From 4b11a6f021912bcc5e2d50e88154e1215689f547 Mon Sep 17 00:00:00 2001 From: Huaibin Yang Date: Mon, 28 Jan 2013 10:44:10 -0800 Subject: [PATCH] msm_fb: display: add wfd suspend/resume to early suspend wfd on/off was handled by fb_on/fb_close which are called from video or userspace side. However, this is not the case for this branch. mdp driver has to register wfd for suspend to make sure proper panel on/off happen. Change-Id: If1836598e5ae95e4b2b72e40dc85784a0d20c843 Signed-off-by: Huaibin Yang --- drivers/video/msm/mdp.c | 4 +++- drivers/video/msm/mdp4_overlay_writeback.c | 17 ++++++++++++++--- drivers/video/msm/msm_fb.c | 3 +-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/video/msm/mdp.c b/drivers/video/msm/mdp.c index a92a543da309..9922941ab33f 100644 --- a/drivers/video/msm/mdp.c +++ b/drivers/video/msm/mdp.c @@ -1512,7 +1512,7 @@ u32 mdp_get_panel_framerate(struct msm_fb_data_type *mfd) if (frame_rate == 0) { frame_rate = DEFAULT_FRAME_RATE; - pr_warn("%s frame rate=%d is default\n", __func__, frame_rate); + pr_debug("%s frame rate=%d is default\n", __func__, frame_rate); } pr_debug("%s frame rate=%d total_pixel=%d, pixel_rate=%d\n", __func__, frame_rate, total_pixel, pixel_rate); @@ -2325,6 +2325,8 @@ static int mdp_off(struct platform_device *pdev) mfd->panel.type == LCDC_PANEL || mfd->panel.type == LVDS_PANEL) mdp4_lcdc_off(pdev); + else if (mfd->panel.type == WRITEBACK_PANEL) + mdp4_overlay_writeback_off(pdev); mdp_pipe_ctrl(MDP_CMD_BLOCK, MDP_BLOCK_POWER_ON, FALSE); ret = panel_next_off(pdev); diff --git a/drivers/video/msm/mdp4_overlay_writeback.c b/drivers/video/msm/mdp4_overlay_writeback.c index 696685e7eb41..29e148bfd3e4 100644 --- a/drivers/video/msm/mdp4_overlay_writeback.c +++ b/drivers/video/msm/mdp4_overlay_writeback.c @@ -167,9 +167,14 @@ int mdp4_overlay_writeback_on(struct platform_device *pdev) (0x0 & 0xFFF)); /* 12-bit R */ mdp_clk_ctrl(0); + + atomic_set(&vctrl->suspend, 0); + return ret; } +static void mdp4_wfd_wait4ov(int cndx); + int mdp4_overlay_writeback_off(struct platform_device *pdev) { int cndx = 0; @@ -186,17 +191,23 @@ int mdp4_overlay_writeback_off(struct platform_device *pdev) vctrl = &vsync_ctrl_db[cndx]; pipe = vctrl->base_pipe; + + atomic_set(&vctrl->suspend, 1); + if (pipe == NULL) { pr_err("%s: NO base pipe\n", __func__); return ret; } + complete(&vctrl->ov_comp); + msleep(20); + mdp_clk_ctrl(1); /* sanity check, free pipes besides base layer */ mdp4_overlay_unset_mixer(pipe->mixer_num); mdp4_mixer_stage_down(pipe, 1); mdp4_overlay_pipe_free(pipe); vctrl->base_pipe = NULL; - + mdp_clk_ctrl(0); undx = vctrl->update_ndx; vp = &vctrl->vlist[undx]; if (vp->update_cnt) { @@ -322,8 +333,6 @@ void mdp4_wfd_pipe_queue(int cndx, struct mdp4_overlay_pipe *pipe) mdp4_stat.overlay_play[pipe->mixer_num]++; } -static void mdp4_wfd_wait4ov(int cndx); - int mdp4_wfd_pipe_commit(struct msm_fb_data_type *mfd, int cndx, int wait) { @@ -361,6 +370,7 @@ int mdp4_wfd_pipe_commit(struct msm_fb_data_type *mfd, /* free previous committed iommu back to pool */ mdp4_overlay_iommu_unmap_freelist(mixer); + mdp_clk_ctrl(1); pipe = vp->plist; for (i = 0; i < OVERLAY_PIPE_MAX; i++, pipe++) { if (pipe->pipe_used) { @@ -429,6 +439,7 @@ void mdp4_wfd_init(int cndx) vctrl->update_ndx = 0; mutex_init(&vctrl->update_lock); init_completion(&vctrl->ov_comp); + atomic_set(&vctrl->suspend, 1); spin_lock_init(&vctrl->spin_lock); INIT_WORK(&vctrl->clk_work, clk_ctrl_work); } diff --git a/drivers/video/msm/msm_fb.c b/drivers/video/msm/msm_fb.c index 88f19c0caf55..c4fe8ef83a7e 100644 --- a/drivers/video/msm/msm_fb.c +++ b/drivers/video/msm/msm_fb.c @@ -1551,8 +1551,7 @@ static int msm_fb_register(struct msm_fb_data_type *mfd) #ifdef CONFIG_HAS_EARLYSUSPEND if (hdmi_prim_display || - (mfd->panel_info.type != DTV_PANEL && - mfd->panel_info.type != WRITEBACK_PANEL)) { + (mfd->panel_info.type != DTV_PANEL)) { mfd->early_suspend.suspend = msmfb_early_suspend; mfd->early_suspend.resume = msmfb_early_resume; mfd->early_suspend.level = EARLY_SUSPEND_LEVEL_DISABLE_FB - 2;