From de2a0594873b0fb0ecfec087b7362fd3580e5621 Mon Sep 17 00:00:00 2001 From: Huaibin Yang Date: Mon, 10 Dec 2012 14:04:00 -0800 Subject: [PATCH] msm_fb: display: add wfd clk ctrl in pipe_commit mdp_clk_ctrl on is not called when commit is from overlay commit path which can cause mdp hang. mdp_clk_ctrl off should be after mdp overlay2 is done, so schedule a work in overlay2 done isr. Change-Id: I94fd08da27cfda114f5cc0056a5103f0a9b772f6 Signed-off-by: Huaibin Yang --- drivers/video/msm/mdp.c | 4 +++- drivers/video/msm/mdp4_overlay_writeback.c | 18 ++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/video/msm/mdp.c b/drivers/video/msm/mdp.c index 7b8493d37632..0960cc3d308e 100644 --- a/drivers/video/msm/mdp.c +++ b/drivers/video/msm/mdp.c @@ -1715,7 +1715,9 @@ void mdp_clk_ctrl(int on) mdp_clk_cnt--; if (mdp_clk_cnt == 0) mdp_clk_disable_unprepare(); - } + } else + pr_err("%s: %d: mdp clk off is invalid\n", + __func__, __LINE__); } pr_debug("%s: on=%d cnt=%d\n", __func__, on, mdp_clk_cnt); mutex_unlock(&mdp_suspend_mutex); diff --git a/drivers/video/msm/mdp4_overlay_writeback.c b/drivers/video/msm/mdp4_overlay_writeback.c index 42b748c93b98..bd20e8215185 100644 --- a/drivers/video/msm/mdp4_overlay_writeback.c +++ b/drivers/video/msm/mdp4_overlay_writeback.c @@ -61,6 +61,7 @@ static struct vsycn_ctrl { struct msm_fb_data_type *mfd; struct mdp4_overlay_pipe *base_pipe; struct vsync_update vlist[2]; + struct work_struct clk_work; } vsync_ctrl_db[MAX_CONTROLLER]; static void vsync_irq_enable(int intr, int term) @@ -376,6 +377,8 @@ int mdp4_wfd_pipe_commit(struct msm_fb_data_type *mfd, } } + mdp_clk_ctrl(1); + mdp4_mixer_stage_commit(mixer); pipe = vctrl->base_pipe; @@ -400,6 +403,13 @@ int mdp4_wfd_pipe_commit(struct msm_fb_data_type *mfd, return cnt; } +static void clk_ctrl_work(struct work_struct *work) +{ + struct vsycn_ctrl *vctrl = + container_of(work, typeof(*vctrl), clk_work); + mdp_clk_ctrl(0); +} + void mdp4_wfd_init(int cndx) { struct vsycn_ctrl *vctrl; @@ -418,6 +428,7 @@ void mdp4_wfd_init(int cndx) mutex_init(&vctrl->update_lock); init_completion(&vctrl->ov_comp); spin_lock_init(&vctrl->spin_lock); + INIT_WORK(&vctrl->clk_work, clk_ctrl_work); } static void mdp4_wfd_wait4ov(int cndx) @@ -451,7 +462,7 @@ void mdp4_overlay2_done_wfd(struct mdp_dma_data *dma) vsync_irq_disable(INTR_OVERLAY2_DONE, MDP_OVERLAY2_TERM); vctrl->ov_done++; complete(&vctrl->ov_comp); - + schedule_work(&vctrl->clk_work); pr_debug("%s ovdone interrupt\n", __func__); spin_unlock(&vctrl->spin_lock); } @@ -476,16 +487,11 @@ void mdp4_writeback_overlay(struct msm_fb_data_type *mfd) mdp4_overlay_mdp_perf_upd(mfd, 1); - mdp_clk_ctrl(1); - mdp4_wfd_pipe_commit(mfd, 0, 1); mdp4_overlay_mdp_perf_upd(mfd, 0); - mdp_clk_ctrl(0); - mutex_unlock(&mfd->dma->ov_mutex); - } static int mdp4_overlay_writeback_register_buffer(