One option for the LVDS port of the LDB is to be connected to an
additional bridge, such as a LVDS to HDMI converter. Add support for
such case, along with the direct connection to a panel.

Signed-off-by: Francesco Valla <[email protected]>
---
I was trying to add display support for the i.MX93 FRDM on top of the
patch sent some time ago by Fabian Pflug [1], using some of the work
already done by Alexander Stein but not yet merged [2], but then I
noticed that the support for LVDS-HDMI converter bridges was missing
from the LDB driver already present for the i.MX93.

Not a fail of the driver itself, obviously, but I wonder if/how the
existing i.MX8MP setups (e.g.: [3]), which use the same driver, work
correclty. Unfortunately I don't have the i.MX8MP hardware to test them.

Anyhow, a patch for such setup is attached; it was tested on the i.MX93
FRDM using [1] and [2] plus some more devicetree modifications.

[1] 
https://lore.kernel.org/all/[email protected]
[2] 
https://lore.kernel.org/all/[email protected]
[3] 
https://elixir.bootlin.com/linux/v6.17.5/source/arch/arm64/boot/dts/freescale/imx8mp-evk-lvds0-imx-dlvds-hdmi-channel0.dtso

Regards,
Francesco
---
 drivers/gpu/drm/bridge/fsl-ldb.c | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/bridge/fsl-ldb.c b/drivers/gpu/drm/bridge/fsl-ldb.c
index 
5c3cf37200bcee1db285c97e2b463c9355ee6acb..fad436f2e0bfac8b42096a6fcd0022da0f35284e
 100644
--- a/drivers/gpu/drm/bridge/fsl-ldb.c
+++ b/drivers/gpu/drm/bridge/fsl-ldb.c
@@ -294,7 +294,6 @@ 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;
 
@@ -335,15 +334,24 @@ static int fsl_ldb_probe(struct platform_device *pdev)
                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);
-       if (IS_ERR(fsl_ldb->panel_bridge))
-               return PTR_ERR(fsl_ldb->panel_bridge);
+       /* First try to get an additional bridge, if not found go for a panel */
+       fsl_ldb->panel_bridge = of_drm_find_bridge(panel_node);
+       if (fsl_ldb->panel_bridge) {
+               of_node_put(panel_node);
+       } else {
+               struct drm_panel *panel;
 
+               panel = of_drm_find_panel(panel_node);
+               of_node_put(panel_node);
+               if (IS_ERR(panel))
+                       return dev_err_probe(dev, PTR_ERR(panel),
+                                            "Failed to find panel");
+
+               fsl_ldb->panel_bridge = devm_drm_panel_bridge_add(dev, panel);
+               if (IS_ERR(fsl_ldb->panel_bridge))
+                       return dev_err_probe(dev, 
PTR_ERR(fsl_ldb->panel_bridge),
+                                            "Failed to add panel bridge");
+       }
 
        if (fsl_ldb_is_dual(fsl_ldb)) {
                struct device_node *port1, *port2;

---
base-commit: fd57572253bc356330dbe5b233c2e1d8426c66fd
change-id: 20251028-imx93_ldb_bridge-3c011e7856dc

Best regards,
-- 
Francesco Valla <[email protected]>

Reply via email to