Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ properties:
- apple,j715-macaudio-jack
- apple,j773-macaudio
- apple,j773-macaudio-jack
- apple,j773g-macaudio
- apple,j813-macaudio
- apple,j815-macaudio
- apple,j873-macaudio
Expand Down
47 changes: 36 additions & 11 deletions arch/arm64/boot/dts/apple/t8132-j773g.dts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,34 @@
enable-active-high;
};

/*
* The speaker: the AOP audio component's speaker back-end (DAI 3) to
* the SN012776. Its playback waits for a protection lease (macaudio).
*/
sound: sound {
compatible = "apple,j773g-macaudio", "apple,macaudio";
model = "Mac mini J773g";
#address-cells = <1>;
#size-cells = <0>;

dai-link@0 {
reg = <0>;
link-name = "Speaker";

cpu {
sound-dai = <&aop_audio 3>;
};

codec {
sound-dai = <&speaker>;
};
};
};

/*
* The headphone jack: the AOP audio component's jack back-end (DAI 4)
* to the CS42L84 (ADT /arm-io/i2c1/audio-codec-output), a card of its
* own as on the M4 Pro Mac mini. The speaker has no card yet.
* own as on the M4 Pro Mac mini.
*/
sound_jack: sound-jack {
compatible = "apple,j773-macaudio-jack", "apple,macaudio";
Expand Down Expand Up @@ -78,22 +102,24 @@
};

/*
* No microphones (ADT iop-audio-controller has no audio-hp): only the jack's
* streams, "cout" and "cin" on base-ns ADMAC channels 4 and 5 (ADT
* audio-codec-output and audio-codec-input), as on the M4 Pro Mac mini.
* Without a "dma" channel the AOP audio component attaches no PDM device.
* No microphones (ADT iop-audio-controller has no audio-hp): the speaker's
* stream, "spkr" on base-ns ADMAC channel 0 (ADT audio-speaker, which lists
* no RX channel, so no "sense"), and the jack's, "cout" and "cin" on
* channels 4 and 5 (ADT audio-codec-output and audio-codec-input), as on the
* M4 Pro Mac mini. Without a "dma" channel the AOP audio component attaches
* no PDM device.
*/
&aop_audio {
dmas = <&admac1 4>, <&admac1 5>;
dma-names = "cout", "cin";
dmas = <&admac1 0>, <&admac1 4>, <&admac1 5>;
dma-names = "spkr", "cout", "cin";
apple,chassis-name = "J773g";
apple,machine-kind = "Mac mini";
};

/*
* The SN012776 speaker amp (ADT /arm-io/i2c3/audio-speaker at 0x38, mono,
* speaker-protection 0): interrupt on AP GPIO 14, level low. Disabled
* until the speaker has a sound card and a protection profile.
* speaker-protection 0): interrupt on AP GPIO 14, level low, held in
* hardware shutdown until the sound card enables it.
*/
&i2c3 {
status = "okay";
Expand All @@ -105,11 +131,10 @@
apple,sdz-group-fail-closed;
apple,deferred-shutdown;
#sound-dai-cells = <0>;
sound-name-prefix = "Speaker";
/* No sound-name-prefix: a mono speaker's controls go unprefixed (macaudio). */
interrupts-extended = <&pinctrl_ap 14 IRQ_TYPE_LEVEL_LOW>;
ti,imon-slot-no = <0>;
ti,vmon-slot-no = <2>;
status = "disabled";
};
};

Expand Down
8 changes: 7 additions & 1 deletion sound/soc/apple/aop_spkr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1679,7 +1679,13 @@ pub(crate) struct SpeakerComponent {

impl SpeakerComponent {
pub(crate) fn register(aop: Arc<SndSocAopData>) -> Result<Self> {
let spkr = Service::new(aop.clone(), AUDIO_DEV_SPKR, "spkr", PWRD_OUTPUT, true)?;
// A Mac whose speaker stream has no sense channel (the Mac mini: its ADT
// audio-speaker stream lists no RX channel) runs the speakers without the ring.
let has_sense = aop
.fwnode
.property_match_string(c_str!("dma-names"), c_str!("sense"))
.is_ok();
let spkr = Service::new(aop.clone(), AUDIO_DEV_SPKR, "spkr", PWRD_OUTPUT, has_sense)?;
let cout = Service::new(aop.clone(), AUDIO_DEV_COUT, "cout", PWRD_OUTPUT, false)?;
let cin = Service::new(aop.clone(), AUDIO_DEV_CIN, "cin", PWRD_INPUT, false)?;
let services = [&spkr, &cout, &cin];
Expand Down
28 changes: 28 additions & 0 deletions sound/soc/apple/macaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -4286,6 +4286,32 @@ struct macaudio_platform_cfg macaudio_j575c_j773_cfg = {
.route_only_fes = BIT(0),
};

/*
* J773g (T8132, Mac mini M4): one SN012776 on the AOP's speaker stream, the
* J713's frame (250 BCLKs of 12 MHz, six 32-bit playback slots, which the
* firmware runs whole although the ADT's audio-speaker lists one), the amp on
* the first slot. The stream has no sense channel (the ADT's audio-speaker
* lists no RX channel and the amp's speaker-protection is 0), so there is no
* V/I to read: playback waits for a protection lease (macaudio_spk_admitted()),
* which only speakerguardd v2 takes, with a feed-forward unit compiled from
* this Mac's own tuning. Without it the speaker stays silent.
*/
struct macaudio_platform_cfg macaudio_j773g_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,
};

/*
* J713 (T8132, MacBook Air 13" M4): the J616s stream, six 32-bit playback
* and twelve 16-bit sense slots in the same 250-bit frame, with four
Expand Down Expand Up @@ -4443,6 +4469,8 @@ static const struct of_device_id macaudio_snd_device_id[] = {
{ .compatible = "apple,j773-macaudio", .data = &macaudio_j575c_j773_cfg },
/* j773 - cs42l84 - the jack, a card of its own (AOP-fed) */
{ .compatible = "apple,j773-macaudio-jack", .data = &macaudio_j616_jack_cfg },
/* j773g - sn012776 15 1x 1W (AOP-fed, no V/I sense) */
{ .compatible = "apple,j773g-macaudio", .data = &macaudio_j773g_cfg },
/* j873 AID48 sn012776 15 1x 1W (AOP-fed, no protection) */
{ .compatible = "apple,j873-macaudio", .data = &macaudio_j873_cfg },
/* j813 AID? sn012776 15 2x 1W+1T (AOP-fed, V/I sense) */
Expand Down