aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/hda_intel.c46
1 files changed, 22 insertions, 24 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 4d2df771112e..e9d4cb4d07e1 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -520,38 +520,36 @@ static void azx_update_rirb(struct azx *chip)
520static unsigned int azx_rirb_get_response(struct hda_codec *codec) 520static unsigned int azx_rirb_get_response(struct hda_codec *codec)
521{ 521{
522 struct azx *chip = codec->bus->private_data; 522 struct azx *chip = codec->bus->private_data;
523 int timeout = 50; 523 unsigned long timeout;
524 524
525 for (;;) { 525 again:
526 timeout = jiffies + msecs_to_jiffies(1000);
527 do {
526 if (chip->polling_mode) { 528 if (chip->polling_mode) {
527 spin_lock_irq(&chip->reg_lock); 529 spin_lock_irq(&chip->reg_lock);
528 azx_update_rirb(chip); 530 azx_update_rirb(chip);
529 spin_unlock_irq(&chip->reg_lock); 531 spin_unlock_irq(&chip->reg_lock);
530 } 532 }
531 if (! chip->rirb.cmds) 533 if (! chip->rirb.cmds)
532 break; 534 return chip->rirb.res; /* the last value */
533 if (! --timeout) { 535 schedule_timeout_interruptible(1);
534 if (! chip->polling_mode) { 536 } while (time_after_eq(timeout, jiffies));
535 snd_printk(KERN_WARNING "hda_intel: " 537
536 "azx_get_response timeout, " 538 if (!chip->polling_mode) {
537 "switching to polling mode...\n"); 539 snd_printk(KERN_WARNING "hda_intel: azx_get_response timeout, "
538 chip->polling_mode = 1; 540 "switching to polling mode...\n");
539 timeout = 50; 541 chip->polling_mode = 1;
540 continue; 542 goto again;
541 }
542 snd_printk(KERN_ERR
543 "hda_intel: azx_get_response timeout, "
544 "switching to single_cmd mode...\n");
545 chip->rirb.rp = azx_readb(chip, RIRBWP);
546 chip->rirb.cmds = 0;
547 /* switch to single_cmd mode */
548 chip->single_cmd = 1;
549 azx_free_cmd_io(chip);
550 return -1;
551 }
552 msleep(1);
553 } 543 }
554 return chip->rirb.res; /* the last value */ 544
545 snd_printk(KERN_ERR "hda_intel: azx_get_response timeout, "
546 "switching to single_cmd mode...\n");
547 chip->rirb.rp = azx_readb(chip, RIRBWP);
548 chip->rirb.cmds = 0;
549 /* switch to single_cmd mode */
550 chip->single_cmd = 1;
551 azx_free_cmd_io(chip);
552 return -1;
555} 553}
556 554
557/* 555/*