aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_intel.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda/hda_intel.c')
-rw-r--r--sound/pci/hda/hda_intel.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index c19e71a94e1b..1f350522bed4 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -783,11 +783,13 @@ static unsigned int azx_rirb_get_response(struct hda_bus *bus,
783{ 783{
784 struct azx *chip = bus->private_data; 784 struct azx *chip = bus->private_data;
785 unsigned long timeout; 785 unsigned long timeout;
786 unsigned long loopcounter;
786 int do_poll = 0; 787 int do_poll = 0;
787 788
788 again: 789 again:
789 timeout = jiffies + msecs_to_jiffies(1000); 790 timeout = jiffies + msecs_to_jiffies(1000);
790 for (;;) { 791
792 for (loopcounter = 0;; loopcounter++) {
791 if (chip->polling_mode || do_poll) { 793 if (chip->polling_mode || do_poll) {
792 spin_lock_irq(&chip->reg_lock); 794 spin_lock_irq(&chip->reg_lock);
793 azx_update_rirb(chip); 795 azx_update_rirb(chip);
@@ -803,7 +805,7 @@ static unsigned int azx_rirb_get_response(struct hda_bus *bus,
803 } 805 }
804 if (time_after(jiffies, timeout)) 806 if (time_after(jiffies, timeout))
805 break; 807 break;
806 if (bus->needs_damn_long_delay) 808 if (bus->needs_damn_long_delay || loopcounter > 3000)
807 msleep(2); /* temporary workaround */ 809 msleep(2); /* temporary workaround */
808 else { 810 else {
809 udelay(10); 811 udelay(10);
@@ -2351,6 +2353,17 @@ static void azx_power_notify(struct hda_bus *bus)
2351 * power management 2353 * power management
2352 */ 2354 */
2353 2355
2356static int snd_hda_codecs_inuse(struct hda_bus *bus)
2357{
2358 struct hda_codec *codec;
2359
2360 list_for_each_entry(codec, &bus->codec_list, list) {
2361 if (snd_hda_codec_needs_resume(codec))
2362 return 1;
2363 }
2364 return 0;
2365}
2366
2354static int azx_suspend(struct pci_dev *pci, pm_message_t state) 2367static int azx_suspend(struct pci_dev *pci, pm_message_t state)
2355{ 2368{
2356 struct snd_card *card = pci_get_drvdata(pci); 2369 struct snd_card *card = pci_get_drvdata(pci);
@@ -2397,7 +2410,8 @@ static int azx_resume(struct pci_dev *pci)
2397 return -EIO; 2410 return -EIO;
2398 azx_init_pci(chip); 2411 azx_init_pci(chip);
2399 2412
2400 azx_init_chip(chip, 1); 2413 if (snd_hda_codecs_inuse(chip->bus))
2414 azx_init_chip(chip, 1);
2401 2415
2402 snd_hda_resume(chip->bus); 2416 snd_hda_resume(chip->bus);
2403 snd_power_change_state(card, SNDRV_CTL_POWER_D0); 2417 snd_power_change_state(card, SNDRV_CTL_POWER_D0);