aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTero Kristo <t-kristo@ti.com>2012-02-28 04:39:10 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-03-11 16:09:00 -0400
commit34a38440689b06a515104d668494e0ff8a4e1537 (patch)
treeb6ea0840779978b209a11eeaedc0575080d57885
parent63bfff4e20211b464cbea6e79e5fd36df227c154 (diff)
regulator: twl6030: add support for vdd1, vdd2 and vdd3 regulators
vdd1 and vdd2 are now common regulators for twl4030 and twl6030. Also added vdd3 as a new regulator for twl6030. twl6030 vdd1...vdd3 smps regulator voltages can only be controlled through the smartreflex voltage channel, thus the support for the voltage_get and set is minimal and requires external controller. Signed-off-by: Tero Kristo <t-kristo@ti.com> Signed-off-by: Rajendra Nayak <rnayak@ti.com> Acked-by: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r--drivers/mfd/twl-core.c15
-rw-r--r--drivers/regulator/twl-regulator.c39
-rw-r--r--include/linux/i2c/twl.h5
3 files changed, 57 insertions, 2 deletions
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index fae5f76d6ccb..c788e363ed56 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -949,6 +949,21 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features)
949 /* twl6030 regulators */ 949 /* twl6030 regulators */
950 if (twl_has_regulator() && twl_class_is_6030() && 950 if (twl_has_regulator() && twl_class_is_6030() &&
951 !(features & TWL6025_SUBCLASS)) { 951 !(features & TWL6025_SUBCLASS)) {
952 child = add_regulator(TWL6030_REG_VDD1, pdata->vdd1,
953 features);
954 if (IS_ERR(child))
955 return PTR_ERR(child);
956
957 child = add_regulator(TWL6030_REG_VDD2, pdata->vdd2,
958 features);
959 if (IS_ERR(child))
960 return PTR_ERR(child);
961
962 child = add_regulator(TWL6030_REG_VDD3, pdata->vdd3,
963 features);
964 if (IS_ERR(child))
965 return PTR_ERR(child);
966
952 child = add_regulator(TWL6030_REG_VMMC, pdata->vmmc, 967 child = add_regulator(TWL6030_REG_VMMC, pdata->vmmc,
953 features); 968 features);
954 if (IS_ERR(child)) 969 if (IS_ERR(child))
diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c
index 7ff8bb22d569..8611282f1d20 100644
--- a/drivers/regulator/twl-regulator.c
+++ b/drivers/regulator/twl-regulator.c
@@ -561,6 +561,32 @@ static struct regulator_ops twl4030smps_ops = {
561 .get_voltage = twl4030smps_get_voltage, 561 .get_voltage = twl4030smps_get_voltage,
562}; 562};
563 563
564static int twl6030coresmps_set_voltage(struct regulator_dev *rdev, int min_uV,
565 int max_uV, unsigned *selector)
566{
567 struct twlreg_info *info = rdev_get_drvdata(rdev);
568
569 if (info->set_voltage)
570 return info->set_voltage(info->data, min_uV);
571
572 return -ENODEV;
573}
574
575static int twl6030coresmps_get_voltage(struct regulator_dev *rdev)
576{
577 struct twlreg_info *info = rdev_get_drvdata(rdev);
578
579 if (info->get_voltage)
580 return info->get_voltage(info->data);
581
582 return -ENODEV;
583}
584
585static struct regulator_ops twl6030coresmps_ops = {
586 .set_voltage = twl6030coresmps_set_voltage,
587 .get_voltage = twl6030coresmps_get_voltage,
588};
589
564static int twl6030ldo_list_voltage(struct regulator_dev *rdev, unsigned index) 590static int twl6030ldo_list_voltage(struct regulator_dev *rdev, unsigned index)
565{ 591{
566 struct twlreg_info *info = rdev_get_drvdata(rdev); 592 struct twlreg_info *info = rdev_get_drvdata(rdev);
@@ -926,6 +952,16 @@ static struct regulator_ops twlsmps_ops = {
926 }, \ 952 }, \
927 } 953 }
928 954
955#define TWL6030_ADJUSTABLE_SMPS(label) { \
956 .desc = { \
957 .name = #label, \
958 .id = TWL6030_REG_##label, \
959 .ops = &twl6030coresmps_ops, \
960 .type = REGULATOR_VOLTAGE, \
961 .owner = THIS_MODULE, \
962 }, \
963 }
964
929#define TWL6030_ADJUSTABLE_LDO(label, offset, min_mVolts, max_mVolts) { \ 965#define TWL6030_ADJUSTABLE_LDO(label, offset, min_mVolts, max_mVolts) { \
930 .base = offset, \ 966 .base = offset, \
931 .min_mV = min_mVolts, \ 967 .min_mV = min_mVolts, \
@@ -1027,6 +1063,9 @@ static struct twlreg_info twl_regs[] = {
1027 /* 6030 REG with base as PMC Slave Misc : 0x0030 */ 1063 /* 6030 REG with base as PMC Slave Misc : 0x0030 */
1028 /* Turnon-delay and remap configuration values for 6030 are not 1064 /* Turnon-delay and remap configuration values for 6030 are not
1029 verified since the specification is not public */ 1065 verified since the specification is not public */
1066 TWL6030_ADJUSTABLE_SMPS(VDD1),
1067 TWL6030_ADJUSTABLE_SMPS(VDD2),
1068 TWL6030_ADJUSTABLE_SMPS(VDD3),
1030 TWL6030_ADJUSTABLE_LDO(VAUX1_6030, 0x54, 1000, 3300), 1069 TWL6030_ADJUSTABLE_LDO(VAUX1_6030, 0x54, 1000, 3300),
1031 TWL6030_ADJUSTABLE_LDO(VAUX2_6030, 0x58, 1000, 3300), 1070 TWL6030_ADJUSTABLE_LDO(VAUX2_6030, 0x58, 1000, 3300),
1032 TWL6030_ADJUSTABLE_LDO(VAUX3_6030, 0x5c, 1000, 3300), 1071 TWL6030_ADJUSTABLE_LDO(VAUX3_6030, 0x5c, 1000, 3300),
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 08a82d314f24..f66c0311e448 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -712,6 +712,9 @@ struct twl4030_platform_data {
712 struct regulator_init_data *vaux1; 712 struct regulator_init_data *vaux1;
713 struct regulator_init_data *vaux2; 713 struct regulator_init_data *vaux2;
714 struct regulator_init_data *vaux3; 714 struct regulator_init_data *vaux3;
715 struct regulator_init_data *vdd1;
716 struct regulator_init_data *vdd2;
717 struct regulator_init_data *vdd3;
715 /* TWL4030 LDO regulators */ 718 /* TWL4030 LDO regulators */
716 struct regulator_init_data *vpll1; 719 struct regulator_init_data *vpll1;
717 struct regulator_init_data *vpll2; 720 struct regulator_init_data *vpll2;
@@ -720,8 +723,6 @@ struct twl4030_platform_data {
720 struct regulator_init_data *vsim; 723 struct regulator_init_data *vsim;
721 struct regulator_init_data *vaux4; 724 struct regulator_init_data *vaux4;
722 struct regulator_init_data *vio; 725 struct regulator_init_data *vio;
723 struct regulator_init_data *vdd1;
724 struct regulator_init_data *vdd2;
725 struct regulator_init_data *vintana1; 726 struct regulator_init_data *vintana1;
726 struct regulator_init_data *vintana2; 727 struct regulator_init_data *vintana2;
727 struct regulator_init_data *vintdig; 728 struct regulator_init_data *vintdig;