diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2021-06-22 21:24:06 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-06-23 20:47:18 +0000 |
commit | 3aa4dd2c4a695152dd17aaec601d3a79bc5ab1c4 (patch) | |
tree | 0f08d695a03d2ca88092b7ae82429cd38143928e /include/config.h | |
parent | 87f59b57817d5800fd929938b2dca914bad14d2c (diff) | |
download | chrome-ec-3aa4dd2c4a695152dd17aaec601d3a79bc5ab1c4.tar.gz |
chgstv2: Unify power-on and shutdown battery thresholds
Currently, power-on battery SoC and shutdown battery SoC are
independently configured by each board. This patch will unify the
setting as follows:
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%)
BATTERY_LEVEL_SHUTDOWN = 3 (shutdown if soc < 3%)
CONFIG_BATTERY_EXPORT_DISPLAY_SOC = Y (removed)
CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON_WITH_AC = 1
This allows us to show the low battery alert whenever we can because
EC doesn't inhibit power-on even if it knows the host would
immediately shut down.
With CONFIG_BATTERY_EXPORT_DISPLAY_SOC, boards will start using the
CONFIG_BATT_HOST_SHUTDOWN_PERCENTAGE = 2% as the low battery
threshold (and the SoC will be agreed between the EC and Powerd).
Boards with CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON = 1 will keep the
same threshold. This is for avoiding degrading the UX by increasing
the power-on threshold (even though a question that 1% may not be
enough for soft sync to finish consistently remains to be answered).
Boards with CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON > 2 will have a
lower threshold but we think 2% is enough to finish the software sync.
A lower threshold also improves the UX by showing the low battery
alert in the situation where otherwise the system would leave the user
uninformed by not responding to a power button press.
BUG=b:191837893
BRANCH=None
TEST=buildall
Change-Id: If6ff733bc181f929561a3fffb8a84e760668ce37
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2981468
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'include/config.h')
-rw-r--r-- | include/config.h | 63 |
1 files changed, 23 insertions, 40 deletions
diff --git a/include/config.h b/include/config.h index 175d64a0bb..661e1de680 100644 --- a/include/config.h +++ b/include/config.h @@ -634,61 +634,44 @@ #undef CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV /* - * If remaining capacity is x% of full capacity, remaining capacity is set - * equal to full capacity. - * * Some batteries don't update full capacity timely or don't update it at all. * On such systems, compensation is required to guarantee remaining_capacity * will be equal to full_capacity eventually. This used to be done in ACPI. * - * When CONFIG_BATTERY_EXPORT_DISPLAY_SOC is enabled, CONFIG_BATT_FULL_FACTOR - * has no effect. Also CONFIG_BATT_HOST_SHUTDOWN_PERCENTAGE is used by Powerd - * as the threshold for low battery shutdown. For example, if we have: + * Powerd uses CONFIG_BATT_HOST_SHUTDOWN_PERCENTAGE as the threshold for low + * battery shutdown. + * + * We want to show the low battery alert whenever we can. Thus, we make EC not + * inhibit power-on even if it knows the host would immediately shut down. To + * get that behavior, we need: + * + * MIN_BAT_PCT_FOR_POWER_ON < HOST_SHUTDOWN_PER = BATTERY_LEVEL_SHUTDOWN * - * CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON = 3 - * CONFIG_BATT_HOST_SHUTDOWN_PERCENTAGE = 2, - * BATTERY_LEVEL_SHUTDOWN = 1 + * Thus, we set them as follows by default: * - * the battery range is divided as follows (assuming system is powered only by - * internal battery): + * 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%) + * BATTERY_LEVEL_SHUTDOWN = 3 (shutdown if soc < 3%) * - * 0% ------------------- 1% ------------------- 2% ------------------- 3% - * EC refuses to boot -> - * Powerd shuts down system -> - * EC shuts down system -> + * 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 that happens while a user is away, they can press the power button to + * learn what happened. */ -#define CONFIG_BATT_FULL_FACTOR 98 -#define CONFIG_BATT_HOST_SHUTDOWN_PERCENTAGE 4 +#define CONFIG_BATT_HOST_SHUTDOWN_PERCENTAGE 2 /* shutdown if soc <= 2% */ /* * Powerd's full_factor. The value comes from: * src/platform2/power_manager/default_prefs/power_supply_full_factor * - * When CONFIG_BATTERY_EXPORT_DISPLAY_SOC is enabled, this value is exported - * to the host (i.e. Powerd). It's used to calculate the ETA for full charge. + * This value is used by the host to calculate the ETA for full charge. */ #define CONFIG_BATT_HOST_FULL_FACTOR 97 /* - * This option enables EC to be the origin of the display SoC and allows the - * host (i.e. Powerd) to retrieve it through EC_CMD_DISPLAY_SOC. - * - * The display SoC is computed from the remaining capacity, the last full - * charge, CONFIG_BATT_FULL_FACTOR, CONFIG_BATT_HOST_FULL_FACTOR, and - * CONFIG_BATT_HOST_SHUTDOWN_PERCENTAGE. - * - * If this option is disabled, the EC and the host will individually compute - * the display SoC, which may result in inconsistent behaviors since the numbers - * do not necessarily match. As such, this option is going to be enabled by - * default and the old behavior (#undef CONFIG_BATTERY_EXPORT_DISPLAY_SOC) will - * be deprecated. - * - * TODO: Define CONFIG_BATTERY_EXPORT_DISPLAY_SOC by default and remove - * CONFIG_BATTERY_EXPORT_DISPLAY_SOC and CONFIG_BATT_FULL_FACTOR. - */ -#undef CONFIG_BATTERY_EXPORT_DISPLAY_SOC - -/* * Smart battery pass-through host commands. */ #undef CONFIG_SB_PASSTHROUGH @@ -1070,8 +1053,8 @@ * analog signaling. If the AP requires greater than 15W to boot, then see * CONFIG_CHARGER_LIMIT_POWER_THRESH_CHG_MW. */ -#undef CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON -#undef CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON_WITH_AC +#define CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON 2 /* Don't boot if soc < 2% */ +#define CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON_WITH_AC 1 /* Default: 15000 */ #undef CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON /* Default: Disabled */ |