包括两个部分kernel thermal monitor(KTM)和thermal engine。

  • Thermal 管理包括的内容如下:
  1. 硅片结温
  2. 内存温度限制
  3. 外表面温度限制
  • 当thermal engine完全初始化后,KTM确保所有环境条件下的结温处于限定的范围之内。
  • Thermal engine monitor监控系统的温度限制范围。
  • 机械结构设计模拟是获得最佳性能的必要步骤
  • Thermal management软件控制thermal响应。

DCVS:Dynamic Cloclk Frequency and Voltage Scaling.

下图包括了thermal 管理框架的四个部分:thermal engine, sensor driver以及其它温度管理设备。

在安卓用户空间thermal engine作为一个超级用户运行,thermal engine是温度管理的核心。启动时thermal engine初始化系统。threshold,set point以及管理的设备配置缺省情况从代码读取。参数用于设置温度传感器的中断门限。

为了在温度规范内获得最佳性能,这些参数在每一个设计中都要调优。温度传感器有:

  • 嵌入芯片硅结的温度传感器,这些是被称之为TSENS
  • thermal management 设备是软件抽象的设备,用于控制硬件,如GPU,CPU等

除了上述thermal架构,还有两个温度管理算法用于thermal engine完全启动前的设备启动和linux内核初始化阶段的温度管理。

Android温度限制和特点

  • KTM

内核启动时保护系统

设置110°为CPU热插拔的门限

将控制移交给thermal engine

  • Thermal engine

完整的温度保护策略

对特定对象必须调节

  • Thermal reset

异常情况

TM移交时间线

KTM

KTM函数和相关的调试

循环查询指定TSENS的温度,并根据得到的温度有如下的行为:

  • check_temp()--位于drivers/thermal/msm_thermal.c;每一个采样周期(msm_thermal_info.poll_ms)将被调用
  • do_therm_reset()---如果任意一个温度传感器的温度超过critical门限,这将导致看门狗(其参数由设备树的qcom,therm-reset-temp指定)喂狗,
msm_thermal:msm_thermal_bite: TSENS:α reached temperature:β. System reset
  • therm_get_temp()--获得设备树<qcom, sensor_id>字段指定sensor的温度,在调试时需要将该温度打印出来。
  • do_core_control()--到CPU温度超过门限时将cpu unplug,其打印的信息如下:
    msm_thermal:do_core_control: Set Offline: CPU$ Temp: β
    msm_thermal:do_core_control: Allow Online CPU$ Temp: β
  • do_vdd_mx()--对linux设备,KTM管理所有的温度传感器,如果温度掉于某个门限,其提升内存供电电压,在收到内存门限后KTM打印如下信息:
msm_thermal: vdd_mx_notify: Sensorα trigger received for type <threshold_type>
  • do_psm()--对于PMIC,温度超过一个门限后,其将被自动disable,KTM将发送一个命令让PMIC工作在PWM(pulse width modulation)模式,发送该命令时打印的信息如下:
msm_thermal:do_psm: Requested PMIC PWM Mode tsens:α. Temp:β
msm_thermal:do_psm: Requested PMIC AUTO Mode
  • do_gfx_phase_cond() and do_cx_phase_cond()---DIGITAL/GFX的多阶段电压轨。
msm_thermal:send_temperature_band: Sending <rail> temperature band<band_number> where, <rail>: DIGITAL or GFX with multiple BAND definition
depending on chipset
  • do_ocr()--对于一些设备,KTM监控温度,如果发现任意一个传感器温度超过门限,其向regulator发送最优电流请求。
  • do_vdd_restriction()--用于限制温度低门限(5°)时,KTM打印的信息如下:
msm_thermal:vdd_restriction_notify: sensor:α reached high thresh for Vddrestriction
msm_thermal:vdd_restriction_notify: sensor:α reached low thresh for Vddrestriction
  • do_freq_control()---当一个温度超过门限时CPU调频控制,其打印的信息如下:
msm_thermal:do_freq_control: Limiting CPU$ max frequency to 1958400. Temp:β

KTM设置

一个例子是:/arch/arm64/boot/dts/qcom/msm8916.dtsi

