aboutsummaryrefslogtreecommitdiff
path: root/sound/pci/ac97
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/ac97')
-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 0677d41239a..94cd989cff2 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)
void snd_ac97_resume(ac97_t *ac97)
{
int i;
+ unsigned long end_time;
if (ac97->bus->ops->reset) {
ac97->bus->ops->reset(ac97);
@@ -2244,26 +2245,26 @@ void snd_ac97_resume(ac97_t *ac97)
snd_ac97_write(ac97, AC97_POWERDOWN, ac97->regs[AC97_POWERDOWN]);
if (ac97_is_audio(ac97)) {
ac97->bus->ops->write(ac97, AC97_MASTER, 0x8101);
- for (i = HZ/10; i >= 0; i--) {
+ end_time = jiffies + msecs_to_jiffies(100);
+ do {
if (snd_ac97_read(ac97, AC97_MASTER) == 0x8101)
break;
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(1);
- }
+ } while (time_after_eq(end_time, jiffies));
/* FIXME: extra delay */
ac97->bus->ops->write(ac97, AC97_MASTER, 0x8000);
- if (snd_ac97_read(ac97, AC97_MASTER) != 0x8000) {
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout(HZ/4);
- }
+ if (snd_ac97_read(ac97, AC97_MASTER) != 0x8000)
+ msleep(250);
} else {
- for (i = HZ/10; i >= 0; i--) {
+ end_time = jiffies + msecs_to_jiffies(100);
+ do {
unsigned short val = snd_ac97_read(ac97, AC97_EXTENDED_MID);
if (val != 0xffff && (val & 1) != 0)
break;
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(1);
- }
+ } while (time_after_eq(end_time, jiffies));
}
__reset_ready: