Skip to contentSkip to conversation

regulator: arizona-ldo1: Mark as always-on if no LDOENA

PATCH In review Richard Fitzgerald 2 participants 2 messages Apr 21, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 regulator: arizona-ldo1: Mark as always-on if no LDOENA

If we don't have a GPIO for LDOENA it's impossible to turn the LDO1 regulator off so mark it as always-on.

---
 drivers/regulator/arizona-ldo1.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/regulator/arizona-ldo1.c +10 -3
index f7c88ff..cc62ea2 100644
@@ -290,9 +290,9 @@ static int arizona_ldo1_probe(struct platform_device *pdev)
 	config.ena_gpio = arizona->pdata.ldoena;
 
 	if (arizona->pdata.ldo1)
-		config.init_data = arizona->pdata.ldo1;
-	else
-		config.init_data = &ldo1->init_data;
+		ldo1->init_data = *arizona->pdata.ldo1;
+
+	config.init_data = &ldo1->init_data;
 
 	/*
 	 * LDO1 can only be used to supply DCVDD so if it has no
@@ -301,6 +301,13 @@ static int arizona_ldo1_probe(struct platform_device *pdev)
 	if (config.init_data->num_consumer_supplies == 0)
 		arizona->external_dcvdd = true;
 
+	if (!arizona->external_dcvdd && (config.ena_gpio == 0) &&
+	    !config.ena_gpio_initialized) {
+		dev_warn(arizona->dev,
+			 "No LDOENA: regulator will be always-on\n");
+		ldo1->init_data.constraints.always_on = true;
+	}
+
 	ldo1->regulator = devm_regulator_register(&pdev->dev, desc, &config);
 
 	of_node_put(config.of_node);
Signature · 1 line
1.9.1
maintainer
#1 lore raw
Quoted 2 lines · Richard Fitzgerald

If we don't have a GPIO for LDOENA it's impossible to turn the LDO1 regulator off so mark it as always-on.

If there is no enable control method for the regulator this should be redundant. If that's not the case you should fix that.