summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorShawn Guo <shawn.guo@linaro.org>2012-08-05 17:05:20 +0200
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-08-08 15:34:41 +0200
commit3f1965776f6ec769192400810b6260fe48301bbb (patch)
treeaf582e003095638d26ce7d0fee558d3f3a9b285b /include
parentLinux 3.6-rc1 (diff)
downloadlinux-3f1965776f6ec769192400810b6260fe48301bbb.tar.xz
linux-3f1965776f6ec769192400810b6260fe48301bbb.zip
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')
-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