summaryrefslogtreecommitdiff
path: root/common/charge_state_v2.c
diff options
context:
space:
mode:
authorJonathan Brandmeyer <jbrandmeyer@chromium.org>2018-08-03 13:24:06 -0600
committerchrome-bot <chrome-bot@chromium.org>2018-08-08 04:29:20 -0700
commitb80693e94e6e9aa0a382c39c20efba6f2c7403a9 (patch)
treeb44a8b48858906c6f8a3875b6a69d7c2b6908ddc /common/charge_state_v2.c
parent5d2cdcab232748095d1efeb4e5c0fc23b13adb67 (diff)
downloadchrome-ec-b80693e94e6e9aa0a382c39c20efba6f2c7403a9.tar.gz
battery: Optionally prevent boot at low SOC with cell imbalance.
Measure the cell imbalance with method dispatch to a per-battery method, such that families with a plurality of configurable batteries can support them all. By default, cell imbalance is taken to be 'zero' in case we don't support that battery's management IC. Provide a driver for reading cell voltages for the TI BQ4050 family. This IC is quite popular, but by no means universal. BUG=b:111214767 BRANCH=none TEST=Boot on Careena with a custom debug print statement, showing that we can measure the typical battery voltages during and after the boot at the battery status polling interval. Change-Id: I235389b252ac9c373aa9706dbd1066f7c0bbce71 Signed-off-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1162663 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'common/charge_state_v2.c')
-rw-r--r--common/charge_state_v2.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c
index d97157e38b..5cca92f181 100644
--- a/common/charge_state_v2.c
+++ b/common/charge_state_v2.c
@@ -1973,14 +1973,19 @@ int charge_prevent_power_on(int power_button_pressed)
automatic_power_on = 0;
/*
* Require a minimum battery level to power on and ensure that the
- * battery can prvoide power to the system.
+ * battery can provide power to the system.
*/
if (current_batt_params->is_present != BP_YES ||
+#ifdef CONFIG_BATTERY_MEASURE_IMBALANCE
+ (current_batt_params->flags & BATT_FLAG_IMBALANCED_CELL &&
+ current_batt_params->state_of_charge <
+ CONFIG_CHARGER_MIN_BAT_PCT_IMBALANCED_POWER_ON) ||
+#endif
#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)
+ CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON)
prevent_power_on = 1;
#if defined(CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON) && \