diff options
author | Takashi Iwai <tiwai@suse.de> | 2011-01-13 08:37:14 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-01-13 08:37:14 +0100 |
commit | e38302f78284e3e80ffc2eef54001fce7d183bd4 (patch) | |
tree | 0cb61d52ca9d11d446e3fc1bc97d8fd92ab1e934 /sound/core/control.c | |
parent | 3c0eee3fe6a3a1c745379547c7e7c904aa64f6d5 (diff) | |
parent | c386735264da97e6b6d15aa56361e9ef188b26ab (diff) | |
download | kernel_samsung_tuna-e38302f78284e3e80ffc2eef54001fce7d183bd4.zip kernel_samsung_tuna-e38302f78284e3e80ffc2eef54001fce7d183bd4.tar.gz kernel_samsung_tuna-e38302f78284e3e80ffc2eef54001fce7d183bd4.tar.bz2 |
Merge branch 'topic/misc' into for-linus
Diffstat (limited to 'sound/core/control.c')
-rw-r--r-- | sound/core/control.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/sound/core/control.c b/sound/core/control.c index 45a8180..9ce00ed 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -1488,7 +1488,7 @@ int snd_ctl_create(struct snd_card *card) } /* - * Frequently used control callbacks + * Frequently used control callbacks/helpers */ int snd_ctl_boolean_mono_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) @@ -1513,3 +1513,29 @@ int snd_ctl_boolean_stereo_info(struct snd_kcontrol *kcontrol, } EXPORT_SYMBOL(snd_ctl_boolean_stereo_info); + +/** + * snd_ctl_enum_info - fills the info structure for an enumerated control + * @info: the structure to be filled + * @channels: the number of the control's channels; often one + * @items: the number of control values; also the size of @names + * @names: an array containing the names of all control values + * + * Sets all required fields in @info to their appropriate values. + * If the control's accessibility is not the default (readable and writable), + * the caller has to fill @info->access. + */ +int snd_ctl_enum_info(struct snd_ctl_elem_info *info, unsigned int channels, + unsigned int items, const char *const names[]) +{ + info->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; + info->count = channels; + info->value.enumerated.items = items; + if (info->value.enumerated.item >= items) + info->value.enumerated.item = items - 1; + strlcpy(info->value.enumerated.name, + names[info->value.enumerated.item], + sizeof(info->value.enumerated.name)); + return 0; +} +EXPORT_SYMBOL(snd_ctl_enum_info); |