drm/i915/sdvo: Include LVDS panels for the IS_DIGITAL check
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 20 Jun 2011 13:45:50 +0000 (14:45 +0100)
committerKeith Packard <keithp@keithp.com>
Fri, 16 Dec 2011 16:49:56 +0000 (08:49 -0800)
We were checking whether the supplied edid matched the connector it was
read from. We do this in case a DDC read returns an EDID for another
device on a multifunction or otherwise interesting card. However, we
failed to include LVDS as a digital device and so rejecting an otherwise
valid EDID.

Fixes the detection of the secondary SDVO LVDS panel on the Libretto
W105.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=39216
Signed-off-by: Keith Packard <keithp@keithp.com>
drivers/gpu/drm/i915/intel_sdvo.c

index e308d67..f7b9268 100644 (file)
@@ -50,6 +50,7 @@
 #define IS_TMDS(c)     (c->output_flag & SDVO_TMDS_MASK)
 #define IS_LVDS(c)     (c->output_flag & SDVO_LVDS_MASK)
 #define IS_TV_OR_LVDS(c) (c->output_flag & (SDVO_TV_MASK | SDVO_LVDS_MASK))
+#define IS_DIGITAL(c) (c->output_flag & (SDVO_TMDS_MASK | SDVO_LVDS_MASK))
 
 
 static const char *tv_format_names[] = {
@@ -1318,6 +1319,18 @@ intel_sdvo_tmds_sink_detect(struct drm_connector *connector)
        return status;
 }
 
+static bool
+intel_sdvo_connector_matches_edid(struct intel_sdvo_connector *sdvo,
+                                 struct edid *edid)
+{
+       bool monitor_is_digital = !!(edid->input & DRM_EDID_INPUT_DIGITAL);
+       bool connector_is_digital = !!IS_DIGITAL(sdvo);
+
+       DRM_DEBUG_KMS("connector_is_digital? %d, monitor_is_digital? %d\n",
+                     connector_is_digital, monitor_is_digital);
+       return connector_is_digital == monitor_is_digital;
+}
+
 static enum drm_connector_status
 intel_sdvo_detect(struct drm_connector *connector, bool force)
 {
@@ -1362,10 +1375,12 @@ intel_sdvo_detect(struct drm_connector *connector, bool force)
                if (edid == NULL)
                        edid = intel_sdvo_get_analog_edid(connector);
                if (edid != NULL) {
-                       if (edid->input & DRM_EDID_INPUT_DIGITAL)
-                               ret = connector_status_disconnected;
-                       else
+                       if (intel_sdvo_connector_matches_edid(intel_sdvo_connector,
+                                                             edid))
                                ret = connector_status_connected;
+                       else
+                               ret = connector_status_disconnected;
+
                        connector->display_info.raw_edid = NULL;
                        kfree(edid);
                } else
@@ -1406,11 +1421,8 @@ static void intel_sdvo_get_ddc_modes(struct drm_connector *connector)
                edid = intel_sdvo_get_analog_edid(connector);
 
        if (edid != NULL) {
-               struct intel_sdvo_connector *intel_sdvo_connector = to_intel_sdvo_connector(connector);
-               bool monitor_is_digital = !!(edid->input & DRM_EDID_INPUT_DIGITAL);
-               bool connector_is_digital = !!IS_TMDS(intel_sdvo_connector);
-
-               if (connector_is_digital == monitor_is_digital) {
+               if (intel_sdvo_connector_matches_edid(to_intel_sdvo_connector(connector),
+                                                     edid)) {
                        drm_mode_connector_update_edid_property(connector, edid);
                        drm_add_edid_modes(connector, edid);
                }