PDK API Guide for J721E
pmic_power.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright (c) 2020 Texas Instruments Incorporated - http://www.ti.com
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the
14  * distribution.
15  *
16  * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  *****************************************************************************/
33 
59 #ifndef PMIC_POWER_H_
60 #define PMIC_POWER_H_
61 
62 /* ========================================================================= */
63 /* Include Files */
64 /* ========================================================================= */
65 
66 #include <pmic_core.h>
69 
70 #ifdef __cplusplus
71 extern "C" {
72 #endif
73 
74 /* ========================================================================= */
75 /* Macros & Typedefs */
76 /* ========================================================================= */
77 
91 #define PMIC_CFG_REGULATOR_VMON_RV_SEL_VALID (0U)
92 
95 #define PMIC_CFG_REGULATOR_BUCK_PLDN_EN_VALID (1U)
96 
100 #define PMIC_CFG_VMON_EN_VALID (2U)
101 
104 #define PMIC_CFG_REGULATOR_BUCK_VOUT_SEL_VALID (3U)
105 
108 #define PMIC_CFG_REGULATOR_BUCK_FPWM_VALID (4U)
109 
112 #define PMIC_CFG_REGULATOR_BUCK_PWM_MP_VALID (5U)
113 
116 #define PMIC_CFG_REGULATOR_EN_VALID (6U)
117 
121 #define PMIC_CFG_REGULATOR_LDO_SLOW_RAMP_EN_VALID (7U)
122 
125 #define PMIC_CFG_REGULATOR_LDO_BYPASS_MODE_EN_VALID (8U)
126 
128 #define PMIC_CFG_VCCA_PWR_GOOD_LVL_VALID (9U)
129 
132 #define PMIC_CFG_VMON_RANGE_VALID (10U)
133 
136 #define PMIC_CFG_REGULATOR_BUCK_ILIM_VALID (12U)
137 
140 #define PMIC_CFG_REGULATOR_BUCK_VMON_SLEW_RATE_VALID (13U)
141 
144 #define PMIC_CFG_REGULATOR_LDO_PLDN_SEL_VALID (14U)
145 
148 #define PMIC_CFG_REGULATOR_LDO_RV_TIMEOUT_SEL_VALID (15U)
149 
152 #define PMIC_CFG_PWR_RESOURCE_PG_UV_THRESHOLD_LVL_VALID (16U)
153 
156 #define PMIC_CFG_PWR_RESOURCE_PG_OV_THRESHOLD_LVL_VALID (17U)
157 
160 #define PMIC_CFG_PWR_RESOURCE_RAIL_GRP_SEL_VALID (18U)
161 
164 #define PMIC_CFG_REGULATOR_VMON_VOLTAGE_SET_VALID (19U)
165 /* @} */
166 
176 #define PMIC_CFG_REGULATOR_VMON_RV_SEL_VALID_SHIFT \
177  (1U << PMIC_CFG_REGULATOR_VMON_RV_SEL_VALID)
178 #define PMIC_CFG_REGULATOR_BUCK_PLDN_EN_VALID_SHIFT \
179  (1U << PMIC_CFG_REGULATOR_BUCK_PLDN_EN_VALID)
180 #define PMIC_CFG_VMON_EN_VALID_SHIFT (1U << PMIC_CFG_VMON_EN_VALID)
181 #define PMIC_CFG_REGULATOR_BUCK_VOUT_SEL_VALID_SHIFT \
182  (1U << PMIC_CFG_REGULATOR_BUCK_VOUT_SEL_VALID)
183 #define PMIC_CFG_REGULATOR_BUCK_FPWM_VALID_SHIFT \
184  (1U << PMIC_CFG_REGULATOR_BUCK_FPWM_VALID)
185 #define PMIC_CFG_REGULATOR_BUCK_PWM_MP_VALID_SHIFT \
186  (1U << PMIC_CFG_REGULATOR_BUCK_PWM_MP_VALID)
187 #define PMIC_CFG_REGULATOR_EN_VALID_SHIFT (1U << PMIC_CFG_REGULATOR_EN_VALID)
188 #define PMIC_CFG_REGULATOR_LDO_SLOW_RAMP_EN_VALID_SHIFT \
189  (1U << PMIC_CFG_REGULATOR_LDO_SLOW_RAMP_EN_VALID)
190 #define PMIC_CFG_REGULATOR_LDO_BYPASS_MODE_EN_VALID_SHIFT \
191  (1U << PMIC_CFG_REGULATOR_LDO_BYPASS_MODE_EN_VALID)
192 #define PMIC_CFG_VCCA_PWR_GOOD_LVL_VALID_SHIFT \
193  (1U << PMIC_CFG_VCCA_PWR_GOOD_LVL_VALID)
194 #define PMIC_CFG_VMON_RANGE_VALID_SHIFT (1U << PMIC_CFG_VMON_RANGE_VALID)
195 #define PMIC_CFG_REGULATOR_BUCK_ILIM_VALID_SHIFT \
196  (1U << PMIC_CFG_REGULATOR_BUCK_ILIM_VALID)
197 #define PMIC_CFG_REGULATOR_BUCK_VMON_SLEW_RATE_VALID_SHIFT \
198  (1U << PMIC_CFG_REGULATOR_BUCK_VMON_SLEW_RATE_VALID)
199 #define PMIC_CFG_REGULATOR_LDO_PLDN_SEL_VALID_SHIFT \
200  (1U << PMIC_CFG_REGULATOR_LDO_PLDN_SEL_VALID)
201 #define PMIC_CFG_REGULATOR_LDO_RV_TIMEOUT_SEL_VALID_SHIFT \
202  (1U << PMIC_CFG_REGULATOR_LDO_RV_TIMEOUT_SEL_VALID)
203 #define PMIC_CFG_PWR_RESOURCE_PG_UV_THRESHOLD_LVL_VALID_SHIFT \
204  (1U << PMIC_CFG_PWR_RESOURCE_PG_UV_THRESHOLD_LVL_VALID)
205 #define PMIC_CFG_PWR_RESOURCE_PG_OV_THRESHOLD_LVL_VALID_SHIFT \
206  (1U << PMIC_CFG_PWR_RESOURCE_PG_OV_THRESHOLD_LVL_VALID)
207 #define PMIC_CFG_PWR_RESOURCE_RAIL_GRP_SEL_VALID_SHIFT \
208  (1U << PMIC_CFG_PWR_RESOURCE_RAIL_GRP_SEL_VALID)
209 #define PMIC_CFG_REGULATOR_VMON_VOLTAGE_SET_VALID_SHIFT \
210  (1U << PMIC_CFG_REGULATOR_VMON_VOLTAGE_SET_VALID)
211 /* @} */
212 
221 #define PMIC_POWER_PGOOD_WINDOW_VALID (0U)
222 
224 #define PMIC_POWER_PGOOD_POL_VALID (1U)
225 
232 #define PMIC_CFG_DEGLITCH_TIME_SEL_VALID (2U)
233 
235 #define PMIC_SEVERE_ERR_TRIG_VALID (3U)
236 
238 #define PMIC_OTHER_RAIL_TRIG_VALID (4U)
239 
241 #define PMIC_SOC_RAIL_TRIG_VALID (5U)
242 
244 #define PMIC_MCU_RAIL_TRIG_VALID (6U)
245 
247 #define PMIC_MODERATE_ERR_TRIG_VALID (7U)
248 /* @} */
249 
259 #define PMIC_POWER_PGOOD_WINDOW_VALID_SHIFT \
260  (1U << PMIC_POWER_PGOOD_WINDOW_VALID)
261 #define PMIC_POWER_PGOOD_POL_VALID_SHIFT \
262  (1U << PMIC_POWER_PGOOD_POL_VALID)
263 #define PMIC_CFG_DEGLITCH_TIME_SEL_VALID_SHIFT \
264  (1U << PMIC_CFG_DEGLITCH_TIME_SEL_VALID)
265 #define PMIC_SEVERE_ERR_TRIG_VALID_SHIFT \
266  (1U << PMIC_SEVERE_ERR_TRIG_VALID)
267 #define PMIC_OTHER_RAIL_TRIG_VALID_SHIFT \
268  (1U << PMIC_OTHER_RAIL_TRIG_VALID)
269 #define PMIC_SOC_RAIL_TRIG_VALID_SHIFT \
270  (1U << PMIC_SOC_RAIL_TRIG_VALID)
271 #define PMIC_MCU_RAIL_TRIG_VALID_SHIFT \
272  (1U << PMIC_MCU_RAIL_TRIG_VALID)
273 #define PMIC_MODERATE_ERR_TRIG_VALID_SHIFT \
274  (1U << PMIC_MODERATE_ERR_TRIG_VALID)
275 
288 #define PMIC_POWER_REGULATOR_ILIM_STAT_VALID (0U)
289 
292 #define PMIC_POWER_RESOURCE_UV_STAT_VALID (1U)
293 
296 #define PMIC_POWER_RESOURCE_OV_STAT_VALID (2U)
297 
299 #define PMIC_POWER_VCCA_OV_LVL_STAT_VALID (3U)
300 /* @} */
301 
311 #define PMIC_POWER_REGULATOR_ILIM_STAT_VALID_SHIFT \
312  (1U << PMIC_POWER_REGULATOR_ILIM_STAT_VALID)
313 #define PMIC_POWER_RESOURCE_UV_STAT_VALID_SHIFT \
314  (1U << PMIC_POWER_RESOURCE_UV_STAT_VALID)
315 #define PMIC_POWER_RESOURCE_OV_STAT_VALID_SHIFT \
316  (1U << PMIC_POWER_RESOURCE_OV_STAT_VALID)
317 #define PMIC_POWER_VCCA_OV_LVL_STAT_VALID_SHIFT \
318  (1U << PMIC_POWER_VCCA_OV_LVL_STAT_VALID)
319 
328 #define PMIC_THERMAL_WARN_VALID (1U)
329 
334 #define PMIC_THERMAL_SHTDWN_VALID (2U)
335 /* @} */
336 
346 #define PMIC_THERMAL_WARN_VALID_SHIFT \
347  (1U << PMIC_THERMAL_WARN_VALID)
348 #define PMIC_THERMAL_SHTDWN_VALID_SHIFT \
349  (1U << PMIC_THERMAL_SHTDWN_VALID)
350 /* @} */
351 
359 #define PMIC_THERMAL_STAT_WARN_VALID (1U)
360 
361 #define PMIC_THERMAL_STAT_ORD_SHTDWN_VALID (2U)
362 
363 #define PMIC_THERMAL_STAT_IMM_SHTDWN_VALID (3U)
364 /* @} */
365 
375 #define PMIC_THERMAL_STAT_WARN_VALID_SHIFT \
376  (1U << PMIC_THERMAL_STAT_WARN_VALID)
377 #define PMIC_THERMAL_STAT_ORD_SHTDWN_VALID_SHIFT \
378  (1U << PMIC_THERMAL_STAT_ORD_SHTDWN_VALID)
379 #define PMIC_THERMAL_STAT_IMM_SHTDWN_VALID_SHIFT \
380  (1U << PMIC_THERMAL_STAT_IMM_SHTDWN_VALID)
381 /* @} */
382 
389 #define PMIC_POWER_INTERRUPT_ENABLE (0U)
390 #define PMIC_POWER_INTERRUPT_DISABLE (1U)
391 /* @} */
392 
400 #define PMIC_POWER_GOOD_UV_MONITOR_ENABLE (0x0U)
401 
402 #define PMIC_POWER_GOOD_UV_OV_MONITOR_ENABLE (0x1U)
403 /* @} */
404 
412 #define PMIC_POWER_PGOOD_POL_HIGH (0x0U)
413 
414 #define PMIC_POWER_PGOOD_POL_LOW (0x1U)
415 /* @} */
416 
423 #define PMIC_POWER_TRIG_IMM_SHUTDOWN (0U)
424 #define PMIC_POWER_TRIG_ODERLY_SHUTDOWN (1U)
425 #define PMIC_POWER_TRIG_MCU_PWR_ERR (2U)
426 #define PMIC_POWER_TRIG_SOC_PWR_ERR (3U)
427 /* @} */
428 /*==========================================================================*/
429 /* Structures and Enums */
430 /*==========================================================================*/
431 
594 typedef struct Pmic_PowerResourceCfg_s
595 {
596  uint32_t validParams;
597  bool rvCheckEn;
599  bool vmonEn;
607  bool vmonRange;
610  uint8_t ldoPullDownSel;
614  uint8_t railGrpSel;
615  uint16_t voltage_mV;
617 
689 typedef struct Pmic_PowerCommonCfg_s
690 {
691  uint32_t validParams;
696  uint8_t otherRailTrig;
697  uint8_t socRailTrig;
698  uint8_t mcuRailTrig;
701 
783 typedef struct Pmic_PowerResourceStat_s
784 {
785  uint32_t validParams;
791 
833 typedef struct Pmic_PowerThermalCfg_s
834 {
835  uint32_t validParams;
839 
875 typedef struct Pmic_PowerThermalStat_s
876 {
877  uint16_t validParams;
882 
883 /*==========================================================================*/
884 /* Function Declarations */
885 /*==========================================================================*/
886 
953  Pmic_CoreHandle_t *pPmicCoreHandle,
954  const uint16_t pwrResource,
955  const Pmic_PowerResourceCfg_t pwrResourceCfg);
956 
1014  Pmic_CoreHandle_t *pPmicCoreHandle,
1015  const uint16_t pwrResource,
1016  Pmic_PowerResourceCfg_t *pPwrResourceCfg);
1017 
1064 int32_t Pmic_powerSetCommonConfig(Pmic_CoreHandle_t *pPmicCoreHandle,
1065  const Pmic_PowerCommonCfg_t powerCommonCfg);
1066 
1110 int32_t Pmic_powerGetCommonConfig(Pmic_CoreHandle_t *pPmicCoreHandle,
1111  Pmic_PowerCommonCfg_t *pPowerCommonCfg);
1112 
1159 int32_t Pmic_powerSetConfigPowerGood(Pmic_CoreHandle_t *pPmicCoreHandle,
1160  const uint16_t pgoodSrcSel,
1161  const uint8_t pgoodSelType);
1162 
1185 int32_t Pmic_powerGetConfigPowerGood(Pmic_CoreHandle_t *pPmicCoreHandle,
1186  const uint16_t pgoodSrcSel,
1187  uint8_t *pPgoodSelType);
1188 
1242 int32_t Pmic_powerGetPwrRsrcStat(Pmic_CoreHandle_t *pPmicCoreHandle,
1243  const uint16_t pwrResource,
1244  Pmic_PowerResourceStat_t *pPwrRsrcStatCfg);
1283  Pmic_CoreHandle_t *pPmicCoreHandle,
1284  Pmic_PowerThermalStat_t *pPwrThermalStatCfg);
1285 
1315  Pmic_CoreHandle_t *pPmicCoreHandle,
1316  const Pmic_PowerThermalCfg_t thermalThreshold);
1317 
1346 int32_t Pmic_powerGetThermalConfig(Pmic_CoreHandle_t *pPmicCoreHandle,
1347  Pmic_PowerThermalCfg_t *pThermalThreshold);
1348 
1377 int32_t Pmic_powerSetPwrRsrcIntr(Pmic_CoreHandle_t *pPmicCoreHandle,
1378  const uint16_t pwrResource,
1379  const uint8_t intrType,
1380  const bool intrEnable);
1381 
1404 int32_t Pmic_powerSetIntr(Pmic_CoreHandle_t *pPmicCoreHandle,
1405  const uint8_t intrType,
1406  const bool intrEnable);
1407 
1408 #ifdef __cplusplus
1409 }
1410 #endif /* __cplusplus */
1411 
1412 #endif/* PMIC_POWER_H_ */
1413 
1414 /* @} */
1415 
bool thermalShutdownThold
Definition: pmic_power.h:837
bool pgoodPolarity
Definition: pmic_power.h:693
int32_t Pmic_powerGetPwrThermalStat(Pmic_CoreHandle_t *pPmicCoreHandle, Pmic_PowerThermalStat_t *pPwrThermalStatCfg)
API to get PMIC die temperature thermal status.
int32_t Pmic_powerGetPwrRsrcStat(Pmic_CoreHandle_t *pPmicCoreHandle, const uint16_t pwrResource, Pmic_PowerResourceStat_t *pPwrRsrcStatCfg)
API to get power resources status.
bool vccaPwrGudLvl
Definition: pmic_power.h:606
int32_t Pmic_powerSetThermalConfig(Pmic_CoreHandle_t *pPmicCoreHandle, const Pmic_PowerThermalCfg_t thermalThreshold)
API to configure the thermal temperature threshold level for PMIC.
Power configuration The power control and config structure Note: validParams is input param for all S...
Definition: pmic_power.h:689
uint8_t moderateRailTrig
Definition: pmic_power.h:699
bool regulatorEn
Definition: pmic_power.h:603
PMIC Power Thermal status structure Note: validParams is input param for all Get APIs....
Definition: pmic_power.h:875
uint8_t pgOvThresholdLvl
Definition: pmic_power.h:613
uint8_t socRailTrig
Definition: pmic_power.h:697
int32_t Pmic_powerGetConfigPowerGood(Pmic_CoreHandle_t *pPmicCoreHandle, const uint16_t pgoodSrcSel, uint8_t *pPgoodSelType)
Get Power good configuration.
int32_t Pmic_powerSetIntr(Pmic_CoreHandle_t *pPmicCoreHandle, const uint8_t intrType, const bool intrEnable)
API to enable/disable Power interrupt.
bool overVoltageProtectionLvlStat
Definition: pmic_power.h:789
uint16_t voltage_mV
Definition: pmic_power.h:615
uint8_t pgUvThresholdLvl
Definition: pmic_power.h:612
int32_t Pmic_powerGetPwrResourceCfg(Pmic_CoreHandle_t *pPmicCoreHandle, const uint16_t pwrResource, Pmic_PowerResourceCfg_t *pPwrResourceCfg)
API to get power resources configurations.
bool deglitchTimeSel
Definition: pmic_power.h:694
bool underVoltageTholdStat
Definition: pmic_power.h:787
bool buckFpwmMpMode
Definition: pmic_power.h:602
int32_t Pmic_powerGetThermalConfig(Pmic_CoreHandle_t *pPmicCoreHandle, Pmic_PowerThermalCfg_t *pThermalThreshold)
Get the PMIC thermal threshold value function.
PMIC Power Thermal configuration structure Note: validParams is input param for all Set and Get APIs....
Definition: pmic_power.h:833
bool buckPullDownEn
Definition: pmic_power.h:598
uint8_t severeErrorTrig
Definition: pmic_power.h:695
PMIC power status. The PMIC power and thermal status structure. Note: validParams is input param for ...
Definition: pmic_power.h:783
int32_t Pmic_powerSetPwrResourceCfg(Pmic_CoreHandle_t *pPmicCoreHandle, const uint16_t pwrResource, const Pmic_PowerResourceCfg_t pwrResourceCfg)
API to set power resources configurations.
bool thermalWarnThold
Definition: pmic_power.h:836
bool vmonRange
Definition: pmic_power.h:607
bool thermalStateWarning
Definition: pmic_power.h:878
int32_t Pmic_powerSetPwrRsrcIntr(Pmic_CoreHandle_t *pPmicCoreHandle, const uint16_t pwrResource, const uint8_t intrType, const bool intrEnable)
API to enable/disable Power interrupt.
uint8_t mcuRailTrig
Definition: pmic_power.h:698
uint8_t buckVmonSlewRate
Definition: pmic_power.h:609
PMIC Interface Handle. Contains various PMIC driver instance specific information....
Definition: pmic_types.h:148
PMIC LP8764x Leo PMIC Power Resources Driver API/interface file.
uint8_t ldoPullDownSel
Definition: pmic_power.h:610
bool pgoodWindow
Definition: pmic_power.h:692
uint8_t railGrpSel
Definition: pmic_power.h:614
bool currentLimitLvlStat
Definition: pmic_power.h:786
bool thermalStateOderlyShtDwn
Definition: pmic_power.h:879
bool ldoBypassModeEn
Definition: pmic_power.h:605
PMIC Driver Common API/interface file.
bool buckFpwmMode
Definition: pmic_power.h:601
uint32_t validParams
Definition: pmic_power.h:835
PMIC TPS6594x Leo PMIC Power Resources Driver API/interface file.
bool ldoSlowRampEn
Definition: pmic_power.h:604
int32_t Pmic_powerSetConfigPowerGood(Pmic_CoreHandle_t *pPmicCoreHandle, const uint16_t pgoodSrcSel, const uint8_t pgoodSelType)
API to Set Power good configuration.
uint8_t buckCurrentLimit
Definition: pmic_power.h:608
int32_t Pmic_powerSetCommonConfig(Pmic_CoreHandle_t *pPmicCoreHandle, const Pmic_PowerCommonCfg_t powerCommonCfg)
API to Set Power configuration.
bool overVoltageTholdStat
Definition: pmic_power.h:788
uint16_t validParams
Definition: pmic_power.h:877
uint8_t otherRailTrig
Definition: pmic_power.h:696
bool buckVoutSel
Definition: pmic_power.h:600
uint32_t validParams
Definition: pmic_power.h:596
uint32_t validParams
Definition: pmic_power.h:691
uint8_t ldoRvTimeoutSel
Definition: pmic_power.h:611
uint32_t validParams
Definition: pmic_power.h:785
bool vmonEn
Definition: pmic_power.h:599
bool thermalStateImmShtDwn
Definition: pmic_power.h:880
int32_t Pmic_powerGetCommonConfig(Pmic_CoreHandle_t *pPmicCoreHandle, Pmic_PowerCommonCfg_t *pPowerCommonCfg)
API to Get Power configuration.
bool rvCheckEn
Definition: pmic_power.h:597
Pmic Power resources control and configuration structure. Note: validParams is input param for all Se...
Definition: pmic_power.h:594