diff options
Diffstat (limited to 'sound/pci/ac97/ac97_codec.c')
-rw-r--r-- | sound/pci/ac97/ac97_codec.c | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index bbed644bf9c5..6a9966df0cc9 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) by Jaroslav Kysela <perex@suse.cz> | 2 | * Copyright (c) by Jaroslav Kysela <perex@perex.cz> |
3 | * Universal interface for Audio Codec '97 | 3 | * Universal interface for Audio Codec '97 |
4 | * | 4 | * |
5 | * For more details look to AC '97 component specification revision 2.2 | 5 | * For more details look to AC '97 component specification revision 2.2 |
@@ -39,7 +39,7 @@ | |||
39 | 39 | ||
40 | #include "ac97_patch.c" | 40 | #include "ac97_patch.c" |
41 | 41 | ||
42 | MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); | 42 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); |
43 | MODULE_DESCRIPTION("Universal interface for Audio Codec '97"); | 43 | MODULE_DESCRIPTION("Universal interface for Audio Codec '97"); |
44 | MODULE_LICENSE("GPL"); | 44 | MODULE_LICENSE("GPL"); |
45 | 45 | ||
@@ -49,7 +49,7 @@ module_param(enable_loopback, bool, 0444); | |||
49 | MODULE_PARM_DESC(enable_loopback, "Enable AC97 ADC/DAC Loopback Control"); | 49 | MODULE_PARM_DESC(enable_loopback, "Enable AC97 ADC/DAC Loopback Control"); |
50 | 50 | ||
51 | #ifdef CONFIG_SND_AC97_POWER_SAVE | 51 | #ifdef CONFIG_SND_AC97_POWER_SAVE |
52 | static int power_save; | 52 | static int power_save = CONFIG_SND_AC97_POWER_SAVE_DEFAULT; |
53 | module_param(power_save, bool, 0644); | 53 | module_param(power_save, bool, 0644); |
54 | MODULE_PARM_DESC(power_save, "Enable AC97 power-saving control"); | 54 | MODULE_PARM_DESC(power_save, "Enable AC97 power-saving control"); |
55 | #endif | 55 | #endif |
@@ -176,7 +176,7 @@ static const struct ac97_codec_id snd_ac97_codec_ids[] = { | |||
176 | { 0x574d4C09, 0xffffffff, "WM9709", NULL, NULL}, | 176 | { 0x574d4C09, 0xffffffff, "WM9709", NULL, NULL}, |
177 | { 0x574d4C12, 0xffffffff, "WM9711,WM9712", patch_wolfson11, NULL}, | 177 | { 0x574d4C12, 0xffffffff, "WM9711,WM9712", patch_wolfson11, NULL}, |
178 | { 0x574d4c13, 0xffffffff, "WM9713,WM9714", patch_wolfson13, NULL, AC97_DEFAULT_POWER_OFF}, | 178 | { 0x574d4c13, 0xffffffff, "WM9713,WM9714", patch_wolfson13, NULL, AC97_DEFAULT_POWER_OFF}, |
179 | { 0x594d4800, 0xffffffff, "YMF743", NULL, NULL }, | 179 | { 0x594d4800, 0xffffffff, "YMF743", patch_yamaha_ymf743, NULL }, |
180 | { 0x594d4802, 0xffffffff, "YMF752", NULL, NULL }, | 180 | { 0x594d4802, 0xffffffff, "YMF752", NULL, NULL }, |
181 | { 0x594d4803, 0xffffffff, "YMF753", patch_yamaha_ymf753, NULL }, | 181 | { 0x594d4803, 0xffffffff, "YMF753", patch_yamaha_ymf753, NULL }, |
182 | { 0x83847600, 0xffffffff, "STAC9700,83,84", patch_sigmatel_stac9700, NULL }, | 182 | { 0x83847600, 0xffffffff, "STAC9700,83,84", patch_sigmatel_stac9700, NULL }, |
@@ -779,6 +779,12 @@ static int snd_ac97_spdif_default_put(struct snd_kcontrol *kcontrol, struct snd_ | |||
779 | change |= snd_ac97_update_bits_nolock(ac97, AC97_CXR_AUDIO_MISC, | 779 | change |= snd_ac97_update_bits_nolock(ac97, AC97_CXR_AUDIO_MISC, |
780 | AC97_CXR_SPDIF_MASK | AC97_CXR_COPYRGT, | 780 | AC97_CXR_SPDIF_MASK | AC97_CXR_COPYRGT, |
781 | v); | 781 | v); |
782 | } else if (ac97->id == AC97_ID_YMF743) { | ||
783 | change |= snd_ac97_update_bits_nolock(ac97, | ||
784 | AC97_YMF7X3_DIT_CTRL, | ||
785 | 0xff38, | ||
786 | ((val << 4) & 0xff00) | | ||
787 | ((val << 2) & 0x0038)); | ||
782 | } else { | 788 | } else { |
783 | unsigned short extst = snd_ac97_read_cache(ac97, AC97_EXTENDED_STATUS); | 789 | unsigned short extst = snd_ac97_read_cache(ac97, AC97_EXTENDED_STATUS); |
784 | snd_ac97_update_bits_nolock(ac97, AC97_EXTENDED_STATUS, AC97_EA_SPDIF, 0); /* turn off */ | 790 | snd_ac97_update_bits_nolock(ac97, AC97_EXTENDED_STATUS, AC97_EA_SPDIF, 0); /* turn off */ |
@@ -1375,7 +1381,8 @@ static int snd_ac97_mixer_build(struct snd_ac97 * ac97) | |||
1375 | for (idx = 0; idx < 2; idx++) { | 1381 | for (idx = 0; idx < 2; idx++) { |
1376 | if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_tone[idx], ac97))) < 0) | 1382 | if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_tone[idx], ac97))) < 0) |
1377 | return err; | 1383 | return err; |
1378 | if (ac97->id == AC97_ID_YMF753) { | 1384 | if (ac97->id == AC97_ID_YMF743 || |
1385 | ac97->id == AC97_ID_YMF753) { | ||
1379 | kctl->private_value &= ~(0xff << 16); | 1386 | kctl->private_value &= ~(0xff << 16); |
1380 | kctl->private_value |= 7 << 16; | 1387 | kctl->private_value |= 7 << 16; |
1381 | } | 1388 | } |
@@ -2036,11 +2043,12 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template, | |||
2036 | else { | 2043 | else { |
2037 | udelay(50); | 2044 | udelay(50); |
2038 | if (ac97->scaps & AC97_SCAP_SKIP_AUDIO) | 2045 | if (ac97->scaps & AC97_SCAP_SKIP_AUDIO) |
2039 | err = ac97_reset_wait(ac97, HZ/2, 1); | 2046 | err = ac97_reset_wait(ac97, msecs_to_jiffies(500), 1); |
2040 | else { | 2047 | else { |
2041 | err = ac97_reset_wait(ac97, HZ/2, 0); | 2048 | err = ac97_reset_wait(ac97, msecs_to_jiffies(500), 0); |
2042 | if (err < 0) | 2049 | if (err < 0) |
2043 | err = ac97_reset_wait(ac97, HZ/2, 1); | 2050 | err = ac97_reset_wait(ac97, |
2051 | msecs_to_jiffies(500), 1); | ||
2044 | } | 2052 | } |
2045 | if (err < 0) { | 2053 | if (err < 0) { |
2046 | snd_printk(KERN_WARNING "AC'97 %d does not respond - RESET\n", ac97->num); | 2054 | snd_printk(KERN_WARNING "AC'97 %d does not respond - RESET\n", ac97->num); |
@@ -2104,7 +2112,7 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template, | |||
2104 | } | 2112 | } |
2105 | /* nothing should be in powerdown mode */ | 2113 | /* nothing should be in powerdown mode */ |
2106 | snd_ac97_write_cache(ac97, AC97_GENERAL_PURPOSE, 0); | 2114 | snd_ac97_write_cache(ac97, AC97_GENERAL_PURPOSE, 0); |
2107 | end_time = jiffies + (HZ / 10); | 2115 | end_time = jiffies + msecs_to_jiffies(100); |
2108 | do { | 2116 | do { |
2109 | if ((snd_ac97_read(ac97, AC97_POWERDOWN) & 0x0f) == 0x0f) | 2117 | if ((snd_ac97_read(ac97, AC97_POWERDOWN) & 0x0f) == 0x0f) |
2110 | goto __ready_ok; | 2118 | goto __ready_ok; |
@@ -2136,7 +2144,7 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template, | |||
2136 | udelay(100); | 2144 | udelay(100); |
2137 | /* nothing should be in powerdown mode */ | 2145 | /* nothing should be in powerdown mode */ |
2138 | snd_ac97_write_cache(ac97, AC97_EXTENDED_MSTATUS, 0); | 2146 | snd_ac97_write_cache(ac97, AC97_EXTENDED_MSTATUS, 0); |
2139 | end_time = jiffies + (HZ / 10); | 2147 | end_time = jiffies + msecs_to_jiffies(100); |
2140 | do { | 2148 | do { |
2141 | if ((snd_ac97_read(ac97, AC97_EXTENDED_MSTATUS) & tmp) == tmp) | 2149 | if ((snd_ac97_read(ac97, AC97_EXTENDED_MSTATUS) & tmp) == tmp) |
2142 | goto __ready_ok; | 2150 | goto __ready_ok; |
@@ -2354,7 +2362,8 @@ int snd_ac97_update_power(struct snd_ac97 *ac97, int reg, int powerup) | |||
2354 | * (for avoiding loud click noises for many (OSS) apps | 2362 | * (for avoiding loud click noises for many (OSS) apps |
2355 | * that open/close frequently) | 2363 | * that open/close frequently) |
2356 | */ | 2364 | */ |
2357 | schedule_delayed_work(&ac97->power_work, HZ*2); | 2365 | schedule_delayed_work(&ac97->power_work, |
2366 | msecs_to_jiffies(2000)); | ||
2358 | else { | 2367 | else { |
2359 | cancel_delayed_work(&ac97->power_work); | 2368 | cancel_delayed_work(&ac97->power_work); |
2360 | update_power_regs(ac97); | 2369 | update_power_regs(ac97); |
@@ -2436,7 +2445,7 @@ EXPORT_SYMBOL(snd_ac97_suspend); | |||
2436 | /* | 2445 | /* |
2437 | * restore ac97 status | 2446 | * restore ac97 status |
2438 | */ | 2447 | */ |
2439 | void snd_ac97_restore_status(struct snd_ac97 *ac97) | 2448 | static void snd_ac97_restore_status(struct snd_ac97 *ac97) |
2440 | { | 2449 | { |
2441 | int i; | 2450 | int i; |
2442 | 2451 | ||
@@ -2457,7 +2466,7 @@ void snd_ac97_restore_status(struct snd_ac97 *ac97) | |||
2457 | /* | 2466 | /* |
2458 | * restore IEC958 status | 2467 | * restore IEC958 status |
2459 | */ | 2468 | */ |
2460 | void snd_ac97_restore_iec958(struct snd_ac97 *ac97) | 2469 | static void snd_ac97_restore_iec958(struct snd_ac97 *ac97) |
2461 | { | 2470 | { |
2462 | if (ac97->ext_id & AC97_EI_SPDIF) { | 2471 | if (ac97->ext_id & AC97_EI_SPDIF) { |
2463 | if (ac97->regs[AC97_EXTENDED_STATUS] & AC97_EA_SPDIF) { | 2472 | if (ac97->regs[AC97_EXTENDED_STATUS] & AC97_EA_SPDIF) { |
@@ -2494,7 +2503,10 @@ void snd_ac97_resume(struct snd_ac97 *ac97) | |||
2494 | 2503 | ||
2495 | snd_ac97_write(ac97, AC97_POWERDOWN, 0); | 2504 | snd_ac97_write(ac97, AC97_POWERDOWN, 0); |
2496 | if (! (ac97->flags & AC97_DEFAULT_POWER_OFF)) { | 2505 | if (! (ac97->flags & AC97_DEFAULT_POWER_OFF)) { |
2497 | snd_ac97_write(ac97, AC97_RESET, 0); | 2506 | if (!(ac97->scaps & AC97_SCAP_SKIP_AUDIO)) |
2507 | snd_ac97_write(ac97, AC97_RESET, 0); | ||
2508 | else if (!(ac97->scaps & AC97_SCAP_SKIP_MODEM)) | ||
2509 | snd_ac97_write(ac97, AC97_EXTENDED_MID, 0); | ||
2498 | udelay(100); | 2510 | udelay(100); |
2499 | snd_ac97_write(ac97, AC97_POWERDOWN, 0); | 2511 | snd_ac97_write(ac97, AC97_POWERDOWN, 0); |
2500 | } | 2512 | } |