[PATCH 065/108] drm/i915/dp_tunnel: Query max link limits via link_caps for BW computation

Imre Deak
2026-04-28T12:54:50Z

Query the maximum link limits via the link caps interface to compute the
available TBT bandwidth. Unlike the max common link params used so far
for this, the max link limits also accounts for any forced link
parameters.

This makes the max_limits query uniform across modeset, mode validation,
link state checking, and TBT bandwidth computation. It also allows
intel_dp_link_caps_max_common_lane_count() to be unexported.

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
drivers/gpu/drm/i915/display/intel_dp_link_caps.c | 2 +-
drivers/gpu/drm/i915/display/intel_dp_link_caps.h | 1 -
drivers/gpu/drm/i915/display/intel_dp_tunnel.c | 12 +++++++++---
3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_caps.c b/drivers/gpu/drm/i915/display/intel_dp_link_caps.c
index 7c6259c95d388..e8d1fd86b327f 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_link_caps.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_link_caps.c
@@ -171,7 +171,7 @@ void intel_dp_link_caps_all_common_rates(struct intel_dp_link_caps *link_caps,
*num_rates = link_caps->num_rates;
}

-int intel_dp_link_caps_max_common_lane_count(struct intel_dp_link_caps *link_caps)
+static int intel_dp_link_caps_max_common_lane_count(struct intel_dp_link_caps *link_caps)
{
return link_caps->max_lane_count;
}
diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_caps.h b/drivers/gpu/drm/i915/display/intel_dp_link_caps.h
index 110c1d1e604dd..7fe0e4a028f26 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_link_caps.h
+++ b/drivers/gpu/drm/i915/display/intel_dp_link_caps.h
@@ -17,7 +17,6 @@ int intel_dp_link_caps_max_common_rate(struct intel_dp_link_caps *link_caps);
int intel_dp_link_caps_num_common_rates(struct intel_dp_link_caps *link_caps);
void intel_dp_link_caps_all_common_rates(struct intel_dp_link_caps *link_caps,
const int **rates, int *num_rates);
-int intel_dp_link_caps_max_common_lane_count(struct intel_dp_link_caps *link_caps);

void intel_dp_link_caps_get_forced_params(struct intel_dp_link_caps *link_caps,
struct intel_dp_link_config *forced_params);
diff --git a/drivers/gpu/drm/i915/display/intel_dp_tunnel.c b/drivers/gpu/drm/i915/display/intel_dp_tunnel.c
index 52f5c88f7e09c..07817f5251c81 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_tunnel.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_tunnel.c
@@ -58,10 +58,16 @@ static int kbytes_to_mbits(int kbytes)
static int get_current_link_bw(struct intel_dp *intel_dp)
{
struct intel_dp_link_caps *link_caps = intel_dp->link.caps;
- int rate = intel_dp_link_caps_max_common_rate(link_caps);
- int lane_count = intel_dp_link_caps_max_common_lane_count(link_caps);
+ struct intel_dp_link_config max_link_limits;

- return intel_dp_max_link_data_rate(intel_dp, rate, lane_count);
+ /*
+ * TODO: Compute BW from the maximum-BW configuration; max limits are
+ * independent bounds over all configs and may not form a valid config.
+ */
+ intel_dp_link_caps_get_max_limits(link_caps, &max_link_limits);
+
+ return intel_dp_max_link_data_rate(intel_dp, max_link_limits.rate,
+ max_link_limits.lane_count);
}

static int __update_tunnel_state(struct intel_dp *intel_dp, bool force_sink_update)
--
2.49.1