| From 7259cc8ab017834f2307de356b9fa91629e2e266 Mon Sep 17 00:00:00 2001 |
| From: Daniel Vetter <daniel.vetter@ffwll.ch> |
| Date: Thu, 6 Jun 2013 00:52:17 +0200 |
| Subject: drm/i915: duplicate intel_enable_pll into i9xx and vlv versions |
| |
| Mostly since I _really_ don't want to touch the vlv hell. |
| |
| No code change, just duplication. Also kill a now seriously outdated |
| code comment - the remark about the dvo encoder is now handled with |
| the pipe A quirk. |
| |
| v2: Update the BUG_ONs as suggested by Jani (both in vlv_ and i9xx_ |
| functions, since the split happens here). |
| |
| Cc: Jani Nikula <jani.nikula@linux.intel.com> |
| Reviewed-by: Imre Deak <imre.deak@intel.com> |
| Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> |
| (cherry picked from commit 87442f732bfad16a8b65fb5d86f69bc0417dc9db) |
| (cherry picked from drm-intel-next-queued) |
| Signed-off-by: Darren Hart <dvhart@linux.intel.com> |
| --- |
| drivers/gpu/drm/i915/intel_display.c | 51 ++++++++++++++++++++++++------------ |
| 1 file changed, 34 insertions(+), 17 deletions(-) |
| |
| diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c |
| index 60ae6d3c6d16..370c720fd039 100644 |
| --- a/drivers/gpu/drm/i915/intel_display.c |
| +++ b/drivers/gpu/drm/i915/intel_display.c |
| @@ -1301,20 +1301,37 @@ static void assert_pch_ports_disabled(struct drm_i915_private *dev_priv, |
| assert_pch_hdmi_disabled(dev_priv, pipe, PCH_HDMID); |
| } |
| |
| -/** |
| - * intel_enable_pll - enable a PLL |
| - * @dev_priv: i915 private structure |
| - * @pipe: pipe PLL to enable |
| - * |
| - * Enable @pipe's PLL so we can start pumping pixels from a plane. Check to |
| - * make sure the PLL reg is writable first though, since the panel write |
| - * protect mechanism may be enabled. |
| - * |
| - * Note! This is for pre-ILK only. |
| - * |
| - * Unfortunately needed by dvo_ns2501 since the dvo depends on it running. |
| - */ |
| -static void intel_enable_pll(struct drm_i915_private *dev_priv, enum pipe pipe) |
| +static void vlv_enable_pll(struct drm_i915_private *dev_priv, enum pipe pipe) |
| +{ |
| + int reg; |
| + u32 val; |
| + |
| + assert_pipe_disabled(dev_priv, pipe); |
| + |
| + /* No really, not for ILK+ */ |
| + BUG_ON(!IS_VALLEYVIEW(dev_priv->dev)); |
| + |
| + /* PLL is protected by panel, make sure we can write it */ |
| + if (IS_MOBILE(dev_priv->dev) && !IS_I830(dev_priv->dev)) |
| + assert_panel_unlocked(dev_priv, pipe); |
| + |
| + reg = DPLL(pipe); |
| + val = I915_READ(reg); |
| + val |= DPLL_VCO_ENABLE; |
| + |
| + /* We do this three times for luck */ |
| + I915_WRITE(reg, val); |
| + POSTING_READ(reg); |
| + udelay(150); /* wait for warmup */ |
| + I915_WRITE(reg, val); |
| + POSTING_READ(reg); |
| + udelay(150); /* wait for warmup */ |
| + I915_WRITE(reg, val); |
| + POSTING_READ(reg); |
| + udelay(150); /* wait for warmup */ |
| +} |
| + |
| +static void i9xx_enable_pll(struct drm_i915_private *dev_priv, enum pipe pipe) |
| { |
| int reg; |
| u32 val; |
| @@ -1322,7 +1339,7 @@ static void intel_enable_pll(struct drm_i915_private *dev_priv, enum pipe pipe) |
| assert_pipe_disabled(dev_priv, pipe); |
| |
| /* No really, not for ILK+ */ |
| - BUG_ON(!IS_VALLEYVIEW(dev_priv->dev) && dev_priv->info->gen >= 5); |
| + BUG_ON(dev_priv->info->gen >= 5); |
| |
| /* PLL is protected by panel, make sure we can write it */ |
| if (IS_MOBILE(dev_priv->dev) && !IS_I830(dev_priv->dev)) |
| @@ -3589,7 +3606,7 @@ static void valleyview_crtc_enable(struct drm_crtc *crtc) |
| if (encoder->pre_pll_enable) |
| encoder->pre_pll_enable(encoder); |
| |
| - intel_enable_pll(dev_priv, pipe); |
| + vlv_enable_pll(dev_priv, pipe); |
| |
| for_each_encoder_on_crtc(dev, crtc, encoder) |
| if (encoder->pre_enable) |
| @@ -3630,7 +3647,7 @@ static void i9xx_crtc_enable(struct drm_crtc *crtc) |
| intel_crtc->active = true; |
| intel_update_watermarks(dev); |
| |
| - intel_enable_pll(dev_priv, pipe); |
| + i9xx_enable_pll(dev_priv, pipe); |
| |
| for_each_encoder_on_crtc(dev, crtc, encoder) |
| if (encoder->pre_enable) |
| -- |
| 1.8.5.rc3 |
| |