diff options
author | Ben Lok <ben.lok@mediatek.com> | 2016-02-25 17:41:12 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-03-01 19:35:48 -0800 |
commit | 62055e53b6fa4a914618d4e97617663a2b62980a (patch) | |
tree | dc5efc883be523065275202f1dfeea9945ec500c /common | |
parent | d89301b0360365306ea7b24751490847858e3646 (diff) | |
download | chrome-ec-62055e53b6fa4a914618d4e97617663a2b62980a.tar.gz |
oak: avoid reading BC1.2 interrupt reg during handling vbus event
PI3USB9281 may not assert the interrupt line if device is detached
and reading the interrupt register simultaneously. And it is not
necessary to check the interrupt status when vbus change event
happens. To prevent losing the detach interrupt during vbus change
event happens, only check the interrupt status only if receiving
the USB_CHG_EVENT_INTR event.
BUG=chrome-os-partner:48797
BRANCH=none
TEST=Plug/Unplug PD charger 20 times, UI should not display
"Low power charger" warning message each time during the PD charger
is unplugged.
Change-Id: I51fe68732ece882029f1503294c2122cfbb00c34
Signed-off-by: Ben Lok <ben.lok@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/328897
Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/usb_charger.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/common/usb_charger.c b/common/usb_charger.c index 713db048cf..c56e0f4d0f 100644 --- a/common/usb_charger.c +++ b/common/usb_charger.c @@ -218,19 +218,19 @@ void usb_charger_task(void) while (1) { /* Wait for interrupt */ evt = task_wait_event(-1); - /* Read interrupt register to clear on chip */ - interrupt = pi3usb9281_get_interrupts(port); - /* Interrupt from the Pericom chip, determine interrupt type */ - if (evt & USB_CHG_EVENT_INTR) { + /* Interrupt from the Pericom chip, determine charger type */ + if (evt & USB_CHG_EVENT_BC12) { + /* Read interrupt register to clear on chip */ + pi3usb9281_get_interrupts(port); + usb_charger_bc12_detect(port); + } else if (evt & USB_CHG_EVENT_INTR) { + /* Check the interrupt register, and clear on chip */ + interrupt = pi3usb9281_get_interrupts(port); if (interrupt & attach_mask) usb_charger_bc12_detect(port); } - /* Ignore interrupt status and determine charger type */ - if (evt & USB_CHG_EVENT_BC12) - usb_charger_bc12_detect(port); - /* * Re-enable interrupts on pericom charger detector since the * chip may periodically reset itself, and come back up with |