Documentation\cpu-freq\core.txt

    如果想评论或更新本文的内容,请直接联系原文档的维护者。

如果你使用英文交流有困难的话,也可以向中文版维护者求助。

如果本翻译更新不及时或者翻译存在问题,请联系中文版维护者。

中文版维护者: 陶莹莉  tyl18768122426@163.com

中文版翻译者:  陶莹莉  tyl18768122426@163.com

中文版校译者:  陶莹莉  tyl18768122426@163.com

 

 CPU frequency and voltage scaling code in the Linux(TM) kernel
  在Linux(TM)内核的CPU频率和缩放代码

           L i n u x    C P U F r e q

     C P U F r e q    C o r e


      Dominik Brodowski  <linux@brodo.de>
       David Kimdon <dwhedon@debian.org>

 

   Clock scaling allows you to change the clock speed of the CPUs on the
    fly. This is a nice method to save battery power, because the lower
            the clock speed, the less power the CPU consumes.

 时钟分频,可以让你改变CPU的时钟飞逝速度。这是一个很好的节省电池电量方法,因为
           时钟速度越低,CPU消耗功率越少。
Contents:
---------
1.  CPUFreq core and interfaces
2.  CPUFreq notifiers

1. General Information

=======================
目录:
---------
1.CPUFreq的核心和接口
2.CPUFreq通知

1.一般信息
=======================

The CPUFreq core code is located in drivers/cpufreq/cpufreq.c. This
cpufreq code offers a standardized interface for the CPUFreq
architecture drivers (those pieces of code that do actual
frequency transitions), as well as to "notifiers". These are device
drivers or other part of the kernel that need to be informed of
policy changes (ex. thermal modules like ACPI) or of all
frequency changes (ex. timing code) or even need to force certain
speed limits (like LCD drivers on ARM architecture). Additionally, the
kernel "constant" loops_per_jiffy is updated on frequency changes
here.

CPUFreq的核心代码位于drivers/cpufreq/cpufreq.c。CPU频率代码为CPUFreq
架构驱动程序提供了一个标准化接口(这部分代码,实际一直在做频率转换),
以及“通知”。这些设备驱动程序或其他内核的一部分,需要被告知策略的变化
(例如热模块,如ACPI)或频率的变化(例如:计时码),甚至需要强制某些
速度限制(如LCD驱动器在ARM架构)。此外,该内核“常数”loops_per_jiffy在频繁的更新变化。

Reference counting is done by cpufreq_get_cpu and cpufreq_put_cpu,
which make sure that the cpufreq processor driver is correctly
registered with the core, and will not be unloaded until
cpufreq_put_cpu is called.
引用计数由cpufreq_get_cpu 和cpufreq_put_cpu完成,确保CPU频率的处理器驱动程序是正确
被注册到核心的,并且不会被卸载,直到被称cpufreq_put_cpu调用。

2. CPUFreq notifiers
====================
2.CPUFreq 通知
====================
CPUFreq notifiers conform to the standard kernel notifier interface.
See linux/include/linux/notifier.h for details on notifiers.

CPUFreq通知程序符合标准内核通知接口。
详细信息请参阅linux/include/linux/notifier.h。

There are two different CPUFreq notifiers - policy notifiers and
transition notifiers.

有两种不同的CPUFreq通知 - 策略通知和过渡通知。

2.1 CPUFreq policy notifiers
----------------------------
2.1 CPUFreq 策略通知
----------------------------

These are notified when a new policy is intended to be set. Each
CPUFreq policy notifier is called three times for a policy transition:

1.) During CPUFREQ_ADJUST all CPUFreq notifiers may change the limit if
    they see a need for this - may it be thermal considerations or
    hardware limitations.

2.) During CPUFREQ_INCOMPATIBLE only changes may be done in order to avoid
    hardware failure.

3.) And during CPUFREQ_NOTIFY all notifiers are informed of the new policy
   - if two hardware drivers failed to agree on a new policy before this
   stage, the incompatible hardware shall be shut down, and the user
   informed of this.
  
当一个新策略的打算实施时需要通知。为了策略的过渡,每个CPUFreq策略通知会被调用三次:
1)在CPUFREQ调整期间,所有的CPUFreq通知可能会改变限制,如果
    他们认为这一点有必要 - 这可能出于导热的考虑或硬件的限制。

2)在CPUFREQ不兼容时,可能做些改变,以避免硬件故障。

3)在CPUFREQ通知时,所有通知会被告知新的策略
    - 如果两个硬件驱动程序在此之前未能达成了新的政策,这个不兼容的硬件应该关机,用户会被
   通知这个。
  
The phase is specified in the second argument to the notifier.

The third argument, a void *pointer, points to a struct cpufreq_policy
consisting of five values: cpu, min, max, policy and max_cpu_freq. min
and max are the lower and upper frequencies (in kHz) of the new
policy, policy the new policy, cpu the number of the affected CPU; and
max_cpu_freq the maximum supported CPU frequency. This value is given
for informational purposes only.

这个阶段被指定为通知的第二个参数。

第三个参数是void *指针,指向一个cpufreq_policy的结构体,包括五个值:CPU,
最小值,最大值,策略和最大CPU频率的。最小和最大是新
方针频率(千赫)的下限和上限,实现新策略,CPU数量会影响CPU ;
最大CPU频率是支持的最大CPU频率。这个值仅供参考。
2.2 CPUFreq transition notifiers
--------------------------------

These are notified twice when the CPUfreq driver switches the CPU core
frequency and this change has any external implications.

The second argument specifies the phase - CPUFREQ_PRECHANGE or
CPUFREQ_POSTCHANGE.

2.2 CPUFreq过渡通知
这些都是通知两次当cpufreq驱动CPU核心频率而这种变化有对任何外部有影响。

第二个参数指定的阶段是 CPUFREQ_PRECHANGE或CPUFREQ_POSTCHANGE。

The third argument is a struct cpufreq_freqs with the following
values:
cpu - number of the affected CPU
old - old frequency
new - new frequency
CPUFREQ_POSTCHANGE。
第三个参数是一个结构体类型的cpufreq_freqs,含有以下的值:
CPU -受影响的CPU数量
old- 旧频率
new - 新频率
CPUFREQ_POSTCHANGE。

If the cpufreq core detects the frequency has changed while the system
was suspended, these notifiers are called with CPUFREQ_RESUMECHANGE as
second argument.
如果CPU频率核心检测的频率发生了变化,但被系统禁止,这些通知会被称为CPUFREQ_RESUMECHANGE作为
第二个参数。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值