diff options
author | Aseda Aboagye <aaboagye@google.com> | 2021-03-29 20:16:35 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-03-30 17:49:53 +0000 |
commit | 6810f49dfeb4f41cf53952192d74c71c7ab15e99 (patch) | |
tree | fbb7c7dce9ec75d0fa7f547eca56ae7967cf24e4 | |
parent | bf5368700249a9a29ab6e4358115362a0ef7ae09 (diff) | |
download | chrome-ec-6810f49dfeb4f41cf53952192d74c71c7ab15e99.tar.gz |
raa489000: Add raa489000_enable_asgate()
This commit exports a function to allow the ASGATE to be enabled or
disabled when the charger IC is in the READY state. This can help to
achieve a VBUS level of 0V if the READY state is required/desired.
BUG=b:183220414
BRANCH=dedede
TEST=With some other patches to use this function, build and flash on
madoo, plug in a charger, remove charger, verify that VBUS goes down
to less than 200mV and decays to 0.
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Change-Id: Icb5316d9c206138e68fa4e55dee5b454182921e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2793057
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Diana Z <dzigterman@chromium.org>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r-- | driver/charger/isl923x.c | 8 | ||||
-rw-r--r-- | driver/charger/isl923x.h | 1 | ||||
-rw-r--r-- | include/driver/charger/isl923x_public.h | 9 |
3 files changed, 18 insertions, 0 deletions
diff --git a/driver/charger/isl923x.c b/driver/charger/isl923x.c index 129fe30000..09db9e0f2b 100644 --- a/driver/charger/isl923x.c +++ b/driver/charger/isl923x.c @@ -786,6 +786,14 @@ out: } #ifdef CONFIG_CHARGER_RAA489000 +int raa489000_enable_asgate(int chgnum, bool enable) +{ + enum mask_update_action action = enable ? MASK_SET : MASK_CLR; + + return raw_update16(chgnum, RAA489000_REG_CONTROL8, + RAA489000_C8_ASGATE_ON_READY, action); +} + void raa489000_hibernate(int chgnum, bool disable_adc) { int rv, regval; diff --git a/driver/charger/isl923x.h b/driver/charger/isl923x.h index 69bc82389c..1ab0973b03 100644 --- a/driver/charger/isl923x.h +++ b/driver/charger/isl923x.h @@ -270,6 +270,7 @@ /* Control8: MCU_LDO - BAT state disable */ #define RAA489000_C8_MCU_LDO_BAT_STATE_DISABLE BIT(14) +#define RAA489000_C8_ASGATE_ON_READY BIT(13) /* OTG voltage limit in mV, current limit in mA */ #define ISL9237_OTG_VOLTAGE_MIN 4864 diff --git a/include/driver/charger/isl923x_public.h b/include/driver/charger/isl923x_public.h index df3b0ce057..d8cc9cf662 100644 --- a/include/driver/charger/isl923x_public.h +++ b/include/driver/charger/isl923x_public.h @@ -45,6 +45,15 @@ int isl923x_set_comparator_inversion(int chgnum, int invert); * @param chgnum index into chg_chips table. */ void raa489000_hibernate(int chgnum, bool disable_adc); + +/** + * Enable or Disable the ASGATE in the READY state. + * + * @param chgnum: Index into charger chips + * @param enable: whether to enable ASGATE + */ +int raa489000_enable_asgate(int chgnum, bool enable); + enum ec_error_list isl9238c_hibernate(int chgnum); enum ec_error_list isl9238c_resume(int chgnum); |