aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorBalaji T K <balajitk@ti.com>2011-05-20 09:33:51 -0400
committerLiam Girdwood <lrg@slimlogic.co.uk>2011-05-27 05:49:29 -0400
commitf8c2940bcd623b4d185d4ff7ff5678a4508939b3 (patch)
tree9257c5a985cfd80b53e0f427af34634b40c798a6 /drivers/regulator
parent6851ad3ab3461966adfffe8789372fe8256da792 (diff)
regulator: twl6030: do not write to _GRP for regulator enable
TWL6030: regulator is enabled via VREG_STATE TWL4030: regulator is enabled via VREG_GRP Since there is nothing common, split twlreg_enable similar to other regulator_ops Signed-off-by: Balaji T K <balajitk@ti.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/twl-regulator.c39
1 files changed, 25 insertions, 14 deletions
diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c
index 2a808c25f982..abb40c6d9a4d 100644
--- a/drivers/regulator/twl-regulator.c
+++ b/drivers/regulator/twl-regulator.c
@@ -156,7 +156,7 @@ static int twl6030reg_is_enabled(struct regulator_dev *rdev)
156 return grp && (val == TWL6030_CFG_STATE_ON); 156 return grp && (val == TWL6030_CFG_STATE_ON);
157} 157}
158 158
159static int twlreg_enable(struct regulator_dev *rdev) 159static int twl4030reg_enable(struct regulator_dev *rdev)
160{ 160{
161 struct twlreg_info *info = rdev_get_drvdata(rdev); 161 struct twlreg_info *info = rdev_get_drvdata(rdev);
162 int grp; 162 int grp;
@@ -166,17 +166,28 @@ static int twlreg_enable(struct regulator_dev *rdev)
166 if (grp < 0) 166 if (grp < 0)
167 return grp; 167 return grp;
168 168
169 if (twl_class_is_4030()) 169 grp |= P1_GRP_4030;
170 grp |= P1_GRP_4030;
171 else
172 grp |= P1_GRP_6030;
173 170
174 ret = twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_GRP, grp); 171 ret = twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_GRP, grp);
175 172
176 if (!ret && twl_class_is_6030()) 173 udelay(info->delay);
177 ret = twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_STATE, 174
178 grp << TWL6030_CFG_STATE_GRP_SHIFT | 175 return ret;
179 TWL6030_CFG_STATE_ON); 176}
177
178static int twl6030reg_enable(struct regulator_dev *rdev)
179{
180 struct twlreg_info *info = rdev_get_drvdata(rdev);
181 int grp;
182 int ret;
183
184 grp = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_GRP);
185 if (grp < 0)
186 return grp;
187
188 ret = twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_STATE,
189 grp << TWL6030_CFG_STATE_GRP_SHIFT |
190 TWL6030_CFG_STATE_ON);
180 191
181 udelay(info->delay); 192 udelay(info->delay);
182 193
@@ -473,7 +484,7 @@ static struct regulator_ops twl4030ldo_ops = {
473 .set_voltage = twl4030ldo_set_voltage, 484 .set_voltage = twl4030ldo_set_voltage,
474 .get_voltage = twl4030ldo_get_voltage, 485 .get_voltage = twl4030ldo_get_voltage,
475 486
476 .enable = twlreg_enable, 487 .enable = twl4030reg_enable,
477 .disable = twlreg_disable, 488 .disable = twlreg_disable,
478 .is_enabled = twl4030reg_is_enabled, 489 .is_enabled = twl4030reg_is_enabled,
479 490
@@ -531,7 +542,7 @@ static struct regulator_ops twl6030ldo_ops = {
531 .set_voltage = twl6030ldo_set_voltage, 542 .set_voltage = twl6030ldo_set_voltage,
532 .get_voltage = twl6030ldo_get_voltage, 543 .get_voltage = twl6030ldo_get_voltage,
533 544
534 .enable = twlreg_enable, 545 .enable = twl6030reg_enable,
535 .disable = twlreg_disable, 546 .disable = twlreg_disable,
536 .is_enabled = twl6030reg_is_enabled, 547 .is_enabled = twl6030reg_is_enabled,
537 548
@@ -564,7 +575,7 @@ static struct regulator_ops twl4030fixed_ops = {
564 575
565 .get_voltage = twlfixed_get_voltage, 576 .get_voltage = twlfixed_get_voltage,
566 577
567 .enable = twlreg_enable, 578 .enable = twl4030reg_enable,
568 .disable = twlreg_disable, 579 .disable = twlreg_disable,
569 .is_enabled = twl4030reg_is_enabled, 580 .is_enabled = twl4030reg_is_enabled,
570 581
@@ -578,7 +589,7 @@ static struct regulator_ops twl6030fixed_ops = {
578 589
579 .get_voltage = twlfixed_get_voltage, 590 .get_voltage = twlfixed_get_voltage,
580 591
581 .enable = twlreg_enable, 592 .enable = twl6030reg_enable,
582 .disable = twlreg_disable, 593 .disable = twlreg_disable,
583 .is_enabled = twl6030reg_is_enabled, 594 .is_enabled = twl6030reg_is_enabled,
584 595
@@ -588,7 +599,7 @@ static struct regulator_ops twl6030fixed_ops = {
588}; 599};
589 600
590static struct regulator_ops twl6030_fixed_resource = { 601static struct regulator_ops twl6030_fixed_resource = {
591 .enable = twlreg_enable, 602 .enable = twl6030reg_enable,
592 .disable = twlreg_disable, 603 .disable = twlreg_disable,
593 .is_enabled = twl6030reg_is_enabled, 604 .is_enabled = twl6030reg_is_enabled,
594 .get_status = twl6030reg_get_status, 605 .get_status = twl6030reg_get_status,