Skip to content

ASoC: tas2764: restore GPIO-controlled amps across firmware S2R - #3811

Merged
DjDeveloperr merged 1 commit into
aurora-silicon:mainfrom
patatman:fix/t6020-s2r-prereqs
Dec 3, 2026
Merged

DjDeveloperr merged 1 commit into
aurora-silicon:mainfrom
patatman:fix/t6020-s2r-prereqs

Conversation

@patatman

@patatman patatman commented Dec 1, 2026 •

Copy link
Copy Markdown

What: Treat GPIO-controlled TAS2764 amps (sdz_gpio) the same as sdz_group amps on pm_resume_via_firmware(), and guard tas2764->sdz_group in tas2764_restore_failed() so an I2C failure on a GPIO-controlled amp drives SDZ low and keeps regcache cache-only/dirty instead of dereferencing a NULL sdz_group. Ref #3336
Tested: Rebased onto main (c09b61228, dropping sound/soc/apple/mca.c now that a8d2f37caf89 caches and replays MCA DAI format) at b8c8bb060 with checkpatch.pl --strict (0 errors) and LLVM=1 build of sound/soc/codecs/tas2764.o (0 warnings). Prior identical tas2764.c diff verified on J414s (M2 Pro, T6020): 4x consecutive hardware SLP_S2R wakes on our desktop stack and @JJRPF's C82 linux@main + #3811 wake (rc=0, WARN=0, zero audio/I2C errors). Exact-head b8c8bb060 J414s 2x deep-sleep speaker (5% vol) + headphones check running next alongside #3999.
Risk: two-way door · Apple Silicon Macs with GPIO-controlled tas2764 (sdz_gpio, no sdz_group) using firmware-driven deep sleep (pm_resume_via_firmware()); no change on s2idle
Not yet: Exact-head b8c8bb060 J414s 2x deep-sleep speakers (5%) + headphones hardware row, and a second-generation firmware-S2R Mac row (e.g. J714s).

Details
  • sound/soc/codecs/tas2764.c:
    • Extend power_on in tas2764_codec_resume() from tas2764->sdz_group && pm_resume_via_firmware() to (tas2764->sdz_group || tas2764->sdz_gpio) && pm_resume_via_firmware() so shutdown-GPIO amps also get a clean power-on soft reset, page-register cache drop, regcache sync, and init quirks after firmware S2R.
    • Guard tas2764->sdz_group in tas2764_restore_failed(): when sdz_group == NULL and sdz_gpio is present, drive sdz_gpio low (0) and mark regcache cache-only and dirty instead of calling tas2764_group_shutdown() on a NULL group.
  • Dropped sound/soc/apple/mca.c on rebase because a8d2f37caf89 on main already caches serdes_bclk_pol / tx_bitstart / rx_bitstart in mca_fe_set_fmt() and reprograms them in mca_configure_serdes() / mca_fe_hw_params().

Based on @JJRPF's aurora-deepidle patch series. Thanks to @DjDeveloperr, @JJRPF, and @muness for the review, bug catch, and testing.

Evidence
  • scripts/checkpatch.pl --strict at b8c8bb060: 0 errors.
  • sound/soc/codecs/tas2764.o (snd-soc-tas2764.ko) compiles cleanly with LLVM=1 (0 warnings).
  • Exact-head J414s 2x deep-sleep audio row (speakers 5% + headphones) will be posted here once tested on main + #3999 + b8c8bb060.

@patatman
patatman requested review from a team as code owners December 1, 2026 16:35
@github-actions github-actions Bot added area:audio Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot) labels Dec 1, 2026
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Merge readiness at b8c8bb06: ready to merge

Check Detail
CI at head ok 1 check passed
Review ok approved by DjDeveloperr, RyanTheTide
Requested changes ok none
Hardware row at head ok in the PR body at b8c8bb06
Conflicts ok none
PR text ok Risk: two-way · Apple Silicon Macs with GPIO-controlled tas2764 (sdzgpio, no sdzgroup) using firmware-driven deep sleep (pmresumeviafirmware()); no change on s2idle

