diff options
author | Bengt Jonsson <bengt.g.jonsson@stericsson.com> | 2010-12-10 05:08:40 -0500 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2011-01-12 09:33:02 -0500 |
commit | cb189b07d57b574cc14382e2130960b0a0193c23 (patch) | |
tree | 8a8d9992e9a2776830989b9acc1301a70d55e349 | |
parent | 1394fd2826afb2adf7f6c4833d36a0feba22e665 (diff) |
regulators: Moved define for number of regulators in ab8500
The define for number of regulators is moved from ab8500-core to
ab8500-regulator so that the regulator driver can be updated
independently of ab8500-core. This also changes the platform
configuration structure of ab8500-core so that it contains a
pointer to the regulator_init_data array plus number of
regulators instead of an fixed size array of pointers to
regulator_init_data.
Signed-off-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
-rw-r--r-- | drivers/regulator/ab8500.c | 8 | ||||
-rw-r--r-- | include/linux/mfd/ab8500.h | 5 | ||||
-rw-r--r-- | include/linux/regulator/ab8500.h | 24 |
3 files changed, 22 insertions, 15 deletions
diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c index 2f4ec0facef1..5670775f6c9b 100644 --- a/drivers/regulator/ab8500.c +++ b/drivers/regulator/ab8500.c | |||
@@ -370,6 +370,12 @@ static __devinit int ab8500_regulator_probe(struct platform_device *pdev) | |||
370 | } | 370 | } |
371 | pdata = dev_get_platdata(ab8500->dev); | 371 | pdata = dev_get_platdata(ab8500->dev); |
372 | 372 | ||
373 | /* make sure the platform data has the correct size */ | ||
374 | if (pdata->num_regulator != ARRAY_SIZE(ab8500_regulator_info)) { | ||
375 | dev_err(&pdev->dev, "platform configuration error\n"); | ||
376 | return -EINVAL; | ||
377 | } | ||
378 | |||
373 | /* register all regulators */ | 379 | /* register all regulators */ |
374 | for (i = 0; i < ARRAY_SIZE(ab8500_regulator_info); i++) { | 380 | for (i = 0; i < ARRAY_SIZE(ab8500_regulator_info); i++) { |
375 | struct ab8500_regulator_info *info = NULL; | 381 | struct ab8500_regulator_info *info = NULL; |
@@ -380,7 +386,7 @@ static __devinit int ab8500_regulator_probe(struct platform_device *pdev) | |||
380 | info->ab8500 = ab8500; | 386 | info->ab8500 = ab8500; |
381 | 387 | ||
382 | info->regulator = regulator_register(&info->desc, &pdev->dev, | 388 | info->regulator = regulator_register(&info->desc, &pdev->dev, |
383 | pdata->regulator[i], info); | 389 | &pdata->regulator[i], info); |
384 | if (IS_ERR(info->regulator)) { | 390 | if (IS_ERR(info->regulator)) { |
385 | err = PTR_ERR(info->regulator); | 391 | err = PTR_ERR(info->regulator); |
386 | dev_err(&pdev->dev, "failed to register regulator %s\n", | 392 | dev_err(&pdev->dev, "failed to register regulator %s\n", |
diff --git a/include/linux/mfd/ab8500.h b/include/linux/mfd/ab8500.h index d63b6050b183..85cf2c28fac6 100644 --- a/include/linux/mfd/ab8500.h +++ b/include/linux/mfd/ab8500.h | |||
@@ -99,8 +99,6 @@ | |||
99 | #define AB8500_NR_IRQS 104 | 99 | #define AB8500_NR_IRQS 104 |
100 | #define AB8500_NUM_IRQ_REGS 13 | 100 | #define AB8500_NUM_IRQ_REGS 13 |
101 | 101 | ||
102 | #define AB8500_NUM_REGULATORS 15 | ||
103 | |||
104 | /** | 102 | /** |
105 | * struct ab8500 - ab8500 internal structure | 103 | * struct ab8500 - ab8500 internal structure |
106 | * @dev: parent device | 104 | * @dev: parent device |
@@ -145,7 +143,8 @@ struct regulator_init_data; | |||
145 | struct ab8500_platform_data { | 143 | struct ab8500_platform_data { |
146 | int irq_base; | 144 | int irq_base; |
147 | void (*init) (struct ab8500 *); | 145 | void (*init) (struct ab8500 *); |
148 | struct regulator_init_data *regulator[AB8500_NUM_REGULATORS]; | 146 | int num_regulator; |
147 | struct regulator_init_data *regulator; | ||
149 | }; | 148 | }; |
150 | 149 | ||
151 | extern int __devinit ab8500_init(struct ab8500 *ab8500); | 150 | extern int __devinit ab8500_init(struct ab8500 *ab8500); |
diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h index f509877c2ed4..6a210f1511fc 100644 --- a/include/linux/regulator/ab8500.h +++ b/include/linux/regulator/ab8500.h | |||
@@ -11,15 +11,17 @@ | |||
11 | #define __LINUX_MFD_AB8500_REGULATOR_H | 11 | #define __LINUX_MFD_AB8500_REGULATOR_H |
12 | 12 | ||
13 | /* AB8500 regulators */ | 13 | /* AB8500 regulators */ |
14 | #define AB8500_LDO_AUX1 0 | 14 | enum ab8500_regulator_id { |
15 | #define AB8500_LDO_AUX2 1 | 15 | AB8500_LDO_AUX1, |
16 | #define AB8500_LDO_AUX3 2 | 16 | AB8500_LDO_AUX2, |
17 | #define AB8500_LDO_INTCORE 3 | 17 | AB8500_LDO_AUX3, |
18 | #define AB8500_LDO_TVOUT 4 | 18 | AB8500_LDO_INTCORE, |
19 | #define AB8500_LDO_AUDIO 5 | 19 | AB8500_LDO_TVOUT, |
20 | #define AB8500_LDO_ANAMIC1 6 | 20 | AB8500_LDO_AUDIO, |
21 | #define AB8500_LDO_ANAMIC2 7 | 21 | AB8500_LDO_ANAMIC1, |
22 | #define AB8500_LDO_DMIC 8 | 22 | AB8500_LDO_ANAMIC2, |
23 | #define AB8500_LDO_ANA 9 | 23 | AB8500_LDO_DMIC, |
24 | 24 | AB8500_LDO_ANA, | |
25 | AB8500_NUM_REGULATORS, | ||
26 | }; | ||
25 | #endif | 27 | #endif |