drm/i915/dp_mst: Ensure link parameters are up-to-date for a disabled link
authorImre Deak <imre.deak@intel.com>
Mon, 22 Jul 2024 16:55:02 +0000 (19:55 +0300)
committerImre Deak <imre.deak@intel.com>
Wed, 31 Jul 2024 15:45:59 +0000 (18:45 +0300)
As explained in the previous patch, the MST link BW reported by branch
devices during topology probing/path resources enumeration depends on
the link parameters programmed to DPCD to be up-to-date. After a sink is
plugged this is not ensured, as those DPCD values start out zeroed. The
target link parameters (for a subsequent modeset) are the maximum that
is supported, so make sure these maximum values are programmed before the
topology probing.

Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240722165503.2084999-14-imre.deak@intel.com
drivers/gpu/drm/i915/display/intel_dp.c
drivers/gpu/drm/i915/display/intel_dp_mst.c
drivers/gpu/drm/i915/display/intel_dp_mst.h

index 5523469404f93d699a72fe400ca5f60f653b4ec3..09789d62001f7341d587608be8c16520681caf5c 100644 (file)
@@ -4254,6 +4254,9 @@ intel_dp_mst_configure(struct intel_dp *intel_dp)
 
        intel_dp->is_mst = intel_dp->mst_detect != DRM_DP_SST;
 
+       if (intel_dp->is_mst)
+               intel_dp_mst_prepare_probe(intel_dp);
+
        drm_dp_mst_topology_mgr_set_mst(&intel_dp->mst_mgr, intel_dp->is_mst);
 
        /* Avoid stale info on the next detect cycle. */
index 19c8b6878b030a9742c28dd4170c9366401c2550..faee7af0a8a480f7b4fd389ff4713b75193e240f 100644 (file)
@@ -43,6 +43,7 @@
 #include "intel_dp_hdcp.h"
 #include "intel_dp_mst.h"
 #include "intel_dp_tunnel.h"
+#include "intel_dp_link_training.h"
 #include "intel_dpio_phy.h"
 #include "intel_hdcp.h"
 #include "intel_hotplug.h"
@@ -2031,3 +2032,33 @@ bool intel_dp_mst_crtc_needs_modeset(struct intel_atomic_state *state,
 
        return false;
 }
+
+/**
+ * intel_dp_mst_prepare_probe - Prepare an MST link for topology probing
+ * @intel_dp: DP port object
+ *
+ * Prepare an MST link for topology probing, programming the target
+ * link parameters to DPCD. This step is a requirement of the enumaration
+ * of path resources during probing.
+ */
+void intel_dp_mst_prepare_probe(struct intel_dp *intel_dp)
+{
+       int link_rate = intel_dp_max_link_rate(intel_dp);
+       int lane_count = intel_dp_max_lane_count(intel_dp);
+       u8 rate_select;
+       u8 link_bw;
+
+       if (intel_dp->link_trained)
+               return;
+
+       if (intel_mst_probed_link_params_valid(intel_dp, link_rate, lane_count))
+               return;
+
+       intel_dp_compute_rate(intel_dp, link_rate, &link_bw, &rate_select);
+
+       intel_dp_link_training_set_mode(intel_dp, link_rate, false);
+       intel_dp_link_training_set_bw(intel_dp, link_bw, rate_select, lane_count,
+                                     drm_dp_enhanced_frame_cap(intel_dp->dpcd));
+
+       intel_mst_set_probed_link_params(intel_dp, link_rate, lane_count);
+}
index 8ca1d599091c69e176fe3b600dd4283be64c432f..fba76454fa67f34d954fd35e878f5974298b980a 100644 (file)
@@ -27,5 +27,6 @@ int intel_dp_mst_atomic_check_link(struct intel_atomic_state *state,
                                   struct intel_link_bw_limits *limits);
 bool intel_dp_mst_crtc_needs_modeset(struct intel_atomic_state *state,
                                     struct intel_crtc *crtc);
+void intel_dp_mst_prepare_probe(struct intel_dp *intel_dp);
 
 #endif /* __INTEL_DP_MST_H__ */