Skip to content

A9: keep the AOP GPIO domain on, so s2idle wakes with the AOP running - #227

Open
ricktav wants to merge 1 commit into
OrchardLinux:mainfrom
ricktav:n66/aop-suspend
Open

ricktav wants to merge 1 commit into
OrchardLinux:mainfrom
ricktav:n66/aop-suspend

Conversation

@ricktav

@ricktav ricktav commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Since #219 the AOP starts on the A9 iPhones. With it running, the iPhone 6s Plus (N66) no longer comes back from s2idle. Omarchy suspends after about a minute idle, so on an installed N66 the phone hangs a minute after boot.

Cause. The AOP's firmware keeps running while Linux sleeps, but the power domain of its GPIO block, aop_gpio, is not always-on like ps_aop itself. In s2idle genpd turns it off in the noirq phase.

Fix. kernel/patches/devices/t8010/0048: apple,always-on on ps_aop_gpio in s800-0-3-pmgr.dtsi. One line.

Tested on an iPhone 6s Plus (N66), all in a RAM boot with the all-features kernel:

pm_test=platform real s2idle, Power button
without the AOP driver returns after 5 s —
AOP running, main's DTB never returns (hard reset) does not wake (hard reset)
AOP running, with this patch returns after 5 s wakes (Triggering wakeup from IRQ 67, Power Button); the AOP still answers afterwards (barometer reads)

pm_test=devices passed in every case, so the hang is in the late/noirq phase.

Not tested:

  • The iPad 5. The change is in the S8000/S8003 shared pmgr file, so it also applies to the iPad 5, which has the AOP enabled on main too. It probably hangs in s2idle the same way, but I have not checked that, nor this fix on it.
  • The other A9 iPhones (6s, SE): same file and same AOP, not tested.
  • An installed system: tested only in RAM boots so far, not yet in Omarchy from storage.

Checks: kernel/audit-patches.py --device n66 applies the whole series including 0048; unit tests OK; generate matrix --check ok.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SFMaVf5sMxs7xEyPFZWGEj

With the AOP started (t8010/0040, 0041), an iPhone 6s Plus hangs in
s2idle: genpd turns aop_gpio off in the noirq phase while the AOP
firmware keeps running. Mark aop_gpio always-on, as ps_aop is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFMaVf5sMxs7xEyPFZWGEj
@ricktav

ricktav commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

Now also tested on an installed system: Omarchy on the iPhone 6s Plus (N66) from storage, with this one change in its DTB and the AOP running (AOP IS READY). omarchy-powerd suspended it after its idle timeout (PM: suspend entry (s2idle)), and the Power button woke it (System returned from sleep operation 'suspend'). Before this change the same install hung there and needed a hard reset.

The iPad 5 is still untested.

@ricktav

ricktav commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

Correction, please hold this PR: in every test above that passed with the change, the AOP accelerometer and gyroscope children did not probe (-22). My test DTB was made by decompiling and recompiling the DTB, and that round trip mangled their mount-matrix strings. The AOP itself and the barometer did run. The hanging runs had them probing. So it is not yet shown that aop_gpio is the cause rather than the accel/gyro drivers. I will retest with a DTB built from source with this patch (accel and gyro probing) and report here.

@ricktav

ricktav commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

Retested with a DTB built from source with this patch (cpp + dtc -@ on s8000-n66.dts; its only difference from the unpatched all-features DTB is the one apple,always-on line), in a RAM boot on the iPhone 6s Plus. This time the AOP accelerometer, gyroscope and barometer all probed and read (accel z -62677, gyro z -43716, pressure 6708995).

  • pm_test=platform: returns after its 5 s.
  • Real s2idle: woken by the Power button (pm_wakeup_irq 67, Power Button). Afterwards accel, gyro and barometer still read.

So the hang without this patch is not from the accel/gyro drivers: with them running, aop_gpio always-on is enough. The correction above no longer holds. The iPad 5 is still untested.

@ricktav

ricktav commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

And on the installed system with the source-built DTB: Omarchy on the iPhone 6s Plus with the AOP accelerometer, gyroscope and barometer probed. omarchy-powerd suspended it after its idle timeout (PM: suspend entry (s2idle)), the Home button woke it (pm_wakeup_irq 66), suspend_stats: 1 success, 0 fail. After the wake the three AOP sensors still read and Wi-Fi stayed connected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant