Skip to content

Commit 34a3844

Browse files
Tero Kristobroonie
authored andcommitted
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>
1 parent 63bfff4 commit 34a3844

3 files changed

Lines changed: 57 additions & 2 deletions

File tree

‎drivers/mfd/twl-core.c‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,21 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features)
949949
/* twl6030 regulators */
950950
if (twl_has_regulator() && twl_class_is_6030() &&
951951
!(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+
952967
child = add_regulator(TWL6030_REG_VMMC, pdata->vmmc,
953968
features);
954969
if (IS_ERR(child))

‎drivers/regulator/twl-regulator.c‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,32 @@ static struct regulator_ops twl4030smps_ops = {
561561
.get_voltage = twl4030smps_get_voltage,
562562
};
563563

564+
static 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+
575+
static 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+
585+
static struct regulator_ops twl6030coresmps_ops = {
586+
.set_voltage = twl6030coresmps_set_voltage,
587+
.get_voltage = twl6030coresmps_get_voltage,
588+
};
589+
564590
static int twl6030ldo_list_voltage(struct regulator_dev *rdev, unsigned index)
565591
{
566592
struct twlreg_info *info = rdev_get_drvdata(rdev);
@@ -926,6 +952,16 @@ static struct regulator_ops twlsmps_ops = {
926952
}, \
927953
}
928954

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+
929965
#define TWL6030_ADJUSTABLE_LDO(label, offset, min_mVolts, max_mVolts) { \
930966
.base = offset, \
931967
.min_mV = min_mVolts, \
@@ -1027,6 +1063,9 @@ static struct twlreg_info twl_regs[] = {
10271063
/* 6030 REG with base as PMC Slave Misc : 0x0030 */
10281064
/* Turnon-delay and remap configuration values for 6030 are not
10291065
verified since the specification is not public */
1066+
TWL6030_ADJUSTABLE_SMPS(VDD1),
1067+
TWL6030_ADJUSTABLE_SMPS(VDD2),
1068+
TWL6030_ADJUSTABLE_SMPS(VDD3),
10301069
TWL6030_ADJUSTABLE_LDO(VAUX1_6030, 0x54, 1000, 3300),
10311070
TWL6030_ADJUSTABLE_LDO(VAUX2_6030, 0x58, 1000, 3300),
10321071
TWL6030_ADJUSTABLE_LDO(VAUX3_6030, 0x5c, 1000, 3300),

‎include/linux/i2c/twl.h‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,9 @@ struct twl4030_platform_data {
712712
struct regulator_init_data *vaux1;
713713
struct regulator_init_data *vaux2;
714714
struct regulator_init_data *vaux3;
715+
struct regulator_init_data *vdd1;
716+
struct regulator_init_data *vdd2;
717+
struct regulator_init_data *vdd3;
715718
/* TWL4030 LDO regulators */
716719
struct regulator_init_data *vpll1;
717720
struct regulator_init_data *vpll2;
@@ -720,8 +723,6 @@ struct twl4030_platform_data {
720723
struct regulator_init_data *vsim;
721724
struct regulator_init_data *vaux4;
722725
struct regulator_init_data *vio;
723-
struct regulator_init_data *vdd1;
724-
struct regulator_init_data *vdd2;
725726
struct regulator_init_data *vintana1;
726727
struct regulator_init_data *vintana2;
727728
struct regulator_init_data *vintdig;

0 commit comments

Comments
 (0)