From 30b06c97b9aac5fb19b00c96e79b7692985d82ac Mon Sep 17 00:00:00 2001 From: Jayant Shekhar Date: Fri, 30 Jan 2015 11:29:07 +0530 Subject: [PATCH] msm: mdss: Synchronize DSI off, BTA status and DSI event handler Currently there will not be a race condition with ESD check and dsi off sequences. But there can be a race condition with dsi_off and DSI event handler as the mutex is removed from dsi_off. Add the mutex back again in dsi_off and BTA status check. Change-Id: I1ae6cccbcf255f5295d1fdb79de140d5615b45ad Signed-off-by: Jayant Shekhar --- drivers/video/fbdev/msm/dsi_status_6g.c | 3 +++ drivers/video/fbdev/msm/mdss_dsi.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/drivers/video/fbdev/msm/dsi_status_6g.c b/drivers/video/fbdev/msm/dsi_status_6g.c index 5b1125876833..2dad6911aa9a 100644 --- a/drivers/video/fbdev/msm/dsi_status_6g.c +++ b/drivers/video/fbdev/msm/dsi_status_6g.c @@ -148,6 +148,7 @@ void mdss_check_dsi_ctrl_status(struct work_struct *work, uint32_t interval) * overlay operations. Need refine this lock for command mode */ + mutex_lock(&ctrl_pdata->mutex); mutex_lock(&ctl->offlock); if (mipi->mode == DSI_CMD_MODE) mutex_lock(&mdp5_data->ov_lock); @@ -157,6 +158,7 @@ void mdss_check_dsi_ctrl_status(struct work_struct *work, uint32_t interval) if (mipi->mode == DSI_CMD_MODE) mutex_unlock(&mdp5_data->ov_lock); mutex_unlock(&ctl->offlock); + mutex_unlock(&ctrl_pdata->mutex); pr_err("%s: DSI turning off, avoiding panel status check\n", __func__); return; @@ -184,6 +186,7 @@ void mdss_check_dsi_ctrl_status(struct work_struct *work, uint32_t interval) if (mipi->mode == DSI_CMD_MODE) mutex_unlock(&mdp5_data->ov_lock); mutex_unlock(&ctl->offlock); + mutex_unlock(&ctrl_pdata->mutex); if ((pstatus_data->mfd->panel_power_state == MDSS_PANEL_POWER_ON)) { if (ret > 0) diff --git a/drivers/video/fbdev/msm/mdss_dsi.c b/drivers/video/fbdev/msm/mdss_dsi.c index 53150c1761c7..b08f045a7b82 100644 --- a/drivers/video/fbdev/msm/mdss_dsi.c +++ b/drivers/video/fbdev/msm/mdss_dsi.c @@ -548,6 +548,7 @@ static int mdss_dsi_off(struct mdss_panel_data *pdata, int power_state) ctrl_pdata = container_of(pdata, struct mdss_dsi_ctrl_pdata, panel_data); + mutex_lock(&ctrl_pdata->mutex); panel_info = &ctrl_pdata->panel_data.panel_info; pr_debug("%s+: ctrl=%p ndx=%d power_state=%d\n", @@ -590,6 +591,7 @@ panel_power_ctrl: panel_info->mipi.frame_rate = panel_info->new_fps; end: + mutex_unlock(&ctrl_pdata->mutex); pr_debug("%s-:\n", __func__); return ret;