linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cpufreq: cpufreq-cpu0: use the exact frequency for clk_set_rate()
@ 2013-02-25 17:22 Guennadi Liakhovetski
  2013-03-27 22:46 ` Guennadi Liakhovetski
  2013-03-28  7:11 ` Viresh Kumar
  0 siblings, 2 replies; 8+ messages in thread
From: Guennadi Liakhovetski @ 2013-02-25 17:22 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: cpufreq, linux-kernel

clk_set_rate() isn't supposed to accept approximate frequencies, instead
a supported frequency should be obtained from clk_round_rate() and then
used to set the clock.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---

Applies on top of my previous patch to fix unsigned freq_Hz "cpufreq: fix 
sign check of an unsigned variable in cpufreq-cpu0"

 drivers/cpufreq/cpufreq-cpu0.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
index e7bad3c..6ce9b51 100644
--- a/drivers/cpufreq/cpufreq-cpu0.c
+++ b/drivers/cpufreq/cpufreq-cpu0.c
@@ -45,7 +45,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy,
 	struct cpufreq_freqs freqs;
 	struct opp *opp;
 	unsigned long volt = 0, volt_old = 0, tol = 0;
-	long freq_Hz;
+	long freq_Hz, freq_exact;
 	unsigned int index, cpu;
 	int ret;
 
@@ -60,6 +60,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy,
 	freq_Hz = clk_round_rate(cpu_clk, freq_table[index].frequency * 1000);
 	if (freq_Hz < 0)
 		freq_Hz = freq_table[index].frequency * 1000;
+	freq_exact = freq_Hz;
 	freqs.new = freq_Hz / 1000;
 	freqs.old = clk_get_rate(cpu_clk) / 1000;
 
@@ -96,7 +97,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy,
 		}
 	}
 
-	ret = clk_set_rate(cpu_clk, freqs.new * 1000);
+	ret = clk_set_rate(cpu_clk, freq_exact);
 	if (ret) {
 		pr_err("failed to set clock rate: %d\n", ret);
 		if (cpu_reg)
-- 
1.7.2.5


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] cpufreq: cpufreq-cpu0: use the exact frequency for clk_set_rate()
  2013-02-25 17:22 [PATCH] cpufreq: cpufreq-cpu0: use the exact frequency for clk_set_rate() Guennadi Liakhovetski
@ 2013-03-27 22:46 ` Guennadi Liakhovetski
  2013-03-28  2:07   ` Shawn Guo
  2013-03-28  7:11 ` Viresh Kumar
  1 sibling, 1 reply; 8+ messages in thread
From: Guennadi Liakhovetski @ 2013-03-27 22:46 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: cpufreq, linux-kernel, Shawn Guo

Hi Shawn

On Mon, 25 Feb 2013, Guennadi Liakhovetski wrote:

> clk_set_rate() isn't supposed to accept approximate frequencies, instead
> a supported frequency should be obtained from clk_round_rate() and then
> used to set the clock.
> 
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>

Can I have your ack for this one, please?

Thanks
Guennadi

> ---
> 
> Applies on top of my previous patch to fix unsigned freq_Hz "cpufreq: fix 
> sign check of an unsigned variable in cpufreq-cpu0"
> 
>  drivers/cpufreq/cpufreq-cpu0.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
> index e7bad3c..6ce9b51 100644
> --- a/drivers/cpufreq/cpufreq-cpu0.c
> +++ b/drivers/cpufreq/cpufreq-cpu0.c
> @@ -45,7 +45,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy,
>  	struct cpufreq_freqs freqs;
>  	struct opp *opp;
>  	unsigned long volt = 0, volt_old = 0, tol = 0;
> -	long freq_Hz;
> +	long freq_Hz, freq_exact;
>  	unsigned int index, cpu;
>  	int ret;
>  
> @@ -60,6 +60,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy,
>  	freq_Hz = clk_round_rate(cpu_clk, freq_table[index].frequency * 1000);
>  	if (freq_Hz < 0)
>  		freq_Hz = freq_table[index].frequency * 1000;
> +	freq_exact = freq_Hz;
>  	freqs.new = freq_Hz / 1000;
>  	freqs.old = clk_get_rate(cpu_clk) / 1000;
>  
> @@ -96,7 +97,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy,
>  		}
>  	}
>  
> -	ret = clk_set_rate(cpu_clk, freqs.new * 1000);
> +	ret = clk_set_rate(cpu_clk, freq_exact);
>  	if (ret) {
>  		pr_err("failed to set clock rate: %d\n", ret);
>  		if (cpu_reg)
> -- 
> 1.7.2.5
> 
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] cpufreq: cpufreq-cpu0: use the exact frequency for clk_set_rate()
  2013-03-27 22:46 ` Guennadi Liakhovetski
@ 2013-03-28  2:07   ` Shawn Guo
  2013-05-22 18:12     ` Guennadi Liakhovetski
  0 siblings, 1 reply; 8+ messages in thread
