Merge branch 'writeback' of git://git.kernel.dk/linux-2.6-block
[pandora-kernel.git] / drivers / gpu / drm / i915 / intel_crt.c
index 590f81c..212e227 100644 (file)
@@ -64,6 +64,34 @@ static void intel_crt_dpms(struct drm_encoder *encoder, int mode)
        }
 
        I915_WRITE(reg, temp);
+
+       if (IS_IGD(dev)) {
+               if (mode == DRM_MODE_DPMS_OFF) {
+                       /* turn off DAC */
+                       temp = I915_READ(PORT_HOTPLUG_EN);
+                       temp &= ~CRT_EOS_INT_EN;
+                       I915_WRITE(PORT_HOTPLUG_EN, temp);
+
+                       temp = I915_READ(PORT_HOTPLUG_STAT);
+                       if (temp & CRT_EOS_INT_STATUS)
+                               I915_WRITE(PORT_HOTPLUG_STAT,
+                                       CRT_EOS_INT_STATUS);
+               } else {
+                       /* turn on DAC. EOS interrupt must be enabled after DAC
+                        * is enabled, so it sounds not good to enable it in
+                        * i915_driver_irq_postinstall()
+                        * wait 12.5ms after DAC is enabled
+                        */
+                       msleep(13);
+                       temp = I915_READ(PORT_HOTPLUG_STAT);
+                       if (temp & CRT_EOS_INT_STATUS)
+                               I915_WRITE(PORT_HOTPLUG_STAT,
+                                       CRT_EOS_INT_STATUS);
+                       temp = I915_READ(PORT_HOTPLUG_EN);
+                       temp |= CRT_EOS_INT_EN;
+                       I915_WRITE(PORT_HOTPLUG_EN, temp);
+               }
+       }
 }
 
 static int intel_crt_mode_valid(struct drm_connector *connector,
@@ -151,13 +179,10 @@ static bool intel_igdng_crt_detect_hotplug(struct drm_connector *connector)
 {
        struct drm_device *dev = connector->dev;
        struct drm_i915_private *dev_priv = dev->dev_private;
-       u32 adpa, temp;
+       u32 adpa;
        bool ret;
 
-       temp = adpa = I915_READ(PCH_ADPA);
-
-       adpa &= ~ADPA_DAC_ENABLE;
-       I915_WRITE(PCH_ADPA, adpa);
+       adpa = I915_READ(PCH_ADPA);
 
        adpa &= ~ADPA_CRT_HOTPLUG_MASK;
 
@@ -184,8 +209,6 @@ static bool intel_igdng_crt_detect_hotplug(struct drm_connector *connector)
        else
                ret = false;
 
-       /* restore origin register */
-       I915_WRITE(PCH_ADPA, temp);
        return ret;
 }