From 5e61763585735b3ebc6378cbf0516f08f6446c6c Mon Sep 17 00:00:00 2001 From: astsam Date: Wed, 27 Jan 2021 20:45:49 +0300 Subject: [PATCH] Add low frequency 5GHz band --- core/rtw_rf.c | 6 +++++- hal/rtl8812a/rtl8812a_phycfg.c | 10 +++++++--- include/rtw_rf.h | 2 +- os_dep/linux/ioctl_cfg80211.c | 3 +++ 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/core/rtw_rf.c b/core/rtw_rf.c index ca07652..ea2ce43 100644 --- a/core/rtw_rf.c +++ b/core/rtw_rf.c @@ -51,6 +51,8 @@ u8 op_chs_of_cch_2g_40m[CENTER_CH_2G_40M_NUM][2] = { }; u8 center_ch_5g_all[CENTER_CH_5G_ALL_NUM] = { + 15, 16, 17, 18, + 20, 24, 28, 32, /* G00 */36, 38, 40, 42, /* G01 */44, 46, 48, @@ -80,6 +82,8 @@ u8 center_ch_5g_all[CENTER_CH_5G_ALL_NUM] = { }; u8 center_ch_5g_20m[CENTER_CH_5G_20M_NUM] = { + 15, 16, 17, 18, + 20, 24, 28, 32, /* G00 */36, 40, /* G01 */44, 48, /* G02 */52, 56, @@ -382,7 +386,7 @@ u8 rtw_get_ch_group(u8 ch, u8 *group, u8 *cck_group) } else { band = BAND_ON_5G; - if (36 <= ch && ch <= 42) + if (15 <= ch && ch <= 42) gp = 0; else if (44 <= ch && ch <= 48) gp = 1; diff --git a/hal/rtl8812a/rtl8812a_phycfg.c b/hal/rtl8812a/rtl8812a_phycfg.c index d60354d..4641688 100644 --- a/hal/rtl8812a/rtl8812a_phycfg.c +++ b/hal/rtl8812a/rtl8812a_phycfg.c @@ -1798,6 +1798,8 @@ phy_SwChnl8812( /* fc_area */ if (36 <= channelToSW && channelToSW <= 48) phy_set_bb_reg(pAdapter, rFc_area_Jaguar, 0x1ffe0000, 0x494); + else if (15 <= channelToSW && channelToSW <= 35) + phy_set_bb_reg(pAdapter, rFc_area_Jaguar, 0x1ffe0000, 0x494); else if (50 <= channelToSW && channelToSW <= 80) phy_set_bb_reg(pAdapter, rFc_area_Jaguar, 0x1ffe0000, 0x453); else if (82 <= channelToSW && channelToSW <= 116) @@ -1811,6 +1813,8 @@ phy_SwChnl8812( /* RF_MOD_AG */ if (36 <= channelToSW && channelToSW <= 80) phy_set_rf_reg(pAdapter, eRFPath, RF_CHNLBW_Jaguar, BIT18 | BIT17 | BIT16 | BIT9 | BIT8, 0x101); /* 5'b00101); */ + else if (15 <= channelToSW && channelToSW <= 35) + phy_set_rf_reg(pAdapter, eRFPath, RF_CHNLBW_Jaguar, BIT18 | BIT17 | BIT16 | BIT9 | BIT8, 0x101); /* 5'b00101); */ else if (82 <= channelToSW && channelToSW <= 140) phy_set_rf_reg(pAdapter, eRFPath, RF_CHNLBW_Jaguar, BIT18 | BIT17 | BIT16 | BIT9 | BIT8, 0x301); /* 5'b01101); */ else if (140 < channelToSW) @@ -1826,7 +1830,7 @@ phy_SwChnl8812( /* <20130104, Kordan> APK for MP chip is done on initialization from folder. */ if (IS_HARDWARE_TYPE_8821U(pAdapter) && (!IS_NORMAL_CHIP(pHalData->version_id)) && channelToSW > 14) { /* <20121116, Kordan> For better result of APK. Asked by AlexWang. */ - if (36 <= channelToSW && channelToSW <= 80) + if (15 <= channelToSW && channelToSW <= 80) phy_set_rf_reg(pAdapter, eRFPath, RF_APK_Jaguar, bRFRegOffsetMask, 0x710E7); else if (82 <= channelToSW && channelToSW <= 140) phy_set_rf_reg(pAdapter, eRFPath, RF_APK_Jaguar, bRFRegOffsetMask, 0x716E9); @@ -1834,7 +1838,7 @@ phy_SwChnl8812( phy_set_rf_reg(pAdapter, eRFPath, RF_APK_Jaguar, bRFRegOffsetMask, 0x714E9); } else if (IS_HARDWARE_TYPE_8821S(pAdapter) && channelToSW > 14) { /* <20130111, Kordan> For better result of APK. Asked by Willson. */ - if (36 <= channelToSW && channelToSW <= 80) + if (15 <= channelToSW && channelToSW <= 80) phy_set_rf_reg(pAdapter, eRFPath, RF_APK_Jaguar, bRFRegOffsetMask, 0x714E9); else if (82 <= channelToSW && channelToSW <= 140) phy_set_rf_reg(pAdapter, eRFPath, RF_APK_Jaguar, bRFRegOffsetMask, 0x110E9); @@ -1842,7 +1846,7 @@ phy_SwChnl8812( phy_set_rf_reg(pAdapter, eRFPath, RF_APK_Jaguar, bRFRegOffsetMask, 0x714E9); } else if (IS_HARDWARE_TYPE_8821E(pAdapter) && channelToSW > 14) { /* <20130613, Kordan> For better result of APK. Asked by Willson. */ - if (36 <= channelToSW && channelToSW <= 80) + if (15 <= channelToSW && channelToSW <= 80) phy_set_rf_reg(pAdapter, eRFPath, RF_APK_Jaguar, bRFRegOffsetMask, 0x114E9); else if (82 <= channelToSW && channelToSW <= 140) phy_set_rf_reg(pAdapter, eRFPath, RF_APK_Jaguar, bRFRegOffsetMask, 0x110E9); diff --git a/include/rtw_rf.h b/include/rtw_rf.h index 4ca01fa..e367734 100644 --- a/include/rtw_rf.h +++ b/include/rtw_rf.h @@ -25,7 +25,7 @@ #define CENTER_CH_2G_40M_NUM 9 #define CENTER_CH_2G_NUM 14 -#define CENTER_CH_5G_20M_NUM (28+8) /* 20M center channels */ +#define CENTER_CH_5G_20M_NUM (28+16) /* 20M center channels */ #define CENTER_CH_5G_40M_NUM 14 /* 40M center channels */ #define CENTER_CH_5G_80M_NUM 7 /* 80M center channels */ #define CENTER_CH_5G_160M_NUM 3 /* 160M center channels */ diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index 9952fec..e9f4ba9 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -201,6 +201,9 @@ static struct ieee80211_channel rtw_2ghz_channels[MAX_CHANNEL_NUM_2G] = { /* from center_ch_5g_20m */ static struct ieee80211_channel rtw_5ghz_a_channels[MAX_CHANNEL_NUM_5G] = { + CHAN5G(15, 0), CHAN5G(16, 0), CHAN5G(17, 0), CHAN5G(18, 0), + CHAN5G(20, 0), CHAN5G(24, 0), CHAN5G(28, 0), CHAN5G(32, 0), + CHAN5G(36, 0), CHAN5G(40, 0), CHAN5G(44, 0), CHAN5G(48, 0), CHAN5G(52, 0), CHAN5G(56, 0), CHAN5G(60, 0), CHAN5G(64, 0),