Skip to content

ASoC: apple: mca: sample J613 speaker sense on the opposite BCLK edge - #2104

Open
satchlj wants to merge 3 commits into
aurora-silicon:integration/aurorafrom
satchlj:j613-mca-sense-edge-20261116
Open

satchlj wants to merge 3 commits into
aurora-silicon:integration/aurorafrom
satchlj:j613-mca-sense-edge-20261116

Conversation

@satchlj

@satchlj satchlj commented Nov 17, 2026

Copy link
Copy Markdown
Member

Claude Fable 5.2 on @satchlj's behalf

On the J613 (M3 MacBook Air), nominal MCA receive sampling corrupts the speaker amplifier voltage/current sense stream and prevents speakersafetyd from protecting normal playback. The inverted I2S link selects rising-edge SDOUT launch in the TAS2764-class amplifier driver; the nominal MCA RX setting samples at that launch boundary.

Invert only the RX BCLK polarity for MCA cluster 2 when the root machine is compatible with apple,j613. This is the J613 speaker V/I sense frontend. It retains the I2S one-bit offset (bitstart 1 / edge 1), TX/playback polarity, sample representation and gain. Other clusters and boards, including J413 despite its shared sound-card fallback, keep their existing settings. The patch is three insertions in sound/soc/apple/mca.c; the existing local board/cluster condition was already appropriately scoped and needed no rewrite.

The receive setting was selected from hardware capture comparisons, supported by the public driver and TAS2764 datasheet timing definitions. No physical oscilloscope edge or setup/hold measurement is claimed. No timing-chain regression commit has been established, so there is no speculative Fixes tag.

Validation:

  • This rebased commit: replayed from local 1f17eef0f378eaadf8d693ee879c589010ec9e3b onto integration/aurora at 677be395b9d2e15d98696107ebf88191f08efbf9. sound/soc/apple/mca.o is compile-tested for arm64 in neo-build with LLVM 18.1.3, W=1 and the retained production configuration followed by olddefconfig. checkpatch.pl --strict: 0 errors, 0 warnings, 0 checks. This rebased commit has not been boot-tested.
  • Earlier J613 capture evidence: nominal bitstart 1 / edge 0 produced roughly 23,000 counts RMS in raw signed-16 quiet samples. The fix-only 30.20-based kernel (d4ed471f8eb5815d0b14510b438fcb57bfdc65c5 plus the same three-line change) gave 7.11–8.55 counts quiet RMS across per-amp captures, bipolar isolated tones and positive real power. Other-pair fitted 440 Hz response was at most 0.120 counts. Normal playback, an eight-second loud limiting test, stop-to-floor and restart-mediated suspend/resume passed. These capture/limiting figures belong to that 30.20-based trial.
  • Installed 30.14-based evidence, 2026-11-15: the same change is installed as default kernel 7.3.0-aurora73-ppt-4-sensefix1-ARCH. Its base composition was cba5ede3e1ea62647355eee42136afef493d175a: integration 05f3aabb2ae08f84506a3462638885bf77a8c5f8 plus the then-recorded drm/apple: support J613 native26 external displays #973 (952c236abf3f), media: apple: isp: enable exact J613 26.6.2 preview #974 (76a7dfbcdd04), arm64: dts: apple: t8122: SPI2 and SPI4 run from the 24 MHz reference, not 200 MHz #1598 (f1c9d85fa75a) and thunderbolt: apple: enable the J613 USB4 host-to-host path #1490 (9b89ce2742e2). With speakersafetyd 2.0.1-2.j613spkfix1, protected built-in playback and stop/start fail-safe passed. One s2idle cycle failed closed on an incomplete sense period, then automatically warm-restarted: fresh valid sense at 1.248384 s, protected unlock at 1.249550 s, and both groups at nominal gain at 3.979528 s after wake. Post-resume playback passed. This is recovery through a daemon restart, not seamless same-process continuity.

Hardware evidence is limited to J613 and the recorded compositions above; it does not qualify the current rebased integration tree on hardware. Independent common absolute V/I gain calibration remains open. No sample masking, guessed scale correction, daemon change or protection bypass is included.

🤖 Generated with Claude Code

On J613 the inverted I2S link selects rising-edge SDOUT launch on the
TAS2764-class speaker amplifiers. The nominal MCA receive polarity puts
speaker V/I sense sampling at that launch boundary, corrupting raw signed
samples and preventing speakersafetyd from protecting normal playback.

Invert RX polarity only for cluster 2 on apple,j613, retaining the one-bit
I2S offset and the existing TX polarity. Hardware capture comparisons show
that this opposite-edge window restores quiet samples and isolated bipolar
per-amplifier tones without sample masking or gain conversion. Playback
sampling and all other boards retain their existing configuration.

The same change on a 30.14-based J613 kernel passes protected playback,
stop-to-floor and suspend/resume through a fail-closed daemon warm restart.
The rebased commit is arm64 compile-tested separately. No timing-chain
regression commit has been established, so omit a Fixes tag.

Signed-off-by: Satya Benson <satya@benson.earth>
@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for working out the J613 sense-stream corruption and writing up the edge reasoning.

The fix is applied with of_machine_is_compatible("apple,j613") && cl->no == 2 in sound/soc/apple/mca.c:597-599. We select behaviour by a hardware or device-tree property rather than by the list of machines it was tested on. That matters especially here, because the sense stream feeds speaker protection, and any other board wired the same way should get the same receive edge without being named.

The edge belongs to the board's amp-to-MCA link, so it fits in the DT: for example a boolean on the MCA cluster or the capture dai-link (along the lines of bitclock-inversion for RX), set in the J613 DTS. The driver would then flip RX BCLK polarity whenever the property is present, on any cluster.

If you make it a DT property, we can run speaker-sense no-regression rows on our M1 Pro, M2, M4 Pro and A18 Pro.

satchlj and others added 2 commits November 19, 2026 06:32
Describe which MCA receive clusters sample on the opposite bit clock
edge from the DAI format. The transmit polarity stays as configured.

Signed-off-by: Satya Benson <satya@benson.earth>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Read the MCA clusters whose receive serializers use the opposite
BCLK edge from the DAI format. The J613 speaker sense frontend still
uses cluster 2 with inverted receive polarity, while the transmit
edge and DAI format remain the same.

Signed-off-by: Satya Benson <satya@benson.earth>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@satchlj

satchlj commented Nov 19, 2026

Copy link
Copy Markdown
Member Author

Claude Fable 5.2 on @satchlj's behalf

062f321c2f4c makes sound/soc/apple/mca.c read the RX BCLK inversion from the MCA node. Both J613 DT variants set cluster 2 through their shared DTS. The binding is documented in 3022449fad53. The arm64 MCA object and the J613, J613 25G83 and J615 DTBs built. Binding validation passed and the compiled DTBs confirmed the property on both J613s and its absence on J615. Checkpatch only flagged the co-author trailer casing. This has not been re-tested on hardware since the change. A J613 row will follow.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for the DT property and binding; that is exactly the shape we hoped for, and it keeps speaker protection independent of board names. The J613 sense row on this head is the remaining item, and the red dt-checks/host-tests jobs failed in apt (network), so a re-run should clear them. We will run speaker-sense no-regression rows on our lab Macs.

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