21 #include <linux/types.h>
27 #include <linux/export.h>
29 #include <mach/hardware.h>
30 #include <mach/cpufreq.h>
31 #include <mach/common.h>
47 struct clk *armclk = cpufreq.armclk;
55 cpufreq_verify_within_limits(policy, policy->
cpuinfo.min_freq,
60 cpufreq_verify_within_limits(policy, policy->
cpuinfo.min_freq,
65 static unsigned int davinci_getspeed(
unsigned int cpu)
74 unsigned int target_freq,
unsigned int relation)
80 struct clk *armclk = cpufreq.armclk;
86 if (target_freq < policy->
cpuinfo.min_freq)
87 target_freq = policy->
cpuinfo.min_freq;
88 if (target_freq > policy->
cpuinfo.max_freq)
89 target_freq = policy->
cpuinfo.max_freq;
91 freqs.old = davinci_getspeed(0);
95 if (freqs.old == freqs.new)
98 dev_dbg(cpufreq.dev,
"transition: %u --> %u\n", freqs.old, freqs.new);
101 freqs.new, relation, &idx);
118 if (cpufreq.asyncclk) {
119 ret =
clk_set_rate(cpufreq.asyncclk, cpufreq.asyncrate);
140 if (policy->
cpu != 0)
145 result = pdata->
init();
150 policy->
cur = policy->
min = policy->
max = davinci_getspeed(0);
164 policy->
cur = davinci_getspeed(0);
172 policy->
cpuinfo.transition_latency = 2000 * 1000;
182 static struct freq_attr *davinci_cpufreq_attr[] = {
189 .verify = davinci_verify_speed,
190 .target = davinci_target,
191 .get = davinci_getspeed,
192 .init = davinci_cpu_init,
193 .exit = davinci_cpu_exit,
195 .attr = davinci_cpufreq_attr,
201 struct clk *asyncclk;
208 cpufreq.dev = &pdev->
dev;
211 if (IS_ERR(cpufreq.armclk)) {
212 dev_err(cpufreq.dev,
"Unable to get ARM clock\n");
213 return PTR_ERR(cpufreq.armclk);
216 asyncclk =
clk_get(cpufreq.dev,
"async");
217 if (!IS_ERR(asyncclk)) {
218 cpufreq.asyncclk = asyncclk;
229 if (cpufreq.asyncclk)
237 .name =
"cpufreq-davinci",
240 .remove =
__exit_p(davinci_cpufreq_remove),
246 davinci_cpufreq_probe);