Repository navigation
ASoC: cs42l84: J604 headset codec probe writes as macOS does them - #1895
IronsideXXVI wants to merge 4 commits into
Conversation
|
Please hold this one for now. We found a side effect on the J604 (MEASURED 2026-11-14). One of the macOS probe writes, 0x1480 = 0x80, unmasks bits 5-6 of The fix is to read 0x1484 once after the |
…terrupt storm) UPSTREAM.md: the cs42l84 pull request is held by us. One of the macOS writes it carries unmasks a status latch the driver never reads, which keeps the codec's interrupt asserted at idle; the fix is built for the next kernel.
|
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
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 |
|
The hold is resolved: I pushed a 4th commit, c0a5945 "ASoC: cs42l84: acknowledge the remote status latch after apple,init-writes". The cause: the init writes move 0x1480 from 0xe0 to 0x80, which unmasks bits 5 and 6. Their status latches in REMOTE_BUTTON_STATUS1 (0x1484) at power-up and only clears when 0x1484 is read. macOS reads it once at boot. This driver read it only for button polling, so the latch held the IRQ line asserted. The fix: when init writes were applied, read 0x1484 once right after them and on every codec interrupt. Measured on the J604, kernel 7.3.0 1.913, screen unlocked, nothing plugged in:
One difference from what ran: on our tree the same read sits inside the ring-sense path. This branch has no ring-sense detection, so here it is keyed on the init writes instead. It makes the same reads at the same points. Still to do: the plug/unplug test with a headset. Build: checkpatch --strict 0/0/0, and the codec builds with W=1 and no warnings. Tested on the J604 only (linux-aurora 1.913). |
…p reading corrected kernel/: the 8 patches 1.913 and 1.914 add (595 in all), same Aurora base. 1.913 (0588-0593): the thermal sensor polled every 50 ms while cool, the ISP's old first-open workarounds dropped, the SMC's power channels in the device tree, a wake mark at __cpu_setup, the headset codec reading its remote status as macOS does, and a deeper G16 job queue. 1.914 (0594-0595): the HDMI converter powered the Apple device-tree way, and the doorbell count macOS keeps in the GPU firmware's Globals. The recipe is the linux-aurora-next package. STATUS.md: 1.914 is the default as linux-aurora-next with 1.913 beside it as linux-aurora. 1.913 stalled early in boot on its first start and passed on its second; a 1.911 build failed its gate and was never the default. The headset codec's idle interrupt storm is gone (0 in 10 s, as macOS), so the jack moves to parity at idle: 22 at parity, 16 short, 13 untested. Correction: 1.910's deep-sleep reset was in the resume stub's 60 s window, not in __cpu_setup; every deep sleep since 1.905 slept and woke before the reset. The GPU's fourth idle fix is in 1.914, not measured yet. UPSTREAM.md: aurora-silicon/linux#1895's hold resolved by a fourth commit; #1894 held on an outside J604 test that reports silent speakers.
Apple machines set some CS42L84 registers at probe that the driver leaves at their reset values. Add a property that lists them as (register, value) pairs, applied in order once the device ID is verified. Assisted-by: LLM Signed-off-by: Dylan Ironside <dylan@dylanironside.io>
Apply the optional apple,init-writes (register, value) pairs in order right after the device ID and revision checks. Machines without the property are unchanged. Assisted-by: LLM Signed-off-by: Dylan Ironside <dylan@dylanironside.io>
…rites macOS sets 20 registers of the J604's headset codec during probe that the driver leaves at their reset values: 0x0203, two 16-bit values at 0x31e8 and 0x31f4, four at 0x31b0/0x31bc/0x31c8/0x31d4, 0x31ae, 0x3065, 0x0c01, the jack detect controls 0x1471, 0x1473, 0x1478 and 0x1480, and DAC_CTL1 with bit 6 clear. They come from an I2C trace of macOS 26B123 booting on the J604 under the hypervisor, compared with the same registers read on Linux; everything else macOS writes at probe the driver already does, or holds its reset value. DAC_CTL1 is written muted; playback unmutes it as before. Assisted-by: LLM Signed-off-by: Dylan Ironside <dylan@dylanironside.io>
…rites macOS's probe writes for the J604's headset codec (apple,init-writes) set 0x1480 from 0xe0 to 0x80, unmasking bits 5 and 6. Their status latches in REMOTE_BUTTON_STATUS1 (0x1484) at power-up: macOS reads it as 0x60 13 ms after the write, the read clears it (it reads 0x00 after), and macOS sees no codec traffic at idle. This driver read 0x1484 only for button polling, so with the init writes the latch held the interrupt line asserted: about 1000 codec interrupts a second with nothing plugged in, each costing two I2C reads that changed nothing. With the init writes, read 0x1484 once right after them and on every codec interrupt, as macOS does. The polled button bits (0 and 1) are not affected: the poll reads the same register at its own cadence. Assisted-by: LLM Signed-off-by: Dylan Ironside <dylan@dylanironside.io>
c0a5945 to
f0ca074
Compare
|
I force-pushed to fix the dt-checks failure ( The cause is in the binding. It gave The binding commit now also has |
|
@IronsideXXVI The fourth commit works on a second J604. I built this PR at c0a5945, plus #1543, #1894, #1917, #1918, #1919 and #1922, on
For comparison, on our default kernel (linux 2129f55, no codec init writes) the same counters also stay at 0 in 10 s. Not tested: plug/unplug and headset buttons, since I have no wired headset here. 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, that is the independent check this needed. It is also a fair point that your default kernel without the init writes stays at 0 too: the storm only came with Results so far for the four commits:
Still open on both machines: plug/unplug and headset buttons. I will post ours here when someone at our Mac has a headset plugged in. |
macOS 26B123 sets 20 registers of the J604's CS42L84 headset codec during probe that this driver leaves at their reset values:
0x02030x31e8and0x31f40x31b0,0x31bc,0x31c8and0x31d40x31ae,0x3065and0x0c010x1471,0x1473,0x1478and0x1480DAC_CTL1with bit 6 clearThe source is an I2C trace of macOS booting on the J604 (MacBook Pro 14" M4, T8132) under the hypervisor. It was compared with the same registers read back on Linux, where 20 differ, for example
0x31b0is0x0551on Linux vs macOS's0x05e6, and0x1478is0x2fvs0x8f. Everything else macOS writes at probe, the driver already does or holds at its reset value.This series:
apple,init-writesproperty, a list of (register, value) u16 pairs.DAC_CTL1is written muted, and playback unmutes it as before.REMOTE_BUTTON_STATUS1(0x1484) once after them and on every codec interrupt. The writes unmask two sources whose status latches at power-up and is cleared by reading 0x1484; macOS reads it. Without this the latch holds the interrupt line asserted, about 1000 interrupts a second at idle.Machines without the property are unchanged. macOS's jack-detect polling loop and debounce values are not part of this; the driver keeps its own design there.
Checked on top of
integration/aurora1f5037a:dt_binding_check DT_SCHEMA_FILES=sound/cirrus,cs42l84.yamlpassesCHECK_DTBS=y apple/t8132-j604.dtbreports nothing for the propertyMeasured on the J604 (linux-aurora 1.913, nothing plugged in): 0 codec interrupts in 10 s (it was 9918 before patch 4), the jack reports not available, and audio playback works. The plug/unplug test is still to do.
Tested on the J604 only.
This is independent of #1894 (the J604 amplifiers), and both touch
t8132-j604.dts.