From patchwork Wed Dec 8 16:10:21 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Flynn X-Patchwork-Id: 392302 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oB8Ln6Vf023747 for ; Wed, 8 Dec 2010 21:49:26 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 482149E762 for ; Wed, 8 Dec 2010 13:49:06 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Wed, 08 Dec 2010 21:49:26 +0000 (UTC) X-Greylist: delayed 10979 seconds by postgrey-1.31 at gabe; Wed, 08 Dec 2010 13:48:48 PST Received: from mailout1.thls.bbc.co.uk (mailout1.thls.bbc.co.uk [132.185.240.36]) by gabe.freedesktop.org (Postfix) with ESMTP id 5D5BA9E730 for ; Wed, 8 Dec 2010 13:48:48 -0800 (PST) Received: from gateh.kw.bbc.co.uk (gateh.kw.bbc.co.uk [132.185.132.17]) by mailout1.thls.bbc.co.uk (8.14.4/8.14.3) with ESMTP id oB8IjkMW019190 for ; Wed, 8 Dec 2010 18:45:46 GMT Received: from mailhub.rd.bbc.co.uk ([172.29.120.130]) by gateh.kw.bbc.co.uk (8.13.6/8.13.6) with ESMTP id oB8IjjfK014990 for ; Wed, 8 Dec 2010 18:45:45 GMT Received: from b36048.rd.bbc.co.uk ([172.29.136.48]:57209) by mailhub.rd.bbc.co.uk with esmtp (Exim 4.69) (envelope-from ) id 1PQP1N-0004kl-BO for intel-gfx@lists.freedesktop.org; Wed, 08 Dec 2010 18:45:45 +0000 Received: from davidf by b36048.rd.bbc.co.uk with local (Exim 4.69) (envelope-from ) id 1PQP1N-00088Z-9n for intel-gfx@lists.freedesktop.org; Wed, 08 Dec 2010 18:45:45 +0000 Resent-From: David Flynn Resent-Date: Wed, 8 Dec 2010 18:45:45 +0000 Resent-Message-ID: <20101208184545.GA31256@rd.bbc.co.uk> Resent-To: intel-gfx@lists.freedesktop.org Date: Wed, 8 Dec 2010 16:10:21 +0000 From: David Flynn To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Message-ID: <20101208161021.GF20844@rd.bbc.co.uk> MIME-Version: 1.0 Content-Disposition: inline X-Editor: Vim http://www.vim.org/ Organisation: Poor X-Operating-System: SunOS 5.10 SUNW,Sun-Fire-V210 User-Agent: Mutt/1.5.20 (2009-06-14) Resent-Date: Wed, 08 Dec 2010 18:45:45 +0000 Subject: [Intel-gfx] [PATCH] drm/i915/dp: Fix I2C/EDID handling with active DisplayPort to DVI converter X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index c8e0055..186cdc7 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -482,6 +482,7 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode, int msg_bytes; int reply_bytes; int ret; + unsigned retry; /* Set up the command byte */ if (mode & MODE_I2C_READ) @@ -513,7 +514,7 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode, break; } - for (;;) { + for (retry = 5; retry; retry--) { ret = intel_dp_aux_ch(intel_dp, msg, msg_bytes, reply, reply_bytes); @@ -521,6 +522,21 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode, DRM_DEBUG_KMS("aux_ch failed %d\n", ret); return ret; } + switch (reply[0] & AUX_NATIVE_REPLY_MASK) { + case AUX_NATIVE_REPLY_ACK: + /* I2C-over-AUX Reply field is only valid when paired with AUX ACK.*/ + break; + case AUX_NATIVE_REPLY_NACK: + DRM_DEBUG_KMS("aux_ch nack\n"); + return -EREMOTEIO; + case AUX_NATIVE_REPLY_DEFER: + udelay(100); + continue; + default: + DRM_ERROR("aux_ch invalid reply 0x%02x\n", reply[0]); + return -EREMOTEIO; + } + switch (reply[0] & AUX_I2C_REPLY_MASK) { case AUX_I2C_REPLY_ACK: if (mode == MODE_I2C_READ) { @@ -528,17 +544,20 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode, } return reply_bytes - 1; case AUX_I2C_REPLY_NACK: - DRM_DEBUG_KMS("aux_ch nack\n"); + DRM_DEBUG_KMS("aux_i2c nack\n"); return -EREMOTEIO; case AUX_I2C_REPLY_DEFER: - DRM_DEBUG_KMS("aux_ch defer\n"); + DRM_DEBUG_KMS("aux_i2c defer\n"); udelay(100); break; default: - DRM_ERROR("aux_ch invalid reply 0x%02x\n", reply[0]); + DRM_ERROR("aux_i2c invalid reply 0x%02x\n", reply[0]); return -EREMOTEIO; } } + + DRM_ERROR("too many retries, giving up\n"); + return -EREMOTEIO; } static int