public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: ville.syrjala@linux.intel.com
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 3/3] drm/i915: Cache HPLL frequency on VLV/CHV
Date: Thu, 06 Nov 2014 16:02:10 +0200	[thread overview]
Message-ID: <1415282530.20763.15.camel@intelbox> (raw)
In-Reply-To: <1412692882-13577-3-git-send-email-ville.syrjala@linux.intel.com>

On Tue, 2014-10-07 at 17:41 +0300, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> We need the HPLL frequency when calculating cdclk. Currently we read
> that out from the hardware every single time, which isn't going to fly
> very well if the device is runtime suspended. So cache the HPLL
> frequency in dev_priv and use the cached value.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

You could add:
Reference: https://bugs.freedesktop.org/show_bug.cgi?id=82939

where this fixes some subtest failures on VLV.
On 1/3 and 3/3 of this patchset:
Reviewed-by: Imre Deak <imre.deak@intel.com>

> ---
>  drivers/gpu/drm/i915/i915_drv.h      |  1 +
>  drivers/gpu/drm/i915/intel_display.c | 14 +++++++-------
>  2 files changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 1e476b5..68a3509 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -1545,6 +1545,7 @@ struct drm_i915_private {
>  
>  	unsigned int fsb_freq, mem_freq, is_ddr3;
>  	unsigned int vlv_cdclk_freq;
> +	unsigned int hpll_freq;
>  
>  	/**
>  	 * wq - Driver workqueue for GEM.
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 149310b..6fbae00 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -4660,10 +4660,9 @@ static void valleyview_set_cdclk(struct drm_device *dev, int cdclk)
>  	mutex_unlock(&dev_priv->rps.hw_lock);
>  
>  	if (cdclk == 400000) {
> -		u32 divider, vco;
> +		u32 divider;
>  
> -		vco = valleyview_get_vco(dev_priv);
> -		divider = DIV_ROUND_CLOSEST(vco << 1, cdclk) - 1;
> +		divider = DIV_ROUND_CLOSEST(dev_priv->hpll_freq << 1, cdclk) - 1;
>  
>  		mutex_lock(&dev_priv->dpio_lock);
>  		/* adjust cdclk divider */
> @@ -4742,8 +4741,7 @@ static void cherryview_set_cdclk(struct drm_device *dev, int cdclk)
>  static int valleyview_calc_cdclk(struct drm_i915_private *dev_priv,
>  				 int max_pixclk)
>  {
> -	int vco = valleyview_get_vco(dev_priv);
> -	int freq_320 = (vco <<  1) % 320000 != 0 ? 333333 : 320000;
> +	int freq_320 = (dev_priv->hpll_freq <<  1) % 320000 != 0 ? 333333 : 320000;
>  
>  	/* FIXME: Punit isn't quite ready yet */
>  	if (IS_CHERRYVIEW(dev_priv->dev))
> @@ -5452,7 +5450,6 @@ static int intel_crtc_compute_config(struct intel_crtc *crtc,
>  static int valleyview_get_display_clock_speed(struct drm_device *dev)
>  {
>  	struct drm_i915_private *dev_priv = dev->dev_private;
> -	int vco = valleyview_get_vco(dev_priv);
>  	u32 val;
>  	int divider;
>  
> @@ -5460,6 +5457,9 @@ static int valleyview_get_display_clock_speed(struct drm_device *dev)
>  	if (IS_CHERRYVIEW(dev))
>  		return 400000;
>  
> +	if (dev_priv->hpll_freq == 0)
> +		dev_priv->hpll_freq = valleyview_get_vco(dev_priv);
> +
>  	mutex_lock(&dev_priv->dpio_lock);
>  	val = vlv_cck_read(dev_priv, CCK_DISPLAY_CLOCK_CONTROL);
>  	mutex_unlock(&dev_priv->dpio_lock);
> @@ -5470,7 +5470,7 @@ static int valleyview_get_display_clock_speed(struct drm_device *dev)
>  	     (divider << DISPLAY_FREQUENCY_STATUS_SHIFT),
>  	     "cdclk change in progress\n");
>  
> -	return DIV_ROUND_CLOSEST(vco << 1, divider + 1);
> +	return DIV_ROUND_CLOSEST(dev_priv->hpll_freq << 1, divider + 1);
>  }
>  
>  static int i945_get_display_clock_speed(struct drm_device *dev)


_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2014-11-06 14:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-07 14:41 [PATCH 1/3] drm/i915: Add missing '\n' to cdclk debug message ville.syrjala
2014-10-07 14:41 ` [PATCH 2/3] drm/i915: Grab rpm ref when changing cdclk on VLV/CHV ville.syrjala
2014-10-27  8:48   ` Daniel Vetter
2014-10-27  9:28     ` Ville Syrjälä
2014-11-06 12:49   ` [PATCH v2 2/3] drm/i915: Move the .global_resources() hook call into modeset_update_crtc_power_domains() ville.syrjala
2014-11-06 13:10     ` Daniel Vetter
2014-11-10 17:14       ` Jesse Barnes
2014-11-10 17:24         ` Ville Syrjälä
2014-11-10 18:08           ` Jesse Barnes
2014-10-07 14:41 ` [PATCH 3/3] drm/i915: Cache HPLL frequency on VLV/CHV ville.syrjala
2014-11-06 14:02   ` Imre Deak [this message]
2014-11-06 14:46     ` Daniel Vetter

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=1415282530.20763.15.camel@intelbox \
    --to=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox