[alsa-devel] How to support mutiple audio interface in alsa

Takashi Iwai tiwai at suse.de
Thu Sep 10 15:27:38 CEST 2009


At Wed, 9 Sep 2009 11:50:34 -0700,
Feng Ye wrote:
> 
> Hello there,
> 
> This question is for ALSA, not ALSA SOC.
> I am doing an ALSA driver for our chip (soc chip with cpu inside), inside it has I2S and DAC. The I2S can be feed to DAC, or come out of the chip to an external CODEC chip.
> I wonder how should I model this in the driver, are they multiple ALSA cards, or devices, or subdevices?
> Since the I2S is shared, I think the most appropriate is 'subdevice', but I do not see how this is used in linux/sound, this is only used in pci, and seems to
 tied together with substream number.

The substream can be specified explicitly with arguments such as hw:0,1,2,
which means card#0, PCM device#1 and substream#2.

The multiple substreams are provided usually for the multiple playback
devices (hardware mixing) or for multiple channel streams (separate
streams for front, rear, clfe, etc).

> If the answer is 'device', is there some existing driver that are doing this?

There are several drivers using multiple devices.  For example,
emu10k1 provides front, rear, clfe as separate PCM devices, and
combine them together in alsa-lib using multi plugin.

The main difference is that the multiple substreams are supposed to be
chosen automatically at multiple opens of the device.  This is good
for multiple playback systems with h/w mixing.  If the streams should
be handled rather independently, multiple PCM devices might be more
appropriate.  But, there isn't too big difference in the
implementation difficulties.


Takashi


More information about the Alsa-devel mailing list