Repository navigation
ASoC: tas2764: Bring an SDZ group back from a deep sleep as from power-on - #1996
Conversation
…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>
3a19048 to
a4f5e7a
Compare
|
A K116s data point (16" M5 Pro, firmware 27.2, six SN012776 in one SDZ group): the same failure, and this PR fixes it.
Tested once so far, with silence only. Not tested: audible playback, and commit 2's case (s2idle after a half-failed deep sleep). |
|
J714s (14-inch M5 Pro, six SN012776 in one SDZ group with Without them, the first stream after a deep-sleep wake (the fault comes 32 ms after the speaker start is granted): 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 |
|
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 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.
#2515 calls Non-blocking notes for later:
|
68aacc0
into
aurora-silicon:integration/aurora
|
Merged as Hardware evidence:
Local compile check: The non-blocking notes in my review above are still open for a later PR: the dark-wake read of |
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:
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/aurora580e911 (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:
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
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.