1#!/system/bin/sh
2#
3# Copyright (C) 2020 The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#      http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17# performance test setup for sw5100 devices
18function disable_thermal()
19{
20    thermal_path='/sys/devices/virtual/thermal/'
21
22    nz=$(ls -al $thermal_path | grep thermal_zone | wc -l)
23    i=0
24    while [ $i -lt $nz ]; do
25        tz_path=$thermal_path'thermal_zone'$i'/'
26        mode_path=$tz_path'mode'
27
28        if [ -f $mode_path ]; then
29            echo disabled > $tz_path'mode'
30        fi
31        i=$(($i + 1));
32    done
33}
34
35disable_thermal
36#setprop vendor.powerhal.init 0
37#setprop ctl.restart vendor.power-hal-aidl
38
39cpubase=/sys/devices/system/cpu
40gov=cpufreq/scaling_governor
41
42cpu=0
43top=4
44# 614400 864000 1363200 1708800
45cpufreq=1708800
46# Set the cores around 1.7G
47while [ $((cpu < $top)) -eq 1 ]; do
48  echo 1 > $cpubase/cpu${cpu}/online
49  echo userspace > $cpubase/cpu${cpu}/$gov
50  echo $cpufreq > /sys/devices/system/cpu/cpu$cpu/cpufreq/scaling_max_freq
51  echo $cpufreq > /sys/devices/system/cpu/cpu$cpu/cpufreq/scaling_setspeed
52  S=`cat $cpubase/cpu${cpu}/cpufreq/scaling_cur_freq`
53  echo "set cpu $cpu to $S kHz"
54  cpu=$(($cpu + 1))
55done
56
57echo "disable GPU bus split"
58echo 0 > /sys/class/kgsl/kgsl-3d0/bus_split
59echo "enable GPU force clock on"
60echo 1 > /sys/class/kgsl/kgsl-3d0/force_clk_on
61echo "set GPU idle timer to 10000"
62echo 10000 > /sys/class/kgsl/kgsl-3d0/idle_timer
63
64# 1010 900 700 470 310 mhz
65echo gpubw_mon > /sys/class/devfreq/kgsl-busmon/governor
66echo 1010000000 > /sys/class/devfreq/kgsl-busmon/min_freq
67echo -n "set GPU bus frequency to max at "
68cat /sys/class/devfreq/kgsl-busmon/target_freq
69
70# 1010 900 700 470 310 mhz
71echo msm-adreno-tz > /sys/class/kgsl/kgsl-3d0/devfreq/governor
72echo 1010000000 > /sys/class/kgsl/kgsl-3d0/devfreq/min_freq
73echo 0 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel
74echo 0 > /sys/class/kgsl/kgsl-3d0/min_pwrlevel
75echo -n "set GPU frequency to max at "
76cat /sys/class/kgsl/kgsl-3d0/devfreq/cur_freq
77