2011-02-26 01:11:20     AD1938 audio

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

2011-02-26 01:11:20     AD1938 audio

Jean Nicollerat (SWITZERLAND)

Message: 98445   

 

Hi,

 

I want to use the AD1938 with the BF537-stamp board.

 

I have compile the kernel with the drivers, all seem ok, but I don't how to access to de device, how to send commandw, read ,write stream, ..

 

I have see that there is documentation at this link :   docs.blackfin.uclinux.org/doku.php?id=linux-kernel:drivers:ad193x&s[]=ad193x

 

but the link is broken.

 

 

 

regards

 

Jean

QuoteReplyEditDelete

 

 

2011-02-27 18:27:50     Re: AD1938 audio

Mike Frysinger (UNITED STATES)

Message: 98456   

 

everything in userspace is done via ALSA

 

you can use the example apps like "tone" or "aplay".  if you want to do something in your own code, please refer to:

  alsa-project.org

QuoteReplyEditDelete

 

 

2011-03-02 11:52:22     Re: AD1938 audio

Jean Nicollerat (SWITZERLAND)

Message: 98601   

 

I have compile the kernel and boot with it.

 

I have make a modprobe on some module ( Is it possible to make it at boot ?)

 

\u:\w> lsmod

Module                  Size  Used by

snd_ad193x               829  0

snd_soc_ad193x          5641  1 snd_ad193x

snd_bf5xx_tdm           1853  1 snd_ad193x

snd_soc_bf5xx_tdm       2157  1 snd_ad193x

snd_soc_bf5xx_sport     9448  2 snd_bf5xx_tdm,snd_soc_bf5xx_tdm

bfin_dma                2093  0

snd_soc_core           35479  4 snd_ad193x,snd_soc_ad193x,snd_bf5xx_tdm,snd_soc_bf5xx_tdm

i2c_core               12456  2 snd_soc_ad193x,snd_soc_core

snd_pcm                44692  2 snd_bf5xx_tdm,snd_soc_core

snd_timer              12472  1 snd_pcm

snd_page_alloc          2749  1 snd_pcm

snd                    32553  3 snd_soc_core,snd_pcm,snd_timer

soundcore               3499  1 snd

ac97_bus                 513  1 snd_soc_core

 

 

I try the app "tone" but I get the message : /dev/dsp: No such file or directory

 

I try the app "aplay" but I don't have it. It seem that I have to add the "ALSA utils" option at the compilation to have it. But I get an error message at the building (don't found a header file).

 

Can anybody help ?

QuoteReplyEditDelete

 

 

2011-03-02 21:41:40     Re: AD1938 audio

Mike Frysinger (UNITED STATES)

Message: 98607   

 

you need to enable the OSS emulation to use things like /dev/dsp

 

also, you didnt post the actual error you're seeing so i can only guess, but ALSA requires FDPIC.  you cannot build it as FLAT.

QuoteReplyEditDelete

 

 

2011-03-03 13:59:40     Re: AD1938 audio

Adam Rosenberg (UNITED STATES)

Message: 98631   

 

I noticed that if you enable OSS emulation as a module you will have to load it manually.  Like this:

 

modprobe snd-pcm-oss.ko

modprobe snd-mixer-oss.ko

 

-Adam

QuoteReplyEditDelete

 

 

2011-03-04 08:00:29     Re: AD1938 audio

Jean Nicollerat (SWITZERLAND)

Message: 98651   

 

Thanks you.

 

I have compile the kernel and make a test with "tone", it's working.

 

 

 

But it is not clear for me wich modules the system need.

 

And there are modules about the ad193x in :

 

/lib/modules/2.6.../kernel/sound/soc/blackfin/snd-ad193x.ko

 

/lib/modules/2.6.../kernel/sound/soc/codec/snd-soc-ad193x.ko

 

what is the differences ?

 

 

 

