summaryrefslogtreecommitdiff
path: root/drivers/usb/pd/usbpd.h
diff options
context:
space:
mode:
authorJack Pham <jackp@codeaurora.org>2016-03-17 00:27:10 -0700
committerJeevan Shriram <jshriram@codeaurora.org>2016-05-10 13:20:25 -0700
commit82a0ca0e2d89e797fbbf2001ec5403764132998c (patch)
tree3806370e62427c606b6d4a858442ba364f8d9b22 /drivers/usb/pd/usbpd.h
parente4fd13f74c5a926c013ae80db1d65ed60b5bee9f (diff)
usb: pd: Add initial support for USB Power Delivery
Add PD policy engine driver. This driver will interact with the charger/Type-C module via power_supply framework, and in turn notify the USB controller on when to begin/end data operation using extcon. For this initial patch this driver is simply acting as a pass-through between Type-C connection states and relaying them as USB/USB_HOST notifications. Change-Id: Ieba8e68761beef83a572b75b6b5f3b7ab7802e9e Signed-off-by: Jack Pham <jackp@codeaurora.org>
Diffstat (limited to 'drivers/usb/pd/usbpd.h')
-rw-r--r--drivers/usb/pd/usbpd.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/drivers/usb/pd/usbpd.h b/drivers/usb/pd/usbpd.h
new file mode 100644
index 000000000000..7a24d33190e4
--- /dev/null
+++ b/drivers/usb/pd/usbpd.h
@@ -0,0 +1,43 @@
+/* Copyright (c) 2016, Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _USBPD_H
+#define _USBPD_H
+
+#include <linux/device.h>
+
+struct usbpd;
+
+#if IS_ENABLED(CONFIG_USB_PD_POLICY)
+struct usbpd *usbpd_create(struct device *parent);
+void usbpd_destroy(struct usbpd *pd);
+#else
+static inline struct usbpd *usbpd_create(struct device *parent)
+{
+ return ERR_PTR(-ENODEV);
+}
+static inline void usbpd_destroy(struct usbpd *pd) { }
+#endif
+
+enum data_role {
+ DR_NONE = -1,
+ DR_UFP = 0,
+ DR_DFP = 1,
+};
+
+enum power_role {
+ PR_NONE = -1,
+ PR_SINK = 0,
+ PR_SRC = 1,
+};
+
+#endif /* _USBPD_H */