Skip to content

ASoC: tas2764: Bring an SDZ group back from a deep sleep as from power-on - #1996

Merged
DjDeveloperr merged 2 commits into
aurora-silicon:integration/aurorafrom
IronsideXXVI:j604-tas2764-deep-wake
Nov 20, 2026
Merged

DjDeveloperr merged 2 commits into
aurora-silicon:integration/aurorafrom
IronsideXXVI:j604-tas2764-deep-wake

Conversation

@IronsideXXVI

@IronsideXXVI IronsideXXVI commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

What

Amps that share an SDZ line (an SDZ group) skip the init quirks at resume, because a group is assumed to keep SDZ, and with it the amps' registers, across system sleep. That holds for s2idle. A firmware-driven sleep powers the SoC's pin controller off, so SDZ drops while asleep and every amp of the group comes back from a power-on reset: TI's volatile quirk page is gone, and the page register is back at 0 while the cache may still hold another page.

On the J604 (MacBook Pro 14", M4) this is the failure the resume comment in tas2764.c already names for a J316 woofer amp. After a deep-sleep wake, the first stream latched an over-current on one woofer amp; the group's fail-closed shutdown then took all six amps to hardware shutdown within about 1 ms, and the speakers stayed silent until a reboot:

tas2764 1-0039: fault: over current
tas2764 1-0039: SDZ group shut down (cause 0x2): every amp of the group is in hardware shutdown

followed by I2C NACKs and ASoC -6 / -5 errors on all six amps.

With this change, on a resume via firmware (pm_resume_via_firmware()) a group is treated like a power-on, as the probe does it: wait the SDZ-to-I2C time, reset the amp, drop the cached page so the next page switch reads the amp, sync the cache and apply the init quirks again. An amp that does not answer on I2C is reported (SDZ or its supply did not come back). s2idle keeps today's path.

Commit 2 covers a sleep that cuts SDZ or the amps' supply without the firmware saying so, for example an s2idle resume after a deep sleep that failed half way. PWR_CTRL resets with BOP_SRC clear, and the probe sets BOP_SRC on every SN012776, so one read that bypasses the cache tells a reset amp from one that kept its registers. Such an amp, or one that does not answer, takes the same power-on path. Cost: one register read per amp per resume.

Since the first version: rebased onto integration/aurora 580e911 (no conflicts); commit 1's message now says what was measured (the cache sync at resume succeeds, the first stream latches the over-current), not write errors at resume; commit 2 added.

Testing

On a J604 (2026-11-15), with our kernel 1.929, which carries this change:

  • One deep sleep, then a 3 s silent stream: 6 of 6 amps active, 0 I2C errors, 0 over-current lines.
  • Seven deep sleeps on one boot, then the same stream: 6 of 6 amps active, the playback path running, 0 tas2764 fault or SDZ group lines.
  • Before, on our kernel 1.928 (same machine, same check): the first stream after a deep-sleep wake tripped the over-current and the group shutdown shown above.
  • Since then, both commits in each of our kernels up to 1.934: in the install check of 1.932 and of 1.934, one deep sleep each, 0 tas2764 fault lines after the wake and the speaker safety daemon active.
  • Commit 2's own case (a reset amp after a resume the firmware did not report) has not been triggered on the device.
  • Builds with W=1 with no warnings (snd-soc-tas2764.o); checkpatch --strict is clean on both commits.

Not covered: the test stream is silent, so listening to real audio after a wake is still to do; other machines with SDZ groups have not been tested; the s2idle path is unchanged and was not re-measured.

Questions for review

  • Is pm_resume_via_firmware() the right signal for "SDZ may have dropped"? Commit 2 also detects the power-on reset from the amp itself (BOP_SRC); if you prefer, the read alone could be the signal and commit 1's firmware check could go.
  • The reset and quirk replay run for every amp of the group on each such resume, with two 1-2 ms waits per amp (SDZ to I2C, and after the reset). Is that acceptable for resume latency, or should it be deferred to the first stream?

…r-on

Amps in an SDZ group keep the shared SDZ line across system sleep and
only sync their register cache at resume. That holds for s2idle. A
firmware-driven sleep powers the SoC's pin controller off, so the line
drops while asleep and every amp comes back from a power-on reset when
the pin controller restores it: TI's volatile quirk page is gone, and
the page register is back at 0 while the cache may still hold another
page.

The cache sync at resume still succeeds, so nothing is logged then. On
a J604 the first stream after a deep-sleep wake latched an over-current
on one woofer amp, the failure the resume path's comment already names
for an amp without its init quirks. The SDZ group then shut all six amps
down, as it is meant to, and they stayed off the bus until a reboot.

On a resume via firmware, treat a group like a power-on: wait the SDZ
high to I2C time, reset the amp, drop the cached page so the next page
switch reads the amp, sync the cache and apply the init quirks again,
as the probe does. Say so when the amp does not answer on I2C, which
means SDZ or the supply did not come back. s2idle keeps today's path.

Tested on a J604 (M4 MacBook Pro 14"): before, the first stream after a
deep wake logged "fault: over current" on a woofer amp and "SDZ group
shut down"; with this change, a stream after seven deep wakes kept all
six amps active with no I2C error and no over-current.

Assisted-by: LLM
Signed-off-by: Dylan Ironside <dylan@dylanironside.io>
The previous change restores an SDZ group from a power-on reset when the
resume comes through firmware. A sleep can still cut the shared SDZ line
or the amps' supply without the firmware reporting it, for example an
s2idle resume after a deep sleep that failed half way. The amps then sit
in their reset state with the cache believing otherwise, and the first
stream latches an over-current on a woofer amp, which takes the whole
group down.

Ask the amp. PWR_CTRL resets to 0x1a with BOP_SRC clear, and the probe
sets BOP_SRC on every SN012776, so a read that bypasses the cache tells
a reset amp from one that kept its registers. When it was reset, or does
not answer, take the power-on path. This costs one register read per amp
per resume.

Assisted-by: LLM
Signed-off-by: Dylan Ironside <dylan@dylanironside.io>
@IronsideXXVI
IronsideXXVI force-pushed the j604-tas2764-deep-wake branch from 3a19048 to a4f5e7a Compare November 15, 2026 15:54
@axboe

axboe commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

A K116s data point (16" M5 Pro, firmware 27.2, six SN012776 in one SDZ group): the same failure, and this PR fixes it.

  • Without it, the first stream after a deep-sleep wake: tas2764 0-0039: fault: over current, then SDZ group shut down (cause 0x2): every amp of the group is in hardware shutdown, I2C NACKs and ASoC -6/-5 on the others.
  • With both commits cherry-picked (they apply cleanly on integration/aurora 677be39): a 3 s silent stream after a deep-sleep wake raises no tas2764 fault or SDZ group line.

Tested once so far, with silence only. Not tested: audible playback, and commit 2's case (s2idle after a half-failed deep sleep).

@Isaac-Duarte

Copy link
Copy Markdown
Contributor

J714s (14-inch M5 Pro, six SN012776 in one SDZ group with apple,sdz-group-fail-closed) hardware result: the same failure, and this PR fixes it. Both commits are cherry-picked unchanged onto 0abc2f3 plus my carried PRs.

Without them, the first stream after a deep-sleep wake (the fault comes 32 ms after the speaker start is granted):

snd-soc-macaudio sound: Speaker protection granted
tas2764 0-0039: fault: over current
tas2764 0-0039: SDZ group shut down (cause 0x2): every amp of the group is in hardware shutdown
i2c-apple 505014000.i2c: NACK, status 0x08210100

Every amp NACKed from then on, and playback was refused until a reboot.

With them: five deep sleeps in one boot. A stream started on the speakers after four of the five wakes (none was started in the 4 s between the second wake and the next sleep): once the session's own start, and after each of the three 30 s sleeps a spoken test sample through the speaker sink at 30 % volume, which was heard on the speakers. No tas2764 fault, no SDZ group line and no I2C error in the boot.

Not tested: commit 2's case (no sleep failed half way, and registers lost in a sleep was never printed), sleeps longer than 30 s, and a stream still running at the suspend.

@DjDeveloperr

Copy link
Copy Markdown
Contributor

Review (code only, plus Isaac's J714s and axboe's K116s results). The success path is correct. After the reset, PWR_CTRL is in shutdown, and the sync restores the interrupt masks, sense slots, brownout and clock before the quirks and update_pwr_ctrl run. The amp is never active before its protection is set up. Non-group amps and s2idle are unchanged. Every SDZ-group node is ti,sn012776, so the BOP_SRC check holds on all of them.

One gap, fixed in #2515 (stacked on your head, our commit only): when the power-on restore fails, the resume only logs the error. That covers the reset write NACKing, the sync failing part way, and the quirks failing.

  • ASoC ignores the resume's return value. Only group->failed gates startup and update_pwr_ctrl.
  • So a later unmute can set an amp active at its reset defaults while the cache holds the restored values.
  • With this PR the path can also start from a healthy amp: an aborted deep sleep still reports a resume via firmware, and a failed read counts as a reset.

#2515 calls tas2764_group_shutdown() on both failure paths, as a latched fault already does. If you'd rather fold it into this PR, or prefer a per-amp retry at the next startup, say so. We'd like to merge this now for the M5 ship candidate, with #2515 right behind it.

Non-blocking notes for later:

  • pm_resume_via_firmware() is read in ASoC's deferred resume work. A dark-wake re-suspend can clear it first, so commit 2's read probably does fire in practice. It may be worth testing a dark wake.
  • regmap_read_bypassed() would avoid toggling the map-wide bypass.
  • The comment above tas2764_codec_suspend still says group members keep their registers across sleep.

@DjDeveloperr
DjDeveloperr merged commit 68aacc0 into aurora-silicon:integration/aurora Nov 20, 2026
1 check passed
@DjDeveloperr

Copy link
Copy Markdown
Contributor

Merged as 68aacc05e1c5 (head a4f5e7a1ac05, unchanged), followed immediately by the fail-closed follow-up #2515 (de2c29696952). Both are for the M5 ship candidate.

Hardware evidence:

  • @Isaac-Duarte's J714s run: five deep sleeps with no tas2764 fault.
  • @axboe's K116s run: no fault after a deep-sleep wake.

Local compile check: snd-soc-tas2764 built with the M5 asahi config at W=1 with no compiler warnings, together with #2144, #2510 and #2515. The integration tip's tas2764.c is byte-identical to the built tree.

The non-blocking notes in my review above are still open for a later PR: the dark-wake read of pm_resume_via_firmware(), regmap_read_bypassed(), and the stale suspend comment.

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.

4 participants