regulator: Updated function call use flag that initalizes GPIO.

Fixes bug where GPIO_ACTIVE_LOW would not initialize properly.

Signed-off-by: Rene Colato <rcolato@boston-engineering.com>
This commit is contained in:
Rene Colato 2025-05-14 15:56:30 -04:00 committed by Benjamin Cabé
commit 7fa815c929
2 changed files with 11 additions and 1 deletions

View file

@ -84,6 +84,7 @@ static DEVICE_API(regulator, regulator_fixed_api) = {
static int regulator_fixed_init(const struct device *dev) static int regulator_fixed_init(const struct device *dev)
{ {
const struct regulator_fixed_config *cfg = dev->config; const struct regulator_fixed_config *cfg = dev->config;
bool is_enabled = false;
regulator_common_data_init(dev); regulator_common_data_init(dev);
@ -98,9 +99,17 @@ static int regulator_fixed_init(const struct device *dev)
if (ret < 0) { if (ret < 0) {
return ret; return ret;
} }
ret = gpio_pin_get_dt(&cfg->enable);
if (ret < 0) {
return ret;
}
is_enabled = ret;
} }
return regulator_common_init(dev, false); return regulator_common_init(dev, is_enabled);
} }
#define REGULATOR_FIXED_DEFINE(inst) \ #define REGULATOR_FIXED_DEFINE(inst) \

View file

@ -10,6 +10,7 @@ include:
property-allowlist: property-allowlist:
- regulator-name - regulator-name
- regulator-boot-on - regulator-boot-on
- regulator-boot-off
- regulator-always-on - regulator-always-on
- regulator-min-microvolt - regulator-min-microvolt
- regulator-max-microvolt - regulator-max-microvolt