platform: msm8974: Avoid MDSS GDSC enable if already enabled
During display init, check if MDSS GDSC is enabled. Avoid
re-enabling it if already enabled. Also, do proper status
checks to verify that GDSC is properly enabled/disabled as
required.
Change-Id: I5642d5a5c51d6ed5cc2900d2da1f7de275121db1
diff --git a/platform/msm8974/acpuclock.c b/platform/msm8974/acpuclock.c
index 4b1798f..6131e61 100644
--- a/platform/msm8974/acpuclock.c
+++ b/platform/msm8974/acpuclock.c
@@ -340,17 +340,18 @@
uint32_t reg = 0;
reg = readl(MDP_GDSCR);
if (enable) {
- if (reg & 0x1) {
+ if (!(reg & GDSC_POWER_ON_BIT)) {
reg &= ~(BIT(0) | GDSC_EN_FEW_WAIT_MASK);
reg |= GDSC_EN_FEW_WAIT_256_MASK;
writel(reg, MDP_GDSCR);
+ while(!(readl(MDP_GDSCR) & (GDSC_POWER_ON_BIT)));
+ } else {
+ dprintf(INFO, "MDP GDSC already enabled\n");
}
-
- while(readl(MDP_GDSCR) & ((GDSC_POWER_ON_BIT) | (GDSC_POWER_ON_STATUS_BIT)));
} else {
- reg &= ~BIT(0);
+ reg |= BIT(0);
writel(reg, MDP_GDSCR);
- while(!(readl(MDP_GDSCR) & ((GDSC_POWER_ON_BIT))));
+ while(readl(MDP_GDSCR) & (GDSC_POWER_ON_BIT));
}
}