Omapl137 linux audio driver
From Texas Instruments Embedded Processors Wiki
Agenda
- Overview - Audio features available
- DSK board
- Audio daughter card
- Driver Overview
- Architecture
- Configurations
- Open Source ALSA utilities
- Commands - Walk through
- Record and playback - Examples
Block diagram - DSK board and Audio daughter card
Audio features - DSK board
- AIC3106 stereo codec is present on board
- Supports Stereo Record and Playback
Audio features - Audio daughter card
The following audio components are present on the daughter card:
- AK4588 combo codec
- Supports 8 channel audio playback (8 channel DAC)
- Supports SPDIF data record (Co-axial and Optical jacks)
- Controlled through SPI interface
- PCM1602 (ADCs)
- Supports 8 channel audio record
- SPDIF DIT port
- Supports transmit of SPDIF data (Co-axial jack)
Driver architecture
Supports ALSA (Advanced Linux Sound Architecture) architecture.
- The package includes hardware drivers, libraries and utilities to provides audio functionality for the Linux operating system.
- Kernel level library
- User space library - useful for application developers
- Utils
- Can be configured in OSS-Emulation mode
- To provide compatibility for most of the OSS applications
Build Configuration - DSK board
The default config file (da830_omapl137_defconfig) configures the audio for DSK board.
- Configuring audio for the dsk board through menu config.
Device Drivers -> sound --->
<*> Sound card support
Advanced Linux Sound Architecture --->
<*> Advanced Linux Sound Architecture
System on Chip audio support --->
<*> ALSA for SoC audio support
[ ] DA830/OMAP-L137 McASP0 control by ARM
[*] DA830/OMAP-L137 McASP1 control by ARM
[ ] DA830/OMAP-L137 McASP2 control by ARM
DA830/OMAP-L137 EVM: Codec To Use (AIC3106 (on EVM Board)) --->
(X) AIC3106 (on EVM Board)
Build Configuration - Audio daughter card
The Menu Config shown will enable the following features:
- 8-channel audio playback
- SPDIF record
- 8-channel audio record
- SPDIF playback
Device Drivers -> sound --->
<*> Sound card support
Advanced Linux Sound Architecture --->
<*> Advanced Linux Sound Architecture
System on Chip audio support --->
<*> ALSA for SoC audio support
[*] DA830/OMAP-L137 McASP0 control by ARM
[*] DA830/OMAP-L137 McASP1 control by ARM
[*] DA830/OMAP-L137 McASP2 control by ARM
DA830/OMAP-L137 EVM: Codec To Use (AIC3106 (on EVM Board)) --->
(X) AK4588 (on daughter Board)
ALSA Utils
- Collection of small and powerful applications designed to allow users to control the various parts of the ALSA system.
- The following applications are commonly used by the users. These are readily available as part of the package.
- aplay - Audio playback
- arecord - Audio recording
- amixer - Audio controls
arecord
arecord utility is used to record the audio through the audio capture devices.
- arecord option '-l' is used to list audio capture devices on board:
# arecord -l **** List of CAPTURE Hardware Devices **** arecord -l **** List of CAPTURE Hardware Devices **** card 0: EVM [DA8XX EVM], device 0: AIC3X aic3x-I2S-0 [aic3x-0] Subdevices: 1/1 Subdevice #0: subdevice #0
Description of above log:
- card 0, device 0: AIC3106 device (Device id used to receive audio data in I2S format)
arecord (2)
The following command records the stereo audio through AIC3106 device.
# arecord -D 'hw:0,0' -r 48000 -f S16_LE -c 2 song.dat
Description of the command:
D = Device id (Represented with 'hw: <cardId,deviceId>')
r = Sampling rate
f = data format
c = number of channels
aplay
arecord utility is used to playback the audio through the audio playback devices.
- aplay option used to list audio capture devices on board:
# aplay -l **** List of PLAYBACK Hardware Devices **** card 0: EVM [DA8XX EVM], device 0: AIC3X aic3x-I2S-0 [aic3x-0] Subdevices: 1/1 Subdevice #0: subdevice #0
Description of above log:
- card 0, device 0: AIC3106 device (Device id used to playback stereo data (I2S format))
aplay (2)
The following command plays back the stereo audio through AIC3106 device.
# aplay -D 'hw:0,0' -r 48000 -f S16_LE -c 2 song.dat
(or)
# aplay -D 'hw:0,0' -c 2 song.dat
Description of the command:
D = Device id (Represented with 'hw: <cardId,deviceId>')
r = Sampling rate
f = data format
c = number of channels
Record and play back simultaneously
The data recorded through arecord command is piped to the aplay.
# arecord -D 'hw:0,0' -r 48000 -f S16_LE -c 2 | aplay -D 'hw:0,0' -c 2
(or)
Give arecord command to record data to the song.raw file and make it as back ground task and give aplay comamnd to play back the data from the same file.
# arecord -D 'hw:0,0' -r 48000 -f S16_LE -c 2 song.raw & # aplay -D 'hw:0,0' -c 2 song.raw
</font>
amixer
amixer controls the mixer for the audio driver. It controls volume, channels, etc
- amixer help command
amixer -help Usage: amixer <options> [command] Available options: -h,--help this help -c,--card N select the card -D,--device N select the device, default 'default' .. Available commands: scontrols show all mixer simple controls scontents show contents of all mixer simple controls (default command) controls show all controls for given card contents show contents of all controls for given card ..
amixer (2)
amixer -controls: This option lists the handles (numid) to control enabling of different channels and their volume.
- Log displaying the numids for multichannel capture and display channels.
# amixer -controls numid=1,iface=MIXER,name='PCM Playback Volume' ...
amixer - Controlling the volume
amixer cset numid=1 127, 0 /* Mute the right channel */ amixer cset numid=1 0, 127 /* Mute the left channel */ amixer cset numid=1 0, 0 /* Mute both the channels */ amixer cget numid=1 /* Get the volume of the channels */
SPDIF - Record
The audio daughter card supports SPDIF record.
- Procedure to do SPDIF record
# arecord -l /* List all the audio capture devices */
**** List of CAPTURE Hardware Devices ****
card 0: EVM [DA8xx EVM], device 0: DIR DIR-I2S-0 [DIR-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: EVM [DA8xx EVM], device 1: AK4xxx ak4xxx-I2S-1 [ak4xxx-1]
Subdevices: 1/1
Subdevice #0: subdevice #
# arecord -D 'hw:0,0' -r 48000 -f S16_LE -c 2 song.raw /* Record through the selected device */
SPDIF - Playback
The audio daughter card supports SPDIF playback.
- Procedure to play SPDIF data
# aplay -l /* List all the audio playback devices */
**** List of PLAYBACK Hardware Devices ****
card 0: EVM [DA8xx EVM], device 1: AK4xxx ak4xxx-I2S-1 [ak4xxx-1] <br>
Subdevices: 1/1 <br>
Subdevice #0: subdevice #0 <br>
card 0: EVM [DA8xx EVM], device 2: DIT DIT-I2S-2 [DIT-2] <br>
Subdevices: 1/1 <br>
Subdevice #0: subdevice # <br>
/* Playback through the selected device */
# aplay -D 'hw:0,2' -c 2 song.raw
- Simultaneous: Record through SPDIF DIR and playback through SPDIF DIT
# arecord -D 'hw:0,0' -r 48000 -f S16_LE -c 2 | aplay -D 'hw:0,2' -c 2
References
- AIC3106 Datasheet
- AK4588 Datasheet
- AK4588 overview
- ALSA Project
- OMAP Audio Driver webex presentation

