From 5f9e39ceaf609bfa31685ed4e763ac6c6e4ea27b Mon Sep 17 00:00:00 2001 From: Shawn Nematbakhsh Date: Fri, 2 Sep 2016 12:54:23 -0700 Subject: bd99955: usb_charger: Don't do BC1.2 detection on source ports If we're sourcing 5V to the port, consider the port as not providing power, for the purpose of VBUS / BC1.2 detection. BUG=chrome-os-partner:55432 BRANCH=None TEST=Manual on kevin, attach legacy peripheral in one port, zinger in the other, run "reboot" on EC console, and verify zinger port is selected as charge port. Also attach Apple charge-thru accessory w/o charger plugged, verify that charge manager is not informed of a BC1.2 / VBUS supplier. Change-Id: Ifbe587215f28756760e7106e1a00dd96319438e3 Signed-off-by: Shawn Nematbakhsh Reviewed-on: https://chromium-review.googlesource.com/380324 Commit-Ready: Shawn N Tested-by: Shawn N Reviewed-by: Vijay P Hiremath Reviewed-by: Vincent Palatin --- driver/charger/bd99955.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/driver/charger/bd99955.c b/driver/charger/bd99955.c index 2f0af04145..68ebc0f77d 100644 --- a/driver/charger/bd99955.c +++ b/driver/charger/bd99955.c @@ -343,11 +343,12 @@ static int bd99955_get_vbus_detect_interrupts(int port) static void usb_charger_process(enum bd99955_charge_port port) { - int vbus_provided = bd99955_is_vbus_provided(port); + int chg_port = bd99955_pd_port_to_chg_port(port); + int vbus_provided = bd99955_is_vbus_provided(port) && + !usb_charger_port_is_sourcing_vbus(chg_port); /* Inform other modules about VBUS level */ - usb_charger_vbus_change(bd99955_pd_port_to_chg_port(port), - vbus_provided); + usb_charger_vbus_change(chg_port, vbus_provided); /* Do BC1.2 detection */ if (vbus_provided) { -- cgit v1.2.1