提交 bf2a359d 编写于 作者: N Nishanth Menon 提交者: Kevin Hilman

cpufreq: OMAP: dont support !freq_table

OMAP2+ all have frequency tables, hence the hacks we had for older
silicon do not need to be carried forward. As part of this change,
use cpufreq_frequency_table_target to find the best match for
frequency requested.
Signed-off-by: NNishanth Menon <nm@ti.com>
Signed-off-by: NKevin Hilman <khilman@ti.com>
上级 a820ffa8
...@@ -35,8 +35,6 @@ ...@@ -35,8 +35,6 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#define VERY_HI_RATE 900000000
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
struct lpj_info { struct lpj_info {
unsigned long ref; unsigned long ref;
...@@ -54,20 +52,9 @@ static struct device *mpu_dev; ...@@ -54,20 +52,9 @@ static struct device *mpu_dev;
static int omap_verify_speed(struct cpufreq_policy *policy) static int omap_verify_speed(struct cpufreq_policy *policy)
{ {
if (freq_table) if (!freq_table)
return cpufreq_frequency_table_verify(policy, freq_table);
if (policy->cpu)
return -EINVAL; return -EINVAL;
return cpufreq_frequency_table_verify(policy, freq_table);
cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
policy->cpuinfo.max_freq);
policy->min = clk_round_rate(mpu_clk, policy->min * 1000) / 1000;
policy->max = clk_round_rate(mpu_clk, policy->max * 1000) / 1000;
cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
policy->cpuinfo.max_freq);
return 0;
} }
static unsigned int omap_getspeed(unsigned int cpu) static unsigned int omap_getspeed(unsigned int cpu)
...@@ -85,18 +72,31 @@ static int omap_target(struct cpufreq_policy *policy, ...@@ -85,18 +72,31 @@ static int omap_target(struct cpufreq_policy *policy,
unsigned int target_freq, unsigned int target_freq,
unsigned int relation) unsigned int relation)
{ {
int i, ret = 0; unsigned int i;
int ret = 0;
struct cpufreq_freqs freqs; struct cpufreq_freqs freqs;
/* Ensure desired rate is within allowed range. Some govenors if (!freq_table) {
* (ondemand) will just pass target_freq=0 to get the minimum. */ dev_err(mpu_dev, "%s: cpu%d: no freq table!\n", __func__,
if (target_freq < policy->min) policy->cpu);
target_freq = policy->min; return -EINVAL;
if (target_freq > policy->max) }
target_freq = policy->max;
ret = cpufreq_frequency_table_target(policy, freq_table, target_freq,
relation, &i);
if (ret) {
dev_dbg(mpu_dev, "%s: cpu%d: no freq match for %d(ret=%d)\n",
__func__, policy->cpu, target_freq, ret);
return ret;
}
freqs.new = freq_table[i].frequency;
if (!freqs.new) {
dev_err(mpu_dev, "%s: cpu%d: no match for freq %d\n", __func__,
policy->cpu, target_freq);
return -EINVAL;
}
freqs.old = omap_getspeed(policy->cpu); freqs.old = omap_getspeed(policy->cpu);
freqs.new = clk_round_rate(mpu_clk, target_freq * 1000) / 1000;
freqs.cpu = policy->cpu; freqs.cpu = policy->cpu;
if (freqs.old == freqs.new && policy->cur == freqs.new) if (freqs.old == freqs.new && policy->cur == freqs.new)
...@@ -162,19 +162,18 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy) ...@@ -162,19 +162,18 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
return -EINVAL; return -EINVAL;
policy->cur = policy->min = policy->max = omap_getspeed(policy->cpu); policy->cur = policy->min = policy->max = omap_getspeed(policy->cpu);
opp_init_cpufreq_table(mpu_dev, &freq_table); result = opp_init_cpufreq_table(mpu_dev, &freq_table);
if (freq_table) { if (result) {
result = cpufreq_frequency_table_cpuinfo(policy, freq_table); dev_err(mpu_dev, "%s: cpu%d: failed creating freq table[%d]\n",
if (!result) __func__, policy->cpu, result);
cpufreq_frequency_table_get_attr(freq_table, return result;
policy->cpu);
} else {
policy->cpuinfo.min_freq = clk_round_rate(mpu_clk, 0) / 1000;
policy->cpuinfo.max_freq = clk_round_rate(mpu_clk,
VERY_HI_RATE) / 1000;
} }
result = cpufreq_frequency_table_cpuinfo(policy, freq_table);
if (!result)
cpufreq_frequency_table_get_attr(freq_table, policy->cpu);
policy->min = policy->cpuinfo.min_freq; policy->min = policy->cpuinfo.min_freq;
policy->max = policy->cpuinfo.max_freq; policy->max = policy->cpuinfo.max_freq;
policy->cur = omap_getspeed(policy->cpu); policy->cur = omap_getspeed(policy->cpu);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册