From: Shawn Guo @ 2013-03-28  2:07 UTC (permalink / raw)
  To: Guennadi Liakhovetski; +Cc: Rafael J. Wysocki, cpufreq, linux-kernel

On Wed, Mar 27, 2013 at 11:46:38PM +0100, Guennadi Liakhovetski wrote:
> Hi Shawn
> 
> On Mon, 25 Feb 2013, Guennadi Liakhovetski wrote:
> 
> > clk_set_rate() isn't supposed to accept approximate frequencies, instead
> > a supported frequency should be obtained from clk_round_rate() and then
> > used to set the clock.
> > 
> > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> 
> Can I have your ack for this one, please?

Acked-by: Shawn Guo <shawn.guo@linaro.org>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] cpufreq: cpufreq-cpu0: use the exact frequency for clk_set_rate()
  2013-02-25 17:22 [PATCH] cpufreq: cpufreq-cpu0: use the exact frequency for clk_set_rate() Guennadi Liakhovetski
  2013-03-27 22:46 ` Guennadi Liakhovetski
@ 2013-03-28  7:11 ` Viresh Kumar
  1 sibling, 0 replies; 8+ messages in thread
From: Viresh Kumar @ 2013-03-28  7:11 UTC (permalink / raw)
  To: Guennadi Liakhovetski; +Cc: Rafael J. Wysocki, cpufreq, linux-kernel

On Mon, Feb 25, 2013 at 10:52 PM, Guennadi Liakhovetski
<g.liakhovetski@gmx.de> wrote:
> clk_set_rate() isn't supposed to accept approximate frequencies, instead
> a supported frequency should be obtained from clk_round_rate() and then
> used to set the clock.
>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> ---
>
> Applies on top of my previous patch to fix unsigned freq_Hz "cpufreq: fix
> sign check of an unsigned variable in cpufreq-cpu0"
>
>  drivers/cpufreq/cpufreq-cpu0.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] cpufreq: cpufreq-cpu0: use the exact frequency for clk_set_rate()
  2013-03-28  2:07   ` Shawn Guo
@ 2013-05-22 18:12     ` Guennadi Liakhovetski
  2013-05-22 19:31       ` Rafael J. Wysocki
  0 siblings, 1 reply; 8+ messages in thread
From: Guennadi Liakhovetski @ 2013-05-22 18:12 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: cpufreq, linux-kernel, Viresh Kumar, Shawn Guo

Hi Rafael

I don't see this patch in your cpufreq branch nor in next or Linus' trees, 
has it been pulled yet?

Thanks
Guennadi

On Thu, 28 Mar 2013, Shawn Guo wrote:

> On Wed, Mar 27, 2013 at 11:46:38PM +0100, Guennadi Liakhovetski wrote:
> > Hi Shawn
> > 
> > On Mon, 25 Feb 2013, Guennadi Liakhovetski wrote:
> > 
> > > clk_set_rate() isn't supposed to accept approximate frequencies, instead
> > > a supported frequency should be obtained from clk_round_rate() and then
> > > used to set the clock.
> > > 
> > > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> > 
> > Can I have your ack for this one, please?
> 
> Acked-by: Shawn Guo <shawn.guo@linaro.org>
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] cpufreq: cpufreq-cpu0: use the exact frequency for clk_set_rate()
  2013-05-22 18:12     ` Guennadi Liakhovetski
@ 2013-05-22 19:31       ` Rafael J. Wysocki
  2013-06-05 11:25         ` Guennadi Liakhovetski
  0 siblings, 1 reply; 8+ messages in thread
From: Rafael J. Wysocki @ 2013-05-22 19:31 UTC (permalink / raw)
  To: Guennadi Liakhovetski; +Cc: cpufreq, linux-kernel, Viresh Kumar, Shawn Guo

On Wednesday, May 22, 2013 08:12:22 PM Guennadi Liakhovetski wrote:
> Hi Rafael
> 
> I don't see this patch in your cpufreq branch nor in next or Linus' trees, 
> has it been pulled yet?

No, I haven't applied it yet, not sure why exactly.

In the future it's better to CC cpufreq patches to linux-pm@vger.kernel.org so
that the kernel.org Patchwork can pick them up.  I'm much less likely to
overlook them then.

This is a fix, so do we need it in 3.10-rc?

Rafael


