[ALSA] hda-codec - Fix AD1988 SPDIF playback route control

Fix AD1988 SPDIF playback route control for selecting ADC1-3.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
This commit is contained in:
Takashi Iwai 2007-05-05 12:17:17 +02:00 committed by Jaroslav Kysela
parent 713fb93936
commit 35b26722a1

View file

@ -1898,8 +1898,9 @@ static int ad1988_spdif_playback_source_get(struct snd_kcontrol *kcontrol,
sel = snd_hda_codec_read(codec, 0x02, 0, AC_VERB_GET_CONNECT_SEL, 0); sel = snd_hda_codec_read(codec, 0x02, 0, AC_VERB_GET_CONNECT_SEL, 0);
if (sel > 0) { if (sel > 0) {
sel = snd_hda_codec_read(codec, 0x0b, 0, AC_VERB_GET_CONNECT_SEL, 0); sel = snd_hda_codec_read(codec, 0x0b, 0,
if (sel <= 3) AC_VERB_GET_CONNECT_SEL, 0);
if (sel < 3)
sel++; sel++;
else else
sel = 0; sel = 0;
@ -1912,23 +1913,27 @@ static int ad1988_spdif_playback_source_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
struct hda_codec *codec = snd_kcontrol_chip(kcontrol); struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
unsigned int sel; unsigned int val, sel;
int change; int change;
val = ucontrol->value.enumerated.item[0];
sel = snd_hda_codec_read(codec, 0x02, 0, AC_VERB_GET_CONNECT_SEL, 0); sel = snd_hda_codec_read(codec, 0x02, 0, AC_VERB_GET_CONNECT_SEL, 0);
if (! ucontrol->value.enumerated.item[0]) { if (!val) {
change = sel != 0; change = sel != 0;
if (change) if (change || codec->in_resume)
snd_hda_codec_write(codec, 0x02, 0, AC_VERB_SET_CONNECT_SEL, 0); snd_hda_codec_write(codec, 0x02, 0,
AC_VERB_SET_CONNECT_SEL, 0);
} else { } else {
change = sel == 0; change = sel == 0;
if (change) if (change || codec->in_resume)
snd_hda_codec_write(codec, 0x02, 0, AC_VERB_SET_CONNECT_SEL, 1); snd_hda_codec_write(codec, 0x02, 0,
sel = snd_hda_codec_read(codec, 0x0b, 0, AC_VERB_GET_CONNECT_SEL, 0) + 1; AC_VERB_SET_CONNECT_SEL, 1);
change |= sel == ucontrol->value.enumerated.item[0]; sel = snd_hda_codec_read(codec, 0x0b, 0,
if (change) AC_VERB_GET_CONNECT_SEL, 0) + 1;
snd_hda_codec_write(codec, 0x02, 0, AC_VERB_SET_CONNECT_SEL, change |= sel != val;
ucontrol->value.enumerated.item[0] - 1); if (change || codec->in_resume)
snd_hda_codec_write(codec, 0x0b, 0,
AC_VERB_SET_CONNECT_SEL, val - 1);
} }
return change; return change;
} }