Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	Stuart Abercrombie <sabercrombie@google.com>
Subject: Re: [PATCH 2/2] drm/i915: fix pnv display core clock readout out
Date: Fri, 26 Jul 2013 11:18:21 +0300	[thread overview]
Message-ID: <87ehal3faq.fsf@intel.com> (raw)
In-Reply-To: <1374820542-28282-2-git-send-email-daniel.vetter@ffwll.ch>

On Fri, 26 Jul 2013, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> We need the correct clock to accurately assess whether we need to
> enable the double wide pipe mode or not.
>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Stéphane Marchesin <marcheu@chromium.org>
> Cc: Stuart Abercrombie <sabercrombie@google.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/i915/i915_reg.h      |  6 ++++++
>  drivers/gpu/drm/i915/intel_display.c | 29 ++++++++++++++++++++++++++++-
>  2 files changed, 34 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index 6caa748..3aebe5d 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -61,6 +61,12 @@
>  #define   GC_LOW_FREQUENCY_ENABLE	(1 << 7)
>  #define   GC_DISPLAY_CLOCK_190_200_MHZ	(0 << 4)
>  #define   GC_DISPLAY_CLOCK_333_MHZ	(4 << 4)
> +#define   GC_DISPLAY_CLOCK_267_MHZ_PNV	(0 << 4)
> +#define   GC_DISPLAY_CLOCK_333_MHZ_PNV	(1 << 4)
> +#define   GC_DISPLAY_CLOCK_444_MHZ_PNV	(2 << 4)
> +#define   GC_DISPLAY_CLOCK_200_MHZ_PNV	(5 << 4)
> +#define   GC_DISPLAY_CLOCK_133_MHZ_PNV	(6 << 4)
> +#define   GC_DISPLAY_CLOCK_167_MHZ_PNV	(7 << 4)
>  #define   GC_DISPLAY_CLOCK_MASK		(7 << 4)
>  #define   GM45_GC_RENDER_CLOCK_MASK	(0xf << 0)
>  #define   GM45_GC_RENDER_CLOCK_266_MHZ	(8 << 0)
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index b3389d7..3e66f05 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -4163,6 +4163,30 @@ static int i9xx_misc_get_display_clock_speed(struct drm_device *dev)
>  	return 200000;
>  }
>  
> +static int pnv_get_display_clock_speed(struct drm_device *dev)
> +{
> +	u16 gcfgc = 0;
> +
> +	pci_read_config_word(dev->pdev, GCFGC, &gcfgc);
> +
> +	switch (gcfgc & GC_DISPLAY_CLOCK_MASK) {
> +	case GC_DISPLAY_CLOCK_267_MHZ_PNV:
> +		return 267000;
> +	case GC_DISPLAY_CLOCK_333_MHZ_PNV:
> +		return 333000;
> +	case GC_DISPLAY_CLOCK_444_MHZ_PNV:
> +		return 444000;
> +	case GC_DISPLAY_CLOCK_200_MHZ_PNV:
> +		return 200000;
> +	default:
> +		DRM_ERROR("Unknown pnv display core clock 0x%04x\n", gcfgc);

Reading the spec, should the default/fallback be 333 MHz for desktop?
Otherwise,

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> +	case GC_DISPLAY_CLOCK_133_MHZ_PNV:
> +		return 133000;
> +	case GC_DISPLAY_CLOCK_167_MHZ_PNV:
> +		return 167000;
> +	}
> +}
> +
>  static int i915gm_get_display_clock_speed(struct drm_device *dev)
>  {
>  	u16 gcfgc = 0;
> @@ -9605,9 +9629,12 @@ static void intel_init_display(struct drm_device *dev)
>  	else if (IS_I915G(dev))
>  		dev_priv->display.get_display_clock_speed =
>  			i915_get_display_clock_speed;
> -	else if (IS_I945GM(dev) || IS_845G(dev) || IS_PINEVIEW_M(dev))
> +	else if (IS_I945GM(dev) || IS_845G(dev))
>  		dev_priv->display.get_display_clock_speed =
>  			i9xx_misc_get_display_clock_speed;
> +	else if (IS_PINEVIEW(dev))
> +		dev_priv->display.get_display_clock_speed =
> +			pnv_get_display_clock_speed;
>  	else if (IS_I915GM(dev))
>  		dev_priv->display.get_display_clock_speed =
>  			i915gm_get_display_clock_speed;
> -- 
> 1.8.3.2
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2013-07-26  8:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-26  6:35 [PATCH 1/2] drm/i915: enable pnv gpu reset Daniel Vetter
2013-07-26  6:35 ` [PATCH 2/2] drm/i915: fix pnv display core clock readout out Daniel Vetter
2013-07-26  7:19   ` Chris Wilson
2013-07-26  8:18   ` Jani Nikula [this message]
2013-07-26 17:55     ` Daniel Vetter
2013-07-26  7:28 ` [PATCH 1/2] drm/i915: enable pnv gpu reset Chris Wilson

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=87ehal3faq.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=sabercrombie@google.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