Commit 8f6571ad authored by Quan Zhou's avatar Quan Zhou Committed by Felix Fietkau
Browse files

wifi: mt76: mt7925: add handler to hif suspend/resume event



When the system suspend or resume, the WiFi driver sends
an hif_ctrl command to the firmware and waits for an event.
Due to changes in the event format reported by the chip, the
current mt7925's driver does not account for these changes,
resulting in command timeout. Add flow to handle hif_ctrl
event to avoid command timeout. We also exented API
mt76_connac_mcu_set_hif_suspend for connac3 this time.

Signed-off-by: default avatarQuan Zhou <quan.zhou@mediatek.com>
Link: https://patch.msgid.link/3a0844ff5162142c4a9f3cf7104f75076ddd3b87.1735910562.git.quan.zhou@mediatek.com


Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent a0f721b8
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1248,7 +1248,7 @@ static int mt7615_suspend(struct ieee80211_hw *hw,
					    phy->mt76);

	if (!mt7615_dev_running(dev))
		err = mt76_connac_mcu_set_hif_suspend(&dev->mt76, true);
		err = mt76_connac_mcu_set_hif_suspend(&dev->mt76, true, true);

	mt7615_mutex_release(dev);

@@ -1270,7 +1270,7 @@ static int mt7615_resume(struct ieee80211_hw *hw)
	if (!running) {
		int err;

		err = mt76_connac_mcu_set_hif_suspend(&dev->mt76, false);
		err = mt76_connac_mcu_set_hif_suspend(&dev->mt76, false, true);
		if (err < 0) {
			mt7615_mutex_release(dev);
			return err;
+3 −3
Original line number Diff line number Diff line
@@ -83,7 +83,7 @@ static int mt7615_pci_suspend(struct pci_dev *pdev, pm_message_t state)
	hif_suspend = !test_bit(MT76_STATE_SUSPEND, &dev->mphy.state) &&
		      mt7615_firmware_offload(dev);
	if (hif_suspend) {
		err = mt76_connac_mcu_set_hif_suspend(mdev, true);
		err = mt76_connac_mcu_set_hif_suspend(mdev, true, true);
		if (err)
			return err;
	}
@@ -131,7 +131,7 @@ static int mt7615_pci_suspend(struct pci_dev *pdev, pm_message_t state)
	}
	napi_enable(&mdev->tx_napi);
	if (hif_suspend)
		mt76_connac_mcu_set_hif_suspend(mdev, false);
		mt76_connac_mcu_set_hif_suspend(mdev, false, true);

	return err;
}
@@ -175,7 +175,7 @@ static int mt7615_pci_resume(struct pci_dev *pdev)

	if (!test_bit(MT76_STATE_SUSPEND, &dev->mphy.state) &&
	    mt7615_firmware_offload(dev))
		err = mt76_connac_mcu_set_hif_suspend(mdev, false);
		err = mt76_connac_mcu_set_hif_suspend(mdev, false, true);

	return err;
}
+2 −2
Original line number Diff line number Diff line
@@ -191,7 +191,7 @@ static int mt7663s_suspend(struct device *dev)
	    mt7615_firmware_offload(mdev)) {
		int err;

		err = mt76_connac_mcu_set_hif_suspend(&mdev->mt76, true);
		err = mt76_connac_mcu_set_hif_suspend(&mdev->mt76, true, true);
		if (err < 0)
			return err;
	}
@@ -230,7 +230,7 @@ static int mt7663s_resume(struct device *dev)

	if (!test_bit(MT76_STATE_SUSPEND, &mdev->mphy.state) &&
	    mt7615_firmware_offload(mdev))
		err = mt76_connac_mcu_set_hif_suspend(&mdev->mt76, false);
		err = mt76_connac_mcu_set_hif_suspend(&mdev->mt76, false, true);

	return err;
}
+2 −2
Original line number Diff line number Diff line
@@ -225,7 +225,7 @@ static int mt7663u_suspend(struct usb_interface *intf, pm_message_t state)
	    mt7615_firmware_offload(dev)) {
		int err;

		err = mt76_connac_mcu_set_hif_suspend(&dev->mt76, true);
		err = mt76_connac_mcu_set_hif_suspend(&dev->mt76, true, true);
		if (err < 0)
			return err;
	}
@@ -253,7 +253,7 @@ static int mt7663u_resume(struct usb_interface *intf)

	if (!test_bit(MT76_STATE_SUSPEND, &dev->mphy.state) &&
	    mt7615_firmware_offload(dev))
		err = mt76_connac_mcu_set_hif_suspend(&dev->mt76, false);
		err = mt76_connac_mcu_set_hif_suspend(&dev->mt76, false, true);

	return err;
}
+2 −2
Original line number Diff line number Diff line
@@ -2534,7 +2534,7 @@ mt76_connac_mcu_set_wow_ctrl(struct mt76_phy *phy, struct ieee80211_vif *vif,
}
EXPORT_SYMBOL_GPL(mt76_connac_mcu_set_wow_ctrl);

int mt76_connac_mcu_set_hif_suspend(struct mt76_dev *dev, bool suspend)
int mt76_connac_mcu_set_hif_suspend(struct mt76_dev *dev, bool suspend, bool wait_resp)
{
	struct {
		struct {
@@ -2566,7 +2566,7 @@ int mt76_connac_mcu_set_hif_suspend(struct mt76_dev *dev, bool suspend)
		req.hdr.hif_type = 0;

	return mt76_mcu_send_msg(dev, MCU_UNI_CMD(HIF_CTRL), &req,
				 sizeof(req), true);
				 sizeof(req), wait_resp);
}
EXPORT_SYMBOL_GPL(mt76_connac_mcu_set_hif_suspend);

Loading