PDK API Guide for J721E
pmic_core.h File Reference

Introduction

PMIC Driver Common API/interface file.

Go to the source code of this file.

Data Structures

struct  Pmic_RecovCntCfg_t
 PMIC Recovery Counter Configuration Note: validParams is input param for all Set and Get APIs. other params except validParams is input param for Set APIS and output param for Get APIs. More...
 
struct  Pmic_CommonCtrlCfg_t
 PMIC common control param configuration Note: validParams is input param for all Set and Get APIs. other params except validParams is input param for Set APIs and output param for Get APIs. More...
 
struct  Pmic_MiscCtrlCfg_t
 PMIC Miscellaneous control param Configuration Note: validParams is input param for all Set and Get APIs. other params except validParams is input param for Set APIs and output param for Get APIs. More...
 
struct  Pmic_BatteryCtrlCfg_t
 PMIC Backup Battery control param Configuration Note: validParams is input param for all Set and Get APIs. other params except validParams is input param for Set APIs and output param for Get APIs. More...
 
struct  Pmic_CommonCtrlStat_t
 PMIC common control param status Note: validParams is input param for all Get APIs. other params except validParams is output param for Get APIs. More...
 
struct  Pmic_DeviceInfo_t
 PMIC Device Information. More...
 

Macros

#define DRV_INIT_SUCCESS   (0xABCD0000U)
 PMIC driver Core Handle INIT status Magic Number. Used to validate Handle to avoid corrupted PmicHandle usage. on Success: (DRV_INIT_SUCCESS | Pmic_InstType_t) More...
 
#define PMIC_SILICON_REV_ID_PG_2_0   (0x08U)
 Silicon Revision Id - PG 2.0 for TPS6594x Leo and LP8764x Hera. More...
 
#define PMIC_SILICON_REV_ID_PG_1_0   (0x0U)
 Silicon Revision Id - PG 1.0 for TPS6594x Leo and LP8764x Hera. More...
 
PMIC Recovery Counter Configuration Type

#define PMIC_CFG_RECOV_CNT_THR_VAL_VALID   (0U)
 validParams value used to set/get Recovery Counter Threshold Value More...
 
#define PMIC_CFG_RECOV_CNT_CLR_CNT_VALID   (1U)
 validParams value used to Clear/get Recovery Counter Value More...
 
PMIC Recovery Count Configuration Structure Param Bit shift values

Application can use below shifted values to set the validParams struct members defined in Pmic_RecovCntCfg_t structure

#define PMIC_CFG_RECOV_CNT_THR_VAL_VALID_SHIFT   (1U << PMIC_CFG_RECOV_CNT_THR_VAL_VALID)
 
#define PMIC_CFG_RECOV_CNT_CLR_CNT_VALID_SHIFT   (1U << PMIC_CFG_RECOV_CNT_CLR_CNT_VALID)
 
PMIC Scratchpad register selection

#define PMIC_SCRATCH_PAD_REG_1   (0x0U)
 
#define PMIC_SCRATCH_PAD_REG_2   (0x1U)
 
#define PMIC_SCRATCH_PAD_REG_3   (0x2U)
 
#define PMIC_SCRATCH_PAD_REG_4   (0x3U)
 
PMIC User Spare register selection

#define PMIC_USER_SPARE_REG_1   (0x0U)
 
#define PMIC_USER_SPARE_REG_2   (0x1U)
 
#define PMIC_USER_SPARE_REG_3   (0x2U)
 
#define PMIC_USER_SPARE_REG_4   (0x3U)
 
PMIC User Spare register Value

#define PMIC_USER_SPARE_REG_VAL_0   (0x0U)
 
#define PMIC_USER_SPARE_REG_VAL_1   (0x1U)
 
PMIC Common control param status Structure Param Bits

PMIC valid params configuration type for the structure member validParams of Pmic_CommonCtrlStat_t structure

#define PMIC_CFG_BB_EOC_INDICATION_STAT_VALID   (0U)
 validParams value used to get Backup Battery End of charge Indication Status More...
 
#define PMIC_CFG_REGISTER_LOCK_STAT_VALID   (1U)
 validParams value used to get Register lock status More...
 
#define PMIC_CFG_EXT_CLK_VALIDITY_STAT_VALID   (2U)
 validParams value used to get External clock validity status More...
 
#define PMIC_CFG_STARTUP_PIN_STAT_VALID   (3U)
 validParams value used to get Startup(nPWRON/Enable) pin status More...
 
#define PMIC_CFG_EN_DRV_PIN_STAT_VALID   (4U)
 validParams value used to get EN_DRV Pin status More...
 
