From patchwork Sun Dec 31 22:34:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Stefan_Br=C3=BCns?= X-Patchwork-Id: 10138331 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2B0FB6020A for ; Sun, 31 Dec 2017 22:35:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1CC92286BB for ; Sun, 31 Dec 2017 22:35:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 10D572876A; Sun, 31 Dec 2017 22:35:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6405B286C1 for ; Sun, 31 Dec 2017 22:35:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8270689951; Sun, 31 Dec 2017 22:35:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-out-1.itc.rwth-aachen.de (mail-out-1.itc.rwth-aachen.de [134.130.5.46]) by gabe.freedesktop.org (Postfix) with ESMTPS id 981A789951; Sun, 31 Dec 2017 22:35:10 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2CECQA+ZUla/54agoZdHQEBBQELAYM+Z?= =?us-ascii?q?oEbB4QAmTuZK4IVCiOFGIQyQBcBAQEBAQEBAQFrKIVNBAsBRjUCJgJfCgQFii4?= =?us-ascii?q?EDK5SgW06iEqBZQEBAQEBBQEBAQEBHgUJAYEFgn2CEoM/KYY1GIIigg4MMYJlB?= =?us-ascii?q?YpIiUiPPIEThnCPSYl9KYdAjSSJMgICAgIJAhqBPCEBNoFPcIJ6glQcgWh3AYg?= =?us-ascii?q?aAYEVAQEB?= X-IPAS-Result: =?us-ascii?q?A2CECQA+ZUla/54agoZdHQEBBQELAYM+ZoEbB4QAmTuZK4I?= =?us-ascii?q?VCiOFGIQyQBcBAQEBAQEBAQFrKIVNBAsBRjUCJgJfCgQFii4EDK5SgW06iEqBZ?= =?us-ascii?q?QEBAQEBBQEBAQEBHgUJAYEFgn2CEoM/KYY1GIIigg4MMYJlBYpIiUiPPIEThnC?= =?us-ascii?q?PSYl9KYdAjSSJMgICAgIJAhqBPCEBNoFPcIJ6glQcgWh3AYgaAYEVAQEB?= X-IronPort-AV: E=Sophos;i="5.45,488,1508796000"; d="scan'208";a="31486628" Received: from rwthex-w2-a.rwth-ad.de ([134.130.26.158]) by mail-in-1.itc.rwth-aachen.de with ESMTP; 31 Dec 2017 23:35:07 +0100 Received: from pebbles.fritz.box (77.182.71.79) by rwthex-w2-a.rwth-ad.de (2002:8682:1a9e::8682:1a9e) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.26; Sun, 31 Dec 2017 23:35:02 +0100 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= To: Subject: [PATCH v2] drm/i915: Try EDID bitbanging on HDMI after failed read Date: Sun, 31 Dec 2017 23:34:54 +0100 X-Mailer: git-send-email 2.15.1 MIME-Version: 1.0 X-Originating-IP: [77.182.71.79] X-ClientProxiedBy: rwthex-w2-b.rwth-ad.de (2002:8682:1a9f::8682:1a9f) To rwthex-w2-a.rwth-ad.de (2002:8682:1a9e::8682:1a9e) Message-ID: Cc: David Airlie , intel-gfx@lists.freedesktop.org, Joonas Lahtinen , linux-kernel@vger.kernel.org, Rodrigo Vivi , =?UTF-8?q?Stefan=20Br=C3=BCns?= 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The ACK/NACK implementation as found in e.g. the G965 has the falling clock edge and the release of the data line after the ACK for the received byte happen at the same time. This is conformant with the I2C specification, which allows a zero hold time, see footnote [3]: "A device must internally provide a hold time of at least 300 ns for the SDA signal (with respect to the V IH(min) of the SCL signal) to bridge the undefined region of the falling edge of SCL." Some HDMI-to-VGA converters apparently fail to adhere to this requirement and latch SDA at the falling clock edge, so instead of an ACK sometimes a NACK is read and the slave (i.e. the EDID ROM) ends the transfer. The bitbanging releases the data line for the ACK only 1/4 bit time after the falling clock edge, so a slave will see the correct value no matter if it samples at the rising or the falling clock edge or in the center. Fallback to bitbanging is already done for the CRT connector. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92685 Signed-off-by: Stefan BrĂ¼ns --- Changes in v2: - Fix/enhance commit message, no code changes drivers/gpu/drm/i915/intel_hdmi.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index 4dea833f9d1b..847cda4c017c 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c @@ -1573,12 +1573,20 @@ intel_hdmi_set_edid(struct drm_connector *connector) struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector); struct edid *edid; bool connected = false; + struct i2c_adapter *i2c; intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS); - edid = drm_get_edid(connector, - intel_gmbus_get_adapter(dev_priv, - intel_hdmi->ddc_bus)); + i2c = intel_gmbus_get_adapter(dev_priv, intel_hdmi->ddc_bus); + + edid = drm_get_edid(connector, i2c); + + if (!edid && !intel_gmbus_is_forced_bit(i2c)) { + DRM_DEBUG_KMS("HDMI GMBUS EDID read failed, retry using GPIO bit-banging\n"); + intel_gmbus_force_bit(i2c, true); + edid = drm_get_edid(connector, i2c); + intel_gmbus_force_bit(i2c, false); + } intel_hdmi_dp_dual_mode_detect(connector, edid != NULL);