Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 1 | /* |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 2 | * This file provides the ACPI based P-state support. This |
| 3 | * module works with generic cpufreq infrastructure. Most of |
| 4 | * the code is based on i386 version |
| 5 | * (arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c) |
| 6 | * |
| 7 | * Copyright (C) 2005 Intel Corp |
| 8 | * Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> |
| 9 | */ |
| 10 | |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 11 | #include <linux/kernel.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 12 | #include <linux/slab.h> |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 13 | #include <linux/module.h> |
| 14 | #include <linux/init.h> |
| 15 | #include <linux/cpufreq.h> |
| 16 | #include <linux/proc_fs.h> |
| 17 | #include <linux/seq_file.h> |
| 18 | #include <asm/io.h> |
| 19 | #include <asm/uaccess.h> |
| 20 | #include <asm/pal.h> |
| 21 | |
| 22 | #include <linux/acpi.h> |
| 23 | #include <acpi/processor.h> |
| 24 | |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 25 | MODULE_AUTHOR("Venkatesh Pallipadi"); |
| 26 | MODULE_DESCRIPTION("ACPI Processor P-States Driver"); |
| 27 | MODULE_LICENSE("GPL"); |
| 28 | |
| 29 | |
| 30 | struct cpufreq_acpi_io { |
| 31 | struct acpi_processor_performance acpi_data; |
| 32 | struct cpufreq_frequency_table *freq_table; |
| 33 | unsigned int resume; |
| 34 | }; |
| 35 | |
| 36 | static struct cpufreq_acpi_io *acpi_io_data[NR_CPUS]; |
| 37 | |
| 38 | static struct cpufreq_driver acpi_cpufreq_driver; |
| 39 | |
| 40 | |
| 41 | static int |
| 42 | processor_set_pstate ( |
| 43 | u32 value) |
| 44 | { |
| 45 | s64 retval; |
| 46 | |
Dominik Brodowski | 2d06d8c | 2011-03-27 15:04:46 +0200 | [diff] [blame] | 47 | pr_debug("processor_set_pstate\n"); |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 48 | |
| 49 | retval = ia64_pal_set_pstate((u64)value); |
| 50 | |
| 51 | if (retval) { |
Dominik Brodowski | 2d06d8c | 2011-03-27 15:04:46 +0200 | [diff] [blame] | 52 | pr_debug("Failed to set freq to 0x%x, with error 0x%lx\n", |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 53 | value, retval); |
| 54 | return -ENODEV; |
| 55 | } |
| 56 | return (int)retval; |
| 57 | } |
| 58 | |
| 59 | |
| 60 | static int |
| 61 | processor_get_pstate ( |
| 62 | u32 *value) |
| 63 | { |
| 64 | u64 pstate_index = 0; |
| 65 | s64 retval; |
| 66 | |
Dominik Brodowski | 2d06d8c | 2011-03-27 15:04:46 +0200 | [diff] [blame] | 67 | pr_debug("processor_get_pstate\n"); |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 68 | |
Venkatesh Pallipadi | 17e77b1 | 2006-12-01 15:28:14 -0800 | [diff] [blame] | 69 | retval = ia64_pal_get_pstate(&pstate_index, |
| 70 | PAL_GET_PSTATE_TYPE_INSTANT); |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 71 | *value = (u32) pstate_index; |
| 72 | |
| 73 | if (retval) |
Dominik Brodowski | 2d06d8c | 2011-03-27 15:04:46 +0200 | [diff] [blame] | 74 | pr_debug("Failed to get current freq with " |
Denis V. Lunev | 60192db | 2008-07-17 11:11:17 -0700 | [diff] [blame] | 75 | "error 0x%lx, idx 0x%x\n", retval, *value); |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 76 | |
| 77 | return (int)retval; |
| 78 | } |
| 79 | |
| 80 | |
| 81 | /* To be used only after data->acpi_data is initialized */ |
| 82 | static unsigned |
| 83 | extract_clock ( |
| 84 | struct cpufreq_acpi_io *data, |
| 85 | unsigned value, |
| 86 | unsigned int cpu) |
| 87 | { |
| 88 | unsigned long i; |
| 89 | |
Dominik Brodowski | 2d06d8c | 2011-03-27 15:04:46 +0200 | [diff] [blame] | 90 | pr_debug("extract_clock\n"); |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 91 | |
| 92 | for (i = 0; i < data->acpi_data.state_count; i++) { |
Venkatesh Pallipadi | 17e77b1 | 2006-12-01 15:28:14 -0800 | [diff] [blame] | 93 | if (value == data->acpi_data.states[i].status) |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 94 | return data->acpi_data.states[i].core_frequency; |
| 95 | } |
| 96 | return data->acpi_data.states[i-1].core_frequency; |
| 97 | } |
| 98 | |
| 99 | |
| 100 | static unsigned int |
| 101 | processor_get_freq ( |
| 102 | struct cpufreq_acpi_io *data, |
| 103 | unsigned int cpu) |
| 104 | { |
| 105 | int ret = 0; |
| 106 | u32 value = 0; |
| 107 | cpumask_t saved_mask; |
| 108 | unsigned long clock_freq; |
| 109 | |
Dominik Brodowski | 2d06d8c | 2011-03-27 15:04:46 +0200 | [diff] [blame] | 110 | pr_debug("processor_get_freq\n"); |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 111 | |
| 112 | saved_mask = current->cpus_allowed; |
Julia Lawall | 552dce3 | 2010-03-26 23:02:23 +0100 | [diff] [blame] | 113 | set_cpus_allowed_ptr(current, cpumask_of(cpu)); |
Alex Williamson | 182fdd2 | 2007-08-13 15:49:46 -0600 | [diff] [blame] | 114 | if (smp_processor_id() != cpu) |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 115 | goto migrate_end; |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 116 | |
Venkatesh Pallipadi | 17e77b1 | 2006-12-01 15:28:14 -0800 | [diff] [blame] | 117 | /* processor_get_pstate gets the instantaneous frequency */ |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 118 | ret = processor_get_pstate(&value); |
| 119 | |
| 120 | if (ret) { |
Julia Lawall | 552dce3 | 2010-03-26 23:02:23 +0100 | [diff] [blame] | 121 | set_cpus_allowed_ptr(current, &saved_mask); |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 122 | printk(KERN_WARNING "get performance failed with error %d\n", |
| 123 | ret); |
Alex Williamson | 182fdd2 | 2007-08-13 15:49:46 -0600 | [diff] [blame] | 124 | ret = 0; |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 125 | goto migrate_end; |
| 126 | } |
| 127 | clock_freq = extract_clock(data, value, cpu); |
| 128 | ret = (clock_freq*1000); |
| 129 | |
| 130 | migrate_end: |
Julia Lawall | 552dce3 | 2010-03-26 23:02:23 +0100 | [diff] [blame] | 131 | set_cpus_allowed_ptr(current, &saved_mask); |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 132 | return ret; |
| 133 | } |
| 134 | |
| 135 | |
| 136 | static int |
| 137 | processor_set_freq ( |
| 138 | struct cpufreq_acpi_io *data, |
Viresh Kumar | b43a7ff | 2013-03-24 11:56:43 +0530 | [diff] [blame] | 139 | struct cpufreq_policy *policy, |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 140 | int state) |
| 141 | { |
| 142 | int ret = 0; |
| 143 | u32 value = 0; |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 144 | cpumask_t saved_mask; |
| 145 | int retval; |
| 146 | |
Dominik Brodowski | 2d06d8c | 2011-03-27 15:04:46 +0200 | [diff] [blame] | 147 | pr_debug("processor_set_freq\n"); |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 148 | |
| 149 | saved_mask = current->cpus_allowed; |
Viresh Kumar | b43a7ff | 2013-03-24 11:56:43 +0530 | [diff] [blame] | 150 | set_cpus_allowed_ptr(current, cpumask_of(policy->cpu)); |
| 151 | if (smp_processor_id() != policy->cpu) { |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 152 | retval = -EAGAIN; |
| 153 | goto migrate_end; |
| 154 | } |
| 155 | |
| 156 | if (state == data->acpi_data.state) { |
| 157 | if (unlikely(data->resume)) { |
Dominik Brodowski | 2d06d8c | 2011-03-27 15:04:46 +0200 | [diff] [blame] | 158 | pr_debug("Called after resume, resetting to P%d\n", state); |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 159 | data->resume = 0; |
| 160 | } else { |
Dominik Brodowski | 2d06d8c | 2011-03-27 15:04:46 +0200 | [diff] [blame] | 161 | pr_debug("Already at target state (P%d)\n", state); |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 162 | retval = 0; |
| 163 | goto migrate_end; |
| 164 | } |
| 165 | } |
| 166 | |
Dominik Brodowski | 2d06d8c | 2011-03-27 15:04:46 +0200 | [diff] [blame] | 167 | pr_debug("Transitioning from P%d to P%d\n", |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 168 | data->acpi_data.state, state); |
| 169 | |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 170 | /* |
| 171 | * First we write the target state's 'control' value to the |
| 172 | * control_register. |
| 173 | */ |
| 174 | |
| 175 | value = (u32) data->acpi_data.states[state].control; |
| 176 | |
Dominik Brodowski | 2d06d8c | 2011-03-27 15:04:46 +0200 | [diff] [blame] | 177 | pr_debug("Transitioning to state: 0x%08x\n", value); |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 178 | |
| 179 | ret = processor_set_pstate(value); |
| 180 | if (ret) { |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 181 | printk(KERN_WARNING "Transition failed with error %d\n", ret); |
| 182 | retval = -ENODEV; |
| 183 | goto migrate_end; |
| 184 | } |
| 185 | |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 186 | data->acpi_data.state = state; |
| 187 | |
| 188 | retval = 0; |
| 189 | |
| 190 | migrate_end: |
Julia Lawall | 552dce3 | 2010-03-26 23:02:23 +0100 | [diff] [blame] | 191 | set_cpus_allowed_ptr(current, &saved_mask); |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 192 | return (retval); |
| 193 | } |
| 194 | |
| 195 | |
| 196 | static unsigned int |
| 197 | acpi_cpufreq_get ( |
| 198 | unsigned int cpu) |
| 199 | { |
| 200 | struct cpufreq_acpi_io *data = acpi_io_data[cpu]; |
| 201 | |
Dominik Brodowski | 2d06d8c | 2011-03-27 15:04:46 +0200 | [diff] [blame] | 202 | pr_debug("acpi_cpufreq_get\n"); |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 203 | |
| 204 | return processor_get_freq(data, cpu); |
| 205 | } |
| 206 | |
| 207 | |
| 208 | static int |
| 209 | acpi_cpufreq_target ( |
| 210 | struct cpufreq_policy *policy, |
Viresh Kumar | 9c0ebcf | 2013-10-25 19:45:48 +0530 | [diff] [blame] | 211 | unsigned int index) |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 212 | { |
Viresh Kumar | 9c0ebcf | 2013-10-25 19:45:48 +0530 | [diff] [blame] | 213 | return processor_set_freq(acpi_io_data[policy->cpu], policy, index); |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 214 | } |
| 215 | |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 216 | static int |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 217 | acpi_cpufreq_cpu_init ( |
| 218 | struct cpufreq_policy *policy) |
| 219 | { |
| 220 | unsigned int i; |
| 221 | unsigned int cpu = policy->cpu; |
| 222 | struct cpufreq_acpi_io *data; |
| 223 | unsigned int result = 0; |
| 224 | |
Dominik Brodowski | 2d06d8c | 2011-03-27 15:04:46 +0200 | [diff] [blame] | 225 | pr_debug("acpi_cpufreq_cpu_init\n"); |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 226 | |
Viresh Kumar | d5b73cd | 2013-08-06 22:53:06 +0530 | [diff] [blame] | 227 | data = kzalloc(sizeof(*data), GFP_KERNEL); |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 228 | if (!data) |
| 229 | return (-ENOMEM); |
| 230 | |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 231 | acpi_io_data[cpu] = data; |
| 232 | |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 233 | result = acpi_processor_register_performance(&data->acpi_data, cpu); |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 234 | |
| 235 | if (result) |
| 236 | goto err_free; |
| 237 | |
| 238 | /* capability check */ |
| 239 | if (data->acpi_data.state_count <= 1) { |
Dominik Brodowski | 2d06d8c | 2011-03-27 15:04:46 +0200 | [diff] [blame] | 240 | pr_debug("No P-States\n"); |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 241 | result = -ENODEV; |
| 242 | goto err_unreg; |
| 243 | } |
| 244 | |
| 245 | if ((data->acpi_data.control_register.space_id != |
| 246 | ACPI_ADR_SPACE_FIXED_HARDWARE) || |
| 247 | (data->acpi_data.status_register.space_id != |
| 248 | ACPI_ADR_SPACE_FIXED_HARDWARE)) { |
Dominik Brodowski | 2d06d8c | 2011-03-27 15:04:46 +0200 | [diff] [blame] | 249 | pr_debug("Unsupported address space [%d, %d]\n", |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 250 | (u32) (data->acpi_data.control_register.space_id), |
| 251 | (u32) (data->acpi_data.status_register.space_id)); |
| 252 | result = -ENODEV; |
| 253 | goto err_unreg; |
| 254 | } |
| 255 | |
| 256 | /* alloc freq_table */ |
Viresh Kumar | d5b73cd | 2013-08-06 22:53:06 +0530 | [diff] [blame] | 257 | data->freq_table = kmalloc(sizeof(*data->freq_table) * |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 258 | (data->acpi_data.state_count + 1), |
| 259 | GFP_KERNEL); |
| 260 | if (!data->freq_table) { |
| 261 | result = -ENOMEM; |
| 262 | goto err_unreg; |
| 263 | } |
| 264 | |
| 265 | /* detect transition latency */ |
| 266 | policy->cpuinfo.transition_latency = 0; |
| 267 | for (i=0; i<data->acpi_data.state_count; i++) { |
| 268 | if ((data->acpi_data.states[i].transition_latency * 1000) > |
| 269 | policy->cpuinfo.transition_latency) { |
| 270 | policy->cpuinfo.transition_latency = |
| 271 | data->acpi_data.states[i].transition_latency * 1000; |
| 272 | } |
| 273 | } |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 274 | |
| 275 | /* table init */ |
| 276 | for (i = 0; i <= data->acpi_data.state_count; i++) |
| 277 | { |
Viresh Kumar | 5070158 | 2013-03-30 16:25:15 +0530 | [diff] [blame] | 278 | data->freq_table[i].driver_data = i; |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 279 | if (i < data->acpi_data.state_count) { |
| 280 | data->freq_table[i].frequency = |
| 281 | data->acpi_data.states[i].core_frequency * 1000; |
| 282 | } else { |
| 283 | data->freq_table[i].frequency = CPUFREQ_TABLE_END; |
| 284 | } |
| 285 | } |
| 286 | |
Viresh Kumar | bbe2c17 | 2013-09-16 18:56:17 +0530 | [diff] [blame] | 287 | result = cpufreq_table_validate_and_show(policy, data->freq_table); |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 288 | if (result) { |
| 289 | goto err_freqfree; |
| 290 | } |
| 291 | |
| 292 | /* notify BIOS that we exist */ |
| 293 | acpi_processor_notify_smm(THIS_MODULE); |
| 294 | |
| 295 | printk(KERN_INFO "acpi-cpufreq: CPU%u - ACPI performance management " |
| 296 | "activated.\n", cpu); |
| 297 | |
| 298 | for (i = 0; i < data->acpi_data.state_count; i++) |
Dominik Brodowski | 2d06d8c | 2011-03-27 15:04:46 +0200 | [diff] [blame] | 299 | pr_debug(" %cP%d: %d MHz, %d mW, %d uS, %d uS, 0x%x 0x%x\n", |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 300 | (i == data->acpi_data.state?'*':' '), i, |
| 301 | (u32) data->acpi_data.states[i].core_frequency, |
| 302 | (u32) data->acpi_data.states[i].power, |
| 303 | (u32) data->acpi_data.states[i].transition_latency, |
| 304 | (u32) data->acpi_data.states[i].bus_master_latency, |
| 305 | (u32) data->acpi_data.states[i].status, |
| 306 | (u32) data->acpi_data.states[i].control); |
| 307 | |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 308 | /* the first call to ->target() should result in us actually |
| 309 | * writing something to the appropriate registers. */ |
| 310 | data->resume = 1; |
| 311 | |
| 312 | return (result); |
| 313 | |
| 314 | err_freqfree: |
| 315 | kfree(data->freq_table); |
| 316 | err_unreg: |
| 317 | acpi_processor_unregister_performance(&data->acpi_data, cpu); |
| 318 | err_free: |
| 319 | kfree(data); |
| 320 | acpi_io_data[cpu] = NULL; |
| 321 | |
| 322 | return (result); |
| 323 | } |
| 324 | |
| 325 | |
| 326 | static int |
| 327 | acpi_cpufreq_cpu_exit ( |
| 328 | struct cpufreq_policy *policy) |
| 329 | { |
| 330 | struct cpufreq_acpi_io *data = acpi_io_data[policy->cpu]; |
| 331 | |
Dominik Brodowski | 2d06d8c | 2011-03-27 15:04:46 +0200 | [diff] [blame] | 332 | pr_debug("acpi_cpufreq_cpu_exit\n"); |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 333 | |
| 334 | if (data) { |
| 335 | cpufreq_frequency_table_put_attr(policy->cpu); |
| 336 | acpi_io_data[policy->cpu] = NULL; |
| 337 | acpi_processor_unregister_performance(&data->acpi_data, |
| 338 | policy->cpu); |
| 339 | kfree(data); |
| 340 | } |
| 341 | |
| 342 | return (0); |
| 343 | } |
| 344 | |
| 345 | |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 346 | static struct cpufreq_driver acpi_cpufreq_driver = { |
Viresh Kumar | 59b2413 | 2013-10-03 20:28:07 +0530 | [diff] [blame] | 347 | .verify = cpufreq_generic_frequency_table_verify, |
Viresh Kumar | 9c0ebcf | 2013-10-25 19:45:48 +0530 | [diff] [blame] | 348 | .target_index = acpi_cpufreq_target, |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 349 | .get = acpi_cpufreq_get, |
| 350 | .init = acpi_cpufreq_cpu_init, |
| 351 | .exit = acpi_cpufreq_cpu_exit, |
| 352 | .name = "acpi-cpufreq", |
Viresh Kumar | 59b2413 | 2013-10-03 20:28:07 +0530 | [diff] [blame] | 353 | .attr = cpufreq_generic_attr, |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 354 | }; |
| 355 | |
| 356 | |
| 357 | static int __init |
| 358 | acpi_cpufreq_init (void) |
| 359 | { |
Dominik Brodowski | 2d06d8c | 2011-03-27 15:04:46 +0200 | [diff] [blame] | 360 | pr_debug("acpi_cpufreq_init\n"); |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 361 | |
| 362 | return cpufreq_register_driver(&acpi_cpufreq_driver); |
| 363 | } |
| 364 | |
| 365 | |
| 366 | static void __exit |
| 367 | acpi_cpufreq_exit (void) |
| 368 | { |
Dominik Brodowski | 2d06d8c | 2011-03-27 15:04:46 +0200 | [diff] [blame] | 369 | pr_debug("acpi_cpufreq_exit\n"); |
Venkatesh Pallipadi | 4db8699 | 2005-07-29 16:15:00 -0700 | [diff] [blame] | 370 | |
| 371 | cpufreq_unregister_driver(&acpi_cpufreq_driver); |
| 372 | return; |
| 373 | } |
| 374 | |
| 375 | |
| 376 | late_initcall(acpi_cpufreq_init); |
| 377 | module_exit(acpi_cpufreq_exit); |
| 378 | |