diff mbox series

[08/20] drm/i915/dp: Reduce link params only after retrying with unchanged params

Message ID 20240514191418.2863344-9-imre.deak@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/dp_mst: Enable link training fallback | expand

Commit Message

Imre Deak May 14, 2024, 7:14 p.m. UTC
Try to maintain the current link parameters by retrying the link
training with unchanged link parameters before reducing these parameters
(sending an uevent to userspace to retrain the link instead).

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

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
index 0da7649e4ba9e..a173b9c105981 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -1763,6 +1763,8 @@  struct intel_dp {
 		int max_lane_count;
 		/* Max rate for the current link */
 		int max_rate;
+		/* Sequential failures after a passing LT */
+		int seq_failures;
 	} link_train;
 	bool reset_link_params;
 	int mso_link_count;
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index 2ec6e9c34e282..da56a2b7fa0f8 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -2950,6 +2950,7 @@  static void intel_dp_reset_link_train_params(struct intel_dp *intel_dp)
 {
 	intel_dp->link_train.max_lane_count = intel_dp_max_common_lane_count(intel_dp);
 	intel_dp->link_train.max_rate = intel_dp_max_common_rate(intel_dp);
+	intel_dp->link_train.seq_failures = 0;
 }
 
 /* Enable backlight PWM and backlight PP control. */
@@ -5056,6 +5057,9 @@  intel_dp_needs_link_retrain(struct intel_dp *intel_dp)
 					intel_dp->lane_count))
 		return false;
 
+	if (intel_dp->link_train.seq_failures)
+		return true;
+
 	/* Retrain if link not ok */
 	return !intel_dp_link_ok(intel_dp, link_status);
 }
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 85074c1c2281d..6b0aab278ae8d 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_link_training.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
@@ -1484,10 +1484,13 @@  void intel_dp_start_link_train(struct intel_dp *intel_dp,
 		passed = intel_dp_link_train_all_phys(intel_dp, crtc_state, lttpr_count);
 
 	if (passed) {
+		intel_dp->link_train.seq_failures = 0;
 		intel_dp_queue_link_check(intel_dp, 2000);
 		return;
 	}
 
+	intel_dp->link_train.seq_failures++;
+
 	/*
 	 * Ignore the link failure in CI
 	 *
@@ -1505,6 +1508,11 @@  void intel_dp_start_link_train(struct intel_dp *intel_dp,
 		return;
 	}
 
+	if (intel_dp->link_train.seq_failures < 2) {
+		intel_dp_queue_link_check(intel_dp, 0);
+		return;
+	}
+
 	intel_dp_schedule_fallback_link_training(intel_dp, crtc_state);
 }