summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2015-01-29 11:29:37 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-01-31 05:42:48 +0000
commit7ad29b56aeaa26ff2461257bdc070e9277a41782 (patch)
tree17ae31b74964acf2e63010c37b99da7deda0dcaf
parentd93544bbed59789f728527cb8c73f9997598130c (diff)
downloadchrome-ec-7ad29b56aeaa26ff2461257bdc070e9277a41782.tar.gz
charge_state_v2: ignore false battery SOC readings
Ignore battery readings over 100%. This fixes a samus bug where a false battery SOC reading causes charging to stop. BUG=chrome-os-partner:36115, chrome-os-partner:36081 BRANCH=samus TEST=add following code to common/smart.c: static int reset_soc; in battery_get_params(): if (reset_soc) { batt_new.state_of_charge = 65535; reset_soc = 0; } after battery_get_params(): static int command_battsoc(int argc, char **argv) { reset_soc = 1; return EC_SUCCESS; } DECLARE_CONSOLE_COMMAND(battsoc, command_battsoc, "", "", NULL); This changes the battery state of charge to 65535% for one loop through charge state machine. w/o this CL, on samus the battery stops charging when you call this, but with this CL it is fixed. Change-Id: I44f054a4e84260bd7cd7b77e44b1698645ab6c35 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/244346 Reviewed-by: Shawn N <shawnn@chromium.org>
-rw-r--r--common/charge_state_v2.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c
index 0f48d2482f..5e3df653c6 100644
--- a/common/charge_state_v2.c
+++ b/common/charge_state_v2.c
@@ -611,6 +611,13 @@ void charger_task(void)
curr.batt.flags |= BATT_FLAG_BAD_TEMPERATURE;
}
+ /* If the battery thinks it's above 100%, don't believe it */
+ if (curr.batt.state_of_charge > 100) {
+ CPRINTS("ignoring ridiculous batt.soc of %d%%",
+ curr.batt.state_of_charge);
+ curr.batt.flags |= BATT_FLAG_BAD_STATE_OF_CHARGE;
+ }
+
/*
* Now decide what we want to do about it. We'll normally just
* pass along whatever the battery wants to the charger. Note
@@ -740,15 +747,6 @@ void charger_task(void)
}
/*
- * If battery seems to be disconnected, we need to get it
- * out of that state, even if the charge level is full.
- */
- if (curr.batt.state_of_charge >= BATTERY_LEVEL_FULL &&
- !battery_seems_to_be_disconnected)
- /* Full up. Stop charging */
- curr.state = ST_IDLE;
-
- /*
* TODO(crosbug.com/p/27643): Quit trying if charging too long
* without getting full (CONFIG_CHARGER_TIMEOUT_HOURS).
*/