本文主要是介绍Linux内核Thermal框架详解二、Thermal Core(1),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
本文部分内容参考
万字长文 | Thermal框架源码剖析,
Linux Thermal机制源码分析之框架概述_不捡风筝的玖伍贰柒的博客-CSDN博客
特此致谢!
一、概述
Thermal Core作为中枢完成以下动作、实现以下功能:
- 注册Governor、注册Thermal类、并且基于Device Tree注册Thermal Zone;
- 提供Thermal Zone注册函数、Cooling Device注册函数、提供将Cooling设备绑定到Zone的函数,一个Thermal Zone可以有多个Cooling设备;
- 提供一个核心函数thermal_zone_device_update作为Thermal中断处理函数和轮询函数,轮询时间会根据不同Trip Delay调节。
总的来说,Thermal Core作为thermal的核心部分,负责把governor、cooling device、zone device等部分关联在一起,因此Thermal Core需要提供注册接口和作为记录的全局变量来记录注册的信息。
二、框架及接口函数
1. 框架
Thermal Core的框架如下图所示:
在上图中你可能会有疑问:为什么看不到Theremal Core?这正是它被称为“Core”的原因,正所谓是“大象无形,大音希声”。
2. 接口函数
Thermal Core的接口函数(位于drivers/thermal/thermal_core.c中)如下:
函数 | 作用 |
thermal_zone_device_register | Thermal Zone的注册函数 |
thermal_zone_device_unregister | Thermal Zone的注销函数 |
thermal_zone_get_temp | Thermal Zone温度获取函数 |
thermal_zone_device_update | |
thermal_zone_get_zone_by_name | |
thermal_cooling_device_register | Cooling Device的注册函数 |
thermal_of_cooling_device_register | Cooling Device的注册函数 |
thermal_cooling_device_unregister | Cooling Device的注销函数 |
thermal_zone_bind_cooling_device | 将Cooling Device绑定到Zone的函数 |
thermal_zone_unbind_cooling_device | 解绑Cooling Device与Zone的函数 |
thermal_notify_framework | 通知相关函数 |
thermal_generate_netlink_event | 通知相关函数 |
这篇关于Linux内核Thermal框架详解二、Thermal Core(1)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!