From 7fa815c92967f26a7c9af33776677015013e18d0 Mon Sep 17 00:00:00 2001 From: Rene Colato Date: Wed, 14 May 2025 15:56:30 -0400 Subject: [PATCH] regulator: Updated function call use flag that initalizes GPIO. Fixes bug where GPIO_ACTIVE_LOW would not initialize properly. Signed-off-by: Rene Colato --- drivers/regulator/regulator_fixed.c | 11 ++++++++++- dts/bindings/regulator/regulator-fixed.yaml | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/regulator/regulator_fixed.c b/drivers/regulator/regulator_fixed.c index cc5170b1695..f56ab01d8d3 100644 --- a/drivers/regulator/regulator_fixed.c +++ b/drivers/regulator/regulator_fixed.c @@ -84,6 +84,7 @@ static DEVICE_API(regulator, regulator_fixed_api) = { static int regulator_fixed_init(const struct device *dev) { const struct regulator_fixed_config *cfg = dev->config; + bool is_enabled = false; regulator_common_data_init(dev); @@ -98,9 +99,17 @@ static int regulator_fixed_init(const struct device *dev) if (ret < 0) { 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) \ diff --git a/dts/bindings/regulator/regulator-fixed.yaml b/dts/bindings/regulator/regulator-fixed.yaml index 4f3236d8c6c..0887c6f10b2 100644 --- a/dts/bindings/regulator/regulator-fixed.yaml +++ b/dts/bindings/regulator/regulator-fixed.yaml @@ -10,6 +10,7 @@ include: property-allowlist: - regulator-name - regulator-boot-on + - regulator-boot-off - regulator-always-on - regulator-min-microvolt - regulator-max-microvolt