From patchwork Wed Jul 11 10:31:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 1181621 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 9A780DF25A for ; Wed, 11 Jul 2012 10:37:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 85B45A0DC4 for ; Wed, 11 Jul 2012 03:37:35 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wi0-f177.google.com (mail-wi0-f177.google.com [209.85.212.177]) by gabe.freedesktop.org (Postfix) with ESMTP id ADCFAA09A0 for ; Wed, 11 Jul 2012 03:32:24 -0700 (PDT) Received: by wibhm11 with SMTP id hm11so712229wib.12 for ; Wed, 11 Jul 2012 03:32:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=/Uwf0/DG2Y51WGizUuHBLqEvygmx9Ye1HKGQiiffz70=; b=NoTwcBMsJ7mJsDMPynsrz0L7Nj48XzavuuAdHLrs1TateEU1b6enTsPeYMN2um9rUB e0ApRe0VzhqX4a5QmypWK2GzkugBBU3KHMbdNhwkVCrvQB8l1SgLqJFpwOSwIlGiZbtj t3kuGa9P2S4y5P76Dx19RXzx26lo4CHAe/VdY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=/Uwf0/DG2Y51WGizUuHBLqEvygmx9Ye1HKGQiiffz70=; b=VeqPyN8epPEpPw+V3+GS1a4oWVs1IW90pThRa5bb3BrNf1sgx7IdGLfZ+VKvII36U0 M1/jUv2hFbetXbD0ejCuaKgHO+B+Ai2hrN9lKQiH0KvWNsTAqpeVsVEipLNi0nxJXVsi Twr3nrZz4XBN23/AUjO7cZQCRMPt2pfsf11NwqOdyBFL0HXhSgjCGnGBiU+xLli7Zzy/ 0kCmbqfIaooUx2LYxeVTOncnag34+hg5X9Qsl074HSSIzvSMO5ZuoDIVV6FyazIwzuL8 04PYASMKjaFvmuIsP4zK2XExmXYU9D4y18IN+leUBytMut+jF6SbNliyKRQZRZPdH+yl +Aag== Received: by 10.216.195.212 with SMTP id p62mr20060129wen.217.1342002743581; Wed, 11 Jul 2012 03:32:23 -0700 (PDT) Received: from phenom.ffwll.local (178-83-130-250.dynamic.hispeed.ch. [178.83.130.250]) by mx.google.com with ESMTPS id b7sm4047169wiz.9.2012.07.11.03.32.22 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 11 Jul 2012 03:32:22 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Date: Wed, 11 Jul 2012 12:31:52 +0200 Message-Id: <1342002713-12628-1-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1342000687_250108@CP5-2952> References: <1342000687_250108@CP5-2952> X-Gm-Message-State: ALoCoQl1NZ5hSvjRKeKDkpzY7De9ro4/OjCW4cSpGHkkqbQ7ZK3x868HO3KX+52HsbBYug1Eb0dq Cc: Daniel Vetter Subject: [Intel-gfx] [PATCH 1/2] drm/i915: check whether we actually received an edid in detect_ddc X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Somehow detect_ddc manages to fall through all checks when we think that something responds on the ddc i2c address, but the edid read failed. Fix this up by explicitly checking for this case. This fixes a regression on newer chips because since commit aaa377302b2994fcc2c66741b47da33feb489dca Author: Daniel Vetter Date: Sat Jun 16 15:30:32 2012 +0200 drm/i915/crt: Do not rely upon the HPD presence pin we use ddc detection also on hotplug capable platforms. And one of these reads all 0s for any i2c transaction if nothing is connected to the vga port. v2: Implement Chris Wilson's review: - simplify logic, default to "nothing detected" - kill stale comment - BUG_ON(!crt->type != ANALOG) Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=51900 Tested-by: Yang Guang Signed-Off-by: Daniel Vetter Reviewed-by: Chris Wilson --- drivers/gpu/drm/i915/intel_crt.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index 61d55d3..3c6028c 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c @@ -330,39 +330,34 @@ static bool intel_crt_detect_ddc(struct drm_connector *connector) { struct intel_crt *crt = intel_attached_crt(connector); struct drm_i915_private *dev_priv = crt->base.base.dev->dev_private; + struct edid *edid; + struct i2c_adapter *i2c; + + BUG_ON(crt->base.type != INTEL_OUTPUT_ANALOG); - /* CRT should always be at 0, but check anyway */ - if (crt->base.type != INTEL_OUTPUT_ANALOG) - return false; + i2c = intel_gmbus_get_adapter(dev_priv, dev_priv->crt_ddc_pin); + edid = drm_get_edid(connector, i2c); - if (intel_ddc_probe(&crt->base, dev_priv->crt_ddc_pin)) { - struct edid *edid; - bool is_digital = false; - struct i2c_adapter *i2c; + if (edid) { + bool is_digital = edid->input & DRM_EDID_INPUT_DIGITAL; - i2c = intel_gmbus_get_adapter(dev_priv, dev_priv->crt_ddc_pin); - edid = drm_get_edid(connector, i2c); /* * This may be a DVI-I connector with a shared DDC * link between analog and digital outputs, so we * have to check the EDID input spec of the attached device. - * - * On the other hand, what should we do if it is a broken EDID? */ - if (edid != NULL) { - is_digital = edid->input & DRM_EDID_INPUT_DIGITAL; - connector->display_info.raw_edid = NULL; - kfree(edid); - } - if (!is_digital) { DRM_DEBUG_KMS("CRT detected via DDC:0x50 [EDID]\n"); return true; - } else { - DRM_DEBUG_KMS("CRT not detected via DDC:0x50 [EDID reports a digital panel]\n"); } + + DRM_DEBUG_KMS("CRT not detected via DDC:0x50 [EDID reports a digital panel]\n"); + } else { + DRM_DEBUG_KMS("CRT not detected via DDC:0x50 [no valid EDID found]\n"); } + kfree(edid); + return false; }