From 485c236b2c0d455c673d1d6677055a3e801b41bb Mon Sep 17 00:00:00 2001 From: Edward Hill Date: Mon, 28 Sep 2020 17:08:39 -0600 Subject: Revert "Zork: Workaround for bad ISL9241 CONTROL1 read" This reverts commit 61d40d6eaa88437d48e06fba9b773f7eb99f6ecc. Revert the workaround since CL:2393404 solved the problem. BUG=b:163076059 BRANCH=zork TEST=none Change-Id: I0397141b5b4e15736172474cb073842e18c3a71d Signed-off-by: Edward Hill Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2437194 Reviewed-by: Denis Brockus Commit-Queue: Denis Brockus --- baseboard/zork/baseboard.c | 30 ------------------------------ driver/charger/isl9241.c | 16 +++++----------- driver/charger/isl9241.h | 5 ----- 3 files changed, 5 insertions(+), 46 deletions(-) diff --git a/baseboard/zork/baseboard.c b/baseboard/zork/baseboard.c index b067b66d10..b72e4fb77f 100644 --- a/baseboard/zork/baseboard.c +++ b/baseboard/zork/baseboard.c @@ -299,36 +299,6 @@ static int command_temps_log(int argc, char **argv) DECLARE_CONSOLE_COMMAND(tempslog, command_temps_log, "seconds", "Print temp sensors periodically"); -/* - * b/163076059: Sometimes CONTROL1 reads as 0xFF03 for unknown reason - * when the state change from S0 to S3, but the second read will get - * the correct 0x0103. Retry CONTROL1 read before update learn mode - * to make sure write the correct value. - */ -__override int isl9241_update_learn_mode(int chgnum, int enable) -{ - int rv; - int i; - int reg; - - /* Retry CONTROL1 read if high byte is 0xFF. */ - for (i = 0; i < 10; i++) { - rv = isl9241_read(chgnum, ISL9241_REG_CONTROL1, ®); - if (rv == EC_SUCCESS && (reg >> 8) != 0xFF) - break; - ccprints("isl9241 error: CONTROL1=0x%x (rv=%d i=%d)", - reg, rv, i); - if (rv) - return rv; - } - - if (enable) - reg |= ISL9241_CONTROL1_LEARN_MODE; - else - reg &= ~ISL9241_CONTROL1_LEARN_MODE; - - return isl9241_write(chgnum, ISL9241_REG_CONTROL1, reg); -} /* * b/164921478: On G3->S5, wait for RSMRST_L to be deasserted before asserting diff --git a/driver/charger/isl9241.c b/driver/charger/isl9241.c index 7d724d24be..d6dbf395d8 100644 --- a/driver/charger/isl9241.c +++ b/driver/charger/isl9241.c @@ -60,7 +60,7 @@ static const struct charger_info isl9241_charger_info = { static enum ec_error_list isl9241_discharge_on_ac(int chgnum, int enable); -inline enum ec_error_list isl9241_read(int chgnum, int offset, +static inline enum ec_error_list isl9241_read(int chgnum, int offset, int *value) { return i2c_read16(chg_chips[chgnum].i2c_port, @@ -68,7 +68,7 @@ inline enum ec_error_list isl9241_read(int chgnum, int offset, offset, value); } -inline enum ec_error_list isl9241_write(int chgnum, int offset, +static inline enum ec_error_list isl9241_write(int chgnum, int offset, int value) { return i2c_write16(chg_chips[chgnum].i2c_port, @@ -304,21 +304,15 @@ static enum ec_error_list isl9241_post_init(int chgnum) return EC_SUCCESS; } -__overridable int isl9241_update_learn_mode(int chgnum, int enable) -{ - return isl9241_update(chgnum, ISL9241_REG_CONTROL1, - ISL9241_CONTROL1_LEARN_MODE, - (enable) ? MASK_SET : MASK_CLR); -} - static enum ec_error_list isl9241_discharge_on_ac(int chgnum, int enable) { int rv; mutex_lock(&control1_mutex); - rv = isl9241_update_learn_mode(chgnum, enable); - + rv = isl9241_update(chgnum, ISL9241_REG_CONTROL1, + ISL9241_CONTROL1_LEARN_MODE, + (enable) ? MASK_SET : MASK_CLR); if (!rv) learn_mode = enable; diff --git a/driver/charger/isl9241.h b/driver/charger/isl9241.h index 17e98cfaaf..1110f11b8a 100644 --- a/driver/charger/isl9241.h +++ b/driver/charger/isl9241.h @@ -122,11 +122,6 @@ extern const struct charger_drv isl9241_drv; -enum ec_error_list isl9241_read(int chgnum, int offset, - int *value); -enum ec_error_list isl9241_write(int chgnum, int offset, - int value); -__override_proto int isl9241_update_learn_mode(int chgnum, int enable); /** * Set AC prochot threshold * -- cgit v1.2.1