summaryrefslogtreecommitdiff
path: root/include/usb_charge.h
diff options
context:
space:
mode:
authorVijay Hiremath <vijay.p.hiremath@intel.com>2016-05-09 18:36:53 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-06-08 19:17:56 -0700
commit4a6967951f107dfaf4ea7cc14516b5b1c0819244 (patch)
tree4dcfa0abbe51ead60b7cca0867890e6d1e69d97f /include/usb_charge.h
parent6e874dc7e7535189d4bd0e62ae1f98ba8d2c1650 (diff)
downloadchrome-ec-4a6967951f107dfaf4ea7cc14516b5b1c0819244.tar.gz
Driver: BD99955: Use Charger interrupt to detect VBUS activity
Added support to enable the BD99955 charger interrupt to detect the VBUS activity. With this approach GPIO USB_Cx_VBUS_DET_N pin can be removed. BUG=chrome-os-partner:53688 BRANCH=none TEST=Manually tested on Amenia. Type-C, DCP & SDP chargers can negotiate to desired current & voltage. Battery can charge. USB3.0 & USB2.0 sync devices are detected by the Kernel. Change-Id: I5470092c5cd43026aafc1a638ba446d0037c71e7 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/343650 Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com> Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'include/usb_charge.h')
-rw-r--r--include/usb_charge.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/usb_charge.h b/include/usb_charge.h
index 5d21a6aab9..5de334583d 100644
--- a/include/usb_charge.h
+++ b/include/usb_charge.h
@@ -52,6 +52,19 @@ int usb_charge_ports_enabled(void);
#define USB_CHG_EVENT_VBUS TASK_EVENT_CUSTOM(2)
#define USB_CHG_EVENT_INTR TASK_EVENT_CUSTOM(4)
+/*
+ * Define USB_CHG_PORT_TO_TASK_ID() and TASK_ID_TO_USB_CHG__PORT() macros to
+ * go between USB_CHG port number and task ID. Assume that TASK_ID_USB_CHG_P0,
+ * is the lowest task ID and IDs are on a continuous range.
+ */
+#ifdef HAS_TASK_USB_CHG_P0
+#define USB_CHG_PORT_TO_TASK_ID(port) (TASK_ID_USB_CHG_P0 + (port))
+#define TASK_ID_TO_USB_CHG_PORT(id) ((id) - TASK_ID_USB_CHG_P0)
+#else
+#define USB_CHG_PORT_TO_TASK_ID(port) -1 /* dummy task ID */
+#define TASK_ID_TO_USB_CHG_PORT(id) 0
+#endif /* HAS_TASK_USB_CHG_P0 */
+
/**
* Returns true if the passed port is a power source.
*