Skip to content

Commit d1dae72

Browse files
committed
regulator: max77686: Fix shared GPIOs
This reverts commit c89c00e "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>
1 parent ba08799 commit d1dae72

1 file changed

Lines changed: 7 additions & 12 deletions

File tree

‎drivers/regulator/max77686-regulator.c‎

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
#include <linux/kernel.h>
2626
#include <linux/bug.h>
2727
#include <linux/err.h>
28-
#include <linux/gpio/consumer.h>
28+
#include <linux/gpio.h>
29+
#include <linux/of_gpio.h>
2930
#include <linux/slab.h>
3031
#include <linux/platform_device.h>
3132
#include <linux/regulator/driver.h>
@@ -89,7 +90,6 @@ enum max77686_ramp_rate {
8990
};
9091

9192
struct max77686_data {
92-
struct device *dev;
9393
DECLARE_BITMAP(gpio_enabled, MAX77686_REGULATORS);
9494

9595
/* Array indexed by regulator id */
@@ -269,20 +269,16 @@ static int max77686_of_parse_cb(struct device_node *np,
269269
case MAX77686_BUCK8:
270270
case MAX77686_BUCK9:
271271
case MAX77686_LDO20 ... MAX77686_LDO22:
272-
config->ena_gpiod = devm_gpiod_get_from_of_node(max77686->dev,
273-
np,
274-
"maxim,ena",
275-
0,
276-
GPIOD_OUT_HIGH,
277-
"max77686-regulator");
278-
if (IS_ERR(config->ena_gpiod))
279-
config->ena_gpiod = NULL;
272+
config->ena_gpio = of_get_named_gpio(np,
273+
"maxim,ena-gpios", 0);
274+
config->ena_gpio_flags = GPIOF_OUT_INIT_HIGH;
275+
config->ena_gpio_initialized = true;
280276
break;
281277
default:
282278
return 0;
283279
}
284280

285-
if (config->ena_gpiod) {
281+
if (gpio_is_valid(config->ena_gpio)) {
286282
set_bit(desc->id, max77686->gpio_enabled);
287283

288284
return regmap_update_bits(config->regmap, desc->enable_reg,
@@ -525,7 +521,6 @@ static int max77686_pmic_probe(struct platform_device *pdev)
525521
if (!max77686)
526522
return -ENOMEM;
527523

528-
max77686->dev = &pdev->dev;
529524
config.dev = iodev->dev;
530525
config.regmap = iodev->regmap;
531526
config.driver_data = max77686;

0 commit comments

Comments
 (0)