On Thu, Aug 06, 2020 at 10:30:36AM -0500, Pierre-Louis Bossart wrote:
What I was trying to describe in my earlier answer is a different need to have an atomic update of *multiple* controls.
If e.g. a DSP or hardware engine exposes two separate filters for left and right channels, and the coefficients for those filters are modified with separate controls, it would be really nice to have the capability of writing these controls separately, but have a 'commit' mechanism so that these updated coefficients are used at the same time by the left and right filters.
For the pair of left and right filters, the simplest solution is to unify the two control elements into single one, as you know. The array of two values can be passed to your driver by single system call and ALSA control core surely calls driver code under lock acquisition against any operation for control element.
I am not worried about other applications, the issue is that a transaction on a bus or IPC is assumed to have an immediate effect. In the case of multiple values, it'd really be desirable to defer the effect of write transactions until they are all complete. I am not making this up, this sort of capabilities is described in standards and I am not aware of any support from the ALSA control framework for a global commit operation. We have mechanisms to synchronize triggers on PCM devices with the snd_pcm_link(), synchronization of control changes is a miss IMHO.