summaryrefslogtreecommitdiff
path: root/include/battery.h
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@google.com>2017-03-07 13:36:04 -0800
committerchrome-bot <chrome-bot@chromium.org>2017-03-09 01:09:35 -0800
commitfa1a7c49f74af490aa8bdea37e574780859f9258 (patch)
treebfd6f9927a2cae5e58f20af8c34f33b7858b8bd7 /include/battery.h
parent73cd8cc2c4f5864755a86f234d1b477328cda179 (diff)
downloadchrome-ec-fa1a7c49f74af490aa8bdea37e574780859f9258.tar.gz
battery: Allow BATTERY_LEVEL_NEAR_FULL to be defined by board
Allow the board to override the hardcoded 97% value for reporting to the host (and controlling LED behavior) when the battery is "near full". When enabling "discharge on ac" with a full battery the battery stops taking a charge until it reaches ~94% SOC (the actual value is not set but rather comes from a smart battery status bit) but the user will see the device as discharging between 97% and 94%. The host side view can be worked around with a powerd preference. The LED behavior is all inside the EC, so you end up with the LED showing discharging when it should not. If we allow the board to override this to 94% then the LED and host behavior is consistent. BUG=b:36024657 BRANCH=none TEST=make -j buildall Change-Id: Ie5ab8e41b87101e201073276bf441e25be7daca4 Signed-off-by: Duncan Laurie <dlaurie@google.com> Reviewed-on: https://chromium-review.googlesource.com/450949 Reviewed-by: Scott Collyer <scollyer@chromium.org>
Diffstat (limited to 'include/battery.h')
-rw-r--r--include/battery.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/battery.h b/include/battery.h
index f2d65c7127..4848ef080b 100644
--- a/include/battery.h
+++ b/include/battery.h
@@ -14,7 +14,11 @@
#define BATTERY_LEVEL_FULL 100
/* Tell host we're charged when battery level >= this percentage */
+#ifdef CONFIG_BATTERY_LEVEL_NEAR_FULL
+#define BATTERY_LEVEL_NEAR_FULL CONFIG_BATTERY_LEVEL_NEAR_FULL
+#else
#define BATTERY_LEVEL_NEAR_FULL 97
+#endif
/*
* Send battery-low host event when discharging and battery level <= this level