From patchwork Sat Jan 27 02:49:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dhinakaran Pandiyan X-Patchwork-Id: 10187283 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 11802603ED for ; Sat, 27 Jan 2018 02:50:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F38962A9B4 for ; Sat, 27 Jan 2018 02:50:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E83292AA42; Sat, 27 Jan 2018 02:50:07 +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=ham 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 70D8F2AA19 for ; Sat, 27 Jan 2018 02:50:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D18A86E859; Sat, 27 Jan 2018 02:50:06 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id 48AA66E8B2; Sat, 27 Jan 2018 02:50:05 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Jan 2018 18:50:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,419,1511856000"; d="scan'208";a="199174024" Received: from dk-thinkpad-x260.jf.intel.com ([10.54.75.38]) by fmsmga006.fm.intel.com with ESMTP; 26 Jan 2018 18:50:04 -0800 From: Dhinakaran Pandiyan To: intel-gfx@lists.freedesktop.org Date: Fri, 26 Jan 2018 18:49:22 -0800 Message-Id: <20180127024923.3093-8-dhinakaran.pandiyan@intel.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180127024923.3093-1-dhinakaran.pandiyan@intel.com> References: <20180127024923.3093-1-dhinakaran.pandiyan@intel.com> Subject: [Intel-gfx] [PATCH 8/9] drm/dp: Export AUX_RETRY_INTERVAL X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dhinakaran Pandiyan , dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Drivers can use this in their retry loops too. Cc: dri-devel@lists.freedesktop.org Signed-off-by: Dhinakaran Pandiyan --- drivers/gpu/drm/drm_dp_helper.c | 12 +++++------- include/drm/drm_dp_helper.h | 2 ++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index ffe14ec3e7f2..0a7c8d6e7d8c 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -169,8 +169,6 @@ int drm_dp_bw_code_to_link_rate(u8 link_bw) } EXPORT_SYMBOL(drm_dp_bw_code_to_link_rate); -#define AUX_RETRY_INTERVAL 500 /* us */ - /** * DOC: dp helpers * @@ -206,8 +204,8 @@ static int drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 request, */ for (retry = 0; retry < 32; retry++) { if (ret != 0 && ret != -ETIMEDOUT) { - usleep_range(AUX_RETRY_INTERVAL, - AUX_RETRY_INTERVAL + 100); + usleep_range(DP_AUX_RETRY_INTERVAL, + DP_AUX_RETRY_INTERVAL + 100); } ret = aux->transfer(aux, &msg); @@ -718,7 +716,7 @@ static int drm_dp_i2c_retry_count(const struct drm_dp_aux_msg *msg, drm_dp_aux_reply_duration(msg); int i2c_time_us = drm_dp_i2c_msg_duration(msg, i2c_speed_khz); - return DIV_ROUND_UP(i2c_time_us, aux_time_us + AUX_RETRY_INTERVAL); + return DIV_ROUND_UP(i2c_time_us, aux_time_us + DP_AUX_RETRY_INTERVAL); } /* @@ -795,7 +793,7 @@ static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) * For now just defer for long enough to hopefully be * safe for all use-cases. */ - usleep_range(AUX_RETRY_INTERVAL, AUX_RETRY_INTERVAL + 100); + usleep_range(DP_AUX_RETRY_INTERVAL, DP_AUX_RETRY_INTERVAL + 100); continue; default: @@ -827,7 +825,7 @@ static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) aux->i2c_defer_count++; if (defer_i2c < 7) defer_i2c++; - usleep_range(AUX_RETRY_INTERVAL, AUX_RETRY_INTERVAL + 100); + usleep_range(DP_AUX_RETRY_INTERVAL, DP_AUX_RETRY_INTERVAL + 100); drm_dp_i2c_msg_write_status_update(msg); continue; diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index c239e6e24a10..2eae1aed2d26 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -61,6 +61,8 @@ #define DP_AUX_I2C_REPLY_DEFER (0x2 << 2) #define DP_AUX_I2C_REPLY_MASK (0x3 << 2) +#define DP_AUX_RETRY_INTERVAL 500 /* us */ + /* AUX CH addresses */ /* DPCD */ #define DP_DPCD_REV 0x000