[PATCH 005/108] drm/i915/dp_link_training: Factor out link training state reset helper

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

Factor out the link training state reset into a helper in
intel_dp_link_training.c to prepare for isolating the link training state
from the generic DP code.

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
drivers/gpu/drm/i915/display/intel_dp.c | 3 +--
drivers/gpu/drm/i915/display/intel_dp_link_training.c | 8 ++++++++
drivers/gpu/drm/i915/display/intel_dp_link_training.h | 2 ++
3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index 442610054d7f7..ef7d5e55cc468 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -3728,8 +3728,7 @@ void intel_dp_reset_link_params(struct intel_dp *intel_dp)
intel_dp->link.max_rate = intel_dp_max_common_rate(intel_dp);
intel_dp->link.mst_probed_lane_count = 0;
intel_dp->link.mst_probed_rate = 0;
- intel_dp->link.retrain_disabled = false;
- intel_dp->link.seq_train_failures = 0;
+ intel_dp_link_training_reset(intel_dp->link.training);
}

/* Enable backlight PWM and backlight PP control. */
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 c4e461d24e2ed..653b974e925c2 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_link_training.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
@@ -2222,6 +2222,14 @@ void intel_dp_link_training_debugfs_add(struct intel_connector *connector)
connector, &i915_dp_link_retrain_disabled_fops);
}

+void intel_dp_link_training_reset(struct intel_dp_link_training *link_training)
+{
+ struct intel_dp *intel_dp = link_training->dp;
+
+ intel_dp->link.retrain_disabled = false;
+ intel_dp->link.seq_train_failures = 0;
+}
+
/**
* intel_dp_link_training_init - allocate and initialize link training state
* @intel_dp: DP encoder state
diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_training.h b/drivers/gpu/drm/i915/display/intel_dp_link_training.h
index e68d51bcb42e1..6c0c74e31a3c5 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_link_training.h
+++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.h
@@ -56,6 +56,8 @@ void intel_dp_128b132b_sdp_crc16(struct intel_dp *intel_dp,

void intel_dp_link_training_debugfs_add(struct intel_connector *connector);

+void intel_dp_link_training_reset(struct intel_dp_link_training *link_training);
+
struct intel_dp_link_training *intel_dp_link_training_init(struct intel_dp *intel_dp);
void intel_dp_link_training_cleanup(struct intel_dp_link_training *link_training);

--
2.49.1