1#!/bin/bash
2
3# Copyright (C) 2015 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
17adb root
18adb wait-for-device
19adb shell stop mpdecision
20adb shell stop perfd
21adb shell stop
22for pid in $( adb shell ps | awk '{ if ( $9 == "surfaceflinger" ) { print $2 } }' ); do
23    adb shell kill $pid
24done
25adb shell setprop debug.egl.traceGpuCompletion 1
26adb shell daemonize surfaceflinger
27sleep 3
28adb shell setprop service.bootanim.exit 1
29
30# cpu possible frequencies
31# 204000 229500 255000 280500 306000 331500 357000 382500 408000 433500 459000
32# 484500 510000 535500 561000 586500 612000 637500 663000 688500 714000 739500
33# 765000 790500 816000 841500 867000 892500 918000 943500 969000 994500 1020000
34# 1122000 1224000 1326000 1428000 1530000 1632000 1734000 1836000 1938000
35# 2014500 2091000 2193000 2295000 2397000 2499000
36
37S=1326000
38echo "set cpu $cpu to $S hz";
39adb shell "echo userspace > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"
40adb shell "echo $S > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq"
41adb shell "echo $S > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq"
42adb shell "echo $S > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"
43
44#disable hotplug
45adb shell "echo 0 > /sys/devices/system/cpu/cpuquiet/tegra_cpuquiet/enable"
46
47# gbus possible rates
48# 72000 108000 180000 252000 324000 396000 468000 540000 612000 648000
49# 684000 708000 756000 804000 852000 (kHz)
50
51S=324000000
52echo "set gpu to $S hz"
53adb shell "echo 1 > /d/clock/override.gbus/state"
54adb shell "echo $S > /d/clock/override.gbus/rate"
55