[PATCH 018/108] drm/i915/dp_link_training: Add helper to reset link recovery state

Imre Deak
2026-04-28T12:53:20Z

Add link_recovery_reset() to make it explicit when link recovery is no
longer needed and the recovery state can be cleared.

This also prepares for replacing the sequential link training failure
counter with an enum in a follow-up change.

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
.../drm/i915/display/intel_dp_link_training.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_training.c b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
index eb922dca69c5b..90bd1b0f1ab7d 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_link_training.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
@@ -1304,6 +1304,18 @@ link_recovery_mark_train_failure(struct intel_dp_link_training *link_training)
return link_recovery_autoretrain_allowed(link_training);
}

+/**
+ * link_recovery_reset - reset the link recovery state
+ * @link_training: link training state
+ *
+ * Reset the link recovery state to indicate that no link recovery is
+ * required.
+ */
+static void link_recovery_reset(struct intel_dp_link_training *link_training)
+{
+ link_training->seq_train_failures = 0;
+}
+
/**
* intel_dp_stop_link_train - stop link training
* @intel_dp: DP struct
@@ -1868,7 +1880,7 @@ void intel_dp_start_link_train(struct intel_atomic_state *state,
link_training->force_train_failure--;
lt_dbg(intel_dp, DP_PHY_DPRX, "Forcing link training failure\n");
} else if (passed) {
- link_training->seq_train_failures = 0;
+ link_recovery_reset(link_training);
return;
}

@@ -2538,7 +2550,7 @@ void intel_dp_link_training_debugfs_add(struct intel_connector *connector)
void intel_dp_link_training_reset(struct intel_dp_link_training *link_training)
{
link_training->retrain_disabled = false;
- link_training->seq_train_failures = 0;
+ link_recovery_reset(link_training);
}

/**
--
2.49.1