aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorDonggeun Kim <dg77.kim@samsung.com>2012-01-03 02:22:03 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-01-03 15:20:01 -0500
commite1de2f423462a5c6ba2c902dff1f5ddd8d3dbde3 (patch)
tree4924c6a832f36ea58b83e8b1ecbf8602ca5b86ab /drivers/regulator
parent1bb50b28a984857c2487d13187af5b3701aed38a (diff)
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>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/core.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index eb750a1ed7f..ca86f39a0fd 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2491,6 +2491,43 @@ err:
2491EXPORT_SYMBOL_GPL(regulator_bulk_disable); 2491EXPORT_SYMBOL_GPL(regulator_bulk_disable);
2492 2492
2493/** 2493/**
2494 * regulator_bulk_force_disable - force disable multiple regulator consumers
2495 *
2496 * @num_consumers: Number of consumers
2497 * @consumers: Consumer data; clients are stored here.
2498 * @return 0 on success, an errno on failure
2499 *
2500 * This convenience API allows consumers to forcibly disable multiple regulator
2501 * clients in a single API call.
2502 * NOTE: This should be used for situations when device damage will
2503 * likely occur if the regulators are not disabled (e.g. over temp).
2504 * Although regulator_force_disable function call for some consumers can
2505 * return error numbers, the function is called for all consumers.
2506 */
2507int regulator_bulk_force_disable(int num_consumers,
2508 struct regulator_bulk_data *consumers)
2509{
2510 int i;
2511 int ret;
2512
2513 for (i = 0; i < num_consumers; i++)
2514 consumers[i].ret =
2515 regulator_force_disable(consumers[i].consumer);
2516
2517 for (i = 0; i < num_consumers; i++) {
2518 if (consumers[i].ret != 0) {
2519 ret = consumers[i].ret;
2520 goto out;
2521 }
2522 }
2523
2524 return 0;
2525out:
2526 return ret;
2527}
2528EXPORT_SYMBOL_GPL(regulator_bulk_force_disable);
2529
2530/**
2494 * regulator_bulk_free - free multiple regulator consumers 2531 * regulator_bulk_free - free multiple regulator consumers
2495 * 2532 *
2496 * @num_consumers: Number of consumers 2533 * @num_consumers: Number of consumers