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 <huaibiny@codeaurora.org>
This commit is contained in:
Huaibin Yang 2012-12-10 14:04:00 -08:00 committed by Stephen Boyd
parent d32249627a
commit de2a059487
2 changed files with 15 additions and 7 deletions

View file

@ -1715,7 +1715,9 @@ void mdp_clk_ctrl(int on)
mdp_clk_cnt--; mdp_clk_cnt--;
if (mdp_clk_cnt == 0) if (mdp_clk_cnt == 0)
mdp_clk_disable_unprepare(); 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); pr_debug("%s: on=%d cnt=%d\n", __func__, on, mdp_clk_cnt);
mutex_unlock(&mdp_suspend_mutex); mutex_unlock(&mdp_suspend_mutex);

View file

@ -61,6 +61,7 @@ static struct vsycn_ctrl {
struct msm_fb_data_type *mfd; struct msm_fb_data_type *mfd;
struct mdp4_overlay_pipe *base_pipe; struct mdp4_overlay_pipe *base_pipe;
struct vsync_update vlist[2]; struct vsync_update vlist[2];
struct work_struct clk_work;
} vsync_ctrl_db[MAX_CONTROLLER]; } vsync_ctrl_db[MAX_CONTROLLER];
static void vsync_irq_enable(int intr, int term) 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); mdp4_mixer_stage_commit(mixer);
pipe = vctrl->base_pipe; pipe = vctrl->base_pipe;
@ -400,6 +403,13 @@ int mdp4_wfd_pipe_commit(struct msm_fb_data_type *mfd,
return cnt; 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) void mdp4_wfd_init(int cndx)
{ {
struct vsycn_ctrl *vctrl; struct vsycn_ctrl *vctrl;
@ -418,6 +428,7 @@ void mdp4_wfd_init(int cndx)
mutex_init(&vctrl->update_lock); mutex_init(&vctrl->update_lock);
init_completion(&vctrl->ov_comp); init_completion(&vctrl->ov_comp);
spin_lock_init(&vctrl->spin_lock); spin_lock_init(&vctrl->spin_lock);
INIT_WORK(&vctrl->clk_work, clk_ctrl_work);
} }
static void mdp4_wfd_wait4ov(int cndx) 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); vsync_irq_disable(INTR_OVERLAY2_DONE, MDP_OVERLAY2_TERM);
vctrl->ov_done++; vctrl->ov_done++;
complete(&vctrl->ov_comp); complete(&vctrl->ov_comp);
schedule_work(&vctrl->clk_work);
pr_debug("%s ovdone interrupt\n", __func__); pr_debug("%s ovdone interrupt\n", __func__);
spin_unlock(&vctrl->spin_lock); 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); mdp4_overlay_mdp_perf_upd(mfd, 1);
mdp_clk_ctrl(1);
mdp4_wfd_pipe_commit(mfd, 0, 1); mdp4_wfd_pipe_commit(mfd, 0, 1);
mdp4_overlay_mdp_perf_upd(mfd, 0); mdp4_overlay_mdp_perf_upd(mfd, 0);
mdp_clk_ctrl(0);
mutex_unlock(&mfd->dma->ov_mutex); mutex_unlock(&mfd->dma->ov_mutex);
} }
static int mdp4_overlay_writeback_register_buffer( static int mdp4_overlay_writeback_register_buffer(