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