2011-01-21 12:29:19 using generic I2S audio DAC
Sam Hawkens (GERMANY)
Message: 97608
I am trying to use a generic I2S audio DAC with a BF533 stamp board. In the past I used the AD1836 driver in I2S mode and this worked fine. Now I ugraded to the 2010R1 (uClinux + toolchain). The current AD1836 ALSA SOC driver seems to support only TDM mode. When I use this driver (modprobe works fine) I get a /dev/dsp device and can run 'tone'. What I hear sounds like some clicks and pops - no wonder if it's TDM.
So I looked for an alternative and found the SSM2602 and the ADAV80x driver. I understand both use I2S mode. Is this correct?
When I use either of these drivers I get the same effect. Modprobe seems to work, but no /dev/dsp shows up. And naturally 'tone' produces an error.
What am I missing?
root:/> modprobe snd-ssm2602
dma rx:1 tx:2, err irq:10, regs:ffc00800
root:/> modprobe snd-pcm-oss
root:/> lsmod
Module Size Used by
snd_pcm_oss 28254 0
snd_mixer_oss 10159 1 snd_pcm_oss
snd_ssm2602 813 0
snd_bf5xx_i2s 1708 1 snd_ssm2602
snd_soc_bf5xx_i2s 1833 1 snd_ssm2602
snd_soc_bf5xx_sport 9444 2 snd_bf5xx_i2s,snd_soc_bf5xx_i2s
snd_soc_ssm2602 6613 1 snd_ssm2602
snd_soc_core 35007 4 snd_ssm2602,snd_bf5xx_i2s,snd_soc_bf5xx_i2s,snd_soc_ssm2602
i2c_core 12456 2 snd_soc_ssm2602,snd_soc_core
snd_pcm 45420 3 snd_pcm_oss,snd_bf5xx_i2s,snd_soc_core
snd_timer 12424 1 snd_pcm
snd_page_alloc 2749 1 snd_pcm
snd 31839 5 snd_pcm_oss,snd_mixer_oss,snd_soc_core,snd_pcm,snd_timer
soundcore 3499 1 snd
root:/> tone
ERROR: failed to open DAC device /dev/dsp
root:/> ls -l /dev/d*
ls: /dev/d*: No such file or directory
Same thing with the ADAV80x driver...
root:/> modprobe snd-adav80x
dma rx:1 tx:2, err irq:10, regs:ffc00800
root:/> modprobe snd-pcm-oss
root:/> tone
ERROR: failed to open DAC device /dev/dsp
root:/> ls -l /dev/dsp
ls: /dev/dsp: No such file or directory
root:/> lsmod
Module Size Used by
snd_pcm_oss 28254 0
snd_mixer_oss 10159 1 snd_pcm_oss
snd_adav80x 789 0
snd_bf5xx_i2s 1708 1 snd_adav80x
snd_soc_bf5xx_i2s 1833 1 snd_adav80x
snd_soc_bf5xx_sport 9444 2 snd_bf5xx_i2s,snd_soc_bf5xx_i2s
snd_soc_adav80x 4233 1 snd_adav80x
snd_soc_core 35007 4 snd_adav80x,snd_bf5xx_i2s,snd_soc_bf5xx_i2s,snd_soc_adav80x
i2c_core 12456 2 snd_soc_adav80x,snd_soc_core
snd_pcm 45420 3 snd_pcm_oss,snd_bf5xx_i2s,snd_soc_core
snd_timer 12424 1 snd_pcm
snd_page_alloc 2749 1 snd_pcm
snd 31839 5 snd_pcm_oss,snd_mixer_oss,snd_soc_core,snd_pcm,snd_timer
soundcore 3499 1 snd
root:/>
QuoteReplyEditDelete
2011-01-23 23:35:06 Re: using generic I2S audio DAC
Sonic Zhang (CHINA)
Message: 97634
Did you install the ssm2602/3 or adv80x add-on boards to your bf533-stamp before inserting the kernel module? The node is created by mdev only after the device is probed successfully.
QuoteReplyEditDelete
2011-01-24 02:01:16 Re: using generic I2S audio DAC
Sam Hawkens (GERMANY)
Message: 97635
OK, that explains it. The "generic" DAC I am using has only an I2S Interface for the audio data, but no control via I2C or SPI. Is there any "quick and dirty" way to get one of the available drivers to work with it? Or re-enable I2S in the AD1836 driver like in the past releases?
QuoteReplyEditDelete
2011-01-24 02:05:48 Re: using generic I2S audio DAC
Sonic Zhang (CHINA)
Message: 97636
Why not write your own ASOC driver for this "generic" DAC?
QuoteReplyEditDelete
2011-01-24 16:14:15 Re: using generic I2S audio DAC
Sam Hawkens (GERMANY)
Message: 97654
Well, yes, I was trying to avoid this. Especially since the AD1836 driver worked fine for me in I2S mode before it was ported to ASOC. And there are already so many drivers that basically all do the same thing... Anyway, thanx a lot for the feedback and support. I'll try to get into the principle of ASOC an write something that suits my needs.
QuoteReplyEditDelete
2011-01-26 08:52:01 Re: using generic I2S audio DAC
Sam Hawkens (GERMANY)
Message: 97700
OK, I am trying to strip all "unnecessary-for-me" code from the SSM2602 driver since I need an example to start with. One more question: which function call does actually create the node /dev/dsp?
QuoteReplyEditDelete
2011-01-26 15:23:49 Re: using generic I2S audio DAC
Mike Frysinger (UNITED STATES)
Message: 97708
/dev/dsp is completely in the OSS emulation layer. alsa drivers do not deal with that directly in any way.
QuoteReplyEditDelete
2011-01-30 06:44:52 Re: using generic I2S audio DAC
Sam Hawkens (GERMANY)
Message: 97774
Meanwhile I have made some progress. I did not want to reinvent the wheel, so I looked through the mainlined codeds and found that wm8727.c is just what I need. A stereo I2S DAC without control Interface. Great. So all I have to do is to create a machine driver to glue the codec and the blackfin platform driver together. At least that's what I thought, but now I am stuck and need some help. This is what I did:
create a machine driver bf5xx-wm8727.c
If you diff the src included against bf5xx-ad183x.c you will find they are almost identical. So that should work.
patch blackfin-linux-dist/linux-2.6.x/sound/soc/blackfin/Makefile to build the driver
patch blackfin-linux-dist/linux-2.6.x/sound/soc/blackfin/Kconfig to add an option to make menuconfig
patch blackfin-linux-dist/romfs/etc/modprobe.conf to use this module instead of ad183x
Is that the right way to go? Can't be too wrong, at least I get the following result:
root:/> modprobe snd-wm8727
dma rx:1 tx:2, err irq:10, regs:ffc00800
bf5xx_wm8727_init
bf5xx_wm8727_init platform_device_alloc OK
bf5xx_wm8727_init OK
root:/> lsmod
Module Size Used by
snd_wm8727 1013 0
snd_soc_wm8727 1549 1 snd_wm8727
snd_bf5xx_i2s 1708 1 snd_wm8727
snd_soc_bf5xx_i2s 1833 1 snd_wm8727
snd_soc_bf5xx_sport 9444 2 snd_bf5xx_i2s,snd_soc_bf5xx_i2s
snd_soc_core 35007 4 snd_wm8727,snd_soc_wm8727,snd_bf5xx_i2s,snd_soc_bf5xx_i2s
snd_pcm 45548 2 snd_bf5xx_i2s,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
That looks quite good to me. But Alsa won't find a sound card:
root:/> cat /proc/asound/cards
--- no soundcards ---
root:/> cat /proc/asound/devices
33: : timer
So I thought maybe Alsa needs a configuration file for the card(?) I added this to romfs:
root:/> cat /usr/share/alsa/cards/WM8727.conf
WM8727.pcm.default {
@args [ CARD ]
@args.CARD {
type string
}
type asym
playback.pcm {
type plug
slave.pcm {
@func concat
strings [ "dmix:CARD=" $CARD ]
}
}
}
but I must admit this was just a guess. Anyway I could not figure out how Alsa would know how this file is connected to the ASoC driver.
This is where I am stuck. What is missing???
bf5xx-wm8727.c
Kconfig.patch
modprobe.conf.patch
Makefile.patch
QuoteReplyEditDelete
2011-01-30 14:13:45 Re: using generic I2S audio DAC
Mike Frysinger (UNITED STATES)
Message: 97783
if you arent seeing anything in /proc/, then nothing in userspace will fix this. so dont worry about alsa config files. look at your board file to make sure you've registered the resources to pull in your new drivers.
QuoteReplyEditDelete
2011-01-31 01:49:34 Re: using generic I2S audio DAC
Sam Hawkens (GERMANY)
Message: 97801
The codec driver is mainlined, so I expect this to be tested. And the driver I added is identical with bf5xx-ad183x.c (which is working) except for the following changes:
ad183x uses bf5xx-tdm, my driver is using bf5xx-i2s
ad183x calls snd_soc_dai_set_channel_map(), my driver doesn't. I think it is only required for tdm(?)
snd_soc_dai_set_fmt() is used with different parameters
And that's all.
QuoteReplyEditDelete
2011-01-31 02:09:08 Re: using generic I2S audio DAC
Mike Frysinger (UNITED STATES)
Message: 97802
the mainline status of codecs is irrelevant. these are platform drivers which means they only get instantiated at runtime if you provide proper corresponding platform resources in your boards file.
this is documented in the wiki already:
docs.blackfin.uclinux.org/doku.php?id=uclinux-dist:dev-management#troubleshooting
QuoteReplyEditDelete
2011-02-01 02:35:27 Re: using generic I2S audio DAC
Sam Hawkens (GERMANY)
Message: 97829
Are we actually talking about blackfin-linux-dist/linux-2.6.x/arch/blackfin/mach-bf533/boards/stamp.c in case of my BF533 Stamp board? Still I do not see what I would have to add there aside from what's already configured by default. This is already in the file:
#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
static struct platform_device bfin_i2s = {
.name = "bfin-i2s",
.id = CONFIG_SND_BF5XX_SPORT_NUM,
/* TODO: add platform data here */
};
#endif
#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
&bfin_i2s,
#endif
What else do I need? When I look at ad183x there is only a struct in bfin_spi_board_info[] and I don't have SPI control. Anything else?
QuoteReplyEditDelete
2011-02-01 02:57:44 Re: using generic I2S audio DAC
Mike Frysinger (UNITED STATES)
Message: 97831
so you havent declared any resources for the codec you're actually using ? the ad183x parts use spi, thus spi resources are declared. find out what resources your codec needs and add those to your board resources.
it looks like you arent using an ADI part, so i dont know what your codec requires.
QuoteReplyEditDelete
2011-02-01 03:03:02 Re: using generic I2S audio DAC
Sam Hawkens (GERMANY)
Message: 97832
The codec has no control interface. Just I2S audio via SPORT0 - that's it. So do I need to declare any resources for using the snd-soc-bf5xx-i2s platform drivers?
QuoteReplyEditDelete
2011-02-01 03:17:21 Re: using generic I2S audio DAC
Mike Frysinger (UNITED STATES)
Message: 97837
review the codec driver in question, or ask the manuf of the codec in question. every ASOC codec driver needs some kind of resource in order for the kernel to instantiate it.