Skip to content

Commit

Permalink
ALSA: hda - Fix calling cs_automic twice for Cirrus codecs.
Browse files Browse the repository at this point in the history
If cs_automic is called twice (like it is during init) while the mic
is present, it will over-write the last_input with the new one,
causing it to switch back to the automic input when the mic is
unplugged. This leaves the driver in a state (cur_input, last_input,
and automix_idx the same) where the internal mic can not be selected
until it is rebooted without the mic attached.

Check that the mic hasn't already been switched to before setting
last_input.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Dylan Reid authored and Takashi Iwai committed Feb 1, 2012
1 parent ea51e50 commit f70eecd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sound/pci/hda/patch_cirrus.c
Original file line number Diff line number Diff line change
Expand Up @@ -988,8 +988,10 @@ static void cs_automic(struct hda_codec *codec)
change_cur_input(codec, !spec->automic_idx, 0);
} else {
if (present) {
spec->last_input = spec->cur_input;
spec->cur_input = spec->automic_idx;
if (spec->cur_input != spec->automic_idx) {
spec->last_input = spec->cur_input;
spec->cur_input = spec->automic_idx;
}
} else {
spec->cur_input = spec->last_input;
}
Expand Down

0 comments on commit f70eecd

Please sign in to comment.