[linux thermal] thermal device tree
thermal device tree
本文kernel版本:4.14
由于各個(gè)廠商在thermal governor和硬件上的差異(sensor的排布不同),thermal zone中的溫度sensor、cooling devices的設(shè)備樹(shù)配置也有所不同。kernel document總結(jié)了幾種thermal zone設(shè)備樹(shù)配置示例。
1、cpu thermal zone
thermal zone包含一個(gè)溫度sensor和若干cooling devices的情況
#include <dt-bindings/thermal/thermal.h>/*cpufreq cooling device-passive被動(dòng)冷卻*/ 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>;/* 說(shuō)明四組OPPs都可用 */cooling-max-level = <3>;/* 說(shuō)明OPPs中只有頻率最低的那一組可用(198MHz@0.85V) */#cooling-cells = <2>; /* min followed by max */};... };/*風(fēng)扇控制器-active主動(dòng)冷卻*/ /*一個(gè)通過(guò)i2c總線1控制的風(fēng)扇設(shè)備fan0,地址0x48,有10個(gè)冷卻等級(jí)*/ &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,用來(lái)監(jiān)視'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>;/* 溫度超過(guò)cpu_alert0時(shí),等級(jí)0-4 */};map1 {trip = <&cpu_alert1>;cooling-device = <&fan0 5 THERMAL_NO_LIMIT>;/* 溫度超過(guò)cpu_alert1時(shí),等級(jí)5-9 */ };map2 {trip = <&cpu_alert1>;cooling-device =<&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;/* 所有冷卻等級(jí)都可以用在cpu_alert1上,即溫度在alert1-alert2之間,所有冷卻等級(jí)可用 */};};}; };2、IC with several internal sensors
每個(gè)sensor對(duì)應(yīng)一個(gè)thermal zone的情況。
硬件排布上,這三個(gè)sensor分別放置在芯片中的不同位置,可以監(jiān)視不同的熱點(diǎn)溫度。
bandgap0監(jiān)視CPU thermal zone; bandgap1監(jiān)視GPU thermal zone; bandgap2監(jiān)視DSP thermal zone。
它們有各自的延時(shí)、trips和cooling maps。
3、Several sensors within one single thermal zone
一個(gè)thermal zone對(duì)應(yīng)多個(gè)sensor的情況。
假設(shè)這里有兩個(gè)sensor,一個(gè)在cpu內(nèi)部,一個(gè)在靠近c(diǎn)pu的位置。該thermal zone的溫度變化由這兩個(gè)sensor共同決定。
4、board thermal
一個(gè)thermal zone有多個(gè)sensor和cooling device的情況。
電池的thermal zone對(duì)應(yīng)sensor adc_dummy4
board的thermal zone對(duì)應(yīng)sensor adc_dummy0、1、2
參考鏈接:https://elixir.bootlin.com/linux/v4.14.262/source/Documentation/devicetree/bindings/thermal/thermal.txt
總結(jié)
以上是生活随笔為你收集整理的[linux thermal] thermal device tree的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: LTE中SRB---无线资源承载
- 下一篇: 搞技术的人生技巧——装贪财