dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Reim <reimth@googlemail.com>
To: Dave Airlie <airlied@redhat.com>, Alex Deucher <alexdeucher@gmail.com>
Cc: Thomas Reim <rdratlos@yahoo.co.uk>, dri-devel@lists.freedesktop.org
Subject: [PATCH 1/2] drm: Improve detection of floating connectors
Date: Mon, 28 Nov 2011 17:20:09 +0100	[thread overview]
Message-ID: <1322497210-16331-2-git-send-email-reimth@gmail.com> (raw)
In-Reply-To: <1322497210-16331-1-git-send-email-reimth@gmail.com>

	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@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

  reply	other threads:[~2011-11-28 16:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-28 16:20 [PATCH 0/2] drm_radeon_kms: Some Regression Fixes for Extended DDC Probe Thomas Reim
2011-11-28 16:20 ` Thomas Reim [this message]
2011-11-28 16:20 ` [PATCH 2/2] drm/radeon/kms: wrap-up handling of floating connectors and connector unavailability status logging Thomas Reim
2011-11-29 14:50   ` Alex Deucher
2011-11-29 18:06     ` Thomas Reim
2011-11-29 20:53       ` Alex Deucher
2011-11-30 10:54         ` Thomas Reim
2011-12-01 14:10           ` Alex Deucher
2011-11-29 18:33   ` Thomas Reim
2011-11-28 16:34 ` [PATCH 0/2] drm_radeon_kms: Some Regression Fixes for Extended DDC Probe Thomas Reim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1322497210-16331-2-git-send-email-reimth@gmail.com \
    --to=reimth@googlemail.com \
    --cc=airlied@redhat.com \
    --cc=alexdeucher@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=rdratlos@yahoo.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox