mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
luci-app-cpufreq: unlocked for all target
This commit is contained in:
parent
2ae46625df
commit
a0adb27385
@ -18,7 +18,7 @@ block-mount coremark kmod-nf-nathelper kmod-nf-nathelper-extra kmod-ipt-raw wget
|
||||
default-settings luci luci-proto-relay luci-app-ddns luci-app-sqm luci-app-upnp luci-app-adbyby-plus luci-app-autoreboot \
|
||||
luci-app-filetransfer luci-app-vsftpd luci-app-ssr-plus luci-app-unblockmusic \
|
||||
luci-app-zerotier luci-app-arpbind luci-app-vlmcsd luci-app-wol luci-app-ramfree \
|
||||
luci-app-sfe luci-app-flowoffload luci-app-nlbwmon luci-app-accesscontrol \
|
||||
luci-app-sfe luci-app-flowoffload luci-app-nlbwmon luci-app-accesscontrol luci-app-cpufreq \
|
||||
ddns-scripts_aliyun ddns-scripts_dnspod
|
||||
# For nas targets
|
||||
DEFAULT_PACKAGES.nas:=block-mount fdisk lsblk mdadm
|
||||
|
@ -6,11 +6,11 @@
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=LuCI for CPU IPQ40xx Freq
|
||||
LUCI_DEPENDS:=@TARGET_ipq40xx
|
||||
LUCI_TITLE:=LuCI for CPU Freq Setting
|
||||
LUCI_DEPENDS:=
|
||||
PKG_NAME:=luci-app-cpufreq
|
||||
PKG_VERSION:=1
|
||||
PKG_RELEASE:=2
|
||||
PKG_RELEASE:=3
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
|
@ -1,3 +1,26 @@
|
||||
local fs = require "nixio.fs"
|
||||
|
||||
cpu_freqs = fs.readfile("/sys/devices/system/cpu/cpufreq/policy0/scaling_available_frequencies") or "100000"
|
||||
cpu_freqs = string.sub(cpu_freqs, 1, -3)
|
||||
|
||||
cpu_governors = fs.readfile("/sys/devices/system/cpu/cpufreq/policy0/scaling_available_governors") or "performance"
|
||||
cpu_governors = string.sub(cpu_governors, 1, -3)
|
||||
|
||||
function string.split(input, delimiter)
|
||||
input = tostring(input)
|
||||
delimiter = tostring(delimiter)
|
||||
if (delimiter=='') then return false end
|
||||
local pos,arr = 0, {}
|
||||
for st,sp in function() return string.find(input, delimiter, pos, true) end do
|
||||
table.insert(arr, string.sub(input, pos, st - 1))
|
||||
pos = sp + 1
|
||||
end
|
||||
table.insert(arr, string.sub(input, pos))
|
||||
return arr
|
||||
end
|
||||
|
||||
freq_array = string.split(cpu_freqs, " ")
|
||||
governor_array = string.split(cpu_governors, " ")
|
||||
|
||||
mp = Map("cpufreq", translate("CPU Freq Settings"))
|
||||
mp.description = translate("Set CPU Scaling Governor to Max Performance or Balance Mode")
|
||||
@ -6,22 +29,19 @@ s = mp:section(NamedSection, "cpufreq", "settings")
|
||||
s.anonymouse = true
|
||||
|
||||
governor = s:option(ListValue, "governor", translate("CPU Scaling Governor"))
|
||||
governor:value("ondemand", translate("Ondemand Balance Mode"))
|
||||
governor:value("performance", translate("Performance Mode"))
|
||||
for _, e in ipairs(governor_array) do
|
||||
if e ~= "" then governor:value(e,string.upper(e)) end
|
||||
end
|
||||
|
||||
minifreq = s:option(Value, "minifreq", translate("Min Idle CPU Freq"))
|
||||
minifreq.datatype="range(48000,716000)"
|
||||
minifreq.rmempty = false
|
||||
minifreq.description = translate("CPU Freq from 48000 to 716000 (Khz)")
|
||||
minifreq.placeholder = 48000
|
||||
minifreq.default = 48000
|
||||
minfreq = s:option(ListValue, "minifreq", translate("Min Idle CPU Freq"))
|
||||
for _, e in ipairs(freq_array) do
|
||||
if e ~= "" then minfreq:value(e) end
|
||||
end
|
||||
|
||||
maxfreq = s:option(Value, "maxfreq", translate("Max Turbo Boost CPU Freq"))
|
||||
maxfreq.datatype="range(48000,716000)"
|
||||
maxfreq.rmempty = false
|
||||
maxfreq.description = translate("CPU Freq from 48000 to 716000 (Khz)")
|
||||
maxfreq.placeholder = 716000
|
||||
maxfreq.default = 716000
|
||||
maxfreq = s:option(ListValue, "maxfreq", translate("Max Turbo Boost CPU Freq"))
|
||||
for _, e in ipairs(freq_array) do
|
||||
if e ~= "" then maxfreq:value(e) end
|
||||
end
|
||||
|
||||
upthreshold = s:option(Value, "upthreshold", translate("CPU Switching Threshold"))
|
||||
upthreshold.datatype="range(1,99)"
|
||||
@ -37,5 +57,4 @@ factor.description = translate("The sampling rate determines how frequently the
|
||||
factor.placeholder = 10
|
||||
factor.default = 10
|
||||
|
||||
|
||||
return mp
|
||||
|
Loading…
Reference in New Issue
Block a user