From fd3f9b9a304bb4838bd0b015981e1798b15552f6 Mon Sep 17 00:00:00 2001 From: Daisuke Nojiri Date: Wed, 12 Sep 2018 13:12:31 -0700 Subject: chgmgr: Set available voltage to 0 on disconnect Currently, available current is consistently set to zero when a supplier is disconnected across BC 1.2 drivers, PD task, usb charger task but voltage is set to zero only in some places. This patch will set available voltage consistently to 0 on disconnected ports. This change should have no impact externally or internally because currently ports are treated as a disconnected port as long as available current is zero. Signed-off-by: Daisuke Nojiri BUG=chromium:841944 BRANCH=none TEST=Verify ectool usbpdpower 1 return 'Port 1: Disconnected' and 'Port 1: SNK (not charging)' without and with a BJ adapter connected respectively on Fizz. Verify ectool usbpdpower prints 'Disconnected' and 'SNK Charger PD' on Vayne without and with USB-C charger, respectively. Verify ectool usbpdpower prints 'Disconnected' and 'SNK Charger Type-C' on Vayne without and with a phone USB-C charger, respectively. Change-Id: I9aca575a4a4240ec1f669c55437decaedf758a77 Reviewed-on: https://chromium-review.googlesource.com/1222092 Commit-Ready: Daisuke Nojiri Tested-by: Daisuke Nojiri Reviewed-by: Jett Rink --- common/charge_manager.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'common/charge_manager.c') diff --git a/common/charge_manager.c b/common/charge_manager.c index 7ae0400262..315610328b 100644 --- a/common/charge_manager.c +++ b/common/charge_manager.c @@ -583,8 +583,10 @@ static void charge_manager_refresh(void) * Zero the available charge on the rejected port so that * it is no longer chosen. */ - for (i = 0; i < CHARGE_SUPPLIER_COUNT; ++i) + for (i = 0; i < CHARGE_SUPPLIER_COUNT; ++i) { available_charge[i][new_port].current = 0; + available_charge[i][new_port].voltage = 0; + } } active_charge_port_initialized = 1; -- cgit v1.2.1