feat(st-pmic): add pmic_voltages_init() function

This new function pmic_voltages_init() is used to set the minimum value
for STM32MP13 VDDCPU and VDDCORE regulators. This value is retrieved
from device tree.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: Ibbe237cb5dccc1fddf92e07ffd3955048ff82075
This commit is contained in:
Yann Gautier 2022-01-18 15:49:42 +01:00
parent 1c37d0c1d3
commit 5278ec3faf
2 changed files with 38 additions and 1 deletions

View file

@ -329,6 +329,36 @@ int pmic_ddr_power_init(enum ddr_type ddr_type)
return 0;
}
int pmic_voltages_init(void)
{
#if STM32MP13
struct rdev *buck1, *buck4;
int status;
buck1 = regulator_get_by_name("buck1");
if (buck1 == NULL) {
return -ENOENT;
}
buck4 = regulator_get_by_name("buck4");
if (buck4 == NULL) {
return -ENOENT;
}
status = regulator_set_min_voltage(buck1);
if (status != 0) {
return status;
}
status = regulator_set_min_voltage(buck4);
if (status != 0) {
return status;
}
#endif
return 0;
}
enum {
STPMIC1_BUCK1 = 0,
STPMIC1_BUCK2,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2021, STMicroelectronics - All Rights Reserved
* Copyright (c) 2017-2022, STMicroelectronics - All Rights Reserved
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -48,4 +48,11 @@ static inline void print_pmic_info_and_debug(void)
*/
int pmic_ddr_power_init(enum ddr_type ddr_type);
/*
* pmic_voltages_init - Update voltages for platform init
*
* Returns 0 on success, and negative values on errors
*/
int pmic_voltages_init(void);
#endif /* STM32MP_PMIC_H */