[RFC PATCH 1/3] ALSA: control: add kcontrol_type to control
Jaska Uimonen
jaska.uimonen at linux.intel.com
Fri Jan 8 12:23:53 CET 2021
Current kcontrol structs don't have a member to describe the control
type. The type is present in the widget which contains the control. As
there can be many controls in one widget it is inherently presumed that
the control types are the same.
Lately there has been use cases where different types of controls would
be needed for single widget. Thus enable this by adding the control type
to kcontrol and kcontrol_new structs.
Signed-off-by: Jaska Uimonen <jaska.uimonen at linux.intel.com>
---
include/sound/control.h | 2 ++
sound/core/control.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/include/sound/control.h b/include/sound/control.h
index 77d9fa10812d..3933823a606d 100644
--- a/include/sound/control.h
+++ b/include/sound/control.h
@@ -46,6 +46,7 @@ struct snd_kcontrol_new {
unsigned int index; /* index of item */
unsigned int access; /* access rights */
unsigned int count; /* count of same elements */
+ unsigned int kcontrol_type;
snd_kcontrol_info_t *info;
snd_kcontrol_get_t *get;
snd_kcontrol_put_t *put;
@@ -65,6 +66,7 @@ struct snd_kcontrol {
struct list_head list; /* list of controls */
struct snd_ctl_elem_id id;
unsigned int count; /* count of same elements */
+ unsigned int kcontrol_type;
snd_kcontrol_info_t *info;
snd_kcontrol_get_t *get;
snd_kcontrol_put_t *put;
diff --git a/sound/core/control.c b/sound/core/control.c
index 3b44378b9dec..f081ae4f839c 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -268,6 +268,8 @@ struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new *ncontrol,
}
kctl->id.index = ncontrol->index;
+ kctl->kcontrol_type = ncontrol->kcontrol_type;
+
kctl->info = ncontrol->info;
kctl->get = ncontrol->get;
kctl->put = ncontrol->put;
--
2.24.1
More information about the Alsa-devel
mailing list