aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCharles Keepax <ckeepax@opensource.wolfsonmicro.com>2015-10-15 05:37:12 -0400
committerMark Brown <broonie@kernel.org>2015-10-16 10:48:39 -0400
commitce938001c08c6580a8da38dc226fa605512afab6 (patch)
treee20a0c631e76a048767463dbba290b629235d4aa
parent33aa380006776850872914d83fe0dbeee42fc95d (diff)
regulator: arizona-ldo1: Fix handling of GPIO 0
The LDO1 driver is using the arizona_of_get_named_gpio helper function which will return 0 if an error was encountered whilst parsing the GPIO, as under the pdata scheme 0 was not being treated as a valid GPIO. However, since the regulator framework was expanded to allow the use of GPIO 0 this causes us to attempt to register GPIO 0 when we encountered an error parsing the device tree. This patch uses of_get_named_gpio directly and sets the ena_gpio_initialized flag based on the return value. Fixes: 1de3821ace82 ("regulator: Set ena_gpio_initialized in regulator drivers") Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--drivers/regulator/arizona-ldo1.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/regulator/arizona-ldo1.c b/drivers/regulator/arizona-ldo1.c
index e3c5982a66a0..f7c88ff90c43 100644
--- a/drivers/regulator/arizona-ldo1.c
+++ b/drivers/regulator/arizona-ldo1.c
@@ -17,6 +17,7 @@
17#include <linux/bitops.h> 17#include <linux/bitops.h>
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/of.h> 19#include <linux/of.h>
20#include <linux/of_gpio.h>
20#include <linux/platform_device.h> 21#include <linux/platform_device.h>
21#include <linux/regulator/driver.h> 22#include <linux/regulator/driver.h>
22#include <linux/regulator/machine.h> 23#include <linux/regulator/machine.h>
@@ -189,13 +190,22 @@ static int arizona_ldo1_of_get_pdata(struct arizona *arizona,
189{ 190{
190 struct arizona_pdata *pdata = &arizona->pdata; 191 struct arizona_pdata *pdata = &arizona->pdata;
191 struct arizona_ldo1 *ldo1 = config->driver_data; 192 struct arizona_ldo1 *ldo1 = config->driver_data;
193 struct device_node *np = arizona->dev->of_node;
192 struct device_node *init_node, *dcvdd_node; 194 struct device_node *init_node, *dcvdd_node;
193 struct regulator_init_data *init_data; 195 struct regulator_init_data *init_data;
194 196
195 pdata->ldoena = arizona_of_get_named_gpio(arizona, "wlf,ldoena", true); 197 pdata->ldoena = of_get_named_gpio(np, "wlf,ldoena", 0);
198 if (pdata->ldoena < 0) {
199 dev_warn(arizona->dev,
200 "LDOENA GPIO property missing/malformed: %d\n",
201 pdata->ldoena);
202 pdata->ldoena = 0;
203 } else {
204 config->ena_gpio_initialized = true;
205 }
196 206
197 init_node = of_get_child_by_name(arizona->dev->of_node, "ldo1"); 207 init_node = of_get_child_by_name(np, "ldo1");
198 dcvdd_node = of_parse_phandle(arizona->dev->of_node, "DCVDD-supply", 0); 208 dcvdd_node = of_parse_phandle(np, "DCVDD-supply", 0);
199 209
200 if (init_node) { 210 if (init_node) {
201 config->of_node = init_node; 211 config->of_node = init_node;
@@ -274,8 +284,6 @@ static int arizona_ldo1_probe(struct platform_device *pdev)
274 ret = arizona_ldo1_of_get_pdata(arizona, &config, desc); 284 ret = arizona_ldo1_of_get_pdata(arizona, &config, desc);
275 if (ret < 0) 285 if (ret < 0)
276 return ret; 286 return ret;
277
278 config.ena_gpio_initialized = true;
279 } 287 }
280 } 288 }
281 289