diff options
author | Vincent Palatin <vpalatin@chromium.org> | 2015-06-24 10:29:15 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-06-24 23:13:23 +0000 |
commit | 564256d2eeb40e63e400ddea0a27489ca4947da1 (patch) | |
tree | a394b336e724084f1d6bfb1f1b0a7f54950dcbae | |
parent | 68198a2446bd07d670cdd7a0323ded8c4f5d2391 (diff) | |
download | chrome-ec-564256d2eeb40e63e400ddea0a27489ca4947da1.tar.gz |
bq2589x: ryu: enable IR compensation
Set the resistance compensation for the charger IC according to the EE
team measurements :
- Resistance compensation = 60 mOhm
- Voltage clamping = 160 mV
- Thermal regulation = 120C
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=smaug
BUG=chrome-os-partner:38603
TEST=dump the BQ25892 registers by using the "bq25" command and see that
REG08 contains 0x77.
Change-Id: I90e9ea4569d77fd90ed0290ec78e66810d744648
Reviewed-on: https://chromium-review.googlesource.com/281660
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r-- | board/ryu/board.h | 3 | ||||
-rw-r--r-- | driver/charger/bq2589x.c | 8 | ||||
-rw-r--r-- | driver/charger/bq2589x.h | 25 | ||||
-rw-r--r-- | include/config.h | 6 |
4 files changed, 42 insertions, 0 deletions
diff --git a/board/ryu/board.h b/board/ryu/board.h index 84fa024fea..4d7d28c0a5 100644 --- a/board/ryu/board.h +++ b/board/ryu/board.h @@ -68,6 +68,9 @@ #define CONFIG_CHARGER #define CONFIG_CHARGER_V2 #define CONFIG_CHARGER_BQ25892 +#define CONFIG_CHARGER_BQ2589X_IR_COMP (BQ2589X_IR_TREG_120C | \ + BQ2589X_IR_VCLAMP_160MV | \ + BQ2589X_IR_BAT_COMP_60MOHM) #define CONFIG_CHARGER_BQ2589X_BOOST (BQ2589X_BOOSTV_MV(4998) | \ BQ2589X_BOOST_LIM_1650MA) #define CONFIG_CHARGER_ILIM_PIN_DISABLED diff --git a/driver/charger/bq2589x.c b/driver/charger/bq2589x.c index 6de1c65f33..e54f0d7a9e 100644 --- a/driver/charger/bq2589x.c +++ b/driver/charger/bq2589x.c @@ -24,6 +24,11 @@ #define CONFIG_CHARGER_BQ2589X_BOOST BQ2589X_BOOST_DEFAULT #endif +/* IR compensation settings */ +#ifndef CONFIG_CHARGER_BQ2589X_IR_COMP +#define CONFIG_CHARGER_BQ2589X_IR_COMP BQ2589X_IR_COMP_DEFAULT +#endif + /* Charger information */ static const struct charger_info bq2589x_charger_info = { .name = "bq2589x", @@ -265,6 +270,9 @@ static void bq2589x_init(void) if (bq2589x_watchdog_reset()) return; + if (bq2589x_write(BQ2589X_REG_IR_COMP, CONFIG_CHARGER_BQ2589X_IR_COMP)) + return; + if (bq2589x_write(BQ2589X_REG_BOOST_MODE, CONFIG_CHARGER_BQ2589X_BOOST)) return; diff --git a/driver/charger/bq2589x.h b/driver/charger/bq2589x.h index fd5119536c..771868a7cc 100644 --- a/driver/charger/bq2589x.h +++ b/driver/charger/bq2589x.h @@ -43,6 +43,31 @@ #define BQ2589X_CFG2_OTG_CONFIG (1<<5) #define BQ2589X_CFG2_WD_RST (1<<6) +/* REG08 : IR compensation definitions */ +#define BQ2589X_IR_BAT_COMP_140MOHM (7 << 5) +#define BQ2589X_IR_BAT_COMP_120MOHM (6 << 5) +#define BQ2589X_IR_BAT_COMP_100MOHM (5 << 5) +#define BQ2589X_IR_BAT_COMP_80MOHM (4 << 5) +#define BQ2589X_IR_BAT_COMP_60MOHM (3 << 5) +#define BQ2589X_IR_BAT_COMP_40MOHM (2 << 5) +#define BQ2589X_IR_BAT_COMP_20MOHM (1 << 5) +#define BQ2589X_IR_BAT_COMP_0MOHM (0 << 5) +#define BQ2589X_IR_VCLAMP_224MV (7 << 2) +#define BQ2589X_IR_VCLAMP_192MV (6 << 2) +#define BQ2589X_IR_VCLAMP_160MV (5 << 2) +#define BQ2589X_IR_VCLAMP_128MV (4 << 2) +#define BQ2589X_IR_VCLAMP_96MV (3 << 2) +#define BQ2589X_IR_VCLAMP_64MV (2 << 2) +#define BQ2589X_IR_VCLAMP_32MV (1 << 2) +#define BQ2589X_IR_VCLAMP_0MV (0 << 2) +#define BQ2589X_IR_TREG_120C (3 << 0) +#define BQ2589X_IR_TREG_100C (2 << 0) +#define BQ2589X_IR_TREG_80C (1 << 0) +#define BQ2589X_IR_TREG_60C (0 << 0) + +#define BQ2589X_IR_COMP_DEFAULT (BQ2589X_IR_TREG_120C | BQ2589X_IR_VCLAMP_0MV |\ + BQ2589X_IR_BAT_COMP_0MOHM) + /* 5V VBUS Boost settings */ #define BQ2589X_BOOSTV_MV(mv) (((((mv) - 4550)/64) & 0xF) << 4) #define BQ2589X_BOOSTV_DEFAULT BQ2589X_BOOSTV_MV(4998) diff --git a/include/config.h b/include/config.h index 7050b94ee7..46aed17057 100644 --- a/include/config.h +++ b/include/config.h @@ -253,6 +253,12 @@ #undef CONFIG_CHARGER_TPS65090 /* Note: does not use CONFIG_CHARGER */ /* + * BQ2589x IR Compensation settings. + * Should be the combination of BQ2589X_IR_TREG_xxxC, BQ2589X_IR_VCLAMP_yyyMV + * and BQ2589X_IR_BAT_COMP_zzzMOHM. + */ +#undef CONFIG_CHARGER_BQ2589X_IR_COMP +/* * BQ2589x 5V boost current limit and voltage. * Should be the combination of BQ2589X_BOOSTV_MV(voltage) and * BQ2589X_BOOST_LIM_xxxMA. |