diff --git a/drivers/video/msm/mdp4_overlay_dsi_cmd.c b/drivers/video/msm/mdp4_overlay_dsi_cmd.c index 17551709510d..23e6d1db7ea1 100644 --- a/drivers/video/msm/mdp4_overlay_dsi_cmd.c +++ b/drivers/video/msm/mdp4_overlay_dsi_cmd.c @@ -251,6 +251,7 @@ void mdp4_dsi_cmd_pipe_queue(int cndx, struct mdp4_overlay_pipe *pipe) } static void mdp4_dsi_cmd_blt_ov_update(struct mdp4_overlay_pipe *pipe); +static int mdp4_dsi_cmd_clk_check(struct vsycn_ctrl *vctrl); int mdp4_dsi_cmd_pipe_commit(int cndx, int wait) { @@ -291,6 +292,9 @@ int mdp4_dsi_cmd_pipe_commit(int cndx, int wait) } mutex_unlock(&vctrl->update_lock); + if (mdp4_dsi_cmd_clk_check(vctrl) < 0) + return 0; + /* free previous committed iommu back to pool */ mdp4_overlay_iommu_unmap_freelist(mixer); @@ -1135,35 +1139,16 @@ void mdp_dsi_cmd_overlay_suspend(struct msm_fb_data_type *mfd) } } -void mdp4_dsi_cmd_overlay(struct msm_fb_data_type *mfd) +static int mdp4_dsi_cmd_clk_check(struct vsycn_ctrl *vctrl) { - int cndx = 0; - struct vsycn_ctrl *vctrl; - struct mdp4_overlay_pipe *pipe; - unsigned long flags; int clk_set_on = 0; - - mutex_lock(&mfd->dma->ov_mutex); - vctrl = &vsync_ctrl_db[cndx]; - - if (!mfd->panel_power_on) { - mutex_unlock(&mfd->dma->ov_mutex); - return; - } - - pipe = vctrl->base_pipe; - if (pipe == NULL) { - pr_err("%s: NO base pipe\n", __func__); - mutex_unlock(&mfd->dma->ov_mutex); - return; - } + unsigned long flags; mutex_lock(&vctrl->update_lock); if (atomic_read(&vctrl->suspend)) { mutex_unlock(&vctrl->update_lock); - mutex_unlock(&mfd->dma->ov_mutex); pr_err("%s: suspended, no more pan display\n", __func__); - return; + return -EPERM; } spin_lock_irqsave(&vctrl->spin_lock, flags); @@ -1185,6 +1170,35 @@ void mdp4_dsi_cmd_overlay(struct msm_fb_data_type *mfd) mutex_unlock(&vctrl->update_lock); + return 0; +} + +void mdp4_dsi_cmd_overlay(struct msm_fb_data_type *mfd) +{ + int cndx = 0; + struct vsycn_ctrl *vctrl; + struct mdp4_overlay_pipe *pipe; + + mutex_lock(&mfd->dma->ov_mutex); + vctrl = &vsync_ctrl_db[cndx]; + + if (!mfd->panel_power_on) { + mutex_unlock(&mfd->dma->ov_mutex); + return; + } + + pipe = vctrl->base_pipe; + if (pipe == NULL) { + pr_err("%s: NO base pipe\n", __func__); + mutex_unlock(&mfd->dma->ov_mutex); + return; + } + + if (mdp4_dsi_cmd_clk_check(vctrl) < 0) { + mutex_unlock(&mfd->dma->ov_mutex); + return; + } + if (pipe->mixer_stage == MDP4_MIXER_STAGE_BASE) { mdp4_mipi_vsync_enable(mfd, pipe, 0); mdp4_overlay_setup_pipe_addr(mfd, pipe);