cpufreq: dt: Tolerance applies on both sides of target voltage
authorViresh Kumar <viresh.kumar@linaro.org>
Wed, 2 Sep 2015 09:06:50 +0000 (14:36 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 3 Sep 2015 00:46:09 +0000 (02:46 +0200)
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>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/cpufreq-dt.c

index b1131cf89757e62d51015d7bbc2356c23ae98c1a..3b64c203bf99a77e14a6bbf3b9e8e3d9519cccb8 100644 (file)
@@ -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;