• Home
Name Date Size #Lines LOC

..--

application/12-May-2024-2,6982,005

etc/init/12-May-2024-6561

figures/12-May-2024-

frameworks/12-May-2024-1,4951,057

interfaces/12-May-2024-1,037636

sa_profile/12-May-2024-4528

services/12-May-2024-10,1977,649

test/12-May-2024-3,5812,694

utils/12-May-2024-897594

LICENSED12-May-20249.9 KiB177150

OAT.xmlD12-May-2024982 2610

README.mdD12-May-20249.9 KiB195172

README_zh.mdD12-May-20248.3 KiB195172

bundle.jsonD12-May-20242.8 KiB8584

thermalmgr.gniD12-May-2024720 1815

README.md

1# Thermal Manager
2
3-   [Introduction](#section0056945901)
4-   [Directory Structure](#section0056945902)
5-   [Configuration Description](#section0056945903)
6-   [Repositories Involved](#section0056945904)
7
8## Introduction<a name="section0056945901"></a>
9
10The thermal manager provides the device temperature management and control capabilities to ensure the thermal safety and experience of the entire system.
11
12**Figure 1**  Architecture of the thermal manager
13![](figures/thermal_manager_architecture.png "Architecture of the thermal manager")
14
15**Key components of the thermal manager**:
16
171. Thermal Manager: provides temperature query and callback APIs for applications and other subsystems.
182. Thermal Service: implements core temperature control functions, such as temperature detection, temperature level arbitration, and action delivery, according to the configuration file.
193. Thermal HDI: implements temperature driver information reporting and driver instruction delivery according to the configuration file.
204. Thermal Protector: implements simplified temperature control in the non-running state according to the configuration file.
21
22## Directory Structure<a name="section0056945902"></a>
23```
24/base/powermgr/thermal_manager
25├── application                  # Native application
26│   └── protector                # Thermal Protector code
27├── etc                          # init configuration
28├── figures                      # Figures
29├── frameworks                   # NAPIs
30├── hdi                          # Thermal HDI code
31│   ├── api                      # APIs
32│   ├── client                   # Client code
33│   └── service                  # Service code
34├── interface                    # APIs
35│   ├── innerkits                # Internal APIs
36│   └── kits                     # External APIs
37├── sa_profile                   # SA profile
38├── services                     # Thermal Service code
39│   ├── native                   # Native APIs
40│   ├── test                     # Unit test code
41│   └── zidl                     # zidl APIs
42├── test                         # Test code
43└── utils                        # Utilities
44```
45
46## Configuration Description<a name="section0056945903"></a>
47**1. thermal\_service\_config.xml**
48Configuration example:
49
50```
51<?xml version="1.0" encoding="UTF-8"?>
52<thermal version="0.99" product="ipx">
53    <base>
54        <item tag="temperature_query_enum" value="soc,battery,shell,ambient"/>
55    </base>
56    <level>
57        <sensor_cluster name="warm_base" sensor="shell">
58            <item level="1" threshold="35000" threshold_clr="33000"/>
59            <item level="2" threshold="37000" threshold_clr="35000"/>
60            <item level="3" threshold="40000" threshold_clr="38000"/>
61        </sensor_cluster>
62        <sensor_cluster name="warm_safe" sensor="battery,pa">
63            <item level="1" threshold="48000,60000" threshold_clr="45000,55000"/>
64        </sensor_cluster>
65    </level>
66    <state>
67        <item name="screen"/>
68        <item name="charge"/>
69    </state>
70    <action>
71        <item name="cpu"/>
72        <item name="current"/>
73        <item name="shut_down" param="100"/>
74        <item name="thermal_level" strict="1"/>
75    </action>
76    <policy>
77        <config name="warm_base" level="1">
78            <cpu screen="1">2800000</cpu>
79            <cpu screen="0">2400000</cpu>
80            <current charge="1">1500</current>
81            <thermal_level>3</thermal_level>
82        </config>
83        <config name="warm_base" level="2">
84            <cpu screen="1">2200000</cpu>
85            <cpu screen="0">1800000</cpu>
86            <current charge="1">1200</current>
87            <thermal_level>4</thermal_level>
88        </config>
89        <config name="warm_base" level="3">
90            <cpu screen="1">1600000</cpu>
91            <cpu screen="0">1200000</cpu>
92            <current charge="1">1000</current>
93            <thermal_level>5</thermal_level>
94        </config>
95        <config name="warm_safe" level="1">
96            <shut_down>1</shut_down>
97        </config>
98    </policy>
99</thermal>
100```
101```
102thermal                          # Root directory. Wherein, version indicates the version number, and product indicates the product name.
103├── base                         # base directory, used to configure basic parameters.
104│   └── item                     # item directory. Wherein, tag indicates the configuration tag, and value indicates the configuration value.
105├── level                        # Level directory, used to store the temperature level information.
106│   └── sensor_cluster           # sensor_cluster directory, used to configure a cluster of sensors. Wherein, name indicates the cluster name, and sensor indicates the sensor name.
107│       └── item                 # item directory, used to configure the temperature level information. Wherein, level indicates the temperature level, threshold indicates the triggering temperature, and xxx_clr indicates the setback temperature.
108├── state                        # state directory, used to configure the state machine. Wherein, name indicates the name of the state machine.
109├── action                       # action directory, used to configure actions. Wherein, name indicates the name of the action, param indicates the action parameter, and strict indicates the arbitration scheme.
110└── policy                       # policy directory, used to configure the policy for the corresponding temperature level.
111    └── config                   # config directory, used to configure the action for the corresponding temperature level. Wherein, name is that of sensor_cluster, and the level is that of the item in sensor_cluster.
112        └── <action_name>        # action name corresponding to the action value. The state condition and its value can be configured in this attribute.
113```
114
115**2. thermal\_hdi\_config.xml**
116Configuration example:
117
118```
119<?xml version="1.0" encoding="UTF-8"?>
120<thermal version="0.99" product="ipx">
121    <base>
122        <item tag="xxx" value="3"/>
123    </base>
124    <polling>
125        <group name="v1" interval="5000">
126            <thermal_zone type="skin" replace="shell"/>
127            <thermal_zone type="soc"/>
128            <thermal_node type="charger" path="/sys/module/thermal/param/chg_thermal"/>
129            <thermal_zone type="battery"/>
130        </group>
131    </polling>
132</thermal>
133```
134Directory structure:
135```
136thermal                          # Root directory. Wherein, version indicates the version number, and product indicates the product name.
137├── base                         # base directory, used to configure basic parameters.
138│   └── item                     # item directory. Wherein, tag indicates the configuration tag, and value indicates the configuration value.
139└── polling                      # polling directory, used to configure the temperature reporting information
140    └── group                    # group directory, used to configure the temperature reporting group. Wherein, name indicates the group name, and interval indicates the polling and reporting interval, in milliseconds.
141        ├── thermal_zone         # thermal_zone directory, used to configure the thermal zone reporting information. Wherein, type indicates the driver type, and replace (optional) indicates the name of the driver type to replace.
142        └── thermal_node         # thermal_node directory, used to configure driver node reporting information. Wherein, path indicates the node path.
143```
144
145**3. thermal\_protector\_config.xml**
146Configuration example:
147
148```
149<?xml version="1.0" encoding="utf-8"?>
150<thermal version="0.99" product="ipx">
151    <base>
152        <item tag="xxx" value="3"/>
153    </base>
154    <control>
155        <thermal_zone type="battery" interval="5000">
156            <item level="1" threshold="37000" threshold_clr="35000">
157                <current>1800</current>
158            </item>
159            <item level="2" threshold="40000" threshold_clr="38000">
160                <current>1500</current>
161                <voltage>5</voltage>
162            </item>
163        </thermal_zone>
164    </control>
165</thermal>
166
167```
168Directory structure:
169```
170thermal                          # Root directory. Wherein, version indicates the version number, and product indicates the product name.
171├── base                         # base directory, used to configure basic parameters.
172│   └── item                     # item directory. Wherein, tag indicates the configuration tag, and value indicates the configuration value.
173└── control                      # control directory, used to configure the temperature level and corresponding action.
174    └── thermal_zone             # thermal_zone directory, used to configure the thermal zone reporting information. Wherein, type indicates the driver type, and interval indicates the polling and reporting interval, in milliseconds.
175        └── item                 # item directory, used to configure the temperature level information. Wherein, level indicates the temperature level, threshold indicates the triggering temperature, and xxx_clr indicates the setback temperature.
176            └── <action_name>    # action name corresponding to the action value.
177```
178
179## Repositories Involved<a name="section0056945904"></a>
180[Power Management Subsystem](https://gitee.com/openharmony/docs/blob/master/en/readme/power-management.md)
181
182[powermgr_power_manager](https://gitee.com/openharmony/powermgr_power_manager)
183
184[powermgr_display_manager](https://gitee.com/openharmony/powermgr_display_manager)
185
186[powermgr_battery_manager](https://gitee.com/openharmony/powermgr_battery_manager)
187
188**powermgr_thermal_manager**
189
190[powermgr_battery_statistics](https://gitee.com/openharmony/powermgr_battery_statistics)
191
192[powermgr_battery_lite](https://gitee.com/openharmony/powermgr_battery_lite)
193
194[powermgr_powermgr_lite](https://gitee.com/openharmony/powermgr_powermgr_lite)
195

README_zh.md

1# 热管理服务
2
3-   [简介](#section0056945901)
4-   [目录](#section0056945902)
5-   [配置说明](#section0056945903)
6-   [相关仓](#section0056945904)
7
8## 简介<a name="section0056945901"></a>
9
10热管理服务提供设备温度管理控制能力,保障整机热安全及热体验。
11
12**图 1**  热管理服务架构图
13![](figures/thermal_manager_architecture.png "热管理服务架构图")
14
15**热管理服务模块功能说明**:
16
171. 温控管理中心(Thermal Manager):提供对应用及其他子系统的温控查询及回调接口。
182. 温控核心服务(Thermal Service):提供温度检测、档位仲裁及动作下发等温控核心功能,附配置文件。
193. 内核连接模块(Thermal HDI):提供温度驱动信息上报及驱动指令下发等功能,附配置文件。
204. 非运行态温控模块(Thermal Protector):提供非运行态时的简化温控服务,附配置文件。
21
22## 目录<a name="section0056945902"></a>
23```
24/base/powermgr/thermal_manager
25├── application                  # native应用
26│   └── protector                # Thermal Protector代码
27├── etc                          # init配置
28├── figures                      # 图片
29├── frameworks                   # napi接口
30├── hdi                          # Thermal HDI代码
31│   ├── api                      # api接口
32│   ├── client                   # 客户端代码
33│   └── service                  # 服务代码
34├── interface                    # 接口
35│   ├── innerkits                # 内部接口
36│   └── kits                     # 外部接口
37├── sa_profile                   # SA配置文件
38├── services                     # Thermal Service代码
39│   ├── native                   # native层
40│   ├── test                     # 单元测试代码
41│   └── zidl                     # zidl层
42├── test                         # 测试代码
43└── utils                        # 工具和通用层
44```
45
46## 配置说明<a name="section0056945903"></a>
47**thermal_service_config.xml**
48配置示例:
49
50```
51<?xml version="1.0" encoding="UTF-8"?>
52<thermal version="0.99" product="ipx">
53    <base>
54        <item tag="temperature_query_enum" value="soc,battery,shell,ambient"/>
55    </base>
56    <level>
57        <sensor_cluster name="warm_base" sensor="shell">
58            <item level="1" threshold="35000" threshold_clr="33000"/>
59            <item level="2" threshold="37000" threshold_clr="35000"/>
60            <item level="3" threshold="40000" threshold_clr="38000"/>
61        </sensor_cluster>
62        <sensor_cluster name="warm_safe" sensor="battery,pa">
63            <item level="1" threshold="48000,60000" threshold_clr="45000,55000"/>
64        </sensor_cluster>
65    </level>
66    <state>
67        <item name="screen"/>
68        <item name="charge"/>
69    </state>
70    <action>
71        <item name="cpu"/>
72        <item name="current"/>
73        <item name="shut_down" param="100"/>
74        <item name="thermal_level" strict="1"/>
75    </action>
76    <policy>
77        <config name="warm_base" level="1">
78            <cpu screen="1">2800000</cpu>
79            <cpu screen="0">2400000</cpu>
80            <current charge="1">1500</current>
81            <thermal_level>3</thermal_level>
82        </config>
83        <config name="warm_base" level="2">
84            <cpu screen="1">2200000</cpu>
85            <cpu screen="0">1800000</cpu>
86            <current charge="1">1200</current>
87            <thermal_level>4</thermal_level>
88        </config>
89        <config name="warm_base" level="3">
90            <cpu screen="1">1600000</cpu>
91            <cpu screen="0">1200000</cpu>
92            <current charge="1">1000</current>
93            <thermal_level>5</thermal_level>
94        </config>
95        <config name="warm_safe" level="1">
96            <shut_down>1</shut_down>
97        </config>
98    </policy>
99</thermal>
100```
101```
102thermal                          # 根目录,version为版本号;product为产品名
103├── base                         # base目录,配置基本参数
104│   └── item                     # item目录,tag为配置标签,value为配置值
105├── level                        # level目录,配置温度档位信息
106│   └── sensor_cluster           # sensor_cluster目录,表示一个sensor集合,name为集合名,sensor为传感器名
107│       └── item                 # item目录,配置具体档位信息,level为等级,threshold为触发温度,xxx_clr为回退温度
108├── state                        # state目录,配置状态机,name为状态机名称
109├── action                       # action目录,配置动作,name为加载动作名称,param为加载参数,strict为仲裁方案
110└── policy                       # policy目录,配置档位对应的动作
111    └── config                   # config目录,配置对应档位的动作,name对应sensor_cluster的name,level对应其item中的level
112        └── <action_name>        # 标签值对应动作的动作值,属性中可以配置state条件及对应的值
113```
114
115**2)thermal_hdi_config.xml**
116配置示例:
117
118```
119<?xml version="1.0" encoding="UTF-8"?>
120<thermal version="0.99" product="ipx">
121    <base>
122        <item tag="xxx" value="3"/>
123    </base>
124    <polling>
125        <group name="v1" interval="5000">
126            <thermal_zone type="skin" replace="shell"/>
127            <thermal_zone type="soc"/>
128            <thermal_node type="charger" path="/sys/module/thermal/param/chg_thermal"/>
129            <thermal_zone type="battery"/>
130        </group>
131    </polling>
132</thermal>
133```
134目录说明:
135```
136thermal                          # 根目录,version为版本号;product为产品名
137├── base                         # base目录,配置基本参数
138│   └── item                     # item目录,tag为配置标签,value为配置值;
139└── polling                      # polling目录,配置温度上报信息
140    └── group                    # group目录,配置上报组,name为组名,interval为轮询上报周期,单位ms
141        ├── thermal_zone         # thermal_zone目录,配置thermal zone上报,type对应该驱动的type,replace(可选)为替换的type名
142        └── thermal_node         # thermal_node目录,配置驱动节点上报,path为节点路径
143```
144
145**3)thermal_protector_config.xml**
146配置示例:
147
148```
149<?xml version="1.0" encoding="utf-8"?>
150<thermal version="0.99" product="ipx">
151    <base>
152        <item tag="xxx" value="3"/>
153    </base>
154    <control>
155        <thermal_zone type="battery" interval="5000">
156            <item level="1" threshold="37000" threshold_clr="35000">
157                <current>1800</current>
158            </item>
159            <item level="2" threshold="40000" threshold_clr="38000">
160                <current>1500</current>
161                <voltage>5</voltage>
162            </item>
163        </thermal_zone>
164    </control>
165</thermal>
166
167```
168目录说明:
169```
170thermal                          # 根目录,version为版本号;product为产品名
171├── base                         # base目录,配置基本参数
172│   └── item                     # item目录,tag为配置标签,value为配置值;
173└── control                      # control,配置温度档位及动作
174    └── thermal_zone             # thermal_zone目录,type为对应类型,interval为轮询上报周期,单位ms
175        └── item                 # item目录,配置具体档位信息,level为等级,threshold为触发温度,xxx_clr为回退温度
176            └── <action_name>    # 标签值对应动作的动作值
177```
178
179## 相关仓<a name="section0056945904"></a>
180[电源管理子系统](https://gitee.com/openharmony/docs/blob/master/zh-cn/readme/%E7%94%B5%E6%BA%90%E7%AE%A1%E7%90%86%E5%AD%90%E7%B3%BB%E7%BB%9F.md)
181
182[powermgr_power_manager](https://gitee.com/openharmony/powermgr_power_manager)
183
184[powermgr_display_manager](https://gitee.com/openharmony/powermgr_display_manager)
185
186[powermgr_battery_manager](https://gitee.com/openharmony/powermgr_battery_manager)
187
188**powermgr_thermal_manager**
189
190[powermgr_battery_statistics](https://gitee.com/openharmony/powermgr_battery_statistics)
191
192[powermgr_battery_lite](https://gitee.com/openharmony/powermgr_battery_lite)
193
194[powermgr_powermgr_lite](https://gitee.com/openharmony/powermgr_powermgr_lite)
195