Commit d71d67a7 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau

mt76: mt7615: reschedule ps work according to last activity

Reschedule runtime-pm delayed work if there is a new activity when ps
delayed work is already scheduled
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent e9eb59c6
...@@ -1932,13 +1932,21 @@ EXPORT_SYMBOL_GPL(mt7615_pm_power_save_sched); ...@@ -1932,13 +1932,21 @@ EXPORT_SYMBOL_GPL(mt7615_pm_power_save_sched);
void mt7615_pm_power_save_work(struct work_struct *work) void mt7615_pm_power_save_work(struct work_struct *work)
{ {
struct mt7615_dev *dev; struct mt7615_dev *dev;
unsigned long delta;
dev = (struct mt7615_dev *)container_of(work, struct mt7615_dev, dev = (struct mt7615_dev *)container_of(work, struct mt7615_dev,
pm.ps_work.work); pm.ps_work.work);
if (mt7615_firmware_own(dev)) delta = dev->pm.idle_timeout;
queue_delayed_work(dev->mt76.wq, &dev->pm.ps_work, if (time_is_after_jiffies(dev->pm.last_activity + delta)) {
dev->pm.idle_timeout); delta = dev->pm.last_activity + delta - jiffies;
goto out;
}
if (!mt7615_firmware_own(dev))
return;
out:
queue_delayed_work(dev->mt76.wq, &dev->pm.ps_work, delta);
} }
static void static void
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment