regulator: add regen regulator
authorGrazvydas Ignotas <notasas@gmail.com>
Sun, 22 May 2016 21:48:06 +0000 (00:48 +0300)
committerGrazvydas Ignotas <notasas@gmail.com>
Sun, 3 Jul 2016 00:23:25 +0000 (03:23 +0300)
Well it's not really a regulator, just an output signal that is
programmed the same way as a regulator, so it's easiest to add it
this way.

drivers/mfd/twl-core.c
drivers/regulator/twl-regulator.c
include/linux/i2c/twl.h

index 5182f6d..9b1df0b 100644 (file)
@@ -985,6 +985,11 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features)
                                        features);
                if (IS_ERR(child))
                        return PTR_ERR(child);
+
+               child = add_regulator(TWL4030_REG_REGEN, pdata->regen,
+                                       features);
+               if (IS_ERR(child))
+                       return PTR_ERR(child);
        }
 
        /* maybe add LDOs that are omitted on cost-reduced parts */
index b44f667..d1f3c10 100644 (file)
@@ -999,6 +999,20 @@ static struct regulator_ops twlsmps_ops = {
                }, \
        }
 
+#define TWL4030_FIXED_RESOURCE(label, offset, num, turnon_delay, remap_conf) { \
+       .base = offset, \
+       .id = num, \
+       .delay = turnon_delay, \
+       .remap = remap_conf, \
+       .desc = { \
+               .name = #label, \
+               .id = TWL4030_REG_##label, \
+               .ops = &twl4030fixed_ops, \
+               .type = REGULATOR_VOLTAGE, \
+               .owner = THIS_MODULE, \
+               }, \
+       }
+
 #define TWL6030_FIXED_RESOURCE(label, offset, turnon_delay) { \
        .base = offset, \
        .delay = turnon_delay, \
@@ -1052,6 +1066,8 @@ static struct twlreg_info twl_regs[] = {
        TWL4030_FIXED_LDO(VUSB3V1, 0x77, 3100, 19, 150, 0x08),
        /* VUSBCP is managed *only* by the USB subchip */
 
+       TWL4030_FIXED_RESOURCE(REGEN, 0x7f, 21, 10, 0x08), /* OD to VBAT */
+
        /* 6030 REG with base as PMC Slave Misc : 0x0030 */
        /* Turnon-delay and remap configuration values for 6030 are not
           verified since the specification is not public */
index ca0aeec..f1a95c2 100644 (file)
@@ -729,6 +729,9 @@ struct twl4030_platform_data {
        struct regulator_init_data              *vintana1;
        struct regulator_init_data              *vintana2;
        struct regulator_init_data              *vintdig;
+
+       struct regulator_init_data              *regen;
+
        /* TWL6030 LDO regulators */
        struct regulator_init_data              *vmmc;
        struct regulator_init_data              *vpp;
@@ -811,6 +814,9 @@ static inline int twl4030charger_usb_en(int enable) { return 0; }
 #define TWL4030_REG_VUSB1V8    18
 #define TWL4030_REG_VUSB3V1    19
 
+/* output signals */
+#define TWL4030_REG_REGEN      21
+
 /* TWL6030 SMPS/LDO's */
 /* EXTERNAL dc-to-dc buck convertor controllable via SR */
 #define TWL6030_REG_VDD1       30