Skip to content

ASoC: tas2764: Fail an SDZ group closed when its restore after a reset fails - #2515

Merged
DjDeveloperr merged 3 commits into
integration/aurorafrom
djdev/tas2764-restore-fail-closed-20261119
Nov 20, 2026
Merged

DjDeveloperr merged 3 commits into
integration/aurorafrom
djdev/tas2764-restore-fail-closed-20261119

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #1996 (stacked on its head a4f5e7a1ac05; only the top commit 80d147f1968d is new). Merge right after #1996.

Why

Review of #1996 found one gap in its error paths. When an SDZ group amp comes back from a power-on reset, the resume may fail to restore it: the reset write gets no answer, or regcache_sync or the init quirks fail. In that case the resume only logs the error.

  • ASoC ignores a component's resume error (soc-component.c), and the regmap stays live.
  • startup and update_pwr_ctrl refuse only a failed group. So the next unmute writes PWR_CTRL active.
  • The amp then plays at its reset defaults: gain, brownout, interrupt masks, and no quirk page. Meanwhile the cache holds the restored values, so macaudio's floor writes skip the amp as unchanged.

#1996 also takes the reset path for amps that may have kept their registers. An aborted deep sleep still reports a resume through firmware, and a failed BOP_SRC read counts as a reset. So a transient I2C error can now put a healthy amp in that state.

What

On either failure, fail the group closed exactly as a latched over-current or over-temperature fault already does, with tas2764_group_shutdown(). The SDZ supply is forced off and every stream is refused until the driver is reloaded, which probes the amps again from scratch.

The success path is unchanged, and amps outside a group and s2idle are not touched.

Testing

🤖 Generated with Claude Code

IronsideXXVI and others added 3 commits November 15, 2026 15:27
…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>
…t fails

When an SDZ group amp comes back from a power-on reset and the resume
cannot restore it (the reset write gets no answer, the cache sync or the
init quirks fail), the resume only logs the error. ASoC ignores a
component's resume error, the regmap stays live, and only a failed group
refuses streams. The amp keeps its reset defaults (gain, brownout,
interrupt masks, no quirk page) while the cache holds the restored
values, so a later unmute writes PWR_CTRL active and the amp plays with
its protection not set up. The macaudio floor writes find the cache
unchanged and skip the amp too.

The power-on path can now also be taken for an amp that kept its
registers (an aborted deep sleep still reports a resume through
firmware, and a failed read counts as a reset), so a transient I2C error
can leave a healthy amp in that state.

Fail the group closed in both cases, as a latched over-current or
over-temperature does: the shared SDZ supply is forced off and every
stream is refused until the driver is reloaded, which probes the amps
again from scratch.

Assisted-by: Claude Opus 5.5
Signed-off-by: Diljit Singh <hey@djdev.me>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DjDeveloperr
DjDeveloperr merged commit de2c296 into integration/aurora Nov 20, 2026
1 check passed
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Merged as de2c29696952 (head 80d147f1968d), right after #1996 (68aacc05e1c5).

Compile check: sound/soc/codecs/tas2764.o built with the M5 asahi config at W=1, together with #1996, #2144 and #2510 on integration 449c6a19, with no compiler warnings. The tip's tas2764.c is byte-identical to the built tree.

No hardware run: the success path that Isaac (J714s) and axboe (K116s) ran takes none of the new branches.

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.

2 participants