[alsa-devel] dev_* output functions and ASoC codecs

Barry Song 21cnbao at gmail.com
Mon Oct 12 12:34:56 CEST 2009


On Mon, Oct 12, 2009 at 5:36 PM, Mark Brown
<broonie at opensource.wolfsonmicro.com> wrote:
> On Mon, Oct 12, 2009 at 10:26:09AM +0800, Barry Song wrote:
>
> Please don't top post and please start new threads for new topics.
>
>> We use many global variables in asoc now, except defining two/multi
>> groups of global variables to fulfill two/multi codecs work at the
>> same time in one system, is there any other way?
>
> Could you be more specific about which variables you are talking about
> here?  In general you should just use the struct device driver data or
> a private data field in one of the ASoC structures for any per-device
> data, in much the same way as you would do for any other system.
>
Let me take wm8903 as an example.
In codec:
"static struct snd_soc_codec *wm8903_codec" is a global variable to
describe a codec.  The global variable limit the codec driver can only
support one to work.
If we use num_links = 2, it seems codec_dai for wm8903 should be duplicated too.

In CPU dai:
in case there are two same I2S interfaces connecting two same wm8903,
then an array with two elements for CPU dai is needed.
For the two struct snd_soc_dai, all fields(like probe, remove) are
same except private_data.

In machin driver:
snd_soc_dai_link connect the multi same CPU dai and codec dai together.

If we don't use num_links =2, we need to call
platform_device_alloc("soc-audio",...)/platform_device_add() twice
with duplicated struct snd_soc_device.

Don't know whether I lost something.


More information about the Alsa-devel mailing list