aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBengt Jonsson <bengt.g.jonsson@stericsson.com>2013-03-21 11:59:03 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-03-22 07:03:17 -0400
commit732805a563617aafc7405409c03182afafb3943b (patch)
tree8ecd2fefdef5f6802f8a28b60dfb93f26f0473a7
parent33bc8f46a8ee3fc1836def9713933435b7ff0b90 (diff)
regulator: 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. Signed-off-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Yvan FILLION <yvan.fillion@stericsson.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r--arch/arm/mach-ux500/board-mop500-regulators.c12
-rw-r--r--arch/arm/mach-ux500/board-mop500-regulators.h4
-rw-r--r--drivers/regulator/ab8500.c21
-rw-r--r--include/linux/regulator/ab8500.h7
4 files changed, 32 insertions, 12 deletions
diff --git a/arch/arm/mach-ux500/board-mop500-regulators.c b/arch/arm/mach-ux500/board-mop500-regulators.c
index a8141e3e8ca1..0fd84d42e1ec 100644
--- a/arch/arm/mach-ux500/board-mop500-regulators.c
+++ b/arch/arm/mach-ux500/board-mop500-regulators.c
@@ -122,8 +122,7 @@ static struct regulator_consumer_supply ab8500_vana_consumers[] = {
122}; 122};
123 123
124/* ab8500 regulator register initialization */ 124/* ab8500 regulator register initialization */
125struct ab8500_regulator_reg_init 125static struct ab8500_regulator_reg_init ab8500_reg_init[] = {
126ab8500_regulator_reg_init[AB8500_NUM_REGULATOR_REGISTERS] = {
127 /* 126 /*
128 * VanaRequestCtrl = HP/LP depending on VxRequest 127 * VanaRequestCtrl = HP/LP depending on VxRequest
129 * VpllRequestCtrl = HP/LP depending on VxRequest 128 * VpllRequestCtrl = HP/LP depending on VxRequest
@@ -314,7 +313,7 @@ ab8500_regulator_reg_init[AB8500_NUM_REGULATOR_REGISTERS] = {
314}; 313};
315 314
316/* AB8500 regulators */ 315/* AB8500 regulators */
317struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS] = { 316static struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS] = {
318 /* supplies to the display/camera */ 317 /* supplies to the display/camera */
319 [AB8500_LDO_AUX1] = { 318 [AB8500_LDO_AUX1] = {
320 .constraints = { 319 .constraints = {
@@ -423,3 +422,10 @@ struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS] = {
423 .consumer_supplies = ab8500_vana_consumers, 422 .consumer_supplies = ab8500_vana_consumers,
424 }, 423 },
425}; 424};
425
426struct ab8500_regulator_platform_data ab8500_regulator_plat_data = {
427 .reg_init = ab8500_reg_init,
428 .num_reg_init = ARRAY_SIZE(ab8500_reg_init),
429 .regulator = ab8500_regulators,
430 .num_regulator = ARRAY_SIZE(ab8500_regulators),
431};
diff --git a/arch/arm/mach-ux500/board-mop500-regulators.h b/arch/arm/mach-ux500/board-mop500-regulators.h
index 78a0642a2206..9ca4869a6f23 100644
--- a/arch/arm/mach-ux500/board-mop500-regulators.h
+++ b/arch/arm/mach-ux500/board-mop500-regulators.h
@@ -14,9 +14,7 @@
14#include <linux/regulator/machine.h> 14#include <linux/regulator/machine.h>
15#include <linux/regulator/ab8500.h> 15#include <linux/regulator/ab8500.h>
16 16
17extern struct ab8500_regulator_reg_init 17extern struct ab8500_regulator_platform_data ab8500_regulator_plat_data;
18ab8500_regulator_reg_init[AB8500_NUM_REGULATOR_REGISTERS];
19extern struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS];
20extern struct regulator_init_data tps61052_regulator; 18extern struct regulator_init_data tps61052_regulator;
21extern struct regulator_init_data gpio_en_3v3_regulator; 19extern struct regulator_init_data gpio_en_3v3_regulator;
22 20
diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c
index c7784c4bff4f..f7d1f538c200 100644
--- a/drivers/regulator/ab8500.c
+++ b/drivers/regulator/ab8500.c
@@ -939,8 +939,9 @@ ab8500_regulator_of_probe(struct platform_device *pdev, struct device_node *np)
939static int ab8500_regulator_probe(struct platform_device *pdev) 939static int ab8500_regulator_probe(struct platform_device *pdev)
940{ 940{
941 struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent); 941 struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent);
942 struct ab8500_platform_data *pdata;
943 struct device_node *np = pdev->dev.of_node; 942 struct device_node *np = pdev->dev.of_node;
943 struct ab8500_platform_data *ppdata;
944 struct ab8500_regulator_platform_data *pdata;
944 int i, err; 945 int i, err;
945 946
946 if (np) { 947 if (np) {
@@ -961,7 +962,14 @@ static int ab8500_regulator_probe(struct platform_device *pdev)
961 dev_err(&pdev->dev, "null mfd parent\n"); 962 dev_err(&pdev->dev, "null mfd parent\n");
962 return -EINVAL; 963 return -EINVAL;
963 } 964 }
964 pdata = dev_get_platdata(ab8500->dev); 965
966 ppdata = dev_get_platdata(ab8500->dev);
967 if (!ppdata) {
968 dev_err(&pdev->dev, "null parent pdata\n");
969 return -EINVAL;
970 }
971
972 pdata = ppdata->regulator;
965 if (!pdata) { 973 if (!pdata) {
966 dev_err(&pdev->dev, "null pdata\n"); 974 dev_err(&pdev->dev, "null pdata\n");
967 return -EINVAL; 975 return -EINVAL;
@@ -974,12 +982,12 @@ static int ab8500_regulator_probe(struct platform_device *pdev)
974 } 982 }
975 983
976 /* initialize registers */ 984 /* initialize registers */
977 for (i = 0; i < pdata->num_regulator_reg_init; i++) { 985 for (i = 0; i < pdata->num_reg_init; i++) {
978 int id, mask, value; 986 int id, mask, value;
979 987
980 id = pdata->regulator_reg_init[i].id; 988 id = pdata->reg_init[i].id;
981 mask = pdata->regulator_reg_init[i].mask; 989 mask = pdata->reg_init[i].mask;
982 value = pdata->regulator_reg_init[i].value; 990 value = pdata->reg_init[i].value;
983 991
984 /* check for configuration errors */ 992 /* check for configuration errors */
985 BUG_ON(id >= AB8500_NUM_REGULATOR_REGISTERS); 993 BUG_ON(id >= AB8500_NUM_REGULATOR_REGISTERS);
@@ -1045,5 +1053,6 @@ module_exit(ab8500_regulator_exit);
1045 1053
1046MODULE_LICENSE("GPL v2"); 1054MODULE_LICENSE("GPL v2");
1047MODULE_AUTHOR("Sundar Iyer <sundar.iyer@stericsson.com>"); 1055MODULE_AUTHOR("Sundar Iyer <sundar.iyer@stericsson.com>");
1056MODULE_AUTHOR("Bengt Jonsson <bengt.g.jonsson@stericsson.com>");
1048MODULE_DESCRIPTION("Regulator Driver for ST-Ericsson AB8500 Mixed-Sig PMIC"); 1057MODULE_DESCRIPTION("Regulator Driver for ST-Ericsson AB8500 Mixed-Sig PMIC");
1049MODULE_ALIAS("platform:ab8500-regulator"); 1058MODULE_ALIAS("platform:ab8500-regulator");
diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h
index dd7944f735d8..3a8e02687f7b 100644
--- a/include/linux/regulator/ab8500.h
+++ b/include/linux/regulator/ab8500.h
@@ -152,4 +152,11 @@ enum ab9540_regulator_reg {
152 AB9540_NUM_REGULATOR_REGISTERS, 152 AB9540_NUM_REGULATOR_REGISTERS,
153}; 153};
154 154
155struct ab8500_regulator_platform_data {
156 int num_reg_init;
157 struct ab8500_regulator_reg_init *reg_init;
158 int num_regulator;
159 struct regulator_init_data *regulator;
160};
161
155#endif 162#endif