Areas: area:audio
Merge: gh pr merge 3811 --merge (Owners and Core through the bypass: add --admin).

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@JJRPF JJRPF left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the diff (t602x-die0.dtsi, apple-dart.c, pmp-export.c, mca.c, tas2764.c):

  • ane_dart0 power-domain fix, apple_dart_sleep_prepare() fallback save when apple,sleep-restore is absent, and MCA fmt_lost / TAS2764 sdz_gpio audio resume all look clean.

  • One catch in drivers/soc/apple/pmp-export.c:

    at_commit = READ_ONCE(defer_commit) && apple_pmp_commit_available(dev);

    apple_sleep_commit_stops_coprocs() was dropped here. Without it, when defer_commit=1 (the default) and a firmware sleep runs without the sleep driver's commit (e.g. PSCI SYSTEM_SUSPEND when sleep-controller is enabled in DT), at_commit still evaluates true and leaves PMP running into a commit that never calls last_stop, causing a WD2 reset.

    Keeping apple_sleep_commit_stops_coprocs() in the condition fixes both paths:

    bool defer = READ_ONCE(defer_commit) && apple_sleep_commit_stops_coprocs();
    
    at_commit = defer && apple_pmp_commit_available(dev);
    if (!at_commit && defer) {
            dev_err(dev, "no stop at the sleep's commit: refusing the sleep\n");
            return -EBUSY;
    }

We'll follow up with a second-unit J414s hardware verification row after rebasing onto main + this PR.

@muness

muness commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

