aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/pci/hda/patch_analog.c45
1 files changed, 31 insertions, 14 deletions
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index fafadf9fab..488724f2e3 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -1889,16 +1889,19 @@ static int ad1988_spdif_playback_source_get(struct snd_kcontrol *kcontrol,
1889 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 1889 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1890 unsigned int sel; 1890 unsigned int sel;
1891 1891
1892 sel = snd_hda_codec_read(codec, 0x02, 0, AC_VERB_GET_CONNECT_SEL, 0); 1892 sel = snd_hda_codec_read(codec, 0x1d, 0, AC_VERB_GET_AMP_GAIN_MUTE,
1893 if (sel > 0) { 1893 AC_AMP_GET_INPUT);
1894 if (!(sel & 0x80))
1895 ucontrol->value.enumerated.item[0] = 0;
1896 else {
1894 sel = snd_hda_codec_read(codec, 0x0b, 0, 1897 sel = snd_hda_codec_read(codec, 0x0b, 0,
1895 AC_VERB_GET_CONNECT_SEL, 0); 1898 AC_VERB_GET_CONNECT_SEL, 0);
1896 if (sel < 3) 1899 if (sel < 3)
1897 sel++; 1900 sel++;
1898 else 1901 else
1899 sel = 0; 1902 sel = 0;
1903 ucontrol->value.enumerated.item[0] = sel;
1900 } 1904 }
1901 ucontrol->value.enumerated.item[0] = sel;
1902 return 0; 1905 return 0;
1903} 1906}
1904 1907
@@ -1910,17 +1913,32 @@ static int ad1988_spdif_playback_source_put(struct snd_kcontrol *kcontrol,
1910 int change; 1913 int change;
1911 1914
1912 val = ucontrol->value.enumerated.item[0]; 1915 val = ucontrol->value.enumerated.item[0];
1913 sel = snd_hda_codec_read(codec, 0x02, 0, AC_VERB_GET_CONNECT_SEL, 0);
1914 if (!val) { 1916 if (!val) {
1915 change = sel != 0; 1917 sel = snd_hda_codec_read(codec, 0x1d, 0,
1916 if (change || codec->in_resume) 1918 AC_VERB_GET_AMP_GAIN_MUTE,
1917 snd_hda_codec_write(codec, 0x02, 0, 1919 AC_AMP_GET_INPUT);
1918 AC_VERB_SET_CONNECT_SEL, 0); 1920 change = sel & 0x80;
1921 if (change || codec->in_resume) {
1922 snd_hda_codec_write(codec, 0x1d, 0,
1923 AC_VERB_SET_AMP_GAIN_MUTE,
1924 AMP_IN_UNMUTE(0));
1925 snd_hda_codec_write(codec, 0x1d, 0,
1926 AC_VERB_SET_AMP_GAIN_MUTE,
1927 AMP_IN_MUTE(1));
1928 }
1919 } else { 1929 } else {
1920 change = sel == 0; 1930 sel = snd_hda_codec_read(codec, 0x1d, 0,
1921 if (change || codec->in_resume) 1931 AC_VERB_GET_AMP_GAIN_MUTE,
1922 snd_hda_codec_write(codec, 0x02, 0, 1932 AC_AMP_GET_INPUT | 0x01);
1923 AC_VERB_SET_CONNECT_SEL, 1); 1933 change = sel & 0x80;
1934 if (change || codec->in_resume) {
1935 snd_hda_codec_write(codec, 0x1d, 0,
1936 AC_VERB_SET_AMP_GAIN_MUTE,
1937 AMP_IN_MUTE(0));
1938 snd_hda_codec_write(codec, 0x1d, 0,
1939 AC_VERB_SET_AMP_GAIN_MUTE,
1940 AMP_IN_UNMUTE(1));
1941 }
1924 sel = snd_hda_codec_read(codec, 0x0b, 0, 1942 sel = snd_hda_codec_read(codec, 0x0b, 0,
1925 AC_VERB_GET_CONNECT_SEL, 0) + 1; 1943 AC_VERB_GET_CONNECT_SEL, 0) + 1;
1926 change |= sel != val; 1944 change |= sel != val;
@@ -2039,10 +2057,9 @@ static struct hda_verb ad1988_spdif_init_verbs[] = {
2039 {0x02, AC_VERB_SET_CONNECT_SEL, 0x0}, /* PCM */ 2057 {0x02, AC_VERB_SET_CONNECT_SEL, 0x0}, /* PCM */
2040 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x0}, /* ADC1 */ 2058 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x0}, /* ADC1 */
2041 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 2059 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2042 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 2060 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2043 /* SPDIF out pin */ 2061 /* SPDIF out pin */
2044 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x27}, /* 0dB */ 2062 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x27}, /* 0dB */
2045 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x17}, /* 0dB */
2046 2063
2047 { } 2064 { }
2048}; 2065};