distribution/packages/jelos/profile.d/99-freqfunctions
fewtarius 05c9b2bb64
* Fix oops
* EmulationStation enhanced power save by default
* Fix textviewer dependency
2022-02-11 22:08:46 -05:00

50 lines
877 B
Bash

#!/bin/sh
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2021-present Fewtarius (https://github.com/fewtarius)
. /etc/os-release
set_gov() {
for POLICY in ${CPU_FREQ[@]}
do
echo $1 >${POLICY} 2>/dev/null
done
for HANDLE in ${GPU_FREQ} ${DMC_FREQ}
do
echo $1 >${HANDLE} 2>/dev/null || echo dmc_$1 >${HANDLE} 2>/dev/null
done
}
enable_cores() {
for CORE in ${1}
do
echo 1 >/sys/devices/system/cpu/cpu${CORE}/online
done
}
disable_cores() {
for CORE in ${FAST_CORES}
do
echo 0 >/sys/devices/system/cpu/cpu${CORE}/online
done
}
maxperf() {
enable_cores "${FAST_CORES}"
disable_cores "${SLOW_CORES}"
set_gov performance
}
normperf() {
enable_cores "${SLOW_CORES}"
disable_cores "${FAST_CORES}"
set_gov ondemand
}
powersave() {
enable_cores "${SLOW_CORES}"
disable_cores "${FAST_CORES}"
set_gov powersave
}