From patchwork Sat Apr 18 17:06:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 201816 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44EF1C38A29 for ; Sat, 18 Apr 2020 17:07:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2724722242 for ; Sat, 18 Apr 2020 17:07:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IQ9EFc/9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726699AbgDRRHW (ORCPT ); Sat, 18 Apr 2020 13:07:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725887AbgDRRHV (ORCPT ); Sat, 18 Apr 2020 13:07:21 -0400 Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41FB5C061A0C; Sat, 18 Apr 2020 10:07:21 -0700 (PDT) Received: by mail-lj1-x242.google.com with SMTP id e25so5341363ljg.5; Sat, 18 Apr 2020 10:07:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GmbaXDj6/A2yy3AR+sXi1M1Zh+o7hArk00ZH5b0F9ZU=; b=IQ9EFc/970LojBwLiW62BzGPBnOzmy32A9jVWoWDsei2DhVR8dy4ffZK8x9F8N/PT9 wz+97rXX+dPMgbFLEKEgQdx3eKpfxvKbKVItMhwDIZZM4azyCyXkzGwkA1cOCVO16rZW ijs5x3KGwycbHCNqt377mxeBk5RpP4qSU/hhCb8VoluNtNwpdZk0fRsstUZ/wF6uSkIP cH2DfNt7s4OhUz9VQoicOILzpbPXRXEOJ9miVMZ9abM3msVEBkoUeDljv5312QK5ipCx mV4h5MQAtt6gTz0k6nhyJvwz5ONJBG8xfvHxyizNXWX3ekQx+Z2N98hMEt1qNfcYdgBC FlVA== 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=GmbaXDj6/A2yy3AR+sXi1M1Zh+o7hArk00ZH5b0F9ZU=; b=rOEmrC/y2lacksHnwEtk9Si1Ul3z8Xj4C7dhw5HMnyKTwe4VLkr7l50rXwZcDyjtHp x2L47VlebHA33pXMlBGti9cyzuY52Zoy8fhHJwPjUnYhcIBw73as12BtxcGU9OeqJW9r /rkk+WY/wM3TkLwig2FMBSzJyld5adGYbb77/yXQefDwv9ephw4ysQkO4mQRJzW8V7ji R+Nsg25kFYwM2oSFFDfg9Qd2uGeVNijLru1cxQrqZPV9mELwAAQ187F0vjZkFIjhS2uZ mHKUr5CNPhY9xwyRCttvZ3GEEEF9PkBNhwq6IQLrNxvkE0wheBYVrAekM8c8b4q8b5wN 64PQ== X-Gm-Message-State: AGi0Pub8xZoG8SqdjJoZmumrEaovOmMc62TxOJmS1rGRxB7Ul/1RoqWE V3gNNCS717zAmBJTpXLK+GYaSUbo X-Google-Smtp-Source: APiQypJZeGBXci/SYfTR0hCgDyYACwvrJkNlkiEL97tY/h/8Q5HyrC0kRIAH1vune5hFb+wviydGyw== X-Received: by 2002:a2e:9a4c:: with SMTP id k12mr5235920ljj.189.1587229639769; Sat, 18 Apr 2020 10:07:19 -0700 (PDT) Received: from localhost.localdomain (ppp91-78-208-152.pppoe.mtu-net.ru. [91.78.208.152]) by smtp.gmail.com with ESMTPSA id e15sm8768909ljb.25.2020.04.18.10.07.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Apr 2020 10:07:19 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Sam Ravnborg , Laurent Pinchart , Rob Herring , Frank Rowand Cc: dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 2/6] drm/of: Make drm_of_find_panel_or_bridge() to check graph's presence Date: Sat, 18 Apr 2020 20:06:59 +0300 Message-Id: <20200418170703.1583-3-digetx@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200418170703.1583-1-digetx@gmail.com> References: <20200418170703.1583-1-digetx@gmail.com> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org When graph isn't defined in a device-tree, the of_graph_get_remote_node() prints a noisy error message, telling that port node is not found. This is undesirable behaviour in our case because absence of a panel/bridge graph is a valid case. Let's check presence of the local port in a device-tree before proceeding with parsing the graph. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_of.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index b50b44e76279..e0652c38f357 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -239,13 +239,24 @@ int drm_of_find_panel_or_bridge(const struct device_node *np, struct drm_bridge **bridge) { int ret = -EPROBE_DEFER; - struct device_node *remote; + struct device_node *local, *remote; if (!panel && !bridge) return -EINVAL; if (panel) *panel = NULL; + /* + * of_graph_get_remote_node() produces a noisy error message if port + * node isn't found and the absence of the port is a legit case here, + * so at first we silently check presence of the local port. + */ + local = of_graph_get_local_port(np); + if (!local) + return -ENODEV; + + of_node_put(local); + remote = of_graph_get_remote_node(np, port, endpoint); if (!remote) return -ENODEV; From patchwork Sat Apr 18 17:07:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 201817 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 847F4C38A2F for ; Sat, 18 Apr 2020 17:07:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 669C122209 for ; Sat, 18 Apr 2020 17:07:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="T3DnJSRY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726882AbgDRRH0 (ORCPT ); Sat, 18 Apr 2020 13:07:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726855AbgDRRHY (ORCPT ); Sat, 18 Apr 2020 13:07:24 -0400 Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57EBEC061A0C; Sat, 18 Apr 2020 10:07:23 -0700 (PDT) Received: by mail-lf1-x143.google.com with SMTP id k28so4394038lfe.10; Sat, 18 Apr 2020 10:07:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bzHxFhcgWD/fZsCe3fmC7U0LkboW0qpnWF3suCBMKYk=; b=T3DnJSRYxNDt1AYmdsFRorYQ4sIbtNy/6+H3c+6NJY7aaU79vwN+SYTDidg4TKuA98 uo4I5ZY60m++jXGywzj3RODdSlR+iDtP8z2XXjco1sz7bRQyRnlzp5IsvyBTyX0H4rmR xehROXC4fNe+sL0U221SX/K7W7RbscCMft2bMFgvZd6TjLh72jCMy4F5TniArQO+IBOO D93gu3+bXptqcq0F7L3j6319aoKk78KvxJrkdiGljpKuXescvmutAqEd7WzY5VB2FSBd JKf1bU4Erlmlx/BQ/ZDXIY6YIZxrKHT2LSSg1jmE1OQpBIXiC1JC7VJgXMQwBJNA5B9S pMBg== 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=bzHxFhcgWD/fZsCe3fmC7U0LkboW0qpnWF3suCBMKYk=; b=el54Mo1O8J6zVTJc8nHzavnG56s9JA1bVv2Z/YQVjqiUtnPpkf4TVaI6e8/ZRswuON U9VT/66nkIUsflPZjtiK3UYu9yDpwGnoyUC+TertsPcXMziPS3epDMjt81d2eWxOmY4F UnoAENQlYMpUVgp382RRQV9kqua1o74AyXwkh5h8rOiB3RqOdCVTAA6wXnmeCLaauwIC rMVGUk7wor1Nb2RPxodQtVNrLsFljZCGVuvFjhIogL6o/x5OCWvVSZNW9d/lgPw+dQ0x k9oj4Kfxk6751BdAkltWi3lgN6vL4K4FBR5oVUnMGqD7CYlyOAbGdWqiNIVd3s0cYBwZ 1C7A== X-Gm-Message-State: AGi0PuZxyXWmpr9UcxmxuLx3L+Cp8RICBY4bX1u85NaqL45BIzQRBFwV p/lNd+TSKSd11nYN4uBd30o= X-Google-Smtp-Source: APiQypJOiKhEF7D0gxeLQ/r3Rd9nuz90wAPm/Ps9vRcN1st7U3WZUnpoxcnAew3oAkwi1D7S5rp4Dw== X-Received: by 2002:ac2:58ee:: with SMTP id v14mr5017916lfo.25.1587229641823; Sat, 18 Apr 2020 10:07:21 -0700 (PDT) Received: from localhost.localdomain (ppp91-78-208-152.pppoe.mtu-net.ru. [91.78.208.152]) by smtp.gmail.com with ESMTPSA id e15sm8768909ljb.25.2020.04.18.10.07.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Apr 2020 10:07:21 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Sam Ravnborg , Laurent Pinchart , Rob Herring , Frank Rowand Cc: dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 4/6] drm/tegra: output: Support DRM bridges Date: Sat, 18 Apr 2020 20:07:01 +0300 Message-Id: <20200418170703.1583-5-digetx@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200418170703.1583-1-digetx@gmail.com> References: <20200418170703.1583-1-digetx@gmail.com> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Newer Tegra device-trees will specify a video output graph which involves a bridge. This patch adds initial support for the DRM bridges to the Tegra DRM output. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/tegra/drm.h | 2 ++ drivers/gpu/drm/tegra/output.c | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h index 804869799305..cccd368b6752 100644 --- a/drivers/gpu/drm/tegra/drm.h +++ b/drivers/gpu/drm/tegra/drm.h @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -116,6 +117,7 @@ struct tegra_output { struct device_node *of_node; struct device *dev; + struct drm_bridge *bridge; struct drm_panel *panel; struct i2c_adapter *ddc; const struct edid *edid; diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c index a6a711d54e88..ccd1421f1b24 100644 --- a/drivers/gpu/drm/tegra/output.c +++ b/drivers/gpu/drm/tegra/output.c @@ -5,6 +5,7 @@ */ #include +#include #include #include @@ -99,8 +100,19 @@ int tegra_output_probe(struct tegra_output *output) if (!output->of_node) output->of_node = output->dev->of_node; + err = drm_of_find_panel_or_bridge(output->of_node, -1, -1, + &output->panel, &output->bridge); + if (err && err != -ENODEV) + return err; + panel = of_parse_phandle(output->of_node, "nvidia,panel", 0); if (panel) { + /* + * Don't mix nvidia,panel phandle with the graph in a + * device-tree. + */ + WARN_ON(output->panel || output->bridge); + output->panel = of_drm_find_panel(panel); of_node_put(panel); From patchwork Sat Apr 18 17:07:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 201818 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A05CAC3A5A0 for ; Sat, 18 Apr 2020 17:07:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7385D21D6C for ; Sat, 18 Apr 2020 17:07:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="p8+rPkCQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727807AbgDRRHd (ORCPT ); Sat, 18 Apr 2020 13:07:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726909AbgDRRH1 (ORCPT ); Sat, 18 Apr 2020 13:07:27 -0400 Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 836D2C061A0F; Sat, 18 Apr 2020 10:07:25 -0700 (PDT) Received: by mail-lf1-x142.google.com with SMTP id k28so4394093lfe.10; Sat, 18 Apr 2020 10:07:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=n6hq2XlIahyxNhJ/uhIqbU22a2HtKZ7QcDFqMh6e2uc=; b=p8+rPkCQFlqk8Qz5o6rG+cm0B0GQn1ZPk+VZjXU0bU3vhKYL1ISyCecUxphRh6caRX IMaYy03D4Y6kU+BwW5E8yuGUZFFKNC2h3mS6WyoqV9x/UIZNzTbLXnFymi5bL515Ng64 jR9sV05P16vG/GepxUh4FZKY+jukbV7Uayc5bZ/wRZktbAgnIPSrqgha4qkaOu810IH2 CqKSVXvB/x2d+HmKubLBNKaj3fSl6XmxZdLcBl+mqBURUY6lp5zz+3Eh2kULhTWgqwk3 A9I8f4ucQMuwMoePIVguxgsN+CuWHrz4n1cqicgcqxpEmEQhP6+oHE+9W/5vpbkKo5jh XYfg== 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=n6hq2XlIahyxNhJ/uhIqbU22a2HtKZ7QcDFqMh6e2uc=; b=i8lNFfOtx4maaOqe9wXkbmaqt5pyH2nHAl91PACTsDS1JA18U5oRQGS5GopCZhSi92 M1ovjx33u3rZXIVD0OIRap8EeDgFKfYTM6rvVTjgmI0GED76Z5kQjvOb3fmuaze/FhHm 4cVRUFdX2jsIEZZv7lW+M4jpzhpKNNzCi3SiEt/+h2AEsT9Byb0Zyw/hkr76OuDjfoaZ ru3ECQ+q+hJp1DVX5NWV9Mzg72Fj8jh9Wv+83/D4NkkFxNM74kcvH1buoIbk3FXJB9md EZsQKYHG/FeOaMdspE1LIcv80BdfcI2ygmCtK0ufbW8aZDDSE2M/UVkA2oZQXsz/SiAh yB9w== X-Gm-Message-State: AGi0Pub76fOP2ahWMWtK2fJMpNysTkrxx5XewK30MJYG/z812k03IYof OW/URU4GxM3iX+B7gY8F0LY= X-Google-Smtp-Source: APiQypJKSR6OQSZl8ELLfty+ryCDSBKdNmCq2quUB+LFQLqbsTFG8Isth8KFNW7Lv1XLNJL+IRBRnw== X-Received: by 2002:a19:c14e:: with SMTP id r75mr5468293lff.62.1587229644017; Sat, 18 Apr 2020 10:07:24 -0700 (PDT) Received: from localhost.localdomain (ppp91-78-208-152.pppoe.mtu-net.ru. [91.78.208.152]) by smtp.gmail.com with ESMTPSA id e15sm8768909ljb.25.2020.04.18.10.07.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Apr 2020 10:07:23 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Sam Ravnborg , Laurent Pinchart , Rob Herring , Frank Rowand Cc: dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 6/6] drm/tegra: output: rgb: Wrap directly-connected panel into DRM bridge Date: Sat, 18 Apr 2020 20:07:03 +0300 Message-Id: <20200418170703.1583-7-digetx@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200418170703.1583-1-digetx@gmail.com> References: <20200418170703.1583-1-digetx@gmail.com> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Currently Tegra DRM driver manually manages display panel, but this management could be moved out into DRM core if we'll wrap panel into DRM bridge. This patch wraps RGB panel into a DRM bridge and removes manual handling of the panel from the RGB output code. Suggested-by: Laurent Pinchart Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/tegra/rgb.c | 53 +++++++++++++------------------------ 1 file changed, 18 insertions(+), 35 deletions(-) diff --git a/drivers/gpu/drm/tegra/rgb.c b/drivers/gpu/drm/tegra/rgb.c index 9a7024ec96bc..a4c5a6066c54 100644 --- a/drivers/gpu/drm/tegra/rgb.c +++ b/drivers/gpu/drm/tegra/rgb.c @@ -8,7 +8,6 @@ #include #include -#include #include #include "drm.h" @@ -86,15 +85,6 @@ static void tegra_dc_write_regs(struct tegra_dc *dc, tegra_dc_writel(dc, table[i].value, table[i].offset); } -static const struct drm_connector_funcs tegra_rgb_connector_funcs = { - .reset = drm_atomic_helper_connector_reset, - .detect = tegra_output_connector_detect, - .fill_modes = drm_helper_probe_single_connector_modes, - .destroy = tegra_output_connector_destroy, - .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, - .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, -}; - static enum drm_mode_status tegra_rgb_connector_mode_valid(struct drm_connector *connector, struct drm_display_mode *mode) @@ -117,14 +107,8 @@ static void tegra_rgb_encoder_disable(struct drm_encoder *encoder) struct tegra_output *output = encoder_to_output(encoder); struct tegra_rgb *rgb = to_rgb(output); - if (output->panel) - drm_panel_disable(output->panel); - tegra_dc_write_regs(rgb->dc, rgb_disable, ARRAY_SIZE(rgb_disable)); tegra_dc_commit(rgb->dc); - - if (output->panel) - drm_panel_unprepare(output->panel); } static void tegra_rgb_encoder_enable(struct drm_encoder *encoder) @@ -133,9 +117,6 @@ static void tegra_rgb_encoder_enable(struct drm_encoder *encoder) struct tegra_rgb *rgb = to_rgb(output); u32 value; - if (output->panel) - drm_panel_prepare(output->panel); - tegra_dc_write_regs(rgb->dc, rgb_enable, ARRAY_SIZE(rgb_enable)); value = DE_SELECT_ACTIVE | DE_CONTROL_NORMAL; @@ -157,9 +138,6 @@ static void tegra_rgb_encoder_enable(struct drm_encoder *encoder) tegra_dc_writel(rgb->dc, value, DC_DISP_SHIFT_CLOCK_OPTIONS); tegra_dc_commit(rgb->dc); - - if (output->panel) - drm_panel_enable(output->panel); } static int @@ -278,6 +256,23 @@ int tegra_dc_rgb_init(struct drm_device *drm, struct tegra_dc *dc) drm_encoder_helper_add(&output->encoder, &tegra_rgb_encoder_helper_funcs); + /* + * Wrap directly-connected panel into DRM bridge in order to let + * DRM core to handle panel for us. + */ + if (output->panel) { + output->bridge = devm_drm_panel_bridge_add(output->dev, + output->panel); + if (IS_ERR(output->bridge)) { + dev_err(output->dev, + "failed to wrap panel into bridge: %pe\n", + output->bridge); + return PTR_ERR(output->bridge); + } + + output->panel = NULL; + } + /* * Tegra devices that have LVDS panel utilize LVDS encoder bridge * for converting up to 28 LCD LVTTL lanes into 5/4 LVDS lanes that @@ -292,8 +287,7 @@ int tegra_dc_rgb_init(struct drm_device *drm, struct tegra_dc *dc) * Newer device-trees utilize LVDS encoder bridge, which provides * us with a connector and handles the display panel. * - * For older device-trees we fall back to our own connector and use - * nvidia,panel phandle. + * For older device-trees we wrapped panel into the panel-bridge. */ if (output->bridge) { err = drm_bridge_attach(&output->encoder, output->bridge, @@ -313,17 +307,6 @@ int tegra_dc_rgb_init(struct drm_device *drm, struct tegra_dc *dc) } drm_connector_attach_encoder(connector, &output->encoder); - } else { - drm_connector_init(drm, &output->connector, - &tegra_rgb_connector_funcs, - DRM_MODE_CONNECTOR_LVDS); - drm_connector_helper_add(&output->connector, - &tegra_rgb_connector_helper_funcs); - output->connector.dpms = DRM_MODE_DPMS_OFF; - - drm_connector_attach_encoder(&output->connector, - &output->encoder); - drm_connector_register(&output->connector); } err = tegra_output_init(drm, output);