summaryrefslogtreecommitdiff
path: root/include/usb_charge.h
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2015-08-03 16:33:44 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-08-05 16:50:46 +0000
commitfeea8de21bb7d73624eddaeb536a0bc298ccc61e (patch)
treebeeeda82a2bf7b7d536bedd55d2ba4aa44a38967 /include/usb_charge.h
parent38eb374fceed84ea499c5e27c8b2ded869c5d75f (diff)
downloadchrome-ec-feea8de21bb7d73624eddaeb536a0bc298ccc61e.tar.gz
usb_charger: move common usb charger code out of board directory
Move common USB charger code out of board directory including setting VBUS supplier when VBUS changes, and initializing BC1.2 supplier types on init. This also enables re-enabling of Pericom BC1.2 detection interrupts when VBUS is changed on all boards that use USB_CHG task. BUG=chrome-os-partner:42292 BRANCH=none TEST=make -j buildall. Tested on glados and samus by plugging in a few different chargers and making sure we charge. Change-Id: Ib102fbf7a6aace998e6fcb6d35f3c97e5f03f5c2 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/290453 Reviewed-by: Shawn N <shawnn@chromium.org> Reviewed-by: Rong Chang <rongchang@chromium.org>
Diffstat (limited to 'include/usb_charge.h')
-rw-r--r--include/usb_charge.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/usb_charge.h b/include/usb_charge.h
index 60f2c9742c..e7d620bd81 100644
--- a/include/usb_charge.h
+++ b/include/usb_charge.h
@@ -47,6 +47,10 @@ int usb_charge_set_mode(int usb_port_id, enum usb_charge_mode mode);
*/
int usb_charge_ports_enabled(void);
+/* Events handled by the USB_CHG task */
+#define USB_CHG_EVENT_BC12 TASK_EVENT_CUSTOM(1)
+#define USB_CHG_EVENT_VBUS TASK_EVENT_CUSTOM(2)
+
/**
* Returns true if the passed port is a power source.
*
@@ -69,5 +73,12 @@ enum usb_switch {
*/
void usb_charger_set_switches(int port, enum usb_switch setting);
+/**
+ * Notify USB_CHG task that VBUS level has changed.
+ *
+ * @param port port number.
+ * @param vbus_level new VBUS level
+ */
+void usb_charger_vbus_change(int port, int vbus_level);
#endif /* __CROS_EC_USB_CHARGE_H */