]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
usb: typec: function for checking cable plug orientation
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>
Wed, 27 Jun 2018 15:19:47 +0000 (18:19 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Jun 2018 10:52:07 +0000 (19:52 +0900)
This adds function typec_get_orientation() that can be used
for checking the current cable plug orientation.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/class.c
include/linux/usb/typec.h

index 633105917fa66e2c1c4662d551809c09dde1ddb1..3ef7b99b080f6809b7981eb032cd6019f0a9fe07 100644 (file)
@@ -1329,6 +1329,18 @@ int typec_set_orientation(struct typec_port *port,
 }
 EXPORT_SYMBOL_GPL(typec_set_orientation);
 
+/**
+ * typec_get_orientation - Get USB Type-C cable plug orientation
+ * @port: USB Type-C Port
+ *
+ * Get current cable plug orientation for @port.
+ */
+enum typec_orientation typec_get_orientation(struct typec_port *port)
+{
+       return port->orientation;
+}
+EXPORT_SYMBOL_GPL(typec_get_orientation);
+
 /**
  * typec_set_mode - Set mode of operation for USB Type-C connector
  * @port: USB Type-C port for the connector
index 15f8d9a50b317c466288fe6f817b49acc08bb4a0..6c33b53d116263badd8a67c4290dcf3890c3c13d 100644 (file)
@@ -265,6 +265,7 @@ 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);
+enum typec_orientation typec_get_orientation(struct typec_port *port);
 int typec_set_mode(struct typec_port *port, int mode);
 
 int typec_find_port_power_role(const char *name);