mirror of
https://github.com/hanwckf/immortalwrt-mt798x.git
synced 2025-01-09 02:43:53 +08:00
mtwifi-cfg: add support for mtk dbdc chip cfgs
This commit is contained in:
parent
f7eaac3baf
commit
202f16e915
@ -109,6 +109,12 @@ function cfg2dat(cfg)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function set_dev_dat(dats, dat, cfg)
|
||||||
|
if cfg ~= nil then
|
||||||
|
dats[dat] = cfg2dat(cfg)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function set_dat(dats, apidx, dat, cfg)
|
function set_dat(dats, apidx, dat, cfg)
|
||||||
if cfg ~= nil then
|
if cfg ~= nil then
|
||||||
dats[dat] = utils.token_set(dats[dat], apidx, cfg2dat(cfg))
|
dats[dat] = utils.token_set(dats[dat], apidx, cfg2dat(cfg))
|
||||||
@ -227,6 +233,39 @@ function mtwifi_cfg_iwpriv_hook(cfg)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function set_chip_cfg(cfg, dats)
|
||||||
|
local dev_dats
|
||||||
|
local uci
|
||||||
|
local dat_key
|
||||||
|
|
||||||
|
if not cfg.config.dbdc_main then return end
|
||||||
|
|
||||||
|
for k,v in pairs(defs.chip_cfgs) do
|
||||||
|
uci = k
|
||||||
|
dat_key = v[1]
|
||||||
|
|
||||||
|
-- reset chip cfgs to default
|
||||||
|
dats[dat_key] = v[2]
|
||||||
|
|
||||||
|
-- setup current dev cfg
|
||||||
|
set_dev_dat(dats, dat_key, cfg.config[uci])
|
||||||
|
end
|
||||||
|
|
||||||
|
-- setup other dev cfg
|
||||||
|
for k,v in pairs(l1dat.devname_ridx) do
|
||||||
|
if k ~= cfg.device then
|
||||||
|
dev_dats = load_profile(v.profile_path)
|
||||||
|
if dev_dats then
|
||||||
|
for _,j in pairs(defs.chip_cfgs) do
|
||||||
|
dat_key = j[1]
|
||||||
|
set_dev_dat(dev_dats, dat_key, dats[dat_key])
|
||||||
|
end
|
||||||
|
save_profile(dev_dats, v.profile_path)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function mtwifi_cfg_setup(argv)
|
function mtwifi_cfg_setup(argv)
|
||||||
local cfg = cjson.decode(argv)
|
local cfg = cjson.decode(argv)
|
||||||
|
|
||||||
@ -291,6 +330,9 @@ function mtwifi_cfg_setup(argv)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- setup chip cfgs
|
||||||
|
set_chip_cfg(cfg, dats)
|
||||||
|
|
||||||
-- setup dev cfgs
|
-- setup dev cfgs
|
||||||
if cfg.config.twt then
|
if cfg.config.twt then
|
||||||
dats.TWTSupport = cfg.config.twt
|
dats.TWTSupport = cfg.config.twt
|
||||||
|
@ -81,6 +81,12 @@ mtwifi_defs.vif_acl = {
|
|||||||
["AccessControlList"] = "",
|
["AccessControlList"] = "",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mtwifi_defs.chip_cfgs = {
|
||||||
|
-- uci config = dat config, default value
|
||||||
|
["beacon_int"] = { "BeaconPeriod" , "100"},
|
||||||
|
["dtim_period"] = { "DtimPeriod", "1"},
|
||||||
|
}
|
||||||
|
|
||||||
mtwifi_defs.reinstall_cfgs = {
|
mtwifi_defs.reinstall_cfgs = {
|
||||||
"BssidNum", "WHNAT", "E2pAccessMode",
|
"BssidNum", "WHNAT", "E2pAccessMode",
|
||||||
"HT_RxStream", "HT_TxStream", "WdsEnable"
|
"HT_RxStream", "HT_TxStream", "WdsEnable"
|
||||||
|
@ -7,7 +7,7 @@ append DRIVERS "mtwifi"
|
|||||||
|
|
||||||
detect_mtwifi() {
|
detect_mtwifi() {
|
||||||
local idx ifname
|
local idx ifname
|
||||||
local band hwmode htmode htbsscoex ssid
|
local band hwmode htmode htbsscoex ssid dbdc_main
|
||||||
if [ -d "/sys/module/mt_wifi" ]; then
|
if [ -d "/sys/module/mt_wifi" ]; then
|
||||||
dev_list="$(l1util list)"
|
dev_list="$(l1util list)"
|
||||||
for dev in $dev_list; do
|
for dev in $dev_list; do
|
||||||
@ -21,12 +21,14 @@ detect_mtwifi() {
|
|||||||
htmode="HE40"
|
htmode="HE40"
|
||||||
htbsscoex="1"
|
htbsscoex="1"
|
||||||
ssid="ImmortalWrt-2.4G"
|
ssid="ImmortalWrt-2.4G"
|
||||||
|
dbdc_main="1"
|
||||||
else
|
else
|
||||||
band="5g"
|
band="5g"
|
||||||
hwmode="11a"
|
hwmode="11a"
|
||||||
htmode="HE160"
|
htmode="HE160"
|
||||||
htbsscoex="0"
|
htbsscoex="0"
|
||||||
ssid="ImmortalWrt-5G"
|
ssid="ImmortalWrt-5G"
|
||||||
|
dbdc_main="0"
|
||||||
fi
|
fi
|
||||||
uci -q batch <<-EOF
|
uci -q batch <<-EOF
|
||||||
set wireless.${dev}=wifi-device
|
set wireless.${dev}=wifi-device
|
||||||
@ -34,6 +36,7 @@ detect_mtwifi() {
|
|||||||
set wireless.${dev}.phy=${ifname}
|
set wireless.${dev}.phy=${ifname}
|
||||||
set wireless.${dev}.hwmode=${hwmode}
|
set wireless.${dev}.hwmode=${hwmode}
|
||||||
set wireless.${dev}.band=${band}
|
set wireless.${dev}.band=${band}
|
||||||
|
set wireless.${dev}.dbdc_main=${dbdc_main}
|
||||||
set wireless.${dev}.channel=auto
|
set wireless.${dev}.channel=auto
|
||||||
set wireless.${dev}.txpower=100
|
set wireless.${dev}.txpower=100
|
||||||
set wireless.${dev}.htmode=${htmode}
|
set wireless.${dev}.htmode=${htmode}
|
||||||
|
@ -14,8 +14,8 @@ MTWIFI_MAX_APCLI_IDX=0
|
|||||||
MTWIFI_CFG_IFNAME_KEY="mtwifi_ifname"
|
MTWIFI_CFG_IFNAME_KEY="mtwifi_ifname"
|
||||||
|
|
||||||
drv_mtwifi_init_device_config() {
|
drv_mtwifi_init_device_config() {
|
||||||
config_add_int txpower
|
config_add_int txpower beacon_int dtim_period
|
||||||
config_add_boolean mu_beamformer
|
config_add_boolean mu_beamformer dbdc_main
|
||||||
config_add_string country twt
|
config_add_string country twt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user