Skip to content

Commit 70f1dcc

Browse files
MarijnS95gregkh
authored andcommitted
drm/msm/dsi: Set PHY usescase (and mode) before registering DSI host
[ Upstream commit 660c396 ] Ordering issues here cause an uninitialized (default STANDALONE) usecase to be programmed (which appears to be a MUX) in some cases when msm_dsi_host_register() is called, leading to the slave PLL in bonded-DSI mode to source from a clock parent (dsi1vco) that is off. This should seemingly not be a problem as the actual dispcc clocks from DSI1 that are muxed in the clock tree of DSI0 are way further down, this bit still seems to have an effect on them somehow and causes the right side of the panel controlled by DSI1 to not function. In an ideal world this code is refactored to no longer have such error-prone calls "across subsystems", and instead model the "PLL src" register field as a regular mux so that changing the clock parents programmatically or in DTS via `assigned-clock-parents` has the desired effect. But for the avid reader, the clocks that we *are* muxing into DSI0's tree are way further down, so if this bit turns out to be a simple mux between dsiXvco and out_div, that shouldn't have any effect as this whole tree is off anyway. Fixes: 57bf433 ("drm/msm/dsi: Pass down use case to PHY") Reviewed-by: Abhinav Kumar <[email protected]> Reviewed-by: Dmitry Baryshkov <[email protected]> Signed-off-by: Marijn Suijten <[email protected]> Patchwork: https://patchwork.freedesktop.org/patch/637650/ Link: https://lore.kernel.org/r/20250217-drm-msm-initial-dualpipe-dsc-fixes-v3-2-913100d6103f@somainline.org Signed-off-by: Dmitry Baryshkov <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 2af52e4 commit 70f1dcc

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

drivers/gpu/drm/msm/dsi/dsi_manager.c

+21-11
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,35 @@ static int dsi_mgr_setup_components(int id)
7474
int ret;
7575

7676
if (!IS_BONDED_DSI()) {
77+
/*
78+
* Set the usecase before calling msm_dsi_host_register(), which would
79+
* already program the PLL source mux based on a default usecase.
80+
*/
81+
msm_dsi_phy_set_usecase(msm_dsi->phy, MSM_DSI_PHY_STANDALONE);
82+
msm_dsi_host_set_phy_mode(msm_dsi->host, msm_dsi->phy);
83+
7784
ret = msm_dsi_host_register(msm_dsi->host);
7885
if (ret)
7986
return ret;
80-
81-
msm_dsi_phy_set_usecase(msm_dsi->phy, MSM_DSI_PHY_STANDALONE);
82-
msm_dsi_host_set_phy_mode(msm_dsi->host, msm_dsi->phy);
8387
} else if (other_dsi) {
8488
struct msm_dsi *master_link_dsi = IS_MASTER_DSI_LINK(id) ?
8589
msm_dsi : other_dsi;
8690
struct msm_dsi *slave_link_dsi = IS_MASTER_DSI_LINK(id) ?
8791
other_dsi : msm_dsi;
92+
93+
/*
94+
* PLL0 is to drive both DSI link clocks in bonded DSI mode.
95+
*
96+
* Set the usecase before calling msm_dsi_host_register(), which would
97+
* already program the PLL source mux based on a default usecase.
98+
*/
99+
msm_dsi_phy_set_usecase(clk_master_dsi->phy,
100+
MSM_DSI_PHY_MASTER);
101+
msm_dsi_phy_set_usecase(clk_slave_dsi->phy,
102+
MSM_DSI_PHY_SLAVE);
103+
msm_dsi_host_set_phy_mode(msm_dsi->host, msm_dsi->phy);
104+
msm_dsi_host_set_phy_mode(other_dsi->host, other_dsi->phy);
105+
88106
/* Register slave host first, so that slave DSI device
89107
* has a chance to probe, and do not block the master
90108
* DSI device's probe.
@@ -98,14 +116,6 @@ static int dsi_mgr_setup_components(int id)
98116
ret = msm_dsi_host_register(master_link_dsi->host);
99117
if (ret)
100118
return ret;
101-
102-
/* PLL0 is to drive both 2 DSI link clocks in bonded DSI mode. */
103-
msm_dsi_phy_set_usecase(clk_master_dsi->phy,
104-
MSM_DSI_PHY_MASTER);
105-
msm_dsi_phy_set_usecase(clk_slave_dsi->phy,
106-
MSM_DSI_PHY_SLAVE);
107-
msm_dsi_host_set_phy_mode(msm_dsi->host, msm_dsi->phy);
108-
msm_dsi_host_set_phy_mode(other_dsi->host, other_dsi->phy);
109119
}
110120

111121
return 0;

0 commit comments

Comments
 (0)