wifi: mt76: mt7921: fix wrong power after multiple SAR set
authorYN Chen <YN.Chen@mediatek.com>
Wed, 16 Nov 2022 14:43:02 +0000 (22:43 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:32:21 +0000 (13:32 +0100)
[ Upstream commit 7eefb93d4a6fbccd859e538d208c50fd10b44cb7 ]

We should update CLC config before SAR set to synchronize all
related settings.

Fixes: 23bdc5d8cadf ("wifi: mt76: mt7921: introduce Country Location Control support")
Signed-off-by: YN Chen <YN.Chen@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/mediatek/mt76/mt7921/init.c
drivers/net/wireless/mediatek/mt76/mt7921/main.c
drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h

index dcdb3cf04ac1ba1908f9237a2bf503baaed14095..4ad66b34438389113d94179f3bc204457f4ae1c1 100644 (file)
@@ -37,6 +37,7 @@ mt7921_regd_notifier(struct wiphy *wiphy,
 
        memcpy(dev->mt76.alpha2, request->alpha2, sizeof(dev->mt76.alpha2));
        dev->mt76.region = request->dfs_region;
+       dev->country_ie_env = request->country_ie_env;
 
        mt7921_mutex_acquire(dev);
        mt7921_mcu_set_clc(dev, request->alpha2, request->country_ie_env);
index 7e409ac7d9a820f71090c78d49d9c4f4f8cda6cb..111d9221b94f571812f8aa32a69c9d1f69f6f22d 100644 (file)
@@ -1504,7 +1504,13 @@ static int mt7921_set_sar_specs(struct ieee80211_hw *hw,
        int err;
 
        mt7921_mutex_acquire(dev);
+       err = mt7921_mcu_set_clc(dev, dev->mt76.alpha2,
+                                dev->country_ie_env);
+       if (err < 0)
+               goto out;
+
        err = mt7921_set_tx_sar_pwr(hw, sar);
+out:
        mt7921_mutex_release(dev);
 
        return err;
index eaba114a9c7e40e266beeaa014856a80f79147ea..2babaeff72ba2d855682c09cc78f67735122e427 100644 (file)
@@ -244,6 +244,8 @@ struct mt7921_dev {
        struct work_struct ipv6_ns_work;
        /* IPv6 addresses for WoWLAN */
        struct sk_buff_head ipv6_ns_list;
+
+       enum environment_cap country_ie_env;
 };
 
 enum {