Repository navigation
ASoC: apple: mca: sample the J615 speaker sense one bit clock later - #2589
Merged
Merged
Conversation
…late On some boards the data that devices send to an MCA port arrives later than the DAI format places it. On the MacBook Air 15" M3 (J615) the six speaker amps' voltage and current sense words reach their two ports one bit clock late, so every received word comes in shifted by one bit. Add an optional per-port apple,rx-delay-bclks array: the number of bit clocks by which that port's received data is late. Only 0 and 1 have been seen. Signed-off-by: Ryan Murray <[email protected]>
When a cluster captures from ports that the device tree lists in apple,rx-delay-bclks, start its RX bit count that many bit clocks later than the DAI format does, taking the largest delay of its source ports. Without the property nothing changes. On the J615 the speaker sense capture otherwise sees each word one bit late: its top bit is the previous slot's last bit. speakersafetyd then reads amps that draw watts in silence and exits at the start of every speaker stream, which leaves the speakers held at their safe level. Signed-off-by: Ryan Murray <[email protected]>
…k late The J615's six SN012776 amps return their voltage and current sense words to MCA ports 0 and 1 one bit clock later than the I2S format places them. Describe that so that the sense capture samples them where they are. Signed-off-by: Ryan Murray <[email protected]>
DjDeveloperr
approved these changes
Nov 20, 2026
DjDeveloperr
left a comment
Contributor
There was a problem hiding this comment.
Reviewed at ff41fe2. Approve.
Scope (sense capture only, DT-driven)
sound/soc/apple/mca.c:721-724: the new write is guarded by!is_tx, so it touches only the cluster's RX serdesREG_RX_SERDES_BITSTART. Speaker playback (TX bitstart, serdes conf, gain, amp enables) is not touched.sound/soc/apple/mca.c:1405-1411:rx_delaycomes fromapple,rx-delay-bclksonly. If the property is absent,of_property_read_u32_indexleaves the kzalloc'd 0, and values above 1 are refused and treated as 0. There is no compatible or chip list.- On every other board the capture hw_params now writes back
cl->rx_bitstart + 0, which is the valuemca_fe_set_fmtalready wrote (mca.c:615-618). The register value is the same, and Ryan's negative control (this mca.c, no property, J615) shows that. Rewriting it on every hw_params is also correct when a cluster switches between late and on-time ports. - The sleep save/restore (
mca.c:1522-1527) reads RXA+0xc back from hardware, so the delayed bitstart survives a firmware-path suspend with the sense stream open. arch/arm64/boot/dts/apple/t8122-j615.dts:114-120:<1 1 0 0 0 0>matches the six clusters in t8122.dtsi (6 clocks) and the speaker link on<&mca 0>, <&mca 1>. The jack on port 2 stays at 0. J613 and all other SoCs are unchanged.
Binding
Documentation/devicetree/bindings/sound/apple,mca.yaml:113-124: documented, uint32-array of 4..6 entries, each at most 1, matching the driver's clamp. dt-checks is still running on this head.
Safety
- No amp limit, gain, idle mode or playback path changes. Nothing reaches the amps earlier than before. The visible effect is that speakersafetyd no longer exits at stream start, so the amps stay under the daemon's protection instead of in warm-restart lockdown.
- The evidence for the one-bit direction is strong: silence decodes to under 0.04 mW on all six amps once shifted. But it is silence only. The daemon's model under load still needs the playback row below before any distro pin picks this up for J615.
Notes (non-blocking)
- The
mca_rx_delay_of_portsKUnit case is not in the CI host-test set. It passes per Ryan's x86_64 qemu run. - Using the max delay means a capture that mixes a late port with an on-time port would sample the on-time port late. This is documented in the helper and test, and no current DT does it.
Post-merge row (required): J615 real speaker playback through speakersafetyd at 5% volume, with Ryan's OK: silent all-zero stream for more than one period, then real audio. Check NRestarts 0, plausible per-amp power, and no gain-reduction lockup. If it fails: git revert -m 1 <merge sha> on integration/aurora.
This was referenced Nov 20, 2026
This was referenced Nov 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On the MacBook Air 15" M3 (J615), speakersafetyd exits at the start of every speaker stream with
Left Tweeter: Negative power, bad ivsense data?. It happens on every boot (26 of 26 observed). systemd restarts it in "warm" mode, so the speakers stay held at maximum gain reduction after every boot. When a restart storm hits StartLimitBurst the daemon is gone and the speakers stay locked.The daemon is right. Recordings of the sense capture during the stream the system opens at boot (silence, nothing played on purpose) show every one of the 12 voltage/current words shifted by one bit. Each word's top bit is the previous slot's last bit, and the rest is the real word shifted right. Silence then reads as several watts on all six amps (-4.5 to +4.1 W), not just the tweeter, which is simply the first speaker the daemon checks. The proof that the shift is one bit late: the first channel of the frame, whose previous slot is idle, never reads negative. Shifting the words back by one bit gives under 0.04 mW on every amp, i.e. silence.
Change
apple,rx-delay-bclks, one entry per port: how many bit clocks late that port's received data arrives because of board signal timing (0 or 1).The J615 uses the same macOS speaker-stream description as the M2 Air 15" (J415), where the same Linux format works, so this is board/SoC timing. It's described in the DT rather than gated on a board or chip.
Testing
mca_rx_delay_of_ports. checkpatch --strict clean; dt_binding_check and CHECK_DTBS (t8122-j613/j615) clean; W=1 clean.Still to run
Evidence detail
--sense-captureof the first period of each daemon start, 12 x S16 at 48 kHz, 4096 frames. Raw values cluster at 0..+-17 and +-32745..32767 (e.g. 32762 = 0x7FFA = -12 >> 1 with a 0 top bit; -32761 = 0x8007 = 14 >> 1 with a 1 top bit).current_delay_samplesfix) does not change the raw numbers, so it is not that class.Assisted-by: LLM (Claude:Opus 5.5)