diff options
author | Alec Berg <alecaberg@chromium.org> | 2014-06-06 09:18:45 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-06-07 01:29:53 +0000 |
commit | 49cc3902b06b10c03bb139fda864ca9b591f958a (patch) | |
tree | bb5617bce1eb3c759dee571b3acfe9a0a9d5e62d /driver | |
parent | 57856ba2b31ca46c5f450abdcb5725939c40a529 (diff) | |
download | chrome-ec-49cc3902b06b10c03bb139fda864ca9b591f958a.tar.gz |
samus: allow charging of dead battery requesting nil
On samus battery, when the battery is dead it reports 0 for desired
voltage, current, and state of charge. In this case we should allow
charging.
Added a CONFIG option for this that should be removed as soon as
the battery side is fixed.
With this CL, when a dead samus battery is used and a charger is
connected, we attempt to charge it.
BUG=chrome-os-partner:29465
BRANCH=none
TEST=test on a samus with a dead battery. w/o this CL, the battery
never charges because the charging not allowed flag is set. With this
CL, the battery charges.
Change-Id: Ic61f27a27237166d33cb9ea5f024d3ef6360ce82
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/202603
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r-- | driver/battery/smart.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/driver/battery/smart.c b/driver/battery/smart.c index 52e61a8699..6dcedfd81f 100644 --- a/driver/battery/smart.c +++ b/driver/battery/smart.c @@ -300,9 +300,22 @@ void battery_get_params(struct batt_params *batt) if (!(batt_new.flags & (BATT_FLAG_BAD_DESIRED_VOLTAGE | BATT_FLAG_BAD_DESIRED_CURRENT | BATT_FLAG_BAD_STATE_OF_CHARGE)) && +#ifdef CONFIG_BATTERY_REQUESTS_NIL_WHEN_DEAD + /* + * TODO (crosbug.com/p/29467): remove this workaround + * for dead battery that requests no voltage/current + */ + ((batt_new.desired_voltage && + batt_new.desired_current && + batt_new.state_of_charge < BATTERY_LEVEL_FULL) || + (batt_new.desired_voltage == 0 && + batt_new.desired_current == 0 && + batt_new.state_of_charge == 0))) +#else batt_new.desired_voltage && batt_new.desired_current && batt_new.state_of_charge < BATTERY_LEVEL_FULL) +#endif batt_new.flags |= BATT_FLAG_WANT_CHARGE; else /* Force both to zero */ |