include/linux/devfreq.h
Source file repositories/reference/linux-study-clean/include/linux/devfreq.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/devfreq.h- Extension
.h- Size
- 15023 bytes
- Lines
- 460
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device.hlinux/notifier.hlinux/pm_opp.hlinux/pm_qos.h
Detected Declarations
struct devfreqstruct devfreq_governorstruct devfreq_cpu_datastruct thermal_cooling_devicestruct devfreq_dev_statusstruct devfreq_dev_profilestruct devfreq_statsstruct devfreqstruct devfreq_freqsstruct devfreq_simple_ondemand_datastruct devfreq_passive_dataenum devfreq_timerenum devfreq_parent_dev_typefunction devfreq_remove_devicefunction devm_devfreq_remove_devicefunction devfreq_resume_devicefunction devfreq_suspendfunction devfreq_register_opp_notifierfunction devfreq_unregister_opp_notifierfunction devm_devfreq_register_opp_notifierfunction devm_devfreq_unregister_opp_notifierfunction devfreq_unregister_notifierfunction devm_devfreq_register_notifierfunction devm_devfreq_unregister_notifierfunction devfreq_update_stats
Annotated Snippet
struct devfreq_dev_status {
/* both since the last measure */
unsigned long total_time;
unsigned long busy_time;
unsigned long current_frequency;
void *private_data;
};
/*
* The resulting frequency should be at most this. (this bound is the
* least upper bound; thus, the resulting freq should be lower or same)
* If the flag is not set, the resulting frequency should be at most the
* bound (greatest lower bound)
*/
#define DEVFREQ_FLAG_LEAST_UPPER_BOUND 0x1
/**
* struct devfreq_dev_profile - Devfreq's user device profile
* @initial_freq: The operating frequency when devfreq_add_device() is
* called.
* @polling_ms: The polling interval in ms. 0 disables polling.
* @timer: Timer type is either deferrable or delayed timer.
* @target: The device should set its operating frequency at
* freq or lowest-upper-than-freq value. If freq is
* higher than any operable frequency, set maximum.
* Before returning, target function should set
* freq at the current frequency.
* The "flags" parameter's possible values are
* explained above with "DEVFREQ_FLAG_*" macros.
* @get_dev_status: The device should provide the current performance
* status to devfreq. Governors are recommended not to
* use this directly. Instead, governors are recommended
* to use devfreq_update_stats() along with
* devfreq.last_status.
* @get_cur_freq: The device should provide the current frequency
* at which it is operating.
* @exit: An optional callback that is called when devfreq
* is removing the devfreq object due to error or
* from devfreq_remove_device() call. If the user
* has registered devfreq->nb at a notifier-head,
* this is the time to unregister it.
* @freq_table: Optional list of frequencies to support statistics
* and freq_table must be generated in ascending order.
* @max_state: The size of freq_table.
*
* @is_cooling_device: A self-explanatory boolean giving the device a
* cooling effect property.
* @dev_groups: Optional device-specific sysfs attribute groups that to
* be attached to the devfreq device.
*/
struct devfreq_dev_profile {
unsigned long initial_freq;
unsigned int polling_ms;
enum devfreq_timer timer;
int (*target)(struct device *dev, unsigned long *freq, u32 flags);
int (*get_dev_status)(struct device *dev,
struct devfreq_dev_status *stat);
int (*get_cur_freq)(struct device *dev, unsigned long *freq);
void (*exit)(struct device *dev);
unsigned long *freq_table;
unsigned int max_state;
bool is_cooling_device;
const struct attribute_group **dev_groups;
};
/**
* struct devfreq_stats - Statistics of devfreq device behavior
* @total_trans: Number of devfreq transitions.
* @trans_table: Statistics of devfreq transitions.
* @time_in_state: Statistics of devfreq states.
* @last_update: The last time stats were updated.
*/
struct devfreq_stats {
unsigned int total_trans;
unsigned int *trans_table;
u64 *time_in_state;
u64 last_update;
};
/**
* struct devfreq - Device devfreq structure
* @node: list node - contains the devices with devfreq that have been
* registered.
* @lock: a mutex to protect accessing devfreq.
* @dev: device registered by devfreq class. dev.parent is the device
* using devfreq.
Annotation
- Immediate include surface: `linux/device.h`, `linux/notifier.h`, `linux/pm_opp.h`, `linux/pm_qos.h`.
- Detected declarations: `struct devfreq`, `struct devfreq_governor`, `struct devfreq_cpu_data`, `struct thermal_cooling_device`, `struct devfreq_dev_status`, `struct devfreq_dev_profile`, `struct devfreq_stats`, `struct devfreq`, `struct devfreq_freqs`, `struct devfreq_simple_ondemand_data`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.