Skip to content

Commit aaf3f4e

Browse files
Heikki Krogerusgregkh
authored andcommitted
usb: typec: function for checking cable plug orientation
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>
1 parent 82f5d77 commit aaf3f4e

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

drivers/usb/typec/class.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,6 +1329,18 @@ int typec_set_orientation(struct typec_port *port,
13291329
}
13301330
EXPORT_SYMBOL_GPL(typec_set_orientation);
13311331

1332+
/**
1333+
* typec_get_orientation - Get USB Type-C cable plug orientation
1334+
* @port: USB Type-C Port
1335+
*
1336+
* Get current cable plug orientation for @port.
1337+
*/
1338+
enum typec_orientation typec_get_orientation(struct typec_port *port)
1339+
{
1340+
return port->orientation;
1341+
}
1342+
EXPORT_SYMBOL_GPL(typec_get_orientation);
1343+
13321344
/**
13331345
* typec_set_mode - Set mode of operation for USB Type-C connector
13341346
* @port: USB Type-C port for the connector

include/linux/usb/typec.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ void typec_set_pwr_opmode(struct typec_port *port, enum typec_pwr_opmode mode);
265265

266266
int typec_set_orientation(struct typec_port *port,
267267
enum typec_orientation orientation);
268+
enum typec_orientation typec_get_orientation(struct typec_port *port);
268269
int typec_set_mode(struct typec_port *port, int mode);
269270

270271
int typec_find_port_power_role(const char *name);

0 commit comments

Comments
 (0)