| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * linux/include/linux/cpufreq.h |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2001 Russell King |
|---|
| 5 | 6 | * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de> |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 8 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 9 | | - * published by the Free Software Foundation. |
|---|
| 10 | 7 | */ |
|---|
| 11 | 8 | #ifndef _LINUX_CPUFREQ_H |
|---|
| 12 | 9 | #define _LINUX_CPUFREQ_H |
|---|
| .. | .. |
|---|
| 16 | 13 | #include <linux/completion.h> |
|---|
| 17 | 14 | #include <linux/kobject.h> |
|---|
| 18 | 15 | #include <linux/notifier.h> |
|---|
| 16 | +#include <linux/pm_qos.h> |
|---|
| 19 | 17 | #include <linux/spinlock.h> |
|---|
| 20 | 18 | #include <linux/sysfs.h> |
|---|
| 21 | 19 | |
|---|
| .. | .. |
|---|
| 42 | 40 | CPUFREQ_TABLE_SORTED_DESCENDING |
|---|
| 43 | 41 | }; |
|---|
| 44 | 42 | |
|---|
| 45 | | -struct cpufreq_freqs { |
|---|
| 46 | | - unsigned int cpu; /* cpu nr */ |
|---|
| 47 | | - unsigned int old; |
|---|
| 48 | | - unsigned int new; |
|---|
| 49 | | - u8 flags; /* flags of cpufreq_driver, see below. */ |
|---|
| 50 | | -}; |
|---|
| 51 | | - |
|---|
| 52 | 43 | struct cpufreq_cpuinfo { |
|---|
| 53 | 44 | unsigned int max_freq; |
|---|
| 54 | 45 | unsigned int min_freq; |
|---|
| 55 | 46 | |
|---|
| 56 | 47 | /* in 10^(-9) s = nanoseconds */ |
|---|
| 57 | 48 | unsigned int transition_latency; |
|---|
| 58 | | -}; |
|---|
| 59 | | - |
|---|
| 60 | | -struct cpufreq_user_policy { |
|---|
| 61 | | - unsigned int min; /* in kHz */ |
|---|
| 62 | | - unsigned int max; /* in kHz */ |
|---|
| 63 | 49 | }; |
|---|
| 64 | 50 | |
|---|
| 65 | 51 | struct cpufreq_policy { |
|---|
| .. | .. |
|---|
| 91 | 77 | struct work_struct update; /* if update_policy() needs to be |
|---|
| 92 | 78 | * called, but you're in IRQ context */ |
|---|
| 93 | 79 | |
|---|
| 94 | | - struct cpufreq_user_policy user_policy; |
|---|
| 80 | + struct freq_constraints constraints; |
|---|
| 81 | + struct freq_qos_request *min_freq_req; |
|---|
| 82 | + struct freq_qos_request *max_freq_req; |
|---|
| 83 | + |
|---|
| 95 | 84 | struct cpufreq_frequency_table *freq_table; |
|---|
| 96 | 85 | enum cpufreq_table_sorting freq_table_sorted; |
|---|
| 97 | 86 | |
|---|
| .. | .. |
|---|
| 121 | 110 | bool fast_switch_enabled; |
|---|
| 122 | 111 | |
|---|
| 123 | 112 | /* |
|---|
| 113 | + * Set if the CPUFREQ_GOV_STRICT_TARGET flag is set for the current |
|---|
| 114 | + * governor. |
|---|
| 115 | + */ |
|---|
| 116 | + bool strict_target; |
|---|
| 117 | + |
|---|
| 118 | + /* |
|---|
| 124 | 119 | * Preferred average time interval between consecutive invocations of |
|---|
| 125 | 120 | * the driver to set the frequency for this policy. To be set by the |
|---|
| 126 | 121 | * scaling driver (0, which is the default, means no preference). |
|---|
| .. | .. |
|---|
| 138 | 133 | |
|---|
| 139 | 134 | /* Cached frequency lookup from cpufreq_driver_resolve_freq. */ |
|---|
| 140 | 135 | unsigned int cached_target_freq; |
|---|
| 141 | | - int cached_resolved_idx; |
|---|
| 136 | + unsigned int cached_resolved_idx; |
|---|
| 142 | 137 | |
|---|
| 143 | 138 | /* Synchronization for frequency transitions */ |
|---|
| 144 | 139 | bool transition_ongoing; /* Tracks transition status */ |
|---|
| .. | .. |
|---|
| 154 | 149 | |
|---|
| 155 | 150 | /* Pointer to the cooling device if used for thermal mitigation */ |
|---|
| 156 | 151 | struct thermal_cooling_device *cdev; |
|---|
| 152 | + |
|---|
| 153 | + struct notifier_block nb_min; |
|---|
| 154 | + struct notifier_block nb_max; |
|---|
| 155 | +}; |
|---|
| 156 | + |
|---|
| 157 | +/* |
|---|
| 158 | + * Used for passing new cpufreq policy data to the cpufreq driver's ->verify() |
|---|
| 159 | + * callback for sanitization. That callback is only expected to modify the min |
|---|
| 160 | + * and max values, if necessary, and specifically it must not update the |
|---|
| 161 | + * frequency table. |
|---|
| 162 | + */ |
|---|
| 163 | +struct cpufreq_policy_data { |
|---|
| 164 | + struct cpufreq_cpuinfo cpuinfo; |
|---|
| 165 | + struct cpufreq_frequency_table *freq_table; |
|---|
| 166 | + unsigned int cpu; |
|---|
| 167 | + unsigned int min; /* in kHz */ |
|---|
| 168 | + unsigned int max; /* in kHz */ |
|---|
| 169 | +}; |
|---|
| 170 | + |
|---|
| 171 | +struct cpufreq_freqs { |
|---|
| 172 | + struct cpufreq_policy *policy; |
|---|
| 173 | + unsigned int old; |
|---|
| 174 | + unsigned int new; |
|---|
| 175 | + u8 flags; /* flags of cpufreq_driver, see below. */ |
|---|
| 157 | 176 | }; |
|---|
| 158 | 177 | |
|---|
| 159 | 178 | /* Only for ACPI */ |
|---|
| .. | .. |
|---|
| 178 | 197 | static inline void cpufreq_cpu_put(struct cpufreq_policy *policy) { } |
|---|
| 179 | 198 | #endif |
|---|
| 180 | 199 | |
|---|
| 200 | +static inline bool policy_is_inactive(struct cpufreq_policy *policy) |
|---|
| 201 | +{ |
|---|
| 202 | + return cpumask_empty(policy->cpus); |
|---|
| 203 | +} |
|---|
| 204 | + |
|---|
| 181 | 205 | static inline bool policy_is_shared(struct cpufreq_policy *policy) |
|---|
| 182 | 206 | { |
|---|
| 183 | 207 | return cpumask_weight(policy->cpus) > 1; |
|---|
| 184 | 208 | } |
|---|
| 185 | 209 | |
|---|
| 186 | | -/* /sys/devices/system/cpu/cpufreq: entry point for global variables */ |
|---|
| 187 | | -extern struct kobject *cpufreq_global_kobject; |
|---|
| 188 | | - |
|---|
| 189 | 210 | #ifdef CONFIG_CPU_FREQ |
|---|
| 190 | 211 | unsigned int cpufreq_get(unsigned int cpu); |
|---|
| 191 | 212 | unsigned int cpufreq_quick_get(unsigned int cpu); |
|---|
| 192 | 213 | unsigned int cpufreq_quick_get_max(unsigned int cpu); |
|---|
| 214 | +unsigned int cpufreq_get_hw_max_freq(unsigned int cpu); |
|---|
| 193 | 215 | void disable_cpufreq(void); |
|---|
| 194 | 216 | |
|---|
| 195 | 217 | u64 get_cpu_idle_time(unsigned int cpu, u64 *wall, int io_busy); |
|---|
| 218 | + |
|---|
| 219 | +struct cpufreq_policy *cpufreq_cpu_acquire(unsigned int cpu); |
|---|
| 220 | +void cpufreq_cpu_release(struct cpufreq_policy *policy); |
|---|
| 196 | 221 | int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu); |
|---|
| 222 | +void refresh_frequency_limits(struct cpufreq_policy *policy); |
|---|
| 197 | 223 | void cpufreq_update_policy(unsigned int cpu); |
|---|
| 224 | +void cpufreq_update_limits(unsigned int cpu); |
|---|
| 198 | 225 | bool have_governor_per_policy(void); |
|---|
| 226 | +bool cpufreq_supports_freq_invariance(void); |
|---|
| 199 | 227 | struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy); |
|---|
| 200 | 228 | void cpufreq_enable_fast_switch(struct cpufreq_policy *policy); |
|---|
| 201 | 229 | void cpufreq_disable_fast_switch(struct cpufreq_policy *policy); |
|---|
| .. | .. |
|---|
| 212 | 240 | { |
|---|
| 213 | 241 | return 0; |
|---|
| 214 | 242 | } |
|---|
| 243 | +static inline unsigned int cpufreq_get_hw_max_freq(unsigned int cpu) |
|---|
| 244 | +{ |
|---|
| 245 | + return 0; |
|---|
| 246 | +} |
|---|
| 247 | +static inline bool cpufreq_supports_freq_invariance(void) |
|---|
| 248 | +{ |
|---|
| 249 | + return false; |
|---|
| 250 | +} |
|---|
| 215 | 251 | static inline void disable_cpufreq(void) { } |
|---|
| 216 | | -static inline void cpufreq_update_policy(unsigned int cpu) { } |
|---|
| 217 | 252 | #endif |
|---|
| 218 | 253 | |
|---|
| 219 | 254 | #ifdef CONFIG_CPU_FREQ_STAT |
|---|
| .. | .. |
|---|
| 269 | 304 | |
|---|
| 270 | 305 | struct cpufreq_driver { |
|---|
| 271 | 306 | char name[CPUFREQ_NAME_LEN]; |
|---|
| 272 | | - u8 flags; |
|---|
| 307 | + u16 flags; |
|---|
| 273 | 308 | void *driver_data; |
|---|
| 274 | 309 | |
|---|
| 275 | 310 | /* needed by all drivers */ |
|---|
| 276 | 311 | int (*init)(struct cpufreq_policy *policy); |
|---|
| 277 | | - int (*verify)(struct cpufreq_policy *policy); |
|---|
| 312 | + int (*verify)(struct cpufreq_policy_data *policy); |
|---|
| 278 | 313 | |
|---|
| 279 | 314 | /* define one out of two */ |
|---|
| 280 | 315 | int (*setpolicy)(struct cpufreq_policy *policy); |
|---|
| .. | .. |
|---|
| 306 | 341 | * |
|---|
| 307 | 342 | * get_intermediate should return a stable intermediate frequency |
|---|
| 308 | 343 | * platform wants to switch to and target_intermediate() should set CPU |
|---|
| 309 | | - * to to that frequency, before jumping to the frequency corresponding |
|---|
| 344 | + * to that frequency, before jumping to the frequency corresponding |
|---|
| 310 | 345 | * to 'index'. Core will take care of sending notifications and driver |
|---|
| 311 | 346 | * doesn't have to handle them in target_intermediate() or |
|---|
| 312 | 347 | * target_index(). |
|---|
| .. | .. |
|---|
| 323 | 358 | /* should be defined, if possible */ |
|---|
| 324 | 359 | unsigned int (*get)(unsigned int cpu); |
|---|
| 325 | 360 | |
|---|
| 361 | + /* Called to update policy limits on firmware notifications. */ |
|---|
| 362 | + void (*update_limits)(unsigned int cpu); |
|---|
| 363 | + |
|---|
| 326 | 364 | /* optional */ |
|---|
| 327 | 365 | int (*bios_limit)(int cpu, unsigned int *limit); |
|---|
| 328 | 366 | |
|---|
| 367 | + int (*online)(struct cpufreq_policy *policy); |
|---|
| 368 | + int (*offline)(struct cpufreq_policy *policy); |
|---|
| 329 | 369 | int (*exit)(struct cpufreq_policy *policy); |
|---|
| 330 | 370 | void (*stop_cpu)(struct cpufreq_policy *policy); |
|---|
| 331 | 371 | int (*suspend)(struct cpufreq_policy *policy); |
|---|
| .. | .. |
|---|
| 338 | 378 | |
|---|
| 339 | 379 | /* platform specific boost support code */ |
|---|
| 340 | 380 | bool boost_enabled; |
|---|
| 341 | | - int (*set_boost)(int state); |
|---|
| 381 | + int (*set_boost)(struct cpufreq_policy *policy, int state); |
|---|
| 342 | 382 | }; |
|---|
| 343 | 383 | |
|---|
| 344 | 384 | /* flags */ |
|---|
| 345 | | -#define CPUFREQ_STICKY (1 << 0) /* driver isn't removed even if |
|---|
| 346 | | - all ->init() calls failed */ |
|---|
| 347 | | -#define CPUFREQ_CONST_LOOPS (1 << 1) /* loops_per_jiffy or other |
|---|
| 348 | | - kernel "constants" aren't |
|---|
| 349 | | - affected by frequency |
|---|
| 350 | | - transitions */ |
|---|
| 351 | | -#define CPUFREQ_PM_NO_WARN (1 << 2) /* don't warn on suspend/resume |
|---|
| 352 | | - speed mismatches */ |
|---|
| 385 | + |
|---|
| 386 | +/* driver isn't removed even if all ->init() calls failed */ |
|---|
| 387 | +#define CPUFREQ_STICKY BIT(0) |
|---|
| 388 | + |
|---|
| 389 | +/* loops_per_jiffy or other kernel "constants" aren't affected by frequency transitions */ |
|---|
| 390 | +#define CPUFREQ_CONST_LOOPS BIT(1) |
|---|
| 391 | + |
|---|
| 392 | +/* don't warn on suspend/resume speed mismatches */ |
|---|
| 393 | +#define CPUFREQ_PM_NO_WARN BIT(2) |
|---|
| 353 | 394 | |
|---|
| 354 | 395 | /* |
|---|
| 355 | 396 | * This should be set by platforms having multiple clock-domains, i.e. |
|---|
| .. | .. |
|---|
| 357 | 398 | * be created in cpu/cpu<num>/cpufreq/ directory and so they can use the same |
|---|
| 358 | 399 | * governor with different tunables for different clusters. |
|---|
| 359 | 400 | */ |
|---|
| 360 | | -#define CPUFREQ_HAVE_GOVERNOR_PER_POLICY (1 << 3) |
|---|
| 401 | +#define CPUFREQ_HAVE_GOVERNOR_PER_POLICY BIT(3) |
|---|
| 361 | 402 | |
|---|
| 362 | 403 | /* |
|---|
| 363 | 404 | * Driver will do POSTCHANGE notifications from outside of their ->target() |
|---|
| 364 | 405 | * routine and so must set cpufreq_driver->flags with this flag, so that core |
|---|
| 365 | 406 | * can handle them specially. |
|---|
| 366 | 407 | */ |
|---|
| 367 | | -#define CPUFREQ_ASYNC_NOTIFICATION (1 << 4) |
|---|
| 408 | +#define CPUFREQ_ASYNC_NOTIFICATION BIT(4) |
|---|
| 368 | 409 | |
|---|
| 369 | 410 | /* |
|---|
| 370 | 411 | * Set by drivers which want cpufreq core to check if CPU is running at a |
|---|
| .. | .. |
|---|
| 373 | 414 | * from the table. And if that fails, we will stop further boot process by |
|---|
| 374 | 415 | * issuing a BUG_ON(). |
|---|
| 375 | 416 | */ |
|---|
| 376 | | -#define CPUFREQ_NEED_INITIAL_FREQ_CHECK (1 << 5) |
|---|
| 417 | +#define CPUFREQ_NEED_INITIAL_FREQ_CHECK BIT(5) |
|---|
| 377 | 418 | |
|---|
| 378 | 419 | /* |
|---|
| 379 | 420 | * Set by drivers to disallow use of governors with "dynamic_switching" flag |
|---|
| 380 | 421 | * set. |
|---|
| 381 | 422 | */ |
|---|
| 382 | | -#define CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING (1 << 6) |
|---|
| 423 | +#define CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING BIT(6) |
|---|
| 383 | 424 | |
|---|
| 384 | 425 | /* |
|---|
| 385 | 426 | * Set by drivers that want the core to automatically register the cpufreq |
|---|
| .. | .. |
|---|
| 387 | 428 | */ |
|---|
| 388 | 429 | #define CPUFREQ_IS_COOLING_DEV BIT(7) |
|---|
| 389 | 430 | |
|---|
| 431 | +/* |
|---|
| 432 | + * Set by drivers that need to update internale upper and lower boundaries along |
|---|
| 433 | + * with the target frequency and so the core and governors should also invoke |
|---|
| 434 | + * the diver if the target frequency does not change, but the policy min or max |
|---|
| 435 | + * may have changed. |
|---|
| 436 | + */ |
|---|
| 437 | +#define CPUFREQ_NEED_UPDATE_LIMITS BIT(8) |
|---|
| 438 | + |
|---|
| 390 | 439 | int cpufreq_register_driver(struct cpufreq_driver *driver_data); |
|---|
| 391 | 440 | int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); |
|---|
| 392 | 441 | |
|---|
| 442 | +bool cpufreq_driver_test_flags(u16 flags); |
|---|
| 393 | 443 | const char *cpufreq_get_current_driver(void); |
|---|
| 394 | 444 | void *cpufreq_get_driver_data(void); |
|---|
| 395 | 445 | |
|---|
| 396 | | -static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy, |
|---|
| 397 | | - unsigned int min, unsigned int max) |
|---|
| 446 | +static inline int cpufreq_thermal_control_enabled(struct cpufreq_driver *drv) |
|---|
| 447 | +{ |
|---|
| 448 | + return IS_ENABLED(CONFIG_CPU_THERMAL) && |
|---|
| 449 | + (drv->flags & CPUFREQ_IS_COOLING_DEV); |
|---|
| 450 | +} |
|---|
| 451 | + |
|---|
| 452 | +static inline void cpufreq_verify_within_limits(struct cpufreq_policy_data *policy, |
|---|
| 453 | + unsigned int min, |
|---|
| 454 | + unsigned int max) |
|---|
| 398 | 455 | { |
|---|
| 399 | 456 | if (policy->min < min) |
|---|
| 400 | 457 | policy->min = min; |
|---|
| .. | .. |
|---|
| 410 | 467 | } |
|---|
| 411 | 468 | |
|---|
| 412 | 469 | static inline void |
|---|
| 413 | | -cpufreq_verify_within_cpu_limits(struct cpufreq_policy *policy) |
|---|
| 470 | +cpufreq_verify_within_cpu_limits(struct cpufreq_policy_data *policy) |
|---|
| 414 | 471 | { |
|---|
| 415 | 472 | cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, |
|---|
| 416 | | - policy->cpuinfo.max_freq); |
|---|
| 473 | + policy->cpuinfo.max_freq); |
|---|
| 417 | 474 | } |
|---|
| 418 | 475 | |
|---|
| 419 | 476 | #ifdef CONFIG_CPU_FREQ |
|---|
| .. | .. |
|---|
| 437 | 494 | #define CPUFREQ_POSTCHANGE (1) |
|---|
| 438 | 495 | |
|---|
| 439 | 496 | /* Policy Notifiers */ |
|---|
| 440 | | -#define CPUFREQ_ADJUST (0) |
|---|
| 441 | | -#define CPUFREQ_NOTIFY (1) |
|---|
| 497 | +#define CPUFREQ_CREATE_POLICY (0) |
|---|
| 498 | +#define CPUFREQ_REMOVE_POLICY (1) |
|---|
| 442 | 499 | |
|---|
| 443 | 500 | #ifdef CONFIG_CPU_FREQ |
|---|
| 444 | 501 | int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list); |
|---|
| .. | .. |
|---|
| 491 | 548 | * CPUFREQ GOVERNORS * |
|---|
| 492 | 549 | *********************************************************************/ |
|---|
| 493 | 550 | |
|---|
| 551 | +#define CPUFREQ_POLICY_UNKNOWN (0) |
|---|
| 494 | 552 | /* |
|---|
| 495 | 553 | * If (cpufreq_driver->target) exists, the ->governor decides what frequency |
|---|
| 496 | 554 | * within the limits is used. If (cpufreq_driver->setpolicy> exists, these |
|---|
| .. | .. |
|---|
| 518 | 576 | char *buf); |
|---|
| 519 | 577 | int (*store_setspeed) (struct cpufreq_policy *policy, |
|---|
| 520 | 578 | unsigned int freq); |
|---|
| 521 | | - /* For governors which change frequency dynamically by themselves */ |
|---|
| 522 | | - bool dynamic_switching; |
|---|
| 523 | 579 | struct list_head governor_list; |
|---|
| 524 | 580 | struct module *owner; |
|---|
| 581 | + u8 flags; |
|---|
| 525 | 582 | }; |
|---|
| 583 | + |
|---|
| 584 | +/* Governor flags */ |
|---|
| 585 | + |
|---|
| 586 | +/* For governors which change frequency dynamically by themselves */ |
|---|
| 587 | +#define CPUFREQ_GOV_DYNAMIC_SWITCHING BIT(0) |
|---|
| 588 | + |
|---|
| 589 | +/* For governors wanting the target frequency to be set exactly */ |
|---|
| 590 | +#define CPUFREQ_GOV_STRICT_TARGET BIT(1) |
|---|
| 591 | + |
|---|
| 526 | 592 | |
|---|
| 527 | 593 | /* Pass a target to the cpufreq driver */ |
|---|
| 528 | 594 | unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy, |
|---|
| .. | .. |
|---|
| 538 | 604 | unsigned int cpufreq_policy_transition_delay_us(struct cpufreq_policy *policy); |
|---|
| 539 | 605 | int cpufreq_register_governor(struct cpufreq_governor *governor); |
|---|
| 540 | 606 | void cpufreq_unregister_governor(struct cpufreq_governor *governor); |
|---|
| 607 | +int cpufreq_start_governor(struct cpufreq_policy *policy); |
|---|
| 608 | +void cpufreq_stop_governor(struct cpufreq_policy *policy); |
|---|
| 609 | + |
|---|
| 610 | +#define cpufreq_governor_init(__governor) \ |
|---|
| 611 | +static int __init __governor##_init(void) \ |
|---|
| 612 | +{ \ |
|---|
| 613 | + return cpufreq_register_governor(&__governor); \ |
|---|
| 614 | +} \ |
|---|
| 615 | +core_initcall(__governor##_init) |
|---|
| 616 | + |
|---|
| 617 | +#define cpufreq_governor_exit(__governor) \ |
|---|
| 618 | +static void __exit __governor##_exit(void) \ |
|---|
| 619 | +{ \ |
|---|
| 620 | + return cpufreq_unregister_governor(&__governor); \ |
|---|
| 621 | +} \ |
|---|
| 622 | +module_exit(__governor##_exit) |
|---|
| 541 | 623 | |
|---|
| 542 | 624 | struct cpufreq_governor *cpufreq_default_governor(void); |
|---|
| 543 | 625 | struct cpufreq_governor *cpufreq_fallback_governor(void); |
|---|
| .. | .. |
|---|
| 662 | 744 | int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy, |
|---|
| 663 | 745 | struct cpufreq_frequency_table *table); |
|---|
| 664 | 746 | |
|---|
| 665 | | -int cpufreq_frequency_table_verify(struct cpufreq_policy *policy, |
|---|
| 747 | +int cpufreq_frequency_table_verify(struct cpufreq_policy_data *policy, |
|---|
| 666 | 748 | struct cpufreq_frequency_table *table); |
|---|
| 667 | | -int cpufreq_generic_frequency_table_verify(struct cpufreq_policy *policy); |
|---|
| 749 | +int cpufreq_generic_frequency_table_verify(struct cpufreq_policy_data *policy); |
|---|
| 668 | 750 | |
|---|
| 669 | 751 | int cpufreq_table_index_unsorted(struct cpufreq_policy *policy, |
|---|
| 670 | 752 | unsigned int target_freq, |
|---|
| .. | .. |
|---|
| 902 | 984 | case CPUFREQ_RELATION_C: |
|---|
| 903 | 985 | return cpufreq_table_find_index_c(policy, target_freq); |
|---|
| 904 | 986 | default: |
|---|
| 905 | | - pr_err("%s: Invalid relation: %d\n", __func__, relation); |
|---|
| 906 | | - return -EINVAL; |
|---|
| 987 | + WARN_ON_ONCE(1); |
|---|
| 988 | + return 0; |
|---|
| 907 | 989 | } |
|---|
| 908 | 990 | } |
|---|
| 909 | 991 | |
|---|
| .. | .. |
|---|
| 941 | 1023 | } |
|---|
| 942 | 1024 | #endif |
|---|
| 943 | 1025 | |
|---|
| 944 | | -#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) |
|---|
| 945 | | -void sched_cpufreq_governor_change(struct cpufreq_policy *policy, |
|---|
| 946 | | - struct cpufreq_governor *old_gov); |
|---|
| 947 | | -#else |
|---|
| 948 | | -static inline void sched_cpufreq_governor_change(struct cpufreq_policy *policy, |
|---|
| 949 | | - struct cpufreq_governor *old_gov) { } |
|---|
| 950 | | -#endif |
|---|
| 951 | | - |
|---|
| 952 | | -#if defined(CONFIG_ARCH_ROCKCHIP) && defined(CONFIG_CPU_FREQ_GOV_INTERACTIVE) |
|---|
| 953 | | -void cpufreq_task_boost(int cpu, unsigned long util); |
|---|
| 954 | | -#else |
|---|
| 955 | | -static inline void cpufreq_task_boost(int cpu, unsigned long util) |
|---|
| 956 | | -{ |
|---|
| 957 | | -} |
|---|
| 958 | | -#endif |
|---|
| 959 | | - |
|---|
| 960 | 1026 | extern void arch_freq_prepare_all(void); |
|---|
| 961 | 1027 | extern unsigned int arch_freq_get_on_cpu(int cpu); |
|---|
| 962 | 1028 | |
|---|
| 963 | | -extern void arch_set_freq_scale(struct cpumask *cpus, unsigned long cur_freq, |
|---|
| 964 | | - unsigned long max_freq); |
|---|
| 965 | | -extern void arch_set_max_freq_scale(struct cpumask *cpus, |
|---|
| 966 | | - unsigned long policy_max_freq); |
|---|
| 1029 | +#ifndef arch_set_freq_scale |
|---|
| 1030 | +static __always_inline |
|---|
| 1031 | +void arch_set_freq_scale(const struct cpumask *cpus, |
|---|
| 1032 | + unsigned long cur_freq, |
|---|
| 1033 | + unsigned long max_freq) |
|---|
| 1034 | +{ |
|---|
| 1035 | +} |
|---|
| 1036 | +#endif |
|---|
| 967 | 1037 | |
|---|
| 968 | 1038 | /* the following are really really optional */ |
|---|
| 969 | 1039 | extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs; |
|---|
| .. | .. |
|---|
| 972 | 1042 | int cpufreq_table_validate_and_sort(struct cpufreq_policy *policy); |
|---|
| 973 | 1043 | |
|---|
| 974 | 1044 | unsigned int cpufreq_generic_get(unsigned int cpu); |
|---|
| 975 | | -int cpufreq_generic_init(struct cpufreq_policy *policy, |
|---|
| 1045 | +void cpufreq_generic_init(struct cpufreq_policy *policy, |
|---|
| 976 | 1046 | struct cpufreq_frequency_table *table, |
|---|
| 977 | 1047 | unsigned int transition_latency); |
|---|
| 978 | 1048 | #endif /* _LINUX_CPUFREQ_H */ |
|---|