Skip to content

meson64: allow GPIO interrupts to act as wakeup sources - #10738

Merged
igorpecovnik merged 1 commit into
armbian:mainfrom
iav:fix/meson64-gpio-irq-wakeup
Sep 17, 2026
Merged

igorpecovnik merged 1 commit into
armbian:mainfrom
iav:fix/meson64-gpio-irq-wakeup

Conversation

@iav

@iav iav commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

meson_gpio_irq_chip declares neither .irq_set_wake nor
IRQCHIP_SKIP_SET_WAKE, so enable_irq_wake() returns -ENXIO for every
interrupt behind it and the interrupt is masked entering suspend.

On ODROID-HC4 the PCF8563 RTC alarm is exactly such an interrupt
(meson-gpio-irqchip 82 Level rtc-pcf8563), so the board enters
suspend-to-idle with nothing left to wake it: the alarm never fires and
only a power cycle brings it back.

Tested on hardware 2026-09-16, two kernels differing only in this flag:

  • without it: PM: suspend-to-idle, then silence; the board did not
    return on the alarm, nor 2.5 minutes past it, and was power-cycled;
  • with it: the same board wakes on the same alarm every time, and
    /sys/power/pm_wakeup_irq reports that interrupt.

The flag, rather than .irq_set_wake, matches what 35 other drivers under
drivers/irqchip do. The parent here is the GIC, which has no wakeup state
of its own, so irq_chip_set_wake_parent would just fail.

Patch added to meson64-6.12, -6.18, -7.2 and -7.3; it applies cleanly to
all four (verified against the respective kernel trees).

This is an upstream candidate: the defect is not Armbian-specific and
affects any Amlogic board whose wakeup source sits on a GPIO interrupt.

Important, please read before merging. The hardware test above ran on a
kernel that also carried a PCIe suspend/resume patch for pci-meson.c, which
is not in this tree — it is #10740, still a draft. On ODROID-HC4 the SATA controller sits behind PCIe, and
without that patch the controller comes back unprogrammed after resume and the
board hangs — so with this flag alone the board can be woken, but it will not
survive the sleep it was woken from.

This flag is still correct and useful on its own: it is what makes any GPIO
interrupt on Amlogic capable of waking the system at all, and on boards without
PCIe there is nothing else in the way. But for HC4 it only becomes a working
suspend story together with the PCIe patch, which is now open as a draft in #10740. Please do not read the HC4 numbers here as "suspend works on HC4
after this merge".

Related work — how this fits with the other suspend patches

This patch stands on its own: it is what makes any GPIO interrupt on Amlogic
capable of waking the system, and on boards without PCIe nothing else is in the
way. The others in the series:

Summary by CodeRabbit

  • Bug Fixes
    • GPIO interrupts on supported Meson platforms can now remain active during suspend.
    • Configured GPIO-based wakeup sources, including compatible real-time clock alarms, can wake the device from suspend-to-idle.

The Amlogic GPIO interrupt controller claims neither .irq_set_wake nor
IRQCHIP_SKIP_SET_WAKE, so enable_irq_wake() fails with -ENXIO and the
interrupt is masked on the way into suspend.  On ODROID-HC4 the PCF8563
alarm arrives through that controller, which leaves the board with no way
back from suspend-to-idle: it goes to sleep and stays there.

Add the flag, as 35 other drivers under drivers/irqchip do.  The parent
here is the GIC, so passing the request up with irq_chip_set_wake_parent
is not an option.

Verified on ODROID-HC4 with 7.2.6: without the patch the RTC alarm never
fires and the board has to be power-cycled; with it the same alarm brings
the board back every time.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 38f7d691-28cd-4280-bff1-61f425635e74

📥 Commits

Reviewing files that changed from the base of the PR and between 901cae7 and 33a3d8d.

📒 Files selected for processing (4)
  • patch/kernel/archive/meson64-6.12/general-irqchip-meson-gpio-allow-wakeup.patch
  • patch/kernel/archive/meson64-6.18/general-irqchip-meson-gpio-allow-wakeup.patch
  • patch/kernel/archive/meson64-7.2/general-irqchip-meson-gpio-allow-wakeup.patch
  • patch/kernel/archive/meson64-7.3/general-irqchip-meson-gpio-allow-wakeup.patch

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

Four archived Meson64 kernel patch files update meson_gpio_irq_chip with IRQCHIP_SKIP_SET_WAKE. The patches address failed enable_irq_wake() calls and masked GPIO interrupts during suspend.

Changes

Meson GPIO wakeup support

