summaryrefslogtreecommitdiff
path: root/common/battery.c
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2014-03-26 10:31:04 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-03-27 18:45:06 +0000
commitf47b6e84e5ca3d5a7a5351e950b865e2ca6d7c32 (patch)
treeb2d5f440abcf4b7c6bbf530a624ace59c396169e /common/battery.c
parent3f3a2e20a1c24982bf71ec31653f7321c1017439 (diff)
downloadchrome-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 'common/battery.c')
-rw-r--r--common/battery.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/common/battery.c b/common/battery.c
index 7f318646a3..1f8b757929 100644
--- a/common/battery.c
+++ b/common/battery.c
@@ -21,9 +21,10 @@
/**
* Physical detection of battery.
*/
-int battery_is_present(void)
+enum battery_present battery_is_present(void)
{
- return (gpio_get_level(CONFIG_BATTERY_PRESENT_GPIO) == 0);
+ /* The GPIO is low when the battery is present */
+ return gpio_get_level(CONFIG_BATTERY_PRESENT_GPIO) ? BP_NO : BP_YES;
}
#endif