]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm/i915/hdmi: Read the HPD status before trying to read the EDID
authorDamien Lespiau <damien.lespiau@intel.com>
Thu, 13 Dec 2012 16:09:00 +0000 (16:09 +0000)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 14 Dec 2012 10:12:58 +0000 (11:12 +0100)
If you unplug the hdmi connector slowly enough, the hotplug interrupt
fires but then the kernel code tries to read the EDID and succeeds
(because the connector is still half connected, the HPD pin is shorter
than the others, and DDC works). Since EDID succeeds it thinks the
monitor is still connected.

To prevent that, read the live HPD status in the hotplug handler before
trying to read the EDID.

v2: Rename the function to ibx_ (Chris Wilson)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=55372
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_drv.h
drivers/gpu/drm/i915/intel_hdmi.c

index 2a01b09221fbd05317236402e0da0ea5c867b32b..6adeabda258724a5fd842718e7f03938fa769f48 100644 (file)
@@ -985,6 +985,39 @@ void intel_wait_for_pipe_off(struct drm_device *dev, int pipe)
        }
 }
 
+/*
+ * ibx_digital_port_connected - is the specified port connected?
+ * @dev_priv: i915 private structure
+ * @port: the port to test
+ *
+ * Returns true if @port is connected, false otherwise.
+ */
+bool ibx_digital_port_connected(struct drm_i915_private *dev_priv,
+                               struct intel_digital_port *port)
+{
+       u32 bit;
+
+       /* XXX: IBX has different SDEISR bits */
+       if (HAS_PCH_IBX(dev_priv->dev))
+               return true;
+
+       switch(port->port) {
+       case PORT_B:
+               bit = SDE_PORTB_HOTPLUG_CPT;
+               break;
+       case PORT_C:
+               bit = SDE_PORTC_HOTPLUG_CPT;
+               break;
+       case PORT_D:
+               bit = SDE_PORTD_HOTPLUG_CPT;
+               break;
+       default:
+               return true;
+       }
+
+       return I915_READ(SDEISR) & bit;
+}
+
 static const char *state_string(bool enabled)
 {
        return enabled ? "on" : "off";
index 22728f2c1d83b407e04da62369c09e215207e584..53d4c8fec2a0b7eb467ab1b129c4709b1c6d7b87 100644 (file)
@@ -545,6 +545,9 @@ hdmi_to_dig_port(struct intel_hdmi *intel_hdmi)
        return container_of(intel_hdmi, struct intel_digital_port, hdmi);
 }
 
+bool ibx_digital_port_connected(struct drm_i915_private *dev_priv,
+                               struct intel_digital_port *port);
+
 extern void intel_connector_attach_encoder(struct intel_connector *connector,
                                           struct intel_encoder *encoder);
 extern struct drm_encoder *intel_best_encoder(struct drm_connector *connector);
index 53df0a88a6a8ad281208c79b7c5f17e8902c44af..9f834d324cfdbfa5713b9c447484155c9a0028fe 100644 (file)
@@ -793,16 +793,21 @@ static bool g4x_hdmi_connected(struct intel_hdmi *intel_hdmi)
 static enum drm_connector_status
 intel_hdmi_detect(struct drm_connector *connector, bool force)
 {
+       struct drm_device *dev = connector->dev;
        struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
        struct intel_digital_port *intel_dig_port =
                hdmi_to_dig_port(intel_hdmi);
        struct intel_encoder *intel_encoder = &intel_dig_port->base;
-       struct drm_i915_private *dev_priv = connector->dev->dev_private;
+       struct drm_i915_private *dev_priv = dev->dev_private;
        struct edid *edid;
        enum drm_connector_status status = connector_status_disconnected;
 
-       if (IS_G4X(connector->dev) && !g4x_hdmi_connected(intel_hdmi))
+
+       if (IS_G4X(dev) && !g4x_hdmi_connected(intel_hdmi))
                return status;
+       else if (HAS_PCH_SPLIT(dev) &&
+                !ibx_digital_port_connected(dev_priv, intel_dig_port))
+                return status;
 
        intel_hdmi->has_hdmi_sink = false;
        intel_hdmi->has_audio = false;