video: tegra20: dsi: check for panels among child nodes
authorSvyatoslav Ryhel <clamor95@gmail.com>
Sun, 24 Nov 2024 07:38:03 +0000 (09:38 +0200)
committerSvyatoslav Ryhel <clamor95@gmail.com>
Wed, 26 Feb 2025 11:06:02 +0000 (13:06 +0200)
Switch to Linux-like approach of DSI panel binding as a DSI
controllers child node.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
drivers/video/tegra20/tegra-dsi.c

index 6327266..53db5a2 100644 (file)
@@ -973,10 +973,22 @@ static int tegra_dsi_bridge_probe(struct udevice *dev)
                debug("%s: Cannot get avdd-dsi-csi-supply: error %d\n",
                      __func__, ret);
 
-       ret = uclass_get_device_by_phandle(UCLASS_PANEL, dev,
-                                          "panel", &priv->panel);
+       /* Check all DSI children */
+       device_foreach_child(priv->panel, dev) {
+               if (device_get_uclass_id(priv->panel) == UCLASS_PANEL)
+                       break;
+       }
+
+       /* if loop exits without panel device return error */
+       if (device_get_uclass_id(priv->panel) != UCLASS_PANEL) {
+               log_debug("%s: panel not found, ret %d\n", __func__, ret);
+               return -EINVAL;
+       }
+
+       ret = uclass_get_device_by_ofnode(UCLASS_PANEL, dev_ofnode(priv->panel),
+                                         &priv->panel);
        if (ret) {
-               printf("%s: Cannot get panel: error %d\n", __func__, ret);
+               log_debug("%s: Cannot get panel: error %d\n", __func__, ret);
                return log_ret(ret);
        }
 
@@ -1036,6 +1048,7 @@ U_BOOT_DRIVER(tegra_dsi) = {
        .id             = UCLASS_PANEL,
        .of_match       = tegra_dsi_bridge_ids,
        .ops            = &tegra_dsi_bridge_ops,
+       .bind           = dm_scan_fdt_dev,
        .probe          = tegra_dsi_bridge_probe,
        .plat_auto      = sizeof(struct tegra_dc_plat),
        .priv_auto      = sizeof(struct tegra_dsi_priv),