J414c M2 Max (T6021) at eef84285, -46 userspace, stock command line, with this head's t6021-j414c.dtb and Aura #639 (ae08762a) in Stage 2: ane_dart0's power domain resolves to ane_sys; all three ANE DARTs bound to apple-dart and the ANE driver bound (the ANE firmware isn't installed here, so it stays off). apple_pmp.defer_commit reads Y. The FaceTime camera streamed 30 of 30 frames before and after an s2idle sleep of 16 s, which woke cleanly. 0 failed units. Kernel errors: apple-clpc ("parent is not a PMC") and two still using legacy "apple,dma-range" property notes (2a9400000.mtp, 2a9b30000.input), none from the files this PR touches. main has no T602x deep sleep yet, so the DART fallback save, the PMP commit and the MCA/TAS2764 wake paths weren't exercised here.

@github-actions github-actions Bot removed the needs-hw-row No hardware row at the PR head (bot) label Dec 2, 2026

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed eef8428. The ane_dart0 power-domain fix, the MCA format rewrite and the TAS2764 sdz_gpio resume look right. Two blockers:

  1. pmp-export.c: defer_commit is a module parameter, and J414s deep sleep only works with it set to 0 on the command line. Merged code has to pick its behaviour itself, with the default command line. Please select the early (suspend_late) PMP idle from what the hardware or DT says about this PMP, for example a property on the T6020 PMP node, and drop the parameter. With the default (1) the logic matches main, so the WD2 case raised in the earlier review comes from main's code and is not new here.

  2. apple-dart.c: apple_dart_sleep_prepare() is documented as doing nothing without apple,sleep-restore (comment above it), and its callers (atc.c, pm_shim.c) only use it on listed DARTs. The new fallback sets sleep_saved on unlisted DARTs, which makes the DART's own noirq suspend and resume skip their save and reset, yet nothing in this PR calls it on an unlisted DART. Please move this change to the PR that adds the DCP disp0 caller, with the doc comment updated, so the new contract and its user land together.

Suggestion: split the t602x-die0.dtsi fix into its own PR. It is a clear bug fix, and the J414c row already shows ane_dart0 on ane_sys with all three ANE DARTs bound, so it can merge on its own. The PR text also needs the What/Tested/Risk/Not yet sections (needs-template label).

@github-actions github-actions Bot added the changes-requested A reviewer requested changes (bot) label Dec 2, 2026
@patatman
patatman force-pushed the fix/t6020-s2r-prereqs branch from eef8428 to a4a7d01 Compare December 2, 2026 07:05
@patatman patatman changed the title T6020 S2R prerequisites: ane_dart0 power-domain, DART fallback save, PMP defer_commit, MCA/TAS2764 audio wake ASoC: apple: restore MCA DAI format and GPIO-controlled TAS2764 across firmware S2R Dec 2, 2026
@patatman

patatman commented Dec 2, 2026

Copy link
Copy Markdown
Author

@DjDeveloperr Thank you for the clear review! Updated #3811 to address all points (head is now a4a7d016):

  1. Dropped t602x-die0.dtsi (ane_dart0) so arm64: dts: apple: t602x: give the first ANE DART its power domain #1694 remains the single source of that fix.
  2. Dropped drivers/iommu/apple-dart.c so the fallback save and its updated doc comment land together with the DCP disp0 caller PR.
  3. Dropped drivers/soc/apple/pmp-export.c (defer_commit module parameter) so PMP early-idle / the suspend_noirq polled-idle root cause is handled cleanly and parameter-free alongside the T6020 apple_sleep provider.
  4. Updated the PR title and body to match the What / Tested / Risk / Not yet template.

#3811 is now scoped strictly to the ASoC mca.c + tas2764.c firmware-S2R audio restore fixes.

@github-actions github-actions Bot added door:two-way Revertible or not, from Merge risk (bot) and removed area:platform Area from CODEOWNERS (bot) needs-template PR body lacks Tested or Risk (bot) labels Dec 2, 2026
@JJRPF

JJRPF commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Hit a kernel NULL pointer dereference in tas2764_group_shutdown() on our J414s (T6020) deep-sleep wake test (running linux@main + #3811's tas2764.c change + aura#639 ae08762a):

[  185.062503] tas2764 3-003c: no answer on I2C after a deep sleep (-62): SDZ or supply not back
[  185.064562] Unable to handle kernel NULL pointer dereference at virtual address 000000000000001c
[  185.122122] pc : tas2764_group_shutdown+0x34/0x38c [snd_soc_tas2764]

Because tas2764_codec_resume() now enters the power_on path for tas2764->sdz_gpio (where tas2764->sdz_group == NULL), if I2C returns -62 (-ETIME) on wake, tas2764_restore_failed() calls tas2764_group_shutdown(tas2764, 0) which unconditionally dereferences group->failed (WRITE_ONCE(group->failed, true)).

Unlike the IRQ handler (which checks && tas2764->sdz_group), tas2764_restore_failed() / tas2764_group_shutdown() needs a tas2764->sdz_group guard (and/or driving sdz_gpio low when sdz_group == NULL).

@JJRPF

JJRPF commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Follow-up on the tas2764_group_shutdown() / tas2764_restore_failed() NULL-deref report on J414s (T6020):

Guarding tas2764->sdz_group in tas2764_restore_failed() paired with mapping pinctrl_ap (/soc/pinctrl@39b028000) in apple_sleep_map_pins() eliminated the Oops and all 33 I2C / tps6598x / cs42l84 / tas2764 wake errors across:

  • C64: rc=0, wall=31.52 s, WARN=0, zero I2C/codec/PD errors
  • C65: 3/3 consecutive back-to-back cycles (21.2 s, 24.5 s, 23.9 s, WARN=0)
  • C66: 100% zero-unbind SLP_S2R (31.52 s, rc=0, WARN=0)

@patatman
patatman force-pushed the fix/t6020-s2r-prereqs branch from a4a7d01 to 336d7af Compare December 2, 2026 14:40
@patatman

patatman commented Dec 2, 2026

Copy link
Copy Markdown
Author

@JJRPF Good catch on the tas2764_restore_failed() NULL dereference! Fixed in 336d7afef:

  • tas2764_restore_failed() now checks if (tas2764->sdz_group) before calling tas2764_group_shutdown().
  • For a GPIO-controlled amp (tas2764->sdz_gpio without sdz_group), it drives sdz_gpio low (0) and sets regcache_cache_only(..., true) + regcache_mark_dirty(...) so the amp fails closed in hardware shutdown without unbalancing sdz_reg refcounts on a subsequent suspend.

@DjDeveloperr Re-requesting review at 336d7afef now that both your earlier review items and the tas2764_restore_failed() NULL guard are addressed.

@JJRPF

JJRPF commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

@patatman Thanks for the quick fix! The tas2764->sdz_group guard plus driving sdz_gpio low and marking regcache cache-only/dirty in 336d7afef looks clean and matches what resolved the Oops on our J414s. We'll rebase onto current main + 336d7afef and follow up with a live-desktop verification row once our desktop S2R bisect wraps up.

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 336d7afef270. Both earlier blockers are gone: the defer_commit parameter and the DART fallback are out of this PR. The rest looks right to me:

  • mca.c: fmt_lost is set for every cluster only on a firmware resume. The format is written again at the next prepare, once the cluster's power domain is up. set_fmt writes the same registers it wrote before, now through one helper.
  • tas2764.c: a GPIO-only amp now takes the power-on restore after a firmware sleep (soft reset, page drop, cache sync, quirks). If that fails, it stays shut down (SDZ low, cache-only, dirty) instead of dereferencing the NULL sdz_group. There's no sdz_reg on those amps, so no regulator count can go wrong, and s2idle is unchanged.

Local checks at this head (arm64, LLVM=1): W=1 build of sound/soc/apple/mca.o and sound/soc/codecs/tas2764.o gives 0 warnings.

Two things are left before merge:

  1. The commit has no Signed-off-by. checkpatch.pl --strict reports it as its only error, and our rules need the author's own DCO sign-off on every commit. Only you can add it: git commit --amend -s and a force push of your own branch is fine here.
  2. Hardware rows at the new head. Firmware deep sleep isn't on main for T6020 yet, so the row has to come from a T6020 deep-sleep stack plus this exact head: J414s, speakers at 5 % volume and headphones after two or more deep sleeps. mca and tas2764 are shared, so one more Mac with firmware deep sleep is needed too (J714s), to show audio comes back with no I2C errors.

@github-actions github-actions Bot added the merge-conflict Conflicts with the base branch (bot) label Dec 2, 2026
@JJRPF

JJRPF commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

J414s (MacBook Pro 14" M2 Pro, T6020) hardware verification on aurora-silicon/linux@main (2c667a4be5a6, which already includes a8d2f37caf89 MCA DAI format caching in hw_params) + #3811 (336d7afef270 tas2764.c):

  • C82 (apple_sleep.deep=1, aura#639 ae08762a, 100% zero-unbind): PASS (rc=0, wall=31.0217 s, all 10 CPUs 0-9 online, boot object resumes 0 -> 1, WARN=0, zero audio/codec/I2C wake errors, NVMe 64 MiB direct read @ 2.9 GB/s).

On Macs whose TAS2764 amplifiers are controlled directly by an SDZ GPIO
(without a shared sdz_group), a firmware-driven deep sleep (SLP_S2R)
powers off the pin controller and drops the SDZ line, resetting every
amp to its power-on defaults.

Include tas2764->sdz_gpio alongside tas2764->sdz_group in the power_on
check in tas2764_codec_resume() so GPIO-controlled amps also run the
power-on soft reset, page-register cache drop, regcache sync, and init
quirks after firmware S2R.

Guard tas2764->sdz_group in tas2764_restore_failed() so an I2C failure
on a GPIO-controlled amp drives SDZ low and keeps regcache cache-only
and dirty instead of dereferencing a NULL sdz_group in
tas2764_group_shutdown().

Signed-off-by: Pim Jeursen <pim@jeursen.nl>
@patatman
patatman force-pushed the fix/t6020-s2r-prereqs branch from 336d7af to b8c8bb0 Compare December 3, 2026 08:30
@github-actions github-actions Bot added needs-hw-row No hardware row at the PR head (bot) and removed merge-conflict Conflicts with the base branch (bot) labels Dec 3, 2026
@patatman patatman changed the title ASoC: apple: restore MCA DAI format and GPIO-controlled TAS2764 across firmware S2R ASoC: tas2764: restore GPIO-controlled amps across firmware S2R Dec 3, 2026
@patatman

patatman commented Dec 3, 2026

Copy link
Copy Markdown
Author

@DjDeveloperr Updated #3811 to b8c8bb060:

  1. Added Signed-off-by: Pim Jeursen <pim@jeursen.nl> (checkpatch.pl --strict: 0 errors).
  2. Rebased onto current main (c09b61228) and dropped sound/soc/apple/mca.c now that a8d2f37caf89 already caches and replays the MCA DAI format in hw_params / mca_configure_serdes(). #3811 is now strictly the sound/soc/codecs/tas2764.c change.

Testing b8c8bb060 together with #3999 on my J414s next for the 2x deep-sleep speakers (5%) + headphones hardware row.

@github-actions github-actions Bot removed the needs-hw-row No hardware row at the PR head (bot) label Dec 3, 2026

@RyanTheTide RyanTheTide left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPIO-only amps now take the reset and cache restore path on firmware resume. If restore fails, the direct SDZ line is driven low and regcache stays dirty and cache-only. The shared-group and s2idle paths retain their existing behavior. Exact hardware checks are still pending.

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: MERGE at b8c8bb060a4bdd3f6eb67c2e1725f70755435c6b, after the two rows below.

Blockers: none in the code. The points from the review at eef84285 are gone: no defer_commit parameter, no DART fallback, and the commit has its sign-off.

Rows still owed (the PR body lists them as not yet run, so this isn't ready to merge even if the bot says so):

  1. J414s (T6020) at this head on the #3999 stack: two or more deep sleeps, then speakers at 5 % with speakerguardd gating, and headphones. No I2C, over-current or protection events.
  2. One more Mac whose amps hang on shutdown-gpios and which deep-sleeps on main: J813 or J815 (T8142), or J613 or J615 (T8122). These take the new path on their next deep wake. The J714s I named earlier doesn't: its amps are behind an SDZ supply, so this change does nothing there.

Checked: the diff against 336d7afef270 (same added and removed lines, mca.c dropped because main has it). On the J414s all six amps share GPIO 57; the GPIO core counts the users' votes, so a failed amp dropping its vote doesn't reset the others, and it stays cache-only, so no later unmute reaches it. Suspend, the next resume and s2idle are balanced. Merges cleanly with main f7e3388dd07d, which hasn't changed the file since this branch's base.

@github-actions github-actions Bot added ready-to-merge Meets the merge policy: merge it (bot) and removed changes-requested A reviewer requested changes (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 3, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor

A J414s (T6020, firmware 27.2) result that touches this row, and one question.

On our J414s a deep sleep wakes when the audio card is bound but never opened (all other drivers loaded except aurora), and stalls after any stream has run. Each line is one boot so far:

  • card bound, never opened: wakes
  • mca1/mca2 (speakers + sense) used once: stalls
  • 1 s of silence on the headphone jack only (mca0, cs42l84, no amp touched, power domains back at idle before the sleep): stalls

So on our machine the amps are not the cause, and this PR can't be either. The next boots split ADMAC/MCA streaming from the clock and power setup.

JJRPF and patatman: in C82 and in the 13.5 runs, had anything opened the card between boot and the sleep (PipeWire, speakerguardd, alsactl restore, a test tone)? And which firmware is on JJRPF's machine? cat /proc/asound/card*/pcm*/sub*/status plus the mca lines of pm_genpd_summary right before the sleep would answer it. If C82 woke with the card used, the difference is in firmware or Stage 2 and we should compare those first.

@DjDeveloperr

Copy link
Copy Markdown
Contributor

Hardware verification (J414s / M2 Pro, T6020, exact head b8c8bb060a4b, 2x committed deep sleep)

  • Target: MacBook Pro 14-inch M2 Pro (J414s, Mac14,9, SoC T6020), OS firmware 27.2 (mBoot-20457.41.3), Fedora 45 (graphical.target, full desktop, speakerguardd-v2 and alsa-state unmasked). All 6 tas2764 speaker amplifiers (10-0038, 10-0039, 10-003a, 1-003b, 1-003c, 1-003d; ti,sn012776,ti,tas2764) use per-amp shutdown-gpios (sdz_gpio, no sdz_group).
  • Kernel & exact heads: 7.3.0-j414s-pr3811+ (main 35bfbf3875a7 + #3998 845b4ad4e079 + #3999 b4038743451e + #4200 ae343b883fba + #3811 b8c8bb060a4b, merge commit b5e952173e85, sound/soc/codecs/tas2764.c verified byte-identical to b8c8bb060a4b). vmlinuz sha256 fb89196959f1..., snd-soc-tas2764.ko sha256 5b151b24ec36..., boot.bin sha256 196da4c69088....
  • Cmdline additions: apple_sleep.deep=1 apple_sleep.untested_commit=1 appledrm.s2r_untested=1 no_console_suspend, mem_sleep set to [deep].
  • Boot ID: b41e00af-d77e-44a9-ae3f-edd9a80b6b35 (single boot across both sleeps).

Results (2/2 committed deep sleeps PASS)

Stage Sleep / Wake All 6 tas2764 AMIXER (Amp Fault Status / Amp Gain) Speakers plughw:AppleJ414,0 (2.0 s silence) Headphones plughw:AppleJ414,1 (2.0 s silence) dmesg (tas2764/I2C/audio/WARN)
Pre-sleep resumes 0, success=0 fail=0 6/6 Fault=0,0,0, Gain=15 48 kHz: 2.167 s, 44.1 kHz: 2.041 s (rc=0) 48 kHz: 2.202 s, 44.1 kHz: 2.080 s (rc=0) 0 errors / warnings
Post-wake 1 (rtcwake -s 100) WOKE_RC=0, resumes 0 -> 1, success=1 fail=0, 194/252 AP pins restored, halted 0x19, stuck 0 6/6 Fault=0,0,0, Gain=15 48 kHz: 2.162 s, 44.1 kHz: 2.042 s (rc=0) 48 kHz: 2.207 s, 44.1 kHz: 2.083 s (rc=0) 0 errors / warnings; Wi-Fi 3/3
Post-wake 2 (rtcwake -s 30) WOKE_RC=0, resumes 1 -> 2, success=2 fail=0, 194/252 AP pins restored, halted 0x19, stuck 0 6/6 Fault=0,0,0, Gain=15 48 kHz: 2.166 s, 44.1 kHz: 2.040 s (rc=0) 48 kHz: 2.207 s, 44.1 kHz: 2.084 s (rc=0) 0 errors / warnings; Wi-Fi 3/3

Notes

  • Playback verification used 2.0 s digital silence (/dev/zero) at 48 kHz and 44.1 kHz on both speaker (plughw:AppleJ414,0) and headphone (plughw:AppleJ414,1) PCMs, paired with live amixer readback of all 6 tas2764 Amp Fault Status and Amp Gain Volume controls; no human listened to audible output at the Mac.

@DjDeveloperr

Copy link
Copy Markdown
Contributor

Hardware check on MacBook Pro 16-inch (M3 Pro, J516s, T6030, OS firmware 27.2) at PR head b8c8bb060a4bdd3f6eb67c2e1725f70755435c6b (6× ti,sn012776 / tas2764 amps sharing shutdown-gpios = <&pinctrl_ap 171 GPIO_ACTIVE_HIGH>, no SDZ-supply / no apple,sdz-group-fail-closed, ti,sleep-keep-sdz present):

  • Kernel: 7.3.0-j516s-pr3811 (main 5bb2f1eed073 + #4213 a313071a0aad + #4225 9dd2888214bf + #3811 b8c8bb060a4b, merge head 55a827f0bfea, tree 2e1252b12e14), boot 136fad62-d09a-4cfa-8247-6f5dac91bbe9
  • Sleep cycles: 2 consecutive committed firmware deep sleeps (mem_sleep = [deep], rtcwake -m mem -s 30, boot object resumes 0 -> 1 -> 2, suspend_stats/success 0 -> 1 -> 2, fail = 0)
  • Automated row script verdict: VERDICT=FAIL fails=8 — however, inspecting the traces and dmesg shows zero tas2764 / I2C / kernel errors and that all 8 script failures come from two test-harness issues rather than a driver failure:

1. Power-on resume branch (regcache_drop_region) — 3/6 amps captured before trace snapshot raced soc_resume_deferred

  • In both deep-sleep cycles, #3811's new power_on branch ((sdz_group || sdz_gpio) && pm_resume_via_firmware()) ran cleanly on tas2764 amps sharing &pinctrl_ap 171, taking ~27–30 ms per amp on ASoC's async soc_resume_deferred kworker:
    • Cycle 1: 2-003c at 24.740209 s, 2-003d at 24.770167 s, 2-003b at 24.797239 s — then PM: suspend exit fired 0.40 ms later at 24.797640 s, and the script logged cycle 1 back rc=0 at 24.798643 s and immediately copied /sys/kernel/tracing/trace before soc_resume_deferred reached the remaining 3 amps (0-0038, 0-0039, 0-003a, ~90 ms later).
    • Cycle 2: identical timing — 2-003c at 32.155135 s, 2-003d at 32.185126 s, 2-003b at 32.212119 s, PM: suspend exit 0.18 ms later at 32.212298 s, cycle 2 back rc=0 at 32.213940 s.
  • Because pm_suspend_clear_flags() is only called at the start of the next suspend, pm_resume_via_firmware() remains true across the deferred resume, and waiting for card SNDRV_CTL_POWER_D0 (e.g., running amixer before copying the trace buffer) is needed to observe all 6 amps in the trace.
  • Across all 6 amps (Left/Right Tweeter, Woofer 1, Woofer 2), Amp Fault Status remained 0,0,0 and Amp Gain Volume remained 15 pre-sleep, post-wake-1, and post-wake-2, with 0 tas2764, I2C, or kernel WARN/error lines in dmesg and Speaker Protection Sleeps advancing 0 -> 1 -> 2.

2. Audio playback (PCM 0 passed 6/6; PCM 1 refused with EIO pre-sleep and post-wake)

  • plughw:AppleJ516,0 (Primary, Headphone Playback Mux = Primary): passed 6/6 (48000 and 44100 Hz, 2.037–2.060 s wall time, rc=0) pre-sleep, post-wake-1, and post-wake-2.
  • plughw:AppleJ516,1 (Secondary, Speaker Playback Mux = Secondary): returned aplay: pcm_write:2191: write error: Input/output error (rc=1, 0.63–0.67 s) identically pre-sleep as well as post-wake-1 and post-wake-2, because speaker protection was withdrawn at boot (snd-soc-macaudio sound: Speaker protection withdrawn: released by the owner) and Secondary speaker playback is refused without an active speaker-protection lease.

Summary

  • Observed working: #3811's power_on branch fired on GPIO-controlled tas2764 amps across 2 deep sleeps (3/6 directly captured in the trace before cp raced soc_resume_deferred), 0/6 amps faulted, mixer gain/state stayed intact, and 0 kernel/I2C errors occurred.
  • Unverified in this run (harness limits): direct trace capture of 0-0038/0-0039/0-003a (requires reading the trace after amixer waits for D0), and post-wake speaker playback on PCM 1 (requires an active speaker-protection lease).

@DjDeveloperr

Copy link
Copy Markdown
Contributor

J516s (Mac15,7, T6030, OS firmware 27.2) second-generation rerun at exact PR head b8c8bb060a4bdd3f6eb67c2e1725f70755435c6b: PASS (fails=0, mode=deep, cycles=2, new_branch_exercised=yes).

Note: the earlier 2026-12-03T21:10Z comment (#issuecomment-7392387409, boot 136fad62) was a harness FAIL, not a driver failure: (1) run-row.sh snapshotted /sys/kernel/tracing/trace ~1 ms after PM: suspend exit while ASoC's async soc_resume_deferred() kworker was still halfway through the 6 amps (~27-30 ms/amp), missing 0-0038/39/3a, and (2) aplay opened PCM 1 (Secondary) directly instead of playing through speakerguardd-v2, which holds the speaker-protection lease and causes raw PCM 1 opens to return EIO identically before and after sleep.

Rerun details (same kernel binary 7.3.0-j516s-pr3811 #4, boot_id e53a0e43-f1c6-4dad-8180-80899caab4dd, mem_sleep = s2idle [deep], 6 per-amp SDZ GPIO amps 0-0038/39/3a, 2-003b/c/d with shutdown-gpios=y, group=n, sleep-keep-sdz=y, CARD=AppleJ516):

  • Pre-sleep: PCM 0 (plughw:AppleJ516,0) 2 s digital silence 48 kHz rc=0 wall=2.063 s, 44.1 kHz rc=0 wall=2.064 s; PCM 1 (speakerguardd-v2 sink sgv2.voicing.j516, 5% volume, 2 s digital silence) 48 kHz rc=0 wall=2.172 s, 44.1 kHz rc=0 wall=2.047 s, Speaker protection granted logged (granted=1); all 6 amps Amp Fault Status = 0,0,0 and Amp Gain Volume = 15 before and after playback; 0 dmesg error/fault/WARN lines.
  • Deep sleep 1 (rtcwake -m mem -s 30, suspend_stats success 0 -> 1, boot object resumes 0 -> 1, wake source: NUB.SPMI0.SW3):
    • After amixer D0 wait (TRACE_WAIT_MS=11, MISSING=): 6/6 GPIO amps hit regmap:regcache_drop_region on kworker/1:2: 2-003c (72.210 s), 2-003d (72.237 s), 2-003b (72.264 s), 0-0039 (72.292 s), 0-003a (72.323 s), 0-0038 (72.351 s).
    • Post-wake 1 playback: PCM 0 48 kHz rc=0 wall=2.035 s, 44.1 kHz rc=0 wall=2.034 s; PCM 1 (sgv2.voicing.j516, 5%) 48 kHz rc=0 wall=2.044 s, 44.1 kHz rc=0 wall=2.058 s, Speaker protection granted (granted=1); all 6 amps Fault Status = 0,0,0 and Gain = 15 before and after playback; 0 dmesg errors.
  • Deep sleep 2 (rtcwake -m mem -s 30, suspend_stats success 1 -> 2, boot object resumes 1 -> 2, wake source: NUB.SPMI0.SW3):
    • After amixer D0 wait (TRACE_WAIT_MS=15, MISSING=): 6/6 GPIO amps hit regmap:regcache_drop_region on kworker/1:2: 2-003c (82.654 s), 2-003d (82.681 s), 2-003b (82.708 s), 0-0039 (82.740 s), 0-003a (82.769 s), 0-0038 (82.800 s).
    • Post-wake 2 playback: PCM 0 48 kHz rc=0 wall=2.035 s, 44.1 kHz rc=0 wall=2.038 s; PCM 1 (sgv2.voicing.j516, 5%) 48 kHz rc=0 wall=2.055 s, 44.1 kHz rc=0 wall=2.063 s, Speaker protection granted (granted=1); all 6 amps Fault Status = 0,0,0 and Gain = 15 before and after playback; 0 dmesg errors.

Verdict: PASS (fails=0, all 6 tas2764 per-amp SDZ GPIO codecs took the #3811 firmware-resume restore path on both deep sleeps and streamed cleanly through speakerguardd-v2 with zero faults). Stock 7.3.0-f3822 restored and verified clean.

@DjDeveloperr
DjDeveloperr merged commit de55bfa into aurora-silicon:main Dec 3, 2026
3 checks passed
@JJRPF

JJRPF commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

To answer your question: nothing had opened the audio card in our earlier RAM-root passes (C82–C88). When the job opens and releases every PCM first, t6020-main fails the commit (C92). With #4200 applied, the same job wakes cleanly (C93). So on J414s the stall after audio use is the NCO, and #4200 fixes it.

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

Labels

area:audio Area from CODEOWNERS (bot) door:two-way Revertible or not, from Merge risk (bot) ready-to-merge Meets the merge policy: merge it (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants