[PATCH v2 3/4] regulator: add a new API regulator_set_voltage_tol()
Shawn Guo
shawn.guo at linaro.org
Sun Aug 5 11:05:20 EDT 2012
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 at linaro.org>
---
include/linux/regulator/consumer.h | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index da339fd..2160352 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
--
1.7.5.4
More information about the linux-arm-kernel
mailing list