温控节点配置
/apollo/VENDOR/vendor/qcom/proprietary_UM/devicetree/qcom/holi-thermal.dtsi
sensor创建线程持续监控温度
/apollo/VENDOR/vendor/qcom/proprietary_UM/thermal-engine/sensors/sensors_manager.c
pthread_create(&(sensor_mgr->monitor_thread), NULL,
sensor_monitor, sensor_mgr);
温控配置文件
/apollo/VENDOR/vendor/qcom/proprietary_UM/thermal-engine/thermal-engine.conf
默认温控配置文件
/apollo/VENDOR/vendor/qcom/proprietary_UM/thermal-engine/inc/thermal.h
#define CONFIG_FILE_DEFAULT “/system/etc/thermal-engine.conf”
加载温控配置文件
/apollo/VENDOR/vendor/qcom/proprietary_UM/thermal-engine/thermal.c
ifdef ENABLE_OLD_PARSER
load_config(&thermal_settings, config_file);
else
load_config(&thermal_settings, config_file, LOAD_ALL_FLAG);
endif
monitor算法
/apollo/VENDOR/vendor/qcom/proprietary_UM/thermal-engine/thermal_monitor.c
Thermal cooling device 相关代码:
/apollo/VENDOR/kernel/msm-5.4/
drivers/thermal/devfreq_cooling.c
drivers/thermal/cpu_cooling.c
Thermal governor 相关代码
/apollo/VENDOR/kernel/msm-5.4/
drivers/thermal/power_allocator.c /* power allocator 温控策略 /
drivers/thermal/step_wise.c / step wise 温控策略 /
drivers/thermal/fair_share.c / fair share 温控策略 /
drivers/thermal/user_space.c / userspace 温控策略 */
重要结构体
https://blog.csdn.net/weixin_43555423/article/details/105899848?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522164687876516780269813718%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fall.%2522%257D&request_id=164687876516780269813718&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2allfirst_rank_ecpm_v1~rank_v31_ecpm-19-105899848.pc_search_result_cache&utm_term=thermal+engine&spm=1018.2226.3001.4187
sensor driver相关
struct rockchip_thermal_sensor:RK 平台上该结构体代表了一个 tsadc;
struct rockchip_thermal_data:sensor driver 的私有数据;
struct thermal_zone_device:一个 tsadc 会和一个 thermal zone 绑定;
int id:该 tsadc 的编号,一般来说 RK 的 SoC 内部有两个 tsadc;
governor相关
struct thermal_governor:用来描述一个 governor(即温控策略)信息。
内核目前有五种 governor:
1、power_allocator:引⼊ PID(⽐例-积分-微分)控制,根据当前温度,动态给各 cooling device 分配 power,并将 power 转换为频率,从而达到根据温度限制频率的效果。
2、step_wise:根据当前温度,cooling device 逐级降频。
3、fair share:频率档位⽐较多的 cooling device 优先降频。
4、bang bang:两点温度调节,可用于 cooling device 有风扇的场景。
5、userspace:用户空间控制。
cooling device相关
struct thermal_cooling_device:用来描述一个 cooling device(即降温设备) 信息,并将函数操作集抽取出来。
struct thermal_cooling_device_ops:cooling device函数操作集
thermal zone
struct thermal_zone_device:一个 thermal zone 是根据 dts 里的配置一步步解析并构建的,包含了很多信息,比如服务于该 thermal zone 的 tsadc,服务于该 thermal zone 的降温设备,该 thermal zone 所用的 governor,以及 thermal 机制工作时所需的一些参数,等等。
struct thermal_zone_device_ops:thermal zone函数操作集