[linux thermal] thermal device tree
thermal device tree
本文kernel版本:4.14
由于各個廠商在thermal governor和硬件上的差異(sensor的排布不同),thermal zone中的溫度sensor、cooling devices的設備樹配置也有所不同。kernel document總結了幾種thermal zone設備樹配置示例。
1、cpu thermal zone
thermal zone包含一個溫度sensor和若干cooling devices的情況
#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 1200000792000 1100000396000 950000198000 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之間,所有冷卻等級可用 */};};}; };2、IC with several internal sensors
每個sensor對應一個thermal zone的情況。
硬件排布上,這三個sensor分別放置在芯片中的不同位置,可以監視不同的熱點溫度。
bandgap0監視CPU thermal zone; bandgap1監視GPU thermal zone; bandgap2監視DSP thermal zone。
它們有各自的延時、trips和cooling maps。
3、Several sensors within one single thermal zone
一個thermal zone對應多個sensor的情況。
假設這里有兩個sensor,一個在cpu內部,一個在靠近cpu的位置。該thermal zone的溫度變化由這兩個sensor共同決定。
4、board thermal
一個thermal zone有多個sensor和cooling device的情況。
電池的thermal zone對應sensor adc_dummy4
board的thermal zone對應sensor adc_dummy0、1、2
參考鏈接:https://elixir.bootlin.com/linux/v4.14.262/source/Documentation/devicetree/bindings/thermal/thermal.txt
總結
以上是生活随笔為你收集整理的[linux thermal] thermal device tree的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: LTE中SRB---无线资源承载
- 下一篇: Linux kernel ‘aac_se