drm/i915: Support IGD EOS
authorShaohua Li <shaohua.li@intel.com>
Mon, 24 Aug 2009 02:25:23 +0000 (10:25 +0800)
committerEric Anholt <eric@anholt.net>
Fri, 4 Sep 2009 20:05:30 +0000 (13:05 -0700)
In the event that any one of the DAC analog outputs (R,G,B) were driven
at full-scale (white video) or some analog level close to full-scale
voltage, and if the video cable were then disconnected, the analog video
voltage level would exceed the maximum electrical overstress limit of the
native (thin-oxide) transistors thus causing a long-term reliability concern.
The electrical overstress condition occurs in this particular case.

This patch address the IGD EOS (electrical overstress condition) issue.
When the EOS interrupt occurs, OS should disable DAC and then disable EOS,
then the normal hotplug operation follows.

TODO: it appears the normal unplug interrupt is missed as reported by Li Peng,
need more checks here.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
drivers/gpu/drm/i915/i915_irq.c
drivers/gpu/drm/i915/i915_reg.h
drivers/gpu/drm/i915/intel_crt.c

index 7ebc84c..6c89f2f 100644 (file)
@@ -565,6 +565,27 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS)
 
                        I915_WRITE(PORT_HOTPLUG_STAT, hotplug_status);
                        I915_READ(PORT_HOTPLUG_STAT);
+
+                       /* EOS interrupts occurs */
+                       if (IS_IGD(dev) &&
+                               (hotplug_status & CRT_EOS_INT_STATUS)) {
+                               u32 temp;
+
+                               DRM_DEBUG("EOS interrupt occurs\n");
+                               /* status is already cleared */
+                               temp = I915_READ(ADPA);
+                               temp &= ~ADPA_DAC_ENABLE;
+                               I915_WRITE(ADPA, temp);
+
+                               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);
+                       }
                }
 
                I915_WRITE(IIR, iir);
index 2955083..87a737f 100644 (file)
 #define   SDVOB_HOTPLUG_INT_EN                 (1 << 26)
 #define   SDVOC_HOTPLUG_INT_EN                 (1 << 25)
 #define   TV_HOTPLUG_INT_EN                    (1 << 18)
+#define   CRT_EOS_INT_EN                       (1 << 10)
 #define   CRT_HOTPLUG_INT_EN                   (1 << 9)
 #define   CRT_HOTPLUG_FORCE_DETECT             (1 << 3)
 #define CRT_HOTPLUG_ACTIVATION_PERIOD_32       (0 << 8)
 #define   DPC_HOTPLUG_INT_STATUS               (1 << 28)
 #define   HDMID_HOTPLUG_INT_STATUS             (1 << 27)
 #define   DPD_HOTPLUG_INT_STATUS               (1 << 27)
+#define   CRT_EOS_INT_STATUS                   (1 << 12)
 #define   CRT_HOTPLUG_INT_STATUS               (1 << 11)
 #define   TV_HOTPLUG_INT_STATUS                        (1 << 10)
 #define   CRT_HOTPLUG_MONITOR_MASK             (3 << 8)
index 590f81c..88814fa 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,