Lines Matching +full:string +full:- +full:array +full:- +full:property
1 // SPDX-License-Identifier: GPL-2.0
3 * property.c - Unified device property interface.
17 #include <linux/property.h>
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
36 * @dev: Device whose property is being checked
37 * @propname: Name of the property
39 * Check if property @propname is present in the device firmware description.
41 * Return: true if property @propname is present. Otherwise, returns false.
50 * fwnode_property_present - check if a property of a firmware node is present
51 * @fwnode: Firmware node whose property to check
52 * @propname: Name of the property
54 * Return: true if property @propname is present. Otherwise, returns false.
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
74 * @dev: Device to get the property of
75 * @propname: Name of the property
77 * @nval: Size of the @val array
79 * Function reads an array of u8 properties with @propname from the device
86 * %0 if the property was found (success),
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
102 * @dev: Device to get the property of
103 * @propname: Name of the property
105 * @nval: Size of the @val array
107 * Function reads an array of u16 properties with @propname from the device
114 * %0 if the property was found (success),
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
130 * @dev: Device to get the property of
131 * @propname: Name of the property
133 * @nval: Size of the @val array
135 * Function reads an array of u32 properties with @propname from the device
142 * %0 if the property was found (success),
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
158 * @dev: Device to get the property of
159 * @propname: Name of the property
161 * @nval: Size of the @val array
163 * Function reads an array of u64 properties with @propname from the device
170 * %0 if the property was found (success),
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
186 * @dev: Device to get the property of
187 * @propname: Name of the property
189 * @nval: Size of the @val array
191 * Function reads an array of string properties with @propname from the 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
214 * @dev: Device to get the property of
215 * @propname: Name of the property
218 * Function reads property @propname from the device firmware description and
219 * stores the value into @val if found. The value is checked to be a string.
221 * Return: %0 if the property was found (success),
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
236 * @dev: Device to get the property of
237 * @propname: Name of the property holding the array
238 * @string: String to look for
240 * Find a given string in a string array and if it is found return the
243 * Return: index, starting from %0, if the property was found (success),
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.
250 const char *string) in device_property_match_string() argument
252 return fwnode_property_match_string(dev_fwnode(dev), propname, string); in device_property_match_string()
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
278 * @propname: Name of the property
280 * @nval: Size of the @val array
282 * Read an array of u8 properties with @propname from @fwnode and stores them to
289 * %0 if the property was found (success),
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
307 * @propname: Name of the property
309 * @nval: Size of the @val array
311 * Read an array of u16 properties with @propname from @fwnode and store them to
318 * %0 if the property was found (success),
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
336 * @propname: Name of the property
338 * @nval: Size of the @val array
340 * Read an array of u32 properties with @propname from @fwnode store them to
347 * %0 if the property was found (success),
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
365 * @propname: Name of the property
367 * @nval: Size of the @val array
369 * Read an array of u64 properties with @propname from @fwnode and store them to
376 * %0 if the property was found (success),
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
394 * @propname: Name of the property
396 * @nval: Size of the @val array
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
434 * @propname: Name of the property
437 * Read property @propname from the given firmware node and store the value into
438 * @val if found. The value is checked to be a string.
440 * Return: %0 if the property was found (success),
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
458 * @propname: Name of the property holding the array
459 * @string: String to look for
461 * Find a given string in a string array and if it is found return the
464 * Return: index, starting from %0, if the property was found (success),
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.
471 const char *propname, const char *string) in fwnode_property_match_string() argument
481 return -ENODATA; in fwnode_property_match_string()
485 return -ENOMEM; in fwnode_property_match_string()
491 ret = match_string(values, nval, string); in fwnode_property_match_string()
493 ret = -ENODATA; in fwnode_property_match_string()
502 * fwnode_property_get_reference_args() - Find a reference with arguments
504 * @prop: The name of the property
505 * @nargs_prop: The name of the property telling the number of
508 * @nargs: Number of arguments. Ignored if @nargs_prop is non-NULL.
512 * Obtain a reference based on a named property in an fwnode, with
516 * @args->fwnode pointer.
519 * %-ENOENT when the index is out of bounds, the index has an empty
520 * reference or the property was not found
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
574 * fwnode_get_name - Return the name of a node
586 * fwnode_get_name_prefix - Return the prefix of node for printing purposes
598 * fwnode_get_parent - Return parent firwmare node
614 * fwnode_get_next_parent - Iterate to the node's parent
639 * fwnode_get_next_parent_dev - Find device of closest ancestor fwnode
667 * fwnode_count_parents - Return the number of parents a node has
685 * fwnode_get_nth_parent - Return an nth parent of a node
705 if (--depth == 0) in fwnode_get_nth_parent()
713 * fwnode_is_ancestor_of - Test if @ancestor is ancestor of @child
741 * fwnode_get_next_child_node - Return the next child node handle for a node
758 * fwnode_get_next_available_child_node - Return the next available child node handle for a node
786 * device_get_next_child_node - Return the next child node handle for a device
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
816 * @childname: String to match child node name against.
830 * device_get_named_child_node - Return first matching named child node handle
832 * @childname: String to match child node name against.
845 * fwnode_handle_get - Obtain a reference to a device node
863 * fwnode_handle_put - Drop reference to a device node
877 * fwnode_device_is_available - check if a device is available for use
898 * device_get_child_node_count - return the number of child nodes for device
931 * fwnode_get_phy_mode - Get phy mode for given firmware 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
986 * fwnode_irq_get - Get IRQ directly from a fwnode
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
1011 * Find a match to the string @name in the 'interrupt-names' string array
1014 * string.
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
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
1102 * fwnode_graph_get_remote_port_parent - Return fwnode of a remote device
1125 * fwnode_graph_get_remote_port - Return fwnode of a remote port
1141 * fwnode_graph_get_remote_endpoint - Return fwnode of a remote endpoint
1169 * fwnode_graph_get_endpoint_by_id - get endpoint by port and endpoint numbers
1236 * fwnode_graph_get_endpoint_count - Count endpoints on a device node
1261 * fwnode_graph_parse_endpoint - parse common endpoint node properties
1350 * fwnode_connection_find_match - Find connection from a device node
1380 * fwnode_connection_find_matches - Find connections from a device node
1385 * @matches: (Optional) array of pointers to fill with matches
1391 * through the @matches array.
1407 return -EINVAL; in fwnode_connection_find_matches()
1414 matches_len -= count_graph; in fwnode_connection_find_matches()