Lines Matching refs:fwnode
23 of_fwnode_handle(dev->of_node) : dev->fwnode;
30 of_fwnode_handle(dev->of_node) : dev->fwnode;
51 * @fwnode: Firmware node whose property to check
56 bool fwnode_property_present(const struct fwnode_handle *fwnode,
61 if (IS_ERR_OR_NULL(fwnode))
64 ret = fwnode_call_bool_op(fwnode, property_present, propname);
68 return fwnode_call_bool_op(fwnode->secondary, property_present, propname);
256 static int fwnode_property_read_int_array(const struct fwnode_handle *fwnode,
263 if (IS_ERR_OR_NULL(fwnode))
266 ret = fwnode_call_int_op(fwnode, property_read_int_array, propname,
271 return fwnode_call_int_op(fwnode->secondary, property_read_int_array, propname,
277 * @fwnode: Firmware node to get the property of
282 * Read an array of u8 properties with @propname from @fwnode and stores them to
296 int fwnode_property_read_u8_array(const struct fwnode_handle *fwnode,
299 return fwnode_property_read_int_array(fwnode, propname, sizeof(u8),
306 * @fwnode: Firmware node to get the property of
311 * Read an array of u16 properties with @propname from @fwnode and store them to
325 int fwnode_property_read_u16_array(const struct fwnode_handle *fwnode,
328 return fwnode_property_read_int_array(fwnode, propname, sizeof(u16),
335 * @fwnode: Firmware node to get the property of
340 * Read an array of u32 properties with @propname from @fwnode store them to
354 int fwnode_property_read_u32_array(const struct fwnode_handle *fwnode,
357 return fwnode_property_read_int_array(fwnode, propname, sizeof(u32),
364 * @fwnode: Firmware node to get the property of
369 * Read an array of u64 properties with @propname from @fwnode and store them to
383 int fwnode_property_read_u64_array(const struct fwnode_handle *fwnode,
386 return fwnode_property_read_int_array(fwnode, propname, sizeof(u64),
393 * @fwnode: Firmware node to get the property of
412 int fwnode_property_read_string_array(const struct fwnode_handle *fwnode,
418 if (IS_ERR_OR_NULL(fwnode))
421 ret = fwnode_call_int_op(fwnode, property_read_string_array, propname,
426 return fwnode_call_int_op(fwnode->secondary, property_read_string_array, propname,
433 * @fwnode: Firmware node to get the property of
446 int fwnode_property_read_string(const struct fwnode_handle *fwnode,
449 int ret = fwnode_property_read_string_array(fwnode, propname, val, 1);
457 * @fwnode: Firmware node to get the property of
470 int fwnode_property_match_string(const struct fwnode_handle *fwnode,
476 nval = fwnode_property_read_string_array(fwnode, propname, NULL, 0);
487 ret = fwnode_property_read_string_array(fwnode, propname, values, nval);
503 * @fwnode: Firmware node where to look for the reference
512 * Obtain a reference based on a named property in an fwnode, with
516 * @args->fwnode pointer.
523 int fwnode_property_get_reference_args(const struct fwnode_handle *fwnode,
530 if (IS_ERR_OR_NULL(fwnode))
533 ret = fwnode_call_int_op(fwnode, get_reference_args, prop, nargs_prop,
538 if (IS_ERR_OR_NULL(fwnode->secondary))
541 return fwnode_call_int_op(fwnode->secondary, get_reference_args, prop, nargs_prop,
548 * @fwnode: Firmware node where to look for the reference
555 * fwnode pointer.
557 * Return: a pointer to the reference fwnode, when found. Otherwise,
560 struct fwnode_handle *fwnode_find_reference(const struct fwnode_handle *fwnode,
567 ret = fwnode_property_get_reference_args(fwnode, name, NULL, 0, index,
569 return ret ? ERR_PTR(ret) : args.fwnode;
575 * @fwnode: The firmware node
579 const char *fwnode_get_name(const struct fwnode_handle *fwnode)
581 return fwnode_call_ptr_op(fwnode, get_name);
587 * @fwnode: The firmware node
592 const char *fwnode_get_name_prefix(const struct fwnode_handle *fwnode)
594 return fwnode_call_ptr_op(fwnode, get_name_prefix);
599 * @fwnode: Firmware whose parent is retrieved
602 * fwnode pointer.
607 struct fwnode_handle *fwnode_get_parent(const struct fwnode_handle *fwnode)
609 return fwnode_call_ptr_op(fwnode, get_parent);
615 * @fwnode: Firmware whose parent is retrieved
622 * fwnode pointer. Note that this function also puts a reference to @fwnode
628 struct fwnode_handle *fwnode_get_next_parent(struct fwnode_handle *fwnode)
630 struct fwnode_handle *parent = fwnode_get_parent(fwnode);
632 fwnode_handle_put(fwnode);
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
649 * Return: a pointer to the device of the @fwnode's closest ancestor.
651 struct device *fwnode_get_next_parent_dev(const struct fwnode_handle *fwnode)
656 fwnode_for_each_parent_node(fwnode, parent) {
668 * @fwnode: The node the parents of which are to be counted
672 unsigned int fwnode_count_parents(const struct fwnode_handle *fwnode)
677 fwnode_for_each_parent_node(fwnode, parent)
686 * @fwnode: The node the parent of which is requested
690 * fwnode pointer.
696 struct fwnode_handle *fwnode_get_nth_parent(struct fwnode_handle *fwnode,
702 return fwnode_handle_get(fwnode);
704 fwnode_for_each_parent_node(fwnode, parent) {
742 * @fwnode: Firmware node to find the next child node for.
746 * fwnode pointer. Note that this function also puts a reference to @child
750 fwnode_get_next_child_node(const struct fwnode_handle *fwnode,
753 return fwnode_call_ptr_op(fwnode, get_next_child_node, child);
759 * @fwnode: Firmware node to find the next child node for.
763 * fwnode pointer. Note that this function also puts a reference to @child
767 fwnode_get_next_available_child_node(const struct fwnode_handle *fwnode,
772 if (IS_ERR_OR_NULL(fwnode))
776 next_child = fwnode_get_next_child_node(fwnode, next_child);
791 * fwnode pointer. Note that this function also puts a reference to @child
797 const struct fwnode_handle *fwnode = dev_fwnode(dev);
800 if (IS_ERR_OR_NULL(fwnode))
803 /* Try to find a child in primary fwnode */
804 next = fwnode_get_next_child_node(fwnode, child);
809 return fwnode_get_next_child_node(fwnode->secondary, child);
815 * @fwnode: Firmware node to find the named child node for.
819 * fwnode pointer.
822 fwnode_get_named_child_node(const struct fwnode_handle *fwnode,
825 return fwnode_call_ptr_op(fwnode, get_named_child_node, childname);
835 * fwnode pointer.
846 * @fwnode: Pointer to the device node to obtain the reference to.
849 * fwnode pointer.
851 * Return: the fwnode handle.
853 struct fwnode_handle *fwnode_handle_get(struct fwnode_handle *fwnode)
855 if (!fwnode_has_op(fwnode, get))
856 return fwnode;
858 return fwnode_call_ptr_op(fwnode, get);
864 * @fwnode: Pointer to the device node to drop the reference to.
870 void fwnode_handle_put(struct fwnode_handle *fwnode)
872 fwnode_call_void_op(fwnode, put);
878 * @fwnode: Pointer to the fwnode of the device.
882 * For fwnode node types that don't implement the .device_is_available()
885 bool fwnode_device_is_available(const struct fwnode_handle *fwnode)
887 if (IS_ERR_OR_NULL(fwnode))
890 if (!fwnode_has_op(fwnode, device_is_available))
893 return fwnode_call_bool_op(fwnode, device_is_available);
932 * @fwnode: Pointer to the given node
938 int fwnode_get_phy_mode(const struct fwnode_handle *fwnode)
943 err = fwnode_property_read_string(fwnode, "phy-mode", &pm);
945 err = fwnode_property_read_string(fwnode,
973 * fwnode_iomap - Maps the memory mapped IO for a given fwnode
974 * @fwnode: Pointer to the firmware node
979 void __iomem *fwnode_iomap(struct fwnode_handle *fwnode, int index)
981 return fwnode_call_ptr_op(fwnode, iomap, index);
986 * fwnode_irq_get - Get IRQ directly from a fwnode
987 * @fwnode: Pointer to the firmware node
992 int fwnode_irq_get(const struct fwnode_handle *fwnode, unsigned int index)
996 ret = fwnode_call_int_op(fwnode, irq_get, index);
1006 * fwnode_irq_get_byname - Get IRQ from a fwnode using its name
1007 * @fwnode: Pointer to the firmware node
1018 int fwnode_irq_get_byname(const struct fwnode_handle *fwnode, const char *name)
1025 index = fwnode_property_match_string(fwnode, "interrupt-names", name);
1029 return fwnode_irq_get(fwnode, index);
1035 * @fwnode: Pointer to the parent firmware node
1039 * fwnode pointer. Note that this function also puts a reference to @prev
1046 fwnode_graph_get_next_endpoint(const struct fwnode_handle *fwnode,
1054 * an endpoint from fwnode->secondary, then we need to use the secondary
1055 * as parent rather than @fwnode.
1061 parent = fwnode;
1079 * fwnode_graph_get_port_parent - Return the device fwnode of a port endpoint
1083 * fwnode pointer.
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.
1108 * fwnode pointer.
1111 fwnode_graph_get_remote_port_parent(const struct fwnode_handle *fwnode)
1115 endpoint = fwnode_graph_get_remote_endpoint(fwnode);
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.
1131 * fwnode pointer.
1134 fwnode_graph_get_remote_port(const struct fwnode_handle *fwnode)
1136 return fwnode_get_next_parent(fwnode_graph_get_remote_endpoint(fwnode));
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.
1147 * fwnode pointer.
1150 fwnode_graph_get_remote_endpoint(const struct fwnode_handle *fwnode)
1152 return fwnode_call_ptr_op(fwnode, graph_get_remote_endpoint);
1170 * @fwnode: parent fwnode_handle containing the graph
1173 * @flags: fwnode lookup flags
1176 * fwnode pointer.
1178 * Return: the fwnode handle of the local endpoint corresponding the port and
1189 fwnode_graph_get_endpoint_by_id(const struct fwnode_handle *fwnode,
1197 fwnode_graph_for_each_endpoint(fwnode, ep) {
1237 * @fwnode: The node related to a device
1238 * @flags: fwnode lookup flags
1244 unsigned int fwnode_graph_get_endpoint_count(const struct fwnode_handle *fwnode,
1250 fwnode_graph_for_each_endpoint(fwnode, ep) {
1262 * @fwnode: pointer to endpoint fwnode_handle
1263 * @endpoint: pointer to the fwnode endpoint data structure
1265 * Parse @fwnode representing a graph endpoint node and store the
1267 * @fwnode.
1269 int fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,
1274 return fwnode_call_int_op(fwnode, graph_parse_endpoint, endpoint);
1284 static unsigned int fwnode_graph_devcon_matches(const struct fwnode_handle *fwnode,
1295 fwnode_graph_for_each_endpoint(fwnode, ep) {
1318 static unsigned int fwnode_devcon_matches(const struct fwnode_handle *fwnode,
1333 node = fwnode_find_reference(fwnode, con_id, i);
1351 * @fwnode: Device node with the connection
1356 * Find a connection with unique identifier @con_id between @fwnode and another
1360 void *fwnode_connection_find_match(const struct fwnode_handle *fwnode,
1367 if (!fwnode || !match)
1370 count = fwnode_graph_devcon_matches(fwnode, con_id, data, match, &ret, 1);
1374 count = fwnode_devcon_matches(fwnode, con_id, data, match, &ret, 1);
1381 * @fwnode: Device node with the connection
1389 * @fwnode and other device nodes. @match will be used to convert the
1398 int fwnode_connection_find_matches(const struct fwnode_handle *fwnode,
1406 if (!fwnode || !match)
1409 count_graph = fwnode_graph_devcon_matches(fwnode, con_id, data, match,
1417 count_ref = fwnode_devcon_matches(fwnode, con_id, data, match,