harmony 鸿蒙Thermal Control Customization
Thermal Control Customization
Overview
Introduction
By default, OpenHarmony provides the thermal control feature. If a device becomes overheated during usage, thermal control measures need to be taken for the device. For example, if the battery temperature is too high during charging, then thermal control needs to be applied to the charging device. However, thermal control varies according to product specifications. To address this issue, OpenHarmony provides the thermal control customization function.
Constraints
The configuration path for battery level customization is subject to the configuration policy. In this development guide, /vendor
is used as an example of the configuration path. During actual development, you need to modify the customization path based on the product configuration policy.
How to Develop
Setting Up the Environment
Hardware requirements:
Development board running the standard system, for example, the DAYU200 or Hi3516D V300 open source suite.
Environment requirements:
For details about the requirements on the Linux environment, see Quick Start.
Getting Started with Development
The following uses DAYU200 as an example to illustrate thermal control customization.
Create the
thermal
folder in the product directory /vendor/hihope/rk3568.Create a target folder by referring to the default thermal control configuration folder, and install it in
//vendor/hihope/rk3568/thermal
. The content is as follows:profile ├── BUILD.gn ├── thermal_service_config.xml
Write the custom
thermal_service_config.xml
file by referring to the thermal_service_config.xml file in the default thermal control configuration folder. The following table describes the related configuration items.Table 1 Configuration items for thermal control
|Configuration Item|Configuration Item Description|Parameter|Parameter Description|Data Type|Value Range|
|——–|——–|——–|——–|——–|——–|
|name=“cpu_big”|Big-core CPU control (big-core CPU frequency)|N/A|N/A|N/A|N/A|
|name=“cpu_med”|Medium-core CPU control (medium-core CPU frequency)|N/A|N/A|N/A|N/A|
|name=“cpu_lit”|Small-core CPU control (small-core CPU frequency)|N/A|N/A|N/A|N/A|
|name=“gpu”|GPU control (GPU frequency)|N/A|N/A|N/A|N/A|
|name=“lcd”|LCD control (screen brightness)|N/A|N/A|N/A|N/A|
|name=“volume”|Sound control (volume)|uid|User ID|int|Product-specific|
|name=“current”|Charging current control (charging current during fast charging and slow charging)|protocol|Supported charging protocols: fast charging (supercharge) and slow charging (buck)|string|sc or buck|
|name=“current”|Charging current control|event|- 1: event sending enabled
-0: event sending disabled|int|0 or 1|
|name=“voltage”|Charging voltage control (charging voltage during fast charging and slow charging)|protocol|Supported charging protocols: fast charging (supercharge) and slow charging (buck)|string|sc or buck|
|name=“voltage”|Charging voltage control|event|- 1: event sending enabled
-0: event sending disabled|int|0 or 1|
|name=“process_ctrl”|Process control (survival status of foreground and background processes)|event|- 1: event sending enabled
-0: event sending disabled
If this parameter is not set, the value is defaulted to 0.|int|0 or 1|
|name=“shut_down”|Shutdown control (device shutdown)|event|- 1: event sending enabled
-0: event sending disabled|int|0 or 1|
|name=“thermallevel”|Thermal level control (thermal level reporting)|event|- 1: event sending enabled
-0: event sending disabled|int|0 or 1|
|name=“popup”|Pop-up window control (pop-up window display)|N/A|N/A|N/A|N/A|
```shell
<action>
<item name="cpu_big"/>
<item name="cpu_med"/>
<item name="cpu_lit"/>
<item name="gpu"/>
<item name="lcd"/>
<item name="volume" uid="2001,2002"/>
<item name="current" protocol="sc,buck" event="1"/>
<item name="voltage" protocol="sc,buck" event="1"/>
<item name="process_ctrl" event=""/>
<item name="shut_down" event="0"/>
<item name="thermallevel" event="0"/>
<item name="popup"/>
</action>
```
Write the
BUILD.gn
file by referring to the BUILD.gn file in the default thermal control configuration folder to pack thethermal_service_config.xml
file to the/vendor/etc/thermal_config
directory. The configuration is as follows:import("//build/ohos.gni") # Reference build/ohos.gni. ohos_prebuilt_etc("thermal_service_config") { source = "thermal_service_config.xml" relative_install_dir = "thermal_config" install_images = [ chipset_base_dir ] # Required configuration for installing the thermal_service_config.xml file in the vendor directory. part_name = "product_rk3568" # Set part_name to product_rk3568 for subsequent build. You can change it as required. }
Add the build target to
module_list
in ohos.build in the/vendor/hihope/rk3568
directory. For example:{ "parts": { "product_rk3568": { "module_list": [ "//vendor/hihope/rk3568/default_app_config:default_app_config", "//vendor/hihope/rk3568/image_conf:custom_image_conf", "//vendor/hihope/rk3568/preinstall-config:preinstall-config", "//vendor/hihope/rk3568/resourceschedule:resourceschedule", "//vendor/hihope/rk3568/etc:product_etc_conf", "//vendor/hihope/rk3568/thermal/profile:thermal_service_config", // Add the configuration for building of thermal_service_config. ] } }, "subsystem": "product_hihope" }
In the preceding code,
//vendor/hihope/rk3568/thermal/
is the folder path,profile
is the folder name, andthermal_service_config
is the build target.Build the customized version by referring to Quick Start.
./build.sh --product-name rk3568 --ccache
Burn the customized version to the DAYU200 development board.
Debugging and Verification
After startup, run the following command to launch the shell command line:
hdc shell
Obtain the current thermal control information.
hidumper -s 3303 -a -a
The following is the reference thermal control result after customization:
-------------------------------[ability]------------------------------- ----------------------------------ThermalService--------------------------------- name: cpu_big strict: 0 enableEvent: 0 name: cpu_med strict: 0 enableEvent: 0 name: cpu_lit strict: 0 enableEvent: 0 name: gpu strict: 0 enableEvent: 0 name: boost strict: 0 enableEvent: 0 name: lcd strict: 0 enableEvent: 0 name: volume uid: 2001,2002 strict: 0 enableEvent: 0 name: current protocol: sc,buck strict: 0 enableEvent: 1 name: voltage protocol: sc,buck strict: 0 enableEvent: 1 name: process_ctrl strict: 0 enableEvent: 0 name: shut_down strict: 0 enableEvent: 0 name: thermallevel strict: 0 enableEvent: 0 name: popup strict: 0 enableEvent: 0
Reference
During development, you can refer to the default thermal control configuration.
Packing path: /vendor/etc/thermal_config/hdf
你可能感兴趣的鸿蒙文章
harmony 鸿蒙AI Framework Development Guide
harmony 鸿蒙NNRt Access Adaptation
harmony 鸿蒙Application Privilege Configuration
harmony 鸿蒙Setting Up a Development Environment
harmony 鸿蒙Development Guidelines
harmony 鸿蒙Application Framework Overview
- 所属分类: 后端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