blob: 4872734c354379801fa92b3a339601c1c5b0f51a [file] [log] [blame]
Yann Gautierbb836ee2018-07-16 17:55:07 +02001/*
Nicolas Le Bayon0b10b652019-11-18 13:13:36 +01002 * Copyright (c) 2017-2021, STMicroelectronics - All Rights Reserved
Yann Gautierbb836ee2018-07-16 17:55:07 +02003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
Yann Gautiera45433b2019-01-16 18:31:00 +01007#ifndef STM32MP_PMIC_H
8#define STM32MP_PMIC_H
Yann Gautierbb836ee2018-07-16 17:55:07 +02009
10#include <stdbool.h>
11
Yann Gautier57e282b2019-01-07 11:17:24 +010012#include <platform_def.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000013
Yann Gautierf3928f62019-02-14 11:15:03 +010014/*
15 * dt_pmic_status - Check PMIC status from device tree
16 *
17 * Returns the status of the PMIC (secure, non-secure), or a negative value on
18 * error
19 */
20int dt_pmic_status(void);
21
22/*
23 * dt_pmic_configure_boot_on_regulators - Configure boot-on and always-on
24 * regulators from device tree configuration
25 *
26 * Returns 0 on success, and negative values on errors
27 */
28int dt_pmic_configure_boot_on_regulators(void);
29
30/*
31 * initialize_pmic_i2c - Initialize I2C for the PMIC control
32 *
33 * Returns true if PMIC is available, false if not found, panics on errors
34 */
35bool initialize_pmic_i2c(void);
36
37/*
38 * initialize_pmic - Main PMIC initialization function, called at platform init
39 *
40 * Panics on errors
41 */
Yann Gautierbb836ee2018-07-16 17:55:07 +020042void initialize_pmic(void);
Yann Gautierf3928f62019-02-14 11:15:03 +010043
Nicolas Le Bayon0b10b652019-11-18 13:13:36 +010044#if DEBUG
45void print_pmic_info_and_debug(void);
46#else
47static inline void print_pmic_info_and_debug(void)
48{
49}
50#endif
51
Yann Gautierf3928f62019-02-14 11:15:03 +010052/*
53 * pmic_ddr_power_init - Initialize regulators required for DDR
54 *
55 * Returns 0 on success, and negative values on errors
56 */
Yann Gautierbb836ee2018-07-16 17:55:07 +020057int pmic_ddr_power_init(enum ddr_type ddr_type);
58
Yann Gautiera45433b2019-01-16 18:31:00 +010059#endif /* STM32MP_PMIC_H */