drivers: regulator: support regulator-boot-on for PMIC driver
Add support for regulator-boot-on to PMIC driver. Many PMIC devices will be enabled at boot, so this property allows the regulator framework to correctly track their state. Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
This commit is contained in:
parent
f10ec43808
commit
842ee0acf3
4 changed files with 23 additions and 4 deletions
|
@ -191,6 +191,7 @@ arduino_serial: &flexcomm12 {
|
|||
enable-val = <PCA9420_MODECFG_2_SW1_EN_VAL>;
|
||||
min-uV = <500000>;
|
||||
max-uV = <1800000>;
|
||||
regulator-boot-on;
|
||||
};
|
||||
|
||||
pca9420_sw2: sw2_buck {
|
||||
|
@ -207,6 +208,7 @@ arduino_serial: &flexcomm12 {
|
|||
enable-val = <PCA9420_MODECFG_2_SW2_EN_VAL>;
|
||||
min-uV = <1500000>;
|
||||
max-uV = <3300000>;
|
||||
regulator-boot-on;
|
||||
};
|
||||
|
||||
pca9420_ldo1: ldo1_reg {
|
||||
|
@ -223,6 +225,7 @@ arduino_serial: &flexcomm12 {
|
|||
enable-val = <PCA9420_MODECFG_2_LDO1_EN_VAL>;
|
||||
min-uV = <1700000>;
|
||||
max-uV = <1900000>;
|
||||
regulator-boot-on;
|
||||
};
|
||||
|
||||
pca9420_ldo2: ldo2_reg {
|
||||
|
@ -239,6 +242,7 @@ arduino_serial: &flexcomm12 {
|
|||
enable-val = <PCA9420_MODECFG_2_LDO2_EN_VAL>;
|
||||
min-uV = <1500000>;
|
||||
max-uV = <3300000>;
|
||||
regulator-boot-on;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -265,6 +265,7 @@ i2s1: &flexcomm3 {
|
|||
enable-val = <PCA9420_MODECFG_2_SW1_EN_VAL>;
|
||||
min-uV = <500000>;
|
||||
max-uV = <1800000>;
|
||||
regulator-boot-on;
|
||||
};
|
||||
|
||||
pca9420_sw2: sw2_buck {
|
||||
|
@ -281,6 +282,7 @@ i2s1: &flexcomm3 {
|
|||
enable-val = <PCA9420_MODECFG_2_SW2_EN_VAL>;
|
||||
min-uV = <1500000>;
|
||||
max-uV = <3300000>;
|
||||
regulator-boot-on;
|
||||
};
|
||||
|
||||
pca9420_ldo1: ldo1_reg {
|
||||
|
@ -297,6 +299,7 @@ i2s1: &flexcomm3 {
|
|||
enable-val = <PCA9420_MODECFG_2_LDO1_EN_VAL>;
|
||||
min-uV = <1700000>;
|
||||
max-uV = <1900000>;
|
||||
regulator-boot-on;
|
||||
};
|
||||
|
||||
pca9420_ldo2: ldo2_reg {
|
||||
|
@ -313,6 +316,7 @@ i2s1: &flexcomm3 {
|
|||
enable-val = <PCA9420_MODECFG_2_LDO2_EN_VAL>;
|
||||
min-uV = <1500000>;
|
||||
max-uV = <3300000>;
|
||||
regulator-boot-on;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ struct regulator_config {
|
|||
uint8_t enable_mask;
|
||||
uint8_t enable_val;
|
||||
bool enable_inverted;
|
||||
bool boot_on;
|
||||
uint8_t ilim_reg;
|
||||
uint8_t ilim_mask;
|
||||
struct i2c_dt_spec i2c;
|
||||
|
@ -502,6 +503,7 @@ static int pmic_reg_init(const struct device *dev)
|
|||
{
|
||||
const struct regulator_config *config = dev->config;
|
||||
struct regulator_data *data = dev->data;
|
||||
int rc = 0;
|
||||
|
||||
/* Cast the voltage array set at compile time to the voltage range
|
||||
* struct
|
||||
|
@ -513,10 +515,13 @@ static int pmic_reg_init(const struct device *dev)
|
|||
if (!device_is_ready(config->i2c.bus)) {
|
||||
return -ENODEV;
|
||||
}
|
||||
if (config->initial_mode) {
|
||||
return regulator_set_mode(dev, config->initial_mode);
|
||||
if (config->boot_on) {
|
||||
rc = enable_regulator(dev, NULL);
|
||||
}
|
||||
return 0;
|
||||
if (config->initial_mode) {
|
||||
rc = regulator_set_mode(dev, config->initial_mode);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
|
@ -554,6 +559,7 @@ static const struct regulator_driver_api api = {
|
|||
.ilim_reg = DT_PROP_OR(node, ilim_reg, 0), \
|
||||
.ilim_mask = DT_PROP_OR(node, ilim_mask, 0), \
|
||||
.enable_inverted = DT_PROP(node, enable_inverted), \
|
||||
.boot_on = DT_PROP_OR(node, regulator_boot_on, false), \
|
||||
.num_modes = ARRAY_SIZE(pmic_reg_##ord##_allowed_modes), \
|
||||
.initial_mode = DT_PROP_OR(DT_PARENT(node), regulator_initial_mode, 0), \
|
||||
.i2c = I2C_DT_SPEC_GET(DT_PARENT(node)), \
|
||||
|
|
|
@ -3,10 +3,11 @@
|
|||
|
||||
description: PMIC controlled regulator
|
||||
|
||||
include: regulator.yaml
|
||||
|
||||
compatible: "regulator-pmic"
|
||||
|
||||
include: base.yaml
|
||||
|
||||
properties:
|
||||
regulator-initial-mode:
|
||||
type: int
|
||||
|
@ -38,6 +39,10 @@ properties:
|
|||
to the modesel-reg.
|
||||
|
||||
child-binding:
|
||||
include:
|
||||
- name: regulator.yaml
|
||||
property-allowlist:
|
||||
- regulator-boot-on
|
||||
description: Voltage output of PMIC controller regulator
|
||||
properties:
|
||||
voltage-range:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue