All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@ti.com>
To: Afzal Mohammed <afzal@ti.com>
Cc: linux-omap@vger.kernel.org, Sekhar Nori <nsekhar@ti.com>
Subject: Re: [PATCH] cpufreq: OMAP: specify range for voltage scaling
Date: Thu, 01 Mar 2012 12:12:23 -0800	[thread overview]
Message-ID: <87fwdshyhk.fsf@ti.com> (raw)
In-Reply-To: <1330004964-22831-1-git-send-email-afzal@ti.com> (Afzal Mohammed's message of "Thu, 23 Feb 2012 19:19:24 +0530")

Afzal Mohammed <afzal@ti.com> writes:

> Specify voltage in ranges for regulator. Range
> used is tolerance specified for OPP.
>
> This helps to achieve DVFS with a wider range of
> regulators.
>
> Cc: Kevin Hilman <khilman@ti.com>
> Cc: Sekhar Nori <nsekhar@ti.com>
> Signed-off-by: Afzal Mohammed <afzal@ti.com>

Thanks, will queue this with the CPUfreq changes for MPU DVFS.

Kevin

> ---
> Hi,
>
> Tolerance specified here is that of AM335X, least value
> of tolerance that I could find so far for OMAP family
>
> This applies on top of Kevin Hilman's patch (v2),
> "cpufreq: OMAP: scale voltage along with frequency"
> http://www.spinics.net/lists/linux-omap/msg65002.html
>
> Regards
> Afzal
>
>  drivers/cpufreq/omap-cpufreq.c |   10 +++++++---
>  1 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/cpufreq/omap-cpufreq.c b/drivers/cpufreq/omap-cpufreq.c
> index 10b8e23..3cea51b 100644
> --- a/drivers/cpufreq/omap-cpufreq.c
> +++ b/drivers/cpufreq/omap-cpufreq.c
> @@ -38,6 +38,9 @@
>  
>  #include <mach/hardware.h>
>  
> +/* OPP tolerance in percentage */
> +#define	OPP_TOLERANCE	4
> +
>  #ifdef CONFIG_SMP
>  struct lpj_info {
>  	unsigned long	ref;
> @@ -81,7 +84,7 @@ static int omap_target(struct cpufreq_policy *policy,
>  	int r, ret = 0;
>  	struct cpufreq_freqs freqs;
>  	struct opp *opp;
> -	unsigned long freq, volt = 0, volt_old = 0;
> +	unsigned long freq, volt = 0, volt_old = 0, tol = 0;
>  
>  	if (!freq_table) {
>  		dev_err(mpu_dev, "%s: cpu%d: no freq table!\n", __func__,
> @@ -125,6 +128,7 @@ static int omap_target(struct cpufreq_policy *policy,
>  			return -EINVAL;
>  		}
>  		volt = opp_get_voltage(opp);
> +		tol = volt * OPP_TOLERANCE / 100;
>  		volt_old = regulator_get_voltage(mpu_reg);
>  	}
>  
> @@ -134,7 +138,7 @@ static int omap_target(struct cpufreq_policy *policy,
>  
>  	/* scaling up?  scale voltage before frequency */
>  	if (mpu_reg && (freqs.new > freqs.old)) {
> -		r = regulator_set_voltage(mpu_reg, volt, volt);
> +		r = regulator_set_voltage(mpu_reg, volt - tol, volt + tol);
>  		if (r < 0) {
>  			dev_warn(mpu_dev, "%s: unable to scale voltage up.\n",
>  				 __func__);
> @@ -147,7 +151,7 @@ static int omap_target(struct cpufreq_policy *policy,
>  
>  	/* scaling down?  scale voltage after frequency */
>  	if (mpu_reg && (freqs.new < freqs.old)) {
> -		r = regulator_set_voltage(mpu_reg, volt, volt);
> +		r = regulator_set_voltage(mpu_reg, volt - tol, volt + tol);
>  		if (r < 0) {
>  			dev_warn(mpu_dev, "%s: unable to scale voltage down.\n",
>  				 __func__);

  reply	other threads:[~2012-03-01 20:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-23 13:49 [PATCH] cpufreq: OMAP: specify range for voltage scaling Afzal Mohammed
2012-03-01 20:12 ` Kevin Hilman [this message]
2012-03-01 22:07   ` Kevin Hilman
2012-03-02 10:19     ` Tero Kristo
2012-03-02 22:39       ` Kevin Hilman
2012-03-02 10:56     ` Mohammed, Afzal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fwdshyhk.fsf@ti.com \
    --to=khilman@ti.com \
    --cc=afzal@ti.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=nsekhar@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.