summaryrefslogtreecommitdiff
path: root/include/config.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/config.h')
-rw-r--r--include/config.h63
1 files changed, 23 insertions, 40 deletions
diff --git a/include/config.h b/include/config.h
index faa1f5ed3c..2a1e5f5759 100644
--- a/include/config.h
+++ b/include/config.h
@@ -492,61 +492,44 @@
#undef CONFIG_BATTERY_MEASURE_IMBALANCE
/*
- * 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
-
-/*
* Expose some data when it is needed.
* For example, battery disconnect state
*/
@@ -866,8 +849,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 */