include/linux/cpufreq.h
Source file repositories/reference/linux-study-clean/include/linux/cpufreq.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/cpufreq.h- Extension
.h- Size
- 37581 bytes
- Lines
- 1254
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/clk.hlinux/cpu.hlinux/cpumask.hlinux/completion.hlinux/kobject.hlinux/notifier.hlinux/of.hlinux/pm_opp.hlinux/pm_qos.hlinux/spinlock.hlinux/sysfs.hlinux/minmax.h
Detected Declarations
struct cpufreq_governorstruct cpufreq_cpuinfostruct cpufreq_policystruct cpufreq_policy_datastruct cpufreq_freqsstruct freq_attrstruct cpufreq_driverstruct cpufreq_governorstruct gov_attr_setstruct governor_attrstruct cpufreq_frequency_tableenum cpufreq_table_sortingfunction cpufreq_cpu_putfunction policy_is_sharedfunction cpufreq_get_pressurefunction cpufreq_getfunction cpufreq_quick_getfunction cpufreq_quick_get_maxfunction cpufreq_get_hw_max_freqfunction cpufreq_supports_freq_invariancefunction disable_cpufreqfunction cpufreq_stats_create_tablefunction cpufreq_thermal_control_enabledfunction cpufreq_verify_within_limitsfunction cpufreq_verify_within_cpu_limitsfunction cpufreq_suspendfunction cpufreq_register_notifierfunction cpufreq_unregister_notifierfunction cpufreq_scalefunction sugov_is_governorfunction cpufreq_policy_apply_limitsfunction cpufreq_table_find_index_alfunction cpufreq_for_each_efficient_entry_idxfunction cpufreq_table_find_index_dlfunction cpufreq_for_each_efficient_entry_idxfunction find_index_lfunction cpufreq_table_find_index_lfunction cpufreq_table_find_index_ahfunction cpufreq_for_each_efficient_entry_idxfunction cpufreq_table_find_index_dhfunction cpufreq_for_each_efficient_entry_idxfunction find_index_hfunction cpufreq_table_find_index_hfunction cpufreq_table_find_index_acfunction cpufreq_for_each_efficient_entry_idxfunction cpufreq_table_find_index_dcfunction cpufreq_for_each_efficient_entry_idxfunction find_index_c
Annotated Snippet
core_initcall(__governor##_init)
#define cpufreq_governor_exit(__governor) \
static void __exit __governor##_exit(void) \
{ \
return cpufreq_unregister_governor(&__governor); \
} \
module_exit(__governor##_exit)
struct cpufreq_governor *cpufreq_default_governor(void);
struct cpufreq_governor *cpufreq_fallback_governor(void);
#ifdef CONFIG_CPU_FREQ_GOV_SCHEDUTIL
bool sugov_is_governor(struct cpufreq_policy *policy);
#else
static inline bool sugov_is_governor(struct cpufreq_policy *policy)
{
return false;
}
#endif
static inline void cpufreq_policy_apply_limits(struct cpufreq_policy *policy)
{
if (policy->max < policy->cur)
__cpufreq_driver_target(policy, policy->max,
CPUFREQ_RELATION_HE);
else if (policy->min > policy->cur)
__cpufreq_driver_target(policy, policy->min,
CPUFREQ_RELATION_LE);
}
/* Governor attribute set */
struct gov_attr_set {
struct kobject kobj;
struct list_head policy_list;
struct mutex update_lock;
int usage_count;
};
/* sysfs ops for cpufreq governors */
extern const struct sysfs_ops governor_sysfs_ops;
static inline struct gov_attr_set *to_gov_attr_set(struct kobject *kobj)
{
return container_of(kobj, struct gov_attr_set, kobj);
}
void gov_attr_set_init(struct gov_attr_set *attr_set, struct list_head *list_node);
void gov_attr_set_get(struct gov_attr_set *attr_set, struct list_head *list_node);
unsigned int gov_attr_set_put(struct gov_attr_set *attr_set, struct list_head *list_node);
/* Governor sysfs attribute */
struct governor_attr {
struct attribute attr;
ssize_t (*show)(struct gov_attr_set *attr_set, char *buf);
ssize_t (*store)(struct gov_attr_set *attr_set, const char *buf,
size_t count);
};
/*********************************************************************
* FREQUENCY TABLE HELPERS *
*********************************************************************/
/* Special Values of .frequency field */
#define CPUFREQ_ENTRY_INVALID ~0u
#define CPUFREQ_TABLE_END ~1u
/* Special Values of .flags field */
#define CPUFREQ_BOOST_FREQ (1 << 0)
#define CPUFREQ_INEFFICIENT_FREQ (1 << 1)
struct cpufreq_frequency_table {
unsigned int flags;
unsigned int driver_data; /* driver specific data, not used by core */
unsigned int frequency; /* kHz - doesn't need to be in ascending
* order */
};
/*
* cpufreq_for_each_entry - iterate over a cpufreq_frequency_table
* @pos: the cpufreq_frequency_table * to use as a loop cursor.
* @table: the cpufreq_frequency_table * to iterate over.
*/
#define cpufreq_for_each_entry(pos, table) \
for (pos = table; pos->frequency != CPUFREQ_TABLE_END; pos++)
/*
* cpufreq_for_each_entry_idx - iterate over a cpufreq_frequency_table
* with index
* @pos: the cpufreq_frequency_table * to use as a loop cursor.
Annotation
- Immediate include surface: `linux/clk.h`, `linux/cpu.h`, `linux/cpumask.h`, `linux/completion.h`, `linux/kobject.h`, `linux/notifier.h`, `linux/of.h`, `linux/pm_opp.h`.
- Detected declarations: `struct cpufreq_governor`, `struct cpufreq_cpuinfo`, `struct cpufreq_policy`, `struct cpufreq_policy_data`, `struct cpufreq_freqs`, `struct freq_attr`, `struct cpufreq_driver`, `struct cpufreq_governor`, `struct gov_attr_set`, `struct governor_attr`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: integration implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.