From: Shayne Chen <shayne.chen@mediatek.com>
To: Felix Fietkau <nbd@nbd.name>
Cc: linux-wireless <linux-wireless@vger.kernel.org>,
Lorenzo Bianconi <lorenzo@kernel.org>,
Ryder Lee <ryder.lee@mediatek.com>,
Evelyn Tsai <evelyn.tsai@mediatek.com>,
linux-mediatek <linux-mediatek@lists.infradead.org>,
StanleyYP Wang <StanleyYP.Wang@mediatek.com>,
Shayne Chen <shayne.chen@mediatek.com>
Subject: [PATCH mt76 5/7] wifi: mt76: mt7996: offload radar threshold initialization
Date: Tue, 25 Nov 2025 11:46:37 +0800 [thread overview]
Message-ID: <20251125034639.1416214-5-shayne.chen@mediatek.com> (raw)
In-Reply-To: <20251125034639.1416214-1-shayne.chen@mediatek.com>
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Since some radar specifications maintained by the driver are incorrect
and are now also maintained by the firmware, offload the initialization
procedure to the firmware.
This fixes issues for radar detection rate testings.
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
.../net/wireless/mediatek/mt76/mt7996/mac.c | 77 -------------------
.../net/wireless/mediatek/mt76/mt7996/mac.h | 5 --
2 files changed, 82 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mac.c b/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
index ce85d8f1bde6..98abaa51cf00 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
@@ -13,45 +13,6 @@
#define to_rssi(field, rcpi) ((FIELD_GET(field, rcpi) - 220) / 2)
-static const struct mt7996_dfs_radar_spec etsi_radar_specs = {
- .pulse_th = { 110, -10, -80, 40, 5200, 128, 5200 },
- .radar_pattern = {
- [5] = { 1, 0, 6, 32, 28, 0, 990, 5010, 17, 1, 1 },
- [6] = { 1, 0, 9, 32, 28, 0, 615, 5010, 27, 1, 1 },
- [7] = { 1, 0, 15, 32, 28, 0, 240, 445, 27, 1, 1 },
- [8] = { 1, 0, 12, 32, 28, 0, 240, 510, 42, 1, 1 },
- [9] = { 1, 1, 0, 0, 0, 0, 2490, 3343, 14, 0, 0, 12, 32, 28, { }, 126 },
- [10] = { 1, 1, 0, 0, 0, 0, 2490, 3343, 14, 0, 0, 15, 32, 24, { }, 126 },
- [11] = { 1, 1, 0, 0, 0, 0, 823, 2510, 14, 0, 0, 18, 32, 28, { }, 54 },
- [12] = { 1, 1, 0, 0, 0, 0, 823, 2510, 14, 0, 0, 27, 32, 24, { }, 54 },
- },
-};
-
-static const struct mt7996_dfs_radar_spec fcc_radar_specs = {
- .pulse_th = { 110, -10, -80, 40, 5200, 128, 5200 },
- .radar_pattern = {
- [0] = { 1, 0, 8, 32, 28, 0, 508, 3076, 13, 1, 1 },
- [1] = { 1, 0, 12, 32, 28, 0, 140, 240, 17, 1, 1 },
- [2] = { 1, 0, 8, 32, 28, 0, 190, 510, 22, 1, 1 },
- [3] = { 1, 0, 6, 32, 28, 0, 190, 510, 32, 1, 1 },
- [4] = { 1, 0, 9, 255, 28, 0, 323, 343, 13, 1, 32 },
- },
-};
-
-static const struct mt7996_dfs_radar_spec jp_radar_specs = {
- .pulse_th = { 110, -10, -80, 40, 5200, 128, 5200 },
- .radar_pattern = {
- [0] = { 1, 0, 8, 32, 28, 0, 508, 3076, 13, 1, 1 },
- [1] = { 1, 0, 12, 32, 28, 0, 140, 240, 17, 1, 1 },
- [2] = { 1, 0, 8, 32, 28, 0, 190, 510, 22, 1, 1 },
- [3] = { 1, 0, 6, 32, 28, 0, 190, 510, 32, 1, 1 },
- [4] = { 1, 0, 9, 255, 28, 0, 323, 343, 13, 1, 32 },
- [13] = { 1, 0, 7, 32, 28, 0, 3836, 3856, 14, 1, 1 },
- [14] = { 1, 0, 6, 32, 28, 0, 615, 5010, 110, 1, 1 },
- [15] = { 1, 1, 0, 0, 0, 0, 15, 5010, 110, 0, 0, 12, 32, 28 },
- },
-};
-
static struct mt76_wcid *mt7996_rx_get_wcid(struct mt7996_dev *dev,
u16 idx, u8 band_idx)
{
@@ -3010,40 +2971,6 @@ static int mt7996_dfs_start_radar_detector(struct mt7996_phy *phy)
return err;
}
-static int
-mt7996_dfs_init_radar_specs(struct mt7996_phy *phy)
-{
- const struct mt7996_dfs_radar_spec *radar_specs;
- struct mt7996_dev *dev = phy->dev;
- int err, i;
-
- switch (dev->mt76.region) {
- case NL80211_DFS_FCC:
- radar_specs = &fcc_radar_specs;
- err = mt7996_mcu_set_fcc5_lpn(dev, 8);
- if (err < 0)
- return err;
- break;
- case NL80211_DFS_ETSI:
- radar_specs = &etsi_radar_specs;
- break;
- case NL80211_DFS_JP:
- radar_specs = &jp_radar_specs;
- break;
- default:
- return -EINVAL;
- }
-
- for (i = 0; i < ARRAY_SIZE(radar_specs->radar_pattern); i++) {
- err = mt7996_mcu_set_radar_th(dev, i,
- &radar_specs->radar_pattern[i]);
- if (err < 0)
- return err;
- }
-
- return mt7996_mcu_set_pulse_th(dev, &radar_specs->pulse_th);
-}
-
int mt7996_dfs_init_radar_detector(struct mt7996_phy *phy)
{
struct mt7996_dev *dev = phy->dev;
@@ -3063,10 +2990,6 @@ int mt7996_dfs_init_radar_detector(struct mt7996_phy *phy)
goto stop;
if (prev_state <= MT_DFS_STATE_DISABLED) {
- err = mt7996_dfs_init_radar_specs(phy);
- if (err < 0)
- return err;
-
err = mt7996_dfs_start_radar_detector(phy);
if (err < 0)
return err;
diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mac.h b/drivers/net/wireless/mediatek/mt76/mt7996/mac.h
index 4eca37b013fc..70ee30f32f88 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/mac.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/mac.h
@@ -37,9 +37,4 @@ struct mt7996_dfs_pattern {
u32 min_stgpr_diff;
} __packed;
-struct mt7996_dfs_radar_spec {
- struct mt7996_dfs_pulse pulse_th;
- struct mt7996_dfs_pattern radar_pattern[16];
-};
-
#endif
--
2.51.0
next prev parent reply other threads:[~2025-11-25 3:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-25 3:46 [PATCH mt76 1/7] wifi: mt76: mt7996: extend CSA and CCA support for MLO Shayne Chen
2025-11-25 3:46 ` [PATCH mt76 2/7] wifi: mt76: mt7996: fix the behavior of radar detection Shayne Chen
2025-12-09 11:19 ` Lorenzo Bianconi
2025-12-12 8:35 ` Shayne Chen
2025-11-25 3:46 ` [PATCH mt76 3/7] wifi: mt76: mt7996: set specific BSSINFO and STAREC commands after channel switch Shayne Chen
2025-11-25 3:46 ` [PATCH mt76 4/7] wifi: mt76: mt7996: abort CCA when CSA is starting Shayne Chen
2025-11-25 3:46 ` Shayne Chen [this message]
2025-11-25 3:46 ` [PATCH mt76 6/7] wifi: mt76: mt7996: add duplicated WTBL command Shayne Chen
2025-11-25 3:46 ` [PATCH mt76 7/7] wifi: mt76: mt7996: fix iface combination for different chipsets Shayne Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251125034639.1416214-5-shayne.chen@mediatek.com \
--to=shayne.chen@mediatek.com \
--cc=StanleyYP.Wang@mediatek.com \
--cc=evelyn.tsai@mediatek.com \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=nbd@nbd.name \
--cc=ryder.lee@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox