aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2018-05-30 10:13:42 -0400
committerMark Brown <broonie@kernel.org>2018-05-30 10:17:04 -0400
commitd1dae72fab2c377ff463742eefd8ac0f9e99b7b9 (patch)
tree7b8516e84fcce2c2de6bf09af2c89d6a22194458
parentba08799e90b5935a3df20766a73b5841046f6832 (diff)
regulator: max77686: Fix shared GPIOs
This reverts commit c89c00e2b8f0 "regulator: max77686: Pass descriptor instead of GPIO number" as it has problems with shared GPIOs similar to that on s2mps11. Reported-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--drivers/regulator/max77686-regulator.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/regulator/max77686-regulator.c b/drivers/regulator/max77686-regulator.c
index 37f98a8350f0..c301f3733475 100644
--- a/drivers/regulator/max77686-regulator.c
+++ b/drivers/regulator/max77686-regulator.c
@@ -25,7 +25,8 @@
25#include <linux/kernel.h> 25#include <linux/kernel.h>
26#include <linux/bug.h> 26#include <linux/bug.h>
27#include <linux/err.h> 27#include <linux/err.h>
28#include <linux/gpio/consumer.h> 28#include <linux/gpio.h>
29#include <linux/of_gpio.h>
29#include <linux/slab.h> 30#include <linux/slab.h>
30#include <linux/platform_device.h> 31#include <linux/platform_device.h>
31#include <linux/regulator/driver.h> 32#include <linux/regulator/driver.h>
@@ -89,7 +90,6 @@ enum max77686_ramp_rate {
89}; 90};
90 91
91struct max77686_data { 92struct max77686_data {
92 struct device *dev;
93 DECLARE_BITMAP(gpio_enabled, MAX77686_REGULATORS); 93 DECLARE_BITMAP(gpio_enabled, MAX77686_REGULATORS);
94 94
95 /* Array indexed by regulator id */ 95 /* Array indexed by regulator id */
@@ -269,20 +269,16 @@ static int max77686_of_parse_cb(struct device_node *np,
269 case MAX77686_BUCK8: 269 case MAX77686_BUCK8:
270 case MAX77686_BUCK9: 270 case MAX77686_BUCK9:
271 case MAX77686_LDO20 ... MAX77686_LDO22: 271 case MAX77686_LDO20 ... MAX77686_LDO22:
272 config->ena_gpiod = devm_gpiod_get_from_of_node(max77686->dev, 272 config->ena_gpio = of_get_named_gpio(np,
273 np, 273 "maxim,ena-gpios", 0);
274 "maxim,ena", 274 config->ena_gpio_flags = GPIOF_OUT_INIT_HIGH;
275 0, 275 config->ena_gpio_initialized = true;
276 GPIOD_OUT_HIGH,
277 "max77686-regulator");
278 if (IS_ERR(config->ena_gpiod))
279 config->ena_gpiod = NULL;
280 break; 276 break;
281 default: 277 default:
282 return 0; 278 return 0;
283 } 279 }
284 280
285 if (config->ena_gpiod) { 281 if (gpio_is_valid(config->ena_gpio)) {
286 set_bit(desc->id, max77686->gpio_enabled); 282 set_bit(desc->id, max77686->gpio_enabled);
287 283
288 return regmap_update_bits(config->regmap, desc->enable_reg, 284 return regmap_update_bits(config->regmap, desc->enable_reg,
@@ -525,7 +521,6 @@ static int max77686_pmic_probe(struct platform_device *pdev)
525 if (!max77686) 521 if (!max77686)
526 return -ENOMEM; 522 return -ENOMEM;
527 523
528 max77686->dev = &pdev->dev;
529 config.dev = iodev->dev; 524 config.dev = iodev->dev;
530 config.regmap = iodev->regmap; 525 config.regmap = iodev->regmap;
531 config.driver_data = max77686; 526 config.driver_data = max77686;