linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Balaji T K <balajitk@ti.com>
To: linux-omap@vger.kernel.org, lrg@slimlogic.co.uk
Cc: broonie@opensource.wolfsonmicro.com, lrg@ti.com,
	gg@slimlogic.co.uk, Balaji T K <balajitk@ti.com>
Subject: [PATCH 2/2] regulator: twl6030: do not write to _GRP for regulator disable
Date: Fri, 20 May 2011 19:03:52 +0530	[thread overview]
Message-ID: <1305898432-14939-3-git-send-email-balajitk@ti.com> (raw)
In-Reply-To: <1305898432-14939-1-git-send-email-balajitk@ti.com>

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>
---
 drivers/regulator/twl-regulator.c |   47 +++++++++++++++++-------------------
 1 files changed, 22 insertions(+), 25 deletions(-)

diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c
index abb40c6..4702b8a 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)
 	return ret;
 }
 
-static int twlreg_disable(struct regulator_dev *rdev)
+static int twl4030reg_disable(struct regulator_dev *rdev)
 {
 	struct twlreg_info	*info = rdev_get_drvdata(rdev);
 	int			grp;
@@ -204,28 +204,25 @@ static int twlreg_disable(struct regulator_dev *rdev)
 	if (grp < 0)
 		return grp;
 
-	/* For 6030, set the off state for all grps enabled */
-	if (twl_class_is_6030()) {
-		ret = twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_STATE,
-			(grp & (P1_GRP_6030 | P2_GRP_6030 | P3_GRP_6030)) <<
-				TWL6030_CFG_STATE_GRP_SHIFT |
-			TWL6030_CFG_STATE_OFF);
-		if (ret)
-			return ret;
-	}
-
-	if (twl_class_is_4030())
-		grp &= ~(P1_GRP_4030 | P2_GRP_4030 | P3_GRP_4030);
-	else
-		grp &= ~(P1_GRP_6030 | P2_GRP_6030 | P3_GRP_6030);
+	grp &= ~(P1_GRP_4030 | P2_GRP_4030 | P3_GRP_4030);
 
 	ret = twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_GRP, grp);
 
-	/* Next, associate cleared grp in state register */
-	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_OFF);
+	return ret;
+}
+
+static int twl6030reg_disable(struct regulator_dev *rdev)
+{
+	struct twlreg_info	*info = rdev_get_drvdata(rdev);
+	int			grp = 0;
+	int			ret;
+
+	grp = P1_GRP_6030 | P2_GRP_6030 | P3_GRP_6030;
+
+	/* For 6030, set the off state for all grps enabled */
+	ret = twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_STATE,
+			(grp) << TWL6030_CFG_STATE_GRP_SHIFT |
+			TWL6030_CFG_STATE_OFF);
 
 	return ret;
 }
@@ -485,7 +482,7 @@ static struct regulator_ops twl4030ldo_ops = {
 	.get_voltage	= twl4030ldo_get_voltage,
 
 	.enable		= twl4030reg_enable,
-	.disable	= twlreg_disable,
+	.disable	= twl4030reg_disable,
 	.is_enabled	= twl4030reg_is_enabled,
 
 	.set_mode	= twl4030reg_set_mode,
@@ -543,7 +540,7 @@ static struct regulator_ops twl6030ldo_ops = {
 	.get_voltage	= twl6030ldo_get_voltage,
 
 	.enable		= twl6030reg_enable,
-	.disable	= twlreg_disable,
+	.disable	= twl6030reg_disable,
 	.is_enabled	= twl6030reg_is_enabled,
 
 	.set_mode	= twl6030reg_set_mode,
@@ -576,7 +573,7 @@ static struct regulator_ops twl4030fixed_ops = {
 	.get_voltage	= twlfixed_get_voltage,
 
 	.enable		= twl4030reg_enable,
-	.disable	= twlreg_disable,
+	.disable	= twl4030reg_disable,
 	.is_enabled	= twl4030reg_is_enabled,
 
 	.set_mode	= twl4030reg_set_mode,
@@ -590,7 +587,7 @@ static struct regulator_ops twl6030fixed_ops = {
 	.get_voltage	= twlfixed_get_voltage,
 
 	.enable		= twl6030reg_enable,
-	.disable	= twlreg_disable,
+	.disable	= twl6030reg_disable,
 	.is_enabled	= twl6030reg_is_enabled,
 
 	.set_mode	= twl6030reg_set_mode,
@@ -600,7 +597,7 @@ static struct regulator_ops twl6030fixed_ops = {
 
 static struct regulator_ops twl6030_fixed_resource = {
 	.enable		= twl6030reg_enable,
-	.disable	= twlreg_disable,
+	.disable	= twl6030reg_disable,
 	.is_enabled	= twl6030reg_is_enabled,
 	.get_status	= twl6030reg_get_status,
 };
-- 
1.7.0.4


  parent reply	other threads:[~2011-05-20 13:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-20 13:33 [PATCH 0/2] regulator: twl6030: do not write to _GRP for enable/disable Balaji T K
2011-05-20 13:33 ` [PATCH 1/2] regulator: twl6030: do not write to _GRP for regulator enable Balaji T K
2011-05-22  6:50   ` Mark Brown
2011-05-22  9:26     ` Liam Girdwood
2011-05-20 13:33 ` Balaji T K [this message]
2011-05-22  6:59   ` [PATCH 2/2] regulator: twl6030: do not write to _GRP for regulator disable Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1305898432-14939-3-git-send-email-balajitk@ti.com \
    --to=balajitk@ti.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=gg@slimlogic.co.uk \
    --cc=linux-omap@vger.kernel.org \
    --cc=lrg@slimlogic.co.uk \
    --cc=lrg@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).