1 /* 2 * Copyright 2023-2024 NXP 3 * All rights reserved. 4 * 5 * SPDX-License-Identifier: BSD-3-Clause 6 */ 7 8 #ifndef FSL_PCA9422_H_ 9 #define FSL_PCA9422_H_ 10 11 /******************************************************************************* 12 * Includes 13 ******************************************************************************/ 14 #include <stdint.h> 15 #include <stdbool.h> 16 #include <string.h> 17 #include "fsl_common.h" 18 19 /******************************************************************************* 20 * Definitions 21 ******************************************************************************/ 22 23 /*! @brief PCA9422 Default I2C address. */ 24 #define PCA9422_DEFAULT_I2C_ADDR (0x61U) 25 26 /*! @brief Define the Register Memory Map of PCA9422. */ 27 #define PCA9422_DEV_INFO (0x00U) 28 #define PCA9422_TOP_INT (0x01U) 29 #define PCA9422_SUB_INT0 (0x02U) 30 #define PCA9422_SUB_INT0_MASK (0x03U) 31 #define PCA9422_SUB_INT1 (0x04U) 32 #define PCA9422_SUB_INT1_MASK (0x05U) 33 #define PCA9422_SUB_INT2 (0x06U) 34 #define PCA9422_SUB_INT2_MASK (0x07U) 35 #define PCA9422_TOP_STAT (0x08U) 36 37 #define PCA9422_TOP_CNTL0 (0x09U) 38 #define PCA9422_TOP_CNTL1 (0x0AU) 39 #define PCA9422_TOP_CNTL2 (0x0BU) 40 #define PCA9422_TOP_CNTL3 (0x0CU) 41 #define PCA9422_TOP_CNTL4 (0x0DU) 42 43 #define PCA9422_INT1 (0x0EU) 44 #define PCA9422_INT1_MASK (0x0FU) 45 #define PCA9422_INT1_STATUS (0x10U) 46 47 #define PCA9422_PWR_STATE (0x11U) 48 #define PCA9422_RESET_CTRL (0x12U) 49 #define PCA9422_SW_RST (0x13U) 50 #define PCA9422_PWR_SEQ_CTRL (0x14U) 51 #define PCA9422_SYS_CFG1 (0x15U) 52 #define PCA9422_SYS_CFG2 (0x16U) 53 54 #define PCA9422_REG_STATUS (0x17U) 55 #define PCA9422_BUCK123_DVS_CFG1 (0x18U) 56 #define PCA9422_BUCK123_DVS_CFG2 (0x19U) 57 #define PCA9422_BUCK1CTRL (0x1AU) 58 #define PCA9422_BUCK1OUT_DVS0 (0x1BU) 59 #define PCA9422_BUCK1OUT_DVS1 (0x1CU) 60 #define PCA9422_BUCK1OUT_DVS2 (0x1DU) 61 #define PCA9422_BUCK1OUT_DVS3 (0x1EU) 62 #define PCA9422_BUCK1OUT_DVS4 (0x1FU) 63 #define PCA9422_BUCK1OUT_DVS5 (0x20U) 64 #define PCA9422_BUCK1OUT_DVS6 (0x21U) 65 #define PCA9422_BUCK1OUT_DVS7 (0x22U) 66 #define PCA9422_BUCK1OUT_STBY (0x23U) 67 #define PCA9422_BUCK1OUT_MAX_LIMIT (0x24U) 68 #define PCA9422_BUCK1OUT_SLEEP (0x25U) 69 70 #define PCA9422_BUCK2CTRL (0x26U) 71 #define PCA9422_BUCK2OUT_DVS0 (0x27U) 72 #define PCA9422_BUCK2OUT_DVS1 (0x28U) 73 #define PCA9422_BUCK2OUT_DVS2 (0x29U) 74 #define PCA9422_BUCK2OUT_DVS3 (0x2AU) 75 #define PCA9422_BUCK2OUT_DVS4 (0x2BU) 76 #define PCA9422_BUCK2OUT_DVS5 (0x2CU) 77 #define PCA9422_BUCK2OUT_DVS6 (0x2DU) 78 #define PCA9422_BUCK2OUT_DVS7 (0x2EU) 79 #define PCA9422_BUCK2OUT_STBY (0x2FU) 80 #define PCA9422_BUCK2OUT_MAX_LIMIT (0x30U) 81 #define PCA9422_BUCK2OUT_SLEEP (0x31U) 82 83 #define PCA9422_BUCK3CTRL (0x32U) 84 #define PCA9422_BUCK3OUT_DVS0 (0x33U) 85 #define PCA9422_BUCK3OUT_DVS1 (0x34U) 86 #define PCA9422_BUCK3OUT_DVS2 (0x35U) 87 #define PCA9422_BUCK3OUT_DVS3 (0x36U) 88 #define PCA9422_BUCK3OUT_DVS4 (0x37U) 89 #define PCA9422_BUCK3OUT_DVS5 (0x38U) 90 #define PCA9422_BUCK3OUT_DVS6 (0x39U) 91 #define PCA9422_BUCK3OUT_DVS7 (0x3AU) 92 #define PCA9422_BUCK3OUT_STBY (0x3BU) 93 #define PCA9422_BUCK3OUT_MAX_LIMIT (0x3CU) 94 #define PCA9422_BUCK3OUT_SLEEP (0x3DU) 95 #define PCA9422_LPM_FPWM (0x3EU) 96 97 #define PCA9422_LDO2_CFG (0x3FU) 98 #define PCA9422_LDO2_OUT (0x40U) 99 #define PCA9422_LDO2_OUT_STBY (0x41U) 100 #define PCA9422_LDO3_CFG (0x42U) 101 #define PCA9422_LDO3_OUT (0x43U) 102 #define PCA9422_LDO3_OUT_STBY (0x44U) 103 #define PCA9422_LDO23_CFG (0x45U) 104 #define PCA9422_LDO4_CFG (0x46U) 105 #define PCA9422_LDO4_OUT (0x47U) 106 #define PCA9422_LDO4_OUT_STBY (0x48U) 107 #define PCA9422_LDO1_CFG1 (0x49U) 108 #define PCA9422_LDO1_CFG2 (0x4AU) 109 110 #define PCA9422_LDO2_OUT_SLEEP (0x4BU) 111 #define PCA9422_LDO3_OUT_SLEEP (0x4CU) 112 #define PCA9422_LDO4_OUT_SLEEP (0x4DU) 113 114 #define PCA9422_SW4_BB_CFG1 (0x4EU) 115 #define PCA9422_SW4_BB_CFG2 (0x4FU) 116 #define PCA9422_SW4_BB_CFG3 (0x50U) 117 #define PCA9422_SW4_BB_CFG4 (0x51U) 118 #define PCA9422_SW4_BB_MAX_LIMIT (0x52U) 119 #define PCA9422_SW4_BB_MIN_LIMIT (0x53U) 120 #define PCA9422_SW4_BB_VOUT_SLEEP (0x54U) 121 122 #define PCA9422_LED_CFG1 (0x55U) 123 #define PCA9422_LED_CFG2 (0x56U) 124 #define PCA9422_GPIO_STATUS (0x57U) 125 #define PCA9422_GPIO_CFG (0x58U) 126 127 #define PCA9422_REGULATOR_EN (0x59U) 128 #define PCA9422_WAKEUP_SEQ1 (0x5AU) 129 #define PCA9422_WAKEUP_SEQ2 (0x5BU) 130 131 #define PCA9422_INT_DEVICE_0 (0x5C) 132 #define PCA9422_INT_DEVICE_1 (0x5D) 133 #define PCA9422_INT_CHARGER_0 (0x5E) 134 #define PCA9422_INT_CHARGER_1 (0x5F) 135 #define PCA9422_INT_CHARGER_2 (0x60) 136 #define PCA9422_INT_CHARGER_3 (0x61) 137 #define PCA9422_INT_DEVICE_0_MASK (0x62) 138 #define PCA9422_INT_DEVICE_1_MASK (0x63) 139 #define PCA9422_INT_CHARGER_0_MASK (0x64) 140 #define PCA9422_INT_CHARGER_1_MASK (0x65) 141 #define PCA9422_INT_CHARGER_2_MASK (0x66) 142 #define PCA9422_INT_CHARGER_3_MASK (0x67) 143 #define PCA9422_DEVICE_0_STS (0x68) 144 #define PCA9422_DEVICE_1_STS (0x69) 145 #define PCA9422_CHARGER_0_STS (0x6A) 146 #define PCA9422_CHARGER_1_STS (0x6B) 147 #define PCA9422_CHARGER_2_STS (0x6C) 148 #define PCA9422_CHARGER_3_STS (0x6D) 149 150 #define PCA9422_CHGIN_CNTL_0 (0x6E) 151 #define PCA9422_CHGIN_CNTL_1 (0x6F) 152 #define PCA9422_CHGIN_CNTL_2 (0x70) 153 #define PCA9422_CHGIN_CNTL_3 (0x71) 154 155 #define PCA9422_CHG_CNTL0 (0x72U) 156 #define PCA9422_CHG_CNTL1 (0x73U) 157 #define PCA9422_CHG_CNTL2 (0x74U) 158 #define PCA9422_CHG_CNTL3 (0x75U) 159 #define PCA9422_CHG_CNTL4 (0x76U) 160 #define PCA9422_CHG_CNTL5 (0x77U) 161 #define PCA9422_CHG_CNTL6 (0x78U) 162 #define PCA9422_CHG_CNTL7 (0x79U) 163 #define PCA9422_CHG_CNTL8 (0x7AU) 164 #define PCA9422_CHG_CNTL9 (0x7BU) 165 #define PCA9422_CHG_CNTL10 (0x7CU) 166 167 #define PCA9422_REG_LOCK (0x80U) 168 169 /*! @brief Define the Register Mask - device information */ 170 #define PCA9422_DEV_ID (0xF8U) 171 #define PCA9422_DEV_REV (0x07U) 172 173 /*! @brief Define the Register Masks - Top-level System Control Register. */ 174 #define PCA9422_TOP_INT_SYS (0x10U) 175 #define PCA9422_TOP_INT_CHG (0x08U) 176 #define PCA9422_TOP_INT_SW_BB (0x04U) 177 #define PCA9422_TOP_INT_SW (0x02U) 178 #define PCA9422_TOP_INT_LDO (0x01U) 179 180 #define PCA9422_SUB_INT0_ON_SHORT_PUSH (0x80U) 181 #define PCA9422_SUB_INT0_THERMAL_WARNING (0x40U) 182 #define PCA9422_SUB_INT0_THSD (0x20U) 183 #define PCA9422_SUB_INT0_THSD_EXIT (0x10U) 184 #define PCA9422_SUB_INT0_VSYS_MIN_WARNING (0x08U) 185 #define PCA9422_SUB_INT0_WD_TIMER (0x04U) 186 #define PCA9422_SUB_INT0_VSYS_OVP (0x02U) 187 #define PCA9422_SUB_INT0_VSYS_OVP_EXT (0x01U) 188 #define PCA9422_SUB_INT0_ALL (0xFFU) 189 190 #define PCA9422_SUB_INT1_MODE_CMPL (0x02U) 191 #define PCA9422_SUB_INT1_ON_LONG_PUSH (0x01U) 192 #define PCA9422_SUB_INT1_ALL (0x03U) 193 194 #define PCA9422_SUB_INT2_VOUTSW1 (0x80U) 195 #define PCA9422_SUB_INT2_VOUTSW2 (0x40U) 196 #define PCA9422_SUB_INT2_VOUTSW3 (0x20U) 197 #define PCA9422_SUB_INT2_VOUTSW4 (0x10U) 198 #define PCA9422_SUB_INT2_VOUTLDO1 (0x08U) 199 #define PCA9422_SUB_INT2_VOUTLDO2 (0x04U) 200 #define PCA9422_SUB_INT2_VOUTLDO3 (0x02U) 201 #define PCA9422_SUB_INT2_VOUTLDO4 (0x01U) 202 #define PCA9422_SUB_INT2_ALL (0xFFU) 203 204 #define PCA9422_TOP_STAT_SHIP_HISTORY (0x02U) 205 #define PCA9422_TOP_STAT_OCP_HISTORY (0x01U) 206 207 #define PCA9422_TOP_CNTL0_WD_TIMER (0xC0U) 208 #define PCA9422_TOP_CNTL0_SHIP_MODE_EN (0x10U) 209 #define PCA9422_TOP_CNTL0_PWR_DN_EN (0x08U) 210 #define PCA9422_TOP_CNTL0_nEN_CHG_IN_WATCHDOG (0x04U) 211 #define PCA9422_TOP_CNTL0_RESET_CFG (0x02U) 212 213 #define PCA9422_TOP_CNTL1_SW_GLOBAL_RST_READY (0x04U) 214 #define PCA9422_TOP_CNTL1_THERMAL_WARNING (0x03U) 215 216 #define PCA9422_TOP_CNTL2_THERM_SHDN (0x1CU) 217 #define PCA9422_TOP_CNTL2_ON_GLT_SHORT (0x03U) 218 219 #define PCA9422_TOP_CNTL3_VSYS_MIN_WARNING (0x78U) 220 #define PCA9422_TOP_CNTL3_SW_GLOBAL_RST (0x04U) 221 #define PCA9422_TOP_CNTL3_ON_GLT_LONG (0x03U) 222 223 #define PCA9422_TOP_CNTL4_WE_TIMER_CLR (0x07U) 224 225 /*! @brief Define the Register Masks - Battery Charger Register. */ 226 #define PCA9422_INT_DEVICE_0_CHGIN_SAFE_0V (0x04U) 227 #define PCA9422_INT_DEVICE_0_CHGIN_NOK (0x02U) 228 #define PCA9422_INT_DEVICE_0_CHGIN_OK (0x01U) 229 230 #define PCA9422_INT_DEVICE_1_CHGIN_I_LIMIT (0x80U) 231 #define PCA9422_INT_DEVICE_1_VSYS_SUPPLEMENT_EXIT (0x40U) 232 #define PCA9422_INT_DEVICE_1_VSYS_SUPPLEMENT (0x20U) 233 #define PCA9422_INT_DEVICE_1_VSYS_OVER_LOAD (0x10U) 234 #define PCA9422_INT_DEVICE_1_CHGIN_AICL_RELEASE (0x08U) 235 #define PCA9422_INT_DEVICE_1_CHGIN_AICL (0x04U) 236 #define PCA9422_INT_DEVICE_1_CHGIN_OVP_EXIT (0x02U) 237 #define PCA9422_INT_DEVICE_1_CHGIN_OVP (0x01U) 238 239 #define PCA9422_INT_CHARGER_0_TOPOFF (0x80U) 240 #define PCA9422_INT_CHARGER_0_CV_MODE (0x40U) 241 #define PCA9422_INT_CHARGER_0_FAST_CHARGE (0x20U) 242 #define PCA9422_INT_CHARGER_0_PRECHARGE (0x10U) 243 #define PCA9422_INT_CHARGER_0_CHARGER_OFF (0x08U) 244 #define PCA9422_INT_CHARGER_0_CHARGER_ON (0x04U) 245 #define PCA9422_INT_CHARGER_0_CHG_QUAL_NOK (0x02U) 246 #define PCA9422_INT_CHARGER_0_CHG_QUAL_OK (0x01U) 247 248 #define PCA9422_INT_CHARGER_1_THERM_HOT (0x80U) 249 #define PCA9422_INT_CHARGER_1_THERM_WARM_PLUS (0x40U) 250 #define PCA9422_INT_CHARGER_1_THERM_WARM (0x20U) 251 #define PCA9422_INT_CHARGER_1_THERM_COOL (0x10U) 252 #define PCA9422_INT_CHARGER_1_THERM_COLD (0x08U) 253 #define PCA9422_INT_CHARGER_1_VBAT_OVP_EXIT (0x04U) 254 #define PCA9422_INT_CHARGER_1_VBAT_OVP (0x02U) 255 #define PCA9422_INT_CHARGER_1_NO_BATTERY (0x01U) 256 257 #define PCA9422_INT_CHARGER_2_RECHARGE (0x80U) 258 #define PCA9422_INT_CHARGER_2_CHARGE_DONE (0x40U) 259 #define PCA9422_INT_CHARGER_2_THERMAL_REGULATION (0x20U) 260 #define PCA9422_INT_CHARGER_2_TOP_OFF_TIMER_OUT (0x10U) 261 #define PCA9422_INT_CHARGER_2_FAST_CHG_TIMER_OUT (0x08U) 262 #define PCA9422_INT_CHARGER_2_PRECHARGE_TIMER_OUT (0x04U) 263 #define PCA9422_INT_CHARGER_2_THERM_DISABLE (0x02U) 264 #define PCA9422_INT_CHARGER_2_THERM_OPEN (0x01U) 265 266 #define PCA9422_INT_CHARGER_3_VBAT_OCP (0x01U) 267 268 #define PCA9422_CHGIN_CNTL_O_CHGIN_PD_EN (0x02U) 269 270 #define PCA9422_CHGIN_CNTL_1_FORCE_DISCHARGE_VSYS_EN (0x08U) 271 #define PCA9422_CHGIN_CNTL_1_AICL_V (0x06U) 272 #define PCa9422_CHGIN_CNTL_1_AICL_EN (0x01U) 273 274 #define PCA9422_CHGIN_CNTL_2_CHGIN_IN_LIMIT (0x1FU) 275 276 #define PCA9422_CHGIN_CNTL_3_VSYS_REG (0xF0U) 277 278 #define PCA9422_CHARGER_CNTL_0_CHARGER_LOCK (0x30U) 279 280 #define PCA9422_CHARGER_CNTL_1_BAT_PRESENCE_DET_DISABLE (0x40U) 281 #define PCA9422_CHARGER_CNTL_1_AUTOSTOP_CHG_EN (0x20U) 282 #define PCA9422_CHARGER_CNTL_1_CHARGER_EN (0x10U) 283 #define PCA9422_CHARGER_CNTL_1_V_WARM_50C (0x0CU) 284 #define PCA9422_CHARGER_CNTL_1_PRECHG_CURRENT (0x02U) 285 #define PCA9422_CHARGER_CNTL_1_CHG_CURRENT_STEP (0x01U) 286 287 #define PCA9422_CHARGER_CNTL_2_VBAT_REG (0x7FU) 288 289 #define PCA9422_CHARGER_CNTL_3_I_FAST_CHG (0x7FU) 290 291 #define PCA9422_CHARGER_CNTL_4_VBAT_OVP_DEB (0xC0U) 292 #define PCA9422_CHARGER_CNTL_4_RECHARGE_TH (0x30U) 293 #define PCA9422_CHARGER_CNTL_4_TOPOFF_CURRENT (0x0CU) 294 #define PCA9422_CHARGER_CNTL_4_PRE_CHG_TIMER (0x03U) 295 296 #define PCA9422_CHARGER_CNTL_5_THERM_NTC_EN (0x40U) 297 #define PCA9422_CHARGER_CNTL_5_OCP_DISCHARGE_DEB (0x30U) 298 #define PCA9422_CHARGER_CNTL_5_OCP_DISCHARGE (0x03U) 299 300 #define PCA9422_CHARGER_CNTL_6_V_HOT_60C (0xC0U) 301 #define PCA9422_CHARGER_CNTL_6_V_WARM_45C (0x30U) 302 #define PCA9422_CHARGER_CNTL_6_V_COOL_10C (0x0CU) 303 #define PCA9422_CHARGER_CNTL_6_V_COLD_0C (0x03U) 304 305 #define PCA9422_CHARGER_CNTL_7_FAST_CHG_TIMER (0xC0U) 306 #define PCA9422_CHARGER_CNTL_7_2X_ALL_TIMERS_EN (0x20U) 307 #define PCA9422_CHARGER_CNTL_7_CHG_DISABLE_AT_COLD_HOT_EN (0x10U) 308 #define PCA9422_CHARGER_CNTL_7_NEW_I_VBAT_AT_10C (0x0CU) 309 #define PCA9422_CHARGER_CNTL_7_NEW_VBAT_AT_45C (0x03U) 310 311 #define PCA9422_CHARGER_CNTL_8_THERMAL_REGULATION (0x38U) 312 #define PCA9422_CHARGER_CNTL_8_TOP_OFF_TIMER (0x07U) 313 314 #define PCA9422_CHARGER_CNTL_9_NEW_VBAT_AT_50C (0xC0U) 315 #define PCA9422_CHARGER_CNTL_9_NEW_I_VBAT_AT_50C (0x30U) 316 #define PCA9422_CHARGER_CNTL_9_NEW_I_VBAT_AT_45C (0x0CU) 317 #define PCA9422_CHARGER_CNTL_9_FORCE_DISCHARGE_VBAT_EN (0x02U) 318 #define PCA9422_CHARGER_CNTL_9_USB_SUSPEND (0x01U) 319 320 #define PCA9422_CHARGER_CNTL_10_AMUX_AUTO_OFF_WAIT (0xC0U) 321 #define PCA9422_CHARGER_CNTL_10_AMUX_MODE (0x20U) 322 #define PCA9422_CHARGER_CNTL_10_AMUX_VBAT_VSYS_GAIN (0x10U) 323 #define PCA9422_CHARGER_CNTL_10_AMUX_THERM_GAIN (0x08U) 324 #define PCA9422_CHARGER_CNTL_10_AMUX_CHANNEL (0x07U) 325 326 /*! @brief Define the Register Masks - Regulator Register. */ 327 #define PCA9422_INT1_VR_FLT1 (0x08U) 328 #define PCA9422_INT1_BB_FAULT_OC (0x01U) 329 330 #define PCA9422_PWR_STATE_PWR_STAT (0xF0U) 331 #define PCA9422_PWR_STATE_PWR_MODE (0x0FU) 332 333 #define PCA9422_RESET_CTRL_TRESTART (0x08U) 334 335 #define PCA9422_SW_RST_SW_RST_KEY (0xFFU) 336 337 #define PCA9422_PWR_SEQ_CTRL_PSQ_TON_STEP (0x0CU) 338 #define PCA9422_PWR_SEQ_CTRL_PSQ_TOFF_STEP (0x03U) 339 340 #define PCA9422_SYS_CFG1_STANDBY_CTRL (0x40U) 341 #define PCA9422_SYS_CFG1_STANDBY_CFG (0x20U) 342 #define PCA9422_SYS_CFG1_DVS_CTRL2_EN (0x04U) 343 #define PCA9422_SYS_CFG1_TFLT_SD_WAIT (0x02U) 344 #define PCA9422_SYS_CFG1_THERM_SD_DIS (0x01U) 345 346 #define PCA9422_SYS_CFG2_PWR_SAVE (0x30U) 347 #define PCA9422_SYS_CFG2_GPIO_PULLUP_CFG (0x08U) 348 #define PCA9422_SYS_CFG2_POK_PU (0x04U) 349 #define PCA9422_SYS_CFG2_VSYS_UVLO_SEL (0x03U) 350 351 #define PCA9422_REG_STATUS_VOUTSW1_OK (0x80U) 352 #define PCA9422_REG_STATUS_VOUTSW2_OK (0x40U) 353 #define PCA9422_REG_STATUS_VOUTSW3_OK (0x20U) 354 #define PCA9422_REG_STATUS_VOUTSW4_OK (0x10U) 355 #define PCA9422_REG_STATUS_VOUTLDO1_OK (0x08U) 356 #define PCA9422_REG_STATUS_VOUTLDO2_OK (0x04U) 357 #define PCA9422_REG_STATUS_VOUTLDO3_OK (0x02U) 358 #define PCA9422_REG_STATUS_VOUTLDO4_OK (0x01U) 359 360 /* BUCK */ 361 #define PCA9422_BUCK123_DVS_CFG1_B1_DVS_UP (0x80U) 362 #define PCA9422_BUCK123_DVS_CFG1_B1_DVS_DN (0x40U) 363 #define PCA9422_BUCK123_DVS_CFG1_B2_DVS_UP (0x20U) 364 #define PCA9422_BUCK123_DVS_CFG1_B2_DVS_DN (0x10U) 365 #define PCA9422_BUCK123_DVS_CFG1_MODE_PULSE (0x08U) 366 #define PCA9422_BUCK123_DVS_CFG1_SMART_MODE (0x04U) 367 #define PCA9422_BUCK123_DVS_CFG1_BUCK_SEL (0x03U) 368 369 #define PCA9422_BUCK123_DVS_CFG2_B1_DVS_CTRL (0xC0U) 370 #define PCA9422_BUCK123_DVS_CFG2_B2_DVS_CTRL (0x30U) 371 #define PCA9422_BUCK123_DVS_CFG2_B3_DVS_CTRL (0x0CU) 372 #define PCA9422_BUCK123_DVS_CFG2_B3_DVS_UP (0x02U) 373 #define PCA9422_BUCK123_DVS_CFG2_B3_DVS_DN (0x01U) 374 375 #define PCA9422_BUCKXCTRL_BX_RAMP (0xC0U) 376 #define PCA9422_BUCKXCTRL_BX_LPMODE (0x30U) 377 #define PCA9422_BUCKXCTRL_BX_AD (0x08U) 378 #define PCA9422_BUCKXCTRL_BX_FPWM (0x04U) 379 #define PCA9422_BUCKXCTRL_BX_ENMODE (0x03U) 380 381 #define PCA9422_BUCKXOUT_DVS0_BX_DVS0 (0xFFU) 382 #define PCA9422_BUCKXOUT_DVS1_BX_DVS1 (0xFFU) 383 #define PCA9422_BUCKXOUT_DVS2_BX_DVS2 (0xFFU) 384 #define PCA9422_BUCKXOUT_DVS3_BX_DVS3 (0xFFU) 385 #define PCA9422_BUCKXOUT_DVS4_BX_DVS4 (0xFFU) 386 #define PCA9422_BUCKXOUT_DVS5_BX_DVS5 (0xFFU) 387 #define PCA9422_BUCKXOUT_DVS6_BX_DVS6 (0xFFU) 388 #define PCA9422_BUCKXOUT_DVS7_BX_DVS7 (0xFFU) 389 #define PCA9422_BUCKXOUT_STDBY_BX_STDBY (0xFFU) 390 #define PCA9422_BUCKXOUT_MAX_LIMIT_BX_MAX_LIMIT (0xFFU) 391 #define PCA9422_BUCKXOUT_SLEEP_BX_SLEEP (0xFFU) 392 393 #define PCA9422_LPM_FPWM_B3_LPM_FPWM_EN (0x04U) 394 #define PCA9422_LPM_FPWM_B2_LPM_FPWM_EN (0x02U) 395 #define PCA9422_LPM_FPWM_B1_LPM_FPWM_EN (0x01U) 396 397 /* LDO2 */ 398 #define PCA9422_LDO2_CFG_L2_CSEL (0xC0U) 399 #define PCA9422_LDO2_CFG_L2_LLSEL (0x30U) 400 #define PCA9422_LDO2_CFG_L2_LPMODE (0x0CU) 401 #define PCA9422_LDO2_CFG_L2_ENMODE (0x03U) 402 403 #define PCA9422_LDO2_OUT_L2_AD (0x80U) 404 #define PCA9422_LDO2_OUT_L2_INL2_MDET (0x40U) 405 #define PCA9422_LDO2_OUT_L2_OUT (0x3FU) 406 407 #define PCA9422_LDO2_OUT_STBY_L2_OUT_STBY (0x3FU) 408 409 /* LDO3 */ 410 #define PCA9422_LDO3_CFG_L3_CSEL (0xC0U) 411 #define PCA9422_LDO3_CFG_L3_LLSEL (0x30U) 412 #define PCA9422_LDO3_CFG_L3_LPMODE (0x0CU) 413 #define PCA9422_LDO3_CFG_L3_ENMODE (0x03U) 414 415 #define PCA9422_LDO3_OUT_L3_AD (0x80U) 416 #define PCA9422_LDO3_OUT_L3_INL3_MDET (0x40U) 417 #define PCA9422_LDO3_OUT_L3_OUT (0x3FU) 418 419 #define PCA9422_LDO3_OUT_STBY_L3_OUT_STBY (0x3FU) 420 421 #define PCA9422_LDO23_CFG_LDO3_MODE (0x80U) 422 #define PCA9422_LDO23_CFG_LDO2_MODE (0x40U) 423 #define PCA9422_LDO23_CFG_L2_INL2_VSEL (0x20U) 424 #define PCA9422_LDO23_CFG_L3_INL3_VSEL (0x10U) 425 426 /* LDO4 */ 427 #define PCA9422_LDO4_CFG_L4_AD (0x10U) 428 #define PCA9422_LDO4_CFG_L4_ENMODE (0x03U) 429 #define PCA9422_LDO4_OUT_L4_OUT (0x7FU) 430 431 #define PCA9422_LDO4_OUT_STBY_L4_OUT_STBY (0x7FU) 432 433 /* LDO1 */ 434 #define PCA9422_LDO1_CFG1_L1_AD (0x80U) 435 #define PCA9422_LDO1_CFG1_L1_OUT (0x7FU) 436 437 #define PCA9422_LDO1_CFG2_L1_ENMODE (0x01U) 438 439 #define PCA9422_LDO2_OUT_SLEEP_L2_OUT_SLEEP (0x3FU) 440 #define PCA9422_LDO3_OUT_SLEEP_L3_OUT_SLEEP (0x3FU) 441 #define PCA9422_LDO4_OUT_SLEEP_L4_OUT_SLEEP (0x7FU) 442 443 /* SW4 BB */ 444 #define PCA9422_SW4_BB_CFG1_BB_FPWM (0x08U) 445 #define PCA9422_SW4_BB_CFG1_BB_FAULT_OC_CTRL (0x04U) 446 #define PCA9422_SW4_BB_CFG1_BB_SOFT_STDN (0x02U) 447 #define PCA9422_SW4_BB_CFG1_BB_DIS (0x01U) 448 449 #define PCA9422_SW4_BB_CFG2_BB_ENABLE (0x40U) 450 #define PCA9422_SW4_BB_CFG2_BB_MODESEL (0x30U) 451 #define PCA9422_SW4_BB_CFG2_BB_ENMODE (0x0CU) 452 #define PCA9422_SW4_BB_CFG2_BB_LPMODE (0x03U) 453 454 #define PCA9422_SW4_BB_CFG3_BB_VOUT (0xFFU) 455 #define PCA9422_SW4_BB_CFG4_BB_VOUT_STBY (0xFFU) 456 #define PCA9422_SW4_BB_MAX_LIMIT_BB_MAX_LIMIT (0xFFU) 457 #define PCA9422_SW4_BB_MIM_LIMIT_BB_MIM_LIMIT (0xFFU) 458 #define PCA9422_SW4_BB_VOUT_SLEEP_BB_VOUT_SLEEP (0xFFU) 459 460 /* LED */ 461 #define PCA9422_LED_CFG1_LED_EN (0x80U) 462 #define PCA9422_LED_CFG1_LED_RAMP (0x40U) 463 #define PCA9422_LED_CFG1_LED_PWM (0x3FU) 464 465 #define PCA9422_LED_CFG2_LEDOVRD (0x20U) 466 #define PCA9422_LED_CFG2_LED_CFG (0x10U) 467 #define PCA9422_LED_CFG2_LED_CURRENT (0x0CU) 468 #define PCA9422_LED_CFG2_LED_FREQ (0x03U) 469 470 /* GPIO */ 471 #define PCA9422_GPIO_STATUS_GPIO_STATUS (0x01U) 472 473 #define PCA9422_GPIO_CFG_GPIO_OUT (0x80U) 474 #define PCA9422_GPIO_CFG_GPIO_R_CFG2 (0x40U) 475 #define PCA9422_GPIO_CFG_GPIO_R_CFG1 (0x20U) 476 #define PCA9422_GPIO_CFG_GPIO_OUT_CFG (0x10U) 477 #define PCA9422_GPIO_CFG_GPIO_GPIO_CFG (0x0FU) 478 479 /* Regulator EN */ 480 #define PCA9422_REGULATOR_EN_B1_ENABLE (0x20U) 481 #define PCA9422_REGULATOR_EN_B2_ENABLE (0x10U) 482 #define PCA9422_REGULATOR_EN_B3_ENABLE (0x08U) 483 #define PCA9422_REGULATOR_EN_L2_ENABLE (0x04U) 484 #define PCA9422_REGULATOR_EN_L3_ENABLE (0x02U) 485 #define PCA9422_REGULATOR_EN_L4_ENABLE (0x01U) 486 487 #define PCA9422_WAKEUP_SEQ1_BB_WAKEUP_GR (0xC0U) 488 #define PCA9422_WAKEUP_SEQ1_B3_WAKEUP_GR (0x30U) 489 #define PCA9422_WAKEUP_SEQ1_B2_WAKEUP_GR (0x0CU) 490 #define PCA9422_WAKEUP_SEQ1_B1_WAKEUP_GR (0x03U) 491 492 #define PCA9422_WAKEUP_SEQ2_WAKEUP_SEQ_CFG (0xC0U) 493 #define PCA9422_WAKEUP_SEQ2_L4_WAKEUP_GR (0x30U) 494 #define PCA9422_WAKEUP_SEQ2_L3_WAKEUP_GR (0x0CU) 495 #define PCA9422_WAKEUP_SEQ2_L2_WAKEUP_GR (0x03U) 496 497 #define PCA94R22_REG_LOCK_UNLOCK_KEY (0xFFU) 498 499 /*! @brief PCA9422 Device information */ 500 typedef enum _pca9422_dev_rev 501 { 502 kPCA9422_DevRevA0 = 0x00U, /* Device revision A0 */ 503 kPCA9422_DevRevB0 = 0x01U, /* Device revision B0 */ 504 } pca9422_dev_rev_t; 505 506 /*! @brief PCA9422 Top level function definition. */ 507 /*! @brief PCA9422 Watchdog timer setting definition. */ 508 typedef enum _pca9422_wd_timer 509 { 510 kPCA9422_WdTimerDisabled = 0x00U, /* Watch dog timer disabled. */ 511 kPCA9422_WdTimer16s = 0x40U, /* Watch dog timer timeout value is 16 sec. */ 512 kPCA9422_WdTimer32s = 0x80U, /* Watch dog timer timeout value is 32 sec. */ 513 kPCA9422_WdTimer64s = 0xC0U, /* Watch dog timer timeout value is 64 sec. */ 514 } pca9422_wd_timer_t; 515 516 /*! @brief PCA9422 Battery Charger definition. */ 517 /*! @brief PCA9422 AICL threshold on CHGIN definition. */ 518 typedef enum _pca9422_aicl_v 519 { 520 kPCA9422_AICLV4p5V = 0x00U, /* AICL Threshould on VIN is 4.5V */ 521 kPCA9422_AICLV4p6V = 0x02U, /* AICL Threshould on VIN is 4.6V */ 522 kPCA9422_AICLV4p7V = 0x04U, /* AICL Threshould on VIN is 4.7V */ 523 kPCA9422_AICLV4p8V = 0x06U, /* AICL Threshould on VIN is 4.8V */ 524 } pca9422_aicl_v_t; 525 526 /*! @brief PCA9422 Input Current Limit on CHGIN definition. */ 527 typedef enum _pca9422_chgin_ilim 528 { 529 kPCA9422_ChgInIlim_45mA = 0x00U, 530 kPCA9422_ChgInIlim_70mA = 0x01U, 531 kPCA9422_ChgInIlim_95mA = 0x02U, 532 kPCA9422_ChgInIlim_120mA = 0x03U, 533 kPCA9422_ChgInIlim_145mA = 0x04U, 534 kPCA9422_ChgInIlim_170mA = 0x05U, 535 kPCA9422_ChgInIlim_195mA = 0x06U, 536 kPCA9422_ChgInIlim_220mA = 0x07U, 537 kPCA9422_ChgInIlim_245mA = 0x08U, 538 kPCA9422_ChgInIlim_270mA = 0x09U, 539 kPCA9422_ChgInIlim_295mA = 0x0AU, 540 kPCA9422_ChgInIlim_320mA = 0x0BU, 541 kPCA9422_ChgInIlim_345mA = 0x0CU, 542 kPCA9422_ChgInIlim_370mA = 0x0DU, 543 kPCA9422_ChgInIlim_395mA = 0x0EU, 544 kPCA9422_ChgInIlim_420mA = 0x0FU, 545 kPCA9422_ChgInIlim_445mA = 0x10U, 546 kPCA9422_ChgInIlim_470mA = 0x11U, 547 kPCA9422_ChgInIlim_495mA = 0x12U, 548 kPCA9422_ChgInIlim_520mA = 0x13U, 549 kPCA9422_ChgInIlim_545mA = 0x14U, 550 kPCA9422_ChgInIlim_570mA = 0x15U, 551 kPCA9422_ChgInIlim_595mA = 0x16U, 552 kPCA9422_ChgInIlim_620mA = 0x17U, 553 kPCA9422_ChgInIlim_645mA = 0x18U, 554 kPCA9422_ChgInIlim_670mA = 0x19U, 555 kPCA9422_ChgInIlim_695mA = 0x1AU, 556 kPCA9422_ChgInIlim_795mA = 0x1BU, 557 kPCA9422_ChgInIlim_895mA = 0x1CU, 558 kPCA9422_ChgInIlim_995mA = 0x1DU, 559 kPCA9422_ChgInIlim_1095mA = 0x1EU, 560 kPCA9422_ChgInIlim_1195mA = 0x1FU, 561 } pca9422_chgin_ilim_t; 562 563 /*! @brief PCA9422 VSYS Regulation voltage definition. */ 564 #define PCA9422_VSYS_REG_MIN (4425U) 565 #define PCA9422_VSYS_REG_MAX (4800U) 566 #define PCA9422_VSYS_REG_STEP (25U) 567 #define PCA9422_VSYS_REG(_volt) (((_volt) - PCA9422_VSYS_REG_MIN) / PCA9422_VSYS_REG_STEP) 568 #define PCA9422_VBAT_CLAMP_OFFSET (200U) 569 570 /*! @brief PCA9422 Unlock or lock all Charger Control register definition. */ 571 #define PCA9422_CHARGER_LOCK_UNLOCK (0x30U) 572 #define PCA9422_CHARGER_LOCK_LOCK (0x00U) 573 574 /*! @brief PCA922 V_WARM_50C threshold definition. */ 575 typedef enum _pca9422_v_warm_50c 576 { 577 kPCA9422_Vwarm50C40p75percent = 0x00U, /* Vwarm threshold is 40.75% of VTHREM_BIAS. */ 578 kPCA9422_Vwarm50C36p53percent = 0x04U, /* Vwarm threshold is 36.53% of VTHREM_BIAS. */ 579 kPCA9422_Vwarm50C32p63percent = 0x08U, /* Vwarm threshold is 32.63% of VTHREM_BIAS. */ 580 kPCA9422_Vwarm50C29p07percent = 0x0CU, /* Vwarm threshold is 29.07% of VTHREM_BIAS. */ 581 } pca9422_v_warm_50c_t; 582 583 /*! @brief PCA922 V_WARM_45C threshold definition. */ 584 typedef enum _pca9422_v_warm_45c 585 { 586 kPCA9422_Vwarm45C40p75percent = 0x00U, /* Vwarm threshold is 40.75% of VTHREM_BIAS. */ 587 kPCA9422_Vwarm45C36p53percent = 0x10U, /* Vwarm threshold is 36.53% of VTHREM_BIAS. */ 588 kPCA9422_Vwarm45C32p63percent = 0x20U, /* Vwarm threshold is 32.63% of VTHREM_BIAS. */ 589 kPCA9422_Vwarm45C29p07percent = 0x30U, /* Vwarm threshold is 29.07% of VTHREM_BIAS. */ 590 } pca9422_v_warm_45c_t; 591 592 /*! @brief PCA9422 Precharge Current definition. */ 593 typedef enum _pca9422_prechg_i 594 { 595 kPCA9422_PrechgI10percent = 0x00U, /* Precharge current is 10% of Fast charge current. */ 596 kPCA9422_PrechgI20percent = 0x02U, /* Precharge current is 20% of Fast charge current. */ 597 } pca9422_prechg_i_t; 598 599 /*! @brief PCA9422 current step on battery charge current definition. */ 600 typedef enum _pca9422_chg_i_step 601 { 602 kPCA9422_ChgIStep2p5mA = 0x00U, /* Battery charge current step is 2.5mA. */ 603 kPCA9422_ChgIStep5p0mA = 0x01U, /* Battery charge current step is 5.0mA. */ 604 } pca9422_chg_i_step_t; 605 606 /*! @brief PCA9422 fast charge current default value definition. */ 607 #define PCA9422_I_FAST_CHG_DFT (0x27U) 608 609 /*! @brief PCA9422 VBAT floating voltage definition. */ 610 #define PCA9422_VBAT_REG_MIN (3600U) 611 #define PCA9422_VBAT_REG_MAX (4600U) 612 #define PCA9422_VBAT_REG_STEP (10U) 613 #define PCA9422_VBAT_REG(_volt) (((_volt) - PCA9422_VBAT_REG_MIN) / PCA9422_VBAT_REG_STEP) 614 615 /*! @brief PCA9422 fast charge current default value definition. */ 616 #define PCA9422_I_FAST_CHG_DFT (0x27U) /* 100mA */ 617 618 /*! @brief PCA9422 Recharge threshold definition. */ 619 typedef enum _pca9422_recharge_th 620 { 621 kPCA9422_RechargeTh100mV = 0x00U, /* Recharge threshold based on VBAT <= VBAT_REG - 100mV */ 622 kPCA9422_RechargeTh150mV = 0x10U, /* Recharge threshold based on VBAT <= VBAT_REG - 150mV */ 623 kPCA9422_RechargeTh200mV = 0x20U, /* Recharge threshold based on VBAT <= VBAT_REG - 200mV */ 624 } pca9422_recharge_th_t; 625 626 /*! @brief PCA9422 Top-off current definition. */ 627 typedef enum _pca9422_topoff_i 628 { 629 kPCA9422_TopoffI2p5percent = 0x00U, /* Topoff current is 2.5% of Fast charge current. */ 630 kPCA9422_TopoffI5p0percent = 0x04U, /* Topoff current is 5.0% of Fast charge current. */ 631 kPCA9422_TopoffI7p5percent = 0x08U, /* Topoff current is 7.5% of Fast charge current. */ 632 kPCA9422_TopoffI10p0percent = 0x0CU, /* Topoff current is 10.0% of Fast charge current. */ 633 } pca9422_topoff_i_t; 634 635 /*! @brief PCA9422 Precharge timer definition. */ 636 typedef enum _pca9422_precharge_timer 637 { 638 kPCA9422_PrechgTimerDisable = 0x00U, /* Precharge timer is disabled. */ 639 kPCA9422_PrechgTimer15min = 0x01U, /* Precharge timer set 15min. */ 640 kPCA9422_PrechgTimer30min = 0x02U, /* Precharge timer set 30min. */ 641 kPCA9422_PrechgTimer60min = 0x03U, /* Precharge timer set 60min. */ 642 } pca9422_precharge_timer_t; 643 644 /*! @brief PCA9422 charger control 5 register default value definition. */ 645 #define PCA9422_CHARGER_CNTL_5_DFT (0x01U) 646 647 /*! @brief PCA9422 V_HOT_60C threshold definition. */ 648 typedef enum _pca9422_v_hot_60c 649 { 650 kPCA9422_Vhot60C32p63percent = 0x00U, /* Vhot threshold is 32.63% of VTHREM_BIAS. */ 651 kPCA9422_Vhot60C29p07percent = 0x40U, /* Vhot threshold is 29.07% of VTHREM_BIAS. */ 652 kPCA9422_Vhot60C25p84percent = 0x80U, /* Vhot threshold is 25.84% of VTHREM_BIAS. */ 653 kPCA9422_Vhot60C22p94percent = 0xC0U, /* Vhot threshold is 22.94% of VTHREM_BIAS. */ 654 } pca9422_v_hot_60c_t; 655 656 /*! @brief PCA9422 V_COOL_10C threshold definition. */ 657 typedef enum _pca9422_v_cool_10c 658 { 659 kPCA9422_Vcool10C74p18percent = 0x00U, /* Vcool threshold is 74.18% of VTHREM_BIAS. */ 660 kPCA9422_Vcool10C69p62percent = 0x04U, /* Vcool threshold is 69.62% of VTHREM_BIAS. */ 661 kPCA9422_Vcool10C64p82percent = 0x08U, /* Vcool threshold is 64.82% of VTHREM_BIAS. */ 662 kPCA9422_Vcool10C59p87percent = 0x0CU, /* Vcool threshold is 59.87% of VTHREM_BIAS. */ 663 } pca9422_v_cool_10c_t; 664 665 /*! @brief PCA9422 V_COLD_0C threshold definition. */ 666 typedef enum _pca9422_v_cold_0c 667 { 668 kPCA9422_Vcold0C82p26percent = 0x00U, /* Vcold threshold is 82.26% of VTHREM_BIAS. */ 669 kPCA9422_Vcold0C78p42percent = 0x01U, /* Vcold threshold is 78.42% of VTHREM_BIAS. */ 670 kPCA9422_Vcold0C74p18percent = 0x02U, /* Vcold threshold is 74.18% of VTHREM_BIAS. */ 671 kPCA9422_Vcold0C69p62percent = 0x03U, /* Vcold threshold is 69.62% of VTHREM_BIAS. */ 672 } pca9422_v_cold_0c_t; 673 674 /*! @brief PCA9422 Fast charge timer definition. */ 675 typedef enum _pca9422_fast_chg_timer 676 { 677 kPCA9422_FastchgTimerDisable = 0x00U, /* Fast charge timer is disabled */ 678 kPCA9422_FastchgTimer3h = 0x40U, /* Fast charge timer set 3 hours */ 679 kPCA9422_FastchgTimer5h = 0x80U, /* Fast charge timer set 5 hours */ 680 kPCA9422_FastchgTimer7h = 0xC0U, /* Fast charge timer set 7 hours */ 681 } pca9422_fast_chg_timer_t; 682 683 /*! @brief PCA9422 New charge current at COOL(10C) condition definition. */ 684 typedef enum _pca9422_new_i_vbat_10c 685 { 686 kPCA9422_NewIVbat10C_StayIFastchg = 0x00U, /* Stays a current IFAST_CHG */ 687 kPCA9422_NewIVbat10C_0p75percentIFastchg = 688 0x04U, /* Set [2.5mA or 5.0mA + 0.75 *I_FAST_CHG[6:0] x 2.5mA or 5.0mA] */ 689 kPCA9422_NewIVbat10C_0p5percentIFastchg = 0x08U, /* Set [2.5mA or 5.0mA + 0.50 *I_FAST_CHG[6:0] x 2.5mA or 5.0mA] */ 690 kPCA9422_NewIVbat10C_0p25percentIFastchg = 691 0x0CU, /* Set [2.5mA or 5.0mA + 0.25 *I_FAST_CHG[6:0] x 2.5mA or 5.0mA] */ 692 } pca9422_new_i_vbat_10c_t; 693 694 /*! @brief PCA9422 New charge current at WARM Plus(50C) condition definition. */ 695 typedef enum _pca9422_new_i_vbat_50c 696 { 697 kPCA9422_NewIVbat50C_StayIFastchg = 0x00U, /* Stays a current IFAST_CHG */ 698 kPCA9422_NewIVbat50C_0p75percentIFastchg = 699 0x10U, /* Set [2.5mA or 5.0mA + 0.75 *I_FAST_CHG[6:0] x 2.5mA or 5.0mA] */ 700 kPCA9422_NewIVbat50C_0p5percentIFastchg = 0x20U, /* Set [2.5mA or 5.0mA + 0.50 *I_FAST_CHG[6:0] x 2.5mA or 5.0mA] */ 701 kPCA9422_NewIVbat50C_0p25percentIFastchg = 702 0x30U, /* Set [2.5mA or 5.0mA + 0.25 *I_FAST_CHG[6:0] x 2.5mA or 5.0mA] */ 703 } pca9422_new_i_vbat_50c_t; 704 705 /*! @brief PCA9422 New charge current at WARM(45C) condition definition. */ 706 typedef enum _pca9422_new_i_vbat_45c 707 { 708 kPCA9422_NewIVbat45C_StayIFastchg = 0x00U, /* Stays a current IFAST_CHG */ 709 kPCA9422_NewIVbat45C_0p75percentIFastchg = 710 0x04U, /* Set [2.5mA or 5.0mA + 0.75 *I_FAST_CHG[6:0] x 2.5mA or 5.0mA] */ 711 kPCA9422_NewIVbat45C_0p5percentIFastchg = 0x08U, /* Set [2.5mA or 5.0mA + 0.50 *I_FAST_CHG[6:0] x 2.5mA or 5.0mA] */ 712 kPCA9422_NewIVbat45C_0p25percentIFastchg = 713 0x0CU, /* Set [2.5mA or 5.0mA + 0.25 *I_FAST_CHG[6:0] x 2.5mA or 5.0mA] */ 714 } pca9422_new_i_vbat_45c_t; 715 716 /*! @brief PCA9422 New VBAT_REG at WARM condition, WARM_45C or WARM_50C, definition. */ 717 typedef enum _pca9422_new_vbat_45c 718 { 719 kPCA9422_NewVbat45C_StayVbatReg = 0x00U, /* Stays a current VVBAT_REG */ 720 kPCA9422_NewVbat45C_VbatRegMinus100mV = 0x01U, /* Set a new value with (VVBAT_REG – 100mV) */ 721 kPCA9422_NewVbat45C_VbatRegMinus150mV = 0x02U, /* Set a new value with (VVBAT_REG – 150mV) */ 722 kPCA9422_NewVbat45C_VbatRegMinus200mV = 0x03U, /* Set a new value with (VVBAT_REG – 200mV) */ 723 } pca9422_new_vbat_45c_t; 724 725 /*! @brief PCA9422 New VBAT_REG at WARM condition, WARM_45C or WARM_50C, definition. */ 726 typedef enum _pca9422_new_vbat_50c 727 { 728 kPCA9422_NewVbat50C_StayVbatReg = 0x00U, /* Stays a current VVBAT_REG */ 729 kPCA9422_NewVbat50C_VbatRegMinus100mV = 0x40U, /* Set a new value with (VVBAT_REG – 100mV) */ 730 kPCA9422_NewVbat50C_VbatRegMinus150mV = 0x80U, /* Set a new value with (VVBAT_REG – 150mV) */ 731 kPCA9422_NewVbat50C_VbatRegMinus200mV = 0xC0U, /* Set a new value with (VVBAT_REG – 200mV) */ 732 } pca9422_new_vbat_50c_t; 733 734 /*! @brief PCA9422 thermal regulation threshold definition. */ 735 typedef enum _pca9422_thermal_reg 736 { 737 kPCA9422_ThermalRegulationDisable = 0x00U, /* Thermal regulation threshold is disabled */ 738 kPCA9422_ThermalRegulation60C = 0x08U, /* Thermal regulation threshuold is 60C */ 739 kPCA9422_ThermalRegulation70C = 0x10U, /* Thermal regulation threshuold is 70C */ 740 kPCA9422_ThermalRegulation80C = 0x18U, /* Thermal regulation threshuold is 80C */ 741 kPCA9422_ThermalRegulation90C = 0x20U, /* Thermal regulation threshuold is 90C */ 742 kPCA9422_ThermalRegulation100C = 0x28U, /* Thermal regulation threshuold is 100C */ 743 } pca9422_thermal_regulation_t; 744 745 /*! @brief PCA9422 Top-off timer definition. */ 746 typedef enum _pca9422_top_off_timer 747 { 748 kPCA9422_TopoffTimerDisable = 0x00U, 749 kPCA9422_TopoffTimer5min = 0x01U, 750 kPCA9422_TopoffTimer10min = 0x02U, 751 kPCA9422_TopoffTimer15min = 0x03U, 752 kPCA9422_TopoffTimer20min = 0x04U, 753 kPCA9422_TopoffTimer25min = 0x05U, 754 kPCA9422_TopoffTimer30min = 0x06U, 755 kPCA9422_TopoffTimer35min = 0x07U, 756 } pca9422_top_off_timer_t; 757 758 /*! @brief PCA9422 AMUX wait time definition. */ 759 typedef enum _pca9422_amux_auto_off_wait 760 { 761 kPCA9422_AMUXAutoOffWait_256us = 0x00U, 762 kPCA9422_AMUXAutoOffWait_1088us = 0x40U, 763 kPCA9422_AMUXAutoOffWait_8192us = 0x80U, 764 kPCA9422_AMUXAutoOffWait_32768us = 0xC0U, 765 } pca9422_amux_auto_off_wait_t; 766 767 /*! @brief PCA9422 AMUX mode definition. */ 768 typedef enum _pca9422_amux_mode 769 { 770 kPCA9422_AMUXModeManual = 0x00U, 771 kPCA9422_AMUXModeAutoOneshot = 0x20U, 772 } pca9422_amux_mode_t; 773 774 /*! @brief PCA9422 AMUX VBAT/VSYS channel scale factor definition. */ 775 typedef enum _pca9422_amux_vbat_vsys_gain 776 { 777 kPCA9422_AMUXVbatVsysGain_1dvd3 = 0x00U, /* 1/3 */ 778 kPCA9422_AMUXVbatVsysGain_1dvd4 = 0x10U, /* 1/4 */ 779 } pca9422_amux_vbat_vsys_gain_t; 780 781 /*! @brief PCA9422 AMUX THERM and THERM_BIAS channel scale factor definition. */ 782 typedef enum _pca9422_amux_therm_gain 783 { 784 kPCA9422_AMUXThermGain_1 = 0x00U, /* 1 */ 785 kPCA9422_AMUXThermGain_1dvd1p5 = 0x08U, /* 1/1.5 */ 786 } pca9422_amux_therm_gain_t; 787 788 /* @brief PCA9422 AMUX channel definition. */ 789 typedef enum _pca9422_amux_channel 790 { 791 kPCA9422_AMUXChannel_Off = 0x00U, 792 kPCA9422_AMUXChannel_Vbat = 0x01U, 793 kPCA9422_AMUXChannel_Therm = 0x02U, 794 kPCA9422_AMUXChannel_ThermBias = 0x03U, 795 kPCA9422_AMUXChannel_Vsys = 0x04U, 796 kPCA9422_AMUXChannel_Vin = 0x05U, 797 kPCA9422_AMUXChannel_Max = 0x06U, 798 } pca9422_amux_channel_t; 799 800 /* @brief PCA9422 AMUX configuration structure definition */ 801 typedef struct _pca9422_amux_config 802 { 803 /* AMUX wait time to be automatically disabled in automatic one-shot mode. */ 804 uint8_t waitTime; 805 /* AMUX mode */ 806 uint8_t amuxMode; 807 /* VBAT/VSYS channel scale factor */ 808 uint8_t vbatGain; 809 /* THERM and THERM_BIAS channels scale factor */ 810 uint8_t thermGain; 811 /* AMUX channel */ 812 uint8_t amuxChannel; 813 } pca9422_amux_config_t; 814 815 /*! @brief PCA9422 Regulator */ 816 /*! @brief PCA9422 Regulator Status definition. */ 817 typedef enum _pca9422_reg_status 818 { 819 kPCA9422_RegStatusVoutSw1OK = 0x80U, /* SW1 VOUT Power good status */ 820 kPCA9422_RegStatusVoutSw2OK = 0x40U, /* SW2 VOUT Power good status */ 821 kPCA9422_RegStatusVoutSw3OK = 0x20U, /* SW3 VOUT Power good status */ 822 kPCA9422_RegStatusVoutSw4OK = 0x10U, /* SW4 VOUT Power good status */ 823 kPCA9422_RegStatusVoutLdo1OK = 0x08U, /* LDO1 VOUT Power good status */ 824 kPCA9422_RegStatusVoutLdo2OK = 0x04U, /* LDO2 VOUT Power good status */ 825 kPCA9422_RegStatusVoutLdo3OK = 0x02U, /* LDO3 VOUT Power good status */ 826 kPCA9422_RegStatusVoutLdo4OK = 0x01U, /* LDO4 VOUT Power good status */ 827 } pca9422_reg_status_t; 828 829 /*! @brief PCA9422 Power mode definition. */ 830 typedef enum _pca9422_power_mode 831 { 832 kPCA9422_ActiveModeDVS0 = 0x00U, /* Active mode - DVS0 */ 833 kPCA9422_ActiveModeDVS1 = 0x01U, /* Active mode - DVS1 */ 834 kPCA9422_ActiveModeDVS2 = 0x02U, /* Active mode - DVS2 */ 835 kPCA9422_ActiveModeDVS3 = 0x03U, /* Active mode - DVS3 */ 836 kPCA9422_ActiveModeDVS4 = 0x04U, /* Active mode - DVS4 */ 837 kPCA9422_ActiveModeDVS5 = 0x05U, /* Active mode - DVS5 */ 838 kPCA9422_ActiveModeDVS6 = 0x06U, /* Active mode - DVS6 */ 839 kPCA9422_ActiveModeDVS7 = 0x07U, /* Active mode - DVS7 */ 840 kPCA9422_StandbyMode = 0x08U, /* STANDBY mode */ 841 kPCA9422_NoneMode = 0x09U, /* None mode */ 842 kPCA9422_DPStandbyMode = 0x0AU, /* DPSTANDBY mode */ 843 kPCA9422_SleepMode = 0x0BU, /* SLEEP mode */ 844 kPCA9422_PowerModeMax = 0x0CU, /* Max Power mode */ 845 } pca9422_power_mode_t; 846 847 /*! @brief PCA9422 Standby control definition */ 848 typedef enum _pca9422_standby_ctrl 849 { 850 kPCA9422_StandbyCtrlPins = 0x00U, 851 kPCA9422_StandbyCtrlStandbyConfigandPin = 0x40U, 852 } pca9422_standby_ctrl_t; 853 854 /*! @brief PCA9422 Standby configuration definition */ 855 typedef enum _pca9422_standby_cfg 856 { 857 kPCA9422_StandbyCfgStandby = 0x00U, 858 kPCA9422_StandbyCfgDPStandby = 0x20U, 859 } pca9422_standby_cfg_t; 860 861 /*! @brief PCA9422 DVS_CTRL2 pin enable definition */ 862 typedef enum _pca9422_dvs_ctrl2_en 863 { 864 kPCA9422_DVSCtrl2PinIgnore = 0x00U, 865 kPCA9422_DVSCtrl2PinUseDVSCtrl = 0x04U, 866 } pca9422_dvs_ctrl2_en_t; 867 868 /*! @brief PCA9422 Power Save mode definition */ 869 typedef enum _pca9422_power_save_mode 870 { 871 kPCA9422_PowerSaveUseLowIq = 0x00U, 872 kPCA9422_PowerSaveStandbyDPStandby = 0x10U, 873 kPCA9422_PowerSaveDPStandby = 0x20U, 874 kPCA9422_PowerSaveNormal = 0x30U, 875 } pca9422_power_save_mode_t; 876 877 /*! @brief PCA9422 GPIO pull-up configuration definition */ 878 typedef enum _pca9422_gpio_pullup_cfg 879 { 880 kPCA9422_GPIOPullupVsys = 0x00U, 881 kPCA9422_GPIOPullupLDO1 = 0x08U, 882 } pca9422_gpio_pullup_cfg_t; 883 884 /*! @brief PCA9422 VSYS UVLO threshold definition */ 885 typedef enum _pca9422_vsys_uvlo_sel 886 { 887 kPCA9422_VsysUVLOSel2p6V = 0x00U, 888 kPCA9422_VsysUVLOSel2p7V = 0x01U, 889 kPCA9422_VsysUVLOSel2p8V = 0x02U, 890 } pca9422_vsys_uvlo_sel_t; 891 892 /*! @brief PCA9422 DVS smart mode configuration definition */ 893 typedef enum _pca9422_smart_mode 894 { 895 kPCA9422_SmartModeDisabled = 0x00U, 896 kPCA9422_SmartModeEnabled = 0x04U, 897 } pca9422_smart_mode_t; 898 899 /*! @brief PCA9422 Run state definition. */ 900 typedef enum _pca9422_run_state 901 { 902 kPCA9422_RunStateActiveMode = 0x00U, 903 kPCA9422_RunStateSleepMode = 0x01U, 904 kPCA9422_RunStateStandbyMode = 0x02U, 905 kPCA9422_RunStateDPStandbyMode = 0x03U, 906 } pca9422_run_state_t; 907 908 /*! @brief PCA9422 Regulator definition. */ 909 typedef enum _pca9422_regulator 910 { 911 kPCA9422_RegulatorSwitch1 = 0x80U, /* Switch1 regulator. */ 912 kPCA9422_RegulatorSwitch2 = 0x40U, /* Switch2 regulator. */ 913 kPCA9422_RegulatorSwitch3 = 0x20U, /* Switch3 regulator. */ 914 kPCA9422_RegulatorSwitch4 = 0x10U, /* Switch4 regulator. */ 915 kPCA9422_RegulatorLdo1 = 0x08U, /* LDO1 regulator. */ 916 kPCA9422_RegulatorLdo2 = 0x04U, /* LDO2 regulator. */ 917 kPCA9422_RegulatorLdo3 = 0x02U, /* LDO3 regulator. */ 918 kPCA9422_RegulatorLdo4 = 0x01U, /* LDO4 regulator. */ 919 } pca9422_regulator_t; 920 921 /*! @brief PCA9422 Regulator Enable mode definition. */ 922 typedef enum _pca9422_enmode 923 { 924 kPCA9422_EnmodeOnAll = 0x00U, 925 kPCA9422_EnmodeOnActiveSleepStandby = 0x01U, 926 kPCA9422_EnmodeOnActiveSleep = 0x02U, 927 kPCA9422_EnmodeOnActive = 0x03U, 928 } pca9422_enmode_t; 929 930 /*! @brief PCA9422 Buck DVS control definition. */ 931 enum _pca9422_bx_dvs_ctrl 932 { 933 kPCA9422_DVS0thrI2CInActiveAndSleep = 0x00U, /* BUCKxOUT_DVS0 Reg through I2C in both ACTIVE and SLEEP modes */ 934 kPCA9422_DVS0thrI2CInAcitveAndBxOUTSLEEPInSleep = 935 0x01U, /* BUCKxOUT_DVS0 Reg through I2C in ACTIVE mode, and BUCKxOUT_SLEEP when in SLEEP mode */ 936 kPCA9422_PinInActiveAndBxOUTSLEEPInSleep = 937 0x02U, /* DVS_CTRL[2:0] pins in ACTIVE mode and BUCKxOUT_SLEEP when in SLEEP mode */ 938 kPCA9422_DVS0thrI2CInAcitveAndPinInSleep = 939 0x03U, /* BUCKxOUT_DVS0 Reg through I2C in ACTIVE mode, and DVS_CTRL[2:0] pins when in SLEEP mode */ 940 }; 941 942 /*! @brief PCA9422 Buck DVS Ramp definition. */ 943 typedef enum _pca9422_bx_ramp 944 { 945 kPCA9422_BxRamp_25mVp1us = 0x00U, 946 kPCA9422_BxRamp_25mVp2us = 0x40U, 947 kPCA9422_BxRamp_25mVp4us = 0x80U, 948 kPCA9422_BxRamp_25mVp8us = 0xC0U, 949 } pca9422_bx_ramp_t; 950 951 /*! @brief PCA9422 Buck power mode definition. */ 952 typedef enum _pca9422_bx_lpmode 953 { 954 kPCA9422_BxLPmodeNormal = 0x00U, /* Normal mode */ 955 kPCA9422_BxLPmodeAtStandbyDPStandby = 0x10U, /* Low power mode at STANDBY mode and DPSTANDBY mode */ 956 kPCA9422_BxLPmodeAtDPStandby = 0x20U, /* Low power mode at DPSTANDBY mode */ 957 kPCA9422_BxLPmodeForcedLPM = 0x30U, /* Forced low power mode */ 958 } pca9422_bx_lpmode_t; 959 960 /*! @brief PCA9422 Buck Active Discharge definition. */ 961 typedef enum _pca9422_bx_ad 962 { 963 kPCA9422_BxADDisabled = 0x00U, 964 kPCA9422_BxADEnabled = 0x08U, 965 } pca9422_bx_ad_t; 966 967 /*! @brief PCA9422 Buck Forced PWM definition. */ 968 typedef enum _pca9422_bx_fpwm_mode 969 { 970 kPCA9422_BxAutoPFMandPWM = 0x00U, 971 kPCA9422_BxForcedPWM = 0x04U, 972 } pca9422_bx_fpwm_mode_t; 973 974 /*! @brief PCA9422 Buck1 OUT voltage definition. (uV unit) */ 975 #define PCA9422_BUCK1_OUT_MIN (400000U) /* 400mV */ 976 #define PCA9422_BUCK1_OUT_STEP (6250UL) /* 6.25mV */ 977 #define PCA9422_BUCK1_OUT_MAX (1975000U) /* 1975mV */ 978 #define PCA9422_BUCK1_OUT_VAL(_volt) (((_volt) - PCA9422_BUCK1_OUT_MIN) / PCA9422_BUCK1_OUT_STEP) 979 #define PCA9422_BUCK1_OUT_VOLT(_val) (((_val) * PCA9422_BUCK1_OUT_STEP) + PCA9422_BUCK1_OUT_MIN) 980 981 /*! @brief PCA9422 Buck2 OUT voltage definition. (uV unit) */ 982 #define PCA9422_BUCK2_OUT_MIN (400000U) /* 400mV */ 983 #define PCA9422_BUCK2_OUT_STEP (25000U) /* 25mV */ 984 #define PCA9422_BUCK2_OUT_MAX (3400000U) /* 3400mV */ 985 #define PCA9422_BUCK2_OUT_VAL(_volt) (((_volt) - PCA9422_BUCK2_OUT_MIN) / PCA9422_BUCK2_OUT_STEP) 986 #define PCA9422_BUCK2_OUT_VOLT(_val) (((_val) * PCA9422_BUCK2_OUT_STEP) + PCA9422_BUCK2_OUT_MIN) 987 988 /*! @brief PCA9422 Buck3 OUT voltage definition. (uV unit) */ 989 #define PCA9422_BUCK3_OUT_MIN (400000U) /* 400mV */ 990 #define PCA9422_BUCK3_OUT_STEP (6250UL) /* 6.25mV */ 991 #define PCA9422_BUCK3_OUT_MAX (1975000U) /* 1975mV */ 992 #define PCA9422_BUCK3_OUT_VAL(_volt) (((_volt) - PCA9422_BUCK3_OUT_MIN) / PCA9422_BUCK3_OUT_STEP) 993 #define PCA9422_BUCK3_OUT_VOLT(_val) (((_val) * PCA9422_BUCK3_OUT_STEP) + PCA9422_BUCK3_OUT_MIN) 994 995 /*! @brief PCA9422 LDO2/3 output capacitor selection definition. */ 996 typedef enum _pca9422_ldo23_csel 997 { 998 kPCA9422_LDO23CoutLess5uF = 0x00U, /* Setting for Cout < 5uF */ 999 kPCA9422_LDO23CoutHigh5uF = 0x40U, /* Setting for Cout > 5uF */ 1000 kPCA9422_LDO23AutoCoutDetection = 0x80U, /* Auto Cout detection */ 1001 } pca9422_ldo23_csel_t; 1002 1003 /*! @brief PCA9422 LDO2/3 output trace resistance compensation definition. */ 1004 typedef enum _pca9422_ldo23_llsel 1005 { 1006 kPCA9422_LDO23LLSelNoComp = 0x00U, /* No Compensation */ 1007 kPCA9422_LDO23LLSel15mOhm = 0x10U, /* 15mOhm */ 1008 kPCA9422_LDO23LLSel30mOhm = 0x20U, /* 30mOhm */ 1009 kPCA9422_LDO23LLSel45mOhm = 0x30U, /* 45mOhm */ 1010 } pca9422_ldo23_llsel_t; 1011 1012 /*! @brief PCA9422 LDO2/3 power mode definition. */ 1013 typedef enum _pca9422_ldo23_lpmode 1014 { 1015 kPCA9422_LDO23LPmodeAtRunState = 0x00U, 1016 kPCA9422_LDO23LPmodeAtStandbyDPStandby = 0x04U, 1017 kPCA9422_LDO23LPmodeAtDPStandby = 0x08U, 1018 kPCA9422_LDO23LPmodeNormal = 0x0CU, 1019 } pca9422_ldo23_lpmode_t; 1020 1021 /*! @brief PCA9422 LDO2/3 Load Switch mode definition. */ 1022 typedef enum _pca9422_ldo23_mode 1023 { 1024 kPCA9422_LDO23LDOMode = 0x00U, 1025 kPCA9422_LDO23LoadSwitchMode = 0x01U, 1026 } pca9422_ldo23_mode_t; 1027 1028 /*! @brief PCA9422 LDO1 OUT voltage definition. (uV unit) */ 1029 #define PCA9422_LDO1_OUT_MIN (800000U) /* 800mV */ 1030 #define PCA9422_LDO1_OUT_STEP (25000U) /* 25mV */ 1031 #define PCA9422_LDO1_OUT_MAX (3000000U) /* 3000mV */ 1032 #define PCA9422_LDO1_OUT_VAL(_volt) (((_volt) - PCA9422_LDO1_OUT_MIN) / PCA9422_LDO1_OUT_STEP) 1033 #define PCA9422_LDO1_OUT_VOLT(_val) (((_val) * PCA9422_LDO1_OUT_STEP) + PCA9422_LDO1_OUT_MIN) 1034 1035 /*! @brief PCA9422 LDO2/3 OUT voltage definition. (uV unit) */ 1036 #define PCA9422_LDO23_OUT_MIN (500000U) /* 500mV */ 1037 #define PCA9422_LDO23_OUT_STEP (25000U) /* 25mV */ 1038 #define PCA9422_LDO23_OUT_MAX (1950000U) /* 1950mV */ 1039 #define PCA9422_LDO23_OUT_VAL(_volt) (((_volt) - PCA9422_LDO23_OUT_MIN) / PCA9422_LDO23_OUT_STEP) 1040 #define PCA9422_LDO23_OUT_VOLT(_val) (((_val) * PCA9422_LDO23_OUT_STEP) + PCA9422_LDO23_OUT_MIN) 1041 1042 /*! @brief PCA9422 LDO4 OUT voltage definition. (uV unit) */ 1043 #define PCA9422_LDO4_OUT_MIN (800000U) /* 800mV */ 1044 #define PCA9422_LDO4_OUT_STEP (25000U) /* 25mV */ 1045 #define PCA9422_LDO4_OUT_MAX (3300000U) /* 3300mV */ 1046 #define PCA9422_LDO4_OUT_VAL(_volt) (((_volt) - PCA9422_LDO4_OUT_MIN) / PCA9422_LDO4_OUT_STEP) 1047 #define PCA9422_LDO4_OUT_VOLT(_val) (((_val) * PCA9422_LDO4_OUT_STEP) + PCA9422_LDO4_OUT_MIN) 1048 1049 /*! @brief PCA9422 Buck-Boost FPWM mode definition. */ 1050 typedef enum _pca9422_bb_fpwm_mode 1051 { 1052 kPCA9422_BBAutoPFMandPWM = 0x00U, /* Automatic PFM and PWM mode transition */ 1053 kPCA9422_BBForcedPWM = 0x08U, /* Forced PWM mode */ 1054 } pca9422_bb_fpwm_mode_t; 1055 1056 /*! @brief PCA9422 Buck-Boost overcurrent response definition. */ 1057 typedef enum _pca9422_bb_fault_oc_ctrl 1058 { 1059 kPCA9422_BBNotTurnOff = 0x00U, 1060 kPCA9422_BBTurnOff = 0x04U, 1061 } pca9422_bb_fault_oc_ctrl_t; 1062 1063 /*! @brief PCA9422 Buck-Boost active discharge control definition. */ 1064 typedef enum _pca9422_bb_soft_stdn 1065 { 1066 kPCA9422_BBRampDownDisabled = 0x00U, /* Digital ramping down Vout is disabled */ 1067 kPCA9422_BBRampDownEnabled = 0x02U, /* Digital ramping down Vout is enabled */ 1068 } pca9422_bb_soft_stdn_t; 1069 1070 /*! @brief PCA9422 Buck-Boost passive discharge control definition. */ 1071 typedef enum _pca9422_bb_dis 1072 { 1073 kPCA9422_BBPassiveDsgDisabled = 0x00U, 1074 kPCA9422_BBPassiveDsgEnabled = 0x01U, 1075 } pca9422_bb_dis_t; 1076 1077 /*! @brief PCA9422 Buck-Boost enable in RUN state definition. */ 1078 typedef enum _pca9422_bb_enable_in_run 1079 { 1080 kPCA9422_BBOffInRunState = 0x00U, 1081 kPCA9422_BBOnInRunState = 0x40U, 1082 } pca9422_bb_enable_in_run_t; 1083 1084 /*! @brief PCA9422 Buck-Boost operation mode definition. */ 1085 typedef enum _pca9422_bb_mode 1086 { 1087 kPCA9422_BBOPmodeAuto = 0x00U, /* Auto */ 1088 kPCA9422_BBOPmodeForcedBoostOnly = 0x10U, /* Forced BOOST only */ 1089 kPCA9422_BBOPmodeForcedBuckOnly = 0x20U, /* Forced BUCK only */ 1090 } pca9422_bb_mode_t; 1091 1092 /*! @brief PCA9422 Buck-Boost Enable mode definition. */ 1093 typedef enum _pca9422_bb_enmode 1094 { 1095 kPCA9422_BBEnmodeOnAll = 0x00U, 1096 kPCA9422_BBEnmodeOnActiveSleepStandby = 0x04U, 1097 kPCA9422_BBEnmodeOnActiveSleep = 0x08U, 1098 kPCA9422_BBEnmodeOnActive = 0x0CU, 1099 } pca9422_bb_enmode_t; 1100 1101 /*! @brief PCA9422 Buck-Boost power mode definition. */ 1102 typedef enum _pca9422_bb_lpmode 1103 { 1104 kPCA9422_BBLPmodeNormal = 0x00U, 1105 kPCA9422_BBLPmodeAtStandbyDPStandby = 0x01U, 1106 kPCA9422_BBLPmodeAtDPStandby = 0x02U, 1107 kPCA9422_BBLPmodeForcedLPM = 0x03U, 1108 } pca9422_bb_lpmode_t; 1109 1110 /*! @brief PCA9422 Regulator power mode definition. */ 1111 typedef enum _pca9422_reg_lpmode 1112 { 1113 kPCA9422_LPmodeNormal = 0x00U, 1114 kPCA9422_LPmodeAtStandbyDPStandby = 0x01U, 1115 kPCA9422_LPpmodeAtDPstandby = 0x02U, 1116 kPCA9422_LPmodeForcedLPM = 0x03U, 1117 } pca9422_reg_lpmode_t; 1118 1119 /*! @brief PCA9422 Buck-Boost OUT voltage definition. (uV unit) */ 1120 #define PCA9422_BB_OUT_MIN (1800000U) /* 1800mV */ 1121 #define PCA9422_BB_OUT_STEP (25000U) /* 25mV */ 1122 #define PCA9422_BB_OUT_MAX (5000000U) /* 5000mV */ 1123 #define PCA9422_BB_OUT_VAL(_volt) (((_volt) - PCA9422_BB_OUT_MIN) / PCA9422_BB_OUT_STEP) 1124 #define PCA9422_BB_OUT_VOLT(_val) (((_val) * PCA9422_BB_OUT_STEP) + PCA9422_BB_OUT_MIN) 1125 1126 /*! @brief PCA9422 Regulator Voltage definition. */ 1127 typedef enum _pca9422_vout 1128 { 1129 kPCA9422_RegVout = 0x00U, 1130 kPCA9422_RegSleepVout = 0x01U, 1131 kPCA9422_RegStandbyVout = 0x02U, 1132 kPCA9422_SWMaxVout = 0x03U, 1133 kPCA9422_BBMinVout = 0x04U, 1134 kPCA9422_SWDVS0Vout = 0x05U, 1135 kPCA9422_SWDVS1Vout = 0x06U, 1136 kPCA9422_SWDVS2Vout = 0x07U, 1137 kPCA9422_SWDVS3Vout = 0x08U, 1138 kPCA9422_SWDVS4Vout = 0x09U, 1139 kPCA9422_SWDVS5Vout = 0x0AU, 1140 kPCA9422_SWDVS6Vout = 0x0BU, 1141 kPCA9422_SWDVS7Vout = 0x0CU, 1142 } pca9422_vout_t; 1143 1144 /*! @brief PCA9422 LED enable definition. */ 1145 typedef enum _pca9422_led_en 1146 { 1147 kPCA9422_LedEnDisable = 0x00U, 1148 kPCA9422_LedEnEnable = 0x80U, 1149 } pca9422_led_en_t; 1150 1151 /*! @brief PCA9422 LED control definition. */ 1152 typedef enum _pca9422_led_ovrd 1153 { 1154 kPCA9422_LedControlByStateMachine = 0x00U, 1155 kPCA9422_LedControlBySoftware = 0x20U, 1156 } pca9422_led_ovrd_t; 1157 1158 /*! @brief PCA9422 Output voltage configuration lock definition. */ 1159 typedef enum _pca9422_reg_lock 1160 { 1161 kPCA9422_RegLockUnlockKey = 0x5CU, 1162 kPCA9422_RegLockLockKey = 0x00U, 1163 } pca9422_reg_lock_t; 1164 1165 /*! @brief PCA9422 Mode Configuration definition. */ 1166 typedef struct _pca9422_modecfg 1167 { 1168 uint32_t sw1OutVolt; /* uV */ 1169 uint32_t sw2OutVolt; /* uV */ 1170 uint32_t sw3OutVolt; /* uV */ 1171 uint32_t sw4OutVolt; /* uV */ 1172 uint32_t ldo1OutVolt; /* uV */ 1173 uint32_t ldo2OutVolt; /* uV */ 1174 uint32_t ldo3OutVolt; /* uV */ 1175 uint32_t ldo4OutVolt; /* uV */ 1176 } pca9422_modecfg_t; 1177 1178 /*! @brief PCA9422 Enmode Configuration definition */ 1179 typedef struct _pca9422_enmodecfg 1180 { 1181 pca9422_enmode_t sw1OutEnMode; 1182 pca9422_enmode_t sw2OutEnMode; 1183 pca9422_enmode_t sw3OutEnMode; 1184 pca9422_enmode_t sw4OutEnMode; 1185 pca9422_enmode_t ldo1OutEnMode; 1186 pca9422_enmode_t ldo2OutEnMode; 1187 pca9422_enmode_t ldo3OutEnMode; 1188 pca9422_enmode_t ldo4OutEnMode; 1189 } pca9422_enmodecfg_t; 1190 1191 /*! @brief PCA9422 Enable configuration definition */ 1192 typedef struct _pca9422_enablecfg 1193 { 1194 bool enableSw1Out; 1195 bool enableSw2Out; 1196 bool enableSw3Out; 1197 bool enableSw4Out; 1198 bool enableLdo1Out; 1199 bool enableLdo2Out; 1200 bool enableLdo3Out; 1201 bool enableLdo4Out; 1202 } pca9422_enablecfg_t; 1203 1204 /*! @brief PCA9422 Regulator Enable in RUN state definition */ 1205 typedef struct _pca9422_regultoren 1206 { 1207 bool sw1Enable; 1208 bool sw2Enable; 1209 bool sw3Enable; 1210 bool sw4Enable; 1211 bool ldo1Enable; 1212 bool ldo2Enable; 1213 bool ldo3Enable; 1214 bool ldo4Enable; 1215 } pca9422_regulatoren_t; 1216 1217 /*! @brief PCA9422 Handle definition. */ 1218 typedef struct _pca9422_handle 1219 { 1220 /* Pointer to the user-defined I2C Send Data function. */ 1221 status_t (*I2C_SendFunc)( 1222 uint8_t deviceAddress, uint32_t subAddress, uint8_t subAddressSize, const uint8_t *txBuff, uint8_t txBuffSize); 1223 /* Pointer to the user-defined I2C Receive Data function. */ 1224 status_t (*I2C_ReceiveFunc)( 1225 uint8_t deviceAddress, uint32_t subAddress, uint8_t subAddressSize, uint8_t *rxBuff, uint8_t rxBuffSize); 1226 /* The I2C Slave Address Read From OTP. */ 1227 uint8_t slaveAddress; 1228 } pca9422_handle_t; 1229 1230 /*! @brief PCA9422 Configuration Structure definition. */ 1231 /*! @brief PCA9422 Charger Configuration Structure definition. */ 1232 typedef struct _pca9422_charger_config 1233 { 1234 /* Pointer to the user-defined I2C Send Data function. */ 1235 status_t (*I2C_SendFunc)( 1236 uint8_t deviceAddress, uint32_t subAddress, uint8_t subAddressSize, const uint8_t *txBuff, uint8_t txBuffSize); 1237 /* Pointer to the user-defined I2C Receive Data function. */ 1238 status_t (*I2C_ReceiveFunc)( 1239 uint8_t deviceAddress, uint32_t subAddress, uint8_t subAddressSize, uint8_t *rxBuff, uint8_t rxBuffSize); 1240 /* Charge current */ 1241 /* Precharge current */ 1242 pca9422_prechg_i_t prechgI; 1243 /* Charging current step */ 1244 pca9422_chg_i_step_t chgIStep; 1245 /* Top-off current */ 1246 pca9422_topoff_i_t topoffI; 1247 /* Fast Charge current */ 1248 uint16_t fastI; 1249 /* Charging voltage */ 1250 /* VBAT float voltage */ 1251 uint16_t vbatReg; 1252 /* Recharge threshold */ 1253 pca9422_recharge_th_t rechgVolt; 1254 /* Charging timer */ 1255 /* Precharge timer - refer _pca9422_precharge_timer */ 1256 pca9422_precharge_timer_t prechgTime; 1257 /* Fast charge timer - refer _pca9422_fast_chg_timer */ 1258 pca9422_fast_chg_timer_t fastchgTime; 1259 /* Top-off timer */ 1260 pca9422_top_off_timer_t topoffTime; 1261 /* JEITA parameters */ 1262 /* Warm voltage threshold - 45C, refer _pca9422_v_warm */ 1263 pca9422_v_warm_45c_t warmVolt; 1264 /* Warm plus voltage threshold - 50C, refer _pca9422_v_warm */ 1265 pca9422_v_warm_50c_t warmPlusVolt; 1266 /* Hot voltage threshold - 60C */ 1267 pca9422_v_hot_60c_t hotVolt; 1268 /* Cool voltage threshold - 10C */ 1269 pca9422_v_cool_10c_t coolVolt; 1270 /* Cold voltage threshold - 0C */ 1271 pca9422_v_cold_0c_t coldVolt; 1272 /* New regulation voltage - Warm(45C) */ 1273 pca9422_new_vbat_45c_t warmVbatReg; 1274 /* New regulation voltage - Warm plus(50C) */ 1275 pca9422_new_vbat_50c_t warmPlusVbatReg; 1276 /* New Fast charge current - Cold(10C) */ 1277 pca9422_new_i_vbat_10c_t coldIVbat; 1278 /* New Fast charge current - Warm(45C) */ 1279 pca9422_new_i_vbat_45c_t warmIVbat; 1280 /* New Fast charge current - Warm plus(50C) */ 1281 pca9422_new_i_vbat_50c_t warmPlusIVbat; 1282 /* AICL threshold */ 1283 pca9422_aicl_v_t aiclV; 1284 /* Input current limit */ 1285 pca9422_chgin_ilim_t icl; 1286 /* VSYS regulation voltage */ 1287 uint16_t vsysReg; 1288 /* AMUX wait time */ 1289 pca9422_amux_auto_off_wait_t amuxWaitTime; 1290 /* AMUX mode */ 1291 pca9422_amux_mode_t amuxMode; 1292 /* VBAT/VSYS channel scale factor */ 1293 pca9422_amux_vbat_vsys_gain_t amuxVbatGain; 1294 /* THERM and THERM_BIAS channels scale factor */ 1295 pca9422_amux_therm_gain_t amuxThermGain; 1296 /* AMUX channel */ 1297 pca9422_amux_channel_t amuxChannel; 1298 /* The PCA9422 I2C Slave Address. */ 1299 uint8_t slaveAddress; 1300 } pca9422_charger_config_t; 1301 1302 /*! @brief PCA9422 Regulator Configuration Structure definition. */ 1303 /*! @brief PCA9422 Buck Configuration Structure definition. */ 1304 typedef struct _pca9422_buck_config 1305 { 1306 uint8_t dvsUpStep; 1307 uint8_t dvsDnStep; 1308 uint8_t dvsCtrl; 1309 pca9422_bx_ramp_t rampSpeed; 1310 pca9422_bx_lpmode_t lpMode; 1311 pca9422_bx_ad_t activeDischg; 1312 pca9422_bx_fpwm_mode_t fpwmEn; 1313 pca9422_enmode_t enMode; 1314 uint32_t dvsVout[8]; 1315 uint32_t stbyVout; 1316 uint32_t maxVout; 1317 uint32_t sleepVout; 1318 } pca9422_buck_config_t; 1319 1320 /*! @brief PCA9422 LDO2/3/4 Configuration Structure definition. */ 1321 typedef struct _pca9422_ldo234_config 1322 { 1323 pca9422_ldo23_csel_t cSel; 1324 pca9422_ldo23_llsel_t llSel; 1325 pca9422_ldo23_lpmode_t lpMode; 1326 pca9422_enmode_t enMode; 1327 pca9422_ldo23_mode_t ldoMode; 1328 bool activeDischg; 1329 uint32_t vout; 1330 uint32_t stbyVout; 1331 uint32_t sleepVout; 1332 } pca9422_ldo234_config_t; 1333 1334 /*! @brief PCA9422 LDO1 Configuration Structure definition. */ 1335 typedef struct _pca9422_ldo1_config 1336 { 1337 bool activeDischg; 1338 bool enMode; 1339 uint32_t vout; 1340 } pca9422_ldo1_config_t; 1341 1342 /*! @brief PCA9422 Buck-Boost Configuration Structure definition. */ 1343 typedef struct _pca9422_bb_config 1344 { 1345 pca9422_bb_fpwm_mode_t fpwmEn; 1346 pca9422_bb_fault_oc_ctrl_t ocCtrl; 1347 pca9422_bb_soft_stdn_t softStdn; 1348 pca9422_bb_dis_t passiveDis; 1349 pca9422_bb_enable_in_run_t enInRun; 1350 pca9422_bb_mode_t bbMode; 1351 pca9422_bb_enmode_t enMode; 1352 pca9422_bb_lpmode_t lpMode; 1353 uint32_t vout; 1354 uint32_t stdyVout; 1355 uint32_t maxVout; 1356 uint32_t minVout; 1357 uint32_t sleepVout; 1358 } pca9422_bb_config_t; 1359 1360 typedef struct _pca9422_regulator_config 1361 { 1362 /* Pointer to the user-defined I2C Send Data function. */ 1363 status_t (*I2C_SendFunc)( 1364 uint8_t deviceAddress, uint32_t subAddress, uint8_t subAddressSize, const uint8_t *txBuff, uint8_t txBuffSize); 1365 /* Pointer to the user-defined I2C Receive Data function. */ 1366 status_t (*I2C_ReceiveFunc)( 1367 uint8_t deviceAddress, uint32_t subAddress, uint8_t subAddressSize, uint8_t *rxBuff, uint8_t rxBuffSize); 1368 /* Standby Control */ 1369 pca9422_standby_ctrl_t standbyCtrl; 1370 /* Standby configuration bit */ 1371 pca9422_standby_cfg_t standbyCfg; 1372 /* DVS_CTRL2 pin enable bit */ 1373 pca9422_dvs_ctrl2_en_t dvsCtrl2En; 1374 /* VSYS UVLO threshold */ 1375 pca9422_vsys_uvlo_sel_t vsysUvlo; 1376 /* DVS smart mode */ 1377 pca9422_smart_mode_t smartMode; 1378 /* Buck1/2/3 configuration */ 1379 pca9422_buck_config_t buck[3]; 1380 /* LDO2/3/4 configuration */ 1381 pca9422_ldo234_config_t ldo[3]; 1382 /* LDO1 configuration */ 1383 pca9422_ldo1_config_t ldo1; 1384 /* Buck-Boost configuration */ 1385 pca9422_bb_config_t buckBoost; 1386 /* The PCA9422 I2C Slave Address. */ 1387 uint8_t slaveAddress; 1388 } pca9422_regulator_config_t; 1389 1390 /*! 1391 * @addtogroup pca9422 1392 * @{ 1393 */ 1394 1395 /******************************************************************************* 1396 * API 1397 ******************************************************************************/ 1398 #if defined(__cplusplus) 1399 extern "C" { 1400 #endif 1401 1402 /*! 1403 * @name Initialization and Control function 1404 * @{ 1405 */ 1406 1407 /*! 1408 * @brief Gets the default configuration structure for charger. 1409 * 1410 * This function initializes the PCA9422 charger configuration structure to default values. The default 1411 * values are as follows. 1412 1413 * config->I2C_SendFunc = NULL; 1414 * config->I2C_ReceiveFunc = NULL; 1415 * config->prechgI = kPCA9422_PrechgI20percent; 1416 * config->chgIStep = kPCA9422_ChgIStep2p5mA; 1417 * config->topoffI = kPCA9422_TopoffI2p5percent; 1418 * config->fastI = 100U; 1419 * config->vbatReg = 4200U; 1420 * config->rechgVolt = kPCA9422_RechargeTh100mV; 1421 * config->prechgTime = kPCA9422_PrechgTimer30min; 1422 * config->fastchgTime = kPCA9422_FastchgTimer3h; 1423 * config->topoffTime = kPCA9422_TopoffTimer5min; 1424 * config->warmVolt = kPCA9422_Vwarm45C32p63percent; 1425 * config->warmPlusVolt = kPCA9422_Vwarm50C29p07percent; 1426 * config->hotVolt = kPCA9422_Vhot60C22p94percent; 1427 * config->coolVolt = kPCA9422_Vcool10C64p82percent; 1428 * config->coldVolt = kPCA9422_Vcold0C74p18percent; 1429 * config->warmVbatReg = kPCA9422_NewVbat45C_StayVbatReg; 1430 * config->warmPlusVbatReg = kPCA9422_NewVbat50C_StayVbatReg; 1431 * config->coldIVbat = kPCA9422_NewIVbat10C_StayIFastchg; 1432 * config->warmIVbat = kPCA9422_NewIVbat45C_StayIFastchg; 1433 * config->warmPlusIVbat = kPCA9422_NewIVbat50C_StayIFastchg; 1434 * config->aiclV = kPCA9422_AICLV4p5V; 1435 * config->icl = kPCA9422_ChgInIlim_470mA; 1436 * config->vsysReg = 4550U; 1437 * config->amuxWaitTime = kPCA9422_AMUXAutoOffWait_256us; 1438 * config->amuxMode = kPCA9422_AMUXModeManual; 1439 * config->amuxVbatGain = kPCA9422_AMUXVbatVsysGain_1dvd3; 1440 * config->amuxThermGain = kPCA9422_AMUXThermGain_1; 1441 * config->amuxChannel = kPCA9422_AMUXChannel_Off; 1442 * config->slaveAddress = PCA9422_DEFAULT_I2C_ADDR; 1443 * 1444 * @param config Pointer to the PCA9422 configuration structure for charger. 1445 */ 1446 void PCA9422_GetChargerDefaultConfig(pca9422_charger_config_t *config); 1447 1448 /*! 1449 * @brief Initializes a PCA9422 charger instance. 1450 * 1451 * This function initializes the PCA9422 battery charger with user-defined settings. 1452 * This example shows how to set up the pca9422_config_t parameters and how 1453 * to call the PCA9422_Init function by passing in these parameters. 1454 * @code 1455 * pca9422_config_t pca9422Config; 1456 * PCA9422_GetDefaultConfig(&pca9422Config); 1457 * pca9422Config.I2C_SendFunc = APP_I2C_SendFunc; 1458 * pca9422Config.I2C_ReceiveFunc = APP_I2C_ReceiveFunc; 1459 * PCA9422_Init(&pca9422Handle, &pca9422Config); 1460 * @endcode 1461 * 1462 * @param handle PCA9422 Handle. 1463 * @param config Pointer to the user-defined configuration structure. 1464 */ 1465 void PCA9422_InitCharger(pca9422_handle_t *handle, const pca9422_charger_config_t *config); 1466 /* @} */ 1467 1468 /*! 1469 * @brief Set Precharge Current of PCA9422. 1470 * 1471 * @param handle PCA9422 Handle. 1472 * @param iPrechg Precharge current(register value). 1473 * @return true if success or false if error. 1474 */ 1475 bool PCA9422_SetPreChargeCurrent(pca9422_handle_t *handle, uint8_t iPrechg); 1476 1477 /*! 1478 * @brief Get Precharge Current of PCA9422. 1479 * 1480 * @param handle PCA9422 Handle. 1481 * @return Precharge current(register value). 1482 */ 1483 uint8_t PCA9422_GetPreChargeCurrent(pca9422_handle_t *handle); 1484 1485 /*! 1486 * @brief Get Topoff Current of PCA9422. 1487 * 1488 * @param handle PCA9422 Handle. 1489 * @return Topoff current(register value). 1490 */ 1491 uint8_t PCA9422_GetTopoffCurrent(pca9422_handle_t *handle); 1492 1493 /*! 1494 * @brief Set Topoff Current of PCA9422. 1495 * 1496 * @param handle PCA9422 Handle. 1497 * @param iTopoff Topoff current(register value). 1498 * @return true if success or false if error. 1499 */ 1500 bool PCA9422_SetTopoffCurrent(pca9422_handle_t *handle, uint8_t iTopoff); 1501 1502 /*! 1503 * @brief Set Fast Charge Current of PCA9422. 1504 * 1505 * @param handle PCA9422 Handle. 1506 * @param iFast Fast charge current(mA*10). 1507 * @return true if success or false if error. 1508 */ 1509 bool PCA9422_SetFastChargeCurrent(pca9422_handle_t *handle, uint16_t iFast); 1510 1511 /*! 1512 * @brief Get Fast Charge Current of PCA9422. 1513 * 1514 * @param handle PCA9422 Handle. 1515 * @return current Fast charge current(mA*10). 1516 */ 1517 uint16_t PCA9422_GetFastChargeCurrent(pca9422_handle_t *handle); 1518 1519 /*! 1520 * @brief Get Charge Current of PCA9422. 1521 * 1522 * @param handle PCA9422 Handle. 1523 * @return current charge current(mA). 1524 */ 1525 uint16_t PCA9422_GetChargeCurrent(pca9422_handle_t *handle); 1526 /*! 1527 * @brief Get VBAT regulation voltage of PCA9422. 1528 * 1529 * @param handle PCA9422 Handle. 1530 * @return vFloat VBAT floating(regulation) voltage(mV). 1531 */ 1532 uint16_t PCA9422_GetVBATRegulation(pca9422_handle_t *handle); 1533 1534 /*! 1535 * @brief Set VBAT regulation voltage of PCA9422. 1536 * 1537 * @param handle PCA9422 Handle. 1538 * @param vFloat VBAT floating(regulation) voltage(mV). 1539 * @return true if success or false if error. 1540 */ 1541 bool PCA9422_SetVBATRegulation(pca9422_handle_t *handle, uint16_t vFloat); 1542 1543 /*! 1544 * @brief Set recharge threshold voltage of PCA9422. 1545 * 1546 * @param handle PCA9422 Handle. 1547 * @param rechgTh Recharge threshold(register value). 1548 * @return true if success or false if error. 1549 */ 1550 bool PCA9422_SetRechargeThreshold(pca9422_handle_t *handle, uint8_t rechgTh); 1551 1552 /*! 1553 * @brief Set precharge timer of PCA9422. 1554 * 1555 * @param handle PCA9422 Handle. 1556 * @param tPrechg Precharge Timer(register value). 1557 * @return true if success or false if error. 1558 */ 1559 bool PCA9422_SetPrechargeTimer(pca9422_handle_t *handle, uint8_t tPrechg); 1560 1561 /*! 1562 * @brief Set fast charge timer of PCA9422. 1563 * 1564 * @param handle PCA9422 Handle. 1565 * @param tFastchg Fast charge Timer(register value). 1566 * @return true if success or false if error. 1567 */ 1568 bool PCA9422_SetFastchargeTimer(pca9422_handle_t *handle, uint8_t tFastchg); 1569 1570 /*! 1571 * @brief Set topoff timer of PCA9422. 1572 * 1573 * @param handle PCA9422 Handle. 1574 * @param tTopoff Topoff Timer(register value). 1575 * @return true if success or false if error. 1576 */ 1577 bool PCA9422_SetTopoffTimer(pca9422_handle_t *handle, uint8_t tTopoff); 1578 1579 /*! 1580 * @brief Get Charge State of PCA9422. 1581 * 1582 * @param handle PCA9422 Handle. 1583 * @return charge state. 1584 * 0 - No charge 1585 * 0x01 - Charging On (Fast Charge or Prehcarge state) 1586 * 0x02 - Constant Voltage or Topoff state 1587 * 0x04 - Charge Done state 1588 */ 1589 uint8_t PCA9422_GetChargeState(pca9422_handle_t *handle); 1590 1591 /*! 1592 * @brief Select AMUX channel of PCA9422. 1593 * 1594 * @param handle PCA9422 Handle. 1595 * @param amuxCh AMUX channel. 1596 */ 1597 void PCA9422_SelectAMUXChannel(pca9422_handle_t *handle, pca9422_amux_channel_t amuxCh); 1598 1599 /*! 1600 * @brief Set AMUX mode of PCA9422. 1601 * 1602 * @param handle PCA9422 Handle. 1603 * @param mode AMUX mode. 1604 */ 1605 void PCA9422_SetAMUXMode(pca9422_handle_t *handle, pca9422_amux_mode_t mode); 1606 1607 /*! 1608 * @brief Get AMUX mode of PCA9422. 1609 * 1610 * @param handle PCA9422 Handle. 1611 * @return AMUX mode if success or 0xFF if error. 1612 */ 1613 pca9422_amux_mode_t PCA9422_GetAMUXMode(pca9422_handle_t *handle); 1614 1615 /*! 1616 * @brief Set AMUX configuration of PCA9422. 1617 * 1618 * @param handle PCA9422 Handle. 1619 * @param config AMUX configuration. 1620 * @return true if success or false if error. 1621 */ 1622 bool PCA9422_SetAMUXConfig(pca9422_handle_t *handle, pca9422_amux_config_t config); 1623 1624 /*! 1625 * @brief Get AMUX scale factor for each channel of PCAA9422. 1626 * 1627 * @param handle PCA9422 Handle. 1628 * @param channel AMUX channel. 1629 * @return scalefactor Scale factor for the channel. 1630 */ 1631 float PCA9422_GetAMUXScaleFactor(pca9422_handle_t *handle, pca9422_amux_channel_t channel); 1632 1633 /*! 1634 * @brief Set Enable or Disable charge of PCA9422. 1635 * 1636 * @param handle PCA9422 Handle. 1637 * @param enable if enable is 1 and disable is 0. 1638 * @return true if success or false if error. 1639 */ 1640 bool PCA9422_SetEnableCharge(pca9422_handle_t *handle, bool enable); 1641 1642 /*! 1643 * @brief Set Enable or Disable USB suspend Mode of PCA9422. 1644 * 1645 * @param handle PCA9422 Handle. 1646 * @param enable if enable is 1 and disable is 0. 1647 * @return true if success or false if error. 1648 */ 1649 bool PCA9422_SetUSBSuspendMode(pca9422_handle_t *handle, bool enable); 1650 1651 /*! 1652 * @name Initialization and Control function for regulators 1653 * @{ 1654 */ 1655 /*! 1656 * @brief Gets the default configuration structure for regulators. 1657 * 1658 * This function initializes the PCA9422 regulator configuration structure to default values. The default 1659 * values are as follows. 1660 * 1661 * pca9422RegConfig->I2C_SendFunc = NULL; 1662 * pca9422RegConfig->I2C_ReceiveFunc = NULL; 1663 * pca9422RegConfig->standbyCtrl = kPCA9422_StandbyCtrlPins; 1664 * pca9422RegConfig->standbyCfg = kPCA9422_StandbyCfgStandby; 1665 * pca9422RegConfig->dvsCtrl2En = kPCA9422_DVSCtrl2EnIgnore; 1666 * pca9422RegConfig->vsysUvlo = kPCA9422_VsysUvloSel2p7V; 1667 * pca9422RegConfig->smartMode = kPCA9422_SmartModeDisabled; 1668 * pca9422RegConfig->buck = *buck; 1669 * pca9422RegConfig->ldo = *ldo; 1670 * pca9422RegConfig->ldo1 = ldo1; 1671 * pca9422RegConfig->buckBoost = buckBoost; 1672 * pca9422RegConfig->slaveAddress = PCA9422_DEFAULT_I2C_ADDR; 1673 * 1674 * @param RegConfig Pointer to the PCA9422 configuration structure for regulator. 1675 */ 1676 void PCA9422_GetRegulatorDefaultConfig(pca9422_regulator_config_t *RegConfig); 1677 1678 /*! 1679 * @brief Initializes a PCA9422 instance. 1680 * 1681 * This function initializes the PCA9422 regulator with user-defined settings. 1682 * This example shows how to set up the pca9422_regulator_config_t parameters and 1683 * how to call the PCA9422_RegInit function by passing in these parameters. 1684 * @code 1685 * pca9422_regulator_config_t pca9422RegConfig; 1686 * PCA9422_GetRegDefaultConfig(&pca9422RegConfig); 1687 * pca9422RegConfig.I2C_SendFunc = APP_I2C_SendFunc; 1688 * pca9422RegConfig.I2C_ReceiveFunc = APP_I2C_ReceiveFunc; 1689 * PCA9422_RegInit(&pca9422Handle, &pca9422RegConfig); 1690 * @endcode 1691 * 1692 * @param handle PCA9422 Handle. 1693 * @param config Pointer to the user-defined configuration structure for regulator. 1694 */ 1695 void PCA9422_InitRegulator(pca9422_handle_t *handle, const pca9422_regulator_config_t *config); 1696 1697 /*! 1698 * @brief Gets the default mode configuration structure. 1699 * 1700 * This function initializes the PCA9422 mode configuration structure to default values. 1701 * The default values are as follows. 1702 * 1703 * config->sw1OutVolt = 1000000; 1704 * config->sw2OutVolt = 1100000; 1705 * config->sw3OutVolt = 1000000; 1706 * config->sw4OutVolt = 1800000; 1707 * config->ldo1OutVolt = 1800000; 1708 * config->ldo2OutVolt = 1800000; 1709 * config->ldo3OutVolt = 1200000; 1710 * config->ldo4OutVolt = 3300000; 1711 * 1712 * @param config Pointer to the PCA9422 mode configuration structure. 1713 */ 1714 void PCA9422_GetDefaultPowerModeConfig(pca9422_modecfg_t *config); 1715 1716 /*! 1717 * @brief Gets the default enmode configuration structure. 1718 * 1719 * This function initializes the PCA9422 enmode configuration structure to default values. 1720 * The default values are as follows. 1721 * 1722 * enModeCfg->sw1OutEnMode = kPCA9422_EnmodeOnAll; 1723 * enModeCfg->sw2OutEnMode = kPCA9422_EnmodeOnAll; 1724 * enModeCfg->sw3OutEnMode = kPCA9422_EnmodeOnAll; 1725 * enModeCfg->sw4OutEnMode = kPCA9422_EnmodeOnAll; 1726 * enModeCfg->ldo1OutEnMode = kPCA9422_EnmodeOnAll; 1727 * enModeCfg->ldo2OutEnMode = kPCA9422_EnmodeOnAll; 1728 * enModeCfg->ldo3OutEnMode = kPCA9422_EnmodeOnAll; 1729 * enModeCfg->ldo4OutEnMode = kPCA9422_EnmodeOnAll; 1730 * 1731 * @param enModeCfg Pointer to the PCA9422 enmode configuration structure. 1732 */ 1733 void PCA9422_GetDefaultEnModeConfig(pca9422_enmodecfg_t *enModeCfg); 1734 1735 /*! 1736 * @brief Gets the default regulator enable configuration structure in RUN state. 1737 * 1738 * This function initializes the PCA9422 regulator enable configuration structure in RUN state to default values. 1739 * The default values are as follows. 1740 * 1741 * regEnCfg->sw1Enable = true; 1742 * regEnCfg->sw2Enable = true; 1743 * regEnCfg->sw3Enable = true; 1744 * regEnCfg->sw4Enable = true; 1745 * regEnCfg->ldo1Enable = true; 1746 * regEnCfg->ldo2Enable = true; 1747 * regEnCfg->ldo3Enable = true; 1748 * regEnCfg->ldo4Enable = true; 1749 * 1750 * @param regEnCfg Pointer to the PCA9422 regulator enable configuration structure in RUN state. 1751 */ 1752 void PCA9422_GetDefaultRegEnableConfig(pca9422_regulatoren_t *regEnCfg); 1753 1754 /*! 1755 * @brief Gets the default buck config structure. 1756 * 1757 * This function initializes the PCA9422 buck config structure to default values. The default 1758 * values are as follows. 1759 * 1760 * buckCfg->dvs_up_step = 0; 1761 * buckCfg->dvs_dn_step = 0; 1762 * buckCfg->dvs_ctrl = kPCA9422_Bx_dvs_ctrl_i2c_in_active_sleep; 1763 * buckCfg->ramp_speed = kPCA9422_Bx_ramp_25mVp2us; 1764 * buckCfg->lpmode = kPCA9422_Bx_lpmode_normal; 1765 * buckCfg->active_dischg = kPCA9422_Bx_enable_ad; 1766 * buckCfg->fpwm_en = kPCA9422_Bx_fpwm_auto; 1767 * buckCfg->enmode = kPCA9422_Reg_Enmode_on_all; 1768 * buckCfg->dvs_vout[8] = *dvs; 1769 * buckCfg->stby_vout = bx_standby_vout; 1770 * buckCfg->max_vout = bx_max_vout; 1771 * buckCfg->sleep_vout = bx_sleep_vout; 1772 * 1773 * @param buckCfg Pointer to the PCA9422 buck configuration structure. 1774 */ 1775 void PCA9422_GetDefaultBuckConfig(pca9422_buck_config_t *buckCfg); 1776 1777 /*! 1778 * @brief Gets the default LDO2/3/4 config structure. 1779 * 1780 * This function initializes the PCA9422 LDO2/3/4 config structure to default values. The default 1781 * values are as follows. 1782 * 1783 * ldoCfg->csel = kPCA9422_LDO23_csel_auto_cout_detection; 1784 * ldoCfg->llsel = kPCA9422_LDO23_llsel_15mOhm; 1785 * ldoCfg->lpmode = kPCA9422_LDO23_lpmode_normal; 1786 * ldoCfg->ldo_mode = kPCA9422_LDO23_mode_ldo; 1787 * ldoCfg->active_dischg = true; 1788 * ldoCfg->vout = ldox_vout; 1789 * ldoCfg->stby_vout = ldox_stdy_vout; 1790 * ldoCfg->sleep_vout = ldox_sleep_vout; 1791 * 1792 * @param ldoCfg Pointer to the PCA9422 ldo234 configuration structure. 1793 */ 1794 void PCA9422_GetDefaultLDO234Config(pca9422_ldo234_config_t *ldoCfg); 1795 1796 /*! 1797 * @brief Gets the default LDO1 config structure. 1798 * 1799 * This function initializes the PCA9422 LDO1 config structure to default values. The default 1800 * values are as follows. 1801 1802 bool active_dischg; 1803 bool enmode; 1804 uint32_t vout; 1805 * 1806 * ldo1Cfg->active_dischg = true; 1807 * ldo1Cfg->enmode = true; 1808 * ldo1Cfg->vout = 1800000; 1809 * 1810 * @param ldo1Cfg Pointer to the PCA9422 LDO1 configuration structure. 1811 */ 1812 void PCA9422_GetDefaultLDO1Config(pca9422_ldo1_config_t *ldo1Cfg); 1813 1814 /*! 1815 * @brief Gets the default buck-boost config structure. 1816 * 1817 * This function initializes the PCA9422 buck-boost config structure to default values. The default 1818 * values are as follows. 1819 * 1820 * bbCfg->fpwm_en = kPCA9422_BB_fpwm_auto; 1821 * bbCfg->oc_ctrl = kPCA9422_BB_fault_oc_ctrl_not_turn_off; 1822 * bbCfg->soft_stdn = kPCA9422_BB_soft_stdn_disabled; 1823 * bbCfg->passive_dis = kPCA9422_BB_dis_enabled; 1824 * bbCfg->en_in_run = kPCA9422_BB_enable_in_run_on; 1825 * bbCfg->bb_mode = kPCA9422_BB_mode_auto; 1826 * bbCfg->enmode = kPCA9422_BB_enmode_on_all; 1827 * bbCfg->lpmode = kPCA9422_BB_lpmode_normal; 1828 * bbCfg->vout = 5000000; 1829 * bbCfg->stby_vout = 5000000; 1830 * bbCfg->max_vout = 5000000; 1831 * bbCfg->min_vout = 4500000; 1832 * bbCfg->sleep_vout = 5000000; 1833 * 1834 * @param bbCfg Pointer to the PCA9422 buck-boost configuration structure. 1835 */ 1836 void PCA9422_GetDefaultBBConfig(pca9422_bb_config_t *bbCfg); 1837 1838 /*! 1839 * @brief Gets the current regulator enable mode. 1840 * 1841 * This function gets the current regulator enable mode of PCA9422. 1842 * 1843 * @param handle PCA9422 Handle. 1844 * @param reg Regulator of PCA9422. 1845 * @param enmode Enable mode of regulator. 1846 */ 1847 void PCA9422_GetRegulatorEnMode(pca9422_handle_t *handle, pca9422_regulator_t reg, pca9422_enmode_t *enmode); 1848 1849 /*! 1850 * @brief Sets the current regulator enable mode. 1851 * 1852 * This function sets the current regulator enable mode of PCA9422. 1853 * 1854 * @param handle PCA9422 Handle. 1855 * @param reg Regulator of PCA9422. 1856 * @param enmode Enable mode of regulator. 1857 */ 1858 void PCA9422_SetRegulatorEnMode(pca9422_handle_t *handle, pca9422_regulator_t reg, pca9422_enmode_t enmode); 1859 1860 /*! 1861 * @brief Get LDO1 enable mode. 1862 * 1863 * This function get LDO1 enable mode of PCA9422. 1864 * 1865 * @param handle PCA9422 Handle. 1866 * @param enmode Enable mode of regulator. 1867 */ 1868 void PCA9422_GetLDO1EnMode(pca9422_handle_t *handle, bool *enmode); 1869 1870 /*! 1871 * @brief Sets LDO1 enable mode. 1872 * 1873 * This function sets LDO1 enable mode of PCA9422. 1874 * 1875 * @param handle PCA9422 Handle. 1876 * @param enmode Enable mode of regulator. 1877 */ 1878 void PCA9422_SetLDO1EnMode(pca9422_handle_t *handle, bool enmode); 1879 1880 /*! 1881 * @brief Gets the current regulator power mode. 1882 * 1883 * This function gets the current regulator power mode of PCA9422. 1884 * 1885 * @param handle PCA9422 Handle. 1886 * @param reg Regulator of PCA9422. 1887 * @param lpmode Power mode of regulator. 1888 */ 1889 void PCA9422_GetRegulatorLPMode(pca9422_handle_t *handle, pca9422_regulator_t reg, pca9422_reg_lpmode_t *lpmode); 1890 1891 /*! 1892 * @brief Sets the current regulator power mode. 1893 * 1894 * This function sets the current regulator power mode of PCA9422. 1895 * 1896 * @param handle PCA9422 Handle. 1897 * @param reg Regulator of PCA9422. 1898 * @param lpmode Power mode of regulator. 1899 */ 1900 void PCA9422_SetRegulatorLPMode(pca9422_handle_t *handle, pca9422_regulator_t reg, pca9422_reg_lpmode_t lpmode); 1901 1902 /*! 1903 * @brief Sets voltage value in uV for vout mode. 1904 * 1905 * @param handle PCA9422 Handle. 1906 * @param reg Regulator of PCA9422. 1907 * @param vout Vout type of PCA9422. 1908 * @param volt Regulator voltage in uV of PCA9422. 1909 */ 1910 void PCA9422_SetRegulatorVoltage(pca9422_handle_t *handle, pca9422_regulator_t reg, pca9422_vout_t vout, uint32_t volt); 1911 1912 /*! 1913 * @brief Gets voltage value in uV for vout mode. 1914 * 1915 * @param handle PCA9422 Handle. 1916 * @param reg Regulator of PCA9422. 1917 * @param vout Vout type of PCA9422. 1918 * @param volt Regulator voltage in uV of PCA9422. 1919 */ 1920 void PCA9422_GetRegulatorVoltage(pca9422_handle_t *handle, 1921 pca9422_regulator_t reg, 1922 pca9422_vout_t vout, 1923 uint32_t *volt); 1924 1925 /*! 1926 * @brief Get PCA9422 SW1, SW2, SW3, SW4, LDO1, LDO2, LDO3, LDO4 OK status. 1927 * 1928 * This function return the PCA9422 regulators status. 1929 * 1930 * @param handle PCA9422 Handle. 1931 * @return ORed regulator status. see @ref pca9422_reg_status_t for regulator status definition. 1932 */ 1933 uint8_t PCA9422_GetRegulatorStatus(pca9422_handle_t *handle); 1934 1935 /*! 1936 * @brief Switch PCA9422 power mode. 1937 * 1938 * This function switch the PCA9422 regulators power mode with pin control. 1939 * 1940 * @param handle PCA9422 Handle. 1941 * @param mode Target power mode to go into. 1942 */ 1943 void PCA9422_SwitchPowerMode(pca9422_handle_t *handle, pca9422_power_mode_t mode); 1944 1945 /*! 1946 * @brief Get PCA9422 current power mode. 1947 * 1948 * This function returns the PCA9422 current power mode. 1949 * 1950 * @param handle PCA9422 Handle. 1951 * @param mode Current power mode. 1952 * @return true on success, false on failure. 1953 */ 1954 bool PCA9422_GetCurrentPowerMode(pca9422_handle_t *handle, pca9422_power_mode_t *mode); 1955 1956 /*! 1957 * @brief Get PCA9422 current EN mode. 1958 * 1959 * This function returns the PCA9422 current Enmode. 1960 * 1961 * @param handle PCA9422 Handle. 1962 * @param config Current Enmode configuration. 1963 */ 1964 void PCA9422_GetCurrentEnMode(pca9422_handle_t *handle, pca9422_enmodecfg_t *config); 1965 1966 /*! 1967 * @brief Get PCA9422 standby mode control. 1968 * 1969 * This function returns the PCA9422 standby mode control method. 1970 * 1971 * @param handle PCA9422 Handle. 1972 * @param ctrl Standby mode control. 1973 * @return true on success, false on failure. 1974 */ 1975 bool PCA9422_GetStandbyControl(pca9422_handle_t *handle, pca9422_standby_ctrl_t *ctrl); 1976 1977 /*! 1978 * @brief Sets Buck DVS control. 1979 * 1980 * @param handle PCA9422 Handle. 1981 * @param reg Buck Regulator 1982 * @param dvsCtrl Buck DVS control method. 1983 */ 1984 void PCA9422_SetBuckDVSControl(pca9422_handle_t *handle, pca9422_regulator_t reg, uint8_t dvsCtrl); 1985 1986 /*! 1987 * @brief Enable PCA9422 Regulator in Run state. 1988 * 1989 * @param handle PCA9422 Handle. 1990 * @param reg Regulator of PCA9422. 1991 * @param enable true is enable, false is disabled. 1992 */ 1993 void PCA9422_SetEnableRegulatorRunState(pca9422_handle_t *handle, pca9422_regulator_t reg, bool enable); 1994 1995 /*! 1996 * @brief Get Enable PCA9422 Regulator status in Run state. 1997 * 1998 * @param handle PCA9422 Handle. 1999 * @param reg Regulator of PCA9422. 2000 * @param enable true is enable, false is disabled. 2001 */ 2002 void PCA9422_GetEnableRegulatorRunState(pca9422_handle_t *handle, pca9422_regulator_t reg, bool *enable); 2003 2004 /*! 2005 * @brief Read PCA9422 power mode configurations for specific modes. 2006 * 2007 * This function read the PCA9422 mode configurations for specific modes with 2008 * user-defined settings. 2009 * 2010 * @param handle PCA9422 Handle. 2011 * @param powerMode Target mode to read. 2012 * @param configs Pointer to the configuration to save read information. 2013 */ 2014 void PCA9422_ReadPowerModeConfigs(pca9422_handle_t *handle, pca9422_power_mode_t powerMode, pca9422_modecfg_t *configs); 2015 2016 /*! 2017 * @brief Write PCA9422 power mode configurations for specific modes. 2018 * 2019 * This function write the PCA9422 mode configurations for specific modes with 2020 * user-defined settings. 2021 * 2022 * @param handle PCA9422 Handle. 2023 * @param powerMode Target mode to write. 2024 * @param configs Pointer to the configuration to save read information. 2025 */ 2026 void PCA9422_WritePowerModeConfigs(pca9422_handle_t *handle, pca9422_power_mode_t powerMode, pca9422_modecfg_t configs); 2027 2028 /*! 2029 * @brief Write PCA9422 enmode configurations for specific modes. 2030 * 2031 * This function write the PCA9422 enmode configurations for specific modes with 2032 * user-defined settings. 2033 * 2034 * @param handle PCA9422 Handle. 2035 * @param config Pointer to the configuration to save read information. 2036 */ 2037 void PCA9422_WriteEnModeConfig(pca9422_handle_t *handle, pca9422_enmodecfg_t config); 2038 2039 /*! 2040 * @brief Write PCA9422 Regulator enable configurations for run state. 2041 * 2042 * This function write the PCA9422 Regulator enable configurations for run state with 2043 * user-defined settings. 2044 * 2045 * @param handle PCA9422 Handle. 2046 * @param config Pointer to the configuration to save read information. 2047 */ 2048 void PCA9422_WriteRegEnableConfig(pca9422_handle_t *handle, pca9422_regulatoren_t config); 2049 2050 /*! 2051 * @brief Read PCA9422 regulator enable status for specific modes. 2052 * 2053 * This function read the PCA9422 enable status configurations for specific modes with 2054 * user-defined settings. 2055 * 2056 * @param handle PCA9422 Handle. 2057 * @param powerMode Target mode to read. 2058 * @param configs Pointer to the enable configuration to save read information. 2059 */ 2060 void PCA9422_ReadEnableConfigs(pca9422_handle_t *handle, pca9422_power_mode_t powerMode, pca9422_enablecfg_t *config); 2061 2062 /*! 2063 * @brief Feed PCA9422 watchdog. 2064 * 2065 * This function feed the PCA9422 watch dog. 2066 * 2067 * @param handle PCA9422 Handle. 2068 */ 2069 void PCA9422_FeedWatchDog(pca9422_handle_t *handle); 2070 2071 /*! 2072 * @brief Set PCA9422 watchdog timer. 2073 * 2074 * This function set PCA9422 watch dog timer. 2075 * 2076 * @param handle PCA9422 Handle. 2077 * @param wd_timer PCA9422 Watchdog timer. 2078 */ 2079 void PCA9422_SetWatchDogTimer(pca9422_handle_t *handle, pca9422_wd_timer_t wd_timer); 2080 /* @} */ 2081 2082 /*! 2083 * @name Basic register access functions 2084 * @{ 2085 */ 2086 2087 /*! 2088 * @brief Write the value to register array of PCA9422. 2089 * 2090 * @param handle Pointer to a valid PCA9422 instance structure. 2091 * @param regBase variable store base address of register array. 2092 * @param val variable array to be written to PCA9422. 2093 * @param size array length in bytes to write. 2094 * @return true if success or false if error. 2095 */ 2096 bool PCA9422_WriteRegs(pca9422_handle_t *handle, uint8_t regBase, uint8_t *val, uint32_t size); 2097 2098 /*! 2099 * @brief Read the value of register array in PCA9422. 2100 * 2101 * @param handle Pointer to a valid PCA9422 instance structure. 2102 * @param regBase variable store address of register array. 2103 * @param val variable array to store return value. 2104 * @param size array length in bytes to read. 2105 * @return true if success or false if error. 2106 */ 2107 bool PCA9422_ReadRegs(pca9422_handle_t *handle, uint8_t regBase, uint8_t *val, uint32_t size); 2108 2109 /*! 2110 * @brief Modify some bits in the register in PCA9422. 2111 * @param handle Pointer to a valid PCA9422 instance structure. 2112 * @param reg variable store address of register. 2113 * @param mask The mask code for the bits want to write. The bit you want to write should be 1. 2114 * @param val Value needs to write into the register. 2115 * @return true if success or false if error. 2116 */ 2117 bool PCA9422_ModifyReg(pca9422_handle_t *handle, uint8_t reg, uint8_t mask, uint8_t val); 2118 2119 /*! 2120 * @brief Write the value to register in PCA9422 and read register to confirm it. 2121 * 2122 * @param handle Pointer to a valid PCA9422 instance structure. 2123 * @param regBase variable store base address of register array. 2124 * @param val value to be written to PCA9422. 2125 * @return true if success or false if error. 2126 */ 2127 bool PCA9422_WriteRegsReadback(pca9422_handle_t *handle, uint8_t regBase, uint8_t *val); 2128 2129 /*! 2130 * @brief Modify some bits in the register in PCA9422 and read register to confirm it. 2131 * @param handle Pointer to a valid PCA9422 instance structure. 2132 * @param reg variable store address of register. 2133 * @param mask The mask code for the bits want to write. The bit you want to write should be 1. 2134 * @param val Value needs to write into the register. 2135 * @return true if success or false if error. 2136 */ 2137 bool PCA9422_ModifyRegReadback(pca9422_handle_t *handle, uint8_t reg, uint8_t mask, uint8_t val); 2138 /* @} */ 2139 2140 /*! 2141 * @name Charger Interrupts 2142 * @{ 2143 */ 2144 2145 /*! 2146 * @brief Enables PCA9422 Charger interrupts according to the provided interrupt source mask. 2147 * 2148 * This function enables the PCA9422 interrupts according to the provided interrupt source. 2149 * 2150 * @param handle Pointer to a valid PCA9422 instance structure. 2151 * @param source Pointer to interrupt sources of selected interrupt category to enable. 2152 */ 2153 void PCA9422_EnableChargerInterrupts(pca9422_handle_t *handle, uint8_t *source); 2154 2155 /*! 2156 * @brief Disable PCA9422 Charger interrupts according to the provided interrupt source mask. 2157 * 2158 * This function disables the PCA9422 interrupts according to the provided interrupt source. 2159 * 2160 * @param handle Pointer to a valid PCA9422 instance structure. 2161 * @param source Pointer to interrupt sources of selected interrupt category to disable. 2162 */ 2163 void PCA9422_DisableChargerInterrupts(pca9422_handle_t *handle, uint8_t *source); 2164 2165 /*! 2166 * @brief Get Charger interrupt flags. 2167 * 2168 * This function gets charger interrupt flags. 2169 * The flags are returned as an array of the corresponding interrupt source: 2170 * 2171 * @param handle Pointer to a valid PCA9422 instance structure. 2172 * @param source Pointer to charger interrupt flags. 2173 */ 2174 void PCA9422_GetChargerInterrupts(pca9422_handle_t *handle, uint8_t *source); 2175 2176 /*! 2177 * @brief Get Charger interrupt status flags. 2178 * 2179 * This function gets charger interrupt flags. 2180 * The flags are returned as an array of the corresponding interrupt source: 2181 * 2182 * @param handle Pointer to a valid PCA9422 instance structure. 2183 * @param status Pointer to charger interrupt status flags. 2184 */ 2185 void PCA9422_GetChargerInterruptStatus(pca9422_handle_t *handle, uint8_t *status); 2186 2187 /* @} */ 2188 2189 /*! 2190 * @name Regulator Interrupt 2191 * @{ 2192 */ 2193 2194 /*! 2195 * @brief Enables PCA9422 Regulator interrupt according to the provided interrupt source mask. 2196 * 2197 * This function enables the PCA9422 Regulator interrupt according to the provided interrupt source. 2198 * 2199 * @param handle Pointer to a valid PCA9422 instance structure. 2200 * @param source Pointer to interrupt source of selected interrupt category to enable. 2201 */ 2202 void PCA9422_EnableRegulatorInterrupt(pca9422_handle_t *handle, uint8_t *source); 2203 2204 /*! 2205 * @brief Disable PCA9422 Regulator interrupt according to the provided interrupt source mask. 2206 * 2207 * This function disables the PCA9422 Regulator interrupt according to the provided interrupt source. 2208 * 2209 * @param handle Pointer to a valid PCA9422 instance structure. 2210 * @param source Pointer to interrupt source of selected interrupt category to disable. 2211 */ 2212 void PCA9422_DisableRegulatorInterrupt(pca9422_handle_t *handle, uint8_t *source); 2213 2214 /*! 2215 * @brief Get Regulator interrupt flag. 2216 * 2217 * This function gets regulator interrupt flag. 2218 * The flags are returned as an array of the corresponding interrupt source: 2219 * 2220 * @param handle Pointer to a valid PCA9422 instance structure. 2221 * @param source Pointer to regulator interrupt flag. 2222 */ 2223 void PCA9422_GetRegulatorInterrupt(pca9422_handle_t *handle, uint8_t *source); 2224 2225 /*! 2226 * @brief Get Regulator interrupt status flag. 2227 * 2228 * This function gets regulator interrupt status flag. 2229 * The flags are returned as an array of the corresponding interrupt source: 2230 * 2231 * @param handle Pointer to a valid PCA9422 instance structure. 2232 * @param status Pointer to regulator interrupt status flag. 2233 */ 2234 void PCA9422_GetRegulatorInterruptStatus(pca9422_handle_t *handle, uint8_t *status); 2235 2236 /*! 2237 * @name Sub-level Interrupt 2238 * @{ 2239 */ 2240 2241 /*! 2242 * @brief Enables PCA9422 Sub level interrupt according to the provided interrupt source mask. 2243 * 2244 * This function enables the PCA9422 sub level interrupt according to the provided interrupt source. 2245 * 2246 * @param handle Pointer to a valid PCA9422 instance structure. 2247 * @param source Pointer to interrupt source of selected interrupt category to enable. 2248 */ 2249 void PCA9422_EnableSublevelInterrupts(pca9422_handle_t *handle, uint8_t *source); 2250 2251 /*! 2252 * @brief Disable PCA9422 Sub level interrupt according to the provided interrupt source mask. 2253 * 2254 * This function disables the PCA9422 sub level interrupt according to the provided interrupt source. 2255 * 2256 * @param handle Pointer to a valid PCA9422 instance structure. 2257 * @param source Pointer to interrupt source of selected interrupt category to disable. 2258 */ 2259 void PCA9422_DisableSublevelInterrupts(pca9422_handle_t *handle, uint8_t *source); 2260 2261 /*! 2262 * @brief Get Sub level interrupt flags. 2263 * 2264 * This function gets sub level interrupt flags. 2265 * The flags are returned as an array of the corresponding interrupt source: 2266 * 2267 * @param handle Pointer to a valid PCA9422 instance structure. 2268 * @param source Pointer to sub level interrupt flags. 2269 */ 2270 void PCA9422_GetSublevelInterrupts(pca9422_handle_t *handle, uint8_t *source); 2271 2272 /*! 2273 * @brief Get Top level interrupt status flag. 2274 * 2275 * This function gets top level interrupt status flag. 2276 * The flags are returned as an array of the corresponding interrupt source: 2277 * 2278 * @param handle Pointer to a valid PCA9422 instance structure. 2279 * @param status Pointer to top level interrupt status flag. 2280 */ 2281 void PCA9422_GetToplevelInterruptStatus(pca9422_handle_t *handle, uint8_t *status); 2282 /* @} */ 2283 2284 /*! 2285 * @name mode control functions 2286 * @{ 2287 */ 2288 2289 /* @} */ 2290 2291 #if defined(__cplusplus) 2292 } 2293 #endif 2294 2295 /*! @} */ 2296 2297 #endif /* _FSL_PCA9422_H_ */ 2298 2299 /******************************************************************************* 2300 * EOF 2301 ******************************************************************************/ 2302