From patchwork Wed Apr 20 12:12:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sharma, Shashank" X-Patchwork-Id: 8889331 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 311E1BF29F for ; Wed, 20 Apr 2016 12:03:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5C418201C8 for ; Wed, 20 Apr 2016 12:03:18 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 957D9201FA for ; Wed, 20 Apr 2016 12:03:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 832A56E99B; Wed, 20 Apr 2016 12:03:14 +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 ESMTP id C4C276E99B for ; Wed, 20 Apr 2016 12:03:12 +0000 (UTC) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP; 20 Apr 2016 05:03:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,509,1455004800"; d="scan'208";a="962658899" Received: from shashanks-desktop.iind.intel.com ([10.223.26.24]) by fmsmga002.fm.intel.com with ESMTP; 20 Apr 2016 05:03:11 -0700 From: Shashank Sharma To: jani.nikula@linux.intel.com, intel-gfx@lists.freedesktop.org, ville.syrjala@linux.intel.com Date: Wed, 20 Apr 2016 17:42:51 +0530 Message-Id: <1461154371-1292-1-git-send-email-shashank.sharma@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <87fuvpv4l1.fsf@intel.com> References: <87fuvpv4l1.fsf@intel.com> Cc: joseph.salisbury@canonical.com, daniel.vetter@intel.com Subject: [Intel-gfx] [PATCH v2] drm/i915: Restrict usage of live status check 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=-5.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 This patch restricts usage of live status check for HDMI detection. While testing certain (monitor + cable) combinations with various intel platforms, it seems that live status register is not reliable on some older devices. So limit the live_status check from VLV onwards. This fixes regression added by patch: 'commit 237ed86c693d ("drm/i915: Check live status before reading edid")' === V2 === Ville: - Add live_status = true in the end of delay loop. Jani: - Initialize bool live_status with false; - Change regression reference in the commit message. - Use dev_priv instead of dev - Move declaration of try at the loop Signed-off-by: Shashank Sharma --- drivers/gpu/drm/i915/intel_hdmi.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index b199ede..98f5ae0 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c @@ -1398,22 +1398,39 @@ 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 try; DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id, connector->name); intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS); - for (try = 0; !live_status && try < 9; try++) { - if (try) - msleep(10); - live_status = intel_digital_port_connected(dev_priv, + /* + * Live status check for HDMI detection is not very + * reliable on older platforms. So insist the live + * status check for EDID read from VLV onwards. + */ + if (INTEL_INFO(dev_priv)->gen >= 7 && !IS_IVYBRIDGE(dev_priv)) { + unsigned int try; + + for (try = 0; !live_status && try < 9; try++) { + if (try) + msleep(10); + live_status = intel_digital_port_connected(dev_priv, hdmi_to_dig_port(intel_hdmi)); + } } - if (!live_status) - DRM_DEBUG_KMS("Live status not up!"); + if (!live_status) { + /* + * TODO: Replace this with some magic code. + * Even after giving enough delay, live status is not up. + * Lets read EDID and decide if HDMI is available. We + * have to do this not to break old platforms, but ideally + * should read EDID only when live_status reg allows us. + */ + DRM_DEBUG_KMS("Live status down, making it up\n"); + live_status = true; + } intel_hdmi_unset_edid(connector);