Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp3490674pxx; Mon, 2 Nov 2020 10:13:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJxjxkRerzrS+8nGdtbP7cVsj3dlfrS3kveyeGPvovgQ7oBdOX2B4+3MI5EElHNV6q/z/8VJ X-Received: by 2002:a05:6402:22d9:: with SMTP id dm25mr17588614edb.182.1604340824644; Mon, 02 Nov 2020 10:13:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604340824; cv=none; d=google.com; s=arc-20160816; b=dGz/WAQhdICAk+z9OhjPkXgTpty+BT+pk5XZKmGYFXooUK/k0glDqEGdK7mR1gM3wr V7cbKhfS17IDV3m7KzqaqSgPXkTPmebi0ZCtgJ1kUzpwaa7xpqBHTTzx5xlqhH/qvyI2 ogIWtMZZS/Gfg0c1VcKvqoLDuQunC8O+eFDKA+4BGXQFEb4SgrVVJvB24BMr/x0QBpfB MYIP11XnWlXdKstNOQzCQfBqf5nFgWX8N4HcA6ZvBTV50PWRYqYo98a0F2qtKPVYai5u I0upIpEeot7AA81bb7DJVrLHEagNk4hmknAj3YSS3qYivXP7RE3o1sEntJWyaST62anI Q8rQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Wmiepruc3iCJr4t5GLBvdMshT7V+umkWxaVmydO1lC4=; b=oe88Lx1ZWa3MtU3UTZ+002Er8Kj4eKZ5+1TN7+Ak5gENxV5Rem87kSiXivGNc2L9uW FgJfDLiLYsnA64I2mmMixbBUUZF1kxQixTkjn+OR9XrO7RUfZZZ2Q+tKXkaGn/cjYxq6 61Mc1Cg8y+9PlvtL+YJZ+1TMz1D7qjUoQYEE3ZGubOyq/xOWmesrPsYdRxqN2pyXANbB IOhvqWMQhcPYTqdH3ciB5ZOSiu4cHyW9eZIrmpzSP/EH92/D5aiwC0bX44cgSNCMaZhl +nW3VwDOXmG5cSt1dWORxegOWFwl7idfSQPhRMI7yJlYEfws+Vk3mEfWjCdtEr+IxUPf MqDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=fVmd9hMh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m2si3456436eja.161.2020.11.02.10.13.21; Mon, 02 Nov 2020 10:13:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=fVmd9hMh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726236AbgKBSLy (ORCPT + 99 others); Mon, 2 Nov 2020 13:11:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726088AbgKBSLv (ORCPT ); Mon, 2 Nov 2020 13:11:51 -0500 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1613FC0617A6 for ; Mon, 2 Nov 2020 10:11:51 -0800 (PST) Received: by mail-pf1-x441.google.com with SMTP id b3so11836425pfo.2 for ; Mon, 02 Nov 2020 10:11:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Wmiepruc3iCJr4t5GLBvdMshT7V+umkWxaVmydO1lC4=; b=fVmd9hMhFPFDmgKxG8aw6065UP1hSU/+jbR6rqxTwx/DSXw79TIDaPRljmz6icQrm1 uBRIf71eV6DvEk8ouKaza4Ltfyj22EVXwwWA2zQjQlUyW4XzOjYRXhGZGjJ6ftKq4IVW bXWL44Dc7D4VkY/mAwUA2eutPQ29fy5+u89qw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Wmiepruc3iCJr4t5GLBvdMshT7V+umkWxaVmydO1lC4=; b=T3xmCjKBjxRE8ZSacxD4YIW50zFk1htwyVwW9r2RWMpxm3vGYuau26csA6M3FL0hxP R7o8APF74mTIyeMWVuSVLNtH4WM+vmS+uUHMCqDYJ0zKzIosWe9s55d+qXC/1ii4fixX 60HpMZuqJWmvRoeW6cGRxdvY8MklePf9NHV7waLp66CSTGGcCj/qUqXX99B0kqX0Uyup 7liQY+wOVPjrbyolySAVOuisl4E7Y0md4IY9ovz9+TlUHhEcNs2sh5i4SrH9JlEIPPYn AYcNurBtYpJFkrVKlQb30kfANGCL9X1MTvl2GLBdzk7pfrmnFf++b/NivYTlN7n3VYWh ZoQA== X-Gm-Message-State: AOAM530NgVSzLmqJKeMtAxXtV36TUo1w+/u9uWZ3U9lhKcad4shPzEyS /lldHILzHaFfxklYbLafpQcd+A== X-Received: by 2002:a63:a1d:: with SMTP id 29mr14072488pgk.162.1604340710699; Mon, 02 Nov 2020 10:11:50 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:3e52:82ff:fe6c:83ab]) by smtp.gmail.com with ESMTPSA id b17sm13175640pgb.94.2020.11.02.10.11.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 10:11:50 -0800 (PST) From: Stephen Boyd To: Andrzej Hajda , Neil Armstrong , Sam Ravnborg Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Douglas Anderson , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Sean Paul Subject: [PATCH v3 3/4] drm/bridge: ti-sn65dsi86: Read EDID blob over DDC Date: Mon, 2 Nov 2020 10:11:43 -0800 Message-Id: <20201102181144.3469197-4-swboyd@chromium.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog In-Reply-To: <20201102181144.3469197-1-swboyd@chromium.org> References: <20201102181144.3469197-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the DDC connection to read the EDID from the eDP panel instead of relying on the panel to tell us the modes. Reviewed-by: Douglas Anderson Reviewed-by: Laurent Pinchart Cc: Jonas Karlman Cc: Jernej Skrabec Cc: Sean Paul Acked-by: Sam Ravnborg Signed-off-by: Stephen Boyd --- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c index 8276fa50138f..6b6e98ca2881 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c @@ -119,6 +119,7 @@ * @debugfs: Used for managing our debugfs. * @host_node: Remote DSI node. * @dsi: Our MIPI DSI source. + * @edid: Detected EDID of eDP panel. * @refclk: Our reference clock. * @panel: Our panel. * @enable_gpio: The GPIO we toggle to enable the bridge. @@ -144,6 +145,7 @@ struct ti_sn_bridge { struct drm_bridge bridge; struct drm_connector connector; struct dentry *debugfs; + struct edid *edid; struct device_node *host_node; struct mipi_dsi_device *dsi; struct clk *refclk; @@ -265,6 +267,23 @@ connector_to_ti_sn_bridge(struct drm_connector *connector) static int ti_sn_bridge_connector_get_modes(struct drm_connector *connector) { struct ti_sn_bridge *pdata = connector_to_ti_sn_bridge(connector); + struct edid *edid = pdata->edid; + int num, ret; + + if (!edid) { + pm_runtime_get_sync(pdata->dev); + edid = pdata->edid = drm_get_edid(connector, &pdata->aux.ddc); + pm_runtime_put(pdata->dev); + } + + if (edid && drm_edid_is_valid(edid)) { + ret = drm_connector_update_edid_property(connector, edid); + if (!ret) { + num = drm_add_edid_modes(connector, edid); + if (num) + return num; + } + } return drm_panel_get_modes(pdata->panel, connector); } @@ -1245,6 +1264,7 @@ static int ti_sn_bridge_remove(struct i2c_client *client) if (!pdata) return -EINVAL; + kfree(pdata->edid); ti_sn_debugfs_remove(pdata); of_node_put(pdata->host_node); -- Sent by a computer, using git, on the internet