blob: be8bf16c46eb74e7cc790699d279ae93a39ee699 [file] [log] [blame]
developer05f3b2b2024-08-19 19:17:34 +08001From bfb5a104b7f24c396a444916d3755122b916153e Mon Sep 17 00:00:00 2001
developer66e89bc2024-04-23 14:50:01 +08002From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
3Date: Fri, 22 Dec 2023 17:27:10 +0800
developer05f3b2b2024-08-19 19:17:34 +08004Subject: [PATCH 058/199] mtk: mt76: mt7996: add background radar hw cap check
developer66e89bc2024-04-23 14:50:01 +08005
developer66e89bc2024-04-23 14:50:01 +08006Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
7---
8 mt7996/debugfs.c | 5 +++++
9 mt7996/init.c | 7 ++++---
10 mt7996/mt7996.h | 20 ++++++++++++++++++++
11 3 files changed, 29 insertions(+), 3 deletions(-)
12
13diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c
developer05f3b2b2024-08-19 19:17:34 +080014index 58879695..6d119467 100644
developer66e89bc2024-04-23 14:50:01 +080015--- a/mt7996/debugfs.c
16+++ b/mt7996/debugfs.c
17@@ -262,6 +262,11 @@ mt7996_rdd_monitor(struct seq_file *s, void *data)
18
19 mutex_lock(&dev->mt76.mutex);
20
21+ if (!mt7996_get_background_radar_cap(dev)) {
22+ seq_puts(s, "no background radar capability\n");
23+ goto out;
24+ }
25+
26 if (!cfg80211_chandef_valid(chandef)) {
27 ret = -EINVAL;
28 goto out;
29diff --git a/mt7996/init.c b/mt7996/init.c
developer05f3b2b2024-08-19 19:17:34 +080030index 342f15fb..ade07db7 100644
developer66e89bc2024-04-23 14:50:01 +080031--- a/mt7996/init.c
32+++ b/mt7996/init.c
developer05f3b2b2024-08-19 19:17:34 +080033@@ -406,9 +406,10 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
developer66e89bc2024-04-23 14:50:01 +080034
35 wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_OPERATING_CHANNEL_VALIDATION);
36 wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_BEACON_PROTECTION);
37- if (!mdev->dev->of_node ||
38- !of_property_read_bool(mdev->dev->of_node,
39- "mediatek,disable-radar-background"))
40+ if (mt7996_get_background_radar_cap(phy->dev) &&
41+ (!mdev->dev->of_node ||
42+ !of_property_read_bool(mdev->dev->of_node,
43+ "mediatek,disable-radar-background")))
44 wiphy_ext_feature_set(wiphy,
45 NL80211_EXT_FEATURE_RADAR_BACKGROUND);
46
47diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
developer05f3b2b2024-08-19 19:17:34 +080048index 294818b4..784fb3db 100644
developer66e89bc2024-04-23 14:50:01 +080049--- a/mt7996/mt7996.h
50+++ b/mt7996/mt7996.h
developer05f3b2b2024-08-19 19:17:34 +080051@@ -606,6 +606,26 @@ mt7996_band_valid(struct mt7996_dev *dev, u8 band)
developer66e89bc2024-04-23 14:50:01 +080052 return band == MT_BAND0 || band == MT_BAND2;
53 }
54
55+static inline bool
56+mt7996_get_background_radar_cap(struct mt7996_dev *dev)
57+{
58+ switch (mt76_chip(&dev->mt76)) {
59+ case 0x7990:
60+ if (dev->chip_sku == MT7996_SKU_233)
61+ return 0;
62+ break;
63+ case 0x7992:
64+ if (dev->chip_sku == MT7992_SKU_23 ||
65+ dev->chip_sku == MT7992_SKU_24)
66+ return 0;
67+ break;
68+ default:
69+ break;
70+ }
71+
72+ return 1;
73+}
74+
75 extern const struct ieee80211_ops mt7996_ops;
76 extern struct pci_driver mt7996_pci_driver;
77 extern struct pci_driver mt7996_hif_driver;
78--
developer9237f442024-06-14 17:13:04 +0800792.18.0
developer66e89bc2024-04-23 14:50:01 +080080