Message ID | 4166ff63e1992adefd757cd3774e841e137024f9.1441184706.git.viresh.kumar@linaro.org |
---|---|
State | New |
Headers | show |
Am Mittwoch, den 02.09.2015, 14:36 +0530 schrieb Viresh Kumar: > Tolerance applies on both sides of the target voltage, i.e. both min and > max sides. While I'm not really comfortable with the above, it is exactly how OPPv1 and the voltage tolerance property are specified. Reviewed-by: Lucas Stach <l.stach@pengutronix.de> > But while checking if a voltage is supported by the regulator > or not, we haven't taken care of tolerance on the lower side. Fix that. > > Cc: Lucas Stach <l.stach@pengutronix.de> > Fixes: 045ee45c4ff2 ("cpufreq: cpufreq-dt: disable unsupported OPPs") > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> > --- > drivers/cpufreq/cpufreq-dt.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c > index b1131cf89757..3b64c203bf99 100644 > --- a/drivers/cpufreq/cpufreq-dt.c > +++ b/drivers/cpufreq/cpufreq-dt.c > @@ -303,7 +303,8 @@ static int cpufreq_init(struct cpufreq_policy *policy) > rcu_read_unlock(); > > tol_uV = opp_uV * priv->voltage_tolerance / 100; > - if (regulator_is_supported_voltage(cpu_reg, opp_uV, > + if (regulator_is_supported_voltage(cpu_reg, > + opp_uV - tol_uV, > opp_uV + tol_uV)) { > if (opp_uV < min_uV) > min_uV = opp_uV;
On 02-09-15, 11:39, Lucas Stach wrote: > Am Mittwoch, den 02.09.2015, 14:36 +0530 schrieb Viresh Kumar: > > Tolerance applies on both sides of the target voltage, i.e. both min and > > max sides. > > While I'm not really comfortable with the above, it is exactly how OPPv1 > and the voltage tolerance property are specified. > > Reviewed-by: Lucas Stach <l.stach@pengutronix.de> Thanks. And this is exactly how the regulator API work: static inline int regulator_set_voltage_tol(struct regulator *regulator, int new_uV, int tol_uV) { if (regulator_set_voltage(regulator, new_uV, new_uV + tol_uV) == 0) return 0; else return regulator_set_voltage(regulator, new_uV - tol_uV, new_uV + tol_uV); } But yeah, OPP-v2 is going to take care of this with target/min/max values..
diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index b1131cf89757..3b64c203bf99 100644 --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c @@ -303,7 +303,8 @@ static int cpufreq_init(struct cpufreq_policy *policy) rcu_read_unlock(); tol_uV = opp_uV * priv->voltage_tolerance / 100; - if (regulator_is_supported_voltage(cpu_reg, opp_uV, + if (regulator_is_supported_voltage(cpu_reg, + opp_uV - tol_uV, opp_uV + tol_uV)) { if (opp_uV < min_uV) min_uV = opp_uV;
Tolerance applies on both sides of the target voltage, i.e. both min and max sides. But while checking if a voltage is supported by the regulator or not, we haven't taken care of tolerance on the lower side. Fix that. Cc: Lucas Stach <l.stach@pengutronix.de> Fixes: 045ee45c4ff2 ("cpufreq: cpufreq-dt: disable unsupported OPPs") Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> --- drivers/cpufreq/cpufreq-dt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)