prep_fugu.sh revision 65c7566490901d1b3dba550c1ceee5ee75aab987
1#!/bin/bash
2
3cpubase=/sys/devices/system/cpu
4gov=cpufreq/scaling_governor
5
6adb root
7adb wait-for-device
8thermal=$(adb shell "getprop persist.service.thermal")
9echo "thermal status: $thermal"
10if [ $thermal -eq 1 ]
11then
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"
23fi
24
25adb 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
31cpu=0
32S=1166000
33while [ $((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))
42done
43
44#/sys/class/devfreq/dfrgx/available_frequencies is empty, so set to min
45echo "performance mode, 457 MHz"
46adb shell "echo performance > /sys/class/devfreq/dfrgx/governor"
47adb shell "echo 457000 > /sys/class/devfreq/dfrgx/min_freq"
48adb shell "echo 457000 > /sys/class/devfreq/dfrgx/max_freq"
49