summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/mediatek/mt76/mt7921/pci.c
diff options
context:
space:
mode:
authorLorenzo Bianconi <lorenzo@kernel.org>2021-06-12 17:49:30 +0300
committerFelix Fietkau <nbd@nbd.name>2021-06-19 10:22:50 +0300
commit495cd981afe78b12fee635bfe35897eae427d89e (patch)
tree8b3278bfd13aa06e85e06e101ee4df030df3b280 /drivers/net/wireless/mediatek/mt76/mt7921/pci.c
parent8225816d2974204c09228f94c0451bd959575475 (diff)
downloadlinux-495cd981afe78b12fee635bfe35897eae427d89e.tar.xz
mt76: mt7921: introduce dedicated control for deep_sleep
Introduce ds_enable switch to fully control fw deep_sleep capability Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net/wireless/mediatek/mt76/mt7921/pci.c')
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt7921/pci.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c
index 27906b2cd912..c3905bcab360 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c
@@ -208,8 +208,10 @@ static int mt7921_pci_suspend(struct pci_dev *pdev, pm_message_t state)
goto restore_suspend;
}
- if (!pm->enable)
- mt76_connac_mcu_set_deep_sleep(&dev->mt76, true);
+ /* always enable deep sleep during suspend to reduce
+ * power consumption
+ */
+ mt76_connac_mcu_set_deep_sleep(&dev->mt76, true);
napi_disable(&mdev->tx_napi);
mt76_worker_disable(&mdev->tx_worker);
@@ -252,7 +254,7 @@ restore_napi:
}
napi_enable(&mdev->tx_napi);
- if (!pm->enable)
+ if (!pm->ds_enable)
mt76_connac_mcu_set_deep_sleep(&dev->mt76, false);
if (hif_suspend)
@@ -268,9 +270,10 @@ static int mt7921_pci_resume(struct pci_dev *pdev)
{
struct mt76_dev *mdev = pci_get_drvdata(pdev);
struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
+ struct mt76_connac_pm *pm = &dev->pm;
int i, err;
- dev->pm.suspended = false;
+ pm->suspended = false;
err = pci_set_power_state(pdev, PCI_D0);
if (err)
return err;
@@ -301,7 +304,8 @@ static int mt7921_pci_resume(struct pci_dev *pdev)
napi_enable(&mdev->tx_napi);
napi_schedule(&mdev->tx_napi);
- if (!dev->pm.enable)
+ /* restore previous ds setting */
+ if (!pm->ds_enable)
mt76_connac_mcu_set_deep_sleep(&dev->mt76, false);
if (!test_bit(MT76_STATE_SUSPEND, &dev->mphy.state))