From 1d8ee8c89e99f9c412caac411252455cb1f189af Mon Sep 17 00:00:00 2001 From: Roberto Dantas <7robertodantas@gmail.com> Date: Wed, 11 Nov 2026 14:30:50 -0300 Subject: [PATCH 1/4] ASoC: apple: macaudio: keep a lone amp from narrowing a wider speaker stream speaker_fe_channels gives the speaker front-end every slot of a CPU stream that has more slots than amps (the AOP's six-slot speaker stream on the J713). The front-end link merges its back-ends' channel limits (dpcm_merged_chan). ASoC leaves a back-end's codecs out of that merge when there are several of them, but merges a single codec's own limits: with one amp (two channels on an SN012776) behind a six-slot stream the front-end's channels come out empty, and every open fails with -EINVAL. Do not merge channels on the speaker front-end of such a machine. Its CPU DAI already states the stream's channel count, and the amp takes its slots from its TDM mask, as on the J713. Signed-off-by: Roberto Dantas <7robertodantas@gmail.com> Assisted-by: LLM (Claude Code) Co-Authored-By: Claude Opus 5.5 --- sound/soc/apple/macaudio.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sound/soc/apple/macaudio.c b/sound/soc/apple/macaudio.c index 4e1b642e4b0a5..5345cb4ad7ae1 100644 --- a/sound/soc/apple/macaudio.c +++ b/sound/soc/apple/macaudio.c @@ -2770,6 +2770,17 @@ static int macaudio_parse_of(struct macaudio_snd_data *ma) card->dai_link[i].num_platforms = 0; else card->dai_link[i].platforms->of_node = platform; + + /* + * A stream with more slots than amps: the front-end carries + * every slot, while a back-end with a single amp would cap it + * at that codec's own channel count (ASoC merges a lone + * codec's channels, not several codecs'). The amp takes its + * slots from its TDM mask. + */ + if (ma->cfg->speaker_fe_channels && + !strcmp(card->dai_link[i].name, "Secondary")) + card->dai_link[i].dpcm_merged_chan = 0; } /* Skip the speaker sense PCM link if this amp has no sense (or no speakers) */ From 95b3dce63a1b1a751126d8e315a9808fc7a61694 Mon Sep 17 00:00:00 2001 From: Roberto Dantas <7robertodantas@gmail.com> Date: Wed, 11 Nov 2026 14:31:02 -0300 Subject: [PATCH 2/4] ASoC: apple: macaudio: enable the J575c speaker The J575c (Mac Studio, M4 Max) has one SN012776 on the AOP's speaker stream. Its variant left the speaker link unbound: the speaker had not been brought up, and the J773s ADT's speaker stream lists no receive slots, so no V/I sense was expected. On a J575c the firmware runs this stream exactly as on the J616s, ADT notwithstanding (its audio-speaker node lists one playback slot and no receive slots): six 32-bit playback slots and twelve 16-bit sense slots in a 250-bit frame at 12 MHz. A one-channel stream drains six times faster than 48 kHz; a six-channel one runs at 48 kHz, and the amp's current and voltage come back on sense channels 0 and 1 (a 440 Hz tone at -40 dB reads back in both, the voltage 14 degrees ahead of the current, 3.4 ohm at speakersafetyd's SN012776 scales). Give the J575c its own variant: the J616s stream format and frame, the speaker front-end on all six slots as on the J713, the amp on the first two (it downmixes them). The J773 keeps its speaker off. Signed-off-by: Roberto Dantas <7robertodantas@gmail.com> Assisted-by: LLM (Claude Code) Co-Authored-By: Claude Opus 5.5 --- sound/soc/apple/macaudio.c | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/sound/soc/apple/macaudio.c b/sound/soc/apple/macaudio.c index 5345cb4ad7ae1..067a411b286f3 100644 --- a/sound/soc/apple/macaudio.c +++ b/sound/soc/apple/macaudio.c @@ -4096,10 +4096,34 @@ struct macaudio_platform_cfg macaudio_j614_cfg = { }; /* - * J773 (Mac mini, M4 Pro) and J575c (Mac Studio, M4 Max): one SN012776 on - * the AOP's speaker stream. Neither speaker has been brought up or has a - * protection profile, and the J773s stream returns no V/I sense, so keep - * them off as on the J614s: the speaker link is not bound. + * J575c (Mac Studio, M4 Max): the J616s stream, six 32-bit playback and + * twelve 16-bit sense slots in the same 250-bit frame (the firmware runs it + * so, although the ADT's audio-speaker lists one playback slot), with one + * SN012776 on the first two playback slots (it downmixes them) and the + * first two sense slots (current, then voltage), which speakersafetyd's + * J575 model reads. The front-end carries all six channels; the last four + * are silent. + */ +struct macaudio_platform_cfg macaudio_j575c_cfg = { + .enable_speakers = true, + .amp = AMP_SN012776, + .speakers = SPKR_1W, + .stereo = false, + .safe_vol = -20, + .fe_dai_names = { "j616-pcm-0", "j616-pcm-1", "j616-pcm-2" }, + .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBC_CFC | + SND_SOC_DAIFMT_GATED | SND_SOC_DAIFMT_NB_IF, + .secondary_bclk_ratio = 250, + .fe_cpu_is_platform = true, + /* No headphone codec on this card: the jack is a card of its own. */ + .route_only_fes = BIT(0), + .speaker_fe_channels = 6, +}; + +/* + * J773 (Mac mini, M4 Pro): one SN012776 on the AOP's speaker stream. The + * speaker has not been brought up and has no protection profile, so keep it + * off as on the J614s: the speaker link is not bound. */ struct macaudio_platform_cfg macaudio_j575c_j773_cfg = { .enable_speakers = false, @@ -4230,8 +4254,8 @@ static const struct of_device_id macaudio_snd_device_id[] = { /* j514 AID28 sn012776 15 2x 2W+1T Compat: apple,j314-macaudio */ /* j516 AID29 sn012776 15 2x 2W+1T Compat: apple,j316-macaudio */ /* j575 AID33 sn012776 15 1x 1W Compat: apple,j375-macaudio */ - /* j575c - sn012776 - 1x 1W (AOP-fed; speaker off until bring-up) */ - { .compatible = "apple,j575c-macaudio", .data = &macaudio_j575c_j773_cfg }, + /* j575c - sn012776 - 1x 1W (AOP-fed) */ + { .compatible = "apple,j575c-macaudio", .data = &macaudio_j575c_cfg }, /* j575c - cs42l84 - the jack, a card of its own (AOP-fed) */ { .compatible = "apple,j575c-macaudio-jack", .data = &macaudio_j616_jack_cfg }, /* j613 AID20 sn012776 15 2x 1W+1T Compat: apple,j413-macaudio */ From 34d37e647c7e436d4e17c4d8520fca057deb0fb4 Mon Sep 17 00:00:00 2001 From: Roberto Dantas <7robertodantas@gmail.com> Date: Wed, 11 Nov 2026 14:33:26 -0300 Subject: [PATCH 3/4] dt-bindings: sound: apple,t6041-aop-audio: speakers and jack without microphones A Mac without microphones (the Mac mini and Mac Studio) lists no "dma" channel. Its node could describe the headset jack alone, but not the speakers too: allow "spkr", "sense", "cout" and "cin" (the J575c, Mac Studio M4 Max). Signed-off-by: Roberto Dantas <7robertodantas@gmail.com> Assisted-by: LLM (Claude Code) Co-Authored-By: Claude Opus 5.5 --- .../bindings/sound/apple,t6041-aop-audio.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/apple,t6041-aop-audio.yaml b/Documentation/devicetree/bindings/sound/apple,t6041-aop-audio.yaml index ed77d983a10b2..8c0b1928ef207 100644 --- a/Documentation/devicetree/bindings/sound/apple,t6041-aop-audio.yaml +++ b/Documentation/devicetree/bindings/sound/apple,t6041-aop-audio.yaml @@ -63,6 +63,13 @@ properties: - description: The microphones only items: - const: dma + - description: + The speakers and the headset jack, on a Mac without microphones + items: + - const: spkr + - const: sense + - const: cout + - const: cin - description: The microphones and the headset jack items: - const: dma @@ -143,3 +150,14 @@ examples: #sound-dai-cells = <1>; }; }; + - | + aop { + audio { + compatible = "apple,t6041-aop-audio", "apple,t6030-aop-audio"; + apple,chassis-name = "J575"; + apple,machine-kind = "Mac Studio"; + dmas = <&admac1 0>, <&admac1 1>, <&admac1 4>, <&admac1 5>; + dma-names = "spkr", "sense", "cout", "cin"; + #sound-dai-cells = <1>; + }; + }; From 8c4d009db1e7ed04ea707ceb88b2b3a9af3fea9e Mon Sep 17 00:00:00 2001 From: Roberto Dantas <7robertodantas@gmail.com> Date: Wed, 11 Nov 2026 14:31:14 -0300 Subject: [PATCH 4/4] arm64: dts: apple: t6041-j575c: enable the speaker The J575c's speaker amp, its I2C bus and its sound card were disabled, and the AOP audio node listed only the headphone jack's streams. Enable them, with the speaker stream (base-ns ADMAC TX0) and its sense (RX0) on the AOP audio node, as on the J616s. The amp's address and interrupt, guessed until now, are the ADT's (/arm-io/i2c1/audio-speaker: 0x38, AP pin 55), as is its shutdown line (function-reset: AP pin 54). The amp loses its "Speaker" name prefix: like the J375's single amp, its controls are the card's plain "Speaker Volume", "Amp Gain Volume", "VSENSE Switch" and "ISENSE Switch", the names macaudio's mono fixups, the Mac Studio UCM profile and speakersafetyd's J575 model use (with the prefix, macaudio's control fixup fails and the card does not bind). The boot loader passes the amp's ADT configuration (apple,speaker-config 00 14 00 02, apple,bop-config, apple,amp-dcblocker-config). Until a protection daemon takes the volume lock, macaudio holds the amp at its lowest volume step. Signed-off-by: Roberto Dantas <7robertodantas@gmail.com> Assisted-by: LLM (Claude Code) Co-Authored-By: Claude Opus 5.5 --- arch/arm64/boot/dts/apple/t6041-j575c.dts | 25 +++++++++++++---------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/arch/arm64/boot/dts/apple/t6041-j575c.dts b/arch/arm64/boot/dts/apple/t6041-j575c.dts index de0d491d90ca1..b16f5df47939b 100644 --- a/arch/arm64/boot/dts/apple/t6041-j575c.dts +++ b/arch/arm64/boot/dts/apple/t6041-j575c.dts @@ -889,7 +889,7 @@ }; / { - /* guess: the SDZ line of the J616c and J773s, AP pin 54 */ + /* ADT audio-speaker function-reset: AP pin 54 (0x36) */ speaker_sdz: regulator-sn012776-sdz { compatible = "regulator-fixed"; regulator-name = "sn012776-sdz"; @@ -898,16 +898,15 @@ }; /* - * The speaker stays off: it has no bring-up and no protection - * profile. The card, the amp and the AOP speaker stream are all left - * out or disabled. + * The speaker: the AOP audio component's speaker back-end (DAI 3) to + * the SN012776. The card holds the amp at its lowest volume step until + * a protection daemon takes the volume lock. */ sound: sound { compatible = "apple,j575c-macaudio", "apple,macaudio"; model = "Mac Studio J575"; #address-cells = <1>; #size-cells = <0>; - status = "disabled"; dai-link@0 { reg = <0>; @@ -964,26 +963,30 @@ status = "okay"; }; -/* No microphones: only the jack's streams, as on the J773s. */ +/* + * No microphones. ADT iop-audio-controller: the speaker stream on base-ns + * ADMAC channel 0 (TX0), the jack's on channels 4 and 5. The firmware runs + * the speaker serializer in the J616s frame, sense included, on RX0. + */ &aop_audio { - dmas = <&admac1 4>, <&admac1 5>; - dma-names = "cout", "cin"; + dmas = <&admac1 0>, <&admac1 1>, <&admac1 4>, <&admac1 5>; + dma-names = "spkr", "sense", "cout", "cin"; apple,chassis-name = "J575"; apple,machine-kind = "Mac Studio"; }; -/* guess: one SN012776 at 0x38 as on the J773s and J575d, interrupt AP 55 */ +/* ADT /arm-io/i2c1/audio-speaker: one SN012776 at 0x38, interrupt AP 55 */ &i2c1 { + status = "okay"; + speaker: codec@38 { compatible = "ti,sn012776", "ti,tas2764"; reg = <0x38>; SDZ-supply = <&speaker_sdz>; #sound-dai-cells = <0>; - sound-name-prefix = "Speaker"; interrupts-extended = <&pinctrl 55 IRQ_TYPE_LEVEL_LOW>; ti,imon-slot-no = <0>; ti,vmon-slot-no = <2>; - status = "disabled"; }; };