全志A133 android10 thermal温控策略配置调试

发布于:2025-02-11 ⋅ 阅读:(35) ⋅ 点赞:(0)

一,功能介绍

Thermal简称热控制系统,其功能是通过temperature sensor(温度传感器)测量当前CPU、GPU等设备的温度值,然后根据此温度值,影响CPU、GPU等设备的调频策略,对CPU、GPU等设备的最大频率进行限制,最终实现对CPU、GPU等设备温度的闭环控制,避免SOC温度过高。


二,DTS配置

源码位置:longan/kernel/linux-4.9/arch/arm64/boot/dts/sunxi/sun50iw10p1.dtsi

thermal-zones {
        cpu_thermal_zone {
                polling-delay-passive = <500>; //温度超过阈值,轮询温度周期(ms)
                polling-delay = <1000>; //温度未超过阈值,轮询温度周期(ms)
                thermal-sensors = <&ths 0>;
                sustainable-power = <1200>; //温度达到预设温度最大值,系统可分配的最大power
                k_po = <66>;
                k_pu = <132>;
                k_i = <0>;

                cpu_trips: trips {
                        cpu_threshold: trip-point@0 {
                                temperature = <70000>; //代表系统温控在70度左右开启
                                type = "passive";
                                hysteresis = <0>;
                        };
                        cpu_target: trip-point@1 {
                                temperature = <90000>; //代表系统最高温度是90度左右
                                type = "passive";
                                hysteresis = <0>;
                        };
                        cpu_crit: cpu_crit@0 {
                                temperature = <110000>; //代表系统到达110度就会过温关机
                                type = "critical";
                                hysteresis = <0>;
                        };
                };
				cooling-maps {
                           map0 {
                                   trip = <&cpu_target>;
                                   cooling-device = <&cpu0
                                   THERMAL_NO_LIMIT
                                   THERMAL_NO_LIMIT>;
                                   contribution = <1024>; //cpu分配功率权重,通过调整cooling device对应的contribution,可以调整降频顺序和降频尺度
                           };
                   /*      map1{
                                   trip = <&cpu_target>;
                                   cooling-device = <&gpu
                                   THERMAL_NO_LIMIT
                                   THERMAL_NO_LIMIT>;
                                   contribution = <1024>;
                           };      */
                   };
           };
           gpu_thermal_zone{
                   polling-delay-passive = <500>;
                   polling-delay = <1000>;
                   thermal-sensors = <&ths 1>;
                   sustainable-power = <1100>;
           };
           ddr_thermal_zone{
                   polling-delay-passive = <0>;
                   polling-delay = <0>;
                   thermal-sensors = <&ths 2>;
           };
   };

temperature: 可根据产品温控规格,适当调整。

  1. 提高该参数,会允许系统在高温情况下运行更快,性能更好。当然,也会让产品的温度更高,所以需要注意,修改该参数后能否满足产品温度要求和高温测试等。
  2. 降低该参数就会在一定程度上降低高温情况下的性能,可以让产品运行在较低的温度。

三,调试方法

1. 查看sensor温度

查看thermal_zone的类型

#cat sys/class/thermal/thermal_zone0/type
cpu_thermal_zon

查看thermal_zone温度

#cat sys/class/thermal/thermal_zone0/temp
36000

温度单位为mC,也就是36摄氏度。

2. 模拟温度

thermal有温度模拟功能,可以通过模拟温度校验温度策略是否符合预期。

设置thermal_zone0的模拟温度
#echo 80000 > /sys/class/thermal/thermal_zone0/emul_temp
关闭thermal_zone0的模拟温度功能
#echo 0 > /sys/class/thermal/thermal_zone0/emul_temp

3. 关闭温控

a. 通过调试节点关闭温控

确认cpu温控为thermal_zone0

#cat /sys/class/thermal/thermal_zone0/type
cpu_thermal_zone

关闭温控策略

#echo disabled > /sys/class/thermal/thermal_zone0/mode

接触所有cooling device的限制

#echo 0 > /sys/class/thermal/thermal_zone0/cdev*/cur_state
b. 通过修改dts节点关闭温控

以关闭cpu温控为例,删除cpu_thermal_zone下的其他节点和属性

cpu_thermal_zone{
	polling‑delay‑passive = <0>;
	polling‑delay = <0>;
	thermal‑sensors = <&ths 0>;
};

网站公告

今日签到

点亮在社区的每一天
去签到