diff --git a/boards/arm/mimxrt595_evk/mimxrt595_evk_cm33.dts b/boards/arm/mimxrt595_evk/mimxrt595_evk_cm33.dts index c1f59480f75..5687606fd89 100644 --- a/boards/arm/mimxrt595_evk/mimxrt595_evk_cm33.dts +++ b/boards/arm/mimxrt595_evk/mimxrt595_evk_cm33.dts @@ -191,6 +191,7 @@ arduino_serial: &flexcomm12 { enable-val = ; min-uV = <500000>; max-uV = <1800000>; + regulator-boot-on; }; pca9420_sw2: sw2_buck { @@ -207,6 +208,7 @@ arduino_serial: &flexcomm12 { enable-val = ; min-uV = <1500000>; max-uV = <3300000>; + regulator-boot-on; }; pca9420_ldo1: ldo1_reg { @@ -223,6 +225,7 @@ arduino_serial: &flexcomm12 { enable-val = ; min-uV = <1700000>; max-uV = <1900000>; + regulator-boot-on; }; pca9420_ldo2: ldo2_reg { @@ -239,6 +242,7 @@ arduino_serial: &flexcomm12 { enable-val = ; min-uV = <1500000>; max-uV = <3300000>; + regulator-boot-on; }; diff --git a/boards/arm/mimxrt685_evk/mimxrt685_evk_cm33.dts b/boards/arm/mimxrt685_evk/mimxrt685_evk_cm33.dts index 6ec0aac8b7d..8cb5d018058 100644 --- a/boards/arm/mimxrt685_evk/mimxrt685_evk_cm33.dts +++ b/boards/arm/mimxrt685_evk/mimxrt685_evk_cm33.dts @@ -265,6 +265,7 @@ i2s1: &flexcomm3 { enable-val = ; min-uV = <500000>; max-uV = <1800000>; + regulator-boot-on; }; pca9420_sw2: sw2_buck { @@ -281,6 +282,7 @@ i2s1: &flexcomm3 { enable-val = ; min-uV = <1500000>; max-uV = <3300000>; + regulator-boot-on; }; pca9420_ldo1: ldo1_reg { @@ -297,6 +299,7 @@ i2s1: &flexcomm3 { enable-val = ; min-uV = <1700000>; max-uV = <1900000>; + regulator-boot-on; }; pca9420_ldo2: ldo2_reg { @@ -313,6 +316,7 @@ i2s1: &flexcomm3 { enable-val = ; min-uV = <1500000>; max-uV = <3300000>; + regulator-boot-on; }; diff --git a/drivers/regulator/regulator_pmic.c b/drivers/regulator/regulator_pmic.c index 4c079fa2a48..d3de8c9b078 100644 --- a/drivers/regulator/regulator_pmic.c +++ b/drivers/regulator/regulator_pmic.c @@ -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)), \ diff --git a/dts/bindings/regulator/regulator-pmic.yaml b/dts/bindings/regulator/regulator-pmic.yaml index d054427bcca..567a71bba6a 100644 --- a/dts/bindings/regulator/regulator-pmic.yaml +++ b/dts/bindings/regulator/regulator-pmic.yaml @@ -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: