Lines Matching refs:fwnode
24 &dev->of_node->fwnode : dev->fwnode;
43 * @fwnode: Firmware node whose property to check
46 bool fwnode_property_present(const struct fwnode_handle *fwnode,
51 ret = fwnode_call_bool_op(fwnode, property_present, propname);
52 if (ret == false && !IS_ERR_OR_NULL(fwnode) &&
53 !IS_ERR_OR_NULL(fwnode->secondary))
54 ret = fwnode_call_bool_op(fwnode->secondary, property_present,
229 static int fwnode_property_read_int_array(const struct fwnode_handle *fwnode,
236 ret = fwnode_call_int_op(fwnode, property_read_int_array, propname,
238 if (ret == -EINVAL && !IS_ERR_OR_NULL(fwnode) &&
239 !IS_ERR_OR_NULL(fwnode->secondary))
241 fwnode->secondary, property_read_int_array, propname,
249 * @fwnode: Firmware node to get the property of
254 * Read an array of u8 properties with @propname from @fwnode and stores them to
265 int fwnode_property_read_u8_array(const struct fwnode_handle *fwnode,
268 return fwnode_property_read_int_array(fwnode, propname, sizeof(u8),
275 * @fwnode: Firmware node to get the property of
280 * Read an array of u16 properties with @propname from @fwnode and store them to
291 int fwnode_property_read_u16_array(const struct fwnode_handle *fwnode,
294 return fwnode_property_read_int_array(fwnode, propname, sizeof(u16),
301 * @fwnode: Firmware node to get the property of
306 * Read an array of u32 properties with @propname from @fwnode store them to
317 int fwnode_property_read_u32_array(const struct fwnode_handle *fwnode,
320 return fwnode_property_read_int_array(fwnode, propname, sizeof(u32),
327 * @fwnode: Firmware node to get the property of
332 * Read an array of u64 properties with @propname from @fwnode and store them to
343 int fwnode_property_read_u64_array(const struct fwnode_handle *fwnode,
346 return fwnode_property_read_int_array(fwnode, propname, sizeof(u64),
353 * @fwnode: Firmware node to get the property of
369 int fwnode_property_read_string_array(const struct fwnode_handle *fwnode,
375 ret = fwnode_call_int_op(fwnode, property_read_string_array, propname,
377 if (ret == -EINVAL && !IS_ERR_OR_NULL(fwnode) &&
378 !IS_ERR_OR_NULL(fwnode->secondary))
379 ret = fwnode_call_int_op(fwnode->secondary,
388 * @fwnode: Firmware node to get the property of
401 int fwnode_property_read_string(const struct fwnode_handle *fwnode,
404 int ret = fwnode_property_read_string_array(fwnode, propname, val, 1);
412 * @fwnode: Firmware node to get the property of
425 int fwnode_property_match_string(const struct fwnode_handle *fwnode,
431 nval = fwnode_property_read_string_array(fwnode, propname, NULL, 0);
442 ret = fwnode_property_read_string_array(fwnode, propname, values, nval);
457 * @fwnode: Firmware node where to look for the reference
466 * Obtain a reference based on a named property in an fwnode, with
470 * args->fwnode pointer.
477 int fwnode_property_get_reference_args(const struct fwnode_handle *fwnode,
482 return fwnode_call_int_op(fwnode, get_reference_args, prop, nargs_prop,
489 * @fwnode: Firmware node where to look for the reference
495 * Returns pointer to the reference fwnode, or ERR_PTR. Caller is responsible to
496 * call fwnode_handle_put() on the returned fwnode pointer.
498 struct fwnode_handle *fwnode_find_reference(const struct fwnode_handle *fwnode,
505 ret = fwnode_property_get_reference_args(fwnode, name, NULL, 0, index,
507 return ret ? ERR_PTR(ret) : args.fwnode;
521 struct fwnode_handle *fwnode = dev_fwnode(dev);
523 if (!fwnode)
526 if (is_software_node(fwnode->secondary)) {
527 fwnode_remove_software_node(fwnode->secondary);
548 struct fwnode_handle *fwnode;
550 fwnode = fwnode_create_software_node(properties, NULL);
551 if (IS_ERR(fwnode))
552 return PTR_ERR(fwnode);
554 set_secondary_fwnode(dev, fwnode);
561 * @fwnode: The firmware node
565 const char *fwnode_get_name(const struct fwnode_handle *fwnode)
567 return fwnode_call_ptr_op(fwnode, get_name);
573 * @fwnode: The firmware node
578 const char *fwnode_get_name_prefix(const struct fwnode_handle *fwnode)
580 return fwnode_call_ptr_op(fwnode, get_name_prefix);
585 * @fwnode: Firmware whose parent is retrieved
590 struct fwnode_handle *fwnode_get_parent(const struct fwnode_handle *fwnode)
592 return fwnode_call_ptr_op(fwnode, get_parent);
598 * @fwnode: Firmware whose parent is retrieved
607 struct fwnode_handle *fwnode_get_next_parent(struct fwnode_handle *fwnode)
609 struct fwnode_handle *parent = fwnode_get_parent(fwnode);
611 fwnode_handle_put(fwnode);
619 * @fwnode: The node the parents of which are to be counted
623 unsigned int fwnode_count_parents(const struct fwnode_handle *fwnode)
628 __fwnode = fwnode_get_parent(fwnode);
639 * @fwnode: The node the parent of which is requested
649 struct fwnode_handle *fwnode_get_nth_parent(struct fwnode_handle *fwnode,
654 fwnode_handle_get(fwnode);
656 for (i = 0; i < depth && fwnode; i++)
657 fwnode = fwnode_get_next_parent(fwnode);
659 return fwnode;
665 * @fwnode: Firmware node to find the next child node for.
669 fwnode_get_next_child_node(const struct fwnode_handle *fwnode,
672 return fwnode_call_ptr_op(fwnode, get_next_child_node, child);
679 * @fwnode: Firmware node to find the next child node for.
683 fwnode_get_next_available_child_node(const struct fwnode_handle *fwnode,
688 if (!fwnode)
692 next_child = fwnode_get_next_child_node(fwnode, next_child);
711 struct fwnode_handle *fwnode = NULL, *next;
714 fwnode = &dev->of_node->fwnode;
716 fwnode = acpi_fwnode_handle(adev);
718 /* Try to find a child in primary fwnode */
719 next = fwnode_get_next_child_node(fwnode, child);
724 if (fwnode && !IS_ERR_OR_NULL(fwnode->secondary))
725 next = fwnode_get_next_child_node(fwnode->secondary, child);
733 * @fwnode: Firmware node to find the named child node for.
737 fwnode_get_named_child_node(const struct fwnode_handle *fwnode,
740 return fwnode_call_ptr_op(fwnode, get_named_child_node, childname);
758 * @fwnode: Pointer to the device node to obtain the reference to.
760 * Returns the fwnode handle.
762 struct fwnode_handle *fwnode_handle_get(struct fwnode_handle *fwnode)
764 if (!fwnode_has_op(fwnode, get))
765 return fwnode;
767 return fwnode_call_ptr_op(fwnode, get);
773 * @fwnode: Pointer to the device node to drop the reference to.
779 void fwnode_handle_put(struct fwnode_handle *fwnode)
781 fwnode_call_void_op(fwnode, put);
787 * @fwnode: Pointer to the fwnode of the device.
789 bool fwnode_device_is_available(const struct fwnode_handle *fwnode)
791 return fwnode_call_bool_op(fwnode, device_is_available);
842 * @fwnode: Pointer to the given node
848 int fwnode_get_phy_mode(struct fwnode_handle *fwnode)
853 err = fwnode_property_read_string(fwnode, "phy-mode", &pm);
855 err = fwnode_property_read_string(fwnode,
882 static void *fwnode_get_mac_addr(struct fwnode_handle *fwnode,
886 int ret = fwnode_property_read_u8_array(fwnode, name, addr, alen);
895 * @fwnode: Pointer to the firmware node
916 void *fwnode_get_mac_address(struct fwnode_handle *fwnode, char *addr, int alen)
920 res = fwnode_get_mac_addr(fwnode, "mac-address", addr, alen);
924 res = fwnode_get_mac_addr(fwnode, "local-mac-address", addr, alen);
928 return fwnode_get_mac_addr(fwnode, "address", addr, alen);
945 * fwnode_irq_get - Get IRQ directly from a fwnode
946 * @fwnode: Pointer to the firmware node
952 int fwnode_irq_get(struct fwnode_handle *fwnode, unsigned int index)
954 struct device_node *of_node = to_of_node(fwnode);
961 ret = acpi_irq_get(ACPI_HANDLE_FWNODE(fwnode), index, &res);
971 * @fwnode: Pointer to the parent firmware node
978 fwnode_graph_get_next_endpoint(const struct fwnode_handle *fwnode,
981 return fwnode_call_ptr_op(fwnode, graph_get_next_endpoint, prev);
986 * fwnode_graph_get_port_parent - Return the device fwnode of a port endpoint
1006 * fwnode_graph_get_remote_port_parent - Return fwnode of a remote device
1007 * @fwnode: Endpoint firmware node pointing to the remote endpoint
1009 * Extracts firmware node of a remote device the @fwnode points to.
1012 fwnode_graph_get_remote_port_parent(const struct fwnode_handle *fwnode)
1016 endpoint = fwnode_graph_get_remote_endpoint(fwnode);
1026 * fwnode_graph_get_remote_port - Return fwnode of a remote port
1027 * @fwnode: Endpoint firmware node pointing to the remote endpoint
1029 * Extracts firmware node of a remote port the @fwnode points to.
1032 fwnode_graph_get_remote_port(const struct fwnode_handle *fwnode)
1034 return fwnode_get_next_parent(fwnode_graph_get_remote_endpoint(fwnode));
1039 * fwnode_graph_get_remote_endpoint - Return fwnode of a remote endpoint
1040 * @fwnode: Endpoint firmware node pointing to the remote endpoint
1042 * Extracts firmware node of a remote endpoint the @fwnode points to.
1045 fwnode_graph_get_remote_endpoint(const struct fwnode_handle *fwnode)
1047 return fwnode_call_ptr_op(fwnode, graph_get_remote_endpoint);
1053 * @fwnode: pointer to parent fwnode_handle containing graph port/endpoint
1057 * Return: Remote fwnode handle associated with remote endpoint node linked
1061 fwnode_graph_get_remote_node(const struct fwnode_handle *fwnode, u32 port_id,
1066 while ((endpoint = fwnode_graph_get_next_endpoint(fwnode, endpoint))) {
1091 * @fwnode: parent fwnode_handle containing the graph
1094 * @flags: fwnode lookup flags
1096 * Return the fwnode handle of the local endpoint corresponding the port and
1110 fwnode_graph_get_endpoint_by_id(const struct fwnode_handle *fwnode,
1118 while ((ep = fwnode_graph_get_next_endpoint(fwnode, ep))) {
1166 * @fwnode: pointer to endpoint fwnode_handle
1167 * @endpoint: pointer to the fwnode endpoint data structure
1169 * Parse @fwnode representing a graph endpoint node and store the
1171 * @fwnode.
1173 int fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,
1178 return fwnode_call_int_op(fwnode, graph_parse_endpoint, endpoint);
1189 fwnode_graph_devcon_match(struct fwnode_handle *fwnode, const char *con_id,
1196 fwnode_graph_for_each_endpoint(fwnode, ep) {
1214 fwnode_devcon_match(struct fwnode_handle *fwnode, const char *con_id,
1222 node = fwnode_find_reference(fwnode, con_id, i);
1237 * @fwnode: Device node with the connection
1242 * Find a connection with unique identifier @con_id between @fwnode and another
1246 void *fwnode_connection_find_match(struct fwnode_handle *fwnode,
1252 if (!fwnode || !match)
1255 ret = fwnode_graph_devcon_match(fwnode, con_id, data, match);
1259 return fwnode_devcon_match(fwnode, con_id, data, match);