Commit a8afa92e authored by Mark Brown's avatar Mark Brown

Merge branch 'regulator-4.18' into regulator-linus

parents 1ffaddd0 a9191579
...@@ -36,6 +36,8 @@ struct arizona_ldo1 { ...@@ -36,6 +36,8 @@ struct arizona_ldo1 {
struct regulator_consumer_supply supply; struct regulator_consumer_supply supply;
struct regulator_init_data init_data; struct regulator_init_data init_data;
struct gpio_desc *ena_gpiod;
}; };
static int arizona_ldo1_hc_list_voltage(struct regulator_dev *rdev, static int arizona_ldo1_hc_list_voltage(struct regulator_dev *rdev,
...@@ -253,12 +255,17 @@ static int arizona_ldo1_common_init(struct platform_device *pdev, ...@@ -253,12 +255,17 @@ static int arizona_ldo1_common_init(struct platform_device *pdev,
} }
} }
/* We assume that high output = regulator off */ /* We assume that high output = regulator off
config.ena_gpiod = devm_gpiod_get_optional(&pdev->dev, "wlf,ldoena", * Don't use devm, since we need to get against the parent device
GPIOD_OUT_HIGH); * so clean up would happen at the wrong time
*/
config.ena_gpiod = gpiod_get_optional(parent_dev, "wlf,ldoena",
GPIOD_OUT_LOW);
if (IS_ERR(config.ena_gpiod)) if (IS_ERR(config.ena_gpiod))
return PTR_ERR(config.ena_gpiod); return PTR_ERR(config.ena_gpiod);
ldo1->ena_gpiod = config.ena_gpiod;
if (pdata->init_data) if (pdata->init_data)
config.init_data = pdata->init_data; config.init_data = pdata->init_data;
else else
...@@ -276,6 +283,9 @@ static int arizona_ldo1_common_init(struct platform_device *pdev, ...@@ -276,6 +283,9 @@ static int arizona_ldo1_common_init(struct platform_device *pdev,
of_node_put(config.of_node); of_node_put(config.of_node);
if (IS_ERR(ldo1->regulator)) { if (IS_ERR(ldo1->regulator)) {
if (config.ena_gpiod)
gpiod_put(config.ena_gpiod);
ret = PTR_ERR(ldo1->regulator); ret = PTR_ERR(ldo1->regulator);
dev_err(&pdev->dev, "Failed to register LDO1 supply: %d\n", dev_err(&pdev->dev, "Failed to register LDO1 supply: %d\n",
ret); ret);
...@@ -334,8 +344,19 @@ static int arizona_ldo1_probe(struct platform_device *pdev) ...@@ -334,8 +344,19 @@ static int arizona_ldo1_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int arizona_ldo1_remove(struct platform_device *pdev)
{
struct arizona_ldo1 *ldo1 = platform_get_drvdata(pdev);
if (ldo1->ena_gpiod)
gpiod_put(ldo1->ena_gpiod);
return 0;
}
static struct platform_driver arizona_ldo1_driver = { static struct platform_driver arizona_ldo1_driver = {
.probe = arizona_ldo1_probe, .probe = arizona_ldo1_probe,
.remove = arizona_ldo1_remove,
.driver = { .driver = {
.name = "arizona-ldo1", .name = "arizona-ldo1",
}, },
......
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