diff --git a/drivers/video/fbdev/msm/mdss_mdp_cdm.c b/drivers/video/fbdev/msm/mdss_mdp_cdm.c index f1d1bdd301e3..10928e6bceaa 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_cdm.c +++ b/drivers/video/fbdev/msm/mdss_mdp_cdm.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved. +/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -377,6 +377,17 @@ int mdss_mdp_cdm_destroy(struct mdss_mdp_cdm *cdm) return -EINVAL; } + mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_ON); + mutex_lock(&cdm->lock); + /* Disable HDMI packer */ + writel_relaxed(0x0, cdm->base + MDSS_MDP_REG_CDM_HDMI_PACK_OP_MODE); + + /* Put CDM in bypass */ + writel_relaxed(0x0, cdm->mdata->mdp_base + MDSS_MDP_MDP_OUT_CTL_0); + + mutex_unlock(&cdm->lock); + mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_OFF); + kref_put(&cdm->kref, mdss_mdp_cdm_free); return rc; diff --git a/drivers/video/fbdev/msm/mdss_mdp_intf_video.c b/drivers/video/fbdev/msm/mdss_mdp_intf_video.c index ea55203afc51..39233b8ad3a4 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_intf_video.c +++ b/drivers/video/fbdev/msm/mdss_mdp_intf_video.c @@ -1071,6 +1071,13 @@ static int mdss_mdp_video_stop(struct mdss_mdp_ctl *ctl, int panel_power_state) { int intfs_num, ret = 0; + if (ctl->cdm) { + if (!mdss_mdp_cdm_destroy(ctl->cdm)) + mdss_mdp_ctl_write(ctl, + MDSS_MDP_REG_CTL_FLUSH, BIT(26)); + ctl->cdm = NULL; + } + intfs_num = ctl->intf_num - MDSS_MDP_INTF0; ret = mdss_mdp_video_intfs_stop(ctl, ctl->panel_data, intfs_num); if (IS_ERR_VALUE(ret)) { @@ -1083,10 +1090,6 @@ static int mdss_mdp_video_stop(struct mdss_mdp_ctl *ctl, int panel_power_state) mdss_mdp_ctl_reset(ctl, false); ctl->intf_ctx[MASTER_CTX] = NULL; - if (ctl->cdm) { - mdss_mdp_cdm_destroy(ctl->cdm); - ctl->cdm = NULL; - } return 0; } diff --git a/drivers/video/fbdev/msm/mdss_mdp_intf_writeback.c b/drivers/video/fbdev/msm/mdss_mdp_intf_writeback.c index 87ed56028edd..9b63499e64b0 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_intf_writeback.c +++ b/drivers/video/fbdev/msm/mdss_mdp_intf_writeback.c @@ -792,7 +792,9 @@ static int mdss_mdp_writeback_stop(struct mdss_mdp_ctl *ctl, } if (ctl->cdm) { - mdss_mdp_cdm_destroy(ctl->cdm); + if (!mdss_mdp_cdm_destroy(ctl->cdm)) + mdss_mdp_ctl_write(ctl, + MDSS_MDP_REG_CTL_FLUSH, BIT(26)); ctl->cdm = NULL; } return 0;