Skip to content

Commit 90b7c1c

Browse files
MarijnS95robclark
authored andcommitted
drm/msm/dsi: dsi_phy_14nm: Take ready-bit into account in poll_for_ready
The downstream driver models this PLL lock check as an if-elseif-else. The only way to reach the else case where pll_locked=true [1] is by succeeding both readl_poll_timeout_atomic calls (which return zero on success) in the if _and_ elseif condition. Hence both the "lock" and "ready" bit need to be tested in the SM_READY_STATUS register before considering the PLL locked and ready to go. Tested on the Sony Xperia XA2 Ultra (nile-discovery, sdm630). [1]: https://source.codeaurora.org/quic/la/kernel/msm-4.19/tree/drivers/clk/qcom/mdss/mdss-dsi-pll-14nm-util.c?h=LA.UM.9.2.1.r1-08000-sdm660.0#n302 Fixes: f079f6d ("drm/msm/dsi: Add PHY/PLL for 8x96") Signed-off-by: Marijn Suijten <[email protected]> Reviewed-by: Dmitry Baryshkov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Baryshkov <[email protected]> Signed-off-by: Rob Clark <[email protected]>
1 parent ad69b73 commit 90b7c1c

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,13 @@ static struct dsi_pll_14nm *pll_14nm_list[DSI_MAX];
110110
static bool pll_14nm_poll_for_ready(struct dsi_pll_14nm *pll_14nm,
111111
u32 nb_tries, u32 timeout_us)
112112
{
113-
bool pll_locked = false;
113+
bool pll_locked = false, pll_ready = false;
114114
void __iomem *base = pll_14nm->phy->pll_base;
115115
u32 tries, val;
116116

117117
tries = nb_tries;
118118
while (tries--) {
119-
val = dsi_phy_read(base +
120-
REG_DSI_14nm_PHY_PLL_RESET_SM_READY_STATUS);
119+
val = dsi_phy_read(base + REG_DSI_14nm_PHY_PLL_RESET_SM_READY_STATUS);
121120
pll_locked = !!(val & BIT(5));
122121

123122
if (pll_locked)
@@ -126,23 +125,24 @@ static bool pll_14nm_poll_for_ready(struct dsi_pll_14nm *pll_14nm,
126125
udelay(timeout_us);
127126
}
128127

129-
if (!pll_locked) {
130-
tries = nb_tries;
131-
while (tries--) {
132-
val = dsi_phy_read(base +
133-
REG_DSI_14nm_PHY_PLL_RESET_SM_READY_STATUS);
134-
pll_locked = !!(val & BIT(0));
128+
if (!pll_locked)
129+
goto out;
135130

136-
if (pll_locked)
137-
break;
131+
tries = nb_tries;
132+
while (tries--) {
133+
val = dsi_phy_read(base + REG_DSI_14nm_PHY_PLL_RESET_SM_READY_STATUS);
134+
pll_ready = !!(val & BIT(0));
138135

139-
udelay(timeout_us);
140-
}
136+
if (pll_ready)
137+
break;
138+
139+
udelay(timeout_us);
141140
}
142141

143-
DBG("DSI PLL is %slocked", pll_locked ? "" : "*not* ");
142+
out:
143+
DBG("DSI PLL is %slocked, %sready", pll_locked ? "" : "*not* ", pll_ready ? "" : "*not* ");
144144

145-
return pll_locked;
145+
return pll_locked && pll_ready;
146146
}
147147

148148
static void dsi_pll_14nm_config_init(struct dsi_pll_config *pconf)

0 commit comments

Comments
 (0)