From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Reim Subject: [PATCH 1/2] drm: Improve detection of floating connectors Date: Mon, 28 Nov 2011 17:20:09 +0100 Message-ID: <1322497210-16331-2-git-send-email-reimth@gmail.com> References: <1322497210-16331-1-git-send-email-reimth@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-bw0-f49.google.com (mail-bw0-f49.google.com [209.85.214.49]) by gabe.freedesktop.org (Postfix) with ESMTP id 84B18A0945 for ; Mon, 28 Nov 2011 08:21:32 -0800 (PST) Received: by bkat2 with SMTP id t2so9964082bka.36 for ; Mon, 28 Nov 2011 08:21:31 -0800 (PST) In-Reply-To: <1322497210-16331-1-git-send-email-reimth@gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: Dave Airlie , Alex Deucher Cc: Thomas Reim , dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org 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 --- 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