summaryrefslogtreecommitdiffstats
path: root/include/linux/usb/typec.h
diff options
context:
space:
mode:
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>2022-05-02 16:20:56 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-06-12 06:49:47 +0200
commit662a60102c122e44fdaf5c826f7f415eb57d48ad (patch)
tree14316d839bbfc42609275983ff01647dc4806692 /include/linux/usb/typec.h
parentf061f43d7418cb62b8d073e221ec75d3f5b89e17 (diff)
downloadlinux-stable-662a60102c122e44fdaf5c826f7f415eb57d48ad.tar.gz
linux-stable-662a60102c122e44fdaf5c826f7f415eb57d48ad.tar.bz2
linux-stable-662a60102c122e44fdaf5c826f7f415eb57d48ad.zip
usb: typec: Separate USB Power Delivery from USB Type-C
Introducing a small device class for USB Power Delivery. The idea with it is that we do not mix any more USB Power Delivery information into the USB Type-C connectors only. This separation will make it possible to register USB Power Delivery devices also from other places, for example from USB Type-C Bridges (see USB Type-C Bridge Specification). The device class will not always deal with only the messages and objects that were negotiated with the partner, but instead messages and objects that can be used in the negotiation. That allows the USB PD devices to be shared and reconfigured. The ports can decide which objects are to be advertised to the partner before the contract is negotiated. It is also possible to allow the user space to make that decision if needed. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/20220502132058.86236-2-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.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/usb/typec.h b/include/linux/usb/typec.h
index fdf737d48b3b..45e28d14ae56 100644
--- a/include/linux/usb/typec.h
+++ b/include/linux/usb/typec.h
@@ -52,6 +52,16 @@ enum typec_role {
TYPEC_SOURCE,
};
+static inline int is_sink(enum typec_role role)
+{
+ return role == TYPEC_SINK;
+}
+
+static inline int is_source(enum typec_role role)
+{
+ return role == TYPEC_SOURCE;
+}
+
enum typec_pwr_opmode {
TYPEC_PWR_MODE_USB,
TYPEC_PWR_MODE_1_5A,