Skip to content

Commit

Permalink
regulator: add a new API regulator_set_voltage_tol()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Shawn Guo authored and Mark Brown committed Aug 8, 2012
1 parent 0d7614f commit 3f19657
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/linux/regulator/consumer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 3f19657

Please sign in to comment.