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: 8882311 Return-Path: X-Original-To: patchwork-dri-devel@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 5BFFF9F39A for ; Tue, 19 Apr 2016 17:34:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 631F72026C for ; Tue, 19 Apr 2016 17:34:27 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id C1673202E9 for ; Tue, 19 Apr 2016 17:34:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 42B766E225; Tue, 19 Apr 2016 17:34:19 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@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 2828B6E7F6 for ; Tue, 19 Apr 2016 17:34:17 +0000 (UTC) Received: by mail-qk0-x232.google.com with SMTP id r191so5998280qke.2 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=Esg4iX5upWdwTfgJV61oN0dq5BZJek8YS5KzXVqBpTkL4Gax6oPKipPdM0PkDXzV5J pBeUUeWAQRTx5xLC8dp3N3BEYYBQubR4upaIpkQzeXwWxmUPxWEIrHVwVqLjvCY9rX+b C09v5Kkez/CrmJyaWEmVEvJ0FK3qy7hmncDdidupa794Hz5UdKzR/Os6emo3Za5ZGXuN RF12eJhz+xjcNoi1tU3W6LEgvPN9zl2Sk7fGqEzuAX4W1ReW7QVi8Z0TrQAU52eZbn4A hg2x5YVz/LKIF+M4jK4UYO6D8cfHpfWgxMeqqL01My+EqAsRoZBPKg16TQGJ6r/ydKMs Ex4w== X-Gm-Message-State: AOPr4FWsD0AYoOQHEMpA1exIujkQKFOsD8XXcE4NKmjshpGwvg/prp4x0/Nx7n3ilHcB1w== 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 Subject: [PATCH] drm: i915: Improve behavior in case of broken HDMI EDID 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 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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=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 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;