summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Hurst <shurst@google.com>2021-11-13 12:49:02 -0800
committerCommit Bot <commit-bot@chromium.org>2021-11-15 19:01:41 +0000
commitc5e13038568246583763d10c70edf16d1062469d (patch)
tree50c9a52242cf1021a448dbaf20f467e217355493
parentc555d4d5462a07179a4f61c9ad5fd3a9c6605d7c (diff)
downloadchrome-ec-c5e13038568246583763d10c70edf16d1062469d.tar.gz
TCPMV2: Prevent EC boot loop when battery is dead
Transition to Unattached.SNK state when a dead battery is detected on EC boot. BUG=b:205883173 TEST=Verified that EC does not boot when battery is dead BRANCH=main Signed-off-by: Sam Hurst <shurst@google.org> Change-Id: Ib49ed1f11a16da08909524180b825a8942116635 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3280648 Tested-by: Sam Hurst <shurst@google.com> Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Sam Hurst <shurst@google.com>
-rw-r--r--common/usbc/usb_tc_drp_acc_trysrc_sm.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/common/usbc/usb_tc_drp_acc_trysrc_sm.c b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
index 96f811fcb4..b8e3fc712b 100644
--- a/common/usbc/usb_tc_drp_acc_trysrc_sm.c
+++ b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
@@ -1574,9 +1574,9 @@ void tc_state_init(int port)
}
/*
- * If this is non-EFS2 device, battery is not present and EC RO doesn't
- * keep power-on reset flag after reset caused by H1, then don't apply
- * CC open because it will cause brown out.
+ * If this is non-EFS2 device, battery is not present or at some minimum
+ * voltage and EC RO doesn't keep power-on reset flag after reset caused
+ * by H1, then don't apply CC open because it will cause brown out.
*
* Please note that we are checking if CONFIG_BOARD_RESET_AFTER_POWER_ON
* is defined now, but actually we need to know if it was enabled in
@@ -1585,7 +1585,7 @@ void tc_state_init(int port)
*/
if (!IS_ENABLED(CONFIG_BOARD_RESET_AFTER_POWER_ON) &&
!IS_ENABLED(CONFIG_VBOOT_EFS2) && IS_ENABLED(CONFIG_BATTERY) &&
- (battery_is_present() == BP_NO)) {
+ !pd_is_battery_capable()) {
first_state = TC_UNATTACHED_SNK;
}