Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / drivers / regulator / twl-regulator.c
bloba4456db5849d06282b7eb2884d20e8da29093753
1 /*
2 * twl-regulator.c -- support regulators in twl4030/twl6030 family chips
4 * Copyright (C) 2008 David Brownell
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
12 #include <linux/module.h>
13 #include <linux/string.h>
14 #include <linux/slab.h>
15 #include <linux/init.h>
16 #include <linux/err.h>
17 #include <linux/platform_device.h>
18 #include <linux/of.h>
19 #include <linux/of_device.h>
20 #include <linux/regulator/driver.h>
21 #include <linux/regulator/machine.h>
22 #include <linux/regulator/of_regulator.h>
23 #include <linux/mfd/twl.h>
24 #include <linux/delay.h>
27 * The TWL4030/TW5030/TPS659x0 family chips include power management, a
28 * USB OTG transceiver, an RTC, ADC, PWM, and lots more. Some versions
29 * include an audio codec, battery charger, and more voltage regulators.
30 * These chips are often used in OMAP-based systems.
32 * This driver implements software-based resource control for various
33 * voltage regulators. This is usually augmented with state machine
34 * based control.
37 struct twlreg_info {
38 /* start of regulator's PM_RECEIVER control register bank */
39 u8 base;
41 /* twl resource ID, for resource control state machine */
42 u8 id;
44 /* voltage in mV = table[VSEL]; table_len must be a power-of-two */
45 u8 table_len;
46 const u16 *table;
48 /* State REMAP default configuration */
49 u8 remap;
51 /* used by regulator core */
52 struct regulator_desc desc;
54 /* chip specific features */
55 unsigned long features;
57 /* data passed from board for external get/set voltage */
58 void *data;
62 /* LDO control registers ... offset is from the base of its register bank.
63 * The first three registers of all power resource banks help hardware to
64 * manage the various resource groups.
66 /* Common offset in TWL4030/6030 */
67 #define VREG_GRP 0
68 /* TWL4030 register offsets */
69 #define VREG_TYPE 1
70 #define VREG_REMAP 2
71 #define VREG_DEDICATED 3 /* LDO control */
72 #define VREG_VOLTAGE_SMPS_4030 9
73 /* TWL6030 register offsets */
74 #define VREG_TRANS 1
75 #define VREG_STATE 2
76 #define VREG_VOLTAGE 3
77 #define VREG_VOLTAGE_SMPS 4
79 static inline int
80 twlreg_read(struct twlreg_info *info, unsigned slave_subgp, unsigned offset)
82 u8 value;
83 int status;
85 status = twl_i2c_read_u8(slave_subgp,
86 &value, info->base + offset);
87 return (status < 0) ? status : value;
90 static inline int
91 twlreg_write(struct twlreg_info *info, unsigned slave_subgp, unsigned offset,
92 u8 value)
94 return twl_i2c_write_u8(slave_subgp,
95 value, info->base + offset);
98 /*----------------------------------------------------------------------*/
100 /* generic power resource operations, which work on all regulators */
102 static int twlreg_grp(struct regulator_dev *rdev)
104 return twlreg_read(rdev_get_drvdata(rdev), TWL_MODULE_PM_RECEIVER,
105 VREG_GRP);
109 * Enable/disable regulators by joining/leaving the P1 (processor) group.
110 * We assume nobody else is updating the DEV_GRP registers.
112 /* definition for 4030 family */
113 #define P3_GRP_4030 BIT(7) /* "peripherals" */
114 #define P2_GRP_4030 BIT(6) /* secondary processor, modem, etc */
115 #define P1_GRP_4030 BIT(5) /* CPU/Linux */
116 /* definition for 6030 family */
117 #define P3_GRP_6030 BIT(2) /* secondary processor, modem, etc */
118 #define P2_GRP_6030 BIT(1) /* "peripherals" */
119 #define P1_GRP_6030 BIT(0) /* CPU/Linux */
121 static int twl4030reg_is_enabled(struct regulator_dev *rdev)
123 int state = twlreg_grp(rdev);
125 if (state < 0)
126 return state;
128 return state & P1_GRP_4030;
131 #define PB_I2C_BUSY BIT(0)
132 #define PB_I2C_BWEN BIT(1)
134 /* Wait until buffer empty/ready to send a word on power bus. */
135 static int twl4030_wait_pb_ready(void)
138 int ret;
139 int timeout = 10;
140 u8 val;
142 do {
143 ret = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, &val,
144 TWL4030_PM_MASTER_PB_CFG);
145 if (ret < 0)
146 return ret;
148 if (!(val & PB_I2C_BUSY))
149 return 0;
151 mdelay(1);
152 timeout--;
153 } while (timeout);
155 return -ETIMEDOUT;
158 /* Send a word over the powerbus */
159 static int twl4030_send_pb_msg(unsigned msg)
161 u8 val;
162 int ret;
164 /* save powerbus configuration */
165 ret = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, &val,
166 TWL4030_PM_MASTER_PB_CFG);
167 if (ret < 0)
168 return ret;
170 /* Enable i2c access to powerbus */
171 ret = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, val | PB_I2C_BWEN,
172 TWL4030_PM_MASTER_PB_CFG);
173 if (ret < 0)
174 return ret;
176 ret = twl4030_wait_pb_ready();
177 if (ret < 0)
178 return ret;
180 ret = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, msg >> 8,
181 TWL4030_PM_MASTER_PB_WORD_MSB);
182 if (ret < 0)
183 return ret;
185 ret = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, msg & 0xff,
186 TWL4030_PM_MASTER_PB_WORD_LSB);
187 if (ret < 0)
188 return ret;
190 ret = twl4030_wait_pb_ready();
191 if (ret < 0)
192 return ret;
194 /* Restore powerbus configuration */
195 return twl_i2c_write_u8(TWL_MODULE_PM_MASTER, val,
196 TWL4030_PM_MASTER_PB_CFG);
199 static int twl4030reg_enable(struct regulator_dev *rdev)
201 struct twlreg_info *info = rdev_get_drvdata(rdev);
202 int grp;
203 int ret;
205 grp = twlreg_grp(rdev);
206 if (grp < 0)
207 return grp;
209 grp |= P1_GRP_4030;
211 ret = twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_GRP, grp);
213 return ret;
216 static int twl4030reg_disable(struct regulator_dev *rdev)
218 struct twlreg_info *info = rdev_get_drvdata(rdev);
219 int grp;
220 int ret;
222 grp = twlreg_grp(rdev);
223 if (grp < 0)
224 return grp;
226 grp &= ~(P1_GRP_4030 | P2_GRP_4030 | P3_GRP_4030);
228 ret = twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_GRP, grp);
230 return ret;
233 static int twl4030reg_get_status(struct regulator_dev *rdev)
235 int state = twlreg_grp(rdev);
237 if (state < 0)
238 return state;
239 state &= 0x0f;
241 /* assume state != WARM_RESET; we'd not be running... */
242 if (!state)
243 return REGULATOR_STATUS_OFF;
244 return (state & BIT(3))
245 ? REGULATOR_STATUS_NORMAL
246 : REGULATOR_STATUS_STANDBY;
249 static int twl4030reg_set_mode(struct regulator_dev *rdev, unsigned mode)
251 struct twlreg_info *info = rdev_get_drvdata(rdev);
252 unsigned message;
254 /* We can only set the mode through state machine commands... */
255 switch (mode) {
256 case REGULATOR_MODE_NORMAL:
257 message = MSG_SINGULAR(DEV_GRP_P1, info->id, RES_STATE_ACTIVE);
258 break;
259 case REGULATOR_MODE_STANDBY:
260 message = MSG_SINGULAR(DEV_GRP_P1, info->id, RES_STATE_SLEEP);
261 break;
262 default:
263 return -EINVAL;
266 return twl4030_send_pb_msg(message);
269 static inline unsigned int twl4030reg_map_mode(unsigned int mode)
271 switch (mode) {
272 case RES_STATE_ACTIVE:
273 return REGULATOR_MODE_NORMAL;
274 case RES_STATE_SLEEP:
275 return REGULATOR_MODE_STANDBY;
276 default:
277 return -EINVAL;
281 /*----------------------------------------------------------------------*/
284 * Support for adjustable-voltage LDOs uses a four bit (or less) voltage
285 * select field in its control register. We use tables indexed by VSEL
286 * to record voltages in milliVolts. (Accuracy is about three percent.)
288 * Note that VSEL values for VAUX2 changed in twl5030 and newer silicon;
289 * currently handled by listing two slightly different VAUX2 regulators,
290 * only one of which will be configured.
292 * VSEL values documented as "TI cannot support these values" are flagged
293 * in these tables as UNSUP() values; we normally won't assign them.
295 * VAUX3 at 3V is incorrectly listed in some TI manuals as unsupported.
296 * TI are revising the twl5030/tps659x0 specs to support that 3.0V setting.
298 #define UNSUP_MASK 0x8000
300 #define UNSUP(x) (UNSUP_MASK | (x))
301 #define IS_UNSUP(info, x) \
302 ((UNSUP_MASK & (x)) && \
303 !((info)->features & TWL4030_ALLOW_UNSUPPORTED))
304 #define LDO_MV(x) (~UNSUP_MASK & (x))
307 static const u16 VAUX1_VSEL_table[] = {
308 UNSUP(1500), UNSUP(1800), 2500, 2800,
309 3000, 3000, 3000, 3000,
311 static const u16 VAUX2_4030_VSEL_table[] = {
312 UNSUP(1000), UNSUP(1000), UNSUP(1200), 1300,
313 1500, 1800, UNSUP(1850), 2500,
314 UNSUP(2600), 2800, UNSUP(2850), UNSUP(3000),
315 UNSUP(3150), UNSUP(3150), UNSUP(3150), UNSUP(3150),
317 static const u16 VAUX2_VSEL_table[] = {
318 1700, 1700, 1900, 1300,
319 1500, 1800, 2000, 2500,
320 2100, 2800, 2200, 2300,
321 2400, 2400, 2400, 2400,
323 static const u16 VAUX3_VSEL_table[] = {
324 1500, 1800, 2500, 2800,
325 3000, 3000, 3000, 3000,
327 static const u16 VAUX4_VSEL_table[] = {
328 700, 1000, 1200, UNSUP(1300),
329 1500, 1800, UNSUP(1850), 2500,
330 UNSUP(2600), 2800, UNSUP(2850), UNSUP(3000),
331 UNSUP(3150), UNSUP(3150), UNSUP(3150), UNSUP(3150),
333 static const u16 VMMC1_VSEL_table[] = {
334 1850, 2850, 3000, 3150,
336 static const u16 VMMC2_VSEL_table[] = {
337 UNSUP(1000), UNSUP(1000), UNSUP(1200), UNSUP(1300),
338 UNSUP(1500), UNSUP(1800), 1850, UNSUP(2500),
339 2600, 2800, 2850, 3000,
340 3150, 3150, 3150, 3150,
342 static const u16 VPLL1_VSEL_table[] = {
343 1000, 1200, 1300, 1800,
344 UNSUP(2800), UNSUP(3000), UNSUP(3000), UNSUP(3000),
346 static const u16 VPLL2_VSEL_table[] = {
347 700, 1000, 1200, 1300,
348 UNSUP(1500), 1800, UNSUP(1850), UNSUP(2500),
349 UNSUP(2600), UNSUP(2800), UNSUP(2850), UNSUP(3000),
350 UNSUP(3150), UNSUP(3150), UNSUP(3150), UNSUP(3150),
352 static const u16 VSIM_VSEL_table[] = {
353 UNSUP(1000), UNSUP(1200), UNSUP(1300), 1800,
354 2800, 3000, 3000, 3000,
356 static const u16 VDAC_VSEL_table[] = {
357 1200, 1300, 1800, 1800,
359 static const u16 VIO_VSEL_table[] = {
360 1800, 1850,
362 static const u16 VINTANA2_VSEL_table[] = {
363 2500, 2750,
366 static int twl4030ldo_list_voltage(struct regulator_dev *rdev, unsigned index)
368 struct twlreg_info *info = rdev_get_drvdata(rdev);
369 int mV = info->table[index];
371 return IS_UNSUP(info, mV) ? 0 : (LDO_MV(mV) * 1000);
374 static int
375 twl4030ldo_set_voltage_sel(struct regulator_dev *rdev, unsigned selector)
377 struct twlreg_info *info = rdev_get_drvdata(rdev);
379 return twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_VOLTAGE,
380 selector);
383 static int twl4030ldo_get_voltage_sel(struct regulator_dev *rdev)
385 struct twlreg_info *info = rdev_get_drvdata(rdev);
386 int vsel = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_VOLTAGE);
388 if (vsel < 0)
389 return vsel;
391 vsel &= info->table_len - 1;
392 return vsel;
395 static struct regulator_ops twl4030ldo_ops = {
396 .list_voltage = twl4030ldo_list_voltage,
398 .set_voltage_sel = twl4030ldo_set_voltage_sel,
399 .get_voltage_sel = twl4030ldo_get_voltage_sel,
401 .enable = twl4030reg_enable,
402 .disable = twl4030reg_disable,
403 .is_enabled = twl4030reg_is_enabled,
405 .set_mode = twl4030reg_set_mode,
407 .get_status = twl4030reg_get_status,
410 static int
411 twl4030smps_set_voltage(struct regulator_dev *rdev, int min_uV, int max_uV,
412 unsigned *selector)
414 struct twlreg_info *info = rdev_get_drvdata(rdev);
415 int vsel = DIV_ROUND_UP(min_uV - 600000, 12500);
417 twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_VOLTAGE_SMPS_4030, vsel);
419 return 0;
422 static int twl4030smps_get_voltage(struct regulator_dev *rdev)
424 struct twlreg_info *info = rdev_get_drvdata(rdev);
425 int vsel;
427 vsel = twlreg_read(info, TWL_MODULE_PM_RECEIVER,
428 VREG_VOLTAGE_SMPS_4030);
430 return vsel * 12500 + 600000;
433 static struct regulator_ops twl4030smps_ops = {
434 .set_voltage = twl4030smps_set_voltage,
435 .get_voltage = twl4030smps_get_voltage,
438 /*----------------------------------------------------------------------*/
440 static struct regulator_ops twl4030fixed_ops = {
441 .list_voltage = regulator_list_voltage_linear,
443 .enable = twl4030reg_enable,
444 .disable = twl4030reg_disable,
445 .is_enabled = twl4030reg_is_enabled,
447 .set_mode = twl4030reg_set_mode,
449 .get_status = twl4030reg_get_status,
452 /*----------------------------------------------------------------------*/
454 #define TWL4030_ADJUSTABLE_LDO(label, offset, num, turnon_delay, remap_conf) \
455 static const struct twlreg_info TWL4030_INFO_##label = { \
456 .base = offset, \
457 .id = num, \
458 .table_len = ARRAY_SIZE(label##_VSEL_table), \
459 .table = label##_VSEL_table, \
460 .remap = remap_conf, \
461 .desc = { \
462 .name = #label, \
463 .id = TWL4030_REG_##label, \
464 .n_voltages = ARRAY_SIZE(label##_VSEL_table), \
465 .ops = &twl4030ldo_ops, \
466 .type = REGULATOR_VOLTAGE, \
467 .owner = THIS_MODULE, \
468 .enable_time = turnon_delay, \
469 .of_map_mode = twl4030reg_map_mode, \
470 }, \
473 #define TWL4030_ADJUSTABLE_SMPS(label, offset, num, turnon_delay, remap_conf) \
474 static const struct twlreg_info TWL4030_INFO_##label = { \
475 .base = offset, \
476 .id = num, \
477 .remap = remap_conf, \
478 .desc = { \
479 .name = #label, \
480 .id = TWL4030_REG_##label, \
481 .ops = &twl4030smps_ops, \
482 .type = REGULATOR_VOLTAGE, \
483 .owner = THIS_MODULE, \
484 .enable_time = turnon_delay, \
485 .of_map_mode = twl4030reg_map_mode, \
486 }, \
489 #define TWL4030_FIXED_LDO(label, offset, mVolts, num, turnon_delay, \
490 remap_conf) \
491 static const struct twlreg_info TWLFIXED_INFO_##label = { \
492 .base = offset, \
493 .id = num, \
494 .remap = remap_conf, \
495 .desc = { \
496 .name = #label, \
497 .id = TWL4030##_REG_##label, \
498 .n_voltages = 1, \
499 .ops = &twl4030fixed_ops, \
500 .type = REGULATOR_VOLTAGE, \
501 .owner = THIS_MODULE, \
502 .min_uV = mVolts * 1000, \
503 .enable_time = turnon_delay, \
504 .of_map_mode = twl4030reg_map_mode, \
505 }, \
509 * We list regulators here if systems need some level of
510 * software control over them after boot.
512 TWL4030_ADJUSTABLE_LDO(VAUX1, 0x17, 1, 100, 0x08);
513 TWL4030_ADJUSTABLE_LDO(VAUX2_4030, 0x1b, 2, 100, 0x08);
514 TWL4030_ADJUSTABLE_LDO(VAUX2, 0x1b, 2, 100, 0x08);
515 TWL4030_ADJUSTABLE_LDO(VAUX3, 0x1f, 3, 100, 0x08);
516 TWL4030_ADJUSTABLE_LDO(VAUX4, 0x23, 4, 100, 0x08);
517 TWL4030_ADJUSTABLE_LDO(VMMC1, 0x27, 5, 100, 0x08);
518 TWL4030_ADJUSTABLE_LDO(VMMC2, 0x2b, 6, 100, 0x08);
519 TWL4030_ADJUSTABLE_LDO(VPLL1, 0x2f, 7, 100, 0x00);
520 TWL4030_ADJUSTABLE_LDO(VPLL2, 0x33, 8, 100, 0x08);
521 TWL4030_ADJUSTABLE_LDO(VSIM, 0x37, 9, 100, 0x00);
522 TWL4030_ADJUSTABLE_LDO(VDAC, 0x3b, 10, 100, 0x08);
523 TWL4030_ADJUSTABLE_LDO(VINTANA2, 0x43, 12, 100, 0x08);
524 TWL4030_ADJUSTABLE_LDO(VIO, 0x4b, 14, 1000, 0x08);
525 TWL4030_ADJUSTABLE_SMPS(VDD1, 0x55, 15, 1000, 0x08);
526 TWL4030_ADJUSTABLE_SMPS(VDD2, 0x63, 16, 1000, 0x08);
527 /* VUSBCP is managed *only* by the USB subchip */
528 TWL4030_FIXED_LDO(VINTANA1, 0x3f, 1500, 11, 100, 0x08);
529 TWL4030_FIXED_LDO(VINTDIG, 0x47, 1500, 13, 100, 0x08);
530 TWL4030_FIXED_LDO(VUSB1V5, 0x71, 1500, 17, 100, 0x08);
531 TWL4030_FIXED_LDO(VUSB1V8, 0x74, 1800, 18, 100, 0x08);
532 TWL4030_FIXED_LDO(VUSB3V1, 0x77, 3100, 19, 150, 0x08);
534 #define TWL_OF_MATCH(comp, family, label) \
536 .compatible = comp, \
537 .data = &family##_INFO_##label, \
540 #define TWL4030_OF_MATCH(comp, label) TWL_OF_MATCH(comp, TWL4030, label)
541 #define TWL6030_OF_MATCH(comp, label) TWL_OF_MATCH(comp, TWL6030, label)
542 #define TWL6032_OF_MATCH(comp, label) TWL_OF_MATCH(comp, TWL6032, label)
543 #define TWLFIXED_OF_MATCH(comp, label) TWL_OF_MATCH(comp, TWLFIXED, label)
544 #define TWLSMPS_OF_MATCH(comp, label) TWL_OF_MATCH(comp, TWLSMPS, label)
546 static const struct of_device_id twl_of_match[] = {
547 TWL4030_OF_MATCH("ti,twl4030-vaux1", VAUX1),
548 TWL4030_OF_MATCH("ti,twl4030-vaux2", VAUX2_4030),
549 TWL4030_OF_MATCH("ti,twl5030-vaux2", VAUX2),
550 TWL4030_OF_MATCH("ti,twl4030-vaux3", VAUX3),
551 TWL4030_OF_MATCH("ti,twl4030-vaux4", VAUX4),
552 TWL4030_OF_MATCH("ti,twl4030-vmmc1", VMMC1),
553 TWL4030_OF_MATCH("ti,twl4030-vmmc2", VMMC2),
554 TWL4030_OF_MATCH("ti,twl4030-vpll1", VPLL1),
555 TWL4030_OF_MATCH("ti,twl4030-vpll2", VPLL2),
556 TWL4030_OF_MATCH("ti,twl4030-vsim", VSIM),
557 TWL4030_OF_MATCH("ti,twl4030-vdac", VDAC),
558 TWL4030_OF_MATCH("ti,twl4030-vintana2", VINTANA2),
559 TWL4030_OF_MATCH("ti,twl4030-vio", VIO),
560 TWL4030_OF_MATCH("ti,twl4030-vdd1", VDD1),
561 TWL4030_OF_MATCH("ti,twl4030-vdd2", VDD2),
562 TWLFIXED_OF_MATCH("ti,twl4030-vintana1", VINTANA1),
563 TWLFIXED_OF_MATCH("ti,twl4030-vintdig", VINTDIG),
564 TWLFIXED_OF_MATCH("ti,twl4030-vusb1v5", VUSB1V5),
565 TWLFIXED_OF_MATCH("ti,twl4030-vusb1v8", VUSB1V8),
566 TWLFIXED_OF_MATCH("ti,twl4030-vusb3v1", VUSB3V1),
569 MODULE_DEVICE_TABLE(of, twl_of_match);
571 static int twlreg_probe(struct platform_device *pdev)
573 int id;
574 struct twlreg_info *info;
575 const struct twlreg_info *template;
576 struct regulator_init_data *initdata;
577 struct regulation_constraints *c;
578 struct regulator_dev *rdev;
579 const struct of_device_id *match;
580 struct regulator_config config = { };
582 match = of_match_device(twl_of_match, &pdev->dev);
583 if (!match)
584 return -ENODEV;
586 template = match->data;
587 if (!template)
588 return -ENODEV;
590 id = template->desc.id;
591 initdata = of_get_regulator_init_data(&pdev->dev, pdev->dev.of_node,
592 &template->desc);
593 if (!initdata)
594 return -EINVAL;
596 info = devm_kmemdup(&pdev->dev, template, sizeof(*info), GFP_KERNEL);
597 if (!info)
598 return -ENOMEM;
600 /* Constrain board-specific capabilities according to what
601 * this driver and the chip itself can actually do.
603 c = &initdata->constraints;
604 c->valid_modes_mask &= REGULATOR_MODE_NORMAL | REGULATOR_MODE_STANDBY;
605 c->valid_ops_mask &= REGULATOR_CHANGE_VOLTAGE
606 | REGULATOR_CHANGE_MODE
607 | REGULATOR_CHANGE_STATUS;
608 switch (id) {
609 case TWL4030_REG_VIO:
610 case TWL4030_REG_VDD1:
611 case TWL4030_REG_VDD2:
612 case TWL4030_REG_VPLL1:
613 case TWL4030_REG_VINTANA1:
614 case TWL4030_REG_VINTANA2:
615 case TWL4030_REG_VINTDIG:
616 c->always_on = true;
617 break;
618 default:
619 break;
622 config.dev = &pdev->dev;
623 config.init_data = initdata;
624 config.driver_data = info;
625 config.of_node = pdev->dev.of_node;
627 rdev = devm_regulator_register(&pdev->dev, &info->desc, &config);
628 if (IS_ERR(rdev)) {
629 dev_err(&pdev->dev, "can't register %s, %ld\n",
630 info->desc.name, PTR_ERR(rdev));
631 return PTR_ERR(rdev);
633 platform_set_drvdata(pdev, rdev);
635 twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_REMAP, info->remap);
637 /* NOTE: many regulators support short-circuit IRQs (presentable
638 * as REGULATOR_OVER_CURRENT notifications?) configured via:
639 * - SC_CONFIG
640 * - SC_DETECT1 (vintana2, vmmc1/2, vaux1/2/3/4)
641 * - SC_DETECT2 (vusb, vdac, vio, vdd1/2, vpll2)
642 * - IT_CONFIG
645 return 0;
648 MODULE_ALIAS("platform:twl4030_reg");
650 static struct platform_driver twlreg_driver = {
651 .probe = twlreg_probe,
652 /* NOTE: short name, to work around driver model truncation of
653 * "twl_regulator.12" (and friends) to "twl_regulator.1".
655 .driver = {
656 .name = "twl4030_reg",
657 .of_match_table = of_match_ptr(twl_of_match),
661 static int __init twlreg_init(void)
663 return platform_driver_register(&twlreg_driver);
665 subsys_initcall(twlreg_init);
667 static void __exit twlreg_exit(void)
669 platform_driver_unregister(&twlreg_driver);
671 module_exit(twlreg_exit)
673 MODULE_DESCRIPTION("TWL4030 regulator driver");
674 MODULE_LICENSE("GPL");