1#!/system/bin/sh 2# 3# Copyright (C) 2021 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# Exit on errors, or whenever an unset variable is substituted 18set -eu 19 20stop thermal_manager 21setprop vendor.powerhal.init 0 22stop power-hal-1-0 23start power-hal-1-0 24 25echo 'Locking CPU to 1125000 (56% relative to max freq)' 26echo 11 > /proc/ppm/policy/ut_fix_freq_idx 27 28expected_gpu_freq='390000' 29echo "Locking GPU to ${expected_gpu_freq} (min freq)" 30echo "${expected_gpu_freq}" > /proc/gpufreq/gpufreq_opp_freq 31 32expected_cpu_freqs='1125000, 1125000, 1125000, 1125000' 33cpu_freqs="$(cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq | sed -z 's/\n/, /g')" 34echo "Set CPU frequencies to ${cpu_freqs}" 35if [[ "${cpu_freqs}" -ne "${expected_cpu_freqs}" ]]; then 36 echo "Failed to set CPUs to expected frequencies: ${expected_cpu_freqs}" 37 exit 1 38fi 39 40gpu_freq="$(cat /proc/gpufreq/gpufreq_opp_freq | tail -n 1 | cut -d '=, ' -f 5)" 41echo "Set GPU frequency to ${gpu_freq}" 42if [[ "${gpu_freq}" -ne "${expected_gpu_freq}" ]]; then 43 echo "Failed to set GPU to expected frequency: ${expected_gpu_freq}" 44 exit 1 45fi 46 47 48