summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/charge_state_v2.c4
-rw-r--r--driver/battery/smart.c4
-rw-r--r--include/config.h7
3 files changed, 15 insertions, 0 deletions
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c
index 26eeb5e0f2..826a51fc2e 100644
--- a/common/charge_state_v2.c
+++ b/common/charge_state_v2.c
@@ -1516,7 +1516,11 @@ void charger_task(void *u)
*/
if (curr.requested_voltage == 0 &&
curr.requested_current == 0 &&
+#ifdef CONFIG_BATTERY_DEAD_UNTIL_VALUE
+ curr.batt.state_of_charge < CONFIG_BATTERY_DEAD_UNTIL_VALUE) {
+#else
curr.batt.state_of_charge == 0) {
+#endif
/* Battery is dead, give precharge current */
curr.requested_voltage =
batt_info->voltage_max;
diff --git a/driver/battery/smart.c b/driver/battery/smart.c
index 743ebc1ee1..abc1816f36 100644
--- a/driver/battery/smart.c
+++ b/driver/battery/smart.c
@@ -380,7 +380,11 @@ void battery_get_params(struct batt_params *batt)
batt_new.state_of_charge < BATTERY_LEVEL_FULL) ||
(batt_new.desired_voltage == 0 &&
batt_new.desired_current == 0 &&
+#ifdef CONFIG_BATTERY_DEAD_UNTIL_VALUE
+ batt_new.state_of_charge < CONFIG_BATTERY_DEAD_UNTIL_VALUE)))
+#else
batt_new.state_of_charge == 0)))
+#endif
#else
batt_new.desired_voltage &&
batt_new.desired_current &&
diff --git a/include/config.h b/include/config.h
index 0d1bca56c7..a9e89d901e 100644
--- a/include/config.h
+++ b/include/config.h
@@ -358,6 +358,13 @@
#undef CONFIG_BATTERY_V2
/*
+ * Some fuel gauges in battery take some time to return valid battery params
+ * when wake form dead battery.
+ * It need to do precharge to take valid battery params.
+ */
+#undef CONFIG_BATTERY_DEAD_UNTIL_VALUE
+
+/*
* Number of batteries, only matters when CONFIG_BATTERY_V2 is used.
*/
#undef CONFIG_BATTERY_COUNT