Skip to contentSkip to conversation

Does ASoC support sound card with multiple interfaces?

DISCUSSION Ashish Chavan 3 participants 7 messages Jan 2, 2012 – Jan 5, 2012

lore
Share & tools
lore
#0 lore raw

Hi,
I have a codec with multiple TX and RX channels. In ASoC tree, I have
seen examples where these kind of codecs are implemented as multichannel codecs. Instead I want it to be treated as card with multiple interfaces, e.g. Instead of one interface with eight TX channels, I need it to behave it as card with four stereo playback interfaces. The primary aim for doing this is that multiple applications should be able to play/record simultaneously. AFAIK, In case of a multichannel card, if it is opened by one application for stereo playback, there is no way to use rest of the unused channels by other applications.

Is it easily possible to achieve what I am trying to? Any pointers to example driver source will greatly help!

BTW all three i.e., platform, machine as well as codec driver are to be implemented. I am aware of the fact that this requirement may affect all three.

Thanks in advance,

-- Ashish
|| GNU FAN ||

#1 lore raw

On Mon, Jan 02, 2012 at 08:36:13PM +0530, Ashish Chavan wrote:

Always CC maintainers!

Quoted 3 lines

I have a codec with multiple TX and RX channels. In ASoC tree, I have
seen examples where these kind of codecs are implemented as multichannel codecs. Instead I want it to be treated as card with multiple

Yes, this is totally supported. There are quite a few examples of this in the tree. Your CODEC driver should just implement one DAI per audio interface.

#2 lore raw
Quoted 8 lines
Quoted 3 lines

I have a codec with multiple TX and RX channels. In ASoC tree, I have
seen examples where these kind of codecs are implemented as multichannel codecs. Instead I want it to be treated as card with multiple

Yes, this is totally supported. There are quite a few examples of this in the tree. Your CODEC driver should just implement one DAI per audio interface.

Thanks.

I am looking at some of the examples in the tree and have a small query. I want to know how alsa-utils (aplay, arecord) will behave when a codec driver supports multiple DAIs. For example, let's assume that a codec driver implements two DAIs, both capable of doing stereo playback. Then I try to play two files simultaneously using aplay, e.g.

$ aplay x.wav
$ aplay y.wav

AFAIK first "aplay" will result in play back on default interface/DAI (i.e. 0). What will happen with second aplay? Will it automatically find a free DAI to playback? or it is mandatory to explicitly specify the PCM/card # for second aplay?

Similarly what will happen in case of arecord when a codec supports multiple DAIs capable of capturing?

#3 lore raw

Hello Ashish

Quoted 17 lines · Ashish Chavan
Quoted 8 lines
Quoted 3 lines

I have a codec with multiple TX and RX channels. In ASoC tree, I have
seen examples where these kind of codecs are implemented as multichannel codecs. Instead I want it to be treated as card with multiple

Yes, this is totally supported. There are quite a few examples of this in the tree. Your CODEC driver should just implement one DAI per audio interface.

Thanks.

I am looking at some of the examples in the tree and have a small query. I want to know how alsa-utils (aplay, arecord) will behave when a codec driver supports multiple DAIs. For example, let's assume that a codec driver implements two DAIs, both capable of doing stereo playback. Then I try to play two files simultaneously using aplay, e.g.

Quoted 6 lines
$ aplay x.wav
$ aplay y.wav

AFAIK first "aplay" will result in play back on default interface/DAI (i.e. 0). What will happen with second aplay? Will it automatically find a free DAI to playback?

No,

or it is mandatory to explicitly specify the

Quoted 2 lines

PCM/card # for second aplay?

You need to redirect it . You can use

aplay -Dplughw:0,1 x.wav.

Here '0' indicated card number and '1' indicates device number

~Regards
Rajeev

Quoted 9 lines

Similarly what will happen in case of arecord when a codec supports multiple DAIs capable of capturing?

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#4 lore raw
Quoted 6 lines

You need to redirect it . You can use

aplay -Dplughw:0,1 x.wav.

Here '0' indicated card number and '1' indicates device number

Is it really mandatory to specify card and device id? Isn't there a middle layer that takes care of using "first free" interface for playback or recording, if interface is not explicitly specified? As we register DAIs with ALSA subsystem, it should be fairly easy for alsa-lib to find out "first free" interface.

I am aware that this wouldn't be practically useful in most cases, because generally we know beforehand which specific interface to be used for playback/recording. In such cases, automatic selection of interface may be confusing to users. But I just want to confirm if this is at all possible?

#5 lore raw
Quoted 13 lines · Ashish Chavan
Quoted 6 lines

You need to redirect it . You can use

aplay -Dplughw:0,1 x.wav.

Here '0' indicated card number and '1' indicates device number

Is it really mandatory to specify card and device id? Isn't there a middle layer that takes care of using "first free" interface for playback or recording, if interface is not explicitly specified? As we register DAIs with ALSA subsystem, it should be fairly easy for alsa-lib to find out "first free" interface.

Quoted 7 lines

I am aware that this wouldn't be practically useful in most cases, because generally we know beforehand which specific interface to be used for playback/recording. In such cases, automatic selection of interface may be confusing to users. But I just want to confirm if this is at all possible?

AFAIK, automatic selection is not there

~Rajeev

#6 lore raw
In reply to Ashish Chavan
Quoted 5 lines · Ashish Chavan

Is it really mandatory to specify card and device id? Isn't there a middle layer that takes care of using "first free" interface for playback or recording, if interface is not explicitly specified? As we register DAIs with ALSA subsystem, it should be fairly easy for alsa-lib to find out "first free" interface.

That's not implemented since genuinely identical interfaces should be implemented by supporting multiple opens on a single device but those essentailly don't exist in embedded hardware. Pretty much all embedded hardware with multiple routes out of the CPU has either distinct fixed functions for the outputs or independant routing of them so they can't reliably be used interchangibly.

You could implement it but it'd have to be a system specific option to use it.