summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/mediatek/mt76/mt7921/init.c
diff options
context:
space:
mode:
authorYN Chen <YN.Chen@mediatek.com>2021-06-29 07:05:53 +0800
committerFelix Fietkau <nbd@nbd.name>2021-10-20 10:36:26 +0200
commit502604f545978d2d4b12f8029785d5f1e4b32e56 (patch)
treea7b9b536f81ddbe009dfc0913cd385761e4dc6de /drivers/net/wireless/mediatek/mt76/mt7921/init.c
parentd5f4ceeee69ee6afa5ad2e13cf448e132a37543c (diff)
mt76: mt7921: add .set_sar_specs support
add .set_sar_specs to allow configuring SAR power limitations on the frequency ranges from the userland. Co-developed-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: YN Chen <YN.Chen@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net/wireless/mediatek/mt76/mt7921/init.c')
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt7921/init.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
index 52d40385fab6..fd119b260834 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
@@ -41,7 +41,7 @@ mt7921_regd_notifier(struct wiphy *wiphy,
mt7921_mutex_release(dev);
}
-static void
+static int
mt7921_init_wiphy(struct ieee80211_hw *hw)
{
struct mt7921_phy *phy = mt7921_hw_phy(hw);
@@ -75,6 +75,14 @@ mt7921_init_wiphy(struct ieee80211_hw *hw)
wiphy->max_sched_scan_reqs = 1;
wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH;
wiphy->reg_notifier = mt7921_regd_notifier;
+ wiphy->sar_capa = &mt76_sar_capa;
+
+ phy->mt76->frp = devm_kcalloc(dev->mt76.dev,
+ wiphy->sar_capa->num_freq_ranges,
+ sizeof(struct mt76_freq_range_power),
+ GFP_KERNEL);
+ if (!phy->mt76->frp)
+ return -ENOMEM;
wiphy->features |= NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR |
NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR;
@@ -92,6 +100,8 @@ mt7921_init_wiphy(struct ieee80211_hw *hw)
ieee80211_hw_set(hw, CONNECTION_MONITOR);
hw->max_tx_fragments = 4;
+
+ return 0;
}
static void
@@ -211,7 +221,10 @@ int mt7921_register_device(struct mt7921_dev *dev)
if (ret)
return ret;
- mt7921_init_wiphy(hw);
+ ret = mt7921_init_wiphy(hw);
+ if (ret)
+ return ret;
+
dev->mphy.sband_2g.sband.ht_cap.cap |=
IEEE80211_HT_CAP_LDPC_CODING |
IEEE80211_HT_CAP_MAX_AMSDU;