From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Paulo Zanoni <przanoni@gmail.com>
Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 05/10] drm/i915: Disable CLKOUT_DP bending on LPT/WPT as needed
Date: Thu, 3 Dec 2015 12:03:36 +0200 [thread overview]
Message-ID: <20151203100336.GZ4437@intel.com> (raw)
In-Reply-To: <CA+gsUGStHZwFu3jQxeXWjU+rbGckU7P0HFQGc3Rd-dAUbenPgQ@mail.gmail.com>
On Wed, Dec 02, 2015 at 11:35:00AM -0200, Paulo Zanoni wrote:
> 2015-12-01 11:08 GMT-02:00 <ville.syrjala@linux.intel.com>:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > When we want to use SPLL for FDI we want SSC, which means we have to
> > disable clock bending for the PCH SSC reference (bend and spread are
> > mtutually exclusive). So let's turn off bending when we want spread.
^^^^^^^^^
Spotted this typo here just now. Will fix that one too.
> > In case the BIOS enabled clock bending for some reason we'll just turn
> > it off and enable the spread mode instead.
> >
> > Not sure what happens if the BIOS is actually using the bend source for
> > HDMI at this time, but I suppose it should be no worse than what already
> > happens when we simply turn on the spread.
> >
> > We don't currently use the bend source for anything, and only use the
> > PCH SSC reference for the SPLL to drive FDI (always with spread).
> >
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> > drivers/gpu/drm/i915/i915_reg.h | 2 ++
> > drivers/gpu/drm/i915/intel_display.c | 65 ++++++++++++++++++++++++++++++++++--
> > 2 files changed, 65 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> > index 6d7ac192982d..fcc819f400a6 100644
> > --- a/drivers/gpu/drm/i915/i915_reg.h
> > +++ b/drivers/gpu/drm/i915/i915_reg.h
> > @@ -7320,6 +7320,7 @@ enum skl_disp_power_wells {
> > #define SBI_READY (0x0<<0)
> >
> > /* SBI offsets */
> > +#define SBI_SSCDIVINTPHASE 0x0200
> > #define SBI_SSCDIVINTPHASE6 0x0600
> > #define SBI_SSCDIVINTPHASE_DIVSEL_MASK ((0x7f)<<1)
> > #define SBI_SSCDIVINTPHASE_DIVSEL(x) ((x)<<1)
> > @@ -7327,6 +7328,7 @@ enum skl_disp_power_wells {
> > #define SBI_SSCDIVINTPHASE_INCVAL(x) ((x)<<8)
> > #define SBI_SSCDIVINTPHASE_DIR(x) ((x)<<15)
> > #define SBI_SSCDIVINTPHASE_PROPAGATE (1<<0)
> > +#define SBI_SSCDITHPHASE 0x0204
> > #define SBI_SSCCTL 0x020c
> > #define SBI_SSCCTL6 0x060C
> > #define SBI_SSCCTL_PATHALT (1<<3)
> > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> > index d049b087e8e6..c429029e3bed 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -8551,6 +8551,65 @@ static void lpt_disable_clkout_dp(struct drm_device *dev)
> > mutex_unlock(&dev_priv->sb_lock);
> > }
> >
> > +#define BEND_IDX(steps) ((50 + (steps)) / 5)
> > +
> > +static const uint16_t sscdivintphase[] = {
> > + [BEND_IDX( 50)] = 0x3B23,
> > + [BEND_IDX( 45)] = 0x3B23,
> > + [BEND_IDX( 40)] = 0x3C23,
> > + [BEND_IDX( 35)] = 0x3C23,
> > + [BEND_IDX( 30)] = 0x3D23,
> > + [BEND_IDX( 25)] = 0x3D23,
> > + [BEND_IDX( 20)] = 0x3E23,
> > + [BEND_IDX( 15)] = 0x3E23,
> > + [BEND_IDX( 10)] = 0x3F23,
> > + [BEND_IDX( 5)] = 0x3F23,
> > + [BEND_IDX( 0)] = 0x0025,
> > + [BEND_IDX( -5)] = 0x0025,
> > + [BEND_IDX(-10)] = 0x0125,
> > + [BEND_IDX(-15)] = 0x0125,
> > + [BEND_IDX(-20)] = 0x0225,
> > + [BEND_IDX(-25)] = 0x0225,
> > + [BEND_IDX(-30)] = 0x0325,
> > + [BEND_IDX(-35)] = 0x0325,
> > + [BEND_IDX(-40)] = 0x0425,
> > + [BEND_IDX(-45)] = 0x0425,
> > + [BEND_IDX(-50)] = 0x0525,
> > +};
> > +
> > +/*
> > + * Bend CLKOUT_DP
> > + * steps -50 to 50 inclusive, in steps of 5
> > + * < 0 slow down the clock, > 0 speed up the clock, 0 == no bend (135MHz)
> > + * change in clock period = -(steps / 10) * 5.787 ps
> > + */
> > +static void lpt_bend_clkout_dp(struct drm_i915_private *dev_priv, int steps)
>
> As far as I understood from your comments and the table, "int steps"
> should always be a multiple of 5, right?
Yes, it's in decimal .1 fixed point, but only .0 and .5 values are allowed.
I could have made it binary .1 fixed point, but then comparing with the
spec might have been somewhat less obvious.
>
> > +{
> > + uint32_t tmp;
> > +
> > + int idx = BEND_IDX(steps);
>
> So shouldn't we do the following?
>
> if (WARN_ON(steps % 5 != 0))
> return;
Yes, that's a good idea.
>
> > +
> > + if (WARN_ON(idx >= ARRAY_SIZE(sscdivintphase)))
> > + return;
> > +
> > + mutex_lock(&dev_priv->sb_lock);
> > +
> > + if (steps % 5 != 0)
>
> Shouldn't this be "steps % 10 != 0"? Otherwise, we'll always assign 0x0.
Doh! Thanks for catching that. Will fix.
>
> Everything else looks correct.
>
>
> > + tmp = 0xAAAAAAAB;
> > + else
> > + tmp = 0x00000000;
> > + intel_sbi_write(dev_priv, SBI_SSCDITHPHASE, tmp, SBI_ICLK);
> > +
> > + tmp = intel_sbi_read(dev_priv, SBI_SSCDIVINTPHASE, SBI_ICLK);
> > + tmp &= 0xffff0000;
> > + tmp |= sscdivintphase[idx];
> > + intel_sbi_write(dev_priv, SBI_SSCDIVINTPHASE, tmp, SBI_ICLK);
> > +
> > + mutex_unlock(&dev_priv->sb_lock);
> > +}
> > +
> > +#undef BEND_IDX
> > +
> > static void lpt_init_pch_refclk(struct drm_device *dev)
> > {
> > struct intel_encoder *encoder;
> > @@ -8566,10 +8625,12 @@ static void lpt_init_pch_refclk(struct drm_device *dev)
> > }
> > }
> >
> > - if (has_vga)
> > + if (has_vga) {
> > + lpt_bend_clkout_dp(to_i915(dev), 0);
> > lpt_enable_clkout_dp(dev, true, true);
> > - else
> > + } else {
> > lpt_disable_clkout_dp(dev);
> > + }
> > }
> >
> > /*
> > --
> > 2.4.10
> >
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
>
>
> --
> Paulo Zanoni
--
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-12-03 10:04 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-01 13:08 [PATCH 00/10] HSW/BDW PCH modeset fixes and stuff ville.syrjala
2015-12-01 13:08 ` [PATCH 01/10] drm/i915: Don't register the CRT connector when it's fused off ville.syrjala
2015-12-01 19:05 ` Paulo Zanoni
2015-12-01 19:18 ` Ville Syrjälä
2015-12-01 21:28 ` [PATCH v2 01/10] drm/i915: Don't register the CRT connector when it's fused off on LPT-H ville.syrjala
2015-12-01 13:08 ` [PATCH 02/10] drm/i915: Don't register CRT connectro when DDI E can't be used ville.syrjala
2015-12-01 19:13 ` Paulo Zanoni
2015-12-01 21:29 ` [PATCH v2 02/10] drm/i915: Don't register CRT connector " ville.syrjala
2015-12-01 13:08 ` [PATCH 03/10] drm/i915: Check VBT for CRT port presence on HSW/BDW ville.syrjala
2015-12-01 13:41 ` Chris Wilson
2015-12-01 13:57 ` Ville Syrjälä
2015-12-01 14:06 ` Chris Wilson
2015-12-01 14:19 ` Ville Syrjälä
2015-12-01 16:07 ` [PATCH v2 " ville.syrjala
2015-12-01 18:15 ` Ville Syrjälä
2015-12-01 19:28 ` Paulo Zanoni
2015-12-01 19:40 ` Ville Syrjälä
2015-12-01 21:31 ` [PATCH v3 " ville.syrjala
2015-12-01 13:08 ` [PATCH 04/10] drm/i915: Add "missing" break to haswell_get_ddi_pll() ville.syrjala
2015-12-01 19:34 ` Paulo Zanoni
2015-12-01 19:45 ` Ville Syrjälä
2015-12-01 21:32 ` [PATCH v2 " ville.syrjala
2015-12-02 9:29 ` Ville Syrjälä
2015-12-01 13:08 ` [PATCH 05/10] drm/i915: Disable CLKOUT_DP bending on LPT/WPT as needed ville.syrjala
2015-12-02 13:35 ` Paulo Zanoni
2015-12-03 10:03 ` Ville Syrjälä [this message]
2015-12-03 11:16 ` Paulo Zanoni
2015-12-04 20:19 ` [PATCH v2 " ville.syrjala
2015-12-07 16:54 ` Paulo Zanoni
2015-12-01 13:08 ` [PATCH 06/10] drm/i915: Round to closest when computing the VGA dotclock for LPT-H ville.syrjala
2015-12-02 13:45 ` Paulo Zanoni
2015-12-04 20:20 ` [PATCH v2 " ville.syrjala
2015-12-01 13:08 ` [PATCH 07/10] drm/i915: Disable FDI after the CRT port on LPT-H ville.syrjala
2015-12-02 14:01 ` Paulo Zanoni
2015-12-03 10:14 ` Ville Syrjälä
2015-12-04 20:20 ` [PATCH v2 " ville.syrjala
2015-12-07 17:51 ` Paulo Zanoni
2015-12-07 18:57 ` Ville Syrjälä
2015-12-08 14:04 ` Ville Syrjälä
2015-12-08 14:05 ` [PATCH] " ville.syrjala
2015-12-01 13:08 ` [PATCH 08/10] drm/i915: Refactor LPT-H VGA dotclock disabling ville.syrjala
2015-12-02 16:56 ` Paulo Zanoni
2015-12-03 10:15 ` Ville Syrjälä
2015-12-04 20:21 ` [PATCH v2 " ville.syrjala
2015-12-01 13:08 ` [PATCH 09/10] drm/i915: Disable LPT-H VGA dotclock during crtc disable ville.syrjala
2015-12-02 17:02 ` Paulo Zanoni
2015-12-03 10:29 ` Ville Syrjälä
2015-12-04 20:22 ` [PATCH v2 " ville.syrjala
2015-12-01 13:08 ` [PATCH 10/10] drm/i915: Leave FDI running after failed link training on LPT-H ville.syrjala
2015-12-02 17:16 ` Paulo Zanoni
2015-12-03 10:30 ` Ville Syrjälä
2015-12-04 10:09 ` Daniel Vetter
2015-12-04 11:59 ` Ville Syrjälä
2015-12-04 20:22 ` [PATCH v2 " ville.syrjala
2015-12-08 14:32 ` [PATCH 00/10] HSW/BDW PCH modeset fixes and stuff Ville Syrjälä
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=20151203100336.GZ4437@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--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