fb7ada2e18b63e359be8436e372037fd29bb9146
[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-omap-2.6.39 / pm / linux-omap-2.6.39-ti-pm-wip-cpufreq-fixes / 0002-OMAP2-cpufreq-handle-invalid-cpufreq-table.patch
1 From bbd8caaeda861dfa69882c34d8556b541f822ae2 Mon Sep 17 00:00:00 2001
2 From: Nishanth Menon <nm@ti.com>
3 Date: Thu, 12 May 2011 08:14:41 -0500
4 Subject: [PATCH 2/6] OMAP2+: cpufreq: handle invalid cpufreq table
6 Handle the case when cpufreq_frequency_table_cpuinfo fails. freq_table
7 that we passed failed the internal test of cpufreq generic driver,
8 so we should'nt be using the freq_table as such. Instead, warn and
9 fallback to clock functions for validation and operation.
11 Signed-off-by: Nishanth Menon <nm@ti.com>
12 Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
13 ---
14 arch/arm/mach-omap2/omap2plus-cpufreq.c | 12 ++++++++++--
15 1 files changed, 10 insertions(+), 2 deletions(-)
17 diff --git a/arch/arm/mach-omap2/omap2plus-cpufreq.c b/arch/arm/mach-omap2/omap2plus-cpufreq.c
18 index e38ebb8..6e3666a 100644
19 --- a/arch/arm/mach-omap2/omap2plus-cpufreq.c
20 +++ b/arch/arm/mach-omap2/omap2plus-cpufreq.c
21 @@ -182,10 +182,18 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
23 if (freq_table) {
24 result = cpufreq_frequency_table_cpuinfo(policy, freq_table);
25 - if (!result)
26 + if (!result) {
27 cpufreq_frequency_table_get_attr(freq_table,
28 policy->cpu);
29 - } else {
30 + } else {
31 + WARN(true, "%s: fallback to clk_round(freq_table=%d)\n",
32 + __func__, result);
33 + kfree(freq_table);
34 + freq_table = NULL;
35 + }
36 + }
37 +
38 + if (!freq_table) {
39 policy->cpuinfo.min_freq = clk_round_rate(mpu_clk, 0) / 1000;
40 policy->cpuinfo.max_freq = clk_round_rate(mpu_clk,
41 VERY_HI_RATE) / 1000;
42 --
43 1.6.6.1