samus: fix false shutdown due to low battery

Fix bug causing unit to falsely shutdown due to low battery.
The shutdown warning time was not getting reset, so two false
readings of battery SOC or voltage, seperated by more than 30
seconds in time would cause "charge force shutdown due to low
battery"

BUG=chrome-os-partner:33111, chrome-os-partner:33144
BRANCH=samus
TEST=make buildall

Change-Id: I6f00187516d23aa78139e5c1565febca34176ecc
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/224765
This commit is contained in:
Alec Berg
2014-10-21 11:43:01 -07:00
committed by chrome-internal-fetch
parent f36a859e06
commit 89feca3eb3

View File

@@ -414,8 +414,14 @@ static inline int battery_too_low(void)
/* Shut everything down before the battery completely dies. */
static void prevent_deep_discharge(void)
{
if (!battery_too_low())
if (!battery_too_low()) {
/* Reset shutdown warning time */
shutdown_warning_time.val = 0;
return;
}
CPRINTS("Low battery: %d%%, %dmV",
curr.batt.state_of_charge, curr.batt.voltage);
if (chipset_in_state(CHIPSET_STATE_ANY_OFF)) {
#ifdef CONFIG_HIBERNATE