@@ -71,6 +71,7 @@ struct twlreg_info {
71
71
#define VREG_TYPE 1
72
72
#define VREG_REMAP 2
73
73
#define VREG_DEDICATED 3 /* LDO control */
74
+ #define VREG_VOLTAGE_SMPS_4030 9
74
75
/* TWL6030 register offsets */
75
76
#define VREG_TRANS 1
76
77
#define VREG_STATE 2
@@ -514,6 +515,32 @@ static struct regulator_ops twl4030ldo_ops = {
514
515
.get_status = twl4030reg_get_status ,
515
516
};
516
517
518
+ static int
519
+ twl4030smps_set_voltage (struct regulator_dev * rdev , int min_uV , int max_uV ,
520
+ unsigned * selector )
521
+ {
522
+ struct twlreg_info * info = rdev_get_drvdata (rdev );
523
+ int vsel = DIV_ROUND_UP (min_uV - 600000 , 12500 );
524
+
525
+ twlreg_write (info , TWL_MODULE_PM_RECEIVER , VREG_VOLTAGE_SMPS_4030 ,
526
+ vsel );
527
+ return 0 ;
528
+ }
529
+
530
+ static int twl4030smps_get_voltage (struct regulator_dev * rdev )
531
+ {
532
+ struct twlreg_info * info = rdev_get_drvdata (rdev );
533
+ int vsel = twlreg_read (info , TWL_MODULE_PM_RECEIVER ,
534
+ VREG_VOLTAGE_SMPS_4030 );
535
+
536
+ return vsel * 12500 + 600000 ;
537
+ }
538
+
539
+ static struct regulator_ops twl4030smps_ops = {
540
+ .set_voltage = twl4030smps_set_voltage ,
541
+ .get_voltage = twl4030smps_get_voltage ,
542
+ };
543
+
517
544
static int twl6030ldo_list_voltage (struct regulator_dev * rdev , unsigned index )
518
545
{
519
546
struct twlreg_info * info = rdev_get_drvdata (rdev );
@@ -856,6 +883,21 @@ static struct regulator_ops twlsmps_ops = {
856
883
}, \
857
884
}
858
885
886
+ #define TWL4030_ADJUSTABLE_SMPS (label , offset , num , turnon_delay , remap_conf ) \
887
+ { \
888
+ .base = offset, \
889
+ .id = num, \
890
+ .delay = turnon_delay, \
891
+ .remap = remap_conf, \
892
+ .desc = { \
893
+ .name = #label, \
894
+ .id = TWL4030_REG_##label, \
895
+ .ops = &twl4030smps_ops, \
896
+ .type = REGULATOR_VOLTAGE, \
897
+ .owner = THIS_MODULE, \
898
+ }, \
899
+ }
900
+
859
901
#define TWL6030_ADJUSTABLE_LDO (label , offset , min_mVolts , max_mVolts ) { \
860
902
.base = offset, \
861
903
.min_mV = min_mVolts, \
@@ -947,8 +989,8 @@ static struct twlreg_info twl_regs[] = {
947
989
TWL4030_ADJUSTABLE_LDO (VINTANA2 , 0x43 , 12 , 100 , 0x08 ),
948
990
TWL4030_FIXED_LDO (VINTDIG , 0x47 , 1500 , 13 , 100 , 0x08 ),
949
991
TWL4030_ADJUSTABLE_LDO (VIO , 0x4b , 14 , 1000 , 0x08 ),
950
- TWL4030_ADJUSTABLE_LDO (VDD1 , 0x55 , 15 , 1000 , 0x08 ),
951
- TWL4030_ADJUSTABLE_LDO (VDD2 , 0x63 , 16 , 1000 , 0x08 ),
992
+ TWL4030_ADJUSTABLE_SMPS (VDD1 , 0x55 , 15 , 1000 , 0x08 ),
993
+ TWL4030_ADJUSTABLE_SMPS (VDD2 , 0x63 , 16 , 1000 , 0x08 ),
952
994
TWL4030_FIXED_LDO (VUSB1V5 , 0x71 , 1500 , 17 , 100 , 0x08 ),
953
995
TWL4030_FIXED_LDO (VUSB1V8 , 0x74 , 1800 , 18 , 100 , 0x08 ),
954
996
TWL4030_FIXED_LDO (VUSB3V1 , 0x77 , 3100 , 19 , 150 , 0x08 ),
0 commit comments