aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHaojian Zhuang <haojian.zhuang@marvell.com>2010-04-29 13:33:50 -0400
committerLiam Girdwood <lrg@slimlogic.co.uk>2010-05-25 05:16:02 -0400
commit192bbb95ca16f2b4d4383e76b3262672e6116daa (patch)
tree1e090809827018c4a7d4f9dfcd6a97e3ab08c106
parentd4033b54fc91221b13e2850bf298683c0f2ff37d (diff)
regulator: make 88pm860x sharing one driver structure
Remove a lot of driver structures in 88pm860x driver. Make regulators share one driver structure. Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
-rw-r--r--drivers/mfd/88pm860x-core.c34
-rw-r--r--drivers/regulator/88pm8607.c51
2 files changed, 27 insertions, 58 deletions
diff --git a/drivers/mfd/88pm860x-core.c b/drivers/mfd/88pm860x-core.c
index 6a14d2b1ccf0..21de38daf948 100644
--- a/drivers/mfd/88pm860x-core.c
+++ b/drivers/mfd/88pm860x-core.c
@@ -176,30 +176,30 @@ static struct resource regulator_resources[] = {
176 PM8607_REG_RESOURCE(LDO14, LDO14), 176 PM8607_REG_RESOURCE(LDO14, LDO14),
177}; 177};
178 178
179#define PM8607_REG_DEVS(_name, _id) \ 179#define PM8607_REG_DEVS(_id) \
180{ \ 180{ \
181 .name = "88pm8607-" #_name, \ 181 .name = "88pm860x-regulator", \
182 .num_resources = 1, \ 182 .num_resources = 1, \
183 .resources = &regulator_resources[PM8607_ID_##_id], \ 183 .resources = &regulator_resources[PM8607_ID_##_id], \
184 .id = PM8607_ID_##_id, \ 184 .id = PM8607_ID_##_id, \
185} 185}
186 186
187static struct mfd_cell regulator_devs[] = { 187static struct mfd_cell regulator_devs[] = {
188 PM8607_REG_DEVS(buck1, BUCK1), 188 PM8607_REG_DEVS(BUCK1),
189 PM8607_REG_DEVS(buck2, BUCK2), 189 PM8607_REG_DEVS(BUCK2),
190 PM8607_REG_DEVS(buck3, BUCK3), 190 PM8607_REG_DEVS(BUCK3),
191 PM8607_REG_DEVS(ldo1, LDO1), 191 PM8607_REG_DEVS(LDO1),
192 PM8607_REG_DEVS(ldo2, LDO2), 192 PM8607_REG_DEVS(LDO2),
193 PM8607_REG_DEVS(ldo3, LDO3), 193 PM8607_REG_DEVS(LDO3),
194 PM8607_REG_DEVS(ldo4, LDO4), 194 PM8607_REG_DEVS(LDO4),
195 PM8607_REG_DEVS(ldo5, LDO5), 195 PM8607_REG_DEVS(LDO5),
196 PM8607_REG_DEVS(ldo6, LDO6), 196 PM8607_REG_DEVS(LDO6),
197 PM8607_REG_DEVS(ldo7, LDO7), 197 PM8607_REG_DEVS(LDO7),
198 PM8607_REG_DEVS(ldo8, LDO8), 198 PM8607_REG_DEVS(LDO8),
199 PM8607_REG_DEVS(ldo9, LDO9), 199 PM8607_REG_DEVS(LDO9),
200 PM8607_REG_DEVS(ldo10, LDO10), 200 PM8607_REG_DEVS(LDO10),
201 PM8607_REG_DEVS(ldo12, LDO12), 201 PM8607_REG_DEVS(LDO12),
202 PM8607_REG_DEVS(ldo14, LDO14), 202 PM8607_REG_DEVS(LDO14),
203}; 203};
204 204
205struct pm860x_irq_data { 205struct pm860x_irq_data {
diff --git a/drivers/regulator/88pm8607.c b/drivers/regulator/88pm8607.c
index 5fb83e2ced25..121bab4c0dc0 100644
--- a/drivers/regulator/88pm8607.c
+++ b/drivers/regulator/88pm8607.c
@@ -484,60 +484,29 @@ static int __devexit pm8607_regulator_remove(struct platform_device *pdev)
484{ 484{
485 struct pm8607_regulator_info *info = platform_get_drvdata(pdev); 485 struct pm8607_regulator_info *info = platform_get_drvdata(pdev);
486 486
487 platform_set_drvdata(pdev, NULL);
487 regulator_unregister(info->regulator); 488 regulator_unregister(info->regulator);
488 return 0; 489 return 0;
489} 490}
490 491
491#define PM8607_REGULATOR_DRIVER(_name) \ 492static struct platform_driver pm8607_regulator_driver = {
492{ \ 493 .driver = {
493 .driver = { \ 494 .name = "88pm860x-regulator",
494 .name = "88pm8607-" #_name, \ 495 .owner = THIS_MODULE,
495 .owner = THIS_MODULE, \ 496 },
496 }, \ 497 .probe = pm8607_regulator_probe,
497 .probe = pm8607_regulator_probe, \ 498 .remove = __devexit_p(pm8607_regulator_remove),
498 .remove = __devexit_p(pm8607_regulator_remove), \
499}
500
501static struct platform_driver pm8607_regulator_driver[] = {
502 PM8607_REGULATOR_DRIVER(buck1),
503 PM8607_REGULATOR_DRIVER(buck2),
504 PM8607_REGULATOR_DRIVER(buck3),
505 PM8607_REGULATOR_DRIVER(ldo1),
506 PM8607_REGULATOR_DRIVER(ldo2),
507 PM8607_REGULATOR_DRIVER(ldo3),
508 PM8607_REGULATOR_DRIVER(ldo4),
509 PM8607_REGULATOR_DRIVER(ldo5),
510 PM8607_REGULATOR_DRIVER(ldo6),
511 PM8607_REGULATOR_DRIVER(ldo7),
512 PM8607_REGULATOR_DRIVER(ldo8),
513 PM8607_REGULATOR_DRIVER(ldo9),
514 PM8607_REGULATOR_DRIVER(ldo10),
515 PM8607_REGULATOR_DRIVER(ldo12),
516 PM8607_REGULATOR_DRIVER(ldo14),
517}; 499};
518 500
519static int __init pm8607_regulator_init(void) 501static int __init pm8607_regulator_init(void)
520{ 502{
521 int i, count, ret; 503 return platform_driver_register(&pm8607_regulator_driver);
522
523 count = ARRAY_SIZE(pm8607_regulator_driver);
524 for (i = 0; i < count; i++) {
525 ret = platform_driver_register(&pm8607_regulator_driver[i]);
526 if (ret != 0)
527 pr_err("Failed to register regulator driver: %d\n",
528 ret);
529 }
530 return 0;
531} 504}
532subsys_initcall(pm8607_regulator_init); 505subsys_initcall(pm8607_regulator_init);
533 506
534static void __exit pm8607_regulator_exit(void) 507static void __exit pm8607_regulator_exit(void)
535{ 508{
536 int i, count; 509 platform_driver_unregister(&pm8607_regulator_driver);
537
538 count = ARRAY_SIZE(pm8607_regulator_driver);
539 for (i = 0; i < count; i++)
540 platform_driver_unregister(&pm8607_regulator_driver[i]);
541} 510}
542module_exit(pm8607_regulator_exit); 511module_exit(pm8607_regulator_exit);
543 512