diff options
Diffstat (limited to 'driver/charger')
-rw-r--r-- | driver/charger/isl923x.c | 15 | ||||
-rw-r--r-- | driver/charger/isl923x.h | 9 |
2 files changed, 22 insertions, 2 deletions
diff --git a/driver/charger/isl923x.c b/driver/charger/isl923x.c index 6911897d63..04abb042c8 100644 --- a/driver/charger/isl923x.c +++ b/driver/charger/isl923x.c @@ -318,6 +318,21 @@ int isl923x_set_ac_prochot(uint16_t ma) return rv; } +int isl923x_set_dc_prochot(uint16_t ma) +{ + int rv; + + if (ma > ISL923X_DC_PROCHOT_CURRENT_MAX) { + CPRINTS("%s: invalid current (%d mA)\n", __func__, ma); + return EC_ERROR_INVAL; + } + + rv = raw_write16(ISL923X_REG_PROCHOT_DC, ma); + if (rv) + CPRINTS("%s failed (%d)", __func__, rv); + return rv; +} + static void isl923x_init(void) { int reg; diff --git a/driver/charger/isl923x.h b/driver/charger/isl923x.h index 89595a60fa..8076b72e38 100644 --- a/driver/charger/isl923x.h +++ b/driver/charger/isl923x.h @@ -300,12 +300,17 @@ enum isl9237_fsm_state { #endif /* __CROS_EC_ISL923X_H */ /** - * Initialize AC prochot threshold + * Initialize AC & DC prochot threshold * - * @param Porchot threshold current in mA: multiple of 128 up to 6400 mA + * @param AC Porchot threshold current in mA: + * multiple of 128 up to 6400 mA + * DC Porchot threshold current in mA: + * multiple of 128 up to 12800 mA * Bits below 128mA are truncated (ignored). * @return enum ec_error_list */ int isl923x_set_ac_prochot(uint16_t ma); +int isl923x_set_dc_prochot(uint16_t ma); #define ISL923X_AC_PROCHOT_CURRENT_MAX 6400 /* mA */ +#define ISL923X_DC_PROCHOT_CURRENT_MAX 12800 /* mA */ |