DEV Community

ronnie R
ronnie R

Posted on

Allwinner T507 Audio System: DMA Channel, Audio Hub Configuration and Test Guide

This guide provides a concise overview of the audio system on the Allwinner T507 platform, covering the DMA transfer mechanism, Audio Hub configuration methods, and commonly used audio testing tools. It is intended to help developers quickly set up and validate audio functionality.

When a DMA channel sound card records or plays digital audio, it uses the DMA channel to transfer audio data between itself and RAM without CPU intervention to improve the data transfer rate and CPU utilization.

T507 Audio System
T507 Audio System: DMA Channel, Audio Hub Configuration and Test Guide

Audio codec, Audio Hub, DMIC, OWA(One Wire Audio)

Audio codec: Built-in module with digital-to-analog conversion to convert audio digital signals to analog signals.

Audio Hub: T507-specific module integrates basic audio input and output functions and special hardware mixing functions. The mixing function has three input terminals and 4 x I2S, which can complete the mixing of three channels of data. The mixed data is output through HDMI, I2S0, I2S2 and I2S3.

T507 Audio System: DMA Channel, Audio Hub Configuration and Test Guide

T507 Audio System: DMA Channel, Audio Hub Configuration and Test Guide

Audio Path Configuration
To view the current audio device node on the system:

root@forlinx:/# cat /proc/asound/cards
0 [audiocodec ]: audiocodec - audiocodec //codec corresponding card0
audiocodec
1 [sndahub ]: sndahub - sndahub //audio_hub corresponding card1
sndahub
2 [sndhdmi ]: sndhdmi - sndhdmi //hdmi corresponding card2
sndhdmi
3 [sndwm89603001a ]: sndwm8960_3-001 - sndwm8960.3-001a //8960 corresponding card3
sndwm8960.3-001a

root@forlinx:/proc/asound# cat devices
0: [ 0] : control //device 0
16: [ 0- 0]: digital audio playback
24: [ 0- 0]: digital audio capture
32: [ 1] : control //device 1
33: : timer
48: [ 1- 0]: digital audio playback //APBIF_TXDIF0 play hub_device 0
49: [ 1- 1]: digital audio playback //APBIF_TXDIF1 play hub_device 1
50: [ 1- 2]: digital audio playback //APBIF_TXDIF2 play hub_device 2
56: [ 1- 0]: digital audio capture //APBIF0 play hub_device 0
57: [ 1- 1]: digital audio capture //APBIF1 play hub_device 1
58: [ 1- 2]: digital audio capture //APBIF2 play hub_device 2
64: [ 2] : control //device 2
80: [ 2- 0]: digital audio playback
96: [ 3] : control //device 3
112: [ 3- 0]: digital audio playback

120: [ 3- 0]: digital audio capture
Audio_hub Default Configuration
Default i2s3 configuration

root@forlinx:/# tinymix -D 1
Mixer name: 'sndahub'
Number of controls: 26
ctl type num name value
0 ENUM 1 ahub audio format Function null
1 BOOL 1 I2S0IN Switch Off
2 BOOL 1 I2S0OUT Switch Off
3 BOOL 1 I2S1IN Switch Off
4 BOOL 1 I2S1OUT Switch On
5 BOOL 1 I2S2IN Switch Off
6 BOOL 1 I2S2OUT Switch Off
7 BOOL 1 I2S3IN Switch On
8 BOOL 1 I2S3OUT Switch On
9 BOOL 1 DAM0IN Switch Off
10 BOOL 1 DAM1IN Switch Off
11 BOOL 1 DAM0OUT Switch Off
12 BOOL 1 DAM1OUT Switch Off
13 ENUM 1 APBIF0 Src Select NONE
14 ENUM 1 APBIF1 Src Select I2S3_TXDIF
15 ENUM 1 APBIF2 Src Select NONE
16 ENUM 1 I2S0 Src Select NONE
17 ENUM 1 I2S1 Src Select APBIF_TXDIF0
18 ENUM 1 I2S2 Src Select NONE
19 ENUM 1 I2S3 Src Select APBIF_TXDIF1
20 ENUM 1 DAM0Chan0 Src Select NONE
21 ENUM 1 DAM0Chan1 Src Select NONE
22 ENUM 1 DAM0Chan2 Src Select NONE
23 ENUM 1 DAM1Chan0 Src Select NONE
24 ENUM 1 DAM1Chan1 Src Select NONE
25 ENUM 1 DAM1Chan2 Src Select NONE
I2s0 Recommended Configuration

tinymix -D 1 1 1 //Open input for i2s0
tinymix -D 1 2 1 //Open output for i2s0
tinymix -D 1 7 0 //Close i2s3 input
tinymix -D 1 8 0 //Close i2s3 output
tinymix -D 1 14 I2S0_TXDIF
tinymix -D 1 16 APBIF_TXDIF1
tinymix -D 1 19 NONE
I2s2 Recommended Configuration

tinymix -D 1 1 1 //Open input for i2s2
tinymix -D 1 6 1 //Open output for i2s0
tinymix -D 1 7 0 //Close i2s3 input
tinymix -D 1 8 0 //Close i2s3 output
tinymix -D 1 14 I2S2_TXDIF
tinymix -D 1 18 APBIF_TXDIF1
tinymix -D 1 19 NONE
The configuration of audio channels will affect the use of test routines:

Before conducting the playback test, please insert the prepared 3.5mm headphones into the HeadPhone interface. To play sound through the speaker, insert the pin wires of the prepared speaker (SPK_RP and SPK_LN) into the P32 or P31 interface.

T507 Audio System: DMA Channel, Audio Hub Configuration and Test Guide

Introduction to Testing Tools

  1. alsa - utils: These are standard ALSA tools that utilize the alsa - lib standard library. Commonly used tools include amixer, aplay, arecord, alsaconf, etc.

  2. tinyalsa: It is a simplified version of alsa - lib. It provides basic interfaces for PCM and control, and the interfaces can be used as needed. Commonly used tools are tinymix, tinyplay, tinycap.

T507 Audio Test Tool
The alsa-utils standard ALSA tool uses the alsa-lib standard library. Commonly used are amixer, aplay, arecord, alsaconf

tinyalsa is a simplified version of alsa-lib. It provides the basic interfaces for PCM and control, which can be used on demand. Commonly used tools are tinymix, tinyplay, tinycap1

  1. codec (LINEOUT)

only DAC, no ADC. Therefore, it can only play, not record, and audio _ hub is not used.Play commands use aplay or tinyplay

aplay -Dhw:0,0 mic.wav

  1. For the 8960 (external audio chip), its I2S signal passes through the audio_hub, which is a module unique to Allwinner. Audio recording using this.

Audio_hub (with the 8960):

root@forlinx:tinycap_ahub mic.wav -aD 1 -ad 1 -D 3 -d 0 -t 30 -b 16 -c 2 -p 1024
Usage: tinycap_ahub file.wav [-aD ahub card] [-ad ahub device] [-D card] [-d device][-c channels] [-r rate] [-b bits] [-p period_size] [-n n_periods] [-t seconds]
Audio_hub play (8960):

root@forlinx:tinyplay_ahub mic.wav -aD 1 -ad 1 -D 3
Usage: tinyplay_ahub file.wav [-aD ahub card] [-ad ahub device] [-D card] [-d device] [-p period_size] [-n n_periods]

Top comments (1)

Collapse
 
outrine profile image
Timur Horodny

Hi! Have you had any experience running audio with Pulseaudio?