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.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index feeed12920b4..7c96361b95e3 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1379,12 +1379,16 @@ static int azx_suspend(struct pci_dev *pci, pm_message_t state)
1379 snd_pcm_suspend_all(chip->pcm[i]); 1379 snd_pcm_suspend_all(chip->pcm[i]);
1380 snd_hda_suspend(chip->bus, state); 1380 snd_hda_suspend(chip->bus, state);
1381 azx_free_cmd_io(chip); 1381 azx_free_cmd_io(chip);
1382 if (chip->irq >= 0) 1382 if (chip->irq >= 0) {
1383 synchronize_irq(chip->irq);
1383 free_irq(chip->irq, chip); 1384 free_irq(chip->irq, chip);
1385 chip->irq = -1;
1386 }
1384 if (!disable_msi) 1387 if (!disable_msi)
1385 pci_disable_msi(chip->pci); 1388 pci_disable_msi(chip->pci);
1386 pci_disable_device(pci); 1389 pci_disable_device(pci);
1387 pci_save_state(pci); 1390 pci_save_state(pci);
1391 pci_set_power_state(pci, pci_choose_state(pci, state));
1388 return 0; 1392 return 0;
1389} 1393}
1390 1394
@@ -1393,15 +1397,25 @@ static int azx_resume(struct pci_dev *pci)
1393 struct snd_card *card = pci_get_drvdata(pci); 1397 struct snd_card *card = pci_get_drvdata(pci);
1394 struct azx *chip = card->private_data; 1398 struct azx *chip = card->private_data;
1395 1399
1400 pci_set_power_state(pci, PCI_D0);
1396 pci_restore_state(pci); 1401 pci_restore_state(pci);
1397 pci_enable_device(pci); 1402 if (pci_enable_device(pci) < 0) {
1403 printk(KERN_ERR "hda-intel: pci_enable_device failed, "
1404 "disabling device\n");
1405 snd_card_disconnect(card);
1406 return -EIO;
1407 }
1408 pci_set_master(pci);
1398 if (!disable_msi) 1409 if (!disable_msi)
1399 pci_enable_msi(pci); 1410 pci_enable_msi(pci);
1400 /* FIXME: need proper error handling */ 1411 if (request_irq(pci->irq, azx_interrupt, IRQF_DISABLED|IRQF_SHARED,
1401 request_irq(pci->irq, azx_interrupt, IRQF_DISABLED|IRQF_SHARED, 1412 "HDA Intel", chip)) {
1402 "HDA Intel", chip); 1413 printk(KERN_ERR "hda-intel: unable to grab IRQ %d, "
1414 "disabling device\n", pci->irq);
1415 snd_card_disconnect(card);
1416 return -EIO;
1417 }
1403 chip->irq = pci->irq; 1418 chip->irq = pci->irq;
1404 pci_set_master(pci);
1405 azx_init_chip(chip); 1419 azx_init_chip(chip);
1406 snd_hda_resume(chip->bus); 1420 snd_hda_resume(chip->bus);
1407 snd_power_change_state(card, SNDRV_CTL_POWER_D0); 1421 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
@@ -1431,15 +1445,14 @@ static int azx_free(struct azx *chip)
1431 /* disable position buffer */ 1445 /* disable position buffer */
1432 azx_writel(chip, DPLBASE, 0); 1446 azx_writel(chip, DPLBASE, 0);
1433 azx_writel(chip, DPUBASE, 0); 1447 azx_writel(chip, DPUBASE, 0);
1434
1435 synchronize_irq(chip->irq);
1436 } 1448 }
1437 1449
1438 if (chip->irq >= 0) { 1450 if (chip->irq >= 0) {
1451 synchronize_irq(chip->irq);
1439 free_irq(chip->irq, (void*)chip); 1452 free_irq(chip->irq, (void*)chip);
1440 if (!disable_msi)
1441 pci_disable_msi(chip->pci);
1442 } 1453 }
1454 if (!disable_msi)
1455 pci_disable_msi(chip->pci);
1443 if (chip->remap_addr) 1456 if (chip->remap_addr)
1444 iounmap(chip->remap_addr); 1457 iounmap(chip->remap_addr);
1445 1458