Layer / File(s) Summary
Meson GPIO wakeup patch variants
patch/kernel/archive/meson64-6.12/general-irqchip-meson-gpio-allow-wakeup.patch, patch/kernel/archive/meson64-6.18/general-irqchip-meson-gpio-allow-wakeup.patch, patch/kernel/archive/meson64-7.2/general-irqchip-meson-gpio-allow-wakeup.patch, patch/kernel/archive/meson64-7.3/general-irqchip-meson-gpio-allow-wakeup.patch
The patches change the meson_gpio_irq_chip flags from IRQCHIP_SET_TYPE_MASKED to `IRQCHIP_SET_TYPE_MASKED

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 33a3d

The patches retain their intended wakeup change, with no actionable current-head risk identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: enabling Meson GPIO interrupts to function as wakeup sources.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added size/medium PR with more then 50 and less then 250 lines 11 Milestone: Fourth quarter release Needs review Seeking for review Hardware Hardware related like kernel, U-Boot, ... Patches Patches related to kernel, U-Boot, ... labels Sep 16, 2026
iav added a commit to iav/armbian that referenced this pull request Sep 17, 2026
The RTL8211F on HC4 has its interrupt wired to GPIOZ_14 and the device
tree already describes it, but the node does not declare that it can wake
the board. The Realtek PHY driver registers the interrupt as a wakeup IRQ
only for nodes that say so:

	if (device_property_read_bool(dev, "wakeup-source") &&
	    phy_interrupt_is_valid(phydev)) {
		device_set_wakeup_capable(dev, true);
		devm_pm_set_wake_irq(dev, phydev->irq);
	}

Without the property Wake-on-LAN looks enabled and does nothing:
'ethtool -s end0 wol g' succeeds, the PHY stores the magic packet and
raises PME on its interrupt line, but that interrupt is not a wakeup
source, so it is masked entering suspend and the board sleeps through the
packet.

Measured on ODROID-HC4. Before: a magic packet left the board asleep, the
RTC alarm had to bring it back, and the network device reported
wakeup_count 0. After: the same packet wakes the board within seconds.

Added to 6.18, 7.2 and 7.3 only. The 6.12 Realtek driver has no
wakeup-source handling at all, so the property would be inert there.

Depends on the GPIO interrupt controller being able to hold a wakeup
state: the PHY interrupt arrives through meson_gpio_irq_chip, so without
IRQCHIP_SKIP_SET_WAKE (armbian#10738) this property is worse than
useless — everything reports Wake-on-LAN as enabled while the board still
cannot be woken. And on HC4 a woken board also needs PCIe suspend/resume
support (armbian#10740) to find its SATA controller afterwards.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

✅ This PR has been reviewed and approved — all set for merge!

@github-actions github-actions Bot added Ready to merge Reviewed, tested and ready for merge and removed Needs review Seeking for review labels Sep 17, 2026
igorpecovnik pushed a commit that referenced this pull request Sep 17, 2026
The RTL8211F on HC4 has its interrupt wired to GPIOZ_14 and the device
tree already describes it, but the node does not declare that it can wake
the board. The Realtek PHY driver registers the interrupt as a wakeup IRQ
only for nodes that say so:

	if (device_property_read_bool(dev, "wakeup-source") &&
	    phy_interrupt_is_valid(phydev)) {
		device_set_wakeup_capable(dev, true);
		devm_pm_set_wake_irq(dev, phydev->irq);
	}

Without the property Wake-on-LAN looks enabled and does nothing:
'ethtool -s end0 wol g' succeeds, the PHY stores the magic packet and
raises PME on its interrupt line, but that interrupt is not a wakeup
source, so it is masked entering suspend and the board sleeps through the
packet.

Measured on ODROID-HC4. Before: a magic packet left the board asleep, the
RTC alarm had to bring it back, and the network device reported
wakeup_count 0. After: the same packet wakes the board within seconds.

Added to 6.18, 7.2 and 7.3 only. The 6.12 Realtek driver has no
wakeup-source handling at all, so the property would be inert there.

Depends on the GPIO interrupt controller being able to hold a wakeup
state: the PHY interrupt arrives through meson_gpio_irq_chip, so without
IRQCHIP_SKIP_SET_WAKE (#10738) this property is worse than
useless — everything reports Wake-on-LAN as enabled while the board still
cannot be woken. And on HC4 a woken board also needs PCIe suspend/resume
support (#10740) to find its SATA controller afterwards.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@igorpecovnik
igorpecovnik merged commit a5a8398 into armbian:main Sep 17, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

11 Milestone: Fourth quarter release Hardware Hardware related like kernel, U-Boot, ... Patches Patches related to kernel, U-Boot, ... Ready to merge Reviewed, tested and ready for merge size/medium PR with more then 50 and less then 250 lines

Development

Successfully merging this pull request may close these issues.

3 participants