Commit 9557b6fe authored by Ming Yen Hsieh's avatar Ming Yen Hsieh Committed by Felix Fietkau
Browse files

wifi: mt76: mt7925: refine the txpower initialization flow



Refactor the initialization and reset flow for tx power setting to
eliminate redundant configurations

Signed-off-by: default avatarMing Yen Hsieh <mingyen.hsieh@mediatek.com>
Link: https://patch.msgid.link/20250908071245.1833006-1-mingyen.hsieh@mediatek.com


Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 2b660ee1
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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)
+0 −14
Original line number Diff line number Diff line
@@ -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;
+3 −2
Original line number Diff line number Diff line
@@ -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 @@ mt7925_mcu_rate_txpower_band(struct mt76_phy *phy,

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)
+0 −1
Original line number Diff line number Diff line
@@ -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;