2,851
社区成员




如何使用QCS8550的 thermal-engine,比如调整风扇的强度?
由于各个厂商在thermal governor和硬件上的差异(sensor的排布不同),thermal zone中的温度sensor、cooling devices的设备树配置也有所不同。kernel document总结了几种thermal zone设备树配置示例。
#include <dt-bindings/thermal/thermal.h>
/*cpufreq cooling device-passive被动冷却*/
cpus {
/*
* Here is an example of describing a cooling device for a DVFS
* capable CPU. The CPU node describes its four OPPs.
* The cooling states possible are 0..3, and they are
* used as OPP indexes. The minimum cooling state is 0, which means
* all four OPPs can be available to the system. The maximum
* cooling state is 3, which means only the lowest OPPs (198MHz@0.85V)
* can be available in the system.
*/
/* */
cpu0: cpu@0 {
...
operating-points = <
/* kHz uV */
970000 1200000
792000 1100000
396000 950000
198000 850000
>;
cooling-min-level = <0>;/* 说明四组OPPs都可用 */
cooling-max-level = <3>;/* 说明OPPs中只有频率最低的那一组可用(198MHz@0.85V) */
#cooling-cells = <2>; /* min followed by max */
};
...
};
/*风扇控制器-active主动冷却*/
/*一个通过i2c总线1控制的风扇设备fan0,地址0x48,有10个冷却等级*/
&i2c1 {
...
/*
* A simple fan controller which supports 10 speeds of operation
* (represented as 0-9).
*/
fan0: fan@0x48 {
...
cooling-min-level = <0>;
cooling-max-level = <9>;/* 10 cooling states */
#cooling-cells = <2>; /* min followed by max */
};
};
/*温度传感器IC*/
/*ADC sensor(bandgap0),地址0x0000ED00,用来监视'cpu-thermal'的温度*/
ocp {
...
/*
* A simple IC with a single bandgap temperature sensor.
*/
bandgap0: bandgap@0x0000ED00 {
...
#thermal-sensor-cells = <0>;
};
};
thermal-zones {
cpu_thermal: cpu-thermal {
polling-delay-passive = <250>; /* milliseconds */
polling-delay = <1000>; /* milliseconds */
thermal-sensors = <&bandgap0>;
trips {
cpu_alert0: cpu-alert0 {
temperature = <90000>; /* millicelsius */
hysteresis = <2000>; /* millicelsius */
type = "active";
};
cpu_alert1: cpu-alert1 {
temperature = <100000>; /* millicelsius */
hysteresis = <2000>; /* millicelsius */
type = "passive";
};
cpu_crit: cpu-crit {
temperature = <125000>; /* millicelsius */
hysteresis = <2000>; /* millicelsius */
type = "critical";
};
};
cooling-maps {
map0 {
trip = <&cpu_alert0>;
cooling-device = <&fan0 THERMAL_NO_LIMIT 4>;/* 温度超过cpu_alert0时,等级0-4 */
};
map1 {
trip = <&cpu_alert1>;
cooling-device = <&fan0 5 THERMAL_NO_LIMIT>;/* 温度超过cpu_alert1时,等级5-9 */
};
map2 {
trip = <&cpu_alert1>;
cooling-device =
<&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;/* 所有冷却等级都可以用在cpu_alert1上,即温度在alert1-alert2之间,所有冷却等级可用 */
};
};
};
};
当对应的thermal zone的传感器的温度在不同的等级的时候, 我们就调用不同的风扇等级, 以此降温
同问6490