From 3568df5702a5da062eef8a0c41e7a3962ccf2d66 Mon Sep 17 00:00:00 2001 From: Diana Z Date: Wed, 29 May 2019 10:40:23 -0600 Subject: Prevent power on with disconnected battery Currently, if a battery is disconnected but reporting a charge percentage over CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON_WITH_AC, a system will be allowed to boot despite the battery not providing power yet. This change verifies that the battery is connected, as well as having a high enough charge percentage before allowing boot. BUG=b:133724948 BRANCH=octopus TEST=verified casta can power on once CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON_WITH_AC is passed and battery is connected Change-Id: Ide9fe041a328bbeaeee8b9e7f9788b5731ac80ea Signed-off-by: Diana Z Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1637296 --- common/charge_state_v2.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c index bd4bb81558..be0ac08cf3 100644 --- a/common/charge_state_v2.c +++ b/common/charge_state_v2.c @@ -2006,6 +2006,10 @@ int charge_prevent_power_on(int power_button_pressed) defined(CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON_WITH_AC) else if (charge_manager_get_power_limit_uw() >= CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON_WITH_BATT * 1000 +#ifdef CONFIG_BATTERY_REVIVE_DISCONNECT + && battery_get_disconnect_state() == + BATTERY_NOT_DISCONNECTED +#endif && (current_batt_params->state_of_charge >= CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON_WITH_AC)) prevent_power_on = 0; -- cgit v1.2.1