diff options
author | Vic Yang <victoryang@chromium.org> | 2013-09-04 21:10:14 +0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2013-09-05 10:11:44 +0000 |
commit | c4da0e4461a92a4193e8909aeb23b6f42090d0e8 (patch) | |
tree | 043c7c596508f0b169289332356b559e845b00a4 | |
parent | b75a3ee153c1834f0b71fe5d72de076cd112cd0f (diff) | |
download | chrome-ec-c4da0e4461a92a4193e8909aeb23b6f42090d0e8.tar.gz |
Set termination current to minimum for BQ24192 charger
The charger stops charging when charging current is smaller than this
value. To maximize battery life, let's set this value to its minimum so
that the battery is charged to as full as possible.
BUG=chrome-os-partner:22238
TEST=Test charging on Kirby with the next CL
BRANCH=None
Change-Id: I528dd0668244cba480538b825fff1cf28d7748ec
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/168006
-rw-r--r-- | common/charger_bq24192.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/common/charger_bq24192.c b/common/charger_bq24192.c index 377af57665..6debffa347 100644 --- a/common/charger_bq24192.c +++ b/common/charger_bq24192.c @@ -58,6 +58,18 @@ static int bq24192_watchdog_reset(void) bq24192_write(BQ24192_REG_POWER_ON_CFG, val); } +static int bq24192_set_terminate_current(int current) +{ + int reg_val, rv; + int val = (current - 128) / 128; + + rv = bq24192_read(BQ24192_REG_PRE_CHG_CURRENT, ®_val); + if (rv) + return rv; + reg_val = (reg_val & ~0xf) | (val & 0xf); + return bq24192_write(BQ24192_REG_PRE_CHG_CURRENT, reg_val); +} + int charger_enable_otg_power(int enabled) { int val, rv; @@ -194,6 +206,13 @@ int charger_set_voltage(int voltage) return bq24192_write(BQ24192_REG_CHG_VOLTAGE, val); } +/* Charging power state initialization */ +int charger_post_init(void) +{ + /* Input current controlled by extpower module. Do nothing here. */ + return EC_SUCCESS; +} + /*****************************************************************************/ /* Hooks */ @@ -220,6 +239,9 @@ static void bq24192_init(void) if (rv) return; + if (bq24192_set_terminate_current(128)) + return; + if (bq24192_watchdog_reset()) return; |