Skip to content

Instantly share code, notes, and snippets.

@calebccff
Last active May 15, 2022 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save calebccff/8f81d1e63b147be8993b8e3d0095fe97 to your computer and use it in GitHub Desktop.
Save calebccff/8f81d1e63b147be8993b8e3d0095fe97 to your computer and use it in GitHub Desktop.
Qualcomm sound architecture notes

Qcom (sdm845) audio

db410c notes

From 96boards docsdragonboard/dragonboard410c/guides/enable-ls-i2s.md.html

  • Primary MI2S - Supports only playback
  • Secondary MI2S - Supports only playback
  • Tertiary MI2S - Supports only capture
  • Quatenary MI2S - Supports both playback and capture

Primary and Secondary I2S interfaces are connected to External Primary TLMM via Mux1. Teritary and Quatenary I2S interfaces are connected to External Secondary TLMM via Mux2.

By default, internal WCD codec in APQ8016 occupies Primary MI2S for playback and Teritary MI2S for capture. On the other hand, external codec (ADV7533) present on the Dragonboard410c occupies Quatenary MI2S for playback.

NOTE: As far as I can tell SDM845 is not at all similar to this

Layout

The DT sound node defines available links and routing between sources/sinks. The hardware has 8 "mixers", MultiMedia[1..8]

Digital audio interfaces

CPU, platform and codec DAIs are defined in the sound node. Summary can be found in this nice article

diagram

CPU DAI

The CPU DAI handles physical audio links - like a PHY (?). It does I2S, SPDIF, PCM etc...

Codec DAI

The codec DAI handles audio controls, volume, mixing, routing etc.

Platform DAI

The platform DAI does stuff like audio DMA? On sdm845 it's for q6routing for SLIM and MI2s devices.

Mixer controls

blah.. Audio Mixer MultiMedia[1..8]

MultiMedia[1..8] are the "endpoints" which show up as capture/playback devices in userspace, controls are mixed to them, e.g.

QUATERNARY_MI2S Audio Mixer MultiMedia1 - enables routing sound playback into MultiMedia1 to the QUAT MI2S interface.

For capture it would be MultiMedia1 Audio Mixer QUATERNARY_MI2S

Worth noting that RX on the codec represents a playback device, e.g. SLIM_RX0.

WCD934x

7 SLIMBUS RX channels (for playback)

  • RX0 - Earpiece
  • RX1 - Headphone Left
  • RX2 - Headphone Right
  • RX3 - Hifi LineOut 1
  • RX4 - Hifi LineOut 2
  • RX5/6 - N/A ?
  • RX7 - Speaker left out PA (unused on most form factor devices)
  • RX8 - Speaker right out PA

General bringup

I'm not sure if all of these are needed, it's also possible that RXn refers to something different than above? Without access to the WCD934x docs we can't know how the muxes, routing and interfaces work entirely.

Control Value
SLIM RX0 MUX AIF1_PB
SLIM RX1 MUX AIF1_PB
SLIM RX2 MUX AIF1_PB
SLIM RX3 MUX AIF1_PB

Earpiece

For earpiece playback from AIF1_PB the following controls must be set:

Control Value
RX INT0_1 MIX1 INP0 RX0
RX INT0 DEM MUX CLSH_DSM_OUT
RX INT0_1 INTERP RX INT0_1 MIX1

volume can be set with the RX0 Digital Volume control

Headphones

Downstream seems to make use of the AIF_PB4 playback interface on the wcd934x codec for the headphones (AIF1 for the earpiece?), I'm not sure how to represent that nicely on mainline, perhaps we could use MultiMedia4 and route that. For now the headphone configuration is pretty weird.

According to the kernel driver, RX1 and RX2 are for headphones, but both here and in downstream we reference RX2 and RX3, I don't fully understand these controls.

Control Value
RX INT1 DEM MUX CLSH_DSM_OUT
RX INT2 DEM MUX CLSH_DSM_OUT
RX INT1_1 INTERP RX INT1_1 MIX1
RX INT2_1 INTERP RX INT2_1 MIX1
RX INT1_1 MIX1 INP0 RX2
RX INT2_1 MIX1 INP0 RX3
RX INT1_2 MUX RX0
RX INT2_2 MUX RX1

Glossary

Acronym Meaning
DAI Digital Audio Interface
I2S Inter-IC Sound Standard
MI2S Multi-channel Inter-IC Sound Standard
SLIMbus Serial Lower Power Interchip Media Bus
DMIC Digital Microphone Interface
AIF Audio Interface _
TDM Time Division Multiplexing - multiplex multiple streams into a single sample buffer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment