msm: mdss: refactor ctl layer mixer programing
The layer mixer offset within ctl needs to map to the mixer allocated.
Change-Id: I6caa9d2423f4bfd326ebb4ce1080444fcc40c384
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>
diff --git a/drivers/video/msm/mdss/mdss_mdp_ctl.c b/drivers/video/msm/mdss/mdss_mdp_ctl.c
index e81e3f5..82ebdb8 100644
--- a/drivers/video/msm/mdss/mdss_mdp_ctl.c
+++ b/drivers/video/msm/mdss/mdss_mdp_ctl.c
@@ -41,6 +41,7 @@
static DEFINE_MUTEX(mdss_mdp_ctl_lock);
static int mdss_mdp_mixer_free(struct mdss_mdp_mixer *mixer);
+static inline int __mdss_mdp_ctl_get_mixer_off(struct mdss_mdp_mixer *mixer);
static inline void mdp_mixer_write(struct mdss_mdp_mixer *mixer,
u32 reg, u32 val)
@@ -1043,6 +1044,7 @@
{
struct mdss_mdp_ctl *sctl;
int ret = 0;
+ u32 off;
if (!ctl->power_on) {
pr_debug("%s %d already off!\n", __func__, __LINE__);
@@ -1076,12 +1078,13 @@
mdss_mdp_ctl_write(sctl, MDSS_MDP_REG_CTL_TOP, 0);
if (ctl->mixer_left) {
- mdss_mdp_ctl_write(ctl, MDSS_MDP_REG_CTL_LAYER(
- ctl->mixer_left->num), 0);
+ off = __mdss_mdp_ctl_get_mixer_off(ctl->mixer_left);
+ mdss_mdp_ctl_write(ctl, off, 0);
}
+
if (ctl->mixer_right) {
- mdss_mdp_ctl_write(ctl, MDSS_MDP_REG_CTL_LAYER(
- ctl->mixer_right->num), 0);
+ off = __mdss_mdp_ctl_get_mixer_off(ctl->mixer_right);
+ mdss_mdp_ctl_write(ctl, off, 0);
}
ctl->power_on = false;
@@ -1185,11 +1188,7 @@
ctl->flush_bits |= BIT(6) << mixer->num; /* LAYER_MIXER */
mdp_mixer_write(mixer, MDSS_MDP_REG_LM_OP_MODE, blend_color_out);
- if (mixer->type == MDSS_MDP_MIXER_TYPE_INTF)
- off = MDSS_MDP_REG_CTL_LAYER(mixer->num);
- else
- off = MDSS_MDP_REG_CTL_LAYER(mixer->num +
- MDSS_MDP_INTF_MAX_LAYERMIXER);
+ off = __mdss_mdp_ctl_get_mixer_off(mixer);
mdss_mdp_ctl_write(ctl, off, mixercfg);
return 0;
@@ -1620,3 +1619,11 @@
return mixer_cnt;
}
+static inline int __mdss_mdp_ctl_get_mixer_off(struct mdss_mdp_mixer *mixer)
+{
+ if (mixer->type == MDSS_MDP_MIXER_TYPE_INTF)
+ return MDSS_MDP_REG_CTL_LAYER(mixer->num);
+ else
+ return MDSS_MDP_REG_CTL_LAYER(mixer->num +
+ MDSS_MDP_INTF_MAX_LAYERMIXER);
+}