From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: "Kumar, Shobhit" <shobhit.kumar@linux.intel.com>
Cc: Shobhit Kumar <shobhit.kumar@intel.com>, intel-gfx@lists.freedesktop.org
Subject: Re: [v3] drm/i915/skl: If needed sanitize bios programmed cdclk
Date: Tue, 20 Oct 2015 14:19:22 +0300 [thread overview]
Message-ID: <20151020111922.GG26517@intel.com> (raw)
In-Reply-To: <56261004.4010304@linux.intel.com>
On Tue, Oct 20, 2015 at 03:27:24PM +0530, Kumar, Shobhit wrote:
> On 10/19/2015 07:18 PM, Ville Syrjälä wrote:
> > On Fri, Oct 16, 2015 at 06:48:53PM +0530, Shobhit Kumar wrote:
> >> Especially in cases where pre-os does not enable display, cdclk might
> >> not be in sane state. During sanitization initialize cdclk with maximum
> >> value till we get dynamic cdclk support.
> >>
> >> v2: Check if BIOS programmed correctly rather than always calling init
> >> - Do validation of programmed cdctl and what it is expected
> >> - Only do slk_init_cdclk if validation failed else reuse BIOS
> >> programmed value
> >>
> >> v3: Move the validation logic in a separate sanitize function (Ville)
> >>
> >> Cc: Imre Deak <imre.deak@intel.com>
> >> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >> Signed-off-by: Shobhit Kumar <shobhit.kumar@intel.com>
> >> ---
> >> drivers/gpu/drm/i915/intel_ddi.c | 12 ++++++++----
> >> drivers/gpu/drm/i915/intel_display.c | 31 +++++++++++++++++++++++++++++++
> >> drivers/gpu/drm/i915/intel_drv.h | 1 +
> >> 3 files changed, 40 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> >> index b25e99a..86d43e6 100644
> >> --- a/drivers/gpu/drm/i915/intel_ddi.c
> >> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> >> @@ -2949,10 +2949,14 @@ void intel_ddi_pll_init(struct drm_device *dev)
> >>
> >> cdclk_freq = dev_priv->display.get_display_clock_speed(dev);
> >> dev_priv->skl_boot_cdclk = cdclk_freq;
> >> - if (!(I915_READ(LCPLL1_CTL) & LCPLL_PLL_ENABLE))
> >> - DRM_ERROR("LCPLL1 is disabled\n");
> >> - else
> >> - intel_display_power_get(dev_priv, POWER_DOMAIN_PLLS);
> >> + if (skl_sanitize_cdclk(dev_priv))
> >> + DRM_DEBUG_KMS("Sanitized cdclk programmed by pre-os\n");
> >> + else {
> >> + if (!(I915_READ(LCPLL1_CTL) & LCPLL_PLL_ENABLE))
> >> + DRM_ERROR("LCPLL1 is disabled\n");
> >
> > Since skl_sanitize_cdclk() will enable the PLL this shouldn't
> > happen anymore, right?
> >
>
> Yeah right. Will remove.
>
> >> + else
> >> + intel_display_power_get(dev_priv, POWER_DOMAIN_PLLS);
> >> + }
> >> } else if (IS_BROXTON(dev)) {
> >> broxton_init_cdclk(dev);
> >> broxton_ddi_phy_init(dev);
> >> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> >> index 5f37f84..98333d3 100644
> >> --- a/drivers/gpu/drm/i915/intel_display.c
> >> +++ b/drivers/gpu/drm/i915/intel_display.c
> >> @@ -5784,6 +5784,37 @@ void skl_init_cdclk(struct drm_i915_private *dev_priv)
> >> DRM_ERROR("DBuf power enable timeout\n");
> >> }
> >>
> >> +int skl_sanitize_cdclk(struct drm_i915_private *dev_priv)
> >> +{
> >> + uint32_t lcpll1 = I915_READ(LCPLL1_CTL);
> >> + uint32_t cdctl = I915_READ(CDCLK_CTL);
> >> + int freq = dev_priv->skl_boot_cdclk;
> >> +
> >> + /* Is PLL enabled and locked ? */
> >> + if (!((lcpll1 & LCPLL_PLL_ENABLE) && (lcpll1 & LCPLL_PLL_LOCK)))
> >> + goto sanitize;
> >> +
> >> + /* DPLL okay; verify the cdclock
> >> + *
> >> + * Noticed in some instances that the freq selection is correct but
> >> + * decimal part is programmed wrong from BIOS where pre-os does not
> >> + * enable display. Verify the same as well.
> >> + */
> >> + if (cdctl == ((cdctl & CDCLK_FREQ_SEL_MASK) | skl_cdclk_decimal(freq)))
> >> + /* All well; nothing to sanitize */
> >> + return false;
> >> +sanitize:
> >> + /*
> >> + * As of now initialize with max cdclk till
> >> + * we get dynamic cdclk support
> >> + * */
> >> + dev_priv->skl_boot_cdclk = 675000;
> >
> > Should be '= dev_priv->max_cdclk'
> >
> > I think we end up doing the intel_update_cdclk() before this gets
> > called, so max_cdclk should already contain something sensible. The
> > whole init sequence is a bit messy currently, but I think we can put
> > off cleaning it up after the dc6 stuff gets sorted.
> >
>
> Actually at the end of skl_init_cdclock, intel_update_cdclk will be
> called and initialize the max_cdclk correctly.
It gets called already earlier from intel_modeset_init().
> In case there was no
> sanitization needed, the BIOS programmed cdclk is stored in
> skl_boot_cdclk and that is used inside the skl_init_cdclk. Same is
> invoked resume time, so we need to update this variable or else change
> the logic.
>
> >> + skl_init_cdclk(dev_priv);
> >> +
> >> + /* we did have to sanitize */
> >> + return true;
> >> +}
> >> +
> >> /* Adjust CDclk dividers to allow high res or save power if possible */
> >> static void valleyview_set_cdclk(struct drm_device *dev, int cdclk)
> >> {
> >> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> >> index 0598932..ec10e6a 100644
> >> --- a/drivers/gpu/drm/i915/intel_drv.h
> >> +++ b/drivers/gpu/drm/i915/intel_drv.h
> >> @@ -1152,6 +1152,7 @@ void broxton_ddi_phy_uninit(struct drm_device *dev);
> >> void bxt_enable_dc9(struct drm_i915_private *dev_priv);
> >> void bxt_disable_dc9(struct drm_i915_private *dev_priv);
> >> void skl_init_cdclk(struct drm_i915_private *dev_priv);
> >> +int skl_sanitize_cdclk(struct drm_i915_private *dev_priv);
> >> void skl_uninit_cdclk(struct drm_i915_private *dev_priv);
> >> void intel_dp_get_m_n(struct intel_crtc *crtc,
> >> struct intel_crtc_state *pipe_config);
> >> --
> >> 2.4.3
> >
--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-10-20 11:19 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-05 15:22 [PATCH] drm/i915/skl: Init cdclk in the driver rather than relying on pre-os Shobhit Kumar
2015-10-05 15:35 ` Imre Deak
2015-10-06 6:35 ` Jani Nikula
2015-10-06 9:57 ` Kumar, Shobhit
2015-10-06 9:56 ` Kumar, Shobhit
2015-10-06 10:41 ` Imre Deak
2015-10-06 11:03 ` Kumar, Shobhit
2015-10-06 11:19 ` Daniel Vetter
2015-10-06 11:41 ` Ville Syrjälä
2015-10-06 12:19 ` Daniel Vetter
2015-10-06 12:43 ` Kumar, Shobhit
2015-10-06 13:04 ` Daniel Vetter
2015-10-06 13:29 ` Ville Syrjälä
2015-10-06 13:25 ` Ville Syrjälä
2015-10-07 6:31 ` Kumar, Shobhit
2015-10-08 4:28 ` [v2] " Shobhit Kumar
2015-10-08 11:29 ` Imre Deak
2015-10-08 12:13 ` Kumar, Shobhit
2015-10-08 12:24 ` Ville Syrjälä
2015-10-09 10:53 ` Kumar, Shobhit
2015-10-16 13:08 ` Kumar, Shobhit
2015-10-16 13:18 ` [v3] drm/i915/skl: If needed sanitize bios programmed cdclk Shobhit Kumar
2015-10-19 7:43 ` Kumar, Shobhit
2015-10-19 13:48 ` Ville Syrjälä
2015-10-20 9:57 ` Kumar, Shobhit
2015-10-20 11:19 ` Ville Syrjälä [this message]
2015-10-20 12:27 ` Kumar, Shobhit
2015-10-20 12:43 ` [v4] " Shobhit Kumar
2015-10-20 12:52 ` Ville Syrjälä
2015-10-21 6:25 ` 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=20151020111922.GG26517@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=shobhit.kumar@intel.com \
--cc=shobhit.kumar@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;
as well as URLs for NNTP newsgroup(s).