Commit 8aff2d91 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau
Browse files

mt76: mt7663s: enable runtime-pm



Allow the user to enable runtime-pm for mt7663s driver

Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent c2f9e631
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ mt7615_pm_set(void *data, u64 val)
	if (!mt7615_wait_for_mcu_init(dev))
		return 0;

	if (!mt7615_firmware_offload(dev) || !mt76_is_mmio(&dev->mt76))
	if (!mt7615_firmware_offload(dev) || mt76_is_usb(&dev->mt76))
		return -EOPNOTSUPP;

	if (val == pm->enable)
+10 −3
Original line number Diff line number Diff line
@@ -65,13 +65,16 @@ static int __mt7663s_mcu_drv_pmctrl(struct mt7615_dev *dev)

	ret = readx_poll_timeout(mt7663s_read_pcr, dev, status,
				 status & WHLPCR_IS_DRIVER_OWN, 2000, 1000000);
	if (ret < 0)
	if (ret < 0) {
		dev_err(dev->mt76.dev, "Cannot get ownership from device");
	else
	} else {
		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;
	}
	sdio_release_host(func);
	pm->last_activity = jiffies;

	return ret;
}
@@ -113,6 +116,10 @@ static int mt7663s_mcu_fw_pmctrl(struct mt7615_dev *dev)
	if (ret < 0) {
		dev_err(dev->mt76.dev, "Cannot set ownership to device");
		clear_bit(MT76_STATE_PM, &mphy->state);
	} else {
		pm->stats.last_doze_event = jiffies;
		pm->stats.awake_time += pm->stats.last_doze_event -
					pm->stats.last_wake_event;
	}

	sdio_release_host(func);
+2 −2
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ int mt76_connac_pm_wake(struct mt76_phy *phy, struct mt76_connac_pm *pm)
	if (!pm->enable)
		return 0;

	if (!mt76_is_mmio(dev))
	if (mt76_is_usb(dev))
		return 0;

	cancel_delayed_work_sync(&pm->ps_work);
@@ -37,7 +37,7 @@ void mt76_connac_power_save_sched(struct mt76_phy *phy,
{
	struct mt76_dev *dev = phy->dev;

	if (!mt76_is_mmio(dev))
	if (mt76_is_usb(dev))
		return;

	if (!pm->enable)