mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-11 18:35:28 +00:00
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>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user