linux-uconsole/drivers/base/power
Tony Lindgren b0cb7f6099 PM / wakeirq: Fix dedicated wakeirq for drivers not using autosuspend
commit bed570307e upstream.

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: 4990d4fe32 (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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-12 11:22:49 +01:00
..
opp PM / OPP: Initialize u_volt_min/max to a valid value 2016-05-04 14:48:51 -07:00
clock_ops.c ARM: SoC driver updates for v4.4 2015-11-10 15:00:03 -08:00
common.c PM: Convert dev_pm_put_subsys_data() into a void function 2015-02-03 22:59:25 +01:00
domain.c PM / Domains: Fix removal of a subdomain 2016-05-04 14:48:51 -07:00
domain_governor.c PM / Domains: Validate cases of a non-bound driver in genpd governor 2015-12-02 15:21:21 +01:00
generic_ops.c PM / PCI / ACPI: Kick devices that might have been reset by firmware 2015-10-14 02:17:34 +02:00
main.c PM / sleep: don't suspend parent when async child suspend_{noirq, late} fails 2016-11-26 09:54:53 +01:00
Makefile PM / OPP: Move opp core to its own directory 2015-09-15 02:03:16 +02:00
power.h PM / wakeirq: Fix dedicated wakeirq for drivers not using autosuspend 2017-01-12 11:22:49 +01:00
qos.c PM / QoS: Make it possible to expose device latency tolerance to userspace 2015-07-28 08:50:41 +01:00
runtime.c PM / wakeirq: Fix dedicated wakeirq for drivers not using autosuspend 2017-01-12 11:22:49 +01:00
sysfs.c PM / QoS: Make it possible to expose device latency tolerance to userspace 2015-07-28 08:50:41 +01:00
trace.c PM / sleep: add pm-trace support for suspending phase 2015-03-18 15:54:27 +01:00
wakeirq.c PM / wakeirq: Fix dedicated wakeirq for drivers not using autosuspend 2017-01-12 11:22:49 +01:00
wakeup.c PM / wakeup: wakeup_source_create: use kstrdup_const 2015-09-25 02:30:50 +02:00