aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_display.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2013-06-05 07:34:13 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-06-10 13:54:14 -0400
commite9a632a578e0205c1fb015bb01af49c2ae71d6f2 (patch)
tree0395f1101eae98a7a6fcee2b387c2b7ac6eb66b2 /drivers/gpu/drm/i915/intel_display.c
parent46edb027df0d4bd423f7430dd473609caad4674b (diff)
drm/i915: scrap register address storage
Using ids in register macros is much more common in our driver. Also this way we can reduce the platform specific stuff a bit. Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_display.c')
-rw-r--r--drivers/gpu/drm/i915/intel_display.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 1ee16e9195b9..1825ca5466e8 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -938,7 +938,7 @@ static void assert_shared_dpll(struct drm_i915_private *dev_priv,
938 "asserting DPLL %s with no DPLL\n", state_string(state))) 938 "asserting DPLL %s with no DPLL\n", state_string(state)))
939 return; 939 return;
940 940
941 val = I915_READ(pll->pll_reg); 941 val = I915_READ(PCH_DPLL(pll->id));
942 cur_state = !!(val & DPLL_VCO_ENABLE); 942 cur_state = !!(val & DPLL_VCO_ENABLE);
943 WARN(cur_state != state, 943 WARN(cur_state != state,
944 "%s assertion failure (expected %s, current %s), val=%08x\n", 944 "%s assertion failure (expected %s, current %s), val=%08x\n",
@@ -949,14 +949,14 @@ static void assert_shared_dpll(struct drm_i915_private *dev_priv,
949 u32 pch_dpll; 949 u32 pch_dpll;
950 950
951 pch_dpll = I915_READ(PCH_DPLL_SEL); 951 pch_dpll = I915_READ(PCH_DPLL_SEL);
952 cur_state = pll->pll_reg == _PCH_DPLL_B; 952 cur_state = pll->id == DPLL_ID_PCH_PLL_B;
953 if (!WARN(((pch_dpll >> (4 * crtc->pipe)) & 1) != cur_state, 953 if (!WARN(((pch_dpll >> (4 * crtc->pipe)) & 1) != cur_state,
954 "PLL[%d] not attached to this transcoder %c: %08x\n", 954 "PLL[%d] not attached to this transcoder %c: %08x\n",
955 cur_state, pipe_name(crtc->pipe), pch_dpll)) { 955 cur_state, pipe_name(crtc->pipe), pch_dpll)) {
956 cur_state = !!(val >> (4*crtc->pipe + 3)); 956 cur_state = !!(val >> (4*crtc->pipe + 3));
957 WARN(cur_state != state, 957 WARN(cur_state != state,
958 "PLL[%d] not %s on this transcoder %c: %08x\n", 958 "PLL[%d] not %s on this transcoder %c: %08x\n",
959 pll->pll_reg == _PCH_DPLL_B, 959 pll->id == DPLL_ID_PCH_PLL_B,
960 state_string(state), 960 state_string(state),
961 pipe_name(crtc->pipe), 961 pipe_name(crtc->pipe),
962 val); 962 val);
@@ -1446,7 +1446,7 @@ static void ironlake_enable_shared_dpll(struct intel_crtc *crtc)
1446 1446
1447 DRM_DEBUG_KMS("enabling %s\n", pll->name); 1447 DRM_DEBUG_KMS("enabling %s\n", pll->name);
1448 1448
1449 reg = pll->pll_reg; 1449 reg = PCH_DPLL(pll->id);
1450 val = I915_READ(reg); 1450 val = I915_READ(reg);
1451 val |= DPLL_VCO_ENABLE; 1451 val |= DPLL_VCO_ENABLE;
1452 I915_WRITE(reg, val); 1452 I915_WRITE(reg, val);
@@ -1490,7 +1490,7 @@ static void intel_disable_shared_dpll(struct intel_crtc *crtc)
1490 /* Make sure transcoder isn't still depending on us */ 1490 /* Make sure transcoder isn't still depending on us */
1491 assert_pch_transcoder_disabled(dev_priv, crtc->pipe); 1491 assert_pch_transcoder_disabled(dev_priv, crtc->pipe);
1492 1492
1493 reg = pll->pll_reg; 1493 reg = PCH_DPLL(pll->id);
1494 val = I915_READ(reg); 1494 val = I915_READ(reg);
1495 val &= ~DPLL_VCO_ENABLE; 1495 val &= ~DPLL_VCO_ENABLE;
1496 I915_WRITE(reg, val); 1496 I915_WRITE(reg, val);
@@ -3107,8 +3107,8 @@ static struct intel_shared_dpll *intel_get_shared_dpll(struct intel_crtc *crtc,
3107 if (pll->refcount == 0) 3107 if (pll->refcount == 0)
3108 continue; 3108 continue;
3109 3109
3110 if (dpll == (I915_READ(pll->pll_reg) & 0x7fffffff) && 3110 if (dpll == (I915_READ(PCH_DPLL(pll->id)) & 0x7fffffff) &&
3111 fp == I915_READ(pll->fp0_reg)) { 3111 fp == I915_READ(PCH_FP0(pll->id))) {
3112 DRM_DEBUG_KMS("CRTC:%d sharing existing %s (refcount %d, ative %d)\n", 3112 DRM_DEBUG_KMS("CRTC:%d sharing existing %s (refcount %d, ative %d)\n",
3113 crtc->base.base.id, 3113 crtc->base.base.id,
3114 pll->name, pll->refcount, pll->active); 3114 pll->name, pll->refcount, pll->active);
@@ -3139,12 +3139,12 @@ found:
3139 assert_shared_dpll_disabled(dev_priv, pll, NULL); 3139 assert_shared_dpll_disabled(dev_priv, pll, NULL);
3140 3140
3141 /* Wait for the clocks to stabilize before rewriting the regs */ 3141 /* Wait for the clocks to stabilize before rewriting the regs */
3142 I915_WRITE(pll->pll_reg, dpll & ~DPLL_VCO_ENABLE); 3142 I915_WRITE(PCH_DPLL(pll->id), dpll & ~DPLL_VCO_ENABLE);
3143 POSTING_READ(pll->pll_reg); 3143 POSTING_READ(PCH_DPLL(pll->id));
3144 udelay(150); 3144 udelay(150);
3145 3145
3146 I915_WRITE(pll->fp0_reg, fp); 3146 I915_WRITE(PCH_FP0(pll->id), fp);
3147 I915_WRITE(pll->pll_reg, dpll & ~DPLL_VCO_ENABLE); 3147 I915_WRITE(PCH_DPLL(pll->id), dpll & ~DPLL_VCO_ENABLE);
3148 } 3148 }
3149 pll->refcount++; 3149 pll->refcount++;
3150 3150
@@ -5785,10 +5785,10 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
5785 if (intel_crtc->config.has_pch_encoder) { 5785 if (intel_crtc->config.has_pch_encoder) {
5786 pll = intel_crtc_to_shared_dpll(intel_crtc); 5786 pll = intel_crtc_to_shared_dpll(intel_crtc);
5787 5787
5788 I915_WRITE(pll->pll_reg, dpll); 5788 I915_WRITE(PCH_DPLL(pll->id), dpll);
5789 5789
5790 /* Wait for the clocks to stabilize. */ 5790 /* Wait for the clocks to stabilize. */
5791 POSTING_READ(pll->pll_reg); 5791 POSTING_READ(PCH_DPLL(pll->id));
5792 udelay(150); 5792 udelay(150);
5793 5793
5794 /* The pixel multiplier can only be updated once the 5794 /* The pixel multiplier can only be updated once the
@@ -5796,13 +5796,13 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
5796 * 5796 *
5797 * So write it again. 5797 * So write it again.
5798 */ 5798 */
5799 I915_WRITE(pll->pll_reg, dpll); 5799 I915_WRITE(PCH_DPLL(pll->id), dpll);
5800 5800
5801 if (is_lvds && has_reduced_clock && i915_powersave) { 5801 if (is_lvds && has_reduced_clock && i915_powersave) {
5802 I915_WRITE(pll->fp1_reg, fp2); 5802 I915_WRITE(PCH_FP1(pll->id), fp2);
5803 intel_crtc->lowfreq_avail = true; 5803 intel_crtc->lowfreq_avail = true;
5804 } else { 5804 } else {
5805 I915_WRITE(pll->fp1_reg, fp); 5805 I915_WRITE(PCH_FP1(pll->id), fp);
5806 } 5806 }
5807 } 5807 }
5808 5808
@@ -8744,9 +8744,6 @@ static void ibx_pch_dpll_init(struct drm_device *dev)
8744 for (i = 0; i < dev_priv->num_shared_dpll; i++) { 8744 for (i = 0; i < dev_priv->num_shared_dpll; i++) {
8745 dev_priv->shared_dplls[i].id = i; 8745 dev_priv->shared_dplls[i].id = i;
8746 dev_priv->shared_dplls[i].name = ibx_pch_dpll_names[i]; 8746 dev_priv->shared_dplls[i].name = ibx_pch_dpll_names[i];
8747 dev_priv->shared_dplls[i].pll_reg = _PCH_DPLL(i);
8748 dev_priv->shared_dplls[i].fp0_reg = _PCH_FP0(i);
8749 dev_priv->shared_dplls[i].fp1_reg = _PCH_FP1(i);
8750 } 8747 }
8751} 8748}
8752 8749