Skip to content

ASoC: cs42l84: J604 headset codec probe writes as macOS does them - #1895

Open
IronsideXXVI wants to merge 4 commits into
aurora-silicon:integration/aurorafrom
IronsideXXVI:j604-cs42l84-init
Open

IronsideXXVI wants to merge 4 commits into
aurora-silicon:integration/aurorafrom
IronsideXXVI:j604-cs42l84-init

Conversation

@IronsideXXVI

@IronsideXXVI IronsideXXVI commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

macOS 26B123 sets 20 registers of the J604's CS42L84 headset codec during probe that this driver leaves at their reset values:

  • 0x0203
  • two 16-bit values at 0x31e8 and 0x31f4
  • four at 0x31b0, 0x31bc, 0x31c8 and 0x31d4
  • 0x31ae, 0x3065 and 0x0c01
  • the jack-detect controls 0x1471, 0x1473, 0x1478 and 0x1480
  • DAC_CTL1 with bit 6 clear

The 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 0x31b0 is 0x0551 on Linux vs macOS's 0x05e6, and 0x1478 is 0x2f vs 0x8f. Everything else macOS writes at probe, the driver already does or holds at its reset value.

This series:

  1. dt-bindings: an optional apple,init-writes property, a list of (register, value) u16 pairs.
  2. cs42l84: apply the pairs in order right after the device ID and revision checks.
  3. t8132-j604: the J604's 20 pairs. DAC_CTL1 is written muted, and playback unmutes it as before.
  4. cs42l84: with the init writes applied, read 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/aurora 1f5037a:

  • checkpatch --strict: 0/0/0 on each patch
  • dt_binding_check DT_SCHEMA_FILES=sound/cirrus,cs42l84.yaml passes
  • CHECK_DTBS=y apple/t8132-j604.dtb reports nothing for the property
  • the codec builds

Measured 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.

@IronsideXXVI

Copy link
Copy Markdown
Contributor Author

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 REMOTE_BUTTON_STATUS1 (0x1484). macOS reads 0x1484 right after that write: it reads 0x60, the latch clears on read, and the codec is quiet from then on. This driver reads 0x1484 only for button polling, so the latch stays set and holds the interrupt line asserted. With nothing plugged in that is about 990 codec interrupts/s, plus about 1980/s on its I2C bus, which macOS never sees.

The fix is to read 0x1484 once after the apple,init-writes and in every codec interrupt, as macOS does; button polling is unchanged. It is built and runs on our next J604 kernel. Once the J604 shows 0 codec interrupts at idle, I'll add it to this PR as a fourth commit with the measurement.

IronsideXXVI added a commit to IronsideXXVI/omarchy-j604 that referenced this pull request Nov 14, 2026
…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.
@davishann15-commits

Copy link
Copy Markdown

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 integration/aurora 7c71d6d, plus #1543, #1894, #1895, #1917, #1918, #1919 and #1922. It booted on its own J604 tree as an aura-try trial. Userspace: Hyprland 0.57.2, mesa-aurora 26.3.0_devel.202611130318, speakerguardd-v2 1.0.0alpha.1-40.

apple,init-writes is on the J604's cs42l84 node, and the codec probes cleanly (cs42l84 0-004b: Cirrus Logic CS42L84, Revision: 36, no errors). With the jack profile of alsa-ucm-conf-asahi#18 the jack card resolves its HiFi verb. Not tested: playback or headset detection through the jack (no wired headphones at hand).


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

@IronsideXXVI

Copy link
Copy Markdown
Contributor Author

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:

  • cs42l84 IRQ delta 0 in 10 s (it was 9918 per 10 s on 1.910). Both pasemi_apple_i2c controllers also 0 (they were about 19800).
  • The jack reports "not available", which is correct with nothing plugged in.
  • Codec and amp registers are unchanged from 1.910, and there are no codec error lines.
  • Our audio check passes (38/38 biquads, 0 xruns).

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).

IronsideXXVI added a commit to IronsideXXVI/omarchy-j604 that referenced this pull request Nov 14, 2026
…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>
@IronsideXXVI

Copy link
Copy Markdown
Contributor Author

I force-pushed to fix the dt-checks failure (apple,init-writes: [...] is too short).

The cause is in the binding. It gave maxItems: 64 without minItems. dtschema's _fixup_items_size() then sets minItems to the maxItems value, so the J604's 42 values counted as too short.

The binding commit now also has minItems: 2 (one register/value pair). Against the previous head, the tree differs only by that one line in cirrus,cs42l84.yaml. The other three commits are unchanged apart from their hashes. checkpatch --strict is still 0/0/0 on all four commits.

@davishann15-commits

Copy link
Copy Markdown

@IronsideXXVI The fourth commit works on a second J604.

I built this PR at c0a5945, plus #1543, #1894, #1917, #1918, #1919 and #1922, on integration/aurora 7c71d6d with alarm-aurora's pkgrel 38 recipe. Its code and DT hunks are identical to your force-pushed f0ca074 (only cirrus,cs42l84.yaml differs). It booted on its own J604 tree as an aura-try trial. With the screen unlocked and nothing plugged in:

  • Over 10 s: cs42l84 IRQ delta 0. Both pasemi_apple_i2c controllers: delta 0. The codec had raised 2 interrupts in total since boot.
  • Headphone Jack and Headset Mic Jack both read off, which is correct with nothing plugged in.
  • The only cs42l84 line in the log is Cirrus Logic CS42L84, Revision: 36. No errors.

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

@IronsideXXVI

Copy link
Copy Markdown
Contributor Author

@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 apple,init-writes, which this series now handles.

Results so far for the four commits:

  • Your J604: 0 codec and 0 I2C interrupts in 10 s, jacks read off with nothing plugged in, no codec errors.
  • Ours (linux-aurora 1.913 to 1.915): the same, 0 in 10 s (9918 per 10 s before the fourth commit).

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.

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