diff options
author | Mark Brown <broonie@kernel.org> | 2018-08-10 12:31:22 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-08-10 12:31:22 -0400 |
commit | a8afa92ec0d9312b23fd291aa8db95da266f2d5f (patch) | |
tree | 9a7bfeee7649de881a757aaaefe0b3721088737d | |
parent | 1ffaddd029c867d134a1dde39f540dcc8c52e274 (diff) | |
parent | a9191579ba1086d91842199263e6fe6bb5eec1ba (diff) |
Merge branch 'regulator-4.18' into regulator-linus
-rw-r--r-- | drivers/regulator/arizona-ldo1.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/drivers/regulator/arizona-ldo1.c b/drivers/regulator/arizona-ldo1.c index f6d6a4ad9e8a..e976d073f28d 100644 --- a/drivers/regulator/arizona-ldo1.c +++ b/drivers/regulator/arizona-ldo1.c | |||
@@ -36,6 +36,8 @@ struct arizona_ldo1 { | |||
36 | 36 | ||
37 | struct regulator_consumer_supply supply; | 37 | struct regulator_consumer_supply supply; |
38 | struct regulator_init_data init_data; | 38 | struct regulator_init_data init_data; |
39 | |||
40 | struct gpio_desc *ena_gpiod; | ||
39 | }; | 41 | }; |
40 | 42 | ||
41 | static int arizona_ldo1_hc_list_voltage(struct regulator_dev *rdev, | 43 | 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 | } | 255 | } |
254 | } | 256 | } |
255 | 257 | ||
256 | /* We assume that high output = regulator off */ | 258 | /* We assume that high output = regulator off |
257 | config.ena_gpiod = devm_gpiod_get_optional(&pdev->dev, "wlf,ldoena", | 259 | * Don't use devm, since we need to get against the parent device |
258 | GPIOD_OUT_HIGH); | 260 | * so clean up would happen at the wrong time |
261 | */ | ||
262 | config.ena_gpiod = gpiod_get_optional(parent_dev, "wlf,ldoena", | ||
263 | GPIOD_OUT_LOW); | ||
259 | if (IS_ERR(config.ena_gpiod)) | 264 | if (IS_ERR(config.ena_gpiod)) |
260 | return PTR_ERR(config.ena_gpiod); | 265 | return PTR_ERR(config.ena_gpiod); |
261 | 266 | ||
267 | ldo1->ena_gpiod = config.ena_gpiod; | ||
268 | |||
262 | if (pdata->init_data) | 269 | if (pdata->init_data) |
263 | config.init_data = pdata->init_data; | 270 | config.init_data = pdata->init_data; |
264 | else | 271 | else |
@@ -276,6 +283,9 @@ static int arizona_ldo1_common_init(struct platform_device *pdev, | |||
276 | of_node_put(config.of_node); | 283 | of_node_put(config.of_node); |
277 | 284 | ||
278 | if (IS_ERR(ldo1->regulator)) { | 285 | if (IS_ERR(ldo1->regulator)) { |
286 | if (config.ena_gpiod) | ||
287 | gpiod_put(config.ena_gpiod); | ||
288 | |||
279 | ret = PTR_ERR(ldo1->regulator); | 289 | ret = PTR_ERR(ldo1->regulator); |
280 | dev_err(&pdev->dev, "Failed to register LDO1 supply: %d\n", | 290 | dev_err(&pdev->dev, "Failed to register LDO1 supply: %d\n", |
281 | ret); | 291 | ret); |
@@ -334,8 +344,19 @@ static int arizona_ldo1_probe(struct platform_device *pdev) | |||
334 | return ret; | 344 | return ret; |
335 | } | 345 | } |
336 | 346 | ||
347 | static int arizona_ldo1_remove(struct platform_device *pdev) | ||
348 | { | ||
349 | struct arizona_ldo1 *ldo1 = platform_get_drvdata(pdev); | ||
350 | |||
351 | if (ldo1->ena_gpiod) | ||
352 | gpiod_put(ldo1->ena_gpiod); | ||
353 | |||
354 | return 0; | ||
355 | } | ||
356 | |||
337 | static struct platform_driver arizona_ldo1_driver = { | 357 | static struct platform_driver arizona_ldo1_driver = { |
338 | .probe = arizona_ldo1_probe, | 358 | .probe = arizona_ldo1_probe, |
359 | .remove = arizona_ldo1_remove, | ||
339 | .driver = { | 360 | .driver = { |
340 | .name = "arizona-ldo1", | 361 | .name = "arizona-ldo1", |
341 | }, | 362 | }, |