From e86e97e45397b7f6c25b883aefc0a29a09a55e72 Mon Sep 17 00:00:00 2001 From: Quan Zhou Date: Fri, 3 Jan 2025 21:53:50 +0800 Subject: [PATCH] wifi: mt76: mt7925e: fix too long of wifi resume time The mt7925e takes a long time to resume in platform resume scenarios. This is due to the mt7925 reconfiguring the tx power for each wifi channel during resume. By streamlining the process and removing redundant power configurations, the resume time for the mt7925 can be shortened. Signed-off-by: Quan Zhou Link: https://patch.msgid.link/f075d43d87a5eefa5869baf755e9986edf735860.1735910836.git.quan.zhou@mediatek.com Signed-off-by: Felix Fietkau --- mt7925/init.c | 5 +++++ mt7925/mac.c | 1 + mt7925/main.c | 10 +++++++--- mt792x.h | 2 ++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/mt7925/init.c b/mt7925/init.c index f6f8ab38..f41ca424 100644 --- a/mt7925/init.c +++ b/mt7925/init.c @@ -63,9 +63,13 @@ void mt7925_regd_update(struct mt792x_dev *dev) struct mt76_dev *mdev = &dev->mt76; struct ieee80211_hw *hw = mdev->hw; + if (!dev->regd_change) + return; + mt7925_mcu_set_clc(dev, mdev->alpha2, dev->country_ie_env); mt7925_mcu_set_channel_domain(hw->priv); mt7925_set_tx_sar_pwr(hw, NULL); + dev->regd_change = false; } EXPORT_SYMBOL_GPL(mt7925_regd_update); @@ -91,6 +95,7 @@ mt7925_regd_notifier(struct wiphy *wiphy, memcpy(mdev->alpha2, req->alpha2, 2); mdev->region = req->dfs_region; dev->country_ie_env = req->country_ie_env; + dev->regd_change = true; if (pm->suspended) return; diff --git a/mt7925/mac.c b/mt7925/mac.c index 91e854e3..c871d2f9 100644 --- a/mt7925/mac.c +++ b/mt7925/mac.c @@ -1300,6 +1300,7 @@ 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); diff --git a/mt7925/main.c b/mt7925/main.c index 7b93e8fb..dba593d9 100644 --- a/mt7925/main.c +++ b/mt7925/main.c @@ -310,6 +310,7 @@ 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); @@ -320,9 +321,12 @@ int __mt7925_start(struct mt792x_phy *phy) if (err) return err; - err = mt7925_set_tx_sar_pwr(mphy->hw, NULL); - 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); diff --git a/mt792x.h b/mt792x.h index f0e7b555..32ed01a9 100644 --- a/mt792x.h +++ b/mt792x.h @@ -224,6 +224,8 @@ 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; struct work_struct init_work;