blob: 5aefd991faabe46ee8fa4c1189934da4d7310867 [file] [log] [blame]
developer43a264f2024-03-26 14:09:54 +08001From e38dd3530b0bce868b754b9fb02648974a036ab6 Mon Sep 17 00:00:00 2001
developer8935fc12024-01-11 14:08:37 +08002From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
3Date: Fri, 22 Dec 2023 17:27:10 +0800
4Subject: [PATCH 1043/1044] mtk: wifi: mt76: mt7996: add background radar hw
5 cap check
6
7Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
8---
9 mt7996/debugfs.c | 5 +++++
10 mt7996/init.c | 7 ++++---
11 mt7996/mt7996.h | 20 ++++++++++++++++++++
12 3 files changed, 29 insertions(+), 3 deletions(-)
13
14diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c
developer43a264f2024-03-26 14:09:54 +080015index 50ac6d4d..2a5f82da 100644
developer8935fc12024-01-11 14:08:37 +080016--- a/mt7996/debugfs.c
17+++ b/mt7996/debugfs.c
18@@ -257,6 +257,11 @@ mt7996_rdd_monitor(struct seq_file *s, void *data)
19
20 mutex_lock(&dev->mt76.mutex);
21
22+ if (!mt7996_get_background_radar_cap(dev)) {
23+ seq_puts(s, "no background radar capability\n");
24+ goto out;
25+ }
26+
27 if (!cfg80211_chandef_valid(chandef)) {
28 ret = -EINVAL;
29 goto out;
30diff --git a/mt7996/init.c b/mt7996/init.c
developerebda9012024-02-22 13:42:45 +080031index ec90cdc7..20415e3c 100644
developer8935fc12024-01-11 14:08:37 +080032--- a/mt7996/init.c
33+++ b/mt7996/init.c
34@@ -393,9 +393,10 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
35
36 wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_OPERATING_CHANNEL_VALIDATION);
37 wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_BEACON_PROTECTION);
38- if (!mdev->dev->of_node ||
39- !of_property_read_bool(mdev->dev->of_node,
40- "mediatek,disable-radar-background"))
41+ if (mt7996_get_background_radar_cap(phy->dev) &&
42+ (!mdev->dev->of_node ||
43+ !of_property_read_bool(mdev->dev->of_node,
44+ "mediatek,disable-radar-background")))
45 wiphy_ext_feature_set(wiphy,
46 NL80211_EXT_FEATURE_RADAR_BACKGROUND);
47
48diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
49index bde0c086..95db69ca 100644
50--- a/mt7996/mt7996.h
51+++ b/mt7996/mt7996.h
52@@ -599,6 +599,26 @@ mt7996_band_valid(struct mt7996_dev *dev, u8 band)
53 return band == MT_BAND0 || band == MT_BAND2;
54 }
55
56+static inline bool
57+mt7996_get_background_radar_cap(struct mt7996_dev *dev)
58+{
59+ switch (mt76_chip(&dev->mt76)) {
60+ case 0x7990:
61+ if (dev->chip_sku == MT7996_SKU_233)
62+ return 0;
63+ break;
64+ case 0x7992:
65+ if (dev->chip_sku == MT7992_SKU_23 ||
66+ dev->chip_sku == MT7992_SKU_24)
67+ return 0;
68+ break;
69+ default:
70+ break;
71+ }
72+
73+ return 1;
74+}
75+
76 extern const struct ieee80211_ops mt7996_ops;
77 extern struct pci_driver mt7996_pci_driver;
78 extern struct pci_driver mt7996_hif_driver;
79--
802.18.0
81