mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] irqchip/meson-gpio: Allow the GPIO interrupts to wake the system
@ 2026-10-10 18:20 Igor Velkov via B4 Relay
  2026-10-12  9:22 ` Neil Armstrong
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Igor Velkov via B4 Relay @ 2026-10-10 18:20 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Radu Rendec, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, linux-arm-kernel, linux-amlogic,
	linux-kernel, Igor Velkov

From: Igor Velkov <iav@iav.lv>

meson_gpio_irq_chip has neither .irq_set_wake nor IRQCHIP_SKIP_SET_WAKE,
so enable_irq_wake() fails with -ENXIO for every interrupt routed through
it, and such an interrupt never gets IRQD_WAKEUP_STATE.

That matters for suspend-to-idle. suspend_device_irqs() keeps only the
wakeup interrupts enabled; the rest are suspended and masked by the flow
handler when they first fire. A GPIO interrupt that fires during s2idle
therefore brings a CPU out of idle once, gets masked, and the system
sleeps on. For mem the firmware chooses the wakeup sources, and this
flag changes nothing there.

Set IRQCHIP_SKIP_SET_WAKE, like the other hierarchical irqchips with a
GIC parent. The GIC sets the same flag, so irq_chip_set_wake_parent()
would end there anyway.

Tested on ODROID-HC4 with the PCF8563 alarm interrupt routed through this
controller: with the flag the alarm wakes the board from s2idle 4/4, and
/sys/power/pm_wakeup_irq names it; without the flag the board stayed in
s2idle past the alarm until a power cycle (0/5).

Assisted-by: LLM
Signed-off-by: Igor Velkov <iav@iav.lv>
---
Changes in v2:
- Reworded, as Neil asked: say that the test and the effect are for
  suspend-to-idle, describe how genirq handles the interrupt there, and
  note that for mem the firmware picks the wakeup sources.
- Repeated the run without the flag: 0/5 (v1 said 0/1).
- Link to v1: https://lore.kernel.org/r/20261008-meson-gpio-wake-v1-1-b0af1598d469@iav.lv
---
 drivers/irqchip/irq-meson-gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-meson-gpio.c b/drivers/irqchip/irq-meson-gpio.c
index 91a9c337fe6d..e0329ef5e4a2 100644
--- a/drivers/irqchip/irq-meson-gpio.c
+++ b/drivers/irqchip/irq-meson-gpio.c
@@ -538,7 +538,7 @@ static struct irq_chip meson_gpio_irq_chip = {
 #ifdef CONFIG_SMP
 	.irq_set_affinity	= irq_chip_set_affinity_parent,
 #endif
-	.flags			= IRQCHIP_SET_TYPE_MASKED,
+	.flags			= IRQCHIP_SET_TYPE_MASKED | IRQCHIP_SKIP_SET_WAKE,
 };
 
 static int meson_gpio_irq_domain_translate(struct irq_domain *domain,

---
base-commit: a90ee4305c4a5df72c11b31dacfdc76e00fcf78a
change-id: 20261008-meson-gpio-wake-f3bfa3bb2e5a

Best regards,
-- 
Igor Velkov <iav@iav.lv>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] irqchip/meson-gpio: Allow the GPIO interrupts to wake the system
  2026-10-10 18:20 [PATCH v2] irqchip/meson-gpio: Allow the GPIO interrupts to wake the system Igor Velkov via B4 Relay
@ 2026-10-12  9:22 ` Neil Armstrong
  2026-10-15 10:11 ` [tip: irq/drivers] " tip-bot2 for Igor Velkov
  2026-10-19 12:58 ` [PATCH v2] " Asai, Shigeaki
  2 siblings, 0 replies; 4+ messages in thread
From: Neil Armstrong @ 2026-10-12  9:22 UTC (permalink / raw)
  To: iav, Thomas Gleixner
  Cc: Radu Rendec, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
	linux-arm-kernel, linux-amlogic, linux-kernel

