11 #include <linux/kernel.h>
14 #include <linux/slab.h>
42 static enum arm_opp idx2opp[] = {
49 static struct freq_attr *db8500_cpufreq_attr[] = {
54 static int db8500_cpufreq_verify_speed(
struct cpufreq_policy *policy)
60 unsigned int target_freq,
61 unsigned int relation)
67 if (target_freq < policy->
cpuinfo.min_freq)
68 target_freq = policy->
cpuinfo.min_freq;
69 if (target_freq > policy->
cpuinfo.max_freq)
70 target_freq = policy->
cpuinfo.max_freq;
74 (policy, freq_table, target_freq, relation, &idx)) {
78 freqs.old = policy->
cur;
81 if (freqs.old == freqs.new)
89 if (prcmu_set_arm_opp(idx2opp[idx])) {
90 pr_err(
"db8500-cpufreq: Failed to set OPP level\n");
101 static
unsigned int db8500_cpufreq_getspeed(
unsigned int cpu)
105 for (i = 0; prcmu_get_arm_opp() != idx2opp[
i]; i++)
119 pr_info(
"db8500-cpufreq : Available frequencies:\n");
128 pr_err(
"db8500-cpufreq : Failed to read policy table\n");
134 policy->
cur = db8500_cpufreq_getspeed(policy->
cpu);
135 policy->
governor = CPUFREQ_DEFAULT_GOVERNOR;
142 policy->
cpuinfo.transition_latency = 20 * 1000;
145 cpumask_copy(policy->
cpus, cpu_present_mask);
154 .verify = db8500_cpufreq_verify_speed,
155 .target = db8500_cpufreq_target,
156 .get = db8500_cpufreq_getspeed,
157 .init = db8500_cpufreq_init,
159 .attr = db8500_cpufreq_attr,
162 static int __init db8500_cpufreq_register(
void)
164 if (!cpu_is_u8500_family())
167 pr_info(
"cpufreq for DB8500 started\n");