diff options
author | Svyatoslav Ryhel <clamor95@gmail.com> | 2025-02-21 13:29:43 +0200 |
---|---|---|
committer | Svyatoslav Ryhel <clamor95@gmail.com> | 2025-03-13 19:13:17 +0200 |
commit | 82424ce784d77eba8be5c287297ae0f712db00ed (patch) | |
tree | b91d44797178bca0a42a26cda1509b9041835d3b | |
parent | 44144f1ba9abee9f6db368cdbab24174dfbd4ec1 (diff) |
video: bridge: tc358768: convert to use of_graph
Use OF graph parsing helpers to get linked panel.
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
-rw-r--r-- | drivers/video/bridge/tc358768.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/drivers/video/bridge/tc358768.c b/drivers/video/bridge/tc358768.c index b5d45e0e3c9..15bee19a152 100644 --- a/drivers/video/bridge/tc358768.c +++ b/drivers/video/bridge/tc358768.c @@ -6,6 +6,7 @@ #include <clk.h> #include <dm.h> +#include <dm/ofnode_graph.h> #include <i2c.h> #include <log.h> #include <mipi_display.h> @@ -877,6 +878,26 @@ static int tc358768_panel_timings(struct udevice *dev, return 0; } +static int tc358768_get_panel(struct udevice *dev) +{ + struct tc358768_priv *priv = dev_get_priv(dev); + int i, ret; + + u32 num = ofnode_graph_get_port_count(dev_ofnode(dev)); + + for (i = 0; i < num; i++) { + ofnode remote = ofnode_graph_get_remote_node(dev_ofnode(dev), i, -1); + + ret = uclass_get_device_by_ofnode(UCLASS_PANEL, remote, + &priv->panel); + if (!ret) + return 0; + } + + /* If this point is reached, no panels were found */ + return -ENODEV; +} + static int tc358768_setup(struct udevice *dev) { struct tc358768_priv *priv = dev_get_priv(dev); @@ -893,11 +914,10 @@ static int tc358768_setup(struct udevice *dev) return ret; } - ret = uclass_get_device_by_phandle(UCLASS_PANEL, dev, - "panel", &priv->panel); + ret = tc358768_get_panel(dev); if (ret) { - log_debug("%s: Cannot get panel: ret=%d\n", __func__, ret); - return log_ret(ret); + log_debug("%s: panel not found, ret %d\n", __func__, ret); + return ret; } panel_get_display_timing(priv->panel, &priv->timing); @@ -976,6 +996,7 @@ U_BOOT_DRIVER(tc358768) = { .id = UCLASS_VIDEO_BRIDGE, .of_match = tc358768_ids, .ops = &tc358768_ops, + .bind = dm_scan_fdt_dev, .probe = tc358768_probe, .priv_auto = sizeof(struct tc358768_priv), }; |