aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-05-20 13:10:50 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-05-24 11:54:00 -0400
commit92b27b088c51bd9a979e39e184c41b1f57352dca (patch)
treeda354a6cf9d4dd54f4149bb0d786533425c03507 /drivers/gpu
parent7b9e0ae6da0a7eaf2680a1a788f08df123724f3b (diff)
drm/i915: Fix PCH PLL assertions to not assume CRTC:PLL relationship
The existing assertions were written under the assumption that we wanted to test the related PLL to a CRTC. With the split of PLL into a separately managed entity which may be shared amongst CRTCs, we need to pass in both the CRTC and the PLL to the assertion routine. Occassionally, this means passing NULL for the CRTC as we wish to check the status of the PLL irrespective of the current CRTC. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/i915/intel_display.c56
1 files changed, 33 insertions, 23 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 3c71850ddf20..67ed819220a4 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -910,9 +910,10 @@ static void assert_pll(struct drm_i915_private *dev_priv,
910 910
911/* For ILK+ */ 911/* For ILK+ */
912static void assert_pch_pll(struct drm_i915_private *dev_priv, 912static void assert_pch_pll(struct drm_i915_private *dev_priv,
913 struct intel_crtc *intel_crtc, bool state) 913 struct intel_pch_pll *pll,
914 struct intel_crtc *crtc,
915 bool state)
914{ 916{
915 int reg;
916 u32 val; 917 u32 val;
917 bool cur_state; 918 bool cur_state;
918 919
@@ -921,30 +922,37 @@ static void assert_pch_pll(struct drm_i915_private *dev_priv,
921 return; 922 return;
922 } 923 }
923 924
924 if (!intel_crtc->pch_pll) { 925 if (WARN (!pll,
925 WARN(1, "asserting PCH PLL enabled with no PLL\n"); 926 "asserting PCH PLL %s with no PLL\n", state_string(state)))
926 return; 927 return;
927 }
928 928
929 if (HAS_PCH_CPT(dev_priv->dev)) { 929 val = I915_READ(pll->pll_reg);
930 cur_state = !!(val & DPLL_VCO_ENABLE);
931 WARN(cur_state != state,
932 "PCH PLL state for reg %x assertion failure (expected %s, current %s), val=%08x\n",
933 pll->pll_reg, state_string(state), state_string(cur_state), val);
934
935 /* Make sure the selected PLL is correctly attached to the transcoder */
936 if (crtc && HAS_PCH_CPT(dev_priv->dev)) {
930 u32 pch_dpll; 937 u32 pch_dpll;
931 938
932 pch_dpll = I915_READ(PCH_DPLL_SEL); 939 pch_dpll = I915_READ(PCH_DPLL_SEL);
933 940 cur_state = pll->pll_reg == _PCH_DPLL_B;
934 /* Make sure the selected PLL is enabled to the transcoder */ 941 if (!WARN(((pch_dpll >> (4 * crtc->pipe)) & 1) != cur_state,
935 WARN(!((pch_dpll >> (4 * intel_crtc->pipe)) & 8), 942 "PLL[%d] not attached to this transcoder %d: %08x\n",
936 "transcoder %d PLL not enabled\n", intel_crtc->pipe); 943 cur_state, crtc->pipe, pch_dpll)) {
944 cur_state = !!(val >> (4*crtc->pipe + 3));
945 WARN(cur_state != state,
946 "PLL[%d] not %s on this transcoder %d: %08x\n",
947 pll->pll_reg == _PCH_DPLL_B,
948 state_string(state),
949 crtc->pipe,
950 val);
951 }
937 } 952 }
938
939 reg = intel_crtc->pch_pll->pll_reg;
940 val = I915_READ(reg);
941 cur_state = !!(val & DPLL_VCO_ENABLE);
942 WARN(cur_state != state,
943 "PCH PLL state assertion failure (expected %s, current %s)\n",
944 state_string(state), state_string(cur_state));
945} 953}
946#define assert_pch_pll_enabled(d, p) assert_pch_pll(d, p, true) 954#define assert_pch_pll_enabled(d, p, c) assert_pch_pll(d, p, c, true)
947#define assert_pch_pll_disabled(d, p) assert_pch_pll(d, p, false) 955#define assert_pch_pll_disabled(d, p, c) assert_pch_pll(d, p, c, false)
948 956
949static void assert_fdi_tx(struct drm_i915_private *dev_priv, 957static void assert_fdi_tx(struct drm_i915_private *dev_priv,
950 enum pipe pipe, bool state) 958 enum pipe pipe, bool state)
@@ -1424,7 +1432,7 @@ static void intel_enable_pch_pll(struct intel_crtc *intel_crtc)
1424 assert_pch_refclk_enabled(dev_priv); 1432 assert_pch_refclk_enabled(dev_priv);
1425 1433
1426 if (pll->active++ && pll->on) { 1434 if (pll->active++ && pll->on) {
1427 assert_pch_pll_enabled(dev_priv, intel_crtc); 1435 assert_pch_pll_enabled(dev_priv, pll, NULL);
1428 return; 1436 return;
1429 } 1437 }
1430 1438
@@ -1460,12 +1468,12 @@ static void intel_disable_pch_pll(struct intel_crtc *intel_crtc)
1460 intel_crtc->base.base.id); 1468 intel_crtc->base.base.id);
1461 1469
1462 if (WARN_ON(pll->active == 0)) { 1470 if (WARN_ON(pll->active == 0)) {
1463 assert_pch_pll_disabled(dev_priv, intel_crtc); 1471 assert_pch_pll_disabled(dev_priv, pll, NULL);
1464 return; 1472 return;
1465 } 1473 }
1466 1474
1467 if (--pll->active) { 1475 if (--pll->active) {
1468 assert_pch_pll_enabled(dev_priv, intel_crtc); 1476 assert_pch_pll_enabled(dev_priv, pll, NULL);
1469 return; 1477 return;
1470 } 1478 }
1471 1479
@@ -1495,7 +1503,9 @@ static void intel_enable_transcoder(struct drm_i915_private *dev_priv,
1495 BUG_ON(dev_priv->info->gen < 5); 1503 BUG_ON(dev_priv->info->gen < 5);
1496 1504
1497 /* Make sure PCH DPLL is enabled */ 1505 /* Make sure PCH DPLL is enabled */
1498 assert_pch_pll_enabled(dev_priv, to_intel_crtc(crtc)); 1506 assert_pch_pll_enabled(dev_priv,
1507 to_intel_crtc(crtc)->pch_pll,
1508 to_intel_crtc(crtc));
1499 1509
1500 /* FDI must be feeding us bits for PCH ports */ 1510 /* FDI must be feeding us bits for PCH ports */
1501 assert_fdi_tx_enabled(dev_priv, pipe); 1511 assert_fdi_tx_enabled(dev_priv, pipe);