From mboxrd@z Thu Jan 1 00:00:00 1970 From: Laurent Pinchart Subject: Re: [PATCH v4 2/3] drm/tegra: output: Support DRM bridges Date: Fri, 17 Apr 2020 22:30:18 +0300 Message-ID: <20200417193018.GI5861@pendragon.ideasonboard.com> References: <20200417175238.27154-1-digetx@gmail.com> <20200417175238.27154-3-digetx@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Return-path: Content-Disposition: inline In-Reply-To: <20200417175238.27154-3-digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Sender: linux-tegra-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Dmitry Osipenko Cc: Thierry Reding , Sam Ravnborg , dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-tegra@vger.kernel.org Hi Dmitry, Thank you for the patch. On Fri, Apr 17, 2020 at 08:52:37PM +0300, Dmitry Osipenko wrote: > 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's DRM output. > > Signed-off-by: Dmitry Osipenko > --- > drivers/gpu/drm/tegra/drm.h | 2 ++ > drivers/gpu/drm/tegra/output.c | 13 ++++++++++++- > 2 files changed, 14 insertions(+), 1 deletion(-) > > 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 You could add a forward declaration of struct drm_bridge instead, that can lower the compilation time a little bit. > #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..ec0cd4a1ced1 100644 > --- a/drivers/gpu/drm/tegra/output.c > +++ b/drivers/gpu/drm/tegra/output.c > @@ -5,6 +5,7 @@ > */ > > #include > +#include > #include > #include > > @@ -92,13 +93,23 @@ static irqreturn_t hpd_irq(int irq, void *data) > > int tegra_output_probe(struct tegra_output *output) > { > - struct device_node *ddc, *panel; > + struct device_node *ddc, *panel, *port; > unsigned long flags; > int err, size; > > if (!output->of_node) > output->of_node = output->dev->of_node; > > + port = of_get_child_by_name(output->of_node, "port"); Do you need to check for the presence of a port node first ? Can you just check the return value of drm_of_find_panel_or_bridge(), and fall back to "nvidia,panel" if it returns -ENODEV ? > + if (port) { > + err = drm_of_find_panel_or_bridge(output->of_node, 0, 0, NULL, > + &output->bridge); > + of_node_put(port); > + > + if (err) > + return err; > + } > + > panel = of_parse_phandle(output->of_node, "nvidia,panel", 0); > if (panel) { > output->panel = of_drm_find_panel(panel); -- Regards, Laurent Pinchart From mboxrd@z Thu Jan 1 00:00:00 1970 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=-6.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS 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 8BCEEC2D0EF for ; Fri, 17 Apr 2020 19:30:35 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 61EBC2051A for ; Fri, 17 Apr 2020 19:30:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="dE7ay/+H" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 61EBC2051A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B6AC56E5AB; Fri, 17 Apr 2020 19:30:34 +0000 (UTC) Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by gabe.freedesktop.org (Postfix) with ESMTPS id B1E366E5AB for ; Fri, 17 Apr 2020 19:30:32 +0000 (UTC) Received: from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 2EADB97D; Fri, 17 Apr 2020 21:30:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1587151831; bh=LT1fkzEiIU2SdM1Bf5osoUKh8u7+bnqSZLlDYNIAJjo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dE7ay/+HO41kMLRny/Fj7jxuxie/OQKooqir9nFALZiMdNGYalCu1GoKmXiqqh7L7 38i1+wOMBgq6qJxSikUCmuDd7ULN0pkBmh9LJhAKQlG0QCbwu9EIwXahjdFfi2zT58 xLDaG9Tfvl9oqB9XIlKNUieP97wQpA8DUXHjdS1E= Date: Fri, 17 Apr 2020 22:30:18 +0300 From: Laurent Pinchart To: Dmitry Osipenko Subject: Re: [PATCH v4 2/3] drm/tegra: output: Support DRM bridges Message-ID: <20200417193018.GI5861@pendragon.ideasonboard.com> References: <20200417175238.27154-1-digetx@gmail.com> <20200417175238.27154-3-digetx@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200417175238.27154-3-digetx@gmail.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-tegra@vger.kernel.org, Thierry Reding , Sam Ravnborg , dri-devel@lists.freedesktop.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Hi Dmitry, Thank you for the patch. On Fri, Apr 17, 2020 at 08:52:37PM +0300, Dmitry Osipenko wrote: > 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's DRM output. > > Signed-off-by: Dmitry Osipenko > --- > drivers/gpu/drm/tegra/drm.h | 2 ++ > drivers/gpu/drm/tegra/output.c | 13 ++++++++++++- > 2 files changed, 14 insertions(+), 1 deletion(-) > > 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 You could add a forward declaration of struct drm_bridge instead, that can lower the compilation time a little bit. > #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..ec0cd4a1ced1 100644 > --- a/drivers/gpu/drm/tegra/output.c > +++ b/drivers/gpu/drm/tegra/output.c > @@ -5,6 +5,7 @@ > */ > > #include > +#include > #include > #include > > @@ -92,13 +93,23 @@ static irqreturn_t hpd_irq(int irq, void *data) > > int tegra_output_probe(struct tegra_output *output) > { > - struct device_node *ddc, *panel; > + struct device_node *ddc, *panel, *port; > unsigned long flags; > int err, size; > > if (!output->of_node) > output->of_node = output->dev->of_node; > > + port = of_get_child_by_name(output->of_node, "port"); Do you need to check for the presence of a port node first ? Can you just check the return value of drm_of_find_panel_or_bridge(), and fall back to "nvidia,panel" if it returns -ENODEV ? > + if (port) { > + err = drm_of_find_panel_or_bridge(output->of_node, 0, 0, NULL, > + &output->bridge); > + of_node_put(port); > + > + if (err) > + return err; > + } > + > panel = of_parse_phandle(output->of_node, "nvidia,panel", 0); > if (panel) { > output->panel = of_drm_find_panel(panel); -- Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel