aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2012-04-10 23:07:17 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-04-13 04:54:45 -0400
commitb6f476c2c12d19b48364c9b0c818182280c2d1ae (patch)
tree1ecc60c8575c167bbdfa6d9932433fbcbad7007f /drivers
parent48c936d6da7988db03df64b4773ab14d0b7ddd3e (diff)
regulator: twl-regulator: Use twlreg_grp helper function
Since the twlreg_grp helper function is there, use it. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/regulator/twl-regulator.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c
index d9ba4c497672..7385b273a10f 100644
--- a/drivers/regulator/twl-regulator.c
+++ b/drivers/regulator/twl-regulator.c
@@ -175,15 +175,14 @@ static int twl6030reg_is_enabled(struct regulator_dev *rdev)
175 struct twlreg_info *info = rdev_get_drvdata(rdev); 175 struct twlreg_info *info = rdev_get_drvdata(rdev);
176 int grp = 0, val; 176 int grp = 0, val;
177 177
178 if (!(twl_class_is_6030() && (info->features & TWL6025_SUBCLASS))) 178 if (!(twl_class_is_6030() && (info->features & TWL6025_SUBCLASS))) {
179 grp = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_GRP); 179 grp = twlreg_grp(rdev);
180 if (grp < 0) 180 if (grp < 0)
181 return grp; 181 return grp;
182
183 if (!(twl_class_is_6030() && (info->features & TWL6025_SUBCLASS)))
184 grp &= P1_GRP_6030; 182 grp &= P1_GRP_6030;
185 else 183 } else {
186 grp = 1; 184 grp = 1;
185 }
187 186
188 val = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_STATE); 187 val = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_STATE);
189 val = TWL6030_CFG_STATE_APP(val); 188 val = TWL6030_CFG_STATE_APP(val);
@@ -197,7 +196,7 @@ static int twl4030reg_enable(struct regulator_dev *rdev)
197 int grp; 196 int grp;
198 int ret; 197 int ret;
199 198
200 grp = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_GRP); 199 grp = twlreg_grp(rdev);
201 if (grp < 0) 200 if (grp < 0)
202 return grp; 201 return grp;
203 202
@@ -215,7 +214,7 @@ static int twl6030reg_enable(struct regulator_dev *rdev)
215 int ret; 214 int ret;
216 215
217 if (!(twl_class_is_6030() && (info->features & TWL6025_SUBCLASS))) 216 if (!(twl_class_is_6030() && (info->features & TWL6025_SUBCLASS)))
218 grp = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_GRP); 217 grp = twlreg_grp(rdev);
219 if (grp < 0) 218 if (grp < 0)
220 return grp; 219 return grp;
221 220
@@ -245,7 +244,7 @@ static int twl4030reg_disable(struct regulator_dev *rdev)
245 int grp; 244 int grp;
246 int ret; 245 int ret;
247 246
248 grp = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_GRP); 247 grp = twlreg_grp(rdev);
249 if (grp < 0) 248 if (grp < 0)
250 return grp; 249 return grp;
251 250
@@ -357,7 +356,7 @@ static int twl6030reg_set_mode(struct regulator_dev *rdev, unsigned mode)
357 int val; 356 int val;
358 357
359 if (!(twl_class_is_6030() && (info->features & TWL6025_SUBCLASS))) 358 if (!(twl_class_is_6030() && (info->features & TWL6025_SUBCLASS)))
360 grp = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_GRP); 359 grp = twlreg_grp(rdev);
361 360
362 if (grp < 0) 361 if (grp < 0)
363 return grp; 362 return grp;