diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-07 11:09:02 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-07 11:09:02 -0500 |
commit | 8f0cb147b2fb12427bf6abef7fed2b604557a41e (patch) | |
tree | fb5ba437ee74b900fab9686c8c7df18abcd7640b /sound/pci/ac97/ac97_patch.c | |
parent | 8e33ba49765484bc6de3a2f8143733713fa93bc1 (diff) | |
parent | b00e8443c3eece823052d06ae1c7cb797ab0ddf5 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/perex/alsa
Diffstat (limited to 'sound/pci/ac97/ac97_patch.c')
-rw-r--r-- | sound/pci/ac97/ac97_patch.c | 80 |
1 files changed, 52 insertions, 28 deletions
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c index 0238cc65d32a..de1c72ad2c6b 100644 --- a/sound/pci/ac97/ac97_patch.c +++ b/sound/pci/ac97/ac97_patch.c | |||
@@ -163,14 +163,24 @@ static int ac97_channel_mode_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t | |||
163 | .private_value = 1, \ | 163 | .private_value = 1, \ |
164 | } | 164 | } |
165 | 165 | ||
166 | static inline int is_surround_on(ac97_t *ac97) | ||
167 | { | ||
168 | return ac97->channel_mode >= 1; | ||
169 | } | ||
170 | |||
171 | static inline int is_clfe_on(ac97_t *ac97) | ||
172 | { | ||
173 | return ac97->channel_mode >= 2; | ||
174 | } | ||
175 | |||
166 | static inline int is_shared_linein(ac97_t *ac97) | 176 | static inline int is_shared_linein(ac97_t *ac97) |
167 | { | 177 | { |
168 | return ! ac97->indep_surround && ac97->channel_mode >= 1; | 178 | return ! ac97->indep_surround && is_surround_on(ac97); |
169 | } | 179 | } |
170 | 180 | ||
171 | static inline int is_shared_micin(ac97_t *ac97) | 181 | static inline int is_shared_micin(ac97_t *ac97) |
172 | { | 182 | { |
173 | return ! ac97->indep_surround && ac97->channel_mode >= 2; | 183 | return ! ac97->indep_surround && is_clfe_on(ac97); |
174 | } | 184 | } |
175 | 185 | ||
176 | 186 | ||
@@ -1450,7 +1460,8 @@ int patch_ad1881(ac97_t * ac97) | |||
1450 | codecs[1] = patch_ad1881_unchained(ac97, 1, (1<<14)); | 1460 | codecs[1] = patch_ad1881_unchained(ac97, 1, (1<<14)); |
1451 | codecs[2] = patch_ad1881_unchained(ac97, 2, (1<<13)); | 1461 | codecs[2] = patch_ad1881_unchained(ac97, 2, (1<<13)); |
1452 | 1462 | ||
1453 | snd_runtime_check(codecs[0] | codecs[1] | codecs[2], goto __end); | 1463 | if (! (codecs[0] || codecs[1] || codecs[2])) |
1464 | goto __end; | ||
1454 | 1465 | ||
1455 | for (idx = 0; idx < 3; idx++) | 1466 | for (idx = 0; idx < 3; idx++) |
1456 | if (ac97->spec.ad18xx.unchained[idx]) | 1467 | if (ac97->spec.ad18xx.unchained[idx]) |
@@ -1753,12 +1764,13 @@ static int snd_ac97_ad1888_downmix_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_va | |||
1753 | 1764 | ||
1754 | static void ad1888_update_jacks(ac97_t *ac97) | 1765 | static void ad1888_update_jacks(ac97_t *ac97) |
1755 | { | 1766 | { |
1767 | unsigned short val = 0; | ||
1768 | if (! is_shared_linein(ac97)) | ||
1769 | val |= (1 << 12); | ||
1770 | if (! is_shared_micin(ac97)) | ||
1771 | val |= (1 << 11); | ||
1756 | /* shared Line-In */ | 1772 | /* shared Line-In */ |
1757 | snd_ac97_update_bits(ac97, AC97_AD_MISC, 1 << 12, | 1773 | snd_ac97_update_bits(ac97, AC97_AD_MISC, (1 << 11) | (1 << 12), val); |
1758 | is_shared_linein(ac97) ? 0 : 1 << 12); | ||
1759 | /* shared Mic */ | ||
1760 | snd_ac97_update_bits(ac97, AC97_AD_MISC, 1 << 11, | ||
1761 | is_shared_micin(ac97) ? 0 : 1 << 11); | ||
1762 | } | 1774 | } |
1763 | 1775 | ||
1764 | static const snd_kcontrol_new_t snd_ac97_ad1888_controls[] = { | 1776 | static const snd_kcontrol_new_t snd_ac97_ad1888_controls[] = { |
@@ -1852,12 +1864,7 @@ static const snd_kcontrol_new_t snd_ac97_ad1985_controls[] = { | |||
1852 | 1864 | ||
1853 | static void ad1985_update_jacks(ac97_t *ac97) | 1865 | static void ad1985_update_jacks(ac97_t *ac97) |
1854 | { | 1866 | { |
1855 | /* shared Line-In */ | 1867 | ad1888_update_jacks(ac97); |
1856 | snd_ac97_update_bits(ac97, AC97_AD_MISC, 1 << 12, | ||
1857 | is_shared_linein(ac97) ? 0 : 1 << 12); | ||
1858 | /* shared Mic */ | ||
1859 | snd_ac97_update_bits(ac97, AC97_AD_MISC, 1 << 11, | ||
1860 | is_shared_micin(ac97) ? 0 : 1 << 11); | ||
1861 | snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 1 << 9, | 1868 | snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 1 << 9, |
1862 | is_shared_micin(ac97) ? 0 : 1 << 9); | 1869 | is_shared_micin(ac97) ? 0 : 1 << 9); |
1863 | } | 1870 | } |
@@ -2442,21 +2449,37 @@ int patch_cm9739(ac97_t * ac97) | |||
2442 | 2449 | ||
2443 | static void cm9761_update_jacks(ac97_t *ac97) | 2450 | static void cm9761_update_jacks(ac97_t *ac97) |
2444 | { | 2451 | { |
2445 | unsigned short surr_vals[2][2] = { | 2452 | /* FIXME: check the bits for each model |
2446 | { 0x0008, 0x0400 }, /* off, on */ | 2453 | * model 83 is confirmed to work |
2447 | { 0x0000, 0x0408 }, /* off, on (9761-82 rev.B) */ | 2454 | */ |
2455 | static unsigned short surr_on[3][2] = { | ||
2456 | { 0x0008, 0x0000 }, /* 9761-78 & 82 */ | ||
2457 | { 0x0000, 0x0008 }, /* 9761-82 rev.B */ | ||
2458 | { 0x0000, 0x0008 }, /* 9761-83 */ | ||
2459 | }; | ||
2460 | static unsigned short clfe_on[3][2] = { | ||
2461 | { 0x0000, 0x1000 }, /* 9761-78 & 82 */ | ||
2462 | { 0x1000, 0x0000 }, /* 9761-82 rev.B */ | ||
2463 | { 0x0000, 0x1000 }, /* 9761-83 */ | ||
2464 | }; | ||
2465 | static unsigned short surr_shared[3][2] = { | ||
2466 | { 0x0000, 0x0400 }, /* 9761-78 & 82 */ | ||
2467 | { 0x0000, 0x0400 }, /* 9761-82 rev.B */ | ||
2468 | { 0x0000, 0x0400 }, /* 9761-83 */ | ||
2448 | }; | 2469 | }; |
2449 | unsigned short clfe_vals[2][2] = { | 2470 | static unsigned short clfe_shared[3][2] = { |
2450 | { 0x2000, 0x1880 }, /* off, on */ | 2471 | { 0x2000, 0x0880 }, /* 9761-78 & 82 */ |
2451 | { 0x1000, 0x2880 }, /* off, on (9761-82 rev.B) */ | 2472 | { 0x0000, 0x2880 }, /* 9761-82 rev.B */ |
2473 | { 0x2000, 0x0800 }, /* 9761-83 */ | ||
2452 | }; | 2474 | }; |
2475 | unsigned short val = 0; | ||
2453 | 2476 | ||
2454 | /* shared Line-In */ | 2477 | val |= surr_on[ac97->spec.dev_flags][is_surround_on(ac97)]; |
2455 | snd_ac97_update_bits(ac97, AC97_CM9761_MULTI_CHAN, 0x0408, | 2478 | val |= clfe_on[ac97->spec.dev_flags][is_clfe_on(ac97)]; |
2456 | surr_vals[ac97->spec.dev_flags][is_shared_linein(ac97)]); | 2479 | val |= surr_shared[ac97->spec.dev_flags][is_shared_linein(ac97)]; |
2457 | /* shared Mic */ | 2480 | val |= clfe_shared[ac97->spec.dev_flags][is_shared_micin(ac97)]; |
2458 | snd_ac97_update_bits(ac97, AC97_CM9761_MULTI_CHAN, 0x3880, | 2481 | |
2459 | clfe_vals[ac97->spec.dev_flags][is_shared_micin(ac97)]); | 2482 | snd_ac97_update_bits(ac97, AC97_CM9761_MULTI_CHAN, 0x3c88, val); |
2460 | } | 2483 | } |
2461 | 2484 | ||
2462 | static const snd_kcontrol_new_t snd_ac97_cm9761_controls[] = { | 2485 | static const snd_kcontrol_new_t snd_ac97_cm9761_controls[] = { |
@@ -2551,7 +2574,7 @@ int patch_cm9761(ac97_t *ac97) | |||
2551 | snd_ac97_write_cache(ac97, AC97_MASTER, 0x8808); | 2574 | snd_ac97_write_cache(ac97, AC97_MASTER, 0x8808); |
2552 | snd_ac97_write_cache(ac97, AC97_PCM, 0x8808); | 2575 | snd_ac97_write_cache(ac97, AC97_PCM, 0x8808); |
2553 | 2576 | ||
2554 | ac97->spec.dev_flags = 0; /* 1 = model 82 revision B */ | 2577 | ac97->spec.dev_flags = 0; /* 1 = model 82 revision B, 2 = model 83 */ |
2555 | if (ac97->id == AC97_ID_CM9761_82) { | 2578 | if (ac97->id == AC97_ID_CM9761_82) { |
2556 | unsigned short tmp; | 2579 | unsigned short tmp; |
2557 | /* check page 1, reg 0x60 */ | 2580 | /* check page 1, reg 0x60 */ |
@@ -2560,7 +2583,8 @@ int patch_cm9761(ac97_t *ac97) | |||
2560 | tmp = snd_ac97_read(ac97, 0x60); | 2583 | tmp = snd_ac97_read(ac97, 0x60); |
2561 | ac97->spec.dev_flags = tmp & 1; /* revision B? */ | 2584 | ac97->spec.dev_flags = tmp & 1; /* revision B? */ |
2562 | snd_ac97_write_cache(ac97, AC97_INT_PAGING, val); | 2585 | snd_ac97_write_cache(ac97, AC97_INT_PAGING, val); |
2563 | } | 2586 | } else if (ac97->id == AC97_ID_CM9761_83) |
2587 | ac97->spec.dev_flags = 2; | ||
2564 | 2588 | ||
2565 | ac97->build_ops = &patch_cm9761_ops; | 2589 | ac97->build_ops = &patch_cm9761_ops; |
2566 | 2590 | ||