[alsa-devel] [PATCH] ASoC: core: allow control index different from 0

Takashi Sakamoto o-takashi at sakamocchi.jp
Mon Oct 10 15:03:35 CEST 2016


On Oct 10 2016 18:26, Arnaud Pouliquen wrote:
> Sorry if my approach to treat the topic is not good. My Aim is to find a
> way to support multi instances of an alsa control.
> As I suppose that i'm not alone to have this kind of problematic. I am
> trying to look for a generic way to do it.
> 
>>
>> On Oct 8 2016 01:41, Arnaud Pouliquen wrote:
>>> Perhaps this could be handled in a generic way in control.c?
>>> Today if control is identical, snd_ctl_add returns an error.
>>> Instead an auto-incrementation mechanism could be implemented to
>>> increase index.
>>
>> Just for ALSA SoC part, something like below (not tested). This never
>> work well because 0 is still assigned to the index field later.
> Index is forced to 0 in snd_soc_cnew. Not updated after, please find
> comment in line in your patch.

I should write that '0 is assigned to the index field later than
calculated index number is assigned'.

>> But I still oppose this idea. This idea allows drivers to add control
>> element sets of different types (int/int64/bytes etc...) with the same
>> name and different index number. This certainly brings confusions to
>> applications.
> Today is already possible using the device or subdevice field instead of
> index.

Please explain about the reason or show references to the reason that
usage of iface/card/device/subdevice combination is not convenient to
your issue. To me, this solves the issue (second issue in your previous
message) because at least, from user land, applications can identify a
control element corresponding to each PCM subdevice.

In other words, in your taste, why this is not a generic way for
something you face (this is not cleared yet to me).

>> In a framework of ALSA SoC part, several drivers are associated to one
>> sound card instance can add their own control element sets. There's no
>> mechanism to prevent my concern. This idea is bad.
> Please tell me if i misunderstand. So for you, there is no real solution
> to do it in a generic way. Drivers has to implement it, if they want to
> support.

Over-generalizing, you did.

In my insistent, the usage of index field for this purpose is not just
better. I've never said that no real solutions we have.

> Another solution is to declare a card per instance of control.
> This should work for my use case and for use cases with several codecs
> that declare same controls.> But this should not work for DPCM...
> The drawback for my use case, would be that i need to declare one card
> per PCM device.

In my understanding, this idea is not good for simple-card
implementation in ALSA SoC part, too. The idea needs more complicated
driver to have several instances of sound card.


Regards

Takashi Sakamoto


More information about the Alsa-devel mailing list