summaryrefslogtreecommitdiff
path: root/common/usb_charger.c
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 /common/usb_charger.c
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 'common/usb_charger.c')
-rw-r--r--common/usb_charger.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/common/usb_charger.c b/common/usb_charger.c
index a6b580072b..9888dac199 100644
--- a/common/usb_charger.c
+++ b/common/usb_charger.c
@@ -62,11 +62,13 @@ void usb_charger_vbus_change(int port, int vbus_level)
pd_vbus_low(port);
/* Update VBUS supplier and signal VBUS change to USB_CHG task */
update_vbus_supplier(port, vbus_level);
-#if CONFIG_USB_PD_PORT_COUNT == 2
- task_set_event(port ? TASK_ID_USB_CHG_P1 : TASK_ID_USB_CHG_P0,
- USB_CHG_EVENT_VBUS, 0);
-#else
- task_set_event(TASK_ID_USB_CHG_P0, USB_CHG_EVENT_VBUS, 0);
+
+ /* USB Charger task */
+ task_set_event(USB_CHG_PORT_TO_TASK_ID(port), USB_CHG_EVENT_VBUS, 0);
+
+#ifdef CONFIG_USB_PD_VBUS_DETECT_CHARGER
+ /* USB PD task */
+ task_wake(PD_PORT_TO_TASK_ID(port));
#endif
}