[PATCH 046/108] drm/i915/dp_link_caps: Move max lane count change detection to link_caps

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

Move detection of changes to the maximum common lane count to
intel_dp_link_caps_update(), alongside detection of changes to the
supported link rates.

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
drivers/gpu/drm/i915/display/intel_dp.c | 4 ----
drivers/gpu/drm/i915/display/intel_dp_link_caps.c | 14 +++++++++++---
2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index ef980ab274e34..4e20e1fb20512 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -4738,7 +4738,6 @@ intel_dp_has_sink_count(struct intel_dp *intel_dp)
void intel_dp_update_sink_caps(struct intel_dp *intel_dp)
{
struct intel_connector *connector = intel_dp->attached_connector;
- int old_max_common_lane_count = intel_dp_max_common_lane_count(intel_dp);
int old_max_lane_count_limit = intel_dp->link.max_lane_count;
int current_max_common_lane_count;
bool link_params_changed = false;
@@ -4749,9 +4748,6 @@ void intel_dp_update_sink_caps(struct intel_dp *intel_dp)
link_params_changed = true;

current_max_common_lane_count = intel_dp_max_common_lane_count(intel_dp);
- if (current_max_common_lane_count != old_max_common_lane_count)
- link_params_changed = true;
-
intel_dp->link.max_lane_count = min(intel_dp->link.max_lane_count,
current_max_common_lane_count);

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 214974658b343..a250d7ee06ebb 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_link_caps.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_link_caps.c
@@ -193,14 +193,19 @@ static int link_config_cmp_by_bw(const void *a, const void *b, const void *p)
}

static bool current_common_caps_match(struct intel_dp_link_caps *link_caps,
- const int *rates, int num_rates)
+ const int *rates, int num_rates,
+ int old_max_lane_count)
{
+ int current_max_lane_count = link_caps->max_lane_count;
const int *current_rates = link_caps->rates;
int num_current_rates = link_caps->num_rates;

if (num_current_rates != num_rates)
return false;

+ if (current_max_lane_count != old_max_lane_count)
+ return false;
+
if (memcmp(current_rates, rates, num_rates * sizeof(rates[0])))
return false;

@@ -217,6 +222,7 @@ bool intel_dp_link_caps_update(struct intel_dp *intel_dp,
struct intel_dp_link_config_entry *lc;
bool link_params_changed = false;
int num_common_lane_configs;
+ int old_max_lane_count;
int num_old_rates;
int i;
int j;
@@ -235,6 +241,7 @@ bool intel_dp_link_caps_update(struct intel_dp *intel_dp,

num_old_rates = link_caps->num_rates;
memcpy(old_rates, link_caps->rates, num_old_rates * sizeof(old_rates[0]));
+ old_max_lane_count = link_caps->max_lane_count;

memcpy(link_caps->rates, rates, num_rates * sizeof(rates[0]));
link_caps->num_rates = num_rates;
@@ -257,10 +264,11 @@ bool intel_dp_link_caps_update(struct intel_dp *intel_dp,
link_config_cmp_by_bw, NULL,
intel_dp);

- if (!current_common_caps_match(link_caps, old_rates, num_old_rates))
+ if (!current_common_caps_match(link_caps, old_rates, num_old_rates,
+ old_max_lane_count))
link_params_changed = true;

- /* TODO: Also detect a change in the max lane count and max link limits. */
+ /* TODO: Also detect a change in the max link limits. */
return link_params_changed;
}

--
2.49.1