diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-05-29 02:16:56 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-05-30 10:20:42 -0400 |
commit | e48d6d97bb6bd8c008045ea0522ea8278fdccc55 (patch) | |
tree | cd27ea13b6294037054097658505f6cdc085a1b2 | |
parent | e490517a039a99d692cb3a5561941b0a5f576172 (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>
-rw-r--r-- | include/sound/ac97_codec.h | 1 | ||||
-rw-r--r-- | sound/pci/ac97/ac97_patch.c | 48 |
2 files changed, 35 insertions, 14 deletions
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h index 049edc5e6461..9c309daf492b 100644 --- a/include/sound/ac97_codec.h +++ b/include/sound/ac97_codec.h | |||
@@ -505,6 +505,7 @@ struct snd_ac97 { | |||
505 | unsigned short pcmreg[3]; // PCM registers | 505 | unsigned short pcmreg[3]; // PCM registers |
506 | unsigned short codec_cfg[3]; // CODEC_CFG bits | 506 | unsigned short codec_cfg[3]; // CODEC_CFG bits |
507 | unsigned char swap_mic_linein; // AD1986/AD1986A only | 507 | unsigned char swap_mic_linein; // AD1986/AD1986A only |
508 | unsigned char lo_as_master; /* LO as master */ | ||
508 | } ad18xx; | 509 | } ad18xx; |
509 | unsigned int dev_flags; /* device specific */ | 510 | unsigned int dev_flags; /* device specific */ |
510 | } spec; | 511 | } spec; |
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 | ||
2068 | static int patch_ad1888_specific(struct snd_ac97 *ac97) | 2073 | static 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 | } |