irqchip/sun6i-r: Add wakeup support
authorSamuel Holland <samuel@sholland.org>
Mon, 18 Jan 2021 05:50:34 +0000 (23:50 -0600)
committerMarc Zyngier <maz@kernel.org>
Thu, 21 Jan 2021 20:21:49 +0000 (20:21 +0000)
commit7ab365f6cd6de1e2b0cb1e1e3873dbf68e6f1003
treeb6e2e6b3cdbe6ac65ec7a44394ce1e0e7a158cdc
parent4e34614636b31747b190488240a95647c227021f
irqchip/sun6i-r: Add wakeup support

Maintain bitmaps of wake-enabled IRQs and mux inputs, and program them
to the hardware during the syscore phase of suspend and shutdown. Then
restore the original set of enabled IRQs (only the NMI) during resume.

This serves two purposes. First, it lets power management firmware
running on the ARISC coprocessor know which wakeup sources Linux wants
to have enabled. That way, it can avoid turning them off when it shuts
down the remainder of the clock tree. Second, it preconfigures the
coprocessor's interrupt controller, so the firmware's wakeup logic
is as simple as waiting for an interrupt to arrive.

The suspend/resume logic is not conditional on PM_SLEEP because it is
identical to the init/shutdown logic. Wake IRQs may be enabled during
shutdown to allow powering the board back on. As an example, see
commit a5c5e50cce9d ("Input: gpio-keys - add shutdown callback").

Acked-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20210118055040.21910-5-samuel@sholland.org
drivers/irqchip/irq-sun6i-r.c