From: Jassi Brar <jaswinder.singh@linaro.org>
To: linux-kernel@vger.kernel.org
Cc: lrg@ti.com, broonie@opensource.wolfsonmicro.com,
Jassi Brar <jaswinder.singh@linaro.org>
Subject: [PATCH] regulator: Provide a check for dummy regulator
Date: Thu, 19 Apr 2012 15:21:37 +0530 [thread overview]
Message-ID: <1334829097-32084-1-git-send-email-jaswinder.singh@linaro.org> (raw)
Usually changing the regulator output involves delays before/after the
operation.
There are consumer drivers shared by platforms, where some may
not really have a regulator in the path. Which causes the consumer
to unnecessarily (sometimes disruptively) incur delays for the
"dummy" regulator.
Since the 'struct regulator' is opaque outside of the core,
provide a function to check if the given regulator is a dummy one.
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
---
drivers/regulator/core.c | 9 +++++++++
include/linux/regulator/consumer.h | 6 ++++++
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index e70dd38..2fb6e5b 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3115,6 +3115,15 @@ void regulator_use_dummy_regulator(void)
EXPORT_SYMBOL_GPL(regulator_use_dummy_regulator);
/**
+ * regulator_is_dummy - Check if the regulator is the placeholder 'dummy'
+ */
+bool regulator_is_dummy(struct regulator *regulator)
+{
+ return !strcmp(regulator->rdev->desc->name, "dummy");
+}
+EXPORT_SYMBOL_GPL(regulator_is_dummy);
+
+/**
* rdev_get_drvdata - get rdev regulator driver data
* @rdev: regulator
*
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 4ed1b30..7b0360c 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -141,6 +141,7 @@ void regulator_put(struct regulator *regulator);
void devm_regulator_put(struct regulator *regulator);
/* regulator output control and status */
+bool regulator_is_dummy(struct regulator *regulator);
int regulator_enable(struct regulator *regulator);
int regulator_disable(struct regulator *regulator);
int regulator_force_disable(struct regulator *regulator);
@@ -221,6 +222,11 @@ static inline void devm_regulator_put(struct regulator *regulator)
{
}
+static bool regulator_is_dummy(struct regulator *regulator)
+{
+ return true;
+}
+
static inline int regulator_enable(struct regulator *regulator)
{
return 0;
--
1.7.4.1
next reply other threads:[~2012-04-19 9:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-19 9:51 Jassi Brar [this message]
2012-04-19 12:42 ` Mark Brown
2012-04-19 14:05 ` Jassi Brar
2012-04-19 16:29 ` Mark Brown
2012-04-20 7:32 ` Jassi Brar
2012-04-20 11:46 ` Mark Brown
2012-04-20 12:29 ` Jassi Brar
2012-04-20 13:01 ` Mark Brown
2012-04-20 13:48 ` Jassi Brar
2012-04-20 14:13 ` Jassi Brar
2012-04-20 14:42 ` Mark Brown
2012-04-20 18:25 ` Jassi Brar
2012-04-20 18:48 ` Mark Brown
2012-04-20 19:11 ` Jassi Brar
2012-04-20 22:04 ` 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=1334829097-32084-1-git-send-email-jaswinder.singh@linaro.org \
--to=jaswinder.singh@linaro.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=linux-kernel@vger.kernel.org \
--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
all inboxes | Powered by JetHome®