msm_fb: hdmi: Break infinite loop
Currently, if HDMI PLL lock fails, it will retry. It retries until
the PLL is locked. This may result in infinite loop. This change will
limit the retries to max 10.
Change-Id: I1745643cba7bbc5272f1252208759a83258e9fcb
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
diff --git a/arch/arm/mach-msm/clock-dss-8960.c b/arch/arm/mach-msm/clock-dss-8960.c
index 7f3646f..49b6cf7 100644
--- a/arch/arm/mach-msm/clock-dss-8960.c
+++ b/arch/arm/mach-msm/clock-dss-8960.c
@@ -98,6 +98,7 @@
unsigned int val;
u32 ahb_en_reg, ahb_enabled;
unsigned int timeout_count;
+ int pll_lock_retry = 10;
ahb_en_reg = readl_relaxed(AHB_EN_REG);
ahb_enabled = ahb_en_reg & BIT(4);
@@ -149,7 +150,7 @@
timeout_count = 1000;
while (!(readl_relaxed(HDMI_PHY_PLL_STATUS0) & BIT(0)) &&
- timeout_count) {
+ timeout_count && pll_lock_retry) {
if (--timeout_count == 0) {
/*
* PLL has still not locked.
@@ -166,16 +167,18 @@
udelay(10);
writel_relaxed(0x0D, HDMI_PHY_PLL_LOCKDET_CFG2);
timeout_count = 1000;
-
- pr_err("%s: PLL not locked after %d iterations\n",
- __func__, timeout_count);
- pr_err("%s: Asserting PLL S/W reset & trying again\n",
- __func__);
+ pll_lock_retry--;
}
}
if (!ahb_enabled)
writel_relaxed(ahb_en_reg & ~BIT(4), AHB_EN_REG);
+
+ if (!pll_lock_retry) {
+ pr_err("%s: HDMI PLL not locked\n", __func__);
+ return -EAGAIN;
+ }
+
hdmi_pll_on = 1;
return 0;
}