Repository navigation
ASoC: tas2764: J604 amplifier init and shutdown as macOS does them - #1894
IronsideXXVI wants to merge 6 commits into
Conversation
…ng; rollback measured on the machine; upstream state STATUS.md: the 1.901 reset cause is confirmed on the machine (the memory-controller state read at probe, patch 0531): with that driver kept from starting, 1.901 starts, unlocks with no hands, joins the network and has 0 failed units. The rollback pieces are now measured on the machine: the last good kernel beside the new one, Limine's one-shot with the last good kernel as default, the 15 s Stage 1 window a second Mac can hold, the failed-boot count clear, and the forced USB-C port-controller reset. kernel/ is unchanged; the published series stays 1.888, the last kernel that passed all checks. UPSTREAM.md: new aurora-silicon/aurora-bless#6 and aurora-silicon/linux#1894; the rule for what we open on aurora-silicon/linux now; the panel colour matrix rebases onto the set_matrix conversion already upstream.
Some Apple machines bracket every software shutdown of their SN012776 amplifiers with writes to the vendor's hidden page 0xfd. Add a boolean property that tells the driver to do the same on that amplifier. Assisted-by: LLM Signed-off-by: Dylan Ironside <dylan@dylanironside.io>
macOS brackets every software shutdown of the J604's six SN012776 amplifiers with writes to the vendor's hidden page 0xfd: 0x0d = 0x0d, 0x64 = 0x04, 0x0d = 0x00, then PWR_CTRL shutdown, then 0x0d = 0x0d, 0x64 = 0x00, 0x0d = 0x00. Measured on the J604 under macOS 26B123 with the I2C3 controller traced around a short system sound: the same sequence on all six amplifiers, 0.59 s after the last mute; power-up and mute transitions carry no hidden-page writes. The driver already implements exactly this as TAS2764_SHUTDOWN_DANCE, but only for every amplifier at once through ENABLED_APPLE_QUIRKS, which leaves it off. Honour the "apple,shutdown-dance" property on SN012776 amplifiers, with the dance's immediate-SDZ init step. Machines without the property are unchanged. Assisted-by: LLM Signed-off-by: Dylan Ironside <dylan@dylanironside.io>
Set apple,shutdown-dance on the J604's six SN012776 amplifiers, the sequence macOS 26B123 writes on all six at every software shutdown. Assisted-by: LLM Signed-off-by: Dylan Ironside <dylan@dylanironside.io>
Apple machines can initialise their SN012776 amplifiers with a few register writes beyond the driver's own sequence. Add a property that lists them as (page, register, value) byte triples. Assisted-by: LLM Signed-off-by: Dylan Ironside <dylan@dylanironside.io>
macOS 26B123 initialises each of the J604's six SN012776 amplifiers with three writes the driver does not make (traced at boot on the J604 with the I2C3 controller recorded from the hypervisor's entry): page 0 register 0x07 = 0x68, page 1 register 0x19 = 0x40 and page 1 register 0x47 = 0x02. Every other write of that init matches the driver: the six enabled quirk sequences, the DC blockers and the brownout block from the boot loader's copies of the ADT, and the TDM setup. Apply the apple,init-writes triples after the built-in quirks at initialisation, each checked against the writeable-register list (page 1 register 0x19 joins it). With apple,shutdown-dance the dance's init step writes 0x07 = 0x60 first; a triple can then set another value. Assisted-by: LLM Signed-off-by: Dylan Ironside <dylan@dylanironside.io>
Set apple,init-writes on the J604's six SN012776 amplifiers to the three writes macOS 26B123 makes at their initialisation and the driver does not: page 0 register 0x07 = 0x68, page 1 register 0x19 = 0x40, page 1 register 0x47 = 0x02. Assisted-by: LLM Signed-off-by: Dylan Ironside <dylan@dylanironside.io>
b8e9ffb to
20e0882
Compare
…writes; new #1895 (headset codec) UPSTREAM.md: #1894 carries the three amplifier initialisation writes macOS makes besides the shutdown sequence; #1895 gives the J604 headset codec the 20 probe writes macOS makes. Both are byte-for-byte what macOS writes on the machine and have not run under Linux yet.
|
On a J604 under Linux, this series leaves the speakers silent. The amplifiers stay muted during playback. Tested on a J604 (MacBook Pro 14", M4, Mac16,1; os-fw 26.6.2, system-fw 27.0; aura 1.0.0b13). The kernel was alarm-aurora's pkgrel 38 recipe on I booted the same kernel twice:
The tree without the properties came from a kernel without this series: it is the J604 tree of linux 2129f55 plus #1888, and it otherwise differs from the trial tree only by #1895, #1917 and #1919's properties the trackpad actuator node and two cell properties on Disclosure: an LLM (Claude) ran these tests on my Mac and drafted this. I did the listening and looking, reviewed it, and am responsible for it. Assisted-by: LLM |
|
Thank you, this is exactly the comparison we needed, and it's a real problem. I'm holding this PR until we understand it. Our own J604 runs these six patches in our kernel series (since our 1.905, now 1.913) and its six amplifiers play there. Our userspace differs from yours, though (speakersafetyd plus our own DSP graph, not speakerguardd-v2), and so does our tree. So we may never hit the path where an amp stays at Next on our side: read amp If you have the time, a build with only |
|
@IronsideXXVI, re your comment: here is the split you asked for. The shutdown dance alone also leaves the speakers silent, in a different way: the amps report active but stay silent, and fault at every stream stop. The same kernel with neither property plays clean. Same J604 and kernel as before (alarm-aurora's pkgrel 38 recipe on 7c71d6d plus #1543, #1894, #1895, #1917, #1918, #1919, #1922), speakerguardd-v2 1.0.0alpha.1-40. Each row is one
In every boot, speakerguardd v2's silent switch test record was valid, every stream got its grant ( Two observations, for what they are worth:
I also have the opposite variant ( Disclosure: an LLM (Claude) ran these boots and measurements on my Mac and drafted this. I did the listening, reviewed it, and am responsible for it. Assisted-by: LLM |
|
@IronsideXXVI One more data point. The amp silence is not caused by the cs42l84 interrupt storm from #1895. I rebuilt the same kernel with #1895's fourth commit (c0a5945, code-identical to f0ca074) and checked that cs42l84 and both I2C controllers show 0 interrupts in 10 s. Then I booted this PR as is (both properties) on its own J604 tree:
So the rows in my previous comment stand with the storm gone: both properties mute, dance-only is silent with Disclosure: an LLM (Claude) ran these tests on my Mac and drafted this. I did the listening, reviewed it, and am responsible for it. Assisted-by: LLM |
|
@davishann15-commits Thank you for the split and for ruling out the #1895 storm. Here is what we have on our side, and what we don't have yet. Our J604. The six amps play on our J604 with this series: Dylan listened on our 1.914 kernel, playing his own audio. Our Our register values (idle only so far). With both playback PCMs closed, all six amps read page 0 A note on Where we think the difference is. Your kernel and ours differ in Two rows that would split it. Either would help a lot:
On the stop-time |
|
@IronsideXXVI, re your comment: here is row 1. With Same J604 and method as before: one
As in the other rows, the speakerguardd v2 self-check and switch test passed, and each stream got its grant and was released at its end. On About row 2: I'd rather not run the speakers under speakersafetyd on this Mac. On this J604, speaker protection is speakerguardd v2, set up as Aurora's maintainers asked for this board. The speakersafetyd J604 board file is still in review (alarm-aurora#320), and I don't want to play through the speakers under a protection setup that hasn't been checked on this machine. If you have another way to split the grant path that keeps v2, I'm glad to run it. For example, a debug parameter or a test patch that skips the tweeter-corner restore on a grant, or one that leaves the unmute alone. I can also test your stop-sequence change when it's up. Disclosure: an LLM (Claude) ran this boot and the measurements on my Mac and drafted this. I did the listening, reviewed it, and am responsible for it. Assisted-by: LLM |
The J604 (MacBook Pro 14" M4, T8132) has six SN012776 amplifiers. This series makes the driver set them up and shut them down the way macOS 26B123 does on this machine. Both behaviours were measured on the J604 by tracing the I2C3 controller under macOS.
Shutdown (patches 1-3). macOS brackets every software shutdown of all six amplifiers with writes to the vendor's hidden page 0xfd:
0x0d = 0x0d,0x64 = 0x04,0x0d = 0x00PWR_CTRLshutdown0x0d = 0x0d,0x64 = 0x00,0x0d = 0x00The writes come 0.59 s after the last mute; power-up and mute transitions carry none.
tas2764.calready implements exactly this asTAS2764_SHUTDOWN_DANCE, but only as a switch for every amplifier at once throughENABLED_APPLE_QUIRKS, which leaves it off. These patches add a booleanapple,shutdown-danceproperty and honour it per amplifier, together with the dance's immediate-SDZ init step. The J604's six amplifiers set it.Init (patches 4-6). This part was traced at boot, from the hypervisor's entry. Each amplifier's init matches the driver (the six enabled quirk sequences, the DC blockers, the brownout block from the boot loader's ADT copies, the TDM setup) except for three writes:
0x07 = 0x680x19 = 0x400x47 = 0x02These patches add
apple,init-writes, a list of (page, register, value) byte triples applied after the built-in quirks. Each triple is checked against the writeable-register list, which gains page 10x19. The J604's amplifiers get macOS's three.Machines without either property are unchanged.
Checked on top of
integration/aurora1f5037a:dt_binding_check DT_SCHEMA_FILES=sound/ti,tas27xx.yamlpasses on the committed treeCHECK_DTBS=y apple/t8132-j604.dtbreports nothing for either property, and the DTB carries both on all six amplifiersIn our J604 kernel the same changes passed full arm64 builds. They have not run on the J604 under Linux yet; the register values are byte-for-byte what macOS writes.
(Updated 2026-11-14: the binding text in patch 1 had a colon that broke
dt_binding_check, now reworded; patches 4-6 added.)