14. Thermal Control Strategy and Test Operation Guide

This documentDescriptionin CV184x on the platformView CPU/TPU clocksand 、Thermal Control Strategyand trip Correspondence、 (hysteresis) 、Simulated Temperature Test Steps,withandinDevice TreeinModify Valueand of 。

14.1. Preparation

1. Kernel Requirements

  • Use SDK Providekernel,andEnsureKernel Configurationinalready CONFIG_THERMAL_EMULATION=y ( Tests need , emul_temp Write ,not Driver )。

14.2. Operation Flow

14.2.1. View CPU/TPU clocks

cat /sys/kernel/debug/clk/clk_summary | grep -E '\b(clk_cpu|clk_tpu)\b'

CPU and TPU of beforeFrequency。

14.2.2. View the current temperature

cat /sys/class/thermal/thermal_zone0/temp

Unitis millicelsius ( ),for example 90000 Indicates 90°C。

14.2.3. Thermal Control Strategy(and trip Correspondence)

Through thermal zone of trip and cooling device ; of CPU/TPU Frequency cv184x_cooling Nodeof dev-freqs ( NodeDefinition build/boards/default/dts/cv184x_arm/cv184x_base_arm.dtsi)。

Table 14.1 andFrequency、Description

CPU Frequency (Hz)

TPU Frequency (Hz)

Description

tmp < 90°C

1000000000

500000000

passive trip,cooling state 0

90 ≤ tmp < 100°C

500000000

375000000

trip_0,cooling state 1

100 ≤ tmp < 120°C

500000000

300000000

trip_1,cooling state 2

tmp ≥ 120°C

(critical trip)

IfBoard-levelor SoC of dev-freqs andonTablenot ,with build/boards/default/dts/cv184x_arm/cv184x_base_arm.dtsi in cv184x_cooling { dev-freqs = ... } andActual clk_summary is 。Default ARM DTS is :(1100M,750M) / (500M,375M) / (500M,300M),and cooling state 0/1/2 。

14.2.4. Hysteresis Description

hysteresis not in Value , Frequency 。

  • Unitand temperature ,is millicelsius

  • Configuration:5000 5°C

  • ( ) trip of temperature

  • ( ): need temperature - hysteresis

Example ( trip 90°C、 5°C):

  • from 91°C to 89°C: ( 90-5=85°C,not )。

  • to 84°C: 85°C after ,Frequency to 。

:If trip is 100°C、 5°C, need to 95°C following from to 。

14.3. Operation Example

14.3.1. Simulated Temperature Test Steps

14.3.2.

cat /sys/class/thermal/thermal_zone0/temp
cat /sys/kernel/debug/clk/clk_summary | grep -E '\b(clk_cpu|clk_tpu)\b'

14.3.3. Simulate 90°C (should enter the first throttling level)

echo 90000 > /sys/class/thermal/thermal_zone0/emul_temp
cat /sys/kernel/debug/clk/clk_summary | grep -E '\b(clk_cpu|clk_tpu)\b'

14.3.4. Simulate 100°C (should enter the second throttling level)

echo 100000 > /sys/class/thermal/thermal_zone0/emul_temp
cat /sys/kernel/debug/clk/clk_summary | grep -E '\b(clk_cpu|clk_tpu)\b'

14.3.5. Simulate a drop to 95°C (with hysteresis, the frequency should remain at the second level)

echo 95000 > /sys/class/thermal/thermal_zone0/emul_temp
cat /sys/kernel/debug/clk/clk_summary | grep -E '\b(clk_cpu|clk_tpu)\b'

14.3.6. Simulate a drop to 94°C (below the hysteresis exit threshold; it should return to the first or a higher level, depending on the policy)

echo 94000 > /sys/class/thermal/thermal_zone0/emul_temp
cat /sys/kernel/debug/clk/clk_summary | grep -E '\b(clk_cpu|clk_tpu)\b'

Ifwith 100°C/5°C is ,need 95°C ; with before DTS in soc_thermal_trip_1 of temperature and hysteresis is 。

14.3.7. Simulate 120°C (trigger critical and force shutdown)

echo 120000 > /sys/class/thermal/thermal_zone0/emul_temp

Devicewill Kernel thermal critical isExecute or ,Do not in Execute。

14.3.8. Modify Thermal Thresholds, Shutdown Temperature, and Hysteresis in the Device Tree

DefaultDefinitionin build/boards/default/dts/cv184x/cv184x_base.dtsi of thermal-zones soc_thermal_0 trips in:

Table 14.2 trip NodeDefaultValue

Node

Default temperature

Default hysteresis

type

soc_thermal_trip_0

90000 (90°C)

5000 (5°C)

passive

trip

soc_thermal_trip_1

100000 (100°C)

5000 (5°C)

passive

trip

soc_thermal_crtical_0

120000 (120°C)

0

critical

/

not Default DTS,with Board Variant:

  • build/boards/default/dts/cv184x/cv184x_base.dtsi

in Board-level DTS trip Attribute(Board NameReplaceisActual ):

  • build/boards/cv184x/Board Name/dts_arm/Board Name.dts

  • Use &label

14.3.9. Board-Level Override Example

in ofBoard-level DTS(Pathusually build/boards/cv184x/Board Name/dts_arm/Board Name.dts) :

/ {

};

/*   base in thermal trip:temperature/hysteresis  is millicelsius */

&soc_thermal_trip_0 {
     temperature = <90000>;   /*  ,for example 90°C */
     hysteresis = <5000>;     /* 5°C  , to  trip following 5°C   */
};

&soc_thermal_trip_1 {
     temperature = <100000>;  /*  ,for example 100°C */
     hysteresis = <5000>;
};

&soc_thermal_crtical_0 {
     temperature = <120000>;  /* shutdown  ,for example 120°C;type   critical */
     hysteresis = <0>;
};

ModifyafterRebuildDevice Treeand Image,cooling-maps trip ,No need to map, trip Value 。

14.4. Related File Index

Table 14.3 Related FilesandPath

FilePath

Description

build/boards/default/dts/cv184x/cv184x_base.dtsi

Default thermal-zones、trip、cooling-maps

build/boards/default/dts/cv184x_arm/cv184x_base_arm.dtsi

cv184x_cooling and dev-freqs

linux_5.10/drivers/soc/cvitek/clock_cooling/cv184x/clock_cooling.c

cooling and clk_set_rate Implementation

Board-level build/boards/cv184x/Board Name/dts_arm/Board Name.dts

&soc_thermal_trip_0&soc_thermal_trip_1&soc_thermal_crtical_0 Value