summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDonggeun Kim <dg77.kim@samsung.com>2012-01-03 16:22:03 +0900
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-01-03 20:20:01 +0000
commite1de2f423462a5c6ba2c902dff1f5ddd8d3dbde3 (patch)
tree4924c6a832f36ea58b83e8b1ecbf8602ca5b86ab
parent1bb50b28a984857c2487d13187af5b3701aed38a (diff)
downloadop-kernel-dev-e1de2f423462a5c6ba2c902dff1f5ddd8d3dbde3.zip
op-kernel-dev-e1de2f423462a5c6ba2c902dff1f5ddd8d3dbde3.tar.gz
regulator: add regulator_bulk_force_disable function
This patch allows consumers to forcibly disable multiple regulator clients in a single API call. Signed-off-by: Donggeun Kim <dg77.kim@samsung.com> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r--drivers/regulator/core.c37
-rw-r--r--include/linux/regulator/consumer.h8
2 files changed, 45 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index eb750a1..ca86f39 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2491,6 +2491,43 @@ err:
EXPORT_SYMBOL_GPL(regulator_bulk_disable);
/**
+ * regulator_bulk_force_disable - force disable multiple regulator consumers
+ *
+ * @num_consumers: Number of consumers
+ * @consumers: Consumer data; clients are stored here.
+ * @return 0 on success, an errno on failure
+ *
+ * This convenience API allows consumers to forcibly disable multiple regulator
+ * clients in a single API call.
+ * NOTE: This should be used for situations when device damage will
+ * likely occur if the regulators are not disabled (e.g. over temp).
+ * Although regulator_force_disable function call for some consumers can
+ * return error numbers, the function is called for all consumers.
+ */
+int regulator_bulk_force_disable(int num_consumers,
+ struct regulator_bulk_data *consumers)
+{
+ int i;
+ int ret;
+
+ for (i = 0; i < num_consumers; i++)
+ consumers[i].ret =
+ regulator_force_disable(consumers[i].consumer);
+
+ for (i = 0; i < num_consumers; i++) {
+ if (consumers[i].ret != 0) {
+ ret = consumers[i].ret;
+ goto out;
+ }
+ }
+
+ return 0;
+out:
+ return ret;
+}
+EXPORT_SYMBOL_GPL(regulator_bulk_force_disable);
+
+/**
* regulator_bulk_free - free multiple regulator consumers
*
* @num_consumers: Number of consumers
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 889ab5a..f2698a0 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -149,6 +149,8 @@ int regulator_bulk_enable(int num_consumers,
struct regulator_bulk_data *consumers);
int regulator_bulk_disable(int num_consumers,
struct regulator_bulk_data *consumers);
+int regulator_bulk_force_disable(int num_consumers,
+ struct regulator_bulk_data *consumers);
void regulator_bulk_free(int num_consumers,
struct regulator_bulk_data *consumers);
@@ -247,6 +249,12 @@ static inline int regulator_bulk_disable(int num_consumers,
return 0;
}
+static inline int regulator_bulk_force_disable(int num_consumers,
+ struct regulator_bulk_data *consumers)
+{
+ return 0;
+}
+
static inline void regulator_bulk_free(int num_consumers,
struct regulator_bulk_data *consumers)
{
OpenPOWER on IntegriCloud