From patchwork Mon May 7 10:36:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Feng Tang X-Patchwork-Id: 10383865 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 3166660159 for ; Mon, 7 May 2018 10:35:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22ECA2894B for ; Mon, 7 May 2018 10:35:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 17B55289EE; Mon, 7 May 2018 10:35:59 +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=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, 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 BA7B82894B for ; Mon, 7 May 2018 10:35:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 40ECD89E5B; Mon, 7 May 2018 10:35:56 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id 53CA289E35; Mon, 7 May 2018 10:35:55 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 May 2018 03:35:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,373,1520924400"; d="scan'208";a="39838219" Received: from shbuild999.sh.intel.com ([10.239.146.218]) by orsmga006.jf.intel.com with ESMTP; 07 May 2018 03:35:52 -0700 From: Feng Tang To: dri-devel@lists.freedesktop.org, Gustavo Padovan , Maarten Lankhorst , Sean Paul , David Airlie , Jani Nikula , intel-gfx@lists.freedesktop.org Date: Mon, 7 May 2018 18:36:09 +0800 Message-Id: <1525689369-27124-1-git-send-email-feng.tang@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [Intel-gfx] [PATCH] drm/dp: add module parameter for the dpcd access max retries 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: Feng Tang MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP To fulfil the Dell 4K monitor, the dpcd max retries has been bumped from 7 to 32, which may hurt the boot/init time for some platforms, as the 32 retries may take hundreds of ms. This patch makes no functional change, but make the max retries adjustable, so that concerned users/platforms can have an option to short the wait time. On a Intel Atom Processor A3960 based NUC, the i915_init() time could be reduced from 450ms to 200ms. retries = 3: [ 0.457806] calling i915_init+0x0/0x51 @ 1 [ 0.662307] initcall i915_init+0x0/0x51 returned 0 after 199694 usecs retries = 32: [ 0.465818] calling i915_init+0x0/0x51 @ 1 [ 0.925831] initcall i915_init+0x0/0x51 returned 0 after 449219 usecs Signed-off-by: Feng Tang --- drivers/gpu/drm/drm_dp_helper.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index ffe14ec..6054067 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -171,6 +171,20 @@ EXPORT_SYMBOL(drm_dp_bw_code_to_link_rate); #define AUX_RETRY_INTERVAL 500 /* us */ +/* + * The specification doesn't give any recommendation on how often to + * retry native transactions. We used to retry 7 times like for + * aux i2c transactions but real world devices this wasn't + * sufficient, bump to 32 which makes Dell 4k monitors happier. + * + * Since the retry may take quite some boot time, we make it a + * adjustable parameter for possible shorter retry time. + */ +static int dp_dpcd_max_retries __read_mostly = 32; +module_param_unsafe(dp_dpcd_max_retries, int, 0644); +MODULE_PARM_DESC(dp_dpcd_max_retries, + "Max retry number for DPCD access (default 32)"); + /** * DOC: dp helpers * @@ -198,13 +212,7 @@ static int drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 request, mutex_lock(&aux->hw_mutex); - /* - * The specification doesn't give any recommendation on how often to - * retry native transactions. We used to retry 7 times like for - * aux i2c transactions but real world devices this wasn't - * sufficient, bump to 32 which makes Dell 4k monitors happier. - */ - for (retry = 0; retry < 32; retry++) { + for (retry = 0; retry < dp_dpcd_max_retries; retry++) { if (ret != 0 && ret != -ETIMEDOUT) { usleep_range(AUX_RETRY_INTERVAL, AUX_RETRY_INTERVAL + 100);