All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Sanyog Kale <sanyog.r.kale@intel.com>,
	intel-gfx@lists.freedesktop.org,
	Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Subject: Re: [PATCH 04/17] drm/i915/cnl: Allow dynamic cdclk changes on CNL
Date: Fri, 9 Jun 2017 17:34:55 +0300	[thread overview]
Message-ID: <20170609143455.GX12629@intel.com> (raw)
In-Reply-To: <1496959406-6031-4-git-send-email-rodrigo.vivi@intel.com>

On Thu, Jun 08, 2017 at 03:03:13PM -0700, Rodrigo Vivi wrote:
> All the low level cdclk bits are present, so let's add the required
> hooks to reconfigure cdclk on the fly.
> 
> v2: Rebase due to cnl_sanitize_cdclk()
> v3: Rebased by Rodrigo on top of Ville's cdclk rework.
> v4: Rebase moving cnl_calc_cdclk up to follow same order
>     as previous platforms.
> v2: Squash drm/i915/cnl: Adjust min pixel rate. to address
>     the current limitation where CDCLK cannot be set to 168MHz
>     if audio is used with 96MHz. (Imre)
> 
> Cc: Imre Deak <imre.deak@intel.com>
> Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> 
> Cannonlake also needs to adjust the minimal pixel rate
> as gen9 platforms. Specially for the Azalia audio case.
> 
> Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> Cc: Sanyog Kale <sanyog.r.kale@intel.com>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_cdclk.c | 56 ++++++++++++++++++++++++++++++++++++--
>  1 file changed, 53 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_cdclk.c b/drivers/gpu/drm/i915/intel_cdclk.c
> index 35a1432..1d7cfc5 100644
> --- a/drivers/gpu/drm/i915/intel_cdclk.c
> +++ b/drivers/gpu/drm/i915/intel_cdclk.c
> @@ -1400,6 +1400,16 @@ void bxt_uninit_cdclk(struct drm_i915_private *dev_priv)
>  	bxt_set_cdclk(dev_priv, &cdclk_state);
>  }
>  
> +static int cnl_calc_cdclk(int max_pixclk)
> +{
> +	if (max_pixclk > 336000)
> +		return 528000;
> +	else if (max_pixclk > 168000)
> +		return 336000;
> +	else
> +		return 168000;
> +}
> +
>  static void cnl_cdclk_pll_update(struct drm_i915_private *dev_priv,
>  				 struct intel_cdclk_state *cdclk_state)
>  {
> @@ -1641,7 +1651,7 @@ void cnl_init_cdclk(struct drm_i915_private *dev_priv)
>  
>  	cdclk_state = dev_priv->cdclk.hw;
>  
> -	cdclk_state.cdclk = 168000;
> +	cdclk_state.cdclk = cnl_calc_cdclk(0);
>  	cdclk_state.vco = cnl_cdclk_pll_vco(dev_priv, cdclk_state.cdclk);
>  
>  	cnl_set_cdclk(dev_priv, &cdclk_state);
> @@ -1768,7 +1778,7 @@ static int intel_max_pixel_rate(struct drm_atomic_state *state)
>  
>  		pixel_rate = crtc_state->pixel_rate;
>  
> -		if (IS_BROADWELL(dev_priv) || IS_GEN9(dev_priv))
> +		if (IS_BROADWELL(dev_priv) || INTEL_GEN(dev_priv) >= 9)
>  			pixel_rate =
>  				bdw_adjust_min_pipe_pixel_rate(crtc_state,
>  							       pixel_rate);

I think you might also have to adjust some of the clock limits
within bdw_adjust_min_pipe_pixel_rate().

> @@ -1929,6 +1939,40 @@ static int bxt_modeset_calc_cdclk(struct drm_atomic_state *state)
>  	return 0;
>  }
>  
> +static int cnl_modeset_calc_cdclk(struct drm_atomic_state *state)
> +{
> +	struct drm_i915_private *dev_priv = to_i915(state->dev);
> +	struct intel_atomic_state *intel_state =
> +		to_intel_atomic_state(state);
> +	int max_pixclk = intel_max_pixel_rate(state);
> +	int cdclk, vco;
> +
> +	cdclk = cnl_calc_cdclk(max_pixclk);
> +	vco = cnl_cdclk_pll_vco(dev_priv, cdclk);
> +
> +	if (cdclk > dev_priv->max_cdclk_freq) {
> +		DRM_DEBUG_KMS("requested cdclk (%d kHz) exceeds max (%d kHz)\n",
> +			      cdclk, dev_priv->max_cdclk_freq);
> +		return -EINVAL;
> +	}
> +
> +	intel_state->cdclk.logical.vco = vco;
> +	intel_state->cdclk.logical.cdclk = cdclk;
> +
> +	if (!intel_state->active_crtcs) {
> +		cdclk = cnl_calc_cdclk(0);
> +		vco = cnl_cdclk_pll_vco(dev_priv, cdclk);
> +
> +		intel_state->cdclk.actual.vco = vco;
> +		intel_state->cdclk.actual.cdclk = cdclk;
> +	} else {
> +		intel_state->cdclk.actual =
> +			intel_state->cdclk.logical;
> +	}
> +
> +	return 0;
> +}
> +
>  static int intel_compute_max_dotclk(struct drm_i915_private *dev_priv)
>  {
>  	int max_cdclk_freq = dev_priv->max_cdclk_freq;
> @@ -1960,7 +2004,9 @@ static int intel_compute_max_dotclk(struct drm_i915_private *dev_priv)
>   */
>  void intel_update_max_cdclk(struct drm_i915_private *dev_priv)
>  {
> -	if (IS_GEN9_BC(dev_priv)) {
> +	if (IS_CANNONLAKE(dev_priv)) {
> +		dev_priv->max_cdclk_freq = 528000;
> +	} else if (IS_GEN9_BC(dev_priv)) {
>  		u32 limit = I915_READ(SKL_DFSM) & SKL_DFSM_CDCLK_LIMIT_MASK;
>  		int max_cdclk, vco;
>  
> @@ -2157,6 +2203,10 @@ void intel_init_cdclk_hooks(struct drm_i915_private *dev_priv)
>  		dev_priv->display.set_cdclk = skl_set_cdclk;
>  		dev_priv->display.modeset_calc_cdclk =
>  			skl_modeset_calc_cdclk;
> +	} else if (IS_CANNONLAKE(dev_priv)) {
> +		dev_priv->display.set_cdclk = cnl_set_cdclk;
> +		dev_priv->display.modeset_calc_cdclk =
> +			cnl_modeset_calc_cdclk;
>  	}
>  
>  	if (IS_CANNONLAKE(dev_priv))
> -- 
> 1.9.1

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2017-06-09 14:34 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-08 22:03 [PATCH 01/17] drm/i915/cnl: Implement .get_display_clock_speed() for CNL Rodrigo Vivi
2017-06-08 22:03 ` [PATCH 02/17] drm/i915/cnl: Implement .set_cdclk() " Rodrigo Vivi
2017-06-08 22:03 ` [PATCH 03/17] drm/i915/cnl: Implement CNL display init/unit sequence Rodrigo Vivi
2017-06-08 22:03 ` [PATCH 04/17] drm/i915/cnl: Allow dynamic cdclk changes on CNL Rodrigo Vivi
2017-06-09 13:00   ` Imre Deak
2017-06-09 14:34   ` Ville Syrjälä [this message]
2017-06-09 17:57     ` Pandiyan, Dhinakaran
2017-06-09 19:02     ` Imre Deak
2017-06-09 19:32       ` Ville Syrjälä
2017-06-09 19:51         ` Imre Deak
2017-06-09 20:01           ` Vivi, Rodrigo
2017-06-09 20:21             ` Imre Deak
2017-06-09 20:31               ` Vivi, Rodrigo
2017-06-09 20:42                 ` Imre Deak
2017-06-09 21:07                   ` Vivi, Rodrigo
2017-06-09 19:34       ` Pandiyan, Dhinakaran
2017-06-08 22:03 ` [PATCH 05/17] drm/i915/cnl: DDI - PLL mapping Rodrigo Vivi
2017-06-08 22:03 ` [PATCH 06/17] drm/i915: Configure DPLL's for Cannonlake Rodrigo Vivi
2017-06-08 22:03 ` [PATCH 07/17] drm/i915/cnl: Initialize PLLs Rodrigo Vivi
2017-06-08 22:03 ` [PATCH 08/17] drm/i915: Add MMIO helper for 6 ports with different offsets Rodrigo Vivi
2017-06-08 23:53   ` Manasi Navare
2017-06-08 23:52     ` Vivi, Rodrigo
2017-06-08 22:03 ` [PATCH 09/17] drm/i915/cnl: Add registers related to voltage swing sequences Rodrigo Vivi
2017-06-08 22:03 ` [PATCH 10/17] drm/i915/cnl: Add DDI Buffer translation tables for Cannonlake Rodrigo Vivi
2017-06-08 22:03 ` [PATCH 11/17] drm/i915/cnl: Implement voltage swing sequence Rodrigo Vivi
2017-06-08 22:03 ` [PATCH 12/17] drm/i915/cnl: Enable loadgen_select bit for vswing sequence Rodrigo Vivi
2017-06-08 22:03 ` [PATCH 13/17] drm/i915/DMC/CNL: Load DMC on CNL Rodrigo Vivi
2017-06-08 22:03 ` [PATCH 14/17] drm/i915: Use HAS_CSR instead of gen number on DMC load Rodrigo Vivi
2017-06-08 22:03 ` [PATCH 15/17] drm/i915/cnl: Fix Cannonlake scaler mode programing Rodrigo Vivi
2017-06-08 22:03 ` [PATCH 16/17] drm/i915/cnl: Enable fifo underrun for Cannonlake Rodrigo Vivi
2017-06-08 22:03 ` [PATCH 17/17] drm/i915/cnl: LSPCON support is gen9+ Rodrigo Vivi
2017-06-08 22:22 ` ✓ Fi.CI.BAT: success for series starting with [01/17] drm/i915/cnl: Implement .get_display_clock_speed() for CNL 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=20170609143455.GX12629@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dhinakaran.pandiyan@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=rodrigo.vivi@intel.com \
    --cc=sanyog.r.kale@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.