[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1334829097-32084-1-git-send-email-jaswinder.singh@linaro.org>
Date: Thu, 19 Apr 2012 15:21:37 +0530
From: Jassi Brar <jaswinder.singh@...aro.org>
To: linux-kernel@...r.kernel.org
Cc: lrg@...com, broonie@...nsource.wolfsonmicro.com,
Jassi Brar <jaswinder.singh@...aro.org>
Subject: [PATCH] regulator: Provide a check for dummy regulator
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@...aro.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists