aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2014-09-05 14:52:42 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-09-19 08:41:11 -0400
commit1c4e02746147cef8853142a7c71efcb2b9660aed (patch)
tree2217401c3d9f371ce6da71ffe6517cb5a1aa108b /drivers/gpu
parent8337486a8fda53e5f46b3cb2b4eb3272608348cb (diff)
drm/i915: Fix DVO 2x clock enable on 830M
The spec says: "For the correct operation of the muxed DVO pins (GDEVSELB/ I2Cdata, GIRDBY/I2CClk) and (GFRAMEB/DVI_Data, GTRDYB/DVI_Clk): Bit 31 (DPLL VCO Enable) and Bit 30 (2X Clock Enable) must be set to “1” in both the DPLL A Control Register (06014h-06017h) and DPLL B Control Register (06018h-0601Bh)." The pipe A and B force quirks take care of DPLL_VCO_ENABLE, so we just need a bit of special care to handle DPLL_DVO_2X_MODE. v2: Recompute num_dvo_pipes on the spot, use PIPE_A/PIPE_B instead of pipe/!pipe for the register offsets in disable (Daniel) Add a comment about the ordering in enable and another one about filtering out the DVO 2x bit in state readout Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Tested-by: Thomas Richter <richter@rus.uni-stuttgart.de> (v1) Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/i915/intel_display.c53
1 files changed, 49 insertions, 4 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 1386086ec245..f4b8cb388dd6 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -1612,6 +1612,18 @@ static void chv_enable_pll(struct intel_crtc *crtc)
1612 mutex_unlock(&dev_priv->dpio_lock); 1612 mutex_unlock(&dev_priv->dpio_lock);
1613} 1613}
1614 1614
1615static int intel_num_dvo_pipes(struct drm_device *dev)
1616{
1617 struct intel_crtc *crtc;
1618 int count = 0;
1619
1620 for_each_intel_crtc(dev, crtc)
1621 count += crtc->active &&
1622 intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_DVO);
1623
1624 return count;
1625}
1626
1615static void i9xx_enable_pll(struct intel_crtc *crtc) 1627static void i9xx_enable_pll(struct intel_crtc *crtc)
1616{ 1628{
1617 struct drm_device *dev = crtc->base.dev; 1629 struct drm_device *dev = crtc->base.dev;
@@ -1628,7 +1640,18 @@ static void i9xx_enable_pll(struct intel_crtc *crtc)
1628 if (IS_MOBILE(dev) && !IS_I830(dev)) 1640 if (IS_MOBILE(dev) && !IS_I830(dev))
1629 assert_panel_unlocked(dev_priv, crtc->pipe); 1641 assert_panel_unlocked(dev_priv, crtc->pipe);
1630 1642
1631 I915_WRITE(reg, dpll); 1643 /* Enable DVO 2x clock on both PLLs if necessary */
1644 if (IS_I830(dev) && intel_num_dvo_pipes(dev) > 0) {
1645 /*
1646 * It appears to be important that we don't enable this
1647 * for the current pipe before otherwise configuring the
1648 * PLL. No idea how this should be handled if multiple
1649 * DVO outputs are enabled simultaneosly.
1650 */
1651 dpll |= DPLL_DVO_2X_MODE;
1652 I915_WRITE(DPLL(!crtc->pipe),
1653 I915_READ(DPLL(!crtc->pipe)) | DPLL_DVO_2X_MODE);
1654 }
1632 1655
1633 /* Wait for the clocks to stabilize. */ 1656 /* Wait for the clocks to stabilize. */
1634 POSTING_READ(reg); 1657 POSTING_READ(reg);
@@ -1667,8 +1690,22 @@ static void i9xx_enable_pll(struct intel_crtc *crtc)
1667 * 1690 *
1668 * Note! This is for pre-ILK only. 1691 * Note! This is for pre-ILK only.
1669 */ 1692 */
1670static void i9xx_disable_pll(struct drm_i915_private *dev_priv, enum pipe pipe) 1693static void i9xx_disable_pll(struct intel_crtc *crtc)
1671{ 1694{
1695 struct drm_device *dev = crtc->base.dev;
1696 struct drm_i915_private *dev_priv = dev->dev_private;
1697 enum pipe pipe = crtc->pipe;
1698
1699 /* Disable DVO 2x clock on both PLLs if necessary */
1700 if (IS_I830(dev) &&
1701 intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_DVO) &&
1702 intel_num_dvo_pipes(dev) == 1) {
1703 I915_WRITE(DPLL(PIPE_B),
1704 I915_READ(DPLL(PIPE_B)) & ~DPLL_DVO_2X_MODE);
1705 I915_WRITE(DPLL(PIPE_A),
1706 I915_READ(DPLL(PIPE_A)) & ~DPLL_DVO_2X_MODE);
1707 }
1708
1672 /* Don't disable pipe or pipe PLLs if needed */ 1709 /* Don't disable pipe or pipe PLLs if needed */
1673 if ((pipe == PIPE_A && dev_priv->quirks & QUIRK_PIPEA_FORCE) || 1710 if ((pipe == PIPE_A && dev_priv->quirks & QUIRK_PIPEA_FORCE) ||
1674 (pipe == PIPE_B && dev_priv->quirks & QUIRK_PIPEB_FORCE)) 1711 (pipe == PIPE_B && dev_priv->quirks & QUIRK_PIPEB_FORCE))
@@ -4941,7 +4978,7 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
4941 else if (IS_VALLEYVIEW(dev)) 4978 else if (IS_VALLEYVIEW(dev))
4942 vlv_disable_pll(dev_priv, pipe); 4979 vlv_disable_pll(dev_priv, pipe);
4943 else 4980 else
4944 i9xx_disable_pll(dev_priv, pipe); 4981 i9xx_disable_pll(intel_crtc);
4945 } 4982 }
4946 4983
4947 if (!IS_GEN2(dev)) 4984 if (!IS_GEN2(dev))
@@ -5945,7 +5982,7 @@ static void i8xx_update_pll(struct intel_crtc *crtc,
5945 dpll |= PLL_P2_DIVIDE_BY_4; 5982 dpll |= PLL_P2_DIVIDE_BY_4;
5946 } 5983 }
5947 5984
5948 if (intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_DVO)) 5985 if (!IS_I830(dev) && intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_DVO))
5949 dpll |= DPLL_DVO_2X_MODE; 5986 dpll |= DPLL_DVO_2X_MODE;
5950 5987
5951 if (intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_LVDS) && 5988 if (intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_LVDS) &&
@@ -6451,6 +6488,14 @@ static bool i9xx_get_pipe_config(struct intel_crtc *crtc,
6451 } 6488 }
6452 pipe_config->dpll_hw_state.dpll = I915_READ(DPLL(crtc->pipe)); 6489 pipe_config->dpll_hw_state.dpll = I915_READ(DPLL(crtc->pipe));
6453 if (!IS_VALLEYVIEW(dev)) { 6490 if (!IS_VALLEYVIEW(dev)) {
6491 /*
6492 * DPLL_DVO_2X_MODE must be enabled for both DPLLs
6493 * on 830. Filter it out here so that we don't
6494 * report errors due to that.
6495 */
6496 if (IS_I830(dev))
6497 pipe_config->dpll_hw_state.dpll &= ~DPLL_DVO_2X_MODE;
6498
6454 pipe_config->dpll_hw_state.fp0 = I915_READ(FP0(crtc->pipe)); 6499 pipe_config->dpll_hw_state.fp0 = I915_READ(FP0(crtc->pipe));
6455 pipe_config->dpll_hw_state.fp1 = I915_READ(FP1(crtc->pipe)); 6500 pipe_config->dpll_hw_state.fp1 = I915_READ(FP1(crtc->pipe));
6456 } else { 6501 } else {