intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Damien Lespiau <damien.lespiau@intel.com>
To: Paulo Zanoni <przanoni@gmail.com>
Cc: intel-gfx@lists.freedesktop.org, Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: Re: [PATCH 1/2] drm/i915: reuse WRPLL when possible
Date: Mon, 18 Nov 2013 12:01:13 +0000	[thread overview]
Message-ID: <20131118120113.GA10162@strange.amr.corp.intel.com> (raw)
In-Reply-To: <1383164864-1523-1-git-send-email-przanoni@gmail.com>

On Wed, Oct 30, 2013 at 06:27:43PM -0200, Paulo Zanoni wrote:
> From: Paulo Zanoni <paulo.r.zanoni@intel.com>
> 
> It seems we do have machines with 3 HDMI/DVI outputs, so sharing
> WRPLLs is the only way to get 3 pipes working.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=68485
> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>

-- 
Damien

> ---
>  drivers/gpu/drm/i915/intel_ddi.c | 37 ++++++++++++++++++++++---------------
>  1 file changed, 22 insertions(+), 15 deletions(-)
> 
> It is that easy because I already planned to enable PLL sharing when I wrote the
> original code :)
> 
> 
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index 31f4fe2..f2144b2 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -636,8 +636,6 @@ bool intel_ddi_pll_mode_set(struct drm_crtc *crtc)
>  	uint32_t reg, val;
>  	int clock = intel_crtc->config.port_clock;
>  
> -	/* TODO: reuse PLLs when possible (compare values) */
> -
>  	intel_ddi_put_crtc_pll(crtc);
>  
>  	if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP) {
> @@ -665,31 +663,40 @@ bool intel_ddi_pll_mode_set(struct drm_crtc *crtc)
>  	} else if (type == INTEL_OUTPUT_HDMI) {
>  		unsigned p, n2, r2;
>  
> -		if (plls->wrpll1_refcount == 0) {
> +		intel_ddi_calculate_wrpll(clock * 1000, &r2, &n2, &p);
> +
> +		val = WRPLL_PLL_ENABLE | WRPLL_PLL_SELECT_LCPLL_2700 |
> +		      WRPLL_DIVIDER_REFERENCE(r2) | WRPLL_DIVIDER_FEEDBACK(n2) |
> +		      WRPLL_DIVIDER_POST(p);
> +
> +		if (val == I915_READ(WRPLL_CTL1)) {
> +			DRM_DEBUG_KMS("Reusing WRPLL 1 on pipe %c\n",
> +				      pipe_name(pipe));
> +			reg = WRPLL_CTL1;
> +		} else if (val == I915_READ(WRPLL_CTL2)) {
> +			DRM_DEBUG_KMS("Reusing WRPLL 2 on pipe %c\n",
> +				      pipe_name(pipe));
> +			reg = WRPLL_CTL2;
> +		} else if (plls->wrpll1_refcount == 0) {
>  			DRM_DEBUG_KMS("Using WRPLL 1 on pipe %c\n",
>  				      pipe_name(pipe));
> -			plls->wrpll1_refcount++;
>  			reg = WRPLL_CTL1;
> -			intel_crtc->ddi_pll_sel = PORT_CLK_SEL_WRPLL1;
>  		} else if (plls->wrpll2_refcount == 0) {
>  			DRM_DEBUG_KMS("Using WRPLL 2 on pipe %c\n",
>  				      pipe_name(pipe));
> -			plls->wrpll2_refcount++;
>  			reg = WRPLL_CTL2;
> -			intel_crtc->ddi_pll_sel = PORT_CLK_SEL_WRPLL2;
>  		} else {
>  			DRM_ERROR("No WRPLLs available!\n");
>  			return false;
>  		}
>  
> -		WARN(I915_READ(reg) & WRPLL_PLL_ENABLE,
> -		     "WRPLL already enabled\n");
> -
> -		intel_ddi_calculate_wrpll(clock * 1000, &r2, &n2, &p);
> -
> -		val = WRPLL_PLL_ENABLE | WRPLL_PLL_SELECT_LCPLL_2700 |
> -		      WRPLL_DIVIDER_REFERENCE(r2) | WRPLL_DIVIDER_FEEDBACK(n2) |
> -		      WRPLL_DIVIDER_POST(p);
> +		if (reg == WRPLL_CTL1) {
> +			plls->wrpll1_refcount++;
> +			intel_crtc->ddi_pll_sel = PORT_CLK_SEL_WRPLL1;
> +		} else {
> +			plls->wrpll2_refcount++;
> +			intel_crtc->ddi_pll_sel = PORT_CLK_SEL_WRPLL2;
> +		}
>  
>  	} else if (type == INTEL_OUTPUT_ANALOG) {
>  		if (plls->spll_refcount == 0) {
> -- 
> 1.8.3.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2013-11-18 12:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-30 20:27 [PATCH 1/2] drm/i915: reuse WRPLL when possible Paulo Zanoni
2013-10-30 20:27 ` [PATCH 2/2] drm/i915: split intel_ddi_pll_mode_set in 2 pieces Paulo Zanoni
2013-11-18 12:06   ` Damien Lespiau
2013-11-25 17:27     ` [PATCH] " Paulo Zanoni
2013-12-12 10:14       ` Damien Lespiau
2013-12-12 13:17         ` Paulo Zanoni
2013-12-12 14:31           ` Daniel Vetter
2013-11-18 12:01 ` Damien Lespiau [this message]
2013-11-18 16:15   ` [PATCH 1/2] drm/i915: reuse WRPLL when possible 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=20131118120113.GA10162@strange.amr.corp.intel.com \
    --to=damien.lespiau@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=paulo.r.zanoni@intel.com \
    --cc=przanoni@gmail.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;
as well as URLs for NNTP newsgroup(s).