diff options
author | Aseda Aboagye <aaboagye@google.com> | 2020-11-06 17:24:52 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-11-11 06:00:24 +0000 |
commit | 9faa2e488a366741aa87e8212822942caf64b087 (patch) | |
tree | 01c46aabdc3cc4e55e3b89a5a3e0331ce88b9bc1 | |
parent | a3b99150e32f368567eeeba9a2c3a8f65fee4b43 (diff) | |
download | chrome-ec-9faa2e488a366741aa87e8212822942caf64b087.tar.gz |
raa489000: Ignore BATGONE on aux chargers
On OCPC systems, the BATGONE pin is left unconnected as it's not
needed. However, the default setting of the RAA489000 looks at the
BATGONE pin in order utilize LEARN mode. This commit modifies the
initialization to ignore the BATGONE pin on auxiliary chargers in an
OCPC system.
BUG=b:171457154, b:166168305
BRANCH=None
TEST=Build and flash magolor, verify that `chgstate discharge on`
results in 0 amperes being consumed from the connected AC adapter.
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Change-Id: Iefec97e2dfcf0852a02c7acd05257014e93e9f57
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2523303
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Diana Z <dzigterman@chromium.org>
Commit-Queue: Diana Z <dzigterman@chromium.org>
Auto-Submit: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r-- | driver/charger/isl923x.c | 18 | ||||
-rw-r--r-- | driver/charger/isl923x.h | 3 |
2 files changed, 21 insertions, 0 deletions
diff --git a/driver/charger/isl923x.c b/driver/charger/isl923x.c index 655a2890f7..5ab4c7f9f1 100644 --- a/driver/charger/isl923x.c +++ b/driver/charger/isl923x.c @@ -574,6 +574,24 @@ static void isl923x_init(int chgnum) goto init_fail; } +#ifdef CONFIG_OCPC + if (IS_ENABLED(CONFIG_CHARGER_RAA489000)) { + /* + * Ignore BATGONE on auxiliary charger ICs as it's not connected + * there. + */ + if (chgnum != CHARGER_PRIMARY) { + if (raw_read16(chgnum, ISL9238_REG_CONTROL4, ®)) + goto init_fail; + + reg |= RAA489000_C4_BATGONE_DISABLE; + + if (raw_write16(chgnum, ISL9238_REG_CONTROL4, reg)) + goto init_fail; + } + } +#endif /* CONFIG_OCPC */ + return; init_fail: CPRINTS("%s init failed!", CHARGER_NAME); diff --git a/driver/charger/isl923x.h b/driver/charger/isl923x.h index a09354d811..1b2cf30954 100644 --- a/driver/charger/isl923x.h +++ b/driver/charger/isl923x.h @@ -259,6 +259,9 @@ /* Control4: GP comparator control bit */ #define RAA489000_C4_DISABLE_GP_CMP BIT(12) +/* Control4: Ignores BATGONE input */ +#define RAA489000_C4_BATGONE_DISABLE BIT(15) + /* Control6: charger current and maximum system voltage slew rate control. */ #define ISL9238C_C6_SLEW_RATE_CONTROL BIT(6) |