From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AG47ELuNayJu/lwr4Of33Q/ai28/PrGVLTb2z9TgFgmFbXS2EGzxkYci7UKT1sR7Xg3i8n35yhID ARC-Seal: i=1; a=rsa-sha256; t=1520955457; cv=none; d=google.com; s=arc-20160816; b=fae2f/b7B4dh30vqzDjWeOdHg6k8KqacDJe0awpZpwGlslh48xpAHwxUMn4HVckTkh NoCReUqJ9d8J8Qw1sv4VAIQb5xFPXXViCc2Ws42EpraJj3XEJuHD3hUCkebc7Nbi42jz fRmtv+9zjCbL9f78Do40pCQNqFVN+wYqydg2lE0ZQgDqsIvc2JNug6BFNusObNOd3nZ9 KhlFBtOe3rehn/c7Wzpm6hTg+vuI03zSdjEEsa3M53tH5wvckiicU7bYNkMBgrep9oaR d4DOrEy6p7gRyT0aoKCYLjrA675NVjiZwMtSF4St8pbKybZCykS2V7rtASOtpyPv8ZnP f7mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=Hllg1702Oge3+kEJUrkXDLUPjC/itjDEf+HwDVI+oBk=; b=G6JODfCBX2XhKhOAVUx55ihWhR2uMQbxk/HUBsmiA8VIx7Ioc9/EPBrPbcXlvtpLOy ocNpaGeoXiNuo95YEU0iFYAgYK9I0ainVWz2MwVHt52EezVyAEni5DsEiiWzn+1OK3tz 1NkLTS17FjJk2bR47PkJQxoNTO/BJrZdqcA9F/Y76Vwy/bWpekzE99W/qwozqCtWhb4I rQGpZbC58a8EN/h7zsub1nsbKytBdmHLx65qckZB+YvR9TAb7YNOE0OuNyENuTALSOMa dpLmHPJDWJNmUioknEsvuqmCUHXPxF6+3oqWVRorzqvP+o3S/7uQ/4eajHdldGg+eSUM dU0w== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Stefan=20Br=C3=BCns?= , Daniel Vetter , Rodrigo Vivi Subject: [PATCH 4.14 056/140] drm/i915: Try EDID bitbanging on HDMI after failed read Date: Tue, 13 Mar 2018 16:24:19 +0100 Message-Id: <20180313152502.031100233@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180313152458.201155692@linuxfoundation.org> References: <20180313152458.201155692@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-LABELS: =?utf-8?b?IlxcU2VudCI=?= X-GMAIL-THRID: =?utf-8?q?1594836873021113405?= X-GMAIL-MSGID: =?utf-8?q?1594837389804207508?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Stefan Brüns commit 90024a5951029685acc5396258f1b0de9b23cf4a upstream. 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. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92685 Signed-off-by: Stefan Brüns Cc: stable@vger.kernel.org Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/a39f080b-81a5-4c93-b3f7-7cb0a58daca3@rwthex-w2-a.rwth-ad.de (cherry picked from commit cfb926e148e99acc02351d72e8b85e32b5f786ef) Signed-off-by: Rodrigo Vivi Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/intel_hdmi.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c @@ -1563,12 +1563,20 @@ intel_hdmi_set_edid(struct drm_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);