diff options
-rw-r--r-- | driver/charger/isl923x.c | 17 | ||||
-rw-r--r-- | driver/charger/isl923x.h | 1 | ||||
-rw-r--r-- | include/driver/charger/isl923x_public.h | 10 |
3 files changed, 28 insertions, 0 deletions
diff --git a/driver/charger/isl923x.c b/driver/charger/isl923x.c index b918cec8a4..9e3284c29f 100644 --- a/driver/charger/isl923x.c +++ b/driver/charger/isl923x.c @@ -797,6 +797,23 @@ out: } #ifdef CONFIG_CHARGER_RAA489000 +enum ec_error_list raa489000_is_acok(int chgnum, bool *acok) +{ + int regval, rv; + + if ((chgnum < 0) || (chgnum > board_get_charger_chip_count())) { + CPRINTS("%s: Invalid chgnum! (%d)", __func__, chgnum); + return EC_ERROR_INVAL; + } + + rv = raw_read16(chgnum, ISL9238_REG_INFO2, ®val); + if (rv != EC_SUCCESS) + return rv; + *acok = (regval & RAA489000_INFO2_ACOK); + + return EC_SUCCESS; +} + int raa489000_enable_asgate(int chgnum, bool enable) { enum mask_update_action action = enable ? MASK_SET : MASK_CLR; diff --git a/driver/charger/isl923x.h b/driver/charger/isl923x.h index 1ab0973b03..558c17f971 100644 --- a/driver/charger/isl923x.h +++ b/driver/charger/isl923x.h @@ -294,6 +294,7 @@ #define ISL923X_INFO_TRICKLE_ACTIVE_MASK BIT(4) #define ISL9237_INFO_PSTATE_SHIFT 5 #define ISL9237_INFO_PSTATE_MASK 3 +#define RAA489000_INFO2_ACOK BIT(14) /* ADC registers */ #define RAA489000_REG_ADC_INPUT_CURRENT 0x83 diff --git a/include/driver/charger/isl923x_public.h b/include/driver/charger/isl923x_public.h index d8cc9cf662..2ee5f62cdb 100644 --- a/include/driver/charger/isl923x_public.h +++ b/include/driver/charger/isl923x_public.h @@ -8,6 +8,7 @@ #ifndef __CROS_EC_DRIVER_CHARGER_ISL923X_PUBLIC_H #define __CROS_EC_DRIVER_CHARGER_ISL923X_PUBLIC_H +#include "common.h" #include "stdbool.h" #define ISL923X_ADDR_FLAGS (0x09) @@ -38,6 +39,15 @@ int isl923x_set_dc_prochot(int chgnum, uint16_t ma); int isl923x_set_comparator_inversion(int chgnum, int invert); /** + * Return whether ACOK is high or low. + * + * @param chgnum index into chg_chips table. + * @param acok will be set to true if ACOK is asserted, otherwise false. + * @return EC_SUCCESS, error otherwise. + */ +enum ec_error_list raa489000_is_acok(int chgnum, bool *acok); + +/** * Prepare the charger IC for battery ship mode. Battery ship mode sets the * lowest power state for the IC. Battery ship mode can only be entered from * battery only mode. |