Skip to content

Commit

Permalink
cpufreq: cpu0: OPPs can be populated at runtime
Browse files Browse the repository at this point in the history
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.

Suggested-by: Stephen Boyd <sboyd@codeaurora.org>
Tested-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
vireshk authored and rafaeljw committed Jul 16, 2014
1 parent 2fa1adc commit 1bf8cc3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 4 additions & 2 deletions Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 2 additions & 5 deletions drivers/cpufreq/cpufreq-cpu0.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 1bf8cc3

Please sign in to comment.