1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Split TWL6030 logic from twl-regulator.c:
4 * Copyright (C) 2008 David Brownell
6 * Copyright (C) 2016 Nicolae Rosia <nicolae.rosia@gmail.com>
9 #include <linux/module.h>
10 #include <linux/string.h>
11 #include <linux/slab.h>
12 #include <linux/init.h>
13 #include <linux/err.h>
14 #include <linux/platform_device.h>
16 #include <linux/of_device.h>
17 #include <linux/regulator/driver.h>
18 #include <linux/regulator/machine.h>
19 #include <linux/regulator/of_regulator.h>
20 #include <linux/mfd/twl.h>
21 #include <linux/delay.h>
24 /* start of regulator's PM_RECEIVER control register bank */
27 /* twl resource ID, for resource control state machine */
32 /* used by regulator core */
33 struct regulator_desc desc
;
35 /* chip specific features */
36 unsigned long features
;
38 /* data passed from board for external get/set voltage */
43 /* LDO control registers ... offset is from the base of its register bank.
44 * The first three registers of all power resource banks help hardware to
45 * manage the various resource groups.
47 /* Common offset in TWL4030/6030 */
49 /* TWL6030 register offsets */
52 #define VREG_VOLTAGE 3
53 #define VREG_VOLTAGE_SMPS 4
54 /* TWL6030 Misc register offsets */
57 #define VREG_BC_PROC 3
58 #define VREG_BC_CLK_RST 4
60 /* TWL6030 LDO register values for VREG_VOLTAGE */
61 #define TWL6030_VREG_VOLTAGE_WR_S BIT(7)
63 /* TWL6030 LDO register values for CFG_STATE */
64 #define TWL6030_CFG_STATE_OFF 0x00
65 #define TWL6030_CFG_STATE_ON 0x01
66 #define TWL6030_CFG_STATE_OFF2 0x02
67 #define TWL6030_CFG_STATE_SLEEP 0x03
68 #define TWL6030_CFG_STATE_GRP_SHIFT 5
69 #define TWL6030_CFG_STATE_APP_SHIFT 2
70 #define TWL6030_CFG_STATE_APP_MASK (0x03 << TWL6030_CFG_STATE_APP_SHIFT)
71 #define TWL6030_CFG_STATE_APP(v) (((v) & TWL6030_CFG_STATE_APP_MASK) >>\
72 TWL6030_CFG_STATE_APP_SHIFT)
74 /* Flags for SMPS Voltage reading and LDO reading*/
75 #define SMPS_OFFSET_EN BIT(0)
76 #define SMPS_EXTENDED_EN BIT(1)
77 #define TWL_6030_WARM_RESET BIT(3)
79 /* twl6032 SMPS EPROM values */
80 #define TWL6030_SMPS_OFFSET 0xB0
81 #define TWL6030_SMPS_MULT 0xB3
82 #define SMPS_MULTOFFSET_SMPS4 BIT(0)
83 #define SMPS_MULTOFFSET_VIO BIT(1)
84 #define SMPS_MULTOFFSET_SMPS3 BIT(6)
87 twlreg_read(struct twlreg_info
*info
, unsigned slave_subgp
, unsigned offset
)
92 status
= twl_i2c_read_u8(slave_subgp
,
93 &value
, info
->base
+ offset
);
94 return (status
< 0) ? status
: value
;
98 twlreg_write(struct twlreg_info
*info
, unsigned slave_subgp
, unsigned offset
,
101 return twl_i2c_write_u8(slave_subgp
,
102 value
, info
->base
+ offset
);
105 /* generic power resource operations, which work on all regulators */
106 static int twlreg_grp(struct regulator_dev
*rdev
)
108 return twlreg_read(rdev_get_drvdata(rdev
), TWL_MODULE_PM_RECEIVER
,
113 * Enable/disable regulators by joining/leaving the P1 (processor) group.
114 * We assume nobody else is updating the DEV_GRP registers.
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 twl6030reg_is_enabled(struct regulator_dev
*rdev
)
123 struct twlreg_info
*info
= rdev_get_drvdata(rdev
);
126 if (!(twl_class_is_6030() && (info
->features
& TWL6032_SUBCLASS
))) {
127 grp
= twlreg_grp(rdev
);
135 val
= twlreg_read(info
, TWL_MODULE_PM_RECEIVER
, VREG_STATE
);
136 val
= TWL6030_CFG_STATE_APP(val
);
138 return grp
&& (val
== TWL6030_CFG_STATE_ON
);
141 #define PB_I2C_BUSY BIT(0)
142 #define PB_I2C_BWEN BIT(1)
145 static int twl6030reg_enable(struct regulator_dev
*rdev
)
147 struct twlreg_info
*info
= rdev_get_drvdata(rdev
);
151 if (!(twl_class_is_6030() && (info
->features
& TWL6032_SUBCLASS
)))
152 grp
= twlreg_grp(rdev
);
156 ret
= twlreg_write(info
, TWL_MODULE_PM_RECEIVER
, VREG_STATE
,
157 grp
<< TWL6030_CFG_STATE_GRP_SHIFT
|
158 TWL6030_CFG_STATE_ON
);
162 static int twl6030reg_disable(struct regulator_dev
*rdev
)
164 struct twlreg_info
*info
= rdev_get_drvdata(rdev
);
168 if (!(twl_class_is_6030() && (info
->features
& TWL6032_SUBCLASS
)))
169 grp
= P1_GRP_6030
| P2_GRP_6030
| P3_GRP_6030
;
171 /* For 6030, set the off state for all grps enabled */
172 ret
= twlreg_write(info
, TWL_MODULE_PM_RECEIVER
, VREG_STATE
,
173 (grp
) << TWL6030_CFG_STATE_GRP_SHIFT
|
174 TWL6030_CFG_STATE_OFF
);
179 static int twl6030reg_get_status(struct regulator_dev
*rdev
)
181 struct twlreg_info
*info
= rdev_get_drvdata(rdev
);
184 val
= twlreg_grp(rdev
);
188 val
= twlreg_read(info
, TWL_MODULE_PM_RECEIVER
, VREG_STATE
);
190 switch (TWL6030_CFG_STATE_APP(val
)) {
191 case TWL6030_CFG_STATE_ON
:
192 return REGULATOR_STATUS_NORMAL
;
194 case TWL6030_CFG_STATE_SLEEP
:
195 return REGULATOR_STATUS_STANDBY
;
197 case TWL6030_CFG_STATE_OFF
:
198 case TWL6030_CFG_STATE_OFF2
:
203 return REGULATOR_STATUS_OFF
;
206 static int twl6030reg_set_mode(struct regulator_dev
*rdev
, unsigned mode
)
208 struct twlreg_info
*info
= rdev_get_drvdata(rdev
);
212 if (!(twl_class_is_6030() && (info
->features
& TWL6032_SUBCLASS
)))
213 grp
= twlreg_grp(rdev
);
218 /* Compose the state register settings */
219 val
= grp
<< TWL6030_CFG_STATE_GRP_SHIFT
;
220 /* We can only set the mode through state machine commands... */
222 case REGULATOR_MODE_NORMAL
:
223 val
|= TWL6030_CFG_STATE_ON
;
225 case REGULATOR_MODE_STANDBY
:
226 val
|= TWL6030_CFG_STATE_SLEEP
;
233 return twlreg_write(info
, TWL_MODULE_PM_RECEIVER
, VREG_STATE
, val
);
236 static int twl6030coresmps_set_voltage(struct regulator_dev
*rdev
, int min_uV
,
237 int max_uV
, unsigned *selector
)
242 static int twl6030coresmps_get_voltage(struct regulator_dev
*rdev
)
247 static const struct regulator_ops twl6030coresmps_ops
= {
248 .set_voltage
= twl6030coresmps_set_voltage
,
249 .get_voltage
= twl6030coresmps_get_voltage
,
253 twl6030ldo_set_voltage_sel(struct regulator_dev
*rdev
, unsigned selector
)
255 struct twlreg_info
*info
= rdev_get_drvdata(rdev
);
257 if (info
->flags
& TWL_6030_WARM_RESET
)
258 selector
|= TWL6030_VREG_VOLTAGE_WR_S
;
260 return twlreg_write(info
, TWL_MODULE_PM_RECEIVER
, VREG_VOLTAGE
,
264 static int twl6030ldo_get_voltage_sel(struct regulator_dev
*rdev
)
266 struct twlreg_info
*info
= rdev_get_drvdata(rdev
);
267 int vsel
= twlreg_read(info
, TWL_MODULE_PM_RECEIVER
, VREG_VOLTAGE
);
269 if (info
->flags
& TWL_6030_WARM_RESET
)
270 vsel
&= ~TWL6030_VREG_VOLTAGE_WR_S
;
275 static const struct regulator_ops twl6030ldo_ops
= {
276 .list_voltage
= regulator_list_voltage_linear_range
,
278 .set_voltage_sel
= twl6030ldo_set_voltage_sel
,
279 .get_voltage_sel
= twl6030ldo_get_voltage_sel
,
281 .enable
= twl6030reg_enable
,
282 .disable
= twl6030reg_disable
,
283 .is_enabled
= twl6030reg_is_enabled
,
285 .set_mode
= twl6030reg_set_mode
,
287 .get_status
= twl6030reg_get_status
,
290 static const struct regulator_ops twl6030fixed_ops
= {
291 .list_voltage
= regulator_list_voltage_linear
,
293 .enable
= twl6030reg_enable
,
294 .disable
= twl6030reg_disable
,
295 .is_enabled
= twl6030reg_is_enabled
,
297 .set_mode
= twl6030reg_set_mode
,
299 .get_status
= twl6030reg_get_status
,
303 * SMPS status and control
306 static int twl6030smps_list_voltage(struct regulator_dev
*rdev
, unsigned index
)
308 struct twlreg_info
*info
= rdev_get_drvdata(rdev
);
312 switch (info
->flags
) {
322 voltage
= 1350 * 1000;
325 voltage
= 1500 * 1000;
328 voltage
= 1800 * 1000;
331 voltage
= 1900 * 1000;
334 voltage
= 2100 * 1000;
337 voltage
+= (600000 + (12500 * (index
- 1)));
340 case SMPS_EXTENDED_EN
:
346 voltage
= 2084 * 1000;
349 voltage
= 2315 * 1000;
352 voltage
= 2778 * 1000;
355 voltage
= 2932 * 1000;
358 voltage
= 3241 * 1000;
361 voltage
= (1852000 + (38600 * (index
- 1)));
364 case SMPS_OFFSET_EN
| SMPS_EXTENDED_EN
:
370 voltage
= 4167 * 1000;
373 voltage
= 2315 * 1000;
376 voltage
= 2778 * 1000;
379 voltage
= 2932 * 1000;
382 voltage
= 3241 * 1000;
385 voltage
= (2161000 + (38600 * (index
- 1)));
393 static int twl6030smps_map_voltage(struct regulator_dev
*rdev
, int min_uV
,
396 struct twlreg_info
*info
= rdev_get_drvdata(rdev
);
399 switch (info
->flags
) {
403 else if ((min_uV
>= 600000) && (min_uV
<= 1300000)) {
404 vsel
= DIV_ROUND_UP(min_uV
- 600000, 12500);
407 /* Values 1..57 for vsel are linear and can be calculated
408 * values 58..62 are non linear.
410 else if ((min_uV
> 1900000) && (min_uV
<= 2100000))
412 else if ((min_uV
> 1800000) && (min_uV
<= 1900000))
414 else if ((min_uV
> 1500000) && (min_uV
<= 1800000))
416 else if ((min_uV
> 1350000) && (min_uV
<= 1500000))
418 else if ((min_uV
> 1300000) && (min_uV
<= 1350000))
426 else if ((min_uV
>= 700000) && (min_uV
<= 1420000)) {
427 vsel
= DIV_ROUND_UP(min_uV
- 700000, 12500);
430 /* Values 1..57 for vsel are linear and can be calculated
431 * values 58..62 are non linear.
433 else if ((min_uV
> 1900000) && (min_uV
<= 2100000))
435 else if ((min_uV
> 1800000) && (min_uV
<= 1900000))
437 else if ((min_uV
> 1500000) && (min_uV
<= 1800000))
439 else if ((min_uV
> 1350000) && (min_uV
<= 1500000))
444 case SMPS_EXTENDED_EN
:
447 } else if ((min_uV
>= 1852000) && (max_uV
<= 4013600)) {
448 vsel
= DIV_ROUND_UP(min_uV
- 1852000, 38600);
452 case SMPS_OFFSET_EN
|SMPS_EXTENDED_EN
:
455 } else if ((min_uV
>= 2161000) && (min_uV
<= 4321000)) {
456 vsel
= DIV_ROUND_UP(min_uV
- 2161000, 38600);
465 static int twl6030smps_set_voltage_sel(struct regulator_dev
*rdev
,
466 unsigned int selector
)
468 struct twlreg_info
*info
= rdev_get_drvdata(rdev
);
470 return twlreg_write(info
, TWL_MODULE_PM_RECEIVER
, VREG_VOLTAGE_SMPS
,
474 static int twl6030smps_get_voltage_sel(struct regulator_dev
*rdev
)
476 struct twlreg_info
*info
= rdev_get_drvdata(rdev
);
478 return twlreg_read(info
, TWL_MODULE_PM_RECEIVER
, VREG_VOLTAGE_SMPS
);
481 static const struct regulator_ops twlsmps_ops
= {
482 .list_voltage
= twl6030smps_list_voltage
,
483 .map_voltage
= twl6030smps_map_voltage
,
485 .set_voltage_sel
= twl6030smps_set_voltage_sel
,
486 .get_voltage_sel
= twl6030smps_get_voltage_sel
,
488 .enable
= twl6030reg_enable
,
489 .disable
= twl6030reg_disable
,
490 .is_enabled
= twl6030reg_is_enabled
,
492 .set_mode
= twl6030reg_set_mode
,
494 .get_status
= twl6030reg_get_status
,
497 /*----------------------------------------------------------------------*/
498 static const struct linear_range twl6030ldo_linear_range
[] = {
499 REGULATOR_LINEAR_RANGE(0, 0, 0, 0),
500 REGULATOR_LINEAR_RANGE(1000000, 1, 24, 100000),
501 REGULATOR_LINEAR_RANGE(2750000, 31, 31, 0),
504 #define TWL6030_ADJUSTABLE_SMPS(label) \
505 static const struct twlreg_info TWL6030_INFO_##label = { \
508 .id = TWL6030_REG_##label, \
509 .ops = &twl6030coresmps_ops, \
510 .type = REGULATOR_VOLTAGE, \
511 .owner = THIS_MODULE, \
515 #define TWL6030_ADJUSTABLE_LDO(label, offset) \
516 static const struct twlreg_info TWL6030_INFO_##label = { \
520 .id = TWL6030_REG_##label, \
522 .linear_ranges = twl6030ldo_linear_range, \
523 .n_linear_ranges = ARRAY_SIZE(twl6030ldo_linear_range), \
524 .ops = &twl6030ldo_ops, \
525 .type = REGULATOR_VOLTAGE, \
526 .owner = THIS_MODULE, \
530 #define TWL6032_ADJUSTABLE_LDO(label, offset) \
531 static const struct twlreg_info TWL6032_INFO_##label = { \
535 .id = TWL6032_REG_##label, \
537 .linear_ranges = twl6030ldo_linear_range, \
538 .n_linear_ranges = ARRAY_SIZE(twl6030ldo_linear_range), \
539 .ops = &twl6030ldo_ops, \
540 .type = REGULATOR_VOLTAGE, \
541 .owner = THIS_MODULE, \
545 #define TWL6030_FIXED_LDO(label, offset, mVolts, turnon_delay) \
546 static const struct twlreg_info TWLFIXED_INFO_##label = { \
551 .id = TWL6030##_REG_##label, \
553 .ops = &twl6030fixed_ops, \
554 .type = REGULATOR_VOLTAGE, \
555 .owner = THIS_MODULE, \
556 .min_uV = mVolts * 1000, \
557 .enable_time = turnon_delay, \
558 .of_map_mode = NULL, \
562 #define TWL6032_ADJUSTABLE_SMPS(label, offset) \
563 static const struct twlreg_info TWLSMPS_INFO_##label = { \
567 .id = TWL6032_REG_##label, \
569 .ops = &twlsmps_ops, \
570 .type = REGULATOR_VOLTAGE, \
571 .owner = THIS_MODULE, \
575 /* VUSBCP is managed *only* by the USB subchip */
576 /* 6030 REG with base as PMC Slave Misc : 0x0030 */
577 /* Turnon-delay and remap configuration values for 6030 are not
578 verified since the specification is not public */
579 TWL6030_ADJUSTABLE_SMPS(VDD1
);
580 TWL6030_ADJUSTABLE_SMPS(VDD2
);
581 TWL6030_ADJUSTABLE_SMPS(VDD3
);
582 TWL6030_ADJUSTABLE_LDO(VAUX1_6030
, 0x54);
583 TWL6030_ADJUSTABLE_LDO(VAUX2_6030
, 0x58);
584 TWL6030_ADJUSTABLE_LDO(VAUX3_6030
, 0x5c);
585 TWL6030_ADJUSTABLE_LDO(VMMC
, 0x68);
586 TWL6030_ADJUSTABLE_LDO(VPP
, 0x6c);
587 TWL6030_ADJUSTABLE_LDO(VUSIM
, 0x74);
588 /* 6025 are renamed compared to 6030 versions */
589 TWL6032_ADJUSTABLE_LDO(LDO2
, 0x54);
590 TWL6032_ADJUSTABLE_LDO(LDO4
, 0x58);
591 TWL6032_ADJUSTABLE_LDO(LDO3
, 0x5c);
592 TWL6032_ADJUSTABLE_LDO(LDO5
, 0x68);
593 TWL6032_ADJUSTABLE_LDO(LDO1
, 0x6c);
594 TWL6032_ADJUSTABLE_LDO(LDO7
, 0x74);
595 TWL6032_ADJUSTABLE_LDO(LDO6
, 0x60);
596 TWL6032_ADJUSTABLE_LDO(LDOLN
, 0x64);
597 TWL6032_ADJUSTABLE_LDO(LDOUSB
, 0x70);
598 TWL6030_FIXED_LDO(VANA
, 0x50, 2100, 0);
599 TWL6030_FIXED_LDO(VCXIO
, 0x60, 1800, 0);
600 TWL6030_FIXED_LDO(VDAC
, 0x64, 1800, 0);
601 TWL6030_FIXED_LDO(VUSB
, 0x70, 3300, 0);
602 TWL6030_FIXED_LDO(V1V8
, 0x16, 1800, 0);
603 TWL6030_FIXED_LDO(V2V1
, 0x1c, 2100, 0);
604 TWL6032_ADJUSTABLE_SMPS(SMPS3
, 0x34);
605 TWL6032_ADJUSTABLE_SMPS(SMPS4
, 0x10);
606 TWL6032_ADJUSTABLE_SMPS(VIO
, 0x16);
608 static u8
twl_get_smps_offset(void)
612 twl_i2c_read_u8(TWL_MODULE_PM_RECEIVER
, &value
,
613 TWL6030_SMPS_OFFSET
);
617 static u8
twl_get_smps_mult(void)
621 twl_i2c_read_u8(TWL_MODULE_PM_RECEIVER
, &value
,
626 #define TWL_OF_MATCH(comp, family, label) \
628 .compatible = comp, \
629 .data = &family##_INFO_##label, \
632 #define TWL6030_OF_MATCH(comp, label) TWL_OF_MATCH(comp, TWL6030, label)
633 #define TWL6032_OF_MATCH(comp, label) TWL_OF_MATCH(comp, TWL6032, label)
634 #define TWLFIXED_OF_MATCH(comp, label) TWL_OF_MATCH(comp, TWLFIXED, label)
635 #define TWLSMPS_OF_MATCH(comp, label) TWL_OF_MATCH(comp, TWLSMPS, label)
637 static const struct of_device_id twl_of_match
[] = {
638 TWL6030_OF_MATCH("ti,twl6030-vdd1", VDD1
),
639 TWL6030_OF_MATCH("ti,twl6030-vdd2", VDD2
),
640 TWL6030_OF_MATCH("ti,twl6030-vdd3", VDD3
),
641 TWL6030_OF_MATCH("ti,twl6030-vaux1", VAUX1_6030
),
642 TWL6030_OF_MATCH("ti,twl6030-vaux2", VAUX2_6030
),
643 TWL6030_OF_MATCH("ti,twl6030-vaux3", VAUX3_6030
),
644 TWL6030_OF_MATCH("ti,twl6030-vmmc", VMMC
),
645 TWL6030_OF_MATCH("ti,twl6030-vpp", VPP
),
646 TWL6030_OF_MATCH("ti,twl6030-vusim", VUSIM
),
647 TWL6032_OF_MATCH("ti,twl6032-ldo2", LDO2
),
648 TWL6032_OF_MATCH("ti,twl6032-ldo4", LDO4
),
649 TWL6032_OF_MATCH("ti,twl6032-ldo3", LDO3
),
650 TWL6032_OF_MATCH("ti,twl6032-ldo5", LDO5
),
651 TWL6032_OF_MATCH("ti,twl6032-ldo1", LDO1
),
652 TWL6032_OF_MATCH("ti,twl6032-ldo7", LDO7
),
653 TWL6032_OF_MATCH("ti,twl6032-ldo6", LDO6
),
654 TWL6032_OF_MATCH("ti,twl6032-ldoln", LDOLN
),
655 TWL6032_OF_MATCH("ti,twl6032-ldousb", LDOUSB
),
656 TWLFIXED_OF_MATCH("ti,twl6030-vana", VANA
),
657 TWLFIXED_OF_MATCH("ti,twl6030-vcxio", VCXIO
),
658 TWLFIXED_OF_MATCH("ti,twl6030-vdac", VDAC
),
659 TWLFIXED_OF_MATCH("ti,twl6030-vusb", VUSB
),
660 TWLFIXED_OF_MATCH("ti,twl6030-v1v8", V1V8
),
661 TWLFIXED_OF_MATCH("ti,twl6030-v2v1", V2V1
),
662 TWLSMPS_OF_MATCH("ti,twl6032-smps3", SMPS3
),
663 TWLSMPS_OF_MATCH("ti,twl6032-smps4", SMPS4
),
664 TWLSMPS_OF_MATCH("ti,twl6032-vio", VIO
),
667 MODULE_DEVICE_TABLE(of
, twl_of_match
);
669 static int twlreg_probe(struct platform_device
*pdev
)
672 struct twlreg_info
*info
;
673 const struct twlreg_info
*template;
674 struct regulator_init_data
*initdata
;
675 struct regulation_constraints
*c
;
676 struct regulator_dev
*rdev
;
677 struct regulator_config config
= { };
678 struct device_node
*np
= pdev
->dev
.of_node
;
680 template = of_device_get_match_data(&pdev
->dev
);
684 id
= template->desc
.id
;
685 initdata
= of_get_regulator_init_data(&pdev
->dev
, np
, &template->desc
);
689 info
= devm_kmemdup(&pdev
->dev
, template, sizeof(*info
), GFP_KERNEL
);
693 /* Constrain board-specific capabilities according to what
694 * this driver and the chip itself can actually do.
696 c
= &initdata
->constraints
;
697 c
->valid_modes_mask
&= REGULATOR_MODE_NORMAL
| REGULATOR_MODE_STANDBY
;
698 c
->valid_ops_mask
&= REGULATOR_CHANGE_VOLTAGE
699 | REGULATOR_CHANGE_MODE
700 | REGULATOR_CHANGE_STATUS
;
703 case TWL6032_REG_SMPS3
:
704 if (twl_get_smps_mult() & SMPS_MULTOFFSET_SMPS3
)
705 info
->flags
|= SMPS_EXTENDED_EN
;
706 if (twl_get_smps_offset() & SMPS_MULTOFFSET_SMPS3
)
707 info
->flags
|= SMPS_OFFSET_EN
;
709 case TWL6032_REG_SMPS4
:
710 if (twl_get_smps_mult() & SMPS_MULTOFFSET_SMPS4
)
711 info
->flags
|= SMPS_EXTENDED_EN
;
712 if (twl_get_smps_offset() & SMPS_MULTOFFSET_SMPS4
)
713 info
->flags
|= SMPS_OFFSET_EN
;
715 case TWL6032_REG_VIO
:
716 if (twl_get_smps_mult() & SMPS_MULTOFFSET_VIO
)
717 info
->flags
|= SMPS_EXTENDED_EN
;
718 if (twl_get_smps_offset() & SMPS_MULTOFFSET_VIO
)
719 info
->flags
|= SMPS_OFFSET_EN
;
723 if (of_get_property(np
, "ti,retain-on-reset", NULL
))
724 info
->flags
|= TWL_6030_WARM_RESET
;
726 config
.dev
= &pdev
->dev
;
727 config
.init_data
= initdata
;
728 config
.driver_data
= info
;
731 rdev
= devm_regulator_register(&pdev
->dev
, &info
->desc
, &config
);
733 dev_err(&pdev
->dev
, "can't register %s, %ld\n",
734 info
->desc
.name
, PTR_ERR(rdev
));
735 return PTR_ERR(rdev
);
737 platform_set_drvdata(pdev
, rdev
);
739 /* NOTE: many regulators support short-circuit IRQs (presentable
740 * as REGULATOR_OVER_CURRENT notifications?) configured via:
742 * - SC_DETECT1 (vintana2, vmmc1/2, vaux1/2/3/4)
743 * - SC_DETECT2 (vusb, vdac, vio, vdd1/2, vpll2)
750 MODULE_ALIAS("platform:twl6030_reg");
752 static struct platform_driver twlreg_driver
= {
753 .probe
= twlreg_probe
,
754 /* NOTE: short name, to work around driver model truncation of
755 * "twl_regulator.12" (and friends) to "twl_regulator.1".
758 .name
= "twl6030_reg",
759 .of_match_table
= of_match_ptr(twl_of_match
),
763 static int __init
twlreg_init(void)
765 return platform_driver_register(&twlreg_driver
);
767 subsys_initcall(twlreg_init
);
769 static void __exit
twlreg_exit(void)
771 platform_driver_unregister(&twlreg_driver
);
773 module_exit(twlreg_exit
)
775 MODULE_DESCRIPTION("TWL6030 regulator driver");
776 MODULE_LICENSE("GPL");