luci-app-cpufreq: unlocked for all target

This commit is contained in:
LEAN-ESX 2020-03-08 01:50:35 -08:00
parent 2ae46625df
commit a0adb27385
3 changed files with 38 additions and 19 deletions

View File

@ -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 \ 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-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-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 ddns-scripts_aliyun ddns-scripts_dnspod
# For nas targets # For nas targets
DEFAULT_PACKAGES.nas:=block-mount fdisk lsblk mdadm DEFAULT_PACKAGES.nas:=block-mount fdisk lsblk mdadm

View File

@ -6,11 +6,11 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI for CPU IPQ40xx Freq LUCI_TITLE:=LuCI for CPU Freq Setting
LUCI_DEPENDS:=@TARGET_ipq40xx LUCI_DEPENDS:=
PKG_NAME:=luci-app-cpufreq PKG_NAME:=luci-app-cpufreq
PKG_VERSION:=1 PKG_VERSION:=1
PKG_RELEASE:=2 PKG_RELEASE:=3
include $(TOPDIR)/feeds/luci/luci.mk include $(TOPDIR)/feeds/luci/luci.mk

View File

@ -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 = Map("cpufreq", translate("CPU Freq Settings"))
mp.description = translate("Set CPU Scaling Governor to Max Performance or Balance Mode") 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 s.anonymouse = true
governor = s:option(ListValue, "governor", translate("CPU Scaling Governor")) governor = s:option(ListValue, "governor", translate("CPU Scaling Governor"))
governor:value("ondemand", translate("Ondemand Balance Mode")) for _, e in ipairs(governor_array) do
governor:value("performance", translate("Performance Mode")) if e ~= "" then governor:value(e,string.upper(e)) end
end
minifreq = s:option(Value, "minifreq", translate("Min Idle CPU Freq")) minfreq = s:option(ListValue, "minifreq", translate("Min Idle CPU Freq"))
minifreq.datatype="range(48000,716000)" for _, e in ipairs(freq_array) do
minifreq.rmempty = false if e ~= "" then minfreq:value(e) end
minifreq.description = translate("CPU Freq from 48000 to 716000 (Khz)") end
minifreq.placeholder = 48000
minifreq.default = 48000
maxfreq = s:option(Value, "maxfreq", translate("Max Turbo Boost CPU Freq")) maxfreq = s:option(ListValue, "maxfreq", translate("Max Turbo Boost CPU Freq"))
maxfreq.datatype="range(48000,716000)" for _, e in ipairs(freq_array) do
maxfreq.rmempty = false if e ~= "" then maxfreq:value(e) end
maxfreq.description = translate("CPU Freq from 48000 to 716000 (Khz)") end
maxfreq.placeholder = 716000
maxfreq.default = 716000
upthreshold = s:option(Value, "upthreshold", translate("CPU Switching Threshold")) upthreshold = s:option(Value, "upthreshold", translate("CPU Switching Threshold"))
upthreshold.datatype="range(1,99)" upthreshold.datatype="range(1,99)"
@ -37,5 +57,4 @@ factor.description = translate("The sampling rate determines how frequently the
factor.placeholder = 10 factor.placeholder = 10
factor.default = 10 factor.default = 10
return mp return mp