Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

genirq / PM: describe IRQF_COND_SUSPEND

With certain restrictions it is possible for a wakeup device to share
an IRQ with an IRQF_NO_SUSPEND user, and the warnings introduced by
commit cab303be91dc47942bc25de33dc1140123540800 are spurious. The new
IRQF_COND_SUSPEND flag allows drivers to tell the core when these
restrictions are met, allowing spurious warnings to be silenced.

This patch documents how IRQF_COND_SUSPEND is expected to be used,
updating some of the text now made invalid by its addition.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Mark Rutland and committed by
Rafael J. Wysocki
7438b633 2c7af5ba

+13 -3
+13 -3
Documentation/power/suspend-and-interrupts.txt
··· 112 112 IRQF_NO_SUSPEND and enable_irq_wake() 113 113 ------------------------------------- 114 114 115 - There are no valid reasons to use both enable_irq_wake() and the IRQF_NO_SUSPEND 116 - flag on the same IRQ. 115 + There are very few valid reasons to use both enable_irq_wake() and the 116 + IRQF_NO_SUSPEND flag on the same IRQ, and it is never valid to use both for the 117 + same device. 117 118 118 119 First of all, if the IRQ is not shared, the rules for handling IRQF_NO_SUSPEND 119 120 interrupts (interrupt handlers are invoked after suspend_device_irqs()) are ··· 123 122 124 123 Second, both enable_irq_wake() and IRQF_NO_SUSPEND apply to entire IRQs and not 125 124 to individual interrupt handlers, so sharing an IRQ between a system wakeup 126 - interrupt source and an IRQF_NO_SUSPEND interrupt source does not make sense. 125 + interrupt source and an IRQF_NO_SUSPEND interrupt source does not generally 126 + make sense. 127 + 128 + In rare cases an IRQ can be shared between a wakeup device driver and an 129 + IRQF_NO_SUSPEND user. In order for this to be safe, the wakeup device driver 130 + must be able to discern spurious IRQs from genuine wakeup events (signalling 131 + the latter to the core with pm_system_wakeup()), must use enable_irq_wake() to 132 + ensure that the IRQ will function as a wakeup source, and must request the IRQ 133 + with IRQF_COND_SUSPEND to tell the core that it meets these requirements. If 134 + these requirements are not met, it is not valid to use IRQF_COND_SUSPEND.