After resume from warm boot/G3, immediately force a topology link address
reprobe to ensure all MST ports are properly detected. This works around a
race condition where some MST hubs incorrectly report port status bits before
their internal state is fully initialized.

By forcing the reprobe immediately after resume, combined with the fix in
drm_dp_mst_handle_link_address_port() that detects input->output port
transitions, we ensure that all displays are reliably detected even if the
hub initially reports incorrect port status.

Signed-off-by: FNU VISHWANATHA <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_dp.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_dp.c 
b/drivers/gpu/drm/i915/display/intel_dp.c
index 3a67990411b3..fceda523efa3 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -7088,6 +7088,7 @@ void intel_dp_mst_resume(struct intel_display *display)
 
        for_each_intel_encoder(display->drm, encoder) {
                struct intel_dp *intel_dp;
+               struct drm_dp_mst_branch *mstb;
                int ret;
 
                if (encoder->type != INTEL_OUTPUT_DDI)
@@ -7102,6 +7103,23 @@ void intel_dp_mst_resume(struct intel_display *display)
                if (ret) {
                        intel_dp->is_mst = false;
                        drm_dp_mst_topology_mgr_set_mst(&intel_dp->mst.mgr, 
false);
+                       continue;
+               }
+
+               /* After resume, force a link address reprobe to ensure all 
ports
+                * are properly detected. This works around a race condition 
where
+                * some MST hubs incorrectly report port status bits during 
warm boot/G3.
+                * Ref: Sporadic second display not detected after warm boot/G3
+                */
+               if (intel_dp->is_mst) {
+                       mutex_lock(&intel_dp->mst.mgr.lock);
+                       mstb = intel_dp->mst.mgr.mst_primary;
+                       if (mstb) {
+                               drm_dp_mst_topology_get_mstb(mstb);
+                               mstb->link_address_sent = false;
+                               drm_dp_mst_topology_put_mstb(mstb);
+                       }
+                       mutex_unlock(&intel_dp->mst.mgr.lock);
                }
        }
 }
-- 
2.34.1

Reply via email to