Linux内核Thermal框架详解二、Thermal Core(1)

本文详细剖析了LinuxThermal框架中的ThermalCore,它是连接Governor、CoolingDevice和ThermalZone的核心,负责它们的注册、温度监控及中断处理。ThermalCore提供了注册和注销接口,以及绑定和解绑设备的功能,并通过thermal_zone_device_update进行中断处理和轮询更新。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

本文部分内容参考

万字长文 | Thermal框架源码剖析

Linux Thermal机制源码分析之框架概述_不捡风筝的玖伍贰柒的博客-优快云博客

特此致谢!

一、概述

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

通知相关函数
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

蓝天居士

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值