summaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2018-05-30 15:15:20 +0100
committerMark Brown <broonie@kernel.org>2018-05-30 15:17:03 +0100
commitab4d11e2c2329cf7cb7be31ff22489aae4dee5dc (patch)
treeadf82bf82855955ac9e128952de57ae2c3a9e324 /drivers/regulator
parentd1dae72fab2c377ff463742eefd8ac0f9e99b7b9 (diff)
downloadlinux-ab4d11e2c2329cf7cb7be31ff22489aae4dee5dc.tar.bz2
regulator: wm8994: Fix shared GPIOs
This reverts commit 3c6b38d45fa51c7c51 "regulator: wm8994: Pass descriptor instead of GPIO number" as it has problems with shared GPIOs similar to that on s2mps11. Reported-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/wm8994-regulator.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/regulator/wm8994-regulator.c b/drivers/regulator/wm8994-regulator.c
index d3a5f48119c2..7a4ce6df4f22 100644
--- a/drivers/regulator/wm8994-regulator.c
+++ b/drivers/regulator/wm8994-regulator.c
@@ -19,7 +19,7 @@
#include <linux/platform_device.h>
#include <linux/regulator/driver.h>
#include <linux/regulator/machine.h>
-#include <linux/gpio/consumer.h>
+#include <linux/gpio.h>
#include <linux/slab.h>
#include <linux/mfd/wm8994/core.h>
@@ -129,7 +129,6 @@ static int wm8994_ldo_probe(struct platform_device *pdev)
int id = pdev->id % ARRAY_SIZE(pdata->ldo);
struct regulator_config config = { };
struct wm8994_ldo *ldo;
- struct gpio_desc *gpiod;
int ret;
dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1);
@@ -146,14 +145,12 @@ static int wm8994_ldo_probe(struct platform_device *pdev)
config.driver_data = ldo;
config.regmap = wm8994->regmap;
config.init_data = &ldo->init_data;
-
- /* Look up LDO enable GPIO from the parent device node */
- gpiod = devm_gpiod_get_optional(pdev->dev.parent,
- id ? "wlf,ldo2ena" : "wlf,ldo1ena",
- GPIOD_OUT_LOW);
- if (IS_ERR(gpiod))
- return PTR_ERR(gpiod);
- config.ena_gpiod = gpiod;
+ if (pdata) {
+ config.ena_gpio = pdata->ldo[id].enable;
+ } else if (wm8994->dev->of_node) {
+ config.ena_gpio = wm8994->pdata.ldo[id].enable;
+ config.ena_gpio_initialized = true;
+ }
/* Use default constraints if none set up */
if (!pdata || !pdata->ldo[id].init_data || wm8994->dev->of_node) {
@@ -162,7 +159,7 @@ static int wm8994_ldo_probe(struct platform_device *pdev)
ldo->init_data = wm8994_ldo_default[id];
ldo->init_data.consumer_supplies = &ldo->supply;
- if (!gpiod)
+ if (!config.ena_gpio)
ldo->init_data.constraints.valid_ops_mask = 0;
} else {
ldo->init_data = *pdata->ldo[id].init_data;