aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/oxygen/xonar_wm87x6.c
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2011-01-10 10:25:44 -0500
committerTakashi Iwai <tiwai@suse.de>2011-01-10 10:46:53 -0500
commit9600732b6caba595f34acf2abd930098ec9a0b2b (patch)
tree7474e1b11894623186a2acd47a388aa87fdd002e /sound/pci/oxygen/xonar_wm87x6.c
parentb532d6b8d3aa163e1dc143bc729e9ee92f75baf5 (diff)
ALSA: core, oxygen, virtuoso: add an enum control info helper
Introduce the helper function snd_ctl_enum_info() to fill out the elem_info fields for an enumerated control. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/oxygen/xonar_wm87x6.c')
-rw-r--r--sound/pci/oxygen/xonar_wm87x6.c25
1 files changed, 4 insertions, 21 deletions
diff --git a/sound/pci/oxygen/xonar_wm87x6.c b/sound/pci/oxygen/xonar_wm87x6.c
index ad48356c54e4..42d1ab136217 100644
--- a/sound/pci/oxygen/xonar_wm87x6.c
+++ b/sound/pci/oxygen/xonar_wm87x6.c
@@ -577,11 +577,6 @@ static int wm8776_field_enum_info(struct snd_kcontrol *ctl,
577 const char *const *names; 577 const char *const *names;
578 578
579 max = (ctl->private_value >> 12) & 0xf; 579 max = (ctl->private_value >> 12) & 0xf;
580 info->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
581 info->count = 1;
582 info->value.enumerated.items = max + 1;
583 if (info->value.enumerated.item > max)
584 info->value.enumerated.item = max;
585 switch ((ctl->private_value >> 24) & 0x1f) { 580 switch ((ctl->private_value >> 24) & 0x1f) {
586 case WM8776_ALCCTRL2: 581 case WM8776_ALCCTRL2:
587 names = hld; 582 names = hld;
@@ -605,8 +600,7 @@ static int wm8776_field_enum_info(struct snd_kcontrol *ctl,
605 default: 600 default:
606 return -ENXIO; 601 return -ENXIO;
607 } 602 }
608 strcpy(info->value.enumerated.name, names[info->value.enumerated.item]); 603 return snd_ctl_enum_info(info, 1, max + 1, names);
609 return 0;
610} 604}
611 605
612static int wm8776_field_volume_info(struct snd_kcontrol *ctl, 606static int wm8776_field_volume_info(struct snd_kcontrol *ctl,
@@ -863,13 +857,8 @@ static int wm8776_level_control_info(struct snd_kcontrol *ctl,
863 static const char *const names[3] = { 857 static const char *const names[3] = {
864 "None", "Peak Limiter", "Automatic Level Control" 858 "None", "Peak Limiter", "Automatic Level Control"
865 }; 859 };
866 info->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 860
867 info->count = 1; 861 return snd_ctl_enum_info(info, 1, 3, names);
868 info->value.enumerated.items = 3;
869 if (info->value.enumerated.item >= 3)
870 info->value.enumerated.item = 2;
871 strcpy(info->value.enumerated.name, names[info->value.enumerated.item]);
872 return 0;
873} 862}
874 863
875static int wm8776_level_control_get(struct snd_kcontrol *ctl, 864static int wm8776_level_control_get(struct snd_kcontrol *ctl,
@@ -955,13 +944,7 @@ static int hpf_info(struct snd_kcontrol *ctl, struct snd_ctl_elem_info *info)
955 "None", "High-pass Filter" 944 "None", "High-pass Filter"
956 }; 945 };
957 946
958 info->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 947 return snd_ctl_enum_info(info, 1, 2, names);
959 info->count = 1;
960 info->value.enumerated.items = 2;
961 if (info->value.enumerated.item >= 2)
962 info->value.enumerated.item = 1;
963 strcpy(info->value.enumerated.name, names[info->value.enumerated.item]);
964 return 0;
965} 948}
966 949
967static int hpf_get(struct snd_kcontrol *ctl, struct snd_ctl_elem_value *value) 950static int hpf_get(struct snd_kcontrol *ctl, struct snd_ctl_elem_value *value)