summaryrefslogtreecommitdiffstats
path: root/drivers/usb/typec/pd.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 /drivers/usb/typec/pd.h
parentf061f43d7418cb62b8d073e221ec75d3f5b89e17 (diff)
downloadlinux-662a60102c122e44fdaf5c826f7f415eb57d48ad.tar.bz2
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 'drivers/usb/typec/pd.h')
-rw-r--r--drivers/usb/typec/pd.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/usb/typec/pd.h b/drivers/usb/typec/pd.h
new file mode 100644
index 000000000000..049a1aad440a
--- /dev/null
+++ b/drivers/usb/typec/pd.h
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef __USB_POWER_DELIVERY__
+#define __USB_POWER_DELIVERY__
+
+#include <linux/device.h>
+#include <linux/usb/typec.h>
+
+struct usb_power_delivery {
+ struct device dev;
+ int id;
+ u16 revision;
+ u16 version;
+};
+
+struct usb_power_delivery_capabilities {
+ struct device dev;
+ struct usb_power_delivery *pd;
+ enum typec_role role;
+};
+
+#define to_usb_power_delivery_capabilities(o) container_of(o, struct usb_power_delivery_capabilities, dev)
+#define to_usb_power_delivery(o) container_of(o, struct usb_power_delivery, dev)
+
+struct usb_power_delivery *usb_power_delivery_find(const char *name);
+
+int usb_power_delivery_init(void);
+void usb_power_delivery_exit(void);
+
+#endif /* __USB_POWER_DELIVERY__ */