diff mbox

[1/2] regulator: twl6030: do not write to _GRP for regulator enable

Message ID 1305898432-14939-2-git-send-email-balajitk@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Balaji T K May 20, 2011, 1:33 p.m. UTC
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>
---
 drivers/regulator/twl-regulator.c |   39 +++++++++++++++++++++++-------------
 1 files changed, 25 insertions(+), 14 deletions(-)

Comments

Mark Brown May 22, 2011, 6:50 a.m. UTC | #1
On Fri, May 20, 2011 at 07:03:51PM +0530, Balaji T K wrote:
> 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>

but

>  
>  	udelay(info->delay);

all these need to be replaced by implementing get_enable_time().
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Liam Girdwood May 22, 2011, 9:26 a.m. UTC | #2
On Sun, 2011-05-22 at 14:50 +0800, Mark Brown wrote:
> On Fri, May 20, 2011 at 07:03:51PM +0530, Balaji T K wrote:
> > 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>
> 
> but
> 
> >  
> >  	udelay(info->delay);
> 
> all these need to be replaced by implementing get_enable_time().

Both Applied.

Can you fix this incrementally.

Thanks

Liam

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c
index 2a808c2..abb40c6 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)
 	return grp && (val == TWL6030_CFG_STATE_ON);
 }
 
-static int twlreg_enable(struct regulator_dev *rdev)
+static int twl4030reg_enable(struct regulator_dev *rdev)
 {
 	struct twlreg_info	*info = rdev_get_drvdata(rdev);
 	int			grp;
@@ -166,17 +166,28 @@  static int twlreg_enable(struct regulator_dev *rdev)
 	if (grp < 0)
 		return grp;
 
-	if (twl_class_is_4030())
-		grp |= P1_GRP_4030;
-	else
-		grp |= P1_GRP_6030;
+	grp |= P1_GRP_4030;
 
 	ret = twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_GRP, grp);
 
-	if (!ret && twl_class_is_6030())
-		ret = twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_STATE,
-				grp << TWL6030_CFG_STATE_GRP_SHIFT |
-				TWL6030_CFG_STATE_ON);
+	udelay(info->delay);
+
+	return ret;
+}
+
+static int twl6030reg_enable(struct regulator_dev *rdev)
+{
+	struct twlreg_info	*info = rdev_get_drvdata(rdev);
+	int			grp;
+	int			ret;
+
+	grp = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_GRP);
+	if (grp < 0)
+		return grp;
+
+	ret = twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_STATE,
+			grp << TWL6030_CFG_STATE_GRP_SHIFT |
+			TWL6030_CFG_STATE_ON);
 
 	udelay(info->delay);
 
@@ -473,7 +484,7 @@  static struct regulator_ops twl4030ldo_ops = {
 	.set_voltage	= twl4030ldo_set_voltage,
 	.get_voltage	= twl4030ldo_get_voltage,
 
-	.enable		= twlreg_enable,
+	.enable		= twl4030reg_enable,
 	.disable	= twlreg_disable,
 	.is_enabled	= twl4030reg_is_enabled,
 
@@ -531,7 +542,7 @@  static struct regulator_ops twl6030ldo_ops = {
 	.set_voltage	= twl6030ldo_set_voltage,
 	.get_voltage	= twl6030ldo_get_voltage,
 
-	.enable		= twlreg_enable,
+	.enable		= twl6030reg_enable,
 	.disable	= twlreg_disable,
 	.is_enabled	= twl6030reg_is_enabled,
 
@@ -564,7 +575,7 @@  static struct regulator_ops twl4030fixed_ops = {
 
 	.get_voltage	= twlfixed_get_voltage,
 
-	.enable		= twlreg_enable,
+	.enable		= twl4030reg_enable,
 	.disable	= twlreg_disable,
 	.is_enabled	= twl4030reg_is_enabled,
 
@@ -578,7 +589,7 @@  static struct regulator_ops twl6030fixed_ops = {
 
 	.get_voltage	= twlfixed_get_voltage,
 
-	.enable		= twlreg_enable,
+	.enable		= twl6030reg_enable,
 	.disable	= twlreg_disable,
 	.is_enabled	= twl6030reg_is_enabled,
 
@@ -588,7 +599,7 @@  static struct regulator_ops twl6030fixed_ops = {
 };
 
 static struct regulator_ops twl6030_fixed_resource = {
-	.enable		= twlreg_enable,
+	.enable		= twl6030reg_enable,
 	.disable	= twlreg_disable,
 	.is_enabled	= twl6030reg_is_enabled,
 	.get_status	= twl6030reg_get_status,