#define PMIC_CFG_NRSTOUTSOC_PIN_STAT_VALID   (5U)
 validParams value used to get nRSTOUT_SOC Pin status More...
 
#define PMIC_CFG_NRSTOUT_PIN_STAT_VALID   (6U)
 validParams value used to get nRSTOUT Pin status More...
 
#define PMIC_CFG_NINT_PIN_STAT_VALID   (7U)
 validParams value used to get nINT Pin status More...
 
#define PMIC_CFG_SPMI_LPM_STAT_VALID   (8U)
 validParams value used to get SPMI Low Power Mode status More...
 
#define PMIC_CFG_FORCE_ENABLE_DRV_LOW_STAT_VALID   (9U)
 validParams value used to get status of ENABLE_DRV Configuration by I2C/SPI More...
 
PMIC Common Control param status valid param bit shift values

Application can use below shifted values to set the validParam member defined in Pmic_CommonCtrlStat_t structure

#define PMIC_CFG_BB_EOC_INDICATION_STAT_VALID_SHIFT   (1U << PMIC_CFG_BB_EOC_INDICATION_STAT_VALID)
 
#define PMIC_CFG_REGISTER_LOCK_STAT_VALID_SHIFT   (1U << PMIC_CFG_REGISTER_LOCK_STAT_VALID)
 
#define PMIC_CFG_EXT_CLK_VALIDITY_STAT_VALID_SHIFT   (1U << PMIC_CFG_EXT_CLK_VALIDITY_STAT_VALID)
 
#define PMIC_CFG_STARTUP_PIN_STAT_VALID_SHIFT   (1U << PMIC_CFG_STARTUP_PIN_STAT_VALID)
 
#define PMIC_CFG_EN_DRV_PIN_STAT_VALID_SHIFT   (1U << PMIC_CFG_EN_DRV_PIN_STAT_VALID)
 
#define PMIC_CFG_NRSTOUTSOC_PIN_STAT_VALID_SHIFT   (1U << PMIC_CFG_NRSTOUTSOC_PIN_STAT_VALID)
 
#define PMIC_CFG_NRSTOUT_PIN_STAT_VALID_SHIFT   (1U << PMIC_CFG_NRSTOUT_PIN_STAT_VALID)
 
#define PMIC_CFG_NINT_PIN_STAT_VALID_SHIFT   (1U << PMIC_CFG_NINT_PIN_STAT_VALID)
 
#define PMIC_CFG_SPMI_LPM_STAT_VALID_SHIFT   (1U << PMIC_CFG_SPMI_LPM_STAT_VALID)
 
#define PMIC_CFG_FORCE_ENABLE_DRV_LOW_STAT_VALID_SHIFT   (1U << PMIC_CFG_FORCE_ENABLE_DRV_LOW_STAT_VALID)
 
PMIC signal level of the STARTUP(NPWRON/ENABLE)/ NINT / NRSTOUT_SOC/

NRSTOUT/ EN_DRV Pin

#define PMIC_PIN_SIGNAL_LEVEL_LOW   (0U)
 
#define PMIC_PIN_SIGNAL_LEVEL_HIGH   (1U)
 
PMIC Pin Type Selection as NRSTOUT_SOC/ NRSTOUT/ EN_DRV

#define PMIC_PIN_TYPE_EN_DRV   (0U)
 
#define PMIC_PIN_TYPE_NRSTOUT_SOC   (1U)
 
#define PMIC_PIN_TYPE_NRSTOUT   (2U)
 
PMIC ENABLE_DRV I2C/SPI configuration status

#define PMIC_ENABLE_DRV_I2C_SPI_CONFIG_ENABLE   (0U)
 
#define PMIC_ENABLE_DRV_I2C_SPI_CONFIG_DISABLE   (1U)
 
PMIC Register Lock Configuration

#define PMIC_REGISTER_UNLOCK   (0x9BU)
 Unlock PMIC Registers. More...
 
#define PMIC_REGISTER_LOCK   (0x10U)
 Lock PMIC Registers - Write any value other than 0x9B. Here 0x10 is used. More...
 
PMIC Register Lock Status

#define PMIC_REGISTER_STATUS_UNLOCK   (0x0U)
 
#define PMIC_REGISTER_STATUS_LOCK   (0x1U)
 
PMIC Spread Spectrum Configuration

#define PMIC_SPREAD_SPECTRUM_CFG_DISABLE   0U
 Disable Spread Spectrum Configuration. More...
 
#define PMIC_SPREAD_SPECTRUM_CFG_ENABLE   1U
 Enable Spread Spectrum Configuration. More...
 
PMIC Spread Spectrum Modulation Depth Sel

