1 // SPDX-License-Identifier: GPL-2.0+
3 // Copyright (C) 2011-2013 Freescale Semiconductor, Inc. All Rights Reserved.
5 #include <linux/kernel.h>
6 #include <linux/module.h>
7 #include <linux/init.h>
10 #include <linux/of_device.h>
11 #include <linux/regulator/of_regulator.h>
12 #include <linux/platform_device.h>
13 #include <linux/regulator/driver.h>
14 #include <linux/regulator/machine.h>
15 #include <linux/regulator/pfuze100.h>
16 #include <linux/i2c.h>
17 #include <linux/slab.h>
18 #include <linux/regmap.h>
20 #define PFUZE_NUMREGS 128
21 #define PFUZE100_VOL_OFFSET 0
22 #define PFUZE100_STANDBY_OFFSET 1
23 #define PFUZE100_MODE_OFFSET 3
24 #define PFUZE100_CONF_OFFSET 4
26 #define PFUZE100_DEVICEID 0x0
27 #define PFUZE100_REVID 0x3
28 #define PFUZE100_FABID 0x4
30 #define PFUZE100_COINVOL 0x1a
31 #define PFUZE100_SW1ABVOL 0x20
32 #define PFUZE100_SW1CVOL 0x2e
33 #define PFUZE100_SW2VOL 0x35
34 #define PFUZE100_SW3AVOL 0x3c
35 #define PFUZE100_SW3BVOL 0x43
36 #define PFUZE100_SW4VOL 0x4a
37 #define PFUZE100_SWBSTCON1 0x66
38 #define PFUZE100_VREFDDRCON 0x6a
39 #define PFUZE100_VSNVSVOL 0x6b
40 #define PFUZE100_VGEN1VOL 0x6c
41 #define PFUZE100_VGEN2VOL 0x6d
42 #define PFUZE100_VGEN3VOL 0x6e
43 #define PFUZE100_VGEN4VOL 0x6f
44 #define PFUZE100_VGEN5VOL 0x70
45 #define PFUZE100_VGEN6VOL 0x71
47 enum chips { PFUZE100, PFUZE200, PFUZE3000 = 3 };
49 struct pfuze_regulator {
50 struct regulator_desc desc;
51 unsigned char stby_reg;
52 unsigned char stby_mask;
57 struct regmap *regmap;
59 struct pfuze_regulator regulator_descs[PFUZE100_MAX_REGULATOR];
60 struct regulator_dev *regulators[PFUZE100_MAX_REGULATOR];
61 struct pfuze_regulator *pfuze_regulators;
64 static const int pfuze100_swbst[] = {
65 5000000, 5050000, 5100000, 5150000,
68 static const int pfuze100_vsnvs[] = {
69 1000000, 1100000, 1200000, 1300000, 1500000, 1800000, 3000000,
72 static const int pfuze100_coin[] = {
73 2500000, 2700000, 2800000, 2900000, 3000000, 3100000, 3200000, 3300000,
76 static const int pfuze3000_sw1a[] = {
77 700000, 725000, 750000, 775000, 800000, 825000, 850000, 875000,
78 900000, 925000, 950000, 975000, 1000000, 1025000, 1050000, 1075000,
79 1100000, 1125000, 1150000, 1175000, 1200000, 1225000, 1250000, 1275000,
80 1300000, 1325000, 1350000, 1375000, 1400000, 1425000, 1800000, 3300000,
83 static const int pfuze3000_sw2lo[] = {
84 1500000, 1550000, 1600000, 1650000, 1700000, 1750000, 1800000, 1850000,
87 static const int pfuze3000_sw2hi[] = {
88 2500000, 2800000, 2850000, 3000000, 3100000, 3150000, 3200000, 3300000,
91 static const struct i2c_device_id pfuze_device_id[] = {
92 {.name = "pfuze100", .driver_data = PFUZE100},
93 {.name = "pfuze200", .driver_data = PFUZE200},
94 {.name = "pfuze3000", .driver_data = PFUZE3000},
97 MODULE_DEVICE_TABLE(i2c, pfuze_device_id);
99 static const struct of_device_id pfuze_dt_ids[] = {
100 { .compatible = "fsl,pfuze100", .data = (void *)PFUZE100},
101 { .compatible = "fsl,pfuze200", .data = (void *)PFUZE200},
102 { .compatible = "fsl,pfuze3000", .data = (void *)PFUZE3000},
105 MODULE_DEVICE_TABLE(of, pfuze_dt_ids);
107 static int pfuze100_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay)
109 struct pfuze_chip *pfuze100 = rdev_get_drvdata(rdev);
110 int id = rdev_get_id(rdev);
111 unsigned int ramp_bits;
114 if (id < PFUZE100_SWBST) {
115 ramp_delay = 12500 / ramp_delay;
116 ramp_bits = (ramp_delay >> 1) - (ramp_delay >> 3);
117 ret = regmap_update_bits(pfuze100->regmap,
118 rdev->desc->vsel_reg + 4,
119 0xc0, ramp_bits << 6);
121 dev_err(pfuze100->dev, "ramp failed, err %d\n", ret);
128 static const struct regulator_ops pfuze100_ldo_regulator_ops = {
129 .enable = regulator_enable_regmap,
130 .disable = regulator_disable_regmap,
131 .is_enabled = regulator_is_enabled_regmap,
132 .list_voltage = regulator_list_voltage_linear,
133 .set_voltage_sel = regulator_set_voltage_sel_regmap,
134 .get_voltage_sel = regulator_get_voltage_sel_regmap,
137 static const struct regulator_ops pfuze100_fixed_regulator_ops = {
138 .enable = regulator_enable_regmap,
139 .disable = regulator_disable_regmap,
140 .is_enabled = regulator_is_enabled_regmap,
141 .list_voltage = regulator_list_voltage_linear,
144 static const struct regulator_ops pfuze100_sw_regulator_ops = {
145 .enable = regulator_enable_regmap,
146 .disable = regulator_disable_regmap,
147 .is_enabled = regulator_is_enabled_regmap,
148 .list_voltage = regulator_list_voltage_linear,
149 .set_voltage_sel = regulator_set_voltage_sel_regmap,
150 .get_voltage_sel = regulator_get_voltage_sel_regmap,
151 .set_voltage_time_sel = regulator_set_voltage_time_sel,
152 .set_ramp_delay = pfuze100_set_ramp_delay,
155 static const struct regulator_ops pfuze100_swb_regulator_ops = {
156 .enable = regulator_enable_regmap,
157 .disable = regulator_disable_regmap,
158 .is_enabled = regulator_is_enabled_regmap,
159 .list_voltage = regulator_list_voltage_table,
160 .map_voltage = regulator_map_voltage_ascend,
161 .set_voltage_sel = regulator_set_voltage_sel_regmap,
162 .get_voltage_sel = regulator_get_voltage_sel_regmap,
166 #define PFUZE100_FIXED_REG(_chip, _name, base, voltage) \
167 [_chip ## _ ## _name] = { \
171 .ops = &pfuze100_fixed_regulator_ops, \
172 .type = REGULATOR_VOLTAGE, \
173 .id = _chip ## _ ## _name, \
174 .owner = THIS_MODULE, \
175 .min_uV = (voltage), \
176 .enable_reg = (base), \
177 .enable_mask = 0x10, \
181 #define PFUZE100_SW_REG(_chip, _name, base, min, max, step) \
182 [_chip ## _ ## _name] = { \
185 .n_voltages = ((max) - (min)) / (step) + 1, \
186 .ops = &pfuze100_sw_regulator_ops, \
187 .type = REGULATOR_VOLTAGE, \
188 .id = _chip ## _ ## _name, \
189 .owner = THIS_MODULE, \
192 .vsel_reg = (base) + PFUZE100_VOL_OFFSET, \
194 .enable_reg = (base) + PFUZE100_MODE_OFFSET, \
196 .disable_val = 0x0, \
197 .enable_mask = 0xf, \
198 .enable_time = 500, \
200 .stby_reg = (base) + PFUZE100_STANDBY_OFFSET, \
204 #define PFUZE100_SWB_REG(_chip, _name, base, mask, voltages) \
205 [_chip ## _ ## _name] = { \
208 .n_voltages = ARRAY_SIZE(voltages), \
209 .ops = &pfuze100_swb_regulator_ops, \
210 .type = REGULATOR_VOLTAGE, \
211 .id = _chip ## _ ## _name, \
212 .owner = THIS_MODULE, \
213 .volt_table = voltages, \
214 .vsel_reg = (base), \
215 .vsel_mask = (mask), \
216 .enable_reg = (base), \
217 .enable_mask = 0x48, \
221 #define PFUZE100_VGEN_REG(_chip, _name, base, min, max, step) \
222 [_chip ## _ ## _name] = { \
225 .n_voltages = ((max) - (min)) / (step) + 1, \
226 .ops = &pfuze100_ldo_regulator_ops, \
227 .type = REGULATOR_VOLTAGE, \
228 .id = _chip ## _ ## _name, \
229 .owner = THIS_MODULE, \
232 .vsel_reg = (base), \
234 .enable_reg = (base), \
235 .enable_mask = 0x10, \
237 .stby_reg = (base), \
241 #define PFUZE100_COIN_REG(_chip, _name, base, mask, voltages) \
242 [_chip ## _ ## _name] = { \
245 .n_voltages = ARRAY_SIZE(voltages), \
246 .ops = &pfuze100_swb_regulator_ops, \
247 .type = REGULATOR_VOLTAGE, \
248 .id = _chip ## _ ## _name, \
249 .owner = THIS_MODULE, \
250 .volt_table = voltages, \
251 .vsel_reg = (base), \
252 .vsel_mask = (mask), \
253 .enable_reg = (base), \
254 .enable_mask = 0x8, \
258 #define PFUZE3000_VCC_REG(_chip, _name, base, min, max, step) { \
261 .n_voltages = ((max) - (min)) / (step) + 1, \
262 .ops = &pfuze100_ldo_regulator_ops, \
263 .type = REGULATOR_VOLTAGE, \
264 .id = _chip ## _ ## _name, \
265 .owner = THIS_MODULE, \
268 .vsel_reg = (base), \
270 .enable_reg = (base), \
271 .enable_mask = 0x10, \
273 .stby_reg = (base), \
278 #define PFUZE3000_SW2_REG(_chip, _name, base, min, max, step) { \
281 .n_voltages = ((max) - (min)) / (step) + 1, \
282 .ops = &pfuze100_sw_regulator_ops, \
283 .type = REGULATOR_VOLTAGE, \
284 .id = _chip ## _ ## _name, \
285 .owner = THIS_MODULE, \
288 .vsel_reg = (base) + PFUZE100_VOL_OFFSET, \
291 .stby_reg = (base) + PFUZE100_STANDBY_OFFSET, \
295 #define PFUZE3000_SW3_REG(_chip, _name, base, min, max, step) { \
298 .n_voltages = ((max) - (min)) / (step) + 1, \
299 .ops = &pfuze100_sw_regulator_ops, \
300 .type = REGULATOR_VOLTAGE, \
301 .id = _chip ## _ ## _name, \
302 .owner = THIS_MODULE, \
305 .vsel_reg = (base) + PFUZE100_VOL_OFFSET, \
308 .stby_reg = (base) + PFUZE100_STANDBY_OFFSET, \
313 static struct pfuze_regulator pfuze100_regulators[] = {
314 PFUZE100_SW_REG(PFUZE100, SW1AB, PFUZE100_SW1ABVOL, 300000, 1875000, 25000),
315 PFUZE100_SW_REG(PFUZE100, SW1C, PFUZE100_SW1CVOL, 300000, 1875000, 25000),
316 PFUZE100_SW_REG(PFUZE100, SW2, PFUZE100_SW2VOL, 400000, 1975000, 25000),
317 PFUZE100_SW_REG(PFUZE100, SW3A, PFUZE100_SW3AVOL, 400000, 1975000, 25000),
318 PFUZE100_SW_REG(PFUZE100, SW3B, PFUZE100_SW3BVOL, 400000, 1975000, 25000),
319 PFUZE100_SW_REG(PFUZE100, SW4, PFUZE100_SW4VOL, 400000, 1975000, 25000),
320 PFUZE100_SWB_REG(PFUZE100, SWBST, PFUZE100_SWBSTCON1, 0x3 , pfuze100_swbst),
321 PFUZE100_SWB_REG(PFUZE100, VSNVS, PFUZE100_VSNVSVOL, 0x7, pfuze100_vsnvs),
322 PFUZE100_FIXED_REG(PFUZE100, VREFDDR, PFUZE100_VREFDDRCON, 750000),
323 PFUZE100_VGEN_REG(PFUZE100, VGEN1, PFUZE100_VGEN1VOL, 800000, 1550000, 50000),
324 PFUZE100_VGEN_REG(PFUZE100, VGEN2, PFUZE100_VGEN2VOL, 800000, 1550000, 50000),
325 PFUZE100_VGEN_REG(PFUZE100, VGEN3, PFUZE100_VGEN3VOL, 1800000, 3300000, 100000),
326 PFUZE100_VGEN_REG(PFUZE100, VGEN4, PFUZE100_VGEN4VOL, 1800000, 3300000, 100000),
327 PFUZE100_VGEN_REG(PFUZE100, VGEN5, PFUZE100_VGEN5VOL, 1800000, 3300000, 100000),
328 PFUZE100_VGEN_REG(PFUZE100, VGEN6, PFUZE100_VGEN6VOL, 1800000, 3300000, 100000),
331 static struct pfuze_regulator pfuze200_regulators[] = {
332 PFUZE100_SW_REG(PFUZE200, SW1AB, PFUZE100_SW1ABVOL, 300000, 1875000, 25000),
333 PFUZE100_SW_REG(PFUZE200, SW2, PFUZE100_SW2VOL, 400000, 1975000, 25000),
334 PFUZE100_SW_REG(PFUZE200, SW3A, PFUZE100_SW3AVOL, 400000, 1975000, 25000),
335 PFUZE100_SW_REG(PFUZE200, SW3B, PFUZE100_SW3BVOL, 400000, 1975000, 25000),
336 PFUZE100_SWB_REG(PFUZE200, SWBST, PFUZE100_SWBSTCON1, 0x3 , pfuze100_swbst),
337 PFUZE100_SWB_REG(PFUZE200, VSNVS, PFUZE100_VSNVSVOL, 0x7, pfuze100_vsnvs),
338 PFUZE100_FIXED_REG(PFUZE200, VREFDDR, PFUZE100_VREFDDRCON, 750000),
339 PFUZE100_VGEN_REG(PFUZE200, VGEN1, PFUZE100_VGEN1VOL, 800000, 1550000, 50000),
340 PFUZE100_VGEN_REG(PFUZE200, VGEN2, PFUZE100_VGEN2VOL, 800000, 1550000, 50000),
341 PFUZE100_VGEN_REG(PFUZE200, VGEN3, PFUZE100_VGEN3VOL, 1800000, 3300000, 100000),
342 PFUZE100_VGEN_REG(PFUZE200, VGEN4, PFUZE100_VGEN4VOL, 1800000, 3300000, 100000),
343 PFUZE100_VGEN_REG(PFUZE200, VGEN5, PFUZE100_VGEN5VOL, 1800000, 3300000, 100000),
344 PFUZE100_VGEN_REG(PFUZE200, VGEN6, PFUZE100_VGEN6VOL, 1800000, 3300000, 100000),
345 PFUZE100_COIN_REG(PFUZE200, COIN, PFUZE100_COINVOL, 0x7, pfuze100_coin),
348 static struct pfuze_regulator pfuze3000_regulators[] = {
349 PFUZE100_SWB_REG(PFUZE3000, SW1A, PFUZE100_SW1ABVOL, 0x1f, pfuze3000_sw1a),
350 PFUZE100_SW_REG(PFUZE3000, SW1B, PFUZE100_SW1CVOL, 700000, 1475000, 25000),
351 PFUZE100_SWB_REG(PFUZE3000, SW2, PFUZE100_SW2VOL, 0x7, pfuze3000_sw2lo),
352 PFUZE3000_SW3_REG(PFUZE3000, SW3, PFUZE100_SW3AVOL, 900000, 1650000, 50000),
353 PFUZE100_SWB_REG(PFUZE3000, SWBST, PFUZE100_SWBSTCON1, 0x3, pfuze100_swbst),
354 PFUZE100_SWB_REG(PFUZE3000, VSNVS, PFUZE100_VSNVSVOL, 0x7, pfuze100_vsnvs),
355 PFUZE100_FIXED_REG(PFUZE3000, VREFDDR, PFUZE100_VREFDDRCON, 750000),
356 PFUZE100_VGEN_REG(PFUZE3000, VLDO1, PFUZE100_VGEN1VOL, 1800000, 3300000, 100000),
357 PFUZE100_VGEN_REG(PFUZE3000, VLDO2, PFUZE100_VGEN2VOL, 800000, 1550000, 50000),
358 PFUZE3000_VCC_REG(PFUZE3000, VCCSD, PFUZE100_VGEN3VOL, 2850000, 3300000, 150000),
359 PFUZE3000_VCC_REG(PFUZE3000, V33, PFUZE100_VGEN4VOL, 2850000, 3300000, 150000),
360 PFUZE100_VGEN_REG(PFUZE3000, VLDO3, PFUZE100_VGEN5VOL, 1800000, 3300000, 100000),
361 PFUZE100_VGEN_REG(PFUZE3000, VLDO4, PFUZE100_VGEN6VOL, 1800000, 3300000, 100000),
366 static struct of_regulator_match pfuze100_matches[] = {
367 { .name = "sw1ab", },
373 { .name = "swbst", },
374 { .name = "vsnvs", },
375 { .name = "vrefddr", },
376 { .name = "vgen1", },
377 { .name = "vgen2", },
378 { .name = "vgen3", },
379 { .name = "vgen4", },
380 { .name = "vgen5", },
381 { .name = "vgen6", },
385 static struct of_regulator_match pfuze200_matches[] = {
387 { .name = "sw1ab", },
391 { .name = "swbst", },
392 { .name = "vsnvs", },
393 { .name = "vrefddr", },
394 { .name = "vgen1", },
395 { .name = "vgen2", },
396 { .name = "vgen3", },
397 { .name = "vgen4", },
398 { .name = "vgen5", },
399 { .name = "vgen6", },
404 static struct of_regulator_match pfuze3000_matches[] = {
410 { .name = "swbst", },
411 { .name = "vsnvs", },
412 { .name = "vrefddr", },
413 { .name = "vldo1", },
414 { .name = "vldo2", },
415 { .name = "vccsd", },
417 { .name = "vldo3", },
418 { .name = "vldo4", },
421 static struct of_regulator_match *pfuze_matches;
423 static int pfuze_parse_regulators_dt(struct pfuze_chip *chip)
425 struct device *dev = chip->dev;
426 struct device_node *np, *parent;
429 np = of_node_get(dev->of_node);
433 parent = of_get_child_by_name(np, "regulators");
435 dev_err(dev, "regulators node not found\n");
439 switch (chip->chip_id) {
441 pfuze_matches = pfuze3000_matches;
442 ret = of_regulator_match(dev, parent, pfuze3000_matches,
443 ARRAY_SIZE(pfuze3000_matches));
446 pfuze_matches = pfuze200_matches;
447 ret = of_regulator_match(dev, parent, pfuze200_matches,
448 ARRAY_SIZE(pfuze200_matches));
453 pfuze_matches = pfuze100_matches;
454 ret = of_regulator_match(dev, parent, pfuze100_matches,
455 ARRAY_SIZE(pfuze100_matches));
461 dev_err(dev, "Error parsing regulator init data: %d\n",
469 static inline struct regulator_init_data *match_init_data(int index)
471 return pfuze_matches[index].init_data;
474 static inline struct device_node *match_of_node(int index)
476 return pfuze_matches[index].of_node;
479 static int pfuze_parse_regulators_dt(struct pfuze_chip *chip)
484 static inline struct regulator_init_data *match_init_data(int index)
489 static inline struct device_node *match_of_node(int index)
495 static int pfuze_identify(struct pfuze_chip *pfuze_chip)
500 ret = regmap_read(pfuze_chip->regmap, PFUZE100_DEVICEID, &value);
504 if (((value & 0x0f) == 0x8) && (pfuze_chip->chip_id == PFUZE100)) {
506 * Freescale misprogrammed 1-3% of parts prior to week 8 of 2013
507 * as ID=8 in PFUZE100
509 dev_info(pfuze_chip->dev, "Assuming misprogrammed ID=0x8");
510 } else if ((value & 0x0f) != pfuze_chip->chip_id &&
511 (value & 0xf0) >> 4 != pfuze_chip->chip_id) {
512 /* device id NOT match with your setting */
513 dev_warn(pfuze_chip->dev, "Illegal ID: %x\n", value);
517 ret = regmap_read(pfuze_chip->regmap, PFUZE100_REVID, &value);
520 dev_info(pfuze_chip->dev,
521 "Full layer: %x, Metal layer: %x\n",
522 (value & 0xf0) >> 4, value & 0x0f);
524 ret = regmap_read(pfuze_chip->regmap, PFUZE100_FABID, &value);
527 dev_info(pfuze_chip->dev, "FAB: %x, FIN: %x\n",
528 (value & 0xc) >> 2, value & 0x3);
533 static const struct regmap_config pfuze_regmap_config = {
536 .max_register = PFUZE_NUMREGS - 1,
537 .cache_type = REGCACHE_RBTREE,
540 static int pfuze100_regulator_probe(struct i2c_client *client,
541 const struct i2c_device_id *id)
543 struct pfuze_chip *pfuze_chip;
544 struct pfuze_regulator_platform_data *pdata =
545 dev_get_platdata(&client->dev);
546 struct regulator_config config = { };
548 const struct of_device_id *match;
550 u32 sw_check_start, sw_check_end, sw_hi = 0x40;
552 pfuze_chip = devm_kzalloc(&client->dev, sizeof(*pfuze_chip),
557 if (client->dev.of_node) {
558 match = of_match_device(of_match_ptr(pfuze_dt_ids),
561 dev_err(&client->dev, "Error: No device match found\n");
564 pfuze_chip->chip_id = (int)(long)match->data;
566 pfuze_chip->chip_id = id->driver_data;
568 dev_err(&client->dev, "No dts match or id table match found\n");
572 i2c_set_clientdata(client, pfuze_chip);
573 pfuze_chip->dev = &client->dev;
575 pfuze_chip->regmap = devm_regmap_init_i2c(client, &pfuze_regmap_config);
576 if (IS_ERR(pfuze_chip->regmap)) {
577 ret = PTR_ERR(pfuze_chip->regmap);
578 dev_err(&client->dev,
579 "regmap allocation failed with err %d\n", ret);
583 ret = pfuze_identify(pfuze_chip);
585 dev_err(&client->dev, "unrecognized pfuze chip ID!\n");
589 /* use the right regulators after identify the right device */
590 switch (pfuze_chip->chip_id) {
592 pfuze_chip->pfuze_regulators = pfuze3000_regulators;
593 regulator_num = ARRAY_SIZE(pfuze3000_regulators);
594 sw_check_start = PFUZE3000_SW2;
595 sw_check_end = PFUZE3000_SW2;
599 pfuze_chip->pfuze_regulators = pfuze200_regulators;
600 regulator_num = ARRAY_SIZE(pfuze200_regulators);
601 sw_check_start = PFUZE200_SW2;
602 sw_check_end = PFUZE200_SW3B;
606 pfuze_chip->pfuze_regulators = pfuze100_regulators;
607 regulator_num = ARRAY_SIZE(pfuze100_regulators);
608 sw_check_start = PFUZE100_SW2;
609 sw_check_end = PFUZE100_SW4;
612 dev_info(&client->dev, "pfuze%s found.\n",
613 (pfuze_chip->chip_id == PFUZE100) ? "100" :
614 ((pfuze_chip->chip_id == PFUZE200) ? "200" : "3000"));
616 memcpy(pfuze_chip->regulator_descs, pfuze_chip->pfuze_regulators,
617 sizeof(pfuze_chip->regulator_descs));
619 ret = pfuze_parse_regulators_dt(pfuze_chip);
623 for (i = 0; i < regulator_num; i++) {
624 struct regulator_init_data *init_data;
625 struct regulator_desc *desc;
628 desc = &pfuze_chip->regulator_descs[i].desc;
631 init_data = pdata->init_data[i];
633 init_data = match_init_data(i);
635 /* SW2~SW4 high bit check and modify the voltage value table */
636 if (i >= sw_check_start && i <= sw_check_end) {
637 regmap_read(pfuze_chip->regmap, desc->vsel_reg, &val);
639 if (pfuze_chip->chip_id == PFUZE3000) {
640 desc->volt_table = pfuze3000_sw2hi;
641 desc->n_voltages = ARRAY_SIZE(pfuze3000_sw2hi);
643 desc->min_uV = 800000;
644 desc->uV_step = 50000;
645 desc->n_voltages = 51;
650 config.dev = &client->dev;
651 config.init_data = init_data;
652 config.driver_data = pfuze_chip;
653 config.of_node = match_of_node(i);
655 pfuze_chip->regulators[i] =
656 devm_regulator_register(&client->dev, desc, &config);
657 if (IS_ERR(pfuze_chip->regulators[i])) {
658 dev_err(&client->dev, "register regulator%s failed\n",
659 pfuze_chip->pfuze_regulators[i].desc.name);
660 return PTR_ERR(pfuze_chip->regulators[i]);
667 static struct i2c_driver pfuze_driver = {
668 .id_table = pfuze_device_id,
670 .name = "pfuze100-regulator",
671 .of_match_table = pfuze_dt_ids,
673 .probe = pfuze100_regulator_probe,
675 module_i2c_driver(pfuze_driver);
678 MODULE_DESCRIPTION("Regulator Driver for Freescale PFUZE100/200/3000 PMIC");
679 MODULE_LICENSE("GPL v2");