developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1 | From 189d4baa960d2202e518c3e15c9959524cafc3d0 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 | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 4 | Subject: [PATCH 053/116] mtk: wifi: mt76: mt7996: add background radar hw cap |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 5 | check |
| 6 | |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 7 | Signed-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 | |
| 14 | diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 15 | index f3a520b..6c5fbc7 100644 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 16 | --- a/mt7996/debugfs.c |
| 17 | +++ b/mt7996/debugfs.c |
| 18 | @@ -262,6 +262,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; |
| 30 | diff --git a/mt7996/init.c b/mt7996/init.c |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 31 | index cb00322..6430bfa 100644 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 32 | --- a/mt7996/init.c |
| 33 | +++ b/mt7996/init.c |
| 34 | @@ -404,9 +404,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 | |
| 48 | diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 49 | index 72865c8..c73701d 100644 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 50 | --- a/mt7996/mt7996.h |
| 51 | +++ b/mt7996/mt7996.h |
| 52 | @@ -605,6 +605,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 | -- |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 80 | 2.18.0 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 81 | |