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

drm/i915: metadata for shared dplls

An id to match the idx (useful for register access macros) and a name
fore neater debug output.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

+40 -29
+12 -9
drivers/gpu/drm/i915/i915_drv.h
··· 132 132 list_for_each_entry((intel_encoder), &(dev)->mode_config.encoder_list, base.head) \ 133 133 if ((intel_encoder)->base.crtc == (__crtc)) 134 134 135 - struct intel_shared_dpll { 136 - int refcount; /* count of number of CRTCs sharing this PLL */ 137 - int active; /* count of number of active CRTCs (i.e. DPMS on) */ 138 - bool on; /* is the PLL actually active? Disabled during modeset */ 139 - int pll_reg; 140 - int fp0_reg; 141 - int fp1_reg; 142 - }; 143 - 144 135 enum intel_dpll_id { 145 136 DPLL_ID_PRIVATE = -1, /* non-shared dpll in use */ 146 137 /* real shared dpll ids must be >= 0 */ ··· 139 148 DPLL_ID_PCH_PLL_B, 140 149 }; 141 150 #define I915_NUM_PLLS 2 151 + 152 + struct intel_shared_dpll { 153 + int refcount; /* count of number of CRTCs sharing this PLL */ 154 + int active; /* count of number of active CRTCs (i.e. DPMS on) */ 155 + bool on; /* is the PLL actually active? Disabled during modeset */ 156 + const char *name; 157 + /* should match the index in the dev_priv->shared_dplls array */ 158 + enum intel_dpll_id id; 159 + int pll_reg; 160 + int fp0_reg; 161 + int fp1_reg; 162 + }; 142 163 143 164 /* Used by dp and fdi links */ 144 165 struct intel_link_m_n {
+28 -20
drivers/gpu/drm/i915/intel_display.c
··· 935 935 } 936 936 937 937 if (WARN (!pll, 938 - "asserting PCH PLL %s with no PLL\n", state_string(state))) 938 + "asserting DPLL %s with no DPLL\n", state_string(state))) 939 939 return; 940 940 941 941 val = I915_READ(pll->pll_reg); 942 942 cur_state = !!(val & DPLL_VCO_ENABLE); 943 943 WARN(cur_state != state, 944 - "PCH PLL state for reg %x assertion failure (expected %s, current %s), val=%08x\n", 945 - pll->pll_reg, state_string(state), state_string(cur_state), val); 944 + "%s assertion failure (expected %s, current %s), val=%08x\n", 945 + pll->name, state_string(state), state_string(cur_state), val); 946 946 947 947 /* Make sure the selected PLL is correctly attached to the transcoder */ 948 948 if (crtc && HAS_PCH_CPT(dev_priv->dev)) { ··· 1430 1430 if (WARN_ON(pll->refcount == 0)) 1431 1431 return; 1432 1432 1433 - DRM_DEBUG_KMS("enable PCH PLL %x (active %d, on? %d)for crtc %d\n", 1434 - pll->pll_reg, pll->active, pll->on, 1433 + DRM_DEBUG_KMS("enable %s (active %d, on? %d)for crtc %d\n", 1434 + pll->name, pll->active, pll->on, 1435 1435 crtc->base.base.id); 1436 1436 1437 1437 /* PCH refclock must be enabled first */ ··· 1444 1444 } 1445 1445 WARN_ON(pll->on); 1446 1446 1447 - DRM_DEBUG_KMS("enabling PCH PLL %x\n", pll->pll_reg); 1447 + DRM_DEBUG_KMS("enabling %s\n", pll->name); 1448 1448 1449 1449 reg = pll->pll_reg; 1450 1450 val = I915_READ(reg); ··· 1471 1471 if (WARN_ON(pll->refcount == 0)) 1472 1472 return; 1473 1473 1474 - DRM_DEBUG_KMS("disable PCH PLL %x (active %d, on? %d) for crtc %d\n", 1475 - pll->pll_reg, pll->active, pll->on, 1474 + DRM_DEBUG_KMS("disable %s (active %d, on? %d) for crtc %d\n", 1475 + pll->name, pll->active, pll->on, 1476 1476 crtc->base.base.id); 1477 1477 1478 1478 if (WARN_ON(pll->active == 0)) { ··· 1485 1485 if (--pll->active) 1486 1486 return; 1487 1487 1488 - DRM_DEBUG_KMS("disabling PCH PLL %x\n", pll->pll_reg); 1488 + DRM_DEBUG_KMS("disabling %s\n", pll->name); 1489 1489 1490 1490 /* Make sure transcoder isn't still depending on us */ 1491 1491 assert_pch_transcoder_disabled(dev_priv, crtc->pipe); ··· 3065 3065 return; 3066 3066 3067 3067 if (pll->refcount == 0) { 3068 - WARN(1, "bad PCH PLL refcount\n"); 3068 + WARN(1, "bad %s refcount\n", pll->name); 3069 3069 return; 3070 3070 } 3071 3071 ··· 3084 3084 enum intel_dpll_id i; 3085 3085 3086 3086 if (pll) { 3087 - DRM_DEBUG_KMS("CRTC:%d dropping existing PCH PLL %x\n", 3088 - crtc->base.base.id, pll->pll_reg); 3087 + DRM_DEBUG_KMS("CRTC:%d dropping existing %s\n", 3088 + crtc->base.base.id, pll->name); 3089 3089 intel_put_shared_dpll(crtc); 3090 3090 } 3091 3091 ··· 3094 3094 i = crtc->pipe; 3095 3095 pll = &dev_priv->shared_dplls[i]; 3096 3096 3097 - DRM_DEBUG_KMS("CRTC:%d using pre-allocated PCH PLL %x\n", 3098 - crtc->base.base.id, pll->pll_reg); 3097 + DRM_DEBUG_KMS("CRTC:%d using pre-allocated %s\n", 3098 + crtc->base.base.id, pll->name); 3099 3099 3100 3100 goto found; 3101 3101 } ··· 3109 3109 3110 3110 if (dpll == (I915_READ(pll->pll_reg) & 0x7fffffff) && 3111 3111 fp == I915_READ(pll->fp0_reg)) { 3112 - DRM_DEBUG_KMS("CRTC:%d sharing existing PCH PLL %x (refcount %d, ative %d)\n", 3112 + DRM_DEBUG_KMS("CRTC:%d sharing existing %s (refcount %d, ative %d)\n", 3113 3113 crtc->base.base.id, 3114 - pll->pll_reg, pll->refcount, pll->active); 3114 + pll->name, pll->refcount, pll->active); 3115 3115 3116 3116 goto found; 3117 3117 } ··· 3121 3121 for (i = 0; i < dev_priv->num_shared_dpll; i++) { 3122 3122 pll = &dev_priv->shared_dplls[i]; 3123 3123 if (pll->refcount == 0) { 3124 - DRM_DEBUG_KMS("CRTC:%d allocated PCH PLL %x\n", 3125 - crtc->base.base.id, pll->pll_reg); 3124 + DRM_DEBUG_KMS("CRTC:%d allocated %s\n", 3125 + crtc->base.base.id, pll->name); 3126 3126 goto found; 3127 3127 } 3128 3128 } ··· 3131 3131 3132 3132 found: 3133 3133 crtc->config.shared_dpll = i; 3134 - DRM_DEBUG_DRIVER("using pll %d for pipe %c\n", i, pipe_name(crtc->pipe)); 3134 + DRM_DEBUG_DRIVER("using %s for pipe %c\n", pll->name, 3135 + pipe_name(crtc->pipe)); 3135 3136 if (pll->active == 0) { 3136 - DRM_DEBUG_DRIVER("setting up pll %d\n", i); 3137 + DRM_DEBUG_DRIVER("setting up %s\n", pll->name); 3137 3138 WARN_ON(pll->on); 3138 3139 assert_shared_dpll_disabled(dev_priv, pll, NULL); 3139 3140 ··· 8729 8728 intel_ddi_pll_init(dev); 8730 8729 } 8731 8730 8731 + static char *ibx_pch_dpll_names[] = { 8732 + "PCH DPLL A", 8733 + "PCH DPLL B", 8734 + }; 8735 + 8732 8736 static void ibx_pch_dpll_init(struct drm_device *dev) 8733 8737 { 8734 8738 drm_i915_private_t *dev_priv = dev->dev_private; ··· 8742 8736 dev_priv->num_shared_dpll = 2; 8743 8737 8744 8738 for (i = 0; i < dev_priv->num_shared_dpll; i++) { 8739 + dev_priv->shared_dplls[i].id = i; 8740 + dev_priv->shared_dplls[i].name = ibx_pch_dpll_names[i]; 8745 8741 dev_priv->shared_dplls[i].pll_reg = _PCH_DPLL(i); 8746 8742 dev_priv->shared_dplls[i].fp0_reg = _PCH_FP0(i); 8747 8743 dev_priv->shared_dplls[i].fp1_reg = _PCH_FP1(i);