summaryrefslogtreecommitdiff
path: root/include/linux/regulator
diff options
context:
space:
mode:
authorShawn Guo <shawn.guo@linaro.org>2012-08-05 23:05:20 +0800
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-08-08 14:34:41 +0100
commit3f1965776f6ec769192400810b6260fe48301bbb (patch)
treeaf582e003095638d26ce7d0fee558d3f3a9b285b /include/linux/regulator
parent0d7614f09c1ebdbaa1599a5aba7593f147bf96ee (diff)
regulator: add a new API regulator_set_voltage_tol()
There are some use cases where a voltage range could be reasonably specified by a target voltage and tolerance. Add a new API regulator_set_voltage_tol() wrapping regulator_set_voltage() call to ease the users. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'include/linux/regulator')
-rw-r--r--include/linux/regulator/consumer.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index da339fd8c755..21603524bdb2 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -352,4 +352,11 @@ static inline void regulator_set_drvdata(struct regulator *regulator,
#endif
+static inline int regulator_set_voltage_tol(struct regulator *regulator,
+ int new_uV, int tol_uV)
+{
+ return regulator_set_voltage(regulator,
+ new_uV - tol_uV, new_uV + tol_uV);
+}
+
#endif