Chinese translated version of Documentation/cpu-freq/core.txt
If you have any comment or update to the content, please contact the
original document maintainer directly. However, if you have a problem
communicating in English you can also ask the Chinese maintainer for
help. Contact the Chinese maintainer if this translation is outdated
or if there is a problem with the translation.
Chinese maintainer: wuyan<1481494885@qq.com>
---------------------------------------------------------------------
Documentation/cpu-freq/core.txt的中文翻译
如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文
交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻
译存在问题,请联系中文版维护者。
中文版校译者: 吴燕 1481494885@qq.com如果本翻译更新不及时或者翻译存在问题,请联系中文版维护者。
中文版维护者: 吴燕 1481494885@qq.com
中文版翻译者: 吴燕 1481494885@qq.com
1 CPU frequency and voltage scaling code in the Linux(TM) kernel 2 3 4 L i n u x C P U F r e q 5 6 C P U F r e q C o r e 7 8 9 Dominik Brodowski <linux@brodo.de> 10 David Kimdon <dwhedon@debian.org> 11 12 13 14 Clock scaling allows you to change the clock speed of the CPUs on the 15 fly. This is a nice method to save battery power, because the lower 16 the clock speed, the less power the CPU consumes.
1在Linux(TM)内核的CPU频率和电压缩放代码
2
3
4 L inux CPU FREQ
5
6 CPUFREQ 核心
7
8
9 Dominik Brodowski<linux@brodo.de>
10 David Kimdon<dwhedon@debian.org>
11
12
13
14 时钟缩放允许您更改CPU时钟速度
15这是一个很好的方法,以节省电池电量,因为
16时钟速度越低,CPU消耗的功率越少。
19 Contents: 20 --------- 21 1. CPUFreq core and interfaces 22 2. CPUFreq notifiers 23 24 1. General Information 25 ======================= 26 27 The CPUFreq core code is located in drivers/cpufreq/cpufreq.c. This 28 cpufreq code offers a standardized interface for the CPUFreq 29 architecture drivers (those pieces of code that do actual 30 frequency transitions), as well as to "notifiers". These are device 31 drivers or other part of the kernel that need to be informed of 32 policy changes (ex. thermal modules like ACPI) or of all 33 frequency changes (ex. timing code) or even need to force certain 34 speed limits (like LCD drivers on ARM architecture). Additionally, the 35 kernel "constant" loops_per_jiffy is updated on frequency changes 36 here.
19内容:
20---------
21 1.核心和接口的CPUFreq
22 2.CPUFreq通知
23
24 1.一般信息
25=======================
26
27 CPUFreq的核心代码位于驱动程序/ CPU频率/ cpufreq.c。
28 CPU频率的代码为
CPUFreq
架构驱动程序
29(代码,实际在做那件提供了一个标准化的接口
30个频率转换),以及“通知”。这些设备
31驱动程序或其他内核的一部分,需要被告知
32政策的变化(例如热模块,如ACPI)或
33频率的变化(例如:计时码)甚至需要强制某些
34速度的限制(如LCD驱动器在ARM架构)。此外,该
35内核的“常数”loops_per_jiffy根据频率变化更新
36
38 Reference counting is done by cpufreq_get_cpu and cpufreq_put_cpu, 39 which make sure that the cpufreq processor driver is correctly 40 registered with the core, and will not be unloaded until 41 cpufreq_put_cpu is called. 42 43 2. CPUFreq notifiers 44 ==================== 45 46 CPUFreq notifiers conform to the standard kernel notifier interface. 47 See linux/include/linux/notifier.h for details on notifiers. 48 49 There are two different CPUFreq notifiers - policy notifiers and 50 transition notifiers.
38引用计数由cpufreq_get_cpu和 cpufreq_put_cpu完成的,
39以确保CPU频率的处理器驱动程序是正确
40注册到核心的,并不会被卸载,直到被cpufreq_put_cup调用
41
42
43 2.CPUFreq通知
44====================
45
46CPUFreq发出通知符合标准内核通知接口。
47发出通知的详细信息,请参阅Linux/包括/ LINUX / notifier.h。
48
49有两种不同的CPUFreq发出通知 - 政策发出通知,
50过渡发出通知。
53 2.1 CPUFreq policy notifiers 54 ---------------------------- 55 56 These are notified when a new policy is intended to be set. Each 57 CPUFreq policy notifier is called three times for a policy transition: 58 59 1.) During CPUFREQ_ADJUST all CPUFreq notifiers may change the limit if 60 they see a need for this - may it be thermal considerations or 61 hardware limitations. 62 63 2.) During CPUFREQ_INCOMPATIBLE only changes may be done in order to avoid 64 hardware failure. 65 66 3.) And during CPUFREQ_NOTIFY all notifiers are informed of the new policy 67 - if two hardware drivers failed to agree on a new policy before this 68 stage, the incompatible hardware shall be shut down, and the user 69 informed of this. 70
53 2.1的CPUFreq政策通知
54----------------------------
55
56这些都是当一个新政策将要被要设置时的通知。每个
57CPUFreq政策通知被调用三次为了政策过渡:
58
59 1)在CPUFREQ_ADJUST所有的CPUFreq通知者可能会改变限制,如果
60,他们看到了这种需要 - 它可能是热的考虑或
61 硬件的限制。
62
63 2)在只有CPUFREQ_INCOMPATIBLE时,可能只会做一些改变来避免
64硬件故障。
65
66 3)和CPUFREQ_NOTIFY期间所有通知会被新政策的通知
67 - 如果两个硬件驱动程序未能达成新的政策,在此之前,
68应当关闭不兼容的硬件和用户
69通知。
71 The phase is specified in the second argument to the notifier. 72 73 The third argument, a void *pointer, points to a struct cpufreq_policy 74 consisting of five values: cpu, min, max, policy and max_cpu_freq. min 75 and max are the lower and upper frequencies (in kHz) of the new 76 policy, policy the new policy, cpu the number of the affected CPU; and 77 max_cpu_freq the maximum supported CPU frequency. This value is given 78 for informational purposes only. 79 80
71阶段的第二个参数是通知中指定的。 72 73第三个参数,void *指针,指向一个struct cpufreq_policy 74包括:CPU,最小值,最大值,政策和max_cpu_freq的五个值。 75最大的下限和上限频率(千赫)的新 76政策,政策的新政策,受影响的CPU CPU数量; 77 max_cpu_freq最大支持的CPU频率。这个值 78仅供参考。
81 2.2 CPUFreq transition notifiers 82 -------------------------------- 83 84 These are notified twice when the CPUfreq driver switches the CPU core 85 frequency and this change has any external implications. 86 87 The second argument specifies the phase - CPUFREQ_PRECHANGE or 88 CPUFREQ_POSTCHANGE. 89 90 The third argument is a struct cpufreq_freqs with the following 91 values: 92 cpu - number of the affected CPU 93 old - old frequency 94 new - new frequency 95 96 If the cpufreq core detects the frequency has changed while the system 97 was suspended, these notifiers are called with CPUFREQ_RESUMECHANGE as 98 second argument.
81 2.2CPUFreq的过渡通知
82--------------------------------
83
84这些通知两次当cpufreq驱动改变CPU核心
85频率时,而这种变化有外部影响。
86
87第二个参数指定的相 - CPUFREQ_PRECHANGE
88或者CPUFreq_POSTCHANGE。
89
90第三个参数是一个struct cpufreq_freqs,值如下:
91
92 CPU - 受影响的CPU数量
93 old - 旧的频率
94 new - 新频率
95
96 如果CPU频率核心检测到的频率已经改变,而系统
97 被禁赛,这些通知会被作为第二个参数
98 与CPUFREQ_RESUMECHANGE调用。