Audio Routing and Configuration on Qualcomm Snapdragon 820 Platforms using ALSA

Audio Routing and Configuration on Qualcomm Snapdragon 820 Platforms using ALSAAudio bring up, routing and testing can be a demanding task without the right tools for the job. The ALSA (Advanced Linux Sound Architecture) project offers an excellent tool through a suite of hardware drivers, libraries and utilities which provide audio and MIDI functionality for the Linux operating system. ALSA is a software framework and part of the Linux kernel that provides an application programming interface (API) for sound card device drivers. It allows for automatic configuration of sound-card hardware and easy handling of multiple sound devices in a system.

On platforms running Android, the audio driver in the Linux kernel interacts with the hardware and HAL implementation. The android audio subsystem decouples the user space and kernel space implementation. TinyALSA, is a library used to interface with ALSA (Advanced Linux Sound Architecture) in the Linux Kernel and is recommended for the user portion of the driver because of its compatible licensing – ALSA is released under the GNU General Public License (GPL) and the GNU Lesser General Public License (LGPL).

On Android, the TinyALSA interface has been available since Android KitKat. This library consists of mainly four tools.

  • Tinyplay

Tinyplay is used for performing playback tests. It is a very simple music player and is used to check if the audio configurations are correct. Tinyplay can only play wav format 44.1kHz and 48kHz sampling rate. Eg:- tinyplay test.wav

  • Tinycap

Tinycap is a simple audio recording tool. This is used to check the audio inputs like digital mic’s and analog mic’s. The audio path needs to be configured after which the command to record the audio should be executed. The audio is saved in .wav format. The command runs till you type ctrl-c and quit the command.

  • Tinymix

Tinymix is used to get more details on the audio configuration parameters like gain etc. These configurations can also be modified using this command. An Audio path map is required to be able to make the correct configurations.

  • Tinypcminfo

Tinypcminfo is used to view information about the PCM channel. Information such as the sampling rate of the PCM, the number of channels, and the number of sampling points can be obtained.

The Tinyalsa tools listed above can be executed via adb shell to verify the necessary audio paths, controlling the audio codec and controlling the devices connected to the codec like handset, headset, speaker etc.

PCM playback over stereo speaker device

We share a procedure for verifying the audio paths on SMART Wireless’ Qualcomm Snapdragon 820 based platforms running Android for multiple use-cases below.

Use-case: PCM playback over stereo speaker device

Commands to Enable

tinymix 'SLIM RX0 MUX' 'AIF1_PB'
tinymix 'SLIM RX1 MUX' 'AIF1_PB'
tinymix 'SLIM_0_RX Channels' 'Two'
tinymix 'RX INT7_1 MIX1 INP0' 'RX0'
tinymix 'RX INT8_1 MIX1 INP0' 'RX1'
tinymix 'COMP7 Switch' 1
tinymix 'COMP8 Switch' 1
tinymix 'SpkrLeft COMP Switch' 1
tinymix 'SpkrLeft BOOST Switch' 1
tinymix 'SpkrLeft VISENSE Switch' 1
tinymix 'SpkrLeft SWR DAC_Port Switch' 1
tinymix 'SpkrRight COMP Switch' 1
tinymix 'SpkrRight BOOST Switch' 1
tinymix 'SpkrRight VISENSE Switch' 1
tinymix 'SpkrRight SWR DAC_Port Switch' 1
tinymix 'SLIMBUS_0_RX Audio Mixer MultiMedia1' 1
tinyplay /data/test.wav

Commands to Disable

tinymix 'SLIM RX0 MUX' 'ZERO'
tinymix 'SLIM RX1 MUX' 'ZERO'
tinymix 'RX INT7_1 MIX1 INP0' 'ZERO'
tinymix 'RX INT8_1 MIX1 INP0' 'ZERO'
tinymix 'COMP7 Switch' 0
tinymix 'COMP8 Switch' 0
tinymix 'SpkrLeft COMP Switch' 0
tinymix 'SpkrLeft BOOST Switch' 0
tinymix 'SpkrLeft VISENSE Switch' 0
tinymix 'SpkrLeft SWR DAC_Port Switch' 0
tinymix 'SpkrRight COMP Switch' 0
tinymix 'SpkrRight BOOST Switch' 0
tinymix 'SpkrRight VISENSE Switch' 0
tinymix 'SpkrRight SWR DAC_Port Switch' 0
tinymix 'SLIMBUS_0_RX Audio Mixer MultiMedia1' 0

