1 // SPDX-License-Identifier: GPL-2.0 2 /* 3 * linux/drivers/thermal/cpufreq_cooling.c 4 * 5 * Copyright (C) 2012 Samsung Electronics Co., Ltd(http://www.samsung.com) 6 * 7 * Copyright (C) 2012-2018 Linaro Limited. 8 * 9 * Authors: Amit Daniel <amit.kachhap@linaro.org> 10 * Viresh Kumar <viresh.kumar@linaro.org> 11 * 12 */ 13 #include <linux/cpu.h> 14 #include <linux/cpufreq.h> 15 #include <linux/cpu_cooling.h> 16 #include <linux/device.h> 17 #include <linux/energy_model.h> 18 #include <linux/err.h> 19 #include <linux/export.h> 20 #include <linux/pm_opp.h> 21 #include <linux/pm_qos.h> 22 #include <linux/slab.h> 23 #include <linux/thermal.h> 24 25 #include <trace/events/thermal.h> 26 27 /* 28 * Cooling state <-> CPUFreq frequency 29 * 30 * Cooling states are translated to frequencies throughout this driver and this 31 * is the relation between them. 32 * 33 * Highest cooling state corresponds to lowest possible frequency. 34 * 35 * i.e. 36 * level 0 --> 1st Max Freq 37 * level 1 --> 2nd Max Freq 38 * ... 39 */ 40 41 /** 42 * struct time_in_idle - Idle time stats 43 * @time: previous reading of the absolute time that this cpu was idle 44 * @timestamp: wall time of the last invocation of get_cpu_idle_time_us() 45 */ 46 struct time_in_idle { 47 u64 time; 48 u64 timestamp; 49 }; 50 51 /** 52 * struct cpufreq_cooling_device - data for cooling device with cpufreq 53 * @last_load: load measured by the latest call to cpufreq_get_requested_power() 54 * @cpufreq_state: integer value representing the current state of cpufreq 55 * cooling devices. 56 * @max_level: maximum cooling level. One less than total number of valid 57 * cpufreq frequencies. 58 * @em: Reference on the Energy Model of the device 59 * @cdev: thermal_cooling_device pointer to keep track of the 60 * registered cooling device. 61 * @policy: cpufreq policy. 62 * @idle_time: idle time stats 63 * @qos_req: PM QoS contraint to apply 64 * 65 * This structure is required for keeping information of each registered 66 * cpufreq_cooling_device. 67 */ 68 struct cpufreq_cooling_device { 69 u32 last_load; 70 unsigned int cpufreq_state; 71 unsigned int max_level; 72 struct em_perf_domain *em; 73 struct cpufreq_policy *policy; 74 #ifndef CONFIG_SMP 75 struct time_in_idle *idle_time; 76 #endif 77 struct freq_qos_request qos_req; 78 }; 79 80 #ifdef CONFIG_THERMAL_GOV_POWER_ALLOCATOR 81 /** 82 * get_level: Find the level for a particular frequency 83 * @cpufreq_cdev: cpufreq_cdev for which the property is required 84 * @freq: Frequency 85 * 86 * Return: level corresponding to the frequency. 87 */ 88 static unsigned long get_level(struct cpufreq_cooling_device *cpufreq_cdev, 89 unsigned int freq) 90 { 91 int i; 92 93 for (i = cpufreq_cdev->max_level - 1; i >= 0; i--) { 94 if (freq > cpufreq_cdev->em->table[i].frequency) 95 break; 96 } 97 98 return cpufreq_cdev->max_level - i - 1; 99 } 100 101 static u32 cpu_freq_to_power(struct cpufreq_cooling_device *cpufreq_cdev, 102 u32 freq) 103 { 104 int i; 105 106 for (i = cpufreq_cdev->max_level - 1; i >= 0; i--) { 107 if (freq > cpufreq_cdev->em->table[i].frequency) 108 break; 109 } 110 111 return cpufreq_cdev->em->table[i + 1].power; 112 } 113 114 static u32 cpu_power_to_freq(struct cpufreq_cooling_device *cpufreq_cdev, 115 u32 power) 116 { 117 int i; 118 119 for (i = cpufreq_cdev->max_level; i > 0; i--) { 120 if (power >= cpufreq_cdev->em->table[i].power) 121 break; 122 } 123 124 return cpufreq_cdev->em->table[i].frequency; 125 } 126 127 /** 128 * get_load() - get load for a cpu 129 * @cpufreq_cdev: struct cpufreq_cooling_device for the cpu 130 * @cpu: cpu number 131 * @cpu_idx: index of the cpu in time_in_idle array 132 * 133 * Return: The average load of cpu @cpu in percentage since this 134 * function was last called. 135 */ 136 #ifdef CONFIG_SMP 137 static u32 get_load(struct cpufreq_cooling_device *cpufreq_cdev, int cpu, 138 int cpu_idx) 139 { 140 unsigned long util = sched_cpu_util(cpu); 141 142 return (util * 100) / arch_scale_cpu_capacity(cpu); 143 } 144 #else /* !CONFIG_SMP */ 145 static u32 get_load(struct cpufreq_cooling_device *cpufreq_cdev, int cpu, 146 int cpu_idx) 147 { 148 u32 load; 149 u64 now, now_idle, delta_time, delta_idle; 150 struct time_in_idle *idle_time = &cpufreq_cdev->idle_time[cpu_idx]; 151 152 now_idle = get_cpu_idle_time(cpu, &now, 0); 153 delta_idle = now_idle - idle_time->time; 154 delta_time = now - idle_time->timestamp; 155 156 if (delta_time <= delta_idle) 157 load = 0; 158 else 159 load = div64_u64(100 * (delta_time - delta_idle), delta_time); 160 161 idle_time->time = now_idle; 162 idle_time->timestamp = now; 163 164 return load; 165 } 166 #endif /* CONFIG_SMP */ 167 168 /** 169 * get_dynamic_power() - calculate the dynamic power 170 * @cpufreq_cdev: &cpufreq_cooling_device for this cdev 171 * @freq: current frequency 172 * 173 * Return: the dynamic power consumed by the cpus described by 174 * @cpufreq_cdev. 175 */ 176 static u32 get_dynamic_power(struct cpufreq_cooling_device *cpufreq_cdev, 177 unsigned long freq) 178 { 179 u32 raw_cpu_power; 180 181 raw_cpu_power = cpu_freq_to_power(cpufreq_cdev, freq); 182 return (raw_cpu_power * cpufreq_cdev->last_load) / 100; 183 } 184 185 /** 186 * cpufreq_get_requested_power() - get the current power 187 * @cdev: &thermal_cooling_device pointer 188 * @power: pointer in which to store the resulting power 189 * 190 * Calculate the current power consumption of the cpus in milliwatts 191 * and store it in @power. This function should actually calculate 192 * the requested power, but it's hard to get the frequency that 193 * cpufreq would have assigned if there were no thermal limits. 194 * Instead, we calculate the current power on the assumption that the 195 * immediate future will look like the immediate past. 196 * 197 * We use the current frequency and the average load since this 198 * function was last called. In reality, there could have been 199 * multiple opps since this function was last called and that affects 200 * the load calculation. While it's not perfectly accurate, this 201 * simplification is good enough and works. REVISIT this, as more 202 * complex code may be needed if experiments show that it's not 203 * accurate enough. 204 * 205 * Return: 0 on success, -E* if getting the static power failed. 206 */ 207 static int cpufreq_get_requested_power(struct thermal_cooling_device *cdev, 208 u32 *power) 209 { 210 unsigned long freq; 211 int i = 0, cpu; 212 u32 total_load = 0; 213 struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata; 214 struct cpufreq_policy *policy = cpufreq_cdev->policy; 215 u32 *load_cpu = NULL; 216 217 freq = cpufreq_quick_get(policy->cpu); 218 219 if (trace_thermal_power_cpu_get_power_enabled()) { 220 u32 ncpus = cpumask_weight(policy->related_cpus); 221 222 load_cpu = kcalloc(ncpus, sizeof(*load_cpu), GFP_KERNEL); 223 } 224 225 for_each_cpu(cpu, policy->related_cpus) { 226 u32 load; 227 228 if (cpu_online(cpu)) 229 load = get_load(cpufreq_cdev, cpu, i); 230 else 231 load = 0; 232 233 total_load += load; 234 if (load_cpu) 235 load_cpu[i] = load; 236 237 i++; 238 } 239 240 cpufreq_cdev->last_load = total_load; 241 242 *power = get_dynamic_power(cpufreq_cdev, freq); 243 244 if (load_cpu) { 245 trace_thermal_power_cpu_get_power(policy->related_cpus, freq, 246 load_cpu, i, *power); 247 248 kfree(load_cpu); 249 } 250 251 return 0; 252 } 253 254 /** 255 * cpufreq_state2power() - convert a cpu cdev state to power consumed 256 * @cdev: &thermal_cooling_device pointer 257 * @state: cooling device state to be converted 258 * @power: pointer in which to store the resulting power 259 * 260 * Convert cooling device state @state into power consumption in 261 * milliwatts assuming 100% load. Store the calculated power in 262 * @power. 263 * 264 * Return: 0 on success, -EINVAL if the cooling device state could not 265 * be converted into a frequency or other -E* if there was an error 266 * when calculating the static power. 267 */ 268 static int cpufreq_state2power(struct thermal_cooling_device *cdev, 269 unsigned long state, u32 *power) 270 { 271 unsigned int freq, num_cpus, idx; 272 struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata; 273 274 /* Request state should be less than max_level */ 275 if (state > cpufreq_cdev->max_level) 276 return -EINVAL; 277 278 num_cpus = cpumask_weight(cpufreq_cdev->policy->cpus); 279 280 idx = cpufreq_cdev->max_level - state; 281 freq = cpufreq_cdev->em->table[idx].frequency; 282 *power = cpu_freq_to_power(cpufreq_cdev, freq) * num_cpus; 283 284 return 0; 285 } 286 287 /** 288 * cpufreq_power2state() - convert power to a cooling device state 289 * @cdev: &thermal_cooling_device pointer 290 * @power: power in milliwatts to be converted 291 * @state: pointer in which to store the resulting state 292 * 293 * Calculate a cooling device state for the cpus described by @cdev 294 * that would allow them to consume at most @power mW and store it in 295 * @state. Note that this calculation depends on external factors 296 * such as the cpu load or the current static power. Calling this 297 * function with the same power as input can yield different cooling 298 * device states depending on those external factors. 299 * 300 * Return: 0 on success, -ENODEV if no cpus are online or -EINVAL if 301 * the calculated frequency could not be converted to a valid state. 302 * The latter should not happen unless the frequencies available to 303 * cpufreq have changed since the initialization of the cpu cooling 304 * device. 305 */ 306 static int cpufreq_power2state(struct thermal_cooling_device *cdev, 307 u32 power, unsigned long *state) 308 { 309 unsigned int target_freq; 310 u32 last_load, normalised_power; 311 struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata; 312 struct cpufreq_policy *policy = cpufreq_cdev->policy; 313 314 last_load = cpufreq_cdev->last_load ?: 1; 315 normalised_power = (power * 100) / last_load; 316 target_freq = cpu_power_to_freq(cpufreq_cdev, normalised_power); 317 318 *state = get_level(cpufreq_cdev, target_freq); 319 trace_thermal_power_cpu_limit(policy->related_cpus, target_freq, *state, 320 power); 321 return 0; 322 } 323 324 static inline bool em_is_sane(struct cpufreq_cooling_device *cpufreq_cdev, 325 struct em_perf_domain *em) { 326 struct cpufreq_policy *policy; 327 unsigned int nr_levels; 328 329 if (!em || em_is_artificial(em)) 330 return false; 331 332 policy = cpufreq_cdev->policy; 333 if (!cpumask_equal(policy->related_cpus, em_span_cpus(em))) { 334 pr_err("The span of pd %*pbl is misaligned with cpufreq policy %*pbl\n", 335 cpumask_pr_args(em_span_cpus(em)), 336 cpumask_pr_args(policy->related_cpus)); 337 return false; 338 } 339 340 nr_levels = cpufreq_cdev->max_level + 1; 341 if (em_pd_nr_perf_states(em) != nr_levels) { 342 pr_err("The number of performance states in pd %*pbl (%u) doesn't match the number of cooling levels (%u)\n", 343 cpumask_pr_args(em_span_cpus(em)), 344 em_pd_nr_perf_states(em), nr_levels); 345 return false; 346 } 347 348 return true; 349 } 350 #endif /* CONFIG_THERMAL_GOV_POWER_ALLOCATOR */ 351 352 #ifdef CONFIG_SMP 353 static inline int allocate_idle_time(struct cpufreq_cooling_device *cpufreq_cdev) 354 { 355 return 0; 356 } 357 358 static inline void free_idle_time(struct cpufreq_cooling_device *cpufreq_cdev) 359 { 360 } 361 #else 362 static int allocate_idle_time(struct cpufreq_cooling_device *cpufreq_cdev) 363 { 364 unsigned int num_cpus = cpumask_weight(cpufreq_cdev->policy->related_cpus); 365 366 cpufreq_cdev->idle_time = kcalloc(num_cpus, 367 sizeof(*cpufreq_cdev->idle_time), 368 GFP_KERNEL); 369 if (!cpufreq_cdev->idle_time) 370 return -ENOMEM; 371 372 return 0; 373 } 374 375 static void free_idle_time(struct cpufreq_cooling_device *cpufreq_cdev) 376 { 377 kfree(cpufreq_cdev->idle_time); 378 cpufreq_cdev->idle_time = NULL; 379 } 380 #endif /* CONFIG_SMP */ 381 382 static unsigned int get_state_freq(struct cpufreq_cooling_device *cpufreq_cdev, 383 unsigned long state) 384 { 385 struct cpufreq_policy *policy; 386 unsigned long idx; 387 388 #ifdef CONFIG_THERMAL_GOV_POWER_ALLOCATOR 389 /* Use the Energy Model table if available */ 390 if (cpufreq_cdev->em) { 391 idx = cpufreq_cdev->max_level - state; 392 return cpufreq_cdev->em->table[idx].frequency; 393 } 394 #endif 395 396 /* Otherwise, fallback on the CPUFreq table */ 397 policy = cpufreq_cdev->policy; 398 if (policy->freq_table_sorted == CPUFREQ_TABLE_SORTED_ASCENDING) 399 idx = cpufreq_cdev->max_level - state; 400 else 401 idx = state; 402 403 return policy->freq_table[idx].frequency; 404 } 405 406 /* cpufreq cooling device callback functions are defined below */ 407 408 /** 409 * cpufreq_get_max_state - callback function to get the max cooling state. 410 * @cdev: thermal cooling device pointer. 411 * @state: fill this variable with the max cooling state. 412 * 413 * Callback for the thermal cooling device to return the cpufreq 414 * max cooling state. 415 * 416 * Return: 0 on success, an error code otherwise. 417 */ 418 static int cpufreq_get_max_state(struct thermal_cooling_device *cdev, 419 unsigned long *state) 420 { 421 struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata; 422 423 *state = cpufreq_cdev->max_level; 424 return 0; 425 } 426 427 /** 428 * cpufreq_get_cur_state - callback function to get the current cooling state. 429 * @cdev: thermal cooling device pointer. 430 * @state: fill this variable with the current cooling state. 431 * 432 * Callback for the thermal cooling device to return the cpufreq 433 * current cooling state. 434 * 435 * Return: 0 on success, an error code otherwise. 436 */ 437 static int cpufreq_get_cur_state(struct thermal_cooling_device *cdev, 438 unsigned long *state) 439 { 440 struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata; 441 442 *state = cpufreq_cdev->cpufreq_state; 443 444 return 0; 445 } 446 447 /** 448 * cpufreq_set_cur_state - callback function to set the current cooling state. 449 * @cdev: thermal cooling device pointer. 450 * @state: set this variable to the current cooling state. 451 * 452 * Callback for the thermal cooling device to change the cpufreq 453 * current cooling state. 454 * 455 * Return: 0 on success, an error code otherwise. 456 */ 457 static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev, 458 unsigned long state) 459 { 460 struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata; 461 struct cpumask *cpus; 462 unsigned int frequency; 463 int ret; 464 465 /* Request state should be less than max_level */ 466 if (state > cpufreq_cdev->max_level) 467 return -EINVAL; 468 469 /* Check if the old cooling action is same as new cooling action */ 470 if (cpufreq_cdev->cpufreq_state == state) 471 return 0; 472 473 frequency = get_state_freq(cpufreq_cdev, state); 474 475 ret = freq_qos_update_request(&cpufreq_cdev->qos_req, frequency); 476 if (ret >= 0) { 477 cpufreq_cdev->cpufreq_state = state; 478 cpus = cpufreq_cdev->policy->related_cpus; 479 arch_update_thermal_pressure(cpus, frequency); 480 ret = 0; 481 } 482 483 return ret; 484 } 485 486 /* Bind cpufreq callbacks to thermal cooling device ops */ 487 488 static struct thermal_cooling_device_ops cpufreq_cooling_ops = { 489 .get_max_state = cpufreq_get_max_state, 490 .get_cur_state = cpufreq_get_cur_state, 491 .set_cur_state = cpufreq_set_cur_state, 492 }; 493 494 /** 495 * __cpufreq_cooling_register - helper function to create cpufreq cooling device 496 * @np: a valid struct device_node to the cooling device device tree node 497 * @policy: cpufreq policy 498 * Normally this should be same as cpufreq policy->related_cpus. 499 * @em: Energy Model of the cpufreq policy 500 * 501 * This interface function registers the cpufreq cooling device with the name 502 * "thermal-cpufreq-%x". This api can support multiple instances of cpufreq 503 * cooling devices. It also gives the opportunity to link the cooling device 504 * with a device tree node, in order to bind it via the thermal DT code. 505 * 506 * Return: a valid struct thermal_cooling_device pointer on success, 507 * on failure, it returns a corresponding ERR_PTR(). 508 */ 509 static struct thermal_cooling_device * 510 __cpufreq_cooling_register(struct device_node *np, 511 struct cpufreq_policy *policy, 512 struct em_perf_domain *em) 513 { 514 struct thermal_cooling_device *cdev; 515 struct cpufreq_cooling_device *cpufreq_cdev; 516 unsigned int i; 517 struct device *dev; 518 int ret; 519 struct thermal_cooling_device_ops *cooling_ops; 520 char *name; 521 522 dev = get_cpu_device(policy->cpu); 523 if (unlikely(!dev)) { 524 pr_warn("No cpu device for cpu %d\n", policy->cpu); 525 return ERR_PTR(-ENODEV); 526 } 527 528 if (IS_ERR_OR_NULL(policy)) { 529 pr_err("%s: cpufreq policy isn't valid: %p\n", __func__, policy); 530 return ERR_PTR(-EINVAL); 531 } 532 533 i = cpufreq_table_count_valid_entries(policy); 534 if (!i) { 535 pr_debug("%s: CPUFreq table not found or has no valid entries\n", 536 __func__); 537 return ERR_PTR(-ENODEV); 538 } 539 540 cpufreq_cdev = kzalloc(sizeof(*cpufreq_cdev), GFP_KERNEL); 541 if (!cpufreq_cdev) 542 return ERR_PTR(-ENOMEM); 543 544 cpufreq_cdev->policy = policy; 545 546 ret = allocate_idle_time(cpufreq_cdev); 547 if (ret) { 548 cdev = ERR_PTR(ret); 549 goto free_cdev; 550 } 551 552 /* max_level is an index, not a counter */ 553 cpufreq_cdev->max_level = i - 1; 554 555 cooling_ops = &cpufreq_cooling_ops; 556 557 #ifdef CONFIG_THERMAL_GOV_POWER_ALLOCATOR 558 if (em_is_sane(cpufreq_cdev, em)) { 559 cpufreq_cdev->em = em; 560 cooling_ops->get_requested_power = cpufreq_get_requested_power; 561 cooling_ops->state2power = cpufreq_state2power; 562 cooling_ops->power2state = cpufreq_power2state; 563 } else 564 #endif 565 if (policy->freq_table_sorted == CPUFREQ_TABLE_UNSORTED) { 566 pr_err("%s: unsorted frequency tables are not supported\n", 567 __func__); 568 cdev = ERR_PTR(-EINVAL); 569 goto free_idle_time; 570 } 571 572 ret = freq_qos_add_request(&policy->constraints, 573 &cpufreq_cdev->qos_req, FREQ_QOS_MAX, 574 get_state_freq(cpufreq_cdev, 0)); 575 if (ret < 0) { 576 pr_err("%s: Failed to add freq constraint (%d)\n", __func__, 577 ret); 578 cdev = ERR_PTR(ret); 579 goto free_idle_time; 580 } 581 582 cdev = ERR_PTR(-ENOMEM); 583 name = kasprintf(GFP_KERNEL, "cpufreq-%s", dev_name(dev)); 584 if (!name) 585 goto remove_qos_req; 586 587 cdev = thermal_of_cooling_device_register(np, name, cpufreq_cdev, 588 cooling_ops); 589 kfree(name); 590 591 if (IS_ERR(cdev)) 592 goto remove_qos_req; 593 594 return cdev; 595 596 remove_qos_req: 597 freq_qos_remove_request(&cpufreq_cdev->qos_req); 598 free_idle_time: 599 free_idle_time(cpufreq_cdev); 600 free_cdev: 601 kfree(cpufreq_cdev); 602 return cdev; 603 } 604 605 /** 606 * cpufreq_cooling_register - function to create cpufreq cooling device. 607 * @policy: cpufreq policy 608 * 609 * This interface function registers the cpufreq cooling device with the name 610 * "thermal-cpufreq-%x". This api can support multiple instances of cpufreq 611 * cooling devices. 612 * 613 * Return: a valid struct thermal_cooling_device pointer on success, 614 * on failure, it returns a corresponding ERR_PTR(). 615 */ 616 struct thermal_cooling_device * 617 cpufreq_cooling_register(struct cpufreq_policy *policy) 618 { 619 return __cpufreq_cooling_register(NULL, policy, NULL); 620 } 621 EXPORT_SYMBOL_GPL(cpufreq_cooling_register); 622 623 /** 624 * of_cpufreq_cooling_register - function to create cpufreq cooling device. 625 * @policy: cpufreq policy 626 * 627 * This interface function registers the cpufreq cooling device with the name 628 * "thermal-cpufreq-%x". This api can support multiple instances of cpufreq 629 * cooling devices. Using this API, the cpufreq cooling device will be 630 * linked to the device tree node provided. 631 * 632 * Using this function, the cooling device will implement the power 633 * extensions by using a simple cpu power model. The cpus must have 634 * registered their OPPs using the OPP library. 635 * 636 * It also takes into account, if property present in policy CPU node, the 637 * static power consumed by the cpu. 638 * 639 * Return: a valid struct thermal_cooling_device pointer on success, 640 * and NULL on failure. 641 */ 642 struct thermal_cooling_device * 643 of_cpufreq_cooling_register(struct cpufreq_policy *policy) 644 { 645 struct device_node *np = of_get_cpu_node(policy->cpu, NULL); 646 struct thermal_cooling_device *cdev = NULL; 647 648 if (!np) { 649 pr_err("cpufreq_cooling: OF node not available for cpu%d\n", 650 policy->cpu); 651 return NULL; 652 } 653 654 if (of_find_property(np, "#cooling-cells", NULL)) { 655 struct em_perf_domain *em = em_cpu_get(policy->cpu); 656 657 cdev = __cpufreq_cooling_register(np, policy, em); 658 if (IS_ERR(cdev)) { 659 pr_err("cpufreq_cooling: cpu%d failed to register as cooling device: %ld\n", 660 policy->cpu, PTR_ERR(cdev)); 661 cdev = NULL; 662 } 663 } 664 665 of_node_put(np); 666 return cdev; 667 } 668 EXPORT_SYMBOL_GPL(of_cpufreq_cooling_register); 669 670 /** 671 * cpufreq_cooling_unregister - function to remove cpufreq cooling device. 672 * @cdev: thermal cooling device pointer. 673 * 674 * This interface function unregisters the "thermal-cpufreq-%x" cooling device. 675 */ 676 void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) 677 { 678 struct cpufreq_cooling_device *cpufreq_cdev; 679 680 if (!cdev) 681 return; 682 683 cpufreq_cdev = cdev->devdata; 684 685 thermal_cooling_device_unregister(cdev); 686 freq_qos_remove_request(&cpufreq_cdev->qos_req); 687 free_idle_time(cpufreq_cdev); 688 kfree(cpufreq_cdev); 689 } 690 EXPORT_SYMBOL_GPL(cpufreq_cooling_unregister); 691