aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-11-23 13:50:59 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-11-23 13:50:59 -0500
commit924ee2c9621b65df9dffa8218af5ee9a9b892bba (patch)
tree316d72848181d4198dad3407ba5441083708ab7e /drivers/regulator
parent68aaa37d0e8232d62a7e9411699e0dc005750186 (diff)
parent69511a452e6dc6b74fe4f3671a51b1b44b9c57e3 (diff)
Merge remote-tracking branch 'regulator/topic/dt' into regulator-next
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/88pm8607.c2
-rw-r--r--drivers/regulator/Makefile1
-rw-r--r--drivers/regulator/aat2870-regulator.c2
-rw-r--r--drivers/regulator/ab3100.c2
-rw-r--r--drivers/regulator/ab8500.c2
-rw-r--r--drivers/regulator/ad5398.c2
-rw-r--r--drivers/regulator/bq24022.c2
-rw-r--r--drivers/regulator/core.c82
-rw-r--r--drivers/regulator/da903x.c2
-rw-r--r--drivers/regulator/db8500-prcmu.c2
-rw-r--r--drivers/regulator/dummy.c2
-rw-r--r--drivers/regulator/fixed.c67
-rw-r--r--drivers/regulator/isl6271a-regulator.c2
-rw-r--r--drivers/regulator/lp3971.c2
-rw-r--r--drivers/regulator/lp3972.c2
-rw-r--r--drivers/regulator/max1586.c2
-rw-r--r--drivers/regulator/max8649.c2
-rw-r--r--drivers/regulator/max8660.c2
-rw-r--r--drivers/regulator/max8925-regulator.c2
-rw-r--r--drivers/regulator/max8952.c2
-rw-r--r--drivers/regulator/max8997.c2
-rw-r--r--drivers/regulator/max8998.c2
-rw-r--r--drivers/regulator/mc13783-regulator.c2
-rw-r--r--drivers/regulator/mc13892-regulator.c2
-rw-r--r--drivers/regulator/of_regulator.c81
-rw-r--r--drivers/regulator/pcap-regulator.c2
-rw-r--r--drivers/regulator/pcf50633-regulator.c2
-rw-r--r--drivers/regulator/tps6105x-regulator.c3
-rw-r--r--drivers/regulator/tps65023-regulator.c2
-rw-r--r--drivers/regulator/tps6507x-regulator.c2
-rw-r--r--drivers/regulator/tps6524x-regulator.c2
-rw-r--r--drivers/regulator/tps6586x-regulator.c2
-rw-r--r--drivers/regulator/tps65910-regulator.c2
-rw-r--r--drivers/regulator/tps65912-regulator.c2
-rw-r--r--drivers/regulator/twl-regulator.c2
-rw-r--r--drivers/regulator/wm831x-dcdc.c8
-rw-r--r--drivers/regulator/wm831x-isink.c2
-rw-r--r--drivers/regulator/wm831x-ldo.c6
-rw-r--r--drivers/regulator/wm8350-regulator.c2
-rw-r--r--drivers/regulator/wm8400-regulator.c2
-rw-r--r--drivers/regulator/wm8994-regulator.c2
41 files changed, 260 insertions, 56 deletions
diff --git a/drivers/regulator/88pm8607.c b/drivers/regulator/88pm8607.c
index ca0d608f8248..df33530cec4a 100644
--- a/drivers/regulator/88pm8607.c
+++ b/drivers/regulator/88pm8607.c
@@ -427,7 +427,7 @@ static int __devinit pm8607_regulator_probe(struct platform_device *pdev)
427 427
428 /* replace driver_data with info */ 428 /* replace driver_data with info */
429 info->regulator = regulator_register(&info->desc, &pdev->dev, 429 info->regulator = regulator_register(&info->desc, &pdev->dev,
430 pdata, info); 430 pdata, info, NULL);
431 if (IS_ERR(info->regulator)) { 431 if (IS_ERR(info->regulator)) {
432 dev_err(&pdev->dev, "failed to register regulator %s\n", 432 dev_err(&pdev->dev, "failed to register regulator %s\n",
433 info->desc.name); 433 info->desc.name);
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index 93a6318f5328..c75a5229cb27 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -4,6 +4,7 @@
4 4
5 5
6obj-$(CONFIG_REGULATOR) += core.o dummy.o 6obj-$(CONFIG_REGULATOR) += core.o dummy.o
7obj-$(CONFIG_OF) += of_regulator.o
7obj-$(CONFIG_REGULATOR_FIXED_VOLTAGE) += fixed.o 8obj-$(CONFIG_REGULATOR_FIXED_VOLTAGE) += fixed.o
8obj-$(CONFIG_REGULATOR_VIRTUAL_CONSUMER) += virtual.o 9obj-$(CONFIG_REGULATOR_VIRTUAL_CONSUMER) += virtual.o
9obj-$(CONFIG_REGULATOR_USERSPACE_CONSUMER) += userspace-consumer.o 10obj-$(CONFIG_REGULATOR_USERSPACE_CONSUMER) += userspace-consumer.o
diff --git a/drivers/regulator/aat2870-regulator.c b/drivers/regulator/aat2870-regulator.c
index 5abeb3ac3e8d..07e98ec6a324 100644
--- a/drivers/regulator/aat2870-regulator.c
+++ b/drivers/regulator/aat2870-regulator.c
@@ -188,7 +188,7 @@ static int aat2870_regulator_probe(struct platform_device *pdev)
188 ri->pdev = pdev; 188 ri->pdev = pdev;
189 189
190 rdev = regulator_register(&ri->desc, &pdev->dev, 190 rdev = regulator_register(&ri->desc, &pdev->dev,
191 pdev->dev.platform_data, ri); 191 pdev->dev.platform_data, ri, NULL);
192 if (IS_ERR(rdev)) { 192 if (IS_ERR(rdev)) {
193 dev_err(&pdev->dev, "Failed to register regulator %s\n", 193 dev_err(&pdev->dev, "Failed to register regulator %s\n",
194 ri->desc.name); 194 ri->desc.name);
diff --git a/drivers/regulator/ab3100.c b/drivers/regulator/ab3100.c
index 585e4946fe0a..042271aace6a 100644
--- a/drivers/regulator/ab3100.c
+++ b/drivers/regulator/ab3100.c
@@ -634,7 +634,7 @@ static int __devinit ab3100_regulators_probe(struct platform_device *pdev)
634 rdev = regulator_register(&ab3100_regulator_desc[i], 634 rdev = regulator_register(&ab3100_regulator_desc[i],
635 &pdev->dev, 635 &pdev->dev,
636 &plfdata->reg_constraints[i], 636 &plfdata->reg_constraints[i],
637 reg); 637 reg, NULL);
638 638
639 if (IS_ERR(rdev)) { 639 if (IS_ERR(rdev)) {
640 err = PTR_ERR(rdev); 640 err = PTR_ERR(rdev);
diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c
index 6e1ae69646b3..e91b8ddc2793 100644
--- a/drivers/regulator/ab8500.c
+++ b/drivers/regulator/ab8500.c
@@ -822,7 +822,7 @@ static __devinit int ab8500_regulator_probe(struct platform_device *pdev)
822 822
823 /* register regulator with framework */ 823 /* register regulator with framework */
824 info->regulator = regulator_register(&info->desc, &pdev->dev, 824 info->regulator = regulator_register(&info->desc, &pdev->dev,
825 &pdata->regulator[i], info); 825 &pdata->regulator[i], info, NULL);
826 if (IS_ERR(info->regulator)) { 826 if (IS_ERR(info->regulator)) {
827 err = PTR_ERR(info->regulator); 827 err = PTR_ERR(info->regulator);
828 dev_err(&pdev->dev, "failed to register regulator %s\n", 828 dev_err(&pdev->dev, "failed to register regulator %s\n",
diff --git a/drivers/regulator/ad5398.c b/drivers/regulator/ad5398.c
index a4be41614eeb..483c80930852 100644
--- a/drivers/regulator/ad5398.c
+++ b/drivers/regulator/ad5398.c
@@ -233,7 +233,7 @@ static int __devinit ad5398_probe(struct i2c_client *client,
233 chip->current_mask = (chip->current_level - 1) << chip->current_offset; 233 chip->current_mask = (chip->current_level - 1) << chip->current_offset;
234 234
235 chip->rdev = regulator_register(&ad5398_reg, &client->dev, 235 chip->rdev = regulator_register(&ad5398_reg, &client->dev,
236 init_data, chip); 236 init_data, chip, NULL);
237 if (IS_ERR(chip->rdev)) { 237 if (IS_ERR(chip->rdev)) {
238 ret = PTR_ERR(chip->rdev); 238 ret = PTR_ERR(chip->rdev);
239 dev_err(&client->dev, "failed to register %s %s\n", 239 dev_err(&client->dev, "failed to register %s %s\n",
diff --git a/drivers/regulator/bq24022.c b/drivers/regulator/bq24022.c
index e24d1b7d97a8..9fab6d1bbe80 100644
--- a/drivers/regulator/bq24022.c
+++ b/drivers/regulator/bq24022.c
@@ -107,7 +107,7 @@ static int __init bq24022_probe(struct platform_device *pdev)
107 ret = gpio_direction_output(pdata->gpio_nce, 1); 107 ret = gpio_direction_output(pdata->gpio_nce, 1);
108 108
109 bq24022 = regulator_register(&bq24022_desc, &pdev->dev, 109 bq24022 = regulator_register(&bq24022_desc, &pdev->dev,
110 pdata->init_data, pdata); 110 pdata->init_data, pdata, NULL);
111 if (IS_ERR(bq24022)) { 111 if (IS_ERR(bq24022)) {
112 dev_dbg(&pdev->dev, "couldn't register regulator\n"); 112 dev_dbg(&pdev->dev, "couldn't register regulator\n");
113 ret = PTR_ERR(bq24022); 113 ret = PTR_ERR(bq24022);
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 679f92ec9a45..f489bed2d848 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -25,6 +25,8 @@
25#include <linux/mutex.h> 25#include <linux/mutex.h>
26#include <linux/suspend.h> 26#include <linux/suspend.h>
27#include <linux/delay.h> 27#include <linux/delay.h>
28#include <linux/of.h>
29#include <linux/regulator/of_regulator.h>
28#include <linux/regulator/consumer.h> 30#include <linux/regulator/consumer.h>
29#include <linux/regulator/driver.h> 31#include <linux/regulator/driver.h>
30#include <linux/regulator/machine.h> 32#include <linux/regulator/machine.h>
@@ -132,6 +134,33 @@ static struct regulator *get_device_regulator(struct device *dev)
132 return NULL; 134 return NULL;
133} 135}
134 136
137/**
138 * of_get_regulator - get a regulator device node based on supply name
139 * @dev: Device pointer for the consumer (of regulator) device
140 * @supply: regulator supply name
141 *
142 * Extract the regulator device node corresponding to the supply name.
143 * retruns the device node corresponding to the regulator if found, else
144 * returns NULL.
145 */
146static struct device_node *of_get_regulator(struct device *dev, const char *supply)
147{
148 struct device_node *regnode = NULL;
149 char prop_name[32]; /* 32 is max size of property name */
150
151 dev_dbg(dev, "Looking up %s-supply from device tree\n", supply);
152
153 snprintf(prop_name, 32, "%s-supply", supply);
154 regnode = of_parse_phandle(dev->of_node, prop_name, 0);
155
156 if (!regnode) {
157 dev_warn(dev, "%s property in node %s references invalid phandle",
158 prop_name, dev->of_node->full_name);
159 return NULL;
160 }
161 return regnode;
162}
163
135/* Platform voltage constraint check */ 164/* Platform voltage constraint check */
136static int regulator_check_voltage(struct regulator_dev *rdev, 165static int regulator_check_voltage(struct regulator_dev *rdev,
137 int *min_uV, int *max_uV) 166 int *min_uV, int *max_uV)
@@ -1148,6 +1177,30 @@ static int _regulator_get_enable_time(struct regulator_dev *rdev)
1148 return rdev->desc->ops->enable_time(rdev); 1177 return rdev->desc->ops->enable_time(rdev);
1149} 1178}
1150 1179
1180static struct regulator_dev *regulator_dev_lookup(struct device *dev,
1181 const char *supply)
1182{
1183 struct regulator_dev *r;
1184 struct device_node *node;
1185
1186 /* first do a dt based lookup */
1187 if (dev && dev->of_node) {
1188 node = of_get_regulator(dev, supply);
1189 if (node)
1190 list_for_each_entry(r, &regulator_list, list)
1191 if (r->dev.parent &&
1192 node == r->dev.of_node)
1193 return r;
1194 }
1195
1196 /* if not found, try doing it non-dt way */
1197 list_for_each_entry(r, &regulator_list, list)
1198 if (strcmp(rdev_get_name(r), supply) == 0)
1199 return r;
1200
1201 return NULL;
1202}
1203
1151/* Internal regulator request function */ 1204/* Internal regulator request function */
1152static struct regulator *_regulator_get(struct device *dev, const char *id, 1205static struct regulator *_regulator_get(struct device *dev, const char *id,
1153 int exclusive) 1206 int exclusive)
@@ -1168,6 +1221,10 @@ static struct regulator *_regulator_get(struct device *dev, const char *id,
1168 1221
1169 mutex_lock(&regulator_list_mutex); 1222 mutex_lock(&regulator_list_mutex);
1170 1223
1224 rdev = regulator_dev_lookup(dev, id);
1225 if (rdev)
1226 goto found;
1227
1171 list_for_each_entry(map, &regulator_map_list, list) { 1228 list_for_each_entry(map, &regulator_map_list, list) {
1172 /* If the mapping has a device set up it must match */ 1229 /* If the mapping has a device set up it must match */
1173 if (map->dev_name && 1230 if (map->dev_name &&
@@ -2638,11 +2695,12 @@ static void rdev_init_debugfs(struct regulator_dev *rdev)
2638 */ 2695 */
2639struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, 2696struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
2640 struct device *dev, const struct regulator_init_data *init_data, 2697 struct device *dev, const struct regulator_init_data *init_data,
2641 void *driver_data) 2698 void *driver_data, struct device_node *of_node)
2642{ 2699{
2643 static atomic_t regulator_no = ATOMIC_INIT(0); 2700 static atomic_t regulator_no = ATOMIC_INIT(0);
2644 struct regulator_dev *rdev; 2701 struct regulator_dev *rdev;
2645 int ret, i; 2702 int ret, i;
2703 const char *supply = NULL;
2646 2704
2647 if (regulator_desc == NULL) 2705 if (regulator_desc == NULL)
2648 return ERR_PTR(-EINVAL); 2706 return ERR_PTR(-EINVAL);
@@ -2697,6 +2755,7 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
2697 2755
2698 /* register with sysfs */ 2756 /* register with sysfs */
2699 rdev->dev.class = &regulator_class; 2757 rdev->dev.class = &regulator_class;
2758 rdev->dev.of_node = of_node;
2700 rdev->dev.parent = dev; 2759 rdev->dev.parent = dev;
2701 dev_set_name(&rdev->dev, "regulator.%d", 2760 dev_set_name(&rdev->dev, "regulator.%d",
2702 atomic_inc_return(&regulator_no) - 1); 2761 atomic_inc_return(&regulator_no) - 1);
@@ -2718,21 +2777,18 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
2718 if (ret < 0) 2777 if (ret < 0)
2719 goto scrub; 2778 goto scrub;
2720 2779
2721 if (init_data->supply_regulator) { 2780 if (init_data->supply_regulator)
2781 supply = init_data->supply_regulator;
2782 else if (regulator_desc->supply_name)
2783 supply = regulator_desc->supply_name;
2784
2785 if (supply) {
2722 struct regulator_dev *r; 2786 struct regulator_dev *r;
2723 int found = 0;
2724 2787
2725 list_for_each_entry(r, &regulator_list, list) { 2788 r = regulator_dev_lookup(dev, supply);
2726 if (strcmp(rdev_get_name(r),
2727 init_data->supply_regulator) == 0) {
2728 found = 1;
2729 break;
2730 }
2731 }
2732 2789
2733 if (!found) { 2790 if (!r) {
2734 dev_err(dev, "Failed to find supply %s\n", 2791 dev_err(dev, "Failed to find supply %s\n", supply);
2735 init_data->supply_regulator);
2736 ret = -ENODEV; 2792 ret = -ENODEV;
2737 goto scrub; 2793 goto scrub;
2738 } 2794 }
diff --git a/drivers/regulator/da903x.c b/drivers/regulator/da903x.c
index e23ddfa8b2c6..8dbc54da7d70 100644
--- a/drivers/regulator/da903x.c
+++ b/drivers/regulator/da903x.c
@@ -537,7 +537,7 @@ static int __devinit da903x_regulator_probe(struct platform_device *pdev)
537 ri->desc.ops = &da9030_regulator_ldo1_15_ops; 537 ri->desc.ops = &da9030_regulator_ldo1_15_ops;
538 538
539 rdev = regulator_register(&ri->desc, &pdev->dev, 539 rdev = regulator_register(&ri->desc, &pdev->dev,
540 pdev->dev.platform_data, ri); 540 pdev->dev.platform_data, ri, NULL);
541 if (IS_ERR(rdev)) { 541 if (IS_ERR(rdev)) {
542 dev_err(&pdev->dev, "failed to register regulator %s\n", 542 dev_err(&pdev->dev, "failed to register regulator %s\n",
543 ri->desc.name); 543 ri->desc.name);
diff --git a/drivers/regulator/db8500-prcmu.c b/drivers/regulator/db8500-prcmu.c
index 78329751af54..515443fcd26b 100644
--- a/drivers/regulator/db8500-prcmu.c
+++ b/drivers/regulator/db8500-prcmu.c
@@ -486,7 +486,7 @@ static int __devinit db8500_regulator_probe(struct platform_device *pdev)
486 486
487 /* register with the regulator framework */ 487 /* register with the regulator framework */
488 info->rdev = regulator_register(&info->desc, &pdev->dev, 488 info->rdev = regulator_register(&info->desc, &pdev->dev,
489 init_data, info); 489 init_data, info, NULL);
490 if (IS_ERR(info->rdev)) { 490 if (IS_ERR(info->rdev)) {
491 err = PTR_ERR(info->rdev); 491 err = PTR_ERR(info->rdev);
492 dev_err(&pdev->dev, "failed to register %s: err %i\n", 492 dev_err(&pdev->dev, "failed to register %s: err %i\n",
diff --git a/drivers/regulator/dummy.c b/drivers/regulator/dummy.c
index b8f520513ce7..0ee00de4be72 100644
--- a/drivers/regulator/dummy.c
+++ b/drivers/regulator/dummy.c
@@ -42,7 +42,7 @@ static int __devinit dummy_regulator_probe(struct platform_device *pdev)
42 int ret; 42 int ret;
43 43
44 dummy_regulator_rdev = regulator_register(&dummy_desc, NULL, 44 dummy_regulator_rdev = regulator_register(&dummy_desc, NULL,
45 &dummy_initdata, NULL); 45 &dummy_initdata, NULL, NULL);
46 if (IS_ERR(dummy_regulator_rdev)) { 46 if (IS_ERR(dummy_regulator_rdev)) {
47 ret = PTR_ERR(dummy_regulator_rdev); 47 ret = PTR_ERR(dummy_regulator_rdev);
48 pr_err("Failed to register regulator: %d\n", ret); 48 pr_err("Failed to register regulator: %d\n", ret);
diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
index ccbead06c8f3..716ea375f50f 100644
--- a/drivers/regulator/fixed.c
+++ b/drivers/regulator/fixed.c
@@ -27,6 +27,10 @@
27#include <linux/gpio.h> 27#include <linux/gpio.h>
28#include <linux/delay.h> 28#include <linux/delay.h>
29#include <linux/slab.h> 29#include <linux/slab.h>
30#include <linux/of.h>
31#include <linux/of_gpio.h>
32#include <linux/regulator/of_regulator.h>
33#include <linux/regulator/machine.h>
30 34
31struct fixed_voltage_data { 35struct fixed_voltage_data {
32 struct regulator_desc desc; 36 struct regulator_desc desc;
@@ -38,6 +42,53 @@ struct fixed_voltage_data {
38 bool is_enabled; 42 bool is_enabled;
39}; 43};
40 44
45
46/**
47 * of_get_fixed_voltage_config - extract fixed_voltage_config structure info
48 * @dev: device requesting for fixed_voltage_config
49 *
50 * Populates fixed_voltage_config structure by extracting data from device
51 * tree node, returns a pointer to the populated structure of NULL if memory
52 * alloc fails.
53 */
54struct fixed_voltage_config *of_get_fixed_voltage_config(struct device *dev)
55{
56 struct fixed_voltage_config *config;
57 struct device_node *np = dev->of_node;
58 const __be32 *delay;
59 struct regulator_init_data *init_data;
60
61 config = devm_kzalloc(dev, sizeof(struct fixed_voltage_config),
62 GFP_KERNEL);
63 if (!config)
64 return NULL;
65
66 config->init_data = of_get_regulator_init_data(dev);
67 init_data = config->init_data;
68
69 config->supply_name = init_data->constraints.name;
70 if (init_data->constraints.min_uV == init_data->constraints.max_uV) {
71 config->microvolts = init_data->constraints.min_uV;
72 } else {
73 dev_err(dev,
74 "Fixed regulator specified with variable voltages\n");
75 return NULL;
76 }
77
78 if (init_data->constraints.boot_on)
79 config->enabled_at_boot = true;
80
81 config->gpio = of_get_named_gpio(np, "gpio", 0);
82 delay = of_get_property(np, "startup-delay-us", NULL);
83 if (delay)
84 config->startup_delay = be32_to_cpu(*delay);
85
86 if (of_find_property(np, "enable-active-high", NULL))
87 config->enable_high = true;
88
89 return config;
90}
91
41static int fixed_voltage_is_enabled(struct regulator_dev *dev) 92static int fixed_voltage_is_enabled(struct regulator_dev *dev)
42{ 93{
43 struct fixed_voltage_data *data = rdev_get_drvdata(dev); 94 struct fixed_voltage_data *data = rdev_get_drvdata(dev);
@@ -112,6 +163,9 @@ static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev)
112 struct fixed_voltage_data *drvdata; 163 struct fixed_voltage_data *drvdata;
113 int ret; 164 int ret;
114 165
166 if (pdev->dev.of_node)
167 config = of_get_fixed_voltage_config(&pdev->dev);
168
115 drvdata = kzalloc(sizeof(struct fixed_voltage_data), GFP_KERNEL); 169 drvdata = kzalloc(sizeof(struct fixed_voltage_data), GFP_KERNEL);
116 if (drvdata == NULL) { 170 if (drvdata == NULL) {
117 dev_err(&pdev->dev, "Failed to allocate device data\n"); 171 dev_err(&pdev->dev, "Failed to allocate device data\n");
@@ -183,7 +237,7 @@ static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev)
183 } 237 }
184 238
185 drvdata->dev = regulator_register(&drvdata->desc, &pdev->dev, 239 drvdata->dev = regulator_register(&drvdata->desc, &pdev->dev,
186 config->init_data, drvdata); 240 config->init_data, drvdata, NULL);
187 if (IS_ERR(drvdata->dev)) { 241 if (IS_ERR(drvdata->dev)) {
188 ret = PTR_ERR(drvdata->dev); 242 ret = PTR_ERR(drvdata->dev);
189 dev_err(&pdev->dev, "Failed to register regulator: %d\n", ret); 243 dev_err(&pdev->dev, "Failed to register regulator: %d\n", ret);
@@ -220,12 +274,23 @@ static int __devexit reg_fixed_voltage_remove(struct platform_device *pdev)
220 return 0; 274 return 0;
221} 275}
222 276
277#if defined(CONFIG_OF)
278static const struct of_device_id fixed_of_match[] __devinitconst = {
279 { .compatible = "regulator-fixed", },
280 {},
281};
282MODULE_DEVICE_TABLE(of, fixed_of_match);
283#else
284#define fixed_of_match NULL
285#endif
286
223static struct platform_driver regulator_fixed_voltage_driver = { 287static struct platform_driver regulator_fixed_voltage_driver = {
224 .probe = reg_fixed_voltage_probe, 288 .probe = reg_fixed_voltage_probe,
225 .remove = __devexit_p(reg_fixed_voltage_remove), 289 .remove = __devexit_p(reg_fixed_voltage_remove),
226 .driver = { 290 .driver = {
227 .name = "reg-fixed-voltage", 291 .name = "reg-fixed-voltage",
228 .owner = THIS_MODULE, 292 .owner = THIS_MODULE,
293 .of_match_table = fixed_of_match,
229 }, 294 },
230}; 295};
231 296
diff --git a/drivers/regulator/isl6271a-regulator.c b/drivers/regulator/isl6271a-regulator.c
index e4b3592e8176..c1a456c4257c 100644
--- a/drivers/regulator/isl6271a-regulator.c
+++ b/drivers/regulator/isl6271a-regulator.c
@@ -170,7 +170,7 @@ static int __devinit isl6271a_probe(struct i2c_client *i2c,
170 170
171 for (i = 0; i < 3; i++) { 171 for (i = 0; i < 3; i++) {
172 pmic->rdev[i] = regulator_register(&isl_rd[i], &i2c->dev, 172 pmic->rdev[i] = regulator_register(&isl_rd[i], &i2c->dev,
173 init_data, pmic); 173 init_data, pmic, NULL);
174 if (IS_ERR(pmic->rdev[i])) { 174 if (IS_ERR(pmic->rdev[i])) {
175 dev_err(&i2c->dev, "failed to register %s\n", id->name); 175 dev_err(&i2c->dev, "failed to register %s\n", id->name);
176 err = PTR_ERR(pmic->rdev[i]); 176 err = PTR_ERR(pmic->rdev[i]);
diff --git a/drivers/regulator/lp3971.c b/drivers/regulator/lp3971.c
index 72b16b5f3db6..0cfabd318a59 100644
--- a/drivers/regulator/lp3971.c
+++ b/drivers/regulator/lp3971.c
@@ -451,7 +451,7 @@ static int __devinit setup_regulators(struct lp3971 *lp3971,
451 for (i = 0; i < pdata->num_regulators; i++) { 451 for (i = 0; i < pdata->num_regulators; i++) {
452 struct lp3971_regulator_subdev *reg = &pdata->regulators[i]; 452 struct lp3971_regulator_subdev *reg = &pdata->regulators[i];
453 lp3971->rdev[i] = regulator_register(&regulators[reg->id], 453 lp3971->rdev[i] = regulator_register(&regulators[reg->id],
454 lp3971->dev, reg->initdata, lp3971); 454 lp3971->dev, reg->initdata, lp3971, NULL);
455 455
456 if (IS_ERR(lp3971->rdev[i])) { 456 if (IS_ERR(lp3971->rdev[i])) {
457 err = PTR_ERR(lp3971->rdev[i]); 457 err = PTR_ERR(lp3971->rdev[i]);
diff --git a/drivers/regulator/lp3972.c b/drivers/regulator/lp3972.c
index fbc5e3741bef..49a15eefe5fe 100644
--- a/drivers/regulator/lp3972.c
+++ b/drivers/regulator/lp3972.c
@@ -555,7 +555,7 @@ static int __devinit setup_regulators(struct lp3972 *lp3972,
555 for (i = 0; i < pdata->num_regulators; i++) { 555 for (i = 0; i < pdata->num_regulators; i++) {
556 struct lp3972_regulator_subdev *reg = &pdata->regulators[i]; 556 struct lp3972_regulator_subdev *reg = &pdata->regulators[i];
557 lp3972->rdev[i] = regulator_register(&regulators[reg->id], 557 lp3972->rdev[i] = regulator_register(&regulators[reg->id],
558 lp3972->dev, reg->initdata, lp3972); 558 lp3972->dev, reg->initdata, lp3972, NULL);
559 559
560 if (IS_ERR(lp3972->rdev[i])) { 560 if (IS_ERR(lp3972->rdev[i])) {
561 err = PTR_ERR(lp3972->rdev[i]); 561 err = PTR_ERR(lp3972->rdev[i]);
diff --git a/drivers/regulator/max1586.c b/drivers/regulator/max1586.c
index 3f49512c5134..40e7a4db2853 100644
--- a/drivers/regulator/max1586.c
+++ b/drivers/regulator/max1586.c
@@ -214,7 +214,7 @@ static int __devinit max1586_pmic_probe(struct i2c_client *client,
214 } 214 }
215 rdev[i] = regulator_register(&max1586_reg[id], &client->dev, 215 rdev[i] = regulator_register(&max1586_reg[id], &client->dev,
216 pdata->subdevs[i].platform_data, 216 pdata->subdevs[i].platform_data,
217 max1586); 217 max1586, NULL);
218 if (IS_ERR(rdev[i])) { 218 if (IS_ERR(rdev[i])) {
219 ret = PTR_ERR(rdev[i]); 219 ret = PTR_ERR(rdev[i]);
220 dev_err(&client->dev, "failed to register %s\n", 220 dev_err(&client->dev, "failed to register %s\n",
diff --git a/drivers/regulator/max8649.c b/drivers/regulator/max8649.c
index c54d0ad18c73..b06a2399587c 100644
--- a/drivers/regulator/max8649.c
+++ b/drivers/regulator/max8649.c
@@ -299,7 +299,7 @@ static int __devinit max8649_regulator_probe(struct i2c_client *client,
299 } 299 }
300 300
301 info->regulator = regulator_register(&dcdc_desc, &client->dev, 301 info->regulator = regulator_register(&dcdc_desc, &client->dev,
302 pdata->regulator, info); 302 pdata->regulator, info, NULL);
303 if (IS_ERR(info->regulator)) { 303 if (IS_ERR(info->regulator)) {
304 dev_err(info->dev, "failed to register regulator %s\n", 304 dev_err(info->dev, "failed to register regulator %s\n",
305 dcdc_desc.name); 305 dcdc_desc.name);
diff --git a/drivers/regulator/max8660.c b/drivers/regulator/max8660.c
index 33f5d9a492ef..a838e664569f 100644
--- a/drivers/regulator/max8660.c
+++ b/drivers/regulator/max8660.c
@@ -449,7 +449,7 @@ static int __devinit max8660_probe(struct i2c_client *client,
449 449
450 rdev[i] = regulator_register(&max8660_reg[id], &client->dev, 450 rdev[i] = regulator_register(&max8660_reg[id], &client->dev,
451 pdata->subdevs[i].platform_data, 451 pdata->subdevs[i].platform_data,
452 max8660); 452 max8660, NULL);
453 if (IS_ERR(rdev[i])) { 453 if (IS_ERR(rdev[i])) {
454 ret = PTR_ERR(rdev[i]); 454 ret = PTR_ERR(rdev[i]);
455 dev_err(&client->dev, "failed to register %s\n", 455 dev_err(&client->dev, "failed to register %s\n",
diff --git a/drivers/regulator/max8925-regulator.c b/drivers/regulator/max8925-regulator.c
index cc9ec0e03271..f976e5d0867e 100644
--- a/drivers/regulator/max8925-regulator.c
+++ b/drivers/regulator/max8925-regulator.c
@@ -266,7 +266,7 @@ static int __devinit max8925_regulator_probe(struct platform_device *pdev)
266 ri->chip = chip; 266 ri->chip = chip;
267 267
268 rdev = regulator_register(&ri->desc, &pdev->dev, 268 rdev = regulator_register(&ri->desc, &pdev->dev,
269 pdata->regulator[pdev->id], ri); 269 pdata->regulator[pdev->id], ri, NULL);
270 if (IS_ERR(rdev)) { 270 if (IS_ERR(rdev)) {
271 dev_err(&pdev->dev, "failed to register regulator %s\n", 271 dev_err(&pdev->dev, "failed to register regulator %s\n",
272 ri->desc.name); 272 ri->desc.name);
diff --git a/drivers/regulator/max8952.c b/drivers/regulator/max8952.c
index 3883d85c5b88..75d89400c123 100644
--- a/drivers/regulator/max8952.c
+++ b/drivers/regulator/max8952.c
@@ -208,7 +208,7 @@ static int __devinit max8952_pmic_probe(struct i2c_client *client,
208 max8952->pdata = pdata; 208 max8952->pdata = pdata;
209 209
210 max8952->rdev = regulator_register(&regulator, max8952->dev, 210 max8952->rdev = regulator_register(&regulator, max8952->dev,
211 &pdata->reg_data, max8952); 211 &pdata->reg_data, max8952, NULL);
212 212
213 if (IS_ERR(max8952->rdev)) { 213 if (IS_ERR(max8952->rdev)) {
214 ret = PTR_ERR(max8952->rdev); 214 ret = PTR_ERR(max8952->rdev);
diff --git a/drivers/regulator/max8997.c b/drivers/regulator/max8997.c
index 6176129a27e5..d26e8646277b 100644
--- a/drivers/regulator/max8997.c
+++ b/drivers/regulator/max8997.c
@@ -1146,7 +1146,7 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev)
1146 regulators[id].n_voltages = 16; 1146 regulators[id].n_voltages = 16;
1147 1147
1148 rdev[i] = regulator_register(&regulators[id], max8997->dev, 1148 rdev[i] = regulator_register(&regulators[id], max8997->dev,
1149 pdata->regulators[i].initdata, max8997); 1149 pdata->regulators[i].initdata, max8997, NULL);
1150 if (IS_ERR(rdev[i])) { 1150 if (IS_ERR(rdev[i])) {
1151 ret = PTR_ERR(rdev[i]); 1151 ret = PTR_ERR(rdev[i]);
1152 dev_err(max8997->dev, "regulator init failed for %d\n", 1152 dev_err(max8997->dev, "regulator init failed for %d\n",
diff --git a/drivers/regulator/max8998.c b/drivers/regulator/max8998.c
index 41a1495eec2b..2d38c2493a07 100644
--- a/drivers/regulator/max8998.c
+++ b/drivers/regulator/max8998.c
@@ -847,7 +847,7 @@ static __devinit int max8998_pmic_probe(struct platform_device *pdev)
847 regulators[index].n_voltages = count; 847 regulators[index].n_voltages = count;
848 } 848 }
849 rdev[i] = regulator_register(&regulators[index], max8998->dev, 849 rdev[i] = regulator_register(&regulators[index], max8998->dev,
850 pdata->regulators[i].initdata, max8998); 850 pdata->regulators[i].initdata, max8998, NULL);
851 if (IS_ERR(rdev[i])) { 851 if (IS_ERR(rdev[i])) {
852 ret = PTR_ERR(rdev[i]); 852 ret = PTR_ERR(rdev[i]);
853 dev_err(max8998->dev, "regulator init failed\n"); 853 dev_err(max8998->dev, "regulator init failed\n");
diff --git a/drivers/regulator/mc13783-regulator.c b/drivers/regulator/mc13783-regulator.c
index 8479082e1aea..56d4a677c404 100644
--- a/drivers/regulator/mc13783-regulator.c
+++ b/drivers/regulator/mc13783-regulator.c
@@ -357,7 +357,7 @@ static int __devinit mc13783_regulator_probe(struct platform_device *pdev)
357 init_data = &pdata->regulators[i]; 357 init_data = &pdata->regulators[i];
358 priv->regulators[i] = regulator_register( 358 priv->regulators[i] = regulator_register(
359 &mc13783_regulators[init_data->id].desc, 359 &mc13783_regulators[init_data->id].desc,
360 &pdev->dev, init_data->init_data, priv); 360 &pdev->dev, init_data->init_data, priv, NULL);
361 361
362 if (IS_ERR(priv->regulators[i])) { 362 if (IS_ERR(priv->regulators[i])) {
363 dev_err(&pdev->dev, "failed to register regulator %s\n", 363 dev_err(&pdev->dev, "failed to register regulator %s\n",
diff --git a/drivers/regulator/mc13892-regulator.c b/drivers/regulator/mc13892-regulator.c
index 023d17d022cf..2824804a2892 100644
--- a/drivers/regulator/mc13892-regulator.c
+++ b/drivers/regulator/mc13892-regulator.c
@@ -573,7 +573,7 @@ static int __devinit mc13892_regulator_probe(struct platform_device *pdev)
573 init_data = &pdata->regulators[i]; 573 init_data = &pdata->regulators[i];
574 priv->regulators[i] = regulator_register( 574 priv->regulators[i] = regulator_register(
575 &mc13892_regulators[init_data->id].desc, 575 &mc13892_regulators[init_data->id].desc,
576 &pdev->dev, init_data->init_data, priv); 576 &pdev->dev, init_data->init_data, priv, NULL);
577 577
578 if (IS_ERR(priv->regulators[i])) { 578 if (IS_ERR(priv->regulators[i])) {
579 dev_err(&pdev->dev, "failed to register regulator %s\n", 579 dev_err(&pdev->dev, "failed to register regulator %s\n",
diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c
new file mode 100644
index 000000000000..76673c784ab8
--- /dev/null
+++ b/drivers/regulator/of_regulator.c
@@ -0,0 +1,81 @@
1/*
2 * OF helpers for regulator framework
3 *
4 * Copyright (C) 2011 Texas Instruments, Inc.
5 * Rajendra Nayak <rnayak@ti.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#include <linux/slab.h>
14#include <linux/of.h>
15#include <linux/regulator/machine.h>
16
17static void of_get_regulation_constraints(struct device_node *np,
18 struct regulator_init_data **init_data)
19{
20 const __be32 *min_uV, *max_uV, *uV_offset;
21 const __be32 *min_uA, *max_uA;
22 struct regulation_constraints *constraints = &(*init_data)->constraints;
23
24 constraints->name = of_get_property(np, "regulator-name", NULL);
25
26 min_uV = of_get_property(np, "regulator-min-microvolt", NULL);
27 if (min_uV)
28 constraints->min_uV = be32_to_cpu(*min_uV);
29 max_uV = of_get_property(np, "regulator-max-microvolt", NULL);
30 if (max_uV)
31 constraints->max_uV = be32_to_cpu(*max_uV);
32
33 /* Voltage change possible? */
34 if (constraints->min_uV != constraints->max_uV)
35 constraints->valid_ops_mask |= REGULATOR_CHANGE_VOLTAGE;
36
37 uV_offset = of_get_property(np, "regulator-microvolt-offset", NULL);
38 if (uV_offset)
39 constraints->uV_offset = be32_to_cpu(*uV_offset);
40 min_uA = of_get_property(np, "regulator-min-microamp", NULL);
41 if (min_uA)
42 constraints->min_uA = be32_to_cpu(*min_uA);
43 max_uA = of_get_property(np, "regulator-max-microamp", NULL);
44 if (max_uA)
45 constraints->max_uA = be32_to_cpu(*max_uA);
46
47 /* Current change possible? */
48 if (constraints->min_uA != constraints->max_uA)
49 constraints->valid_ops_mask |= REGULATOR_CHANGE_CURRENT;
50
51 if (of_find_property(np, "regulator-boot-on", NULL))
52 constraints->boot_on = true;
53
54 if (of_find_property(np, "regulator-always-on", NULL))
55 constraints->always_on = true;
56 else /* status change should be possible if not always on. */
57 constraints->valid_ops_mask |= REGULATOR_CHANGE_STATUS;
58}
59
60/**
61 * of_get_regulator_init_data - extract regulator_init_data structure info
62 * @dev: device requesting for regulator_init_data
63 *
64 * Populates regulator_init_data structure by extracting data from device
65 * tree node, returns a pointer to the populated struture or NULL if memory
66 * alloc fails.
67 */
68struct regulator_init_data *of_get_regulator_init_data(struct device *dev)
69{
70 struct regulator_init_data *init_data;
71
72 if (!dev->of_node)
73 return NULL;
74
75 init_data = devm_kzalloc(dev, sizeof(*init_data), GFP_KERNEL);
76 if (!init_data)
77 return NULL; /* Out of memory? */
78
79 of_get_regulation_constraints(dev->of_node, &init_data);
80 return init_data;
81}
diff --git a/drivers/regulator/pcap-regulator.c b/drivers/regulator/pcap-regulator.c
index 31f6e11a7f16..a5aab1b08bcf 100644
--- a/drivers/regulator/pcap-regulator.c
+++ b/drivers/regulator/pcap-regulator.c
@@ -277,7 +277,7 @@ static int __devinit pcap_regulator_probe(struct platform_device *pdev)
277 void *pcap = dev_get_drvdata(pdev->dev.parent); 277 void *pcap = dev_get_drvdata(pdev->dev.parent);
278 278
279 rdev = regulator_register(&pcap_regulators[pdev->id], &pdev->dev, 279 rdev = regulator_register(&pcap_regulators[pdev->id], &pdev->dev,
280 pdev->dev.platform_data, pcap); 280 pdev->dev.platform_data, pcap, NULL);
281 if (IS_ERR(rdev)) 281 if (IS_ERR(rdev))
282 return PTR_ERR(rdev); 282 return PTR_ERR(rdev);
283 283
diff --git a/drivers/regulator/pcf50633-regulator.c b/drivers/regulator/pcf50633-regulator.c
index 69a11d9dd87f..1d1c31056297 100644
--- a/drivers/regulator/pcf50633-regulator.c
+++ b/drivers/regulator/pcf50633-regulator.c
@@ -320,7 +320,7 @@ static int __devinit pcf50633_regulator_probe(struct platform_device *pdev)
320 pcf = dev_to_pcf50633(pdev->dev.parent); 320 pcf = dev_to_pcf50633(pdev->dev.parent);
321 321
322 rdev = regulator_register(&regulators[pdev->id], &pdev->dev, 322 rdev = regulator_register(&regulators[pdev->id], &pdev->dev,
323 pdev->dev.platform_data, pcf); 323 pdev->dev.platform_data, pcf, NULL);
324 if (IS_ERR(rdev)) 324 if (IS_ERR(rdev))
325 return PTR_ERR(rdev); 325 return PTR_ERR(rdev);
326 326
diff --git a/drivers/regulator/tps6105x-regulator.c b/drivers/regulator/tps6105x-regulator.c
index 1011873896dc..d9278da18a9e 100644
--- a/drivers/regulator/tps6105x-regulator.c
+++ b/drivers/regulator/tps6105x-regulator.c
@@ -151,7 +151,8 @@ static int __devinit tps6105x_regulator_probe(struct platform_device *pdev)
151 /* Register regulator with framework */ 151 /* Register regulator with framework */
152 tps6105x->regulator = regulator_register(&tps6105x_regulator_desc, 152 tps6105x->regulator = regulator_register(&tps6105x_regulator_desc,
153 &tps6105x->client->dev, 153 &tps6105x->client->dev,
154 pdata->regulator_data, tps6105x); 154 pdata->regulator_data, tps6105x,
155 NULL);
155 if (IS_ERR(tps6105x->regulator)) { 156 if (IS_ERR(tps6105x->regulator)) {
156 ret = PTR_ERR(tps6105x->regulator); 157 ret = PTR_ERR(tps6105x->regulator);
157 dev_err(&tps6105x->client->dev, 158 dev_err(&tps6105x->client->dev,
diff --git a/drivers/regulator/tps65023-regulator.c b/drivers/regulator/tps65023-regulator.c
index e0bcd75a7cc4..18d61a0529a9 100644
--- a/drivers/regulator/tps65023-regulator.c
+++ b/drivers/regulator/tps65023-regulator.c
@@ -473,7 +473,7 @@ static int __devinit tps_65023_probe(struct i2c_client *client,
473 473
474 /* Register the regulators */ 474 /* Register the regulators */
475 rdev = regulator_register(&tps->desc[i], &client->dev, 475 rdev = regulator_register(&tps->desc[i], &client->dev,
476 init_data, tps); 476 init_data, tps, NULL);
477 if (IS_ERR(rdev)) { 477 if (IS_ERR(rdev)) {
478 dev_err(&client->dev, "failed to register %s\n", 478 dev_err(&client->dev, "failed to register %s\n",
479 id->name); 479 id->name);
diff --git a/drivers/regulator/tps6507x-regulator.c b/drivers/regulator/tps6507x-regulator.c
index bdef70365f52..0b63ef71a5fe 100644
--- a/drivers/regulator/tps6507x-regulator.c
+++ b/drivers/regulator/tps6507x-regulator.c
@@ -599,7 +599,7 @@ int tps6507x_pmic_probe(struct platform_device *pdev)
599 tps->desc[i].owner = THIS_MODULE; 599 tps->desc[i].owner = THIS_MODULE;
600 600
601 rdev = regulator_register(&tps->desc[i], 601 rdev = regulator_register(&tps->desc[i],
602 tps6507x_dev->dev, init_data, tps); 602 tps6507x_dev->dev, init_data, tps, NULL);
603 if (IS_ERR(rdev)) { 603 if (IS_ERR(rdev)) {
604 dev_err(tps6507x_dev->dev, 604 dev_err(tps6507x_dev->dev,
605 "failed to register %s regulator\n", 605 "failed to register %s regulator\n",
diff --git a/drivers/regulator/tps6524x-regulator.c b/drivers/regulator/tps6524x-regulator.c
index 9166aa0a9df7..70b7b1f4f000 100644
--- a/drivers/regulator/tps6524x-regulator.c
+++ b/drivers/regulator/tps6524x-regulator.c
@@ -651,7 +651,7 @@ static int __devinit pmic_probe(struct spi_device *spi)
651 hw->desc[i].n_voltages = 1; 651 hw->desc[i].n_voltages = 1;
652 652
653 hw->rdev[i] = regulator_register(&hw->desc[i], dev, 653 hw->rdev[i] = regulator_register(&hw->desc[i], dev,
654 init_data, hw); 654 init_data, hw, NULL);
655 if (IS_ERR(hw->rdev[i])) { 655 if (IS_ERR(hw->rdev[i])) {
656 ret = PTR_ERR(hw->rdev[i]); 656 ret = PTR_ERR(hw->rdev[i]);
657 hw->rdev[i] = NULL; 657 hw->rdev[i] = NULL;
diff --git a/drivers/regulator/tps6586x-regulator.c b/drivers/regulator/tps6586x-regulator.c
index 14b9389dd52a..c75fb20faa57 100644
--- a/drivers/regulator/tps6586x-regulator.c
+++ b/drivers/regulator/tps6586x-regulator.c
@@ -396,7 +396,7 @@ static int __devinit tps6586x_regulator_probe(struct platform_device *pdev)
396 return err; 396 return err;
397 397
398 rdev = regulator_register(&ri->desc, &pdev->dev, 398 rdev = regulator_register(&ri->desc, &pdev->dev,
399 pdev->dev.platform_data, ri); 399 pdev->dev.platform_data, ri, NULL);
400 if (IS_ERR(rdev)) { 400 if (IS_ERR(rdev)) {
401 dev_err(&pdev->dev, "failed to register regulator %s\n", 401 dev_err(&pdev->dev, "failed to register regulator %s\n",
402 ri->desc.name); 402 ri->desc.name);
diff --git a/drivers/regulator/tps65910-regulator.c b/drivers/regulator/tps65910-regulator.c
index bb2a08d4e93e..5c15ba01e9c7 100644
--- a/drivers/regulator/tps65910-regulator.c
+++ b/drivers/regulator/tps65910-regulator.c
@@ -948,7 +948,7 @@ static __devinit int tps65910_probe(struct platform_device *pdev)
948 pmic->desc[i].owner = THIS_MODULE; 948 pmic->desc[i].owner = THIS_MODULE;
949 949
950 rdev = regulator_register(&pmic->desc[i], 950 rdev = regulator_register(&pmic->desc[i],
951 tps65910->dev, reg_data, pmic); 951 tps65910->dev, reg_data, pmic, NULL);
952 if (IS_ERR(rdev)) { 952 if (IS_ERR(rdev)) {
953 dev_err(tps65910->dev, 953 dev_err(tps65910->dev,
954 "failed to register %s regulator\n", 954 "failed to register %s regulator\n",
diff --git a/drivers/regulator/tps65912-regulator.c b/drivers/regulator/tps65912-regulator.c
index 39d4a1749e71..da00d88f94b7 100644
--- a/drivers/regulator/tps65912-regulator.c
+++ b/drivers/regulator/tps65912-regulator.c
@@ -727,7 +727,7 @@ static __devinit int tps65912_probe(struct platform_device *pdev)
727 pmic->desc[i].owner = THIS_MODULE; 727 pmic->desc[i].owner = THIS_MODULE;
728 range = tps65912_get_range(pmic, i); 728 range = tps65912_get_range(pmic, i);
729 rdev = regulator_register(&pmic->desc[i], 729 rdev = regulator_register(&pmic->desc[i],
730 tps65912->dev, reg_data, pmic); 730 tps65912->dev, reg_data, pmic, NULL);
731 if (IS_ERR(rdev)) { 731 if (IS_ERR(rdev)) {
732 dev_err(tps65912->dev, 732 dev_err(tps65912->dev,
733 "failed to register %s regulator\n", 733 "failed to register %s regulator\n",
diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c
index ee8747f4fa08..9a2e07a094b3 100644
--- a/drivers/regulator/twl-regulator.c
+++ b/drivers/regulator/twl-regulator.c
@@ -1070,7 +1070,7 @@ static int __devinit twlreg_probe(struct platform_device *pdev)
1070 break; 1070 break;
1071 } 1071 }
1072 1072
1073 rdev = regulator_register(&info->desc, &pdev->dev, initdata, info); 1073 rdev = regulator_register(&info->desc, &pdev->dev, initdata, info, NULL);
1074 if (IS_ERR(rdev)) { 1074 if (IS_ERR(rdev)) {
1075 dev_err(&pdev->dev, "can't register %s, %ld\n", 1075 dev_err(&pdev->dev, "can't register %s, %ld\n",
1076 info->desc.name, PTR_ERR(rdev)); 1076 info->desc.name, PTR_ERR(rdev));
diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c
index bd3531d8b2ac..7558a9666a50 100644
--- a/drivers/regulator/wm831x-dcdc.c
+++ b/drivers/regulator/wm831x-dcdc.c
@@ -553,7 +553,7 @@ static __devinit int wm831x_buckv_probe(struct platform_device *pdev)
553 wm831x_buckv_dvs_init(dcdc, pdata->dcdc[id]->driver_data); 553 wm831x_buckv_dvs_init(dcdc, pdata->dcdc[id]->driver_data);
554 554
555 dcdc->regulator = regulator_register(&dcdc->desc, &pdev->dev, 555 dcdc->regulator = regulator_register(&dcdc->desc, &pdev->dev,
556 pdata->dcdc[id], dcdc); 556 pdata->dcdc[id], dcdc, NULL);
557 if (IS_ERR(dcdc->regulator)) { 557 if (IS_ERR(dcdc->regulator)) {
558 ret = PTR_ERR(dcdc->regulator); 558 ret = PTR_ERR(dcdc->regulator);
559 dev_err(wm831x->dev, "Failed to register DCDC%d: %d\n", 559 dev_err(wm831x->dev, "Failed to register DCDC%d: %d\n",
@@ -747,7 +747,7 @@ static __devinit int wm831x_buckp_probe(struct platform_device *pdev)
747 dcdc->desc.owner = THIS_MODULE; 747 dcdc->desc.owner = THIS_MODULE;
748 748
749 dcdc->regulator = regulator_register(&dcdc->desc, &pdev->dev, 749 dcdc->regulator = regulator_register(&dcdc->desc, &pdev->dev,
750 pdata->dcdc[id], dcdc); 750 pdata->dcdc[id], dcdc, NULL);
751 if (IS_ERR(dcdc->regulator)) { 751 if (IS_ERR(dcdc->regulator)) {
752 ret = PTR_ERR(dcdc->regulator); 752 ret = PTR_ERR(dcdc->regulator);
753 dev_err(wm831x->dev, "Failed to register DCDC%d: %d\n", 753 dev_err(wm831x->dev, "Failed to register DCDC%d: %d\n",
@@ -874,7 +874,7 @@ static __devinit int wm831x_boostp_probe(struct platform_device *pdev)
874 dcdc->desc.owner = THIS_MODULE; 874 dcdc->desc.owner = THIS_MODULE;
875 875
876 dcdc->regulator = regulator_register(&dcdc->desc, &pdev->dev, 876 dcdc->regulator = regulator_register(&dcdc->desc, &pdev->dev,
877 pdata->dcdc[id], dcdc); 877 pdata->dcdc[id], dcdc, NULL);
878 if (IS_ERR(dcdc->regulator)) { 878 if (IS_ERR(dcdc->regulator)) {
879 ret = PTR_ERR(dcdc->regulator); 879 ret = PTR_ERR(dcdc->regulator);
880 dev_err(wm831x->dev, "Failed to register DCDC%d: %d\n", 880 dev_err(wm831x->dev, "Failed to register DCDC%d: %d\n",
@@ -973,7 +973,7 @@ static __devinit int wm831x_epe_probe(struct platform_device *pdev)
973 dcdc->desc.owner = THIS_MODULE; 973 dcdc->desc.owner = THIS_MODULE;
974 974
975 dcdc->regulator = regulator_register(&dcdc->desc, &pdev->dev, 975 dcdc->regulator = regulator_register(&dcdc->desc, &pdev->dev,
976 pdata->epe[id], dcdc); 976 pdata->epe[id], dcdc, NULL);
977 if (IS_ERR(dcdc->regulator)) { 977 if (IS_ERR(dcdc->regulator)) {
978 ret = PTR_ERR(dcdc->regulator); 978 ret = PTR_ERR(dcdc->regulator);
979 dev_err(wm831x->dev, "Failed to register EPE%d: %d\n", 979 dev_err(wm831x->dev, "Failed to register EPE%d: %d\n",
diff --git a/drivers/regulator/wm831x-isink.c b/drivers/regulator/wm831x-isink.c
index 01f27c7f4236..d3ad3f5cff46 100644
--- a/drivers/regulator/wm831x-isink.c
+++ b/drivers/regulator/wm831x-isink.c
@@ -189,7 +189,7 @@ static __devinit int wm831x_isink_probe(struct platform_device *pdev)
189 isink->desc.owner = THIS_MODULE; 189 isink->desc.owner = THIS_MODULE;
190 190
191 isink->regulator = regulator_register(&isink->desc, &pdev->dev, 191 isink->regulator = regulator_register(&isink->desc, &pdev->dev,
192 pdata->isink[id], isink); 192 pdata->isink[id], isink, NULL);
193 if (IS_ERR(isink->regulator)) { 193 if (IS_ERR(isink->regulator)) {
194 ret = PTR_ERR(isink->regulator); 194 ret = PTR_ERR(isink->regulator);
195 dev_err(wm831x->dev, "Failed to register ISINK%d: %d\n", 195 dev_err(wm831x->dev, "Failed to register ISINK%d: %d\n",
diff --git a/drivers/regulator/wm831x-ldo.c b/drivers/regulator/wm831x-ldo.c
index 6709710a059e..5e96a2386b1d 100644
--- a/drivers/regulator/wm831x-ldo.c
+++ b/drivers/regulator/wm831x-ldo.c
@@ -351,7 +351,7 @@ static __devinit int wm831x_gp_ldo_probe(struct platform_device *pdev)
351 ldo->desc.owner = THIS_MODULE; 351 ldo->desc.owner = THIS_MODULE;
352 352
353 ldo->regulator = regulator_register(&ldo->desc, &pdev->dev, 353 ldo->regulator = regulator_register(&ldo->desc, &pdev->dev,
354 pdata->ldo[id], ldo); 354 pdata->ldo[id], ldo, NULL);
355 if (IS_ERR(ldo->regulator)) { 355 if (IS_ERR(ldo->regulator)) {
356 ret = PTR_ERR(ldo->regulator); 356 ret = PTR_ERR(ldo->regulator);
357 dev_err(wm831x->dev, "Failed to register LDO%d: %d\n", 357 dev_err(wm831x->dev, "Failed to register LDO%d: %d\n",
@@ -621,7 +621,7 @@ static __devinit int wm831x_aldo_probe(struct platform_device *pdev)
621 ldo->desc.owner = THIS_MODULE; 621 ldo->desc.owner = THIS_MODULE;
622 622
623 ldo->regulator = regulator_register(&ldo->desc, &pdev->dev, 623 ldo->regulator = regulator_register(&ldo->desc, &pdev->dev,
624 pdata->ldo[id], ldo); 624 pdata->ldo[id], ldo, NULL);
625 if (IS_ERR(ldo->regulator)) { 625 if (IS_ERR(ldo->regulator)) {
626 ret = PTR_ERR(ldo->regulator); 626 ret = PTR_ERR(ldo->regulator);
627 dev_err(wm831x->dev, "Failed to register LDO%d: %d\n", 627 dev_err(wm831x->dev, "Failed to register LDO%d: %d\n",
@@ -818,7 +818,7 @@ static __devinit int wm831x_alive_ldo_probe(struct platform_device *pdev)
818 ldo->desc.owner = THIS_MODULE; 818 ldo->desc.owner = THIS_MODULE;
819 819
820 ldo->regulator = regulator_register(&ldo->desc, &pdev->dev, 820 ldo->regulator = regulator_register(&ldo->desc, &pdev->dev,
821 pdata->ldo[id], ldo); 821 pdata->ldo[id], ldo, NULL);
822 if (IS_ERR(ldo->regulator)) { 822 if (IS_ERR(ldo->regulator)) {
823 ret = PTR_ERR(ldo->regulator); 823 ret = PTR_ERR(ldo->regulator);
824 dev_err(wm831x->dev, "Failed to register LDO%d: %d\n", 824 dev_err(wm831x->dev, "Failed to register LDO%d: %d\n",
diff --git a/drivers/regulator/wm8350-regulator.c b/drivers/regulator/wm8350-regulator.c
index 1bcb22c44095..6894009d815a 100644
--- a/drivers/regulator/wm8350-regulator.c
+++ b/drivers/regulator/wm8350-regulator.c
@@ -1428,7 +1428,7 @@ static int wm8350_regulator_probe(struct platform_device *pdev)
1428 /* register regulator */ 1428 /* register regulator */
1429 rdev = regulator_register(&wm8350_reg[pdev->id], &pdev->dev, 1429 rdev = regulator_register(&wm8350_reg[pdev->id], &pdev->dev,
1430 pdev->dev.platform_data, 1430 pdev->dev.platform_data,
1431 dev_get_drvdata(&pdev->dev)); 1431 dev_get_drvdata(&pdev->dev), NULL);
1432 if (IS_ERR(rdev)) { 1432 if (IS_ERR(rdev)) {
1433 dev_err(&pdev->dev, "failed to register %s\n", 1433 dev_err(&pdev->dev, "failed to register %s\n",
1434 wm8350_reg[pdev->id].name); 1434 wm8350_reg[pdev->id].name);
diff --git a/drivers/regulator/wm8400-regulator.c b/drivers/regulator/wm8400-regulator.c
index 71632ddc3781..706f39563a7b 100644
--- a/drivers/regulator/wm8400-regulator.c
+++ b/drivers/regulator/wm8400-regulator.c
@@ -326,7 +326,7 @@ static int __devinit wm8400_regulator_probe(struct platform_device *pdev)
326 struct regulator_dev *rdev; 326 struct regulator_dev *rdev;
327 327
328 rdev = regulator_register(&regulators[pdev->id], &pdev->dev, 328 rdev = regulator_register(&regulators[pdev->id], &pdev->dev,
329 pdev->dev.platform_data, wm8400); 329 pdev->dev.platform_data, wm8400, NULL);
330 330
331 if (IS_ERR(rdev)) 331 if (IS_ERR(rdev))
332 return PTR_ERR(rdev); 332 return PTR_ERR(rdev);
diff --git a/drivers/regulator/wm8994-regulator.c b/drivers/regulator/wm8994-regulator.c
index b87bf5c841f8..435e335d6e67 100644
--- a/drivers/regulator/wm8994-regulator.c
+++ b/drivers/regulator/wm8994-regulator.c
@@ -269,7 +269,7 @@ static __devinit int wm8994_ldo_probe(struct platform_device *pdev)
269 ldo->is_enabled = true; 269 ldo->is_enabled = true;
270 270
271 ldo->regulator = regulator_register(&wm8994_ldo_desc[id], &pdev->dev, 271 ldo->regulator = regulator_register(&wm8994_ldo_desc[id], &pdev->dev,
272 pdata->ldo[id].init_data, ldo); 272 pdata->ldo[id].init_data, ldo, NULL);
273 if (IS_ERR(ldo->regulator)) { 273 if (IS_ERR(ldo->regulator)) {
274 ret = PTR_ERR(ldo->regulator); 274 ret = PTR_ERR(ldo->regulator);
275 dev_err(wm8994->dev, "Failed to register LDO%d: %d\n", 275 dev_err(wm8994->dev, "Failed to register LDO%d: %d\n",