[PATCH 2/8] drm/dp: Move DPRX 128b/132b link rates helper out of i915

From: Kory Maincent

Date: Wed Nov 18 2026 - 05:36:59 EST


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@xxxxxxxxxxx>
---
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