diff options
author | Denis Brockus <dbrockus@google.com> | 2020-07-24 12:23:55 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-07-28 00:04:00 +0000 |
commit | 00d3f2d0d6e864236c217330659dd7801adf8670 (patch) | |
tree | c3bebb8ca9051de7b042c0e9e9f40f49145487d0 | |
parent | 5e6ed41212cb932efea7576eca65108a5173cc77 (diff) | |
download | chrome-ec-00d3f2d0d6e864236c217330659dd7801adf8670.tar.gz |
zork: don't turn off vbus if we aren't sourcing vbus
Turning off vbus when we are not sourcing vbus causes
a bad behavior when we are cold booting in a batterless
manner. So made it conditional so we would be able to
run correctly with and without battery
BUG=b:162016100
BRANCH=none
TEST=trembyle cold boot with only AC power
Signed-off-by: Denis Brockus <dbrockus@google.com>
Change-Id: I77ad0487887078d6dd7514fd375558f10737fccb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2317892
Tested-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Commit-Queue: Denis Brockus <dbrockus@chromium.org>
Auto-Submit: Denis Brockus <dbrockus@chromium.org>
-rw-r--r-- | baseboard/zork/usb_pd_policy.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/baseboard/zork/usb_pd_policy.c b/baseboard/zork/usb_pd_policy.c index a02ffa00e0..f1bcd3842f 100644 --- a/baseboard/zork/usb_pd_policy.c +++ b/baseboard/zork/usb_pd_policy.c @@ -29,16 +29,15 @@ int pd_check_vconn_swap(int port) void pd_power_supply_reset(int port) { - int prev_en; - - prev_en = ppc_is_sourcing_vbus(port); - - /* Disable VBUS. */ - ppc_vbus_source_enable(port, 0); - - /* Enable discharge if we were previously sourcing 5V */ - if (IS_ENABLED(CONFIG_USB_PD_DISCHARGE) && prev_en) - pd_set_vbus_discharge(port, 1); + /* Don't need to shutoff VBus if we are not sourcing it */ + if (ppc_is_sourcing_vbus(port)) { + /* Disable VBUS. */ + ppc_vbus_source_enable(port, 0); + + /* Enable discharge if we were previously sourcing 5V */ + if (IS_ENABLED(CONFIG_USB_PD_DISCHARGE)) + pd_set_vbus_discharge(port, 1); + } #ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT /* Give back the current quota we are no longer using */ |