2021-08-20
Since the sound drivers will have a couple of changes I am writing this note for the people of #asahi.
The ALSA card now has devices Primary
/hw:0,0
and Secondary
/hw:0,1
. Routing of audio from the devices to speakers/headphones depends on the state of the card's controls (those seen in alsamixer). By default both headphones/speakers are routed to the primary device, with one or the other being enabled based on the plug state of the jack connector. You can override that. To drive all the speakers on large (>2ch) speaker arrays, you need to use the secondary device. So you set the Speaker Playback Mux
to Secondary
, then stream audio to hw:0,1
. This is because the primary device has some parameters set to appease the jack codec -- this limitation may be lifted in the future.
Anyway, such details should be hidden in proper userspace configuration, which we have yet to write.
The machine driver now sets volume caps and locks some other controls. This is done in a fixup_controls
method specific to each machine model. I have written those for j274 (Mac mini) and j314/316 (2021 Macbook Pros), but for the other models it is missing. The driver refuses probe if all: 1. the method is missing for the model in question, 2. speakers are enabled in DT, and 3. snd-soc-macaudio.void_warranty=1
isn't passed to the kernel.
You can help write the methods by obtaining a trace of macOS booting and doing playback on the speakers with the hv/trace_codecs.py
script. This is really just to see what volume level macOS sets. (Ideally you take the trace with setting the full user volume in macOS, although it appears macOS doesn't propagate the user volume into codecs to any extent.)
-
We now set the OCE_RETRY bit on TAS2764 speaker amps so that they retry unmute after an overcurrent event. This is to counter the dropouts of old. The other workaround didn't prove solid.
-
The 'DC blocker' highpass filter of the speaker amps is now exported to userspace for the woofers and locked at 800 Hz for the tweeters.
With the CS42L84 driver we should now have jack support everywhere (hooray!), that is pending the DTs are correct. The driver was tested on j314. It is able of both playback and capture. The mic detection is hand-rolled by me, it is at the moment limited to CTIA (non-China) wiring of the jack, and it is plausible there are issues with it.
-
Machine driver name (important for userspace to lock on) is now
snd-soc-macaudio
-
J314/J316 now have distinct model strings on the ALSA card