msm_fb: display: add mutex to dsi_on
During resume, backlight dcs commands to client may be issued
before dsi_on completed. Add mutex to dsi_on and check dsi state
to make sure dsi_on is completed before sending backlight command
to panel to avoid conflict on dsi link. Otherwise screen will
stay blank if confliction happened.
Change-Id: Icfba079b228f02aeb89949befb10cca29bf6d744
Signed-off-by: kuogee hsieh <khsieh@codeaurora.org>
diff --git a/drivers/video/msm/mdp.h b/drivers/video/msm/mdp.h
index c12a250..8817213 100644
--- a/drivers/video/msm/mdp.h
+++ b/drivers/video/msm/mdp.h
@@ -737,6 +737,10 @@
{
/* empty */
}
+static inline int mdp4_overlay_dsi_state_get(void)
+{
+ return 0;
+}
#endif
#endif /* MDP_H */
diff --git a/drivers/video/msm/mdp4.h b/drivers/video/msm/mdp4.h
index d757b5d..0aeb91e 100644
--- a/drivers/video/msm/mdp4.h
+++ b/drivers/video/msm/mdp4.h
@@ -410,6 +410,7 @@
void mdp4_overlay0_done_dsi_cmd(struct mdp_dma_data *dma);
void mdp4_dsi_cmd_overlay(struct msm_fb_data_type *mfd);
void mdp4_overlay_dsi_state_set(int state);
+int mdp4_overlay_dsi_state_get(void);
void mdp4_overlay_rgb_setup(struct mdp4_overlay_pipe *pipe);
void mdp4_overlay_reg_flush(struct mdp4_overlay_pipe *pipe, int all);
void mdp4_mixer_blend_setup(struct mdp4_overlay_pipe *pipe);
diff --git a/drivers/video/msm/mdp4_overlay_dsi_cmd.c b/drivers/video/msm/mdp4_overlay_dsi_cmd.c
index 0020fd5..07322dc 100644
--- a/drivers/video/msm/mdp4_overlay_dsi_cmd.c
+++ b/drivers/video/msm/mdp4_overlay_dsi_cmd.c
@@ -56,6 +56,11 @@
spin_unlock_irqrestore(&mdp_spin_lock, flag);
}
+int mdp4_overlay_dsi_state_get(void)
+{
+ return dsi_state;
+}
+
static void dsi_clock_tout(unsigned long data)
{
if (mipi_dsi_clk_on) {
@@ -530,6 +535,7 @@
/* mutex holded by caller */
if (dsi_mfd && dsi_pipe) {
mdp4_dsi_cmd_dma_busy_wait(dsi_mfd);
+ mipi_dsi_mdp_busy_wait(dsi_mfd);
mdp4_overlay_update_dsi_cmd(dsi_mfd);
if (dsi_pipe->blt_addr)
diff --git a/drivers/video/msm/mipi_dsi.c b/drivers/video/msm/mipi_dsi.c
index 00256e6..aa210f1 100644
--- a/drivers/video/msm/mipi_dsi.c
+++ b/drivers/video/msm/mipi_dsi.c
@@ -137,7 +137,7 @@
else
up(&mfd->dma->mutex);
- pr_debug("%s:\n", __func__);
+ pr_debug("%s-:\n", __func__);
return ret;
}
@@ -171,11 +171,6 @@
clk_rate = mfd->fbi->var.pixclock;
clk_rate = min(clk_rate, mfd->panel_info.clk_max);
-
-#ifndef CONFIG_FB_MSM_MDP303
- mdp4_overlay_dsi_state_set(ST_DSI_RESUME);
-#endif
-
MIPI_OUTP(MIPI_DSI_BASE + 0x114, 1);
MIPI_OUTP(MIPI_DSI_BASE + 0x114, 0);
@@ -266,6 +261,11 @@
wmb();
}
+ if (mdp_rev >= MDP_REV_41)
+ mutex_lock(&mfd->dma->ov_mutex);
+ else
+ down(&mfd->dma->mutex);
+
ret = panel_next_on(pdev);
mipi_dsi_op_mode_config(mipi->mode);
@@ -320,6 +320,16 @@
#ifdef CONFIG_MSM_BUS_SCALING
mdp_bus_scale_update_request(2);
#endif
+
+ mdp4_overlay_dsi_state_set(ST_DSI_RESUME);
+
+ if (mdp_rev >= MDP_REV_41)
+ mutex_unlock(&mfd->dma->ov_mutex);
+ else
+ up(&mfd->dma->mutex);
+
+ pr_debug("%s-:\n", __func__);
+
return ret;
}
diff --git a/drivers/video/msm/mipi_novatek.c b/drivers/video/msm/mipi_novatek.c
index cb4bd1b..5e2e515 100644
--- a/drivers/video/msm/mipi_novatek.c
+++ b/drivers/video/msm/mipi_novatek.c
@@ -439,6 +439,10 @@
return;
mutex_lock(&mfd->dma->ov_mutex);
+ if (mdp4_overlay_dsi_state_get() <= ST_DSI_SUSPEND) {
+ mutex_unlock(&mfd->dma->ov_mutex);
+ return;
+ }
/* mdp4_dsi_cmd_busy_wait: will turn on dsi clock also */
mdp4_dsi_cmd_dma_busy_wait(mfd);
mdp4_dsi_blt_dmap_busy_wait(mfd);