diff options
author | Jett Rink <jettrink@chromium.org> | 2018-02-09 08:31:02 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-02-09 19:03:20 -0800 |
commit | 7a23aa72bf86aab4e5edd4cbf1fc47aabb0e8b31 (patch) | |
tree | 4b96405b727f3c90d6db837139e44929d08cfaa9 | |
parent | ff11702c40a7bd88fa64444798c40731a09e4166 (diff) | |
download | chrome-ec-7a23aa72bf86aab4e5edd4cbf1fc47aabb0e8b31.tar.gz |
usb-pd: Clear active contract bit before browning out system
In the case where we are resetting Vbus and it is our only power source,
then we will brown out before we set the active port to 0.
BRANCH=none
BUG=none
TEST=Did a cold reset on grunt with no battery power. System booted as
normal.
Change-Id: I3823af6b0475e4cf8abbe12dd8ae4ceef26d1eab
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/911613
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Edward Hill <ecgh@chromium.org>
-rw-r--r-- | common/usb_pd_protocol.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index 7eb6ece81f..af623fbcbe 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -1853,13 +1853,18 @@ static void pd_partner_port_reset(int port) (RESET_FLAG_BROWNOUT | RESET_FLAG_POWER_ON)) return; + /* + * Clear the active contract bit before we apply Rp in case we + * intentionally brown out because we cut off our only power supply. + */ + pd_set_saved_active(port, 0); + /* Provide Rp for 200 msec. or until we no longer have VBUS. */ tcpm_set_cc(port, TYPEC_CC_RP); timeout = get_time().val + 200 * MSEC; while (get_time().val < timeout && pd_is_vbus_present(port)) msleep(10); - pd_set_saved_active(port, 0); } #endif /* CONFIG_USB_PD_DUAL_ROLE */ |