From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Liam Girdwood <lrg@slimlogic.co.uk>
Cc: linux-kernel@vger.kernel.org,
Mark Brown <broonie@opensource.wolfsonmicro.com>
Subject: [PATCH 6/6] regulator: Provide mode to status conversion function
Date: Tue, 21 Jul 2009 16:00:28 +0100 [thread overview]
Message-ID: <1248188428-11277-6-git-send-email-broonie@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1248188428-11277-5-git-send-email-broonie@opensource.wolfsonmicro.com>
This is useful for implementing get_status() in terms of get_mode().
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
drivers/regulator/core.c | 24 ++++++++++++++++++++++++
include/linux/regulator/driver.h | 2 ++
2 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index cba10ec..13d0f92 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1993,6 +1993,30 @@ int regulator_notifier_call_chain(struct regulator_dev *rdev,
}
EXPORT_SYMBOL_GPL(regulator_notifier_call_chain);
+/**
+ * regulator_mode_to_status - convert a regulator mode into a status
+ *
+ * @mode: Mode to convert
+ *
+ * Convert a regulator mode into a status.
+ */
+int regulator_mode_to_status(unsigned int mode)
+{
+ switch (mode) {
+ case REGULATOR_MODE_FAST:
+ return REGULATOR_STATUS_FAST;
+ case REGULATOR_MODE_NORMAL:
+ return REGULATOR_STATUS_NORMAL;
+ case REGULATOR_MODE_IDLE:
+ return REGULATOR_STATUS_IDLE;
+ case REGULATOR_STATUS_STANDBY:
+ return REGULATOR_STATUS_STANDBY;
+ default:
+ return 0;
+ }
+}
+EXPORT_SYMBOL_GPL(regulator_mode_to_status);
+
/*
* To avoid cluttering sysfs (and memory) with useless state, only
* create attributes that can be meaningfully displayed.
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 60efbd1..73c9cd6 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -195,6 +195,8 @@ void *rdev_get_drvdata(struct regulator_dev *rdev);
struct device *rdev_get_dev(struct regulator_dev *rdev);
int rdev_get_id(struct regulator_dev *rdev);
+int regulator_mode_to_status(unsigned int);
+
void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data);
#endif
--
1.6.3.3
next prev parent reply other threads:[~2009-07-21 15:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-21 15:00 [PATCH 1/6] regulator: Add regulator_get_exclusive() API Mark Brown
2009-07-21 15:00 ` [PATCH 2/6] regulator: Add regulator voltage range check API Mark Brown
2009-07-21 15:00 ` [PATCH 3/6] regulator: Warn when unregistering an in-use regulator Mark Brown
2009-07-21 15:00 ` [PATCH 4/6] regulator: Fix support for deviceless supply mappings Mark Brown
2009-07-21 15:00 ` [PATCH 5/6] regulator: Improve virtual consumer probe error handling Mark Brown
2009-07-21 15:00 ` Mark Brown [this message]
2009-07-22 20:41 ` [PATCH 6/6] regulator: Provide mode to status conversion function Liam Girdwood
2009-07-23 8:42 ` Mark Brown
2009-07-22 20:14 ` [PATCH 3/6] regulator: Warn when unregistering an in-use regulator Liam Girdwood
2009-07-23 8:39 ` Mark Brown
2009-07-21 20:49 ` [PATCH 1/6] regulator: Add regulator_get_exclusive() API Daniel Ribeiro
2009-07-22 1:58 ` Eric Miao
2009-07-22 9:58 ` Mark Brown
2009-07-22 20:47 ` Liam Girdwood
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=1248188428-11277-6-git-send-email-broonie@opensource.wolfsonmicro.com \
--to=broonie@opensource.wolfsonmicro.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@slimlogic.co.uk \
/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
Powered by JetHome