]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: mt76: mt7925: refine the txpower initialization flow
authorMing Yen Hsieh <mingyen.hsieh@mediatek.com>
Mon, 8 Sep 2025 07:12:45 +0000 (15:12 +0800)
committerFelix Fietkau <nbd@nbd.name>
Mon, 15 Sep 2025 07:47:42 +0000 (09:47 +0200)
Refactor the initialization and reset flow for tx power setting to
eliminate redundant configurations

Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Link: https://patch.msgid.link/20250908071245.1833006-1-mingyen.hsieh@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7925/mac.c
drivers/net/wireless/mediatek/mt76/mt7925/main.c
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
drivers/net/wireless/mediatek/mt76/mt792x.h

index b581ab9427f22bcb81b633ad697bb491e3f7de32..1e44e96f034e9b9ef30c678a44588a002b6698da 100644 (file)
@@ -1300,7 +1300,6 @@ void mt7925_mac_reset_work(struct work_struct *work)
        cancel_delayed_work_sync(&dev->mphy.mac_work);
        cancel_delayed_work_sync(&pm->ps_work);
        cancel_work_sync(&pm->wake_work);
-       dev->sar_inited = false;
 
        for (i = 0; i < 10; i++) {
                mutex_lock(&dev->mt76.mutex);
@@ -1329,6 +1328,10 @@ void mt7925_mac_reset_work(struct work_struct *work)
                                            IEEE80211_IFACE_ITER_RESUME_ALL,
                                            mt7925_vif_connect_iter, NULL);
        mt76_connac_power_save_sched(&dev->mt76.phy, pm);
+
+       mt792x_mutex_acquire(dev);
+       mt7925_mcu_set_clc(dev, "00", ENVIRON_INDOOR);
+       mt792x_mutex_release(dev);
 }
 
 void mt7925_coredump_work(struct work_struct *work)
index 7416098db9fc3517ee2f1c9aabd20e029c02f12f..ac3d485a2f78f36826632d7154deee2e088d26f7 100644 (file)
@@ -311,7 +311,6 @@ void mt7925_set_stream_he_eht_caps(struct mt792x_phy *phy)
 int __mt7925_start(struct mt792x_phy *phy)
 {
        struct mt76_phy *mphy = phy->mt76;
-       struct mt792x_dev *dev = phy->dev;
        int err;
 
        err = mt7925_mcu_set_channel_domain(mphy);
@@ -322,13 +321,6 @@ int __mt7925_start(struct mt792x_phy *phy)
        if (err)
                return err;
 
-       if (!dev->sar_inited) {
-               err = mt7925_set_tx_sar_pwr(mphy->hw, NULL);
-               if (err)
-                       return err;
-               dev->sar_inited = true;
-       }
-
        mt792x_mac_reset_counters(phy);
        set_bit(MT76_STATE_RUNNING, &mphy->state);
 
@@ -1682,13 +1674,7 @@ static int mt7925_set_sar_specs(struct ieee80211_hw *hw,
        int err;
 
        mt792x_mutex_acquire(dev);
-       err = mt7925_mcu_set_clc(dev, dev->mt76.alpha2,
-                                dev->country_ie_env);
-       if (err < 0)
-               goto out;
-
        err = mt7925_set_tx_sar_pwr(hw, sar);
-out:
        mt792x_mutex_release(dev);
 
        return err;
index 10d68d241ba1f04e85f692b5a46bdad525ccad05..8eda407e4135e0f1cccc2dec7bde5f7a1f266833 100644 (file)
@@ -759,7 +759,6 @@ static int mt7925_load_clc(struct mt792x_dev *dev, const char *fw_name)
                }
        }
 
-       ret = mt7925_mcu_set_clc(dev, "00", ENVIRON_INDOOR);
 out:
        release_firmware(fw);
 
@@ -3724,6 +3723,8 @@ out:
 
 int mt7925_mcu_set_rate_txpower(struct mt76_phy *phy)
 {
+       struct mt76_dev *mdev = phy->dev;
+       struct mt792x_dev *dev = mt792x_hw_dev(mdev->hw);
        int err;
 
        if (phy->cap.has_2ghz) {
@@ -3740,7 +3741,7 @@ int mt7925_mcu_set_rate_txpower(struct mt76_phy *phy)
                        return err;
        }
 
-       if (phy->cap.has_6ghz) {
+       if (phy->cap.has_6ghz && dev->phy.clc_chan_conf) {
                err = mt7925_mcu_rate_txpower_band(phy,
                                                   NL80211_BAND_6GHZ);
                if (err < 0)
index 443d397d9961c3dd2876b50fb53d0544d186ec7a..f2c8b9e4aa0f50fef156b2198b0f101d7eee2fa6 100644 (file)
@@ -234,7 +234,6 @@ struct mt792x_dev {
        bool aspm_supported:1;
        bool hif_idle:1;
        bool hif_resumed:1;
-       bool sar_inited:1;
        bool regd_change:1;
        wait_queue_head_t wait;