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

1 // SPDX-License-Identifier: GPL-2.0
3 * property.c - Unified device property interface.
23 return IS_ENABLED(CONFIG_OF) && dev->of_node ? in __dev_fwnode()
24 of_fwnode_handle(dev->of_node) : dev->fwnode; in __dev_fwnode()
30 return IS_ENABLED(CONFIG_OF) && dev->of_node ? in __dev_fwnode_const()
31 of_fwnode_handle(dev->of_node) : dev->fwnode; in __dev_fwnode_const()
36 * device_property_present - check if a property of a device is present
53 * fwnode_property_present - check if a property of a firmware node is present
54 * @fwnode: Firmware node whose property to check
57 * Check if property @propname is present in the firmware node description.
59 * in the firmware node description.
75 return fwnode_call_bool_op(fwnode->secondary, property_present, propname); in fwnode_property_present()
80 * device_property_read_bool - Return the value for a boolean property of a device
95 * fwnode_property_read_bool - Return the value for a boolean property of a firmware node
96 * @fwnode: Firmware node whose property to check
101 * Return: if property @propname is true or false in the firmware node description.
115 return fwnode_call_bool_op(fwnode->secondary, property_read_bool, propname); in fwnode_property_read_bool()
120 * device_property_read_u8_array - return a u8 array property of a device
134 * %-EINVAL if given arguments are not valid,
135 * %-ENODATA if the property does not have a value,
136 * %-EPROTO if the property is not an array of numbers,
137 * %-EOVERFLOW if the size of the property is not as expected.
138 * %-ENXIO if no suitable firmware interface is present.
148 * device_property_read_u16_array - return a u16 array property of a device
162 * %-EINVAL if given arguments are not valid,
163 * %-ENODATA if the property does not have a value,
164 * %-EPROTO if the property is not an array of numbers,
165 * %-EOVERFLOW if the size of the property is not as expected.
166 * %-ENXIO if no suitable firmware interface is present.
176 * device_property_read_u32_array - return a u32 array property of a device
190 * %-EINVAL if given arguments are not valid,
191 * %-ENODATA if the property does not have a value,
192 * %-EPROTO if the property is not an array of numbers,
193 * %-EOVERFLOW if the size of the property is not as expected.
194 * %-ENXIO if no suitable firmware interface is present.
204 * device_property_read_u64_array - return a u64 array property of a device
218 * %-EINVAL if given arguments are not valid,
219 * %-ENODATA if the property does not have a value,
220 * %-EPROTO if the property is not an array of numbers,
221 * %-EOVERFLOW if the size of the property is not as expected.
222 * %-ENXIO if no suitable firmware interface is present.
232 * device_property_read_string_array - return a string array property of device
244 * Return: number of values read on success if @val is non-NULL,
246 * %-EINVAL if given arguments are not valid,
247 * %-ENODATA if the property does not have a value,
248 * %-EPROTO or %-EILSEQ if the property is not an array of strings,
249 * %-EOVERFLOW if the size of the property is not as expected.
250 * %-ENXIO if no suitable firmware interface is present.
260 * device_property_read_string - return a string property of a device
269 * %-EINVAL if given arguments are not valid,
270 * %-ENODATA if the property does not have a value,
271 * %-EPROTO or %-EILSEQ if the property type is not a string.
272 * %-ENXIO if no suitable firmware interface is present.
282 * device_property_match_string - find a string in an array and return index
291 * %-EINVAL if given arguments are not valid,
292 * %-ENODATA if the property does not have a value,
293 * %-EPROTO if the property is not an array of strings,
294 * %-ENXIO if no suitable firmware interface is present.
311 return -EINVAL; in fwnode_property_read_int_array()
315 if (ret != -EINVAL) in fwnode_property_read_int_array()
318 return fwnode_call_int_op(fwnode->secondary, property_read_int_array, propname, in fwnode_property_read_int_array()
323 * fwnode_property_read_u8_array - return a u8 array property of firmware node
324 * @fwnode: Firmware node to get the property of
337 * %-EINVAL if given arguments are not valid,
338 * %-ENODATA if the property does not have a value,
339 * %-EPROTO if the property is not an array of numbers,
340 * %-EOVERFLOW if the size of the property is not as expected,
341 * %-ENXIO if no suitable firmware interface is present.
352 * fwnode_property_read_u16_array - return a u16 array property of firmware node
353 * @fwnode: Firmware node to get the property of
366 * %-EINVAL if given arguments are not valid,
367 * %-ENODATA if the property does not have a value,
368 * %-EPROTO if the property is not an array of numbers,
369 * %-EOVERFLOW if the size of the property is not as expected,
370 * %-ENXIO if no suitable firmware interface is present.
381 * fwnode_property_read_u32_array - return a u32 array property of firmware node
382 * @fwnode: Firmware node to get the property of
395 * %-EINVAL if given arguments are not valid,
396 * %-ENODATA if the property does not have a value,
397 * %-EPROTO if the property is not an array of numbers,
398 * %-EOVERFLOW if the size of the property is not as expected,
399 * %-ENXIO if no suitable firmware interface is present.
410 * fwnode_property_read_u64_array - return a u64 array property firmware node
411 * @fwnode: Firmware node to get the property of
424 * %-EINVAL if given arguments are not valid,
425 * %-ENODATA if the property does not have a value,
426 * %-EPROTO if the property is not an array of numbers,
427 * %-EOVERFLOW if the size of the property is not as expected,
428 * %-ENXIO if no suitable firmware interface is present.
439 * fwnode_property_read_string_array - return string array property of a node
440 * @fwnode: Firmware node to get the property of
445 * Read an string list property @propname from the given firmware node and store
451 * Return: number of values read on success if @val is non-NULL,
453 * %-EINVAL if given arguments are not valid,
454 * %-ENODATA if the property does not have a value,
455 * %-EPROTO or %-EILSEQ if the property is not an array of strings,
456 * %-EOVERFLOW if the size of the property is not as expected,
457 * %-ENXIO if no suitable firmware interface is present.
466 return -EINVAL; in fwnode_property_read_string_array()
470 if (ret != -EINVAL) in fwnode_property_read_string_array()
473 return fwnode_call_int_op(fwnode->secondary, property_read_string_array, propname, in fwnode_property_read_string_array()
479 * fwnode_property_read_string - return a string property of a firmware node
480 * @fwnode: Firmware node to get the property of
484 * Read property @propname from the given firmware node and store the value into
488 * %-EINVAL if given arguments are not valid,
489 * %-ENODATA if the property does not have a value,
490 * %-EPROTO or %-EILSEQ if the property is not a string,
491 * %-ENXIO if no suitable firmware interface is present.
503 * fwnode_property_match_string - find a string in an array and return index
504 * @fwnode: Firmware node to get the property of
512 * %-EINVAL if given arguments are not valid,
513 * %-ENODATA if the property does not have a value,
514 * %-EPROTO if the property is not an array of strings,
515 * %-ENXIO if no suitable firmware interface is present.
528 return -ENODATA; in fwnode_property_match_string()
532 return -ENOMEM; in fwnode_property_match_string()
540 ret = -ENODATA; in fwnode_property_match_string()
549 * fwnode_property_match_property_string - find a property string value in an array and return index
550 * @fwnode: Firmware node to get the property of
559 * %-ENOENT when the string value was not found in the @array,
560 * %-EINVAL if given arguments are not valid,
561 * %-ENODATA if the property does not have a value,
562 * %-EPROTO or %-EILSEQ if the property is not a string,
563 * %-ENXIO if no suitable firmware interface is present.
577 ret = -ENOENT; in fwnode_property_match_property_string()
584 * fwnode_property_get_reference_args() - Find a reference with arguments
585 * @fwnode: Firmware node where to look for the reference
588 * arguments in the referred node. NULL if @nargs is known,
590 * @nargs: Number of arguments. Ignored if @nargs_prop is non-NULL.
599 * @args->fwnode pointer.
602 * %-ENOENT when the index is out of bounds, the index has an empty
604 * %-EINVAL on parse error
614 return -ENOENT; in fwnode_property_get_reference_args()
621 if (IS_ERR_OR_NULL(fwnode->secondary)) in fwnode_property_get_reference_args()
624 return fwnode_call_int_op(fwnode->secondary, get_reference_args, prop, nargs_prop, in fwnode_property_get_reference_args()
630 * fwnode_find_reference - Find named reference to a fwnode_handle
631 * @fwnode: Firmware node where to look for the reference
657 * fwnode_get_name - Return the name of a node
658 * @fwnode: The firmware node
660 * Return: a pointer to the node name, or %NULL.
669 * fwnode_get_name_prefix - Return the prefix of node for printing purposes
670 * @fwnode: The firmware node
672 * Return: the prefix of a node, intended to be printed right before the node.
681 * fwnode_name_eq - Return true if node name is equal
682 * @fwnode: The firmware node
683 * @name: The name to which to compare the node name
685 * Compare the name provided as an argument to the name of the node, stopping
687 * function is generally used for comparing node names while ignoring the
688 * possible unit address of the node.
690 * Return: true if the node name matches with the name provided in the @name
702 len = strchrnul(node_name, '@') - node_name; in fwnode_name_eq()
709 * fwnode_get_parent - Return parent firwmare node
715 * Return: parent firmware node of the given node if possible or %NULL if no
725 * fwnode_get_next_parent - Iterate to the node's parent
729 * on the passed node, making it suitable for iterating through a
730 * node's parents.
736 * Return: parent firmware node of the given node if possible or %NULL if no
750 * fwnode_count_parents - Return the number of parents a node has
751 * @fwnode: The node the parents of which are to be counted
753 * Return: the number of parents a node has.
768 * fwnode_get_nth_parent - Return an nth parent of a node
769 * @fwnode: The node the parent of which is requested
770 * @depth: Distance of the parent from the node
775 * Return: the nth parent of a node. If there is no parent at the requested
788 if (--depth == 0) in fwnode_get_nth_parent()
796 * fwnode_get_next_child_node - Return the next child node handle for a node
797 * @fwnode: Firmware node to find the next child node for.
798 * @child: Handle to one of the node's child nodes or a %NULL handle.
801 * fwnode pointer. Note that this function also puts a reference to @child
806 struct fwnode_handle *child) in fwnode_get_next_child_node() argument
813 /* Try to find a child in primary fwnode */ in fwnode_get_next_child_node()
814 next = fwnode_call_ptr_op(fwnode, get_next_child_node, child); in fwnode_get_next_child_node()
819 return fwnode_call_ptr_op(fwnode->secondary, get_next_child_node, child); in fwnode_get_next_child_node()
824 * fwnode_get_next_available_child_node - Return the next available child node handle for a node
825 * @fwnode: Firmware node to find the next child node for.
826 * @child: Handle to one of the node's child nodes or a %NULL handle.
829 * fwnode pointer. Note that this function also puts a reference to @child
834 struct fwnode_handle *child) in fwnode_get_next_available_child_node() argument
836 struct fwnode_handle *next_child = child; in fwnode_get_next_available_child_node()
852 * device_get_next_child_node - Return the next child node handle for a device
853 * @dev: Device to find the next child node for.
854 * @child: Handle to one of the device's child nodes or a %NULL handle.
857 * fwnode pointer. Note that this function also puts a reference to @child
861 struct fwnode_handle *child) in device_get_next_child_node() argument
863 return fwnode_get_next_child_node(dev_fwnode(dev), child); in device_get_next_child_node()
868 * fwnode_get_named_child_node - Return first matching named child node handle
869 * @fwnode: Firmware node to find the named child node for.
870 * @childname: String to match child node name against.
884 * device_get_named_child_node - Return first matching named child node handle
885 * @dev: Device to find the named child node for.
886 * @childname: String to match child node name against.
899 * fwnode_handle_get - Obtain a reference to a device node
900 * @fwnode: Pointer to the device node to obtain the reference to.
917 * fwnode_device_is_available - check if a device is available for use
922 * For fwnode node types that don't implement the .device_is_available()
938 * fwnode_get_child_node_count - return the number of child nodes for a given firmware node
939 * @fwnode: Pointer to the parent firmware node
941 * Return: the number of child nodes for a given firmware node.
945 struct fwnode_handle *child; in fwnode_get_child_node_count() local
948 fwnode_for_each_child_node(fwnode, child) in fwnode_get_child_node_count()
956 * fwnode_get_named_child_node_count - number of child nodes with given name
957 * @fwnode: Node which child nodes are counted.
958 * @name: String to match child node name against.
960 * Scan child nodes and count all the nodes with a specific name. Potential
961 * 'number' -ending after the 'at sign' for scanned names is ignored.
967 * Return: the number of child nodes with a matching name for a given device.
972 struct fwnode_handle *child; in fwnode_get_named_child_node_count() local
975 fwnode_for_each_named_child_node(fwnode, child, name) in fwnode_get_named_child_node_count()
998 * fwnode_get_phy_mode - Get phy mode for given firmware node
999 * @fwnode: Pointer to the given node
1001 * The function gets phy interface string from property 'phy-mode' or
1002 * 'phy-connection-type', and return its index in phy_modes table, or errno in
1010 err = fwnode_property_read_string(fwnode, "phy-mode", &pm); in fwnode_get_phy_mode()
1013 "phy-connection-type", &pm); in fwnode_get_phy_mode()
1021 return -ENODEV; in fwnode_get_phy_mode()
1026 * device_get_phy_mode - Get phy mode for given device
1029 * The function gets phy interface string from property 'phy-mode' or
1030 * 'phy-connection-type', and return its index in phy_modes table, or errno in
1040 * fwnode_iomap - Maps the memory mapped IO for a given fwnode
1041 * @fwnode: Pointer to the firmware node
1053 * fwnode_irq_get - Get IRQ directly from a fwnode
1054 * @fwnode: Pointer to the firmware node
1055 * @index: Zero-based index of the IRQ
1066 return -EINVAL; in fwnode_irq_get()
1073 * fwnode_irq_get_byname - Get IRQ from a fwnode using its name
1074 * @fwnode: Pointer to the firmware node
1078 * Find a match to the string @name in the 'interrupt-names' string array
1090 return -EINVAL; in fwnode_irq_get_byname()
1092 index = fwnode_property_match_string(fwnode, "interrupt-names", name); in fwnode_irq_get_byname()
1101 * fwnode_graph_get_next_endpoint - Get next endpoint firmware node
1102 * @fwnode: Pointer to the parent firmware node
1103 * @prev: Previous endpoint node or %NULL to get the first
1109 * Return: an endpoint firmware node pointer or %NULL if no more endpoints
1121 * an endpoint from fwnode->secondary, then we need to use the secondary in fwnode_graph_get_next_endpoint()
1137 ep = fwnode_graph_get_next_endpoint(parent->secondary, NULL); in fwnode_graph_get_next_endpoint()
1146 * fwnode_graph_get_port_parent - Return the device fwnode of a port endpoint
1147 * @endpoint: Endpoint firmware node of the port
1152 * Return: the firmware node of the device the @endpoint belongs to.
1169 * fwnode_graph_get_remote_port_parent - Return fwnode of a remote device
1170 * @fwnode: Endpoint firmware node pointing to the remote endpoint
1172 * Extracts firmware node of a remote device the @fwnode points to.
1192 * fwnode_graph_get_remote_port - Return fwnode of a remote port
1193 * @fwnode: Endpoint firmware node pointing to the remote endpoint
1195 * Extracts firmware node of a remote port the @fwnode points to.
1208 * fwnode_graph_get_remote_endpoint - Return fwnode of a remote endpoint
1209 * @fwnode: Endpoint firmware node pointing to the remote endpoint
1211 * Extracts firmware node of a remote endpoint the @fwnode points to.
1236 * fwnode_graph_get_endpoint_by_id - get endpoint by port and endpoint numbers
1238 * @port: identifier of the port node
1239 * @endpoint: identifier of the endpoint node under the port node
1303 * fwnode_graph_get_endpoint_count - Count endpoints on a device node
1304 * @fwnode: The node related to a device
1306 * Count endpoints in a device node.
1328 * fwnode_graph_parse_endpoint - parse common endpoint node properties
1332 * Parse @fwnode representing a graph endpoint node and store the
1357 struct fwnode_handle *node; in fwnode_graph_devcon_matches() local
1368 node = fwnode_graph_get_remote_port_parent(ep); in fwnode_graph_devcon_matches()
1369 if (!fwnode_device_is_available(node)) { in fwnode_graph_devcon_matches()
1370 fwnode_handle_put(node); in fwnode_graph_devcon_matches()
1374 ret = match(node, con_id, data); in fwnode_graph_devcon_matches()
1375 fwnode_handle_put(node); in fwnode_graph_devcon_matches()
1391 struct fwnode_handle *node; in fwnode_devcon_matches() local
1400 node = fwnode_find_reference(fwnode, con_id, i); in fwnode_devcon_matches()
1401 if (IS_ERR(node)) in fwnode_devcon_matches()
1404 ret = match(node, NULL, data); in fwnode_devcon_matches()
1405 fwnode_handle_put(node); in fwnode_devcon_matches()
1417 * fwnode_connection_find_match - Find connection from a device node
1418 * @fwnode: Device node with the connection
1424 * device node. @match will be used to convert the connection description to
1447 * fwnode_connection_find_matches - Find connections from a device node
1448 * @fwnode: Device node with the connection
1474 return -EINVAL; in fwnode_connection_find_matches()
1481 matches_len -= count_graph; in fwnode_connection_find_matches()