summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/mediatek/mt76/mt76_connac.h
diff options
context:
space:
mode:
authorLorenzo Bianconi <lorenzo@kernel.org>2021-04-18 18:45:36 +0200
committerFelix Fietkau <nbd@nbd.name>2021-04-21 20:55:53 +0200
commitec7bd7b4a9c0e7e90d23b4f6a7dca2c713fe93ab (patch)
tree0c0877393a7fafcc5f0aac4ae526d8045ccf9bc4 /drivers/net/wireless/mediatek/mt76/mt76_connac.h
parent4f9b3aeb837a9df029b56179be7b0505de4400de (diff)
mt76: connac: check wake refcount in mcu_fw_pmctrl
In order to avoid synchronization races between tx and rx path, rely on mt76_connac_skip_fw_pmctrl putting the chip in sleep mode for mt7921 and mt7663 devices Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net/wireless/mediatek/mt76/mt76_connac.h')
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76_connac.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac.h b/drivers/net/wireless/mediatek/mt76/mt76_connac.h
index 85846eab8d7d..116d800c9f9d 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac.h
@@ -116,6 +116,18 @@ mt76_connac_pm_unref(struct mt76_connac_pm *pm)
spin_unlock_bh(&pm->wake.lock);
}
+static inline bool
+mt76_connac_skip_fw_pmctrl(struct mt76_phy *phy, struct mt76_connac_pm *pm)
+{
+ bool ret;
+
+ spin_lock_bh(&pm->wake.lock);
+ ret = pm->wake.count || test_and_set_bit(MT76_STATE_PM, &phy->state);
+ spin_unlock_bh(&pm->wake.lock);
+
+ return ret;
+}
+
static inline void
mt76_connac_mutex_acquire(struct mt76_dev *dev, struct mt76_connac_pm *pm)
__acquires(&dev->mutex)