Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Documentation/devicetree/bindings/sound/apple,t6041-aop-audio.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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>;
};
};
25 changes: 14 additions & 11 deletions arch/arm64/boot/dts/apple/t6041-j575c.dts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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>;
Expand Down Expand Up @@ -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";
};
};

Expand Down
47 changes: 41 additions & 6 deletions sound/soc/apple/macaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) */
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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 */
Expand Down
Loading