diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2019-02-25 12:56:40 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-03-12 07:16:04 -0700 |
commit | 60efadb3772a4990a31f5b70ad0a65a4aceda558 (patch) | |
tree | 2beec890cfd2645776700f3c1c84b78d32bf98ea | |
parent | 67fdc8b2bdab159b6fe8f5e144e51e74591ab5d2 (diff) | |
download | chrome-ec-60efadb3772a4990a31f5b70ad0a65a4aceda558.tar.gz |
Nami: Make Vayne shutdown at 4% battery charge
Currently, Vayne and all other Nami's shutdown when battery charge
(=soc) goes below 3%. This patch makes Vayne set shutdown charge
level to 4% to match Powerd's threshold.
When system is running or in suspend, Vayne behaves as follows:
1. Powerd shuts down system when soc < 4. (EC also catches soc < 4 but
takes no action.) If Powerd fails to shut down system or system is
in suspend, EC forces system to shut down.
2. System shuts down.
3. charger task cuts off battery.
When system is off or in suspend, EC cuts off battery in 30 secs after
soc <= 4%.
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
BUG=b/123727148
BRANCH=nami
TEST=Verify Vayne cuts off battery when soc <= 4% in s0 and s5.
Change-Id: I88cb6c7f59c2c3b16acbf5613152c5a502486d53
Reviewed-on: https://chromium-review.googlesource.com/1512621
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r-- | board/nami/board.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/board/nami/board.c b/board/nami/board.c index 7834f5d174..c21fb2338a 100644 --- a/board/nami/board.c +++ b/board/nami/board.c @@ -8,6 +8,7 @@ #include "adc.h" #include "adc_chip.h" #include "anx7447.h" +#include "battery.h" #include "board_config.h" #include "button.h" #include "charge_manager.h" @@ -1073,3 +1074,13 @@ enum critical_shutdown board_critical_shutdown_check( return CRITICAL_SHUTDOWN_HIBERNATE; } + +uint8_t board_set_battery_level_shutdown(void) +{ + if (oem == PROJECT_VAYNE) + /* We match the shutdown threshold with Powerd's. + * 4 + 1 = 5% because Powerd uses '<=' while EC uses '<'. */ + return CONFIG_BATT_HOST_SHUTDOWN_PERCENTAGE + 1; + else + return BATTERY_LEVEL_SHUTDOWN; +} |