summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2020-07-24 11:43:26 -0600
committerCommit Bot <commit-bot@chromium.org>2020-08-01 02:41:03 +0000
commit0f93e28bc7d3bfe61ba792d31d6a9ed7be43728e (patch)
tree911adb7e2465c16b4acbb3b3abf3d6d04b2b7908
parentd334050b8b0755201f1909002b3b01392cba2c23 (diff)
downloadchrome-ec-0f93e28bc7d3bfe61ba792d31d6a9ed7be43728e.tar.gz
SM5803: Disable Ibus PROCHOT comparator in init
The Ibus PROCHOT comparison should be unnecessary. Additionally, the bit will only set when a charger is plugged in so the current code has inconsistent behavior based on whether a charger is present during EC init. BRANCH=None BUG=b:161214528 TEST=on waddledee, boot both with and without a charger plugged in and note that PROCHOT doesn't set in either case Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I63bb22736dac7dbf1c9e7f627319538cbe9bbd81 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2317886 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r--driver/charger/sm5803.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/driver/charger/sm5803.c b/driver/charger/sm5803.c
index 8b9ebb7fcd..6e33e23efb 100644
--- a/driver/charger/sm5803.c
+++ b/driver/charger/sm5803.c
@@ -99,10 +99,9 @@ static inline enum ec_error_list test_write8(int chgnum, int offset, int value)
offset, value);
}
-static inline enum ec_error_list test_update8(int chgnum,
- const int offset,
+static inline enum ec_error_list test_update8(int chgnum, const int offset,
const uint8_t mask,
- const enum mask_update_action action)
+ const enum mask_update_action action)
{
return i2c_update8(chg_chips[chgnum].i2c_port,
SM5803_ADDR_TEST_FLAGS, offset, mask, action);
@@ -385,10 +384,15 @@ static void sm5803_init(int chgnum)
rv |= main_write8(chgnum, 0x1F, 0x0);
}
+ /* Disable Ibus PROCHOT comparator */
+ rv = chg_read8(chgnum, SM5803_REG_PHOT1, &reg);
+ reg &= ~SM5803_PHOT1_IBUS_PHOT_COMP_EN;
+ rv |= chg_write8(chgnum, SM5803_REG_PHOT1, reg);
+
/* Set default input current */
reg = SM5803_CURRENT_TO_REG(CONFIG_CHARGER_INPUT_CURRENT)
& SM5803_CHG_ILIM_RAW;
- rv = chg_write8(chgnum, SM5803_REG_CHG_ILIM, reg);
+ rv |= chg_write8(chgnum, SM5803_REG_CHG_ILIM, reg);
/* Set Vbus interrupt levels for 3.5V and 4.0V */
rv |= meas_write8(chgnum, SM5803_REG_VBUS_LOW_TH,