Pascal Paillet | 3263aea | 2022-12-16 14:59:34 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2024, STMicroelectronics - All Rights Reserved |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #ifndef STM32MP_PMIC2_H |
| 8 | #define STM32MP_PMIC2_H |
| 9 | |
| 10 | #include <stdbool.h> |
| 11 | #include <drivers/st/regulator.h> |
| 12 | |
| 13 | #include <platform_def.h> |
| 14 | |
| 15 | /* |
| 16 | * dt_pmic_status - Check PMIC status from device tree |
| 17 | * |
| 18 | * Returns the status of the PMIC (secure, non-secure), or a negative value on |
| 19 | * error |
| 20 | */ |
| 21 | int dt_pmic_status(void); |
| 22 | |
| 23 | /* |
| 24 | * initialize_pmic_i2c - Initialize I2C for the PMIC control |
| 25 | * |
| 26 | * Returns true if PMIC is available, false if not found, panics on errors |
| 27 | */ |
| 28 | bool initialize_pmic_i2c(void); |
| 29 | |
| 30 | /* |
| 31 | * initialize_pmic - Main PMIC initialization function, called at platform init |
| 32 | * |
| 33 | * Panics on errors |
| 34 | */ |
| 35 | void initialize_pmic(void); |
| 36 | |
| 37 | /* |
| 38 | * stpmic2_set_prop - Set PMIC2 proprietary property |
| 39 | * |
| 40 | * Returns non zero on errors |
| 41 | */ |
| 42 | int stpmic2_set_prop(const struct regul_description *desc, uint16_t prop, uint32_t value); |
| 43 | |
| 44 | /* |
| 45 | * pmic_switch_off - switch off the platform with PMIC |
| 46 | * |
| 47 | * Panics on errors |
| 48 | */ |
| 49 | void pmic_switch_off(void); |
| 50 | |
| 51 | #endif /* STM32MP_PMIC2_H */ |