immortalwrt/package/lean/luci-app-cpufreq/root/etc/init.d/cpufreq
AmadeusGhost 4502203eca
luci-app-cpufreq: drop untest target (#3915)
Someone reports that it has bug in arm64
2020-03-21 22:37:10 +08:00

28 lines
889 B
Bash
Executable File

#!/bin/sh /etc/rc.common
START=50
NAME=cpufreq
uci_get_by_type() {
local ret=$(uci get $NAME.@$1[0].$2 2>/dev/null)
echo ${ret:=$3}
}
start()
{
config_load cpufreq
local governor=$(uci_get_by_type settings governor ondemand)
local minifreq=$(uci_get_by_type settings minifreq 48000)
local maxfreq=$(uci_get_by_type settings maxfreq 716000)
local upthreshold=$(uci_get_by_type settings upthreshold 50)
local factor=$(uci_get_by_type settings factor 10)
echo $governor > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
echo $minifreq > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq
echo $maxfreq > /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq
if [ "$governor" == "ondemand" ]; then
echo $upthreshold > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
echo $factor > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
fi
}