From patchwork Wed Aug 23 12:42:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sharma, Shashank" X-Patchwork-Id: 9917309 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 2A5AA602CB for ; Wed, 23 Aug 2017 12:40:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C256288AE for ; Wed, 23 Aug 2017 12:40:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0EB9D28999; Wed, 23 Aug 2017 12:40:28 +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 D47A428990 for ; Wed, 23 Aug 2017 12:40:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B5DB46E58A; Wed, 23 Aug 2017 12:39:33 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id 91DEA6E58A for ; Wed, 23 Aug 2017 12:39:32 +0000 (UTC) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Aug 2017 05:39:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,416,1498546800"; d="scan'208,223";a="1165404446" Received: from shashanks-linuxbox.iind.intel.com ([10.223.161.29]) by orsmga001.jf.intel.com with ESMTP; 23 Aug 2017 05:39:29 -0700 From: Shashank Sharma To: intel-gfx@lists.freedesktop.org Date: Wed, 23 Aug 2017 18:12:51 +0530 Message-Id: <1503492171-13446-1-git-send-email-shashank.sharma@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <87y3qa336v.fsf@nikula.org> References: <87y3qa336v.fsf@nikula.org> Subject: [Intel-gfx] [PATCH v2 1/2] drm: Add retries for dp dual mode read 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-Virus-Scanned: ClamAV using ClamSMTP From the CI builds, its been observed that during a driver reload/insert, dp dual mode read function sometimes fails to read from dual mode devices (like LSPCON) over i2c-over-aux channel. This patch: - adds some delay and few retries, allowing a scope for these devices to settle down and respond. - changes one error log's level from ERROR->DEBUG as we want to call it an error only after all the retries are exhausted. V2: Addressed review comments from Jani (for loop for retry) Cc: Ville Syrjala Cc: Imre Deak Cc: Jani Nikula Signed-off-by: Shashank Sharma Reviewed-by: Imre Deak --- drivers/gpu/drm/drm_dp_dual_mode_helper.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_dp_dual_mode_helper.c b/drivers/gpu/drm/drm_dp_dual_mode_helper.c index 80e62f6..09bf962 100644 --- a/drivers/gpu/drm/drm_dp_dual_mode_helper.c +++ b/drivers/gpu/drm/drm_dp_dual_mode_helper.c @@ -75,8 +75,16 @@ ssize_t drm_dp_dual_mode_read(struct i2c_adapter *adapter, }, }; int ret; + int retry; + + for (retry = 0; retry < 6; retry++) { + if (retry) + usleep_range(500, 1000); + ret = i2c_transfer(adapter, msgs, ARRAY_SIZE(msgs)); + if (ret > 0) + break; + } - ret = i2c_transfer(adapter, msgs, ARRAY_SIZE(msgs)); if (ret < 0) return ret; if (ret != ARRAY_SIZE(msgs)) @@ -420,7 +428,7 @@ int drm_lspcon_get_mode(struct i2c_adapter *adapter, ret = drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_LSPCON_CURRENT_MODE, &data, sizeof(data)); if (ret < 0) { - DRM_ERROR("LSPCON read(0x80, 0x41) failed\n"); + DRM_DEBUG_KMS("LSPCON read(0x80, 0x41) failed\n"); return -EFAULT; }