2008-11-14 05:24:19 Problem: recording line-in AD1981BL
Andreas Bellgardt (GERMANY)
Message: 65286
I have a AD1981BL attached to a BF537 Rev.0.3,
kernel is 2.6.26.5-ADI-2009R1-pre-svn5462-dirty,
uClinux-dist-2008R1.5-RC3.
Here's some information of my configuration:
cat /proc/asound/devices
0: [ 0] : control
16: [ 0- 0]: digital audio playback
24: [ 0- 0]: digital audio capture
33: : timer
a fragment of dmesg:
AD1980 SoC Audio Codec
asoc: AC97 <-> bf5xx-ac97 mapping ok
ad1980: Found AD1981 - only 2/2 IN/OUT Channels supported
ALSA device list:
#0: bf5xx-board (AD1980)
root:/> aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: bf5xxboard [bf5xx-board], device 0: AC97 HiFi AC97-AC97-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
root:/> arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: bf5xxboard [bf5xx-board], device 0: AC97 HiFi AC97-AC97-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
Playback of a wav file works fine, but I'm not able to record anything on line-in.
I monitored the audio signal to be recorded up to the line-in pins of the AD1981 (pins 23, 24), so I'm sure a signal is there.
Then I tried:
root:/> mixer
Usage: mixer { vol|pcm|line|mic|cd|pcm2|phin|phout } <value>
or mixer { +rec|-rec } <devicename>
Volume of channels is set to max:
root:/> mixer vol
The mixer vol is currently set to 100:100.
root:/> mixer pcm
The mixer pcm is currently set to 100:100.
root:/> mixer line
The mixer line is currently set to 100:100.
root:/> mixer mic
The mixer mic is currently set to 100:100.
root:/> mixer cd
The mixer cd is currently set to 100:100.
root:/> mixer pcm2
The mixer pcm2 is currently set to 100:100.
root:/> mixer phin
The mixer phin is currently set to 100:100.
root:/> mixer phout
The mixer phout is currently set to 100:100.
Then I tried:
root:/> mixer +rec line
Recording source: line
root:/> mixer rec 100
Setting the mixer rec to 100:100.
root:/> arecord -D hw:0,0 -f S16_LE -c 2 -r 48000 -d 10 play2.wav
Recording WAVE 'play2.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
root:/> aplay play2.wav
... nothing ... (only noise)
root:/> arecord -t wav -c 2 -f S16_LE -r 48000 -M -d 10 play.wav
Recording WAVE 'play.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
root:/> aplay play.wav
Playing WAVE 'play.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
... nothing ... (only noise)
root:/> arecord -D hw:0,0 -t wav -c 2 -f S16_LE -r 48000 -M -d 10 play.wav
Recording WAVE 'play.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
root:/> aplay play.wav
Playing WAVE 'play.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
... nothing ... (only noise)
root:/> arecord -D default -t wav -c 2 -f S16_LE -r 48000 -M -d 10 play.wav
Recording WAVE 'play.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
root:/> aplay play.wav
Playing WAVE 'play.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
... nothing ... (only noise)
root:/> arecord -L
PCM list:
hw {
@args.0 CARD
@args.1 DEV
@args.2 SUBDEV
@args.CARD {
type string
default {
@func getenv
vars {
0 ALSA_PCM_CARD
1 ALSA_CARD
}
default {
@func refer
name 'defaults.pcm.card'
}
}
}
@args.DEV {
type integer
default {
@func igetenv
vars {
0 ALSA_PCM_DEVICE
}
default {
@func refer
name 'defaults.pcm.device'
}
}
}
@args.SUBDEV {
type integer
default {
@func refer
name 'defaults.pcm.subdevice'
}
}
type hw
card $CARD
device $DEV
subdevice $SUBDEV
}
plughw {
@args.0 CARD
@args.1 DEV
@args.2 SUBDEV
@args.CARD {
type string
default {
@func getenv
vars {
0 ALSA_PCM_CARD
1 ALSA_CARD
}
default {
@func refer
name 'defaults.pcm.card'
}
}
}
@args.DEV {
type integer
default {
@func igetenv
vars {
0 ALSA_PCM_DEVICE
}
default {
@func refer
name 'defaults.pcm.device'
}
}
}
@args.SUBDEV {
type integer
default {
@func refer
name 'defaults.pcm.subdevice'
}
}
type plug
slave.pcm {
type hw
card $CARD
device $DEV
subdevice $SUBDEV
}
}
plug {
@args.0 SLAVE
@args.SLAVE {
type string
}
type plug
slave.pcm $SLAVE
}
shm {
@args.0 SOCKET
@args.1 PCM
@args.SOCKET {
type string
}
@args.PCM {
type string
}
type shm
server $SOCKET
pcm $PCM
}
tee {
@args.0 SLAVE
@args.1 FILE
@args.2 FORMAT
@args.SLAVE {
type string
}
@args.FILE {
type string
}
@args.FORMAT {
type string
default raw
}
type file
slave.pcm $SLAVE
file $FILE
format $FORMAT
}
file {
@args.0 FILE
@args.1 FORMAT
@args.FILE {
type string
}
@args.FORMAT {
type string
default raw
}
type file
slave.pcm null
file $FILE
format $FORMAT
}
null {
type null
}
cards 'cards.pcm'
front 'cards.pcm.front'
rear 'cards.pcm.rear'
center_lfe 'cards.pcm.center_lfe'
side 'cards.pcm.side'
surround40 'cards.pcm.surround40'
surround41 'cards.pcm.surround41'
surround50 'cards.pcm.surround50'
surround51 'cards.pcm.surround51'
surround71 'cards.pcm.surround71'
iec958 'cards.pcm.iec958'
spdif 'cards.pcm.iec958'
modem 'cards.pcm.modem'
phoneline 'cards.pcm.phoneline'
default 'cards.pcm.default'
dmix 'cards.pcm.dmix'
dsnoop 'cards.pcm.dsnoop'
Could anyone please tell me how to setup recording on line-in?
Is this a configuration problem or AD1981 driver issue?
Thank you.
Andreas
TranslateQuoteReplyEditDelete
2008-11-14 11:42:53 Re: Problem: recording line-in AD1981BL
Frank Van Hooft (CANADA)
Message: 65308
I had played with a 1981 on a BF537-STAMP under 2008R1 a while back. I was able to record from line-in, although I recall it wasn't always obvious how the different devices (mic, cd, etc) mapped to the internal registers of the device. Doing this:
cat /sys/devices/platform/soc-audio/codec_reg
and sitting down with the block diagram of the 1981 was really helpful in checking that the 1981's internal registers were configured correctly.
Also, ensure your input audio signal is not too low of a frequency, 1kHz should be fine, but 10 Hz probably won't work.
QuoteReplyEditDelete
2008-11-17 08:45:10 Re: Problem: recording line-in AD1981BL
Andreas Bellgardt (GERMANY)
Message: 65372
Thanks for your reply, Frank!
I followed your suggestion and found that I can switch to different input channels in register 0x1a ("Record Select") with the command
root:/> mixer
Usage: mixer { vol|pcm|line|mic|cd|pcm2|phin|phout } <value>
or mixer { +rec|-rec } <devicename>
For example, "mixer +rec line" switches to line-in.
But setting the record volume gain with "mixer rec 100" does not change the registers 0x10 (line-in volume) / 0x1c (record gain). They have a value of 0x8808 / 0x8000 that means their mute bit is set.
How can I change the mute bit and the input volume from application?
If it is not possible from application software, where do I have to make changes in the ad1981 driver?
Regards,
Andreas