drm/i915: Fix CRT force detect on Cougarpoint
authorZhenyu Wang <zhenyuw@linux.intel.com>
Wed, 7 Apr 2010 08:15:55 +0000 (16:15 +0800)
committerEric Anholt <eric@anholt.net>
Mon, 12 Apr 2010 16:23:41 +0000 (09:23 -0700)
To make CRT force detect reliable on Cougarpoint, we need to
disable DAC before force detect, and restore back when trigger
is completed.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
drivers/gpu/drm/i915/intel_crt.c

index 1f732ba568f6a7755c871d75b96f8e28f4e7a6e7..996d063c40caa77e9e6c5518ca36ff2ea35e3d74 100644 (file)
@@ -157,15 +157,21 @@ static bool intel_ironlake_crt_detect_hotplug(struct drm_connector *connector)
 {
        struct drm_device *dev = connector->dev;
        struct drm_i915_private *dev_priv = dev->dev_private;
-       u32 adpa;
+       u32 adpa, temp;
        bool ret;
 
-       adpa = I915_READ(PCH_ADPA);
+       temp = adpa = I915_READ(PCH_ADPA);
 
-       adpa &= ~ADPA_CRT_HOTPLUG_MASK;
-       /* disable HPD first */
-       I915_WRITE(PCH_ADPA, adpa);
-       (void)I915_READ(PCH_ADPA);
+       if (HAS_PCH_CPT(dev)) {
+               /* Disable DAC before force detect */
+               I915_WRITE(PCH_ADPA, adpa & ~ADPA_DAC_ENABLE);
+               (void)I915_READ(PCH_ADPA);
+       } else {
+               adpa &= ~ADPA_CRT_HOTPLUG_MASK;
+               /* disable HPD first */
+               I915_WRITE(PCH_ADPA, adpa);
+               (void)I915_READ(PCH_ADPA);
+       }
 
        adpa |= (ADPA_CRT_HOTPLUG_PERIOD_128 |
                        ADPA_CRT_HOTPLUG_WARMUP_10MS |
@@ -181,6 +187,11 @@ static bool intel_ironlake_crt_detect_hotplug(struct drm_connector *connector)
        while ((I915_READ(PCH_ADPA) & ADPA_CRT_HOTPLUG_FORCE_TRIGGER) != 0)
                ;
 
+       if (HAS_PCH_CPT(dev)) {
+               I915_WRITE(PCH_ADPA, temp);
+               (void)I915_READ(PCH_ADPA);
+       }
+
        /* Check the status to see if both blue and green are on now */
        adpa = I915_READ(PCH_ADPA);
        adpa &= ADPA_CRT_HOTPLUG_MONITOR_MASK;