summaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorImre Deak <imre.deak@intel.com>2026-07-01 18:31:52 +0300
committerImre Deak <imre.deak@intel.com>2026-07-09 10:38:02 +0300
commit9cee806ef5ade6fac89434bd6543e8ff366d1b6e (patch)
treeb249f132d99b428f5138ccd33b838cc7092a30c2 /drivers/gpu
parent77265110e0d6fd3504f8ba22b2d5fd58fe463fe1 (diff)
downloadlinux-9cee806ef5ade6fac89434bd6543e8ff366d1b6e.tar.gz
linux-9cee806ef5ade6fac89434bd6543e8ff366d1b6e.zip
drm/i915/dp_link_training: Reset the max link limits in the fallback code
The target maximum rate/lane count selected by the fallback logic may exceed the current link_caps max_limits' rate/lane count, the latter of which are used as a limit by the lookup functions when filtering allowed configurations. To ensure the fallback search finds all relevant candidates, temporarily reset the link_caps max_limits to the maximum common supported capabilities. After the fallback search completes, set the link_caps max_limits to the configuration selected by the fallback logic, as before, determining the allowed configurations for a subsequent modeset. Reviewed-by: Luca Coelho <luciano.coelho@intel.com> Signed-off-by: Imre Deak <imre.deak@intel.com> Link: https://patch.msgid.link/20260701153204.4124150-24-imre.deak@intel.com
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/i915/display/intel_dp_link_training.c39
1 files changed, 34 insertions, 5 deletions
diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_training.c b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
index b521dd11b62a..7fdcc299daea 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_link_training.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
@@ -1960,10 +1960,12 @@ static bool reduce_link_params(struct intel_dp *intel_dp, const struct intel_crt
static int intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
const struct intel_crtc_state *crtc_state)
{
+ struct intel_display *display = to_intel_display(intel_dp);
struct intel_dp_link_caps *link_caps = intel_dp->link.caps;
struct intel_dp_link_config max_link_limits;
int new_link_rate;
int new_lane_count;
+ int err = -1;
if (intel_dp_is_edp(intel_dp) && !intel_dp->use_max_params) {
lt_dbg(intel_dp, DP_PHY_DPRX,
@@ -1972,14 +1974,32 @@ static int intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
return 0;
}
+ /*
+ * Temporarily reset the max link limit before selecting the fallback
+ * config.
+ *
+ * After fallback, the current logic narrows the allowed configurations
+ * to the selected config's rate and lane count. That can make a later
+ * fallback candidate fall outside the current max_limit, so reset it
+ * before searching.
+ *
+ * TODO: Constrain the allowed configurations by only disabling individual
+ * configurations and remove setting maximum link parameters.
+ */
+ intel_dp_link_caps_get_max_limits(link_caps, &max_link_limits);
+ intel_dp_link_caps_reset_max_limits(link_caps);
+
if (!reduce_link_params(intel_dp, crtc_state, &new_link_rate, &new_lane_count))
- return -1;
+ goto out_restore_max_limits;
if (intel_dp_is_edp(intel_dp) &&
!intel_dp_can_link_train_fallback_for_edp(intel_dp, new_link_rate, new_lane_count)) {
lt_dbg(intel_dp, DP_PHY_DPRX,
"Retrying Link training for eDP with same parameters\n");
- return 0;
+
+ err = 0;
+
+ goto out_restore_max_limits;
}
lt_dbg(intel_dp, DP_PHY_DPRX,
@@ -1990,10 +2010,19 @@ static int intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
max_link_limits.rate = new_link_rate;
max_link_limits.lane_count = new_lane_count;
- /* TODO: handle an update failure */
- intel_dp_link_caps_set_max_limits(link_caps, &max_link_limits);
+ err = 0;
- return 0;
+out_restore_max_limits:
+ /*
+ * Shouldn't fail: setting max_limits can only fail if they drop below
+ * the optionally forced rate/lane-count parameters, but the reduced
+ * config was chosen to satisfy those constraints.
+ */
+ if (drm_WARN_ON(display->drm,
+ !intel_dp_link_caps_set_max_limits(link_caps, &max_link_limits)))
+ err = -1;
+
+ return err;
}
static bool intel_dp_schedule_fallback_link_training(struct intel_atomic_state *state,