[PATCH 1/8] drm/dp: Move max DPRX link rate helper out of i915
From: Kory Maincent
Date: Wed Nov 18 2026 - 05:36:57 EST
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@xxxxxxxxxxx>
---
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