]> www.infradead.org Git - users/willy/linux.git/commit
of: property: add of_graph_get_next_port()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Thu, 24 Oct 2024 02:20:02 +0000 (02:20 +0000)
committerRob Herring (Arm) <robh@kernel.org>
Thu, 24 Oct 2024 21:35:48 +0000 (16:35 -0500)
commit02ac5f9d6caec96071103f7c62b5117526e47b64
treef77b3063f748908f67a7e570fd2c53b48a2e1b3b
parent2e030910fa90a1e46333c092c8bd00746a911be5
of: property: add of_graph_get_next_port()

We have endpoint base functions
- of_graph_get_next_endpoint()
- of_graph_get_endpoint_count()
- for_each_endpoint_of_node()

Here, for_each_endpoint_of_node() loop finds each endpoints

ports {
port@0 {
(1) endpoint {...};
};
port@1 {
(2) endpoint {...};
};
...
};

In above case, it finds endpoint as (1) -> (2) -> ...

Basically, user/driver knows which port is used for what, but not in
all cases. For example on flexible/generic driver case, how many ports
are used is not fixed.

For example Sound Generic Card driver which is very flexible/generic and
used from many venders can't know how many ports are used, and used for
what, because it depends on each vender SoC and/or its used board.

And more, the port can have multi endpoints. For example Generic Sound
Card case, it supports many type of connection between CPU / Codec, and
some of them uses multi endpoint in one port. see below.

ports {
(A) port@0 {
(1) endpoint@0 {...};
(2) endpoint@1 {...};
};
(B) port@1 {
(3) endpoint {...};
};
...
};

Generic Sound Card want to handle each connection via "port" base instead
of "endpoint" base. But, it is very difficult to handle each "port" via
existing for_each_endpoint_of_node(). Because getting each "port" via
of_get_parent() from each "endpoint" doesn't work. For example in above
case, both (1) (2) endpoint has same "port" (= A).

Add "port" base functions.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87ldyeb5t9.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
drivers/of/property.c
include/linux/of_graph.h