All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH Resend] cpufreq: cpu0: OPPs can be populated at runtime
@ 2014-07-11 14:54 Viresh Kumar
  2014-07-18  1:08 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Viresh Kumar @ 2014-07-11 14:54 UTC (permalink / raw)
  To: rjw; +Cc: linaro-kernel, linux-pm, arvind.chauhan, ttynkkynen, Viresh Kumar

OPPs can be populated statically, via DT, or added at run time with
dev_pm_opp_add().

While this driver handles the first case correctly, it would fail to populate
OPPs added at runtime. Because call to of_init_opp_table() would fail as there
are no OPPs in DT and probe will return early.

To fix this, remove error checking and call dev_pm_opp_init_cpufreq_table()
unconditionally.

Update bindings as well.

Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Suggested-by: Stephen Boyd <sboyd@codeaurora.org>
Tested-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
Hi Rafael,

This was earlier sent as part of: https://lkml.org/lkml/2014/7/1/358 series. But
actually is an fix and can (should?) be pushed for 3.16.

Rest of the patches from that series are cleanups/updates and so can go in
3.17.

Please see if you can take it for 3.16.

 Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt | 6 ++++--
 drivers/cpufreq/cpufreq-cpu0.c                             | 7 ++-----
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt b/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt
index f055515..366690c 100644
--- a/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt
+++ b/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt
@@ -8,10 +8,12 @@ Both required and optional properties listed below must be defined
 under node /cpus/cpu@0.
 
 Required properties:
-- operating-points: Refer to Documentation/devicetree/bindings/power/opp.txt
-  for details
+- None
 
 Optional properties:
+- operating-points: Refer to Documentation/devicetree/bindings/power/opp.txt for
+  details. OPPs *must* be supplied either via DT, i.e. this property, or
+  populated at runtime.
 - clock-latency: Specify the possible maximum transition latency for clock,
   in unit of nanoseconds.
 - voltage-tolerance: Specify the CPU voltage tolerance in percentage.
diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
index ee1ae30..86beda9 100644
--- a/drivers/cpufreq/cpufreq-cpu0.c
+++ b/drivers/cpufreq/cpufreq-cpu0.c
@@ -152,11 +152,8 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
 		goto out_put_reg;
 	}
 
-	ret = of_init_opp_table(cpu_dev);
-	if (ret) {
-		pr_err("failed to init OPP table: %d\n", ret);
-		goto out_put_clk;
-	}
+	/* OPPs might be populated at runtime, don't check for error here */
+	of_init_opp_table(cpu_dev);
 
 	ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table);
 	if (ret) {
-- 
2.0.0.rc2


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

* Re: [PATCH Resend] cpufreq: cpu0: OPPs can be populated at runtime
  2014-07-11 14:54 [PATCH Resend] cpufreq: cpu0: OPPs can be populated at runtime Viresh Kumar
@ 2014-07-18  1:08 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2014-07-18  1:08 UTC (permalink / raw)
  To: Viresh Kumar; +Cc: linaro-kernel, linux-pm, arvind.chauhan, ttynkkynen

On Friday, July 11, 2014 08:24:19 PM Viresh Kumar wrote:
> OPPs can be populated statically, via DT, or added at run time with
> dev_pm_opp_add().
> 
> While this driver handles the first case correctly, it would fail to populate
> OPPs added at runtime. Because call to of_init_opp_table() would fail as there
> are no OPPs in DT and probe will return early.
> 
> To fix this, remove error checking and call dev_pm_opp_init_cpufreq_table()
> unconditionally.
> 
> Update bindings as well.
> 
> Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Suggested-by: Stephen Boyd <sboyd@codeaurora.org>
> Tested-by: Stephen Boyd <sboyd@codeaurora.org>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
> Hi Rafael,
> 
> This was earlier sent as part of: https://lkml.org/lkml/2014/7/1/358 series. But
> actually is an fix and can (should?) be pushed for 3.16.
> 
> Rest of the patches from that series are cleanups/updates and so can go in
> 3.17.
> 
> Please see if you can take it for 3.16.

Applied, thanks!

>  Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt | 6 ++++--
>  drivers/cpufreq/cpufreq-cpu0.c                             | 7 ++-----
>  2 files changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt b/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt
> index f055515..366690c 100644
> --- a/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt
> +++ b/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt
> @@ -8,10 +8,12 @@ Both required and optional properties listed below must be defined
>  under node /cpus/cpu@0.
>  
>  Required properties:
> -- operating-points: Refer to Documentation/devicetree/bindings/power/opp.txt
> -  for details
> +- None
>  
>  Optional properties:
> +- operating-points: Refer to Documentation/devicetree/bindings/power/opp.txt for
> +  details. OPPs *must* be supplied either via DT, i.e. this property, or
> +  populated at runtime.
>  - clock-latency: Specify the possible maximum transition latency for clock,
>    in unit of nanoseconds.
>  - voltage-tolerance: Specify the CPU voltage tolerance in percentage.
> diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
> index ee1ae30..86beda9 100644
> --- a/drivers/cpufreq/cpufreq-cpu0.c
> +++ b/drivers/cpufreq/cpufreq-cpu0.c
> @@ -152,11 +152,8 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
>  		goto out_put_reg;
>  	}
>  
> -	ret = of_init_opp_table(cpu_dev);
> -	if (ret) {
> -		pr_err("failed to init OPP table: %d\n", ret);
> -		goto out_put_clk;
> -	}
> +	/* OPPs might be populated at runtime, don't check for error here */
> +	of_init_opp_table(cpu_dev);
>  
>  	ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table);
>  	if (ret) {
> 

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

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

end of thread, other threads:[~2014-07-18  0:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-11 14:54 [PATCH Resend] cpufreq: cpu0: OPPs can be populated at runtime Viresh Kumar
2014-07-18  1:08 ` Rafael J. Wysocki

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.