aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb/typec.h
diff options
context:
space:
mode:
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>2018-03-20 15:57:03 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-03-22 13:40:10 +0100
commitbdecb33af34f79cbfbb656661210f77c8b8b5b5f (patch)
tree057621e106f12ad7de132ebc5064c255f67a19c4 /include/linux/usb/typec.h
parentdrivers: base: Unified device connection lookup (diff)
downloadlinux-dev-bdecb33af34f79cbfbb656661210f77c8b8b5b5f.tar.xz
linux-dev-bdecb33af34f79cbfbb656661210f77c8b8b5b5f.zip
usb: typec: API for controlling USB Type-C Multiplexers
USB Type-C connectors consist of various muxes and switches that route the pins on the connector to the right locations. The USB Type-C drivers need to be able to control the muxes, as they are the ones that know things like the cable plug orientation, and the current mode that was negotiated with the partner. This introduces a small API for registering and controlling cable plug orientation switches, and separate small API for registering and controlling pin multiplexer/demultiplexer switches that are needed with Accessory/Alternate Modes. Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/usb/typec.h')
-rw-r--r--include/linux/usb/typec.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/usb/typec.h b/include/linux/usb/typec.h
index 0d44ce6af08f..2408e5c2ed91 100644
--- a/include/linux/usb/typec.h
+++ b/include/linux/usb/typec.h
@@ -60,6 +60,12 @@ enum typec_accessory {
#define TYPEC_MAX_ACCESSORY 3
+enum typec_orientation {
+ TYPEC_ORIENTATION_NONE,
+ TYPEC_ORIENTATION_NORMAL,
+ TYPEC_ORIENTATION_REVERSE,
+};
+
/*
* struct usb_pd_identity - USB Power Delivery identity data
* @id_header: ID Header VDO
@@ -185,6 +191,8 @@ struct typec_partner_desc {
* @pd_revision: USB Power Delivery Specification revision if supported
* @prefer_role: Initial role preference
* @accessory: Supported Accessory Modes
+ * @sw: Cable plug orientation switch
+ * @mux: Multiplexer switch for Alternate/Accessory Modes
* @fwnode: Optional fwnode of the port
* @try_role: Set data role preference for DRP port
* @dr_set: Set Data Role
@@ -202,6 +210,8 @@ struct typec_capability {
int prefer_role;
enum typec_accessory accessory[TYPEC_MAX_ACCESSORY];
+ struct typec_switch *sw;
+ struct typec_mux *mux;
struct fwnode_handle *fwnode;
int (*try_role)(const struct typec_capability *,
@@ -245,4 +255,8 @@ void typec_set_pwr_role(struct typec_port *port, enum typec_role role);
void typec_set_vconn_role(struct typec_port *port, enum typec_role role);
void typec_set_pwr_opmode(struct typec_port *port, enum typec_pwr_opmode mode);
+int typec_set_orientation(struct typec_port *port,
+ enum typec_orientation orientation);
+int typec_set_mode(struct typec_port *port, int mode);
+
#endif /* __LINUX_USB_TYPEC_H */