summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorTing Shen <phoenixshen@chromium.org>2019-09-10 17:58:16 +0000
committerCommit Bot <commit-bot@chromium.org>2019-10-01 12:52:59 +0000
commit2d592c8b467b99061dad3f0b7552bc4b184f444a (patch)
tree077c4b0d73fd187c20738e8233ca7d1cd564f211 /driver
parent1db81be6d747c8c90ddb3f1e93dadc230506b859 (diff)
downloadchrome-ec-2d592c8b467b99061dad3f0b7552bc4b184f444a.tar.gz
battery: add precharge voltage
Add a precharge_voltage field to batt_info in case we need its value differ from voltage_min, and set precharge_voltage = 3.4V according to battery spec. BUG=b:139012899 TEST=observe the charging curve (see issue link above for test result) BRANCH=master Change-Id: I2e4b240a12cd023ed90aaeda922e10b262508624 Signed-off-by: Ting Shen <phoenixshen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1795491 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r--driver/charger/isl923x.c4
-rw-r--r--driver/charger/rt946x.c3
2 files changed, 5 insertions, 2 deletions
diff --git a/driver/charger/isl923x.c b/driver/charger/isl923x.c
index 04abb042c8..7a02f62ca0 100644
--- a/driver/charger/isl923x.c
+++ b/driver/charger/isl923x.c
@@ -339,8 +339,10 @@ static void isl923x_init(void)
#ifdef CONFIG_TRICKLE_CHARGING
const struct battery_info *bi = battery_get_info();
+ int precharge_voltage = bi->precharge_voltage ?
+ bi->precharge_voltage : bi->voltage_min;
- if (raw_write16(ISL923X_REG_SYS_VOLTAGE_MIN, bi->voltage_min))
+ if (raw_write16(ISL923X_REG_SYS_VOLTAGE_MIN, precharge_voltage))
goto init_fail;
#endif
diff --git a/driver/charger/rt946x.c b/driver/charger/rt946x.c
index 2615f9ff25..244fb2f12d 100644
--- a/driver/charger/rt946x.c
+++ b/driver/charger/rt946x.c
@@ -457,7 +457,8 @@ static int rt946x_init_setting(void)
rv = rt946x_set_ircmp_res(setting->ircmp_res);
if (rv)
return rv;
- rv = rt946x_set_vprec(batt_info->voltage_min);
+ rv = rt946x_set_vprec(batt_info->precharge_voltage ?
+ batt_info->precharge_voltage : batt_info->voltage_min);
if (rv)
return rv;
rv = rt946x_set_iprec(batt_info->precharge_current);