diff options
author | Takashi Iwai <tiwai@suse.de> | 2010-09-09 10:28:02 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2010-09-09 10:46:03 -0400 |
commit | 10a20af7c944649dc6d1ffa06bc759f5f3a16cd9 (patch) | |
tree | 322ad916b8d909e3bdc3c51eb63ccecbdd1ae16a /sound/pci/hda/patch_analog.c | |
parent | 86e2959a10828dd2614e037fb2502bc833adca52 (diff) |
ALSA: hda - Improve the input source name labels
This patch improves the input-source label strings to be generated from
the pin information instead of fixed strings per AUTO_PIN_* type.
This gives more suitable labels, especially for mic and line-in pins.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_analog.c')
-rw-r--r-- | sound/pci/hda/patch_analog.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 85fc0b954603..05db1cfcd8b8 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -2909,32 +2909,27 @@ static int new_analog_input(struct ad198x_spec *spec, hda_nid_t pin, | |||
2909 | } | 2909 | } |
2910 | 2910 | ||
2911 | /* create playback/capture controls for input pins */ | 2911 | /* create playback/capture controls for input pins */ |
2912 | static int ad1988_auto_create_analog_input_ctls(struct ad198x_spec *spec, | 2912 | static int ad1988_auto_create_analog_input_ctls(struct hda_codec *codec, |
2913 | const struct auto_pin_cfg *cfg) | 2913 | const struct auto_pin_cfg *cfg) |
2914 | { | 2914 | { |
2915 | struct ad198x_spec *spec = codec->spec; | ||
2915 | struct hda_input_mux *imux = &spec->private_imux; | 2916 | struct hda_input_mux *imux = &spec->private_imux; |
2916 | int i, err, type, type_idx = 0; | 2917 | int i, err, type, type_idx; |
2917 | 2918 | ||
2918 | for (i = 0; i < cfg->num_inputs; i++) { | 2919 | for (i = 0; i < cfg->num_inputs; i++) { |
2920 | const char *label; | ||
2919 | type = cfg->inputs[i].type; | 2921 | type = cfg->inputs[i].type; |
2920 | if (i > 0 && type != cfg->inputs[i - 1].type) | 2922 | label = hda_get_autocfg_input_label(codec, cfg, i); |
2921 | type_idx++; | 2923 | snd_hda_add_imux_item(imux, label, |
2922 | else | 2924 | ad1988_pin_to_adc_idx(cfg->inputs[i].pin), |
2923 | type_idx = 0; | 2925 | &type_idx); |
2924 | err = new_analog_input(spec, cfg->inputs[i].pin, | 2926 | err = new_analog_input(spec, cfg->inputs[i].pin, |
2925 | auto_pin_cfg_labels[type], type_idx, | 2927 | label, type_idx, |
2926 | type == AUTO_PIN_MIC); | 2928 | type == AUTO_PIN_MIC); |
2927 | if (err < 0) | 2929 | if (err < 0) |
2928 | return err; | 2930 | return err; |
2929 | snd_hda_get_input_pin_label(cfg, i, | ||
2930 | imux->items[imux->num_items].label); | ||
2931 | imux->items[imux->num_items].index = | ||
2932 | ad1988_pin_to_adc_idx(cfg->inputs[i].pin); | ||
2933 | imux->num_items++; | ||
2934 | } | 2931 | } |
2935 | strcpy(imux->items[imux->num_items].label, "Mix"); | 2932 | snd_hda_add_imux_item(imux, "Mix", 9, NULL); |
2936 | imux->items[imux->num_items].index = 9; | ||
2937 | imux->num_items++; | ||
2938 | 2933 | ||
2939 | if ((err = add_control(spec, AD_CTL_WIDGET_VOL, | 2934 | if ((err = add_control(spec, AD_CTL_WIDGET_VOL, |
2940 | "Analog Mix Playback Volume", | 2935 | "Analog Mix Playback Volume", |
@@ -3046,7 +3041,7 @@ static int ad1988_parse_auto_config(struct hda_codec *codec) | |||
3046 | "Speaker")) < 0 || | 3041 | "Speaker")) < 0 || |
3047 | (err = ad1988_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], | 3042 | (err = ad1988_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], |
3048 | "Headphone")) < 0 || | 3043 | "Headphone")) < 0 || |
3049 | (err = ad1988_auto_create_analog_input_ctls(spec, &spec->autocfg)) < 0) | 3044 | (err = ad1988_auto_create_analog_input_ctls(codec, &spec->autocfg)) < 0) |
3050 | return err; | 3045 | return err; |
3051 | 3046 | ||
3052 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | 3047 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |