aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/regulator/Kconfig9
-rw-r--r--drivers/regulator/Makefile1
-rw-r--r--drivers/regulator/tps65218-regulator.c285
-rw-r--r--drivers/regulator/tps6524x-regulator.c5
-rw-r--r--drivers/regulator/tps6586x-regulator.c20
-rw-r--r--drivers/regulator/tps65910-regulator.c21
-rw-r--r--drivers/regulator/tps80031-regulator.c6
-rw-r--r--drivers/regulator/wm831x-dcdc.c16
-rw-r--r--drivers/regulator/wm831x-isink.c4
-rw-r--r--drivers/regulator/wm831x-ldo.c12
-rw-r--r--drivers/regulator/wm8350-regulator.c4
-rw-r--r--drivers/regulator/wm8994-regulator.c4
12 files changed, 320 insertions, 67 deletions
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 8f3866c44a3f..1cd8584a7b88 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -535,6 +535,15 @@ config REGULATOR_TPS65217
535 voltage regulators. It supports software based voltage control 535 voltage regulators. It supports software based voltage control
536 for different voltage domains 536 for different voltage domains
537 537
538config REGULATOR_TPS65218
539 tristate "TI TPS65218 Power regulators"
540 depends on MFD_TPS65218 && OF
541 help
542 This driver supports TPS65218 voltage regulator chips. TPS65218
543 provides six step-down converters and one general-purpose LDO
544 voltage regulators. It supports software based voltage control
545 for different voltage domains
546
538config REGULATOR_TPS6524X 547config REGULATOR_TPS6524X
539 tristate "TI TPS6524X Power regulators" 548 tristate "TI TPS6524X Power regulators"
540 depends on SPI 549 depends on SPI
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index 0cfca37941ec..f0fe0c50b59c 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -70,6 +70,7 @@ obj-$(CONFIG_REGULATOR_TPS65023) += tps65023-regulator.o
70obj-$(CONFIG_REGULATOR_TPS6507X) += tps6507x-regulator.o 70obj-$(CONFIG_REGULATOR_TPS6507X) += tps6507x-regulator.o
71obj-$(CONFIG_REGULATOR_TPS65090) += tps65090-regulator.o 71obj-$(CONFIG_REGULATOR_TPS65090) += tps65090-regulator.o
72obj-$(CONFIG_REGULATOR_TPS65217) += tps65217-regulator.o 72obj-$(CONFIG_REGULATOR_TPS65217) += tps65217-regulator.o
73obj-$(CONFIG_REGULATOR_TPS65218) += tps65218-regulator.o
73obj-$(CONFIG_REGULATOR_TPS6524X) += tps6524x-regulator.o 74obj-$(CONFIG_REGULATOR_TPS6524X) += tps6524x-regulator.o
74obj-$(CONFIG_REGULATOR_TPS6586X) += tps6586x-regulator.o 75obj-$(CONFIG_REGULATOR_TPS6586X) += tps6586x-regulator.o
75obj-$(CONFIG_REGULATOR_TPS65910) += tps65910-regulator.o 76obj-$(CONFIG_REGULATOR_TPS65910) += tps65910-regulator.o
diff --git a/drivers/regulator/tps65218-regulator.c b/drivers/regulator/tps65218-regulator.c
new file mode 100644
index 000000000000..cec72fa71d1d
--- /dev/null
+++ b/drivers/regulator/tps65218-regulator.c
@@ -0,0 +1,285 @@
1/*
2 * tps65218-regulator.c
3 *
4 * Regulator driver for TPS65218 PMIC
5 *
6 * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
13 * kind, whether expressed or implied; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License version 2 for more details.
16 */
17
18#include <linux/kernel.h>
19#include <linux/module.h>
20#include <linux/device.h>
21#include <linux/init.h>
22#include <linux/err.h>
23#include <linux/platform_device.h>
24#include <linux/of_device.h>
25#include <linux/regulator/of_regulator.h>
26#include <linux/regulator/driver.h>
27#include <linux/regulator/machine.h>
28#include <linux/mfd/tps65218.h>
29
30static unsigned int tps65218_ramp_delay = 4000;
31
32enum tps65218_regulators { DCDC1, DCDC2, DCDC3, DCDC4, DCDC5, DCDC6, LDO1 };
33
34#define TPS65218_REGULATOR(_name, _id, _ops, _n, _vr, _vm, _er, _em, _t, \
35 _lr, _nlr) \
36 { \
37 .name = _name, \
38 .id = _id, \
39 .ops = &_ops, \
40 .n_voltages = _n, \
41 .type = REGULATOR_VOLTAGE, \
42 .owner = THIS_MODULE, \
43 .vsel_reg = _vr, \
44 .vsel_mask = _vm, \
45 .enable_reg = _er, \
46 .enable_mask = _em, \
47 .volt_table = _t, \
48 .linear_ranges = _lr, \
49 .n_linear_ranges = _nlr, \
50 } \
51
52#define TPS65218_INFO(_id, _nm, _min, _max) \
53 { \
54 .id = _id, \
55 .name = _nm, \
56 .min_uV = _min, \
57 .max_uV = _max, \
58 }
59
60static const struct regulator_linear_range dcdc1_dcdc2_ranges[] = {
61 REGULATOR_LINEAR_RANGE(850000, 0x0, 0x32, 10000),
62 REGULATOR_LINEAR_RANGE(1375000, 0x33, 0x3f, 25000),
63};
64
65static const struct regulator_linear_range ldo1_dcdc3_ranges[] = {
66 REGULATOR_LINEAR_RANGE(900000, 0x0, 0x1a, 25000),
67 REGULATOR_LINEAR_RANGE(1600000, 0x1b, 0x3f, 50000),
68};
69
70static const struct regulator_linear_range dcdc4_ranges[] = {
71 REGULATOR_LINEAR_RANGE(1175000, 0x0, 0xf, 25000),
72 REGULATOR_LINEAR_RANGE(1550000, 0x10, 0x34, 50000),
73};
74
75static struct tps_info tps65218_pmic_regs[] = {
76 TPS65218_INFO(0, "DCDC1", 850000, 167500),
77 TPS65218_INFO(1, "DCDC2", 850000, 1675000),
78 TPS65218_INFO(2, "DCDC3", 900000, 3400000),
79 TPS65218_INFO(3, "DCDC4", 1175000, 3400000),
80 TPS65218_INFO(4, "DCDC5", 1000000, 1000000),
81 TPS65218_INFO(5, "DCDC6", 1800000, 1800000),
82 TPS65218_INFO(6, "LDO1", 900000, 3400000),
83};
84
85#define TPS65218_OF_MATCH(comp, label) \
86 { \
87 .compatible = comp, \
88 .data = &label, \
89 }
90
91static const struct of_device_id tps65218_of_match[] = {
92 TPS65218_OF_MATCH("ti,tps65218-dcdc1", tps65218_pmic_regs[DCDC1]),
93 TPS65218_OF_MATCH("ti,tps65218-dcdc2", tps65218_pmic_regs[DCDC2]),
94 TPS65218_OF_MATCH("ti,tps65218-dcdc3", tps65218_pmic_regs[DCDC3]),
95 TPS65218_OF_MATCH("ti,tps65218-dcdc4", tps65218_pmic_regs[DCDC4]),
96 TPS65218_OF_MATCH("ti,tps65218-dcdc5", tps65218_pmic_regs[DCDC5]),
97 TPS65218_OF_MATCH("ti,tps65218-dcdc6", tps65218_pmic_regs[DCDC6]),
98 TPS65218_OF_MATCH("ti,tps65218-ldo1", tps65218_pmic_regs[LDO1]),
99 { }
100};
101MODULE_DEVICE_TABLE(of, tps65218_of_match);
102
103static int tps65218_pmic_set_voltage_sel(struct regulator_dev *dev,
104 unsigned selector)
105{
106 int ret;
107 struct tps65218 *tps = rdev_get_drvdata(dev);
108 unsigned int rid = rdev_get_id(dev);
109
110 /* Set the voltage based on vsel value and write protect level is 2 */
111 ret = tps65218_set_bits(tps, dev->desc->vsel_reg, dev->desc->vsel_mask,
112 selector, TPS65218_PROTECT_L1);
113
114 /* Set GO bit for DCDC1/2 to initiate voltage transistion */
115 switch (rid) {
116 case TPS65218_DCDC_1:
117 case TPS65218_DCDC_2:
118 ret = tps65218_set_bits(tps, TPS65218_REG_CONTRL_SLEW_RATE,
119 TPS65218_SLEW_RATE_GO,
120 TPS65218_SLEW_RATE_GO,
121 TPS65218_PROTECT_L1);
122 break;
123 }
124
125 return ret;
126}
127
128static int tps65218_pmic_enable(struct regulator_dev *dev)
129{
130 struct tps65218 *tps = rdev_get_drvdata(dev);
131 unsigned int rid = rdev_get_id(dev);
132
133 if (rid < TPS65218_DCDC_1 || rid > TPS65218_LDO_1)
134 return -EINVAL;
135
136 /* Enable the regulator and password protection is level 1 */
137 return tps65218_set_bits(tps, dev->desc->enable_reg,
138 dev->desc->enable_mask, dev->desc->enable_mask,
139 TPS65218_PROTECT_L1);
140}
141
142static int tps65218_pmic_disable(struct regulator_dev *dev)
143{
144 struct tps65218 *tps = rdev_get_drvdata(dev);
145 unsigned int rid = rdev_get_id(dev);
146
147 if (rid < TPS65218_DCDC_1 || rid > TPS65218_LDO_1)
148 return -EINVAL;
149
150 /* Disable the regulator and password protection is level 1 */
151 return tps65218_clear_bits(tps, dev->desc->enable_reg,
152 dev->desc->enable_mask, TPS65218_PROTECT_L1);
153}
154
155static int tps65218_set_voltage_time_sel(struct regulator_dev *rdev,
156 unsigned int old_selector, unsigned int new_selector)
157{
158 int old_uv, new_uv;
159
160 old_uv = regulator_list_voltage_linear_range(rdev, old_selector);
161 if (old_uv < 0)
162 return old_uv;
163
164 new_uv = regulator_list_voltage_linear_range(rdev, new_selector);
165 if (new_uv < 0)
166 return new_uv;
167
168 return DIV_ROUND_UP(abs(old_uv - new_uv), tps65218_ramp_delay);
169}
170
171/* Operations permitted on DCDC1, DCDC2 */
172static struct regulator_ops tps65218_dcdc12_ops = {
173 .is_enabled = regulator_is_enabled_regmap,
174 .enable = tps65218_pmic_enable,
175 .disable = tps65218_pmic_disable,
176 .get_voltage_sel = regulator_get_voltage_sel_regmap,
177 .set_voltage_sel = tps65218_pmic_set_voltage_sel,
178 .list_voltage = regulator_list_voltage_linear_range,
179 .map_voltage = regulator_map_voltage_linear_range,
180 .set_voltage_time_sel = tps65218_set_voltage_time_sel,
181};
182
183/* Operations permitted on DCDC3, DCDC4 and LDO1 */
184static struct regulator_ops tps65218_ldo1_dcdc34_ops = {
185 .is_enabled = regulator_is_enabled_regmap,
186 .enable = tps65218_pmic_enable,
187 .disable = tps65218_pmic_disable,
188 .get_voltage_sel = regulator_get_voltage_sel_regmap,
189 .set_voltage_sel = tps65218_pmic_set_voltage_sel,
190 .list_voltage = regulator_list_voltage_linear_range,
191 .map_voltage = regulator_map_voltage_linear_range,
192};
193
194/* Operations permitted on DCDC5, DCDC6 */
195static struct regulator_ops tps65218_dcdc56_pmic_ops = {
196 .is_enabled = regulator_is_enabled_regmap,
197 .enable = tps65218_pmic_enable,
198 .disable = tps65218_pmic_disable,
199};
200
201static const struct regulator_desc regulators[] = {
202 TPS65218_REGULATOR("DCDC1", TPS65218_DCDC_1, tps65218_dcdc12_ops, 64,
203 TPS65218_REG_CONTROL_DCDC1,
204 TPS65218_CONTROL_DCDC1_MASK,
205 TPS65218_REG_ENABLE1, TPS65218_ENABLE1_DC1_EN, NULL,
206 dcdc1_dcdc2_ranges, 2),
207 TPS65218_REGULATOR("DCDC2", TPS65218_DCDC_2, tps65218_dcdc12_ops, 64,
208 TPS65218_REG_CONTROL_DCDC2,
209 TPS65218_CONTROL_DCDC2_MASK,
210 TPS65218_REG_ENABLE1, TPS65218_ENABLE1_DC2_EN, NULL,
211 dcdc1_dcdc2_ranges, 2),
212 TPS65218_REGULATOR("DCDC3", TPS65218_DCDC_3, tps65218_ldo1_dcdc34_ops,
213 64, TPS65218_REG_CONTROL_DCDC3,
214 TPS65218_CONTROL_DCDC3_MASK, TPS65218_REG_ENABLE1,
215 TPS65218_ENABLE1_DC3_EN, NULL,
216 ldo1_dcdc3_ranges, 2),
217 TPS65218_REGULATOR("DCDC4", TPS65218_DCDC_4, tps65218_ldo1_dcdc34_ops,
218 53, TPS65218_REG_CONTROL_DCDC4,
219 TPS65218_CONTROL_DCDC4_MASK,
220 TPS65218_REG_ENABLE1, TPS65218_ENABLE1_DC4_EN, NULL,
221 dcdc4_ranges, 2),
222 TPS65218_REGULATOR("DCDC5", TPS65218_DCDC_5, tps65218_dcdc56_pmic_ops,
223 1, -1, -1, TPS65218_REG_ENABLE1,
224 TPS65218_ENABLE1_DC5_EN, NULL, NULL, 0),
225 TPS65218_REGULATOR("DCDC6", TPS65218_DCDC_6, tps65218_dcdc56_pmic_ops,
226 1, -1, -1, TPS65218_REG_ENABLE1,
227 TPS65218_ENABLE1_DC6_EN, NULL, NULL, 0),
228 TPS65218_REGULATOR("LDO1", TPS65218_LDO_1, tps65218_ldo1_dcdc34_ops, 64,
229 TPS65218_REG_CONTROL_DCDC4,
230 TPS65218_CONTROL_LDO1_MASK, TPS65218_REG_ENABLE2,
231 TPS65218_ENABLE2_LDO1_EN, NULL, ldo1_dcdc3_ranges,
232 2),
233};
234
235static int tps65218_regulator_probe(struct platform_device *pdev)
236{
237 struct tps65218 *tps = dev_get_drvdata(pdev->dev.parent);
238 struct regulator_init_data *init_data;
239 const struct tps_info *template;
240 struct regulator_dev *rdev;
241 const struct of_device_id *match;
242 struct regulator_config config = { };
243 int id;
244
245 match = of_match_device(tps65218_of_match, &pdev->dev);
246 if (!match)
247 return -ENODEV;
248
249 template = match->data;
250 id = template->id;
251 init_data = of_get_regulator_init_data(&pdev->dev, pdev->dev.of_node);
252
253 platform_set_drvdata(pdev, tps);
254
255 tps->info[id] = &tps65218_pmic_regs[id];
256 config.dev = &pdev->dev;
257 config.init_data = init_data;
258 config.driver_data = tps;
259 config.regmap = tps->regmap;
260
261 rdev = devm_regulator_register(&pdev->dev, &regulators[id], &config);
262 if (IS_ERR(rdev)) {
263 dev_err(tps->dev, "failed to register %s regulator\n",
264 pdev->name);
265 return PTR_ERR(rdev);
266 }
267
268 return 0;
269}
270
271static struct platform_driver tps65218_regulator_driver = {
272 .driver = {
273 .name = "tps65218-pmic",
274 .owner = THIS_MODULE,
275 .of_match_table = tps65218_of_match,
276 },
277 .probe = tps65218_regulator_probe,
278};
279
280module_platform_driver(tps65218_regulator_driver);
281
282MODULE_AUTHOR("J Keerthy <j-keerthy@ti.com>");
283MODULE_DESCRIPTION("TPS65218 voltage regulator driver");
284MODULE_ALIAS("platform:tps65218-pmic");
285MODULE_LICENSE("GPL v2");
diff --git a/drivers/regulator/tps6524x-regulator.c b/drivers/regulator/tps6524x-regulator.c
index 9f6bfda711b7..5b494db9f95c 100644
--- a/drivers/regulator/tps6524x-regulator.c
+++ b/drivers/regulator/tps6524x-regulator.c
@@ -593,10 +593,9 @@ static int pmic_probe(struct spi_device *spi)
593 } 593 }
594 594
595 hw = devm_kzalloc(&spi->dev, sizeof(struct tps6524x), GFP_KERNEL); 595 hw = devm_kzalloc(&spi->dev, sizeof(struct tps6524x), GFP_KERNEL);
596 if (!hw) { 596 if (!hw)
597 dev_err(dev, "cannot allocate regulator private data\n");
598 return -ENOMEM; 597 return -ENOMEM;
599 } 598
600 spi_set_drvdata(spi, hw); 599 spi_set_drvdata(spi, hw);
601 600
602 memset(hw, 0, sizeof(struct tps6524x)); 601 memset(hw, 0, sizeof(struct tps6524x));
diff --git a/drivers/regulator/tps6586x-regulator.c b/drivers/regulator/tps6586x-regulator.c
index 0485d47f0d8a..32f38a63d944 100644
--- a/drivers/regulator/tps6586x-regulator.c
+++ b/drivers/regulator/tps6586x-regulator.c
@@ -363,10 +363,8 @@ static struct tps6586x_platform_data *tps6586x_parse_regulator_dt(
363 } 363 }
364 364
365 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); 365 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
366 if (!pdata) { 366 if (!pdata)
367 dev_err(&pdev->dev, "Memory alloction failed\n");
368 return NULL; 367 return NULL;
369 }
370 368
371 for (i = 0; i < num; i++) { 369 for (i = 0; i < num; i++) {
372 int id; 370 int id;
@@ -398,7 +396,7 @@ static int tps6586x_regulator_probe(struct platform_device *pdev)
398{ 396{
399 struct tps6586x_regulator *ri = NULL; 397 struct tps6586x_regulator *ri = NULL;
400 struct regulator_config config = { }; 398 struct regulator_config config = { };
401 struct regulator_dev **rdev; 399 struct regulator_dev *rdev;
402 struct regulator_init_data *reg_data; 400 struct regulator_init_data *reg_data;
403 struct tps6586x_platform_data *pdata; 401 struct tps6586x_platform_data *pdata;
404 struct of_regulator_match *tps6586x_reg_matches = NULL; 402 struct of_regulator_match *tps6586x_reg_matches = NULL;
@@ -418,13 +416,6 @@ static int tps6586x_regulator_probe(struct platform_device *pdev)
418 return -ENODEV; 416 return -ENODEV;
419 } 417 }
420 418
421 rdev = devm_kzalloc(&pdev->dev, TPS6586X_ID_MAX_REGULATOR *
422 sizeof(*rdev), GFP_KERNEL);
423 if (!rdev) {
424 dev_err(&pdev->dev, "Mmemory alloc failed\n");
425 return -ENOMEM;
426 }
427
428 version = tps6586x_get_version(pdev->dev.parent); 419 version = tps6586x_get_version(pdev->dev.parent);
429 420
430 for (id = 0; id < TPS6586X_ID_MAX_REGULATOR; ++id) { 421 for (id = 0; id < TPS6586X_ID_MAX_REGULATOR; ++id) {
@@ -451,12 +442,11 @@ static int tps6586x_regulator_probe(struct platform_device *pdev)
451 if (tps6586x_reg_matches) 442 if (tps6586x_reg_matches)
452 config.of_node = tps6586x_reg_matches[id].of_node; 443 config.of_node = tps6586x_reg_matches[id].of_node;
453 444
454 rdev[id] = devm_regulator_register(&pdev->dev, &ri->desc, 445 rdev = devm_regulator_register(&pdev->dev, &ri->desc, &config);
455 &config); 446 if (IS_ERR(rdev)) {
456 if (IS_ERR(rdev[id])) {
457 dev_err(&pdev->dev, "failed to register regulator %s\n", 447 dev_err(&pdev->dev, "failed to register regulator %s\n",
458 ri->desc.name); 448 ri->desc.name);
459 return PTR_ERR(rdev[id]); 449 return PTR_ERR(rdev);
460 } 450 }
461 451
462 if (reg_data) { 452 if (reg_data) {
diff --git a/drivers/regulator/tps65910-regulator.c b/drivers/regulator/tps65910-regulator.c
index f50dd847eebc..fa7db8847578 100644
--- a/drivers/regulator/tps65910-regulator.c
+++ b/drivers/regulator/tps65910-regulator.c
@@ -1011,11 +1011,8 @@ static struct tps65910_board *tps65910_parse_dt_reg_data(
1011 1011
1012 pmic_plat_data = devm_kzalloc(&pdev->dev, sizeof(*pmic_plat_data), 1012 pmic_plat_data = devm_kzalloc(&pdev->dev, sizeof(*pmic_plat_data),
1013 GFP_KERNEL); 1013 GFP_KERNEL);
1014 1014 if (!pmic_plat_data)
1015 if (!pmic_plat_data) {
1016 dev_err(&pdev->dev, "Failure to alloc pdata for regulators.\n");
1017 return NULL; 1015 return NULL;
1018 }
1019 1016
1020 np = of_node_get(pdev->dev.parent->of_node); 1017 np = of_node_get(pdev->dev.parent->of_node);
1021 regulators = of_get_child_by_name(np, "regulators"); 1018 regulators = of_get_child_by_name(np, "regulators");
@@ -1098,10 +1095,8 @@ static int tps65910_probe(struct platform_device *pdev)
1098 } 1095 }
1099 1096
1100 pmic = devm_kzalloc(&pdev->dev, sizeof(*pmic), GFP_KERNEL); 1097 pmic = devm_kzalloc(&pdev->dev, sizeof(*pmic), GFP_KERNEL);
1101 if (!pmic) { 1098 if (!pmic)
1102 dev_err(&pdev->dev, "Memory allocation failed for pmic\n");
1103 return -ENOMEM; 1099 return -ENOMEM;
1104 }
1105 1100
1106 pmic->mfd = tps65910; 1101 pmic->mfd = tps65910;
1107 platform_set_drvdata(pdev, pmic); 1102 platform_set_drvdata(pdev, pmic);
@@ -1130,24 +1125,18 @@ static int tps65910_probe(struct platform_device *pdev)
1130 1125
1131 pmic->desc = devm_kzalloc(&pdev->dev, pmic->num_regulators * 1126 pmic->desc = devm_kzalloc(&pdev->dev, pmic->num_regulators *
1132 sizeof(struct regulator_desc), GFP_KERNEL); 1127 sizeof(struct regulator_desc), GFP_KERNEL);
1133 if (!pmic->desc) { 1128 if (!pmic->desc)
1134 dev_err(&pdev->dev, "Memory alloc fails for desc\n");
1135 return -ENOMEM; 1129 return -ENOMEM;
1136 }
1137 1130
1138 pmic->info = devm_kzalloc(&pdev->dev, pmic->num_regulators * 1131 pmic->info = devm_kzalloc(&pdev->dev, pmic->num_regulators *
1139 sizeof(struct tps_info *), GFP_KERNEL); 1132 sizeof(struct tps_info *), GFP_KERNEL);
1140 if (!pmic->info) { 1133 if (!pmic->info)
1141 dev_err(&pdev->dev, "Memory alloc fails for info\n");
1142 return -ENOMEM; 1134 return -ENOMEM;
1143 }
1144 1135
1145 pmic->rdev = devm_kzalloc(&pdev->dev, pmic->num_regulators * 1136 pmic->rdev = devm_kzalloc(&pdev->dev, pmic->num_regulators *
1146 sizeof(struct regulator_dev *), GFP_KERNEL); 1137 sizeof(struct regulator_dev *), GFP_KERNEL);
1147 if (!pmic->rdev) { 1138 if (!pmic->rdev)
1148 dev_err(&pdev->dev, "Memory alloc fails for rdev\n");
1149 return -ENOMEM; 1139 return -ENOMEM;
1150 }
1151 1140
1152 for (i = 0; i < pmic->num_regulators && i < TPS65910_NUM_REGS; 1141 for (i = 0; i < pmic->num_regulators && i < TPS65910_NUM_REGS;
1153 i++, info++) { 1142 i++, info++) {
diff --git a/drivers/regulator/tps80031-regulator.c b/drivers/regulator/tps80031-regulator.c
index 71f457a42623..26aa6d9c308f 100644
--- a/drivers/regulator/tps80031-regulator.c
+++ b/drivers/regulator/tps80031-regulator.c
@@ -115,7 +115,7 @@ static int tps80031_reg_is_enabled(struct regulator_dev *rdev)
115 ri->rinfo->state_reg, ret); 115 ri->rinfo->state_reg, ret);
116 return ret; 116 return ret;
117 } 117 }
118 return ((reg_val & TPS80031_STATE_MASK) == TPS80031_STATE_ON); 118 return (reg_val & TPS80031_STATE_MASK) == TPS80031_STATE_ON;
119} 119}
120 120
121static int tps80031_reg_enable(struct regulator_dev *rdev) 121static int tps80031_reg_enable(struct regulator_dev *rdev)
@@ -693,10 +693,8 @@ static int tps80031_regulator_probe(struct platform_device *pdev)
693 693
694 pmic = devm_kzalloc(&pdev->dev, 694 pmic = devm_kzalloc(&pdev->dev,
695 TPS80031_REGULATOR_MAX * sizeof(*pmic), GFP_KERNEL); 695 TPS80031_REGULATOR_MAX * sizeof(*pmic), GFP_KERNEL);
696 if (!pmic) { 696 if (!pmic)
697 dev_err(&pdev->dev, "mem alloc for pmic failed\n");
698 return -ENOMEM; 697 return -ENOMEM;
699 }
700 698
701 for (num = 0; num < TPS80031_REGULATOR_MAX; ++num) { 699 for (num = 0; num < TPS80031_REGULATOR_MAX; ++num) {
702 tps_pdata = pdata->regulator_pdata[num]; 700 tps_pdata = pdata->regulator_pdata[num];
diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c
index 04cf9c16ef23..0d88a82ab2a2 100644
--- a/drivers/regulator/wm831x-dcdc.c
+++ b/drivers/regulator/wm831x-dcdc.c
@@ -469,10 +469,8 @@ static int wm831x_buckv_probe(struct platform_device *pdev)
469 469
470 dcdc = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_dcdc), 470 dcdc = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_dcdc),
471 GFP_KERNEL); 471 GFP_KERNEL);
472 if (dcdc == NULL) { 472 if (!dcdc)
473 dev_err(&pdev->dev, "Unable to allocate private data\n");
474 return -ENOMEM; 473 return -ENOMEM;
475 }
476 474
477 dcdc->wm831x = wm831x; 475 dcdc->wm831x = wm831x;
478 476
@@ -622,10 +620,8 @@ static int wm831x_buckp_probe(struct platform_device *pdev)
622 620
623 dcdc = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_dcdc), 621 dcdc = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_dcdc),
624 GFP_KERNEL); 622 GFP_KERNEL);
625 if (dcdc == NULL) { 623 if (!dcdc)
626 dev_err(&pdev->dev, "Unable to allocate private data\n");
627 return -ENOMEM; 624 return -ENOMEM;
628 }
629 625
630 dcdc->wm831x = wm831x; 626 dcdc->wm831x = wm831x;
631 627
@@ -752,10 +748,8 @@ static int wm831x_boostp_probe(struct platform_device *pdev)
752 return -ENODEV; 748 return -ENODEV;
753 749
754 dcdc = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_dcdc), GFP_KERNEL); 750 dcdc = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_dcdc), GFP_KERNEL);
755 if (dcdc == NULL) { 751 if (!dcdc)
756 dev_err(&pdev->dev, "Unable to allocate private data\n");
757 return -ENOMEM; 752 return -ENOMEM;
758 }
759 753
760 dcdc->wm831x = wm831x; 754 dcdc->wm831x = wm831x;
761 755
@@ -842,10 +836,8 @@ static int wm831x_epe_probe(struct platform_device *pdev)
842 dev_dbg(&pdev->dev, "Probing EPE%d\n", id + 1); 836 dev_dbg(&pdev->dev, "Probing EPE%d\n", id + 1);
843 837
844 dcdc = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_dcdc), GFP_KERNEL); 838 dcdc = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_dcdc), GFP_KERNEL);
845 if (dcdc == NULL) { 839 if (!dcdc)
846 dev_err(&pdev->dev, "Unable to allocate private data\n");
847 return -ENOMEM; 840 return -ENOMEM;
848 }
849 841
850 dcdc->wm831x = wm831x; 842 dcdc->wm831x = wm831x;
851 843
diff --git a/drivers/regulator/wm831x-isink.c b/drivers/regulator/wm831x-isink.c
index 0339b886df5d..72e385e76a9d 100644
--- a/drivers/regulator/wm831x-isink.c
+++ b/drivers/regulator/wm831x-isink.c
@@ -165,10 +165,8 @@ static int wm831x_isink_probe(struct platform_device *pdev)
165 165
166 isink = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_isink), 166 isink = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_isink),
167 GFP_KERNEL); 167 GFP_KERNEL);
168 if (isink == NULL) { 168 if (!isink)
169 dev_err(&pdev->dev, "Unable to allocate private data\n");
170 return -ENOMEM; 169 return -ENOMEM;
171 }
172 170
173 isink->wm831x = wm831x; 171 isink->wm831x = wm831x;
174 172
diff --git a/drivers/regulator/wm831x-ldo.c b/drivers/regulator/wm831x-ldo.c
index 46d6700467b5..eca0eeb78acd 100644
--- a/drivers/regulator/wm831x-ldo.c
+++ b/drivers/regulator/wm831x-ldo.c
@@ -235,10 +235,8 @@ static int wm831x_gp_ldo_probe(struct platform_device *pdev)
235 dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1); 235 dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1);
236 236
237 ldo = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_ldo), GFP_KERNEL); 237 ldo = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_ldo), GFP_KERNEL);
238 if (ldo == NULL) { 238 if (!ldo)
239 dev_err(&pdev->dev, "Unable to allocate private data\n");
240 return -ENOMEM; 239 return -ENOMEM;
241 }
242 240
243 ldo->wm831x = wm831x; 241 ldo->wm831x = wm831x;
244 242
@@ -447,10 +445,8 @@ static int wm831x_aldo_probe(struct platform_device *pdev)
447 dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1); 445 dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1);
448 446
449 ldo = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_ldo), GFP_KERNEL); 447 ldo = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_ldo), GFP_KERNEL);
450 if (ldo == NULL) { 448 if (!ldo)
451 dev_err(&pdev->dev, "Unable to allocate private data\n");
452 return -ENOMEM; 449 return -ENOMEM;
453 }
454 450
455 ldo->wm831x = wm831x; 451 ldo->wm831x = wm831x;
456 452
@@ -594,10 +590,8 @@ static int wm831x_alive_ldo_probe(struct platform_device *pdev)
594 dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1); 590 dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1);
595 591
596 ldo = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_ldo), GFP_KERNEL); 592 ldo = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_ldo), GFP_KERNEL);
597 if (ldo == NULL) { 593 if (!ldo)
598 dev_err(&pdev->dev, "Unable to allocate private data\n");
599 return -ENOMEM; 594 return -ENOMEM;
600 }
601 595
602 ldo->wm831x = wm831x; 596 ldo->wm831x = wm831x;
603 597
diff --git a/drivers/regulator/wm8350-regulator.c b/drivers/regulator/wm8350-regulator.c
index de7b9c73e3fa..7ec7c390eeda 100644
--- a/drivers/regulator/wm8350-regulator.c
+++ b/drivers/regulator/wm8350-regulator.c
@@ -361,7 +361,7 @@ static int wm8350_dcdc_set_suspend_voltage(struct regulator_dev *rdev, int uV)
361 361
362 sel = regulator_map_voltage_linear(rdev, uV, uV); 362 sel = regulator_map_voltage_linear(rdev, uV, uV);
363 if (sel < 0) 363 if (sel < 0)
364 return -EINVAL; 364 return sel;
365 365
366 /* all DCDCs have same mV bits */ 366 /* all DCDCs have same mV bits */
367 val = wm8350_reg_read(wm8350, volt_reg) & ~WM8350_DC1_VSEL_MASK; 367 val = wm8350_reg_read(wm8350, volt_reg) & ~WM8350_DC1_VSEL_MASK;
@@ -574,7 +574,7 @@ static int wm8350_ldo_set_suspend_voltage(struct regulator_dev *rdev, int uV)
574 574
575 sel = regulator_map_voltage_linear_range(rdev, uV, uV); 575 sel = regulator_map_voltage_linear_range(rdev, uV, uV);
576 if (sel < 0) 576 if (sel < 0)
577 return -EINVAL; 577 return sel;
578 578
579 /* all LDOs have same mV bits */ 579 /* all LDOs have same mV bits */
580 val = wm8350_reg_read(wm8350, volt_reg) & ~WM8350_LDO1_VSEL_MASK; 580 val = wm8350_reg_read(wm8350, volt_reg) & ~WM8350_LDO1_VSEL_MASK;
diff --git a/drivers/regulator/wm8994-regulator.c b/drivers/regulator/wm8994-regulator.c
index 71c5911f2e71..c24346db8a71 100644
--- a/drivers/regulator/wm8994-regulator.c
+++ b/drivers/regulator/wm8994-regulator.c
@@ -134,10 +134,8 @@ static int wm8994_ldo_probe(struct platform_device *pdev)
134 dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1); 134 dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1);
135 135
136 ldo = devm_kzalloc(&pdev->dev, sizeof(struct wm8994_ldo), GFP_KERNEL); 136 ldo = devm_kzalloc(&pdev->dev, sizeof(struct wm8994_ldo), GFP_KERNEL);
137 if (ldo == NULL) { 137 if (!ldo)
138 dev_err(&pdev->dev, "Unable to allocate private data\n");
139 return -ENOMEM; 138 return -ENOMEM;
140 }
141 139
142 ldo->wm8994 = wm8994; 140 ldo->wm8994 = wm8994;
143 ldo->supply = wm8994_ldo_consumer[id]; 141 ldo->supply = wm8994_ldo_consumer[id];