From patchwork Fri Dec 11 05:05:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sonika.jindal@intel.com X-Patchwork-Id: 7824431 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 301739F54F for ; Fri, 11 Dec 2015 05:05:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2FDEE20524 for ; Fri, 11 Dec 2015 05:05:19 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id DC81A2047D for ; Fri, 11 Dec 2015 05:05:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C787D6E255; Thu, 10 Dec 2015 21:05:15 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id E794F6E255 for ; Thu, 10 Dec 2015 21:05:14 -0800 (PST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP; 10 Dec 2015 21:05:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,411,1444719600"; d="scan'208";a="705252562" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga003.jf.intel.com with ESMTP; 10 Dec 2015 21:05:14 -0800 Received: from fmsmsx153.amr.corp.intel.com (10.18.125.6) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 10 Dec 2015 21:05:14 -0800 Received: from bgsmsx103.gar.corp.intel.com (10.223.4.130) by FMSMSX153.amr.corp.intel.com (10.18.125.6) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 10 Dec 2015 21:05:13 -0800 Received: from bgsmsx104.gar.corp.intel.com ([169.254.5.21]) by BGSMSX103.gar.corp.intel.com ([169.254.4.139]) with mapi id 14.03.0248.002; Fri, 11 Dec 2015 10:35:11 +0530 From: "Jindal, Sonika" To: "Wang, Gary C" , "intel-gfx@lists.freedesktop.org" Thread-Topic: [Intel-gfx] [PATCH] drm/i915: Correct max delay for HDMI hotplug live status checking Thread-Index: AQHRM7gWulllhLzdjUCgEWA6fZSjPp7FOlHg Date: Fri, 11 Dec 2015 05:05:11 +0000 Message-ID: <000C66961D35964B9714611E548C10AD0C3393D7@BGSMSX104.gar.corp.intel.com> References: <1449799710-21189-1-git-send-email-gary.c.wang@intel.com> In-Reply-To: <1449799710-21189-1-git-send-email-gary.c.wang@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.223.10.10] MIME-Version: 1.0 Subject: Re: [Intel-gfx] [PATCH] drm/i915: Correct max delay for HDMI hotplug live status checking 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 How about following instead of two levels of check in the while loop: unsigned int retry = 3; do { live_status = intel_digital_port_connected(dev_priv, hdmi_to_dig_port(intel_hdmi)); if (live_status) break; mdelay(10); } while (--retry); Regards, Sonika -----Original Message----- From: Intel-gfx [mailto:intel-gfx-bounces@lists.freedesktop.org] On Behalf Of Wang, Gary C Sent: Friday, December 11, 2015 7:39 AM To: intel-gfx@lists.freedesktop.org Subject: [Intel-gfx] [PATCH] drm/i915: Correct max delay for HDMI hotplug live status checking The total delay of HDMI hotplug detecting with 30ms should have been split into a resolution of 3 retries of 10ms each, for the worst cases. But it still suffered from only waiting 10ms at most in intel_hdmi_detect(). This patch corrects it by reading hotplug status with 4 times at most for 30ms delay. Reviewed-by: Cooper Chiou Cc: Gavin Hindman Signed-off-by: Gary Wang --- drivers/gpu/drm/i915/intel_hdmi.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) mode change 100644 => 100755 drivers/gpu/drm/i915/intel_hdmi.c -- 1.9.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c old mode 100644 new mode 100755 index be7fab9..888401b --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c @@ -1387,16 +1387,19 @@ intel_hdmi_detect(struct drm_connector *connector, bool force) struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector); struct drm_i915_private *dev_priv = to_i915(connector->dev); bool live_status = false; - unsigned int retry = 3; + // read hotplug status 4 times at most for 30ms delay (3 retries of 10ms each) + unsigned int retry = 4; DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id, connector->name); intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS); - while (!live_status && --retry) { + while (!live_status && retry--) { live_status = intel_digital_port_connected(dev_priv, hdmi_to_dig_port(intel_hdmi)); + if (live_status || !retry) + break; mdelay(10); }