Message ID | 20150815031149.GD1162@linux |
---|---|
State | New |
Headers | show |
On 15-08-15, 07:08, Mark Brown wrote: > On Sat, Aug 15, 2015 at 08:41:49AM +0530, Viresh Kumar wrote: > > > Hopefully below version looks better ? > > Please don't bury patches at the end of replies to messages in the > middle of threads, send them in a form where they can be applied > directly. Okay. I thought its fine to send patches like this and this can be applied directly with the --scissors option to git am or with mailinfo.scissors option set in configuration file. But will surely send patches separately to you. > > Subject: [PATCH] regulator: core: Define regulator_set_voltage_triplet() > > > > The OPP (Operating performance points) v2 bindings allows regulator > > voltage to be supplied as a triplet of <target min max> voltages. > > > > Add regulator_set_voltage_triplet() API in regulator core to support > > that. > > This should explain why this is useful at a regulator API level, not > explain that some user decided to do something. Okay. > > +static inline int regulator_set_voltage_triplet(struct regulator *regulator, > > + int min_uV, int target_uV, > > + int max_uV) > > +{ > > + if (!regulator_set_voltage(regulator, target_uV, max_uV)) > > Make this a check for == 0 which is what you mean here, this isn't a > boolean function. Okay.
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index f8a689ed62a5..a6269c184b8c 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h @@ -552,6 +552,16 @@ static inline int regulator_count_voltages(struct regulator *regulator) } #endif +static inline int regulator_set_voltage_triplet(struct regulator *regulator, + int min_uV, int target_uV, + int max_uV) +{ + if (!regulator_set_voltage(regulator, target_uV, max_uV)) + return 0; + + return regulator_set_voltage(regulator, min_uV, max_uV); +} + static inline int regulator_set_voltage_tol(struct regulator *regulator, int new_uV, int tol_uV) {