Difference between revisions of "ALSA"
m (→Installation) |
m (→Installation) |
||
Line 14: | Line 14: | ||
==Installation== | ==Installation== | ||
+ | '''ALSA is by default installed on the standard Armadeus rootfs.''' Following instructions are only given if you want to change default configuration: | ||
* On your Host select ALSA compilation in Linux configuration: | * On your Host select ALSA compilation in Linux configuration: | ||
[armadeus]$ make linux26-menuconfig | [armadeus]$ make linux26-menuconfig | ||
− | Device Drivers | + | Device Drivers ---> <M> Sound card support |
− | Device Drivers | + | Device Drivers ---> <M> Sound card support ---> <M> Advanced Linux Sound Architecture |
− | Device Drivers | + | Device Drivers ---> <M> Sound card support ---> <M> Advanced Linux Sound Architecture ---> [*] ARM sound devices ---> <M> i.MX1/L TSC2102 alsa driver |
<M> Advanced Linux Sound Architecture | <M> Advanced Linux Sound Architecture | ||
Line 31: | Line 32: | ||
[ ] Verbose printk | [ ] Verbose printk | ||
[ ] Debug | [ ] Debug | ||
− | [ ] | + | [ ] Debug |
− | [ ] | + | [ ] Generic sound devices ---> |
− | + | [*] ARM sound devices ---> | |
− | + | [ ] SPI sound devices ---> | |
− | + | [ ] USB sound devices ---> | |
− | + | < > ALSA for SoC audio support ---> | |
* in Buildroot configuration, select the user space packages for ALSA: | * in Buildroot configuration, select the user space packages for ALSA: | ||
Line 107: | Line 108: | ||
# vi /etc/init.d/S60alsa | # vi /etc/init.d/S60alsa | ||
− | + | <source lang="bash"> | |
+ | #!/bin/sh | ||
− | + | modprobe spi_imx | |
− | + | modprobe snd-imx-alsa-tsc2102 | |
+ | </source> | ||
# chmod a+x /etc/init.d/S60alsa | # chmod a+x /etc/init.d/S60alsa |
Revision as of 12:43, 8 December 2008
This page will summarize the informations to use ALSA on your Armadeus boards.
Contents
Introduction
ALSA stands for Advanced Linux Sound Architecture and provides audio and MIDI functionality to the Linux operating system. Everyone wanting to write portable & state of the art Linux applications dealing with sound should consider using ALSA.
ALSA Soc
On the APF boards we are going to use Embedded version of ALSA: ALSA Soc ->
- http://opensource.wolfsonmicro.com/node/6
- http://www.rpsys.net/openzaurus/patches/alsa/info.html
- http://alsa-project.org/main/index.php/ASoC
But for the moment only "standard" version is functionnal.
Installation
ALSA is by default installed on the standard Armadeus rootfs. Following instructions are only given if you want to change default configuration:
- On your Host select ALSA compilation in Linux configuration:
[armadeus]$ make linux26-menuconfig Device Drivers ---> <M> Sound card support Device Drivers ---> <M> Sound card support ---> <M> Advanced Linux Sound Architecture Device Drivers ---> <M> Sound card support ---> <M> Advanced Linux Sound Architecture ---> [*] ARM sound devices ---> <M> i.MX1/L TSC2102 alsa driver
<M> Advanced Linux Sound Architecture < > Sequencer support (NEW) <M> OSS Mixer API <M> OSS PCM (digital audio) API [*] OSS PCM (digital audio) API - Include plugin system (NEW) [ ] Dynamic device file minor numbers (NEW) [*] Support old ALSA API (NEW) [ ] Verbose procfs contents (NEW) [ ] Verbose printk [ ] Debug [ ] Debug [ ] Generic sound devices ---> [*] ARM sound devices ---> [ ] SPI sound devices ---> [ ] USB sound devices ---> < > ALSA for SoC audio support --->
- in Buildroot configuration, select the user space packages for ALSA:
[armadeus]$ make menuconfig Package Selection for the target-> Audio libraries: --- Audio libraries and applications [*] alsa-lib [*] alsa-utils ALSA utils selection ---> [ ] asterisk [*] aumix [ ] libmad --- libid3tag --- libmad [ ] libmad headers in target [ ] libsndfile --- libvorbis requires the package libogg to build [*] madplay [ ] mpg123
in ALSA utils selection ---> [*] alsaconf [*] alsactl [*] alsamixer [ ] amidi [*] amixer [*] aplay [ ] arecord [ ] iecset [ ] aconnect [ ] aplaymidi [ ] arecordmidi [ ] aseqdump [ ] aseqnet [*] speaker-test
- save your configuration and rebuild your rootfs:
[armadeus]$ make
- after reflashing your rootfs and your Linux kernel on your board, you can load ALSA drivers:
# modprobe spi_imx # modprobe snd-imx-alsa-tsc2102 TI TSC2102 driver initializing audio_dma_request done (8) audio_dma_request done (9) audio support initialized
# lsmod Module Size Used by Not tainted snd_imx_alsa_tsc2102 7204 0 snd_pcm 50760 1 snd_imx_alsa_tsc2102 snd_timer 14084 1 snd_pcm snd_page_alloc 3208 1 snd_pcm snd 28916 3 snd_imx_alsa_tsc2102,snd_pcm,snd_timer soundcore 3332 1 snd tsc2102 10256 1 snd_imx_alsa_tsc2102 hwmon 948 1 tsc2102 spi_imx 9024 0
- if you want OSS support:
modprobe snd-pcm-oss modprobe snd-mixer-oss
- If you want MIDI sequencer support:
modprobe snd-seq modprobe snd-seq-device
Loading script
If you want the drivers to be loaded automatically during each boot, you can add a script in /etc/init.d/. For example:
# vi /etc/init.d/S60alsa
#!/bin/sh
modprobe spi_imx
modprobe snd-imx-alsa-tsc2102
# chmod a+x /etc/init.d/S60alsa
nodes creation
Automatically done by Buildroot, so only here as reference. In /dev/snd/ you should have:
mknod controlC0 c 116 0 mknod pcmC0D0c c 116 24 mknod pcmC0D0p c 116 16
Test
- Check if ALSA is running:
# cat /proc/asound/version Advanced Linux Sound Architecture Driver Version 1.0.17.
- To check if the TSC2102 was detected as a sound chip:
# aplay -lL default:CARD=IMX-ALSA ARMADEUS IMX_ALSA, imx alsa pcm Default Audio Device null Discard all samples (playback) or generate zero samples (capture) **** List of PLAYBACK Hardware Devices **** card 0: IMX-ALSA [ARMADEUS IMX_ALSA], device 0: IMX PCM [imx alsa pcm] Subdevices: 1/1 Subdevice #0: subdevice #0
or
# cat /proc/asound/cards 0 [IMX-ALSA ]: IMXALSA - ARMADEUS IMX_ALSA ARMADEUS IMX_ALSA
- To play a test sound:
# aplay /usr/share/sounds/alsa/Side_Left.wav Playing WAVE '/usr/share/sounds/alsa/Side_Left.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
Note: the audio file Side_Left.wav can be copied from your Linux host (if not already on your rootfs)
Going further
Now that ALSA is working, you can switch to serious things ;-) ->
Links
- http://www.alsa-project.org/
- http://free-electrons.com/formations/audio
- http://alsa-project.org/main/index.php/DevEmbedded
- http://alsa.opensrc.org/index.php/WritingAnAlsaDriver + http://www.alsa-project.org/~tiwai/writing-an-alsa-driver.pdf
- http://www.linuxjournal.com/article/6735
- http://en.wikipedia.org/wiki/PCM
- Buildroot bug (aplay: set_params:1012: unable to install sw params:)