[PATCH 1/2] drm: Improve detection of floating connectors

Thomas Reim reimth at googlemail.com
Mon Nov 28 08:20:09 PST 2011


	Some RS690 chipsets seem to end up with floating connectors, either
	a DVI connector isn't actually populated, or an add-in HDMI card
	is available but not installed. In this case we seem to get a NULL byte
	response for each byte of the i2c transaction.

	Function drm_edid_is_zero has been introduced to handle this. But this
	function detects only all-0 EDIDs. Testing showed that there are floating
	RS690 connectors that responds also few random value bytes via i2c transaction.
	So we detect also this case.

	I've tested this on my RS690 without the HDMI card installed and
	it seems to work fine.

Signed-off-by: Thomas Reim <reimth at gmail.com>
---
 drivers/gpu/drm/drm_edid.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 3e927ce..0e9be64 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -271,14 +271,25 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned char *buf,
 	return ret == 2 ? 0 : -1;
 }
 
+/*
+ * drm_edid_is_zero - zero value EDID records
+ * @edid: EDID data
+ *
+ * Check if an EDID record mainly consists of zero bytes
+ */
 static bool drm_edid_is_zero(u8 *in_edid, int length)
 {
+	int non_zero_counter = 0;
 	int i;
 	u32 *raw_edid = (u32 *)in_edid;
 
-	for (i = 0; i < length / 4; i++)
+	for (i = 0; i < length / 4; i++) {
 		if (*(raw_edid + i) != 0)
+			non_zero_counter++;
+		/* ignore random non-zero bytes */
+		if (non_zero_counter > 8)
 			return false;
+	}
 	return true;
 }
 
-- 
1.7.1



More information about the dri-devel mailing list