Skip to content

Commit 060f02d

Browse files
committed
drm/i915: Refactor LPT-H VGA dotclock disabling
Extract the LPT-H VGA dotclock disable to a separate function in anticipation of further use. While at it move the sb_lock locking inwards when enabling the VGA dotclock, as it's only needed to protect the sideband accesses. v2: Keep the PIXCLK_GATE_GATE name for 0 (Paulo) Signed-off-by: Ville Syrjälä <[email protected]> Reviewed-by: Paulo Zanoni <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 92966a3 commit 060f02d

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

drivers/gpu/drm/i915/intel_display.c

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3940,6 +3940,21 @@ static int intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc)
39403940
return 0;
39413941
}
39423942

3943+
static void lpt_disable_iclkip(struct drm_i915_private *dev_priv)
3944+
{
3945+
u32 temp;
3946+
3947+
I915_WRITE(PIXCLK_GATE, PIXCLK_GATE_GATE);
3948+
3949+
mutex_lock(&dev_priv->sb_lock);
3950+
3951+
temp = intel_sbi_read(dev_priv, SBI_SSCCTL6, SBI_ICLK);
3952+
temp |= SBI_SSCCTL_DISABLE;
3953+
intel_sbi_write(dev_priv, SBI_SSCCTL6, temp, SBI_ICLK);
3954+
3955+
mutex_unlock(&dev_priv->sb_lock);
3956+
}
3957+
39433958
/* Program iCLKIP clock to the desired frequency */
39443959
static void lpt_program_iclkip(struct drm_crtc *crtc)
39453960
{
@@ -3949,18 +3964,7 @@ static void lpt_program_iclkip(struct drm_crtc *crtc)
39493964
u32 divsel, phaseinc, auxdiv, phasedir = 0;
39503965
u32 temp;
39513966

3952-
mutex_lock(&dev_priv->sb_lock);
3953-
3954-
/* It is necessary to ungate the pixclk gate prior to programming
3955-
* the divisors, and gate it back when it is done.
3956-
*/
3957-
I915_WRITE(PIXCLK_GATE, PIXCLK_GATE_GATE);
3958-
3959-
/* Disable SSCCTL */
3960-
intel_sbi_write(dev_priv, SBI_SSCCTL6,
3961-
intel_sbi_read(dev_priv, SBI_SSCCTL6, SBI_ICLK) |
3962-
SBI_SSCCTL_DISABLE,
3963-
SBI_ICLK);
3967+
lpt_disable_iclkip(dev_priv);
39643968

39653969
/* 20MHz is a corner case which is out of range for the 7-bit divisor */
39663970
if (clock == 20000) {
@@ -4000,6 +4004,8 @@ static void lpt_program_iclkip(struct drm_crtc *crtc)
40004004
phasedir,
40014005
phaseinc);
40024006

4007+
mutex_lock(&dev_priv->sb_lock);
4008+
40034009
/* Program SSCDIVINTPHASE6 */
40044010
temp = intel_sbi_read(dev_priv, SBI_SSCDIVINTPHASE6, SBI_ICLK);
40054011
temp &= ~SBI_SSCDIVINTPHASE_DIVSEL_MASK;
@@ -4021,12 +4027,12 @@ static void lpt_program_iclkip(struct drm_crtc *crtc)
40214027
temp &= ~SBI_SSCCTL_DISABLE;
40224028
intel_sbi_write(dev_priv, SBI_SSCCTL6, temp, SBI_ICLK);
40234029

4030+
mutex_unlock(&dev_priv->sb_lock);
4031+
40244032
/* Wait for initialization time */
40254033
udelay(24);
40264034

40274035
I915_WRITE(PIXCLK_GATE, PIXCLK_GATE_UNGATE);
4028-
4029-
mutex_unlock(&dev_priv->sb_lock);
40304036
}
40314037

40324038
static void ironlake_pch_transcoder_set_timings(struct intel_crtc *crtc,

0 commit comments

Comments
 (0)