diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/i2c/other/ak4xxx-adda.c | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/sound/i2c/other/ak4xxx-adda.c b/sound/i2c/other/ak4xxx-adda.c index f3735e64791c..67dbfde837ab 100644 --- a/sound/i2c/other/ak4xxx-adda.c +++ b/sound/i2c/other/ak4xxx-adda.c | |||
@@ -465,17 +465,10 @@ static int snd_akm4xxx_stereo_volume_put(struct snd_kcontrol *kcontrol, | |||
465 | static int snd_akm4xxx_deemphasis_info(struct snd_kcontrol *kcontrol, | 465 | static int snd_akm4xxx_deemphasis_info(struct snd_kcontrol *kcontrol, |
466 | struct snd_ctl_elem_info *uinfo) | 466 | struct snd_ctl_elem_info *uinfo) |
467 | { | 467 | { |
468 | static char *texts[4] = { | 468 | static const char * const texts[4] = { |
469 | "44.1kHz", "Off", "48kHz", "32kHz", | 469 | "44.1kHz", "Off", "48kHz", "32kHz", |
470 | }; | 470 | }; |
471 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 471 | return snd_ctl_enum_info(uinfo, 1, 4, texts); |
472 | uinfo->count = 1; | ||
473 | uinfo->value.enumerated.items = 4; | ||
474 | if (uinfo->value.enumerated.item >= 4) | ||
475 | uinfo->value.enumerated.item = 3; | ||
476 | strcpy(uinfo->value.enumerated.name, | ||
477 | texts[uinfo->value.enumerated.item]); | ||
478 | return 0; | ||
479 | } | 472 | } |
480 | 473 | ||
481 | static int snd_akm4xxx_deemphasis_get(struct snd_kcontrol *kcontrol, | 474 | static int snd_akm4xxx_deemphasis_get(struct snd_kcontrol *kcontrol, |
@@ -570,22 +563,13 @@ static int ak4xxx_capture_source_info(struct snd_kcontrol *kcontrol, | |||
570 | { | 563 | { |
571 | struct snd_akm4xxx *ak = snd_kcontrol_chip(kcontrol); | 564 | struct snd_akm4xxx *ak = snd_kcontrol_chip(kcontrol); |
572 | int mixer_ch = AK_GET_SHIFT(kcontrol->private_value); | 565 | int mixer_ch = AK_GET_SHIFT(kcontrol->private_value); |
573 | const char **input_names; | 566 | unsigned int num_names; |
574 | unsigned int num_names, idx; | ||
575 | 567 | ||
576 | num_names = ak4xxx_capture_num_inputs(ak, mixer_ch); | 568 | num_names = ak4xxx_capture_num_inputs(ak, mixer_ch); |
577 | if (!num_names) | 569 | if (!num_names) |
578 | return -EINVAL; | 570 | return -EINVAL; |
579 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 571 | return snd_ctl_enum_info(uinfo, 1, num_names, |
580 | uinfo->count = 1; | 572 | ak->adc_info[mixer_ch].input_names); |
581 | uinfo->value.enumerated.items = num_names; | ||
582 | idx = uinfo->value.enumerated.item; | ||
583 | if (idx >= num_names) | ||
584 | return -EINVAL; | ||
585 | input_names = ak->adc_info[mixer_ch].input_names; | ||
586 | strlcpy(uinfo->value.enumerated.name, input_names[idx], | ||
587 | sizeof(uinfo->value.enumerated.name)); | ||
588 | return 0; | ||
589 | } | 573 | } |
590 | 574 | ||
591 | static int ak4xxx_capture_source_get(struct snd_kcontrol *kcontrol, | 575 | static int ak4xxx_capture_source_get(struct snd_kcontrol *kcontrol, |