Re: [PATCH RESEND v5 17/25] drm/msm/dp: add link_ready to manage link-level operations

From: Yongxing Mou

Date: Wed Aug 26 2026 - 03:51:31 EST




On 7/13/2026 7:46 AM, Dmitry Baryshkov wrote:
On Mon, Jun 29, 2026 at 10:14:38PM +0800, Yongxing Mou wrote:
In MST mode, multiple streams share the same DP link. Track a link_ready
state so msm_dp_display_prepare_link() runs only once per link and
repeated calls are skipped.

Signed-off-by: Abhinav Kumar <quic_abhinavk@xxxxxxxxxxx>
Signed-off-by: Yongxing Mou <yongxing.mou@xxxxxxxxxxxxxxxx>
---
drivers/gpu/drm/msm/dp/dp_display.c | 42 ++++++++++++++++++++++++-------------
drivers/gpu/drm/msm/dp/dp_display.h | 1 +
2 files changed, 29 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
index 2a74302bcb7c..d56ee10ee065 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -702,6 +702,9 @@ int msm_dp_display_prepare_link(struct msm_dp *msm_dp_display)
if (msm_dp_display->is_edp)
msm_dp_hpd_plug_handle(dp);
+ if (msm_dp_display->link_ready)
+ return 0;
+

What kind of locking is protecting this variable? What prevents it from
being accessed concurrently?

In MST, the entire function is protected by mst_lock, so concurrent access to this variable is serialized.
rc = pm_runtime_resume_and_get(&msm_dp_display->pdev->dev);
if (rc) {
DRM_ERROR("failed to pm_runtime_resume\n");
@@ -714,14 +717,18 @@ int msm_dp_display_prepare_link(struct msm_dp *msm_dp_display)
if (!msm_dp_display->active_stream_cnt) {
msm_dp_display_host_phy_init(dp);
force_link_train = true;
+
+ rc = msm_dp_ctrl_on_link(dp->ctrl, dp->panel);
+ if (rc)
+ DRM_ERROR("Failed link training (rc=%d)\n", rc);
+ // TODO: schedule drm_connector_set_link_status_property()
}
- rc = msm_dp_ctrl_on_link(dp->ctrl, dp->panel);
- if (rc)
- DRM_ERROR("Failed link training (rc=%d)\n", rc);
- // TODO: schedule drm_connector_set_link_status_property()

Why is it being moved now rather than in the patch where
active_stream_cnt was introduced?

Got it. will move to that part
+ rc = msm_dp_ctrl_prepare_stream_on(dp->ctrl, dp->panel, force_link_train);
+ if (!rc)
+ msm_dp_display->link_ready = true;
- return msm_dp_ctrl_prepare_stream_on(dp->ctrl, dp->panel, force_link_train);
+ return rc;
}
static int msm_dp_display_enable(struct msm_dp_display_private *dp,

diff --git a/drivers/gpu/drm/msm/dp/dp_display.h b/drivers/gpu/drm/msm/dp/dp_display.h
index 676213a48089..0464f8941e8d 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.h
+++ b/drivers/gpu/drm/msm/dp/dp_display.h
@@ -22,6 +22,7 @@ struct msm_dp {
bool mst_active;
unsigned int connector_type;
bool is_edp;
+ bool link_ready;

Please group the status variables together.

Got it.
struct msm_dp_audio *msm_dp_audio;
bool psr_supported;

--
2.43.0