On 10/10/26 20:20, Igor Velkov via B4 Relay wrote:
> From: Igor Velkov <iav@iav.lv>
> 
> meson_gpio_irq_chip has neither .irq_set_wake nor IRQCHIP_SKIP_SET_WAKE,
> so enable_irq_wake() fails with -ENXIO for every interrupt routed through
> it, and such an interrupt never gets IRQD_WAKEUP_STATE.
> 
> That matters for suspend-to-idle. suspend_device_irqs() keeps only the
> wakeup interrupts enabled; the rest are suspended and masked by the flow
> handler when they first fire. A GPIO interrupt that fires during s2idle
> therefore brings a CPU out of idle once, gets masked, and the system
> sleeps on. For mem the firmware chooses the wakeup sources, and this
> flag changes nothing there.
> 
> Set IRQCHIP_SKIP_SET_WAKE, like the other hierarchical irqchips with a
> GIC parent. The GIC sets the same flag, so irq_chip_set_wake_parent()
> would end there anyway.
> 
> Tested on ODROID-HC4 with the PCF8563 alarm interrupt routed through this
> controller: with the flag the alarm wakes the board from s2idle 4/4, and
> /sys/power/pm_wakeup_irq names it; without the flag the board stayed in
> s2idle past the alarm until a power cycle (0/5).
> 
> Assisted-by: LLM
> Signed-off-by: Igor Velkov <iav@iav.lv>
> ---
> Changes in v2:
> - Reworded, as Neil asked: say that the test and the effect are for
>    suspend-to-idle, describe how genirq handles the interrupt there, and
>    note that for mem the firmware picks the wakeup sources.
> - Repeated the run without the flag: 0/5 (v1 said 0/1).
> - Link to v1: https://lore.kernel.org/r/20261008-meson-gpio-wake-v1-1-b0af1598d469@iav.lv
> ---
>   drivers/irqchip/irq-meson-gpio.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/irqchip/irq-meson-gpio.c b/drivers/irqchip/irq-meson-gpio.c
> index 91a9c337fe6d..e0329ef5e4a2 100644
> --- a/drivers/irqchip/irq-meson-gpio.c
> +++ b/drivers/irqchip/irq-meson-gpio.c
> @@ -538,7 +538,7 @@ static struct irq_chip meson_gpio_irq_chip = {
>   #ifdef CONFIG_SMP
>   	.irq_set_affinity	= irq_chip_set_affinity_parent,
>   #endif
> -	.flags			= IRQCHIP_SET_TYPE_MASKED,
> +	.flags			= IRQCHIP_SET_TYPE_MASKED | IRQCHIP_SKIP_SET_WAKE,
>   };
>   
>   static int meson_gpio_irq_domain_translate(struct irq_domain *domain,
> 
> ---
> base-commit: a90ee4305c4a5df72c11b31dacfdc76e00fcf78a
> change-id: 20261008-meson-gpio-wake-f3bfa3bb2e5a
> 
> Best regards,

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>

Thanks,
Neil

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip: irq/drivers] irqchip/meson-gpio: Allow the GPIO interrupts to wake the system
  2026-10-10 18:20 [PATCH v2] irqchip/meson-gpio: Allow the GPIO interrupts to wake the system Igor Velkov via B4 Relay
  2026-10-12  9:22 ` Neil Armstrong
@ 2026-10-15 10:11 ` tip-bot2 for Igor Velkov
  2026-10-19 12:58 ` [PATCH v2] " Asai, Shigeaki
  2 siblings, 0 replies; 4+ messages in thread
From: tip-bot2 for Igor Velkov @ 2026-10-15 10:11 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Igor Velkov, Thomas Gleixner, Neil Armstrong, x86, linux-kernel

The following commit has been merged into the irq/drivers branch of tip:

Commit-ID:     5b6e2a46b80ddbc93e72eb4f01519b0c8c3e0ef0
Gitweb:        https://git.kernel.org/tip/5b6e2a46b80ddbc93e72eb4f01519b0c8c3e0ef0
Author:        Igor Velkov <iav@iav.lv>
AuthorDate:    Sat, 10 Oct 2026 18:20:30 
Committer:     Thomas Gleixner <tglx@kernel.org>
CommitterDate: Thu, 15 Oct 2026 12:07:02 +02:00

irqchip/meson-gpio: Allow the GPIO interrupts to wake the system

meson_gpio_irq_chip has neither .irq_set_wake nor IRQCHIP_SKIP_SET_WAKE,
so enable_irq_wake() fails with -ENXIO for every interrupt routed through
it, and such an interrupt never gets IRQD_WAKEUP_STATE.

That matters for suspend-to-idle. suspend_device_irqs() keeps only the
wakeup interrupts enabled; the rest are suspended and masked by the flow
handler when they first fire. A GPIO interrupt that fires during s2idle
therefore brings a CPU out of idle once, gets masked, and the system
sleeps on. For mem the firmware chooses the wakeup sources, and this
flag changes nothing there.

Set IRQCHIP_SKIP_SET_WAKE, like the other hierarchical irqchips with a
GIC parent. The GIC sets the same flag, so irq_chip_set_wake_parent()
would end there anyway.

Tested on ODROID-HC4 with the PCF8563 alarm interrupt routed through this
controller: with the flag the alarm wakes the board from s2idle 4/4, and
/sys/power/pm_wakeup_irq names it; without the flag the board stayed in
s2idle past the alarm until a power cycle (0/5).

Signed-off-by: Igor Velkov <iav@iav.lv>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Assisted-by: LLM
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://patch.msgid.link/20261010-meson-gpio-wake-v2-1-790ecc6df792@iav.lv
---
 drivers/irqchip/irq-meson-gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-meson-gpio.c b/drivers/irqchip/irq-meson-gpio.c
index 91a9c33..e0329ef 100644
--- a/drivers/irqchip/irq-meson-gpio.c
+++ b/drivers/irqchip/irq-meson-gpio.c
@@ -538,7 +538,7 @@ static struct irq_chip meson_gpio_irq_chip = {
 #ifdef CONFIG_SMP
 	.irq_set_affinity	= irq_chip_set_affinity_parent,
 #endif
-	.flags			= IRQCHIP_SET_TYPE_MASKED,
+	.flags			= IRQCHIP_SET_TYPE_MASKED | IRQCHIP_SKIP_SET_WAKE,
 };
 
 static int meson_gpio_irq_domain_translate(struct irq_domain *domain,

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] irqchip/meson-gpio: Allow the GPIO interrupts to wake the system
  2026-10-10 18:20 [PATCH v2] irqchip/meson-gpio: Allow the GPIO interrupts to wake the system Igor Velkov via B4 Relay
  2026-10-12  9:22 ` Neil Armstrong
  2026-10-15 10:11 ` [tip: irq/drivers] " tip-bot2 for Igor Velkov
@ 2026-10-19 12:58 ` Asai, Shigeaki
  2 siblings, 0 replies; 4+ messages in thread
