diff options
Diffstat (limited to 'driver/charger/isl9241.h')
-rw-r--r-- | driver/charger/isl9241.h | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/driver/charger/isl9241.h b/driver/charger/isl9241.h index c3f843f380..4e766a9886 100644 --- a/driver/charger/isl9241.h +++ b/driver/charger/isl9241.h @@ -2,7 +2,7 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. * - * Renesas (Intersil) ISL-9241 battery charger driver header. + * Renesas (Intersil) ISL-9241 (and RAA489110) battery charger driver header. */ #ifndef __CROS_EC_ISL9241_H @@ -45,6 +45,7 @@ #define ISL9241_CONTROL0_INPUT_VTG_REGULATION BIT(2) #define ISL9241_CONTROL0_EN_VIN_VOUT_COMP BIT(5) #define ISL9241_CONTROL0_EN_CHARGE_PUMPS BIT(6) +#define RAA489110_CONTROL0_EN_FORCE_BUCK_MODE BIT(10) #define ISL9241_CONTROL0_EN_BYPASS_GATE BIT(11) #define ISL9241_CONTROL0_NGATE_OFF BIT(12) @@ -105,7 +106,11 @@ #define ISL9241_REG_OTG_VOLTAGE 0x49 #define ISL9241_REG_OTG_CURRENT 0x4A +#ifdef CONFIG_CHARGER_RAA489110 +#define ISL9241_MV_TO_ACOK_REFERENCE(mv) (((mv) / 144) << 6) +#else /* CONFIG_CHARGER_ISL9241 */ #define ISL9241_MV_TO_ACOK_REFERENCE(mv) (((mv) / 96) << 6) +#endif /* VIN Voltage (ADP Min Voltage) (default 4.096V) */ #define ISL9241_REG_VIN_VOLTAGE 0x4B @@ -129,6 +134,7 @@ #define ISL9241_INFORMATION2_ACOK_PIN BIT(14) #define ISL9241_REG_CONTROL4 0x4E +/* ISL9241 only */ #define ISL9241_CONTROL4_FORCE_BUCK_MODE BIT(10) /* 11: Rsense (Rs1:Rs2) ratio for PSYS (0 - 2:1, 1 - 1:1) */ #define ISL9241_CONTROL4_PSYS_RSENSE_RATIO BIT(11) @@ -153,7 +159,11 @@ #define ISL9241_REG_DEVICE_ID 0xFF #define ISL9241_VIN_ADC_BIT_OFFSET 6 +#ifdef CONFIG_CHARGER_RAA489110 +#define ISL9241_VIN_ADC_STEP_MV 144 +#else /* CONFIG_CHARGER_ISL9241 */ #define ISL9241_VIN_ADC_STEP_MV 96 +#endif #define ISL9241_ADC_POLLING_TIME_US 400 @@ -169,4 +179,17 @@ */ #define ISL9241_BYPASS_VSYS_TIMEOUT_MS 500 +/* Sense resistor default values in milli Ohm */ +#define ISL9241_DEFAULT_RS1 20 /* Input current sense resistor */ +#define ISL9241_DEFAULT_RS2 10 /* Battery charge current sense resistor */ + +#define BOARD_RS1 CONFIG_CHARGER_SENSE_RESISTOR_AC +#define BOARD_RS2 CONFIG_CHARGER_SENSE_RESISTOR + +#define BC_REG_TO_CURRENT(REG) (((REG)*ISL9241_DEFAULT_RS2) / BOARD_RS2) +#define BC_CURRENT_TO_REG(CUR) (((CUR)*BOARD_RS2) / ISL9241_DEFAULT_RS2) + +#define AC_REG_TO_CURRENT(REG) (((REG)*ISL9241_DEFAULT_RS1) / BOARD_RS1) +#define AC_CURRENT_TO_REG(CUR) (((CUR)*BOARD_RS1) / ISL9241_DEFAULT_RS1) + #endif /* __CROS_EC_ISL9241_H */ |