Lines Matching refs:role
10 #include <linux/usb/role.h>
25 enum usb_role role;
40 * usb_role_switch_set_role - Set USB role for a switch
41 * @sw: USB role switch
42 * @role: USB role to be switched to
44 * Set USB role @role for @sw.
46 int usb_role_switch_set_role(struct usb_role_switch *sw, enum usb_role role)
58 ret = sw->set(sw, role);
60 sw->role = role;
71 * usb_role_switch_get_role - Get the USB role for a switch
72 * @sw: USB role switch
74 * Depending on the role-switch-driver this function returns either a cached
75 * value of the last set role, or reads back the actual value from the hardware.
79 enum usb_role role;
87 role = sw->get(sw);
89 role = sw->role;
93 return role;
116 if (!fwnode_property_present(parent, "usb-role-switch")) {
127 * usb_role_switch_get - Find USB role switch linked with the caller
130 * Finds and returns role switch linked with @dev. The reference count for the
139 sw = device_connection_find_match(dev, "usb-role-switch", NULL,
150 * fwnode_usb_role_switch_get - Find USB role switch linked with the caller
162 sw = fwnode_connection_find_match(fwnode, "usb-role-switch",
187 * usb_role_switch_find_by_fwnode - Find USB role switch with its fwnode
190 * Finds and returns role switch with @fwnode. The reference count for the
230 const char *usb_role_string(enum usb_role role)
232 if (role < 0 || role >= ARRAY_SIZE(usb_roles))
235 return usb_roles[role];
243 enum usb_role role = usb_role_switch_get_role(sw);
245 return sprintf(buf, "%s\n", usb_roles[role]);
270 static DEVICE_ATTR_RW(role);
317 * USB Role Switch is a device capable or choosing the role for USB connector.
318 * On platforms where the USB controller is dual-role capable, the controller
323 * Returns handle to a new role switch or ERR_PTR. The content of @desc is
355 dev_set_name(&sw->dev, "%s-role-switch",