#define PMIC_SPREAD_SPECTRUM_MODULATION_DEPTH_NONE   (0U)
 No Modulation. More...
 
#define PMIC_SPREAD_SPECTRUM_MODULATION_DEPTH_6_3_PERCENT   (1U)
 Modulation Depth as +/- 6.3%. More...
 
#define PMIC_SPREAD_SPECTRUM_MODULATION_DEPTH_8_4_PERCENT   (2U)
 Modulation Depth as +/- 8.4%. More...
 
PMIC SPMI LPM Mode Control Status

#define PMIC_SPMI_LPM_MODE_CTRL_CFG_DISABLED   (0U)
 SPMI LPM Mode Control Configuration is Disabled. More...
 
#define PMIC_SPMI_LPM_MODE_CTRL_CFG_ENABLED   (1U)
 SPMI LPM Mode Control Configuration is Enabled. More...
 
PMIC Internal Clock Monitoring Configuration

#define PMIC_INTERNAL_CLK_MONITORING_CFG_DISABLE   (0U)
 Disable Internal Clock Monitoring. More...
 
#define PMIC_INTERNAL_CLK_MONITORING_CFG_ENABLE   (1U)
 Enable Internal Clock Monitoring. More...
 
PMIC SYNCCLKOUT Frequency selection

#define PMIC_SYNCCLKOUT_DISABLE   (0U)
 DISABLE SYNCCLKOUT. More...
 
#define PMIC_SYNCCLKOUT_1_1_MHZ   (1U)
 SYNCCLKOUT Frequency as 1.1 MHz. More...
 
#define PMIC_SYNCCLKOUT_2_2_MHZ   (2U)
 SYNCCLKOUT Frequency as 2.2 MHz. More...
 
#define PMIC_SYNCCLKOUT_4_4_MHZ   (3U)
 SYNCCLKOUT Frequency as 4.4 MHz. More...
 
PMIC External Clock selection

#define PMIC_INTERNAL_RC_OSC   (0U)
 Forced to Internal RC Oscillator. More...
 
#define PMIC_AUTOMATIC_EXT_CLK   (1U)
 Selects External clock when Available. More...
 
PMIC External Clock Validity Status

#define PMIC_EXT_CLK_STATUS_VALID   (0U)
 
#define PMIC_EXT_CLK_STATUS_INVALID   (1U)
 
PMIC CRC Status for I2C1/I2C2/SPI

#define PMIC_CRC_STATUS_DISABLED   (0U)
 CRC is disabled. More...
 
#define PMIC_CRC_STATUS_ENABLED   (1U)
 CRC is enabled. More...
 
PMIC Common Control Configuration Structure Param Bits

PMIC valid params configuration type for the structure member validParams of Pmic_CommonCtrlCfg_t structure

#define PMIC_CFG_SPREAD_SPECTRUM_EN_VALID   (0U)
 validParams value used to set/get Spread Spectrum Enable/Disable More...
 
#define PMIC_CFG_ENABLE_DRV_VALID   (1U)
 validParams value used to set/get ENABLE_DRV pin configuration More...
 
#define PMIC_CFG_REG_LOCK_VALID   (2U)
 validParams value used to set/get Register Lock configuration More...
 
#define PMIC_CFG_SPREAD_SPECTRUM_DEPTH_VALID   (3U)
 validParams value used to set/get Spread Spectrum modulation Depth Value More...
 
#define PMIC_CFG_EEPROM_DEFAULT_VALID   (4U)
 validParams value used to set/get to Enable/Disable load from EEPROM defaults on RTC Domain(TPS6594X Leo)/ conf(LP8764x Hera) registers More...
 
#define PMIC_CFG_SKIP_EEPROM_LOAD_VALID   (5U)
 validParams value used to set/get to Enable/Disable to skip EEPROM defaults load on conf and Other registers Valid only for LP8764x Hera More...
 
PMIC Common Control Configuration valid param bit shift values

Application can use below shifted values to set the validParam member defined in Pmic_CommonCtrlCfg_t structure

#define PMIC_CFG_SPREAD_SPECTRUM_EN_VALID_SHIFT   (1U << PMIC_CFG_SPREAD_SPECTRUM_EN_VALID)
 
#define PMIC_CFG_ENABLE_DRV_VALID_SHIFT   (1U << PMIC_CFG_ENABLE_DRV_VALID)
 
#define PMIC_CFG_REG_LOCK_VALID_SHIFT   (1U << PMIC_CFG_REG_LOCK_VALID)
 
#define PMIC_CFG_SPREAD_SPECTRUM_DEPTH_VALID_SHIFT   (1U << PMIC_CFG_SPREAD_SPECTRUM_DEPTH_VALID)
 
