[PATCH 006/108] drm/i915/dp_link_training: Reset link training state on link capability change

Imre Deak
2026-04-28T12:52:56Z

Reset the link training state if the link capabilities change. This
re-enables automatic link retraining after it was disabled following
link training failures when fallback left no usable configuration. The
capability changes may enable a valid configuration, allowing retraining.

Also update the connector detect handler comment to note that link
state recheck may be needed due to re-enabled autoretraining.

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
drivers/gpu/drm/i915/display/intel_dp.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index ef7d5e55cc468..d7c8ace38a01c 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -6439,6 +6439,8 @@ intel_dp_detect(struct drm_connector *_connector,
struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
struct intel_encoder *encoder = &dig_port->base;
enum drm_connector_status status;
+ int old_epoch_counter =
+ connector->base.epoch_counter;
int ret;

drm_dbg_kms(display->drm, "[CONNECTOR:%d:%s]\n",
@@ -6522,6 +6524,8 @@ intel_dp_detect(struct drm_connector *_connector,
if (intel_dp->reset_link_params) {
intel_dp_reset_link_params(intel_dp);
intel_dp->reset_link_params = false;
+ } else if (connector->base.epoch_counter != old_epoch_counter) {
+ intel_dp_link_training_reset(intel_dp->link.training);
}

intel_dp_mst_configure(intel_dp);
@@ -6542,9 +6546,16 @@ intel_dp_detect(struct drm_connector *_connector,
* Some external monitors do not signal loss of link synchronization
* with an IRQ_HPD, so force a link status check.
*
- * TODO: this probably became redundant, so remove it: the link state
- * is rechecked/recovered now after modesets, where the loss of
- * synchronization tends to occur.
+ * NOTE: Handling link synchronization loss here is probably not
+ * needed, since such loss tends to occur right after modesets, and
+ * modesets already schedule a work item to recheck the link state.
+ *
+ * However, if the link is in an active unretrainable state and the
+ * supported link configurations changed, either after an HPD
+ * pulse-triggered link reset (via intel_dp_reset_link_params()) or
+ * after a sink capability update without such a reset (via
+ * intel_dp_set_common_rates()), the link state should be rechecked in
+ * case the link became retrainable.
*/
if (!intel_dp_is_edp(intel_dp))
intel_dp_check_link_state(intel_dp);
--
2.49.1