| 1 | #!/bin/bash |
| 2 | |
| 3 | cpubase=/sys/devices/system/cpu |
| 4 | gov=cpufreq/scaling_governor |
| 5 | |
| 6 | adb root |
| 7 | adb wait-for-device |
| 8 | thermal=$(adb shell "getprop persist.service.thermal") |
| 9 | echo "thermal status: $thermal" |
| 10 | if [ $thermal -eq 1 ] |
| 11 | then |
| 12 | echo "Trying to setprop persist.service.thermal 0 and reboot" |
| 13 | adb shell "setprop persist.service.thermal 0" |
| 14 | adb reboot |
| 15 | adb wait-for-device |
| 16 | thermal=$(adb shell "getprop persist.service.thermal") |
| 17 | if [ $thermal -eq 1 ] |
| 18 | then |
| 19 | echo "thermal property is still 1. Abort." |
| 20 | exit -1 |
| 21 | fi |
| 22 | echo "Successfully setup persist.service.thermal to 0" |
| 23 | fi |
| 24 | |
| 25 | adb shell stop perfprod |
| 26 | |
| 27 | # cores |
| 28 | # 1833000 1750000 1666000 1583000 1500000 1416000 1333000 1250000 |
| 29 | # 1166000 1083000 1000000 916000 833000 750000 666000 583000 500000 |
| 30 | |
| 31 | cpu=0 |
| 32 | S=1166000 |
| 33 | while [ $((cpu < 3)) -eq 1 ]; do |
| 34 | echo "Setting cpu ${cpu} & $(($cpu + 1)) cluster to $S hz" |
| 35 | # cpu0/online doesn't exist, because you can't turned it off, so ignore results of this command |
| 36 | adb shell "echo 1 > $cpubase/cpu${cpu}/online" &> /dev/null |
| 37 | adb shell "echo userspace > $cpubase/cpu${cpu}/$gov" |
| 38 | adb shell "echo $S > $cpubase/cpu${cpu}/cpufreq/scaling_max_freq" |
| 39 | adb shell "echo $S > $cpubase/cpu${cpu}/cpufreq/scaling_min_freq" |
| 40 | adb shell "echo $S > $cpubase/cpu${cpu}/cpufreq/scaling_setspeed" |
| 41 | cpu=$(($cpu + 2)) |
| 42 | done |
| 43 | |
| 44 | #/sys/class/devfreq/dfrgx/available_frequencies is empty, so set to min |
| 45 | echo "performance mode, 457 MHz" |
| 46 | adb shell "echo performance > /sys/class/devfreq/dfrgx/governor" |
| 47 | adb shell "echo 457000 > /sys/class/devfreq/dfrgx/min_freq" |
| 48 | adb shell "echo 457000 > /sys/class/devfreq/dfrgx/max_freq" |