From patchwork Wed Jun 22 01:20:39 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Reim X-Patchwork-Id: 903462 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p5M1LUpN009007 for ; Wed, 22 Jun 2011 01:21:50 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E91549E7C6 for ; Tue, 21 Jun 2011 18:21:28 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-fx0-f49.google.com (mail-fx0-f49.google.com [209.85.161.49]) by gabe.freedesktop.org (Postfix) with ESMTP id C3BF69E73F for ; Tue, 21 Jun 2011 18:21:17 -0700 (PDT) Received: by fxm14 with SMTP id 14so433582fxm.36 for ; Tue, 21 Jun 2011 18:21:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=vGZV67SOFWt/GSv9t2JVzrMOIVDal2w8cDl8afrL9+w=; b=XXb7SN0rHxC+F8fVKDypGp9mid/3ArnkngGAD/hBJVwMgTNn+KUhWQx3M1tzu1oemh 5+Pvmgs70Wt/hv1mJbEGg+MLUV6CzSBbccIZ+SXdETFgn09LANAzo8UFKJXYCpWk5f0q aKeCCaMzSgS09gNG8yCzyHgX6ycdch0DM4i9c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=uw9I7rUrWq0j0AK7xT0TaMjap5yktl1PS1bCQr+SIjx3UcghBjYqDo2vFeLYXHLi48 A+WeBnvA8pjSa4Kj2Y5HniKIPVobPNW7+Vh9UWN5P1HHI0GBtlYBQ/Hwik8sf0gkPstE ctz0kfbUxAJZvyDQp3aTPyorvdvDBtpPmB4qY= Received: by 10.223.76.219 with SMTP id d27mr89544fak.87.1308705676747; Tue, 21 Jun 2011 18:21:16 -0700 (PDT) Received: from localhost.localdomain (p5B2FFB0F.dip.t-dialin.net [91.47.251.15]) by mx.google.com with ESMTPS id q14sm28497faa.3.2011.06.21.18.21.15 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 21 Jun 2011 18:21:16 -0700 (PDT) From: reimth@googlemail.com To: Dave Airlie , Alex Deucher , Mario Kleiner , Jean Delvare , Tyson Whitehead , Jason Wessel Subject: [PATCH 1/1] drm/radeon: Fix Asus M2A-VM HDMI EDID error flooding problem Date: Wed, 22 Jun 2011 03:20:39 +0200 Message-Id: <1308705639-4215-1-git-send-email-reimth@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1308670305-7096-1-git-send-email-rdratlos@yahoo.co.uk> References: <1308670305-7096-1-git-send-email-rdratlos@yahoo.co.uk> Cc: Thomas Reim , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Wed, 22 Jun 2011 01:21:50 +0000 (UTC) From: Thomas Reim Some integrated ATI Radeon chipset implementations (e. g. Asus M2A-VM HDMI) indicate the availability of a DDC even when there's no monitor connected. In this case, drm_get_edid() and drm_edid_block_valid() periodically dump data and kernel errors into system log files and onto terminals, which lead to an unacceptable system behaviour. Tested since kernel 2.35 on Asus M2A-VM HDMI board Signed-off-by: Thomas Reim --- drivers/gpu/drm/radeon/radeon_connectors.c | 21 +++++++++-- drivers/gpu/drm/radeon/radeon_display.c | 11 ++++++ drivers/gpu/drm/radeon/radeon_i2c.c | 55 ++++++++++++++++++++++++++++ drivers/gpu/drm/radeon/radeon_mode.h | 1 + 4 files changed, 85 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index cbfca3a..497e32a 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c @@ -825,9 +825,24 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) int i; enum drm_connector_status ret = connector_status_disconnected; bool dret = false; - - if (radeon_connector->ddc_bus) - dret = radeon_ddc_probe(radeon_connector); + + if (radeon_connector->ddc_bus) { + /* AMD 690 chipset series HDMI DDC quirk: + * Some integrated ATI Radeon chipset implementations (e. g. + * Asus M2A-VM HDMI) indicate the availability of a DDC even + * when there's no monitor connected to HDMI. For HDMI + * connectors we check for the availability of EDID with + * at least a correct EDID header and EDID version/revision + * information. Only then, DDC is assumed to be available. + * This prevents drm_get_edid() and drm_edid_block_valid() of + * periodically dumping data and kernel errors into the logs + * and onto the terminal, which would lead to an unacceptable + * system behaviour */ + if (connector->connector_type == DRM_MODE_CONNECTOR_HDMIA) + dret = radeon_ddc_edid_probe(radeon_connector); + else + dret = radeon_ddc_probe(radeon_connector); + } if (dret) { if (radeon_connector->edid) { kfree(radeon_connector->edid); diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 292f73f..550f143 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c @@ -715,6 +715,9 @@ static bool radeon_setup_enc_conn(struct drm_device *dev) if (ret) { radeon_setup_encoder_clones(dev); radeon_print_display_setup(dev); + /* Is this really required here? + Seems to just force drm to dump EDID errors + to kernel logs */ list_for_each_entry(drm_connector, &dev->mode_config.connector_list, head) radeon_ddc_dump(drm_connector); } @@ -777,8 +780,16 @@ static int radeon_ddc_dump(struct drm_connector *connector) if (!radeon_connector->ddc_bus) return -1; edid = drm_get_edid(connector, &radeon_connector->ddc_bus->adapter); + /* Asus M2A-VM HDMI DDC quirk: Log EDID retrieval status here once, + * instead of periodically dumping data and kernel errors into the + * logs, if a monitor is not connected to HDMI */ if (edid) { + DRM_INFO("Radeon display connector %s: Found valid EDID", + drm_get_connector_name(connector)); kfree(edid); + } else { + DRM_INFO("Radeon display connector %s: No display connected or invalid EDID", + drm_get_connector_name(connector)); } return ret; } diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c b/drivers/gpu/drm/radeon/radeon_i2c.c index 781196d..80b871f 100644 --- a/drivers/gpu/drm/radeon/radeon_i2c.c +++ b/drivers/gpu/drm/radeon/radeon_i2c.c @@ -63,6 +63,61 @@ bool radeon_ddc_probe(struct radeon_connector *radeon_connector) return false; } +/* + * Probe EDID information via I2C: + * Try to fetch EDID information by calling i2c_transfer driver function and + * probe for valid EDID header and version information. + * + * AMD 690 chipset series HDMI DDC quirk: + * Some integrated ATI Radeon chipset implementations (e. g. Asus M2A-VM HDMI + * indicate the availability of a DDC even when there's no monitor connected. + * Invalid EDID leads to flooding of logs and terminals with error messages + */ +bool radeon_ddc_edid_probe(struct radeon_connector *radeon_connector) +{ + u8 out_buf[] = {0x0, 0x0}; + u8 block[20]; + int ret; + struct i2c_msg msgs[] = { + { + .addr = 0x50, + .flags = 0, + .len = 1, + .buf = out_buf, + }, { + .addr = 0x50, + .flags = I2C_M_RD, + .len = 20, + .buf = block, + } + }; + + /* on hw with routers, select right port */ + if (radeon_connector->router.ddc_valid) + radeon_router_select_ddc_port(radeon_connector); + + ret = i2c_transfer(&radeon_connector->ddc_bus->adapter, msgs, 2); + if (ret == 2) + if (block[0] == 0x00 && + block[7] == 0x00 && + block[1] == 0xff && + block[2] == 0xff && + block[3] == 0xff && + block[4] == 0xff && + block[5] == 0xff && + block[6] == 0xff) + /* EDID header starts with: + * 0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00 + */ + if (block[18] != 0x00 || block[19] != 0x00) + /* EDID header ends with EDID version and + * revision number <> 0.0 + */ + return true; + /* Couldn't find an accessible EDID on this connector */ + return false; +} + /* bit banging i2c */ static void radeon_i2c_do_lock(struct radeon_i2c_chan *i2c, int lock_state) diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index 6df4e3c..14710fc 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h @@ -515,6 +515,7 @@ extern void radeon_i2c_put_byte(struct radeon_i2c_chan *i2c, extern void radeon_router_select_ddc_port(struct radeon_connector *radeon_connector); extern void radeon_router_select_cd_port(struct radeon_connector *radeon_connector); extern bool radeon_ddc_probe(struct radeon_connector *radeon_connector); +extern bool radeon_ddc_edid_probe(struct radeon_connector *radeon_connector); extern int radeon_ddc_get_modes(struct radeon_connector *radeon_connector); extern struct drm_encoder *radeon_best_encoder(struct drm_connector *connector);