summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/battery.c5
-rw-r--r--common/charge_state_v2.c18
2 files changed, 14 insertions, 9 deletions
diff --git a/common/battery.c b/common/battery.c
index 4670b436b0..c24bf59da9 100644
--- a/common/battery.c
+++ b/common/battery.c
@@ -702,6 +702,11 @@ int battery_manufacturer_name(char *dest, int size)
return get_battery_manufacturer_name(dest, size);
}
+__overridable enum battery_disconnect_state battery_get_disconnect_state(void)
+{
+ return BATTERY_NOT_DISCONNECTED;
+}
+
#ifdef CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV
#if CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV < 5000 || \
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c
index 948789fba6..6f1cc833c5 100644
--- a/common/charge_state_v2.c
+++ b/common/charge_state_v2.c
@@ -2069,6 +2069,15 @@ void charger_task(void *u)
}
/* The battery is responding. Yay. Try to use it. */
+
+ /*
+ * Always check the disconnect state. This is because
+ * the battery disconnect state is one of the items used
+ * to decide whether or not to leave safe mode.
+ */
+ battery_seems_disconnected =
+ battery_get_disconnect_state() == BATTERY_DISCONNECTED;
+
#ifdef CONFIG_BATTERY_REQUESTS_NIL_WHEN_DEAD
/*
* TODO (crosbug.com/p/29467): remove this workaround
@@ -2085,15 +2094,6 @@ void charger_task(void *u)
} else
#endif
#ifdef CONFIG_BATTERY_REVIVE_DISCONNECT
- /*
- * Always check the disconnect state. This is because
- * the battery disconnect state is one of the items used
- * to decide whether or not to leave safe mode.
- */
- battery_seems_to_be_disconnected =
- battery_get_disconnect_state() ==
- BATTERY_DISCONNECTED;
-
if (curr.requested_voltage == 0 &&
curr.requested_current == 0 &&
battery_seems_disconnected) {