summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2019-05-29 10:40:23 -0600
committerJustin TerAvest <teravest@chromium.org>2019-05-30 16:16:25 +0000
commitea05ecfd8a2c278b1da5e2c111e6f71485c84ad9 (patch)
tree0f8632e8d275103b3caaef5b0c8b55e66f5a09e4
parente899f33e51b863c4445992b90ddae8959dd09df9 (diff)
downloadchrome-ec-ea05ecfd8a2c278b1da5e2c111e6f71485c84ad9.tar.gz
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 <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1635531 Reviewed-by: Justin TerAvest <teravest@chromium.org> Reviewed-by: Karthikeyan Ramasubramanian <kramasub@chromium.org> Commit-Queue: Karthikeyan Ramasubramanian <kramasub@chromium.org> Tested-by: Karthikeyan Ramasubramanian <kramasub@chromium.org> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
-rw-r--r--common/charge_state_v2.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c
index e479a3164f..3ede9e19aa 100644
--- a/common/charge_state_v2.c
+++ b/common/charge_state_v2.c
@@ -2036,6 +2036,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;