Lines Matching refs:role

11 #include <linux/usb/role.h>
26 enum usb_role role;
48 ret = sysfs_create_link(&connector->kobj, &dev->kobj, "usb-role-switch");
57 sysfs_remove_link(&connector->kobj, "usb-role-switch");
67 * usb_role_switch_set_role - Set USB role for a switch
68 * @sw: USB role switch
69 * @role: USB role to be switched to
71 * Set USB role @role for @sw.
73 int usb_role_switch_set_role(struct usb_role_switch *sw, enum usb_role role)
85 ret = sw->set(sw, role);
87 sw->role = role;
98 * usb_role_switch_get_role - Get the USB role for a switch
99 * @sw: USB role switch
101 * Depending on the role-switch-driver this function returns either a cached
102 * value of the last set role, or reads back the actual value from the hardware.
106 enum usb_role role;
114 role = sw->get(sw);
116 role = sw->role;
120 return role;
143 if (!fwnode_property_present(parent, "usb-role-switch")) {
154 * usb_role_switch_get - Find USB role switch linked with the caller
157 * Finds and returns role switch linked with @dev. The reference count for the
166 sw = device_connection_find_match(dev, "usb-role-switch", NULL,
177 * fwnode_usb_role_switch_get - Find USB role switch linked with the caller
189 sw = fwnode_connection_find_match(fwnode, "usb-role-switch",
214 * usb_role_switch_find_by_fwnode - Find USB role switch with its fwnode
217 * Finds and returns role switch with @fwnode. The reference count for the
257 const char *usb_role_string(enum usb_role role)
259 if (role < 0 || role >= ARRAY_SIZE(usb_roles))
262 return usb_roles[role];
270 enum usb_role role = usb_role_switch_get_role(sw);
272 return sprintf(buf, "%s\n", usb_roles[role]);
297 static DEVICE_ATTR_RW(role);
344 * USB Role Switch is a device capable or choosing the role for USB connector.
345 * On platforms where the USB controller is dual-role capable, the controller
350 * Returns handle to a new role switch or ERR_PTR. The content of @desc is
382 dev_set_name(&sw->dev, "%s-role-switch",