]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
PM / wakeirq: Fix dedicated wakeirq for drivers not using autosuspend
authorTony Lindgren <tony@atomide.com>
Tue, 6 Dec 2016 00:38:16 +0000 (16:38 -0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 6 Dec 2016 22:45:59 +0000 (23:45 +0100)
commitbed570307ed78f21b77cb04a1df781dee4a8f05a
tree876e07b8a436cf988a52ac1cb1237dd57407f285
parent1d9174fbc55ec99ccbfcafa3de2528ef78a849aa
PM / wakeirq: Fix dedicated wakeirq for drivers not using autosuspend

I noticed some wakeirq flakeyness with consumer drivers not using
autosuspend. For drivers not using autosuspend, the wakeirq may never
get unmasked in rpm_suspend() because of irq desc->depth.

We are configuring dedicated wakeirqs to start with IRQ_NOAUTOEN as we
naturally don't want them running until rpm_suspend() is called.

However, when a consumer driver initially calls pm_runtime_get(), we
now wrongly start with disable_irq_nosync() call on the dedicated
wakeirq that is disabled to start with.

This causes desc->depth to toggle between 1 and 2 instead of the usual
0 and 1. This can prevent enable_irq() from unmasking the wakeirq as
that only happens at desc->depth 1.

This does not necessarily show up with drivers using autosuspend as
there is time for disable_irq_nosync() before rpm_suspend() gets called
after the autosuspend timeout.

Let's fix the issue by adding wirq->status that lazily gets set on
the first rpm_suspend(). We also need PM runtime core private functions
for dev_pm_enable_wake_irq_check() and dev_pm_disable_wake_irq_check()
so we can enable the dedicated wakeirq on the first rpm_suspend().

While at it, let's also fix the comments for dev_pm_enable_wake_irq()
and dev_pm_disable_wake_irq(). Those can still be used by the consumer
drivers as needed because the IRQ core manages the interrupt usecount
for us.

Fixes: 4990d4fe327b (PM / Wakeirq: Add automated device wake IRQ handling)
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/base/power/power.h
drivers/base/power/runtime.c
drivers/base/power/wakeirq.c