* [PATCH v2 00/10] Move DRM helpers out of i915 driver
@ 2026-11-25 14:01 Kory Maincent
2026-11-25 14:01 ` [PATCH v2 01/10] drm/dp: Move max DPRX link rate helper out of i915 Kory Maincent
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: Kory Maincent @ 2026-11-25 14:01 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter, Jani Nikula, Rodrigo Vivi,
Joonas Lahtinen, Tvrtko Ursulin
Cc: Louis Chauvet, Luca Ceresoli, Thomas Petazzoni, Mark Yacoub,
Sean Paul, Manasi Navare, Drew Davenport, dri-devel,
linux-kernel, intel-gfx, intel-xe, Kory Maincent
This series moves several helpers from the i915 driver into the DRM
core helpers.
These helpers were first sent as a preparation for new DRM features in
the following patch series:
https://patch.msgid.link/20261022-feat_link_cap-v4-0-a4f3f6e8cad9@bootlin.com
However, as these features will take time to be discussed and accepted,
the preparation patches have been advised to be sent independently of
the original series.
Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
Changes in v2:
- Split patch 7 for readability
- Fix a kdoc typo
- Fix a possible issue reported by sashiko
- Link to v1: https://patch.msgid.link/20261118-feat_move_i915_helper-v1-0-652177f3107a@bootlin.com
---
Kory Maincent (10):
drm/dp: Move max DPRX link rate helper out of i915
drm/dp: Move DPRX 128b/132b link rates helper out of i915
drm/dp: Move DPRX 128b/132b support helper out of i915
drm/dp: Move supported 128b/132b link rates helper out of i915
drm/dp: Move DP sink link rates reading helper out of i915
drm/dp: Make the DPRX link rates helpers static
drm/dp: Add drm_dp_read_dpcd_supported_link_rates() helper
drm/dp: Move eDP sink link rates reading helper out of i915
drm/dp: Make the eDP supported link rates helper static
drm: Move DSC capability reading helper out of i915
drivers/gpu/drm/display/drm_dp_helper.c | 260 ++++++++++++++++++++++++++++++++
drivers/gpu/drm/i915/display/intel_dp.c | 221 ++++++---------------------
include/drm/display/drm_dp.h | 3 +
include/drm/display/drm_dp_helper.h | 13 ++
4 files changed, 318 insertions(+), 179 deletions(-)
---
base-commit: b79f6387fd1a9484448230f92502ec3c66e6c1de
change-id: 20261116-feat_move_i915_helper-03c4037ea203
Best regards,
--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 01/10] drm/dp: Move max DPRX link rate helper out of i915
2026-11-25 14:01 [PATCH v2 00/10] Move DRM helpers out of i915 driver Kory Maincent
@ 2026-11-25 14:01 ` Kory Maincent
2026-11-25 14:01 ` [PATCH v2 02/10] drm/dp: Move DPRX 128b/132b link rates " Kory Maincent
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Kory Maincent @ 2026-11-25 14:01 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter, Jani Nikula, Rodrigo Vivi,
Joonas Lahtinen, Tvrtko Ursulin
Cc: Louis Chauvet, Luca Ceresoli, Thomas Petazzoni, Mark Yacoub,
Sean Paul, Manasi Navare, Drew Davenport, dri-devel,
linux-kernel, intel-gfx, intel-xe, Kory Maincent
Move the drm_dprx_max_rate() helper from the i915 driver into the
generic DRM helpers. It returns the maximum DPRX link rate, either from
the DP tunnel capabilities when bandwidth allocation is enabled or from
the DPCD DP_MAX_LINK_RATE register.
Keep the Intel eDP HBR2 limitation quirk handling in the driver.
Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
drivers/gpu/drm/display/drm_dp_helper.c | 11 +++++++++++
drivers/gpu/drm/i915/display/intel_dp.c | 35 +++++++++++----------------------
include/drm/display/drm_dp_helper.h | 4 ++++
3 files changed, 27 insertions(+), 23 deletions(-)
diff --git a/drivers/gpu/drm/display/drm_dp_helper.c b/drivers/gpu/drm/display/drm_dp_helper.c
index 2b6ce05556b0d..e58dabdad1f39 100644
--- a/drivers/gpu/drm/display/drm_dp_helper.c
+++ b/drivers/gpu/drm/display/drm_dp_helper.c
@@ -37,6 +37,7 @@
#include <drm/display/drm_dp_helper.h>
#include <drm/display/drm_dp_mst_helper.h>
+#include <drm/display/drm_dp_tunnel.h>
#include <drm/drm_edid.h>
#include <drm/drm_fixed.h>
#include <drm/drm_print.h>
@@ -4914,3 +4915,13 @@ int drm_dp_max_dprx_data_rate(int max_link_rate, int max_lanes)
1000000 * 8);
}
EXPORT_SYMBOL(drm_dp_max_dprx_data_rate);
+
+int drm_dprx_max_rate(const struct drm_dp_tunnel *tunnel,
+ const u8 dpcd[DP_RECEIVER_CAP_SIZE])
+{
+ if (tunnel && drm_dp_tunnel_bw_alloc_is_enabled(tunnel))
+ return drm_dp_tunnel_max_dprx_rate(tunnel);
+ else
+ return drm_dp_bw_code_to_link_rate(dpcd[DP_MAX_LINK_RATE]);
+}
+EXPORT_SYMBOL_GPL(drm_dprx_max_rate);
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index ef164a7976187..96379c18b8cd4 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -159,28 +159,6 @@ int intel_dp_link_symbol_clock(int rate)
return DIV_ROUND_CLOSEST(rate * 10, intel_dp_link_symbol_size(rate));
}
-static int max_dprx_rate(struct intel_dp *intel_dp)
-{
- struct intel_display *display = to_intel_display(intel_dp);
- int max_rate;
-
- if (intel_dp_tunnel_bw_alloc_is_enabled(intel_dp))
- max_rate = drm_dp_tunnel_max_dprx_rate(intel_dp->tunnel);
- else
- max_rate = drm_dp_bw_code_to_link_rate(intel_dp->dpcd[DP_MAX_LINK_RATE]);
-
- /*
- * Some platforms + eDP panels may not reliably support HBR3
- * due to signal integrity limitations, despite advertising it.
- * Cap the link rate to HBR2 to avoid unstable configurations for the
- * known machines.
- */
- if (intel_dp_is_edp(intel_dp) && intel_has_quirk(display, QUIRK_EDP_LIMIT_RATE_HBR2))
- max_rate = min(max_rate, 540000);
-
- return max_rate;
-}
-
static int max_dprx_lane_count(struct intel_dp *intel_dp)
{
if (intel_dp_tunnel_bw_alloc_is_enabled(intel_dp))
@@ -221,6 +199,7 @@ static u8 dprx_128b132b_link_rates(struct intel_dp *intel_dp, u8 no_bwa_rates)
/* update sink rates from dpcd */
static void intel_dp_set_dpcd_sink_rates(struct intel_dp *intel_dp)
{
+ struct intel_display *display = to_intel_display(intel_dp);
static const int dp_rates[] = {
162000, 270000, 540000, 810000
};
@@ -241,7 +220,17 @@ static void intel_dp_set_dpcd_sink_rates(struct intel_dp *intel_dp)
/*
* Sink rates for 8b/10b.
*/
- max_rate = max_dprx_rate(intel_dp);
+ max_rate = drm_dprx_max_rate(intel_dp->tunnel, intel_dp->dpcd);
+
+ /*
+ * Some platforms + eDP panels may not reliably support HBR3
+ * due to signal integrity limitations, despite advertising it.
+ * Cap the link rate to HBR2 to avoid unstable configurations for the
+ * known machines.
+ */
+ if (intel_dp_is_edp(intel_dp) && intel_has_quirk(display, QUIRK_EDP_LIMIT_RATE_HBR2))
+ max_rate = min(max_rate, 540000);
+
max_lttpr_rate = drm_dp_lttpr_max_link_rate(intel_dp->lttpr_common_caps);
if (max_lttpr_rate)
max_rate = min(max_rate, max_lttpr_rate);
diff --git a/include/drm/display/drm_dp_helper.h b/include/drm/display/drm_dp_helper.h
index f497c9f3a5504..fe08a66f2bb1e 100644
--- a/include/drm/display/drm_dp_helper.h
+++ b/include/drm/display/drm_dp_helper.h
@@ -33,6 +33,7 @@ struct drm_device;
struct drm_dp_aux;
struct drm_panel;
struct drm_printer;
+struct drm_dp_tunnel;
bool drm_dp_channel_eq_ok(const u8 link_status[DP_LINK_STATUS_SIZE],
int lane_count);
@@ -701,6 +702,9 @@ static inline int drm_dp_dpcd_write_byte(struct drm_dp_aux *aux,
int drm_dp_read_dpcd_caps(struct drm_dp_aux *aux,
u8 dpcd[DP_RECEIVER_CAP_SIZE]);
+int drm_dprx_max_rate(const struct drm_dp_tunnel *tunnel,
+ const u8 dpcd[DP_RECEIVER_CAP_SIZE]);
+
int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux,
u8 status[DP_LINK_STATUS_SIZE]);
--
2.43.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 02/10] drm/dp: Move DPRX 128b/132b link rates helper out of i915
2026-11-25 14:01 [PATCH v2 00/10] Move DRM helpers out of i915 driver Kory Maincent
2026-11-25 14:01 ` [PATCH v2 01/10] drm/dp: Move max DPRX link rate helper out of i915 Kory Maincent
@ 2026-11-25 14:01 ` Kory Maincent
2026-11-25 14:01 ` [PATCH v2 03/10] drm/dp: Move DPRX 128b/132b support " Kory Maincent
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Kory Maincent @ 2026-11-25 14:01 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter, Jani Nikula, Rodrigo Vivi,
Joonas Lahtinen, Tvrtko Ursulin
Cc: Louis Chauvet, Luca Ceresoli, Thomas Petazzoni, Mark Yacoub,
Sean Paul, Manasi Navare, Drew Davenport, dri-devel,
linux-kernel, intel-gfx, intel-xe, Kory Maincent
Move the drm_dprx_128b132b_link_rates() helper from the i915 driver
into the generic DRM helpers. It returns the DPRX supported 128b/132b
UHBR rate mask, either from the DP tunnel capabilities when bandwidth
allocation is enabled or from the mask passed by the caller.
Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
drivers/gpu/drm/display/drm_dp_helper.c | 14 ++++++++++++++
drivers/gpu/drm/i915/display/intel_dp.c | 17 +----------------
include/drm/display/drm_dp_helper.h | 2 ++
3 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/drivers/gpu/drm/display/drm_dp_helper.c b/drivers/gpu/drm/display/drm_dp_helper.c
index e58dabdad1f39..86260ffd57cdc 100644
--- a/drivers/gpu/drm/display/drm_dp_helper.c
+++ b/drivers/gpu/drm/display/drm_dp_helper.c
@@ -4925,3 +4925,17 @@ int drm_dprx_max_rate(const struct drm_dp_tunnel *tunnel,
return drm_dp_bw_code_to_link_rate(dpcd[DP_MAX_LINK_RATE]);
}
EXPORT_SYMBOL_GPL(drm_dprx_max_rate);
+
+u8 drm_dprx_128b132b_link_rates(const struct drm_dp_tunnel *tunnel,
+ u8 uhbr_rates)
+{
+ if (!drm_dp_tunnel_bw_alloc_is_enabled(tunnel))
+ return uhbr_rates;
+
+ static_assert(DP_TUNNELING_10GBPS_PER_LANE_SUPPORT == DP_UHBR10 &&
+ DP_TUNNELING_13_5GBPS_PER_LANE_SUPPORT == DP_UHBR13_5 &&
+ DP_TUNNELING_20GBPS_PER_LANE_SUPPORT == DP_UHBR20);
+
+ return drm_dp_tunnel_128b132b_dprx_rates(tunnel);
+}
+EXPORT_SYMBOL_GPL(drm_dprx_128b132b_link_rates);
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index 96379c18b8cd4..e124e7dced178 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -181,21 +181,6 @@ static bool dprx_supports_128b132b(struct intel_dp *intel_dp)
return drm_dp_128b132b_supported(intel_dp->dpcd);
}
-static u8 dprx_128b132b_link_rates(struct intel_dp *intel_dp, u8 no_bwa_rates)
-{
- u8 ret;
-
- if (!intel_dp_tunnel_bw_alloc_is_enabled(intel_dp))
- return no_bwa_rates;
-
- ret = drm_dp_tunnel_128b132b_dprx_rates(intel_dp->tunnel);
- static_assert(DP_TUNNELING_10GBPS_PER_LANE_SUPPORT == DP_UHBR10 &&
- DP_TUNNELING_13_5GBPS_PER_LANE_SUPPORT == DP_UHBR13_5 &&
- DP_TUNNELING_20GBPS_PER_LANE_SUPPORT == DP_UHBR20);
-
- return ret;
-}
-
/* update sink rates from dpcd */
static void intel_dp_set_dpcd_sink_rates(struct intel_dp *intel_dp)
{
@@ -254,7 +239,7 @@ static void intel_dp_set_dpcd_sink_rates(struct intel_dp *intel_dp)
if (dprx_supports_128b132b(intel_dp)) {
BUILD_BUG_ON(ARRAY_SIZE(intel_dp->sink_rates) < ARRAY_SIZE(dp_rates) + 3);
- uhbr_rates = dprx_128b132b_link_rates(intel_dp, uhbr_rates);
+ uhbr_rates = drm_dprx_128b132b_link_rates(intel_dp->tunnel, uhbr_rates);
if (drm_dp_lttpr_count(intel_dp->lttpr_common_caps)) {
/* We have a repeater */
diff --git a/include/drm/display/drm_dp_helper.h b/include/drm/display/drm_dp_helper.h
index fe08a66f2bb1e..7985bb269fdf2 100644
--- a/include/drm/display/drm_dp_helper.h
+++ b/include/drm/display/drm_dp_helper.h
@@ -704,6 +704,8 @@ int drm_dp_read_dpcd_caps(struct drm_dp_aux *aux,
int drm_dprx_max_rate(const struct drm_dp_tunnel *tunnel,
const u8 dpcd[DP_RECEIVER_CAP_SIZE]);
+u8 drm_dprx_128b132b_link_rates(const struct drm_dp_tunnel *tunnel,
+ u8 uhbr_rates);
int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux,
u8 status[DP_LINK_STATUS_SIZE]);
--
2.43.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 03/10] drm/dp: Move DPRX 128b/132b support helper out of i915
2026-11-25 14:01 [PATCH v2 00/10] Move DRM helpers out of i915 driver Kory Maincent
2026-11-25 14:01 ` [PATCH v2 01/10] drm/dp: Move max DPRX link rate helper out of i915 Kory Maincent
2026-11-25 14:01 ` [PATCH v2 02/10] drm/dp: Move DPRX 128b/132b link rates " Kory Maincent
@ 2026-11-25 14:01 ` Kory Maincent
2026-11-25 14:01 ` [PATCH v2 04/10] drm/dp: Move supported 128b/132b link rates " Kory Maincent
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Kory Maincent @ 2026-11-25 14:01 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter, Jani Nikula, Rodrigo Vivi,
Joonas Lahtinen, Tvrtko Ursulin
Cc: Louis Chauvet, Luca Ceresoli, Thomas Petazzoni, Mark Yacoub,
Sean Paul, Manasi Navare, Drew Davenport, dri-devel,
linux-kernel, intel-gfx, intel-xe, Kory Maincent
Move the drm_dprx_supports_128b132b() helper from the i915 driver into
the generic DRM helpers. It reports whether the DPRX supports 128b/132b
channel coding, either from the DP tunnel capabilities when bandwidth
allocation is enabled or from the DPCD receiver capabilities.
Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
drivers/gpu/drm/display/drm_dp_helper.c | 10 ++++++++++
drivers/gpu/drm/i915/display/intel_dp.c | 10 +---------
include/drm/display/drm_dp_helper.h | 2 ++
3 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/display/drm_dp_helper.c b/drivers/gpu/drm/display/drm_dp_helper.c
index 86260ffd57cdc..c92d89ecf96e4 100644
--- a/drivers/gpu/drm/display/drm_dp_helper.c
+++ b/drivers/gpu/drm/display/drm_dp_helper.c
@@ -4939,3 +4939,13 @@ u8 drm_dprx_128b132b_link_rates(const struct drm_dp_tunnel *tunnel,
return drm_dp_tunnel_128b132b_dprx_rates(tunnel);
}
EXPORT_SYMBOL_GPL(drm_dprx_128b132b_link_rates);
+
+bool drm_dprx_supports_128b132b(const struct drm_dp_tunnel *tunnel,
+ const u8 dpcd[DP_RECEIVER_CAP_SIZE])
+{
+ if (tunnel && drm_dp_tunnel_bw_alloc_is_enabled(tunnel))
+ return drm_dp_tunnel_128b132b_supported(tunnel);
+ else
+ return drm_dp_128b132b_supported(dpcd);
+}
+EXPORT_SYMBOL_GPL(drm_dprx_supports_128b132b);
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index e124e7dced178..2ba89fee097d6 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -173,14 +173,6 @@ static void intel_dp_set_default_sink_rates(struct intel_dp *intel_dp)
intel_dp->num_sink_rates = 1;
}
-static bool dprx_supports_128b132b(struct intel_dp *intel_dp)
-{
- if (intel_dp_tunnel_bw_alloc_is_enabled(intel_dp))
- return drm_dp_tunnel_128b132b_supported(intel_dp->tunnel);
- else
- return drm_dp_128b132b_supported(intel_dp->dpcd);
-}
-
/* update sink rates from dpcd */
static void intel_dp_set_dpcd_sink_rates(struct intel_dp *intel_dp)
{
@@ -236,7 +228,7 @@ static void intel_dp_set_dpcd_sink_rates(struct intel_dp *intel_dp)
* Sink rates for 128b/132b. If set, sink should support all 8b/10b
* rates and 10 Gbps.
*/
- if (dprx_supports_128b132b(intel_dp)) {
+ if (drm_dprx_supports_128b132b(intel_dp->tunnel, intel_dp->dpcd)) {
BUILD_BUG_ON(ARRAY_SIZE(intel_dp->sink_rates) < ARRAY_SIZE(dp_rates) + 3);
uhbr_rates = drm_dprx_128b132b_link_rates(intel_dp->tunnel, uhbr_rates);
diff --git a/include/drm/display/drm_dp_helper.h b/include/drm/display/drm_dp_helper.h
index 7985bb269fdf2..b67bb06f6e07e 100644
--- a/include/drm/display/drm_dp_helper.h
+++ b/include/drm/display/drm_dp_helper.h
@@ -706,6 +706,8 @@ int drm_dprx_max_rate(const struct drm_dp_tunnel *tunnel,
const u8 dpcd[DP_RECEIVER_CAP_SIZE]);
u8 drm_dprx_128b132b_link_rates(const struct drm_dp_tunnel *tunnel,
u8 uhbr_rates);
+bool drm_dprx_supports_128b132b(const struct drm_dp_tunnel *tunnel,
+ const u8 dpcd[DP_RECEIVER_CAP_SIZE]);
int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux,
u8 status[DP_LINK_STATUS_SIZE]);
--
2.43.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 04/10] drm/dp: Move supported 128b/132b link rates helper out of i915
2026-11-25 14:01 [PATCH v2 00/10] Move DRM helpers out of i915 driver Kory Maincent
` (2 preceding siblings ...)
2026-11-25 14:01 ` [PATCH v2 03/10] drm/dp: Move DPRX 128b/132b support " Kory Maincent
@ 2026-11-25 14:01 ` Kory Maincent
2026-11-25 14:01 ` [PATCH v2 05/10] drm/dp: Move DP sink link rates reading " Kory Maincent
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Kory Maincent @ 2026-11-25 14:01 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter, Jani Nikula, Rodrigo Vivi,
Joonas Lahtinen, Tvrtko Ursulin
Cc: Louis Chauvet, Luca Ceresoli, Thomas Petazzoni, Mark Yacoub,
Sean Paul, Manasi Navare, Drew Davenport, dri-devel,
linux-kernel, intel-gfx, intel-xe, Kory Maincent
Move the drm_dp_get_128b132b_link_rates() helper from the i915 driver
into the generic DRM helpers. It limits the UHBR rate mask by the
capabilities of the DP tunnel and of the LTTPRs, if any is present,
then expands the remaining rates in ascending order.
Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
drivers/gpu/drm/display/drm_dp_helper.c | 52 +++++++++++++++++++++++++++++++++
drivers/gpu/drm/i915/display/intel_dp.c | 25 +++-------------
include/drm/display/drm_dp.h | 2 ++
include/drm/display/drm_dp_helper.h | 4 +++
4 files changed, 62 insertions(+), 21 deletions(-)
diff --git a/drivers/gpu/drm/display/drm_dp_helper.c b/drivers/gpu/drm/display/drm_dp_helper.c
index c92d89ecf96e4..a0afb5eff5bb4 100644
--- a/drivers/gpu/drm/display/drm_dp_helper.c
+++ b/drivers/gpu/drm/display/drm_dp_helper.c
@@ -4949,3 +4949,55 @@ bool drm_dprx_supports_128b132b(const struct drm_dp_tunnel *tunnel,
return drm_dp_128b132b_supported(dpcd);
}
EXPORT_SYMBOL_GPL(drm_dprx_supports_128b132b);
+
+/**
+ * drm_dp_get_128b132b_link_rates() - get the supported 128b/132b link rates
+ * @lttpr_common_caps: LTTPR common capabilities
+ * @tunnel: DP tunnel object (NULL if not supported)
+ * @uhbr_rates: UHBR rate mask read from the DPCD
+ * DP_128B132B_SUPPORTED_LINK_RATES register
+ * @link_rates: Buffer of DP_MAX_128B132B_SUPPORTED_RATES entries to store the
+ * resulting link rates
+ *
+ * Limit the UHBR rate mask @uhbr_rates by the capabilities of the DP tunnel
+ * and of the LTTPRs, if any is present, then expand the remaining rates into
+ * @link_rates in ascending order.
+ *
+ * Returns: The number of link rates stored in @link_rates.
+ */
+int
+drm_dp_get_128b132b_link_rates(const u8 lttpr_common_caps[DP_LTTPR_COMMON_CAP_SIZE],
+ const struct drm_dp_tunnel *tunnel,
+ u8 uhbr_rates,
+ int link_rates[DP_MAX_128B132B_SUPPORTED_RATES])
+{
+ int i = 0;
+
+ if (tunnel)
+ uhbr_rates = drm_dprx_128b132b_link_rates(tunnel, uhbr_rates);
+
+ if (lttpr_common_caps && drm_dp_lttpr_count(lttpr_common_caps) > 0) {
+ /* We have a repeater */
+ if (lttpr_common_caps[0] >= DP_LTTPR_REV_SUP_128B132B &&
+ dp_lttpr_common_cap(lttpr_common_caps,
+ DP_MAIN_LINK_CHANNEL_CODING_PHY_REPEATER) &
+ DP_PHY_REPEATER_128B132B_SUPPORTED) {
+ /* Repeater supports 128b/132b, valid UHBR rates */
+ uhbr_rates &= dp_lttpr_common_cap(lttpr_common_caps,
+ DP_PHY_REPEATER_128B132B_RATES);
+ } else {
+ /* Does not support 128b/132b */
+ uhbr_rates = 0;
+ }
+ }
+
+ if (uhbr_rates & DP_UHBR10)
+ link_rates[i++] = 1000000;
+ if (uhbr_rates & DP_UHBR13_5)
+ link_rates[i++] = 1350000;
+ if (uhbr_rates & DP_UHBR20)
+ link_rates[i++] = 2000000;
+
+ return i;
+}
+EXPORT_SYMBOL_GPL(drm_dp_get_128b132b_link_rates);
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index 2ba89fee097d6..7ef06e68878d4 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -233,27 +233,10 @@ static void intel_dp_set_dpcd_sink_rates(struct intel_dp *intel_dp)
uhbr_rates = drm_dprx_128b132b_link_rates(intel_dp->tunnel, uhbr_rates);
- if (drm_dp_lttpr_count(intel_dp->lttpr_common_caps)) {
- /* We have a repeater */
- if (intel_dp->lttpr_common_caps[0] >= 0x20 &&
- intel_dp->lttpr_common_caps[DP_MAIN_LINK_CHANNEL_CODING_PHY_REPEATER -
- DP_LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV] &
- DP_PHY_REPEATER_128B132B_SUPPORTED) {
- /* Repeater supports 128b/132b, valid UHBR rates */
- uhbr_rates &= intel_dp->lttpr_common_caps[DP_PHY_REPEATER_128B132B_RATES -
- DP_LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV];
- } else {
- /* Does not support 128b/132b */
- uhbr_rates = 0;
- }
- }
-
- if (uhbr_rates & DP_UHBR10)
- intel_dp->sink_rates[i++] = 1000000;
- if (uhbr_rates & DP_UHBR13_5)
- intel_dp->sink_rates[i++] = 1350000;
- if (uhbr_rates & DP_UHBR20)
- intel_dp->sink_rates[i++] = 2000000;
+ i += drm_dp_get_128b132b_link_rates(intel_dp->lttpr_common_caps,
+ intel_dp->tunnel,
+ uhbr_rates,
+ &intel_dp->sink_rates[i]);
}
intel_dp->num_sink_rates = i;
diff --git a/include/drm/display/drm_dp.h b/include/drm/display/drm_dp.h
index a2a7338552e13..6efacff09567c 100644
--- a/include/drm/display/drm_dp.h
+++ b/include/drm/display/drm_dp.h
@@ -1228,6 +1228,7 @@
# define DP_UHBR10 (1 << 0)
# define DP_UHBR20 (1 << 1)
# define DP_UHBR13_5 (1 << 2)
+# define DP_MAX_128B132B_SUPPORTED_RATES 3
#define DP_128B132B_TRAINING_AUX_RD_INTERVAL 0x2216 /* 2.0 */
# define DP_128B132B_TRAINING_AUX_RD_INTERVAL_1MS_UNIT (1 << 7)
@@ -1528,6 +1529,7 @@
/* LTTPR: Link Training (LT)-tunable PHY Repeaters */
#define DP_LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV 0xf0000 /* 1.3 */
+#define DP_LTTPR_REV_SUP_128B132B 0x20
#define DP_MAX_LINK_RATE_PHY_REPEATER 0xf0001 /* 1.4a */
#define DP_PHY_REPEATER_CNT 0xf0002 /* 1.3 */
#define DP_PHY_REPEATER_MODE 0xf0003 /* 1.3 */
diff --git a/include/drm/display/drm_dp_helper.h b/include/drm/display/drm_dp_helper.h
index b67bb06f6e07e..a8c382a2c916f 100644
--- a/include/drm/display/drm_dp_helper.h
+++ b/include/drm/display/drm_dp_helper.h
@@ -708,6 +708,10 @@ u8 drm_dprx_128b132b_link_rates(const struct drm_dp_tunnel *tunnel,
u8 uhbr_rates);
bool drm_dprx_supports_128b132b(const struct drm_dp_tunnel *tunnel,
const u8 dpcd[DP_RECEIVER_CAP_SIZE]);
+int drm_dp_get_128b132b_link_rates(const u8 lttpr_common_caps[DP_LTTPR_COMMON_CAP_SIZE],
+ const struct drm_dp_tunnel *tunnel,
+ u8 uhbr_rates,
+ int link_rates[DP_MAX_128B132B_SUPPORTED_RATES]);
int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux,
u8 status[DP_LINK_STATUS_SIZE]);
--
2.43.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 05/10] drm/dp: Move DP sink link rates reading helper out of i915
2026-11-25 14:01 [PATCH v2 00/10] Move DRM helpers out of i915 driver Kory Maincent
` (3 preceding siblings ...)
2026-11-25 14:01 ` [PATCH v2 04/10] drm/dp: Move supported 128b/132b link rates " Kory Maincent
@ 2026-11-25 14:01 ` Kory Maincent
2026-11-25 14:01 ` [PATCH v2 06/10] drm/dp: Make the DPRX link rates helpers static Kory Maincent
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Kory Maincent @ 2026-11-25 14:01 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter, Jani Nikula, Rodrigo Vivi,
Joonas Lahtinen, Tvrtko Ursulin
Cc: Louis Chauvet, Luca Ceresoli, Thomas Petazzoni, Mark Yacoub,
Sean Paul, Manasi Navare, Drew Davenport, dri-devel,
linux-kernel, intel-gfx, intel-xe, Kory Maincent
Move the DP sink link rates reading function out of the i915 driver
into the generic DRM helpers. This function provides everything needed
to properly extract link rate capabilities from the DPCD, limited by
the capabilities of the LTTPRs or the DP tunnel when present.
No functional change intended.
Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
drivers/gpu/drm/display/drm_dp_helper.c | 89 +++++++++++++++++++++++++++++++++
drivers/gpu/drm/i915/display/intel_dp.c | 82 ++++++++----------------------
include/drm/display/drm_dp.h | 1 +
include/drm/display/drm_dp_helper.h | 8 +++
4 files changed, 118 insertions(+), 62 deletions(-)
diff --git a/drivers/gpu/drm/display/drm_dp_helper.c b/drivers/gpu/drm/display/drm_dp_helper.c
index a0afb5eff5bb4..e06264c52bf5e 100644
--- a/drivers/gpu/drm/display/drm_dp_helper.c
+++ b/drivers/gpu/drm/display/drm_dp_helper.c
@@ -5001,3 +5001,92 @@ drm_dp_get_128b132b_link_rates(const u8 lttpr_common_caps[DP_LTTPR_COMMON_CAP_SI
return i;
}
EXPORT_SYMBOL_GPL(drm_dp_get_128b132b_link_rates);
+
+/**
+ * drm_dp_read_dpcd_sink_rates() - read the sink rates from the DPCD
+ * @aux: DisplayPort AUX channel
+ * @dpcd: DPCD receiver capabilities
+ * @lttpr_common_caps: LTTPR common capabilities
+ * @desc: DisplayPort sink descriptor
+ * @tunnel: Tunnel object (NULL if not supported)
+ * @sink_rates: Array of DP_MAX_SUPPORTED_RATES entries to store the sink rates
+ *
+ * Read the link rates supported by a DisplayPort sink from the DPCD
+ * DP_MAX_LINK_RATE and DP_128B132B_SUPPORTED_LINK_RATES registers, limited by
+ * the capabilities of the LTTPRs or the tunnel if any is present.
+ * The rates are stored in @sink_rates in ascending order.
+ *
+ * The DPCD receiver capabilities, the LTTPR common capabilities, the tunnel
+ * and the sink descriptor are passed by the caller instead of being read
+ * from the DPCD. Drivers which already read them, like i915, can pass them
+ * to avoid duplicate DPCD reads.
+ *
+ * Returns: The number of supported sink rates.
+ */
+int drm_dp_read_dpcd_sink_rates(struct drm_dp_aux *aux,
+ const u8 dpcd[DP_RECEIVER_CAP_SIZE],
+ const u8 lttpr_common_caps[DP_LTTPR_COMMON_CAP_SIZE],
+ const struct drm_dp_desc *desc,
+ const struct drm_dp_tunnel *tunnel,
+ int sink_rates[DP_MAX_SUPPORTED_RATES])
+{
+ static const int dp_rates[] = {
+ 162000, 270000, 540000, 810000
+ };
+ int max_rate, max_lttpr_rate = 0, ret, i;
+ u8 uhbr_rates = 0;
+
+ BUILD_BUG_ON(ARRAY_SIZE(dp_rates) + DP_MAX_128B132B_SUPPORTED_RATES >
+ DP_MAX_SUPPORTED_RATES);
+
+ if (drm_dp_has_quirk(desc, DP_DPCD_QUIRK_CAN_DO_MAX_LINK_RATE_3_24_GBPS)) {
+ /* Needed, e.g., for Apple MBP 2017, 15 inch eDP Retina panel */
+ static const int quirk_rates[] = { 162000, 270000, 324000 };
+
+ memcpy(sink_rates, quirk_rates, sizeof(quirk_rates));
+
+ return ARRAY_SIZE(quirk_rates);
+ }
+
+ /*
+ * Sink rates for 8b/10b.
+ */
+ max_rate = drm_dprx_max_rate(tunnel, dpcd);
+ if (lttpr_common_caps && lttpr_common_caps[0] >= DP_LTTPR_REV_SUP_8B10B)
+ max_lttpr_rate = drm_dp_lttpr_max_link_rate(lttpr_common_caps);
+
+ if (max_lttpr_rate)
+ max_rate = min(max_rate, max_lttpr_rate);
+
+ for (i = 0; i < ARRAY_SIZE(dp_rates); i++) {
+ if (dp_rates[i] > max_rate)
+ break;
+ sink_rates[i] = dp_rates[i];
+ }
+
+ /*
+ * The following register must be read unconditionally for the later
+ * DP tunnel 128b132b detection to work, see DP Standard v2.1 5.14.3 .
+ */
+ ret = drm_dp_dpcd_read_byte(aux, DP_128B132B_SUPPORTED_LINK_RATES,
+ &uhbr_rates);
+ if (ret < 0) {
+ drm_dbg_kms(aux->drm_dev,
+ "%s: Failed to read DPCD 128B/132B supported link rates (%d)\n",
+ aux->name, ret);
+ uhbr_rates = 0;
+ }
+
+ /*
+ * Sink rates for 128b/132b. If set, sink should support all 8b/10b
+ * rates and 10 Gbps.
+ */
+ if (drm_dprx_supports_128b132b(tunnel, dpcd))
+ i += drm_dp_get_128b132b_link_rates(lttpr_common_caps,
+ tunnel,
+ uhbr_rates,
+ &sink_rates[i]);
+
+ return i;
+}
+EXPORT_SYMBOL_GPL(drm_dp_read_dpcd_sink_rates);
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index 7ef06e68878d4..8fee2d195c944 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -176,70 +176,18 @@ static void intel_dp_set_default_sink_rates(struct intel_dp *intel_dp)
/* update sink rates from dpcd */
static void intel_dp_set_dpcd_sink_rates(struct intel_dp *intel_dp)
{
- struct intel_display *display = to_intel_display(intel_dp);
- static const int dp_rates[] = {
- 162000, 270000, 540000, 810000
- };
- int i, max_rate;
- int max_lttpr_rate;
- u8 uhbr_rates = 0;
-
- if (drm_dp_has_quirk(&intel_dp->desc, DP_DPCD_QUIRK_CAN_DO_MAX_LINK_RATE_3_24_GBPS)) {
- /* Needed, e.g., for Apple MBP 2017, 15 inch eDP Retina panel */
- static const int quirk_rates[] = { 162000, 270000, 324000 };
-
- memcpy(intel_dp->sink_rates, quirk_rates, sizeof(quirk_rates));
- intel_dp->num_sink_rates = ARRAY_SIZE(quirk_rates);
-
- return;
- }
-
- /*
- * Sink rates for 8b/10b.
- */
- max_rate = drm_dprx_max_rate(intel_dp->tunnel, intel_dp->dpcd);
-
- /*
- * Some platforms + eDP panels may not reliably support HBR3
- * due to signal integrity limitations, despite advertising it.
- * Cap the link rate to HBR2 to avoid unstable configurations for the
- * known machines.
- */
- if (intel_dp_is_edp(intel_dp) && intel_has_quirk(display, QUIRK_EDP_LIMIT_RATE_HBR2))
- max_rate = min(max_rate, 540000);
-
- max_lttpr_rate = drm_dp_lttpr_max_link_rate(intel_dp->lttpr_common_caps);
- if (max_lttpr_rate)
- max_rate = min(max_rate, max_lttpr_rate);
+ int num_sink_rates;
- for (i = 0; i < ARRAY_SIZE(dp_rates); i++) {
- if (dp_rates[i] > max_rate)
- break;
- intel_dp->sink_rates[i] = dp_rates[i];
- }
-
- /*
- * The following register must be read unconditionally for the later
- * DP tunnel 128b132b detection to work, see DP Standard v2.1 5.14.3 .
- */
- drm_dp_dpcd_read_byte(&intel_dp->aux, DP_128B132B_SUPPORTED_LINK_RATES, &uhbr_rates);
-
- /*
- * Sink rates for 128b/132b. If set, sink should support all 8b/10b
- * rates and 10 Gbps.
- */
- if (drm_dprx_supports_128b132b(intel_dp->tunnel, intel_dp->dpcd)) {
- BUILD_BUG_ON(ARRAY_SIZE(intel_dp->sink_rates) < ARRAY_SIZE(dp_rates) + 3);
-
- uhbr_rates = drm_dprx_128b132b_link_rates(intel_dp->tunnel, uhbr_rates);
-
- i += drm_dp_get_128b132b_link_rates(intel_dp->lttpr_common_caps,
- intel_dp->tunnel,
- uhbr_rates,
- &intel_dp->sink_rates[i]);
- }
+ num_sink_rates = drm_dp_read_dpcd_sink_rates(&intel_dp->aux,
+ intel_dp->dpcd,
+ intel_dp->lttpr_common_caps,
+ &intel_dp->desc,
+ intel_dp->tunnel,
+ intel_dp->sink_rates);
+ if (num_sink_rates < 0)
+ num_sink_rates = 0;
- intel_dp->num_sink_rates = i;
+ intel_dp->num_sink_rates = num_sink_rates;
}
static void intel_dp_set_sink_rates(struct intel_dp *intel_dp)
@@ -4921,6 +4869,16 @@ intel_edp_set_sink_rates(struct intel_dp *intel_dp)
else
intel_dp_set_sink_rates(intel_dp);
+ /*
+ * Some platforms cannot reliably drive HBR3 rates due to PHY limitations,
+ * even if the sink advertises support. Reject any sink rates above HBR2 on
+ * the known machines for stable output.
+ */
+ if (intel_dp->num_sink_rates && intel_has_quirk(display, QUIRK_EDP_LIMIT_RATE_HBR2))
+ intel_dp->num_sink_rates = intel_dp_rate_limit_len(intel_dp->sink_rates,
+ intel_dp->num_sink_rates,
+ 540000);
+
intel_edp_set_data_override_rates(intel_dp);
}
diff --git a/include/drm/display/drm_dp.h b/include/drm/display/drm_dp.h
index 6efacff09567c..8c1d8b79dc7fd 100644
--- a/include/drm/display/drm_dp.h
+++ b/include/drm/display/drm_dp.h
@@ -1529,6 +1529,7 @@
/* LTTPR: Link Training (LT)-tunable PHY Repeaters */
#define DP_LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV 0xf0000 /* 1.3 */
+#define DP_LTTPR_REV_SUP_8B10B 0x14
#define DP_LTTPR_REV_SUP_128B132B 0x20
#define DP_MAX_LINK_RATE_PHY_REPEATER 0xf0001 /* 1.4a */
#define DP_PHY_REPEATER_CNT 0xf0002 /* 1.3 */
diff --git a/include/drm/display/drm_dp_helper.h b/include/drm/display/drm_dp_helper.h
index a8c382a2c916f..5c4cb57f0fc5e 100644
--- a/include/drm/display/drm_dp_helper.h
+++ b/include/drm/display/drm_dp_helper.h
@@ -34,6 +34,7 @@ struct drm_dp_aux;
struct drm_panel;
struct drm_printer;
struct drm_dp_tunnel;
+struct drm_dp_desc;
bool drm_dp_channel_eq_ok(const u8 link_status[DP_LINK_STATUS_SIZE],
int lane_count);
@@ -713,6 +714,13 @@ int drm_dp_get_128b132b_link_rates(const u8 lttpr_common_caps[DP_LTTPR_COMMON_CA
u8 uhbr_rates,
int link_rates[DP_MAX_128B132B_SUPPORTED_RATES]);
+int drm_dp_read_dpcd_sink_rates(struct drm_dp_aux *aux,
+ const u8 dpcd[DP_RECEIVER_CAP_SIZE],
+ const u8 lttpr_common_caps[DP_LTTPR_COMMON_CAP_SIZE],
+ const struct drm_dp_desc *desc,
+ const struct drm_dp_tunnel *tunnel,
+ int sink_rates[DP_MAX_SUPPORTED_RATES]);
+
int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux,
u8 status[DP_LINK_STATUS_SIZE]);
--
2.43.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 06/10] drm/dp: Make the DPRX link rates helpers static
2026-11-25 14:01 [PATCH v2 00/10] Move DRM helpers out of i915 driver Kory Maincent
` (4 preceding siblings ...)
2026-11-25 14:01 ` [PATCH v2 05/10] drm/dp: Move DP sink link rates reading " Kory Maincent
@ 2026-11-25 14:01 ` Kory Maincent
2026-11-25 14:01 ` [PATCH v2 07/10] drm/dp: Add drm_dp_read_dpcd_supported_link_rates() helper Kory Maincent
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Kory Maincent @ 2026-11-25 14:01 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter, Jani Nikula, Rodrigo Vivi,
Joonas Lahtinen, Tvrtko Ursulin
Cc: Louis Chauvet, Luca Ceresoli, Thomas Petazzoni, Mark Yacoub,
Sean Paul, Manasi Navare, Drew Davenport, dri-devel,
linux-kernel, intel-gfx, intel-xe, Kory Maincent
The DPRX link rates helpers are now only used by the DP sink link
rates reading function, so make them static and remove their
declarations from the public header.
Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
drivers/gpu/drm/display/drm_dp_helper.c | 18 +++++++-----------
include/drm/display/drm_dp_helper.h | 11 -----------
2 files changed, 7 insertions(+), 22 deletions(-)
diff --git a/drivers/gpu/drm/display/drm_dp_helper.c b/drivers/gpu/drm/display/drm_dp_helper.c
index e06264c52bf5e..30935d3ae0055 100644
--- a/drivers/gpu/drm/display/drm_dp_helper.c
+++ b/drivers/gpu/drm/display/drm_dp_helper.c
@@ -4916,18 +4916,17 @@ int drm_dp_max_dprx_data_rate(int max_link_rate, int max_lanes)
}
EXPORT_SYMBOL(drm_dp_max_dprx_data_rate);
-int drm_dprx_max_rate(const struct drm_dp_tunnel *tunnel,
- const u8 dpcd[DP_RECEIVER_CAP_SIZE])
+static int drm_dprx_max_rate(const struct drm_dp_tunnel *tunnel,
+ const u8 dpcd[DP_RECEIVER_CAP_SIZE])
{
if (tunnel && drm_dp_tunnel_bw_alloc_is_enabled(tunnel))
return drm_dp_tunnel_max_dprx_rate(tunnel);
else
return drm_dp_bw_code_to_link_rate(dpcd[DP_MAX_LINK_RATE]);
}
-EXPORT_SYMBOL_GPL(drm_dprx_max_rate);
-u8 drm_dprx_128b132b_link_rates(const struct drm_dp_tunnel *tunnel,
- u8 uhbr_rates)
+static u8 drm_dprx_128b132b_link_rates(const struct drm_dp_tunnel *tunnel,
+ u8 uhbr_rates)
{
if (!drm_dp_tunnel_bw_alloc_is_enabled(tunnel))
return uhbr_rates;
@@ -4938,17 +4937,15 @@ u8 drm_dprx_128b132b_link_rates(const struct drm_dp_tunnel *tunnel,
return drm_dp_tunnel_128b132b_dprx_rates(tunnel);
}
-EXPORT_SYMBOL_GPL(drm_dprx_128b132b_link_rates);
-bool drm_dprx_supports_128b132b(const struct drm_dp_tunnel *tunnel,
- const u8 dpcd[DP_RECEIVER_CAP_SIZE])
+static bool drm_dprx_supports_128b132b(const struct drm_dp_tunnel *tunnel,
+ const u8 dpcd[DP_RECEIVER_CAP_SIZE])
{
if (tunnel && drm_dp_tunnel_bw_alloc_is_enabled(tunnel))
return drm_dp_tunnel_128b132b_supported(tunnel);
else
return drm_dp_128b132b_supported(dpcd);
}
-EXPORT_SYMBOL_GPL(drm_dprx_supports_128b132b);
/**
* drm_dp_get_128b132b_link_rates() - get the supported 128b/132b link rates
@@ -4965,7 +4962,7 @@ EXPORT_SYMBOL_GPL(drm_dprx_supports_128b132b);
*
* Returns: The number of link rates stored in @link_rates.
*/
-int
+static int
drm_dp_get_128b132b_link_rates(const u8 lttpr_common_caps[DP_LTTPR_COMMON_CAP_SIZE],
const struct drm_dp_tunnel *tunnel,
u8 uhbr_rates,
@@ -5000,7 +4997,6 @@ drm_dp_get_128b132b_link_rates(const u8 lttpr_common_caps[DP_LTTPR_COMMON_CAP_SI
return i;
}
-EXPORT_SYMBOL_GPL(drm_dp_get_128b132b_link_rates);
/**
* drm_dp_read_dpcd_sink_rates() - read the sink rates from the DPCD
diff --git a/include/drm/display/drm_dp_helper.h b/include/drm/display/drm_dp_helper.h
index 5c4cb57f0fc5e..dd4c4a6ff17d1 100644
--- a/include/drm/display/drm_dp_helper.h
+++ b/include/drm/display/drm_dp_helper.h
@@ -703,17 +703,6 @@ static inline int drm_dp_dpcd_write_byte(struct drm_dp_aux *aux,
int drm_dp_read_dpcd_caps(struct drm_dp_aux *aux,
u8 dpcd[DP_RECEIVER_CAP_SIZE]);
-int drm_dprx_max_rate(const struct drm_dp_tunnel *tunnel,
- const u8 dpcd[DP_RECEIVER_CAP_SIZE]);
-u8 drm_dprx_128b132b_link_rates(const struct drm_dp_tunnel *tunnel,
- u8 uhbr_rates);
-bool drm_dprx_supports_128b132b(const struct drm_dp_tunnel *tunnel,
- const u8 dpcd[DP_RECEIVER_CAP_SIZE]);
-int drm_dp_get_128b132b_link_rates(const u8 lttpr_common_caps[DP_LTTPR_COMMON_CAP_SIZE],
- const struct drm_dp_tunnel *tunnel,
- u8 uhbr_rates,
- int link_rates[DP_MAX_128B132B_SUPPORTED_RATES]);
-
int drm_dp_read_dpcd_sink_rates(struct drm_dp_aux *aux,
const u8 dpcd[DP_RECEIVER_CAP_SIZE],
const u8 lttpr_common_caps[DP_LTTPR_COMMON_CAP_SIZE],
--
2.43.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 07/10] drm/dp: Add drm_dp_read_dpcd_supported_link_rates() helper
2026-11-25 14:01 [PATCH v2 00/10] Move DRM helpers out of i915 driver Kory Maincent
` (5 preceding siblings ...)
2026-11-25 14:01 ` [PATCH v2 06/10] drm/dp: Make the DPRX link rates helpers static Kory Maincent
@ 2026-11-25 14:01 ` Kory Maincent
2026-11-25 14:01 ` [PATCH v2 08/10] drm/dp: Move eDP sink link rates reading helper out of i915 Kory Maincent
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Kory Maincent @ 2026-11-25 14:01 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter, Jani Nikula, Rodrigo Vivi,
Joonas Lahtinen, Tvrtko Ursulin
Cc: Louis Chauvet, Luca Ceresoli, Thomas Petazzoni, Mark Yacoub,
Sean Paul, Manasi Navare, Drew Davenport, dri-devel,
linux-kernel, intel-gfx, intel-xe, Kory Maincent
Add a new drm_dp_read_dpcd_supported_link_rates() helper which reads
the DPCD DP_SUPPORTED_LINK_RATES registers and converts their values
into link rates. Use it from the i915 eDP sink rates handling.
The custom Intel eDP HBR2 limitation quirk handling stays in the driver.
Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
Changes in v2:
- Fix a small possible issue (sashiko) in case of an intel quirk
and supported link rates exceeding 540000 kHz
- Split the patch in 3 for readability
---
drivers/gpu/drm/display/drm_dp_helper.c | 27 +++++++++++++
drivers/gpu/drm/i915/display/intel_dp.c | 72 +++++++++++++--------------------
include/drm/display/drm_dp_helper.h | 3 ++
3 files changed, 58 insertions(+), 44 deletions(-)
diff --git a/drivers/gpu/drm/display/drm_dp_helper.c b/drivers/gpu/drm/display/drm_dp_helper.c
index 30935d3ae0055..6d684b6b94d0a 100644
--- a/drivers/gpu/drm/display/drm_dp_helper.c
+++ b/drivers/gpu/drm/display/drm_dp_helper.c
@@ -4916,6 +4916,33 @@ int drm_dp_max_dprx_data_rate(int max_link_rate, int max_lanes)
}
EXPORT_SYMBOL(drm_dp_max_dprx_data_rate);
+/**
+ * drm_dp_read_dpcd_supported_link_rates() - read DPCD supported link rates
+ * @aux: DisplayPort AUX channel
+ * @link_rates: Buffer to store the resulting link rates supported
+ *
+ * Attempts to read the DPCD supported link rates for @aux.
+ *
+ * Returns: The number of supported link rates, negative error code otherwise.
+ */
+int drm_dp_read_dpcd_supported_link_rates(struct drm_dp_aux *aux,
+ int link_rates[DP_MAX_SUPPORTED_RATES])
+{
+ __le16 dpcd_link_rates[DP_MAX_SUPPORTED_RATES] = {0};
+ int ret, i;
+
+ ret = drm_dp_dpcd_read_data(aux, DP_SUPPORTED_LINK_RATES,
+ dpcd_link_rates, sizeof(dpcd_link_rates));
+ if (ret < 0)
+ return ret;
+
+ for (i = 0; i < ARRAY_SIZE(dpcd_link_rates) && dpcd_link_rates[i]; i++)
+ link_rates[i] = le16_to_cpu(dpcd_link_rates[i]) * 20;
+
+ return i;
+}
+EXPORT_SYMBOL_GPL(drm_dp_read_dpcd_supported_link_rates);
+
static int drm_dprx_max_rate(const struct drm_dp_tunnel *tunnel,
const u8 dpcd[DP_RECEIVER_CAP_SIZE])
{
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index 8fee2d195c944..798274a7b70ea 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -4811,6 +4811,24 @@ intel_edp_set_data_override_rates(struct intel_dp *intel_dp)
intel_dp->num_sink_rates = count;
}
+/*
+ * Some platforms cannot reliably drive HBR3 rates due to PHY limitations,
+ * even if the sink advertises support. Reject any sink rates above HBR2 on
+ * the known machines for stable output.
+ */
+static void intel_edp_limit_sink_rates_hbr2(struct intel_dp *intel_dp)
+{
+ struct intel_display *display = to_intel_display(intel_dp);
+
+ if (!intel_dp->num_sink_rates ||
+ !intel_has_quirk(display, QUIRK_EDP_LIMIT_RATE_HBR2))
+ return;
+
+ intel_dp->num_sink_rates = intel_dp_rate_limit_len(intel_dp->sink_rates,
+ intel_dp->num_sink_rates,
+ 540000);
+}
+
static void
intel_edp_set_sink_rates(struct intel_dp *intel_dp)
{
@@ -4819,65 +4837,31 @@ intel_edp_set_sink_rates(struct intel_dp *intel_dp)
intel_dp->num_sink_rates = 0;
if (intel_dp->edp_dpcd[0] >= DP_EDP_14) {
- __le16 sink_rates[DP_MAX_SUPPORTED_RATES];
int ret;
- int i;
- ret = drm_dp_dpcd_read_data(&intel_dp->aux,
- DP_SUPPORTED_LINK_RATES,
- sink_rates, sizeof(sink_rates));
+ ret = drm_dp_read_dpcd_supported_link_rates(&intel_dp->aux,
+ intel_dp->sink_rates);
if (ret < 0) {
drm_dbg_kms(display->drm,
"Unable to read eDP supported link rates, using default rates\n");
- memset(sink_rates, 0, sizeof(sink_rates));
+ ret = 0;
}
- for (i = 0; i < ARRAY_SIZE(sink_rates); i++) {
- int rate;
-
- /* Value read multiplied by 200kHz gives the per-lane
- * link rate in kHz. The source rates are, however,
- * stored in terms of LS_Clk kHz. The full conversion
- * back to symbols is
- * (val * 200kHz)*(8/10 ch. encoding)*(1/8 bit to Byte)
- */
- rate = le16_to_cpu(sink_rates[i]) * 200 / 10;
-
- if (rate == 0)
- break;
-
- /*
- * Some platforms cannot reliably drive HBR3 rates due to PHY limitations,
- * even if the sink advertises support. Reject any sink rates above HBR2 on
- * the known machines for stable output.
- */
- if (rate > 540000 &&
- intel_has_quirk(display, QUIRK_EDP_LIMIT_RATE_HBR2))
- break;
-
- intel_dp->sink_rates[i] = rate;
- }
- intel_dp->num_sink_rates = i;
+ intel_dp->num_sink_rates = ret;
}
+ intel_edp_limit_sink_rates_hbr2(intel_dp);
+
/*
* Use DP_LINK_RATE_SET if DP_SUPPORTED_LINK_RATES are available,
* default to DP_MAX_LINK_RATE and DP_LINK_BW_SET otherwise.
*/
- if (intel_dp->num_sink_rates)
+ if (intel_dp->num_sink_rates) {
intel_dp->use_rate_select = true;
- else
+ } else {
intel_dp_set_sink_rates(intel_dp);
-
- /*
- * Some platforms cannot reliably drive HBR3 rates due to PHY limitations,
- * even if the sink advertises support. Reject any sink rates above HBR2 on
- * the known machines for stable output.
- */
- if (intel_dp->num_sink_rates && intel_has_quirk(display, QUIRK_EDP_LIMIT_RATE_HBR2))
- intel_dp->num_sink_rates = intel_dp_rate_limit_len(intel_dp->sink_rates,
- intel_dp->num_sink_rates,
- 540000);
+ intel_edp_limit_sink_rates_hbr2(intel_dp);
+ }
intel_edp_set_data_override_rates(intel_dp);
}
diff --git a/include/drm/display/drm_dp_helper.h b/include/drm/display/drm_dp_helper.h
index dd4c4a6ff17d1..2e018f1e59363 100644
--- a/include/drm/display/drm_dp_helper.h
+++ b/include/drm/display/drm_dp_helper.h
@@ -703,6 +703,9 @@ static inline int drm_dp_dpcd_write_byte(struct drm_dp_aux *aux,
int drm_dp_read_dpcd_caps(struct drm_dp_aux *aux,
u8 dpcd[DP_RECEIVER_CAP_SIZE]);
+int drm_dp_read_dpcd_supported_link_rates(struct drm_dp_aux *aux,
+ int link_rates[DP_MAX_SUPPORTED_RATES]);
+
int drm_dp_read_dpcd_sink_rates(struct drm_dp_aux *aux,
const u8 dpcd[DP_RECEIVER_CAP_SIZE],
const u8 lttpr_common_caps[DP_LTTPR_COMMON_CAP_SIZE],
--
2.43.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 08/10] drm/dp: Move eDP sink link rates reading helper out of i915
2026-11-25 14:01 [PATCH v2 00/10] Move DRM helpers out of i915 driver Kory Maincent
` (6 preceding siblings ...)
2026-11-25 14:01 ` [PATCH v2 07/10] drm/dp: Add drm_dp_read_dpcd_supported_link_rates() helper Kory Maincent
@ 2026-11-25 14:01 ` Kory Maincent
2026-11-25 14:01 ` [PATCH v2 09/10] drm/dp: Make the eDP supported link rates helper static Kory Maincent
2026-11-25 14:01 ` [PATCH v2 10/10] drm: Move DSC capability reading helper out of i915 Kory Maincent
9 siblings, 0 replies; 11+ messages in thread
From: Kory Maincent @ 2026-11-25 14:01 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter, Jani Nikula, Rodrigo Vivi,
Joonas Lahtinen, Tvrtko Ursulin
Cc: Louis Chauvet, Luca Ceresoli, Thomas Petazzoni, Mark Yacoub,
Sean Paul, Manasi Navare, Drew Davenport, dri-devel,
linux-kernel, intel-gfx, intel-xe, Kory Maincent
Move the eDP sink link rates reading function out of the i915 driver
into the generic DRM helpers. The helper reads the rates from the DPCD
DP_SUPPORTED_LINK_RATES registers, available on eDP 1.4 and later
sinks.
No functional change intended.
Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
Changes in v2:
- New patch extracted from the split of the 7
---
drivers/gpu/drm/display/drm_dp_helper.c | 32 ++++++++++++++++++++++++++++++++
drivers/gpu/drm/i915/display/intel_dp.c | 23 +++++++----------------
include/drm/display/drm_dp_helper.h | 2 ++
3 files changed, 41 insertions(+), 16 deletions(-)
diff --git a/drivers/gpu/drm/display/drm_dp_helper.c b/drivers/gpu/drm/display/drm_dp_helper.c
index 6d684b6b94d0a..d26088a1ab232 100644
--- a/drivers/gpu/drm/display/drm_dp_helper.c
+++ b/drivers/gpu/drm/display/drm_dp_helper.c
@@ -5113,3 +5113,35 @@ int drm_dp_read_dpcd_sink_rates(struct drm_dp_aux *aux,
return i;
}
EXPORT_SYMBOL_GPL(drm_dp_read_dpcd_sink_rates);
+
+/**
+ * drm_dp_read_edp_sink_rates() - read the sink rates from the eDP DPCD
+ * @aux: DisplayPort AUX channel
+ * @edp_dpcd_rev: eDP DPCD revision of the sink
+ * @sink_rates: Array of DP_MAX_SUPPORTED_RATES entries to store the sink rates
+ *
+ * Read the link rates supported by an eDP sink from the DPCD
+ * DP_SUPPORTED_LINK_RATES registers, available on eDP 1.4 and later sinks.
+ *
+ * Returns: The number of supported sink rates, 0 if the sink does not support
+ * the DP_SUPPORTED_LINK_RATES register.
+ */
+int drm_dp_read_edp_sink_rates(struct drm_dp_aux *aux, u8 edp_dpcd_rev,
+ int sink_rates[DP_MAX_SUPPORTED_RATES])
+{
+ int num_sink_rates;
+
+ if (edp_dpcd_rev < DP_EDP_14)
+ return 0;
+
+ num_sink_rates = drm_dp_read_dpcd_supported_link_rates(aux, sink_rates);
+ if (num_sink_rates < 0) {
+ drm_dbg_kms(aux->drm_dev,
+ "%s: Unable to read eDP supported link rates (%d)\n",
+ aux->name, num_sink_rates);
+ return 0;
+ }
+
+ return num_sink_rates;
+}
+EXPORT_SYMBOL_GPL(drm_dp_read_edp_sink_rates);
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index 798274a7b70ea..db72e7d152689 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -4832,24 +4832,15 @@ static void intel_edp_limit_sink_rates_hbr2(struct intel_dp *intel_dp)
static void
intel_edp_set_sink_rates(struct intel_dp *intel_dp)
{
- struct intel_display *display = to_intel_display(intel_dp);
-
- intel_dp->num_sink_rates = 0;
-
- if (intel_dp->edp_dpcd[0] >= DP_EDP_14) {
- int ret;
-
- ret = drm_dp_read_dpcd_supported_link_rates(&intel_dp->aux,
- intel_dp->sink_rates);
- if (ret < 0) {
- drm_dbg_kms(display->drm,
- "Unable to read eDP supported link rates, using default rates\n");
- ret = 0;
- }
+ int num_sink_rates;
- intel_dp->num_sink_rates = ret;
- }
+ num_sink_rates = drm_dp_read_edp_sink_rates(&intel_dp->aux,
+ intel_dp->edp_dpcd[0],
+ intel_dp->sink_rates);
+ if (num_sink_rates < 0)
+ num_sink_rates = 0;
+ intel_dp->num_sink_rates = num_sink_rates;
intel_edp_limit_sink_rates_hbr2(intel_dp);
/*
diff --git a/include/drm/display/drm_dp_helper.h b/include/drm/display/drm_dp_helper.h
index 2e018f1e59363..c3677683c5f80 100644
--- a/include/drm/display/drm_dp_helper.h
+++ b/include/drm/display/drm_dp_helper.h
@@ -712,6 +712,8 @@ int drm_dp_read_dpcd_sink_rates(struct drm_dp_aux *aux,
const struct drm_dp_desc *desc,
const struct drm_dp_tunnel *tunnel,
int sink_rates[DP_MAX_SUPPORTED_RATES]);
+int drm_dp_read_edp_sink_rates(struct drm_dp_aux *aux, u8 edp_dpcd_rev,
+ int sink_rates[DP_MAX_SUPPORTED_RATES]);
int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux,
u8 status[DP_LINK_STATUS_SIZE]);
--
2.43.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 09/10] drm/dp: Make the eDP supported link rates helper static
2026-11-25 14:01 [PATCH v2 00/10] Move DRM helpers out of i915 driver Kory Maincent
` (7 preceding siblings ...)
2026-11-25 14:01 ` [PATCH v2 08/10] drm/dp: Move eDP sink link rates reading helper out of i915 Kory Maincent
@ 2026-11-25 14:01 ` Kory Maincent
2026-11-25 14:01 ` [PATCH v2 10/10] drm: Move DSC capability reading helper out of i915 Kory Maincent
9 siblings, 0 replies; 11+ messages in thread
From: Kory Maincent @ 2026-11-25 14:01 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter, Jani Nikula, Rodrigo Vivi,
Joonas Lahtinen, Tvrtko Ursulin
Cc: Louis Chauvet, Luca Ceresoli, Thomas Petazzoni, Mark Yacoub,
Sean Paul, Manasi Navare, Drew Davenport, dri-devel,
linux-kernel, intel-gfx, intel-xe, Kory Maincent
The supported link rates helper is now only used by the eDP sink link
rates reading function, so make it static and remove its declarations from
the public header.
Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
Changes in v2:
- New patch extracted from the split of the 7
---
drivers/gpu/drm/display/drm_dp_helper.c | 5 ++---
include/drm/display/drm_dp_helper.h | 3 ---
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/display/drm_dp_helper.c b/drivers/gpu/drm/display/drm_dp_helper.c
index d26088a1ab232..9938f3be8836a 100644
--- a/drivers/gpu/drm/display/drm_dp_helper.c
+++ b/drivers/gpu/drm/display/drm_dp_helper.c
@@ -4925,8 +4925,8 @@ EXPORT_SYMBOL(drm_dp_max_dprx_data_rate);
*
* Returns: The number of supported link rates, negative error code otherwise.
*/
-int drm_dp_read_dpcd_supported_link_rates(struct drm_dp_aux *aux,
- int link_rates[DP_MAX_SUPPORTED_RATES])
+static int drm_dp_read_dpcd_supported_link_rates(struct drm_dp_aux *aux,
+ int link_rates[DP_MAX_SUPPORTED_RATES])
{
__le16 dpcd_link_rates[DP_MAX_SUPPORTED_RATES] = {0};
int ret, i;
@@ -4941,7 +4941,6 @@ int drm_dp_read_dpcd_supported_link_rates(struct drm_dp_aux *aux,
return i;
}
-EXPORT_SYMBOL_GPL(drm_dp_read_dpcd_supported_link_rates);
static int drm_dprx_max_rate(const struct drm_dp_tunnel *tunnel,
const u8 dpcd[DP_RECEIVER_CAP_SIZE])
diff --git a/include/drm/display/drm_dp_helper.h b/include/drm/display/drm_dp_helper.h
index c3677683c5f80..81fe87ad47050 100644
--- a/include/drm/display/drm_dp_helper.h
+++ b/include/drm/display/drm_dp_helper.h
@@ -703,9 +703,6 @@ static inline int drm_dp_dpcd_write_byte(struct drm_dp_aux *aux,
int drm_dp_read_dpcd_caps(struct drm_dp_aux *aux,
u8 dpcd[DP_RECEIVER_CAP_SIZE]);
-int drm_dp_read_dpcd_supported_link_rates(struct drm_dp_aux *aux,
- int link_rates[DP_MAX_SUPPORTED_RATES]);
-
int drm_dp_read_dpcd_sink_rates(struct drm_dp_aux *aux,
const u8 dpcd[DP_RECEIVER_CAP_SIZE],
const u8 lttpr_common_caps[DP_LTTPR_COMMON_CAP_SIZE],
--
2.43.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 10/10] drm: Move DSC capability reading helper out of i915
2026-11-25 14:01 [PATCH v2 00/10] Move DRM helpers out of i915 driver Kory Maincent
` (8 preceding siblings ...)
2026-11-25 14:01 ` [PATCH v2 09/10] drm/dp: Make the eDP supported link rates helper static Kory Maincent
@ 2026-11-25 14:01 ` Kory Maincent
9 siblings, 0 replies; 11+ messages in thread
From: Kory Maincent @ 2026-11-25 14:01 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter, Jani Nikula, Rodrigo Vivi,
Joonas Lahtinen, Tvrtko Ursulin
Cc: Louis Chauvet, Luca Ceresoli, Thomas Petazzoni, Mark Yacoub,
Sean Paul, Manasi Navare, Drew Davenport, dri-devel,
linux-kernel, intel-gfx, intel-xe, Kory Maincent
Move the DSC capability reading helper out of the i915 driver into the
generic DRM helpers.
No functional change intended.
Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
Change in v2:
- Fix a kdoc typo
---
drivers/gpu/drm/display/drm_dp_helper.c | 30 ++++++++++++++++++++++++++++++
drivers/gpu/drm/i915/display/intel_dp.c | 27 ++++-----------------------
include/drm/display/drm_dp_helper.h | 2 ++
3 files changed, 36 insertions(+), 23 deletions(-)
diff --git a/drivers/gpu/drm/display/drm_dp_helper.c b/drivers/gpu/drm/display/drm_dp_helper.c
index 9938f3be8836a..599918353d34d 100644
--- a/drivers/gpu/drm/display/drm_dp_helper.c
+++ b/drivers/gpu/drm/display/drm_dp_helper.c
@@ -5144,3 +5144,33 @@ int drm_dp_read_edp_sink_rates(struct drm_dp_aux *aux, u8 edp_dpcd_rev,
return num_sink_rates;
}
EXPORT_SYMBOL_GPL(drm_dp_read_edp_sink_rates);
+
+/**
+ * drm_dp_dsc_read_dpcd() - read the DSC capabilities from the DPCD
+ * @aux: DisplayPort AUX channel
+ * @dsc_dpcd: Buffer to store the DSC capabilities read from the DPCD
+ *
+ * Attempts to read the sink DSC capabilities from the DPCD of @aux.
+ *
+ * Returns: 0 on success or a negative error code on failure.
+ */
+int drm_dp_dsc_read_dpcd(struct drm_dp_aux *aux,
+ u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE])
+{
+ int ret;
+
+ ret = drm_dp_dpcd_read_data(aux, DP_DSC_SUPPORT, dsc_dpcd,
+ DP_DSC_RECEIVER_CAP_SIZE);
+ if (ret < 0) {
+ drm_dbg_kms(aux->drm_dev,
+ "Could not read DSC DPCD register 0x%x Error: %pe\n",
+ DP_DSC_SUPPORT, ERR_PTR(ret));
+ return ret;
+ }
+
+ drm_dbg_kms(aux->drm_dev, "DSC DPCD: %*ph\n",
+ DP_DSC_RECEIVER_CAP_SIZE,
+ dsc_dpcd);
+ return 0;
+}
+EXPORT_SYMBOL_GPL(drm_dp_dsc_read_dpcd);
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index db72e7d152689..61f0b8a2b7916 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -4572,25 +4572,6 @@ static bool intel_dp_get_sst_split_sdp_status(u8 dprx)
return dprx & DP_SST_SPLIT_SDP_CAP;
}
-static int intel_dp_read_dsc_dpcd(struct drm_dp_aux *aux,
- u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE])
-{
- int ret;
-
- ret = drm_dp_dpcd_read_data(aux, DP_DSC_SUPPORT, dsc_dpcd, DP_DSC_RECEIVER_CAP_SIZE);
- if (ret < 0) {
- drm_dbg_kms(aux->drm_dev,
- "Could not read DSC DPCD register 0x%x Error: %pe\n",
- DP_DSC_SUPPORT, ERR_PTR(ret));
- return ret;
- }
-
- drm_dbg_kms(aux->drm_dev, "DSC DPCD: %*ph\n",
- DP_DSC_RECEIVER_CAP_SIZE,
- dsc_dpcd);
- return 0;
-}
-
static void init_dsc_overall_throughput_limits(struct intel_connector *connector, bool is_branch)
{
u8 branch_caps[DP_DSC_BRANCH_CAP_SIZE];
@@ -4641,8 +4622,8 @@ void intel_dp_get_dsc_sink_cap(u8 dpcd_rev,
if (dpcd_rev < DP_DPCD_REV_14)
return;
- ret = intel_dp_read_dsc_dpcd(connector->dp.dsc_decompression_aux,
- connector->dp.dsc_dpcd);
+ ret = drm_dp_dsc_read_dpcd(connector->dp.dsc_decompression_aux,
+ connector->dp.dsc_dpcd);
if (ret < 0)
return;
@@ -4676,8 +4657,8 @@ static void intel_edp_get_dsc_sink_cap(u8 edp_dpcd_rev, struct intel_connector *
if (edp_dpcd_rev < DP_EDP_14)
return;
- if (intel_dp_read_dsc_dpcd(connector->dp.dsc_decompression_aux,
- connector->dp.dsc_dpcd) < 0)
+ if (drm_dp_dsc_read_dpcd(connector->dp.dsc_decompression_aux,
+ connector->dp.dsc_dpcd) < 0)
return;
if (connector->dp.dsc_dpcd[0] & DP_DSC_DECOMPRESSION_IS_SUPPORTED)
diff --git a/include/drm/display/drm_dp_helper.h b/include/drm/display/drm_dp_helper.h
index 81fe87ad47050..4e2762d493bf3 100644
--- a/include/drm/display/drm_dp_helper.h
+++ b/include/drm/display/drm_dp_helper.h
@@ -216,6 +216,8 @@ drm_dp_is_branch(const u8 dpcd[DP_RECEIVER_CAP_SIZE])
}
/* DP/eDP DSC support */
+int drm_dp_dsc_read_dpcd(struct drm_dp_aux *aux,
+ u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE]);
u8 drm_dp_dsc_sink_bpp_incr(const u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE]);
u32 drm_dp_dsc_slice_count_to_mask(int slice_count);
u32 drm_dp_dsc_sink_slice_count_mask(const u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE],
--
2.43.0
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2026-11-25 14:02 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-25 14:01 [PATCH v2 00/10] Move DRM helpers out of i915 driver Kory Maincent
2026-11-25 14:01 ` [PATCH v2 01/10] drm/dp: Move max DPRX link rate helper out of i915 Kory Maincent
2026-11-25 14:01 ` [PATCH v2 02/10] drm/dp: Move DPRX 128b/132b link rates " Kory Maincent
2026-11-25 14:01 ` [PATCH v2 03/10] drm/dp: Move DPRX 128b/132b support " Kory Maincent
2026-11-25 14:01 ` [PATCH v2 04/10] drm/dp: Move supported 128b/132b link rates " Kory Maincent
2026-11-25 14:01 ` [PATCH v2 05/10] drm/dp: Move DP sink link rates reading " Kory Maincent
2026-11-25 14:01 ` [PATCH v2 06/10] drm/dp: Make the DPRX link rates helpers static Kory Maincent
2026-11-25 14:01 ` [PATCH v2 07/10] drm/dp: Add drm_dp_read_dpcd_supported_link_rates() helper Kory Maincent
2026-11-25 14:01 ` [PATCH v2 08/10] drm/dp: Move eDP sink link rates reading helper out of i915 Kory Maincent
2026-11-25 14:01 ` [PATCH v2 09/10] drm/dp: Make the eDP supported link rates helper static Kory Maincent
2026-11-25 14:01 ` [PATCH v2 10/10] drm: Move DSC capability reading helper out of i915 Kory Maincent
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®