summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Collyer <scollyer@google.com>2020-01-17 11:26:24 -0800
committerCommit Bot <commit-bot@chromium.org>2020-01-21 14:56:33 +0000
commit3273ea5617c09ef7e321052825dfc3d7a4ba083d (patch)
tree7c0787ad7499cad9069e7b1a1874a12a4567d3c5
parent9e20048e64bb44c3acd228974815c2e4f467a6f7 (diff)
downloadchrome-ec-3273ea5617c09ef7e321052825dfc3d7a4ba083d.tar.gz
bq25710: Check battery disconnect state prior to enabling ICO mode
The bq25710 has an ICO (input current optimization) feature that's used for hw current ramp. When ICO mode is enabled, VSYS is not regulated, and therefore ICO mode can only be utilized when a battery is present. The driver was checking for battery presence, but did not account for the battery discharge FET being disabled. This latter case can happen when a battery has been put into ship mode and AC power gets applied again. This CL adds the check for battery disconnected state and will not allow the hw ramp to be enabled if the battery discharge FET is disabled. BUG=b:146914669 BRANCH=firmware-hatch-12672.B TEST=tested on kindred, put battery in ship mode, then reconnected AC power and verified that the AP power sequences correctly, and that there is no PPVAR_VSYS collapse. Change-Id: I0535d6a89a135e6bfd64400f17f8072ec6a6a7aa Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2008096 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Philip Chen <philipchen@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org> (cherry picked from commit 1cb3412e1259e170de466f75e4539ec37538767c) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2007323 Reviewed-by: David Huang <David.Huang@quantatw.com> Commit-Queue: Tim Wawrzynczak <twawrzynczak@chromium.org> Tested-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
-rw-r--r--driver/charger/bq25710.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/driver/charger/bq25710.c b/driver/charger/bq25710.c
index c4035d2f1b..9df085d78f 100644
--- a/driver/charger/bq25710.c
+++ b/driver/charger/bq25710.c
@@ -490,10 +490,12 @@ int charger_set_hw_ramp(int enable)
if (enable) {
/*
* ICO mode can only be used when a battery is present. If there
- * is no battery, then enabling ICO mode will lead to VSYS
+ * is no battery, or if the battery has not recovered yet from
+ * cutoff, then enabling ICO mode will lead to VSYS
* dropping out.
*/
- if (!battery_is_present()) {
+ if (!battery_is_present() || (battery_get_disconnect_state() !=
+ BATTERY_NOT_DISCONNECTED)) {
CPRINTF("bq25710: no battery, skip ICO enable\n");
return EC_ERROR_UNKNOWN;
}