Skip to contentSkip to conversation

drm/bridge: fsl-ldb: support downstream bridges in addition to panels

PATCH In review Xiaolei Wang 2 participants 2 messages Apr 8 – Apr 16

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/bridge: fsl-ldb: support downstream bridges in addition to panels

The fsl-ldb driver currently only supports connecting to a drm_panel via of_drm_find_panel(). This prevents it from working with downstream bridge chips such as the ITE IT6263 LVDS-to-HDMI converter.

Replace of_drm_find_panel() + devm_drm_panel_bridge_add() with devm_drm_of_get_bridge(), which handles both panels and bridges.

This fixes the LVDS-to-HDMI display output path on i.MX8MP EVK.

---
 drivers/gpu/drm/bridge/fsl-ldb.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)
drivers/gpu/drm/bridge/fsl-ldb.c +3 -12
index 5c3cf37200bc..2936c945ba52 100644
@@ -292,9 +292,7 @@ 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_panel *panel;
 	struct fsl_ldb *fsl_ldb;
 	int dual_link;
 
@@ -322,25 +320,18 @@ static int fsl_ldb_probe(struct platform_device *pdev)
 	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);
+	if (!fsl_ldb->ch0_enabled && !fsl_ldb->ch1_enabled)
 		return dev_err_probe(dev, -ENXIO, "No panel node found");
-	}
 
 	dev_dbg(dev, "Using %s\n",
 		fsl_ldb_is_dual(fsl_ldb) ? "dual-link mode" :
 		fsl_ldb->ch0_enabled ? "channel 0" : "channel 1");
 
-	panel = of_drm_find_panel(panel_node);
-	of_node_put(panel_node);
-	if (IS_ERR(panel))
-		return PTR_ERR(panel);
-
-	fsl_ldb->panel_bridge = devm_drm_panel_bridge_add(dev, panel);
+	fsl_ldb->panel_bridge = devm_drm_of_get_bridge(dev, dev->of_node,
+						       fsl_ldb->ch0_enabled ? 1 : 2, 0);
 	if (IS_ERR(fsl_ldb->panel_bridge))
 		return PTR_ERR(fsl_ldb->panel_bridge);
 
Signature · 1 line
2.43.0
#1 lore raw

Hi Xiaolei,

Quoted 8 lines · Xiaolei Wang

The fsl-ldb driver currently only supports connecting to a drm_panel via of_drm_find_panel(). This prevents it from working with downstream bridge chips such as the ITE IT6263 LVDS-to-HDMI converter.

Replace of_drm_find_panel() + devm_drm_panel_bridge_add() with devm_drm_of_get_bridge(), which handles both panels and bridges.

This fixes the LVDS-to-HDMI display output path on i.MX8MP EVK.

There's already a patch sent out for this:
https://lore.kernel.org/all/[email protected]/

Quoted 52 lines
---
 drivers/gpu/drm/bridge/fsl-ldb.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)
drivers/gpu/drm/bridge/fsl-ldb.c +3 -12
index 5c3cf37200bc..2936c945ba52 100644
@@ -292,9 +292,7 @@ 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_panel *panel;
 	struct fsl_ldb *fsl_ldb;
 	int dual_link;
 
@@ -322,25 +320,18 @@ static int fsl_ldb_probe(struct platform_device *pdev)
 	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);
+	if (!fsl_ldb->ch0_enabled && !fsl_ldb->ch1_enabled)
 		return dev_err_probe(dev, -ENXIO, "No panel node found");
-	}
 
 	dev_dbg(dev, "Using %s\n",
 		fsl_ldb_is_dual(fsl_ldb) ? "dual-link mode" :
 		fsl_ldb->ch0_enabled ? "channel 0" : "channel 1");
 
-	panel = of_drm_find_panel(panel_node);
-	of_node_put(panel_node);
-	if (IS_ERR(panel))
-		return PTR_ERR(panel);
-
-	fsl_ldb->panel_bridge = devm_drm_panel_bridge_add(dev, panel);
+	fsl_ldb->panel_bridge = devm_drm_of_get_bridge(dev, dev->of_node,
+						       fsl_ldb->ch0_enabled ? 1 : 2, 0);
 	if (IS_ERR(fsl_ldb->panel_bridge))
 		return PTR_ERR(fsl_ldb->panel_bridge);
 
Signature · 1 line
2.43.0
Signature · 2 lines
Thanks,
Laurentiu