Commit ce938001 authored by Charles Keepax's avatar Charles Keepax Committed by Mark Brown

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: 1de3821a ("regulator: Set ena_gpio_initialized in regulator drivers")
Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 33aa3800
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_gpio.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/regulator/driver.h> #include <linux/regulator/driver.h>
#include <linux/regulator/machine.h> #include <linux/regulator/machine.h>
...@@ -189,13 +190,22 @@ static int arizona_ldo1_of_get_pdata(struct arizona *arizona, ...@@ -189,13 +190,22 @@ static int arizona_ldo1_of_get_pdata(struct arizona *arizona,
{ {
struct arizona_pdata *pdata = &arizona->pdata; struct arizona_pdata *pdata = &arizona->pdata;
struct arizona_ldo1 *ldo1 = config->driver_data; struct arizona_ldo1 *ldo1 = config->driver_data;
struct device_node *np = arizona->dev->of_node;
struct device_node *init_node, *dcvdd_node; struct device_node *init_node, *dcvdd_node;
struct regulator_init_data *init_data; struct regulator_init_data *init_data;
pdata->ldoena = arizona_of_get_named_gpio(arizona, "wlf,ldoena", true); pdata->ldoena = of_get_named_gpio(np, "wlf,ldoena", 0);
if (pdata->ldoena < 0) {
dev_warn(arizona->dev,
"LDOENA GPIO property missing/malformed: %d\n",
pdata->ldoena);
pdata->ldoena = 0;
} else {
config->ena_gpio_initialized = true;
}
init_node = of_get_child_by_name(arizona->dev->of_node, "ldo1"); init_node = of_get_child_by_name(np, "ldo1");
dcvdd_node = of_parse_phandle(arizona->dev->of_node, "DCVDD-supply", 0); dcvdd_node = of_parse_phandle(np, "DCVDD-supply", 0);
if (init_node) { if (init_node) {
config->of_node = init_node; config->of_node = init_node;
...@@ -274,8 +284,6 @@ static int arizona_ldo1_probe(struct platform_device *pdev) ...@@ -274,8 +284,6 @@ static int arizona_ldo1_probe(struct platform_device *pdev)
ret = arizona_ldo1_of_get_pdata(arizona, &config, desc); ret = arizona_ldo1_of_get_pdata(arizona, &config, desc);
if (ret < 0) if (ret < 0)
return ret; return ret;
config.ena_gpio_initialized = true;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment