我是靠谱客的博主 彪壮蜻蜓,最近开发中收集的这篇文章主要介绍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作为
第二个参数。

最后

以上就是彪壮蜻蜓为你收集整理的Documentation\cpu-freq\core.txt的全部内容,希望文章能够帮你解决Documentation\cpu-freq\core.txt所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(32)

评论列表共有 0 条评论

立即
投稿
返回
顶部