qcom,msm-thermal {
qcom,msm-thermal {
compatible = "qcom,msm-thermal";
qcom,sensor-id = <5>;
qcom,poll-ms = <250>;
qcom,limit-temp = <60>;
qcom,temp-hysteresis = <10>;
qcom,freq-step = <2>;
qcom,freq-control-mask = <0xf>;
qcom,core-limit-temp = <80>;
qcom,core-temp-hysteresis = <10>;
qcom,core-control-mask = <0xe>;
qcom,hotplug-temp = <94>;
qcom,hotplug-temp-hysteresis = <15>;
qcom,cpu-sensors = "tsens_tz_sensor5", "tsens_tz_sensor5",
"tsens_tz_sensor4", "tsens_tz_sensor4";
qcom,freq-mitigation-temp = <94>;
qcom,freq-mitigation-temp-hysteresis = <10>;
qcom,freq-mitigation-value = <400000>;
qcom,freq-mitigation-control-mask = <0x01>;
qcom,online-hotplug-core;
qcom,vdd-restriction-temp = <5>;
qcom,vdd-restriction-temp-hysteresis = <10>;
vdd-dig-supply = <&pm8916_s1_floor_corner>;
qcom,vdd-dig-rstr{
qcom,vdd-rstr-reg = "vdd-dig";
qcom,levels = <5 7 7>; /* Nominal, Super Turbo, Super
Turbo */
qcom,min-level = <1>; /* No Request */
};
qcom,vdd-apps-rstr{
qcom,vdd-rstr-reg = "vdd-apps";
qcom,levels = <533330 800000 998400>;
qcom,freq-req;
};
};

CPU0传感器用于控制算法,如果温度超过limit-temp给定的值,CPU的最高主频将被限制,如果后续轮询温度继续升高,则频率会被进一步降低,轮询的时间间隔是poll-ms定义的值。如果温度调到limit-temp和temp-hysteresis之和以下,那么可以达到的最高主频将被增加。CPU频率的高低在DCVS表中仅一步。

除了CPU调频,第二个温度门限core-limit-temp定义了CPU热插拔的门限。当温度超过该门限时CPU将被unplug。

设备树中的freq-control-mask和core-control-mask定义了那个cpu核按上述定义的规则工作,bit 0对应CPU0,默认core-control-mask 不包括CPU0,因为其不可以热插拔。

该算法位于/drivers/thermal/msm_thermal.c,对应的温度参数定义于arch/arm64/boot/dts/qcom/msm8916.dtsi。

Thermal Engine

这属于安卓侧的温度管理策略,其根据一个configure文件(default is /etc/thermal-engine.conf),但是一般会有一个平台对应文件,如/system/etc/thermal-engine-8974.conf

Thermal 管理策略--嵌入式和配置方式

三种算法

  • SS(single step),PID(Proportional-Integral-Derivative)和monitor。
  • 所有的规则要么定义于config文件,要么硬编码到thermal engine 数据文件里。

对于嵌入式规则,要求必须提供电压限制和PSM控制,可选的是所有CPU启动SS/PID控制算法

对于配置文件定义的算法,管理结温的算法通常采用SS算法,管理Pop 内存的采用SS或者monitor算法。

SS/PID/MONITOR算法实例

SS algorithm

本例中label是surface_control_dtm,该名称必须是唯一的,SS算法(algo_type = ss)通过每隔一秒(sampling = 1000)采样ID是3(sensor = tsens_tz_sensor3)的传感器来进行温度控制,DTM控制所有CPU的最大允许的主频(device = cpu),Sensor ID 3的温度设置根据系统表面温度是25°时设定的,所以控制表面温度在45°时,ID 3的温度传感器的温度应该在70°,安全门限温度设置在了55°,这一温度将不会限制CPU主频。

[surface_control_dtm]
algo_type ss
sensor tsens_tz_sensor3
device cpu
sampling 1000
set_point 70000
set_point_clr 55000

PID algorithm

标号是urface_control_pid,算法类型是(algo_type = pid),其65ms(sampling = 65)间隔采样ID 5温度传感器(sensor = tsens_tz_sensor5),PID调节最大允许的cpu主频(device = cpu0),ID 5是CPU0,所以控制温度设置成了95°,安全门限温度是55°,所谓的安全门限就是在这一温度以下,主频可以放开跑。

[CPU0_control_pid]
algo_type pid
sensor tsens_tz_sensor5
device cpu0
sampling 65
set_point 95000
set_point_clr 55000

Monitor algorithm

[modem]
algo_type monitor
sensor pa_therm0
sampling 1000
thresholds 70000 80000
thresholds_clr 65000 75000
actions modem mode

Thermal engine 调试

1.找到当前的thermal engine配置

adb shell thermal-engine –o > thermal-engine.conf

2.修改该文件后推送到设备上

3.将”debug“放到thermal-engine.conf的首行,然后重新启动thermal-engine服务

adb shell stop thermal-engine
adb root
adb remount
adb push thermal-engine.conf /system/etc/thermal-engine.conf
adb shell sync .
adb shell strat thermal-engine --debug &

4.logcat查看系统温度log

adb logcat –v time –s ThermalEngine

Temperature日志

内部传感器log

1.绝大多数信息已经导入到了sysfs node节点里。

2.log脚本周期性记录温度并保存到文件里

3.当前主频和最高主频也要记录到文件里

// checking for temp zone 0 value if sensor available
if (tz_flags[0]) {
tz_temp= 0;
tzs=
fopen("/sys/devices/virtual/thermal/thermal_zone0/temp","r");
if(tzs) {
fscanf(tzs,"%d",&tz_temp);
if (debug) {
printf("\nReadTEMPZONE0
file %d\n",tz_temp);
}
fclose(tzs);
}
fprintf(out_fd,"%d,",tz_temp);
}

4.POP内存/表面温度记录

可以使用热电偶或者红外摄像机

5,读取当前的温度

adb shell cat /sys/devices/virtual/thermal/thermal_*/temp

高通Thermal debug相关推荐

  1. 高通 Camx debug log控制

    某天,在某网站上看到一句话,"log开的好,问题都能搞". 问题能不能都搞好不知道,不过log开的好,对分析问题的确有很大的帮助. 高通camx的日志主要分2大模块,UMD (us ...

  2. 高通camx debug log 控制 及 UseCase pipeline debug(四)

    如题,log开的好,问题都能搞. Camera user mode driver (UMD) 出于调试目的,有两种方法可以覆盖相机驱动程序的默认设置 方法一: Push a configuration ...

  3. 高通Camera IFE时钟配置

    本文主要分享高通camera驱动中minHorizontalBlanking(最小水平消隐)和minVerticalBlanking(最小垂直消隐)配置项的计算方法: IFE时钟频率由以下sensor ...

  4. 高通 camera CTS Verify FOV calibration debug

    高通 camera CTS Verify FOV calibration debug 背景 分析 如何修改 总结 背景 CTS 手动测试中 有Camera FOV calibration的测试. MT ...

  5. 高通开发笔记---yukon worknote

    点击打开链接 daily build http://android-ci-platform.cnbj.sonyericsson.net/job/daily_build_jb-mr2-yukon/ DL ...

  6. 【高通SDM660平台 Android 10.0】(21) --- 高通Camera persist使用手册

    在网上看到一位兄弟针对高通平台 camera 相关属性总结的特别好,特意转载过来备份下,以供后续调试使用. 原文: <高通Camera persist使用手册> 基于MSM8996平台PL ...

  7. 高通开发笔记---Yangtze worknote

    点击打开链接 1. repo init -u git://review.sonyericsson.net/platform/manifest -b volatile-jb-mr1-yangtze 2. ...

  8. 高通thermal-engine配置文件格式

    点击打开链接 本文基于高通msm8939/8994平台文档及源码. 说明文档:                vendor/qcom/proprietary/thermal-engine/readme ...

  9. 高通 MSM8K bootloader : SBL1 .

    一. MSM8K Boot Flow 图1: 高通MSM8K平台bootloader启动流程基本类似,但具体各平台,比如MSM8974.MSM8916.MSM8994等,会有微小区别. 从上图,可以看 ...

  10. 高通android开发摘要

    一部分是开源的,可以从codeaurora.org上下载,还有一部分是高通产权的,需要从高通的网站上下载. 将高通产权的代码放到:vendor/qcom/proprietary 1. 设置bms一些参 ...

最新文章

  1. 汇编:ZF(zero flag)标志位
  2. node-red教程2 第一条数据流
  3. 【HDOJ】1150 Machine Schedule
  4. 系统仿真平台SkyEye可替代国外Matlab/Sumlink等同类软件
  5. makefile之引用(3)
  6. 列表推导式 python原理_python之列表推导式
  7. ajax css文件,wordpress 添加JS,css文件,实现AJAX效果
  8. tomcat报错无法启动组件_微软正在修复Windows Server无法启动的0xc0000001报错故障
  9. Gliffy Diagrams 安装问题
  10. 什么是人工智能?(科普)
  11. u盘在 计算机管理显示无媒体,urdrive_u盘显示无媒体怎么办_启动盘
  12. HDU 4889 Scary Path Finding Algorithm
  13. 如何使用 Windows 10 自带的磁盘清理程序?
  14. 【龙印】用M665和M666给三角洲3D打印机调平
  15. Python之禅——个人翻译
  16. linux centOS 没有网,怎么办
  17. Hone Hone Clock 以及小松鼠等代码以及插入方法
  18. [面试日记] 1,时隔五年再次开始面试
  19. 电子信箱怎么样注册?邮箱格式怎么写?
  20. 北京图王软件开发有限公司产品介绍-Visual Graph专业图形引擎

热门文章

  1. 提高模型准确率:组合模型
  2. Prometheus监控报警系统入门
  3. 别踩白块儿 java源码下载_“别踩白块儿游戏源代码分析和下载
  4. java的pdf转永中_永中PDF转Word,你值得拥有!
  5. HTML+CSS简单漫画网页设计成品 蜡笔小新3页 大学生个人HTML网页制作作品
  6. MongoDB 简单实践入门
  7. 什么是云渲染?云渲染应用场景有哪些?
  8. 定义c++对象(c++可以完成面向对象编程)(正方体的实例应用);
  9. CopyOnWriteArrayList 有什么特点?
  10. ArcGIS中消除两幅卫星影像之间色带问题