NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.
Omapl137 linux audio driver
Contents
- 1 Agenda
- 2 Block diagram - DSK board and Audio daughter card
- 3 Audio features - DSK board
- 4 Audio features - Audio daughter card
- 5 Driver architecture
- 6 Build Configuration - DSK board
- 7 Build Configuration - Audio daughter card
- 8 ALSA Utils
- 9 arecord
- 10 arecord (2)
- 11 aplay
- 12 aplay (2)
- 13 Record and play back simultaneously
- 14 amixer
- 15 amixer (2)
- 16 amixer - Controlling the volume
- 17 SPDIF - Record
- 18 SPDIF - Playback
- 19 References
Agenda[edit]
- 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[edit]
Audio features - DSK board[edit]
- AIC3106 stereo codec is present on board
- Supports Stereo Record and Playback
Audio features - Audio daughter card[edit]
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[edit]
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[edit]
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[edit]
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[edit]
- 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[edit]
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)[edit]
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[edit]
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)[edit]
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[edit]
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
amixer[edit]
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)[edit]
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[edit]
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[edit]
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[edit]
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