[PATCH 009/108] drm/i915/dp_link_training: Use link_training as base pointer in debugfs

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

Retrieve the link_training pointer from the connector and derive the DP
pointer from it in debugfs entries.

This prepares for a follow-up change where values exposed via debugfs
entries will be retrieved from the link training state.

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
.../drm/i915/display/intel_dp_link_training.c | 25 +++++++++++++++----
1 file changed, 20 insertions(+), 5 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 c2f9af251b6a9..1762e507dd1ec 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_link_training.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
@@ -67,6 +67,11 @@ struct intel_dp_link_training {
struct intel_dp *dp;
};

+static struct intel_dp_link_training *connector_to_link_training(struct intel_connector *connector)
+{
+ return intel_attached_dp(connector)->link.training;
+}
+
static void intel_dp_reset_lttpr_common_caps(struct intel_dp *intel_dp)
{
memset(intel_dp->lttpr_common_caps, 0, sizeof(intel_dp->lttpr_common_caps));
@@ -2307,7 +2312,9 @@ static int i915_dp_force_link_training_failure_show(void *data, u64 *val)
{
struct intel_connector *connector = to_intel_connector(data);
struct intel_display *display = to_intel_display(connector);
- struct intel_dp *intel_dp = intel_attached_dp(connector);
+ struct intel_dp_link_training *link_training =
+ connector_to_link_training(connector);
+ struct intel_dp *intel_dp = link_training->dp;
int err;

err = drm_modeset_lock_single_interruptible(&display->drm->mode_config.connection_mutex);
@@ -2327,7 +2334,9 @@ static int i915_dp_force_link_training_failure_write(void *data, u64 val)
{
struct intel_connector *connector = to_intel_connector(data);
struct intel_display *display = to_intel_display(connector);
- struct intel_dp *intel_dp = intel_attached_dp(connector);
+ struct intel_dp_link_training *link_training =
+ connector_to_link_training(connector);
+ struct intel_dp *intel_dp = link_training->dp;
int err;

if (val > 2)
@@ -2353,7 +2362,9 @@ static int i915_dp_force_link_retrain_show(void *data, u64 *val)
{
struct intel_connector *connector = to_intel_connector(data);
struct intel_display *display = to_intel_display(connector);
- struct intel_dp *intel_dp = intel_attached_dp(connector);
+ struct intel_dp_link_training *link_training =
+ connector_to_link_training(connector);
+ struct intel_dp *intel_dp = link_training->dp;
int err;

err = drm_modeset_lock_single_interruptible(&display->drm->mode_config.connection_mutex);
@@ -2373,7 +2384,9 @@ static int i915_dp_force_link_retrain_write(void *data, u64 val)
{
struct intel_connector *connector = to_intel_connector(data);
struct intel_display *display = to_intel_display(connector);
- struct intel_dp *intel_dp = intel_attached_dp(connector);
+ struct intel_dp_link_training *link_training =
+ connector_to_link_training(connector);
+ struct intel_dp *intel_dp = link_training->dp;
int err;

err = drm_modeset_lock_single_interruptible(&display->drm->mode_config.connection_mutex);
@@ -2398,7 +2411,9 @@ static int i915_dp_link_retrain_disabled_show(struct seq_file *m, void *data)
{
struct intel_connector *connector = to_intel_connector(m->private);
struct intel_display *display = to_intel_display(connector);
- struct intel_dp *intel_dp = intel_attached_dp(connector);
+ struct intel_dp_link_training *link_training =
+ connector_to_link_training(connector);
+ struct intel_dp *intel_dp = link_training->dp;
int err;

err = drm_modeset_lock_single_interruptible(&display->drm->mode_config.connection_mutex);
--
2.49.1