aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/ac97/ac97_codec.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/ac97/ac97_codec.c')
-rw-r--r--sound/pci/ac97/ac97_codec.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index 0677d41239a9..94cd989cff20 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -2227,6 +2227,7 @@ void snd_ac97_restore_iec958(ac97_t *ac97)
2227void snd_ac97_resume(ac97_t *ac97) 2227void snd_ac97_resume(ac97_t *ac97)
2228{ 2228{
2229 int i; 2229 int i;
2230 unsigned long end_time;
2230 2231
2231 if (ac97->bus->ops->reset) { 2232 if (ac97->bus->ops->reset) {
2232 ac97->bus->ops->reset(ac97); 2233 ac97->bus->ops->reset(ac97);
@@ -2244,26 +2245,26 @@ void snd_ac97_resume(ac97_t *ac97)
2244 snd_ac97_write(ac97, AC97_POWERDOWN, ac97->regs[AC97_POWERDOWN]); 2245 snd_ac97_write(ac97, AC97_POWERDOWN, ac97->regs[AC97_POWERDOWN]);
2245 if (ac97_is_audio(ac97)) { 2246 if (ac97_is_audio(ac97)) {
2246 ac97->bus->ops->write(ac97, AC97_MASTER, 0x8101); 2247 ac97->bus->ops->write(ac97, AC97_MASTER, 0x8101);
2247 for (i = HZ/10; i >= 0; i--) { 2248 end_time = jiffies + msecs_to_jiffies(100);
2249 do {
2248 if (snd_ac97_read(ac97, AC97_MASTER) == 0x8101) 2250 if (snd_ac97_read(ac97, AC97_MASTER) == 0x8101)
2249 break; 2251 break;
2250 set_current_state(TASK_UNINTERRUPTIBLE); 2252 set_current_state(TASK_UNINTERRUPTIBLE);
2251 schedule_timeout(1); 2253 schedule_timeout(1);
2252 } 2254 } while (time_after_eq(end_time, jiffies));
2253 /* FIXME: extra delay */ 2255 /* FIXME: extra delay */
2254 ac97->bus->ops->write(ac97, AC97_MASTER, 0x8000); 2256 ac97->bus->ops->write(ac97, AC97_MASTER, 0x8000);
2255 if (snd_ac97_read(ac97, AC97_MASTER) != 0x8000) { 2257 if (snd_ac97_read(ac97, AC97_MASTER) != 0x8000)
2256 set_current_state(TASK_UNINTERRUPTIBLE); 2258 msleep(250);
2257 schedule_timeout(HZ/4);
2258 }
2259 } else { 2259 } else {
2260 for (i = HZ/10; i >= 0; i--) { 2260 end_time = jiffies + msecs_to_jiffies(100);
2261 do {
2261 unsigned short val = snd_ac97_read(ac97, AC97_EXTENDED_MID); 2262 unsigned short val = snd_ac97_read(ac97, AC97_EXTENDED_MID);
2262 if (val != 0xffff && (val & 1) != 0) 2263 if (val != 0xffff && (val & 1) != 0)
2263 break; 2264 break;
2264 set_current_state(TASK_UNINTERRUPTIBLE); 2265 set_current_state(TASK_UNINTERRUPTIBLE);
2265 schedule_timeout(1); 2266 schedule_timeout(1);
2266 } 2267 } while (time_after_eq(end_time, jiffies));
2267 } 2268 }
2268__reset_ready: 2269__reset_ready:
2269 2270