aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_analog.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2007-05-05 06:17:17 -0400
committerJaroslav Kysela <perex@suse.cz>2007-05-11 10:56:15 -0400
commit35b26722a1716b45b5b92d5af2f1ea1fdd4d0a25 (patch)
tree5a64fb57ca19359c64dd1772f8f11306672ec0cd /sound/pci/hda/patch_analog.c
parent713fb93936bebc158b4bbae6be61a6310923543c (diff)
[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>
Diffstat (limited to 'sound/pci/hda/patch_analog.c')
-rw-r--r--sound/pci/hda/patch_analog.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index f6f3c2cc0869..0e1a879663fa 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -1898,8 +1898,9 @@ static int ad1988_spdif_playback_source_get(struct snd_kcontrol *kcontrol,
1898 1898
1899 sel = snd_hda_codec_read(codec, 0x02, 0, AC_VERB_GET_CONNECT_SEL, 0); 1899 sel = snd_hda_codec_read(codec, 0x02, 0, AC_VERB_GET_CONNECT_SEL, 0);
1900 if (sel > 0) { 1900 if (sel > 0) {
1901 sel = snd_hda_codec_read(codec, 0x0b, 0, AC_VERB_GET_CONNECT_SEL, 0); 1901 sel = snd_hda_codec_read(codec, 0x0b, 0,
1902 if (sel <= 3) 1902 AC_VERB_GET_CONNECT_SEL, 0);
1903 if (sel < 3)
1903 sel++; 1904 sel++;
1904 else 1905 else
1905 sel = 0; 1906 sel = 0;
@@ -1912,23 +1913,27 @@ static int ad1988_spdif_playback_source_put(struct snd_kcontrol *kcontrol,
1912 struct snd_ctl_elem_value *ucontrol) 1913 struct snd_ctl_elem_value *ucontrol)
1913{ 1914{
1914 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 1915 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1915 unsigned int sel; 1916 unsigned int val, sel;
1916 int change; 1917 int change;
1917 1918
1919 val = ucontrol->value.enumerated.item[0];
1918 sel = snd_hda_codec_read(codec, 0x02, 0, AC_VERB_GET_CONNECT_SEL, 0); 1920 sel = snd_hda_codec_read(codec, 0x02, 0, AC_VERB_GET_CONNECT_SEL, 0);
1919 if (! ucontrol->value.enumerated.item[0]) { 1921 if (!val) {
1920 change = sel != 0; 1922 change = sel != 0;
1921 if (change) 1923 if (change || codec->in_resume)
1922 snd_hda_codec_write(codec, 0x02, 0, AC_VERB_SET_CONNECT_SEL, 0); 1924 snd_hda_codec_write(codec, 0x02, 0,
1925 AC_VERB_SET_CONNECT_SEL, 0);
1923 } else { 1926 } else {
1924 change = sel == 0; 1927 change = sel == 0;
1925 if (change) 1928 if (change || codec->in_resume)
1926 snd_hda_codec_write(codec, 0x02, 0, AC_VERB_SET_CONNECT_SEL, 1); 1929 snd_hda_codec_write(codec, 0x02, 0,
1927 sel = snd_hda_codec_read(codec, 0x0b, 0, AC_VERB_GET_CONNECT_SEL, 0) + 1; 1930 AC_VERB_SET_CONNECT_SEL, 1);
1928 change |= sel == ucontrol->value.enumerated.item[0]; 1931 sel = snd_hda_codec_read(codec, 0x0b, 0,
1929 if (change) 1932 AC_VERB_GET_CONNECT_SEL, 0) + 1;
1930 snd_hda_codec_write(codec, 0x02, 0, AC_VERB_SET_CONNECT_SEL, 1933 change |= sel != val;
1931 ucontrol->value.enumerated.item[0] - 1); 1934 if (change || codec->in_resume)
1935 snd_hda_codec_write(codec, 0x0b, 0,
1936 AC_VERB_SET_CONNECT_SEL, val - 1);
1932 } 1937 }
1933 return change; 1938 return change;
1934} 1939}