From: Imre Deak Date: Fri, 22 May 2026 16:05:13 +0000 (+0300) Subject: drm/i915/dp: Cache max common lane count X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=cc18eac531a656f9104f78a0d9358bb099080831;p=thirdparty%2Fkernel%2Flinux.git drm/i915/dp: Cache max common lane count Cache the maximum common lane count together with the common link rates. This is safe because the cached value is updated: - during driver probe, before the connector is registered and can be used for mode validation or modesetting - during resume, before output HW state readout can query it - during connector detection, right after updating the sink/link capabilities Caching the value allows detecting max common lane count changes in a follow-up change and keeps the tracking of max common lane count aligned with that of common rates. Reviewed-by: Jouni Högander Reviewed-by: Ville Syrjälä Signed-off-by: Imre Deak Link: https://patch.msgid.link/20260522160514.2628249-4-imre.deak@intel.com --- diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h index ac865b6557b6..13ce37a71b68 100644 --- a/drivers/gpu/drm/i915/display/intel_display_types.h +++ b/drivers/gpu/drm/i915/display/intel_display_types.h @@ -1823,6 +1823,7 @@ struct intel_dp { /* intersection of source and sink rates */ int num_common_rates; int common_rates[DP_MAX_SUPPORTED_RATES]; + int max_common_lane_count; struct { /* TODO: move the rest of link specific fields to here */ bool active; diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index e9eee452dc36..1a6d00852eb1 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -363,7 +363,7 @@ int intel_dp_max_source_lane_count(struct intel_digital_port *dig_port) } /* Theoretical max between source and sink */ -int intel_dp_max_common_lane_count(struct intel_dp *intel_dp) +static void intel_dp_set_max_common_lane_count(struct intel_dp *intel_dp) { struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); int source_max = intel_dp_max_source_lane_count(dig_port); @@ -374,7 +374,12 @@ int intel_dp_max_common_lane_count(struct intel_dp *intel_dp) if (lttpr_max) sink_max = min(sink_max, lttpr_max); - return min3(source_max, sink_max, lane_max); + intel_dp->max_common_lane_count = min3(source_max, sink_max, lane_max); +} + +int intel_dp_max_common_lane_count(struct intel_dp *intel_dp) +{ + return intel_dp->max_common_lane_count; } static int forced_lane_count(struct intel_dp *intel_dp) @@ -810,6 +815,7 @@ static void intel_dp_set_common_rates(struct intel_dp *intel_dp) static void intel_dp_set_common_link_params(struct intel_dp *intel_dp) { intel_dp_set_common_rates(intel_dp); + intel_dp_set_max_common_lane_count(intel_dp); intel_dp_link_config_init(intel_dp); }