Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: <intel-gfx@lists.freedesktop.org>, <intel-xe@lists.freedesktop.org>
Cc: Jani Nikula <jani.nikula@intel.com>
Subject: [PATCH v2 03/28] drm/i915/dp_link_caps: Introduce DP link capability module
Date: Tue, 16 Jun 2026 23:08:23 +0300	[thread overview]
Message-ID: <20260616200849.3534628-4-imre.deak@intel.com> (raw)
In-Reply-To: <20260616200849.3534628-1-imre.deak@intel.com>

Start isolating the DP link capability logic from the generic DP code by
adding a separate intel_dp_link_caps module and a corresponding state
object.

Allocate the state so it can remain opaque within its module.

Follow-up changes will move link capability helpers and state from
intel_dp.c and intel_dp_link_training.c to the new module and state.

v2: Remove unnecessary function documentation. (Jani)

Cc: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/gpu/drm/i915/Makefile                 |  1 +
 .../drm/i915/display/intel_display_types.h    |  2 ++
 drivers/gpu/drm/i915/display/intel_dp.c       |  9 ++++++
 .../gpu/drm/i915/display/intel_dp_link_caps.c | 30 +++++++++++++++++++
 .../gpu/drm/i915/display/intel_dp_link_caps.h | 12 ++++++++
 drivers/gpu/drm/xe/Makefile                   |  1 +
 6 files changed, 55 insertions(+)
 create mode 100644 drivers/gpu/drm/i915/display/intel_dp_link_caps.c
 create mode 100644 drivers/gpu/drm/i915/display/intel_dp_link_caps.h

diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index 07802a7f4ce50..81e16f377641b 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -356,6 +356,7 @@ i915-y += \
 	display/intel_dp_aux.o \
 	display/intel_dp_aux_backlight.o \
 	display/intel_dp_hdcp.o \
+	display/intel_dp_link_caps.o \
 	display/intel_dp_link_training.o \
 	display/intel_dp_mst.o \
 	display/intel_dp_test.o \
diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
index c092c81ed2eb6..10933ccdeb31e 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -58,6 +58,7 @@ struct cec_notifier;
 struct drm_printer;
 struct intel_connector;
 struct intel_ddi_buf_trans;
+struct intel_dp_link_caps;
 struct intel_dp_link_training;
 struct intel_fbc;
 struct intel_global_objs_state;
@@ -1867,6 +1868,7 @@ struct intel_dp {
 		int force_lane_count;
 		int force_rate;
 		struct intel_dp_link_training *training;
+		struct intel_dp_link_caps *caps;
 	} link;
 	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 00eb3f5103383..fa095c4db7fe6 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -71,6 +71,7 @@
 #include "intel_dp.h"
 #include "intel_dp_aux.h"
 #include "intel_dp_hdcp.h"
+#include "intel_dp_link_caps.h"
 #include "intel_dp_link_training.h"
 #include "intel_dp_mst.h"
 #include "intel_dp_test.h"
@@ -7458,10 +7459,18 @@ int intel_dp_link_init(struct intel_dp *intel_dp)
 	if (!intel_dp->link.training)
 		return -ENOMEM;
 
+	intel_dp->link.caps = intel_dp_link_caps_init(intel_dp);
+	if (!intel_dp->link.caps) {
+		intel_dp_link_training_cleanup(intel_dp->link.training);
+
+		return -ENOMEM;
+	}
+
 	return 0;
 }
 
 void intel_dp_link_cleanup(struct intel_dp *intel_dp)
 {
+	intel_dp_link_caps_cleanup(intel_dp->link.caps);
 	intel_dp_link_training_cleanup(intel_dp->link.training);
 }
diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_caps.c b/drivers/gpu/drm/i915/display/intel_dp_link_caps.c
new file mode 100644
index 0000000000000..63989d97effd7
--- /dev/null
+++ b/drivers/gpu/drm/i915/display/intel_dp_link_caps.c
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#include <linux/slab.h>
+
+#include "intel_dp_link_caps.h"
+
+struct intel_dp_link_caps {
+	struct intel_dp *dp;
+};
+
+struct intel_dp_link_caps *intel_dp_link_caps_init(struct intel_dp *intel_dp)
+{
+	struct intel_dp_link_caps *link_caps;
+
+	link_caps = kzalloc_obj(*link_caps);
+	if (!link_caps)
+		return NULL;
+
+	link_caps->dp = intel_dp;
+
+	return link_caps;
+}
+
+void intel_dp_link_caps_cleanup(struct intel_dp_link_caps *link_caps)
+{
+	kfree(link_caps);
+}
diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_caps.h b/drivers/gpu/drm/i915/display/intel_dp_link_caps.h
new file mode 100644
index 0000000000000..050b279463d6e
--- /dev/null
+++ b/drivers/gpu/drm/i915/display/intel_dp_link_caps.h
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: MIT */
+/* Copyright © 2026 Intel Corporation */
+
+#ifndef __INTEL_DP_LINK_CAPS_H__
+#define __INTEL_DP_LINK_CAPS_H__
+
+struct intel_dp;
+
+struct intel_dp_link_caps *intel_dp_link_caps_init(struct intel_dp *intel_dp);
+void intel_dp_link_caps_cleanup(struct intel_dp_link_caps *link_caps);
+
+#endif /* __INTEL_DP_LINK_CAPS_H__ */
diff --git a/drivers/gpu/drm/xe/Makefile b/drivers/gpu/drm/xe/Makefile
index 8e7b146880f46..e5a04253e73bf 100644
--- a/drivers/gpu/drm/xe/Makefile
+++ b/drivers/gpu/drm/xe/Makefile
@@ -278,6 +278,7 @@ xe-$(CONFIG_DRM_XE_DISPLAY) += \
 	i915-display/intel_dp_aux.o \
 	i915-display/intel_dp_aux_backlight.o \
 	i915-display/intel_dp_hdcp.o \
