1#buller is bullhead & angler  (☞゚ヮ゚)☞
2
3nr=$(adb shell cat /proc/cpuinfo | grep processor | wc -l)
4cpubase=/sys/devices/system/cpu
5gov=cpufreq/scaling_governor
6
7adb root
8adb wait-for-device
9adb shell stop thermal-engine
10adb shell stop perfd
11
12# LITTLE cores
13# 384000 460800 600000 672000 787200 864000 960000 1248000 1440000
14# BIG cores
15# 384000 480000 633600 768000 864000 960000 1248000 1344000 1440000
16# 1536000 1632000 1689600 1824000
17
18cpu=0
19S=960000
20while [ $((cpu < 4)) -eq 1 ]; do
21    echo "Setting cpu $cpu to $S hz"
22    adb shell "echo 1 > $cpubase/cpu${cpu}/online"
23    adb shell "echo userspace > $cpubase/cpu${cpu}/$gov"
24    adb shell "echo $S > $cpubase/cpu${cpu}/cpufreq/scaling_max_freq"
25    adb shell "echo $S > $cpubase/cpu${cpu}/cpufreq/scaling_min_freq"
26    adb shell "echo $S > $cpubase/cpu${cpu}/cpufreq/scaling_setspeed"
27    cpu=$(($cpu + 1))
28done
29
30while [ $((cpu < $nr)) -eq 1 ]; do
31  echo "disable cpu $cpu"
32  adb shell "echo 0 > $cpubase/cpu${cpu}/online"
33  cpu=$(($cpu + 1))
34done
35
36echo "setting GPU bus and idle timer"
37adb shell "echo 0 > /sys/class/kgsl/kgsl-3d0/bus_split"
38adb shell "echo 1 > /sys/class/kgsl/kgsl-3d0/force_clk_on"
39adb shell "echo 10000 > /sys/class/kgsl/kgsl-3d0/idle_timer"
40
41# angler: 0 762 1144 1525 2288 3509 4173 5271 5928 7904 9887 11863
42adb shell "echo 11863 > /sys/class/devfreq/qcom,gpubw.70/min_freq" &> /dev/null
43# bullhead: 0 762 1144 1525 2288 3509 4173 5271 5928 7102
44adb shell "echo 7102 > /sys/class/devfreq/qcom,gpubw.19/min_freq" &> /dev/null
45
46
47board=$(adb shell "getprop ro.product.board")
48freq=0
49if [ "$board" = "bullhead" ]
50then
51    #600000000 490000000 450000000 367000000 300000000 180000000
52    freq=300000000
53else
54    #600000000 510000000 450000000 390000000 305000000 180000000
55    freq=305000000
56fi
57echo "performance mode, $freq Hz"
58adb shell "echo performance > /sys/class/kgsl/kgsl-3d0/devfreq/governor"
59adb shell "echo $freq > /sys/class/kgsl/kgsl-3d0/devfreq/min_freq"
60adb shell "echo $freq > /sys/class/kgsl/kgsl-3d0/devfreq/max_freq"
61
62adb shell "echo 4 > /sys/class/kgsl/kgsl-3d0/min_pwrlevel"
63adb shell "echo 4 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel"
64
65