aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2009-11-10 03:18:07 -0500
committerLiam Girdwood <lrg@slimlogic.co.uk>2009-12-17 05:27:26 -0500
commita10099bc8884397f54c9b73831b0529850fe23d3 (patch)
treeccbe143527145294f8612094bdad046ef8a9e3d1 /drivers/regulator
parentb4b90c659d88d09dcb4e34dce5123458cb1b5071 (diff)
regulator/mc13783: various cleanups
- define needed registers and bits in the driver - properly namespace functions and structs - fix locking as required by patch "mfd/mc13783: near complete rewrite" - use platform_data as provided by "mfd/mc13783: near complete rewrite" instead of accessing struct mc13783 - struct mc13783_regulator_priv.desc is (and was) unused and so can go away - use cpp magic to initialize mc13783_regulators - bring MODULE_LICENSE in sync with actual copyright - minor style fixes This allows not including mc13783-private.h which I intend to remove soon. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Cc: Sascha Hauer <s.hauer@pengutronix.de> Cc: Liam Girdwood <lrg@slimlogic.co.uk> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: Samuel Ortiz <sameo@linux.intel.com> Acked-by: Mark Brown <broonie@opensoruce.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/mc13783-regulator.c389
1 files changed, 112 insertions, 277 deletions
diff --git a/drivers/regulator/mc13783-regulator.c b/drivers/regulator/mc13783-regulator.c
index 710211f67449..9f99862ec3a6 100644
--- a/drivers/regulator/mc13783-regulator.c
+++ b/drivers/regulator/mc13783-regulator.c
@@ -8,15 +8,47 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10
11#include <linux/mfd/mc13783-private.h> 11#include <linux/mfd/mc13783.h>
12#include <linux/regulator/machine.h> 12#include <linux/regulator/machine.h>
13#include <linux/regulator/driver.h> 13#include <linux/regulator/driver.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/mfd/mc13783.h>
16#include <linux/kernel.h> 15#include <linux/kernel.h>
17#include <linux/init.h> 16#include <linux/init.h>
18#include <linux/err.h> 17#include <linux/err.h>
19 18
19#define MC13783_REG_SWITCHERS4 28
20#define MC13783_REG_SWITCHERS4_PLLEN (1 << 18)
21
22#define MC13783_REG_SWITCHERS5 29
23#define MC13783_REG_SWITCHERS5_SW3EN (1 << 20)
24
25#define MC13783_REG_REGULATORMODE0 32
26#define MC13783_REG_REGULATORMODE0_VAUDIOEN (1 << 0)
27#define MC13783_REG_REGULATORMODE0_VIOHIEN (1 << 3)
28#define MC13783_REG_REGULATORMODE0_VIOLOEN (1 << 6)
29#define MC13783_REG_REGULATORMODE0_VDIGEN (1 << 9)
30#define MC13783_REG_REGULATORMODE0_VGENEN (1 << 12)
31#define MC13783_REG_REGULATORMODE0_VRFDIGEN (1 << 15)
32#define MC13783_REG_REGULATORMODE0_VRFREFEN (1 << 18)
33#define MC13783_REG_REGULATORMODE0_VRFCPEN (1 << 21)
34
35#define MC13783_REG_REGULATORMODE1 33
36#define MC13783_REG_REGULATORMODE1_VSIMEN (1 << 0)
37#define MC13783_REG_REGULATORMODE1_VESIMEN (1 << 3)
38#define MC13783_REG_REGULATORMODE1_VCAMEN (1 << 6)
39#define MC13783_REG_REGULATORMODE1_VRFBGEN (1 << 9)
40#define MC13783_REG_REGULATORMODE1_VVIBEN (1 << 11)
41#define MC13783_REG_REGULATORMODE1_VRF1EN (1 << 12)
42#define MC13783_REG_REGULATORMODE1_VRF2EN (1 << 15)
43#define MC13783_REG_REGULATORMODE1_VMMC1EN (1 << 18)
44#define MC13783_REG_REGULATORMODE1_VMMC2EN (1 << 21)
45
46#define MC13783_REG_POWERMISC 34
47#define MC13783_REG_POWERMISC_GPO1EN (1 << 6)
48#define MC13783_REG_POWERMISC_GPO2EN (1 << 8)
49#define MC13783_REG_POWERMISC_GPO3EN (1 << 10)
50#define MC13783_REG_POWERMISC_GPO4EN (1 << 12)
51
20struct mc13783_regulator { 52struct mc13783_regulator {
21 struct regulator_desc desc; 53 struct regulator_desc desc;
22 int reg; 54 int reg;
@@ -25,298 +57,97 @@ struct mc13783_regulator {
25 57
26static struct regulator_ops mc13783_regulator_ops; 58static struct regulator_ops mc13783_regulator_ops;
27 59
60#define MC13783_DEFINE(prefix, _name, _reg) \
61 [MC13783_ ## prefix ## _ ## _name] = { \
62 .desc = { \
63 .name = #prefix "_" #_name, \
64 .ops = &mc13783_regulator_ops, \
65 .type = REGULATOR_VOLTAGE, \
66 .id = MC13783_ ## prefix ## _ ## _name, \
67 .owner = THIS_MODULE, \
68 }, \
69 .reg = MC13783_REG_ ## _reg, \
70 .enable_bit = MC13783_REG_ ## _reg ## _ ## _name ## EN, \
71 }
72
73#define MC13783_DEFINE_SW(_name, _reg) MC13783_DEFINE(SW, _name, _reg)
74#define MC13783_DEFINE_REGU(_name, _reg) MC13783_DEFINE(REGU, _name, _reg)
75
28static struct mc13783_regulator mc13783_regulators[] = { 76static struct mc13783_regulator mc13783_regulators[] = {
29 [MC13783_SW_SW3] = { 77 MC13783_DEFINE_SW(SW3, SWITCHERS5),
30 .desc = { 78 MC13783_DEFINE_SW(PLL, SWITCHERS4),
31 .name = "SW_SW3", 79
32 .ops = &mc13783_regulator_ops, 80 MC13783_DEFINE_REGU(VAUDIO, REGULATORMODE0),
33 .type = REGULATOR_VOLTAGE, 81 MC13783_DEFINE_REGU(VIOHI, REGULATORMODE0),
34 .id = MC13783_SW_SW3, 82 MC13783_DEFINE_REGU(VIOLO, REGULATORMODE0),
35 .owner = THIS_MODULE, 83 MC13783_DEFINE_REGU(VDIG, REGULATORMODE0),
36 }, 84 MC13783_DEFINE_REGU(VGEN, REGULATORMODE0),
37 .reg = MC13783_REG_SWITCHERS_5, 85 MC13783_DEFINE_REGU(VRFDIG, REGULATORMODE0),
38 .enable_bit = MC13783_SWCTRL_SW3_EN, 86 MC13783_DEFINE_REGU(VRFREF, REGULATORMODE0),
39 }, 87 MC13783_DEFINE_REGU(VRFCP, REGULATORMODE0),
40 [MC13783_SW_PLL] = { 88 MC13783_DEFINE_REGU(VSIM, REGULATORMODE1),
41 .desc = { 89 MC13783_DEFINE_REGU(VESIM, REGULATORMODE1),
42 .name = "SW_PLL", 90 MC13783_DEFINE_REGU(VCAM, REGULATORMODE1),
43 .ops = &mc13783_regulator_ops, 91 MC13783_DEFINE_REGU(VRFBG, REGULATORMODE1),
44 .type = REGULATOR_VOLTAGE, 92 MC13783_DEFINE_REGU(VVIB, REGULATORMODE1),
45 .id = MC13783_SW_PLL, 93 MC13783_DEFINE_REGU(VRF1, REGULATORMODE1),
46 .owner = THIS_MODULE, 94 MC13783_DEFINE_REGU(VRF2, REGULATORMODE1),
47 }, 95 MC13783_DEFINE_REGU(VMMC1, REGULATORMODE1),
48 .reg = MC13783_REG_SWITCHERS_4, 96 MC13783_DEFINE_REGU(VMMC2, REGULATORMODE1),
49 .enable_bit = MC13783_SWCTRL_PLL_EN, 97 MC13783_DEFINE_REGU(GPO1, POWERMISC),
50 }, 98 MC13783_DEFINE_REGU(GPO2, POWERMISC),
51 [MC13783_REGU_VAUDIO] = { 99 MC13783_DEFINE_REGU(GPO3, POWERMISC),
52 .desc = { 100 MC13783_DEFINE_REGU(GPO4, POWERMISC),
53 .name = "REGU_VAUDIO",
54 .ops = &mc13783_regulator_ops,
55 .type = REGULATOR_VOLTAGE,
56 .id = MC13783_REGU_VAUDIO,
57 .owner = THIS_MODULE,
58 },
59 .reg = MC13783_REG_REGULATOR_MODE_0,
60 .enable_bit = MC13783_REGCTRL_VAUDIO_EN,
61 },
62 [MC13783_REGU_VIOHI] = {
63 .desc = {
64 .name = "REGU_VIOHI",
65 .ops = &mc13783_regulator_ops,
66 .type = REGULATOR_VOLTAGE,
67 .id = MC13783_REGU_VIOHI,
68 .owner = THIS_MODULE,
69 },
70 .reg = MC13783_REG_REGULATOR_MODE_0,
71 .enable_bit = MC13783_REGCTRL_VIOHI_EN,
72 },
73 [MC13783_REGU_VIOLO] = {
74 .desc = {
75 .name = "REGU_VIOLO",
76 .ops = &mc13783_regulator_ops,
77 .type = REGULATOR_VOLTAGE,
78 .id = MC13783_REGU_VIOLO,
79 .owner = THIS_MODULE,
80 },
81 .reg = MC13783_REG_REGULATOR_MODE_0,
82 .enable_bit = MC13783_REGCTRL_VIOLO_EN,
83 },
84 [MC13783_REGU_VDIG] = {
85 .desc = {
86 .name = "REGU_VDIG",
87 .ops = &mc13783_regulator_ops,
88 .type = REGULATOR_VOLTAGE,
89 .id = MC13783_REGU_VDIG,
90 .owner = THIS_MODULE,
91 },
92 .reg = MC13783_REG_REGULATOR_MODE_0,
93 .enable_bit = MC13783_REGCTRL_VDIG_EN,
94 },
95 [MC13783_REGU_VGEN] = {
96 .desc = {
97 .name = "REGU_VGEN",
98 .ops = &mc13783_regulator_ops,
99 .type = REGULATOR_VOLTAGE,
100 .id = MC13783_REGU_VGEN,
101 .owner = THIS_MODULE,
102 },
103 .reg = MC13783_REG_REGULATOR_MODE_0,
104 .enable_bit = MC13783_REGCTRL_VGEN_EN,
105 },
106 [MC13783_REGU_VRFDIG] = {
107 .desc = {
108 .name = "REGU_VRFDIG",
109 .ops = &mc13783_regulator_ops,
110 .type = REGULATOR_VOLTAGE,
111 .id = MC13783_REGU_VRFDIG,
112 .owner = THIS_MODULE,
113 },
114 .reg = MC13783_REG_REGULATOR_MODE_0,
115 .enable_bit = MC13783_REGCTRL_VRFDIG_EN,
116 },
117 [MC13783_REGU_VRFREF] = {
118 .desc = {
119 .name = "REGU_VRFREF",
120 .ops = &mc13783_regulator_ops,
121 .type = REGULATOR_VOLTAGE,
122 .id = MC13783_REGU_VRFREF,
123 .owner = THIS_MODULE,
124 },
125 .reg = MC13783_REG_REGULATOR_MODE_0,
126 .enable_bit = MC13783_REGCTRL_VRFREF_EN,
127 },
128 [MC13783_REGU_VRFCP] = {
129 .desc = {
130 .name = "REGU_VRFCP",
131 .ops = &mc13783_regulator_ops,
132 .type = REGULATOR_VOLTAGE,
133 .id = MC13783_REGU_VRFCP,
134 .owner = THIS_MODULE,
135 },
136 .reg = MC13783_REG_REGULATOR_MODE_0,
137 .enable_bit = MC13783_REGCTRL_VRFCP_EN,
138 },
139 [MC13783_REGU_VSIM] = {
140 .desc = {
141 .name = "REGU_VSIM",
142 .ops = &mc13783_regulator_ops,
143 .type = REGULATOR_VOLTAGE,
144 .id = MC13783_REGU_VSIM,
145 .owner = THIS_MODULE,
146 },
147 .reg = MC13783_REG_REGULATOR_MODE_1,
148 .enable_bit = MC13783_REGCTRL_VSIM_EN,
149 },
150 [MC13783_REGU_VESIM] = {
151 .desc = {
152 .name = "REGU_VESIM",
153 .ops = &mc13783_regulator_ops,
154 .type = REGULATOR_VOLTAGE,
155 .id = MC13783_REGU_VESIM,
156 .owner = THIS_MODULE,
157 },
158 .reg = MC13783_REG_REGULATOR_MODE_1,
159 .enable_bit = MC13783_REGCTRL_VESIM_EN,
160 },
161 [MC13783_REGU_VCAM] = {
162 .desc = {
163 .name = "REGU_VCAM",
164 .ops = &mc13783_regulator_ops,
165 .type = REGULATOR_VOLTAGE,
166 .id = MC13783_REGU_VCAM,
167 .owner = THIS_MODULE,
168 },
169 .reg = MC13783_REG_REGULATOR_MODE_1,
170 .enable_bit = MC13783_REGCTRL_VCAM_EN,
171 },
172 [MC13783_REGU_VRFBG] = {
173 .desc = {
174 .name = "REGU_VRFBG",
175 .ops = &mc13783_regulator_ops,
176 .type = REGULATOR_VOLTAGE,
177 .id = MC13783_REGU_VRFBG,
178 .owner = THIS_MODULE,
179 },
180 .reg = MC13783_REG_REGULATOR_MODE_1,
181 .enable_bit = MC13783_REGCTRL_VRFBG_EN,
182 },
183 [MC13783_REGU_VVIB] = {
184 .desc = {
185 .name = "REGU_VVIB",
186 .ops = &mc13783_regulator_ops,
187 .type = REGULATOR_VOLTAGE,
188 .id = MC13783_REGU_VVIB,
189 .owner = THIS_MODULE,
190 },
191 .reg = MC13783_REG_REGULATOR_MODE_1,
192 .enable_bit = MC13783_REGCTRL_VVIB_EN,
193 },
194 [MC13783_REGU_VRF1] = {
195 .desc = {
196 .name = "REGU_VRF1",
197 .ops = &mc13783_regulator_ops,
198 .type = REGULATOR_VOLTAGE,
199 .id = MC13783_REGU_VRF1,
200 .owner = THIS_MODULE,
201 },
202 .reg = MC13783_REG_REGULATOR_MODE_1,
203 .enable_bit = MC13783_REGCTRL_VRF1_EN,
204 },
205 [MC13783_REGU_VRF2] = {
206 .desc = {
207 .name = "REGU_VRF2",
208 .ops = &mc13783_regulator_ops,
209 .type = REGULATOR_VOLTAGE,
210 .id = MC13783_REGU_VRF2,
211 .owner = THIS_MODULE,
212 },
213 .reg = MC13783_REG_REGULATOR_MODE_1,
214 .enable_bit = MC13783_REGCTRL_VRF2_EN,
215 },
216 [MC13783_REGU_VMMC1] = {
217 .desc = {
218 .name = "REGU_VMMC1",
219 .ops = &mc13783_regulator_ops,
220 .type = REGULATOR_VOLTAGE,
221 .id = MC13783_REGU_VMMC1,
222 .owner = THIS_MODULE,
223 },
224 .reg = MC13783_REG_REGULATOR_MODE_1,
225 .enable_bit = MC13783_REGCTRL_VMMC1_EN,
226 },
227 [MC13783_REGU_VMMC2] = {
228 .desc = {
229 .name = "REGU_VMMC2",
230 .ops = &mc13783_regulator_ops,
231 .type = REGULATOR_VOLTAGE,
232 .id = MC13783_REGU_VMMC2,
233 .owner = THIS_MODULE,
234 },
235 .reg = MC13783_REG_REGULATOR_MODE_1,
236 .enable_bit = MC13783_REGCTRL_VMMC2_EN,
237 },
238 [MC13783_REGU_GPO1] = {
239 .desc = {
240 .name = "REGU_GPO1",
241 .ops = &mc13783_regulator_ops,
242 .type = REGULATOR_VOLTAGE,
243 .id = MC13783_REGU_GPO1,
244 .owner = THIS_MODULE,
245 },
246 .reg = MC13783_REG_POWER_MISCELLANEOUS,
247 .enable_bit = MC13783_REGCTRL_GPO1_EN,
248 },
249 [MC13783_REGU_GPO2] = {
250 .desc = {
251 .name = "REGU_GPO2",
252 .ops = &mc13783_regulator_ops,
253 .type = REGULATOR_VOLTAGE,
254 .id = MC13783_REGU_GPO2,
255 .owner = THIS_MODULE,
256 },
257 .reg = MC13783_REG_POWER_MISCELLANEOUS,
258 .enable_bit = MC13783_REGCTRL_GPO2_EN,
259 },
260 [MC13783_REGU_GPO3] = {
261 .desc = {
262 .name = "REGU_GPO3",
263 .ops = &mc13783_regulator_ops,
264 .type = REGULATOR_VOLTAGE,
265 .id = MC13783_REGU_GPO3,
266 .owner = THIS_MODULE,
267 },
268 .reg = MC13783_REG_POWER_MISCELLANEOUS,
269 .enable_bit = MC13783_REGCTRL_GPO3_EN,
270 },
271 [MC13783_REGU_GPO4] = {
272 .desc = {
273 .name = "REGU_GPO4",
274 .ops = &mc13783_regulator_ops,
275 .type = REGULATOR_VOLTAGE,
276 .id = MC13783_REGU_GPO4,
277 .owner = THIS_MODULE,
278 },
279 .reg = MC13783_REG_POWER_MISCELLANEOUS,
280 .enable_bit = MC13783_REGCTRL_GPO4_EN,
281 },
282}; 101};
283 102
284struct mc13783_priv { 103struct mc13783_regulator_priv {
285 struct regulator_desc desc[ARRAY_SIZE(mc13783_regulators)];
286 struct mc13783 *mc13783; 104 struct mc13783 *mc13783;
287 struct regulator_dev *regulators[0]; 105 struct regulator_dev *regulators[];
288}; 106};
289 107
290static int mc13783_enable(struct regulator_dev *rdev) 108static int mc13783_regulator_enable(struct regulator_dev *rdev)
291{ 109{
292 struct mc13783_priv *priv = rdev_get_drvdata(rdev); 110 struct mc13783_regulator_priv *priv = rdev_get_drvdata(rdev);
293 int id = rdev_get_id(rdev); 111 int id = rdev_get_id(rdev);
112 int ret;
294 113
295 dev_dbg(rdev_get_dev(rdev), "%s id: %d\n", __func__, id); 114 dev_dbg(rdev_get_dev(rdev), "%s id: %d\n", __func__, id);
296 115
297 return mc13783_set_bits(priv->mc13783, mc13783_regulators[id].reg, 116 mc13783_lock(priv->mc13783);
117 ret = mc13783_reg_rmw(priv->mc13783, mc13783_regulators[id].reg,
298 mc13783_regulators[id].enable_bit, 118 mc13783_regulators[id].enable_bit,
299 mc13783_regulators[id].enable_bit); 119 mc13783_regulators[id].enable_bit);
120 mc13783_unlock(priv->mc13783);
121
122 return ret;
300} 123}
301 124
302static int mc13783_disable(struct regulator_dev *rdev) 125static int mc13783_regulator_disable(struct regulator_dev *rdev)
303{ 126{
304 struct mc13783_priv *priv = rdev_get_drvdata(rdev); 127 struct mc13783_regulator_priv *priv = rdev_get_drvdata(rdev);
305 int id = rdev_get_id(rdev); 128 int id = rdev_get_id(rdev);
129 int ret;
306 130
307 dev_dbg(rdev_get_dev(rdev), "%s id: %d\n", __func__, id); 131 dev_dbg(rdev_get_dev(rdev), "%s id: %d\n", __func__, id);
308 132
309 return mc13783_set_bits(priv->mc13783, mc13783_regulators[id].reg, 133 mc13783_lock(priv->mc13783);
134 ret = mc13783_reg_rmw(priv->mc13783, mc13783_regulators[id].reg,
310 mc13783_regulators[id].enable_bit, 0); 135 mc13783_regulators[id].enable_bit, 0);
136 mc13783_unlock(priv->mc13783);
137
138 return ret;
311} 139}
312 140
313static int mc13783_is_enabled(struct regulator_dev *rdev) 141static int mc13783_regulator_is_enabled(struct regulator_dev *rdev)
314{ 142{
315 struct mc13783_priv *priv = rdev_get_drvdata(rdev); 143 struct mc13783_regulator_priv *priv = rdev_get_drvdata(rdev);
316 int ret, id = rdev_get_id(rdev); 144 int ret, id = rdev_get_id(rdev);
317 unsigned int val; 145 unsigned int val;
318 146
147 mc13783_lock(priv->mc13783);
319 ret = mc13783_reg_read(priv->mc13783, mc13783_regulators[id].reg, &val); 148 ret = mc13783_reg_read(priv->mc13783, mc13783_regulators[id].reg, &val);
149 mc13783_unlock(priv->mc13783);
150
320 if (ret) 151 if (ret)
321 return ret; 152 return ret;
322 153
@@ -324,29 +155,32 @@ static int mc13783_is_enabled(struct regulator_dev *rdev)
324} 155}
325 156
326static struct regulator_ops mc13783_regulator_ops = { 157static struct regulator_ops mc13783_regulator_ops = {
327 .enable = mc13783_enable, 158 .enable = mc13783_regulator_enable,
328 .disable = mc13783_disable, 159 .disable = mc13783_regulator_disable,
329 .is_enabled = mc13783_is_enabled, 160 .is_enabled = mc13783_regulator_is_enabled,
330}; 161};
331 162
332static int __devinit mc13783_regulator_probe(struct platform_device *pdev) 163static int __devinit mc13783_regulator_probe(struct platform_device *pdev)
333{ 164{
334 struct mc13783_priv *priv; 165 struct mc13783_regulator_priv *priv;
335 struct mc13783 *mc13783 = dev_get_drvdata(pdev->dev.parent); 166 struct mc13783 *mc13783 = dev_get_drvdata(pdev->dev.parent);
167 struct mc13783_regulator_platform_data *pdata =
168 dev_get_platdata(&pdev->dev);
336 struct mc13783_regulator_init_data *init_data; 169 struct mc13783_regulator_init_data *init_data;
337 int i, ret; 170 int i, ret;
338 171
339 dev_dbg(&pdev->dev, "mc13783_regulator_probe id %d\n", pdev->id); 172 dev_dbg(&pdev->dev, "mc13783_regulator_probe id %d\n", pdev->id);
340 173
341 priv = kzalloc(sizeof(*priv) + mc13783->num_regulators * sizeof(void *), 174 priv = kzalloc(sizeof(*priv) +
175 pdata->num_regulators * sizeof(priv->regulators[0]),
342 GFP_KERNEL); 176 GFP_KERNEL);
343 if (!priv) 177 if (!priv)
344 return -ENOMEM; 178 return -ENOMEM;
345 179
346 priv->mc13783 = mc13783; 180 priv->mc13783 = mc13783;
347 181
348 for (i = 0; i < mc13783->num_regulators; i++) { 182 for (i = 0; i < pdata->num_regulators; i++) {
349 init_data = &mc13783->regulators[i]; 183 init_data = &pdata->regulators[i];
350 priv->regulators[i] = regulator_register( 184 priv->regulators[i] = regulator_register(
351 &mc13783_regulators[init_data->id].desc, 185 &mc13783_regulators[init_data->id].desc,
352 &pdev->dev, init_data->init_data, priv); 186 &pdev->dev, init_data->init_data, priv);
@@ -373,11 +207,12 @@ err:
373 207
374static int __devexit mc13783_regulator_remove(struct platform_device *pdev) 208static int __devexit mc13783_regulator_remove(struct platform_device *pdev)
375{ 209{
376 struct mc13783_priv *priv = platform_get_drvdata(pdev); 210 struct mc13783_regulator_priv *priv = platform_get_drvdata(pdev);
377 struct mc13783 *mc13783 = priv->mc13783; 211 struct mc13783_regulator_platform_data *pdata =
212 dev_get_platdata(&pdev->dev);
378 int i; 213 int i;
379 214
380 for (i = 0; i < mc13783->num_regulators; i++) 215 for (i = 0; i < pdata->num_regulators; i++)
381 regulator_unregister(priv->regulators[i]); 216 regulator_unregister(priv->regulators[i]);
382 217
383 return 0; 218 return 0;
@@ -404,7 +239,7 @@ static void __exit mc13783_regulator_exit(void)
404} 239}
405module_exit(mc13783_regulator_exit); 240module_exit(mc13783_regulator_exit);
406 241
407MODULE_LICENSE("GPL"); 242MODULE_LICENSE("GPL v2");
408MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de"); 243MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de");
409MODULE_DESCRIPTION("Regulator Driver for Freescale MC13783 PMIC"); 244MODULE_DESCRIPTION("Regulator Driver for Freescale MC13783 PMIC");
410MODULE_ALIAS("platform:mc13783-regulator"); 245MODULE_ALIAS("platform:mc13783-regulator");