Svyatoslav Ryhel | 2e23746 | 2025-02-15 19:46:29 +0200 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
| 2 | /* |
| 3 | * Copyright (c) 2025 Svyatoslav Ryhel <clamor95@gmail.com> |
| 4 | */ |
| 5 | |
| 6 | #ifndef _DM_OFNODE_GRAPH_H |
| 7 | #define _DM_OFNODE_GRAPH_H |
| 8 | |
| 9 | #include <dm/of.h> |
| 10 | |
| 11 | /** |
| 12 | * ofnode_graph_get_endpoint_count() - get the number of endpoints in a device ofnode |
| 13 | * @parent: ofnode to the device containing ports and endpoints |
| 14 | * |
| 15 | * Return: count of endpoint of this device ofnode |
| 16 | */ |
| 17 | unsigned int ofnode_graph_get_endpoint_count(ofnode parent); |
| 18 | |
| 19 | /** |
| 20 | * ofnode_graph_get_port_count() - get the number of port in a device or ports ofnode |
| 21 | * @parent: ofnode to the device or ports node |
| 22 | * |
| 23 | * Return: count of port of this device or ports node |
| 24 | */ |
| 25 | unsigned int ofnode_graph_get_port_count(ofnode parent); |
| 26 | |
| 27 | /** |
| 28 | * ofnode_graph_get_port_by_id() - get the port matching a given id |
| 29 | * @parent: parent ofnode |
| 30 | * @id: id of the port |
| 31 | * |
| 32 | * Return: ofnode in given port. |
| 33 | */ |
| 34 | ofnode ofnode_graph_get_port_by_id(ofnode parent, u32 id); |
| 35 | |
| 36 | /** |
| 37 | * ofnode_graph_get_endpoint_by_regs() - get the endpoint matching a given id |
| 38 | * @parent: parent ofnode |
| 39 | * @reg_id: id of the port |
| 40 | * @id: id for the endpoint |
| 41 | * |
| 42 | * Return: ofnode in given endpoint or NULL if not found. |
| 43 | * reg and port_reg are ignored when they are -1. |
| 44 | */ |
| 45 | ofnode ofnode_graph_get_endpoint_by_regs(ofnode parent, u32 reg_id, u32 id); |
| 46 | |
| 47 | /** |
| 48 | * ofnode_graph_get_remote_endpoint() - get remote endpoint node |
| 49 | * @endoint: ofnode of a local endpoint |
| 50 | * |
| 51 | * Return: Remote endpoint ofnode linked with local endpoint. |
| 52 | */ |
| 53 | ofnode ofnode_graph_get_remote_endpoint(ofnode endpoint); |
| 54 | |
| 55 | /** |
| 56 | * ofnode_graph_get_port_parent() - get port's parent node |
| 57 | * @endpoint: ofnode of a local endpoint |
| 58 | * |
| 59 | * Return: device ofnode associated with endpoint |
| 60 | */ |
| 61 | ofnode ofnode_graph_get_port_parent(ofnode endpoint); |
| 62 | |
| 63 | /** |
| 64 | * ofnode_graph_get_remote_port_parent() - get remote port's parent ofnode |
| 65 | * @endoint: ofnode of a local endpoint |
| 66 | * |
| 67 | * Return: device ofnode associated with endpoint linked to local endpoint. |
| 68 | */ |
| 69 | ofnode ofnode_graph_get_remote_port_parent(ofnode endpoint); |
| 70 | |
| 71 | /** |
| 72 | * ofnode_graph_get_remote_port() - get remote port ofnode |
| 73 | * @endoint: ofnode of a local endpoint |
| 74 | * |
| 75 | * Return: port ofnode associated with remote endpoint node linked |
| 76 | * to local endpoint. |
| 77 | */ |
| 78 | ofnode ofnode_graph_get_remote_port(ofnode endpoint); |
| 79 | |
| 80 | /** |
| 81 | * ofnode_graph_get_remote_node() - get remote parent ofnode for given port/endpoint |
| 82 | * @parent: parent ofnode containing graph port/endpoint |
| 83 | * @port: identifier (value of reg property) of the parent port ofnode |
| 84 | * @endpoint: identifier (value of reg property) of the endpoint ofnode |
| 85 | * |
| 86 | * Return: device ofnode associated with endpoint linked to local endpoint. |
| 87 | */ |
| 88 | ofnode ofnode_graph_get_remote_node(ofnode parent, u32 port, u32 endpoint); |
| 89 | |
| 90 | #endif |