developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 1 | From bfb5a104b7f24c396a444916d3755122b916153e Mon Sep 17 00:00:00 2001 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2 | From: StanleyYP Wang <StanleyYP.Wang@mediatek.com> |
| 3 | Date: Fri, 22 Dec 2023 17:27:10 +0800 |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 4 | Subject: [PATCH 058/199] mtk: mt76: mt7996: add background radar hw cap check |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 5 | |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 6 | Signed-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 | |
| 13 | diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 14 | index 58879695..6d119467 100644 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 15 | --- 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; |
| 29 | diff --git a/mt7996/init.c b/mt7996/init.c |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 30 | index 342f15fb..ade07db7 100644 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 31 | --- a/mt7996/init.c |
| 32 | +++ b/mt7996/init.c |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 33 | @@ -406,9 +406,10 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 34 | |
| 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 | |
| 47 | diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 48 | index 294818b4..784fb3db 100644 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 49 | --- a/mt7996/mt7996.h |
| 50 | +++ b/mt7996/mt7996.h |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 51 | @@ -606,6 +606,26 @@ mt7996_band_valid(struct mt7996_dev *dev, u8 band) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 52 | 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 | -- |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 79 | 2.18.0 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 80 | |