2008-02-19 17:54:52 ADC/DAC versus CODEC
Jan Kowalski (POLAND)
Message: 51299
Hi,
As we known AD1836A Audio Daughter Board will be availabe late April'08, ADC are availabe now and DAC will be availabe in few days.
Q.
Can we use from hardware view (connection to STAMP) and from software view 2 cards ADC&DAC together to simulate CODEC?
Please advise.
Maybe you have other solution?
Regards
M
QuoteReplyEditDelete
2008-02-20 11:42:49 Re: ADC/DAC versus CODEC
Robin Getz (UNITED STATES)
Message: 51367 Marek:
I'm not sure I understand the question?
You want to design your own card? or use the parts on a different one?
-Robin
QuoteReplyEditDelete
2008-02-20 11:51:38 Re: ADC/DAC versus CODEC
Jan Kowalski (POLAND)
Message: 51369
Hi,
No I do not want to design my own card, I am to much delay with my stuff to do it.
I thought, maybe someone have one spare I can PO.
Today I received update from AD Customer Support , and in real life I could have this card with me in late June. It is to long.
Regards
M2007-10-04 10:32:18 Advanced usage of the AD1981B codec
Cyril HAENEL (FRANCE)
Message: 44905
Hi all,
I develop a board with a bf537. On this board, I have :
- One stereo amplifier (to output sound on speakers)
- One stereo line output jack
- One mono amplifier (to output sound on another speaker)
- One stereo line input jack
- One mono mike input jack
- One stereo FM tuner (on the board)
The usage of the board follows :
- The mono ouptut must be independant (his only usage is to play mono audio files)
- The stereo output is done on the stereo amplifier OR the stereo line output jack (to use an external amplifier)
On this stereo output, I need to :
- Play audio files (In this case inputs are not used)
- Play the FM
- Play the sound from the line
- Play the sound from the mike
In other word, in all cases there is only one input to sample (Line in, FM, or mike), and the mono output must be independant.
Do you think it's possible to do that with the AD1981B ? How must I connect the differents peripherals on the codec ?
My idea is :
- Stereo amplifier connected on HP_OUT_R and HP_OUT_L
- Stereo line out connected on LINE_OUT_R and LINE_OUT_L
- Mono amplifier connected on MONO_OUT
- Stereo line input connected on LINE_IN_R and LINE_IN_L
- FM tuner connected on AUX_R and AUX_L
- Mike connected on MIC1
What do you think about this ?
Thank you and best regards,
Cyril
TranslateQuoteReplyEditDelete
2007-10-04 11:41:36 Re: Advanced usage of the AD1981B codec
Robin Getz (UNITED STATES)
Message: 44914 Cyril:
I'm not clear what you want to do.
There is only one set of DACs, and one set of ADCs on the AD1981BL. You can do some things with the hardware mixer (see the datasheet of the AD1981), but when you say that mono out must be independant - what do you mean?
Thanks
-Robin
QuoteReplyEditDelete
2007-10-04 13:11:00 Re: Advanced usage of the AD1981B codec
Cyril HAENEL (FRANCE)
Message: 44928 Yes your are right, the codec is not good for what I want to do. I need the AD1980 but it doesn't exist in industrial version (-40 / +70°c).
For the mono output, I mean that it must be independant. It fact, I need 2 independant channel.
For exemple, I need to play a file on the mono output, and play another file (or FM, or Mike, or line in) on the stereo output.
I am searching for a codec, in industrial version.
Thus the minimum I need is 4 DAC ( 2 stereo output, I can use one to do mono), and 2 ADC.
The AD1986 seems to be OK (6 DAC / 2 ADC), with industrial version.
Thanks,
CYril
TranslateQuoteReplyEditDelete
2007-10-04 14:25:19 Re: Advanced usage of the AD1981B codec
Robin Getz (UNITED STATES)
Message: 44938 Cyril:
I might stick with the AD1986A -
http://www.analog.com/en/prod/0,2877,AD1986A,00.html
I think it meets your requirements:
- 6 DAC
- 2 ADC
- -40 to 85C
- slot16 mode
I just need to check with one of our developers - to make sure you can use it before you lay out a board.
The Blackfin does not include real AC'97 controller it is a little tricky to use these parts, and I don't think anyone has done a 6 channel output yet.
-Robin
QuoteReplyEditDelete
2007-10-04 15:22:07 Re: Advanced usage of the AD1981B codec
Cyril HAENEL (FRANCE)
Message: 44940 I just need 2 channels, one channel will be unused.
I saw in the kernel config that the AD1836 can work in 5.1 or 3 separate stereo channel. In fact the /dev/dsp can be opened 3 time to access the 3 separate channel.
These 2 parts are very different to manage ?
Thanks,
Regards
TranslateQuoteReplyEditDelete
2007-10-04 20:38:59 Re: Advanced usage of the AD1981B codec
Robin Getz (UNITED STATES)
Message: 44948 Cyril:
Yes - AD1836 is nothing like the AD1986.
One is designed to be used on the SPORT, and the AC 97 codecs are not.
-Robin
QuoteReplyEditDelete
2007-10-05 04:24:49 Re: Advanced usage of the AD1981B codec
Cyril HAENEL (FRANCE)
Message: 44956 Hi Robin,
Yesterday evening I looked in the sound/blackfin/ac97_sport.c.
This source seem's to be very clean, and permit to transfer AC97 frame over the SPORT ?
If I understand, every "sample" consist on a "ac97_frame" data structure. I can see that this structure contain a lot of pad word, and only contain one PCM data word.
It seem's to be logical because this file is used by ad1981b.c, which just have one stereo channel.
For other codec with more channels, as the AD1986A, maybe "I have just" to add another PCM data word in the ac97_frame ? Like this :
struct ac97_frame {
__u16 ac97_tag; // slot 0
__u16 ac97_addr; // slot 1
__u16 ac97_data; // slot 2
__u32 ac97_pcm1; // slot 3 and 4: left and right pcm data for 1st DAC
__u32 ac97_pcm2; // slot 5 and 6: left and right pcm data for 2nd DAC
__u16 stuff[9]; // pad to 16 words
} __attribute__ ((packed));
If the ac97 data transfer for multiple channel work like this, after I need to modify the source to have access to this 2nd pcm data as an independant channel :-/
TranslateQuoteReplyEditDelete
2007-10-05 05:34:42 Re: Advanced usage of the AD1981B codec
Michael Hennerich (GERMANY)
Message: 44959 Cyril,
all Sound Codecs sit on the SPORT.
You are better off using a AC97 Codec.
(it allows you to mix analog inputs with the output be just setting a register)
have a look into the datasheet
On SVN trunk there is a new Blackfin ASOC driver for AC97 codecs.
This new driver will or already does support multiple channels.
We support the AD1980 and AD1981 and I'm pretty sure the AD1986 will also work - with only one line changed in the driver.
The driver you are refering to has been deleted by me - and will no longer be released.
-Michael
QuoteReplyEditDelete
2007-10-05 07:48:15 Re: Advanced usage of the AD1981B codec
Cyril HAENEL (FRANCE)
Message: 44968 Michael,
Thank you very much for your answer.
What you say is a very good new for me. I think I can mount the AD1986A on board without risk.
AC97 codec is good for me because I don't need to have a spi or i2c connection to configure the codec. On my board I dedicated the SPI to sample some ADC, and I don't want other peripheral on it. And I dedicated the i2c to control the FM tuner only, because the Fm tuner need no activity on i2c when seeking for optimal performance.
And you are right, I have seen that I can mix input with the output. It's perfect for my needs because I can play the line input, FM, or mike input directly on the stereo output without read / write samples in software.
And I think I can easily choose where to send the stereo output, on the stereo amplifier or on the line output.
And I channels can be independant, I will be able to have my mono output independant.
Regards
TranslateQuoteReplyEditDelete
2007-10-05 14:54:54 Re: Advanced usage of the AD1981B codec
Robin Getz (UNITED STATES)
Message: 44989 Cyril:
Transferring the data to/from the DAC/ADCs is not the problem - it is getting access to all the registers properly to set up/control the mixer functionality.
I need to check if this is doable before you design hardware.
Last time I talked to Michael about the required programming sequence for startup on the codecs - we determined it was pretty difficult.
-Robin
QuoteReplyEditDelete
2007-10-05 17:07:53 Re: Advanced usage of the AD1981B codec
Cyril HAENEL (FRANCE)
Message: 45006 There is a big difference between the ad1981 and ad1986 for accessing register ?
I have not looked in detail the ac97 specification, but it seems the register is acceded with the three first word of each sample frame ?
I like to know how things work, can you rapidly explain what is your concern ?
Thank your for your help.
Regards,
Cyril
TranslateQuoteReplyEditDelete
2007-10-10 11:06:23 Re: Advanced usage of the AD1981B codec
Cyril HAENEL (FRANCE)
Message: 45186 Hi Robin,
Have you a good new for me ?
I have no other choice, I must put the AD1986A in my hardware. There is no other codec which can do what I want to do.
Thus I implement the AD1986A, and I pray to have a working driver, even if I must modify it.
Regards,
Cyril
TranslateQuoteReplyEditDelete
2007-10-22 13:05:36 Re: Advanced usage of the AD1981B codec
Robin Getz (UNITED STATES)
Message: 45754 Cyril:
Sorry for the delay.
The problem is that the SPORT is not an AC'97 controller. Using a codec that supports Slot 16 mode is possible, but it is error prone.
-Robin
QuoteReplyEditDelete
2007-12-21 19:23:04 Re: Advanced usage of the AD1981B codec
Cyril HAENEL (FRANCE)
Message: 48910 Hi robin and Michael,
I reread all messages of this thread.
Michael you say that it's better to use an AC97 codec, and that there is no problem with the blackfin SPORT, and Robin you say it will very difficult to have the AD1968A working. What is the truth !? :))))
On my side I had no other solution, so I implanted the AD1968A on my board (you can see it on the image...). Thus it must works, and it will works !
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />Michael, 2 day ago you said on the SVN trunk is a new blackfin ASOC driver for AC97 codec.
I work on the last SVN trunk but I don't see what you talk about. What is "ASOC" ? Can you tell me where is the driver ?
Regards,
Cyril
dsc05167.jpg
TranslateQuoteReplyEditDelete
2007-12-22 18:17:07 Re: Advanced usage of the AD1981B codec
Robin Getz (UNITED STATES)
Message: 48917 Cyril:
We are both right.
In simple audio cases - it will work fine.
In more complicated audio cases (mixing, VOIP, etc) we are still struggling with it.
ASOC == ALSA System on a Chip
-Robin
QuoteReplyEditDelete
2007-12-22 18:33:09 Re: Advanced usage of the AD1981B codec
Cyril HAENEL (FRANCE)
Message: 48918 Hi robin.
In my case I have no complicated usage, I wich :
- 2 indepedant channels (the 3th is unused), one stereo, one mono (or stereo too, I mix the 2 channels in hardware)
- On the mono output, I just need to play audio file (wav, mp3...)
- On the stereo output, I need to play audio file (wav, mp3), or play sound from line input or AUX input.
Where can I find the AC97 codec than Michael was talking about ?
I am interested to look at it, to understand how works sound layer, and begin to work with it.
Regards,
Cyril
TranslateQuoteReplyEditDelete
2007-12-22 18:38:53 Re: Advanced usage of the AD1981B codec
Cyril HAENEL (FRANCE)
Message: 48919 It's OK, I have found it. Your explanation for ASOC helped me to found it
linux-2.6.x/sound/soc/blackfin
I look at the code.
TranslateQuoteReplyEditDelete
2007-12-23 00:27:44 Re: Advanced usage of the AD1981B codec
Robin Getz (UNITED STATES)
Message: 48921 Cyril:
Do you need software mixing? I can't understand from your description. If so - today that does not work, although we are working on fixing it.
You can find the audio device - the same place you find all the other audio device - Linux -> Device Drivers -> Sound
QuoteReplyEditDelete
2007-12-23 09:49:57 Re: Advanced usage of the AD1981B codec
Cyril HAENEL (FRANCE)
Message: 48924 No, I think I don't need software mixing.
I try to detail my need :
Inputs on the codec are :
- Mike input (connected on MIC1)
- An FM tuner (connected on LINE_IN_R and LINE_IN_L )
- An AUX in jack (connected on AUX_R and AUX_L)
Outputs on the codec are :
- Class D mono amplifier (connected on SURR_OUT_R and SURR_OUT_L, mixed on hardware to have mono, even if a stereo file is played).
- Class D stereo amplifier (connected on LINE_OUT_R and LINE_OUT_L)
- Aux OUT jack (connected on HP_OUT_R and HP_OUT_L)
On the mono output (SURR_OUT_R, SURR_OUT_L), I just need to play audio files.
On the stereo output OR aux. output jack (if external amplifier is connected, or head phone), I need to :
- Play audio file
or
- Play the FM tuner
or
- Play the AUX in jack
In the future, I will need to record the mike input, but not necessary for now.
Does I need software mixing to do that ? I think not ? On the outputs I never have more than one audio source to play.
Futhermore, with the AC97, it seem's that to play the FM tuner input on the stereo output or the aux. output jack, it's just a register configuration in the AD1986A to do hardware mixing. Same thing to play the AUX in jack on the stereo output or the AUX. output jack.
Do you understand what I need to do ? It's true my english is not perfect, it's not easy to explain
Regards,
Cyril
TranslateQuoteReplyEditDelete
2007-12-26 05:55:20 Re: Advanced usage of the AD1981B codec
Cyril HAENEL (FRANCE)
Message: 48970 Hi all,
I activated ALSA for soc audio support, SOC audio for the ADI BF5xx chip, and SoC AC97 audio support for BF5xx.
As AD1986 and AD1980 are similar, to test purpose I also modified linux-2.6.x/sound/soc/codecs/ad1980.c :
//if (vendor_id2 != 0x5370) {
if (vendor_id2 != 0x5378) {
if (vendor_id2 != 0x5374)
goto reset_err;
else
printk(KERN_WARNING "ad1980: "
"Found AD1981 - only 2/2 IN/OUT Channels "
"supported\n");
}
When I boot I have :
Advanced Linux Sound Architecture Driver Version 1.0.12rc1 (Thu Jun 22 13:55:50 2006 UTC).
ASoC version 0.13.1
AD1980 SoC Audio Codec
dma_alloc_init: dma_page @ 0x03403000 - 256 pages at 0x03f00000
asoc: AC97 <-> bf5xx-ac97 mapping ok
Vendor ID 1 : 4144
Vendor ID 2 : 5378
ALSA device list:
#0: bf5xx-board (AD1980)
I put debug to print the Vendor's IDs and verify that communication is OK with the codec. Everyting seems to be OK.
Some files in /proc :
root:~> ls -l /proc/asound/
lrwxrwxrwx 1 root root 5 Jan 1 00:16 bf5xxboard -> card0
dr-xr-xr-x 4 root root 0 Jan 1 00:16 card0
-r--r--r-- 1 root root 0 Jan 1 00:16 cards
-r--r--r-- 1 root root 0 Jan 1 00:16 devices
dr-xr-xr-x 2 root root 0 Jan 1 00:16 oss
-r--r--r-- 1 root root 0 Jan 1 00:16 pcm
-r--r--r-- 1 root root 0 Jan 1 00:16 timers
-r--r--r-- 1 root root 0 Jan 1 00:16 version
root:~> ls -l /proc/asound/card0/
-r--r--r-- 1 root root 0 Jan 1 00:18 id
-rw-r--r-- 1 root root 0 Jan 1 00:18 oss_mixer
dr-xr-xr-x 3 root root 0 Jan 1 00:18 pcm0c
dr-xr-xr-x 3 root root 0 Jan 1 00:18 pcm0p
root:~> cat /proc/asound/devices
0: [ 0] : control
16: [ 0- 0]: digital audio playback
24: [ 0- 0]: digital audio capture
33: : timer
root:~> cat /proc/asound/cards
0 [bf5xxboard ]: AD1980 - bf5xx-board
bf5xx-board (AD1980)
The problem is that I don't have any /dev/dsp device, thus when I test tone, for example :
root:~> tone
ERROR: failed to open DAC device /dev/dsp
Do I forget to do something ?
Regards,
Cyril
TranslateQuoteReplyEditDelete
2007-12-26 07:34:46 Re: Advanced usage of the AD1981B codec
Mike Frysinger (UNITED STATES)
Message: 49016 tone does not use alsa, it uses oss ... so if you didnt enable/load the oss emulation layer, it isnt going to work
QuoteReplyEditDelete
2007-12-26 08:02:32 Re: Advanced usage of the AD1981B codec
Cyril HAENEL (FRANCE)
Message: 49017 Yet, I have activated the oss layer in my kernel config :
OSS mixer API : activated
OSS PCM API (digital audio) : activated
OSS PCM API (digital audio), include plugin system : activated
But /dev/dsp doesn't exist
TranslateQuoteReplyEditDelete
2007-12-26 14:27:04 Re: Advanced usage of the AD1981B codec
Robin Getz (UNITED STATES)
Message: 49019 Cyril:
I don't know - you may want to check if your system needs to have the hard reset?
This is what my working system looks like:
root:/usr/bin> ls -lR /proc/asound/
/proc/asound/:
lrwxrwxrwx 1 root root 5 Dec 11 11:52 bf5xxboard -> card0
dr-xr-xr-x 4 root root 0 Dec 11 11:52 card0
-r--r--r-- 1 root root 0 Dec 11 11:52 cards
-r--r--r-- 1 root root 0 Dec 11 11:52 devices
dr-xr-xr-x 2 root root 0 Dec 11 11:52 oss
-r--r--r-- 1 root root 0 Dec 11 11:52 pcm
-r--r--r-- 1 root root 0 Dec 11 11:52 timers
-r--r--r-- 1 root root 0 Dec 11 11:52 version
/proc/asound/card0:
-r--r--r-- 1 root root 0 Dec 11 11:52 id
-rw-r--r-- 1 root root 0 Dec 11 11:52 oss_mixer
dr-xr-xr-x 3 root root 0 Dec 11 11:52 pcm0c
dr-xr-xr-x 3 root root 0 Dec 11 11:52 pcm0p
/proc/asound/card0/pcm0c:
-r--r--r-- 1 root root 0 Dec 11 11:52 info
-rw-r--r-- 1 root root 0 Dec 11 11:52 oss
dr-xr-xr-x 2 root root 0 Dec 11 11:52 sub0
/proc/asound/card0/pcm0c/sub0:
-r--r--r-- 1 root root 0 Dec 11 11:52 hw_params
-r--r--r-- 1 root root 0 Dec 11 11:52 info
-r--r--r-- 1 root root 0 Dec 11 11:52 status
-r--r--r-- 1 root root 0 Dec 11 11:52 sw_params
/proc/asound/card0/pcm0p:
-r--r--r-- 1 root root 0 Dec 11 11:52 info
-rw-r--r-- 1 root root 0 Dec 11 11:52 oss
dr-xr-xr-x 2 root root 0 Dec 11 11:52 sub0
/proc/asound/card0/pcm0p/sub0:
-r--r--r-- 1 root root 0 Dec 11 11:52 hw_params
-r--r--r-- 1 root root 0 Dec 11 11:52 info
-r--r--r-- 1 root root 0 Dec 11 11:52 status
-r--r--r-- 1 root root 0 Dec 11 11:52 sw_params
/proc/asound/oss:
-r--r--r-- 1 root root 0 Dec 11 11:52 devices
-r--r--r-- 1 root root 0 Dec 11 11:52 sndstat
This might be more important:
root:/usr/bin> ls -lR /sys/devices/platform/soc-audio/
/sys/devices/platform/soc-audio/:
lrwxrwxrwx 1 root root 0 Dec 11 11:53 bus -> ../../../bus/platform
-r--r--r-- 1 root root 4096 Dec 11 11:53 codec_reg
-r--r--r-- 1 root root 4096 Dec 11 11:53 dapm_widget
lrwxrwxrwx 1 root root 0 Dec 11 11:53 driver -> ../../../bus/platform/drivers/soc-audio
-r--r--r-- 1 root root 4096 Dec 11 11:53 modalias
lrwxrwxrwx 1 root root 0 Dec 11 11:53 sound:audio -> ../../../class/sound/audio
lrwxrwxrwx 1 root root 0 Dec 11 11:53 sound:controlC0 -> ../../../class/sound/controlC0
lrwxrwxrwx 1 root root 0 Dec 11 11:53 sound:dsp -> ../../../class/sound/dsp
lrwxrwxrwx 1 root root 0 Dec 11 11:53 sound:mixer -> ../../../class/sound/mixer
lrwxrwxrwx 1 root root 0 Dec 11 11:53 sound:pcmC0D0c -> ../../../class/sound/pcmC0D0c
lrwxrwxrwx 1 root root 0 Dec 11 11:53 sound:pcmC0D0p -> ../../../class/sound/pcmC0D0p
lrwxrwxrwx 1 root root 0 Dec 11 11:53 subsystem -> ../../../bus/platform
-rw-r--r-- 1 root root 4096 Dec 11 11:53 uevent
root:/usr/bin>
root:/usr/bin> cat /sys/devices/platform/soc-audio/codec_reg
AD1980 registers
0: 90
2: 0
4: 8000
6: 8000
8: 0
a: 0
c: 8008
e: 8008
10: 8808
12: 8808
14: 0
16: 8808
18: 0
1a: 0
1c: 0
1e: 0
20: 0
22: 0
24: 0
26: f
28: 3c7
2a: 1f0
2c: bb80
2e: bb80
30: bb80
32: bb80
34: 0
36: 8080
38: 8080
3a: 2000
3c: 0
3e: 0
40: 0
42: 0
44: 0
46: 0
48: 0
4a: 0
4c: 0
4e: 0
50: 0
52: 0
54: 0
56: 0
58: 0
5a: 0
5c: 0
5e: 0
60: 8080
62: 0
64: 0
66: 0
68: 0
6a: 0
6c: 0
6e: 0
70: 0
72: 0
74: 9900
76: 0
78: 0
7a: 0
7c: 4144
7e: 5370
root:/usr/bin> ls /dev/dsp -l
crw-rw---- 1 root root 14, 3 Dec 11 11:30 /dev/dsp
Does it work if you just create the /dev/dsp by hand?
-Robin
QuoteReplyEditDelete
2007-12-26 15:30:34 Re: Advanced usage of the AD1981B codec
Cyril HAENEL (FRANCE)
Message: 49020 Robin, I will check tomorrow morning, but from my memory, I have exactly the sames outputs for proc/asound/...
I have not checked the /sys/devices/platform/soc-audio, but I am pretty sure it will be OK, I check that tomorrow morning.
On your system, have you a /dev/sound directory ? Because I looked on internet, /dev/dsp is for OSS, alsa device are in /dev/sound apparently (it's true on my laptop).
But I think to something : do I need to install alsalib to see the sound device in /dev ?
Regards,
Cyril
TranslateQuoteReplyEditDelete
2007-12-26 20:14:23 Re: Advanced usage of the AD1981B codec
Robin Getz (UNITED STATES)
Message: 49021 Cyril:
You should not have /dev/sound, but /dev/snd/
root:~> ls -l /dev/snd/
crw-rw-r-- 1 root root 116, 0 Dec 11 17:41 controlC0
crw-rw-r-- 1 root root 116, 24 Dec 11 17:41 pcmC0D0c
crw-rw-r-- 1 root root 116, 16 Dec 11 17:41 pcmC0D0p
crw-rw-r-- 1 root root 116, 33 Dec 11 17:41 timer
-Robin
QuoteReplyEditDelete
2007-12-27 04:41:51 Re: Advanced usage of the AD1981B codec
Cyril HAENEL (FRANCE)
Message: 49032 Hi Robin,
I have not exactly the same output as you :
root:~> ls -lR /proc/asound/
/proc/asound/:
lrwxrwxrwx 1 root root 5 Jan 1 00:00 bf5xxboard -> card0
dr-xr-xr-x 2 root root 0 Jan 1 00:00 card0
-r--r--r-- 1 root root 0 Jan 1 00:00 cards
-r--r--r-- 1 root root 0 Jan 1 00:00 devices
dr-xr-xr-x 2 root root 0 Jan 1 00:00 oss
-r--r--r-- 1 root root 0 Jan 1 00:00 pcm
-r--r--r-- 1 root root 0 Jan 1 00:00 timers
-r--r--r-- 1 root root 0 Jan 1 00:00 version
/proc/asound/card0:
-r--r--r-- 1 root root 0 Jan 1 00:00 id
-rw-r--r-- 1 root root 0 Jan 1 00:00 oss_mixer
/proc/asound/oss:
-r--r--r-- 1 root root 0 Jan 1 00:00 devices
-r--r--r-- 1 root root 0 Jan 1 00:00 sndstat
root:~>
root:~> ls -lR /sys/devices/platform/soc-audio/
/sys/devices/platform/soc-audio/:
-r--r--r-- 1 root root 4096 Jan 1 00:01 codec_reg
-r--r--r-- 1 root root 4096 Jan 1 00:01 dapm_widget
lrwxrwxrwx 1 root root 0 Jan 1 00:01 driver -> ../../../bus/platform/drivers/soc-audio
-r--r--r-- 1 system -> ../../../../../../class/sound
-rw-r--r-- 1 root root 4096 Jan 1 00:01 uevent
root:~> rwxrwx 1 root root 0 Jan 1 00:01 subsystem -> ../../../bus/platform
-rw-r--r-- 1 root root 4096 Jan 1 00:01 uevent
/sys/devices/platform/soc-audio/sound:
drwxr-xr-x 8 root root 0 Jan 1 00:00 card0
/sys/devices/platform/soc-audio/sound/card0:
drwxr-xr-x 2 root root 0 Jan 1 00:00 audio
drwxr-xr-x 2 root root 0 Jan 1 00:00 controlC0
lrwxrwxrwx 1 root root 0 Jan 1 00:01 device -> ../../../../../devices/platform/soc-audio
drwxr-xr-x 2 root root 0 Jan 1 00:00 dsp
drwxr-xr-x 2 root root 0 Jan 1 00:00 mixer
drwxr-xr-x 2 root root 0 Jan 1 00:00 pcmC0D0c
drwxr-xr-x 2 root root 0 Jan 1 00:00 pcmC0D0p
lrwxrwxrwx 1 root root 0 Jan 1 00:01 subsystem -> ../../../../../class/sound
-rw-r--r-- 1 root root 4096 Jan 1 00:01 uevent
/sys/devices/platform/soc-audio/sound/card0/audio:
-r--r--r-- 1 root root 4096 Jan 1 00:01 dev
lrwxrwxrwx 1 root root 0 Jan 1 00:01 device -> ../../../../../../devices/platform/soc-audio/sound/card0
lrwxrwxrwx 1 root root 0 Jan 1 00:01 subsystem -> ../../../../../../class/sound
-rw-r--r-- 1 root root 4096 Jan 1 00:01 uevent
/sys/devices/platform/soc-audio/sound/card0/controlC0:
-r--r--r-- 1 root root 4096 Jan 1 00:01 dev
lrwxrwxrwx 1 root root 0 Jan 1 00:01 device -> ../../../../../../devices/platform/soc-audio/sound/card0
lrwxrwxrwx 1 root root 0 Jan 1 00:01 subsystem -> ../../../../../../class/sound
-rw-r--r-- 1 root root 4096 Jan 1 00:01 uevent
/sys/devices/platform/soc-audio/sound/card0/dsp:
-r--r--r-- 1 root root 4096 Jan 1 00:01 dev
lrwxrwxrwx 1 root root 0 Jan 1 00:01 device -> ../../../../../../devices/platform/soc-audio/sound/card0
lrwxrwxrwx 1 root root 0 Jan 1 00:01 subsystem -> ../../../../../../class/sound
-rw-r--r-- 1 root root 4096 Jan 1 00:01 uevent
/sys/devices/platform/soc-audio/sound/card0/mixer:
-r--r--r-- 1 root root 4096 Jan 1 00:01 dev
lrwxrwxrwx 1 root root 0 Jan 1 00:01 device -> ../../../../../../devices/platform/soc-audio/sound/card0
lrwxrwxrwx 1 root root 0 Jan 1 00:01 subsystem -> ../../../../../../class/sound
-rw-r--r-- 1 root root 4096 Jan 1 00:01 uevent
/sys/devices/platform/soc-audio/sound/card0/pcmC0D0c:
-r--r--r-- 1 root root 4096 Jan 1 00:01 dev
lrwxrwxrwx 1 root root 0 Jan 1 00:01 device -> ../../../../../../devices/platform/soc-audio/sound/card0
-r--r--r-- 1 root root 4096 Jan 1 00:01 pcm_class
lrwxrwxrwx 1 root root 0 Jan 1 00:01 subsystem -> ../../../../../../class/sound
-rw-r--r-- 1 root root 4096 Jan 1 00:01 uevent
/sys/devices/platform/soc-audio/sound/card0/pcmC0D0p:
-r--r--r-- 1 root root 4096 Jan 1 00:01 dev
lrwxrwxrwx 1 root root 0 Jan 1 00:01 device -> ../../../../../../devices/platform/soc-audio/sound/card0
-r--r--r-- 1 root root 4096 Jan 1 00:01 pcm_class
lrwxrwxrwx 1 root root 0 Jan 1 00:01 subsystem -> ../../../../../../class/sound
-rw-r--r-- 1 root root 4096 Jan 1 00:01 uevent
root:~>
All this is with ALSA for SoC audio support, SoC Audio for the ADI BF5xx chip and SoC AC97 Audio support for BF5xx activated in kernel
Now I try different things in the kernel config :
ALSA for SoC audio support : activated in kernel
SoC Audio for the ADI BF5xx chip : activated in kernel
SoC AC97 Audio support for BF5xx : activated as module
---> compilation error
ALSA for SoC audio support : activated in kernel
SoC Audio for the ADI BF5xx chip : activated as module
SoC AC97 Audio support for BF5xx : activated as module
---> compilation error
ALSA for SoC audio support : activated as module
SoC Audio for the ADI BF5xx chip : activated as module
SoC AC97 Audio support for BF5xx : activated as module
---> compilation OK
root:~> insmod /lib/modules/2.6.22.15-ADI-2007R2-pre-svn/kernel/sound/ac97_bus.ko
root:~> insmod /lib/modules/2.6.22.15-ADI-2007R2-pre-svn/kernel/sound/soc/snd-soc-core.ko
ASoC version 0.13.1
root:~> insmod /lib/modules/2.6.22.15-ADI-2007R2-pre-svn/kernel/sound/soc/blackfin/snd-soc-bf5xx-ac97.ko
root:~> insmod /lib/modules/2.6.22.15-ADI-2007R2-pre-svn/kernel/sound/soc/blackfin/snd-soc-bf5xx.ko
root:~> insmod /lib/modules/2.6.22.15-ADI-2007R2-pre-svn/kernel/sound/soc/codecs/snd-soc-ad1980.ko
root:~> insmod /lib/modules/2.6.22.15-ADI-2007R2-pre-svn/kernel/sound/soc/blackfin/snd-ad1981.ko
AD1980 SoC Audio Codec
asoc: AC97 <-> bf5xx-ac97 mapping ok
root:~>
root:~> ls /dev
audio mixer mtdblock0 pts ram12 ram3 ram8
console mtd0 mtdblock1 ram0 ram13 ram4 ram9
controlC0 mtd0ro null ram1 ram14 ram5 zero
dsp mtd1 pcmC0D0c ram10 ram15 ram6
log mtd1ro pcmC0D0p ram11 ram2 ram7
Now /dev/dsp is here !!! but there is no /dev/snd.
But tone doesn't work :
root:~> tone
ERROR: failed to open DAC device /dev/dsp
Do I need now to install alsa-libs ?
Regards,
Cyril
TranslateQuoteReplyEditDelete
2007-12-27 05:24:06 Re: Advanced usage of the AD1981B codec
Mike Frysinger (UNITED STATES)
Message: 49034 it doesnt matter what userspace libraries (like alsa-lib) you have installed ... /dev/dsp creation is completely up to the kernel and mdev
the important directory to look in is /sys/class/sound/ ... there needs to be a mixer and dsp subdirectory in there
QuoteReplyEditDelete
2007-12-27 05:39:08 Re: Advanced usage of the AD1981B codec
Cyril HAENEL (FRANCE)
Message: 49035 With the audio configured as module :
root:~> ls -lR /sys/class/sound/
/sys/class/sound/:
lrwxrwxrwx 1 root root 0 Jan 1 00:01 audio -> ../../devices/platform/soc-audio/sound/card0/audio
lrwxrwxrwx 1 root root 0 Jan 1 00:01 card0 -> ../../devices/platform/soc-audio/sound/card0
lrwxrwxrwx 1 root root 0 Jan 1 00:01 controlC0 -> ../../devices/platform/soc-audio/sound/card0/controlC0
lrwxrwxrwx 1 root root 0 Jan 1 00:01 dsp -> ../../devices/platform/soc-audio/sound/card0/dsp
lrwxrwxrwx 1 root root 0 Jan 1 00:01 mixer -> ../../devices/platform/soc-audio/sound/card0/mixer
lrwxrwxrwx 1 root root 0 Jan 1 00:01 pcmC0D0c -> ../../devices/platform/soc-audio/sound/card0/pcmC0D0c
lrwxrwxrwx 1 root root 0 Jan 1 00:01 pcmC0D0p -> ../../devices/platform/soc-audio/sound/card0/pcmC0D0p
lrwxrwxrwx 1 root root 0 Jan 1 00:00 timer -> ../../devices/virtual/sound/timer
root:~> ls -l /dev/dsp
brw-rw---- 1 root root 14, 3 Jan 1 00:01 /dev/dsp
On my laptop :
cat testfile > /dev/dsp
I hear sound
On the bf537 board :
root:~> cat testfile > /dev/dsp
/dev/dsp: cannot create
Yet, /dev/dsp is here
TranslateQuoteReplyEditDelete
2007-12-27 05:48:48 Re: Advanced usage of the AD1981B codec
Mike Frysinger (UNITED STATES)
Message: 49037 so your userspace is ok ... the device node is being created properly
the failure is in the kernel driver somewhere
QuoteReplyEditDelete
2007-12-27 06:04:41 Re: Advanced usage of the AD1981B codec
Cyril HAENEL (FRANCE)
Message: 49038 The /dev/dsp is only created when I have the soc sound as module.
The error when opening /dev/dsp probably come from the fact that it's not an ad1980 but an ad1986.
TranslateQuoteReplyEditDelete
2007-12-27 09:15:21 Re: Advanced usage of the AD1981B codec
Cyril HAENEL (FRANCE)
Message: 49050 Do I need to add something in the board file ?
TranslateQuoteReplyEditDelete
2007-12-29 10:36:12 Re: Advanced usage of the AD1981B codec
Cyril HAENEL (FRANCE)
Message: 49112 Good news !
I was right, it was the same error/problem than on my LQ043 topic. With the "Create deprecated sysfs files" option activated in the kernel config, I can open /dev/dsp and /dev/snd/* is well created.
When I launch "tone" or mp2play, I can see the sound on the LINE_OUT_R and LINE_OUT_L outputs, good !
Now the next step for me is to see how use the 6 DAC as 3 independants channels....
Regards,
Cyril
TranslateQuoteReplyEditDelete
2008-02-19 13:30:05 Re: Advanced usage of the AD1981B codec
Cyril HAENEL (FRANCE)
Message: 51292 Sorry to up this old thread..
The board I work on is for an electric car which will be presented to the "Geneva show" the 6-16 march 2008.
Thus I have some thing to finish, and the sound is the priority...
For now everything is ok with the AD1986, I use the soc driver as is (ad1980 based I believe), and it works well.
When I launch mp3play or tone or play, signals appears on the stereo outputs of the codec.
Yesterday I worked on the stereo amplifier part of the board (TPA3100D2 based), it works, but to do the job correctly I want to correctly setup the amplifier gain to never saturate, and I have some questions :
After boot, the "mixer" application tells me that "vol" is at 100, and "pcm" is at 100.
With this, if I launch tone, I have a perfect sinus on the stereo output, at maximum scale : 0V to 4.5V centered on 2.25V (4.5V peak to peak)
But if I play a 16 bits wav file, containing a sinus at full scale ( -32768/+32767), the signal at the codec output is completly saturated. I need to set the "pcm" to 82 to have the max amplitude value before saturate : 0.25V to 4.25V centered on 2.25V (4V peak to peak).
If set "pcm" to 83 I go in saturation.
What configuration I need to use to set my amplifier gain to not saturate the signal on my speaker ?
What I don't understand it's why a full scale 16 bits sinus goes in saturation on the codec output if the volumes are set to 100% ??
TranslateQuoteReplyEditDelete
2008-02-19 14:29:26 Re: Advanced usage of the AD1981B codec
Robin Getz (UNITED STATES)
Message: 51294 Cyril:
Tone does not play out full scale.
try "tone -?" to get usage, but what I think you want is the (undocumented - will fix that) "-m" magintude option.
0 to 255 (255 is full scale, default is 100 (or ~ 40% of linear volume).
-Robin
QuoteReplyEditDelete
2008-02-19 16:45:20 Re: Advanced usage of the AD1981B codec
Cyril HAENEL (FRANCE)
Message: 51297 Robin, in fact it was not exactly my question. Even if tone don't generate a full scale sinus by default, I can do it with a wav file.
What I what to know is if it's a normal behavior to have the codec outputs saturated when playing a full scale sinus with "vol" and "pcm" to 100.
In my case, the codecs outputs are full scale and not saturated when I play my full scale wav file with "vol" to 100 and "pcm" to 82.
I want to undertand this because if some audio file have sounds close to the full scale and volume is 100%, the sound will be already deteriorated before the amplifier !
TranslateQuoteReplyEditDelete
2008-02-20 05:18:21 Re: Advanced usage of the AD1981B codec
Cyril HAENEL (FRANCE)
Message: 51332 Okay, I think I have my answer.
I connected a cable into the headphone of my laptop, and I tested same thing I have tested on my board, with my wav file which contain a sinus at full scale.
I used alsamixer to play with volumes.
When headphone volume and pcm are set to 100%, the sinus is also saturated on the output, at same level as me : 4.6V peak to peak. I need to set the pcm value to 81 to have a perfect sinus close to full scale without saturation (4.05V peak to peak). When I set pcm to 84 (I cannot find how to have a increment step of 1), the sinus begin to saturate.
Thus in fact I have exactly the same behavior on my board, the maximum pcm level before saturation is 82.
It is as if value above 82 amplify the original signal in fact ??
And when pcm is at 100, and I play with the headphone volume, the sinus stay saturated even if the output signal have low amplitude (with headphone volume to 50 for example) !!
Now I know it's normal I have this behavior on my board, thus I can set my amplifier gain to never saturate on the speaker with a full scale signal at input (+/-2.3V). Thus because the amplifier is powered under 12V, I need a x5.2 gain value.
Regards,
Cyril
TranslateQuoteReplyEditDelete
2008-02-20 11:41:06 Re: Advanced usage of the AD1981B codec
Robin Getz (UNITED STATES)
Message: 51366 Cyril:
It is difficult to define audio and "standard" in terms of anything.
<meta content="text/html; charset=utf-8" http-equiv="CONTENT-TYPE" /> <title></title> <meta content="OpenOffice.org 2.0 (Linux)" name="GENERATOR" /> <meta content="Anniep" name="AUTHOR" /> <meta content="20001031;12210000" name="CREATED" /> <meta content="ShawnPr" name="CHANGEDBY" /> <meta content="20001102;15500000" name="CHANGED" />PC2001 defines full scale output as >= 1Vrms (2.82 V peak-peak).
http://www.microsoft.com/whdc/system/platform/pcdesign/desguide/pcguides.mspx
Typically Windows limits the gain in the codec, and does not set the top of the slider to be the max gain.
I'm not sure if that answers things or not. but it is normal (but bad) for a full scale audio file to saturate the outputs at the max gain.
-Robin
QuoteReplyEditDelete
2008-02-20 11:50:34 Re: Advanced usage of the AD1981B codec
Cyril HAENEL (FRANCE)
Message: 51368 I will do the same thing in the final application : limit the gain to never saturate the codec output, even with a full scale signal in the audio file.
I set my amplifier gain to never saturate on the speaker, I connect 2 verygood speakers, and it's really incredible the power I have with the TPA3100D2 (class D amplifier) !!
With a 2000Hz tone at full scale (~18W rms), it's untenable !!