diff options
Diffstat (limited to 'arch/x86/kernel/cpu/cpufreq/speedstep-ich.c')
-rw-r--r-- | arch/x86/kernel/cpu/cpufreq/speedstep-ich.c | 70 |
1 files changed, 37 insertions, 33 deletions
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c b/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c index dedc1e98f168..8bbb11adb315 100644 --- a/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c +++ b/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c | |||
@@ -39,7 +39,7 @@ static struct pci_dev *speedstep_chipset_dev; | |||
39 | 39 | ||
40 | /* speedstep_processor | 40 | /* speedstep_processor |
41 | */ | 41 | */ |
42 | static unsigned int speedstep_processor = 0; | 42 | static unsigned int speedstep_processor; |
43 | 43 | ||
44 | static u32 pmbase; | 44 | static u32 pmbase; |
45 | 45 | ||
@@ -54,7 +54,8 @@ static struct cpufreq_frequency_table speedstep_freqs[] = { | |||
54 | }; | 54 | }; |
55 | 55 | ||
56 | 56 | ||
57 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "speedstep-ich", msg) | 57 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, \ |
58 | "speedstep-ich", msg) | ||
58 | 59 | ||
59 | 60 | ||
60 | /** | 61 | /** |
@@ -62,7 +63,7 @@ static struct cpufreq_frequency_table speedstep_freqs[] = { | |||
62 | * | 63 | * |
63 | * Returns: -ENODEV if no register could be found | 64 | * Returns: -ENODEV if no register could be found |
64 | */ | 65 | */ |
65 | static int speedstep_find_register (void) | 66 | static int speedstep_find_register(void) |
66 | { | 67 | { |
67 | if (!speedstep_chipset_dev) | 68 | if (!speedstep_chipset_dev) |
68 | return -ENODEV; | 69 | return -ENODEV; |
@@ -90,7 +91,7 @@ static int speedstep_find_register (void) | |||
90 | * | 91 | * |
91 | * Tries to change the SpeedStep state. | 92 | * Tries to change the SpeedStep state. |
92 | */ | 93 | */ |
93 | static void speedstep_set_state (unsigned int state) | 94 | static void speedstep_set_state(unsigned int state) |
94 | { | 95 | { |
95 | u8 pm2_blk; | 96 | u8 pm2_blk; |
96 | u8 value; | 97 | u8 value; |
@@ -133,11 +134,11 @@ static void speedstep_set_state (unsigned int state) | |||
133 | 134 | ||
134 | dprintk("read at pmbase 0x%x + 0x50 returned 0x%x\n", pmbase, value); | 135 | dprintk("read at pmbase 0x%x + 0x50 returned 0x%x\n", pmbase, value); |
135 | 136 | ||
136 | if (state == (value & 0x1)) { | 137 | if (state == (value & 0x1)) |
137 | dprintk("change to %u MHz succeeded\n", (speedstep_get_processor_frequency(speedstep_processor) / 1000)); | 138 | dprintk("change to %u MHz succeeded\n", |
138 | } else { | 139 | speedstep_get_frequency(speedstep_processor) / 1000); |
139 | printk (KERN_ERR "cpufreq: change failed - I/O error\n"); | 140 | else |
140 | } | 141 | printk(KERN_ERR "cpufreq: change failed - I/O error\n"); |
141 | 142 | ||
142 | return; | 143 | return; |
143 | } | 144 | } |
@@ -149,7 +150,7 @@ static void speedstep_set_state (unsigned int state) | |||
149 | * Tries to activate the SpeedStep status and control registers. | 150 | * Tries to activate the SpeedStep status and control registers. |
150 | * Returns -EINVAL on an unsupported chipset, and zero on success. | 151 | * Returns -EINVAL on an unsupported chipset, and zero on success. |
151 | */ | 152 | */ |
152 | static int speedstep_activate (void) | 153 | static int speedstep_activate(void) |
153 | { | 154 | { |
154 | u16 value = 0; | 155 | u16 value = 0; |
155 | 156 | ||
@@ -175,20 +176,18 @@ static int speedstep_activate (void) | |||
175 | * functions. Returns the SPEEDSTEP_CHIPSET_-number for the detected | 176 | * functions. Returns the SPEEDSTEP_CHIPSET_-number for the detected |
176 | * chipset, or zero on failure. | 177 | * chipset, or zero on failure. |
177 | */ | 178 | */ |
178 | static unsigned int speedstep_detect_chipset (void) | 179 | static unsigned int speedstep_detect_chipset(void) |
179 | { | 180 | { |
180 | speedstep_chipset_dev = pci_get_subsys(PCI_VENDOR_ID_INTEL, | 181 | speedstep_chipset_dev = pci_get_subsys(PCI_VENDOR_ID_INTEL, |
181 | PCI_DEVICE_ID_INTEL_82801DB_12, | 182 | PCI_DEVICE_ID_INTEL_82801DB_12, |
182 | PCI_ANY_ID, | 183 | PCI_ANY_ID, PCI_ANY_ID, |
183 | PCI_ANY_ID, | ||
184 | NULL); | 184 | NULL); |
185 | if (speedstep_chipset_dev) | 185 | if (speedstep_chipset_dev) |
186 | return 4; /* 4-M */ | 186 | return 4; /* 4-M */ |
187 | 187 | ||
188 | speedstep_chipset_dev = pci_get_subsys(PCI_VENDOR_ID_INTEL, | 188 | speedstep_chipset_dev = pci_get_subsys(PCI_VENDOR_ID_INTEL, |
189 | PCI_DEVICE_ID_INTEL_82801CA_12, | 189 | PCI_DEVICE_ID_INTEL_82801CA_12, |
190 | PCI_ANY_ID, | 190 | PCI_ANY_ID, PCI_ANY_ID, |
191 | PCI_ANY_ID, | ||
192 | NULL); | 191 | NULL); |
193 | if (speedstep_chipset_dev) | 192 | if (speedstep_chipset_dev) |
194 | return 3; /* 3-M */ | 193 | return 3; /* 3-M */ |
@@ -196,8 +195,7 @@ static unsigned int speedstep_detect_chipset (void) | |||
196 | 195 | ||
197 | speedstep_chipset_dev = pci_get_subsys(PCI_VENDOR_ID_INTEL, | 196 | speedstep_chipset_dev = pci_get_subsys(PCI_VENDOR_ID_INTEL, |
198 | PCI_DEVICE_ID_INTEL_82801BA_10, | 197 | PCI_DEVICE_ID_INTEL_82801BA_10, |
199 | PCI_ANY_ID, | 198 | PCI_ANY_ID, PCI_ANY_ID, |
200 | PCI_ANY_ID, | ||
201 | NULL); | 199 | NULL); |
202 | if (speedstep_chipset_dev) { | 200 | if (speedstep_chipset_dev) { |
203 | /* speedstep.c causes lockups on Dell Inspirons 8000 and | 201 | /* speedstep.c causes lockups on Dell Inspirons 8000 and |
@@ -208,8 +206,7 @@ static unsigned int speedstep_detect_chipset (void) | |||
208 | 206 | ||
209 | hostbridge = pci_get_subsys(PCI_VENDOR_ID_INTEL, | 207 | hostbridge = pci_get_subsys(PCI_VENDOR_ID_INTEL, |
210 | PCI_DEVICE_ID_INTEL_82815_MC, | 208 | PCI_DEVICE_ID_INTEL_82815_MC, |
211 | PCI_ANY_ID, | 209 | PCI_ANY_ID, PCI_ANY_ID, |
212 | PCI_ANY_ID, | ||
213 | NULL); | 210 | NULL); |
214 | 211 | ||
215 | if (!hostbridge) | 212 | if (!hostbridge) |
@@ -236,7 +233,7 @@ static unsigned int _speedstep_get(const struct cpumask *cpus) | |||
236 | 233 | ||
237 | cpus_allowed = current->cpus_allowed; | 234 | cpus_allowed = current->cpus_allowed; |
238 | set_cpus_allowed_ptr(current, cpus); | 235 | set_cpus_allowed_ptr(current, cpus); |
239 | speed = speedstep_get_processor_frequency(speedstep_processor); | 236 | speed = speedstep_get_frequency(speedstep_processor); |
240 | set_cpus_allowed_ptr(current, &cpus_allowed); | 237 | set_cpus_allowed_ptr(current, &cpus_allowed); |
241 | dprintk("detected %u kHz as current frequency\n", speed); | 238 | dprintk("detected %u kHz as current frequency\n", speed); |
242 | return speed; | 239 | return speed; |
@@ -251,11 +248,12 @@ static unsigned int speedstep_get(unsigned int cpu) | |||
251 | * speedstep_target - set a new CPUFreq policy | 248 | * speedstep_target - set a new CPUFreq policy |
252 | * @policy: new policy | 249 | * @policy: new policy |
253 | * @target_freq: the target frequency | 250 | * @target_freq: the target frequency |
254 | * @relation: how that frequency relates to achieved frequency (CPUFREQ_RELATION_L or CPUFREQ_RELATION_H) | 251 | * @relation: how that frequency relates to achieved frequency |
252 | * (CPUFREQ_RELATION_L or CPUFREQ_RELATION_H) | ||
255 | * | 253 | * |
256 | * Sets a new CPUFreq policy. | 254 | * Sets a new CPUFreq policy. |
257 | */ | 255 | */ |
258 | static int speedstep_target (struct cpufreq_policy *policy, | 256 | static int speedstep_target(struct cpufreq_policy *policy, |
259 | unsigned int target_freq, | 257 | unsigned int target_freq, |
260 | unsigned int relation) | 258 | unsigned int relation) |
261 | { | 259 | { |
@@ -264,7 +262,8 @@ static int speedstep_target (struct cpufreq_policy *policy, | |||
264 | cpumask_t cpus_allowed; | 262 | cpumask_t cpus_allowed; |
265 | int i; | 263 | int i; |
266 | 264 | ||
267 | if (cpufreq_frequency_table_target(policy, &speedstep_freqs[0], target_freq, relation, &newstate)) | 265 | if (cpufreq_frequency_table_target(policy, &speedstep_freqs[0], |
266 | target_freq, relation, &newstate)) | ||
268 | return -EINVAL; | 267 | return -EINVAL; |
269 | 268 | ||
270 | freqs.old = _speedstep_get(policy->cpus); | 269 | freqs.old = _speedstep_get(policy->cpus); |
@@ -308,7 +307,7 @@ static int speedstep_target (struct cpufreq_policy *policy, | |||
308 | * Limit must be within speedstep_low_freq and speedstep_high_freq, with | 307 | * Limit must be within speedstep_low_freq and speedstep_high_freq, with |
309 | * at least one border included. | 308 | * at least one border included. |
310 | */ | 309 | */ |
311 | static int speedstep_verify (struct cpufreq_policy *policy) | 310 | static int speedstep_verify(struct cpufreq_policy *policy) |
312 | { | 311 | { |
313 | return cpufreq_frequency_table_verify(policy, &speedstep_freqs[0]); | 312 | return cpufreq_frequency_table_verify(policy, &speedstep_freqs[0]); |
314 | } | 313 | } |
@@ -344,7 +343,8 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy) | |||
344 | return -EIO; | 343 | return -EIO; |
345 | 344 | ||
346 | dprintk("currently at %s speed setting - %i MHz\n", | 345 | dprintk("currently at %s speed setting - %i MHz\n", |
347 | (speed == speedstep_freqs[SPEEDSTEP_LOW].frequency) ? "low" : "high", | 346 | (speed == speedstep_freqs[SPEEDSTEP_LOW].frequency) |
347 | ? "low" : "high", | ||
348 | (speed / 1000)); | 348 | (speed / 1000)); |
349 | 349 | ||
350 | /* cpuinfo and default policy values */ | 350 | /* cpuinfo and default policy values */ |
@@ -352,9 +352,9 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy) | |||
352 | 352 | ||
353 | result = cpufreq_frequency_table_cpuinfo(policy, speedstep_freqs); | 353 | result = cpufreq_frequency_table_cpuinfo(policy, speedstep_freqs); |
354 | if (result) | 354 | if (result) |
355 | return (result); | 355 | return result; |
356 | 356 | ||
357 | cpufreq_frequency_table_get_attr(speedstep_freqs, policy->cpu); | 357 | cpufreq_frequency_table_get_attr(speedstep_freqs, policy->cpu); |
358 | 358 | ||
359 | return 0; | 359 | return 0; |
360 | } | 360 | } |
@@ -366,7 +366,7 @@ static int speedstep_cpu_exit(struct cpufreq_policy *policy) | |||
366 | return 0; | 366 | return 0; |
367 | } | 367 | } |
368 | 368 | ||
369 | static struct freq_attr* speedstep_attr[] = { | 369 | static struct freq_attr *speedstep_attr[] = { |
370 | &cpufreq_freq_attr_scaling_available_freqs, | 370 | &cpufreq_freq_attr_scaling_available_freqs, |
371 | NULL, | 371 | NULL, |
372 | }; | 372 | }; |
@@ -396,13 +396,15 @@ static int __init speedstep_init(void) | |||
396 | /* detect processor */ | 396 | /* detect processor */ |
397 | speedstep_processor = speedstep_detect_processor(); | 397 | speedstep_processor = speedstep_detect_processor(); |
398 | if (!speedstep_processor) { | 398 | if (!speedstep_processor) { |
399 | dprintk("Intel(R) SpeedStep(TM) capable processor not found\n"); | 399 | dprintk("Intel(R) SpeedStep(TM) capable processor " |
400 | "not found\n"); | ||
400 | return -ENODEV; | 401 | return -ENODEV; |
401 | } | 402 | } |
402 | 403 | ||
403 | /* detect chipset */ | 404 | /* detect chipset */ |
404 | if (!speedstep_detect_chipset()) { | 405 | if (!speedstep_detect_chipset()) { |
405 | dprintk("Intel(R) SpeedStep(TM) for this chipset not (yet) available.\n"); | 406 | dprintk("Intel(R) SpeedStep(TM) for this chipset not " |
407 | "(yet) available.\n"); | ||
406 | return -ENODEV; | 408 | return -ENODEV; |
407 | } | 409 | } |
408 | 410 | ||
@@ -431,9 +433,11 @@ static void __exit speedstep_exit(void) | |||
431 | } | 433 | } |
432 | 434 | ||
433 | 435 | ||
434 | MODULE_AUTHOR ("Dave Jones <davej@redhat.com>, Dominik Brodowski <linux@brodo.de>"); | 436 | MODULE_AUTHOR("Dave Jones <davej@redhat.com>, " |
435 | MODULE_DESCRIPTION ("Speedstep driver for Intel mobile processors on chipsets with ICH-M southbridges."); | 437 | "Dominik Brodowski <linux@brodo.de>"); |
436 | MODULE_LICENSE ("GPL"); | 438 | MODULE_DESCRIPTION("Speedstep driver for Intel mobile processors on chipsets " |
439 | "with ICH-M southbridges."); | ||
440 | MODULE_LICENSE("GPL"); | ||
437 | 441 | ||
438 | module_init(speedstep_init); | 442 | module_init(speedstep_init); |
439 | module_exit(speedstep_exit); | 443 | module_exit(speedstep_exit); |