diff options
author | xiong.huang <xiong.huang@bitland.corp-partner.google.com> | 2019-11-03 19:45:07 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-11-08 05:13:15 +0000 |
commit | 65682795d639b111f950057a82d9d46647996875 (patch) | |
tree | f4d63230fbcd6f1bb6aab96d1c14472a5fb0df8d /board | |
parent | afb2ed0ec1901eaeb38ae944e1d15562eba2fe7e (diff) | |
download | chrome-ec-65682795d639b111f950057a82d9d46647996875.tar.gz |
Kodama: SMP battery cannot be charged in over discharge state
SMP battery uses HW pre-charge circuit and pre-charge current is
limited to ~50mA. Once the charge current is lower than IEOC level
within CHG_TEDG_EOC, and TE is enabled, the charging power path
will be turned off.
Charger vendor advice that disable EOC and TE when battery stays over
discharge state, otherwise enable EOC and TE.
BUG=b:142630134
TEST=Verified on both SMP battery and Celxpert battery in over
discharge state, all passed.
BRANCH=kukui
Change-Id: I7d6907d54ab555587a489333350de6e9aeffe60e
Signed-off-by: Xiong Huang <xiong.huang@bitland.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1893901
Reviewed-by: Eric Yilun Lin <yllin@chromium.org>
Diffstat (limited to 'board')
-rw-r--r-- | board/kodama/battery.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/board/kodama/battery.c b/board/kodama/battery.c index 21e5672879..e64e0c167a 100644 --- a/board/kodama/battery.c +++ b/board/kodama/battery.c @@ -83,10 +83,37 @@ enum battery_present battery_hw_present(void) int charger_profile_override(struct charge_state_data *curr) { + const struct battery_info *batt_info = battery_get_info(); + static int normal_charge_lock, over_discharge_lock; /* battery temp in 0.1 deg C */ int bat_temp_c = curr->batt.temperature - 2731; /* + * SMP battery uses HW pre-charge circuit and pre-charge current is + * limited to ~50mA. Once the charge current is lower than IEOC level + * within CHG_TEDG_EOC, and TE is enabled, the charging power path will + * be turned off. Disable EOC and TE when battery stays over discharge + * state, otherwise enable EOC and TE. + */ + if (curr->batt.voltage < batt_info->voltage_min) { + normal_charge_lock = 0; + + if (!over_discharge_lock && curr->state == ST_CHARGE) { + over_discharge_lock = 1; + rt946x_enable_charge_eoc(0); + rt946x_enable_charge_termination(0); + } + } else { + over_discharge_lock = 0; + + if (!normal_charge_lock) { + normal_charge_lock = 1; + rt946x_enable_charge_eoc(1); + rt946x_enable_charge_termination(1); + } + } + + /* * When smart battery temperature is more than 45 deg C, the max * charging voltage is 4100mV. */ @@ -107,9 +134,6 @@ int charger_profile_override(struct charge_state_data *curr) if (!curr->batt.is_present && curr->requested_voltage == 0 && curr->requested_current == 0) { - const struct battery_info *batt_info = - battery_get_info(); - /* * b/138978212: With adapter plugged in S0, the system * will set charging current and voltage as 0V/0A once |