All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Lisovskiy, Stanislav" <stanislav.lisovskiy@intel.com>
To: Mika Kahola <mika.kahola@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v2 4/5] drm/i915/display/dg2: Read CD clock from squasher table
Date: Tue, 23 Nov 2021 10:55:30 +0200	[thread overview]
Message-ID: <20211123085530.GD17614@intel.com> (raw)
In-Reply-To: <20211119131348.725220-5-mika.kahola@intel.com>

On Fri, Nov 19, 2021 at 03:13:47PM +0200, Mika Kahola wrote:
> To calculate CD clock with squasher unit, we set CD clock ratio to fixed value of 34.
> The CD clock value is read from CD clock squasher table.
> 
> BSpec: 54034
> 
> v2: Read ratio from register (Ville)
>     Drop unnecessary local variable (Ville)
>     Get CD clock from the given table
> v3: Calculate CD clock frequency based on waveform bit pattern (Ville)
> [v4: vsyrjala: Actually do a proper blind readout from the hardware]
> [v5: vsyrjala: Use has_cdclk_squasher()]
>

Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
 
> Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_cdclk.c | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c
> index 560383e8c5b6..5fcb393079f7 100644
> --- a/drivers/gpu/drm/i915/display/intel_cdclk.c
> +++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
> @@ -1466,6 +1466,7 @@ static void bxt_de_pll_readout(struct drm_i915_private *dev_priv,
>  static void bxt_get_cdclk(struct drm_i915_private *dev_priv,
>  			  struct intel_cdclk_config *cdclk_config)
>  {
> +	u32 squash_ctl = 0;
>  	u32 divider;
>  	int div;
>  
> @@ -1503,7 +1504,21 @@ static void bxt_get_cdclk(struct drm_i915_private *dev_priv,
>  		return;
>  	}
>  
> -	cdclk_config->cdclk = DIV_ROUND_CLOSEST(cdclk_config->vco, div);
> +	if (has_cdclk_squasher(dev_priv))
> +		squash_ctl = intel_de_read(dev_priv, CDCLK_SQUASH_CTL);
> +
> +	if (squash_ctl & CDCLK_SQUASH_ENABLE) {
> +		u16 waveform;
> +		int size;
> +
> +		size = REG_FIELD_GET(CDCLK_SQUASH_WINDOW_SIZE_MASK, squash_ctl) + 1;
> +		waveform = REG_FIELD_GET(CDCLK_SQUASH_WAVEFORM_MASK, squash_ctl) >> (16 - size);
> +
> +		cdclk_config->cdclk = DIV_ROUND_CLOSEST(hweight16(waveform) *
> +							cdclk_config->vco, size * div);
> +	} else {
> +		cdclk_config->cdclk = DIV_ROUND_CLOSEST(cdclk_config->vco, div);
> +	}
>  
>   out:
>  	/*
> -- 
> 2.27.0
> 

  reply	other threads:[~2021-11-23  8:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-19 13:13 [Intel-gfx] [PATCH v2 0/5] Add support for CD clock squashing feature Mika Kahola
2021-11-19 13:13 ` [Intel-gfx] [PATCH v2 1/5] drm/i915/display/dg2: Introduce CD clock squashing table Mika Kahola
2021-11-23  8:53   ` Lisovskiy, Stanislav
2021-11-19 13:13 ` [Intel-gfx] [PATCH v2 2/5] drm/i915/display/dg2: Sanitize CD clock Mika Kahola
2021-11-23  8:54   ` Lisovskiy, Stanislav
2021-11-19 13:13 ` [Intel-gfx] [PATCH v2 3/5] drm/i915/display/dg2: Set CD clock squashing registers Mika Kahola
2021-11-23  8:55   ` Lisovskiy, Stanislav
2021-11-19 13:13 ` [Intel-gfx] [PATCH v2 4/5] drm/i915/display/dg2: Read CD clock from squasher table Mika Kahola
2021-11-23  8:55   ` Lisovskiy, Stanislav [this message]
2021-11-19 13:13 ` [Intel-gfx] [PATCH v2 5/5] drm/i915: Allow cdclk squasher to be reconfigured live Mika Kahola
2021-11-22 13:02   ` Kahola, Mika
2021-11-19 13:46 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Add support for CD clock squashing feature Patchwork
2021-11-19 13:47 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2021-11-19 14:23 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-11-19 17:29 ` [Intel-gfx] ✓ Fi.CI.IGT: " 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=20211123085530.GD17614@intel.com \
    --to=stanislav.lisovskiy@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=mika.kahola@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.