aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorRandy Cushman <rcushman_linux@earthlink.net>2006-12-19 12:42:16 -0500
committerJaroslav Kysela <perex@suse.cz>2007-02-09 03:02:43 -0500
commit831466f4ad2b5fe23dff77edbe6a7c244435e973 (patch)
treec6ca59c6390484573f855d4efad5a6165a4ae5c0 /sound
parent4bb09523de50dcf1afc5d3099b9da0381f01b04c (diff)
[ALSA] ac97 - fix microphone and line_in selection logic
This patch fixes the Microphone and LINE_IN select logic for Analog Devices surround codecs with shared jacks. The existing code can never utilize the shared jacks for Microphone and LINE_IN due to the reversed jack selection logic. The patched code correctly selects the shared jack for input if the 'Channel Mode' selector does not specify that the jack is to be used for output. Specifically, in '2ch' mode the Center/LFE jack is used for microphone input and the Surround jack is used for LINE_IN, in '4ch' mode the Center/LFE jack is used for microphone input and the Surround jack is used for output, and in '6ch' mode both jacks are used for output. Signed-off-by: Randy Cushman <rcushman_linux@earthlink.net> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/ac97/ac97_patch.c66
1 files changed, 40 insertions, 26 deletions
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c
index 818a77d2deff..5f69b9c9f1b3 100644
--- a/sound/pci/ac97/ac97_patch.c
+++ b/sound/pci/ac97/ac97_patch.c
@@ -190,14 +190,28 @@ static inline int is_clfe_on(struct snd_ac97 *ac97)
190 return ac97->channel_mode >= 2; 190 return ac97->channel_mode >= 2;
191} 191}
192 192
193/* system has shared jacks with surround out enabled */
194static inline int is_shared_surrout(struct snd_ac97 *ac97)
195{
196 return !ac97->indep_surround && is_surround_on(ac97);
197}
198
199/* system has shared jacks with center/lfe out enabled */
200static inline int is_shared_clfeout(struct snd_ac97 *ac97)
201{
202 return !ac97->indep_surround && is_clfe_on(ac97);
203}
204
205/* system has shared jacks with line in enabled */
193static inline int is_shared_linein(struct snd_ac97 *ac97) 206static inline int is_shared_linein(struct snd_ac97 *ac97)
194{ 207{
195 return ! ac97->indep_surround && is_surround_on(ac97); 208 return !ac97->indep_surround && !is_surround_on(ac97);
196} 209}
197 210
211/* system has shared jacks with mic in enabled */
198static inline int is_shared_micin(struct snd_ac97 *ac97) 212static inline int is_shared_micin(struct snd_ac97 *ac97)
199{ 213{
200 return ! ac97->indep_surround && is_clfe_on(ac97); 214 return !ac97->indep_surround && !is_clfe_on(ac97);
201} 215}
202 216
203 217
@@ -2017,12 +2031,12 @@ static void alc650_update_jacks(struct snd_ac97 *ac97)
2017{ 2031{
2018 int shared; 2032 int shared;
2019 2033
2020 /* shared Line-In */ 2034 /* shared Line-In / Surround Out */
2021 shared = is_shared_linein(ac97); 2035 shared = is_shared_surrout(ac97);
2022 snd_ac97_update_bits(ac97, AC97_ALC650_MULTICH, 1 << 9, 2036 snd_ac97_update_bits(ac97, AC97_ALC650_MULTICH, 1 << 9,
2023 shared ? (1 << 9) : 0); 2037 shared ? (1 << 9) : 0);
2024 /* update shared Mic */ 2038 /* update shared Mic In / Center/LFE Out */
2025 shared = is_shared_micin(ac97); 2039 shared = is_shared_clfeout(ac97);
2026 /* disable/enable vref */ 2040 /* disable/enable vref */
2027 snd_ac97_update_bits(ac97, AC97_ALC650_CLOCK, 1 << 12, 2041 snd_ac97_update_bits(ac97, AC97_ALC650_CLOCK, 1 << 12,
2028 shared ? (1 << 12) : 0); 2042 shared ? (1 << 12) : 0);
@@ -2152,12 +2166,12 @@ static void alc655_update_jacks(struct snd_ac97 *ac97)
2152{ 2166{
2153 int shared; 2167 int shared;
2154 2168
2155 /* shared Line-In */ 2169 /* shared Line-In / Surround Out */
2156 shared = is_shared_linein(ac97); 2170 shared = is_shared_surrout(ac97);
2157 ac97_update_bits_page(ac97, AC97_ALC650_MULTICH, 1 << 9, 2171 ac97_update_bits_page(ac97, AC97_ALC650_MULTICH, 1 << 9,
2158 shared ? (1 << 9) : 0, 0); 2172 shared ? (1 << 9) : 0, 0);
2159 /* update shared mic */ 2173 /* update shared Mic In / Center/LFE Out */
2160 shared = is_shared_micin(ac97); 2174 shared = is_shared_clfeout(ac97);
2161 /* misc control; vrefout disable */ 2175 /* misc control; vrefout disable */
2162 snd_ac97_update_bits(ac97, AC97_ALC650_CLOCK, 1 << 12, 2176 snd_ac97_update_bits(ac97, AC97_ALC650_CLOCK, 1 << 12,
2163 shared ? (1 << 12) : 0); 2177 shared ? (1 << 12) : 0);
@@ -2301,16 +2315,16 @@ static void alc850_update_jacks(struct snd_ac97 *ac97)
2301{ 2315{
2302 int shared; 2316 int shared;
2303 2317
2304 /* shared Line-In */ 2318 /* shared Line-In / Surround Out */
2305 shared = is_shared_linein(ac97); 2319 shared = is_shared_surrout(ac97);
2306 /* SURR 1kOhm (bit4), Amp (bit5) */ 2320 /* SURR 1kOhm (bit4), Amp (bit5) */
2307 snd_ac97_update_bits(ac97, AC97_ALC850_MISC1, (1<<4)|(1<<5), 2321 snd_ac97_update_bits(ac97, AC97_ALC850_MISC1, (1<<4)|(1<<5),
2308 shared ? (1<<5) : (1<<4)); 2322 shared ? (1<<5) : (1<<4));
2309 /* LINE-IN = 0, SURROUND = 2 */ 2323 /* LINE-IN = 0, SURROUND = 2 */
2310 snd_ac97_update_bits(ac97, AC97_ALC850_JACK_SELECT, 7 << 12, 2324 snd_ac97_update_bits(ac97, AC97_ALC850_JACK_SELECT, 7 << 12,
2311 shared ? (2<<12) : (0<<12)); 2325 shared ? (2<<12) : (0<<12));
2312 /* update shared mic */ 2326 /* update shared Mic In / Center/LFE Out */
2313 shared = is_shared_micin(ac97); 2327 shared = is_shared_clfeout(ac97);
2314 /* Vref disable (bit12), 1kOhm (bit13) */ 2328 /* Vref disable (bit12), 1kOhm (bit13) */
2315 snd_ac97_update_bits(ac97, AC97_ALC850_MISC1, (1<<12)|(1<<13), 2329 snd_ac97_update_bits(ac97, AC97_ALC850_MISC1, (1<<12)|(1<<13),
2316 shared ? (1<<12) : (1<<13)); 2330 shared ? (1<<12) : (1<<13));
@@ -2383,9 +2397,9 @@ int patch_alc850(struct snd_ac97 *ac97)
2383 */ 2397 */
2384static void cm9738_update_jacks(struct snd_ac97 *ac97) 2398static void cm9738_update_jacks(struct snd_ac97 *ac97)
2385{ 2399{
2386 /* shared Line-In */ 2400 /* shared Line-In / Surround Out */
2387 snd_ac97_update_bits(ac97, AC97_CM9738_VENDOR_CTRL, 1 << 10, 2401 snd_ac97_update_bits(ac97, AC97_CM9738_VENDOR_CTRL, 1 << 10,
2388 is_shared_linein(ac97) ? (1 << 10) : 0); 2402 is_shared_surrout(ac97) ? (1 << 10) : 0);
2389} 2403}
2390 2404
2391static const struct snd_kcontrol_new snd_ac97_cm9738_controls[] = { 2405static const struct snd_kcontrol_new snd_ac97_cm9738_controls[] = {
@@ -2467,12 +2481,12 @@ static const struct snd_kcontrol_new snd_ac97_cm9739_controls_spdif[] = {
2467 2481
2468static void cm9739_update_jacks(struct snd_ac97 *ac97) 2482static void cm9739_update_jacks(struct snd_ac97 *ac97)
2469{ 2483{
2470 /* shared Line-In */ 2484 /* shared Line-In / Surround Out */
2471 snd_ac97_update_bits(ac97, AC97_CM9739_MULTI_CHAN, 1 << 10, 2485 snd_ac97_update_bits(ac97, AC97_CM9739_MULTI_CHAN, 1 << 10,
2472 is_shared_linein(ac97) ? (1 << 10) : 0); 2486 is_shared_surrout(ac97) ? (1 << 10) : 0);
2473 /* shared Mic */ 2487 /* shared Mic In / Center/LFE Out **/
2474 snd_ac97_update_bits(ac97, AC97_CM9739_MULTI_CHAN, 0x3000, 2488 snd_ac97_update_bits(ac97, AC97_CM9739_MULTI_CHAN, 0x3000,
2475 is_shared_micin(ac97) ? 0x1000 : 0x2000); 2489 is_shared_clfeout(ac97) ? 0x1000 : 0x2000);
2476} 2490}
2477 2491
2478static const struct snd_kcontrol_new snd_ac97_cm9739_controls[] = { 2492static const struct snd_kcontrol_new snd_ac97_cm9739_controls[] = {
@@ -2584,8 +2598,8 @@ static void cm9761_update_jacks(struct snd_ac97 *ac97)
2584 2598
2585 val |= surr_on[ac97->spec.dev_flags][is_surround_on(ac97)]; 2599 val |= surr_on[ac97->spec.dev_flags][is_surround_on(ac97)];
2586 val |= clfe_on[ac97->spec.dev_flags][is_clfe_on(ac97)]; 2600 val |= clfe_on[ac97->spec.dev_flags][is_clfe_on(ac97)];
2587 val |= surr_shared[ac97->spec.dev_flags][is_shared_linein(ac97)]; 2601 val |= surr_shared[ac97->spec.dev_flags][is_shared_surrout(ac97)];
2588 val |= clfe_shared[ac97->spec.dev_flags][is_shared_micin(ac97)]; 2602 val |= clfe_shared[ac97->spec.dev_flags][is_shared_clfeout(ac97)];
2589 2603
2590 snd_ac97_update_bits(ac97, AC97_CM9761_MULTI_CHAN, 0x3c88, val); 2604 snd_ac97_update_bits(ac97, AC97_CM9761_MULTI_CHAN, 0x3c88, val);
2591} 2605}
@@ -2832,12 +2846,12 @@ int patch_vt1617a(struct snd_ac97 * ac97)
2832 */ 2846 */
2833static void it2646_update_jacks(struct snd_ac97 *ac97) 2847static void it2646_update_jacks(struct snd_ac97 *ac97)
2834{ 2848{
2835 /* shared Line-In */ 2849 /* shared Line-In / Surround Out */
2836 snd_ac97_update_bits(ac97, 0x76, 1 << 9, 2850 snd_ac97_update_bits(ac97, 0x76, 1 << 9,
2837 is_shared_linein(ac97) ? (1<<9) : 0); 2851 is_shared_surrout(ac97) ? (1<<9) : 0);
2838 /* shared Mic */ 2852 /* shared Mic / Center/LFE Out */
2839 snd_ac97_update_bits(ac97, 0x76, 1 << 10, 2853 snd_ac97_update_bits(ac97, 0x76, 1 << 10,
2840 is_shared_micin(ac97) ? (1<<10) : 0); 2854 is_shared_clfeout(ac97) ? (1<<10) : 0);
2841} 2855}
2842 2856
2843static const struct snd_kcontrol_new snd_ac97_controls_it2646[] = { 2857static const struct snd_kcontrol_new snd_ac97_controls_it2646[] = {