dm: core: Add a helper to retrieve devices through graph endpoints
authorMiquel Raynal <miquel.raynal@bootlin.com>
Thu, 3 Apr 2025 07:39:03 +0000 (09:39 +0200)
committerFabio Estevam <festevam@gmail.com>
Fri, 11 Apr 2025 01:32:55 +0000 (22:32 -0300)
commit04fcddac28c9f28239f40c9b90e3e76ed5f5cb13
treeb09be132bdcedb8705ea2946657ba02158bd8ad9
parent9fe367bb60d377402617bb818796bff59e82e7c6
dm: core: Add a helper to retrieve devices through graph endpoints

There are already several helpers to find a udevice based on its
position in a device tree, like getting a child or a node pointed by a
phandle, but there was no support for graph endpoints, which are very
common in display pipelines.

Add a new helper, named uclass_get_device_by_endpoint() which enters the
child graph reprensentation, looks for a specific port, then follows the
remote endpoint, and finally retrieves the first parent of the given
uclass_id.

This is a very handy and straightforward way to get a bridge or a panel
handle.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/core/uclass.c
include/dm/uclass.h