Repository navigation
J813: AOP sound on integration/aurora (speakers, jack, microphones) - #1423
DjDeveloperr merged 22 commits into
Conversation
RyanTheTide
left a comment
There was a problem hiding this comment.
Needed before merge:
- The failing
sourcejob is the diag_shim harness issue (linux/bitmap.hwithout a stub) that integration/aurora fixed in #1438; merging or rebasing onto current integration/aurora clears it. tas2764.c,apple-admac.candmacaudio.care shared with the M1/M2 machines: theti,bclk-ratiopath and the paused-capture restart need to be no-ops when the property is absent and for playback streams. Please add a KUnit or host test that covers the existing (noti,bclk-ratio) TAS2764 configuration, or show it is unchanged.- For J813, show that the speakers stay behind the kernel speaker-protection interface (
Speaker Volume Unlock/Speaker Protectioncontrols) as on the other macaudio machines, so they are not driven above the safe ceiling without a protection daemon.
Add the MacBook Air (M5, J813) and Mac mini (M6, J873) sound cards. t8142-j813-audio.dtsi already names apple,j813-macaudio. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The J873 (Mac mini M6) AOP runs the same firmware generation as T8140 (EPIC v4, iBoot-loaded, started by the AP), but the T8140 "setup port" is not reachable from the AP: mailbox 1 of the AOP's mailbox bank and the ADT aop-exclave-mailbox both bus-error. The firmware boots without it: RTKit protocol 12, then its "audio" EPIC service. Add apple,t8152-aop with the T8140 configuration minus the setup port, starting every advertised endpoint. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The Mac mini (M6, J873) speaker runs a 250-BCLK TDM frame, which the SN012776's ratio auto-detection rejects. Describe the property that fixes the ratio instead. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The J873 (Mac mini M6) AOP runs the speaker frame at 250 BCLKs of 12 MHz. The SN012776 cannot auto-detect that ratio and mutes with "fault: bad TDM clock". With TAS2764_CLK_CFG (register 0x60) set to 0x30 and TDM_CFG0 bit 6 set it accepts the frame and plays. Do that when the new ti,bclk-ratio property names the ratio; only this one ratio is supported. Source of the value: the register write was first seen in the macOS SN012776 driver; it is a single register value, and its effect (no fault, correct playback) was verified on J873 hardware. No table or code was taken from macOS. The field is initialised in probe, so non-OF matches keep auto-detection. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The SDOUT1 mux offers the ASP receive channels as a source, but no DAPM route connected them, so selecting "ASP RX CH1" or "ASP RX CH2" left the capture path without an input. The J873 and J813 AOP audio services use it to loop the playback stream back. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
On T8152 (J873, Mac mini M6) the AOP firmware owns the audio fabric, as on T8140. Its "audio" EPIC service offers cout/cin (the CS42L84 jack, base-ns ADMAC TX5/RX5, MCA4) and spkr (the SN012776 speaker, TX1, MCA0). Each service is an ASoC back-end DAI: startup attaches it, requests pw0 (which raises the audio fabric) and powers the MCA leaves, all of which are required. pwrd starts the serializer clocks at prepare, before ASoC unmutes the codecs: the jack codec locks its PLL to the bit clock, and the speaker amplifier reports "bad TDM clock" whenever it runs without one. The jack restarts its clocks on every prepare so that a stream restarted after an underrun begins on a frame boundary; the mono speaker (one slot per frame) keeps them running. The front-ends are dmaengine PCMs on the base-ns channels: the jack in stereo, the speaker in mono (its serializer runs one 32-bit slot; stereo frames play at half pitch). The firmware's serializer configuration (property 701) is byte-identical to the one macOS publishes, so the driver leaves it alone. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The J873 (Mac mini M6) uses the T8152 AOP audio driver as its CPU component: the CS42L84 jack on "cout" (DSP_A | IB_NF, one-BCLK sync pulse) and one SN012776 on "spkr" (I2S, NB_IF: data sampled on the rising edge, as macOS programs the amp). Each AOP front-end owns the DMA channel of one serializer, so the speaker can only be fed from the secondary front-end; the new spk_secondary_only sets the speaker mux accordingly, and spk_dai_fmt gives the speaker link its own format. There is no qualified speaker protection for J873 yet (no verified sense path, thermal model or power budget) and no safe level, so macaudio_speakers_allowed() keeps the speaker off. The jack is not affected. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The T8142 AOP (MacBook Air J813) waits for the host on a setup port, as the T8140 one does: the ADT's aop-exclave-mailbox at 0x3d067c000 (AOP ASC + 0x4007c000, not behind the arm-io translation). Its EPMAP announces other service endpoints than T8140's fixed set (0x4, 0x20, 0x23 and 0x32 on J813), so take the endpoints that must get buffers from the EPMAP when the match data says so. The firmware places its own crash log buffer in its firmware-mapped DART slot; accept it as the firmware's, as for G17P. After the setup boot all AFK endpoints start, and with the audio fabric left to the firmware (see the J813 device tree) the firmware announces its "audio" EPIC service. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Behind an AOP the serializer feeding a capture channel is the firmware's, and it stops in the middle of a frame whenever it likes. A capture that stays open across such stops (the speaker V/I sense, which a protection daemon reads for as long as it runs) then carries the partial frame forward: every later frame is off by its words, and the samples of one amplifier are read as another's. On the MacBook Air J813 one restart in three slipped by one 16-bit word. Let a client pass the frame size in bytes as a u32 in dma_slave_config.peripheral_config. A paused cyclic capture on such a channel resumes at the next frame boundary of its current period: the reports completed before the pause are accounted for, the rings are reset and the rest of the period is submitted from the aligned address, then whole periods as before. Without a frame size nothing changes. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The J813 speaker stream (ADT iop-audio-controller/audio-speaker) differs from J873's: four SN012776 in 32-bit playback slots 0-3, and their voltage and current sense back on the same stream's RX side (base-ns RX0) as eight 16-bit slots. Make the speaker and sense shapes per-SoC match data: J873 keeps one playback channel; T8142 gets four, and an 8-channel S16_LE "Speaker Sense" front-end. The sense capture is the speaker serializer's RX, which the firmware stops anywhere in a frame. Before every `pwrd` of the speaker, restart a running sense capture at a frame boundary (apple-admac realignment, the partial frame reads as zeros), so that a protection daemon that keeps it open attributes each amplifier's voltage and current to the right one. The sense back-end also attaches the speaker service and requests `pw0 ` at startup: its front-end requests the ADMAC channel next, and the ADMAC only answers while the firmware holds the audio fabric up. Opening the sense before any other stream since the AOP started (speakersafetyd at boot) otherwise faults the bus. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
MacBook Air 13" M5 (T8142): as on J873 the AOP firmware owns the audio fabric and the CPU component is the T8152-style AOP audio driver. The jack is a CS42L84 on "cout", the speakers four SN012776 (one woofer and one tweeter per side) on "spkr", with their V/I sense on the same stream. As on the other SN012776 laptops the table has a safe level, so the speakers are behind the speaker protection interfaces from the bind: under "Speaker Volume Unlock" their volumes stay at the lock's ceiling until a protection daemon (speakersafetyd) holds them, and under "Speaker Protection" they stay at the floor and no speaker start is admitted until an owner is granted. Each amp's level is its apple,speaker-config from the boot loader. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The MacBook Air J813's three microphones are the AOP's "hpai" service (ADT iop-audio-controller/audio-hp-mic): the firmware runs the PDM part and delivers 48 kHz float32 frames of three channels (the ADT's audio-hp-mic-proxy description: 12 bytes per frame) on leap-s ADMAC RX0. There is no codec, so it gets a card of its own with one capture PCM, named like the other AOP microphone cards (AppleJ813HPAI, "MacBook Air J813 High-Power Audio Interface", driver aop_audio) so that the existing UCM and DSP configurations for those apply. As on T8140: open attaches the service and requests pw0 (which raises the LEAP fabric), powers the LEAP leaves (leap-s ADMAC, RX0, LEAP MCA), and only then requests the channel, whose registers fault without them. The trigger starts the DMA and queues pwrd behind it; started earlier, the LEAP produces into a channel nobody services. Close releases the channel, then pw0 and the leaves. The card exists only where the DT gives the LEAP power domains (all three); J873 is unchanged. The dmaengine substream setup moves into a helper shared with the ASoC front-ends. Tested on J813: a tone from the speakers reads -44 to -49 dBFS on all three channels, 70 dB over the quiet floor, exactly while it plays; PipeWire picks up the card with asahi-audio's J613 beamformer graph. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The MacBook Air (M5, J813) gets its jack, speakers and microphones from the T8152 AOP audio driver. Build it beside the T8140 one. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
ti,bclk-ratio is only on the AOP-fed amplifiers (J813, J873). Test that an amp without it, as on every MCA machine, keeps the ratio auto-detection and that its probe writes neither TAS2764_CLK_CFG nor TDM_CFG0's fixed-ratio bit, through a register map that records every write; that 250 BCLKs programs code 0x30 and sets only that bit; and that a ratio without a known code fails the probe. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The paused-capture restart at a frame boundary is the T8152 AOP audio driver's alone: it passes a u32 frame size in the peripheral config for its speaker sense capture. Test that a slave config as mca_hw_params() builds it (zeroed, no peripheral config) and one with a peripheral config of another size give no frame size, and that a resume realigns only a capture channel with a frame size and a transfer, never a playback one, so the MCA machines' channels resume as before. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Cover the AOP-fed machines in the speaker KUnit suites: - apple-speaker-admission: J813 is admitted (it has a safe level), J873 is not (it has none). - apple-speaker-amp-level: neither carries an SN012776 gain; each amp's level is its apple,speaker-config from the boot loader. - apple-speaker-interface: on the J813 table the four SN012776 volumes start at the volume lock's ceiling, go up only once a daemon holds the lock and pings, and under "Speaker Protection" sit at the floor with no speaker start admitted until an owner is granted. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
3679438 to
114ebfd
Compare
|
Thanks, @RyanTheTide. All three are addressed. I force-pushed 3679438 -> 114ebfd, which is now 16 commits on integration/aurora 5186d2e. The description has the details.
KUnit: 84 / 84 in arm64 QEMU at the head, with the kunitconfig from the description. These suites are not in CI. At each test commit it is 81 / 81 and 83 / 83. One run at the ADMAC test commit failed Per-commit build: 16 / 16. apple-dt-check: 0 new warnings, 10 fewer. The speakers still play: a 1 kHz tone at 0.05 reaches the microphones at -50 / -52 / -46 dBFS. |
The driver also runs the J813 (T8142, MacBook Air M5) speakers and its microphone array card. Say so in the Kconfig help and the module description, which still named only the Mac mini jack and speaker. Signed-off-by: Diljit Singh <hey@djdev.me>
TAS2764_CLK_CFG went in between TAS2764_INT_CLK_CFG and its TAS2764_INT_CLK_CFG_IRQZ_CLR field. Put the field back under its register. No functional change. Signed-off-by: Diljit Singh <hey@djdev.me>
|
Reviewed before merging. I found no correctness problems: the setup-port EPMAP endpoint discovery, the ADMAC capture realignment (only for a client that passes a frame size), the I pushed two small fixups as separate commits on top of yours, without changing your commits:
I'll merge once CI is green on the new head. |
Flush queued HPAI startup before releasing its dmaengine runtime, and provide sync_stop so ALSA waits for asynchronous DMA termination before reusing or freeing the capture buffer. This carries the microphone lifetime handling already present in the J815 extension into the common J813/T8152 foundation. No speaker admission, gain, protection or device-tree behavior changes. Signed-off-by: Diljit Singh <hey@djdev.me>
Pair the dmaengine front-end asynchronous STOP with sync_stop before ALSA reuses or releases its buffer. Skip ASoC back-ends, which have no dmaengine runtime, just as the T8140 AOP component does. Signed-off-by: Diljit Singh <hey@djdev.me>
DjDeveloperr
left a comment
There was a problem hiding this comment.
Codex (GPT-6.1 Sol), reviewing on @DjDeveloperr’s behalf.
No remaining blocking source findings in the reviewed/integrated net change. The source DMA/work lifetime gaps are now fixed on the contributor branch, with author cosmetics and original ancestry preserved. Microphone STOP/close flushes pending HPAI start before DMA/channel reuse, MIC_PCM_OPS has sync_stop, and the ASoC component mirrors the established T8140 FE/BE sync_stop behavior. Only the same Rust file changes; no6amp/DT/protection behavior was added. The EXACT final tree63b92ef compiled sound/soc/apple/t8152_aop_audio.o successfully through linux-build/build with matching generated Rust bindings, CONFIG_RUST=y and the module=m, with no object diagnostics. SEP rust-build compiles only apple-sep.o and is NOT cited as this audio proof. Author's existing84-test shared ADMAC/TAS/admission evidence and J813 protected-audio reports remain attributed. Fresh Hosted CI and the existing kernel interlock/safe-ceiling checks must still hold before merge; no playback/hardware actions were performed here.
Approval does not waive pending CI, dependency order, hardware-safety gates or source-versus-release qualification. No source merge is an installed-loader write or a new hardware test.
…tion Retain the reviewed DMA/work and FE/BE sync-stop lifetime fix, and combine T8142 dynamic setup endpoints with current main AOP source/bound rings, LPAI and other interfaces. Carry the reviewed policy-window test-only correction, including unsafe-call negative controls. The audio driver source is unchanged; actual object compilation follows. Assisted-by: LLM
integration/aurora now has the agreed fix for the policy-window test, aurora-silicon#1561 (ea10c4d). The earlier merge into this branch had carried a different version of the same test change, and combining the two leaves aurora-silicon#1561's deferred-call count at zero, which fails the source check. Take integration/aurora's test file as it is: this pull request is J813 audio and changes nothing under tools/aurora-sep. Signed-off-by: Diljit Singh <hey@djdev.me>
|
I pushed 18fa06f, a merge of current integration/aurora. The earlier base merge into this branch (375393a) had carried its own version of the |
|
Note for any lane that pushes to this branch: please don't push further changes to #1423.
Assisted by Claude Code |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Codex (GPT-6.1 Sol), reviewing on @DjDeveloperr’s behalf.
Current-head compile follow-up for 18fa06f (tracked tree 794d2a6c554bf0d3cbfaea23ed89be14418110a2): both sound/soc/apple/t8152_aop_audio.o and the merged drivers/soc/apple/aop.o compiled successfully as AArch64 objects through linux-build/build, with matching generated Rust bindings and both modules enabled. This closes the specific current-provider/current-consumer compilation gap; the older sound-only build is not being substituted for it.
Clang23.1.1, Rust1.99.0, corrected bindgen0.73.2. Audio object261696bytes/SHA256 d717ef8cde88b38dc21e0e3888ea54152de0cf596d5bba77f8c017cb50425ecd; AOP object807208bytes/SHA256 6717d1e5ab043b094d2a367d2794c7a893a7607bde0f9b2d758fd5b139ba44f9. Tracked source remained clean and unchanged throughout; prior build/rollback evidence retained.
Existing source approval stands. Current host and DT workflows passed; SEP workflow43068470145 is still queued at this read, so merge remains pending its actual result. This is object compilation, not a full kernel/module-link, hardware audio or playback qualification. Existing protected-audio evidence and kernel interlocks keep their original scope. No further branch changes, boot/default-loader changes or hardware operations were performed.
Carry byte-exact schema files from reviewed aurora-silicon#1423 at 18fa06f so the shared J813/J815 DT can be checked without inventing a second binding implementation. Original binding updates by Thomas Glanzmann, signed off in commits 9afc945 and bb9ad0e. This is binding metadata only; no driver or speaker-protection adoption or parent edge is added. The M5 merge lane retains ownership of aurora-silicon#1423. Later identical binding changes coalesce in an ordinary merge. Signed-off-by: Diljit Singh <hey@djdev.me>
33079a0
into
aurora-silicon:integration/aurora
… stream The J815 (MacBook Air 15-inch, M5) uses the T8142 speaker stream with six amplifiers instead of J813's four. Its ADT audio-speaker node has six slots (mask 0x3f) and twelve sense words (mask 0xfff), in speaker-config order: left woofer 1, right woofer 1, left tweeter, right tweeter, left woofer 2, right woofer 2. Add a six-amplifier T8142 configuration and select it with apple,speaker-amps = <6>. The firmware stream must match the PCM exactly, so any other count, or the property on a SoC without a second shape, fails the probe. Tested on J815 on top of an earlier revision of the J813 audio series (Linux #1423): all six amplifiers probe, the 12-channel sense PCM opens at 48 kHz, and a low-level sweep of each speaker under speakersafetyd found every speaker on its own playback slot and sense pair. Capped playback and the microphones work. This exact revision has been build-tested only. Assisted-by: Claude Opus 5.5 Signed-off-by: Nick <nekreshen@yandex.ru>
The J815 (MacBook Air 15-inch, M5) has J813's AOP-fed card with six SN012776: two woofers and a tweeter per side, with left speakers in the even slots and right speakers in the odd ones. Each amplifier sends a voltage/current sense pair on the same stream. The speakers are locked to the safe level until speakersafetyd holds the volume, as on J813. Tested on J815 on top of an earlier revision of the J813 audio series (Linux #1423): all six amplifiers probe, the 12-channel sense PCM opens at 48 kHz, and a low-level sweep of each speaker under speakersafetyd found every speaker on its own playback slot and sense pair. Capped playback and the microphones work. This exact revision has been build-tested only. Assisted-by: Claude Opus 5.5 Signed-off-by: Nick <nekreshen@yandex.ru>
Base: integration/aurora (5186d2e). Branch thomas/j813-sound-int (114ebfd), 16 commits:
13 for sound and 3 that add KUnit tests.
The MacBook Air M5 (J813) DT in integration/aurora (
t8142-j813-audio.dtsi) already describesthe AOP, its audio service, the four SN012776 amps, the CS42L84 and the macaudio card. Ryan's
eab3e66 also added the T8152-generation AOP and audio bindings. The drivers behind those
nodes never reached integration: they went into aurora-wip with #1000. On integration a J813
therefore has no sound card at all.
This ports #1000 onto integration/aurora:
soc: apple: aop: T8152 support, and booting the T8142 AOP through its setup port, whoseEPMAP names the service endpoints.
tas2764: a fixed BCLK/FS ratio (ti,bclk-ratio, which the J813 DT already sets).cs42l84: SDOUT1 routed from the ASP input.apple-admac: restart a paused capture at a frame boundary (the speakers' V/I sense).macaudio: J873 and J813.asahi.config: build the T8152 AOP audio driver, beside the T8140 one.Differences from #1000:
Ryan's version of both files (eab3e66), and the J813 DT follows it.
already has it (ecbb337).
apple,j813-macaudio, which no binding listed.AopHwConfigentries take integration's fields in the commits that addthem:
ncal: None(the firmware keeps its own; neither entry patches boot arguments) andbootargs_word_access: false. J813: AOP sound on the MacBook Air M5 (speakers, jack, microphones) #1000 did this in a separate last commit. Here every commitbuilds on its own.
amp_gain. On integration the SN012776 takes eachamp's level from its
apple,speaker-config, which aura passes on the J813 (level 0x0f on allfour amps). J873 has no safe level, so
macaudio_speakers_allowed()keeps its speaker off.please_blow_up_my_speakerscannot override that on integration.Not included: Acelogic's two J813 audio commits from #1048 (ad4910c "ASoC: apple:
validate J813 audio topology and use the default worker queue" and 12165bc "ASoC: apple:
initialize J813 output standby before microphone registration"). They have no Signed-off-by,
and the speakers, jack and microphones work without them (below). @Acelogic, if you want
them in integration, they apply on top of this.
The M1-M4 machines
The changes to shared drivers do nothing without the J813 or J873:
tas2764:tas2764_parse_bclk_ratio()sets a ratio code only fromti,bclk-ratio, andtas2764_apply_bclk_ratio()writes nothing without one. The code starts at -1 in the I2Cprobe, before the device tree is read.
apple-admac:admac_config_realign_bytes()takes a frame size only from a 4-byteperipheral_config. Onlyt8152_aop_audio.rspasses one, for its speaker sense capture.mca_hw_params()zeroes its slave config.admac_resume_realigns()holds for capturechannels only.
macaudio: the newspk_dai_fmtandspk_secondary_onlyfields are 0 in every other table,and the driver reads them only when they are set.
cs42l84: two more DAPM routes into "SDOUT1 Select" (ASP RX CH1/CH2). The default route isstill the ADC.
KUnit tests:
tas2764-bclk-ratio(new):ti,bclk-ratio, one with the ADT blocks the MCA machines get and onebare. Both keep the ratio auto-detection.
TAS2764_CLK_CFGandTDM_CFG0keep their values.TDM_CFG0's fixed-ratio bit.apple-admac-realign(new):mca_hw_params()builds it gets no frame size, and neither does aperipheral_configof another size.playback channel.
apple-speaker-admission: J813 is admitted (it has a safe level) and J873 is not (it hasnone).
apple-speaker-amp-level: neither J813 nor J873 carries an SN012776 gain.apple-speaker-interface, a new case on the J813 table:201.
start is admitted. The owner's lease gives 201, and the release puts them back at 0.
Run in arm64 QEMU with this kunitconfig:
tools/testing/kunit/kunit.py run --arch=arm64 --make_options LLVM=1 --kunitconfig=<that file>passes 84 / 84 tests in 11 suites. These suites are not in CI: its kunit job runs the SEP
kunitconfig only. As a check that the new cases catch regressions, I broke the drivers in
three ways:
CLK_CFGwithout the property;Each of these fails the matching cases (6 of 84). At each test commit the run passes too (81
/ 81, 83 / 83). One run at the ADMAC test commit failed
macaudio_spk_lease_expires, anexisting test with a 10 ms lease, while the host was building at full load. It passed in the
four runs after that.
Testing
On the J813 (macOS 27.0 stub), booted through aura-try:
5186d2e). Built with
CONFIG_SND_SOC_APPLE_T8152_AOP_AUDIO=m.Secondary, Speaker Sense) and AppleJ813HPAI (the microphone array), and dmesg has no AOP or
audio errors.
reads 1, and each Speaker Volume's maximum is 201.
systemctl stop speakersafetyd:level in its
apple,speaker-config(00 0f 00 02,01 0f 04 06,02 0f 08 0a,03 0f 0c 0e).aplayof zeros to hw:AppleJ813,1 (the speakers) fails with "Operation not permitted",and
speaker_starts_refusedgoes from 0 to 1.unlocked again.
at -50.1, -52.1 and -45.7 dBFS at 1 kHz, against -133 to -140 dBFS before the tone. The
previous round measured -48.0, -49.1 and -42.9 dBFS RMS; J813: AOP sound on the MacBook Air M5 (speakers, jack, microphones) #1000 measured -50.5 dBFS.
the AOP. The aurora-wip kernel did not log this line; it changes nothing.
CI checks, run locally:
test_diag_policyandtest_diag_sensorfail ondiag_shim.c'slinux/bitmap.h, whichFix SEP diagnostics source checks and KUnit compilation #1438 fixed.
scripts/dtc/apple-dt-check.shintegration/aurora..this branch: 0 new warnings, 10 fewer.The fixed ones are t8142-j813.dtb's
apple,j813-macaudiocompatible andti,bclk-ratioonits four amps, which are now documented.
apple,macaudio.yamlandti,tas27xx.yamlpassdt_binding_check.
Reviewers: @Acelogic @DjDeveloperr @RyanTheTide @LiamRay10