[PATCH v2 21/21] drm/i915/dp: Add debugfs entry for link training info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add counters for link training pass/failure events and a connector
debugfs entry showing these and relevant link training information. This
is meant to be used by automated testing of the driver's link retraining
and link parameter fallback functionality.

v2:
- Add the entry from intel_dp_link_training.c (Jani)
- Add separate entries for the max link rate/lane count.

Cc: Jani Nikula <jani.nikula@xxxxxxxxx>
Signed-off-by: Imre Deak <imre.deak@xxxxxxxxx>
---
 .../drm/i915/display/intel_display_types.h    |  3 ++
 drivers/gpu/drm/i915/display/intel_dp.c       |  7 +++-
 .../drm/i915/display/intel_dp_link_training.c | 37 +++++++++++++++++++
 3 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
index 52c69c7eb52f5..6f37f2cca2e99 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -1768,6 +1768,9 @@ struct intel_dp {
 		int requested_lane_count;
 		int requested_rate;
 		bool retrain_disabled;
+		int train_count;
+		int retrain_count;
+		int all_train_failures;
 		/* Sequential link training failures after a passing LT */
 		int seq_train_failures;
 		int force_train_failure;
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index 895074d548671..0337be8416082 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -2996,6 +2996,9 @@ void intel_dp_reset_link_params(struct intel_dp *intel_dp)
 	intel_dp->link.max_lane_count = intel_dp_max_common_lane_count(intel_dp);
 	intel_dp->link.max_rate = intel_dp_max_common_rate(intel_dp);
 	intel_dp->link.retrain_disabled = false;
+	intel_dp->link.train_count = 0;
+	intel_dp->link.retrain_count = 0;
+	intel_dp->link.all_train_failures = 0;
 	intel_dp->link.seq_train_failures = 0;
 }
 
@@ -5298,8 +5301,10 @@ int intel_dp_retrain_link(struct intel_encoder *encoder,
 	}
 
 out:
-	if (ret != -EDEADLK)
+	if (ret != -EDEADLK) {
+		intel_dp->link.retrain_count++;
 		intel_dp->link.force_retrain = false;
+	}
 
 	return ret;
 }
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 6fac8421a6918..969a5fc4c7b2e 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_link_training.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
@@ -1490,6 +1490,8 @@ void intel_dp_start_link_train(struct intel_atomic_state *state,
 	else
 		passed = intel_dp_link_train_all_phys(intel_dp, crtc_state, lttpr_count);
 
+	intel_dp->link.train_count++;
+
 	if (intel_dp->link.force_train_failure) {
 		intel_dp->link.force_train_failure--;
 		lt_dbg(intel_dp, DP_PHY_DPRX, "Forcing link training failure\n");
@@ -1499,6 +1501,7 @@ void intel_dp_start_link_train(struct intel_atomic_state *state,
 		return;
 	}
 
+	intel_dp->link.all_train_failures++;
 	intel_dp->link.seq_train_failures++;
 
 	/*
@@ -1890,6 +1893,37 @@ DEFINE_DEBUGFS_ATTRIBUTE(i915_dp_force_link_retrain_fops,
 			 i915_dp_force_link_retrain_show,
 			 i915_dp_force_link_retrain_write, "%llu\n");
 
+static int i915_dp_link_training_info_show(struct seq_file *m, void *data)
+{
+	struct intel_connector *connector = to_intel_connector(m->private);
+	struct drm_i915_private *i915 = to_i915(connector->base.dev);
+	struct intel_dp *intel_dp;
+	int ret;
+
+	ret = drm_modeset_lock_single_interruptible(&i915->drm.mode_config.connection_mutex);
+	if (ret)
+		return ret;
+
+	intel_dp = intel_connector_to_intel_dp(connector);
+
+	seq_printf(m,
+		   "retrain_disabled: %s\n"
+		   "train_count: %d\n"
+		   "retrain_count: %d\n"
+		   "all_train_failures: %d\n"
+		   "seq_train_failures: %d\n",
+		   str_yes_no(intel_dp->link.retrain_disabled),
+		   intel_dp->link.train_count,
+		   intel_dp->link.retrain_count,
+		   intel_dp->link.all_train_failures,
+		   intel_dp->link.seq_train_failures);
+
+	drm_modeset_unlock(&i915->drm.mode_config.connection_mutex);
+
+	return 0;
+}
+DEFINE_SHOW_ATTRIBUTE(i915_dp_link_training_info);
+
 void intel_dp_link_training_debugfs_add(struct intel_connector *connector)
 {
 	struct dentry *root = connector->base.debugfs_entry;
@@ -1915,4 +1949,7 @@ void intel_dp_link_training_debugfs_add(struct intel_connector *connector)
 
 	debugfs_create_file("i915_dp_force_link_retrain", 0644, root,
 			    connector, &i915_dp_force_link_retrain_fops);
+
+	debugfs_create_file("i915_dp_link_training_info", 0444, root,
+			    connector, &i915_dp_link_training_info_fops);
 }
-- 
2.43.3




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux