diff options
author | Takashi Iwai <tiwai@suse.de> | 2011-11-23 01:38:59 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-11-23 01:45:21 -0500 |
commit | 6759dc323826c2c806c998cd93945c5476688dd2 (patch) | |
tree | f1821de346e3d52809005de4cfacff00448c7bf6 /sound | |
parent | 6dfeb703e386369d9f1585d29482efe7b2b4401d (diff) |
ALSA: hda/realtek - Fix missing inits of item indices for auto-mic
When the imux entries are rebuilt in alc_rebuild_imux_for_auto_mic(),
the initialization of index field is missing. It may work without it
casually when the original imux was created by the auto-parser, but
it's definitely broken in the case of static configs where no imux was
parsed beforehand. Because of this, the auto-mic switching doesn't
work properly on some model options.
This patch adds the missing initialization of index field.
Reported-by: Dmitry Nezhevenko <dion@inhex.net>
Cc: <stable@kernel.org> [v3.1]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 336d14eb72af..06c0c12d4fec 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -1054,8 +1054,20 @@ static bool alc_rebuild_imux_for_auto_mic(struct hda_codec *codec) | |||
1054 | spec->imux_pins[2] = spec->dock_mic_pin; | 1054 | spec->imux_pins[2] = spec->dock_mic_pin; |
1055 | for (i = 0; i < 3; i++) { | 1055 | for (i = 0; i < 3; i++) { |
1056 | strcpy(imux->items[i].label, texts[i]); | 1056 | strcpy(imux->items[i].label, texts[i]); |
1057 | if (spec->imux_pins[i]) | 1057 | if (spec->imux_pins[i]) { |
1058 | hda_nid_t pin = spec->imux_pins[i]; | ||
1059 | int c; | ||
1060 | for (c = 0; c < spec->num_adc_nids; c++) { | ||
1061 | hda_nid_t cap = spec->capsrc_nids ? | ||
1062 | spec->capsrc_nids[c] : spec->adc_nids[c]; | ||
1063 | int idx = get_connection_index(codec, cap, pin); | ||
1064 | if (idx >= 0) { | ||
1065 | imux->items[i].index = idx; | ||
1066 | break; | ||
1067 | } | ||
1068 | } | ||
1058 | imux->num_items = i + 1; | 1069 | imux->num_items = i + 1; |
1070 | } | ||
1059 | } | 1071 | } |
1060 | spec->num_mux_defs = 1; | 1072 | spec->num_mux_defs = 1; |
1061 | spec->input_mux = imux; | 1073 | spec->input_mux = imux; |