All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Roper <matthew.d.roper@intel.com>
To: Gustavo Sousa <gustavo.sousa@intel.com>
Cc: <intel-gfx@lists.freedesktop.org>,
	<intel-xe@lists.freedesktop.org>,
	"Lucas De Marchi" <lucas.demarchi@intel.com>,
	<vinod.govindapillai@intel.com>, <stanislav.lisovskiy@intel.com>
Subject: Re: [PATCH 2/8] drm/i915/cdclk: Add and use xe2lpd_mdclk_source_sel()
Date: Mon, 4 Mar 2024 13:58:34 -0800	[thread overview]
Message-ID: <20240304215834.GW718896@mdroper-desk1.amr.corp.intel.com> (raw)
In-Reply-To: <20240304183028.195057-3-gustavo.sousa@intel.com>

On Mon, Mar 04, 2024 at 03:30:21PM -0300, Gustavo Sousa wrote:
> There will be future changes that rely on the source of the MDCLK. Let's
> have xe2lpd_mdclk_source_sel() as the function responsible for reporting
> that information.
> 
> Bspec: 69090
> Signed-off-by: Gustavo Sousa <gustavo.sousa@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_cdclk.c | 17 ++++++++++++++++-
>  drivers/gpu/drm/i915/i915_reg.h            |  4 +++-
>  2 files changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c
> index 407bd541eb46..bf84bf27213f 100644
> --- a/drivers/gpu/drm/i915/display/intel_cdclk.c
> +++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
> @@ -1876,6 +1876,21 @@ static bool cdclk_pll_is_unknown(unsigned int vco)
>  	return vco == ~0;
>  }
>  
> +static u32 xe2lpd_mdclk_source_sel(struct drm_i915_private *i915)
> +{
> +	if (DISPLAY_VER(i915) >= 20)
> +		return MDCLK_SOURCE_SEL_CDCLK_PLL;
> +
> +	/*
> +	 * Earlier display IPs do not provide means of selecting the
> +	 * MDCLK source, but MDCLK_SOURCE_SEL_CD2XCLK is a nice default,
> +	 * since it reflects the source used for those and allows
> +	 * xe2lpd_mdclk_source_sel() to be used in logic that depends on
> +	 * it.
> +	 */
> +	return MDCLK_SOURCE_SEL_CD2XCLK;

At the moment this function only gets called on Xe2 and beyond where the
register field exists; if that's going to change soon, then wouldn't it
be more natural to just use an early exit to highlight that there's
nothing we need to OR into the CDCLK_CTL for earlier platforms?  

    /* Not configurable for older platforms; they always use CD2XCLK */
    if (DISPLAY_VER(i915) < 20)
            return 0;

Functionally it's the same, but it feels more intuitive to me.

If we aren't expecting to call this from common codepaths that aren't
already protected by a display version check, then we could make this a
drm_WARN_ON() to assert that we haven't deviated from expected behavior.


Matt

> +}
> +
>  static bool cdclk_compute_crawl_and_squash_midpoint(struct drm_i915_private *i915,
>  						    const struct intel_cdclk_config *old_cdclk_config,
>  						    const struct intel_cdclk_config *new_cdclk_config,
> @@ -1980,7 +1995,7 @@ static u32 bxt_cdclk_ctl(struct drm_i915_private *i915,
>  		val |= BXT_CDCLK_SSA_PRECHARGE_ENABLE;
>  
>  	if (DISPLAY_VER(i915) >= 20)
> -		val |= MDCLK_SOURCE_SEL_CDCLK_PLL;
> +		val |= xe2lpd_mdclk_source_sel(i915);
>  	else
>  		val |= skl_cdclk_decimal(cdclk);
>  
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index e00557e1a57f..eb953ed1f113 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -5900,7 +5900,9 @@ enum skl_power_gate {
>  #define  CDCLK_FREQ_540		REG_FIELD_PREP(CDCLK_FREQ_SEL_MASK, 1)
>  #define  CDCLK_FREQ_337_308		REG_FIELD_PREP(CDCLK_FREQ_SEL_MASK, 2)
>  #define  CDCLK_FREQ_675_617		REG_FIELD_PREP(CDCLK_FREQ_SEL_MASK, 3)
> -#define  MDCLK_SOURCE_SEL_CDCLK_PLL	REG_BIT(25)
> +#define  MDCLK_SOURCE_SEL_MASK		REG_GENMASK(25, 25)
> +#define  MDCLK_SOURCE_SEL_CD2XCLK	REG_FIELD_PREP(MDCLK_SOURCE_SEL_MASK, 0)
> +#define  MDCLK_SOURCE_SEL_CDCLK_PLL	REG_FIELD_PREP(MDCLK_SOURCE_SEL_MASK, 1)
>  #define  BXT_CDCLK_CD2X_DIV_SEL_MASK	REG_GENMASK(23, 22)
>  #define  BXT_CDCLK_CD2X_DIV_SEL_1	REG_FIELD_PREP(BXT_CDCLK_CD2X_DIV_SEL_MASK, 0)
>  #define  BXT_CDCLK_CD2X_DIV_SEL_1_5	REG_FIELD_PREP(BXT_CDCLK_CD2X_DIV_SEL_MASK, 1)
> -- 
> 2.44.0
> 

-- 
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation

  reply	other threads:[~2024-03-04 21:58 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-04 18:30 [PATCH 0/8] Enable LNL display Gustavo Sousa
2024-03-04 18:30 ` [PATCH 1/8] drm/i915/cdclk: Rename lnl_cdclk_table to xe2lpd_cdclk_table Gustavo Sousa
2024-03-04 21:44   ` Matt Roper
2024-03-04 18:30 ` [PATCH 2/8] drm/i915/cdclk: Add and use xe2lpd_mdclk_source_sel() Gustavo Sousa
2024-03-04 21:58   ` Matt Roper [this message]
2024-03-05 14:40     ` Gustavo Sousa
2024-03-08 15:30       ` Gustavo Sousa
2024-03-04 18:30 ` [PATCH 3/8] drm/i915/cdclk: Only compute squash waveform when necessary Gustavo Sousa
2024-03-04 22:04   ` Matt Roper
2024-03-05 14:42     ` Gustavo Sousa
2024-03-04 18:30 ` [PATCH 4/8] drm/i915: Extract intel_dbuf_mdclk_cdclk_ratio_update() Gustavo Sousa
2024-03-04 22:11   ` Matt Roper
2024-03-04 18:30 ` [PATCH 5/8] drm/i915: Add mdclk_cdclk_ratio to intel_dbuf_state Gustavo Sousa
2024-03-04 23:25   ` Matt Roper
2024-03-05 14:44     ` Gustavo Sousa
2024-03-04 18:30 ` [PATCH 6/8] drm/i915/xe2lpd: Support MDCLK:CDCLK ratio changes Gustavo Sousa
2024-03-11 21:01   ` Lisovskiy, Stanislav
2024-03-11 21:13     ` Gustavo Sousa
2024-03-12  8:27       ` Lisovskiy, Stanislav
2024-03-04 18:30 ` [PATCH 7/8] drm/i915/xe2lpd: Load DMC Gustavo Sousa
2024-03-04 19:50   ` Lucas De Marchi
2024-03-04 20:06     ` Gustavo Sousa
2024-03-04 18:30 ` [PATCH 8/8] drm/xe/lnl: Enable display support Gustavo Sousa
2024-03-04 19:53   ` Lucas De Marchi
2024-03-04 19:41 ` ✓ CI.Patch_applied: success for Enable LNL display Patchwork
2024-03-04 19:42 ` ✗ CI.checkpatch: warning " Patchwork
2024-03-04 19:43 ` ✓ CI.KUnit: success " Patchwork
2024-03-04 19:54 ` ✓ CI.Build: " Patchwork
2024-03-04 19:55 ` ✓ CI.Hooks: " Patchwork
2024-03-04 19:57 ` ✗ CI.checksparse: warning " Patchwork
2024-03-04 20:30 ` ✓ CI.BAT: success " Patchwork
2024-03-05  3:29 ` ✗ Fi.CI.CHECKPATCH: warning " Patchwork
2024-03-05  3:29 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-03-05  3:48 ` ✗ Fi.CI.BAT: failure " 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=20240304215834.GW718896@mdroper-desk1.amr.corp.intel.com \
    --to=matthew.d.roper@intel.com \
    --cc=gustavo.sousa@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    --cc=stanislav.lisovskiy@intel.com \
    --cc=vinod.govindapillai@intel.com \
    /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.