summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorMary Ruthven <mruthven@chromium.org>2015-10-21 10:51:21 -0700
committerchrome-bot <chrome-bot@chromium.org>2015-10-27 11:52:34 -0700
commitcb4a76e8022c73fb0a0b50700912d86f41ea3dbb (patch)
tree0cfcc8ead036350e3ad994ee8229dac69a7f5b28 /driver
parent95e8bc2e0bed68b040d2b19d1dd62a4debcc1852 (diff)
downloadchrome-ec-cb4a76e8022c73fb0a0b50700912d86f41ea3dbb.tar.gz
i2c: get battery information from charge state
ARM systems currently use SBS kernel driver which talks to the battery through I2C passthu in the EC. Instead when asking for battery information try getting it from the charge state machine first, and then try the battery if charge state does not have the information. This reduces latency by cutting out the battery response time. BUG=chromium:484841 BRANCH=none TEST=check that power_supply_info works properly on Jerry Change-Id: If4da15ccabe412adc31fc94b189089ebb3e9265c Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/307905 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r--driver/battery/smart.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/driver/battery/smart.c b/driver/battery/smart.c
index 112af6abb0..212457866e 100644
--- a/driver/battery/smart.c
+++ b/driver/battery/smart.c
@@ -303,6 +303,9 @@ void battery_get_params(struct batt_params *batt)
if (battery_full_charge_capacity(&batt_new.full_capacity))
batt_new.flags |= BATT_FLAG_BAD_FULL_CAPACITY;
+ if (battery_status(&batt_new.status))
+ batt_new.flags |= BATT_FLAG_BAD_STATUS;
+
/* If any of those reads worked, the battery is responsive */
if ((batt_new.flags & BATT_FLAG_BAD_ANY) != BATT_FLAG_BAD_ANY)
batt_new.flags |= BATT_FLAG_RESPONSIVE;