All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2] drm/i915: Make i9xx_crtc_clock_get() work for PCH DPLLs
Date: Fri, 13 Sep 2013 16:06:32 +0300	[thread overview]
Message-ID: <20130913130632.GT20128@intel.com> (raw)
In-Reply-To: <87eh8sna9o.fsf@intel.com>

On Fri, Sep 13, 2013 at 04:04:03PM +0300, Jani Nikula wrote:
> On Mon, 09 Sep 2013, ville.syrjala@linux.intel.com wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > Add the 120MHz refernce clock case for PCH DPLLs.
> >
> > Also determine the reference clock frequency more accurately by
> > checking for the PLLB_REF_INPUT_SPREADSPECTRUMIN refclk input
> > mode. The gen2 code already checked it, but it stil assumed a
> > fixed 66MHz refclk. Instead we need to consult the VBT for the
> > real value.
> >
> > v2: Fix refclk for SSC panel case
> >
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_display.c | 32 +++++++++++++++++++++-----------
> >  1 file changed, 21 insertions(+), 11 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> > index 754de85..4f07292 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -7324,6 +7324,22 @@ void intel_release_load_detect_pipe(struct drm_connector *connector,
> >  	mutex_unlock(&crtc->mutex);
> >  }
> >  
> > +static int i9xx_pll_refclk(struct drm_device *dev,
> > +			   const struct intel_crtc_config *pipe_config)
> > +{
> > +	struct drm_i915_private *dev_priv = dev->dev_private;
> > +	u32 dpll = pipe_config->dpll_hw_state.dpll;
> > +
> > +	if ((dpll & PLL_REF_INPUT_MASK) == PLLB_REF_INPUT_SPREADSPECTRUMIN)
> 
> This seems wrong for at least gen3 and vlv. And it's a bit scary to go
> change gen2 but oh well...

Why? i8xx_update_pll(), i9xx_update_pll() and ironlake_compute_dpll()
all have the same logic for setting that bit.

For VLV I agree. But the clock readout there is totally busted anyway,
so I don't care at this point.

> 
> Jani.
> 
> > +		return dev_priv->vbt.lvds_ssc_freq * 1000;
> > +	else if (HAS_PCH_SPLIT(dev))
> > +		return 120000;
> > +	else if (!IS_GEN2(dev))
> > +		return 96000;
> > +	else
> > +		return 48000;
> > +}
> > +
> >  /* Returns the clock of the currently programmed mode of the given pipe. */
> >  static void i9xx_crtc_clock_get(struct intel_crtc *crtc,
> >  				struct intel_crtc_config *pipe_config)
> > @@ -7334,6 +7350,7 @@ static void i9xx_crtc_clock_get(struct intel_crtc *crtc,
> >  	u32 dpll = pipe_config->dpll_hw_state.dpll;
> >  	u32 fp;
> >  	intel_clock_t clock;
> > +	int refclk = i9xx_pll_refclk(dev, pipe_config);
> >  
> >  	if ((dpll & DISPLAY_RATE_SELECT_FPA1) == 0)
> >  		fp = pipe_config->dpll_hw_state.fp0;
> > @@ -7373,9 +7390,9 @@ static void i9xx_crtc_clock_get(struct intel_crtc *crtc,
> >  		}
> >  
> >  		if (IS_PINEVIEW(dev))
> > -			pineview_clock(96000, &clock);
> > +			pineview_clock(refclk, &clock);
> >  		else
> > -			i9xx_clock(96000, &clock);
> > +			i9xx_clock(refclk, &clock);
> >  	} else {
> >  		bool is_lvds = (pipe == 1) && (I915_READ(LVDS) & LVDS_PORT_EN);
> >  
> > @@ -7383,13 +7400,6 @@ static void i9xx_crtc_clock_get(struct intel_crtc *crtc,
> >  			clock.p1 = ffs((dpll & DPLL_FPA01_P1_POST_DIV_MASK_I830_LVDS) >>
> >  				       DPLL_FPA01_P1_POST_DIV_SHIFT);
> >  			clock.p2 = 14;
> > -
> > -			if ((dpll & PLL_REF_INPUT_MASK) ==
> > -			    PLLB_REF_INPUT_SPREADSPECTRUMIN) {
> > -				/* XXX: might not be 66MHz */
> > -				i9xx_clock(66000, &clock);
> > -			} else
> > -				i9xx_clock(48000, &clock);
> >  		} else {
> >  			if (dpll & PLL_P1_DIVIDE_BY_TWO)
> >  				clock.p1 = 2;
> > @@ -7401,9 +7411,9 @@ static void i9xx_crtc_clock_get(struct intel_crtc *crtc,
> >  				clock.p2 = 4;
> >  			else
> >  				clock.p2 = 2;
> > -
> > -			i9xx_clock(48000, &clock);
> >  		}
> > +
> > +		i9xx_clock(refclk, &clock);
> >  	}
> >  
> >  	pipe_config->adjusted_mode.clock = clock.dot;
> > -- 
> > 1.8.1.5
> >
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> -- 
> Jani Nikula, Intel Open Source Technology Center

-- 
Ville Syrjälä
Intel OTC

  reply	other threads:[~2013-09-13 13:06 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-06 20:28 [PATCH 00/11] drm/i915: adjusted_mode.clock vs. port_clock v3 ville.syrjala
2013-09-06 20:28 ` [PATCH 01/11] drm/i915: Don't factor in pixel multplier when deriving dotclock from link clock and M/N values ville.syrjala
2013-09-06 20:28 ` [PATCH v2 02/11] drm/i915: Make adjusted_mode.clock non-pixel multiplied ville.syrjala
2013-09-13 11:40   ` Jani Nikula
2013-09-06 20:29 ` [PATCH v2 03/11] drm/i915: Add support for pipe_bpp readout ville.syrjala
2013-09-13 11:59   ` Jani Nikula
2013-09-06 20:29 ` [PATCH 04/11] drm/i915: Add state readout and checking for has_dp_encoder and dp_m_n ville.syrjala
2013-09-10 14:02   ` [PATCH v2] " ville.syrjala
2013-09-13 12:11     ` Jani Nikula
2013-09-06 20:29 ` [PATCH 05/11] drm/i915: Make intel_fuzzy_clock_check() take in arbitrary clocks ville.syrjala
2013-09-13 12:55   ` Daniel Vetter
2013-09-06 20:29 ` [PATCH 06/11] drm/i915: Add intel_dotclock_calculate() ville.syrjala
2013-09-13 12:30   ` Jani Nikula
2013-09-13 12:43     ` Ville Syrjälä
2013-09-13 12:59       ` [PATCH v2] " ville.syrjala
2013-09-16 11:14         ` Jani Nikula
2013-09-16 20:41           ` Daniel Vetter
2013-09-17  8:16             ` Ville Syrjälä
2013-09-06 20:29 ` [PATCH 07/11] drm/i915: Make i9xx_crtc_clock_get() use dpll_hw_state ville.syrjala
2013-09-13 12:40   ` Jani Nikula
2013-09-13 13:12     ` Ville Syrjälä
2013-09-13 13:18     ` [PATCH v2] " ville.syrjala
2013-09-13 13:44       ` Jani Nikula
2013-09-06 20:29 ` [PATCH 08/11] drm/i915: Make i9xx_crtc_clock_get() work for PCH DPLLs ville.syrjala
2013-09-08 12:35   ` Daniel Vetter
2013-09-09 11:06     ` [PATCH v2] " ville.syrjala
2013-09-13 13:04       ` Jani Nikula
2013-09-13 13:06         ` Ville Syrjälä [this message]
2013-09-13 13:47           ` Jani Nikula
2013-09-13 13:54             ` Ville Syrjälä
2013-09-16 20:43             ` Daniel Vetter
2013-09-06 20:29 ` [PATCH 09/11] drm/i915: Fix port_clock and adjusted_mode.clock readout all over ville.syrjala
2013-09-08 12:37   ` Daniel Vetter
2013-09-09 10:35     ` [PATCH v2] " ville.syrjala
2013-09-09 11:34       ` [PATCH v3] " ville.syrjala
2013-09-13 13:00         ` [PATCH v4] " ville.syrjala
2013-09-16 11:16           ` Jani Nikula
2013-09-06 20:29 ` [PATCH v2 10/11] drm/i915: Add PIPE_CONF_CHECK_CLOCK_FUZZY() ville.syrjala
2013-09-06 20:29 ` [PATCH v2 11/11] drm/i915: Add fuzzy clock check for port_clock ville.syrjala
2013-09-16 21:16   ` Daniel Vetter
2013-09-08 12:38 ` [PATCH 00/11] drm/i915: adjusted_mode.clock vs. port_clock v3 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=20130913130632.GT20128@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@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 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.