Skip to content

Audio

TL;DR. The card PICO4 is mainline's SM8250 machine driver with the PICO 4's routing: two speakers and the microphone, PICO OS's routes and levels, and PICO OS's calibration loaded into the audio DSP. Speakers and microphone are as loud as on the stock kernel. Part of the system (userspace.md).

The card

The card PICO4 is mainline's SM8250 machine driver with the PICO's routing in the device tree (kernel.md): two WSA8810 speakers on the WSA macro's SoundWire (units 1 and 2), the WCD9380 on the RX and TX SoundWire buses (units 4 and 3), the LPASS macros and the DSP's APR services (AFE, ASM, ADM). Bring-up:

  1. pico4-adsp boots the ADSP through remoteproc (remoteproc-boot).
  2. pico4-audiopd starts the audio process on upstream FastRPC (audiopd, /dev/fastrpc-adsp): hexagonrpcd -P creates it with FASTRPC_IOCTL_INIT_CREATE_STATIC, backed by the stock remote heap (12 MiB of CMA), which the driver gives to the DSP's VMs (LPASS, ADSP heap) as the stock tree does.
  3. lpass-macros probes the VA macro again once the audio process runs: its probe votes the LPASS hardware through the AFE, which refuses until then, and a failed probe is final. The driver has no bind file, so it uses the platform bus's drivers_probe. The other macros, the SoundWire buses and the card follow.

The UCM profile (ucm2/conf.d/sm8250/PICO4.conf) has PICO OS's routes and levels under mainline's control names. Playback is on MultiMedia1 (PCM 0), capture on MultiMedia2 (PCM 1): mainline's ASM front end runs one stream at a time. Speaker voltage and current sense stays off. PICO OS's speaker protection is off too (speaker.prot.enable=false), and PICO OS has no volume cap (cooling.md).

Calibration. PICO OS's calibration reaches the ADSP through the PICO's q6 calibration driver (q6calibration-pico4.c, the kernel commit “ASoC: qcom: q6: PICO OS's audio calibration”), which does what the stock kernel does with the blocks PICO OS's HAL hands it:

  1. At image build, pico4-audiocal export reads PICO OS's calibration database and writes /usr/lib/firmware/qcom/sm8250/pico4/audio-calibration.bin: the custom topologies, and per path its AFE port, ADM topology and parameters (processing blocks and the volume table's step 0). The speakers (WSA_CODEC_DMA_RX_0) get topology 0x11000003 with 1376 bytes of parameters, the microphone (TX_CODEC_DMA_TX_3) 0x10010315 with 728.
  2. The driver maps a buffer through the audio SMMU stream and registers the custom topologies with the ADSP core (earlier ones dropped first, as the stock driver does). The ADSP accepts it only once PICO OS's audio process runs and on some boots a while later, so pico4-lpass-macros probes the driver again every 2 s once the card is up, for up to a minute. Without it the sound has none of PICO's processing.
  3. q6routing opens each calibrated path with its topology and sends its parameters in band after the open. A path without calibration, or whose topology the ADSP refuses, keeps the null topology.

The card as the stock kernel runs it. Every device path, with PICO's processing, runs at 16 bits (the kernel commit “ASoC: qcom: the DSP's stream and port as the stock kernel runs them”; the stock back end reads S16_LE although PICO OS's platform configuration names 24 for the speakers). The ADSP's 24-bit PCM has its samples in the top 24 bits of a 32-bit word, so the front end offers it as S32_LE (the kernel commit “ASoC: qcom: the DSP's 24-bit PCM by its name”), which PipeWire picks for both directions. The amplifiers and the WSA macro run with the registers the stock kernel has during playback (the kernel commit “ASoC: the speakers' amplifiers and codec path as the stock kernel runs them”): the compander sets the amplifier's gain over its COMP port, with its boost, over-current and path settings. The DSP's stream and port get the stock topologies (the kernel commit “ASoC: qcom: the DSP's stream and port as the stock kernel runs them”), the speakers' SoundWire bus its synchronization period and port offsets (the kernel commit “soundwire: qcom: the frame's sync points and the port offsets as the stock kernel programs them”).

Levels. The profile's verb sets PICO OS's levels (WSA_RXn Digital Volume 84, 0 dB; TX_DEC0 Volume 84; ADC1 Volume 12), the boost level and the routes each time the card opens; ALSA's saved state, restored at boot after the card's boot sequence, would otherwise keep whatever it holds. Around a playback the WSA macro's driver moves the digital volume by 2 steps (its gain offset) and keeps it there.

Do not change on a running system: VISENSE on (as the stock kernel has it) adds the sense port to the playback stream: thousands of bus clashes in seconds. COMP off leaves that port's enable set in the active bus bank: no sound and white noise on the right channel, with no kernel error. Switching back, with the PCM closed and the path powered down, recovers both.

Speakers and microphone together, the same sounds on the same headset at the same settings:

Sound Stock kernel This kernel
1 kHz from full scale fading 15 dB/s, volume 0.6, per 250 ms from its peak −41 −43 −47 −51 −55 dBFS −41.4 −45.1 −48.9 −52.6 −56.4 dBFS
Steam's volume sound, volume 0.52 repeats alike within 1 dB, into the room's noise the same shape, repeats alike

So they are as loud as on the stock kernel with PICO's levels. Speech at a normal distance records at about −34 to −40 dBFS. PICO OS processes recordings no further for apps (its audio_effects.xml adds echo cancellation and noise suppression to voice calls only, no gain).

Capture through a suspend

PipeWire restarts a capture stream that runs through a suspend at the wake. Upstream, its timer path takes the time from the planned wakeup, not the clock, so before data comes its next timeout is already over: the real-time thread spins until the kernel's RT watchdog kills it at 200 ms (RT Watchdog Timeout (hard): data-loop.0). The recording ends, and Steam's interface keeps a dead connection and stays silent until a restart. overpressure-spa-alsa takes that timeout from the clock: PipeWire survives, the burst is 0 or 1 tick of 10 ms, and the recording goes on. Interrupt scheduling (api.alsa.disable-tsched) is no alternative: its recordings stay empty.