summaryrefslogtreecommitdiff
path: root/common/charge_state.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2013-11-07 14:36:02 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-12-02 22:03:54 +0000
commit40a1e7fa75b9fd51cf62ee8d725a5b35d846dbd5 (patch)
tree0d403622ef503e01417e050ca6457ebf65e44643 /common/charge_state.c
parentc0ec787ba10dd3ef5fc089cf1449468ec45ff668 (diff)
downloadchrome-ec-40a1e7fa75b9fd51cf62ee8d725a5b35d846dbd5.tar.gz
Cleanly force battery to mAh mode when reading capacity
Smart batteries can report capacity in mAh or 10mW units. We forced the units to mAh in charge_state.c's main loop, but that doesn't guarantee that they're actually set before the capacity is read. It's cleaner to check the capacity reporting mode when actually reading the capacity. BUG=chrome-os-partner:20881 BRANCH=none TEST=battery command reports the same capacity data before/after change (on rambi, design=2940 mAh) Change-Id: I4a4c80eaade72bb09627d5d65693c097e264a992 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/176154
Diffstat (limited to 'common/charge_state.c')
-rw-r--r--common/charge_state.c8
1 files changed, 0 insertions, 8 deletions
diff --git a/common/charge_state.c b/common/charge_state.c
index 8f93248c05..be07113a0d 100644
--- a/common/charge_state.c
+++ b/common/charge_state.c
@@ -361,14 +361,6 @@ static int state_common(struct power_state_context *ctx)
if (batt->desired_current > user_current_limit)
batt->desired_current = user_current_limit;
- if (battery_is_in_10mw_mode(&d)) {
- curr->error |= F_BATTERY_MODE;
- } else if (d) {
- /* Battery capacity mode was set to mW; reset it back to mAh */
- if (battery_set_10mw_mode(0))
- ctx->curr.error |= F_BATTERY_MODE;
- }
-
if (fake_state_of_charge >= 0)
*ctx->memmap_batt_cap =
fake_state_of_charge *