Commit 8bd3f301 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Add a local pipe variable to vlv_enable_pll()

Avoid redundant crtc->pipe lookups by giving vlv_enable_pll() a local
pipe variable. Also makes it look more like the corresponding CHV code.

While at is change the CHV code to enum pipe from int,
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1458052809-23426-5-git-send-email-ville.syrjala@linux.intel.comReviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
parent c231775c
...@@ -1528,24 +1528,25 @@ static void vlv_enable_pll(struct intel_crtc *crtc, ...@@ -1528,24 +1528,25 @@ static void vlv_enable_pll(struct intel_crtc *crtc,
{ {
struct drm_device *dev = crtc->base.dev; struct drm_device *dev = crtc->base.dev;
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
i915_reg_t reg = DPLL(crtc->pipe); enum pipe pipe = crtc->pipe;
i915_reg_t reg = DPLL(pipe);
u32 dpll = pipe_config->dpll_hw_state.dpll; u32 dpll = pipe_config->dpll_hw_state.dpll;
assert_pipe_disabled(dev_priv, crtc->pipe); assert_pipe_disabled(dev_priv, pipe);
/* PLL is protected by panel, make sure we can write it */ /* PLL is protected by panel, make sure we can write it */
if (IS_MOBILE(dev_priv->dev)) if (IS_MOBILE(dev_priv->dev))
assert_panel_unlocked(dev_priv, crtc->pipe); assert_panel_unlocked(dev_priv, pipe);
I915_WRITE(reg, dpll); I915_WRITE(reg, dpll);
POSTING_READ(reg); POSTING_READ(reg);
udelay(150); udelay(150);
if (wait_for(((I915_READ(reg) & DPLL_LOCK_VLV) == DPLL_LOCK_VLV), 1)) if (wait_for(((I915_READ(reg) & DPLL_LOCK_VLV) == DPLL_LOCK_VLV), 1))
DRM_ERROR("DPLL %d failed to lock\n", crtc->pipe); DRM_ERROR("DPLL %d failed to lock\n", pipe);
I915_WRITE(DPLL_MD(crtc->pipe), pipe_config->dpll_hw_state.dpll_md); I915_WRITE(DPLL_MD(pipe), pipe_config->dpll_hw_state.dpll_md);
POSTING_READ(DPLL_MD(crtc->pipe)); POSTING_READ(DPLL_MD(pipe));
/* We do this three times for luck */ /* We do this three times for luck */
I915_WRITE(reg, dpll); I915_WRITE(reg, dpll);
...@@ -1564,11 +1565,11 @@ static void chv_enable_pll(struct intel_crtc *crtc, ...@@ -1564,11 +1565,11 @@ static void chv_enable_pll(struct intel_crtc *crtc,
{ {
struct drm_device *dev = crtc->base.dev; struct drm_device *dev = crtc->base.dev;
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int pipe = crtc->pipe; enum pipe pipe = crtc->pipe;
enum dpio_channel port = vlv_pipe_to_channel(pipe); enum dpio_channel port = vlv_pipe_to_channel(pipe);
u32 tmp; u32 tmp;
assert_pipe_disabled(dev_priv, crtc->pipe); assert_pipe_disabled(dev_priv, pipe);
mutex_lock(&dev_priv->sb_lock); mutex_lock(&dev_priv->sb_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment