11 #include <linux/kernel.h>
12 #include <linux/module.h>
16 #include <linux/timex.h>
22 #define POWERNOW_IOPORT 0xfff0
25 #define PFX "powernow-k6: "
26 static unsigned int busfreq;
27 static unsigned int max_multiplier;
50 static int powernow_k6_get_cpu_multiplier(
void)
61 return clock_ratio[(invalue >> 5)&7].
index;
71 static void powernow_k6_set_state(
unsigned int best_i)
73 unsigned long outvalue = 0, invalue = 0;
77 if (clock_ratio[best_i].
index > max_multiplier) {
82 freqs.old = busfreq * powernow_k6_get_cpu_multiplier();
83 freqs.new = busfreq * clock_ratio[best_i].
index;
90 outvalue = (1<<12) | (1<<10) | (1<<9) | (best_i<<5);
95 invalue = invalue & 0xf;
96 outvalue = outvalue | invalue;
130 unsigned int target_freq,
131 unsigned int relation)
133 unsigned int newstate = 0;
136 target_freq, relation, &newstate))
139 powernow_k6_set_state(newstate);
150 if (policy->
cpu != 0)
154 max_multiplier = powernow_k6_get_cpu_multiplier();
155 busfreq =
cpu_khz / max_multiplier;
160 if (f > max_multiplier)
167 policy->
cpuinfo.transition_latency = 200000;
168 policy->
cur = busfreq * max_multiplier;
183 for (i = 0; i < 8; i++) {
184 if (i == max_multiplier)
185 powernow_k6_set_state(i);
191 static unsigned int powernow_k6_get(
unsigned int cpu)
194 ret = (busfreq * powernow_k6_get_cpu_multiplier());
198 static struct freq_attr *powernow_k6_attr[] = {
204 .verify = powernow_k6_verify,
205 .target = powernow_k6_target,
206 .init = powernow_k6_cpu_init,
207 .exit = powernow_k6_cpu_exit,
208 .get = powernow_k6_get,
209 .name =
"powernow-k6",
211 .attr = powernow_k6_attr,
214 static const struct x86_cpu_id powernow_k6_ids[] = {
228 static int __init powernow_k6_init(
void)
252 static void __exit powernow_k6_exit(
void)