diff options
author | Bill Richardson <wfrichar@chromium.org> | 2014-03-26 10:31:04 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-03-27 18:45:06 +0000 |
commit | f47b6e84e5ca3d5a7a5351e950b865e2ca6d7c32 (patch) | |
tree | b2d5f440abcf4b7c6bbf530a624ace59c396169e /include/battery.h | |
parent | 3f3a2e20a1c24982bf71ec31653f7321c1017439 (diff) | |
download | chrome-ec-f47b6e84e5ca3d5a7a5351e950b865e2ca6d7c32.tar.gz |
Make battery_is_present() tristate: YES, NO, NOT_SURE
In most cases we can't actually know whether a battery is present until
we've been able to talk to it. This adds that NOT_SURE case.
BUG=none
BRANCH=ToT
TEST=none
Nothing uses this case yet, and the only time that battery_is_present() is
called is when we have hardware to detect the battery (which always returns
YES or NO). This is just preparation for charge_state_v2, which will need
the NOT_SURE case for trickle charging.
Change-Id: Ic5793de080529d50c98860450a021a1abae168db
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/191782
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'include/battery.h')
-rw-r--r-- | include/battery.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/include/battery.h b/include/battery.h index 7072b522ef..202148559e 100644 --- a/include/battery.h +++ b/include/battery.h @@ -100,11 +100,13 @@ void battery_vendor_params(struct batt_params *batt); /** * Check for presence of battery. * - * @return non-zero if the battery is present. Note that the - * battery may not be responding on the i2c interface if it - * is deeply discharged. + * @return Whether there is a battery attached or not, or if we can't tell. */ -int battery_is_present(void); +enum battery_present { + BP_NO = 0, + BP_YES = 1, + BP_NOT_SURE, +} battery_is_present(void); /** * Get battery mode. |