From 2cc239894c16edf0ec48533ef13bfe5374a7eff7 Mon Sep 17 00:00:00 2001 From: Diana Z Date: Thu, 9 Jul 2020 15:54:25 -0600 Subject: SM5803: Only enable auto charge when battery is connected When the battery is physically present, but still in a disconnected state the board may brown out once the battery connects and the charger chip believes the end of charge condition is met. Only start auto charging bits when the battery has connected. BRANCH=None BUG=None TEST=on waddledee starting with cutoff battery, board doesn't brownout when battery connects Signed-off-by: Diana Z Change-Id: I8b4622de91ac9a9ae2ac734bcf52eb1f4c2acc8c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2290835 Reviewed-by: Aseda Aboagye --- driver/charger/sm5803.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'driver/charger') diff --git a/driver/charger/sm5803.c b/driver/charger/sm5803.c index dedf8e0318..eaa126653b 100644 --- a/driver/charger/sm5803.c +++ b/driver/charger/sm5803.c @@ -498,7 +498,7 @@ static enum ec_error_list sm5803_set_mode(int chgnum, int mode) flow2_reg &= ~SM5803_FLOW2_AUTO_ENABLED; } else { flow1_reg |= SM5803_FLOW1_CHG_EN; - if (battery_is_present() == BP_YES) + if (battery_get_disconnect_state() == BATTERY_NOT_DISCONNECTED) flow2_reg |= SM5803_FLOW2_AUTO_ENABLED; } -- cgit v1.2.1