summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2021-06-29 11:15:55 -0700
committerCommit Bot <commit-bot@chromium.org>2021-12-15 06:15:25 +0000
commitec8a4273049d0798e3922a175c5b947e039335b6 (patch)
treeaf331f7ab024aa6e4af49f249ff70a75c485d568
parentbfb2075a30c4488e7ce8025f91eb4413c010e4c5 (diff)
downloadchrome-ec-ec8a4273049d0798e3922a175c5b947e039335b6.tar.gz
battery: Set host's low battery shutdown SoC to 3%
Currently, the host's low battery shutdown SoC is 2%. This is the same as EC's low battery shutdown threshold. The EC waits for 30 secs before it triggers the low battery shutdown and powerd reads the SoC every 30 secs. Thus, in most cases powerd can shut down the system gracefully but these delays can be configured differently and the system may be too busy to process all shutdown tasks within 30 secs. This patch increases the host's shutdown SoC to 3%. This will further guarantee that powerd will be given enough time to do everything for a proper shutdown. It also avoids deeply discharging the battery, which is bad for the battery health. BUG=b:191837893 BRANCH=None TEST=Altas using battfake EC command. Change-Id: I3ab23205b400a1a326a60b8f9501611c027183b2 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2994747 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3336672
-rw-r--r--include/battery.h3
-rw-r--r--include/config.h10
2 files changed, 8 insertions, 5 deletions
diff --git a/include/battery.h b/include/battery.h
index 55ea92a39e..3d7876662e 100644
--- a/include/battery.h
+++ b/include/battery.h
@@ -48,7 +48,8 @@ extern struct ec_response_battery_dynamic_info
/*
* Shut down main processor and/or hibernate EC when discharging and battery
- * level < this level.
+ * level < this level. Setting this too low makes the battery discharge too
+ * deeply, which isn't good for the battery health.
*/
#define BATTERY_LEVEL_SHUTDOWN 3
diff --git a/include/config.h b/include/config.h
index de48a2134a..4e07add025 100644
--- a/include/config.h
+++ b/include/config.h
@@ -489,18 +489,20 @@
* Thus, we set them as follows by default:
*
* CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON = 2 (don't boot if soc < 2%)
- * CONFIG_BATT_HOST_SHUTDOWN_PERCENTAGE = 2 (shutdown if soc <= 2%)
+ * CONFIG_BATT_HOST_SHUTDOWN_PERCENTAGE = 3 (shutdown if soc <= 3%)
* BATTERY_LEVEL_SHUTDOWN = 3 (shutdown if soc < 3%)
*
* This produces the following behavior:
*
* - If soc = 1%, system doesn't boot. User wouldn't know why.
- * - If soc = 2%, system boots. Alert is shown. System immediately shuts down.
- * - If battery discharges to 2% while the system is running, system shuts down.
+ * - If soc = 2~3%, system boots. Alert is shown. System immediately shuts down.
+ * - If battery discharges to 3% while the system is running, system shuts down.
* If that happens while a user is away, they can press the power button to
* learn what happened.
+ * - If system fails to shutdown for some reason and battery further discharges
+ * to 2%, EC will trigger shutdown.
*/
-#define CONFIG_BATT_HOST_SHUTDOWN_PERCENTAGE 2 /* shutdown if soc <= 2% */
+#define CONFIG_BATT_HOST_SHUTDOWN_PERCENTAGE 3 /* shutdown if soc <= 3% */
/*
* Powerd's full_factor. The value comes from: