Message ID | 20120731042050.GF762@S2101-09.ap.freescale.net (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Tue, Jul 31, 2012 at 12:20:52PM +0800, Shawn Guo wrote: > On Mon, Jul 30, 2012 at 07:53:45PM +0100, Mark Brown wrote: > > Quite honestly this seems totally unrealistic for the majority of users, > I doubt that. Searching drivers/cpufreq folder, I can see there are > several cpufreq drivers scaling voltage with regulator API, but none > of them is calling regulator_set_voltage_time to find voltage latency. > That said, all these users are specify transition latency on their own. This is more a sign of poor quality of implementation than anything else, and obviously the fact that DT is supposed to be an ABI makes it much more important to get things right. There's also a bunch of problems in ondemand, it really doesn't cope terribly well if you actually tell it what the latencies are for most systems as it becomes absurdly conservative about not ramping. > > especially given the very poor documentation for this stuff which SoC > > vendors typically provide. It's a reasonable amount of work to go back > > and figure this stuff out (especially given that it should be varying > > depending on the transition in question), and it's going to give us a > > bunch of magic numbers in people's bindings. > There will be only one magic number, and it can easily become "magic" > with some comments put there. This doesn't sound like a recipie for success.. > > No, add a new API. > Is the following patch what you are ordering here? Yes. I'd go with _tol rather than _tolerance probably but something like that, yes.
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index da339fd..bfd3cfb 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_tolerance(struct regulator *regulator, + int new_uV, int tol_uV) +{ + return regulator_set_voltage(regulator, + new_uV - tol_uV, new_uV + tol_uV); +} + #endif