By:GentlemanTsao
文章目录
Thermal框架概览
认识thermal sysfs
Thermal sysfs是UE中的文件节点,暴露了thermal sensor,可以通过adb读取和修改。
在UE的/sys/class/thermal目录下查看,可以得到cooling_device和thermal zone列表,如下所示:
每个cooling_device都有自己的类型(type),以区分其他device。我们可以cat cooling_device11 ~14,看到这几个属于modem,依次对应于:
PA
Modem proc
Modem VDD
Modem current
如下所示:
Cooling_device结构,如下所示:
Thermal zone结构,如下所示:
接下来分别阐述这两者及其关系。
Cooling device
定义:
任何可以通过节流/限频以实现降温的设备。
Cooling device包含下面几部分:
如何生效:
每个cooling device都关联一个thermal zone的 trip。
具体实现请参考下面一段代码(位于kernel中):
Thermal_core.c
(amss\linux\android\kernel\msm-4.9\drivers\thermal)
/**
*thermal_zone_bind_cooling_device() - bind a cooling device to a thermal zone
*@tz: pointer to struct thermal_zone_device
* @trip: indicates which trip point the cooling devices is
* associated with in this thermal zone.
*@cdev: pointer to struct thermal_cooling_device