Use-case: PCM playback over speaker device

Commands to Enable

RX7
tinymix 'SLIM RX0 MUX' 'AIF1_PB'
tinymix 'SLIM_0_RX Channels' 'One'
tinymix 'RX INT7_1 MIX1 INP0' 'RX0'
tinymix 'COMP7 Switch' 1
tinymix 'SpkrLeft COMP Switch' 1
tinymix 'SpkrLeft BOOST Switch' 1
tinymix 'SpkrLeft VISENSE Switch' 1
tinymix 'SpkrLeft SWR DAC_Port Switch' 1
tinymix 'SLIMBUS_0_RX Audio Mixer MultiMedia1' 1
tinyplay /data/test.wav
RX8
tinymix 'SLIM RX1 MUX' 'AIF1_PB'
tinymix 'SLIM_0_RX Channels' 'One'
tinymix 'RX INT8_1 MIX1 INP0' 'RX1'
tinymix 'COMP8 Switch' 1
tinymix 'SpkrRight COMP Switch' 1
tinymix 'SpkrRight BOOST Switch' 1
tinymix 'SpkrRight VISENSE Switch' 1
tinymix 'SpkrRight SWR DAC_Port Switch' 1
tinymix 'SLIMBUS_0_RX Audio Mixer MultiMedia1' 1
tinyplay /data/test.wav

Commands to Disable

RX7
tinymix 'SLIM RX0 MUX' 'ZERO'
tinymix 'RX INT7_1 MIX1 INP0' 'ZERO'
tinymix 'COMP7 Switch' 0
tinymix 'SpkrLeft COMP Switch' 0
tinymix 'SpkrLeft BOOST Switch' 0
tinymix 'SpkrLeft VISENSE Switch' 0
tinymix 'SpkrLeft SWR DAC_Port Switch' 0
tinymix 'SLIMBUS_0_RX Audio Mixer MultiMedia1' 0
RX8
tinymix 'SLIM RX1 MUX' 'ZERO'
tinymix 'RX INT8_1 MIX1 INP0' 'ZERO'
tinymix 'COMP8 Switch' 0
tinymix 'SpkrRight COMP Switch' 0
tinymix 'SpkrRight BOOST Switch' 0
tinymix 'SpkrRight VISENSE Switch' 0
tinymix 'SpkrRight SWR DAC_Port Switch' 0
tinymix 'SLIMBUS_0_RX Audio Mixer MultiMedia1' 0

Use-case: PCM playback over handset device

Commands to Enable

tinymix 'SLIM RX0 MUX' 'AIF1_PB'
tinymix 'SLIM_0_RX Channels' 'One'
tinymix 'RX INT0_1 MIX1 INP0' 'RX0'
tinymix 'SLIMBUS_0_RX Audio Mixer MultiMedia1' 1
tinymix 'RX INT0 DEM MUX' 'CLSH_DSM_OUT'
tinymix 'EAR PA Gain' 'G_6_DB'
tinyplay /data/test.wav

Commands to Disable

tinymix 'SLIM RX0 MUX' 'ZERO'
tinymix 'RX INT0_1 MIX1 INP0' 'ZERO'
tinymix 'SLIMBUS_0_RX Audio Mixer MultiMedia1' 0
tinymix 'RX INT0 DEM MUX' 'NORMAL_DSM_OUT'

Use-case: PCM playback over stereo headset – Class-H Low Power (LP), primary path and non-44.1 KHz

Commands to Enable

tinymix 'SLIM RX0 MUX' 'AIF1_PB'
tinymix 'SLIM RX1 MUX' 'AIF1_PB'
tinymix 'SLIM_0_RX Channels' 'Two'
tinymix 'RX INT1_1 MIX1 INP0' 'RX0'
tinymix 'RX INT2_1 MIX1 INP0' 'RX1'
tinymix 'SLIMBUS_0_RX Audio Mixer MultiMedia1' 1
tinymix 'RX INT1 DEM MUX' 'CLSH_DSM_OUT'
tinymix 'RX INT2 DEM MUX' 'CLSH_DSM_OUT'
tinymix 'COMP1 Switch' 1
tinymix 'COMP2 Switch' 1
tinymix 'RX HPH Mode' 'CLS_H_LP'
tinyplay /data/test.wav

Commands to Disable

