Lines Matching full:role

3  * USB Role Switch Support
11 #include <linux/usb/role.h>
28 enum usb_role role; member
50 ret = sysfs_create_link(&connector->kobj, &dev->kobj, "usb-role-switch"); in connector_bind()
59 sysfs_remove_link(&connector->kobj, "usb-role-switch"); in connector_unbind()
69 * usb_role_switch_set_role - Set USB role for a switch
70 * @sw: USB role switch
71 * @role: USB role to be switched to
73 * Set USB role @role for @sw.
75 int usb_role_switch_set_role(struct usb_role_switch *sw, enum usb_role role) in usb_role_switch_set_role() argument
87 ret = sw->set(sw, role); in usb_role_switch_set_role()
89 sw->role = role; in usb_role_switch_set_role()
100 * usb_role_switch_get_role - Get the USB role for a switch
101 * @sw: USB role switch
103 * Depending on the role-switch-driver this function returns either a cached
104 * value of the last set role, or reads back the actual value from the hardware.
108 enum usb_role role; in usb_role_switch_get_role() local
116 role = sw->get(sw); in usb_role_switch_get_role()
118 role = sw->role; in usb_role_switch_get_role()
122 return role; in usb_role_switch_get_role()
145 if (!fwnode_property_present(parent, "usb-role-switch")) { in usb_role_switch_is_parent()
156 * usb_role_switch_get - Find USB role switch linked with the caller
159 * Finds and returns role switch linked with @dev. The reference count for the
168 sw = device_connection_find_match(dev, "usb-role-switch", NULL, in usb_role_switch_get()
179 * fwnode_usb_role_switch_get - Find USB role switch linked with the caller
191 sw = fwnode_connection_find_match(fwnode, "usb-role-switch", in fwnode_usb_role_switch_get()
202 * @sw: USB Role Switch
216 * usb_role_switch_find_by_fwnode - Find USB role switch with its fwnode
217 * @fwnode: fwnode of the USB Role Switch
219 * Finds and returns role switch with @fwnode. The reference count for the
259 const char *usb_role_string(enum usb_role role) in usb_role_string() argument
261 if (role < 0 || role >= ARRAY_SIZE(usb_roles)) in usb_role_string()
264 return usb_roles[role]; in usb_role_string()
272 enum usb_role role = usb_role_switch_get_role(sw); in role_show() local
274 return sprintf(buf, "%s\n", usb_roles[role]); in role_show()
299 static DEVICE_ATTR_RW(role);
344 * usb_role_switch_register - Register USB Role Switch
348 * USB Role Switch is a device capable or choosing the role for USB connector.
349 * On platforms where the USB controller is dual-role capable, the controller
354 * Returns handle to a new role switch or ERR_PTR. The content of @desc is
387 dev_set_name(&sw->dev, "%s-role-switch", in usb_role_switch_register()
411 * usb_role_switch_unregister - Unregsiter USB Role Switch
412 * @sw: USB Role Switch
429 * @sw: USB Role Switch
440 * @sw: USB Role Switch
463 MODULE_DESCRIPTION("USB Role Class");