#define PMIC_CFG_EEPROM_DEFAULT_VALID_SHIFT   (1U << PMIC_CFG_EEPROM_DEFAULT_VALID)
 
#define PMIC_CFG_SKIP_EEPROM_LOAD_VALID_SHIFT   (1U << PMIC_CFG_SKIP_EEPROM_LOAD_VALID)
 
PMIC Miscellaneous Control Configuration Structure Param Bits

PMIC valid params configuration type for the structure member validParams of Pmic_MiscCtrlCfg_t structure

#define PMIC_CFG_AMUX_OUT_REF_OUT_EN_VALID   (0U)
 validParams value used to set/get to Enable/Disable Band gap Voltage to AMUX OUT/REF OUT Pin More...
 
#define PMIC_CFG_CLK_MON_EN_VALID   (1U)
 validParams value used to set/get to Enable or Disable internal Clock Monitoring More...
 
#define PMIC_CFG_SYNC_CLK_OUT_FREQ_SEL_VALID   (2U)
 validParams value used to set/get to Select SYNCCLKOUT Frequency More...
 
#define PMIC_CFG_EXT_CLK_SEL_VALID   (3U)
 validParams value used to set/get External clock Selection More...
 
#define PMIC_CFG_SYNC_CLK_IN_FREQ_VALID   (4U)
 validParams value used to set/get to Select External clock Frequency More...
 
#define PMIC_CFG_NRSTOUT_SOC_VALID   (5U)
 validParams value used to set/get to NRSTOUT_SOC Signal More...
 
#define PMIC_CFG_NRSTOUT_VALID   (6U)
 validParams value used to set/get NRSTOUT Signal More...
 
PMIC Miscellaneous Control Configuration valid param bit shift

values

Application can use below shifted values to set the validParam member defined in Pmic_MiscCtrlCfg_t structure

#define PMIC_CFG_AMUX_OUT_REF_OUT_EN_VALID_SHIFT   (1U << PMIC_CFG_AMUX_OUT_REF_OUT_EN_VALID)
 
#define PMIC_CFG_CLK_MON_EN_VALID_SHIFT   (1U << PMIC_CFG_CLK_MON_EN_VALID)
 
#define PMIC_CFG_SYNC_CLK_OUT_FREQ_SEL_VALID_SHIFT   (1U << PMIC_CFG_SYNC_CLK_OUT_FREQ_SEL_VALID)
 
#define PMIC_CFG_EXT_CLK_SEL_VALID_SHIFT   (1U << PMIC_CFG_EXT_CLK_SEL_VALID)
 
#define PMIC_CFG_SYNC_CLK_IN_FREQ_VALID_SHIFT   (1U << PMIC_CFG_SYNC_CLK_IN_FREQ_VALID)
 
#define PMIC_CFG_NRSTOUT_SOC_VALID_SHIFT   (1U << PMIC_CFG_NRSTOUT_SOC_VALID)
 
#define PMIC_CFG_NRSTOUT_VALID_SHIFT   (1U << PMIC_CFG_NRSTOUT_VALID)
 
PMIC Backup Battery Control Configuration Structure Param Bits

PMIC valid params configuration type for the structure member validParams of Pmic_BatteryCtrlCfg_t structure

#define PMIC_CFG_CHARGING_EN_VALID   (0U)
 validParams value used to set/get to Enable/Disable Backup Battery Charging More...
 
#define PMIC_CFG_END_OF_CHARGE_VOLTAGE_VALID   (1U)
 validParams value used to set/get to Backup Battery configuration for End of charge Voltage More...
 
#define PMIC_CFG_CHARGE_CURRENT_VALID   (2U)
 validParams value used to set/get to Backup Battery charging current value More...
 
PMIC Backup Battery Control Configuration valid param bit shift

values

Application can use below shifted values to set the validParam member defined in Pmic_BatteryCtrlCfg_t structure

#define PMIC_CFG_CHARGING_EN_VALID_SHIFT   (1U << PMIC_CFG_CHARGING_EN_VALID)
 
#define PMIC_CFG_END_OF_CHARGE_VOLTAGE_VALID_SHIFT   (1U << PMIC_CFG_END_OF_CHARGE_VOLTAGE_VALID)
 
#define PMIC_CFG_CHARGE_CURRENT_VALID_SHIFT   (1U << PMIC_CFG_CHARGE_CURRENT_VALID)
 

Functions

int32_t Pmic_setRecoveryCntCfg (Pmic_CoreHandle_t *pPmicCoreHandle, const Pmic_RecovCntCfg_t recovCntCfg)
 API to Set Recovery Counter Configuration. More...
 
