summaryrefslogtreecommitdiff
path: root/driver/charger
diff options
context:
space:
mode:
authorPeter Marheine <pmarheine@chromium.org>2022-08-12 10:29:10 +1000
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-08-15 00:47:35 +0000
commit3aee98e43724c18c222b7114ac1196bc7d53b2be (patch)
treecdb91c8c16bc086d02e4964469197b7db2678474 /driver/charger
parentd84b01e8075947e37272c041ce4bbeb905babffd (diff)
downloadchrome-ec-3aee98e43724c18c222b7114ac1196bc7d53b2be.tar.gz
sm5803: avoid requesting 0 fast-charge current
Silicon Mitus claim that setting the fast charge current to zero can cause charger instability, so force requests for zero current to set a nominal value instead of zero. This should be safe because this function only sets the fast charge current limit, and situations where the charge manager sets zero current should be outside the domain where the charger will use fast-charge mode. BUG=b:230712704 TEST=Fast charge current limit on Nereid is set to 100 mA instead of zero when the battery is fully charged; no errors are reported. BRANCH=none Signed-off-by: Peter Marheine <pmarheine@chromium.org> Change-Id: I3f625552913d40a7a8f8b3d0ac9874e3af7f0a56 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3826712 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'driver/charger')
-rw-r--r--driver/charger/sm5803.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/driver/charger/sm5803.c b/driver/charger/sm5803.c
index 363e320f89..a1fbb4a884 100644
--- a/driver/charger/sm5803.c
+++ b/driver/charger/sm5803.c
@@ -1434,6 +1434,18 @@ static enum ec_error_list sm5803_set_current(int chgnum, int current)
enum ec_error_list rv;
int reg;
+ if (current == 0) {
+ /*
+ * Per Silicon Mitus, setting the fast charge current limit to 0
+ * causes "much unstable". This normally happens when the
+ * battery is fully charged (so we don't expect fast charge to
+ * be in use): turn 0 into the minimum nonzero value so we
+ * avoid setting this register to 0 but still make the requested
+ * current as small as possible.
+ */
+ current = SM5803_REG_TO_CURRENT(1);
+ }
+
rv = chg_read8(chgnum, SM5803_REG_FAST_CONF4, &reg);
if (rv)
return rv;