drm/i915: Return disconnected for SDVO DVI when there's no digital EDID.
authorling.ma@intel.com <ling.ma@intel.com>
Wed, 29 Jul 2009 03:31:18 +0000 (11:31 +0800)
committerEric Anholt <eric@anholt.net>
Thu, 30 Jul 2009 17:05:12 +0000 (10:05 -0700)
The patch fixed a bug on MP965-D.  When VGA is connected to a DVI-I connector,
it incorrectly shows sdvo dvi as connected.

Signed-off-by: Ma Ling <ling.ma@intel.com>
[anholt: hand-resolved against previous commit and fixed up commit message]
Signed-off-by: Eric Anholt <eric@anholt.net>
drivers/gpu/drm/i915/intel_sdvo.c

index b68746f0380ed52cb71be26d55b6cd16a88f5479..5371d9332554fe9716bb5bd8403bb177b4829fd3 100644 (file)
@@ -31,6 +31,7 @@
 #include "drm.h"
 #include "drm_crtc.h"
 #include "intel_drv.h"
+#include "drm_edid.h"
 #include "i915_drm.h"
 #include "i915_drv.h"
 #include "intel_sdvo_regs.h"
@@ -1477,20 +1478,35 @@ intel_sdvo_multifunc_encoder(struct intel_output *intel_output)
        return (caps > 1);
 }
 
-static void
-intel_sdvo_hdmi_sink_detect(struct drm_connector *connector)
+enum drm_connector_status
+intel_sdvo_hdmi_sink_detect(struct drm_connector *connector, u16 response)
 {
        struct intel_output *intel_output = to_intel_output(connector);
        struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv;
+       enum drm_connector_status status = connector_status_connected;
        struct edid *edid = NULL;
 
        edid = drm_get_edid(&intel_output->base,
                            intel_output->ddc_bus);
        if (edid != NULL) {
-               sdvo_priv->is_hdmi = drm_detect_hdmi_monitor(edid);
+               /* Don't report the output as connected if it's a DVI-I
+                * connector with a non-digital EDID coming out.
+                */
+               if (response & (SDVO_OUTPUT_TMDS0 | SDVO_OUTPUT_TMDS1)) {
+                       if (edid->input & DRM_EDID_INPUT_DIGITAL)
+                               sdvo_priv->is_hdmi =
+                                       drm_detect_hdmi_monitor(edid);
+                       else
+                               status = connector_status_disconnected;
+               }
+
                kfree(edid);
                intel_output->base.display_info.raw_edid = NULL;
-       }
+
+       } else if (response & (SDVO_OUTPUT_TMDS0 | SDVO_OUTPUT_TMDS1))
+               status = connector_status_disconnected;
+
+       return status;
 }
 
 static enum drm_connector_status intel_sdvo_detect(struct drm_connector *connector)
@@ -1518,8 +1534,7 @@ static enum drm_connector_status intel_sdvo_detect(struct drm_connector *connect
                        return connector_status_unknown;
                sdvo_priv->attached_output = response;
        }
-       intel_sdvo_hdmi_sink_detect(connector);
-       return connector_status_connected;
+       return intel_sdvo_hdmi_sink_detect(connector, response);
 }
 
 static void intel_sdvo_get_ddc_modes(struct drm_connector *connector)