Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2869f7a1 authored by Lei Chen's avatar Lei Chen Committed by Nirmal Abraham
Browse files

msm: mdss: Fix incorrect handle of vsync for SPI display



SPI can't report vsync event to user space correctly due to
incorrect count and unbalanced handling of the TE interrupt.

Change-Id: Ic0f46216e17c7f92c6d05a66653cfd98c0e775fb
Signed-off-by: default avatarLei Chen <chenlei@codeaurora.org>
Signed-off-by: default avatarRaghavendra Ambadas <rambad@codeaurora.org>
parent 79ac7827
Loading
Loading
Loading
Loading
+15 −14
Original line number Diff line number Diff line
@@ -463,10 +463,7 @@ int is_spi_panel_continuous_splash_on(struct mdss_panel_data *pdata)
void enable_spi_panel_te_irq(struct spi_panel_data *ctrl_pdata,
							bool enable)
{
	static bool is_enabled = true;

	if (is_enabled == enable)
		return;
	static int te_irq_count;

	if (!gpio_is_valid(ctrl_pdata->disp_te_gpio)) {
		pr_err("%s:%d,SPI panel TE GPIO not configured\n",
@@ -474,13 +471,19 @@ void enable_spi_panel_te_irq(struct spi_panel_data *ctrl_pdata,
		return;
	}

	if (enable)
	mutex_lock(&ctrl_pdata->te_mutex);

	if (enable) {
		if (++te_irq_count == 1)
			enable_irq(gpio_to_irq(ctrl_pdata->disp_te_gpio));
	else
	} else {
		if (--te_irq_count == 0)
			disable_irq(gpio_to_irq(ctrl_pdata->disp_te_gpio));
	}

	is_enabled = enable;
	mutex_unlock(&ctrl_pdata->te_mutex);
}

#ifdef TARGET_HW_MDSS_MDP3
int mdss_spi_panel_kickoff(struct mdss_panel_data *pdata,
			char __iomem *buf, int len, int dma_stride)
@@ -1477,14 +1480,14 @@ static irqreturn_t spi_panel_te_handler(int irq, void *data)
{
	struct spi_panel_data *ctrl_pdata = (struct spi_panel_data *)data;
	ktime_t vsync_time;

	static int te_count;
	complete(&ctrl_pdata->spi_panel_te);

	if (ctrl_pdata->vsync_enable && (ctrl_pdata->te_count ==
	if (ctrl_pdata->vsync_enable && (++te_count ==
				ctrl_pdata->vsync_per_te)) {
		vsync_time = ktime_get();
		mdss_spi_display_handle_vsync(ctrl_pdata, vsync_time);
		ctrl_pdata->te_count = 0;
		te_count = 0;
	}

	return IRQ_HANDLED;
@@ -1500,7 +1503,6 @@ void mdss_spi_vsync_enable(struct mdss_panel_data *pdata, int enable)

	ctrl_pdata = container_of(pdata, struct spi_panel_data,
					panel_data);
	mutex_lock(&ctrl_pdata->te_mutex);
	if (enable) {
		if (ctrl_pdata->vsync_enable == false) {
			enable_spi_panel_te_irq(ctrl_pdata, true);
@@ -1512,7 +1514,6 @@ void mdss_spi_vsync_enable(struct mdss_panel_data *pdata, int enable)
			ctrl_pdata->vsync_enable = false;
		}
	}
	mutex_unlock(&ctrl_pdata->te_mutex);
}

static struct device_node *mdss_spi_pref_prim_panel(
+0 −2
Original line number Diff line number Diff line
@@ -144,8 +144,6 @@ struct spi_panel_data {
	bool vsync_enable;
	struct kernfs_node *vsync_event_sd;
	unsigned char *return_buf;
	int te_count;

	struct blocking_notifier_head notifier_head;
};