From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Imre Deak <imre.deak@intel.com>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 1/5] drm/i915/dp: Add helpers to reset link params
Date: Fri, 22 May 2026 00:36:27 +0300 [thread overview]
Message-ID: <ag962-z5WD8SVS9I@intel.com> (raw)
In-Reply-To: <20260518112427.2460725-2-imre.deak@intel.com>
On Mon, May 18, 2026 at 02:24:22PM +0300, Imre Deak wrote:
> Add helpers to defer and handle link params resets instead of
> open-coding the same. Rename intel_dp_reset_link_params() to
> intel_dp_reset_link_params_force() to align its name with the new
> deferred reset helpers.
>
> When deferring a reset, return whether a new reset was queued, used by a
> follow-up change.
>
> Signed-off-by: Imre Deak <imre.deak@intel.com>
> ---
> drivers/gpu/drm/i915/display/g4x_dp.c | 2 +-
> drivers/gpu/drm/i915/display/intel_ddi.c | 2 +-
> drivers/gpu/drm/i915/display/intel_dp.c | 41 +++++++++++++++----
> drivers/gpu/drm/i915/display/intel_dp.h | 3 +-
> .../drm/i915/display/intel_dp_link_training.c | 4 +-
> 5 files changed, 38 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/g4x_dp.c b/drivers/gpu/drm/i915/display/g4x_dp.c
> index 5ff1cdf4581a5..c20a97e21419b 100644
> --- a/drivers/gpu/drm/i915/display/g4x_dp.c
> +++ b/drivers/gpu/drm/i915/display/g4x_dp.c
> @@ -1265,7 +1265,7 @@ static void intel_dp_encoder_reset(struct drm_encoder *encoder)
>
> intel_dp->DP = intel_de_read(display, intel_dp->output_reg);
>
> - intel_dp->reset_link_params = true;
> + intel_dp_reset_link_params_defer(intel_dp);
> intel_dp_invalidate_source_oui(intel_dp);
>
> if (display->platform.valleyview || display->platform.cherryview)
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
> index 86520848892e0..77819aaeccb76 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -4664,7 +4664,7 @@ static void intel_ddi_encoder_reset(struct drm_encoder *encoder)
> struct intel_dp *intel_dp = enc_to_intel_dp(to_intel_encoder(encoder));
> struct intel_digital_port *dig_port = enc_to_dig_port(to_intel_encoder(encoder));
>
> - intel_dp->reset_link_params = true;
> + intel_dp_reset_link_params_defer(intel_dp);
> intel_dp_invalidate_source_oui(intel_dp);
>
> intel_pps_encoder_reset(intel_dp);
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> index 1920d2f026665..13163dd085e91 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -3710,7 +3710,11 @@ void intel_dp_set_link_params(struct intel_dp *intel_dp,
> intel_dp->lane_count = lane_count;
> }
>
> -void intel_dp_reset_link_params(struct intel_dp *intel_dp)
> +/*
> + * Reset link params now, preserving any deferred connector
> + * detect-time reset request.
> + */
> +void intel_dp_reset_link_params_force(struct intel_dp *intel_dp)
> {
> intel_dp->link.max_lane_count = intel_dp_max_common_lane_count(intel_dp);
> intel_dp->link.max_rate = intel_dp_max_common_rate(intel_dp);
> @@ -3720,6 +3724,28 @@ void intel_dp_reset_link_params(struct intel_dp *intel_dp)
> intel_dp->link.seq_train_failures = 0;
> }
>
> +/*
> + * Reset link params during the next connector detect.
> + * Return %true if a new reset was queued.
> + */
> +bool intel_dp_reset_link_params_defer(struct intel_dp *intel_dp)
I find the intel_dp_reset_link_params_defer() vs.
intel_dp_reset_link_params_force() naming rather confusing.
Can't immediately think of a really good name for
intel_dp_reset_link_params_defer() so maybe it's better to not
have a function for it at all (ie. just drop this patch)? Then
you at least see that it's just setting the flag. AFAICS you
only have a single place (in the last patch) that uses this
return value for anything, so could just do the check+set
dance there on the spot.
> +{
> + bool reset_was_pending = intel_dp->reset_link_params;
> +
> + intel_dp->reset_link_params = true;
> +
> + return !reset_was_pending;
> +}
> +
> +static void intel_dp_handle_deferred_link_params_reset(struct intel_dp *intel_dp)
> +{
> + if (!intel_dp->reset_link_params)
> + return;
> +
> + intel_dp->reset_link_params = false;
> + intel_dp_reset_link_params_force(intel_dp);
> +}
> +
> /* Enable backlight PWM and backlight PP control. */
> void intel_edp_backlight_on(const struct intel_crtc_state *crtc_state,
> const struct drm_connector_state *conn_state)
> @@ -4066,7 +4092,7 @@ void intel_dp_sync_state(struct intel_encoder *encoder,
> intel_dp_tunnel_resume(intel_dp, crtc_state, dpcd_updated);
>
> if (crtc_state) {
> - intel_dp_reset_link_params(intel_dp);
> + intel_dp_reset_link_params_force(intel_dp);
> intel_dp_set_link_params(intel_dp, crtc_state->port_clock, crtc_state->lane_count);
> intel_dp->link.active = true;
> }
> @@ -6487,10 +6513,7 @@ intel_dp_detect(struct drm_connector *_connector,
>
> intel_dp_detect_sdp_caps(intel_dp);
>
> - if (intel_dp->reset_link_params) {
> - intel_dp_reset_link_params(intel_dp);
> - intel_dp->reset_link_params = false;
> - }
> + intel_dp_handle_deferred_link_params_reset(intel_dp);
>
> intel_dp_mst_configure(intel_dp);
>
> @@ -6944,7 +6967,7 @@ intel_dp_hpd_pulse(struct intel_digital_port *dig_port, bool long_hpd)
>
> intel_dp_read_dprx_caps(intel_dp, dpcd);
>
> - intel_dp->reset_link_params = true;
> + intel_dp_reset_link_params_defer(intel_dp);
> intel_dp_invalidate_source_oui(intel_dp);
>
> return IRQ_NONE;
> @@ -7252,7 +7275,7 @@ intel_dp_init_connector(struct intel_digital_port *dig_port,
> encoder->base.name))
> return false;
>
> - intel_dp->reset_link_params = true;
> + intel_dp_reset_link_params_defer(intel_dp);
>
> /* Preserve the current hw state. */
> intel_dp->DP = intel_de_read(display, intel_dp->output_reg);
> @@ -7317,7 +7340,7 @@ intel_dp_init_connector(struct intel_digital_port *dig_port,
>
> intel_dp_set_source_rates(intel_dp);
> intel_dp_set_common_rates(intel_dp);
> - intel_dp_reset_link_params(intel_dp);
> + intel_dp_reset_link_params_force(intel_dp);
>
> /* init MST on ports that can support it */
> intel_dp_mst_encoder_init(dig_port, connector->base.base.id);
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.h b/drivers/gpu/drm/i915/display/intel_dp.h
> index f41480d247142..7c24d3dbb6983 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.h
> +++ b/drivers/gpu/drm/i915/display/intel_dp.h
> @@ -114,7 +114,8 @@ int intel_dp_rate_index(const int *rates, int len, int rate);
> int intel_dp_link_config_index(struct intel_dp *intel_dp, int link_rate, int lane_count);
> void intel_dp_link_config_get(struct intel_dp *intel_dp, int idx, int *link_rate, int *lane_count);
> void intel_dp_update_sink_caps(struct intel_dp *intel_dp);
> -void intel_dp_reset_link_params(struct intel_dp *intel_dp);
> +void intel_dp_reset_link_params_force(struct intel_dp *intel_dp);
> +bool intel_dp_reset_link_params_defer(struct intel_dp *intel_dp);
>
> void intel_dp_compute_rate(struct intel_dp *intel_dp, int port_clock,
> u8 *link_bw, u8 *rate_select);
> 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 a26094223f780..b7075060e7bd3 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_link_training.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
> @@ -1935,7 +1935,7 @@ static ssize_t i915_dp_force_link_rate_write(struct file *file,
> if (err)
> return err;
>
> - intel_dp_reset_link_params(intel_dp);
> + intel_dp_reset_link_params_force(intel_dp);
> intel_dp->link.force_rate = rate;
>
> drm_modeset_unlock(&display->drm->mode_config.connection_mutex);
> @@ -2037,7 +2037,7 @@ static ssize_t i915_dp_force_lane_count_write(struct file *file,
> if (err)
> return err;
>
> - intel_dp_reset_link_params(intel_dp);
> + intel_dp_reset_link_params_force(intel_dp);
> intel_dp->link.force_lane_count = lane_count;
>
> drm_modeset_unlock(&display->drm->mode_config.connection_mutex);
> --
> 2.49.1
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2026-05-21 21:36 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-18 11:24 [PATCH 0/5] drm/i915/dp: Sanitize link capability change handling Imre Deak
2026-05-18 11:24 ` [PATCH 1/5] drm/i915/dp: Add helpers to reset link params Imre Deak
2026-05-21 21:36 ` Ville Syrjälä [this message]
2026-05-22 7:36 ` Hogander, Jouni
2026-05-22 7:47 ` Imre Deak
2026-05-22 10:29 ` Jani Nikula
2026-05-22 12:39 ` Ville Syrjälä
2026-05-22 12:46 ` Jani Nikula
2026-05-22 12:50 ` Ville Syrjälä
2026-05-22 15:32 ` Imre Deak
2026-05-18 11:24 ` [PATCH 2/5] drm/i915/dp: Reset link params after a DPRX capability change Imre Deak
2026-05-18 11:24 ` [PATCH 3/5] drm/i915/dp: Add helper to set common link params Imre Deak
2026-05-22 7:20 ` Hogander, Jouni
2026-05-18 11:24 ` [PATCH 4/5] drm/i915/dp: Cache max common lane count Imre Deak
2026-05-22 7:21 ` Hogander, Jouni
2026-05-18 11:24 ` [PATCH 5/5] drm/i915/dp: Detect changes in common link parameters Imre Deak
2026-05-21 21:43 ` Ville Syrjälä
2026-05-22 7:54 ` Imre Deak
2026-05-18 12:01 ` ✓ CI.KUnit: success for drm/i915/dp: Sanitize link capability change handling Patchwork
2026-05-18 12:41 ` ✓ Xe.CI.BAT: " Patchwork
2026-05-18 14:09 ` ✗ i915.CI.BAT: failure " Patchwork
2026-05-18 16:04 ` ✗ Xe.CI.FULL: " Patchwork
2026-05-18 16:52 ` ✓ i915.CI.BAT: success for drm/i915/dp: Sanitize link capability change handling (rev2) Patchwork
2026-05-19 5:53 ` ✓ i915.CI.Full: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ag962-z5WD8SVS9I@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=imre.deak@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.