b0217d0
From 64015d6d16d7ed5b6ffcec95dc13e8694bd2a4d6 Mon Sep 17 00:00:00 2001
b0217d0
From: Chris Wilson <chris@chris-wilson.co.uk>
b0217d0
Date: Mon, 20 Jun 2011 22:35:24 +0100
b0217d0
Subject: [PATCH] drm/i915/sdvo: Include LVDS panels for the IS_DIGITAL check
b0217d0
b0217d0
We were checking whether the supplied edid matched the connector it was
b0217d0
read from. We do this in case a DDC read returns an EDID for another
b0217d0
device on a multifunction or otherwise interesting card. However, we
b0217d0
failed to include LVDS as a digital device and so rejecting an otherwise
b0217d0
valid EDID.
b0217d0
b0217d0
Fixes the detection of the secondary SDVO LVDS panel on the Libretto
b0217d0
W105.
b0217d0
b0217d0
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
b0217d0
---
b0217d0
 drivers/gpu/drm/i915/intel_sdvo.c |   28 ++++++++++++++++++++--------
b0217d0
 1 files changed, 20 insertions(+), 8 deletions(-)
b0217d0
b0217d0
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
b0217d0
index f96975c..26eff9f 100644
b0217d0
--- a/drivers/gpu/drm/i915/intel_sdvo.c
b0217d0
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
b0217d0
@@ -49,6 +49,7 @@
b0217d0
 #define IS_TMDS(c)	(c->output_flag & SDVO_TMDS_MASK)
b0217d0
 #define IS_LVDS(c)	(c->output_flag & SDVO_LVDS_MASK)
b0217d0
 #define IS_TV_OR_LVDS(c) (c->output_flag & (SDVO_TV_MASK | SDVO_LVDS_MASK))
b0217d0
+#define IS_DIGITAL(c) (c->output_flag & (SDVO_TMDS_MASK | SDVO_LVDS_MASK))
b0217d0
 
b0217d0
 
b0217d0
 static const char *tv_format_names[] = {
b0217d0
@@ -1363,6 +1364,18 @@ intel_sdvo_hdmi_sink_detect(struct drm_connector *connector)
b0217d0
 	return status;
b0217d0
 }
b0217d0
 
b0217d0
+static bool
b0217d0
+intel_sdvo_connector_matches_edid(struct intel_sdvo_connector *sdvo,
b0217d0
+				  struct edid *edid)
b0217d0
+{
b0217d0
+	bool monitor_is_digital = !!(edid->input & DRM_EDID_INPUT_DIGITAL);
b0217d0
+	bool connector_is_digital = !!IS_DIGITAL(sdvo);
b0217d0
+
b0217d0
+	DRM_DEBUG_KMS("connector_is_digital? %d, monitor_is_digital? %d\n",
b0217d0
+		      connector_is_digital, monitor_is_digital);
b0217d0
+	return connector_is_digital == monitor_is_digital;
b0217d0
+}
b0217d0
+
b0217d0
 static enum drm_connector_status
b0217d0
 intel_sdvo_detect(struct drm_connector *connector, bool force)
b0217d0
 {
b0217d0
@@ -1407,10 +1420,12 @@ intel_sdvo_detect(struct drm_connector *connector, bool force)
b0217d0
 		if (edid == NULL)
b0217d0
 			edid = intel_sdvo_get_analog_edid(connector);
b0217d0
 		if (edid != NULL) {
b0217d0
-			if (edid->input & DRM_EDID_INPUT_DIGITAL)
b0217d0
-				ret = connector_status_disconnected;
b0217d0
-			else
b0217d0
+			if (intel_sdvo_connector_matches_edid(intel_sdvo_connector,
b0217d0
+							      edid))
b0217d0
 				ret = connector_status_connected;
b0217d0
+			else
b0217d0
+				ret = connector_status_disconnected;
b0217d0
+
b0217d0
 			connector->display_info.raw_edid = NULL;
b0217d0
 			kfree(edid);
b0217d0
 		} else
b0217d0
@@ -1451,11 +1466,8 @@ static void intel_sdvo_get_ddc_modes(struct drm_connector *connector)
b0217d0
 		edid = intel_sdvo_get_analog_edid(connector);
b0217d0
 
b0217d0
 	if (edid != NULL) {
b0217d0
-		struct intel_sdvo_connector *intel_sdvo_connector = to_intel_sdvo_connector(connector);
b0217d0
-		bool monitor_is_digital = !!(edid->input & DRM_EDID_INPUT_DIGITAL);
b0217d0
-		bool connector_is_digital = !!IS_TMDS(intel_sdvo_connector);
b0217d0
-
b0217d0
-		if (connector_is_digital == monitor_is_digital) {
b0217d0
+		if (intel_sdvo_connector_matches_edid(to_intel_sdvo_connector(connector),
b0217d0
+						      edid)) {
b0217d0
 			drm_mode_connector_update_edid_property(connector, edid);
b0217d0
 			drm_add_edid_modes(connector, edid);
b0217d0
 		}
b0217d0
-- 
b0217d0
1.7.5.4
b0217d0