ALSA: hda - Fix calling cs_automic twice for Cirrus codecs.
authorDylan Reid <dgreid@chromium.org>
Tue, 31 Jan 2012 21:04:41 +0000 (13:04 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 13 Feb 2012 19:16:51 +0000 (11:16 -0800)
commitd0f03303d8a9c7c82856c50e6c7ea137c8ca7c83
tree95c6a1fb995384ac52ce803a2cd0213badb1cfd7
parent4f53e64f2effdcbd8f563411031fdc5172f876ce
ALSA: hda - Fix calling cs_automic twice for Cirrus codecs.

commit f70eecde3bca92630d3886496e73316ff353f185 upstream.

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>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/pci/hda/patch_cirrus.c