mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
wifi: mt76: mt7921: move runtime-pm pci code in mt792x-lib
Move the following runtime-pm pci routines in mt792x-lib since they are shared between mt7921 and mt7925 chipsets: - __mt7921e_mcu_drv_pmctrl - mt7921e_mcu_drv_pmctrl - mt7921e_mcu_fw_pmctrl Signed-off-by: Lorenzo Bianconi <[email protected]> Signed-off-by: Deren Wu <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
committed by
Felix Fietkau
parent
e07540abe8
commit
3d65cd7a8d
@@ -736,5 +736,73 @@ out:
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt792x_mcu_fw_pmctrl);
|
||||
|
||||
int __mt792xe_mcu_drv_pmctrl(struct mt792x_dev *dev)
|
||||
{
|
||||
int i, err = 0;
|
||||
|
||||
for (i = 0; i < MT792x_DRV_OWN_RETRY_COUNT; i++) {
|
||||
mt76_wr(dev, MT_CONN_ON_LPCTL, PCIE_LPCR_HOST_CLR_OWN);
|
||||
if (mt76_poll_msec_tick(dev, MT_CONN_ON_LPCTL,
|
||||
PCIE_LPCR_HOST_OWN_SYNC, 0, 50, 1))
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == MT792x_DRV_OWN_RETRY_COUNT) {
|
||||
dev_err(dev->mt76.dev, "driver own failed\n");
|
||||
err = -EIO;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__mt792xe_mcu_drv_pmctrl);
|
||||
|
||||
int mt792xe_mcu_drv_pmctrl(struct mt792x_dev *dev)
|
||||
{
|
||||
struct mt76_phy *mphy = &dev->mt76.phy;
|
||||
struct mt76_connac_pm *pm = &dev->pm;
|
||||
int err;
|
||||
|
||||
err = __mt792xe_mcu_drv_pmctrl(dev);
|
||||
if (err < 0)
|
||||
goto out;
|
||||
|
||||
mt792x_wpdma_reinit_cond(dev);
|
||||
clear_bit(MT76_STATE_PM, &mphy->state);
|
||||
|
||||
pm->stats.last_wake_event = jiffies;
|
||||
pm->stats.doze_time += pm->stats.last_wake_event -
|
||||
pm->stats.last_doze_event;
|
||||
out:
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt792xe_mcu_drv_pmctrl);
|
||||
|
||||
int mt792xe_mcu_fw_pmctrl(struct mt792x_dev *dev)
|
||||
{
|
||||
struct mt76_phy *mphy = &dev->mt76.phy;
|
||||
struct mt76_connac_pm *pm = &dev->pm;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MT792x_DRV_OWN_RETRY_COUNT; i++) {
|
||||
mt76_wr(dev, MT_CONN_ON_LPCTL, PCIE_LPCR_HOST_SET_OWN);
|
||||
if (mt76_poll_msec_tick(dev, MT_CONN_ON_LPCTL,
|
||||
PCIE_LPCR_HOST_OWN_SYNC, 4, 50, 1))
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == MT792x_DRV_OWN_RETRY_COUNT) {
|
||||
dev_err(dev->mt76.dev, "firmware own failed\n");
|
||||
clear_bit(MT76_STATE_PM, &mphy->state);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
pm->stats.last_doze_event = jiffies;
|
||||
pm->stats.awake_time += pm->stats.last_doze_event -
|
||||
pm->stats.last_wake_event;
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt792xe_mcu_fw_pmctrl);
|
||||
|
||||
MODULE_LICENSE("Dual BSD/GPL");
|
||||
MODULE_AUTHOR("Lorenzo Bianconi <[email protected]>");
|
||||
|
||||
Reference in New Issue
Block a user