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
605 * %-ENOTCONN when the remote firmware node exists but has not been
616 return -ENOENT; in fwnode_property_get_reference_args()
623 if (IS_ERR_OR_NULL(fwnode->secondary)) in fwnode_property_get_reference_args()
626 return fwnode_call_int_op(fwnode->secondary, get_reference_args, prop, nargs_prop, in fwnode_property_get_reference_args()
632 * fwnode_find_reference - Find named reference to a fwnode_handle
633 * @fwnode: Firmware node where to look for the reference
659 * fwnode_get_name - Return the name of a node
660 * @fwnode: The firmware node
662 * Return: a pointer to the node name, or %NULL.
671 * fwnode_get_name_prefix - Return the prefix of node for printing purposes
672 * @fwnode: The firmware node
674 * Return: the prefix of a node, intended to be printed right before the node.
683 * fwnode_name_eq - Return true if node name is equal
684 * @fwnode: The firmware node
685 * @name: The name to which to compare the node name
687 * Compare the name provided as an argument to the name of the node, stopping
689 * function is generally used for comparing node names while ignoring the
690 * possible unit address of the node.
692 * Return: true if the node name matches with the name provided in the @name
704 len = strchrnul(node_name, '@') - node_name; in fwnode_name_eq()
711 * fwnode_get_parent - Return parent firwmare node
717 * Return: parent firmware node of the given node if possible or %NULL if no
727 * fwnode_get_next_parent - Iterate to the node's parent
731 * on the passed node, making it suitable for iterating through a
732 * node's parents.
738 * Return: parent firmware node of the given node if possible or %NULL if no
752 * fwnode_count_parents - Return the number of parents a node has
753 * @fwnode: The node the parents of which are to be counted
755 * Return: the number of parents a node has.
770 * fwnode_get_nth_parent - Return an nth parent of a node
771 * @fwnode: The node the parent of which is requested
772 * @depth: Distance of the parent from the node
777 * Return: the nth parent of a node. If there is no parent at the requested
790 if (--depth == 0) in fwnode_get_nth_parent()
798 * fwnode_get_next_child_node - Return the next child node handle for a node
799 * @fwnode: Firmware node to find the next child node for.
800 * @child: Handle to one of the node's child nodes or a %NULL handle.
803 * fwnode pointer. Note that this function also puts a reference to @child
808 struct fwnode_handle *child) in fwnode_get_next_child_node() argument
815 /* Try to find a child in primary fwnode */ in fwnode_get_next_child_node()
816 next = fwnode_call_ptr_op(fwnode, get_next_child_node, child); in fwnode_get_next_child_node()
821 return fwnode_call_ptr_op(fwnode->secondary, get_next_child_node, child); in fwnode_get_next_child_node()
826 * fwnode_get_next_available_child_node - Return the next available child node handle for a node
827 * @fwnode: Firmware node to find the next child node for.
828 * @child: Handle to one of the node's child nodes or a %NULL handle.
831 * fwnode pointer. Note that this function also puts a reference to @child
836 struct fwnode_handle *child) in fwnode_get_next_available_child_node() argument
838 struct fwnode_handle *next_child = child; in fwnode_get_next_available_child_node()
854 * device_get_next_child_node - Return the next child node handle for a device
855 * @dev: Device to find the next child node for.
856 * @child: Handle to one of the device's child nodes or a %NULL handle.
859 * fwnode pointer. Note that this function also puts a reference to @child
863 struct fwnode_handle *child) in device_get_next_child_node() argument
865 return fwnode_get_next_child_node(dev_fwnode(dev), child); in device_get_next_child_node()
870 * fwnode_get_named_child_node - Return first matching named child node handle
871 * @fwnode: Firmware node to find the named child node for.
872 * @childname: String to match child node name against.
886 * device_get_named_child_node - Return first matching named child node handle
887 * @dev: Device to find the named child node for.
888 * @childname: String to match child node name against.
901 * fwnode_handle_get - Obtain a reference to a device node
902 * @fwnode: Pointer to the device node to obtain the reference to.
919 * fwnode_device_is_available - check if a device is available for use
924 * For fwnode node types that don't implement the .device_is_available()
940 * fwnode_get_child_node_count - return the number of child nodes for a given firmware node
941 * @fwnode: Pointer to the parent firmware node
943 * Return: the number of child nodes for a given firmware node.
947 struct fwnode_handle *child; in fwnode_get_child_node_count() local
950 fwnode_for_each_child_node(fwnode, child) in fwnode_get_child_node_count()
958 * fwnode_get_named_child_node_count - number of child nodes with given name
959 * @fwnode: Node which child nodes are counted.
960 * @name: String to match child node name against.
962 * Scan child nodes and count all the nodes with a specific name. Potential
963 * 'number' -ending after the 'at sign' for scanned names is ignored.
969 * Return: the number of child nodes with a matching name for a given device.
974 struct fwnode_handle *child; in fwnode_get_named_child_node_count() local
977 fwnode_for_each_named_child_node(fwnode, child, name) in fwnode_get_named_child_node_count()
1000 * fwnode_get_phy_mode - Get phy mode for given firmware node
1001 * @fwnode: Pointer to the given node
1003 * The function gets phy interface string from property 'phy-mode' or
1004 * 'phy-connection-type', and return its index in phy_modes table, or errno in
1012 err = fwnode_property_read_string(fwnode, "phy-mode", &pm); in fwnode_get_phy_mode()
1015 "phy-connection-type", &pm); in fwnode_get_phy_mode()
1023 return -ENODEV; in fwnode_get_phy_mode()
1028 * device_get_phy_mode - Get phy mode for given device
1031 * The function gets phy interface string from property 'phy-mode' or
1032 * 'phy-connection-type', and return its index in phy_modes table, or errno in
1042 * fwnode_iomap - Maps the memory mapped IO for a given fwnode
1043 * @fwnode: Pointer to the firmware node
1055 * fwnode_irq_get - Get IRQ directly from a fwnode
1056 * @fwnode: Pointer to the firmware node
1057 * @index: Zero-based index of the IRQ
1068 return -EINVAL; in fwnode_irq_get()
1075 * fwnode_irq_get_byname - Get IRQ from a fwnode using its name
1076 * @fwnode: Pointer to the firmware node
1080 * Find a match to the string @name in the 'interrupt-names' string array
1092 return -EINVAL; in fwnode_irq_get_byname()
1094 index = fwnode_property_match_string(fwnode, "interrupt-names", name); in fwnode_irq_get_byname()
1103 * fwnode_graph_get_next_endpoint - Get next endpoint firmware node
1104 * @fwnode: Pointer to the parent firmware node
1105 * @prev: Previous endpoint node or %NULL to get the first
1111 * Return: an endpoint firmware node pointer or %NULL if no more endpoints
1123 * an endpoint from fwnode->secondary, then we need to use the secondary in fwnode_graph_get_next_endpoint()
1139 ep = fwnode_graph_get_next_endpoint(parent->secondary, NULL); in fwnode_graph_get_next_endpoint()
1148 * fwnode_graph_get_port_parent - Return the device fwnode of a port endpoint
1149 * @endpoint: Endpoint firmware node of the port
1154 * Return: the firmware node of the device the @endpoint belongs to.
1171 * fwnode_graph_get_remote_port_parent - Return fwnode of a remote device
1172 * @fwnode: Endpoint firmware node pointing to the remote endpoint
1174 * Extracts firmware node of a remote device the @fwnode points to.
1194 * fwnode_graph_get_remote_port - Return fwnode of a remote port
1195 * @fwnode: Endpoint firmware node pointing to the remote endpoint
1197 * Extracts firmware node of a remote port the @fwnode points to.
1210 * fwnode_graph_get_remote_endpoint - Return fwnode of a remote endpoint
1211 * @fwnode: Endpoint firmware node pointing to the remote endpoint
1213 * Extracts firmware node of a remote endpoint the @fwnode points to.
1238 * fwnode_graph_get_endpoint_by_id - get endpoint by port and endpoint numbers
1240 * @port: identifier of the port node
1241 * @endpoint: identifier of the endpoint node under the port node
1305 * fwnode_graph_get_endpoint_count - Count endpoints on a device node
1306 * @fwnode: The node related to a device
1308 * Count endpoints in a device node.
1330 * fwnode_graph_parse_endpoint - parse common endpoint node properties
1334 * Parse @fwnode representing a graph endpoint node and store the
1359 struct fwnode_handle *node; in fwnode_graph_devcon_matches() local
1370 node = fwnode_graph_get_remote_port_parent(ep); in fwnode_graph_devcon_matches()
1371 if (!fwnode_device_is_available(node)) { in fwnode_graph_devcon_matches()
1372 fwnode_handle_put(node); in fwnode_graph_devcon_matches()
1376 ret = match(node, con_id, data); in fwnode_graph_devcon_matches()
1377 fwnode_handle_put(node); in fwnode_graph_devcon_matches()
1393 struct fwnode_handle *node; in fwnode_devcon_matches() local
1402 node = fwnode_find_reference(fwnode, con_id, i); in fwnode_devcon_matches()
1403 if (IS_ERR(node)) in fwnode_devcon_matches()
1406 ret = match(node, NULL, data); in fwnode_devcon_matches()
1407 fwnode_handle_put(node); in fwnode_devcon_matches()
1419 * fwnode_connection_find_match - Find connection from a device node
1420 * @fwnode: Device node with the connection
1426 * device node. @match will be used to convert the connection description to
1449 * fwnode_connection_find_matches - Find connections from a device node
1450 * @fwnode: Device node with the connection
1476 return -EINVAL; in fwnode_connection_find_matches()
1483 matches_len -= count_graph; in fwnode_connection_find_matches()