SSD_TinyAlsa Usage Reference


1. Overview

The Alsa usage scenario was not considered in the design of the Audio architecture of SSD20X, so currently only TinyAlsa related playback/recording operations are performed, and Alsa operation is not supported such as Dmix operations, etc.


2. Platform alsa support needs to depend on config

  1. alsa needs to rely on the config of the kernel. The config that the kernel needs to enable is as follows (use make menuconfig to configure)

    CONFIG_PM = y

    CONFIG_SOUND = m

    CONFIG_SND = m

    CONFIG_SND_PCM_OSS = m

    CONFIG_SND_PCM_TIMER = y

    kernel will generate:

    insmod soundcore.ko

    insmod snd.ko

    insmod snd-timer.ko

    insmod snd-pcm.ko

  2. insmod mi_alsa.ko


3. alsa test method: use standard Tinyalsa test

Platform alsa can directly use the standard tinyalsa bin to test, but, because tinyalsa itself is also following the kernel version, for the ALSA adaptation of our SSD platform, it is recommended to use tinyalsa1.1.1 version test, the following is the tested version of tinyalsa information:

  1. Use Tinyalsa's source code to obtain

    URL: https://github.com/tinyalsa/tinyalsa/tree/1.1.1

    Download: git clone https://github.com/tinyalsa/tinyalsa.git

  2. tinyalsa compilation

    Configure the build chain:

    export ARCH = arm
    
    export CROSS_COMPILE = arm-linux-gnueabihf-
    
    export CC = $(CROSS_COMPILE)gcc
    

    Run directly in the tinyalsa root directory:

    make clean; make
    
  3. Generated test bin

    Build directory: tinyalsa/utils bin: tinycap/tinymix/tinypcminfo/tinyplay

  4. Test bin basic test command

    tinyplay play test:

    ./tinyplay *.wav
    

    tinypcminfo View information about the pcm channel:

    ./tinypcminfo -D 0
    

    tinycap recording test:

    ./tinycap cap_out.wav
    

    tinymix set and get volume:

    ./ tinymix contents //View the relevant properties of the corresponding Dev
    
    ./ tintmix set 1 60 //Set the volume of the corresponding Dev, here is to get dev=1
    
    ./ tinymix get 1 //Get the current volume of the corresponding Dev, here is to get dev=1
    

4. Platform feature description

AO description:

a. Some versions of Tinyalsa restrict gain from setting negative values, so map AO gain [-60, 30] to [0, 90 ], such as: -60→0, 30→90.

b. If mi_alsa is used, Lineout does not support sampling rate 12k, 24k ( alsa itself is limited); Supported sampling rate: 8k, 11.025k, 16k, 22.05k, 32k, 44.1k, 48k; Lineout supports 1chn mono or stereo .

c. The upper layer of Alsa/Tinyalsa cannot download I2S parameters temporarily: eWorkmode, bSyncClock, eFmt, eMclk, which will be limited when using I2S.