> On Thu, 28 Mar 2013, Shawn Guo wrote:
> 
> > On Wed, Mar 27, 2013 at 11:46:38PM +0100, Guennadi Liakhovetski wrote:
> > > Hi Shawn
> > > 
> > > On Mon, 25 Feb 2013, Guennadi Liakhovetski wrote:
> > > 
> > > > clk_set_rate() isn't supposed to accept approximate frequencies, instead
> > > > a supported frequency should be obtained from clk_round_rate() and then
> > > > used to set the clock.
> > > > 
> > > > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> > > 
> > > Can I have your ack for this one, please?
> > 
> > Acked-by: Shawn Guo <shawn.guo@linaro.org>
> > 
> 
> ---
> Guennadi Liakhovetski, Ph.D.
> Freelance Open-Source Software Developer
> http://www.open-technology.de/
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] cpufreq: cpufreq-cpu0: use the exact frequency for clk_set_rate()
  2013-05-22 19:31       ` Rafael J. Wysocki
@ 2013-06-05 11:25         ` Guennadi Liakhovetski
  2013-06-05 12:15           ` Rafael J. Wysocki
  0 siblings, 1 reply; 8+ messages in thread
From: Guennadi Liakhovetski @ 2013-06-05 11:25 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: cpufreq, linux-kernel, Viresh Kumar, Shawn Guo

Hi Rafael

On Wed, 22 May 2013, Rafael J. Wysocki wrote:

> On Wednesday, May 22, 2013 08:12:22 PM Guennadi Liakhovetski wrote:
> > Hi Rafael
> > 
> > I don't see this patch in your cpufreq branch nor in next or Linus' trees, 
> > has it been pulled yet?
> 
> No, I haven't applied it yet, not sure why exactly.
> 
> In the future it's better to CC cpufreq patches to linux-pm@vger.kernel.org so
> that the kernel.org Patchwork can pick them up.  I'm much less likely to
> overlook them then.
> 
> This is a fix, so do we need it in 3.10-rc?

Would be good, yes.

Thanks
Guennadi

> 
> Rafael
> 
> 
> > On Thu, 28 Mar 2013, Shawn Guo wrote:
> > 
> > > On Wed, Mar 27, 2013 at 11:46:38PM +0100, Guennadi Liakhovetski wrote:
> > > > Hi Shawn
> > > > 
> > > > On Mon, 25 Feb 2013, Guennadi Liakhovetski wrote:
> > > > 
> > > > > clk_set_rate() isn't supposed to accept approximate frequencies, instead
> > > > > a supported frequency should be obtained from clk_round_rate() and then
> > > > > used to set the clock.
> > > > > 
> > > > > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> > > > 
> > > > Can I have your ack for this one, please?
> > > 
> > > Acked-by: Shawn Guo <shawn.guo@linaro.org>

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] cpufreq: cpufreq-cpu0: use the exact frequency for clk_set_rate()
  2013-06-05 11:25         ` Guennadi Liakhovetski
@ 2013-06-05 12:15           ` Rafael J. Wysocki
  0 siblings, 0 replies; 8+ messages in thread
From: Rafael J. Wysocki @ 2013-06-05 12:15 UTC (permalink / raw)
  To: Guennadi Liakhovetski; +Cc: cpufreq, linux-kernel, Viresh Kumar, Shawn Guo

On Wednesday, June 05, 2013 01:25:37 PM Guennadi Liakhovetski wrote:
> Hi Rafael
> 
> On Wed, 22 May 2013, Rafael J. Wysocki wrote:
> 
> > On Wednesday, May 22, 2013 08:12:22 PM Guennadi Liakhovetski wrote:
> > > Hi Rafael
> > > 
> > > I don't see this patch in your cpufreq branch nor in next or Linus' trees, 
> > > has it been pulled yet?
> > 
> > No, I haven't applied it yet, not sure why exactly.
> > 
> > In the future it's better to CC cpufreq patches to linux-pm@vger.kernel.org so
> > that the kernel.org Patchwork can pick them up.  I'm much less likely to
> > overlook them then.
> > 
> > This is a fix, so do we need it in 3.10-rc?
> 
> Would be good, yes.

OK, queued up for 3.10.

Thanks,
Rafael


> > > On Thu, 28 Mar 2013, Shawn Guo wrote:
> > > 
> > > > On Wed, Mar 27, 2013 at 11:46:38PM +0100, Guennadi Liakhovetski wrote:
> > > > > Hi Shawn
> > > > > 
> > > > > On Mon, 25 Feb 2013, Guennadi Liakhovetski wrote:
> > > > > 
> > > > > > clk_set_rate() isn't supposed to accept approximate frequencies, instead
> > > > > > a supported frequency should be obtained from clk_round_rate() and then
> > > > > > used to set the clock.
> > > > > > 
> > > > > > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> > > > > 
> > > > > Can I have your ack for this one, please?
> > > > 
> > > > Acked-by: Shawn Guo <shawn.guo@linaro.org>
> 
> ---
> Guennadi Liakhovetski, Ph.D.
> Freelance Open-Source Software Developer
> http://www.open-technology.de/
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-06-05 12:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-25 17:22 [PATCH] cpufreq: cpufreq-cpu0: use the exact frequency for clk_set_rate() Guennadi Liakhovetski
2013-03-27 22:46 ` Guennadi Liakhovetski
2013-03-28  2:07   ` Shawn Guo
2013-05-22 18:12     ` Guennadi Liakhovetski
2013-05-22 19:31       ` Rafael J. Wysocki
2013-06-05 11:25         ` Guennadi Liakhovetski
2013-06-05 12:15           ` Rafael J. Wysocki
2013-03-28  7:11 ` Viresh Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).