From patchwork Sat Apr 18 07:04:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Todd Previte X-Patchwork-Id: 6236691 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 573D3BF4A7 for ; Sat, 18 Apr 2015 07:04:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 61679203AC for ; Sat, 18 Apr 2015 07:04:38 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2D9BE203A5 for ; Sat, 18 Apr 2015 07:04:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 94E996E17F; Sat, 18 Apr 2015 00:04:35 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-pd0-f170.google.com (mail-pd0-f170.google.com [209.85.192.170]) by gabe.freedesktop.org (Postfix) with ESMTP id B23C46E17F; Sat, 18 Apr 2015 00:04:34 -0700 (PDT) Received: by pdbnk13 with SMTP id nk13so150496383pdb.0; Sat, 18 Apr 2015 00:04:34 -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:in-reply-to:references; bh=/+gzPJtqp0WJ6kPDOz+fMW7Le9APQM4IhmT6q9dLzIg=; b=V73E9N2EnBow4crWuGqEVTn9MKztdF71Kw3o988Zj23QCd41pT4dyMssV66P4PhcXq H4X0B5BkDlh/IbOmO/0er9Cwq78opgrfvG12tvMJQsOdha2Y6qMvBHfBwpO5DOr3KAve zu/xHTjeaJXJYIjD4jv5jevN0aOALIjmk4TPO69spsE8gUGGRlp0p/Qml+6KzUBhHusw PKFhoIaIEGnt10YZokfuWoCmf6fdqvzLg/q+JOOHTGOuaUtpL2PLnBUDn+6N3bXggjwg Z66xRup8/ibgD0uv+8v+K2+zh5mb6OdNfvnF2uZtZ1cQGuJYpKz/XXd1DSF6j+CBOu6/ z8cg== X-Received: by 10.70.126.225 with SMTP id nb1mr11698383pdb.71.1429340674545; Sat, 18 Apr 2015 00:04:34 -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 dc5sm11968427pbc.53.2015.04.18.00.04.33 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 18 Apr 2015 00:04:33 -0700 (PDT) From: Todd Previte To: intel-gfx@lists.freedesktop.org Date: Sat, 18 Apr 2015 00:04:18 -0700 Message-Id: <1429340659-14369-5-git-send-email-tprevite@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1429340659-14369-1-git-send-email-tprevite@gmail.com> References: <1429340659-14369-1-git-send-email-tprevite@gmail.com> Cc: dri-devel@lists.freedesktop.org Subject: [Intel-gfx] [PATCH 4/5] drm: Fix for DP CTS test 4.2.2.5 - I2C DEFER handling X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" 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 For test 4.2.2.5 to pass per the Link CTS Core 1.2 rev1.1 spec, the source device must attempt at least 7 times to read the EDID when it receives an I2C defer. The normal DRM code makes only 7 retries, regardless of whether or not the response is a native defer or an I2C defer. Test 4.2.2.5 fails since there are native defers interspersed with the I2C defers which results in less than 7 EDID read attempts. The solution is to add the numer of defers to the retry counter when an I2C DEFER is returned such that another read attempt will be made. This situation should normally only occur in compliance testing, however, as a worse case real-world scenario, it would result in 13 attempts ( 6 native defers, 7 I2C defers) for a single transaction to complete. The net result is a slightly slower response to an EDID read that shouldn't significantly impact overall performance. V2: - Added a check on the number of I2C Defers to limit the number of times that the retries variable will be decremented. This is to address review feedback regarding possible infinite loops from misbehaving sink devices. V3: - Fixed the limit value to 7 instead of 8 to get the correct retry count. - Combined the increment of the defer count into the if-statement V4: - Removed i915 tag from subject as the patch is not i915-specific V5: - Updated the for-loop to add the number of i2c defers to the retry counter such that the correct number of retry attempts will be made Signed-off-by: Todd Previte Cc: dri-devel@lists.freedesktop.org Reviewed-by: Paulo Zanoni --- drivers/gpu/drm/drm_dp_helper.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index 575172e..80a02a4 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -432,7 +432,7 @@ static u32 drm_dp_i2c_functionality(struct i2c_adapter *adapter) */ static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) { - unsigned int retry; + unsigned int retry, defer_i2c; int ret; /* @@ -440,7 +440,7 @@ static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) * is required to retry at least seven times upon receiving AUX_DEFER * before giving up the AUX transaction. */ - for (retry = 0; retry < 7; retry++) { + for (retry = 0, defer_i2c = 0; retry < (7 + defer_i2c); retry++) { mutex_lock(&aux->hw_mutex); ret = aux->transfer(aux, msg); mutex_unlock(&aux->hw_mutex); @@ -499,7 +499,13 @@ static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) case DP_AUX_I2C_REPLY_DEFER: DRM_DEBUG_KMS("I2C defer\n"); + /* DP Compliance Test 4.2.2.5 Requirement: + * Must have at least 7 retries for I2C defers on the + * transaction to pass this test + */ aux->i2c_defer_count++; + if (defer_i2c < 7) + defer_i2c++; usleep_range(400, 500); continue;