Documentation/translations/zh_TW/cpu-freq/cpu-drivers.rst
Source file repositories/reference/linux-study-clean/Documentation/translations/zh_TW/cpu-freq/cpu-drivers.rst
File Facts
- System
- Linux kernel
- Corpus path
Documentation/translations/zh_TW/cpu-freq/cpu-drivers.rst- Extension
.rst- Size
- 11313 bytes
- Lines
- 258
- Domain
- Support Tooling And Documentation
- Bucket
- Documentation
- Inferred role
- Support Tooling And Documentation: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- 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
- No C-style include directives detected by the generator.
Detected Declarations
function cpufreq_for_each_entry
Annotated Snippet
首先,在 __initcall level 7 (module_init())或更靠後的函數中檢查這個內核是否
運行在正確的CPU和正確的芯片組上。如果是,則使用cpufreq_register_driver()向
CPUfreq核心層註冊一個cpufreq_driver結構體。
結構體cpufreq_driver應該包含什麼成員?
.name - 驅動的名字。
.init - 一個指向per-policy初始化函數的指針。
.verify - 一個指向"verification"函數的指針。
.setpolicy 或 .fast_switch 或 .target 或 .target_index - 差異見
下文。
其它可選成員
.flags - 給cpufreq核心的提示。
.driver_data - cpufreq驅動程序的特有數據。
.get_intermediate 和 target_intermediate - 用於在改變CPU頻率時切換到穩定
的頻率。
.get - 返回CPU的當前頻率。
.bios_limit - 返回HW/BIOS對CPU的最大頻率限制值。
.exit - 一個指向per-policy清理函數的指針,該函數在CPU熱插拔過程的CPU_POST_DEAD
階段被調用。
.suspend - 一個指向per-policy暫停函數的指針,該函數在關中斷且在該策略的調節器停止
後被調用。
.resume - 一個指向per-policy恢復函數的指針,該函數在關中斷且在調節器再一次啓動前被
調用。
.ready - 一個指向per-policy準備函數的指針,該函數在策略完全初始化之後被調用。
.attr - 一個指向NULL結尾的"struct freq_attr"列表的指針,該列表允許導出值到
sysfs。
.boost_enabled - 如果設置,則啓用提升(boost)頻率。
.set_boost - 一個指向per-policy函數的指針,該函數用來開啓/關閉提升(boost)頻率功能。
1.2 Per-CPU 初始化
------------------
每當一個新的CPU被註冊到設備模型中,或者當cpufreq驅動註冊自身之後,如果此CPU的cpufreq策
略不存在,則會調用per-policy的初始化函數cpufreq_driver.init。請注意,.init()和.exit()例程
只爲某個策略調用一次,而不是對該策略管理的每個CPU調用一次。它需要一個 ``struct cpufreq_policy
*policy`` 作爲參數。現在該怎麼做呢?
如果有必要,請在你的CPU上激活CPUfreq功能支持。
然後,驅動程序必須填寫以下值:
+-----------------------------------+--------------------------------------+
|policy->cpuinfo.min_freq和 | 該CPU支持的最低和最高頻率(kHz) |
|policy->cpuinfo.max_freq | |
| | |
+-----------------------------------+--------------------------------------+
|policy->cpuinfo.transition_latency | CPU在兩個頻率之間切換所需的時間,以 |
| | 納秒爲單位 |
| | |
+-----------------------------------+--------------------------------------+
|policy->cur | 該CPU當前的工作頻率(如適用) |
| | |
Annotation
- Detected declarations: `function cpufreq_for_each_entry`.
- Atlas domain: Support Tooling And Documentation / Documentation.
- 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.