]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: mt76: mt7996: set correct background radar capability
authorStanleyYP Wang <StanleyYP.Wang@mediatek.com>
Thu, 26 Sep 2024 03:24:40 +0000 (11:24 +0800)
committerFelix Fietkau <nbd@nbd.name>
Mon, 13 Jan 2025 10:21:54 +0000 (11:21 +0100)
Some of the variants do not support background radar, so add a helper
to report background radar capability.

Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Tested-by: Daniel Golle <daniel@makrotopia.org>
Link: https://patch.msgid.link/20240926032440.15978-3-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7996/init.c
drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h

index 3c1d3f251dfb3e73f5c24d8d4d489480891bebe8..2d36c73251378a221e04c0730a922e91075958b8 100644 (file)
@@ -387,9 +387,10 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
        wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_CAN_REPLACE_PTK0);
        wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_MU_MIMO_AIR_SNIFFER);
 
-       if (!mdev->dev->of_node ||
-           !of_property_read_bool(mdev->dev->of_node,
-                                  "mediatek,disable-radar-background"))
+       if (mt7996_has_background_radar(phy->dev) &&
+           (!mdev->dev->of_node ||
+            !of_property_read_bool(mdev->dev->of_node,
+                                   "mediatek,disable-radar-background")))
                wiphy_ext_feature_set(wiphy,
                                      NL80211_EXT_FEATURE_RADAR_BACKGROUND);
 
index 3f3278f43c796ede05e95b9da5d42ddf67979066..9aec97dd81d9ec9aabc6297acd43777d6288d582 100644 (file)
@@ -447,6 +447,25 @@ mt7996_band_valid(struct mt7996_dev *dev, u8 band)
        return band <= MT_BAND2;
 }
 
+static inline bool
+mt7996_has_background_radar(struct mt7996_dev *dev)
+{
+       switch (mt76_chip(&dev->mt76)) {
+       case 0x7990:
+               if (dev->var.type == MT7996_VAR_TYPE_233)
+                       return false;
+               break;
+       case 0x7992:
+               if (dev->var.type == MT7992_VAR_TYPE_23)
+                       return false;
+               break;
+       default:
+               return false;
+       }
+
+       return true;
+}
+
 extern const struct ieee80211_ops mt7996_ops;
 extern struct pci_driver mt7996_pci_driver;
 extern struct pci_driver mt7996_hif_driver;