tinymix 'SLIM RX0 MUX' 'ZERO'
tinymix 'SLIM RX1 MUX' 'ZERO'
tinymix 'RX INT1_1 MIX1 INP0' 'ZERO'
tinymix 'RX INT2_1 MIX1 INP0' 'ZERO'
tinymix 'SLIMBUS_0_RX Audio Mixer MultiMedia1' 0
tinymix 'COMP1 Switch' 1
tinymix 'COMP2 Switch' 1
tinymix 'RX HPH Mode' 'CLS_H_HIFI'

Use-case: PCM playback over lineout mono – Mixing path

Commands to Enable

tinymix 'SLIM RX0 MUX' 'AIF_MIX1_PB'
tinymix 'SLIM_0_RX Channels' 'One'
tinymix 'RX INT3_2 MUX' 'RX0'
tinymix 'SLIMBUS_0_RX Audio Mixer MultiMedia1' 1
tinymix 'COMP3 Switch' 1
tinyplay /data/test.wav

Commands to Disable

tinymix 'SLIM RX0 MUX' 'ZERO'
tinymix 'RX INT3_2 MUX' 'ZERO'
tinymix 'SLIMBUS_0_RX Audio Mixer MultiMedia1' 0
tinymix 'COMP3 Switch' 0

Use-case: PCM playback over lineout stereo – Primary path

Commands to Enable

tinymix 'SLIM RX0 MUX' 'AIF1_PB'
tinymix 'SLIM RX1 MUX' 'AIF1_PB'
tinymix 'SLIM_0_RX Channels' 'Two'
tinymix 'RX INT3_1 MIX1 INP0' 'RX0'
tinymix 'RX INT4_1 MIX1 INP0' 'RX1'
tinymix 'SLIMBUS_0_RX Audio Mixer MultiMedia1' 1
tinymix 'COMP3 Switch' 1
tinymix 'COMP4 Switch' 1
tinyplay /data/test.wav

Commands to Disable

tinymix 'SLIM RX0 MUX' 'ZERO'
tinymix 'SLIM RX1 MUX' 'ZERO'
tinymix 'RX INT3_1 MIX1 INP0' 'ZERO'
tinymix 'RX INT4_1 MIX1 INP0' 'ZERO'
tinymix 'SLIMBUS_0_RX Audio Mixer MultiMedia1' 0
tinymix 'COMP3 Switch' 0
tinymix 'COMP4 Switch' 0

Use-case: PCM recording over the headset (AMIC2 input)

Commands to Enable

tinymix 'SLIM_0_TX Channels' 'One'
tinymix 'AIF1_CAP Mixer SLIM TX6' 1
tinymix 'SLIM TX6 MUX' 'DEC6'
tinymix 'ADC MUX6' 'AMIC'
tinymix 'AMIC MUX6' 'ADC2'
tinymix 'DEC6 Volume' 84
tinymix 'MultiMedia1 Mixer SLIM_0_TX' 1
tinycap /data/amic2.wav -c 1 -r 48000

Commands to Disable

tinymix 'AIF1_CAP Mixer SLIM TX6' 0
tinymix 'SLIM TX6 MUX' 'ZERO'
tinymix 'ADC MUX6' 'DMIC'
tinymix 'AMIC MUX6' 'ZERO'
tinymix 'DEC6 Volume' 0
tinymix 'MultiMedia1 Mixer SLIM_0_TX' 0

Use-case: PCM recording over DMIC0 input

Commands to Enable

tinymix 'SLIM_0_TX Channels' 'One'
tinymix 'AIF1_CAP Mixer SLIM TX7' 1
tinymix 'SLIM TX7 MUX' 'DEC7'
tinymix 'ADC MUX7' 'DMIC'
tinymix 'DMIC MUX7' 'DMIC0'
tinymix 'DEC7 Volume' 84
tinymix 'MultiMedia1 Mixer SLIM_0_TX' 1
tinycap /data/dmic0.wav -c 1 -r 48000

Commands to Disable

tinymix 'AIF1_CAP Mixer SLIM TX7' 0
tinymix 'SLIM TX7 MUX' 'ZERO'
tinymix 'ADC MUX7' 'DMIC'
tinymix 'DMIC MUX7' 'ZERO'
tinymix 'DEC7 Volume' 0
tinymix 'MultiMedia1 Mixer SLIM_0_TX' 0

SMART Wireless would be glad to help you configure your audio requirements on products designed with our hardware.

mm

Ashwin Parthasarathi

Technical sales engineer at SMART Wireless

More Posts