aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/regulator/core.c3
-rw-r--r--include/linux/regulator/driver.h4
2 files changed, 6 insertions, 1 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index cd87c0c37034..55a87a2722d8 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3650,7 +3650,8 @@ regulator_register(const struct regulator_desc *regulator_desc,
3650 3650
3651 dev_set_drvdata(&rdev->dev, rdev); 3651 dev_set_drvdata(&rdev->dev, rdev);
3652 3652
3653 if (config->ena_gpio && gpio_is_valid(config->ena_gpio)) { 3653 if ((config->ena_gpio || config->ena_gpio_initialized) &&
3654 gpio_is_valid(config->ena_gpio)) {
3654 ret = regulator_ena_gpio_request(rdev, config); 3655 ret = regulator_ena_gpio_request(rdev, config);
3655 if (ret != 0) { 3656 if (ret != 0) {
3656 rdev_err(rdev, "Failed to request enable GPIO%d: %d\n", 3657 rdev_err(rdev, "Failed to request enable GPIO%d: %d\n",
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index fc0ee0ce8325..28da08e4671f 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -301,6 +301,9 @@ struct regulator_desc {
301 * NULL). 301 * NULL).
302 * @regmap: regmap to use for core regmap helpers if dev_get_regulator() is 302 * @regmap: regmap to use for core regmap helpers if dev_get_regulator() is
303 * insufficient. 303 * insufficient.
304 * @ena_gpio_initialized: GPIO controlling regulator enable was properly
305 * initialized, meaning that >= 0 is a valid gpio
306 * identifier and < 0 is a non existent gpio.
304 * @ena_gpio: GPIO controlling regulator enable. 307 * @ena_gpio: GPIO controlling regulator enable.
305 * @ena_gpio_invert: Sense for GPIO enable control. 308 * @ena_gpio_invert: Sense for GPIO enable control.
306 * @ena_gpio_flags: Flags to use when calling gpio_request_one() 309 * @ena_gpio_flags: Flags to use when calling gpio_request_one()
@@ -312,6 +315,7 @@ struct regulator_config {
312 struct device_node *of_node; 315 struct device_node *of_node;
313 struct regmap *regmap; 316 struct regmap *regmap;
314 317
318 bool ena_gpio_initialized;
315 int ena_gpio; 319 int ena_gpio;
316 unsigned int ena_gpio_invert:1; 320 unsigned int ena_gpio_invert:1;
317 unsigned int ena_gpio_flags; 321 unsigned int ena_gpio_flags;