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 module 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 module 13 14 15 16**Key components of the Thermal Manager module**: 17 181. Thermal Manager: provides temperature query and callback APIs for applications and other subsystems. 192. Thermal Service: implements core temperature control functions, such as temperature detection, temperature level arbitration, and action delivery, according to the configuration file. 203. Thermal HDI: implements temperature driver information reporting and driver instruction delivery according to the configuration file. 214. Thermal Protector: implements simplified temperature control in the non-running state according to the configuration file. 22 23## Directory Structure<a name="section0056945902"></a> 24``` 25/base/powermgr/thermal_manager 26├── application # Native application 27│ ├── init # Init configuration 28│ └── protector # Thermal Protector code 29├── figures # Architecture 30├── frameworks # Framework layer 31│ ├── napi # NAPI layer 32│ └── native # Native layer 33├── interface # API layer 34│ └── inner_api # Internal APIs 35├── sa_profile # SA profile 36├── services # Thermal Service code 37│ ├── native # Native layer 38│ └── zidl # Zidl layer 39├── test # Test code 40│ ├── fuzztest # Fuzz test 41│ ├── unittest # Unit test 42│ ├── systemtest # System test 43│ └── utils # Test tools 44└── utils # Utilities 45``` 46 47## Configuration Description<a name="section0056945903"></a> 48**thermal_service_config.xml** 49Configuration example: 50 51``` 52<?xml version="1.0" encoding="UTF-8"?> 53<thermal version="0.99" product="ipx"> 54 <base> 55 <item tag="temperature_query_enum" value="soc,battery,shell,ambient"/> 56 </base> 57 <level> 58 <sensor_cluster name="warm_base" sensor="shell"> 59 <item level="1" threshold="35000" threshold_clr="33000"/> 60 <item level="2" threshold="37000" threshold_clr="35000"/> 61 <item level="3" threshold="40000" threshold_clr="38000"/> 62 </sensor_cluster> 63 <sensor_cluster name="warm_safe" sensor="battery,pa"> 64 <item level="1" threshold="48000,60000" threshold_clr="45000,55000"/> 65 </sensor_cluster> 66 </level> 67 <state> 68 <item name="screen"/> 69 <item name="charge"/> 70 </state> 71 <action> 72 <item name="cpu"/> 73 <item name="current"/> 74 <item name="shut_down" param="100"/> 75 <item name="thermal_level" strict="1"/> 76 </action> 77 <policy> 78 <config name="warm_base" level="1"> 79 <cpu screen="1">2800000</cpu> 80 <cpu screen="0">2400000</cpu> 81 <current charge="1">1500</current> 82 <thermal_level>3</thermal_level> 83 </config> 84 <config name="warm_base" level="2"> 85 <cpu screen="1">2200000</cpu> 86 <cpu screen="0">1800000</cpu> 87 <current charge="1">1200</current> 88 <thermal_level>4</thermal_level> 89 </config> 90 <config name="warm_base" level="3"> 91 <cpu screen="1">1600000</cpu> 92 <cpu screen="0">1200000</cpu> 93 <current charge="1">1000</current> 94 <thermal_level>5</thermal_level> 95 </config> 96 <config name="warm_safe" level="1"> 97 <shut_down>1</shut_down> 98 </config> 99 </policy> 100</thermal> 101``` 102``` 103thermal # Root directory. Wherein, version indicates the version number, and product indicates the product name. 104├── base # base directory, used to configure basic parameters. 105│ └── item # item directory. Wherein, tag indicates the configuration tag, and value indicates the configuration value. 106├── level # level directory, used to store the temperature level information. 107│ └── sensor_cluster # sensor_cluster directory, used to configure a cluster of sensors. Wherein, name indicates the cluster name, and sensor indicates the sensor name. 108│ └── 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. 109├── state # state directory, used to configure the state machine. Wherein, name indicates the name of the state machine. 110├── 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. 111└── policy # policy directory, used to configure the policy for the corresponding temperature level. 112 └── 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. 113 └── <action_name> # action name corresponding to the action value. The state condition and its value can be configured in this attribute. 114``` 115 116 117## Repositories Involved<a name="section0056945904"></a> 118[Power Management Subsystem](https://gitee.com/openharmony/docs/blob/master/en/readme/power-management.md) 119 120[powermgr_power_manager](https://gitee.com/openharmony/powermgr_power_manager) 121 122[powermgr_display_manager](https://gitee.com/openharmony/powermgr_display_manager) 123 124[powermgr_battery_manager](https://gitee.com/openharmony/powermgr_battery_manager) 125 126**powermgr_thermal_manager** 127 128[powermgr_battery_statistics](https://gitee.com/openharmony/powermgr_battery_statistics) 129 130[powermgr_battery_lite](https://gitee.com/openharmony/powermgr_battery_lite) 131 132[powermgr_powermgr_lite](https://gitee.com/openharmony/powermgr_powermgr_lite) 133