From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753853AbbIBJjt (ORCPT ); Wed, 2 Sep 2015 05:39:49 -0400 Received: from metis.ext.pengutronix.de ([92.198.50.35]:34149 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752761AbbIBJjs (ORCPT ); Wed, 2 Sep 2015 05:39:48 -0400 Message-ID: <1441186785.3137.2.camel@pengutronix.de> Subject: Re: [PATCH 3/3] cpufreq: dt: Tolerance applies on both sides of target voltage From: Lucas Stach To: Viresh Kumar Cc: Rafael Wysocki , linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, open list Date: Wed, 02 Sep 2015 11:39:45 +0200 In-Reply-To: <4166ff63e1992adefd757cd3774e841e137024f9.1441184706.git.viresh.kumar@linaro.org> References: <4166ff63e1992adefd757cd3774e841e137024f9.1441184706.git.viresh.kumar@linaro.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.9-1+b1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2001:67c:670:100:fa0f:41ff:fe58:4010 X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > 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 > Fixes: 045ee45c4ff2 ("cpufreq: cpufreq-dt: disable unsupported OPPs") > Signed-off-by: Viresh Kumar > --- > 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; -- Pengutronix e.K. | Lucas Stach | Industrial Linux Solutions | http://www.pengutronix.de/ |