diff options
author | Randall Spangler <rspangler@chromium.org> | 2013-11-07 14:36:02 -0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2013-12-02 22:03:54 +0000 |
commit | 40a1e7fa75b9fd51cf62ee8d725a5b35d846dbd5 (patch) | |
tree | 0d403622ef503e01417e050ca6457ebf65e44643 /include | |
parent | c0ec787ba10dd3ef5fc089cf1449468ec45ff668 (diff) | |
download | chrome-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 'include')
-rw-r--r-- | include/battery.h | 38 |
1 files changed, 4 insertions, 34 deletions
diff --git a/include/battery.h b/include/battery.h index cb2a5c32ef..522f3aa80a 100644 --- a/include/battery.h +++ b/include/battery.h @@ -113,39 +113,12 @@ int battery_is_connected(void); * * See MODE_* constants in battery_smart.h * - * @param mode Destination for current mode. + * @param mode Destination for current mode. * @return non-zero if error. */ int battery_get_mode(int *mode); /** - * Set battery mode. - * - * See MODE_* constants in battery_smart.h - * - * @param mode New mode. - * @return non-zero if error. - */ -int battery_set_mode(int mode); - -/** - * Check if battery is reporting capacity in 10 mW units. - * - * @param val Destination for capacity units; set zero if mAh or - * non-zero if 10 mW. - * @return non-zero if error. - */ -int battery_is_in_10mw_mode(int *val); - -/** - * Set battery capacity units. - * - * @param enabled Set mode to mAh (=0) or 10 mW (=1) - * @return non-zero if error. - */ -int battery_set_10mw_mode(int enabled); - -/** * Read nominal voltage battery is designed to supply. * * @param voltage Destination for voltage in mW @@ -164,8 +137,7 @@ int battery_state_of_charge_abs(int *percent); /** * Read battery remaining capacity. * - * @param capacity Destination for capacity; units are mAh or 10 mW, - * depending on battery_is_in_10mw_mode(). + * @param capacity Destination for capacity in mAh * @return non-zero if error. */ int battery_remaining_capacity(int *capacity); @@ -173,8 +145,7 @@ int battery_remaining_capacity(int *capacity); /** * Read battery full charge capacity. * - * @param capacity Destination for capacity; units are mAh or 10 mW, - * depending on battery_is_in_10mw_mode(). + * @param capacity Destination for capacity in mAh * @return non-zero if error. */ int battery_full_charge_capacity(int *capacity); @@ -182,8 +153,7 @@ int battery_full_charge_capacity(int *capacity); /** * Read the nominal capacity the battery is designed to supply when new. * - * @param capacity Destination for capacity; units are mAh or 10 mW, - * depending on battery_is_in_10mw_mode(). + * @param capacity Destination for capacity in mAh * @return non-zero if error. */ int battery_design_capacity(int *capacity); |