summaryrefslogtreecommitdiff
path: root/drivers/regulator
diff options
context:
space:
mode:
authorBengt Jonsson <bengt.g.jonsson@stericsson.com>2011-10-04 10:56:48 +0200
committerPhilippe Langlais <philippe.langlais@stericsson.com>2012-05-22 10:59:11 +0200
commit8d2db153150436ffa6ab61b0a1685c813343455b (patch)
treed7d9974e5f6869f9eea7fff20edb65eace9f4bfa /drivers/regulator
parente0bc1d89d0b081da808bdf95fba8ef24756c024d (diff)
ab8500: Separate regulator and MFD platform data
The ab8500 MFD should not have knowledge about regulator- specific platform data like number of regulators and regulator registers. As the regulator platform data is about to grow with external regulators, this information is moved to a new structure provided by the regulator driver. ST-Ericsson ID: 282517 ST-Ericsson Linux next: - ST-Ericsson FOSS-OUT ID: Trivial Change-Id: I77d03ffcc3273b0659dea3cffd8191b8c94b83d2 Signed-off-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/33615 Reviewed-by: QABUILD Reviewed-by: Yvan FILLION <yvan.fillion@stericsson.com>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/ab8500.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c
index 9890598b649..74eda689af6 100644
--- a/drivers/regulator/ab8500.c
+++ b/drivers/regulator/ab8500.c
@@ -1083,14 +1083,22 @@ static struct ab8500_reg_init ab8500_reg_init[] = {
static __devinit int ab8500_regulator_probe(struct platform_device *pdev)
{
struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent);
- struct ab8500_platform_data *pdata;
+ struct ab8500_platform_data *ppdata;
+ struct ab8500_regulator_platform_data *pdata;
int i, err;
if (!ab8500) {
dev_err(&pdev->dev, "null mfd parent\n");
return -EINVAL;
}
- pdata = dev_get_platdata(ab8500->dev);
+
+ ppdata = dev_get_platdata(ab8500->dev);
+ if (!ppdata) {
+ dev_err(&pdev->dev, "null parent pdata\n");
+ return -EINVAL;
+ }
+
+ pdata = ppdata->regulator;
if (!pdata) {
dev_err(&pdev->dev, "null pdata\n");
return -EINVAL;
@@ -1103,13 +1111,13 @@ static __devinit int ab8500_regulator_probe(struct platform_device *pdev)
}
/* initialize registers */
- for (i = 0; i < pdata->num_regulator_reg_init; i++) {
+ for (i = 0; i < pdata->num_reg_init; i++) {
int id;
u8 mask, value;
- id = pdata->regulator_reg_init[i].id;
- mask = pdata->regulator_reg_init[i].mask;
- value = pdata->regulator_reg_init[i].value;
+ id = pdata->reg_init[i].id;
+ mask = pdata->reg_init[i].mask;
+ value = pdata->reg_init[i].value;
/* check for configuration errors */
BUG_ON(id >= AB8500_NUM_REGULATOR_REGISTERS);
@@ -1241,5 +1249,6 @@ module_exit(ab8500_regulator_exit);
MODULE_LICENSE("GPL v2");
MODULE_AUTHOR("Sundar Iyer <sundar.iyer@stericsson.com>");
+MODULE_AUTHOR("Bengt Jonsson <bengt.g.jonsson@stericsson.com>");
MODULE_DESCRIPTION("Regulator Driver for ST-Ericsson AB8500 Mixed-Sig PMIC");
MODULE_ALIAS("platform:ab8500-regulator");