From: David Brownell <david-b@pacbell.net>
To: OMAP <linux-omap@vger.kernel.org>
Subject: [patch 2.6.29-rc2-omap1-git 2/7] twl4030 regulator uses new get_status() op
Date: Tue, 20 Jan 2009 02:48:26 -0800 [thread overview]
Message-ID: <200901200248.26729.david-b@pacbell.net> (raw)
In-Reply-To: <200901200244.36238.david-b@pacbell.net>
From: David Brownell <dbrownell@users.sourceforge.net>
Update twl4030 regulator driver to support the new get_status()
method and otherwise implement the newly "clarified" semantics.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
---
Given this, I think this driver is ready to merge to mainline.
drivers/regulator/twl4030-regulator.c | 39 +++++++++++++++-----------------
1 file changed, 19 insertions(+), 20 deletions(-)
--- a/drivers/regulator/twl4030-regulator.c
+++ b/drivers/regulator/twl4030-regulator.c
@@ -90,17 +90,6 @@ static int twl4030reg_grp(struct regulat
return twl4030reg_read(rdev_get_drvdata(rdev), VREG_GRP);
}
-static int twl4030reg_is_enabled(struct regulator_dev *rdev)
-{
- int state = twl4030reg_grp(rdev);
-
- if (state < 0)
- return state;
-
- /* resource state == OFF (vs SLEEP or ACTIVE) */
- return (state & 0x0f) != 0;
-}
-
/*
* Enable/disable regulators by joining/leaving the P1 (processor) group.
* We assume nobody else is updating the DEV_GRP registers.
@@ -110,6 +99,16 @@ static int twl4030reg_is_enabled(struct
#define P2_GRP BIT(6) /* secondary processor, modem, etc */
#define P1_GRP BIT(5) /* CPU/Linux */
+static int twl4030reg_is_enabled(struct regulator_dev *rdev)
+{
+ int state = twl4030reg_grp(rdev);
+
+ if (state < 0)
+ return state;
+
+ return (state & P1_GRP) != 0;
+}
+
static int twl4030reg_enable(struct regulator_dev *rdev)
{
struct twlreg_info *info = rdev_get_drvdata(rdev);
@@ -136,7 +135,7 @@ static int twl4030reg_disable(struct reg
return twl4030reg_write(info, VREG_GRP, grp);
}
-static unsigned twl4030reg_get_mode(struct regulator_dev *rdev)
+static int twl4030reg_get_status(struct regulator_dev *rdev)
{
int state = twl4030reg_grp(rdev);
@@ -146,10 +145,10 @@ static unsigned twl4030reg_get_mode(stru
/* assume state != WARM_RESET; we'd not be running... */
if (!state)
- return REGULATOR_MODE_OFF;
+ return REGULATOR_STATUS_OFF;
return (state & BIT(3))
- ? REGULATOR_MODE_NORMAL
- : REGULATOR_MODE_STANDBY;
+ ? REGULATOR_STATUS_NORMAL
+ : REGULATOR_STATUS_STANDBY;
}
static int twl4030reg_set_mode(struct regulator_dev *rdev, unsigned mode)
@@ -306,7 +305,8 @@ static struct regulator_ops twl4030ldo_o
.is_enabled = twl4030reg_is_enabled,
.set_mode = twl4030reg_set_mode,
- .get_mode = twl4030reg_get_mode,
+
+ .get_status = twl4030reg_get_status,
};
/*----------------------------------------------------------------------*/
@@ -329,7 +329,8 @@ static struct regulator_ops twl4030fixed
.is_enabled = twl4030reg_is_enabled,
.set_mode = twl4030reg_set_mode,
- .get_mode = twl4030reg_get_mode,
+
+ .get_status = twl4030reg_get_status,
};
/*----------------------------------------------------------------------*/
@@ -426,9 +427,7 @@ static int twl4030reg_probe(struct platf
c->min_uV = min_uV;
if (!c->max_uV || c->max_uV > max_uV)
c->max_uV = max_uV;
- c->valid_modes_mask &= REGULATOR_MODE_NORMAL
- | REGULATOR_MODE_STANDBY
- | REGULATOR_MODE_OFF;
+ c->valid_modes_mask &= REGULATOR_MODE_NORMAL | REGULATOR_MODE_STANDBY;
c->valid_ops_mask &= REGULATOR_CHANGE_VOLTAGE
| REGULATOR_CHANGE_MODE
| REGULATOR_CHANGE_STATUS;
next prev parent reply other threads:[~2009-01-20 11:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-20 10:44 [patch 2.6.29-rc2-omap1-git 0/7] regulator and MMC updates David Brownell
2009-01-20 10:45 ` [patch 2.6.29-rc2-omap1-git 1/7] regulator get_status() David Brownell
2009-01-20 10:48 ` David Brownell [this message]
2009-01-20 10:49 ` [patch 2.6.29-rc2-omap1-git 3/7] 3430SDP init updates David Brownell
2009-01-20 10:51 ` [patch 2.6.29-rc2-omap1-git 4/7] minor overo init update David Brownell
2009-01-20 10:52 ` [patch 2.6.29-rc2-omap1-git 5/7] hsmmc init passes device nodes back David Brownell
2009-01-20 10:53 ` [patch 2.6.29-rc2-omap1-git 6/7] beagle regulator updates David Brownell
2009-01-20 10:54 ` [patch 2.6.29-rc2-omap1-git 7/7] 3430SDP " David Brownell
2009-02-04 19:27 ` [patch 2.6.29-rc2-omap1-git 0/7] regulator and MMC updates Tony Lindgren
2009-02-04 23:20 ` David Brownell
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=200901200248.26729.david-b@pacbell.net \
--to=david-b@pacbell.net \
--cc=linux-omap@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.