ALSA control core allows usespace application to register control element set by call of ioctl(2) with SNDRV_CTL_IOCTL_ELEM_ADD request. The added control element set is called as 'user-defined'. Currently sound card has limitation on the number of the user-defined control element set up to 32.
The limitation is inconvenient to drivers in ALSA firewire stack since the drivers expect userspace applications to implement function to control device functionalities such as mixing and routing. As the userspace application, snd-firewire-ctl-services project starts: https://github.com/alsa-project/snd-firewire-ctl-services/
The project supports many devices supported by ALSA firewire stack. The limitation is mostly good since routing and mixing controls can be represented by control element set, which includes control element with the same parameters. Nevertheless, it's actually inconvenient to device which has many varied functionalities. For example, plugin effect such as channel strip and reverb has many parameters. For the case, many control elements are required to configure the parameters and control element set cannot aggregates controls for the parameters. At present, below models are implemented with the control elements and actually add control element sets over 32:
* Apogee Emsemble (snd-bebob-ctl-service) * TC Electronic Konnekt 24d (snd-dice-ctl-service) * TC Electronic Studio Konnekt 48 (snd-dice-ctl-service) * TC Electronic Konnekt Live (snd-dice-ctl-service) * TC Electronic Impact Twin (snd-dice-ctl-service)
It could be investigated to increase the number; e.g. quadruple to the current (=128), however it's hard to find criteria about the number for existent sound card. This commit just removes the limitation for the reason. ALSA control core uses UINT_MAX as the maximum number of control elements added to a sound card. It's limitation for both in-kernel driver and userspace application.
Signed-off-by: Takashi Sakamoto o-takashi@sakamocchi.jp --- include/sound/core.h | 1 - sound/core/control.c | 13 ------------- 2 files changed, 14 deletions(-)
diff --git a/include/sound/core.h b/include/sound/core.h index 0462c577d7a3..6b443ce0acf8 100644 --- a/include/sound/core.h +++ b/include/sound/core.h @@ -100,7 +100,6 @@ struct snd_card { struct rw_semaphore controls_rwsem; /* controls list lock */ rwlock_t ctl_files_rwlock; /* ctl_files list lock */ int controls_count; /* count of all controls */ - int user_ctl_count; /* count of all user controls */ struct list_head controls; /* all controls for this card */ struct list_head ctl_files; /* active control files */
diff --git a/sound/core/control.c b/sound/core/control.c index 5165741a8400..1bcef22713f4 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -18,8 +18,6 @@ #include <sound/info.h> #include <sound/control.h>
-/* max number of user-defined controls */ -#define MAX_USER_CONTROLS 32 #define MAX_CONTROL_COUNT 1028
struct snd_kctl_ioctl { @@ -539,7 +537,6 @@ static int snd_ctl_remove_user_ctl(struct snd_ctl_file * file, ret = snd_ctl_remove(card, kctl); if (ret < 0) goto error; - card->user_ctl_count--; error: up_write(&card->controls_rwsem); return ret; @@ -1435,13 +1432,6 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file, return err; }
- /* - * The number of userspace controls are counted control by control, - * not element by element. - */ - if (card->user_ctl_count + 1 > MAX_USER_CONTROLS) - return -ENOMEM; - /* Check the number of elements for this userspace control. */ count = info->owner; if (count == 0) @@ -1534,9 +1524,6 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file, * applications because the field originally means PID of a process * which locks the element. */ - - card->user_ctl_count++; - unlock: up_write(&card->controls_rwsem); return err;