summaryrefslogtreecommitdiff
path: root/common/charge_state_v2.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/charge_state_v2.c')
-rw-r--r--common/charge_state_v2.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c
index 4a58aae54f..87ad28561b 100644
--- a/common/charge_state_v2.c
+++ b/common/charge_state_v2.c
@@ -570,6 +570,21 @@ void charger_task(void)
goto wait_for_it;
} else {
/* The battery is responding. Yay. Try to use it. */
+#ifdef CONFIG_BATTERY_REQUESTS_NIL_WHEN_DEAD
+ /*
+ * TODO (crosbug.com/p/29467): remove this workaround
+ * for dead battery that requests no voltage/current
+ */
+ if (curr.requested_voltage == 0 &&
+ curr.requested_current == 0 &&
+ curr.batt.state_of_charge == 0) {
+ /* Battery is dead, give precharge current */
+ curr.requested_voltage =
+ batt_info->voltage_max;
+ curr.requested_current =
+ batt_info->precharge_current;
+ } else
+#endif
if (curr.state == ST_PRECHARGE ||
battery_seems_to_be_dead) {
CPRINTS("battery woke up");