2008-04-30 00:20:24     A couple of AD1981B driver questions

Document created by Aaronwu Employee on Aug 6, 2013
Version 1Show Document
  • View in full screen mode

2008-04-30 00:20:24     A couple of AD1981B driver questions

Frank Van Hooft (CANADA)

Message: 55265    Good news, our AD1981B board seems to be working on the BF537 running 2008R1. 'Tone' produces some lovely annoying noise on the line-out ports. I have some questions about talking to the 1981 chip.



1) Doing: cat /sys/devices/platform/soc-audio/codec_reg

produces a useful dump of the 1981 registers. Is there a way to do the reverse and set register values?

We have something very specific we want to do, and it would be easier if we can program the 1981 registers directly, rather than trying to go through 'mixer' or something.



2) At times we only need to grab a handful of input audio samples from the 1981. Like 10 or 20 samples for example. An example program of how to grab data would be useful. I was looking at ossrec.c (part of audio_test); is that a reasonable starting point, or can someone suggest something else?



3) Is it possible to change the sampling rate of the driver? It appears the 1981's rate can be changed (via register 0x32) but it's not clear to me if the driver can be. My experimenting appears to indicate it's fixed at 48000 Hz, 16 bits stereo. For example:


root:/> vrec -w -t 10 test.wav

Recording WAVE : Speed 8000 Hz Mono ...


returns in less than 1 second; not the 10 seconds one might expect. It produces the correct (80044 bytes) filesize though, so obviously it's receiving data much faster than an 8 kHz mono might indicate.  However doing this:


root:/> vrec -w -S -t 10 -s 48000 -b 16 test1.wav

Recording WAVE : 16 bit, Speed 48000 Hz Stereo ...


takes 10 seconds as expected.



Thanks very much.




2008-05-11 23:14:10     回复: A couple of AD1981B driver questions

Cliff Cai (CHINA)

Message: 55726   


Hi Frank,


1.I'm afraid currently you only can program the registers by "mixer" or "alsamixer" or other tools by default,


but I think you can write an application yourself to do the similar work,please refer to the source code of "alsamixer"


in user/blackfin-apps/alsa-utils.


2,"arecord" is alsa based application which is used  for  recording  audio,you can find out  the source code


aplay.c in alsa-utils/aplay.


3.AC97 link does work in a  fixed  sample rate 48k . The codec  can convert this 48k to other rate  internally


due to the per-slot valid tag infrastructure,but from the driver's point of view,only 48k can be seen.


Best Regards






2008-05-12 11:26:30     Re: 回复: A couple of AD1981B driver questions


Message: 55745   




The way that the hardware works on the AD1981, or any other AC'97 code used in slot 16 mode is - only 48kHz, The hardware on the Blackfin side (SPORT) does not understand the way that the codec does sample rate conversion, so any sample rate other than 48kHz is not supported by the system.