aboutsummaryrefslogtreecommitdiff
path: root/include/linux/usb/role.h
AgeCommit message (Collapse)AuthorFilesLines
2020-03-04usb: roles: Allow the role switches to be namedHeikki Krogerus1-0/+2
The switch devices have been named by using the name of the parent device as base for now, but if for example the parent device controls multiple muxes, that will not work. Adding an optional member "name" to the switch descriptor that can be used for naming the switch during registration. Signed-off-by: Heikki Krogerus <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2020-03-04usb: roles: Provide the switch drivers handle to the switch in the APIHeikki Krogerus1-2/+3
The USB role callback functions had a parameter pointing to the parent device (struct device) of the switch. The assumption was that the switch parent is always the controller. Firstly, that may not be true in every case, and secondly, it prevents us from supporting devices that supply multiple muxes. Changing the first parameter of usb_role_switch_set_t and usb_role_switch_get_t from struct device to struct usb_role_switch. Cc: Peter Chen <[email protected]> Cc: Felipe Balbi <[email protected]> Cc: Chunfeng Yun <[email protected]> Cc: Bin Liu <[email protected]> Signed-off-by: Heikki Krogerus <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2020-03-04usb: roles: Leave the private driver data pointer to the driversHeikki Krogerus1-0/+16
Adding usb_role_switch_get/set_drvdata() functions that the switch drivers can use for setting and getting private data pointer that is associated with the switch. Signed-off-by: Heikki Krogerus <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-11-04usb: roles: Add usb_role_switch_find_by_fwnode()Heikki Krogerus1-0/+3
Simple wrapper function that searches USB role switches with class_find_device_by_fwnode(). Signed-off-by: Heikki Krogerus <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Tested-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-09-03usb: roles: Add fwnode_usb_role_switch_get() functionHeikki Krogerus1-0/+7
The fwnode_usb_role_switch_get() function is exactly the same as usb_role_switch_get(), except that it takes struct fwnode_handle as parameter instead of struct device. Signed-off-by: Heikki Krogerus <[email protected]> Signed-off-by: Chunfeng Yun <[email protected]> Tested-by: Biju Das <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-09-03usb: roles: Introduce stubs for the exiting functions in role.hYu Chen1-0/+30
This patch adds stubs for the exiting functions while CONFIG_USB_ROLE_SWITCH does not enabled. Cc: Greg Kroah-Hartman <[email protected]> Cc: Heikki Krogerus <[email protected]> Cc: Hans de Goede <[email protected]> Cc: Andy Shevchenko <[email protected]> Cc: John Stultz <[email protected]> Reviewed-by: Heikki Krogerus <[email protected]> Signed-off-by: Yu Chen <[email protected]> Signed-off-by: Chunfeng Yun <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-02-14usb: roles: Find the muxes by also matching against the device nodeHeikki Krogerus1-0/+2
When the connections are defined in firmware, struct device_connection will have the fwnode member pointing to the device node (struct fwnode_handle) of the requested device, and the endpoint will not be used at all in that case. Acked-by: Hans de Goede <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Reviewed-by: Jun Li <[email protected]> Tested-by: Jun Li <[email protected]> Signed-off-by: Heikki Krogerus <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-03-22usb: common: Small class for USB role switchesHeikki Krogerus1-0/+53
USB role switch is a device that can be used to choose the data role for USB connector. With dual-role capable USB controllers, the controller itself will be the switch, but on some platforms the USB host and device controllers are separate IPs and there is a mux between them and the connector. On those platforms the mux driver will need to register the switch. With USB Type-C connectors, the host-to-device relationship is negotiated over the Configuration Channel (CC). That means the USB Type-C drivers need to be in control of the role switch. The class provides a simple API for the USB Type-C drivers for the control. For other types of USB connectors (mainly microAB) the class provides user space control via sysfs attribute file that can be used to request role swapping from the switch. Reviewed-by: Hans de Goede <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Heikki Krogerus <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>