summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2020-05-08 14:03:07 -0600
committerCommit Bot <commit-bot@chromium.org>2020-05-10 06:39:03 +0000
commitc803796e8f1a80ea9c660355fc7ffba6c091119b (patch)
tree44e6133a326cc36c9f005c38b71c32ba07e6bdfe
parent778245d7f970a3d6be7d7f29e69172450f0783ed (diff)
downloadchrome-ec-c803796e8f1a80ea9c660355fc7ffba6c091119b.tar.gz
SM5803: Enable interrupts after setting thresholds
Move interrupt enable to the point after configuring the interrupt thresholds. This appears to reduce how often the TINT interrupt fires on init. BRANCH=None BUG=b:155436094 TEST=on waddledee, remove power from the board, plug it in, and verify no TINT interrupt is seen during boot Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I85ac7c831572c3a05c87c3432bcfa98484bf4230 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2191138 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r--driver/charger/sm5803.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/driver/charger/sm5803.c b/driver/charger/sm5803.c
index 32fc29f63c..b4bd9afc18 100644
--- a/driver/charger/sm5803.c
+++ b/driver/charger/sm5803.c
@@ -255,10 +255,6 @@ static void sm5803_init(int chgnum)
& SM5803_CHG_ILIM_RAW;
rv = chg_write8(chgnum, SM5803_REG_CHG_ILIM, reg);
- /* Configure TINT and Vbus interrupts to fire */
- rv |= main_write8(chgnum, SM5803_REG_INT2_EN, SM5803_INT2_TINT
- | SM5803_INT2_VBUS);
-
/* Set Vbus interrupt levels for 3.5V and 4.0V */
rv |= meas_write8(chgnum, SM5803_REG_VBUS_LOW_TH,
SM5803_VBUS_LOW_LEVEL);
@@ -272,6 +268,12 @@ static void sm5803_init(int chgnum)
SM5803_TINT_LOW_LEVEL);
/*
+ * Configure TINT and Vbus interrupts to fire after thresholds are
+ * configured
+ */
+ rv |= main_write8(chgnum, SM5803_REG_INT2_EN, SM5803_INT2_TINT
+ | SM5803_INT2_VBUS);
+ /*
* Configure CHG_ENABLE to only be set through I2C by setting
* HOST_MODE_EN bit (all other register bits are 0 by default)
*/