From patchwork Tue Apr 19 17:31:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ezequiel Garcia X-Patchwork-Id: 8882301 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 8B1D0BF29F for ; Tue, 19 Apr 2016 17:34:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7C0712026F for ; Tue, 19 Apr 2016 17:34:23 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 8EFB12026C for ; Tue, 19 Apr 2016 17:34:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 561B86E7F6; Tue, 19 Apr 2016 17:34:19 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-qk0-x232.google.com (mail-qk0-x232.google.com [IPv6:2607:f8b0:400d:c09::232]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1FBC96E225 for ; Tue, 19 Apr 2016 17:34:17 +0000 (UTC) Received: by mail-qk0-x232.google.com with SMTP id x7so6671497qkd.3 for ; Tue, 19 Apr 2016 10:34:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vanguardiasur-com-ar.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=0yJzEw88KWl5zz26+BXyGXEQEi1NQTBflUg8qKFRhvA=; b=VpdqJG8ySZfRNMi5Y6zi5WwnUjgDaz30rfzg+IsaM7tGtF/Ha3QktALHj/DmNOW4R1 uAnb1cV1ZXRGLKho3X44LkqBDKiXCBoaUhT/snBjoEPONigjZQKtUFA8RuP+VrInmGFZ g8le6O0GAqbiqAmhhWSrSFLMF2/UQf1MbWtlfW1ux60LUE7tiL7wfAGZ5pYW9pev3QNe NaAc4BRUAw1X/gyEQ3RjyaLvMZlNqeuL7S4YuK5ZQMYDqHEjizmtUrRkleGlw+pAiObB ZrSlFEsT3uLY8JAI27wXeldh7NZRYapA7bcoCmwsu3ESKO6j5MkCwS7ZlFsyi/F1FUmc nCgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=0yJzEw88KWl5zz26+BXyGXEQEi1NQTBflUg8qKFRhvA=; b=YbbyRpAJEGYPyVwbBo7ImLNiXDkkDExwzqEHblZOB6dFmeutiIwnudN023PvG6RgEL +lso/eB4RRYppwU97l0HsS+209rkMtaWj8Mg2y0ltGEG8DVmhPggsrB7jzM0jCBTtCb8 P1aDOF8Y4+wP23ZLD6q/584ksk6fZe06EmzpHTUIXrdOzF7X+5p2L7XnZltFGLOvCdPt r4liav2OAjOsZqnvyrEu3H+82Twjhdv9zPzwQtCw6aZOCtvAuIHUbYZgEDRR+9Ay8e50 wPojzf3vl+xnWwMA76dMa2rurGmoW9GK6l+E9k1RfruvGJFOPBi3Zqj2iC2Rhxsb6kNh Aghw== X-Gm-Message-State: AOPr4FVSJ8v71hrDv0+OJqxBDPOO2AhmYG4FYC7xRpFS0/KRrSHVnpHQpZSp1A9wEGO77Q== X-Received: by 10.55.76.134 with SMTP id z128mr5324230qka.90.1461087256557; Tue, 19 Apr 2016 10:34:16 -0700 (PDT) Received: from localhost.localdomain ([190.2.108.156]) by smtp.gmail.com with ESMTPSA id o24sm14376756qko.32.2016.04.19.10.34.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Apr 2016 10:34:15 -0700 (PDT) From: Ezequiel Garcia To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Date: Tue, 19 Apr 2016 14:31:13 -0300 Message-Id: <1461087073-14903-1-git-send-email-ezequiel@vanguardiasur.com.ar> X-Mailer: git-send-email 2.7.0 Cc: Daniel Vetter , Ezequiel Garcia Subject: [Intel-gfx] [PATCH] drm: i915: Improve behavior in case of broken HDMI EDID 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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham 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 Currently, our implementation of drm_connector_funcs.detect is based on getting a valid EDID. This requirement makes the driver fail to detect connected connectors in case of EDID corruption, which in turn prevents from falling back to modes provided by builtin or user-provided EDIDs. Let's fix this by calling drm_probe_ddc in drm_connector_funcs.detect, and do the EDID full reading and parsing in drm_connector_helper_funcs.get_modes, when it's actually needed. This patch allows i915 to take advantage of the DRM_LOAD_EDID_FIRMWARE infrastructure. Without this patch, any device that fails to provide a valid EDID will be reported as disconnected (unless the state is forced) and thus the kernel won't allow to use such device with any mode, either builtin, user-provided, or the 1024x768 noedid fallback. Signed-off-by: Ezequiel Garcia --- This patch supersedes: "drm/i915/hdmi: Fix weak connector detection", https://patchwork.freedesktop.org/patch/79098/. drivers/gpu/drm/i915/intel_hdmi.c | 59 ++++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index 616108c4bc3e..aa2f2271394a 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c @@ -1392,36 +1392,17 @@ intel_hdmi_detect(struct drm_connector *connector, bool force) enum drm_connector_status status; 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); + struct i2c_adapter *adap; 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, - hdmi_to_dig_port(intel_hdmi)); - } - - if (!live_status) - DRM_DEBUG_KMS("Live status not up!"); - - intel_hdmi_unset_edid(connector); - - if (intel_hdmi_set_edid(connector, live_status)) { - struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector); - - hdmi_to_dig_port(intel_hdmi)->base.type = INTEL_OUTPUT_HDMI; + adap = intel_gmbus_get_adapter(dev_priv, intel_hdmi->ddc_bus); + if (drm_probe_ddc(adap)) status = connector_status_connected; - } else + else status = connector_status_disconnected; intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS); - return status; } @@ -1442,10 +1423,42 @@ intel_hdmi_force(struct drm_connector *connector) hdmi_to_dig_port(intel_hdmi)->base.type = INTEL_OUTPUT_HDMI; } +static void intel_hdmi_detect_edid(struct drm_connector *connector) +{ + 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, + hdmi_to_dig_port(intel_hdmi)); + } + + if (!live_status) + DRM_DEBUG_KMS("Live status not up!"); + + intel_hdmi_unset_edid(connector); + if (intel_hdmi_set_edid(connector, live_status)) + hdmi_to_dig_port(intel_hdmi)->base.type = INTEL_OUTPUT_HDMI; + + intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS); +} + static int intel_hdmi_get_modes(struct drm_connector *connector) { struct edid *edid; + if (!to_intel_connector(connector)->detect_edid) + intel_hdmi_detect_edid(connector); + edid = to_intel_connector(connector)->detect_edid; if (edid == NULL) return 0;