[One (M7) Android Development] jerrylzy:
Sorry for poor English :)

It is well-known that HTC encrypted their thermal config file, thermald.conf, to prevent users from modifying. Since 4.2.2, it throttles both gpu and cpu when battery reached 40C. It is not a good idea, since it cannot satisfy both those who want coolness and those who want extreme performance. As a result, users and devs have to use a custom thermal solution.

It is a good solution to have a 3rd party thermal management, but I believe there are people who want to use stock kernels or to use powersaver function. So I am here to start a thread about how to write a thermal config file for our own needs.

Requirements

1. a computer with adb and related drivers properly installed

2. your phones rooted

3. wp_mod.ko installed properly or using custom kernel

Step 1:

Find more information about temperature sensors

1. enable usb debug

2. connect your phone to the computer

3.1. input the following

adb pull /proc/last_kmsg

you can find adb.exe in sdk:http://developer.android.com/sdk/index.html

4. open the file, and search "sensor"

3.2. input the following

adb shell
cat /sys/devices/virtual/thermald/thermald_zone*/temp

* is the number of sensor you wanna checkout. it ranges from 0 to 11

the number displayed is the current temperature on this sensor

The following is the info I analysed, some of which may be incorrect

thermal_zone0: enabled, related to cpu
thermal_zone1: enabled, related to cpu
thermal_zone2: disabled, probably related to motherboard
thermal_zone3: disabled, related to cpu
thermal_zone4: disabled, probably related to motherboard
thermal_zone5: disabled, probably related to motherboard
thermal_zone6: disabled, probably related to motherboard
thermal_zone7: enabled, related to cpu
thermal_zone8: enabled, related to cpu
thermal_zone9: enabled, related to cpu
thermal_zone10: disabled, related to cpu
thermal_zone11:disabled, unknown

Step 2

create a txt file on your computer, rename it "thermald.conf"

Step 3

open the "thermald.conf" file you just created

Step 4

Write the first line:

sampling 5000

the number indicates the time interval of the system to scan the temperature, but I doubt whether it has any function now. Also I suggest to leave it unchanged.

Step 5

Define the sensor you want to use and configure its thresholds

[tsens_tz_sensor2]
sampling 1500
thresholds 54 57 64 70 75
thresholds_clr 51 54 57 64 70
actions gpu+cpu gpu+cpu cpu cpu cpu
action_info 400000000+1728000 320000000+1134000 1026000 918000 702000

[tsens_tz_sensor2]

the number after the word "sensor" means the sensor you want to use and config

sampling 1500

time interval of scanning, strongly recommended to leave it unchanged

thresholds 54 57 64 70 75

As it says, these are the thresholds that trigure actions

For example, the number 57 means that if the temperature of this sensor is over 57C, gpu will be throttled to 320mhz and cpu will be throttled to 1134mhz

thresholds_clr 51 54 57 64 70

These are the thresholds that make system to do the former action

For example, the number 54 means that if the temperature of this sensor is under 54C, gpu will be set to 400mhz and cpu will be set to 1728mhz

NOTE: it is strongly recommended to match the (n+1)th thresholds_clr to the nth thresholds, except threshold that trigures shutdown action

actions

These are the actions you want to take, like throttling cpu, gpu and even brightness.

If you want to take multiple actions, just use "+" to connect

For example, if you want to throttle both cpu and gpu

just type

actions cpu+gpu

If you does not want to take any action, just type: none

*actions:

cpu
gpu
lcd
battery
none

action_info

These define the values of actions defined earlier.

For example,

actions cpu+gpu
action_info 1134000+320000000

means to throttle cpu to 1134mhz and 320mhz

NOTE: The sequence of action info should EXACTLY MATCH the sequence of actions

For example, if you type

"cpu+gpu" in actions line

you can only type first, the cpu frequency you want to set, second, the gpu frequency you want to set

you CANNOT type it like this:

actions cpu+gpu
action_info 320000000+1134000

It can confuse the system when it decides to throttle

cpu frequency table:

384000 486000 594000 702000 810000 918000 1026000 1134000 1242000 1350000 1458000 1566000 1674000 1728000

gpu frequency table:

400000000 320000000 200000000

lcd

any value below 255. 255 means not to lower the brightness

battery

+1
+2

I don't know what these values mean, but it is for sure to be able to lower temperature

none

0

Step 5

save it and put it in your system

put the thermald.conf file in the folder where your adb.exe is placed

adb:

adb shell mount -o rw,remount /dev/block/mmcblk0p35 /system
adb push thermald.conf /system/etc/
adb shell chmod 644 /system/etc/thermald.conf

or use recovery to flash

I will post scripts in attachments

Sample

sampling 5000

[tsens_tz_sensor0]
sampling 1500
thresholds 34
thresholds_clr 32
actions none
action_info 0

[tsens_tz_sensor7]
sampling 1500
thresholds 34 36 45 48 57 66 75 95
thresholds_clr 32 34 36 45 48 57 66 90
actions cpu+gpu cpu+gpu cpu+gpu cpu+gpu cpu+gpu cpu+gpu cpu+gpu cpu+gpu+shutdown
action_info 1728000+320000000 1134000+320000000 1026000+200000000 918000+200000000 702000+200000000 486000+200000000 384000+200000000 384000+200000000+5000

[tsens_tz_sensor8]
sampling 1500
thresholds 34 95
thresholds_clr 32 90
actions none shutdown
action_info 0 5000

[tsens_tz_sensor9]
sampling 1500
thresholds 34 95
thresholds_clr 32 90
actions none shutdown
action_info 0 5000

[tsens_tz_sensor10]
sampling 1500
thresholds 34 95
thresholds_clr 32 90
actions none shutdown
action_info 0 5000

Update

10/12/2013 replaced thermald_boot to prevent pnpmgr from changing config files thanks@hamdir

Downloads

I've modified some thermald files for those who do not want to modify it by their own.

Stock thermald config file from htc:

cpu throttles when reaching 57C. both cpu and gpu throttles when battery temp reaches 40C

View attachment 2277359

Stock no gpu:

cpu throttles when reaching 57C, no gpu throttling

View attachment 2319471

Cool Version:

cpu throttles at 46C, no gpu throttling

View attachment 2319461

Extra Cool

cpu throttles at 40C, no gpu throttling

View attachment 2319462

Ultra Cool

cpu throttles at 36C, gpu is limited at 320mhz

View attachment 2319463

Performance

cpu will not throttle until 76C, no gpu throttling

View attachment 2319464

NOTE: without changes of voltages/drivers/kernels, less heat means less performance. cpu performance is noticeably influenced if cpu freq is lower than 1134mhz. if gpu is at 200mhz you will feel laggy in everything.

Hopefully you guys will enjoy this:D