diff options
-rw-r--r-- | driver/charger/isl923x.c | 11 | ||||
-rw-r--r-- | include/config.h | 3 | ||||
-rw-r--r-- | zephyr/Kconfig.charger | 56 |
3 files changed, 70 insertions, 0 deletions
diff --git a/driver/charger/isl923x.c b/driver/charger/isl923x.c index 84f833cc64..2d3a968337 100644 --- a/driver/charger/isl923x.c +++ b/driver/charger/isl923x.c @@ -715,6 +715,17 @@ static void isl923x_init(int chgnum) goto init_fail; } + if (IS_ENABLED(CONFIG_CHARGER_RAA489000)) { + if (raw_read16(chgnum, ISL923X_REG_CONTROL2, ®)) + goto init_fail; + /* Set trickle charge current bits. */ + reg &= ~GENMASK(13, 15); + reg |= ((CONFIG_RAA489000_TRICKLE_CHARGE_CURRENT - 64) / 32) + << 13; + if (raw_write16(chgnum, ISL923X_REG_CONTROL2, reg)) + goto init_fail; + } + /* Revert all changes done by isl9238c_hibernate(). */ if (IS_ENABLED(CONFIG_CHARGER_ISL9238C) && isl9238c_resume(chgnum)) goto init_fail; diff --git a/include/config.h b/include/config.h index 1e34f75a60..fcdc001649 100644 --- a/include/config.h +++ b/include/config.h @@ -1332,6 +1332,9 @@ /* Enable trickle charging */ #undef CONFIG_TRICKLE_CHARGING +/* Set trickle charge current by taking integer value */ +#define CONFIG_RAA489000_TRICKLE_CHARGE_CURRENT 128 + /* Wireless chargers */ #undef CONFIG_CPS8100 diff --git a/zephyr/Kconfig.charger b/zephyr/Kconfig.charger index baa751f138..ba853e66f2 100644 --- a/zephyr/Kconfig.charger +++ b/zephyr/Kconfig.charger @@ -673,4 +673,60 @@ config PLATFORM_EC_DEDICATED_CHARGE_PORT help Enable if there is a dedicated charging port on the system. +if PLATFORM_EC_CHARGER_RAA489000 +choice + prompt "RAA489000 trickle charge current" + default RAA489000_TRICKLE_CHARGE_CURRENT_128MA + help + Set the current limit when trickle-charging. + +config RAA489000_TRICKLE_CHARGE_CURRENT_64MA + bool "64 mA" + help + Set the trickle charge current to 64 mA. + +config RAA489000_TRICKLE_CHARGE_CURRENT_96MA + bool "96 mA" + help + Set the trickle charge current to 96 mA. + +config RAA489000_TRICKLE_CHARGE_CURRENT_128MA + bool "128 mA" + help + Set the trickle charge current to 128 mA. + +config RAA489000_TRICKLE_CHARGE_CURRENT_160MA + bool "160 mA" + help + Set the trickle charge current to 160 mA. + +config RAA489000_TRICKLE_CHARGE_CURRENT_192MA + bool "192 mA" + help + Set the trickle charge current to 192 mA. + +config RAA489000_TRICKLE_CHARGE_CURRENT_224MA + bool "224 mA" + help + Set the trickle charge current to 224 mA. + +config RAA489000_TRICKLE_CHARGE_CURRENT_256MA + bool "256 mA" + help + Set the trickle charge current to 256 mA. + +endchoice + +config RAA489000_TRICKLE_CHARGE_CURRENT + int + default 64 if RAA489000_TRICKLE_CHARGE_CURRENT_64MA + default 96 if RAA489000_TRICKLE_CHARGE_CURRENT_96MA + default 128 if RAA489000_TRICKLE_CHARGE_CURRENT_128MA + default 160 if RAA489000_TRICKLE_CHARGE_CURRENT_160MA + default 192 if RAA489000_TRICKLE_CHARGE_CURRENT_192MA + default 224 if RAA489000_TRICKLE_CHARGE_CURRENT_224MA + default 256 if RAA489000_TRICKLE_CHARGE_CURRENT_256MA + +endif # PLATFORM_EC_CHARGER_RAA489000 + endif # PLATFORM_EC_CHARGER |