Skip to content

Commit 93c97bc

Browse files
superna9999lumag
authored andcommitted
drm/msm: dsi: fix PLL init in bonded mode
When in bonded DSI mode, only one PLL in one DSI PHY is used for both DSI PHYs, meaning that parents of the secondary DSI PHY will use the primary DSI PHY PLL as parent. In this case the primary DSI PHY PLL will be set even if the primary DSI PHY is not yet enabled. The DSI PHY code has support for this particular use-case and will handle the fact the PLL was already set when initializing the primary DSI PHY. By introducing a protected variable pll_enable_cnt in the commit cb55f39 ("drm/msm/dsi/phy: Fix reading zero as PLL rates when unprepared"), this variable is only initially set to 1 when the DSI PHY is initialized making it impossible to set the PLL before, breaking the bonded DSI use case by returning 0 when setting the PLL from the secondary DSI PHY driver and skipping the correct clocks initialization. But since it was already possible to set the PLL without enabling the DSI PHY, just drop the pll_enable_cnt setting from the PHY enable/disable and simply increment/decrement the pll_enable_cnt variable from the dsi_pll_enable/disable_pll_bias to make sure any PLL operation is done with the PLL BIAS enabled. Fixes: cb55f39 ("drm/msm/dsi/phy: Fix reading zero as PLL rates when unprepared") Closes: https://lore.kernel.org/all/[email protected]/ Tested-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Neil Armstrong <[email protected]> Reviewed-by: Dmitry Baryshkov <[email protected]> Patchwork: https://patchwork.freedesktop.org/patch/683688/ Link: https://lore.kernel.org/r/20251027-topic-sm8x50-fix-dsi-bonded-v1-1-a477cd3f907d@linaro.org Signed-off-by: Dmitry Baryshkov <[email protected]>
1 parent 00d5f09 commit 93c97bc

File tree

2 files changed

+2
-17
lines changed

2 files changed

+2
-17
lines changed

drivers/gpu/drm/msm/dsi/phy/dsi_phy.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ struct msm_dsi_phy {
109109
struct msm_dsi_dphy_timing timing;
110110
const struct msm_dsi_phy_cfg *cfg;
111111
void *tuning_cfg;
112-
void *pll_data;
113112

114113
enum msm_dsi_phy_usecase usecase;
115114
bool regulator_ldo_mode;

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

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -426,11 +426,8 @@ static void dsi_pll_enable_pll_bias(struct dsi_pll_7nm *pll)
426426
u32 data;
427427

428428
spin_lock_irqsave(&pll->pll_enable_lock, flags);
429-
if (pll->pll_enable_cnt++) {
430-
spin_unlock_irqrestore(&pll->pll_enable_lock, flags);
431-
WARN_ON(pll->pll_enable_cnt == INT_MAX);
432-
return;
433-
}
429+
pll->pll_enable_cnt++;
430+
WARN_ON(pll->pll_enable_cnt == INT_MAX);
434431

435432
data = readl(pll->phy->base + REG_DSI_7nm_PHY_CMN_CTRL_0);
436433
data |= DSI_7nm_PHY_CMN_CTRL_0_PLL_SHUTDOWNB;
@@ -876,7 +873,6 @@ static int dsi_pll_7nm_init(struct msm_dsi_phy *phy)
876873
spin_lock_init(&pll_7nm->pll_enable_lock);
877874

878875
pll_7nm->phy = phy;
879-
phy->pll_data = pll_7nm;
880876

881877
ret = pll_7nm_register(pll_7nm, phy->provided_clocks->hws);
882878
if (ret) {
@@ -965,10 +961,8 @@ static int dsi_7nm_phy_enable(struct msm_dsi_phy *phy,
965961
u32 const delay_us = 5;
966962
u32 const timeout_us = 1000;
967963
struct msm_dsi_dphy_timing *timing = &phy->timing;
968-
struct dsi_pll_7nm *pll = phy->pll_data;
969964
void __iomem *base = phy->base;
970965
bool less_than_1500_mhz;
971-
unsigned long flags;
972966
u32 vreg_ctrl_0, vreg_ctrl_1, lane_ctrl0;
973967
u32 glbl_pemph_ctrl_0;
974968
u32 glbl_str_swi_cal_sel_ctrl, glbl_hstx_str_ctrl_0;
@@ -1090,13 +1084,10 @@ static int dsi_7nm_phy_enable(struct msm_dsi_phy *phy,
10901084
glbl_rescode_bot_ctrl = 0x3c;
10911085
}
10921086

1093-
spin_lock_irqsave(&pll->pll_enable_lock, flags);
1094-
pll->pll_enable_cnt = 1;
10951087
/* de-assert digital and pll power down */
10961088
data = DSI_7nm_PHY_CMN_CTRL_0_DIGTOP_PWRDN_B |
10971089
DSI_7nm_PHY_CMN_CTRL_0_PLL_SHUTDOWNB;
10981090
writel(data, base + REG_DSI_7nm_PHY_CMN_CTRL_0);
1099-
spin_unlock_irqrestore(&pll->pll_enable_lock, flags);
11001091

11011092
/* Assert PLL core reset */
11021093
writel(0x00, base + REG_DSI_7nm_PHY_CMN_PLL_CNTRL);
@@ -1209,9 +1200,7 @@ static bool dsi_7nm_set_continuous_clock(struct msm_dsi_phy *phy, bool enable)
12091200

12101201
static void dsi_7nm_phy_disable(struct msm_dsi_phy *phy)
12111202
{
1212-
struct dsi_pll_7nm *pll = phy->pll_data;
12131203
void __iomem *base = phy->base;
1214-
unsigned long flags;
12151204
u32 data;
12161205

12171206
DBG("");
@@ -1238,11 +1227,8 @@ static void dsi_7nm_phy_disable(struct msm_dsi_phy *phy)
12381227
writel(data, base + REG_DSI_7nm_PHY_CMN_CTRL_0);
12391228
writel(0, base + REG_DSI_7nm_PHY_CMN_LANE_CTRL0);
12401229

1241-
spin_lock_irqsave(&pll->pll_enable_lock, flags);
1242-
pll->pll_enable_cnt = 0;
12431230
/* Turn off all PHY blocks */
12441231
writel(0x00, base + REG_DSI_7nm_PHY_CMN_CTRL_0);
1245-
spin_unlock_irqrestore(&pll->pll_enable_lock, flags);
12461232

12471233
/* make sure phy is turned off */
12481234
wmb();

0 commit comments

Comments
 (0)