diff options
-rw-r--r-- | drivers/regulator/hi6421-regulator.c | 31 |
1 files changed, 4 insertions, 27 deletions
diff --git a/drivers/regulator/hi6421-regulator.c b/drivers/regulator/hi6421-regulator.c index b0de92bee4a2..e3899201cd7e 100644 --- a/drivers/regulator/hi6421-regulator.c +++ b/drivers/regulator/hi6421-regulator.c | |||
@@ -17,19 +17,13 @@ | |||
17 | #include <linux/device.h> | 17 | #include <linux/device.h> |
18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
19 | #include <linux/err.h> | 19 | #include <linux/err.h> |
20 | #include <linux/io.h> | ||
21 | #include <linux/jiffies.h> | ||
22 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
23 | #include <linux/of.h> | 21 | #include <linux/of.h> |
24 | #include <linux/of_device.h> | ||
25 | #include <linux/of_address.h> | ||
26 | #include <linux/regmap.h> | 22 | #include <linux/regmap.h> |
27 | #include <linux/regulator/driver.h> | 23 | #include <linux/regulator/driver.h> |
28 | #include <linux/regulator/machine.h> | 24 | #include <linux/regulator/machine.h> |
29 | #include <linux/regulator/of_regulator.h> | 25 | #include <linux/regulator/of_regulator.h> |
30 | #include <linux/mfd/hi6421-pmic.h> | 26 | #include <linux/mfd/hi6421-pmic.h> |
31 | #include <linux/delay.h> | ||
32 | #include <linux/time.h> | ||
33 | 27 | ||
34 | /* | 28 | /* |
35 | * struct hi6421_regulator_pdata - Hi6421 regulator data of platform device | 29 | * struct hi6421_regulator_pdata - Hi6421 regulator data of platform device |
@@ -41,20 +35,14 @@ struct hi6421_regulator_pdata { | |||
41 | 35 | ||
42 | /* | 36 | /* |
43 | * struct hi6421_regulator_info - hi6421 regulator information | 37 | * struct hi6421_regulator_info - hi6421 regulator information |
44 | * @dev: device pointer | ||
45 | * @desc: regulator description | 38 | * @desc: regulator description |
46 | * @regulator: regulator device | ||
47 | * @mode_mask: ECO mode bitmask of LDOs; for BUCKs, this masks sleep | 39 | * @mode_mask: ECO mode bitmask of LDOs; for BUCKs, this masks sleep |
48 | * @eco_microamp: eco mode load upper limit (in mA), valid for LDOs only | 40 | * @eco_microamp: eco mode load upper limit (in mA), valid for LDOs only |
49 | * @valid_modes_mask: valid operating modes | ||
50 | */ | 41 | */ |
51 | struct hi6421_regulator_info { | 42 | struct hi6421_regulator_info { |
52 | struct device *dev; | ||
53 | struct regulator_desc desc; | 43 | struct regulator_desc desc; |
54 | struct regulator_dev *regulator; | ||
55 | u8 mode_mask; | 44 | u8 mode_mask; |
56 | u32 eco_microamp; | 45 | u32 eco_microamp; |
57 | unsigned int valid_modes_mask; | ||
58 | }; | 46 | }; |
59 | 47 | ||
60 | /* HI6421 regulators */ | 48 | /* HI6421 regulators */ |
@@ -198,8 +186,6 @@ static const struct regulator_ops hi6421_buck345_ops; | |||
198 | }, \ | 186 | }, \ |
199 | .mode_mask = ecomask, \ | 187 | .mode_mask = ecomask, \ |
200 | .eco_microamp = ecoamp, \ | 188 | .eco_microamp = ecoamp, \ |
201 | .valid_modes_mask = (REGULATOR_MODE_NORMAL \ | ||
202 | | REGULATOR_MODE_IDLE), \ | ||
203 | } | 189 | } |
204 | 190 | ||
205 | /* HI6421 LDO1~3 are linear voltage regulators at fixed uV_step | 191 | /* HI6421 LDO1~3 are linear voltage regulators at fixed uV_step |
@@ -237,8 +223,6 @@ static const struct regulator_ops hi6421_buck345_ops; | |||
237 | }, \ | 223 | }, \ |
238 | .mode_mask = ecomask, \ | 224 | .mode_mask = ecomask, \ |
239 | .eco_microamp = ecoamp, \ | 225 | .eco_microamp = ecoamp, \ |
240 | .valid_modes_mask = (REGULATOR_MODE_NORMAL \ | ||
241 | | REGULATOR_MODE_IDLE), \ | ||
242 | } | 226 | } |
243 | 227 | ||
244 | /* HI6421 LDOAUDIO is a linear voltage regulator with two 4-step ranges | 228 | /* HI6421 LDOAUDIO is a linear voltage regulator with two 4-step ranges |
@@ -276,8 +260,6 @@ static const struct regulator_ops hi6421_buck345_ops; | |||
276 | }, \ | 260 | }, \ |
277 | .mode_mask = ecomask, \ | 261 | .mode_mask = ecomask, \ |
278 | .eco_microamp = ecoamp, \ | 262 | .eco_microamp = ecoamp, \ |
279 | .valid_modes_mask = (REGULATOR_MODE_NORMAL \ | ||
280 | | REGULATOR_MODE_IDLE), \ | ||
281 | } | 263 | } |
282 | 264 | ||
283 | /* HI6421 BUCK0/1/2 are linear voltage regulators at fixed uV_step | 265 | /* HI6421 BUCK0/1/2 are linear voltage regulators at fixed uV_step |
@@ -311,8 +293,6 @@ static const struct regulator_ops hi6421_buck345_ops; | |||
311 | .off_on_delay = odelay, \ | 293 | .off_on_delay = odelay, \ |
312 | }, \ | 294 | }, \ |
313 | .mode_mask = sleepmask, \ | 295 | .mode_mask = sleepmask, \ |
314 | .valid_modes_mask = (REGULATOR_MODE_NORMAL \ | ||
315 | | REGULATOR_MODE_STANDBY), \ | ||
316 | } | 296 | } |
317 | 297 | ||
318 | /* HI6421 BUCK3/4/5 share similar configurations as LDOs, with exception | 298 | /* HI6421 BUCK3/4/5 share similar configurations as LDOs, with exception |
@@ -346,8 +326,6 @@ static const struct regulator_ops hi6421_buck345_ops; | |||
346 | .off_on_delay = odelay, \ | 326 | .off_on_delay = odelay, \ |
347 | }, \ | 327 | }, \ |
348 | .mode_mask = sleepmask, \ | 328 | .mode_mask = sleepmask, \ |
349 | .valid_modes_mask = (REGULATOR_MODE_NORMAL \ | ||
350 | | REGULATOR_MODE_STANDBY), \ | ||
351 | } | 329 | } |
352 | 330 | ||
353 | /* HI6421 regulator information */ | 331 | /* HI6421 regulator information */ |
@@ -580,10 +558,10 @@ static int hi6421_regulator_register(struct platform_device *pdev, | |||
580 | { | 558 | { |
581 | struct hi6421_regulator_info *info = NULL; | 559 | struct hi6421_regulator_info *info = NULL; |
582 | struct regulator_config config = { }; | 560 | struct regulator_config config = { }; |
561 | struct regulator_dev *rdev; | ||
583 | 562 | ||
584 | /* assign per-regulator data */ | 563 | /* assign per-regulator data */ |
585 | info = &hi6421_regulator_info[id]; | 564 | info = &hi6421_regulator_info[id]; |
586 | info->dev = &pdev->dev; | ||
587 | 565 | ||
588 | config.dev = &pdev->dev; | 566 | config.dev = &pdev->dev; |
589 | config.init_data = init_data; | 567 | config.init_data = init_data; |
@@ -592,12 +570,11 @@ static int hi6421_regulator_register(struct platform_device *pdev, | |||
592 | config.of_node = np; | 570 | config.of_node = np; |
593 | 571 | ||
594 | /* register regulator with framework */ | 572 | /* register regulator with framework */ |
595 | info->regulator = devm_regulator_register(&pdev->dev, &info->desc, | 573 | rdev = devm_regulator_register(&pdev->dev, &info->desc, &config); |
596 | &config); | 574 | if (IS_ERR(rdev)) { |
597 | if (IS_ERR(info->regulator)) { | ||
598 | dev_err(&pdev->dev, "failed to register regulator %s\n", | 575 | dev_err(&pdev->dev, "failed to register regulator %s\n", |
599 | info->desc.name); | 576 | info->desc.name); |
600 | return PTR_ERR(info->regulator); | 577 | return PTR_ERR(rdev); |
601 | } | 578 | } |
602 | 579 | ||
603 | return 0; | 580 | return 0; |