From patchwork Fri Jan 23 18:40:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Farnsworth X-Patchwork-Id: 5697541 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 3105A9F2ED for ; Fri, 23 Jan 2015 19:06:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2228220260 for ; Fri, 23 Jan 2015 19:06:44 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 77C552022A for ; Fri, 23 Jan 2015 19:06:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DFF076E05E; Fri, 23 Jan 2015 11:06:40 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 1541 seconds by postgrey-1.34 at gabe; Fri, 23 Jan 2015 11:06:38 PST Received: from claranet-outbound-smtp01.uk.clara.net (claranet-outbound-smtp01.uk.clara.net [195.8.89.34]) by gabe.freedesktop.org (Postfix) with ESMTP id F0C1E6E05E for ; Fri, 23 Jan 2015 11:06:38 -0800 (PST) Received: from 110.100.155.90.in-addr.arpa ([90.155.100.110]:58466 helo=f19simon.office.onelan.co.uk) by relay11.mail.eu.clara.net (relay.clara.net [81.171.239.31]:1025) with esmtpa (authdaemon_plain:simon.farnsworth@onelan.co.uk) id 1YEjA2-0003dz-4L (return-path ); Fri, 23 Jan 2015 18:40:50 +0000 From: Simon Farnsworth To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/dp: Use large transactions for I2C over AUX Date: Fri, 23 Jan 2015 18:40:38 +0000 Message-Id: <1422038438-9323-1-git-send-email-simon.farnsworth@onelan.co.uk> X-Mailer: git-send-email 2.1.0 Cc: Thierry Reding 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.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 DisplayPort to DVI-D Dual Link adapters designed by Bizlink have bugs in their I2C over AUX implementation. They work fine with Windows, but fail with Linux. It turns out that they cannot keep an I2C transaction open unless the previous read was 16 bytes; shorter reads can only be followed by a zero byte transfer ending the I2C transaction. Copy Windows's behaviour, and read 16 bytes at a time. Analysis of the failure state was provided by Datapath Ltd. Signed-off-by: Simon Farnsworth --- Thierry, You put in the comment about "decreased performance", back in December 2013; would you mind testing that this still works with the devices you tested? Unfortunately, Bizlink are the only game in town for DP->DVI-DL adapters - and their firmware is prone to giving up on I2C if we look at it wrongly. Even Apple's device is Bizlink designed. drivers/gpu/drm/drm_dp_helper.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index 79968e3..b4a9d4a 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -507,16 +507,13 @@ static int drm_dp_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, err = drm_dp_i2c_do_msg(aux, &msg); if (err < 0) break; - /* - * Many hardware implementations support FIFOs larger than a - * single byte, but it has been empirically determined that - * transferring data in larger chunks can actually lead to - * decreased performance. Therefore each message is simply - * transferred byte-by-byte. + /* Bizlink designed DP->DVI-D Dual Link adapters require the + * I2C over AUX packets to be as large as possible. If not, + * the I2C transactions never succeed. */ - for (j = 0; j < msgs[i].len; j++) { + for (j = 0; j < msgs[i].len; j+=16) { msg.buffer = msgs[i].buf + j; - msg.size = 1; + msg.size = min(16, msgs[i].len - 16); err = drm_dp_i2c_do_msg(aux, &msg); if (err < 0)