Lines Matching +full:child +full:- +full:node

1 // SPDX-License-Identifier: GPL-2.0
3 * property.c - Unified device property interface.
22 return IS_ENABLED(CONFIG_OF) && dev->of_node ? in __dev_fwnode()
23 of_fwnode_handle(dev->of_node) : dev->fwnode; in __dev_fwnode()
29 return IS_ENABLED(CONFIG_OF) && dev->of_node ? in __dev_fwnode_const()
30 of_fwnode_handle(dev->of_node) : dev->fwnode; in __dev_fwnode_const()
35 * device_property_present - check if a property of a device is present
50 * fwnode_property_present - check if a property of a firmware node is present
51 * @fwnode: Firmware node whose property to check
68 return fwnode_call_bool_op(fwnode->secondary, property_present, propname); in fwnode_property_present()
73 * device_property_read_u8_array - return a u8 array property of a device
87 * %-EINVAL if given arguments are not valid,
88 * %-ENODATA if the property does not have a value,
89 * %-EPROTO if the property is not an array of numbers,
90 * %-EOVERFLOW if the size of the property is not as expected.
91 * %-ENXIO if no suitable firmware interface is present.
101 * device_property_read_u16_array - return a u16 array property of a device
115 * %-EINVAL if given arguments are not valid,
116 * %-ENODATA if the property does not have a value,
117 * %-EPROTO if the property is not an array of numbers,
118 * %-EOVERFLOW if the size of the property is not as expected.
119 * %-ENXIO if no suitable firmware interface is present.
129 * device_property_read_u32_array - return a u32 array property of a device
143 * %-EINVAL if given arguments are not valid,
144 * %-ENODATA if the property does not have a value,
145 * %-EPROTO if the property is not an array of numbers,
146 * %-EOVERFLOW if the size of the property is not as expected.
147 * %-ENXIO if no suitable firmware interface is present.
157 * device_property_read_u64_array - return a u64 array property of a device
171 * %-EINVAL if given arguments are not valid,
172 * %-ENODATA if the property does not have a value,
173 * %-EPROTO if the property is not an array of numbers,
174 * %-EOVERFLOW if the size of the property is not as expected.
175 * %-ENXIO if no suitable firmware interface is present.
185 * device_property_read_string_array - return a string array property of device
197 * Return: number of values read on success if @val is non-NULL,
199 * %-EINVAL if given arguments are not valid,
200 * %-ENODATA if the property does not have a value,
201 * %-EPROTO or %-EILSEQ if the property is not an array of strings,
202 * %-EOVERFLOW if the size of the property is not as expected.
203 * %-ENXIO if no suitable firmware interface is present.
213 * device_property_read_string - return a string property of a device
222 * %-EINVAL if given arguments are not valid,
223 * %-ENODATA if the property does not have a value,
224 * %-EPROTO or %-EILSEQ if the property type is not a string.
225 * %-ENXIO if no suitable firmware interface is present.
235 * device_property_match_string - find a string in an array and return index
244 * %-EINVAL if given arguments are not valid,
245 * %-ENODATA if the property does not have a value,
246 * %-EPROTO if the property is not an array of strings,
247 * %-ENXIO if no suitable firmware interface is present.
264 return -EINVAL; in fwnode_property_read_int_array()
268 if (ret != -EINVAL) in fwnode_property_read_int_array()
271 return fwnode_call_int_op(fwnode->secondary, property_read_int_array, propname, in fwnode_property_read_int_array()
276 * fwnode_property_read_u8_array - return a u8 array property of firmware node
277 * @fwnode: Firmware node to get the property of
290 * %-EINVAL if given arguments are not valid,
291 * %-ENODATA if the property does not have a value,
292 * %-EPROTO if the property is not an array of numbers,
293 * %-EOVERFLOW if the size of the property is not as expected,
294 * %-ENXIO if no suitable firmware interface is present.
305 * fwnode_property_read_u16_array - return a u16 array property of firmware node
306 * @fwnode: Firmware node to get the property of
319 * %-EINVAL if given arguments are not valid,
320 * %-ENODATA if the property does not have a value,
321 * %-EPROTO if the property is not an array of numbers,
322 * %-EOVERFLOW if the size of the property is not as expected,
323 * %-ENXIO if no suitable firmware interface is present.
334 * fwnode_property_read_u32_array - return a u32 array property of firmware node
335 * @fwnode: Firmware node to get the property of
348 * %-EINVAL if given arguments are not valid,
349 * %-ENODATA if the property does not have a value,
350 * %-EPROTO if the property is not an array of numbers,
351 * %-EOVERFLOW if the size of the property is not as expected,
352 * %-ENXIO if no suitable firmware interface is present.
363 * fwnode_property_read_u64_array - return a u64 array property firmware node
364 * @fwnode: Firmware node to get the property of
377 * %-EINVAL if given arguments are not valid,
378 * %-ENODATA if the property does not have a value,
379 * %-EPROTO if the property is not an array of numbers,
380 * %-EOVERFLOW if the size of the property is not as expected,
381 * %-ENXIO if no suitable firmware interface is present.
392 * fwnode_property_read_string_array - return string array property of a node
393 * @fwnode: Firmware node to get the property of
398 * Read an string list property @propname from the given firmware node and store
404 * Return: number of values read on success if @val is non-NULL,
406 * %-EINVAL if given arguments are not valid,
407 * %-ENODATA if the property does not have a value,
408 * %-EPROTO or %-EILSEQ if the property is not an array of strings,
409 * %-EOVERFLOW if the size of the property is not as expected,
410 * %-ENXIO if no suitable firmware interface is present.
419 return -EINVAL; in fwnode_property_read_string_array()
423 if (ret != -EINVAL) in fwnode_property_read_string_array()
426 return fwnode_call_int_op(fwnode->secondary, property_read_string_array, propname, in fwnode_property_read_string_array()
432 * fwnode_property_read_string - return a string property of a firmware node
433 * @fwnode: Firmware node to get the property of
437 * Read property @propname from the given firmware node and store the value into
441 * %-EINVAL if given arguments are not valid,
442 * %-ENODATA if the property does not have a value,
443 * %-EPROTO or %-EILSEQ if the property is not a string,
444 * %-ENXIO if no suitable firmware interface is present.
456 * fwnode_property_match_string - find a string in an array and return index
457 * @fwnode: Firmware node to get the property of
465 * %-EINVAL if given arguments are not valid,
466 * %-ENODATA if the property does not have a value,
467 * %-EPROTO if the property is not an array of strings,
468 * %-ENXIO if no suitable firmware interface is present.
481 return -ENODATA; in fwnode_property_match_string()
485 return -ENOMEM; in fwnode_property_match_string()
493 ret = -ENODATA; in fwnode_property_match_string()
502 * fwnode_property_get_reference_args() - Find a reference with arguments
503 * @fwnode: Firmware node where to look for the reference
506 * arguments in the referred node. NULL if @nargs is known,
508 * @nargs: Number of arguments. Ignored if @nargs_prop is non-NULL.
516 * @args->fwnode pointer.
519 * %-ENOENT when the index is out of bounds, the index has an empty
521 * %-EINVAL on parse error
531 return -ENOENT; in fwnode_property_get_reference_args()
538 if (IS_ERR_OR_NULL(fwnode->secondary)) in fwnode_property_get_reference_args()
541 return fwnode_call_int_op(fwnode->secondary, get_reference_args, prop, nargs_prop, in fwnode_property_get_reference_args()
547 * fwnode_find_reference - Find named reference to a fwnode_handle
548 * @fwnode: Firmware node where to look for the reference
574 * fwnode_get_name - Return the name of a node
575 * @fwnode: The firmware node
577 * Return: a pointer to the node name, or %NULL.
586 * fwnode_get_name_prefix - Return the prefix of node for printing purposes
587 * @fwnode: The firmware node
589 * Return: the prefix of a node, intended to be printed right before the node.
598 * fwnode_get_parent - Return parent firwmare node
604 * Return: parent firmware node of the given node if possible or %NULL if no
614 * fwnode_get_next_parent - Iterate to the node's parent
618 * on the passed node, making it suitable for iterating through a
619 * node's parents.
625 * Return: parent firmware node of the given node if possible or %NULL if no
639 * fwnode_get_next_parent_dev - Find device of closest ancestor fwnode
640 * @fwnode: firmware node
642 * Given a firmware node (@fwnode), this function finds its closest ancestor
643 * firmware node that has a corresponding struct device and returns that struct
667 * fwnode_count_parents - Return the number of parents a node has
668 * @fwnode: The node the parents of which are to be counted
670 * Return: the number of parents a node has.
685 * fwnode_get_nth_parent - Return an nth parent of a node
686 * @fwnode: The node the parent of which is requested
687 * @depth: Distance of the parent from the node
692 * Return: the nth parent of a node. If there is no parent at the requested
705 if (--depth == 0) in fwnode_get_nth_parent()
713 * fwnode_is_ancestor_of - Test if @ancestor is ancestor of @child
715 * @child: Firmware which is tested for being the child
717 * A node is considered an ancestor of itself too.
719 * Return: true if @ancestor is an ancestor of @child. Otherwise, returns false.
721 bool fwnode_is_ancestor_of(const struct fwnode_handle *ancestor, const struct fwnode_handle *child) in fwnode_is_ancestor_of() argument
728 if (child == ancestor) in fwnode_is_ancestor_of()
731 fwnode_for_each_parent_node(child, parent) { in fwnode_is_ancestor_of()
741 * fwnode_get_next_child_node - Return the next child node handle for a node
742 * @fwnode: Firmware node to find the next child node for.
743 * @child: Handle to one of the node's child nodes or a %NULL handle.
746 * fwnode pointer. Note that this function also puts a reference to @child
751 struct fwnode_handle *child) in fwnode_get_next_child_node() argument
753 return fwnode_call_ptr_op(fwnode, get_next_child_node, child); in fwnode_get_next_child_node()
758 * fwnode_get_next_available_child_node - Return the next available child node handle for a node
759 * @fwnode: Firmware node to find the next child node for.
760 * @child: Handle to one of the node's child nodes or a %NULL handle.
763 * fwnode pointer. Note that this function also puts a reference to @child
768 struct fwnode_handle *child) in fwnode_get_next_available_child_node() argument
770 struct fwnode_handle *next_child = child; in fwnode_get_next_available_child_node()
786 * device_get_next_child_node - Return the next child node handle for a device
787 * @dev: Device to find the next child node for.
788 * @child: Handle to one of the device's child nodes or a %NULL handle.
791 * fwnode pointer. Note that this function also puts a reference to @child
795 struct fwnode_handle *child) in device_get_next_child_node() argument
803 /* Try to find a child in primary fwnode */ in device_get_next_child_node()
804 next = fwnode_get_next_child_node(fwnode, child); in device_get_next_child_node()
809 return fwnode_get_next_child_node(fwnode->secondary, child); in device_get_next_child_node()
814 * fwnode_get_named_child_node - Return first matching named child node handle
815 * @fwnode: Firmware node to find the named child node for.
816 * @childname: String to match child node name against.
830 * device_get_named_child_node - Return first matching named child node handle
831 * @dev: Device to find the named child node for.
832 * @childname: String to match child node name against.
845 * fwnode_handle_get - Obtain a reference to a device node
846 * @fwnode: Pointer to the device node to obtain the reference to.
863 * fwnode_handle_put - Drop reference to a device node
864 * @fwnode: Pointer to the device node to drop the reference to.
867 * with break or return to prevent stale device node references from being left
877 * fwnode_device_is_available - check if a device is available for use
882 * For fwnode node types that don't implement the .device_is_available()
898 * device_get_child_node_count - return the number of child nodes for device
899 * @dev: Device to cound the child nodes for
901 * Return: the number of child nodes for a given device.
905 struct fwnode_handle *child; in device_get_child_node_count() local
908 device_for_each_child_node(dev, child) in device_get_child_node_count()
931 * fwnode_get_phy_mode - Get phy mode for given firmware node
932 * @fwnode: Pointer to the given node
934 * The function gets phy interface string from property 'phy-mode' or
935 * 'phy-connection-type', and return its index in phy_modes table, or errno in
943 err = fwnode_property_read_string(fwnode, "phy-mode", &pm); in fwnode_get_phy_mode()
946 "phy-connection-type", &pm); in fwnode_get_phy_mode()
954 return -ENODEV; in fwnode_get_phy_mode()
959 * device_get_phy_mode - Get phy mode for given device
962 * The function gets phy interface string from property 'phy-mode' or
963 * 'phy-connection-type', and return its index in phy_modes table, or errno in
973 * fwnode_iomap - Maps the memory mapped IO for a given fwnode
974 * @fwnode: Pointer to the firmware node
986 * fwnode_irq_get - Get IRQ directly from a fwnode
987 * @fwnode: Pointer to the firmware node
988 * @index: Zero-based index of the IRQ
999 return -EINVAL; in fwnode_irq_get()
1006 * fwnode_irq_get_byname - Get IRQ from a fwnode using its name
1007 * @fwnode: Pointer to the firmware node
1011 * Find a match to the string @name in the 'interrupt-names' string array
1023 return -EINVAL; in fwnode_irq_get_byname()
1025 index = fwnode_property_match_string(fwnode, "interrupt-names", name); in fwnode_irq_get_byname()
1034 * fwnode_graph_get_next_endpoint - Get next endpoint firmware node
1035 * @fwnode: Pointer to the parent firmware node
1036 * @prev: Previous endpoint node or %NULL to get the first
1042 * Return: an endpoint firmware node pointer or %NULL if no more endpoints
1054 * an endpoint from fwnode->secondary, then we need to use the secondary in fwnode_graph_get_next_endpoint()
1070 ep = fwnode_graph_get_next_endpoint(parent->secondary, NULL); in fwnode_graph_get_next_endpoint()
1079 * fwnode_graph_get_port_parent - Return the device fwnode of a port endpoint
1080 * @endpoint: Endpoint firmware node of the port
1085 * Return: the firmware node of the device the @endpoint belongs to.
1102 * fwnode_graph_get_remote_port_parent - Return fwnode of a remote device
1103 * @fwnode: Endpoint firmware node pointing to the remote endpoint
1105 * Extracts firmware node of a remote device the @fwnode points to.
1125 * fwnode_graph_get_remote_port - Return fwnode of a remote port
1126 * @fwnode: Endpoint firmware node pointing to the remote endpoint
1128 * Extracts firmware node of a remote port the @fwnode points to.
1141 * fwnode_graph_get_remote_endpoint - Return fwnode of a remote endpoint
1142 * @fwnode: Endpoint firmware node pointing to the remote endpoint
1144 * Extracts firmware node of a remote endpoint the @fwnode points to.
1169 * fwnode_graph_get_endpoint_by_id - get endpoint by port and endpoint numbers
1171 * @port: identifier of the port node
1172 * @endpoint: identifier of the endpoint node under the port node
1236 * fwnode_graph_get_endpoint_count - Count endpoints on a device node
1237 * @fwnode: The node related to a device
1239 * Count endpoints in a device node.
1261 * fwnode_graph_parse_endpoint - parse common endpoint node properties
1265 * Parse @fwnode representing a graph endpoint node and store the
1290 struct fwnode_handle *node; in fwnode_graph_devcon_matches() local
1301 node = fwnode_graph_get_remote_port_parent(ep); in fwnode_graph_devcon_matches()
1302 if (!fwnode_device_is_available(node)) { in fwnode_graph_devcon_matches()
1303 fwnode_handle_put(node); in fwnode_graph_devcon_matches()
1307 ret = match(node, con_id, data); in fwnode_graph_devcon_matches()
1308 fwnode_handle_put(node); in fwnode_graph_devcon_matches()
1324 struct fwnode_handle *node; in fwnode_devcon_matches() local
1333 node = fwnode_find_reference(fwnode, con_id, i); in fwnode_devcon_matches()
1334 if (IS_ERR(node)) in fwnode_devcon_matches()
1337 ret = match(node, NULL, data); in fwnode_devcon_matches()
1338 fwnode_handle_put(node); in fwnode_devcon_matches()
1350 * fwnode_connection_find_match - Find connection from a device node
1351 * @fwnode: Device node with the connection
1357 * device node. @match will be used to convert the connection description to
1380 * fwnode_connection_find_matches - Find connections from a device node
1381 * @fwnode: Device node with the connection
1407 return -EINVAL; in fwnode_connection_find_matches()
1414 matches_len -= count_graph; in fwnode_connection_find_matches()