diff options
author | Bill Richardson <wfrichar@chromium.org> | 2014-03-27 11:10:46 -0700 |
---|---|---|
committer | Bill Richardson <wfrichar@chromium.org> | 2014-03-28 15:23:01 +0000 |
commit | 91a5fa01940764832c1b974d2022bee4e744f09c (patch) | |
tree | 3a772b75245da7c02cc4ddfa01752168577eee82 /driver/battery/bq27541.c | |
parent | b2d87dc18ad0c6049a48959f4c2d7dfddaf301f1 (diff) | |
download | chrome-ec-91a5fa01940764832c1b974d2022bee4e744f09c.tar.gz |
Add more fields and error flags to struct batt_params
This adds two battery parameters that need to be monitored constantly:
remaining_capacity and full_capacity (that one only changes occasionally,
but we have to notify the AP when it does).
It also adds the is_present field to indicate whether the battery is
physically present or not (when we can tell), so we know whether to try to
wake up a deep-discharged battery.
Along with that, we clean up the error flags to provide indication of which
fields were unable to be read, and replace the manual logical-or of all
errors as they were set with a bitmask (BATT_FLAG_BAD_ANY).
No functionality is changed, only new & better information is provided for
use in the upcoming cleanup of the charge state machine.
BUG=chrome-os-partner:20881
BRANCH=ToT
TEST=make buildall -j
All targets build; all tests pass.
Change-Id: I4312c2fdd3cf2dd9570718e90571eff796b269db
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/191917
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'driver/battery/bq27541.c')
-rw-r--r-- | driver/battery/bq27541.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/driver/battery/bq27541.c b/driver/battery/bq27541.c index 43b669476b..8999ac2324 100644 --- a/driver/battery/bq27541.c +++ b/driver/battery/bq27541.c @@ -187,19 +187,19 @@ void battery_get_params(struct batt_params *batt) batt->flags = 0; if (bq27541_read(REG_TEMPERATURE, &batt->temperature)) - batt->flags |= BATT_FLAG_BAD_ANY; + batt->flags |= BATT_FLAG_BAD_TEMPERATURE; else batt->flags |= BATT_FLAG_RESPONSIVE; /* Battery is responding */ if (bq27541_read(REG_STATE_OF_CHARGE, &batt->state_of_charge)) - batt->flags |= BATT_FLAG_BAD_ANY | BATT_FLAG_BAD_CHARGE_PERCENT; + batt->flags |= BATT_FLAG_BAD_STATE_OF_CHARGE; if (bq27541_read(REG_VOLTAGE, &batt->voltage)) - batt->flags |= BATT_FLAG_BAD_ANY | BATT_FLAG_BAD_VOLTAGE; + batt->flags |= BATT_FLAG_BAD_VOLTAGE; v = 0; if (bq27541_read(REG_AVERAGE_CURRENT, &v)) - batt->flags |= BATT_FLAG_BAD_ANY; + batt->flags |= BATT_FLAG_BAD_CURRENT; batt->current = (int16_t)v; /* Default to not desiring voltage and current */ |