From: Asai, Shigeaki @ 2026-10-19 12:58 UTC (permalink / raw)
  To: iav, Thomas Gleixner
  Cc: Radu Rendec, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, linux-arm-kernel, linux-amlogic,
	linux-kernel


On 10/10/26 20:20, Igor Velkov via B4 Relay wrote:
> Set IRQCHIP_SKIP_SET_WAKE, like the other hierarchical irqchips with a
> GIC parent.

Tested on an ODROID-GO Ultra (S922X), where the RK818 and RK817 PMIC
interrupts come through this controller (GPIOAO_7 and GPIOAO_5).

With this patch, an alarm on the RK818 RTC woke the board from s2idle
4/4, and the power key (rk805-pwrkey on the RK817) 3/3. /proc/interrupts
counted each wakeup on the right interrupt. Without the patch, neither
of them woke the board from s2idle in my earlier tries.

Tested-by: Shigeaki Asai <y-asai.0816@docomonet.jp>

(This reply was written with the help of Claude.)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-10-19 13:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-10 18:20 [PATCH v2] irqchip/meson-gpio: Allow the GPIO interrupts to wake the system Igor Velkov via B4 Relay
2026-10-12  9:22 ` Neil Armstrong
2026-10-15 10:11 ` [tip: irq/drivers] " tip-bot2 for Igor Velkov
2026-10-19 12:58 ` [PATCH v2] " Asai, Shigeaki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®