From bf1475554b50f12429c3a0ee179a51c47f5d1dce Mon Sep 17 00:00:00 2001 From: Ajay Singh Parmar Date: Tue, 13 Jan 2015 12:52:19 -0800 Subject: [PATCH] msm: mdss: clean up ctl during cont splash resolution change During boot-up, if continuous splash screen is enabled, handoff will populate the controller and other structures after reading hardware info. If there is a resolution switch, clear the handoff data so that the data can be reconfigured with new resolution info. Change-Id: Ia524136283711e95879936603bb53c5e8f263ea6 Signed-off-by: Ajay Singh Parmar Signed-off-by: Tatenda Chipeperekwa --- drivers/video/fbdev/msm/mdss_mdp_ctl.c | 3 +- drivers/video/fbdev/msm/mdss_mdp_intf_video.c | 13 +++++- drivers/video/fbdev/msm/mdss_mdp_overlay.c | 43 +++++++++++++++++++ 3 files changed, 57 insertions(+), 2 deletions(-) diff --git a/drivers/video/fbdev/msm/mdss_mdp_ctl.c b/drivers/video/fbdev/msm/mdss_mdp_ctl.c index 029f3c7a7131..9ab9c1a3e9dc 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_ctl.c +++ b/drivers/video/fbdev/msm/mdss_mdp_ctl.c @@ -2417,6 +2417,7 @@ int mdss_mdp_ctl_splash_finish(struct mdss_mdp_ctl *ctl, bool handoff) switch (ctl->panel_data->panel_info.type) { case MIPI_VIDEO_PANEL: case EDP_PANEL: + case DTV_PANEL: return mdss_mdp_video_reconfigure_splash_done(ctl, handoff); case MIPI_CMD_PANEL: return mdss_mdp_cmd_reconfigure_splash_done(ctl, handoff); @@ -3765,7 +3766,7 @@ int mdss_mdp_ctl_stop(struct mdss_mdp_ctl *ctl, int power_state) pr_debug("ctl_num=%d, power_state=%d\n", ctl->num, ctl->power_state); - if (!mdss_mdp_ctl_is_power_on(ctl)) { + if (!ctl->mfd->panel_reconfig && !mdss_mdp_ctl_is_power_on(ctl)) { pr_debug("%s %d already off!\n", __func__, __LINE__); return 0; } diff --git a/drivers/video/fbdev/msm/mdss_mdp_intf_video.c b/drivers/video/fbdev/msm/mdss_mdp_intf_video.c index 1d4fafa2c1cf..6924e6499ac5 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_intf_video.c +++ b/drivers/video/fbdev/msm/mdss_mdp_intf_video.c @@ -1172,7 +1172,12 @@ int mdss_mdp_video_reconfigure_splash_done(struct mdss_mdp_ctl *ctl, int i, ret = 0, off; u32 data, flush; struct mdss_mdp_video_ctx *ctx; - struct mdss_mdp_ctl *sctl = mdss_mdp_get_split_ctl(ctl); + struct mdss_mdp_ctl *sctl; + + if (!ctl) { + pr_err("invalid ctl\n"); + return -ENODEV; + } off = 0; ctx = (struct mdss_mdp_video_ctx *) ctl->intf_ctx[MASTER_CTX]; @@ -1182,8 +1187,14 @@ int mdss_mdp_video_reconfigure_splash_done(struct mdss_mdp_ctl *ctl, } pdata = ctl->panel_data; + if (!pdata) { + pr_err("invalid pdata\n"); + return -ENODEV; + } pdata->panel_info.cont_splash_enabled = 0; + sctl = mdss_mdp_get_split_ctl(ctl); + if (sctl) sctl->panel_data->panel_info.cont_splash_enabled = 0; else if (ctl->panel_data->next && is_pingpong_split(ctl->mfd)) diff --git a/drivers/video/fbdev/msm/mdss_mdp_overlay.c b/drivers/video/fbdev/msm/mdss_mdp_overlay.c index f5d6af2b0881..ef640f4c448f 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_overlay.c +++ b/drivers/video/fbdev/msm/mdss_mdp_overlay.c @@ -4605,6 +4605,46 @@ end: return rc; } +static int mdss_mdp_handoff_cleanup_ctl(struct msm_fb_data_type *mfd) +{ + int rc; + int need_cleanup; + struct mdss_overlay_private *mdp5_data; + + if (!mfd) + return -ENODEV; + + if (mfd->key != MFD_KEY) + return -EINVAL; + + mdp5_data = mfd_to_mdp5_data(mfd); + + mdss_mdp_overlay_free_fb_pipe(mfd); + + mutex_lock(&mdp5_data->list_lock); + need_cleanup = !list_empty(&mdp5_data->pipes_cleanup) || + !list_empty(&mdp5_data->pipes_used); + mutex_unlock(&mdp5_data->list_lock); + + if (need_cleanup) + mdss_mdp_overlay_kickoff(mfd, NULL); + + rc = mdss_mdp_ctl_stop(mdp5_data->ctl, mfd->panel_power_state); + if (!rc) { + if (mdss_fb_is_power_off(mfd)) { + mutex_lock(&mdp5_data->list_lock); + __mdss_mdp_overlay_free_list_purge(mfd); + mutex_unlock(&mdp5_data->list_lock); + } + } + + rc = mdss_mdp_splash_cleanup(mfd, false); + if (rc) + pr_err("%s: failed splash clean up %d\n", __func__, rc); + + return rc; +} + static int mdss_mdp_overlay_off(struct msm_fb_data_type *mfd) { int rc; @@ -4627,6 +4667,9 @@ static int mdss_mdp_overlay_off(struct msm_fb_data_type *mfd) if (!mdss_mdp_ctl_is_power_on(mdp5_data->ctl)) { if (mfd->panel_reconfig) { + if (mfd->panel_info->cont_splash_enabled) + mdss_mdp_handoff_cleanup_ctl(mfd); + mdp5_data->borderfill_enable = false; mdss_mdp_ctl_destroy(mdp5_data->ctl); mdp5_data->ctl = NULL;