int32_t Pmic_getRecoveryCntCfg (Pmic_CoreHandle_t *pPmicCoreHandle, Pmic_RecovCntCfg_t *pRecovCntCfg)
 API to Get Recovery Counter Configuration. More...
 
int32_t Pmic_getRecoveryCnt (Pmic_CoreHandle_t *pPmicCoreHandle, uint8_t *pRecovCntVal)
 API to Read Recovery Count Value. More...
 
int32_t Pmic_setScratchPadValue (Pmic_CoreHandle_t *pPmicCoreHandle, const uint8_t scratchPadRegNum, const uint8_t data)
 API to set/write value in/to scratchpad register. More...
 
int32_t Pmic_getScratchPadValue (Pmic_CoreHandle_t *pPmicCoreHandle, const uint8_t scratchPadRegNum, uint8_t *pData)
 API to get/read data from scratchpad register. More...
 
int32_t Pmic_setUserSpareValue (Pmic_CoreHandle_t *pPmicCoreHandle, const uint8_t userSpareRegNum, const uint8_t data)
 API to set/write value in/to User Spare register. More...
 
int32_t Pmic_getUserSpareValue (Pmic_CoreHandle_t *pPmicCoreHandle, const uint8_t userSpareRegNum, uint8_t *pData)
 API to get/read data from User Spare register. More...
 
int32_t Pmic_setCommonCtrlConfig (Pmic_CoreHandle_t *pPmicCoreHandle, const Pmic_CommonCtrlCfg_t commonCtrlCfg)
 API to set PMIC common control parameter configuration. More...
 
int32_t Pmic_getCommonCtrlConfig (Pmic_CoreHandle_t *pPmicCoreHandle, Pmic_CommonCtrlCfg_t *pCommonCtrlCfg)
 API to get PMIC common control parameter configuration. More...
 
int32_t Pmic_setMiscCtrlConfig (Pmic_CoreHandle_t *pPmicCoreHandle, const Pmic_MiscCtrlCfg_t miscCtrlCfg)
 API to set PMIC Miscellaneous control parameter configuration. More...
 
int32_t Pmic_getMiscCtrlConfig (Pmic_CoreHandle_t *pPmicCoreHandle, Pmic_MiscCtrlCfg_t *pMiscCtrlCfg)
 API to get PMIC Miscellaneous control parameter configuration. More...
 
int32_t Pmic_setBatteryCtrlConfig (Pmic_CoreHandle_t *pPmicCoreHandle, const Pmic_BatteryCtrlCfg_t batteryCtrlCfg)
 API to set PMIC Battery Backup control parameter configuration. More...
 
int32_t Pmic_getBatteryCtrlConfig (Pmic_CoreHandle_t *pPmicCoreHandle, Pmic_BatteryCtrlCfg_t *pBatteryCtrlCfg)
 API to get PMIC Battery Backup control parameter configuration. Note: validParams is input param for all Set and Get APIs. other params except validParams is input param for Set APIs and output param for Get APIs. More...
 
int32_t Pmic_getPinValue (Pmic_CoreHandle_t *pPmicCoreHandle, const uint8_t pinType, uint8_t *pPinValue)
 API to get PMIC GPIO NRSTOUT_SOC/ NRSTOUT/ EN_DRV Pin. More...
 
int32_t Pmic_getCommonCtrlStat (Pmic_CoreHandle_t *pPmicCoreHandle, Pmic_CommonCtrlStat_t *pCommonCtrlStat)
 API to get PMIC common control parameter status. More...
 
int32_t Pmic_getI2CSpeed (Pmic_CoreHandle_t *pPmicCoreHandle, uint8_t *pI2C1Speed, uint8_t *pI2C2Speed)
 API to get configured value for I2C1 or I2C2 Speed based on commMode. More...
 
int32_t Pmic_enableCRC (Pmic_CoreHandle_t *pPmicCoreHandle)
 API to Enable CRC. More...
 
int32_t Pmic_getCrcStatus (Pmic_CoreHandle_t *pPmicCoreHandle, uint8_t *pI2c1SpiCrcStatus, uint8_t *pI2c2CrcStatus)
 API to get CRC Status. More...
 
int32_t Pmic_getDeviceInfo (Pmic_CoreHandle_t *pPmicCoreHandle, Pmic_DeviceInfo_t *pDeviceInfo)
 API to get PMIC Device Information. More...
 
int32_t Pmic_setI2CSpeedCfg (Pmic_CoreHandle_t *pPmicCoreHandle)
 API to set I2C1 or I2C2 Speed based on commMode. More...