diff options
author | Caveh Jalali <caveh@chromium.org> | 2021-11-02 20:22:26 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-11-11 04:14:05 +0000 |
commit | 27bdf8cb59509d5334017a00ad31d82e2c3b6817 (patch) | |
tree | 34beae2f41692e341930334fe011dd6f6f9476ab /driver | |
parent | 45a46c2a52d7a564db12f36067182c7738cc1b07 (diff) | |
download | chrome-ec-27bdf8cb59509d5334017a00ad31d82e2c3b6817.tar.gz |
bq25710: Allow CMP_REF to be configured
This adds support for selecting 1.2 V for the CMP_REF field in the
charge option 1 register. When CONFIG_CHARGER_BQ25710_CMP_REF_1P2 is
defined, the charger chip will be initialized to use 1.2 V for CMP_REF.
BRANCH=none
BUG=b:185190976
TEST=buildall passes
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Change-Id: I8793506b318b61505aa7c0afbc4d8e898680b44d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3272352
Reviewed-by: Boris Mittelberg <bmbm@google.com>
Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r-- | driver/charger/bq25710.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/driver/charger/bq25710.c b/driver/charger/bq25710.c index 2df3477fdc..eda50c0d57 100644 --- a/driver/charger/bq25710.c +++ b/driver/charger/bq25710.c @@ -32,6 +32,14 @@ #endif /* + * Helper macros + */ + +#define SET_CO1_BY_NAME(_field, _c, _x) SET_BQ_FIELD_BY_NAME(BQ257X0, \ + CHARGE_OPTION_1, \ + _field, _c, (_x)) + +/* * Delay required from taking the bq25710 out of low power mode and having the * correct value in register 0x3E for VSYS_MIN voltage. The length of the delay * was determined by experiment. Less than 12 msec was not enough of delay, so @@ -243,7 +251,8 @@ static int bq257x0_init_charge_option_1(int chgnum) int rv; int reg; - if (!IS_ENABLED(CONFIG_CHARGER_BQ25710_PSYS_SENSING)) + if (!IS_ENABLED(CONFIG_CHARGER_BQ25710_PSYS_SENSING) && + !IS_ENABLED(CONFIG_CHARGER_BQ25710_CMP_REF_1P2)) return EC_SUCCESS; rv = raw_read16(chgnum, BQ25710_REG_CHARGE_OPTION_1, ®); @@ -253,6 +262,9 @@ static int bq257x0_init_charge_option_1(int chgnum) if (IS_ENABLED(CONFIG_CHARGER_BQ25710_PSYS_SENSING)) reg = co1_set_psys_sensing(reg, true); + if (IS_ENABLED(CONFIG_CHARGER_BQ25710_CMP_REF_1P2)) + reg = SET_CO1_BY_NAME(CMP_REF, 1P2, reg); + return raw_write16(chgnum, BQ25710_REG_CHARGE_OPTION_1, reg); } |