drm/i915: add panel lock assertion function
authorJesse Barnes <jbarnes@virtuousgeek.org>
Tue, 4 Jan 2011 23:09:32 +0000 (15:09 -0800)
committerChris Wilson <chris@chris-wilson.co.uk>
Wed, 19 Jan 2011 12:36:11 +0000 (12:36 +0000)
When PLLs or timing regs are changed, we need to make sure the panel
lock will allow it.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
drivers/gpu/drm/i915/intel_display.c

index 2bf72a4b069f9010d35c14a90f017b823c476738..491ac56199d11c793484dd241d603ca74901413a 100644 (file)
@@ -1081,6 +1081,35 @@ static void assert_pll(struct drm_i915_private *dev_priv,
 #define assert_pll_enabled(d, p) assert_pll(d, p, true)
 #define assert_pll_disabled(d, p) assert_pll(d, p, false)
 
+static void assert_panel_unlocked(struct drm_i915_private *dev_priv,
+                                 enum pipe pipe)
+{
+       int pp_reg, lvds_reg;
+       u32 val;
+       enum pipe panel_pipe = PIPE_A;
+       bool locked = locked;
+
+       if (HAS_PCH_SPLIT(dev_priv->dev)) {
+               pp_reg = PCH_PP_CONTROL;
+               lvds_reg = PCH_LVDS;
+       } else {
+               pp_reg = PP_CONTROL;
+               lvds_reg = LVDS;
+       }
+
+       val = I915_READ(pp_reg);
+       if (!(val & PANEL_POWER_ON) ||
+           ((val & PANEL_UNLOCK_REGS) == PANEL_UNLOCK_REGS))
+               locked = false;
+
+       if (I915_READ(lvds_reg) & LVDS_PIPEB_SELECT)
+               panel_pipe = PIPE_B;
+
+       WARN(panel_pipe == pipe && locked,
+            "panel assertion failure, pipe %c regs locked\n",
+            pipe ? 'B' : 'A');
+}
+
 static void assert_pipe_enabled(struct drm_i915_private *dev_priv,
                                enum pipe pipe)
 {