From patchwork Thu May 21 00:22:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Todd Previte X-Patchwork-Id: 6451081 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E13A79F1C1 for ; Thu, 21 May 2015 00:22:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 097CE20435 for ; Thu, 21 May 2015 00:22:29 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id D7D1320429 for ; Thu, 21 May 2015 00:22:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3EAC76E77A; Wed, 20 May 2015 17:22:26 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pa0-f48.google.com (mail-pa0-f48.google.com [209.85.220.48]) by gabe.freedesktop.org (Postfix) with ESMTP id 75F4A6E0D0; Wed, 20 May 2015 17:22:25 -0700 (PDT) Received: by pacwv17 with SMTP id wv17so85216707pac.2; Wed, 20 May 2015 17:22:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=Vds0wjiGdNTs7jbaGJLl9b5tSsZx5xp4CtEWNWbBCCg=; b=zOE3aJe3FWjmzimRtmUrW55czWHA36YGfAoWqjqvNc63kcv1x/AjuQO7RRZf0ZqzX+ 2mWb/UQWjaY6IqfjSKcFpBeEwSkN35io6jIclisuiZ//8uGgE7PlkyXPHXhbFM1LatUJ joGPYrPTYZ+5VEb04uZQeoL3PLDocFNkzPRIq1UPOR1VbQipX7dr+zQA6TwQMItDr5LQ lNYlr27HoajiiFkVaQfubsjfx5ENRvpq28ROuuLweUkYuBda2Odlm6KwUlZhtX+qrrgM xom26onXgMGzZj6KHELAFuTz2gCABu5MDhencif+JEQmBVUvZDXwC7LV0D0qLnHhPL0O aC/A== X-Received: by 10.68.244.73 with SMTP id xe9mr68788pbc.98.1432167745151; Wed, 20 May 2015 17:22:25 -0700 (PDT) Received: from localhost.localdomain (ip70-162-72-208.ph.ph.cox.net. [70.162.72.208]) by mx.google.com with ESMTPSA id l1sm17275404pdp.71.2015.05.20.17.22.23 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 May 2015 17:22:24 -0700 (PDT) From: Todd Previte To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/edid: Fix DDC probe for passive DP dongles Date: Wed, 20 May 2015 17:22:16 -0700 Message-Id: <1432167736-3903-1-git-send-email-tprevite@gmail.com> X-Mailer: git-send-email 1.9.1 Cc: intel-gfx@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Passive DP->DVI/HDMI dongles show up to the system as HDMI devices, as they do not have a sink device in them to respond to any AUX traffic. When probing these dongles over the DDC, sometimes they will NAK the first attempt even though the transaction is valid and they support the DDC protocol. The retry loop inside of drm_do_probe_ddc_edid() would normally catch this case and try the transaction again, resulting in success. That, however, was thwarted by the fix for fdo.org bug #41059. The patch is: commit 9292f37e1f5c79400254dca46f83313488093825 Author: Eugeni Dodonov Date: Thu Jan 5 09:34:28 2012 -0200 drm: give up on edid retries when i2c bus is not responding This added code to exit immediately if the return code from the i2c_transfer function was -ENXIO in order to reduce the amount of time spent in waiting for unresponsive or disconnected devices. For the DP dongles, this means that the second retry never happens which results in a failed EDID probe and a black screen. To work around this problem without undoing the fix for bug #41059, the number of retries is checked along with the return code. This allows for a device to NAK once and still continue operations. A second NAK will result in breaking the loop as it would have before and stopping the DDC probe. Signed-off-by: Todd Previte Cc: intel-gfx@lists.freedesktop.org --- drivers/gpu/drm/drm_edid.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 7087da3..e8047bd 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -1238,7 +1238,10 @@ drm_do_probe_ddc_edid(void *data, u8 *buf, unsigned int block, size_t len) */ ret = i2c_transfer(adapter, &msgs[3 - xfers], xfers); - if (ret == -ENXIO) { + /* Passive DP->DVI/HDMI dongles sometimes NAK the first probe + * Try to probe again but if it NAKs, stop trying + */ + if (ret == -ENXIO && retries < 5) { DRM_DEBUG_KMS("drm: skipping non-existent adapter %s\n", adapter->name); break;