[PATCH v5 11/25] drm/msm/dp: move link-level teardown from display_disable to display_unprepare

From: Yongxing Mou

Date: Mon Jun 29 2026 - 09:31:21 EST


From: Abhinav Kumar <quic_abhinavk@xxxxxxxxxxx>

msm_dp_display_disable() currently mixes stream-level shutdown
(disable VSC SDP, off pixel clk, clear power_on) with link-level
teardown (PSM config when sink_count==0, off_link, PHY re-init or
host PHY exit).

For DP MST the same link is shared across multiple streams, so
disabling one stream must not tear down the link. Move the
link-level steps into msm_dp_display_unprepare() so that
display_disable() handles only the per-stream sequence, mirroring
the split already present on the prepare path
(display_prepare_link vs display_set_mode / display_enable).

SST behaviour is unchanged: atomic_post_disable() still calls
display_disable() followed by display_unprepare() in the same
order, and the cached dp->panel used inside unprepare is the same
panel that was previously passed in.

Signed-off-by: Abhinav Kumar <quic_abhinavk@xxxxxxxxxxx>
Signed-off-by: Yongxing Mou <yongxing.mou@xxxxxxxxxxxxxxxx>
---
drivers/gpu/drm/msm/dp/dp_display.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
index 1af56c84b82e..1680a67284a7 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -731,18 +731,6 @@ static int msm_dp_display_disable(struct msm_dp_display_private *dp,

msm_dp_ctrl_off_pixel_clk(dp->ctrl, msm_dp_panel->stream_id);

- /* dongle is still connected but sinks are disconnected */
- if (dp->link->sink_count == 0)
- msm_dp_link_psm_config(dp->link, &msm_dp_panel->link_info, true);
-
- msm_dp_ctrl_off_link(dp->ctrl, dp->panel);
-
- if (dp->link->sink_count == 0)
- /* re-init the PHY so that we can listen to Dongle disconnect */
- msm_dp_ctrl_reinit_phy(dp->ctrl);
- else
- msm_dp_display_host_phy_exit(dp);
-
msm_dp_display->power_on = false;

drm_dbg_dp(dp->drm_dev, "sink count: %d\n", dp->link->sink_count);
@@ -1533,6 +1521,18 @@ static void msm_dp_display_unprepare(struct msm_dp_display_private *dp)
{
struct msm_dp *msm_dp_display = &dp->msm_dp_display;

+ /* dongle is still connected but sinks are disconnected */
+ if (dp->link->sink_count == 0)
+ msm_dp_link_psm_config(dp->link, &dp->panel->link_info, true);
+
+ msm_dp_ctrl_off_link(dp->ctrl, dp->panel);
+
+ if (dp->link->sink_count == 0)
+ /* re-init the PHY so that we can listen to Dongle disconnect */
+ msm_dp_ctrl_reinit_phy(dp->ctrl);
+ else
+ msm_dp_display_host_phy_exit(dp);
+
pm_runtime_put_sync(&msm_dp_display->pdev->dev);

drm_dbg_dp(dp->drm_dev, "type=%d Done\n", msm_dp_display->connector_type);

--
2.43.0