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>; + }; + }; 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"; }; }; diff --git a/sound/soc/apple/macaudio.c b/sound/soc/apple/macaudio.c index 4e1b642e4b0a5..067a411b286f3 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) */ @@ -4085,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, @@ -4219,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 */