aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/core.c2
-rw-r--r--drivers/regulator/fixed.c1
-rw-r--r--drivers/regulator/lp3971.c11
-rw-r--r--drivers/regulator/max1586.c3
-rw-r--r--drivers/regulator/max8649.c4
-rw-r--r--drivers/regulator/max8660.c3
-rw-r--r--drivers/regulator/max8925-regulator.c6
-rw-r--r--drivers/regulator/mc13783-regulator.c4
-rw-r--r--drivers/regulator/tps65023-regulator.c1
-rw-r--r--drivers/regulator/tps6507x-regulator.c1
-rw-r--r--drivers/regulator/userspace-consumer.c1
-rw-r--r--drivers/regulator/virtual.c1
-rw-r--r--drivers/regulator/wm831x-dcdc.c1
-rw-r--r--drivers/regulator/wm831x-isink.c1
-rw-r--r--drivers/regulator/wm831x-ldo.c1
-rw-r--r--drivers/regulator/wm8994-regulator.c1
16 files changed, 35 insertions, 7 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 7461f5bb2bd8..51cf2bb37438 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -16,6 +16,7 @@
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/device.h> 18#include <linux/device.h>
19#include <linux/slab.h>
19#include <linux/err.h> 20#include <linux/err.h>
20#include <linux/mutex.h> 21#include <linux/mutex.h>
21#include <linux/suspend.h> 22#include <linux/suspend.h>
@@ -1038,6 +1039,7 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
1038 goto overflow_err; 1039 goto overflow_err;
1039 1040
1040 regulator->dev = dev; 1041 regulator->dev = dev;
1042 sysfs_attr_init(&regulator->dev_attr.attr);
1041 regulator->dev_attr.attr.name = kstrdup(buf, GFP_KERNEL); 1043 regulator->dev_attr.attr.name = kstrdup(buf, GFP_KERNEL);
1042 if (regulator->dev_attr.attr.name == NULL) 1044 if (regulator->dev_attr.attr.name == NULL)
1043 goto attr_name_err; 1045 goto attr_name_err;
diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
index d11f7622430b..2fe9d99c9f23 100644
--- a/drivers/regulator/fixed.c
+++ b/drivers/regulator/fixed.c
@@ -25,6 +25,7 @@
25#include <linux/regulator/fixed.h> 25#include <linux/regulator/fixed.h>
26#include <linux/gpio.h> 26#include <linux/gpio.h>
27#include <linux/delay.h> 27#include <linux/delay.h>
28#include <linux/slab.h>
28 29
29struct fixed_voltage_data { 30struct fixed_voltage_data {
30 struct regulator_desc desc; 31 struct regulator_desc desc;
diff --git a/drivers/regulator/lp3971.c b/drivers/regulator/lp3971.c
index f5532ed79272..671a7d1f1f0e 100644
--- a/drivers/regulator/lp3971.c
+++ b/drivers/regulator/lp3971.c
@@ -18,6 +18,7 @@
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/regulator/driver.h> 19#include <linux/regulator/driver.h>
20#include <linux/regulator/lp3971.h> 20#include <linux/regulator/lp3971.h>
21#include <linux/slab.h>
21 22
22struct lp3971 { 23struct lp3971 {
23 struct device *dev; 24 struct device *dev;
@@ -45,7 +46,7 @@ static int lp3971_set_bits(struct lp3971 *lp3971, u8 reg, u16 mask, u16 val);
45 LP3971_BUCK2 -> 4 46 LP3971_BUCK2 -> 4
46 LP3971_BUCK3 -> 6 47 LP3971_BUCK3 -> 6
47*/ 48*/
48#define BUCK_VOL_CHANGE_SHIFT(x) (((1 << x) & ~0x01) << 1) 49#define BUCK_VOL_CHANGE_SHIFT(x) (((!!x) << 2) | (x & ~0x01))
49#define BUCK_VOL_CHANGE_FLAG_GO 0x01 50#define BUCK_VOL_CHANGE_FLAG_GO 0x01
50#define BUCK_VOL_CHANGE_FLAG_TARGET 0x02 51#define BUCK_VOL_CHANGE_FLAG_TARGET 0x02
51#define BUCK_VOL_CHANGE_FLAG_MASK 0x03 52#define BUCK_VOL_CHANGE_FLAG_MASK 0x03
@@ -187,7 +188,8 @@ static int lp3971_ldo_set_voltage(struct regulator_dev *dev,
187 return -EINVAL; 188 return -EINVAL;
188 189
189 return lp3971_set_bits(lp3971, LP3971_LDO_VOL_CONTR_REG(ldo), 190 return lp3971_set_bits(lp3971, LP3971_LDO_VOL_CONTR_REG(ldo),
190 LDO_VOL_CONTR_MASK << LDO_VOL_CONTR_SHIFT(ldo), val); 191 LDO_VOL_CONTR_MASK << LDO_VOL_CONTR_SHIFT(ldo),
192 val << LDO_VOL_CONTR_SHIFT(ldo));
191} 193}
192 194
193static struct regulator_ops lp3971_ldo_ops = { 195static struct regulator_ops lp3971_ldo_ops = {
@@ -439,6 +441,10 @@ static int __devinit setup_regulators(struct lp3971 *lp3971,
439 lp3971->num_regulators = pdata->num_regulators; 441 lp3971->num_regulators = pdata->num_regulators;
440 lp3971->rdev = kcalloc(pdata->num_regulators, 442 lp3971->rdev = kcalloc(pdata->num_regulators,
441 sizeof(struct regulator_dev *), GFP_KERNEL); 443 sizeof(struct regulator_dev *), GFP_KERNEL);
444 if (!lp3971->rdev) {
445 err = -ENOMEM;
446 goto err_nomem;
447 }
442 448
443 /* Instantiate the regulators */ 449 /* Instantiate the regulators */
444 for (i = 0; i < pdata->num_regulators; i++) { 450 for (i = 0; i < pdata->num_regulators; i++) {
@@ -461,6 +467,7 @@ error:
461 regulator_unregister(lp3971->rdev[i]); 467 regulator_unregister(lp3971->rdev[i]);
462 kfree(lp3971->rdev); 468 kfree(lp3971->rdev);
463 lp3971->rdev = NULL; 469 lp3971->rdev = NULL;
470err_nomem:
464 return err; 471 return err;
465} 472}
466 473
diff --git a/drivers/regulator/max1586.c b/drivers/regulator/max1586.c
index a49fc952c9a9..b3c1afc16889 100644
--- a/drivers/regulator/max1586.c
+++ b/drivers/regulator/max1586.c
@@ -22,6 +22,7 @@
22#include <linux/i2c.h> 22#include <linux/i2c.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/regulator/driver.h> 24#include <linux/regulator/driver.h>
25#include <linux/slab.h>
25#include <linux/regulator/max1586.h> 26#include <linux/regulator/max1586.h>
26 27
27#define MAX1586_V3_MAX_VSEL 31 28#define MAX1586_V3_MAX_VSEL 31
@@ -243,8 +244,8 @@ static int __devexit max1586_pmic_remove(struct i2c_client *client)
243 for (i = 0; i <= MAX1586_V6; i++) 244 for (i = 0; i <= MAX1586_V6; i++)
244 if (rdev[i]) 245 if (rdev[i])
245 regulator_unregister(rdev[i]); 246 regulator_unregister(rdev[i]);
246 kfree(rdev);
247 i2c_set_clientdata(client, NULL); 247 i2c_set_clientdata(client, NULL);
248 kfree(rdev);
248 249
249 return 0; 250 return 0;
250} 251}
diff --git a/drivers/regulator/max8649.c b/drivers/regulator/max8649.c
index 3ebdf698c648..bfc4c5ffdc96 100644
--- a/drivers/regulator/max8649.c
+++ b/drivers/regulator/max8649.c
@@ -14,6 +14,7 @@
14#include <linux/i2c.h> 14#include <linux/i2c.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/regulator/driver.h> 16#include <linux/regulator/driver.h>
17#include <linux/slab.h>
17#include <linux/regulator/max8649.h> 18#include <linux/regulator/max8649.h>
18 19
19#define MAX8649_DCDC_VMIN 750000 /* uV */ 20#define MAX8649_DCDC_VMIN 750000 /* uV */
@@ -356,6 +357,7 @@ static int __devinit max8649_regulator_probe(struct i2c_client *client,
356 dev_info(info->dev, "Max8649 regulator device is detected.\n"); 357 dev_info(info->dev, "Max8649 regulator device is detected.\n");
357 return 0; 358 return 0;
358out: 359out:
360 i2c_set_clientdata(client, NULL);
359 kfree(info); 361 kfree(info);
360 return ret; 362 return ret;
361} 363}
@@ -367,9 +369,9 @@ static int __devexit max8649_regulator_remove(struct i2c_client *client)
367 if (info) { 369 if (info) {
368 if (info->regulator) 370 if (info->regulator)
369 regulator_unregister(info->regulator); 371 regulator_unregister(info->regulator);
372 i2c_set_clientdata(client, NULL);
370 kfree(info); 373 kfree(info);
371 } 374 }
372 i2c_set_clientdata(client, NULL);
373 375
374 return 0; 376 return 0;
375} 377}
diff --git a/drivers/regulator/max8660.c b/drivers/regulator/max8660.c
index f12f1bb62138..3790b21879ff 100644
--- a/drivers/regulator/max8660.c
+++ b/drivers/regulator/max8660.c
@@ -42,6 +42,7 @@
42#include <linux/i2c.h> 42#include <linux/i2c.h>
43#include <linux/platform_device.h> 43#include <linux/platform_device.h>
44#include <linux/regulator/driver.h> 44#include <linux/regulator/driver.h>
45#include <linux/slab.h>
45#include <linux/regulator/max8660.h> 46#include <linux/regulator/max8660.h>
46 47
47#define MAX8660_DCDC_MIN_UV 725000 48#define MAX8660_DCDC_MIN_UV 725000
@@ -470,8 +471,8 @@ static int __devexit max8660_remove(struct i2c_client *client)
470 for (i = 0; i < MAX8660_V_END; i++) 471 for (i = 0; i < MAX8660_V_END; i++)
471 if (rdev[i]) 472 if (rdev[i])
472 regulator_unregister(rdev[i]); 473 regulator_unregister(rdev[i]);
473 kfree(rdev);
474 i2c_set_clientdata(client, NULL); 474 i2c_set_clientdata(client, NULL);
475 kfree(rdev);
475 476
476 return 0; 477 return 0;
477} 478}
diff --git a/drivers/regulator/max8925-regulator.c b/drivers/regulator/max8925-regulator.c
index 67873f08ed40..b6218f11c957 100644
--- a/drivers/regulator/max8925-regulator.c
+++ b/drivers/regulator/max8925-regulator.c
@@ -230,7 +230,7 @@ static struct max8925_regulator_info max8925_regulator_info[] = {
230 MAX8925_LDO(20, 750, 3900, 50), 230 MAX8925_LDO(20, 750, 3900, 50),
231}; 231};
232 232
233static inline struct max8925_regulator_info *find_regulator_info(int id) 233static struct max8925_regulator_info * __devinit find_regulator_info(int id)
234{ 234{
235 struct max8925_regulator_info *ri; 235 struct max8925_regulator_info *ri;
236 int i; 236 int i;
@@ -247,7 +247,7 @@ static int __devinit max8925_regulator_probe(struct platform_device *pdev)
247{ 247{
248 struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); 248 struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent);
249 struct max8925_platform_data *pdata = chip->dev->platform_data; 249 struct max8925_platform_data *pdata = chip->dev->platform_data;
250 struct max8925_regulator_info *ri = NULL; 250 struct max8925_regulator_info *ri;
251 struct regulator_dev *rdev; 251 struct regulator_dev *rdev;
252 252
253 ri = find_regulator_info(pdev->id); 253 ri = find_regulator_info(pdev->id);
@@ -274,7 +274,9 @@ static int __devexit max8925_regulator_remove(struct platform_device *pdev)
274{ 274{
275 struct regulator_dev *rdev = platform_get_drvdata(pdev); 275 struct regulator_dev *rdev = platform_get_drvdata(pdev);
276 276
277 platform_set_drvdata(pdev, NULL);
277 regulator_unregister(rdev); 278 regulator_unregister(rdev);
279
278 return 0; 280 return 0;
279} 281}
280 282
diff --git a/drivers/regulator/mc13783-regulator.c b/drivers/regulator/mc13783-regulator.c
index f7b81845a196..ad036dd8da13 100644
--- a/drivers/regulator/mc13783-regulator.c
+++ b/drivers/regulator/mc13783-regulator.c
@@ -14,6 +14,7 @@
14#include <linux/regulator/driver.h> 14#include <linux/regulator/driver.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/slab.h>
17#include <linux/init.h> 18#include <linux/init.h>
18#include <linux/err.h> 19#include <linux/err.h>
19 20
@@ -617,9 +618,12 @@ static int __devexit mc13783_regulator_remove(struct platform_device *pdev)
617 dev_get_platdata(&pdev->dev); 618 dev_get_platdata(&pdev->dev);
618 int i; 619 int i;
619 620
621 platform_set_drvdata(pdev, NULL);
622
620 for (i = 0; i < pdata->num_regulators; i++) 623 for (i = 0; i < pdata->num_regulators; i++)
621 regulator_unregister(priv->regulators[i]); 624 regulator_unregister(priv->regulators[i]);
622 625
626 kfree(priv);
623 return 0; 627 return 0;
624} 628}
625 629
diff --git a/drivers/regulator/tps65023-regulator.c b/drivers/regulator/tps65023-regulator.c
index 1f183543bdbd..8e2f2098b005 100644
--- a/drivers/regulator/tps65023-regulator.c
+++ b/drivers/regulator/tps65023-regulator.c
@@ -24,6 +24,7 @@
24#include <linux/regulator/machine.h> 24#include <linux/regulator/machine.h>
25#include <linux/i2c.h> 25#include <linux/i2c.h>
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/slab.h>
27 28
28/* Register definitions */ 29/* Register definitions */
29#define TPS65023_REG_VERSION 0 30#define TPS65023_REG_VERSION 0
diff --git a/drivers/regulator/tps6507x-regulator.c b/drivers/regulator/tps6507x-regulator.c
index c2a9539acd72..74841abcc9cc 100644
--- a/drivers/regulator/tps6507x-regulator.c
+++ b/drivers/regulator/tps6507x-regulator.c
@@ -24,6 +24,7 @@
24#include <linux/regulator/machine.h> 24#include <linux/regulator/machine.h>
25#include <linux/i2c.h> 25#include <linux/i2c.h>
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/slab.h>
27 28
28/* Register definitions */ 29/* Register definitions */
29#define TPS6507X_REG_PPATH1 0X01 30#define TPS6507X_REG_PPATH1 0X01
diff --git a/drivers/regulator/userspace-consumer.c b/drivers/regulator/userspace-consumer.c
index 44917da4ac97..9d5ba9357597 100644
--- a/drivers/regulator/userspace-consumer.c
+++ b/drivers/regulator/userspace-consumer.c
@@ -21,6 +21,7 @@
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/regulator/consumer.h> 22#include <linux/regulator/consumer.h>
23#include <linux/regulator/userspace-consumer.h> 23#include <linux/regulator/userspace-consumer.h>
24#include <linux/slab.h>
24 25
25struct userspace_consumer_data { 26struct userspace_consumer_data {
26 const char *name; 27 const char *name;
diff --git a/drivers/regulator/virtual.c b/drivers/regulator/virtual.c
index d96cecaac73d..69e550f57638 100644
--- a/drivers/regulator/virtual.c
+++ b/drivers/regulator/virtual.c
@@ -15,6 +15,7 @@
15#include <linux/mutex.h> 15#include <linux/mutex.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/regulator/consumer.h> 17#include <linux/regulator/consumer.h>
18#include <linux/slab.h>
18 19
19struct virtual_consumer_data { 20struct virtual_consumer_data {
20 struct mutex lock; 21 struct mutex lock;
diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c
index 6e18e56d850b..dbfaf5945e48 100644
--- a/drivers/regulator/wm831x-dcdc.c
+++ b/drivers/regulator/wm831x-dcdc.c
@@ -21,6 +21,7 @@
21#include <linux/regulator/driver.h> 21#include <linux/regulator/driver.h>
22#include <linux/regulator/machine.h> 22#include <linux/regulator/machine.h>
23#include <linux/gpio.h> 23#include <linux/gpio.h>
24#include <linux/slab.h>
24 25
25#include <linux/mfd/wm831x/core.h> 26#include <linux/mfd/wm831x/core.h>
26#include <linux/mfd/wm831x/regulator.h> 27#include <linux/mfd/wm831x/regulator.h>
diff --git a/drivers/regulator/wm831x-isink.c b/drivers/regulator/wm831x-isink.c
index ca0f6b6c384b..6c446cd6ad54 100644
--- a/drivers/regulator/wm831x-isink.c
+++ b/drivers/regulator/wm831x-isink.c
@@ -19,6 +19,7 @@
19#include <linux/i2c.h> 19#include <linux/i2c.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/regulator/driver.h> 21#include <linux/regulator/driver.h>
22#include <linux/slab.h>
22 23
23#include <linux/mfd/wm831x/core.h> 24#include <linux/mfd/wm831x/core.h>
24#include <linux/mfd/wm831x/regulator.h> 25#include <linux/mfd/wm831x/regulator.h>
diff --git a/drivers/regulator/wm831x-ldo.c b/drivers/regulator/wm831x-ldo.c
index d2406c1519a1..e686cdb61b97 100644
--- a/drivers/regulator/wm831x-ldo.c
+++ b/drivers/regulator/wm831x-ldo.c
@@ -19,6 +19,7 @@
19#include <linux/i2c.h> 19#include <linux/i2c.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/regulator/driver.h> 21#include <linux/regulator/driver.h>
22#include <linux/slab.h>
22 23
23#include <linux/mfd/wm831x/core.h> 24#include <linux/mfd/wm831x/core.h>
24#include <linux/mfd/wm831x/regulator.h> 25#include <linux/mfd/wm831x/regulator.h>
diff --git a/drivers/regulator/wm8994-regulator.c b/drivers/regulator/wm8994-regulator.c
index 95454a4637b7..5a1dc8a24d35 100644
--- a/drivers/regulator/wm8994-regulator.c
+++ b/drivers/regulator/wm8994-regulator.c
@@ -19,6 +19,7 @@
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/regulator/driver.h> 20#include <linux/regulator/driver.h>
21#include <linux/gpio.h> 21#include <linux/gpio.h>
22#include <linux/slab.h>
22 23
23#include <linux/mfd/wm8994/core.h> 24#include <linux/mfd/wm8994/core.h>
24#include <linux/mfd/wm8994/registers.h> 25#include <linux/mfd/wm8994/registers.h>