Skip to content

pmdomain: apple: keep domains the AOP raised across a sleep - #1265

Closed
DjDeveloperr wants to merge 6 commits into
feat/t8140-s2r-usb-keepfrom
fix/t8140-pmgr-keep-aop-domains
Closed

DjDeveloperr wants to merge 6 commits into
feat/t8140-s2r-usb-keepfrom
fix/t8140-pmgr-keep-aop-domains

Conversation

@DjDeveloperr

Copy link
Copy Markdown
Contributor

On the MacBook Neo (T8140, J700) the internal microphone array (HPAI) recorded silence after every system sleep. The low-power microphone kept working.

Cause. The AOP firmware raises some audio power domains itself in the always-on PMGR. genpd has no consumer for them, so it has them off. The sleep leaves them as they are, but apple_pmgr_ps_resume_noirq power-gated every domain genpd had off. The AOP never raises them again, and the array's DMA then ran on all-zero samples.

Fix. At noirq suspend, note each domain that genpd has off but whose target is still on. On resume, lower such a domain only if the sleep changed its target. The #1255 busy-latch handling (power-on path) is unchanged.

Hardware result. J700, this branch, stock DT, four sleeps in one boot. Numbers are nonzero / distinct sample words from 1 s captures.

phase HPAI (96000 words) LPAI (32000 words)
before 81518 / 81076 31993 / 7429
after 1st sleep (deep path) 81524 / 80939 31996 / 7506
after 2nd sleep (DRAM kept) 81524 / 80947 31992 / 7045
after 3rd sleep, marker-filled buffer 81524 / 80971, no marker left 31990 / 7228
stream held open across 4th sleep (systemctl suspend) 81524 / 80943, fresh reopen 81526 / 80981

Without this commit, on the same #1217 head, HPAI reads 0 / 1 after the 1st and 2nd sleep, and LPAI is unaffected. After every wake, SSH, NVMe I/O, the USB devices, Wi-Fi and the panel all worked. pm_genpd_summary was identical after each wake and matched the run without this commit.

Domains kept (listed by a log-only test build, the same on every wake): audio_leap_rx1 (on, 0xff); audio_leap_rx2-4 and audio_mca3_m-5_m (clock-gated, 0x244); dwi (clock-gated, 0x244, no consumer on J700). The first (deep) sleep also notes dpa0/1, fpwm0-2, i2c1, i2c3, msg, pmgr_soc_ocla and pms_fpwm0-4. The wake changes their target, so they are lowered as before.

Also seen with and without this commit: after the first DRAM-kept wake, phy-apple-atc logs "PHY lock request not acknowledged" and apple_soc_edac reports ni1 source 19.

🤖 Generated with Claude Code

…oss a sleep

On the T8140 the AOP firmware raises audio domains of its own in the
always-on PMGR. Once the internal microphone array (HPAI) has run,
audio_leap_rx1 is on and audio_leap_rx2-4 and audio_mca3-5_m are clock
gated, while genpd, with no consumer for them, has them off. The sleep
keeps them. The resume pass then put them where genpd's books say,
power-gated, and the AOP never raises them again: after every sleep the
array's DMA ran at 48 kHz on all-zero samples, while the low-power
microphone kept working (measured).

At the noirq suspend, note which domains genpd has off with a target
still on. On resume, lower such a domain only if the sleep changed its
target. On the J700 the array then records after the first deep sleep
and after later sleeps, including a stream held open across the sleep
(measured).

Signed-off-by: Diljit Singh <hey@djdev.me>
Keep the noirq record of domains another owner raised alongside #1283's
system_sleep rule in the same driver; both sleep callbacks stay.
…omains

Brings in integration/aurora 15f88e1 through #1208. The one conflict is
the PMGR domain's fields: the sleep records and integration's
consumer-switched state are both kept.

Signed-off-by: Diljit Singh <hey@djdev.me>
…omains

Brings in #1208's aop-bootargs host test fix. No conflicts.

Signed-off-by: Diljit Singh <hey@djdev.me>
…omains

Brings in integration/aurora ac11649 (#1311, PCIe multi power domain
support) through #1208. No conflicts.

Signed-off-by: Diljit Singh <hey@djdev.me>
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Superseded by #1445 (merged as 2b05915); its changes are in integration/aurora. The AOP-raised domains are kept by apple_pmgr_ps_suspend_noirq() in drivers/pmdomain/apple/pmgr-pwrstate.c, now limited to T8140's always-on PMGR.

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