Skip to content

Commit a0f721b

Browse files
Quanzhoucennbd168
authored andcommitted
wifi: mt76: mt7925: fix CLC command timeout when suspend/resume
When enter suspend/resume while in a connected state, the upper layer will trigger disconnection before entering suspend, and at the same time, it will trigger regd_notifier() and update CLC, causing the CLC event to not be received due to suspend, resulting in a command timeout. Therefore, the update of CLC is postponed until resume, to ensure data consistency and avoid the occurrence of command timeout. Signed-off-by: Quan Zhou <[email protected]> Link: https://patch.msgid.link/bab00a2805d0533fd8beaa059222659858a9dcb5.1735910455.git.quan.zhou@mediatek.com Signed-off-by: Felix Fietkau <[email protected]>
1 parent 1b97fc8 commit a0f721b

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

drivers/net/wireless/mediatek/mt76/mt7925/init.c

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,26 @@ static int mt7925_thermal_init(struct mt792x_phy *phy)
5757
mt7925_hwmon_groups);
5858
return PTR_ERR_OR_ZERO(hwmon);
5959
}
60+
61+
void mt7925_regd_update(struct mt792x_dev *dev)
62+
{
63+
struct mt76_dev *mdev = &dev->mt76;
64+
struct ieee80211_hw *hw = mdev->hw;
65+
66+
mt7925_mcu_set_clc(dev, mdev->alpha2, dev->country_ie_env);
67+
mt7925_mcu_set_channel_domain(hw->priv);
68+
mt7925_set_tx_sar_pwr(hw, NULL);
69+
}
70+
EXPORT_SYMBOL_GPL(mt7925_regd_update);
71+
6072
static void
6173
mt7925_regd_notifier(struct wiphy *wiphy,
6274
struct regulatory_request *req)
6375
{
6476
struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
6577
struct mt792x_dev *dev = mt792x_hw_dev(hw);
6678
struct mt76_dev *mdev = &dev->mt76;
79+
struct mt76_connac_pm *pm = &dev->pm;
6780

6881
/* allow world regdom at the first boot only */
6982
if (!memcmp(req->alpha2, "00", 2) &&
@@ -79,11 +92,12 @@ mt7925_regd_notifier(struct wiphy *wiphy,
7992
mdev->region = req->dfs_region;
8093
dev->country_ie_env = req->country_ie_env;
8194

95+
if (pm->suspended)
96+
return;
97+
8298
dev->regd_in_progress = true;
8399
mt792x_mutex_acquire(dev);
84-
mt7925_mcu_set_clc(dev, req->alpha2, req->country_ie_env);
85-
mt7925_mcu_set_channel_domain(hw->priv);
86-
mt7925_set_tx_sar_pwr(hw, NULL);
100+
mt7925_regd_update(dev);
87101
mt792x_mutex_release(dev);
88102
dev->regd_in_progress = false;
89103
wake_up(&dev->wait);

drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ int mt7925_mcu_chip_config(struct mt792x_dev *dev, const char *cmd);
215215
int mt7925_mcu_set_rxfilter(struct mt792x_dev *dev, u32 fif,
216216
u8 bit_op, u32 bit_map);
217217

218+
void mt7925_regd_update(struct mt792x_dev *dev);
218219
int mt7925_mac_init(struct mt792x_dev *dev);
219220
int mt7925_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
220221
struct ieee80211_sta *sta);

drivers/net/wireless/mediatek/mt76/mt7925/pci.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,11 +557,14 @@ static int mt7925_pci_resume(struct device *device)
557557
local_bh_enable();
558558

559559
err = mt76_connac_mcu_set_hif_suspend(mdev, false);
560+
if (err < 0)
561+
goto failed;
560562

561563
/* restore previous ds setting */
562564
if (!pm->ds_enable)
563565
mt7925_mcu_set_deep_sleep(dev, false);
564566

567+
mt7925_regd_update(dev);
565568
failed:
566569
pm->suspended = false;
567570

0 commit comments

Comments
 (0)