From: Imre Deak <imre.deak@intel.com>
To: Luca Coelho <luca@coelho.fi>
Cc: <intel-gfx@lists.freedesktop.org>, <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH v2 05/28] drm/i915/dp_link_caps: Move forced link param helpers to link caps
Date: Tue, 23 Jun 2026 15:42:34 +0300 [thread overview]
Message-ID: <ajp_OhvmDVWBzebJ@ideak-desk.lan> (raw)
In-Reply-To: <d54ec733d1f389776c706eb54fc38e03936e2634.camel@coelho.fi>
On Tue, Jun 23, 2026 at 01:22:41PM +0300, Luca Coelho wrote:
> On Tue, 2026-06-16 at 23:08 +0300, Imre Deak wrote:
> > Move the helpers handling forced link parameters to intel_dp_link_caps.c.
> > Their functionality is part of the link capability logic and will be
> > updated to use the link capability state in follow-up changes.
> >
> > Return the forced link rate and lane count through a
> > struct intel_dp_link_config, which is the canonical way the rest of the
> > link capability API will also accept and return link configurations.
> >
> > Signed-off-by: Imre Deak <imre.deak@intel.com>
> > ---
> > drivers/gpu/drm/i915/display/intel_dp.c | 39 ++++++++++---------
> > .../gpu/drm/i915/display/intel_dp_link_caps.c | 22 +++++++++++
> > .../gpu/drm/i915/display/intel_dp_link_caps.h | 5 +++
> > 3 files changed, 47 insertions(+), 19 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> > index a34d3704a5667..7643fe079e15b 100644
> > --- a/drivers/gpu/drm/i915/display/intel_dp.c
> > +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> > @@ -364,17 +364,16 @@ 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)
> > -{
> > - return clamp(intel_dp->link.force_lane_count, 1, intel_dp_max_common_lane_count(intel_dp));
> > -}
> > -
> > int intel_dp_max_lane_count(struct intel_dp *intel_dp)
> > {
> > + struct intel_dp_link_caps *link_caps = intel_dp->link.caps;
> > + struct intel_dp_link_config forced_params;
> > int lane_count;
> >
> > + intel_dp_link_caps_get_forced_params(link_caps, &forced_params);
> > +
> > if (intel_dp->link.force_lane_count)
> > - lane_count = forced_lane_count(intel_dp);
> > + lane_count = forced_params.lane_count;
> > else
> > lane_count = intel_dp->link.max_lane_count;
> >
> > @@ -391,8 +390,12 @@ int intel_dp_max_lane_count(struct intel_dp *intel_dp)
> >
> > static int intel_dp_min_lane_count(struct intel_dp *intel_dp)
> > {
> > + struct intel_dp_link_config forced_params;
> > +
> > + intel_dp_link_caps_get_forced_params(intel_dp->link.caps, &forced_params);
> > +
> > if (intel_dp->link.force_lane_count)
> > - return forced_lane_count(intel_dp);
> > + return forced_params.lane_count;
> >
> > return 1;
> > }
> > @@ -1655,23 +1658,17 @@ static void intel_dp_print_rates(struct intel_dp *intel_dp)
> > drm_dbg_kms(display->drm, "common rates: %s\n", seq_buf_str(&s));
> > }
> >
> > -static int forced_link_rate(struct intel_dp *intel_dp)
> > -{
> > - int len = intel_dp_common_len_rate_limit(intel_dp, intel_dp->link.force_rate);
> > -
> > - if (len == 0)
> > - return intel_dp_common_rate(intel_dp, 0);
> > -
> > - return intel_dp_common_rate(intel_dp, len - 1);
> > -}
> > -
> > int
> > intel_dp_max_link_rate(struct intel_dp *intel_dp)
> > {
> > + struct intel_dp_link_caps *link_caps = intel_dp->link.caps;
> > + struct intel_dp_link_config forced_params;
> > int len;
> >
> > + intel_dp_link_caps_get_forced_params(link_caps, &forced_params);
> > +
> > if (intel_dp->link.force_rate)
> > - return forced_link_rate(intel_dp);
> > + return forced_params.rate;
> >
> > len = intel_dp_common_len_rate_limit(intel_dp, intel_dp->link.max_rate);
> >
> > @@ -1681,8 +1678,12 @@ intel_dp_max_link_rate(struct intel_dp *intel_dp)
> > static int
> > intel_dp_min_link_rate(struct intel_dp *intel_dp)
> > {
> > + struct intel_dp_link_config forced_params;
> > +
> > + intel_dp_link_caps_get_forced_params(intel_dp->link.caps, &forced_params);
> > +
> > if (intel_dp->link.force_rate)
> > - return forced_link_rate(intel_dp);
> > + return forced_params.rate;
> >
> > return intel_dp_common_rate(intel_dp, 0);
> > }
> > 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 37ffd714c6a42..1d3a3ff007a03 100644
> > --- a/drivers/gpu/drm/i915/display/intel_dp_link_caps.c
> > +++ b/drivers/gpu/drm/i915/display/intel_dp_link_caps.c
> > @@ -41,6 +41,28 @@ int intel_dp_max_common_rate(struct intel_dp *intel_dp)
> > return intel_dp_common_rate(intel_dp, intel_dp->num_common_rates - 1);
> > }
> >
> > +static int forced_lane_count(struct intel_dp *intel_dp)
> > +{
> > + return clamp(intel_dp->link.force_lane_count, 1, intel_dp_max_common_lane_count(intel_dp));
> > +}
> > +
> > +static int forced_link_rate(struct intel_dp *intel_dp)
> > +{
> > + int len = intel_dp_common_len_rate_limit(intel_dp, intel_dp->link.force_rate);
> > +
> > + if (len == 0)
> > + return intel_dp_common_rate(intel_dp, 0);
> > +
> > + return intel_dp_common_rate(intel_dp, len - 1);
> > +}
> > +
> > +void intel_dp_link_caps_get_forced_params(struct intel_dp_link_caps *link_caps,
> > + struct intel_dp_link_config *forced_params)
>
> Is this really _get_? Usually "get" in the function name in my head
> returns something (which in this case would be the forced_params), but
> here we're actually setting them.
The function really just returns the forced params tracked in link_caps
and the returning happens via the forced_params struct pointer passed to
the function; so get is the proper name for the function. "set" would
set the forced params in link_caps.
>
> Should it be _set_, or maybe "parse"?
>
>
> > +{
> > + forced_params->rate = forced_link_rate(link_caps->dp);
> > + forced_params->lane_count = forced_lane_count(link_caps->dp);
> > +}
> > +
> > struct intel_dp_link_caps *intel_dp_link_caps_init(struct intel_dp *intel_dp)
> > {
> > struct intel_dp_link_caps *link_caps;
> > 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 3248777d1287f..61dbce86ee3d0 100644
> > --- a/drivers/gpu/drm/i915/display/intel_dp_link_caps.h
> > +++ b/drivers/gpu/drm/i915/display/intel_dp_link_caps.h
> > @@ -5,12 +5,17 @@
> > #define __INTEL_DP_LINK_CAPS_H__
> >
> > struct intel_dp;
> > +struct intel_dp_link_caps;
> > +struct intel_dp_link_config;
> >
> > int intel_dp_common_len_rate_limit(const struct intel_dp *intel_dp,
> > int max_rate);
> > int intel_dp_common_rate(struct intel_dp *intel_dp, int index);
> > int intel_dp_max_common_rate(struct intel_dp *intel_dp);
> >
> > +void intel_dp_link_caps_get_forced_params(struct intel_dp_link_caps *link_caps,
> > + struct intel_dp_link_config *forced_params);
> > +
> > struct intel_dp_link_caps *intel_dp_link_caps_init(struct intel_dp *intel_dp);
> > void intel_dp_link_caps_cleanup(struct intel_dp_link_caps *link_caps);
> >
>
> --
> Cheers,
> Luca.
next prev parent reply other threads:[~2026-06-23 12:42 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-16 20:08 [PATCH v2 00/28] drm/i915/dp_link: Refactor DP link capability logic part1 Imre Deak
2026-06-16 20:08 ` [PATCH v2 01/28] drm/i915/dp: Rename intel_dp_link_config to intel_dp_link_config_entry Imre Deak
2026-06-22 13:11 ` Kahola, Mika
2026-06-22 21:53 ` Michał Grzelak
2026-06-24 15:32 ` Imre Deak
2026-06-16 20:08 ` [PATCH v2 02/28] drm/i915/dp: Add struct intel_dp_link_config Imre Deak
2026-06-22 13:11 ` Kahola, Mika
2026-06-16 20:08 ` [PATCH v2 03/28] drm/i915/dp_link_caps: Introduce DP link capability module Imre Deak
2026-06-22 13:21 ` Kahola, Mika
2026-06-16 20:08 ` [PATCH v2 04/28] drm/i915/dp_link_caps: Move common rate helpers to link caps Imre Deak
2026-06-23 7:27 ` Kahola, Mika
2026-06-16 20:08 ` [PATCH v2 05/28] drm/i915/dp_link_caps: Move forced link param " Imre Deak
2026-06-23 9:40 ` Kahola, Mika
2026-06-23 10:22 ` Luca Coelho
2026-06-23 12:42 ` Imre Deak [this message]
2026-06-23 12:47 ` Luca Coelho
2026-06-16 20:08 ` [PATCH v2 06/28] drm/i915/dp: Simplify querying of forced link parameters Imre Deak
2026-06-23 9:49 ` Kahola, Mika
2026-06-16 20:08 ` [PATCH v2 07/28] drm/i915/dp_link_caps: Move forced and max link debugfs entries to link caps Imre Deak
2026-06-23 10:28 ` Luca Coelho
2026-06-23 10:29 ` Luca Coelho
2026-06-16 20:08 ` [PATCH v2 08/28] drm/i915/dp_link_training: Use helpers to get forced link params Imre Deak
2026-06-23 10:31 ` Luca Coelho
2026-06-16 20:08 ` [PATCH v2 09/28] drm/i915/dp_link_caps: Move forced link params to link_caps Imre Deak
2026-06-23 10:32 ` Luca Coelho
2026-06-16 20:08 ` [PATCH v2 10/28] drm/i915/dp_link_caps: Move link config helpers to link caps Imre Deak
2026-06-23 10:34 ` Luca Coelho
2026-06-16 20:08 ` [PATCH v2 11/28] drm/i915/dp_link_caps: Move link config tracking to link_caps Imre Deak
2026-06-23 11:17 ` Kahola, Mika
2026-06-24 11:15 ` Luca Coelho
2026-06-16 20:08 ` [PATCH v2 12/28] drm/i915/dp_link_caps: Rename helper updating the link configurations Imre Deak
2026-06-23 5:11 ` Garg, Nemesa
2026-06-16 20:08 ` [PATCH v2 13/28] drm/i915/dp: Factor out helper to get link rate capabilities Imre Deak
2026-06-24 8:29 ` Kahola, Mika
2026-06-16 20:08 ` [PATCH v2 14/28] drm/i915/dp_link_caps: Pass supported link rates to link caps update Imre Deak
2026-06-24 8:32 ` Kahola, Mika
2026-06-16 20:08 ` [PATCH v2 15/28] drm/i915/dp_link_caps: Add helper to print all supported link rates Imre Deak
2026-06-23 5:21 ` Garg, Nemesa
2026-06-16 20:08 ` [PATCH v2 16/28] drm/i915/dp_link_caps: Add helper to get the number of " Imre Deak
2026-06-24 8:34 ` Kahola, Mika
2026-06-16 20:08 ` [PATCH v2 17/28] drm/i915/dp_link_caps: Add helper to get common rate index Imre Deak
2026-06-24 9:02 ` Kahola, Mika
2026-06-16 20:08 ` [PATCH v2 18/28] drm/i915/dp_link_caps: Move tracking of common rates to link_caps struct Imre Deak
2026-06-24 9:22 ` Kahola, Mika
2026-06-16 20:08 ` [PATCH v2 19/28] drm/i915/dp_link_caps: Track max common lane count in link_caps Imre Deak
2026-06-24 9:46 ` Kahola, Mika
2026-06-16 20:08 ` [PATCH v2 20/28] drm/i915/dp_link_caps: Use max common lane count from link_caps Imre Deak
2026-06-24 11:29 ` Kahola, Mika
2026-06-16 20:08 ` [PATCH v2 21/28] drm/i915/dp_link_caps: Add helpers to get max link limits Imre Deak
2026-06-24 12:44 ` Kahola, Mika
2026-06-16 20:08 ` [PATCH v2 22/28] drm/i915/dp_link_caps: Add helpers to set " Imre Deak
2026-06-24 12:47 ` Kahola, Mika
2026-06-16 20:08 ` [PATCH v2 23/28] drm/i915/dp_link_caps: Add helper to reset " Imre Deak
2026-06-24 12:49 ` Kahola, Mika
2026-06-16 20:08 ` [PATCH v2 24/28] drm/i915/dp_link_caps: Add helper to reset link_caps state Imre Deak
2026-06-24 12:55 ` Kahola, Mika
2026-06-16 20:08 ` [PATCH v2 25/28] drm/i915/dp_link_caps: Move max link limits to link_caps Imre Deak
2026-06-23 5:34 ` Garg, Nemesa
2026-06-16 20:08 ` [PATCH v2 26/28] drm/i915/dp_link_caps: Pass link_caps to static functions Imre Deak
2026-06-23 5:29 ` Garg, Nemesa
2026-06-16 20:08 ` [PATCH v2 27/28] drm/i915/dp_link_caps: Pass link_caps to config update/lookup helpers Imre Deak
2026-06-23 5:25 ` Garg, Nemesa
2026-06-16 20:08 ` [PATCH v2 28/28] drm/i915/dp_link_caps: Pass link_caps to common rate helpers Imre Deak
2026-06-23 5:39 ` Garg, Nemesa
2026-06-16 20:20 ` ✗ CI.checkpatch: warning for drm/i915/dp_link: Refactor DP link capability logic part1 Patchwork
2026-06-16 20:21 ` ✓ CI.KUnit: success " Patchwork
2026-06-16 21:18 ` ✓ Xe.CI.BAT: " Patchwork
2026-06-17 1:46 ` ✓ Xe.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=ajp_OhvmDVWBzebJ@ideak-desk.lan \
--to=imre.deak@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=luca@coelho.fi \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox