summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2021-11-03 09:33:00 -0600
committerCommit Bot <commit-bot@chromium.org>2021-11-03 21:14:35 +0000
commit67b3cae16ba1a80407ccf7f82ec7695ba6cd44c1 (patch)
treece623b42d54144467dc5a144e9ac92b89cbe8a24
parent0b202341702f75303238b8972f4c5decc0ae30e4 (diff)
downloadchrome-ec-67b3cae16ba1a80407ccf7f82ec7695ba6cd44c1.tar.gz
TCPMv2: Avoid hard reset on shutdown with no battery
When shutting down, it's generally desirable to reset Vconn to the source. However, if we're running with no battery then we should avoid this hard reset in order to prevent removing board power. BRANCH=None BUG=b:202804110 TEST=on guybrush, shutdown with a charger which swaps Vconn and ensure we don't hard reset Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I1b2587495b21a641c3901c5b1fcc127951305e3b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3260165 Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r--common/usbc/usb_tc_drp_acc_trysrc_sm.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/common/usbc/usb_tc_drp_acc_trysrc_sm.c b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
index 182ea686ec..40a66eae20 100644
--- a/common/usbc/usb_tc_drp_acc_trysrc_sm.c
+++ b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
@@ -1893,11 +1893,14 @@ __maybe_unused static void handle_new_power_state(int port)
/*
* If the sink port was sourcing Vconn, and can no longer, request a
- * hard reset on this port to restore Vconn to the source.
+ * hard reset on this port to restore Vconn to the source. If we do not
+ * have sufficient battery to withstand Vbus loss, then continue with
+ * the inconsistent Vconn state in order to keep the board powered.
*/
if (IS_ENABLED(CONFIG_USB_PE_SM)) {
if (tc_is_vconn_src(port) && tc_is_attached_snk(port) &&
- !pd_check_vconn_swap(port))
+ !pd_check_vconn_swap(port) &&
+ pd_is_battery_capable())
pd_dpm_request(port, DPM_REQUEST_HARD_RESET_SEND);
}