aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBalaji T K <balajitk@ti.com>2011-05-20 09:33:52 -0400
committerLiam Girdwood <lrg@slimlogic.co.uk>2011-05-27 05:49:29 -0400
commit0ff3897d79d4607d37432b3eb81a304f7e4b4841 (patch)
tree78b347c8482bb0a1e4998a4333bbf0f70631cb9c
parentf8c2940bcd623b4d185d4ff7ff5678a4508939b3 (diff)
regulator: twl6030: do not write to _GRP for regulator disable
TWL6030: regulator is disabled via VREG_STATE TWL4030: regulator is disabled 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>
-rw-r--r--drivers/regulator/twl-regulator.c47
1 files changed, 22 insertions, 25 deletions
diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c
index abb40c6d9a4d..4702b8a7e0ef 100644
--- a/drivers/regulator/twl-regulator.c
+++ b/drivers/regulator/twl-regulator.c
@@ -194,7 +194,7 @@ static int twl6030reg_enable(struct regulator_dev *rdev)
194 return ret; 194 return ret;
195} 195}
196 196
197static int twlreg_disable(struct regulator_dev *rdev) 197static int twl4030reg_disable(struct regulator_dev *rdev)
198{ 198{
199 struct twlreg_info *info = rdev_get_drvdata(rdev); 199 struct twlreg_info *info = rdev_get_drvdata(rdev);
200 int grp; 200 int grp;
@@ -204,28 +204,25 @@ static int twlreg_disable(struct regulator_dev *rdev)
204 if (grp < 0) 204 if (grp < 0)
205 return grp; 205 return grp;
206 206
207 /* For 6030, set the off state for all grps enabled */ 207 grp &= ~(P1_GRP_4030 | P2_GRP_4030 | P3_GRP_4030);
208 if (twl_class_is_6030()) {
209 ret = twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_STATE,
210 (grp & (P1_GRP_6030 | P2_GRP_6030 | P3_GRP_6030)) <<
211 TWL6030_CFG_STATE_GRP_SHIFT |
212 TWL6030_CFG_STATE_OFF);
213 if (ret)
214 return ret;
215 }
216
217 if (twl_class_is_4030())
218 grp &= ~(P1_GRP_4030 | P2_GRP_4030 | P3_GRP_4030);
219 else
220 grp &= ~(P1_GRP_6030 | P2_GRP_6030 | P3_GRP_6030);
221 208
222 ret = twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_GRP, grp); 209 ret = twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_GRP, grp);
223 210
224 /* Next, associate cleared grp in state register */ 211 return ret;
225 if (!ret && twl_class_is_6030()) 212}
226 ret = twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_STATE, 213
227 grp << TWL6030_CFG_STATE_GRP_SHIFT | 214static int twl6030reg_disable(struct regulator_dev *rdev)
228 TWL6030_CFG_STATE_OFF); 215{
216 struct twlreg_info *info = rdev_get_drvdata(rdev);
217 int grp = 0;
218 int ret;
219
220 grp = P1_GRP_6030 | P2_GRP_6030 | P3_GRP_6030;
221
222 /* For 6030, set the off state for all grps enabled */
223 ret = twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_STATE,
224 (grp) << TWL6030_CFG_STATE_GRP_SHIFT |
225 TWL6030_CFG_STATE_OFF);
229 226
230 return ret; 227 return ret;
231} 228}
@@ -485,7 +482,7 @@ static struct regulator_ops twl4030ldo_ops = {
485 .get_voltage = twl4030ldo_get_voltage, 482 .get_voltage = twl4030ldo_get_voltage,
486 483
487 .enable = twl4030reg_enable, 484 .enable = twl4030reg_enable,
488 .disable = twlreg_disable, 485 .disable = twl4030reg_disable,
489 .is_enabled = twl4030reg_is_enabled, 486 .is_enabled = twl4030reg_is_enabled,
490 487
491 .set_mode = twl4030reg_set_mode, 488 .set_mode = twl4030reg_set_mode,
@@ -543,7 +540,7 @@ static struct regulator_ops twl6030ldo_ops = {
543 .get_voltage = twl6030ldo_get_voltage, 540 .get_voltage = twl6030ldo_get_voltage,
544 541
545 .enable = twl6030reg_enable, 542 .enable = twl6030reg_enable,
546 .disable = twlreg_disable, 543 .disable = twl6030reg_disable,
547 .is_enabled = twl6030reg_is_enabled, 544 .is_enabled = twl6030reg_is_enabled,
548 545
549 .set_mode = twl6030reg_set_mode, 546 .set_mode = twl6030reg_set_mode,
@@ -576,7 +573,7 @@ static struct regulator_ops twl4030fixed_ops = {
576 .get_voltage = twlfixed_get_voltage, 573 .get_voltage = twlfixed_get_voltage,
577 574
578 .enable = twl4030reg_enable, 575 .enable = twl4030reg_enable,
579 .disable = twlreg_disable, 576 .disable = twl4030reg_disable,
580 .is_enabled = twl4030reg_is_enabled, 577 .is_enabled = twl4030reg_is_enabled,
581 578
582 .set_mode = twl4030reg_set_mode, 579 .set_mode = twl4030reg_set_mode,
@@ -590,7 +587,7 @@ static struct regulator_ops twl6030fixed_ops = {
590 .get_voltage = twlfixed_get_voltage, 587 .get_voltage = twlfixed_get_voltage,
591 588
592 .enable = twl6030reg_enable, 589 .enable = twl6030reg_enable,
593 .disable = twlreg_disable, 590 .disable = twl6030reg_disable,
594 .is_enabled = twl6030reg_is_enabled, 591 .is_enabled = twl6030reg_is_enabled,
595 592
596 .set_mode = twl6030reg_set_mode, 593 .set_mode = twl6030reg_set_mode,
@@ -600,7 +597,7 @@ static struct regulator_ops twl6030fixed_ops = {
600 597
601static struct regulator_ops twl6030_fixed_resource = { 598static struct regulator_ops twl6030_fixed_resource = {
602 .enable = twl6030reg_enable, 599 .enable = twl6030reg_enable,
603 .disable = twlreg_disable, 600 .disable = twl6030reg_disable,
604 .is_enabled = twl6030reg_is_enabled, 601 .is_enabled = twl6030reg_is_enabled,
605 .get_status = twl6030reg_get_status, 602 .get_status = twl6030reg_get_status,
606}; 603};