diff options
Diffstat (limited to 'extras/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq-fixes/0005-OMAP2-cpufreq-use-cpufreq_frequency_table_target.patch')
-rw-r--r-- | extras/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq-fixes/0005-OMAP2-cpufreq-use-cpufreq_frequency_table_target.patch | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/extras/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq-fixes/0005-OMAP2-cpufreq-use-cpufreq_frequency_table_target.patch b/extras/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq-fixes/0005-OMAP2-cpufreq-use-cpufreq_frequency_table_target.patch new file mode 100644 index 00000000..504d1916 --- /dev/null +++ b/extras/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq-fixes/0005-OMAP2-cpufreq-use-cpufreq_frequency_table_target.patch | |||
@@ -0,0 +1,78 @@ | |||
1 | From 272d76bcb22b9509ccc1b59d3a62e3930d902d17 Mon Sep 17 00:00:00 2001 | ||
2 | From: Nishanth Menon <nm@ti.com> | ||
3 | Date: Fri, 13 May 2011 05:43:49 -0700 | ||
4 | Subject: [PATCH 5/6] OMAP2+: cpufreq: use cpufreq_frequency_table_target | ||
5 | |||
6 | Use cpufreq_frequency_table_target for finding the proper target | ||
7 | instead of seeing if the frequency requested is divisible alone. | ||
8 | if we have a frequency table, we should restrict ourselves to | ||
9 | selecting the "approved" frequencies alone and only in the case | ||
10 | where the frequency table is not available should we attempt at | ||
11 | closest roundable clock frequency. | ||
12 | |||
13 | Signed-off-by: Nishanth Menon <nm@ti.com> | ||
14 | Signed-off-by: Koen Kooi <koen@dominion.thruhere.net> | ||
15 | --- | ||
16 | arch/arm/mach-omap2/omap2plus-cpufreq.c | 38 ++++++++++++++++++++++-------- | ||
17 | 1 files changed, 28 insertions(+), 10 deletions(-) | ||
18 | |||
19 | diff --git a/arch/arm/mach-omap2/omap2plus-cpufreq.c b/arch/arm/mach-omap2/omap2plus-cpufreq.c | ||
20 | index 854f4b3..d0b4f97 100644 | ||
21 | --- a/arch/arm/mach-omap2/omap2plus-cpufreq.c | ||
22 | +++ b/arch/arm/mach-omap2/omap2plus-cpufreq.c | ||
23 | @@ -77,24 +77,42 @@ static int omap_target(struct cpufreq_policy *policy, | ||
24 | unsigned int target_freq, | ||
25 | unsigned int relation) | ||
26 | { | ||
27 | - int i, ret = 0; | ||
28 | + unsigned int i; | ||
29 | + int ret = 0; | ||
30 | struct cpufreq_freqs freqs; | ||
31 | |||
32 | /* Changes not allowed until all CPUs are online */ | ||
33 | if (is_smp() && (num_online_cpus() < NR_CPUS)) | ||
34 | return ret; | ||
35 | |||
36 | - /* | ||
37 | - * Ensure desired rate is within allowed range. Some govenors | ||
38 | - * (ondemand) will just pass target_freq=0 to get the minimum. | ||
39 | - */ | ||
40 | - if (target_freq < policy->min) | ||
41 | - target_freq = policy->min; | ||
42 | - if (target_freq > policy->max) | ||
43 | - target_freq = policy->max; | ||
44 | + if (freq_table) { | ||
45 | + ret = cpufreq_frequency_table_target(policy, freq_table, | ||
46 | + target_freq, relation, &i); | ||
47 | + if (ret) { | ||
48 | + pr_debug("%s: cpu%d: no freq match for %d(ret=%d)\n", | ||
49 | + __func__, policy->cpu, target_freq, ret); | ||
50 | + return ret; | ||
51 | + } | ||
52 | + freqs.new = freq_table[i].frequency; | ||
53 | + } else { | ||
54 | + /* | ||
55 | + * Ensure desired rate is within allowed range. Some govenors | ||
56 | + * (ondemand) will just pass target_freq=0 to get the minimum. | ||
57 | + */ | ||
58 | + if (target_freq < policy->min) | ||
59 | + target_freq = policy->min; | ||
60 | + if (target_freq > policy->max) | ||
61 | + target_freq = policy->max; | ||
62 | + | ||
63 | + freqs.new = clk_round_rate(mpu_clk, target_freq * 1000) / 1000; | ||
64 | + } | ||
65 | + if (!freqs.new) { | ||
66 | + pr_err("%s: cpu%d: no match for freq %d\n", __func__, | ||
67 | + policy->cpu, target_freq); | ||
68 | + return -EINVAL; | ||
69 | + } | ||
70 | |||
71 | freqs.old = omap_getspeed(policy->cpu); | ||
72 | - freqs.new = clk_round_rate(mpu_clk, target_freq * 1000) / 1000; | ||
73 | freqs.cpu = policy->cpu; | ||
74 | |||
75 | if (freqs.old == freqs.new) | ||
76 | -- | ||
77 | 1.6.6.1 | ||
78 | |||