[PATCH v10 2/9] drm/bridge: fsl-ldb: Get the next non-panel bridge

Laurentiu Palcu laurentiu.palcu at oss.nxp.com
Tue Oct 6 05:21:57 PDT 2026


From: Liu Ying <victor.liu at nxp.com>

The next bridge in bridge chain could be a panel bridge or a non-panel
bridge.  Use devm_drm_of_get_bridge() to replace the combination
function calls of of_drm_find_panel() and devm_drm_panel_bridge_add()
to get either a panel bridge or a non-panel bridge, instead of getting
a panel bridge only.

Signed-off-by: Liu Ying <victor.liu at nxp.com>
Signed-off-by: Laurentiu Palcu <laurentiu.palcu at oss.nxp.com>
---
 drivers/gpu/drm/bridge/fsl-ldb.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/bridge/fsl-ldb.c b/drivers/gpu/drm/bridge/fsl-ldb.c
index 7ec84c81cd786..52ae7f5b63c7c 100644
--- a/drivers/gpu/drm/bridge/fsl-ldb.c
+++ b/drivers/gpu/drm/bridge/fsl-ldb.c
@@ -294,8 +294,8 @@ static const struct drm_bridge_funcs funcs = {
 static int fsl_ldb_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
-	struct device_node *panel_node;
 	struct device_node *remote1, *remote2;
+	struct drm_bridge *next_bridge;
 	struct fsl_ldb *fsl_ldb;
 	int dual_link;
 
@@ -318,19 +318,16 @@ static int fsl_ldb_probe(struct platform_device *pdev)
 	if (IS_ERR(fsl_ldb->regmap))
 		return PTR_ERR(fsl_ldb->regmap);
 
-	/* Locate the remote ports and the panel node */
+	/* Locate the remote ports. */
 	remote1 = of_graph_get_remote_node(dev->of_node, 1, 0);
 	remote2 = of_graph_get_remote_node(dev->of_node, 2, 0);
 	fsl_ldb->ch0_enabled = (remote1 != NULL);
 	fsl_ldb->ch1_enabled = (remote2 != NULL);
-	panel_node = of_node_get(remote1 ? remote1 : remote2);
 	of_node_put(remote1);
 	of_node_put(remote2);
 
-	if (!fsl_ldb->ch0_enabled && !fsl_ldb->ch1_enabled) {
-		of_node_put(panel_node);
-		return dev_err_probe(dev, -ENXIO, "No panel node found");
-	}
+	if (!fsl_ldb->ch0_enabled && !fsl_ldb->ch1_enabled)
+		return dev_err_probe(dev, -ENXIO, "No next bridge node found");
 
 	dev_dbg(dev, "Using %s\n",
 		fsl_ldb_is_dual(fsl_ldb) ? "dual-link mode" :
@@ -339,10 +336,14 @@ static int fsl_ldb_probe(struct platform_device *pdev)
 	if (of_property_present(dev->of_node, "nxp,enable-termination-resistor"))
 		fsl_ldb->use_termination_resistor = true;
 
-	fsl_ldb->bridge.next_bridge = of_drm_find_and_get_bridge(panel_node);
-	of_node_put(panel_node);
-	if (!fsl_ldb->bridge.next_bridge)
-		return -ENODEV;
+	next_bridge = of_drm_get_bridge_by_endpoint(dev->of_node,
+						    fsl_ldb->ch0_enabled ? 1 : 2,
+						    0);
+	if (IS_ERR(next_bridge))
+		return dev_err_probe(dev, PTR_ERR(next_bridge),
+				     "failed to get next bridge\n");
+
+	fsl_ldb->bridge.next_bridge = next_bridge;
 
 	if (fsl_ldb_is_dual(fsl_ldb)) {
 		struct device_node *port1, *port2;

-- 
2.53.0



More information about the linux-arm-kernel mailing list