日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

[linux thermal] thermal device tree

發布時間:2023/12/16 linux 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 [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。

#include <dt-bindings/thermal/thermal.h>ocp {.../** A simple IC with several bandgap temperature sensors.*/bandgap0: bandgap@0x0000ED00 {...#thermal-sensor-cells = <1>;}; };thermal-zones {cpu_thermal: cpu-thermal {polling-delay-passive = <250>; /* milliseconds */polling-delay = <1000>; /* milliseconds *//* sensor ID */thermal-sensors = <&bandgap0 0>;trips {/* each zone within the SoC may have its own trips */cpu_alert: cpu-alert {temperature = <100000>; /* millicelsius */hysteresis = <2000>; /* millicelsius */type = "passive";};cpu_crit: cpu-crit {temperature = <125000>; /* millicelsius */hysteresis = <2000>; /* millicelsius */type = "critical";};};cooling-maps {/* each zone within the SoC may have its own cooling */...};};gpu_thermal: gpu-thermal {polling-delay-passive = <120>; /* milliseconds */polling-delay = <1000>; /* milliseconds *//* sensor ID */thermal-sensors = <&bandgap0 1>;trips {/* each zone within the SoC may have its own trips */gpu_alert: gpu-alert {temperature = <90000>; /* millicelsius */hysteresis = <2000>; /* millicelsius */type = "passive";};gpu_crit: gpu-crit {temperature = <105000>; /* millicelsius */hysteresis = <2000>; /* millicelsius */type = "critical";};};cooling-maps {/* each zone within the SoC may have its own cooling */...};};dsp_thermal: dsp-thermal {polling-delay-passive = <50>; /* milliseconds */polling-delay = <1000>; /* milliseconds *//* sensor ID */thermal-sensors = <&bandgap0 2>;trips {/* each zone within the SoC may have its own trips */dsp_alert: dsp-alert {temperature = <90000>; /* millicelsius */hysteresis = <2000>; /* millicelsius */type = "passive";};dsp_crit: gpu-crit {temperature = <135000>; /* millicelsius */hysteresis = <2000>; /* millicelsius */type = "critical";};};cooling-maps {/* each zone within the SoC may have its own cooling */...};}; };

3、Several sensors within one single thermal zone

一個thermal zone對應多個sensor的情況。
假設這里有兩個sensor,一個在cpu內部,一個在靠近cpu的位置。該thermal zone的溫度變化由這兩個sensor共同決定。

#include <dt-bindings/thermal/thermal.h>&i2c1 {.../** A simple IC with a single temperature sensor.*/adc: sensor@0x49 {...#thermal-sensor-cells = <0>;}; };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>, /* cpu */<&adc>; /* pcb north *//* hotspot = 100 * bandgap - 120 * adc + 484 */coefficients = <100 -120 484>;trips {...};cooling-maps {...};}; };

4、board thermal

一個thermal zone有多個sensor和cooling device的情況。
電池的thermal zone對應sensor adc_dummy4
board的thermal zone對應sensor adc_dummy0、1、2

#include <dt-bindings/thermal/thermal.h>&i2c1 {.../** An IC with several temperature sensor.*/adc_dummy: sensor@0x50 {...#thermal-sensor-cells = <1>; /* sensor internal ID */}; };thermal-zones {batt-thermal {polling-delay-passive = <500>; /* milliseconds */polling-delay = <2500>; /* milliseconds *//* sensor ID */thermal-sensors = <&adc_dummy 4>;trips {...};cooling-maps {...};};board_thermal: board-thermal {polling-delay-passive = <1000>; /* milliseconds */polling-delay = <2500>; /* milliseconds *//* sensor ID */thermal-sensors = <&adc_dummy 0>, /* pcb top edge */<&adc_dummy 1>, /* lcd */<&adc_dummy 2>; /* back cover *//** 三個sensor的線性對應關系:* An array of coefficients describing the sensor* linear relation. E.g.:* z = c1*x1 + c2*x2 + c3*x3*/coefficients = <1200 -345 890>;sustainable-power = <2500>;trips {/* Trips are based on resulting linear equation */cpu_trip: cpu-trip {temperature = <60000>; /* millicelsius */hysteresis = <2000>; /* millicelsius */type = "passive";};gpu_trip: gpu-trip {temperature = <55000>; /* millicelsius */hysteresis = <2000>; /* millicelsius */type = "passive";}lcd_trip: lcp-trip {temperature = <53000>; /* millicelsius */hysteresis = <2000>; /* millicelsius */type = "passive";};crit_trip: crit-trip {temperature = <68000>; /* millicelsius */hysteresis = <2000>; /* millicelsius */type = "critical";};};cooling-maps {map0 {trip = <&cpu_trip>;cooling-device = <&cpu0 0 2>;contribution = <55>;};map1 {trip = <&gpu_trip>;cooling-device = <&gpu0 0 2>;contribution = <20>;};map2 {trip = <&lcd_trip>;cooling-device = <&lcd0 5 10>;contribution = <15>;};};}; };

參考鏈接:https://elixir.bootlin.com/linux/v4.14.262/source/Documentation/devicetree/bindings/thermal/thermal.txt

總結

以上是生活随笔為你收集整理的[linux thermal] thermal device tree的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。