Know I try to play a wav with aplay but I get only noise. I try different format and rate. I don't know if the probleme come from the  the wav file I use or if it is the configuration of the ad1938 that is wrong.

QuoteReplyEditDelete

 

 

2011-03-04 16:26:02     Re: AD1938 audio

Mike Frysinger (UNITED STATES)

Message: 98657   

 

one module is the codec driver and the other module is the machine driver (connects the codec to a transport)

QuoteReplyEditDelete

 

 

2011-03-07 12:05:23     Re: AD1938 audio

Jean Nicollerat (SWITZERLAND)

Message: 98686   

 

I make a test with "tone", and I see that the output signal is not 1000 Hz but 2000Hz.

 

Where is clock selection ?

 

I try to change int the ad193x_bus_probe function:

 

    /* pll input: mclki/xi */

    snd_soc_write(codec, AD193X_PLL_CLK_CTRL0, 0x9D); /* mclk=24.576Mhz: 0x9D; mclk=12.288Mhz: 0x99 */

    snd_soc_write(codec, AD193X_PLL_CLK_CTRL1, 0x04);

    /*ad193x->sysclk = 12288000;*/

    ad193x->sysclk = 24527000; //

 

but there is no change.

QuoteReplyEditDelete

 

 

2011-03-07 21:40:41     Re: AD1938 audio

Mike Frysinger (UNITED STATES)

Message: 98695   

 

i vaguely recall that the `tone` output isnt exact.  so i wouldnt necessarily trust that when tone claims to do 1KHz, it is actually generating 1KHz.  might be better to encode a wav file in the correct format and write it directly to /dev/dsp.

QuoteReplyEditDelete

 

 

2011-03-08 02:12:18     Re: AD1938 audio

Jean Nicollerat (SWITZERLAND)

Message: 98700   

 

I have make the test with a wave file at 1kHz, it's the same I mesure 2kHz. (I test the wave on the sound card of my PC and I mesure the 1 kHz)

 

I also mesure the MCLK on SCLK3 on the ADZS-BFAUD_EZEXT board and I mesure  about 24.51 MHz.

 

In the ad19cx.c file there is :

 

ad193x->sysclk = 12288000;

 

if there is the frequency espected it is false (in my case).

 

As the signal come from the ADAV801, I don't know if there is a configuration I miss.

QuoteReplyEditDelete

 

 

2011-03-08 02:38:25     Re: AD1938 audio

Jean Nicollerat (SWITZERLAND)

Message: 98702   

 

I have the file ad193x.c like that :

 

    /* pll input: mclki/xi */

    snd_soc_write(codec, AD193X_PLL_CLK_CTRL0, 0x9D); /* mclk=24.576Mhz: 0x9D; mclk=12.288Mhz: 0x99 */

    snd_soc_write(codec, AD193X_PLL_CLK_CTRL1, 0x04);

    /*ad193x->sysclk = 12288000;*/

    ad193x->sysclk = 24576000;

 

And know it's ok.

QuoteReplyEditDelete

 

 

2011-03-09 01:29:10     Re: AD1938 audio

Sonic Zhang (CHINA)

Message: 98745   

 

The crystal oscillator on different sound add on boards may differ. So, set a correct value according to your add on board.

QuoteReplyEditDelete

 

 

2011-03-09 01:56:54     Re: AD1938 audio

Mike Frysinger (UNITED STATES)

Message: 98746   

 

no driver should have xtal settings hardcoded in them.  if our codec driver is doing that now, it is broken, and needs to have that pulled out into the platform resources.

QuoteReplyEditDelete

 

 

2011-03-09 04:18:31     Re: AD1938 audio

Scott Jiang (CHINA)

Message: 98760   

 

Add a patch to linux-2.6.x/sound/soc/blackfin/bf5xx-ad193x.c, please update the lastest trunk.

 

This machine driver contains board specific audio configuration, now you can config the sysclk.

 

Please don't modify codecs/ad193x.c, this is codec driver for all boards.

Attachments

    Outcomes