Lines Matching +full:interface +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_match_property_string - find a property string value in an array and return index
503 * @fwnode: Firmware node to get the property of
512 * %-ENOENT when the string value was not found in the @array,
513 * %-EINVAL if given arguments are not valid,
514 * %-ENODATA if the property does not have a value,
515 * %-EPROTO or %-EILSEQ if the property is not a string,
516 * %-ENXIO if no suitable firmware interface is present.
530 ret = -ENOENT; in fwnode_property_match_property_string()
537 * fwnode_property_get_reference_args() - Find a reference with arguments
538 * @fwnode: Firmware node where to look for the reference
541 * arguments in the referred node. NULL if @nargs is known,
543 * @nargs: Number of arguments. Ignored if @nargs_prop is non-NULL.
552 * @args->fwnode pointer.
555 * %-ENOENT when the index is out of bounds, the index has an empty
557 * %-EINVAL on parse error
567 return -ENOENT; in fwnode_property_get_reference_args()
574 if (IS_ERR_OR_NULL(fwnode->secondary)) in fwnode_property_get_reference_args()
577 return fwnode_call_int_op(fwnode->secondary, get_reference_args, prop, nargs_prop, in fwnode_property_get_reference_args()
583 * fwnode_find_reference - Find named reference to a fwnode_handle
584 * @fwnode: Firmware node where to look for the reference
610 * fwnode_get_name - Return the name of a node
611 * @fwnode: The firmware node
613 * Return: a pointer to the node name, or %NULL.
622 * fwnode_get_name_prefix - Return the prefix of node for printing purposes
623 * @fwnode: The firmware node
625 * Return: the prefix of a node, intended to be printed right before the node.
634 * fwnode_name_eq - Return true if node name is equal
635 * @fwnode: The firmware node
636 * @name: The name to which to compare the node name
638 * Compare the name provided as an argument to the name of the node, stopping
640 * function is generally used for comparing node names while ignoring the
641 * possible unit address of the node.
643 * Return: true if the node name matches with the name provided in the @name
655 len = strchrnul(node_name, '@') - node_name; in fwnode_name_eq()
662 * fwnode_get_parent - Return parent firwmare node
668 * Return: parent firmware node of the given node if possible or %NULL if no
678 * fwnode_get_next_parent - Iterate to the node's parent
682 * on the passed node, making it suitable for iterating through a
683 * node's parents.
689 * Return: parent firmware node of the given node if possible or %NULL if no
703 * fwnode_get_next_parent_dev - Find device of closest ancestor fwnode
704 * @fwnode: firmware node
706 * Given a firmware node (@fwnode), this function finds its closest ancestor
707 * firmware node that has a corresponding struct device and returns that struct
731 * fwnode_count_parents - Return the number of parents a node has
732 * @fwnode: The node the parents of which are to be counted
734 * Return: the number of parents a node has.
749 * fwnode_get_nth_parent - Return an nth parent of a node
750 * @fwnode: The node the parent of which is requested
751 * @depth: Distance of the parent from the node
756 * Return: the nth parent of a node. If there is no parent at the requested
769 if (--depth == 0) in fwnode_get_nth_parent()
777 * fwnode_is_ancestor_of - Test if @ancestor is ancestor of @child
781 * A node is considered an ancestor of itself too.
805 * fwnode_get_next_child_node - Return the next child node handle for a node
806 * @fwnode: Firmware node to find the next child node for.
807 * @child: Handle to one of the node's child nodes or a %NULL handle.
822 * fwnode_get_next_available_child_node - Return the next available child node handle for a node
823 * @fwnode: Firmware node to find the next child node for.
824 * @child: Handle to one of the node's child nodes or a %NULL handle.
850 * device_get_next_child_node - Return the next child node handle for a device
851 * @dev: Device to find the next child node for.
873 return fwnode_get_next_child_node(fwnode->secondary, child); in device_get_next_child_node()
878 * fwnode_get_named_child_node - Return first matching named child node handle
879 * @fwnode: Firmware node to find the named child node for.
880 * @childname: String to match child node name against.
894 * device_get_named_child_node - Return first matching named child node handle
895 * @dev: Device to find the named child node for.
896 * @childname: String to match child node name against.
909 * fwnode_handle_get - Obtain a reference to a device node
910 * @fwnode: Pointer to the device node to obtain the reference to.
927 * fwnode_handle_put - Drop reference to a device node
928 * @fwnode: Pointer to the device node to drop the reference to.
931 * with break or return to prevent stale device node references from being left
941 * fwnode_device_is_available - check if a device is available for use
946 * For fwnode node types that don't implement the .device_is_available()
962 * device_get_child_node_count - return the number of child nodes for device
995 * fwnode_get_phy_mode - Get phy mode for given firmware node
996 * @fwnode: Pointer to the given node
998 * The function gets phy interface string from property 'phy-mode' or
999 * 'phy-connection-type', and return its index in phy_modes table, or errno in
1007 err = fwnode_property_read_string(fwnode, "phy-mode", &pm); in fwnode_get_phy_mode()
1010 "phy-connection-type", &pm); in fwnode_get_phy_mode()
1018 return -ENODEV; in fwnode_get_phy_mode()
1023 * device_get_phy_mode - Get phy mode for given device
1026 * The function gets phy interface string from property 'phy-mode' or
1027 * 'phy-connection-type', and return its index in phy_modes table, or errno in
1037 * fwnode_iomap - Maps the memory mapped IO for a given fwnode
1038 * @fwnode: Pointer to the firmware node
1050 * fwnode_irq_get - Get IRQ directly from a fwnode
1051 * @fwnode: Pointer to the firmware node
1052 * @index: Zero-based index of the IRQ
1063 return -EINVAL; in fwnode_irq_get()
1070 * fwnode_irq_get_byname - Get IRQ from a fwnode using its name
1071 * @fwnode: Pointer to the firmware node
1075 * Find a match to the string @name in the 'interrupt-names' string array
1087 return -EINVAL; in fwnode_irq_get_byname()
1089 index = fwnode_property_match_string(fwnode, "interrupt-names", name); in fwnode_irq_get_byname()
1098 * fwnode_graph_get_next_endpoint - Get next endpoint firmware node
1099 * @fwnode: Pointer to the parent firmware node
1100 * @prev: Previous endpoint node or %NULL to get the first
1106 * Return: an endpoint firmware node pointer or %NULL if no more endpoints
1118 * an endpoint from fwnode->secondary, then we need to use the secondary in fwnode_graph_get_next_endpoint()
1134 ep = fwnode_graph_get_next_endpoint(parent->secondary, NULL); in fwnode_graph_get_next_endpoint()
1143 * fwnode_graph_get_port_parent - Return the device fwnode of a port endpoint
1144 * @endpoint: Endpoint firmware node of the port
1149 * Return: the firmware node of the device the @endpoint belongs to.
1166 * fwnode_graph_get_remote_port_parent - Return fwnode of a remote device
1167 * @fwnode: Endpoint firmware node pointing to the remote endpoint
1169 * Extracts firmware node of a remote device the @fwnode points to.
1189 * fwnode_graph_get_remote_port - Return fwnode of a remote port
1190 * @fwnode: Endpoint firmware node pointing to the remote endpoint
1192 * Extracts firmware node of a remote port the @fwnode points to.
1205 * fwnode_graph_get_remote_endpoint - Return fwnode of a remote endpoint
1206 * @fwnode: Endpoint firmware node pointing to the remote endpoint
1208 * Extracts firmware node of a remote endpoint the @fwnode points to.
1233 * fwnode_graph_get_endpoint_by_id - get endpoint by port and endpoint numbers
1235 * @port: identifier of the port node
1236 * @endpoint: identifier of the endpoint node under the port node
1300 * fwnode_graph_get_endpoint_count - Count endpoints on a device node
1301 * @fwnode: The node related to a device
1303 * Count endpoints in a device node.
1325 * fwnode_graph_parse_endpoint - parse common endpoint node properties
1329 * Parse @fwnode representing a graph endpoint node and store the
1354 struct fwnode_handle *node; in fwnode_graph_devcon_matches() local
1365 node = fwnode_graph_get_remote_port_parent(ep); in fwnode_graph_devcon_matches()
1366 if (!fwnode_device_is_available(node)) { in fwnode_graph_devcon_matches()
1367 fwnode_handle_put(node); in fwnode_graph_devcon_matches()
1371 ret = match(node, con_id, data); in fwnode_graph_devcon_matches()
1372 fwnode_handle_put(node); in fwnode_graph_devcon_matches()
1388 struct fwnode_handle *node; in fwnode_devcon_matches() local
1397 node = fwnode_find_reference(fwnode, con_id, i); in fwnode_devcon_matches()
1398 if (IS_ERR(node)) in fwnode_devcon_matches()
1401 ret = match(node, NULL, data); in fwnode_devcon_matches()
1402 fwnode_handle_put(node); in fwnode_devcon_matches()
1414 * fwnode_connection_find_match - Find connection from a device node
1415 * @fwnode: Device node with the connection
1421 * device node. @match will be used to convert the connection description to
1444 * fwnode_connection_find_matches - Find connections from a device node
1445 * @fwnode: Device node with the connection
1471 return -EINVAL; in fwnode_connection_find_matches()
1478 matches_len -= count_graph; in fwnode_connection_find_matches()