mt76: mt7921: clear pm->suspended in mt7921_mac_reset_work
Subsystems (2)
[email protected]
reviewerPATCH v2 1/4 mt76: mt7921: clear pm->suspended in mt7921_mac_reset_work
From: Sean Wang <[email protected]>
clear pm->suspended in mt7921_mac_reset_work to allow pm runtime can be enabled after wifi reset in any circumstance.
---
v2: create a new patch for the following ones
--- drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/mediatek/mt76/mt7921/mac.c +1 -0
@@ -1399,6 +1399,7 @@ void mt7921_mac_reset_work(struct work_struct *work) } dev->hw_full_reset = false; + pm->suspended = false;ieee80211_wake_queues (hw); ieee80211_iterate_active_interfaces(hw, IEEE80211_IFACE_ITER_RESUME_ALL,
Signature · 1 line
2.25.1
[email protected]
reviewerPATCH v2 2/4 mt76: mt7921: fix possible resume failure
From: Sean Wang <[email protected]>
Fix the possible resume failure due to mt76_connac_mcu_set_hif_suspend timeout.
That is because clearing the flag pm->suspended too early opened up a race window, where mt7921_poll_tx/rx scheduled a ps_work to put the device in doze mode, that is unexpected for the device is being resumed from the suspend state and would make the remaining MCU comamnds in resume handler failed to execute.
---
v2: refine the error handling path
--- drivers/net/wireless/mediatek/mt76/mt7921/pci.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/pci.c +7 -2
@@ -315,7 +315,6 @@ static int mt7921_pci_resume(struct pci_dev *pdev)struct mt76_connac_pm *pm = &dev->pm;int i, err; - pm->suspended = false; err =pci_set_power_state (pdev,PCI_D0 );if (err)return err;
@@ -353,7 +352,13 @@ static int mt7921_pci_resume(struct pci_dev *pdev)if (!pm->ds_enable)mt76_connac_mcu_set_deep_sleep (&dev->mt76, false); - return mt76_connac_mcu_set_hif_suspend(mdev, false); + err =mt76_connac_mcu_set_hif_suspend (mdev, false); +if (err) +return err; + + pm->suspended = false; + + return err; }#endif /* CONFIG_PM */
Signature · 1 line
2.25.1
[email protected]
reviewerPATCH v2 3/4 mt76: mt7921s: make pm->suspended usage consistent
In reply to [email protected]From: Sean Wang <[email protected]>
Update pm->suspended usage to be consistent with mt7921e driver.
---
v2: refine the error handling path
--- drivers/net/wireless/mediatek/mt76/mt7921/sdio.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/sdio.c +7 -2
@@ -278,7 +278,6 @@ static int mt7921s_resume(struct device *__dev)struct mt76_dev *mdev = &dev->mt76;int err; - pm->suspended = false;clear_bit (MT76_STATE_SUSPEND , &mdev->phy.state); err =mt7921_mcu_drv_pmctrl (dev);
@@ -294,7 +293,13 @@ static int mt7921s_resume(struct device *__dev)if (!pm->ds_enable)mt76_connac_mcu_set_deep_sleep (mdev, false); -return mt76_connac_mcu_set_hif_suspend (mdev, false); + err =mt76_connac_mcu_set_hif_suspend (mdev, false); +if (err) +return err; + + pm->suspended = false; + +return err; }static const struct dev_pm_ops mt7921s_pm_ops = {
Signature · 1 line
2.25.1
[email protected]
reviewerPATCH v2 4/4 mt76: mt7921s: fix suspend error with enlarging mcu timeout value
In reply to [email protected]From: Sean Wang <[email protected]>
Fix the false positive suspend error that may occur on mt7921s with enlarging mcu timeout value.
The reason why we have to enlarge mcu timeout from HZ / 3 to HZ is we should consider the additional overhead caused by running concurrently with btmtksdio (a MT7921 bluetooth SDIO driver) that would compete for the same SDIO bus in process context to complete the suspend procedure.
---
v2: the same, just rebase the patchset
--- drivers/net/wireless/mediatek/mt76/mt7921/mcu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +1 -1
@@ -239,7 +239,7 @@ int mt7921_mcu_fill_message(struct mt76_dev *mdev, struct sk_buff *skb,case MCU_UNI_CMD_HIF_CTRL :case MCU_UNI_CMD_SUSPEND :case MCU_UNI_CMD_OFFLOAD : - mdev->mcu.timeout =HZ /3 ; + mdev->mcu.timeout =HZ ;break ;default : mdev->mcu.timeout =3 *HZ ;
Signature · 1 line
2.25.1