From 3f1965776f6ec769192400810b6260fe48301bbb Mon Sep 17 00:00:00 2001 From: Shawn Guo Date: Sun, 5 Aug 2012 23:05:20 +0800 Subject: 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 Signed-off-by: Mark Brown --- include/linux/regulator/consumer.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include/linux/regulator') diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index da339fd8c75..21603524bdb 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 -- cgit v1.2.3