| Message ID | 20221209152343.180139-8-jagan@amarulasolutions.com |
|---|---|
| State | New |
| Headers |
Return-Path: <linux-amarula+bncBD7MFH7A7EEBBHVHZWOAMGQEA6LZ7QA@amarulasolutions.com> X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 014693F039 for <linux-amarula@patchwork.amarulasolutions.com>; Fri, 9 Dec 2022 16:26:24 +0100 (CET) Received: by mail-pl1-f197.google.com with SMTP id b17-20020a170903229100b00189da3b178bsf4435317plh.7 for <linux-amarula@patchwork.amarulasolutions.com>; Fri, 09 Dec 2022 07:26:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1670599582; cv=pass; d=google.com; s=arc-20160816; b=Jbmq/46CnXgDa/+dpEJcsJfRcYFUlyIHzzfPGowGQnRxmRGEpaMhCq43nuZfcYBMbH fT1b2G+kV3BbgZ5RjYPBBEiX8vqZbhoWe06pLrl3CWAEFO3IBWbuTpMn8ELLGGesSVHH FBfsptsXfwPJI++ZX3TRYKXGsxhQwBvam5BdQLw4jqD7KuJiRUPTUkV9wtXiXNH+T/ZR g3atH5c5vkAYWGcDZeJ0ss+07KH/ZT/fTYW9it6RXPgYZ+WxCNfhuwR39/7cM4OmiZHT bpy8atTIV4nIsLUzOdyguq+JcNNcnOaQ1iq0dcHtqNYhKVgmVxPSfp5tVq+/0m3EZI58 22/g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=Bvl6PS1gTIZjKX5IgVATPY2Q+mSOxBb+1oumIs0WQ+M=; b=mXxIKqy9i7weoA/A5Cq9xIT9Y7qlrSvPCI8SqJZn/4qdvJjTHmTJ19k7D9sliQEvn1 +Y4H8ihgFjc1Q5mMhtWt6beyq/UGqkRriGxPG7JDjcyP4K5DsTz6LbahaJHM4uyefFYA fadh/BjO4e+GjTm897KNfj8FGbRZlFeOP9Jf8nQ97KLVWaTgfwewCF70ExJ5ziWEwxZv rD/6FrpEU7G1vxCjNHM2XyTdno0zX9zo7wzBUIY/QqHvRDDmgiX0zeNnfA4521lz0rtq t+xguGVdNCHp7Wp6E7Eoz8jAMg0XOIGHDm94bIGLPJbawUMuiAD2gsQJ9AqJkF/vCet5 sabg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ToUboGH3; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=Bvl6PS1gTIZjKX5IgVATPY2Q+mSOxBb+1oumIs0WQ+M=; b=JTOkXZALko4fIrZLCeUgRba+iqvxGnbGAty6GSKZ/up/SNyruYdFQFw85/l74acszF hyf4p81sjxFdtv0N5aQk3sI52HL1M1CMSX96xjVV5uBYF4tJUYy41M/rpZbOKfrG+Pzm CqBtP0W8bDCdC3pvAHATmVUXt3L6kKD/20cnY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Bvl6PS1gTIZjKX5IgVATPY2Q+mSOxBb+1oumIs0WQ+M=; b=eRsa4tdNl7bIwMkKcgxG1LtJdhYCv0oFtmLrpNDWJaDLWKdeV8MFJvOF9hcusENEJZ WkXaWSu3/KlzXk6cngOqXFoH2kyvAjPuxR9hG0f/P7bPpjQc545Npvy/Bzn76Sy/5BbP G2GyUJZ+aoWTBpp2bRJWCuNjak3HcvuH896kwP3N/IpfpFzfItehmKfLrGrbvUZWfDxd pE3aYLTonTKBNfnys5sAyYaIjPcAiGSJUgFWns8xeUgWg27JccRn2Q/Dizc63AFb41AZ WsZ+F69NT59HGH8jJB+mIIeUecQwIdxTJBzVWvOkgf0JX99B/GuUf6d9RoVUEv4Q8q/7 Yo2A== X-Gm-Message-State: ANoB5pkBcgXCJ2JrmrMvWpBeT21xRUcsi7WsePGN5AMV8MzZST/79msM BfYjh1nKmksYxw9nBuzfC8UOFH5a X-Google-Smtp-Source: AA0mqf6HWdImq0G7AMOH+NoJo7QroI5j1w228WVpzg1/2ilXEQrnMDtY3nBHhhd/Mkd2XEY8ZFxSPg== X-Received: by 2002:a62:648a:0:b0:572:76dd:3756 with SMTP id y132-20020a62648a000000b0057276dd3756mr79017869pfb.9.1670599582773; Fri, 09 Dec 2022 07:26:22 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:903:2151:b0:189:33cd:635 with SMTP id s17-20020a170903215100b0018933cd0635ls8487245ple.5.-pod-prod-gmail; Fri, 09 Dec 2022 07:26:21 -0800 (PST) X-Received: by 2002:a17:902:e34a:b0:189:58a7:be94 with SMTP id p10-20020a170902e34a00b0018958a7be94mr5332714plc.56.1670599581597; Fri, 09 Dec 2022 07:26:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670599581; cv=none; d=google.com; s=arc-20160816; b=nJdQCTG42nYwL6oaZnDoIcVG3P2FudciRaF0CVzYoc2Mh5iNNqYRtF5olpAZ1T1Nil s3fTkEhswYAud+DIXnjmX381gaq2/NUNttdXsFaUc9r1n3icgTmtpvXgrVkk5W3diLIi FOiCJokXtV1ISU1iSZotUJIqy9DSCdtJ4F2B1MpvpnYrUM1frvATEnjIAVML6Iaxjpvl 2VQKcpUFtF+RFIyOw44fOttB7XD39H+CzEmHV+vij+WLtataVJ444igqvrfppxGdAzj7 P4VmhHlCpumjKGRrFYVcKTEcmhAEECXLFZm3h80wvNCMUF0H414bSbntgEAWphZEXq96 AOaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=7alrY0O9Akksq12nbFzgGTxh+9A05HRUPxTUPucPztw=; b=aHwLN82Z4Ruw+klFh+dQMVv0z3Uch2A62+yBmOrWsEZouV86iIDWzPXTIznLyYrGtI nNgXiU0A+qnzHOJvD7a4bGCKbntZ/xyUSQlkpsyEs8d38El7i5FgMsBfAmi+TtJYvFAK LnBilJ6GrwdUZE9JXEqfjhDN2KyjBba0WBSR+jxexBnCDtJqV1Fwx9O8IUahesmPWQ7k V7izBvGWL17cqPO4VvAarhimEOKE23EtLzKWR3Zf3PTudlYa9N8PgeSKvFk9nfNqpOKF tGzk60++10vjz4MTc7q4IOB2MolZfbm1bXKijyRZUyHrjtkIVk57MxMMzREnyckrRJUz 1bzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ToUboGH3; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id c12-20020a170903234c00b00188b7e9da9csor1018120plh.145.2022.12.09.07.26.21 for <linux-amarula@amarulasolutions.com> (Google Transport Security); Fri, 09 Dec 2022 07:26:21 -0800 (PST) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a17:902:bb98:b0:188:edd2:318c with SMTP id m24-20020a170902bb9800b00188edd2318cmr6345852pls.26.1670599581253; Fri, 09 Dec 2022 07:26:21 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a809:6ba1:bbda:c542:ba0b]) by smtp.gmail.com with ESMTPSA id x14-20020a170902ec8e00b00188c5f0f9e9sm1477587plg.199.2022.12.09.07.26.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Dec 2022 07:26:20 -0800 (PST) From: Jagan Teki <jagan@amarulasolutions.com> To: Andrzej Hajda <andrzej.hajda@intel.com>, Inki Dae <inki.dae@samsung.com>, Marek Szyprowski <m.szyprowski@samsung.com>, Joonyoung Shim <jy0922.shim@samsung.com>, Seung-Woo Kim <sw0312.kim@samsung.com>, Kyungmin Park <kyungmin.park@samsung.com>, Frieder Schrempf <frieder.schrempf@kontron.de>, Fancy Fang <chen.fang@nxp.com>, Tim Harvey <tharvey@gateworks.com>, Michael Nazzareno Trimarchi <michael@amarulasolutions.com>, Adam Ford <aford173@gmail.com>, Neil Armstrong <narmstrong@linaro.org>, Robert Foss <robert.foss@linaro.org>, Laurent Pinchart <Laurent.pinchart@ideasonboard.com>, Tommaso Merciai <tommaso.merciai@amarulasolutions.com>, Marek Vasut <marex@denx.de> Cc: Matteo Lisi <matteo.lisi@engicam.com>, dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, NXP Linux Team <linux-imx@nxp.com>, linux-amarula <linux-amarula@amarulasolutions.com>, Jagan Teki <jagan@amarulasolutions.com> Subject: [PATCH v9 07/18] drm: bridge: samsung-dsim: Lookup OF-graph or Child node devices Date: Fri, 9 Dec 2022 20:53:32 +0530 Message-Id: <20221209152343.180139-8-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221209152343.180139-1-jagan@amarulasolutions.com> References: <20221209152343.180139-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ToUboGH3; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: <linux-amarula.amarulasolutions.com> X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/post>, <mailto:linux-amarula@amarulasolutions.com> List-Help: <https://support.google.com/a/amarulasolutions.com/bin/topic.py?topic=25838>, <mailto:linux-amarula+help@amarulasolutions.com> List-Archive: <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/> List-Unsubscribe: <mailto:googlegroups-manage+476853432473+unsubscribe@googlegroups.com>, <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/subscribe> |
| Series |
drm: bridge: Add Samsung MIPI DSIM bridge
|
|
Commit Message
Jagan Teki
Dec. 9, 2022, 3:23 p.m. UTC
The child devices in MIPI DSI can be binding with OF-graph
and also via child nodes.
The OF-graph interface represents the child devices via
remote and associated endpoint numbers like
dsi {
compatible = "fsl,imx8mm-mipi-dsim";
ports {
port@0 {
reg = <0>;
dsi_in_lcdif: endpoint@0 {
reg = <0>;
remote-endpoint = <&lcdif_out_dsi>;
};
};
port@1 {
reg = <1>;
dsi_out_bridge: endpoint {
remote-endpoint = <&bridge_in_dsi>;
};
};
};
The child node interface represents the child devices via
conventional child nodes on given DSI parent like
dsi {
compatible = "samsung,exynos5433-mipi-dsi";
ports {
port@0 {
reg = <0>;
dsi_to_mic: endpoint {
remote-endpoint = <&mic_to_dsi>;
};
};
};
panel@0 {
reg = <0>;
};
};
As Samsung DSIM bridge is common DSI IP across all Exynos DSI
and NXP i.MX8M host controllers, this patch adds support to
lookup the child devices whether its bindings on the associated
host represent OF-graph or child node interfaces.
v9, v8, v7, v6, v5, v4, v3:
* none
v2:
* new patch
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
drivers/gpu/drm/bridge/samsung-dsim.c | 38 +++++++++++++++++++++++++--
1 file changed, 36 insertions(+), 2 deletions(-)
Comments
On 12/9/22 16:23, Jagan Teki wrote: > The child devices in MIPI DSI can be binding with OF-graph > and also via child nodes. > > The OF-graph interface represents the child devices via > remote and associated endpoint numbers like > > dsi { > compatible = "fsl,imx8mm-mipi-dsim"; > > ports { > port@0 { > reg = <0>; > > dsi_in_lcdif: endpoint@0 { > reg = <0>; > remote-endpoint = <&lcdif_out_dsi>; > }; > }; > > port@1 { > reg = <1>; > > dsi_out_bridge: endpoint { > remote-endpoint = <&bridge_in_dsi>; > }; > }; > }; > > The child node interface represents the child devices via > conventional child nodes on given DSI parent like > > dsi { > compatible = "samsung,exynos5433-mipi-dsi"; > > ports { > port@0 { > reg = <0>; > > dsi_to_mic: endpoint { > remote-endpoint = <&mic_to_dsi>; > }; > }; > }; > > panel@0 { > reg = <0>; > }; > }; > > As Samsung DSIM bridge is common DSI IP across all Exynos DSI > and NXP i.MX8M host controllers, this patch adds support to > lookup the child devices whether its bindings on the associated > host represent OF-graph or child node interfaces. > > v9, v8, v7, v6, v5, v4, v3: > * none > > v2: > * new patch This looks like a good candidate for common/helper code which can be reused by other similar drivers.
On Sun, Dec 11, 2022 at 7:58 AM Marek Vasut <marex@denx.de> wrote: > > On 12/9/22 16:23, Jagan Teki wrote: > > The child devices in MIPI DSI can be binding with OF-graph > > and also via child nodes. > > > > The OF-graph interface represents the child devices via > > remote and associated endpoint numbers like > > > > dsi { > > compatible = "fsl,imx8mm-mipi-dsim"; > > > > ports { > > port@0 { > > reg = <0>; > > > > dsi_in_lcdif: endpoint@0 { > > reg = <0>; > > remote-endpoint = <&lcdif_out_dsi>; > > }; > > }; > > > > port@1 { > > reg = <1>; > > > > dsi_out_bridge: endpoint { > > remote-endpoint = <&bridge_in_dsi>; > > }; > > }; > > }; > > > > The child node interface represents the child devices via > > conventional child nodes on given DSI parent like > > > > dsi { > > compatible = "samsung,exynos5433-mipi-dsi"; > > > > ports { > > port@0 { > > reg = <0>; > > > > dsi_to_mic: endpoint { > > remote-endpoint = <&mic_to_dsi>; > > }; > > }; > > }; > > > > panel@0 { > > reg = <0>; > > }; > > }; > > > > As Samsung DSIM bridge is common DSI IP across all Exynos DSI > > and NXP i.MX8M host controllers, this patch adds support to > > lookup the child devices whether its bindings on the associated > > host represent OF-graph or child node interfaces. > > > > v9, v8, v7, v6, v5, v4, v3: > > * none > > > > v2: > > * new patch > > This looks like a good candidate for common/helper code which can be > reused by other similar drivers. Yes, I have responded to the same comment of yours in v7 [1]. It is hard to make this code work in a generic way. [1] https://lore.kernel.org/all/CAMty3ZBtRZ-vDPQYX+m8uWmsD+vmbFOnCGVba8swQ8GWtWaKJQ@mail.gmail.com/
On 12/11/22 06:42, Jagan Teki wrote: > On Sun, Dec 11, 2022 at 7:58 AM Marek Vasut <marex@denx.de> wrote: >> >> On 12/9/22 16:23, Jagan Teki wrote: >>> The child devices in MIPI DSI can be binding with OF-graph >>> and also via child nodes. >>> >>> The OF-graph interface represents the child devices via >>> remote and associated endpoint numbers like >>> >>> dsi { >>> compatible = "fsl,imx8mm-mipi-dsim"; >>> >>> ports { >>> port@0 { >>> reg = <0>; >>> >>> dsi_in_lcdif: endpoint@0 { >>> reg = <0>; >>> remote-endpoint = <&lcdif_out_dsi>; >>> }; >>> }; >>> >>> port@1 { >>> reg = <1>; >>> >>> dsi_out_bridge: endpoint { >>> remote-endpoint = <&bridge_in_dsi>; >>> }; >>> }; >>> }; >>> >>> The child node interface represents the child devices via >>> conventional child nodes on given DSI parent like >>> >>> dsi { >>> compatible = "samsung,exynos5433-mipi-dsi"; >>> >>> ports { >>> port@0 { >>> reg = <0>; >>> >>> dsi_to_mic: endpoint { >>> remote-endpoint = <&mic_to_dsi>; >>> }; >>> }; >>> }; >>> >>> panel@0 { >>> reg = <0>; >>> }; >>> }; >>> >>> As Samsung DSIM bridge is common DSI IP across all Exynos DSI >>> and NXP i.MX8M host controllers, this patch adds support to >>> lookup the child devices whether its bindings on the associated >>> host represent OF-graph or child node interfaces. >>> >>> v9, v8, v7, v6, v5, v4, v3: >>> * none >>> >>> v2: >>> * new patch >> >> This looks like a good candidate for common/helper code which can be >> reused by other similar drivers. > > Yes, I have responded to the same comment of yours in v7 [1]. It is > hard to make this code work in a generic way. It seems the patch adds a for_each...() loop and a function call. Should be easy enough to turn that into a helper. What am I missing ?
On Sun, Dec 11, 2022 at 11:36 PM Marek Vasut <marex@denx.de> wrote: > > On 12/11/22 06:42, Jagan Teki wrote: > > On Sun, Dec 11, 2022 at 7:58 AM Marek Vasut <marex@denx.de> wrote: > >> > >> On 12/9/22 16:23, Jagan Teki wrote: > >>> The child devices in MIPI DSI can be binding with OF-graph > >>> and also via child nodes. > >>> > >>> The OF-graph interface represents the child devices via > >>> remote and associated endpoint numbers like > >>> > >>> dsi { > >>> compatible = "fsl,imx8mm-mipi-dsim"; > >>> > >>> ports { > >>> port@0 { > >>> reg = <0>; > >>> > >>> dsi_in_lcdif: endpoint@0 { > >>> reg = <0>; > >>> remote-endpoint = <&lcdif_out_dsi>; > >>> }; > >>> }; > >>> > >>> port@1 { > >>> reg = <1>; > >>> > >>> dsi_out_bridge: endpoint { > >>> remote-endpoint = <&bridge_in_dsi>; > >>> }; > >>> }; > >>> }; > >>> > >>> The child node interface represents the child devices via > >>> conventional child nodes on given DSI parent like > >>> > >>> dsi { > >>> compatible = "samsung,exynos5433-mipi-dsi"; > >>> > >>> ports { > >>> port@0 { > >>> reg = <0>; > >>> > >>> dsi_to_mic: endpoint { > >>> remote-endpoint = <&mic_to_dsi>; > >>> }; > >>> }; > >>> }; > >>> > >>> panel@0 { > >>> reg = <0>; > >>> }; > >>> }; > >>> > >>> As Samsung DSIM bridge is common DSI IP across all Exynos DSI > >>> and NXP i.MX8M host controllers, this patch adds support to > >>> lookup the child devices whether its bindings on the associated > >>> host represent OF-graph or child node interfaces. > >>> > >>> v9, v8, v7, v6, v5, v4, v3: > >>> * none > >>> > >>> v2: > >>> * new patch > >> > >> This looks like a good candidate for common/helper code which can be > >> reused by other similar drivers. > > > > Yes, I have responded to the same comment of yours in v7 [1]. It is > > hard to make this code work in a generic way. > > It seems the patch adds a for_each...() loop and a function call. Should > be easy enough to turn that into a helper. What am I missing ? What I'm saying here is, initially, I added for_each in the existing drm_of_find_panel_or_bridge helper but it fails to handle all drm_of use cases generically. You can find more information on this commit 80253168dbfd. I keep this in mind and will see whether it can support the new dsi helper once this supported is merged. Hope I'm clear on it. Jagan.
diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index baad09b2daeb..a4379c2ccb77 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -1356,18 +1356,52 @@ static int samsung_dsim_host_attach(struct mipi_dsi_host *host, struct samsung_dsim *dsi = host_to_dsi(host); const struct samsung_dsim_plat_data *pdata = dsi->plat_data; struct device *dev = dsi->dev; + struct device_node *np = dev->of_node; + struct device_node *remote; struct drm_panel *panel; int ret; - panel = of_drm_find_panel(device->dev.of_node); + /** + * Devices can also be child nodes when we also control that device + * through the upstream device (ie, MIPI-DCS for a MIPI-DSI device). + * + * Lookup for a child node of the given parent that isn't either port + * or ports. + */ + for_each_available_child_of_node(np, remote) { + if (of_node_name_eq(remote, "port") || + of_node_name_eq(remote, "ports")) + continue; + + goto of_find_panel_or_bridge; + } + + /* + * 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 whether graph presents in the + * device-tree node. + */ + if (!of_graph_is_present(np)) + return -ENODEV; + + remote = of_graph_get_remote_node(np, 1, 0); + +of_find_panel_or_bridge: + if (!remote) + return -ENODEV; + + panel = of_drm_find_panel(remote); if (!IS_ERR(panel)) { dsi->out_bridge = devm_drm_panel_bridge_add(dev, panel); } else { - dsi->out_bridge = of_drm_find_bridge(device->dev.of_node); + dsi->out_bridge = of_drm_find_bridge(remote); if (!dsi->out_bridge) dsi->out_bridge = ERR_PTR(-EINVAL); } + of_node_put(remote); + if (IS_ERR(dsi->out_bridge)) { ret = PTR_ERR(dsi->out_bridge); DRM_DEV_ERROR(dev, "failed to find the bridge: %d\n", ret);