From: <sean.wang@mediatek.com> To: <nbd@nbd.name>, <lorenzo.bianconi@redhat.com> Cc: <sean.wang@mediatek.com>, <Soul.Huang@mediatek.com>, <YN.Chen@mediatek.com>, <Leon.Yen@mediatek.com>, <Deren.Wu@mediatek.com>, <km.lin@mediatek.com>, <robin.chiu@mediatek.com>, <ch.yeh@mediatek.com>, <posh.sun@mediatek.com>, <Eric.Liang@mediatek.com>, <Stella.Chang@mediatek.com>, <linux-wireless@vger.kernel.org>, <linux-mediatek@lists.infradead.org> Subject: [PATCH 6/6] mt76: mt7921: enable deep sleep when the device suspends Date: Mon, 19 Apr 2021 00:36:07 +0800 [thread overview] Message-ID: <1618763767-1292-7-git-send-email-sean.wang@mediatek.com> (raw) In-Reply-To: <1618763767-1292-1-git-send-email-sean.wang@mediatek.com> From: Sean Wang <sean.wang@mediatek.com> Enable the deep sleep mode in suspend handler to reduce the power consumption further. Signed-off-by: Sean Wang <sean.wang@mediatek.com> --- drivers/net/wireless/mediatek/mt76/mt7921/pci.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c index 40e2086d075c..277960b680bc 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c @@ -189,6 +189,9 @@ static int mt7921_pci_suspend(struct pci_dev *pdev, pm_message_t state) return err; } + if (!dev->pm.enable) + mt76_connac_mcu_set_deep_sleep(&dev->mt76, true); + napi_disable(&mdev->tx_napi); mt76_worker_disable(&mdev->tx_worker); @@ -227,6 +230,10 @@ static int mt7921_pci_suspend(struct pci_dev *pdev, pm_message_t state) napi_enable(&mdev->napi[i]); } napi_enable(&mdev->tx_napi); + + if (!dev->pm.enable) + mt76_connac_mcu_set_deep_sleep(&dev->mt76, false); + if (hif_suspend) mt76_connac_mcu_set_hif_suspend(mdev, false); @@ -249,6 +256,8 @@ static int mt7921_pci_resume(struct pci_dev *pdev) if (err < 0) return err; + mt7921_wpdma_reinit_cond(dev); + /* enable interrupt */ mt76_wr(dev, MT_PCIE_MAC_INT_ENABLE, 0xff); mt7921_irq_enable(dev, MT_INT_RX_DONE_ALL | MT_INT_TX_DONE_ALL | @@ -266,6 +275,9 @@ static int mt7921_pci_resume(struct pci_dev *pdev) napi_enable(&mdev->tx_napi); napi_schedule(&mdev->tx_napi); + if (!dev->pm.enable) + mt76_connac_mcu_set_deep_sleep(&dev->mt76, false); + if (!test_bit(MT76_STATE_SUSPEND, &dev->mphy.state)) err = mt76_connac_mcu_set_hif_suspend(mdev, false); -- 2.25.1
WARNING: multiple messages have this Message-ID (diff)
From: <sean.wang@mediatek.com> To: <nbd@nbd.name>, <lorenzo.bianconi@redhat.com> Cc: <sean.wang@mediatek.com>, <Soul.Huang@mediatek.com>, <YN.Chen@mediatek.com>, <Leon.Yen@mediatek.com>, <Deren.Wu@mediatek.com>, <km.lin@mediatek.com>, <robin.chiu@mediatek.com>, <ch.yeh@mediatek.com>, <posh.sun@mediatek.com>, <Eric.Liang@mediatek.com>, <Stella.Chang@mediatek.com>, <linux-wireless@vger.kernel.org>, <linux-mediatek@lists.infradead.org> Subject: [PATCH 6/6] mt76: mt7921: enable deep sleep when the device suspends Date: Mon, 19 Apr 2021 00:36:07 +0800 [thread overview] Message-ID: <1618763767-1292-7-git-send-email-sean.wang@mediatek.com> (raw) In-Reply-To: <1618763767-1292-1-git-send-email-sean.wang@mediatek.com> From: Sean Wang <sean.wang@mediatek.com> Enable the deep sleep mode in suspend handler to reduce the power consumption further. Signed-off-by: Sean Wang <sean.wang@mediatek.com> --- drivers/net/wireless/mediatek/mt76/mt7921/pci.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c index 40e2086d075c..277960b680bc 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c @@ -189,6 +189,9 @@ static int mt7921_pci_suspend(struct pci_dev *pdev, pm_message_t state) return err; } + if (!dev->pm.enable) + mt76_connac_mcu_set_deep_sleep(&dev->mt76, true); + napi_disable(&mdev->tx_napi); mt76_worker_disable(&mdev->tx_worker); @@ -227,6 +230,10 @@ static int mt7921_pci_suspend(struct pci_dev *pdev, pm_message_t state) napi_enable(&mdev->napi[i]); } napi_enable(&mdev->tx_napi); + + if (!dev->pm.enable) + mt76_connac_mcu_set_deep_sleep(&dev->mt76, false); + if (hif_suspend) mt76_connac_mcu_set_hif_suspend(mdev, false); @@ -249,6 +256,8 @@ static int mt7921_pci_resume(struct pci_dev *pdev) if (err < 0) return err; + mt7921_wpdma_reinit_cond(dev); + /* enable interrupt */ mt76_wr(dev, MT_PCIE_MAC_INT_ENABLE, 0xff); mt7921_irq_enable(dev, MT_INT_RX_DONE_ALL | MT_INT_TX_DONE_ALL | @@ -266,6 +275,9 @@ static int mt7921_pci_resume(struct pci_dev *pdev) napi_enable(&mdev->tx_napi); napi_schedule(&mdev->tx_napi); + if (!dev->pm.enable) + mt76_connac_mcu_set_deep_sleep(&dev->mt76, false); + if (!test_bit(MT76_STATE_SUSPEND, &dev->mphy.state)) err = mt76_connac_mcu_set_hif_suspend(mdev, false); -- 2.25.1 _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek
next prev parent reply other threads:[~2021-04-18 16:36 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-04-18 16:36 [PATCH 0/6] enable deep sleep mode when mt7921e suspends sean.wang 2021-04-18 16:36 ` sean.wang 2021-04-18 16:36 ` [PATCH 1/6] mt76: mt7921: move mt7921_dma_reset in dma.c sean.wang 2021-04-18 16:36 ` sean.wang 2021-04-18 16:47 ` Lorenzo Bianconi 2021-04-18 16:47 ` Lorenzo Bianconi 2021-04-18 16:36 ` [PATCH 2/6] mt76: mt7921: introduce mt7921_wpdma_reset utility routine sean.wang 2021-04-18 16:36 ` sean.wang 2021-04-18 16:36 ` [PATCH 3/6] mt76: mt7921: introduce mt7921_dma_{enable,disable} utilities sean.wang 2021-04-18 16:36 ` [PATCH 3/6] mt76: mt7921: introduce mt7921_dma_{enable, disable} utilities sean.wang 2021-04-18 16:36 ` [PATCH 4/6] mt76: mt7921: introduce mt7921_wpdma_reinit_cond utility routine sean.wang 2021-04-18 16:36 ` sean.wang 2021-04-18 16:48 ` Lorenzo Bianconi 2021-04-18 16:48 ` Lorenzo Bianconi 2021-04-18 16:36 ` [PATCH 5/6] mt76: connac: introduce mt76_connac_mcu_set_deep_sleep utility sean.wang 2021-04-18 16:36 ` sean.wang 2021-04-18 16:36 ` sean.wang [this message] 2021-04-18 16:36 ` [PATCH 6/6] mt76: mt7921: enable deep sleep when the device suspends sean.wang
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1618763767-1292-7-git-send-email-sean.wang@mediatek.com \ --to=sean.wang@mediatek.com \ --cc=Deren.Wu@mediatek.com \ --cc=Eric.Liang@mediatek.com \ --cc=Leon.Yen@mediatek.com \ --cc=Soul.Huang@mediatek.com \ --cc=Stella.Chang@mediatek.com \ --cc=YN.Chen@mediatek.com \ --cc=ch.yeh@mediatek.com \ --cc=km.lin@mediatek.com \ --cc=linux-mediatek@lists.infradead.org \ --cc=linux-wireless@vger.kernel.org \ --cc=lorenzo.bianconi@redhat.com \ --cc=nbd@nbd.name \ --cc=posh.sun@mediatek.com \ --cc=robin.chiu@mediatek.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.