aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-05-29 02:16:56 -0400
committerTakashi Iwai <tiwai@suse.de>2008-05-30 10:20:42 -0400
commite48d6d97bb6bd8c008045ea0522ea8278fdccc55 (patch)
treecd27ea13b6294037054097658505f6cdc085a1b2 /sound
parente490517a039a99d692cb3a5561941b0a5f576172 (diff)
[ALSA] ac97 - Fix ASUS A9T laptop output
ASUS A9T laptop uses line-out pin as the real front-output while other devices use it as the surround. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/ac97/ac97_patch.c48
1 files changed, 34 insertions, 14 deletions
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c
index 2da89810ca10..1292dcee072d 100644
--- a/sound/pci/ac97/ac97_patch.c
+++ b/sound/pci/ac97/ac97_patch.c
@@ -1971,6 +1971,9 @@ static int snd_ac97_ad1888_lohpsel_get(struct snd_kcontrol *kcontrol, struct snd
1971 1971
1972 val = ac97->regs[AC97_AD_MISC]; 1972 val = ac97->regs[AC97_AD_MISC];
1973 ucontrol->value.integer.value[0] = !(val & AC97_AD198X_LOSEL); 1973 ucontrol->value.integer.value[0] = !(val & AC97_AD198X_LOSEL);
1974 if (ac97->spec.ad18xx.lo_as_master)
1975 ucontrol->value.integer.value[0] =
1976 !ucontrol->value.integer.value[0];
1974 return 0; 1977 return 0;
1975} 1978}
1976 1979
@@ -1979,8 +1982,10 @@ static int snd_ac97_ad1888_lohpsel_put(struct snd_kcontrol *kcontrol, struct snd
1979 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); 1982 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol);
1980 unsigned short val; 1983 unsigned short val;
1981 1984
1982 val = !ucontrol->value.integer.value[0] 1985 val = !ucontrol->value.integer.value[0];
1983 ? (AC97_AD198X_LOSEL | AC97_AD198X_HPSEL) : 0; 1986 if (ac97->spec.ad18xx.lo_as_master)
1987 val = !val;
1988 val = val ? (AC97_AD198X_LOSEL | AC97_AD198X_HPSEL) : 0;
1984 return snd_ac97_update_bits(ac97, AC97_AD_MISC, 1989 return snd_ac97_update_bits(ac97, AC97_AD_MISC,
1985 AC97_AD198X_LOSEL | AC97_AD198X_HPSEL, val); 1990 AC97_AD198X_LOSEL | AC97_AD198X_HPSEL, val);
1986} 1991}
@@ -2031,7 +2036,7 @@ static void ad1888_update_jacks(struct snd_ac97 *ac97)
2031{ 2036{
2032 unsigned short val = 0; 2037 unsigned short val = 0;
2033 /* clear LODIS if shared jack is to be used for Surround out */ 2038 /* clear LODIS if shared jack is to be used for Surround out */
2034 if (is_shared_linein(ac97)) 2039 if (!ac97->spec.ad18xx.lo_as_master && is_shared_linein(ac97))
2035 val |= (1 << 12); 2040 val |= (1 << 12);
2036 /* clear CLDIS if shared jack is to be used for C/LFE out */ 2041 /* clear CLDIS if shared jack is to be used for C/LFE out */
2037 if (is_shared_micin(ac97)) 2042 if (is_shared_micin(ac97))
@@ -2067,9 +2072,13 @@ static const struct snd_kcontrol_new snd_ac97_ad1888_controls[] = {
2067 2072
2068static int patch_ad1888_specific(struct snd_ac97 *ac97) 2073static int patch_ad1888_specific(struct snd_ac97 *ac97)
2069{ 2074{
2070 /* rename 0x04 as "Master" and 0x02 as "Master Surround" */ 2075 if (!ac97->spec.ad18xx.lo_as_master) {
2071 snd_ac97_rename_vol_ctl(ac97, "Master Playback", "Master Surround Playback"); 2076 /* rename 0x04 as "Master" and 0x02 as "Master Surround" */
2072 snd_ac97_rename_vol_ctl(ac97, "Headphone Playback", "Master Playback"); 2077 snd_ac97_rename_vol_ctl(ac97, "Master Playback",
2078 "Master Surround Playback");
2079 snd_ac97_rename_vol_ctl(ac97, "Headphone Playback",
2080 "Master Playback");
2081 }
2073 return patch_build_controls(ac97, snd_ac97_ad1888_controls, ARRAY_SIZE(snd_ac97_ad1888_controls)); 2082 return patch_build_controls(ac97, snd_ac97_ad1888_controls, ARRAY_SIZE(snd_ac97_ad1888_controls));
2074} 2083}
2075 2084
@@ -2088,16 +2097,27 @@ static int patch_ad1888(struct snd_ac97 * ac97)
2088 2097
2089 patch_ad1881(ac97); 2098 patch_ad1881(ac97);
2090 ac97->build_ops = &patch_ad1888_build_ops; 2099 ac97->build_ops = &patch_ad1888_build_ops;
2091 /* Switch FRONT/SURROUND LINE-OUT/HP-OUT default connection */ 2100
2092 /* it seems that most vendors connect line-out connector to headphone out of AC'97 */ 2101 /*
2102 * LO can be used as a real line-out on some devices,
2103 * and we need to revert the front/surround mixer switches
2104 */
2105 if (ac97->subsystem_vendor == 0x1043 &&
2106 ac97->subsystem_device == 0x1193) /* ASUS A9T laptop */
2107 ac97->spec.ad18xx.lo_as_master = 1;
2108
2109 misc = snd_ac97_read(ac97, AC97_AD_MISC);
2093 /* AD-compatible mode */ 2110 /* AD-compatible mode */
2094 /* Stereo mutes enabled */ 2111 /* Stereo mutes enabled */
2095 misc = snd_ac97_read(ac97, AC97_AD_MISC); 2112 misc |= AC97_AD198X_MSPLT | AC97_AD198X_AC97NC;
2096 snd_ac97_write_cache(ac97, AC97_AD_MISC, misc | 2113 if (!ac97->spec.ad18xx.lo_as_master)
2097 AC97_AD198X_LOSEL | 2114 /* Switch FRONT/SURROUND LINE-OUT/HP-OUT default connection */
2098 AC97_AD198X_HPSEL | 2115 /* it seems that most vendors connect line-out connector to
2099 AC97_AD198X_MSPLT | 2116 * headphone out of AC'97
2100 AC97_AD198X_AC97NC); 2117 */
2118 misc |= AC97_AD198X_LOSEL | AC97_AD198X_HPSEL;
2119
2120 snd_ac97_write_cache(ac97, AC97_AD_MISC, misc);
2101 ac97->flags |= AC97_STEREO_MUTES; 2121 ac97->flags |= AC97_STEREO_MUTES;
2102 return 0; 2122 return 0;
2103} 2123}