From 6810f49dfeb4f41cf53952192d74c71c7ab15e99 Mon Sep 17 00:00:00 2001 From: Aseda Aboagye Date: Mon, 29 Mar 2021 20:16:35 -0700 Subject: 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 Change-Id: Icb5316d9c206138e68fa4e55dee5b454182921e9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2793057 Tested-by: Aseda Aboagye Reviewed-by: Diana Z Commit-Queue: Aseda Aboagye --- driver/charger/isl923x.c | 8 ++++++++ driver/charger/isl923x.h | 1 + 2 files changed, 9 insertions(+) (limited to 'driver') 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 -- cgit v1.2.1