Move the link related operations to dp_display_unprepare() and keep only stream related operations in dp_display_disable(). Make dp_display_unprepare() available to other clients such as DP MST. Signed-off-by: Abhinav Kumar <quic_abhinavk@xxxxxxxxxxx> --- drivers/gpu/drm/msm/dp/dp_display.c | 31 ++++++++++++++++--------------- drivers/gpu/drm/msm/dp/dp_display.h | 2 ++ 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index e169cd22db960c0c30707ddbe6a79999dc2a273d..d5b8fd1d4d736ffa7929b9798601dcef0dea5211 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -936,20 +936,8 @@ static int msm_dp_display_disable(struct msm_dp_display_private *dp, msm_dp_ctrl_clear_vsc_sdp_pkt(dp->ctrl, msm_dp_panel); - /* dongle is still connected but sinks are disconnected */ - if (dp->link->sink_count == 0) - msm_dp_ctrl_psm_config(dp->ctrl); - msm_dp_ctrl_stream_clk_off(dp->ctrl, msm_dp_panel); - msm_dp_ctrl_off_link(dp->ctrl); - - /* re-init the PHY so that we can listen to Dongle disconnect */ - if (dp->link->sink_count == 0) - 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); @@ -1678,15 +1666,28 @@ void msm_dp_display_atomic_disable(struct msm_dp *msm_dp) msm_dp_display_disable_helper(msm_dp, msm_dp_display->panel); } -static void msm_dp_display_unprepare(struct msm_dp_display_private *msm_dp_display_priv) +void msm_dp_display_unprepare(struct msm_dp *msm_dp) { - struct msm_dp *msm_dp = &msm_dp_display_priv->msm_dp_display; + struct msm_dp_display_private *msm_dp_display; + msm_dp_display = container_of(msm_dp, struct msm_dp_display_private, msm_dp_display); if (!msm_dp->prepared) { drm_dbg_dp(msm_dp->drm_dev, "Link already setup, return\n"); return; } + /* dongle is still connected but sinks are disconnected */ + if (msm_dp_display->link->sink_count == 0) + msm_dp_ctrl_psm_config(msm_dp_display->ctrl); + + msm_dp_ctrl_off_link(msm_dp_display->ctrl); + + /* re-init the PHY so that we can listen to Dongle disconnect */ + if (msm_dp_display->link->sink_count == 0) + msm_dp_ctrl_reinit_phy(msm_dp_display->ctrl); + else + msm_dp_display_host_phy_exit(msm_dp_display); + pm_runtime_put_sync(&msm_dp->pdev->dev); msm_dp->prepared = false; @@ -1732,7 +1733,7 @@ void msm_dp_display_atomic_post_disable(struct msm_dp *msm_dp) msm_dp_display_atomic_post_disable_helper(msm_dp, msm_dp_display->panel); - msm_dp_display_unprepare(msm_dp_display); + msm_dp_display_unprepare(msm_dp); } void msm_dp_display_mode_set_helper(struct msm_dp *msm_dp, diff --git a/drivers/gpu/drm/msm/dp/dp_display.h b/drivers/gpu/drm/msm/dp/dp_display.h index 2b23f2bf7535d3fd513d40a8411a1903fcd560b0..82eb1c6ed1467b21742bda8eaae9c51d3207e997 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.h +++ b/drivers/gpu/drm/msm/dp/dp_display.h @@ -65,4 +65,6 @@ void msm_dp_display_mode_set_helper(struct msm_dp *msm_dp, void msm_dp_display_atomic_post_disable_helper(struct msm_dp *msm_dp, struct msm_dp_panel *msm_dp_panel); +void msm_dp_display_unprepare(struct msm_dp *dp); + #endif /* _DP_DISPLAY_H_ */ -- 2.34.1