distribution/packages/hardware/quirks/devices/Anbernic RG552/sleep.d/pre/002-freq
2023-12-29 14:29:36 +00:00

28 lines
1 KiB
Bash

#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
# Store current freq governors and set governors to powersave.
. /etc/profile
### Get the current cpu and gpu governor, save for when the device wakes from sleep.
CUR_CPU_FREQ="$(cat ${CPU_FREQ}/scaling_governor)"
CUR_GPU_FREQ="$(cat ${GPU_FREQ}/governor)"
set_setting sleep.cpugovernor "${CUR_CPU_FREQ}"
set_setting sleep.gpugovernor "${CUR_GPU_FREQ}"
### Set all governors to powersave
set_cpu_gov powersave
set_dmc_gov powersave
set_gpu_gov powersave
### Set max/min freq to lowest available value
echo 600000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq
echo 600000 > /sys/devices/system/cpu/cpufreq/policy4/scaling_min_freq
echo 200000000 > /sys/devices/platform/ff9a0000.gpu/devfreq/ff9a0000.gpu/min_freq
echo 600000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq
echo 600000 > /sys/devices/system/cpu/cpufreq/policy4/scaling_max_freq
echo 200000000 > /sys/devices/platform/ff9a0000.gpu/devfreq/ff9a0000.gpu/max_freq