Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+20 -26
-3
drivers/gpu/drm/i915/i915_drv.h
··· 147 147 const char *name; 148 148 /* should match the index in the dev_priv->shared_dplls array */ 149 149 enum intel_dpll_id id; 150 - int pll_reg; 151 - int fp0_reg; 152 - int fp1_reg; 153 150 }; 154 151 155 152 /* Used by dp and fdi links */
+3 -3
drivers/gpu/drm/i915/i915_reg.h
··· 3930 3930 3931 3931 #define _PCH_DPLL_A 0xc6014 3932 3932 #define _PCH_DPLL_B 0xc6018 3933 - #define _PCH_DPLL(pll) (pll == 0 ? _PCH_DPLL_A : _PCH_DPLL_B) 3933 + #define PCH_DPLL(pll) (pll == 0 ? _PCH_DPLL_A : _PCH_DPLL_B) 3934 3934 3935 3935 #define _PCH_FPA0 0xc6040 3936 3936 #define FP_CB_TUNE (0x3<<22) 3937 3937 #define _PCH_FPA1 0xc6044 3938 3938 #define _PCH_FPB0 0xc6048 3939 3939 #define _PCH_FPB1 0xc604c 3940 - #define _PCH_FP0(pll) (pll == 0 ? _PCH_FPA0 : _PCH_FPB0) 3941 - #define _PCH_FP1(pll) (pll == 0 ? _PCH_FPA1 : _PCH_FPB1) 3940 + #define PCH_FP0(pll) (pll == 0 ? _PCH_FPA0 : _PCH_FPB0) 3941 + #define PCH_FP1(pll) (pll == 0 ? _PCH_FPA1 : _PCH_FPB1) 3942 3942 3943 3943 #define PCH_DPLL_TEST 0xc606c 3944 3944
+1 -1
drivers/gpu/drm/i915/i915_ums.c
··· 41 41 return false; 42 42 43 43 if (HAS_PCH_SPLIT(dev)) 44 - dpll_reg = _PCH_DPLL(pipe); 44 + dpll_reg = PCH_DPLL(pipe); 45 45 else 46 46 dpll_reg = (pipe == PIPE_A) ? _DPLL_A : _DPLL_B; 47 47
+16 -19
drivers/gpu/drm/i915/intel_display.c
··· 938 938 "asserting DPLL %s with no DPLL\n", state_string(state))) 939 939 return; 940 940 941 - val = I915_READ(pll->pll_reg); 941 + val = I915_READ(PCH_DPLL(pll->id)); 942 942 cur_state = !!(val & DPLL_VCO_ENABLE); 943 943 WARN(cur_state != state, 944 944 "%s assertion failure (expected %s, current %s), val=%08x\n", ··· 949 949 u32 pch_dpll; 950 950 951 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 953 if (!WARN(((pch_dpll >> (4 * crtc->pipe)) & 1) != cur_state, 954 954 "PLL[%d] not attached to this transcoder %c: %08x\n", 955 955 cur_state, pipe_name(crtc->pipe), pch_dpll)) { 956 956 cur_state = !!(val >> (4*crtc->pipe + 3)); 957 957 WARN(cur_state != state, 958 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 960 state_string(state), 961 961 pipe_name(crtc->pipe), 962 962 val); ··· 1446 1446 1447 1447 DRM_DEBUG_KMS("enabling %s\n", pll->name); 1448 1448 1449 - reg = pll->pll_reg; 1449 + reg = PCH_DPLL(pll->id); 1450 1450 val = I915_READ(reg); 1451 1451 val |= DPLL_VCO_ENABLE; 1452 1452 I915_WRITE(reg, val); ··· 1490 1490 /* Make sure transcoder isn't still depending on us */ 1491 1491 assert_pch_transcoder_disabled(dev_priv, crtc->pipe); 1492 1492 1493 - reg = pll->pll_reg; 1493 + reg = PCH_DPLL(pll->id); 1494 1494 val = I915_READ(reg); 1495 1495 val &= ~DPLL_VCO_ENABLE; 1496 1496 I915_WRITE(reg, val); ··· 3107 3107 if (pll->refcount == 0) 3108 3108 continue; 3109 3109 3110 - if (dpll == (I915_READ(pll->pll_reg) & 0x7fffffff) && 3111 - fp == I915_READ(pll->fp0_reg)) { 3110 + if (dpll == (I915_READ(PCH_DPLL(pll->id)) & 0x7fffffff) && 3111 + fp == I915_READ(PCH_FP0(pll->id))) { 3112 3112 DRM_DEBUG_KMS("CRTC:%d sharing existing %s (refcount %d, ative %d)\n", 3113 3113 crtc->base.base.id, 3114 3114 pll->name, pll->refcount, pll->active); ··· 3139 3139 assert_shared_dpll_disabled(dev_priv, pll, NULL); 3140 3140 3141 3141 /* Wait for the clocks to stabilize before rewriting the regs */ 3142 - I915_WRITE(pll->pll_reg, dpll & ~DPLL_VCO_ENABLE); 3143 - POSTING_READ(pll->pll_reg); 3142 + I915_WRITE(PCH_DPLL(pll->id), dpll & ~DPLL_VCO_ENABLE); 3143 + POSTING_READ(PCH_DPLL(pll->id)); 3144 3144 udelay(150); 3145 3145 3146 - I915_WRITE(pll->fp0_reg, fp); 3147 - I915_WRITE(pll->pll_reg, dpll & ~DPLL_VCO_ENABLE); 3146 + I915_WRITE(PCH_FP0(pll->id), fp); 3147 + I915_WRITE(PCH_DPLL(pll->id), dpll & ~DPLL_VCO_ENABLE); 3148 3148 } 3149 3149 pll->refcount++; 3150 3150 ··· 5785 5785 if (intel_crtc->config.has_pch_encoder) { 5786 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 5790 /* Wait for the clocks to stabilize. */ 5791 - POSTING_READ(pll->pll_reg); 5791 + POSTING_READ(PCH_DPLL(pll->id)); 5792 5792 udelay(150); 5793 5793 5794 5794 /* The pixel multiplier can only be updated once the ··· 5796 5796 * 5797 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 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 5803 intel_crtc->lowfreq_avail = true; 5804 5804 } else { 5805 - I915_WRITE(pll->fp1_reg, fp); 5805 + I915_WRITE(PCH_FP1(pll->id), fp); 5806 5806 } 5807 5807 } 5808 5808 ··· 8744 8744 for (i = 0; i < dev_priv->num_shared_dpll; i++) { 8745 8745 dev_priv->shared_dplls[i].id = i; 8746 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