diff options
author | Diana Z <dzigterman@chromium.org> | 2021-03-03 15:43:20 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-03-10 00:21:26 +0000 |
commit | 3654a335d7d0426fc33018a61b600230ae0645e6 (patch) | |
tree | ed4413078dce92aeadae73ba0038c5809fbd21ce /common | |
parent | 7dadb784c1664342a844f959636bd7303b2f13ce (diff) | |
download | chrome-ec-3654a335d7d0426fc33018a61b600230ae0645e6.tar.gz |
USB charger: Ensure BC 1.2 suppliers are cleared on PR swap
When a type-c port swaps to become the source, it is no longer valid to
consider charging from any BC 1.2 based suppliers on that port. Clear
out these chargers so the charge manager won't select them from an
overridden port.
BRANCH=None
BUG=b:174334068
TEST=on galtic, connect to another chromebook and ensure galtic is the
UFP. Run swaps back and forth, ensuring that "ectool usbpdpower"
correctly reflects our charging state. Also connect a USB-A to C cable
and ensure charging occurs.
Signed-off-by: Diana Z <dzigterman@chromium.org>
Change-Id: Iaaa72b715909d1b653dde6d06b6ba026b768fe3c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2733454
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/usb_charger.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/common/usb_charger.c b/common/usb_charger.c index 5b14608021..40f71062b4 100644 --- a/common/usb_charger.c +++ b/common/usb_charger.c @@ -73,6 +73,10 @@ void usb_charger_vbus_change(int port, int vbus_level) #ifdef HAS_TASK_USB_CHG_P0 /* USB Charger task(s) */ task_set_event(USB_CHG_PORT_TO_TASK_ID(port), USB_CHG_EVENT_VBUS); + + /* If we swapped to sourcing, drop any related charge suppliers */ + if (usb_charger_port_is_sourcing_vbus(port)) + usb_charger_reset_charge(port); #endif #if (defined(CONFIG_USB_PD_VBUS_DETECT_CHARGER) \ |