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 perfd
20adb shell stop thermal-engine
21
22# cpu possible frequencies
23# 204000 229500 255000 280500 306000 331500 357000 382500 408000 433500 459000
24# 484500 510000 535500 561000 586500 612000 637500 663000 688500 714000 739500
25# 765000 790500 816000 841500 867000 892500 918000 943500 969000 994500 1020000
26# 1122000 1224000 1326000 1428000 1530000 1632000 1734000 1836000 1938000
27# 2014500 2091000 2193000 2295000 2397000 2499000
28
29S=1326000
30echo "set cpu $cpu to $S hz";
31adb shell "echo userspace > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"
32adb shell "echo $S > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq"
33adb shell "echo $S > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq"
34adb shell "echo $S > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"
35
36#disable hotplug
37adb shell "echo 0 > /sys/devices/system/cpu/cpuquiet/tegra_cpuquiet/enable"
38
39# gbus possible rates
40# 72000 108000 180000 252000 324000 396000 468000 540000 612000 648000
41# 684000 708000 756000 804000 852000 (kHz)
42
43S=324000000
44echo "set gpu to $S hz"
45adb shell "echo 1 > /d/clock/override.gbus/state"
46adb shell "echo $S > /d/clock/override.gbus/rate"
47