lkml.org 
[lkml]   [2012]   [Apr]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] regulator: Provide a check for dummy regulator
Date
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


\
 
 \ /
  Last update: 2012-04-19 11:55    [W:0.081 / U:0.260 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site