diff options
author | Aseda Aboagye <aaboagye@google.com> | 2017-11-06 17:12:58 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-11-14 00:42:42 -0800 |
commit | 358e249916eeee0a6cf0aa8e5047b05dcdba9628 (patch) | |
tree | 11be79aadb0ace10886db38a05701021eec75860 | |
parent | adf00a969f099e2a1a8783130dd37d6b27ff7036 (diff) | |
download | chrome-ec-358e249916eeee0a6cf0aa8e5047b05dcdba9628.tar.gz |
isl9238: Don't reread PROG pin or reload ILIM.
The ISL9238 has a functionality where it will reload the adapter current
limit from a strap which is read from the PROG pin. This is problematic
when we decide to set the current limit prior to AC actually being
inserted. This commit disables this functionality from the charger.
It seems however that the charger will read the PROG pin and reload the
ILIM at least once before respecting the bits.
BUG=b:67120928, b:66017697
BRANCH=None
TEST=Plug and unplug and then plug again AC. Verify that the default
current limit is not set by the charger automatically.
Change-Id: Ia8e8742843f6ceb286635b31e0fe5c070a2b6dfe
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/759693
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Shamile Khan <shamile.khan@intel.corp-partner.google.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
-rw-r--r-- | driver/charger/isl923x.c | 18 | ||||
-rw-r--r-- | driver/charger/isl923x.h | 6 |
2 files changed, 24 insertions, 0 deletions
diff --git a/driver/charger/isl923x.c b/driver/charger/isl923x.c index 5dae530ef9..4924bc1f52 100644 --- a/driver/charger/isl923x.c +++ b/driver/charger/isl923x.c @@ -339,6 +339,24 @@ static void isl923x_init(void) goto init_fail; #endif /* defined(CONFIG_CHARGE_RAMP_HW) */ +#ifdef CONFIG_CHARGER_ISL9238 + /* + * Don't reread the prog pin and don't reload the ILIM on ACIN. + */ + if (raw_read16(ISL9238_REG_CONTROL3, ®)) + goto init_fail; + reg |= ISL9238_C3_NO_RELOAD_ACLIM_ON_ACIN | + ISL9238_C3_NO_REREAD_PROG_PIN; + if (raw_write16(ISL9238_REG_CONTROL3, reg)) + goto init_fail; + + /* + * Initialize the input current limit to the board's default. + */ + if (charger_set_input_current(CONFIG_CHARGER_INPUT_CURRENT)) + goto init_fail; +#endif /* defined(CONFIG_CHARGER_ISL9238) */ + return; init_fail: CPRINTF("isl923x_init failed!"); diff --git a/driver/charger/isl923x.h b/driver/charger/isl923x.h index fc89e2dec7..361bf0272d 100644 --- a/driver/charger/isl923x.h +++ b/driver/charger/isl923x.h @@ -210,6 +210,12 @@ /* Control3: PSYS gain in uA/W (ISL9238 only) */ #define ISL9238_C3_PSYS_GAIN (1 << 9) +/* Control3: Don't reload ACLIM on ACIN. */ +#define ISL9238_C3_NO_RELOAD_ACLIM_ON_ACIN (1 << 14) + +/* Control3: Don't reread PROG pin. */ +#define ISL9238_C3_NO_REREAD_PROG_PIN (1 << 15) + /* OTG voltage limit in mV, current limit in mA */ #define ISL9237_OTG_VOLTAGE_MIN 4864 #define ISL9237_OTG_VOLTAGE_MAX 5376 |