+	i915-display/intel_dp_link_caps.o \
 	i915-display/intel_dp_link_training.o \
 	i915-display/intel_dp_mst.o \
 	i915-display/intel_dp_test.o \
-- 
2.49.1


  parent reply	other threads:[~2026-06-16 20:09 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-16 20:08 [PATCH v2 00/28] drm/i915/dp_link: Refactor DP link capability logic part1 Imre Deak
2026-06-16 20:08 ` [PATCH v2 01/28] drm/i915/dp: Rename intel_dp_link_config to intel_dp_link_config_entry Imre Deak
2026-06-16 20:08 ` [PATCH v2 02/28] drm/i915/dp: Add struct intel_dp_link_config Imre Deak
2026-06-16 20:08 ` Imre Deak [this message]
2026-06-16 20:08 ` [PATCH v2 04/28] drm/i915/dp_link_caps: Move common rate helpers to link caps Imre Deak
2026-06-16 20:08 ` [PATCH v2 05/28] drm/i915/dp_link_caps: Move forced link param " Imre Deak
2026-06-16 20:08 ` [PATCH v2 06/28] drm/i915/dp: Simplify querying of forced link parameters Imre Deak
2026-06-16 20:08 ` [PATCH v2 07/28] drm/i915/dp_link_caps: Move forced and max link debugfs entries to link caps Imre Deak
2026-06-16 20:08 ` [PATCH v2 08/28] drm/i915/dp_link_training: Use helpers to get forced link params Imre Deak
2026-06-16 20:08 ` [PATCH v2 09/28] drm/i915/dp_link_caps: Move forced link params to link_caps Imre Deak
2026-06-16 20:08 ` [PATCH v2 10/28] drm/i915/dp_link_caps: Move link config helpers to link caps Imre Deak
2026-06-16 20:08 ` [PATCH v2 11/28] drm/i915/dp_link_caps: Move link config tracking to link_caps Imre Deak
2026-06-16 20:08 ` [PATCH v2 12/28] drm/i915/dp_link_caps: Rename helper updating the link configurations Imre Deak
2026-06-16 20:08 ` [PATCH v2 13/28] drm/i915/dp: Factor out helper to get link rate capabilities Imre Deak
2026-06-16 20:08 ` [PATCH v2 14/28] drm/i915/dp_link_caps: Pass supported link rates to link caps update Imre Deak
2026-06-16 20:08 ` [PATCH v2 15/28] drm/i915/dp_link_caps: Add helper to print all supported link rates Imre Deak
2026-06-16 20:08 ` [PATCH v2 16/28] drm/i915/dp_link_caps: Add helper to get the number of " Imre Deak
2026-06-16 20:08 ` [PATCH v2 17/28] drm/i915/dp_link_caps: Add helper to get common rate index Imre Deak
2026-06-16 20:08 ` [PATCH v2 18/28] drm/i915/dp_link_caps: Move tracking of common rates to link_caps struct Imre Deak
2026-06-16 20:08 ` [PATCH v2 19/28] drm/i915/dp_link_caps: Track max common lane count in link_caps Imre Deak
2026-06-16 20:08 ` [PATCH v2 20/28] drm/i915/dp_link_caps: Use max common lane count from link_caps Imre Deak
2026-06-16 20:08 ` [PATCH v2 21/28] drm/i915/dp_link_caps: Add helpers to get max link limits Imre Deak
2026-06-16 20:08 ` [PATCH v2 22/28] drm/i915/dp_link_caps: Add helpers to set " Imre Deak
2026-06-16 20:08 ` [PATCH v2 23/28] drm/i915/dp_link_caps: Add helper to reset " Imre Deak
2026-06-16 20:08 ` [PATCH v2 24/28] drm/i915/dp_link_caps: Add helper to reset link_caps state Imre Deak
2026-06-16 20:08 ` [PATCH v2 25/28] drm/i915/dp_link_caps: Move max link limits to link_caps Imre Deak
2026-06-16 20:08 ` [PATCH v2 26/28] drm/i915/dp_link_caps: Pass link_caps to static functions Imre Deak
2026-06-16 20:08 ` [PATCH v2 27/28] drm/i915/dp_link_caps: Pass link_caps to config update/lookup helpers Imre Deak
2026-06-16 20:08 ` [PATCH v2 28/28] drm/i915/dp_link_caps: Pass link_caps to common rate helpers Imre Deak
2026-06-16 20:20 ` ✗ CI.checkpatch: warning for drm/i915/dp_link: Refactor DP link capability logic part1 Patchwork
2026-06-16 20:21 ` ✓ CI.KUnit: success " Patchwork
2026-06-16 21:18 ` ✓ Xe.CI.BAT: " Patchwork
2026-06-17  1:46 ` ✓ Xe.CI.FULL: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260616200849.3534628-4-imre.deak@intel.com \
    --to=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox