Subject: ADS5121 problem using audio interface

From: Stefan Strobl <[email-masked]>
Date: Wed, 04 Feb 2009 15:04:37 +0100

Hi

I'm trying to get the audio interface working on my ADS5121 Rev4.0 and
have some questions.

I did manage to record and play audio files of type raw and format
S32_BE like this:

$ arecord -traw -c2 -fS32_BE -Dhw:0,0 testfile
$ aplay -traw -c2 -fS32_BE -Dhw:0,0 testfile

I am not able to get the auto conversion work, so that I could play a
wav file of any format. I'm getting this error:

$ aplay -Dplughw:0,0 test.wav
Playing WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono
ALSA lib pcm_plug.c:773:(snd_pcm_plug_hw_refine_schange) Unable to find
an usable access for 'plughw:0,0'
aplay: set_params:901: Sample format non available

I'm not sure, but I expect this to be a problem of my ALSA configuration
and this is where I'm stuck.
Does anyone have a working ALSA configuration file for the ads5121?
Or any other hints on how to overcome this problem?
Does anyone know how to convert wav files so that they can be played in
raw mode?

Many thanks
Stefan.

-----
These are the steps I performed to get audio work:

I'm using kernel 2.6.24.6 (linux-2.6-denx.git/ads5121) with ALSA-1.0.15
built into the kernel and ELDK-4.2.

1. Build and install alsa-lib-1.0.15 and alsa-utils-1.0.15 natively on
the target.

$ wget ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.0.15.tar.bz2
$ tar xf alsa-lib-1.0.15.tar.bz2
$ cd alsa-lib-1.0.15
$ ./configure
$ make
$ make install

$ wget ftp://ftp.alsa-project.org/pub/utils/alsa-utils-1.0.15.tar.bz2
$ tar xf alsa-utils-1.0.15.tar.bz2
$ cd alsa-utils-1.0.15
$ ./configure --disable-nls
$ make
$ make install

2. Manually create the device nodes, with Minor numbers according to
output from /proc/asound/devices

$ cat /proc/asound/devices
  0: [ 0]   : control
  1:        : sequencer
 16: [ 0- 0]: digital audio playback
 24: [ 0- 0]: digital audio capture
 33:        : timer

$ mkdir /dev/snd
$ mknod /dev/snd/pcmC0D0p c 116 16
$ mknod /dev/snd/pcmC0D0c c 116 24
$ mknod /dev/snd/controlC0 c 116 0
$ mknod /dev/snd/timer c 116 33
$ mknod /dev/snd/seq c 116 1

3. Run aplay...

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ADS [MPC5121 ADS], device 0: AC97 AC97 HiFi-<NULL>-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

$ aplay -L
default:CARD=ADS
    MPC5121 ADS,
    Default Audio Device
null
    Discard all samples (playback) or generate zero samples (capture)

$ aplay -traw -c2 -fS32_BE -Dhw:0,0 /dev/urandom
$ arecord -traw -c2 -fS32_BE -Dhw:0,0 testfile
$ aplay -traw -c2 -fS32_BE -Dhw:0,0 testfile