aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/core/control.c4
-rw-r--r--sound/core/info.c5
-rw-r--r--sound/isa/Kconfig1
-rw-r--r--sound/isa/ad1816a/ad1816a.c2
-rw-r--r--sound/isa/cmi8330.c2
-rw-r--r--sound/isa/gus/interwave.c2
-rw-r--r--sound/isa/opti9xx/opti92x-ad1848.c2
-rw-r--r--sound/pci/ac97/ac97_codec.c8
-rw-r--r--sound/pci/ali5451/ali5451.c11
-rw-r--r--sound/pci/als300.c11
-rw-r--r--sound/pci/als4000.c11
-rw-r--r--sound/pci/atiixp.c11
-rw-r--r--sound/pci/atiixp_modem.c11
-rw-r--r--sound/pci/azt3328.c11
-rw-r--r--sound/pci/cmipci.c11
-rw-r--r--sound/pci/cs4281.c9
-rw-r--r--sound/pci/cs46xx/cs46xx_lib.c11
-rw-r--r--sound/pci/cs5535audio/cs5535audio_pm.c11
-rw-r--r--sound/pci/emu10k1/emu10k1.c13
-rw-r--r--sound/pci/ens1370.c12
-rw-r--r--sound/pci/es1938.c29
-rw-r--r--sound/pci/es1968.c71
-rw-r--r--sound/pci/fm801.c11
-rw-r--r--sound/pci/hda/hda_intel.c75
-rw-r--r--sound/pci/hda/patch_analog.c2
-rw-r--r--sound/pci/hda/patch_atihdmi.c1
-rw-r--r--sound/pci/hda/patch_realtek.c4
-rw-r--r--sound/pci/intel8x0.c23
-rw-r--r--sound/pci/intel8x0m.c23
-rw-r--r--sound/pci/maestro3.c13
-rw-r--r--sound/pci/nm256/nm256.c12
-rw-r--r--sound/pci/riptide/riptide.c11
-rw-r--r--sound/pci/trident/trident_main.c18
-rw-r--r--sound/pci/via82xx.c12
-rw-r--r--sound/pci/via82xx_modem.c12
-rw-r--r--sound/pci/vx222/vx222.c11
-rw-r--r--sound/pci/ymfpci/ymfpci_main.c9
37 files changed, 329 insertions, 167 deletions
diff --git a/sound/core/control.c b/sound/core/control.c
index 6973a9686b67..48ef0a09a7a7 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -1018,10 +1018,6 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file,
1018 } 1018 }
1019 switch (info->type) { 1019 switch (info->type) {
1020 case SNDRV_CTL_ELEM_TYPE_BOOLEAN: 1020 case SNDRV_CTL_ELEM_TYPE_BOOLEAN:
1021 private_size = sizeof(char);
1022 if (info->count > 128)
1023 return -EINVAL;
1024 break;
1025 case SNDRV_CTL_ELEM_TYPE_INTEGER: 1021 case SNDRV_CTL_ELEM_TYPE_INTEGER:
1026 private_size = sizeof(long); 1022 private_size = sizeof(long);
1027 if (info->count > 128) 1023 if (info->count > 128)
diff --git a/sound/core/info.c b/sound/core/info.c
index e43662b33f16..0b4aab3225e5 100644
--- a/sound/core/info.c
+++ b/sound/core/info.c
@@ -120,7 +120,10 @@ int snd_iprintf(struct snd_info_buffer *buffer, char *fmt,...)
120 len = buffer->len - buffer->size; 120 len = buffer->len - buffer->size;
121 va_start(args, fmt); 121 va_start(args, fmt);
122 for (;;) { 122 for (;;) {
123 res = vsnprintf(buffer->buffer + buffer->curr, len, fmt, args); 123 va_list ap;
124 va_copy(ap, args);
125 res = vsnprintf(buffer->buffer + buffer->curr, len, fmt, ap);
126 va_end(ap);
124 if (res < len) 127 if (res < len)
125 break; 128 break;
126 err = resize_info_buffer(buffer, buffer->len + PAGE_SIZE); 129 err = resize_info_buffer(buffer, buffer->len + PAGE_SIZE);
diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig
index 557c4de22960..57371f1a441f 100644
--- a/sound/isa/Kconfig
+++ b/sound/isa/Kconfig
@@ -13,6 +13,7 @@ config SND_CS4231_LIB
13 13
14config SND_ADLIB 14config SND_ADLIB
15 tristate "AdLib FM card" 15 tristate "AdLib FM card"
16 depends on SND
16 select SND_OPL3_LIB 17 select SND_OPL3_LIB
17 help 18 help
18 Say Y here to include support for AdLib FM cards. 19 Say Y here to include support for AdLib FM cards.
diff --git a/sound/isa/ad1816a/ad1816a.c b/sound/isa/ad1816a/ad1816a.c
index b33a5fb59ec2..59034507175b 100644
--- a/sound/isa/ad1816a/ad1816a.c
+++ b/sound/isa/ad1816a/ad1816a.c
@@ -120,6 +120,8 @@ static int __devinit snd_card_ad1816a_pnp(int dev, struct snd_card_ad1816a *acar
120 struct pnp_resource_table *cfg = kmalloc(sizeof(*cfg), GFP_KERNEL); 120 struct pnp_resource_table *cfg = kmalloc(sizeof(*cfg), GFP_KERNEL);
121 int err; 121 int err;
122 122
123 if (!cfg)
124 return -ENOMEM;
123 acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL); 125 acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL);
124 if (acard->dev == NULL) { 126 if (acard->dev == NULL) {
125 kfree(cfg); 127 kfree(cfg);
diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c
index 3c1e9fd56fe0..d1f6dfcec46e 100644
--- a/sound/isa/cmi8330.c
+++ b/sound/isa/cmi8330.c
@@ -289,6 +289,8 @@ static int __devinit snd_cmi8330_pnp(int dev, struct snd_cmi8330 *acard,
289 struct pnp_resource_table * cfg = kmalloc(sizeof(struct pnp_resource_table), GFP_KERNEL); 289 struct pnp_resource_table * cfg = kmalloc(sizeof(struct pnp_resource_table), GFP_KERNEL);
290 int err; 290 int err;
291 291
292 if (!cfg)
293 return -ENOMEM;
292 acard->cap = pnp_request_card_device(card, id->devs[0].id, NULL); 294 acard->cap = pnp_request_card_device(card, id->devs[0].id, NULL);
293 if (acard->cap == NULL) { 295 if (acard->cap == NULL) {
294 kfree(cfg); 296 kfree(cfg);
diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c
index f12cd09d1fcc..4ec2d79431fc 100644
--- a/sound/isa/gus/interwave.c
+++ b/sound/isa/gus/interwave.c
@@ -564,6 +564,8 @@ static int __devinit snd_interwave_pnp(int dev, struct snd_interwave *iwcard,
564 struct pnp_resource_table * cfg = kmalloc(sizeof(struct pnp_resource_table), GFP_KERNEL); 564 struct pnp_resource_table * cfg = kmalloc(sizeof(struct pnp_resource_table), GFP_KERNEL);
565 int err; 565 int err;
566 566
567 if (!cfg)
568 return -ENOMEM;
567 iwcard->dev = pnp_request_card_device(card, id->devs[0].id, NULL); 569 iwcard->dev = pnp_request_card_device(card, id->devs[0].id, NULL);
568 if (iwcard->dev == NULL) { 570 if (iwcard->dev == NULL) {
569 kfree(cfg); 571 kfree(cfg);
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c
index a1ad39a8cdce..df227377c333 100644
--- a/sound/isa/opti9xx/opti92x-ad1848.c
+++ b/sound/isa/opti9xx/opti92x-ad1848.c
@@ -1683,6 +1683,8 @@ static int __init snd_card_opti9xx_pnp(struct snd_opti9xx *chip, struct pnp_card
1683 struct pnp_resource_table *cfg = kmalloc(sizeof(*cfg), GFP_KERNEL); 1683 struct pnp_resource_table *cfg = kmalloc(sizeof(*cfg), GFP_KERNEL);
1684 int err; 1684 int err;
1685 1685
1686 if (!cfg)
1687 return -ENOMEM;
1686 chip->dev = pnp_request_card_device(card, pid->devs[0].id, NULL); 1688 chip->dev = pnp_request_card_device(card, pid->devs[0].id, NULL);
1687 if (chip->dev == NULL) { 1689 if (chip->dev == NULL) {
1688 kfree(cfg); 1690 kfree(cfg);
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index a79e91850ba3..6577b2325357 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -570,8 +570,7 @@ int snd_ac97_put_volsw(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value
570 ac97->power_up &= ~(1 << (reg>>1)); 570 ac97->power_up &= ~(1 << (reg>>1));
571 else 571 else
572 ac97->power_up |= 1 << (reg>>1); 572 ac97->power_up |= 1 << (reg>>1);
573 if (power_save) 573 update_power_regs(ac97);
574 update_power_regs(ac97);
575 } 574 }
576#endif 575#endif
577 return err; 576 return err;
@@ -2337,10 +2336,7 @@ int snd_ac97_update_power(struct snd_ac97 *ac97, int reg, int powerup)
2337 } 2336 }
2338 } 2337 }
2339 2338
2340 if (! power_save) 2339 if (power_save && !powerup && ac97->power_workq)
2341 return 0;
2342
2343 if (! powerup && ac97->power_workq)
2344 /* adjust power-down bits after two seconds delay 2340 /* adjust power-down bits after two seconds delay
2345 * (for avoiding loud click noises for many (OSS) apps 2341 * (for avoiding loud click noises for many (OSS) apps
2346 * that open/close frequently) 2342 * that open/close frequently)
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index 13a8cefa7749..a7edd56542d4 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -2032,8 +2032,10 @@ static int ali_suspend(struct pci_dev *pci, pm_message_t state)
2032 outl(0xffffffff, ALI_REG(chip, ALI_STOP)); 2032 outl(0xffffffff, ALI_REG(chip, ALI_STOP));
2033 2033
2034 spin_unlock_irq(&chip->reg_lock); 2034 spin_unlock_irq(&chip->reg_lock);
2035
2035 pci_disable_device(pci); 2036 pci_disable_device(pci);
2036 pci_save_state(pci); 2037 pci_save_state(pci);
2038 pci_set_power_state(pci, pci_choose_state(pci, state));
2037 return 0; 2039 return 0;
2038} 2040}
2039 2041
@@ -2048,8 +2050,15 @@ static int ali_resume(struct pci_dev *pci)
2048 if (! im) 2050 if (! im)
2049 return 0; 2051 return 0;
2050 2052
2053 pci_set_power_state(pci, PCI_D0);
2051 pci_restore_state(pci); 2054 pci_restore_state(pci);
2052 pci_enable_device(pci); 2055 if (pci_enable_device(pci) < 0) {
2056 printk(KERN_ERR "ali5451: pci_enable_device failed, "
2057 "disabling device\n");
2058 snd_card_disconnect(card);
2059 return -EIO;
2060 }
2061 pci_set_master(pci);
2053 2062
2054 spin_lock_irq(&chip->reg_lock); 2063 spin_lock_irq(&chip->reg_lock);
2055 2064
diff --git a/sound/pci/als300.c b/sound/pci/als300.c
index 9b16c299f0a9..95f70f3cc37e 100644
--- a/sound/pci/als300.c
+++ b/sound/pci/als300.c
@@ -768,9 +768,9 @@ static int snd_als300_suspend(struct pci_dev *pci, pm_message_t state)
768 snd_pcm_suspend_all(chip->pcm); 768 snd_pcm_suspend_all(chip->pcm);
769 snd_ac97_suspend(chip->ac97); 769 snd_ac97_suspend(chip->ac97);
770 770
771 pci_set_power_state(pci, PCI_D3hot);
772 pci_disable_device(pci); 771 pci_disable_device(pci);
773 pci_save_state(pci); 772 pci_save_state(pci);
773 pci_set_power_state(pci, pci_choose_state(pci, state));
774 return 0; 774 return 0;
775} 775}
776 776
@@ -779,9 +779,14 @@ static int snd_als300_resume(struct pci_dev *pci)
779 struct snd_card *card = pci_get_drvdata(pci); 779 struct snd_card *card = pci_get_drvdata(pci);
780 struct snd_als300 *chip = card->private_data; 780 struct snd_als300 *chip = card->private_data;
781 781
782 pci_restore_state(pci);
783 pci_enable_device(pci);
784 pci_set_power_state(pci, PCI_D0); 782 pci_set_power_state(pci, PCI_D0);
783 pci_restore_state(pci);
784 if (pci_enable_device(pci) < 0) {
785 printk(KERN_ERR "als300: pci_enable_device failed, "
786 "disabling device\n");
787 snd_card_disconnect(card);
788 return -EIO;
789 }
785 pci_set_master(pci); 790 pci_set_master(pci);
786 791
787 snd_als300_init(chip); 792 snd_als300_init(chip);
diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c
index 15fc3929b5f7..8fb55d3b454b 100644
--- a/sound/pci/als4000.c
+++ b/sound/pci/als4000.c
@@ -804,9 +804,9 @@ static int snd_als4000_suspend(struct pci_dev *pci, pm_message_t state)
804 snd_pcm_suspend_all(chip->pcm); 804 snd_pcm_suspend_all(chip->pcm);
805 snd_sbmixer_suspend(chip); 805 snd_sbmixer_suspend(chip);
806 806
807 pci_set_power_state(pci, PCI_D3hot);
808 pci_disable_device(pci); 807 pci_disable_device(pci);
809 pci_save_state(pci); 808 pci_save_state(pci);
809 pci_set_power_state(pci, pci_choose_state(pci, state));
810 return 0; 810 return 0;
811} 811}
812 812
@@ -816,9 +816,14 @@ static int snd_als4000_resume(struct pci_dev *pci)
816 struct snd_card_als4000 *acard = card->private_data; 816 struct snd_card_als4000 *acard = card->private_data;
817 struct snd_sb *chip = acard->chip; 817 struct snd_sb *chip = acard->chip;
818 818
819 pci_restore_state(pci);
820 pci_enable_device(pci);
821 pci_set_power_state(pci, PCI_D0); 819 pci_set_power_state(pci, PCI_D0);
820 pci_restore_state(pci);
821 if (pci_enable_device(pci) < 0) {
822 printk(KERN_ERR "als4000: pci_enable_device failed, "
823 "disabling device\n");
824 snd_card_disconnect(card);
825 return -EIO;
826 }
822 pci_set_master(pci); 827 pci_set_master(pci);
823 828
824 snd_als4000_configure(chip); 829 snd_als4000_configure(chip);
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c
index 3e8fc5a0006a..e3e99f396711 100644
--- a/sound/pci/atiixp.c
+++ b/sound/pci/atiixp.c
@@ -1442,9 +1442,9 @@ static int snd_atiixp_suspend(struct pci_dev *pci, pm_message_t state)
1442 snd_atiixp_aclink_down(chip); 1442 snd_atiixp_aclink_down(chip);
1443 snd_atiixp_chip_stop(chip); 1443 snd_atiixp_chip_stop(chip);
1444 1444
1445 pci_set_power_state(pci, PCI_D3hot);
1446 pci_disable_device(pci); 1445 pci_disable_device(pci);
1447 pci_save_state(pci); 1446 pci_save_state(pci);
1447 pci_set_power_state(pci, pci_choose_state(pci, state));
1448 return 0; 1448 return 0;
1449} 1449}
1450 1450
@@ -1454,9 +1454,14 @@ static int snd_atiixp_resume(struct pci_dev *pci)
1454 struct atiixp *chip = card->private_data; 1454 struct atiixp *chip = card->private_data;
1455 int i; 1455 int i;
1456 1456
1457 pci_restore_state(pci);
1458 pci_enable_device(pci);
1459 pci_set_power_state(pci, PCI_D0); 1457 pci_set_power_state(pci, PCI_D0);
1458 pci_restore_state(pci);
1459 if (pci_enable_device(pci) < 0) {
1460 printk(KERN_ERR "atiixp: pci_enable_device failed, "
1461 "disabling device\n");
1462 snd_card_disconnect(card);
1463 return -EIO;
1464 }
1460 pci_set_master(pci); 1465 pci_set_master(pci);
1461 1466
1462 snd_atiixp_aclink_reset(chip); 1467 snd_atiixp_aclink_reset(chip);
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c
index c5dda1bf3d46..dc54f2c68ed7 100644
--- a/sound/pci/atiixp_modem.c
+++ b/sound/pci/atiixp_modem.c
@@ -1128,9 +1128,9 @@ static int snd_atiixp_suspend(struct pci_dev *pci, pm_message_t state)
1128 snd_atiixp_aclink_down(chip); 1128 snd_atiixp_aclink_down(chip);
1129 snd_atiixp_chip_stop(chip); 1129 snd_atiixp_chip_stop(chip);
1130 1130
1131 pci_set_power_state(pci, PCI_D3hot);
1132 pci_disable_device(pci); 1131 pci_disable_device(pci);
1133 pci_save_state(pci); 1132 pci_save_state(pci);
1133 pci_set_power_state(pci, pci_choose_state(pci, state));
1134 return 0; 1134 return 0;
1135} 1135}
1136 1136
@@ -1140,9 +1140,14 @@ static int snd_atiixp_resume(struct pci_dev *pci)
1140 struct atiixp_modem *chip = card->private_data; 1140 struct atiixp_modem *chip = card->private_data;
1141 int i; 1141 int i;
1142 1142
1143 pci_restore_state(pci);
1144 pci_enable_device(pci);
1145 pci_set_power_state(pci, PCI_D0); 1143 pci_set_power_state(pci, PCI_D0);
1144 pci_restore_state(pci);
1145 if (pci_enable_device(pci) < 0) {
1146 printk(KERN_ERR "atiixp-modem: pci_enable_device failed, "
1147 "disabling device\n");
1148 snd_card_disconnect(card);
1149 return -EIO;
1150 }
1146 pci_set_master(pci); 1151 pci_set_master(pci);
1147 1152
1148 snd_atiixp_aclink_reset(chip); 1153 snd_atiixp_aclink_reset(chip);
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c
index 692f203d65d8..2414ee630756 100644
--- a/sound/pci/azt3328.c
+++ b/sound/pci/azt3328.c
@@ -1903,9 +1903,9 @@ snd_azf3328_suspend(struct pci_dev *pci, pm_message_t state)
1903 for (reg = 0; reg < AZF_IO_SIZE_SYNTH_PM / 2; reg++) 1903 for (reg = 0; reg < AZF_IO_SIZE_SYNTH_PM / 2; reg++)
1904 chip->saved_regs_synth[reg] = inw(chip->synth_port + reg * 2); 1904 chip->saved_regs_synth[reg] = inw(chip->synth_port + reg * 2);
1905 1905
1906 pci_set_power_state(pci, PCI_D3hot);
1907 pci_disable_device(pci); 1906 pci_disable_device(pci);
1908 pci_save_state(pci); 1907 pci_save_state(pci);
1908 pci_set_power_state(pci, pci_choose_state(pci, state));
1909 return 0; 1909 return 0;
1910} 1910}
1911 1911
@@ -1916,9 +1916,14 @@ snd_azf3328_resume(struct pci_dev *pci)
1916 struct snd_azf3328 *chip = card->private_data; 1916 struct snd_azf3328 *chip = card->private_data;
1917 int reg; 1917 int reg;
1918 1918
1919 pci_restore_state(pci);
1920 pci_enable_device(pci);
1921 pci_set_power_state(pci, PCI_D0); 1919 pci_set_power_state(pci, PCI_D0);
1920 pci_restore_state(pci);
1921 if (pci_enable_device(pci) < 0) {
1922 printk(KERN_ERR "azt3328: pci_enable_device failed, "
1923 "disabling device\n");
1924 snd_card_disconnect(card);
1925 return -EIO;
1926 }
1922 pci_set_master(pci); 1927 pci_set_master(pci);
1923 1928
1924 for (reg = 0; reg < AZF_IO_SIZE_IO2_PM / 2; reg++) 1929 for (reg = 0; reg < AZF_IO_SIZE_IO2_PM / 2; reg++)
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index 1f7e71083069..0093cd1f92db 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -3122,9 +3122,9 @@ static int snd_cmipci_suspend(struct pci_dev *pci, pm_message_t state)
3122 /* disable ints */ 3122 /* disable ints */
3123 snd_cmipci_write(cm, CM_REG_INT_HLDCLR, 0); 3123 snd_cmipci_write(cm, CM_REG_INT_HLDCLR, 0);
3124 3124
3125 pci_set_power_state(pci, PCI_D3hot);
3126 pci_disable_device(pci); 3125 pci_disable_device(pci);
3127 pci_save_state(pci); 3126 pci_save_state(pci);
3127 pci_set_power_state(pci, pci_choose_state(pci, state));
3128 return 0; 3128 return 0;
3129} 3129}
3130 3130
@@ -3134,9 +3134,14 @@ static int snd_cmipci_resume(struct pci_dev *pci)
3134 struct cmipci *cm = card->private_data; 3134 struct cmipci *cm = card->private_data;
3135 int i; 3135 int i;
3136 3136
3137 pci_restore_state(pci);
3138 pci_enable_device(pci);
3139 pci_set_power_state(pci, PCI_D0); 3137 pci_set_power_state(pci, PCI_D0);
3138 pci_restore_state(pci);
3139 if (pci_enable_device(pci) < 0) {
3140 printk(KERN_ERR "cmipci: pci_enable_device failed, "
3141 "disabling device\n");
3142 snd_card_disconnect(card);
3143 return -EIO;
3144 }
3140 pci_set_master(pci); 3145 pci_set_master(pci);
3141 3146
3142 /* reset / initialize to a sane state */ 3147 /* reset / initialize to a sane state */
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c
index d54924e60bb1..0905fa88129d 100644
--- a/sound/pci/cs4281.c
+++ b/sound/pci/cs4281.c
@@ -2050,6 +2050,7 @@ static int cs4281_suspend(struct pci_dev *pci, pm_message_t state)
2050 2050
2051 pci_disable_device(pci); 2051 pci_disable_device(pci);
2052 pci_save_state(pci); 2052 pci_save_state(pci);
2053 pci_set_power_state(pci, pci_choose_state(pci, state));
2053 return 0; 2054 return 0;
2054} 2055}
2055 2056
@@ -2060,8 +2061,14 @@ static int cs4281_resume(struct pci_dev *pci)
2060 unsigned int i; 2061 unsigned int i;
2061 u32 ulCLK; 2062 u32 ulCLK;
2062 2063
2064 pci_set_power_state(pci, PCI_D0);
2063 pci_restore_state(pci); 2065 pci_restore_state(pci);
2064 pci_enable_device(pci); 2066 if (pci_enable_device(pci) < 0) {
2067 printk(KERN_ERR "cs4281: pci_enable_device failed, "
2068 "disabling device\n");
2069 snd_card_disconnect(card);
2070 return -EIO;
2071 }
2065 pci_set_master(pci); 2072 pci_set_master(pci);
2066 2073
2067 ulCLK = snd_cs4281_peekBA0(chip, BA0_CLKCR1); 2074 ulCLK = snd_cs4281_peekBA0(chip, BA0_CLKCR1);
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c
index 16d4ebf2a33f..2807b9756ef0 100644
--- a/sound/pci/cs46xx/cs46xx_lib.c
+++ b/sound/pci/cs46xx/cs46xx_lib.c
@@ -3687,8 +3687,10 @@ int snd_cs46xx_suspend(struct pci_dev *pci, pm_message_t state)
3687 /* disable CLKRUN */ 3687 /* disable CLKRUN */
3688 chip->active_ctrl(chip, -chip->amplifier); 3688 chip->active_ctrl(chip, -chip->amplifier);
3689 chip->amplifier = amp_saved; /* restore the status */ 3689 chip->amplifier = amp_saved; /* restore the status */
3690
3690 pci_disable_device(pci); 3691 pci_disable_device(pci);
3691 pci_save_state(pci); 3692 pci_save_state(pci);
3693 pci_set_power_state(pci, pci_choose_state(pci, state));
3692 return 0; 3694 return 0;
3693} 3695}
3694 3696
@@ -3698,9 +3700,16 @@ int snd_cs46xx_resume(struct pci_dev *pci)
3698 struct snd_cs46xx *chip = card->private_data; 3700 struct snd_cs46xx *chip = card->private_data;
3699 int amp_saved; 3701 int amp_saved;
3700 3702
3703 pci_set_power_state(pci, PCI_D0);
3701 pci_restore_state(pci); 3704 pci_restore_state(pci);
3702 pci_enable_device(pci); 3705 if (pci_enable_device(pci) < 0) {
3706 printk(KERN_ERR "cs46xx: pci_enable_device failed, "
3707 "disabling device\n");
3708 snd_card_disconnect(card);
3709 return -EIO;
3710 }
3703 pci_set_master(pci); 3711 pci_set_master(pci);
3712
3704 amp_saved = chip->amplifier; 3713 amp_saved = chip->amplifier;
3705 chip->amplifier = 0; 3714 chip->amplifier = 0;
3706 chip->active_ctrl(chip, 1); /* force to on */ 3715 chip->active_ctrl(chip, 1); /* force to on */
diff --git a/sound/pci/cs5535audio/cs5535audio_pm.c b/sound/pci/cs5535audio/cs5535audio_pm.c
index aad0e69db9c1..3e4d198a4502 100644
--- a/sound/pci/cs5535audio/cs5535audio_pm.c
+++ b/sound/pci/cs5535audio/cs5535audio_pm.c
@@ -73,9 +73,10 @@ int snd_cs5535audio_suspend(struct pci_dev *pci, pm_message_t state)
73 snd_ac97_suspend(cs5535au->ac97); 73 snd_ac97_suspend(cs5535au->ac97);
74 /* save important regs, then disable aclink in hw */ 74 /* save important regs, then disable aclink in hw */
75 snd_cs5535audio_stop_hardware(cs5535au); 75 snd_cs5535audio_stop_hardware(cs5535au);
76
76 pci_disable_device(pci); 77 pci_disable_device(pci);
77 pci_save_state(pci); 78 pci_save_state(pci);
78 79 pci_set_power_state(pci, pci_choose_state(pci, state));
79 return 0; 80 return 0;
80} 81}
81 82
@@ -87,8 +88,14 @@ int snd_cs5535audio_resume(struct pci_dev *pci)
87 int timeout; 88 int timeout;
88 int i; 89 int i;
89 90
91 pci_set_power_state(pci, PCI_D0);
90 pci_restore_state(pci); 92 pci_restore_state(pci);
91 pci_enable_device(pci); 93 if (pci_enable_device(pci) < 0) {
94 printk(KERN_ERR "cs5535audio: pci_enable_device failed, "
95 "disabling device\n");
96 snd_card_disconnect(card);
97 return -EIO;
98 }
92 pci_set_master(pci); 99 pci_set_master(pci);
93 100
94 /* set LNK_WRM_RST to reset AC link */ 101 /* set LNK_WRM_RST to reset AC link */
diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c
index 493ec0816bb3..55caf341933a 100644
--- a/sound/pci/emu10k1/emu10k1.c
+++ b/sound/pci/emu10k1/emu10k1.c
@@ -226,9 +226,9 @@ static int snd_emu10k1_suspend(struct pci_dev *pci, pm_message_t state)
226 226
227 snd_emu10k1_done(emu); 227 snd_emu10k1_done(emu);
228 228
229 pci_set_power_state(pci, PCI_D3hot);
230 pci_disable_device(pci); 229 pci_disable_device(pci);
231 pci_save_state(pci); 230 pci_save_state(pci);
231 pci_set_power_state(pci, pci_choose_state(pci, state));
232 return 0; 232 return 0;
233} 233}
234 234
@@ -237,11 +237,16 @@ static int snd_emu10k1_resume(struct pci_dev *pci)
237 struct snd_card *card = pci_get_drvdata(pci); 237 struct snd_card *card = pci_get_drvdata(pci);
238 struct snd_emu10k1 *emu = card->private_data; 238 struct snd_emu10k1 *emu = card->private_data;
239 239
240 pci_restore_state(pci);
241 pci_enable_device(pci);
242 pci_set_power_state(pci, PCI_D0); 240 pci_set_power_state(pci, PCI_D0);
241 pci_restore_state(pci);
242 if (pci_enable_device(pci) < 0) {
243 printk(KERN_ERR "emu10k1: pci_enable_device failed, "
244 "disabling device\n");
245 snd_card_disconnect(card);
246 return -EIO;
247 }
243 pci_set_master(pci); 248 pci_set_master(pci);
244 249
245 snd_emu10k1_resume_init(emu); 250 snd_emu10k1_resume_init(emu);
246 snd_emu10k1_efx_resume(emu); 251 snd_emu10k1_efx_resume(emu);
247 snd_ac97_resume(emu->ac97); 252 snd_ac97_resume(emu->ac97);
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index 8cb4fb2412db..d2a811f222c9 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -2072,9 +2072,10 @@ static int snd_ensoniq_suspend(struct pci_dev *pci, pm_message_t state)
2072 udelay(100); 2072 udelay(100);
2073 snd_ak4531_suspend(ensoniq->u.es1370.ak4531); 2073 snd_ak4531_suspend(ensoniq->u.es1370.ak4531);
2074#endif 2074#endif
2075 pci_set_power_state(pci, PCI_D3hot); 2075
2076 pci_disable_device(pci); 2076 pci_disable_device(pci);
2077 pci_save_state(pci); 2077 pci_save_state(pci);
2078 pci_set_power_state(pci, pci_choose_state(pci, state));
2078 return 0; 2079 return 0;
2079} 2080}
2080 2081
@@ -2083,9 +2084,14 @@ static int snd_ensoniq_resume(struct pci_dev *pci)
2083 struct snd_card *card = pci_get_drvdata(pci); 2084 struct snd_card *card = pci_get_drvdata(pci);
2084 struct ensoniq *ensoniq = card->private_data; 2085 struct ensoniq *ensoniq = card->private_data;
2085 2086
2086 pci_restore_state(pci);
2087 pci_enable_device(pci);
2088 pci_set_power_state(pci, PCI_D0); 2087 pci_set_power_state(pci, PCI_D0);
2088 pci_restore_state(pci);
2089 if (pci_enable_device(pci) < 0) {
2090 printk(KERN_ERR DRIVER_NAME ": pci_enable_device failed, "
2091 "disabling device\n");
2092 snd_card_disconnect(card);
2093 return -EIO;
2094 }
2089 pci_set_master(pci); 2095 pci_set_master(pci);
2090 2096
2091 snd_ensoniq_chip_init(ensoniq); 2097 snd_ensoniq_chip_init(ensoniq);
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c
index 2da988f78ba7..1a8d36df4b5d 100644
--- a/sound/pci/es1938.c
+++ b/sound/pci/es1938.c
@@ -1481,10 +1481,14 @@ static int es1938_suspend(struct pci_dev *pci, pm_message_t state)
1481 *d = snd_es1938_reg_read(chip, *s); 1481 *d = snd_es1938_reg_read(chip, *s);
1482 1482
1483 outb(0x00, SLIO_REG(chip, IRQCONTROL)); /* disable irqs */ 1483 outb(0x00, SLIO_REG(chip, IRQCONTROL)); /* disable irqs */
1484 if (chip->irq >= 0) 1484 if (chip->irq >= 0) {
1485 synchronize_irq(chip->irq);
1485 free_irq(chip->irq, chip); 1486 free_irq(chip->irq, chip);
1487 chip->irq = -1;
1488 }
1486 pci_disable_device(pci); 1489 pci_disable_device(pci);
1487 pci_save_state(pci); 1490 pci_save_state(pci);
1491 pci_set_power_state(pci, pci_choose_state(pci, state));
1488 return 0; 1492 return 0;
1489} 1493}
1490 1494
@@ -1494,10 +1498,22 @@ static int es1938_resume(struct pci_dev *pci)
1494 struct es1938 *chip = card->private_data; 1498 struct es1938 *chip = card->private_data;
1495 unsigned char *s, *d; 1499 unsigned char *s, *d;
1496 1500
1501 pci_set_power_state(pci, PCI_D0);
1497 pci_restore_state(pci); 1502 pci_restore_state(pci);
1498 pci_enable_device(pci); 1503 if (pci_enable_device(pci) < 0) {
1499 request_irq(pci->irq, snd_es1938_interrupt, 1504 printk(KERN_ERR "es1938: pci_enable_device failed, "
1500 IRQF_DISABLED|IRQF_SHARED, "ES1938", chip); 1505 "disabling device\n");
1506 snd_card_disconnect(card);
1507 return -EIO;
1508 }
1509
1510 if (request_irq(pci->irq, snd_es1938_interrupt,
1511 IRQF_DISABLED|IRQF_SHARED, "ES1938", chip)) {
1512 printk(KERN_ERR "es1938: unable to grab IRQ %d, "
1513 "disabling device\n", pci->irq);
1514 snd_card_disconnect(card);
1515 return -EIO;
1516 }
1501 chip->irq = pci->irq; 1517 chip->irq = pci->irq;
1502 snd_es1938_chip_init(chip); 1518 snd_es1938_chip_init(chip);
1503 1519
@@ -1556,8 +1572,10 @@ static int snd_es1938_free(struct es1938 *chip)
1556 1572
1557 snd_es1938_free_gameport(chip); 1573 snd_es1938_free_gameport(chip);
1558 1574
1559 if (chip->irq >= 0) 1575 if (chip->irq >= 0) {
1576 synchronize_irq(chip->irq);
1560 free_irq(chip->irq, chip); 1577 free_irq(chip->irq, chip);
1578 }
1561 pci_release_regions(chip->pci); 1579 pci_release_regions(chip->pci);
1562 pci_disable_device(chip->pci); 1580 pci_disable_device(chip->pci);
1563 kfree(chip); 1581 kfree(chip);
@@ -1602,6 +1620,7 @@ static int __devinit snd_es1938_create(struct snd_card *card,
1602 spin_lock_init(&chip->mixer_lock); 1620 spin_lock_init(&chip->mixer_lock);
1603 chip->card = card; 1621 chip->card = card;
1604 chip->pci = pci; 1622 chip->pci = pci;
1623 chip->irq = -1;
1605 if ((err = pci_request_regions(pci, "ESS Solo-1")) < 0) { 1624 if ((err = pci_request_regions(pci, "ESS Solo-1")) < 0) {
1606 kfree(chip); 1625 kfree(chip);
1607 pci_disable_device(pci); 1626 pci_disable_device(pci);
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index b9d723c7e1db..092da53e1464 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -432,46 +432,6 @@ MODULE_PARM_DESC(joystick, "Enable joystick.");
432#define ESM_MODE_PLAY 0 432#define ESM_MODE_PLAY 0
433#define ESM_MODE_CAPTURE 1 433#define ESM_MODE_CAPTURE 1
434 434
435/* acpi states */
436enum {
437 ACPI_D0=0,
438 ACPI_D1,
439 ACPI_D2,
440 ACPI_D3
441};
442
443/* bits in the acpi masks */
444#define ACPI_12MHZ ( 1 << 15)
445#define ACPI_24MHZ ( 1 << 14)
446#define ACPI_978 ( 1 << 13)
447#define ACPI_SPDIF ( 1 << 12)
448#define ACPI_GLUE ( 1 << 11)
449#define ACPI__10 ( 1 << 10) /* reserved */
450#define ACPI_PCIINT ( 1 << 9)
451#define ACPI_HV ( 1 << 8) /* hardware volume */
452#define ACPI_GPIO ( 1 << 7)
453#define ACPI_ASSP ( 1 << 6)
454#define ACPI_SB ( 1 << 5) /* sb emul */
455#define ACPI_FM ( 1 << 4) /* fm emul */
456#define ACPI_RB ( 1 << 3) /* ringbus / aclink */
457#define ACPI_MIDI ( 1 << 2)
458#define ACPI_GP ( 1 << 1) /* game port */
459#define ACPI_WP ( 1 << 0) /* wave processor */
460
461#define ACPI_ALL (0xffff)
462#define ACPI_SLEEP (~(ACPI_SPDIF|ACPI_ASSP|ACPI_SB|ACPI_FM| \
463 ACPI_MIDI|ACPI_GP|ACPI_WP))
464#define ACPI_NONE (ACPI__10)
465
466/* these masks indicate which units we care about at
467 which states */
468static u16 acpi_state_mask[] = {
469 [ACPI_D0] = ACPI_ALL,
470 [ACPI_D1] = ACPI_SLEEP,
471 [ACPI_D2] = ACPI_SLEEP,
472 [ACPI_D3] = ACPI_NONE
473};
474
475 435
476/* APU use in the driver */ 436/* APU use in the driver */
477enum snd_enum_apu_type { 437enum snd_enum_apu_type {
@@ -2160,21 +2120,6 @@ static void snd_es1968_reset(struct es1968 *chip)
2160} 2120}
2161 2121
2162/* 2122/*
2163 * power management
2164 */
2165static void snd_es1968_set_acpi(struct es1968 *chip, int state)
2166{
2167 u16 active_mask = acpi_state_mask[state];
2168
2169 pci_set_power_state(chip->pci, state);
2170 /* make sure the units we care about are on
2171 XXX we might want to do this before state flipping? */
2172 pci_write_config_word(chip->pci, 0x54, ~ active_mask);
2173 pci_write_config_word(chip->pci, 0x56, ~ active_mask);
2174}
2175
2176
2177/*
2178 * initialize maestro chip 2123 * initialize maestro chip
2179 */ 2124 */
2180static void snd_es1968_chip_init(struct es1968 *chip) 2125static void snd_es1968_chip_init(struct es1968 *chip)
@@ -2196,9 +2141,6 @@ static void snd_es1968_chip_init(struct es1968 *chip)
2196 * IRQs. 2141 * IRQs.
2197 */ 2142 */
2198 2143
2199 /* do config work at full power */
2200 snd_es1968_set_acpi(chip, ACPI_D0);
2201
2202 /* Config Reg A */ 2144 /* Config Reg A */
2203 pci_read_config_word(pci, ESM_CONFIG_A, &w); 2145 pci_read_config_word(pci, ESM_CONFIG_A, &w);
2204 2146
@@ -2397,9 +2339,10 @@ static int es1968_suspend(struct pci_dev *pci, pm_message_t state)
2397 snd_pcm_suspend_all(chip->pcm); 2339 snd_pcm_suspend_all(chip->pcm);
2398 snd_ac97_suspend(chip->ac97); 2340 snd_ac97_suspend(chip->ac97);
2399 snd_es1968_bob_stop(chip); 2341 snd_es1968_bob_stop(chip);
2400 snd_es1968_set_acpi(chip, ACPI_D3); 2342
2401 pci_disable_device(pci); 2343 pci_disable_device(pci);
2402 pci_save_state(pci); 2344 pci_save_state(pci);
2345 pci_set_power_state(pci, pci_choose_state(pci, state));
2403 return 0; 2346 return 0;
2404} 2347}
2405 2348
@@ -2413,9 +2356,16 @@ static int es1968_resume(struct pci_dev *pci)
2413 return 0; 2356 return 0;
2414 2357
2415 /* restore all our config */ 2358 /* restore all our config */
2359 pci_set_power_state(pci, PCI_D0);
2416 pci_restore_state(pci); 2360 pci_restore_state(pci);
2417 pci_enable_device(pci); 2361 if (pci_enable_device(pci) < 0) {
2362 printk(KERN_ERR "es1968: pci_enable_device failed, "
2363 "disabling device\n");
2364 snd_card_disconnect(card);
2365 return -EIO;
2366 }
2418 pci_set_master(pci); 2367 pci_set_master(pci);
2368
2419 snd_es1968_chip_init(chip); 2369 snd_es1968_chip_init(chip);
2420 2370
2421 /* need to restore the base pointers.. */ 2371 /* need to restore the base pointers.. */
@@ -2514,7 +2464,6 @@ static int snd_es1968_free(struct es1968 *chip)
2514 if (chip->irq >= 0) 2464 if (chip->irq >= 0)
2515 free_irq(chip->irq, (void *)chip); 2465 free_irq(chip->irq, (void *)chip);
2516 snd_es1968_free_gameport(chip); 2466 snd_es1968_free_gameport(chip);
2517 snd_es1968_set_acpi(chip, ACPI_D3);
2518 chip->master_switch = NULL; 2467 chip->master_switch = NULL;
2519 chip->master_volume = NULL; 2468 chip->master_volume = NULL;
2520 pci_release_regions(chip->pci); 2469 pci_release_regions(chip->pci);
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c
index 3ec7d7ee04dd..77e3d5c18302 100644
--- a/sound/pci/fm801.c
+++ b/sound/pci/fm801.c
@@ -1531,9 +1531,9 @@ static int snd_fm801_suspend(struct pci_dev *pci, pm_message_t state)
1531 chip->saved_regs[i] = inw(chip->port + saved_regs[i]); 1531 chip->saved_regs[i] = inw(chip->port + saved_regs[i]);
1532 /* FIXME: tea575x suspend */ 1532 /* FIXME: tea575x suspend */
1533 1533
1534 pci_set_power_state(pci, PCI_D3hot);
1535 pci_disable_device(pci); 1534 pci_disable_device(pci);
1536 pci_save_state(pci); 1535 pci_save_state(pci);
1536 pci_set_power_state(pci, pci_choose_state(pci, state));
1537 return 0; 1537 return 0;
1538} 1538}
1539 1539
@@ -1543,9 +1543,14 @@ static int snd_fm801_resume(struct pci_dev *pci)
1543 struct fm801 *chip = card->private_data; 1543 struct fm801 *chip = card->private_data;
1544 int i; 1544 int i;
1545 1545
1546 pci_restore_state(pci);
1547 pci_enable_device(pci);
1548 pci_set_power_state(pci, PCI_D0); 1546 pci_set_power_state(pci, PCI_D0);
1547 pci_restore_state(pci);
1548 if (pci_enable_device(pci) < 0) {
1549 printk(KERN_ERR "fm801: pci_enable_device failed, "
1550 "disabling device\n");
1551 snd_card_disconnect(card);
1552 return -EIO;
1553 }
1549 pci_set_master(pci); 1554 pci_set_master(pci);
1550 1555
1551 snd_fm801_chip_init(chip, 1); 1556 snd_fm801_chip_init(chip, 1);
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index feeed12920b4..0e292dc4fd87 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -86,6 +86,7 @@ MODULE_SUPPORTED_DEVICE("{{Intel, ICH6},"
86 "{ATI, SB450}," 86 "{ATI, SB450},"
87 "{ATI, SB600}," 87 "{ATI, SB600},"
88 "{ATI, RS600}," 88 "{ATI, RS600},"
89 "{ATI, RS690},"
89 "{VIA, VT8251}," 90 "{VIA, VT8251},"
90 "{VIA, VT8237A}," 91 "{VIA, VT8237A},"
91 "{SiS, SIS966}," 92 "{SiS, SIS966},"
@@ -336,6 +337,7 @@ struct azx {
336 unsigned int initialized :1; 337 unsigned int initialized :1;
337 unsigned int single_cmd :1; 338 unsigned int single_cmd :1;
338 unsigned int polling_mode :1; 339 unsigned int polling_mode :1;
340 unsigned int msi :1;
339}; 341};
340 342
341/* driver types */ 343/* driver types */
@@ -396,6 +398,7 @@ static char *driver_short_names[] __devinitdata = {
396 */ 398 */
397#define upper_32bit(addr) (sizeof(addr) > 4 ? (u32)((addr) >> 32) : (u32)0) 399#define upper_32bit(addr) (sizeof(addr) > 4 ? (u32)((addr) >> 32) : (u32)0)
398 400
401static int azx_acquire_irq(struct azx *chip, int do_disconnect);
399 402
400/* 403/*
401 * Interface for HD codec 404 * Interface for HD codec
@@ -535,6 +538,18 @@ static unsigned int azx_rirb_get_response(struct hda_codec *codec)
535 schedule_timeout_interruptible(1); 538 schedule_timeout_interruptible(1);
536 } while (time_after_eq(timeout, jiffies)); 539 } while (time_after_eq(timeout, jiffies));
537 540
541 if (chip->msi) {
542 snd_printk(KERN_WARNING "hda_intel: No response from codec, "
543 "disabling MSI...\n");
544 free_irq(chip->irq, chip);
545 chip->irq = -1;
546 pci_disable_msi(chip->pci);
547 chip->msi = 0;
548 if (azx_acquire_irq(chip, 1) < 0)
549 return -1;
550 goto again;
551 }
552
538 if (!chip->polling_mode) { 553 if (!chip->polling_mode) {
539 snd_printk(KERN_WARNING "hda_intel: azx_get_response timeout, " 554 snd_printk(KERN_WARNING "hda_intel: azx_get_response timeout, "
540 "switching to polling mode...\n"); 555 "switching to polling mode...\n");
@@ -1363,6 +1378,20 @@ static int __devinit azx_init_stream(struct azx *chip)
1363 return 0; 1378 return 0;
1364} 1379}
1365 1380
1381static int azx_acquire_irq(struct azx *chip, int do_disconnect)
1382{
1383 if (request_irq(chip->pci->irq, azx_interrupt, IRQF_DISABLED|IRQF_SHARED,
1384 "HDA Intel", chip)) {
1385 printk(KERN_ERR "hda-intel: unable to grab IRQ %d, "
1386 "disabling device\n", chip->pci->irq);
1387 if (do_disconnect)
1388 snd_card_disconnect(chip->card);
1389 return -1;
1390 }
1391 chip->irq = chip->pci->irq;
1392 return 0;
1393}
1394
1366 1395
1367#ifdef CONFIG_PM 1396#ifdef CONFIG_PM
1368/* 1397/*
@@ -1379,12 +1408,16 @@ static int azx_suspend(struct pci_dev *pci, pm_message_t state)
1379 snd_pcm_suspend_all(chip->pcm[i]); 1408 snd_pcm_suspend_all(chip->pcm[i]);
1380 snd_hda_suspend(chip->bus, state); 1409 snd_hda_suspend(chip->bus, state);
1381 azx_free_cmd_io(chip); 1410 azx_free_cmd_io(chip);
1382 if (chip->irq >= 0) 1411 if (chip->irq >= 0) {
1412 synchronize_irq(chip->irq);
1383 free_irq(chip->irq, chip); 1413 free_irq(chip->irq, chip);
1384 if (!disable_msi) 1414 chip->irq = -1;
1415 }
1416 if (chip->msi)
1385 pci_disable_msi(chip->pci); 1417 pci_disable_msi(chip->pci);
1386 pci_disable_device(pci); 1418 pci_disable_device(pci);
1387 pci_save_state(pci); 1419 pci_save_state(pci);
1420 pci_set_power_state(pci, pci_choose_state(pci, state));
1388 return 0; 1421 return 0;
1389} 1422}
1390 1423
@@ -1393,15 +1426,20 @@ static int azx_resume(struct pci_dev *pci)
1393 struct snd_card *card = pci_get_drvdata(pci); 1426 struct snd_card *card = pci_get_drvdata(pci);
1394 struct azx *chip = card->private_data; 1427 struct azx *chip = card->private_data;
1395 1428
1429 pci_set_power_state(pci, PCI_D0);
1396 pci_restore_state(pci); 1430 pci_restore_state(pci);
1397 pci_enable_device(pci); 1431 if (pci_enable_device(pci) < 0) {
1398 if (!disable_msi) 1432 printk(KERN_ERR "hda-intel: pci_enable_device failed, "
1399 pci_enable_msi(pci); 1433 "disabling device\n");
1400 /* FIXME: need proper error handling */ 1434 snd_card_disconnect(card);
1401 request_irq(pci->irq, azx_interrupt, IRQF_DISABLED|IRQF_SHARED, 1435 return -EIO;
1402 "HDA Intel", chip); 1436 }
1403 chip->irq = pci->irq;
1404 pci_set_master(pci); 1437 pci_set_master(pci);
1438 if (chip->msi)
1439 if (pci_enable_msi(pci) < 0)
1440 chip->msi = 0;
1441 if (azx_acquire_irq(chip, 1) < 0)
1442 return -EIO;
1405 azx_init_chip(chip); 1443 azx_init_chip(chip);
1406 snd_hda_resume(chip->bus); 1444 snd_hda_resume(chip->bus);
1407 snd_power_change_state(card, SNDRV_CTL_POWER_D0); 1445 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
@@ -1431,15 +1469,14 @@ static int azx_free(struct azx *chip)
1431 /* disable position buffer */ 1469 /* disable position buffer */
1432 azx_writel(chip, DPLBASE, 0); 1470 azx_writel(chip, DPLBASE, 0);
1433 azx_writel(chip, DPUBASE, 0); 1471 azx_writel(chip, DPUBASE, 0);
1434
1435 synchronize_irq(chip->irq);
1436 } 1472 }
1437 1473
1438 if (chip->irq >= 0) { 1474 if (chip->irq >= 0) {
1475 synchronize_irq(chip->irq);
1439 free_irq(chip->irq, (void*)chip); 1476 free_irq(chip->irq, (void*)chip);
1440 if (!disable_msi)
1441 pci_disable_msi(chip->pci);
1442 } 1477 }
1478 if (chip->msi)
1479 pci_disable_msi(chip->pci);
1443 if (chip->remap_addr) 1480 if (chip->remap_addr)
1444 iounmap(chip->remap_addr); 1481 iounmap(chip->remap_addr);
1445 1482
@@ -1494,6 +1531,7 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
1494 chip->pci = pci; 1531 chip->pci = pci;
1495 chip->irq = -1; 1532 chip->irq = -1;
1496 chip->driver_type = driver_type; 1533 chip->driver_type = driver_type;
1534 chip->msi = !disable_msi;
1497 1535
1498 chip->position_fix = position_fix; 1536 chip->position_fix = position_fix;
1499 chip->single_cmd = single_cmd; 1537 chip->single_cmd = single_cmd;
@@ -1523,16 +1561,14 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
1523 goto errout; 1561 goto errout;
1524 } 1562 }
1525 1563
1526 if (!disable_msi) 1564 if (chip->msi)
1527 pci_enable_msi(pci); 1565 if (pci_enable_msi(pci) < 0)
1566 chip->msi = 0;
1528 1567
1529 if (request_irq(pci->irq, azx_interrupt, IRQF_DISABLED|IRQF_SHARED, 1568 if (azx_acquire_irq(chip, 0) < 0) {
1530 "HDA Intel", (void*)chip)) {
1531 snd_printk(KERN_ERR SFX "unable to grab IRQ %d\n", pci->irq);
1532 err = -EBUSY; 1569 err = -EBUSY;
1533 goto errout; 1570 goto errout;
1534 } 1571 }
1535 chip->irq = pci->irq;
1536 1572
1537 pci_set_master(pci); 1573 pci_set_master(pci);
1538 synchronize_irq(chip->irq); 1574 synchronize_irq(chip->irq);
@@ -1677,6 +1713,7 @@ static struct pci_device_id azx_ids[] = {
1677 { 0x1002, 0x437b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATI }, /* ATI SB450 */ 1713 { 0x1002, 0x437b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATI }, /* ATI SB450 */
1678 { 0x1002, 0x4383, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATI }, /* ATI SB600 */ 1714 { 0x1002, 0x4383, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATI }, /* ATI SB600 */
1679 { 0x1002, 0x793b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATIHDMI }, /* ATI RS600 HDMI */ 1715 { 0x1002, 0x793b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATIHDMI }, /* ATI RS600 HDMI */
1716 { 0x1002, 0x7919, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATIHDMI }, /* ATI RS690 HDMI */
1680 { 0x1106, 0x3288, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_VIA }, /* VIA VT8251/VT8237A */ 1717 { 0x1106, 0x3288, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_VIA }, /* VIA VT8251/VT8237A */
1681 { 0x1039, 0x7502, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_SIS }, /* SIS966 */ 1718 { 0x1039, 0x7502, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_SIS }, /* SIS966 */
1682 { 0x10b9, 0x5461, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ULI }, /* ULI M5461 */ 1719 { 0x10b9, 0x5461, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ULI }, /* ULI M5461 */
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 511df07fa2a3..edd22dec8286 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -818,6 +818,8 @@ static struct hda_board_config ad1986a_cfg_tbl[] = {
818 .config = AD1986A_LAPTOP_EAPD }, /* ASUS A6J */ 818 .config = AD1986A_LAPTOP_EAPD }, /* ASUS A6J */
819 { .pci_subvendor = 0x1043, .pci_subdevice = 0x11f7, 819 { .pci_subvendor = 0x1043, .pci_subdevice = 0x11f7,
820 .config = AD1986A_LAPTOP_EAPD }, /* ASUS U5A */ 820 .config = AD1986A_LAPTOP_EAPD }, /* ASUS U5A */
821 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1263,
822 .config = AD1986A_LAPTOP_EAPD }, /* ASUS U5F */
821 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1297, 823 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1297,
822 .config = AD1986A_LAPTOP_EAPD }, /* ASUS Z62F */ 824 .config = AD1986A_LAPTOP_EAPD }, /* ASUS Z62F */
823 { .pci_subvendor = 0x103c, .pci_subdevice = 0x30af, 825 { .pci_subvendor = 0x103c, .pci_subdevice = 0x30af,
diff --git a/sound/pci/hda/patch_atihdmi.c b/sound/pci/hda/patch_atihdmi.c
index a27440ffd1c8..7333f275decd 100644
--- a/sound/pci/hda/patch_atihdmi.c
+++ b/sound/pci/hda/patch_atihdmi.c
@@ -161,5 +161,6 @@ static int patch_atihdmi(struct hda_codec *codec)
161 */ 161 */
162struct hda_codec_preset snd_hda_preset_atihdmi[] = { 162struct hda_codec_preset snd_hda_preset_atihdmi[] = {
163 { .id = 0x1002793c, .name = "ATI RS600 HDMI", .patch = patch_atihdmi }, 163 { .id = 0x1002793c, .name = "ATI RS600 HDMI", .patch = patch_atihdmi },
164 { .id = 0x1002791a, .name = "ATI RS690 HDMI", .patch = patch_atihdmi },
164 {} /* terminator */ 165 {} /* terminator */
165}; 166};
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 84a3eb8aacc2..0d728c6f697c 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1799,7 +1799,7 @@ static int alc_build_pcms(struct hda_codec *codec)
1799 /* SPDIF for stream index #1 */ 1799 /* SPDIF for stream index #1 */
1800 if (spec->multiout.dig_out_nid || spec->dig_in_nid) { 1800 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
1801 codec->num_pcms = 2; 1801 codec->num_pcms = 2;
1802 info++; 1802 info = spec->pcm_rec + 1;
1803 info->name = spec->stream_name_digital; 1803 info->name = spec->stream_name_digital;
1804 if (spec->multiout.dig_out_nid && 1804 if (spec->multiout.dig_out_nid &&
1805 spec->stream_digital_playback) { 1805 spec->stream_digital_playback) {
@@ -1820,7 +1820,7 @@ static int alc_build_pcms(struct hda_codec *codec)
1820 if (spec->num_adc_nids > 1 && spec->stream_analog_capture && 1820 if (spec->num_adc_nids > 1 && spec->stream_analog_capture &&
1821 spec->adc_nids) { 1821 spec->adc_nids) {
1822 codec->num_pcms = 3; 1822 codec->num_pcms = 3;
1823 info++; 1823 info = spec->pcm_rec + 2;
1824 info->name = spec->stream_name_analog; 1824 info->name = spec->stream_name_analog;
1825 /* No playback stream for second PCM */ 1825 /* No playback stream for second PCM */
1826 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = alc_pcm_null_playback; 1826 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = alc_pcm_null_playback;
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index f4319b8d4644..7f22dab07240 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -2476,10 +2476,14 @@ static int intel8x0_suspend(struct pci_dev *pci, pm_message_t state)
2476 if (chip->device_type == DEVICE_INTEL_ICH4) 2476 if (chip->device_type == DEVICE_INTEL_ICH4)
2477 chip->sdm_saved = igetbyte(chip, ICHREG(SDM)); 2477 chip->sdm_saved = igetbyte(chip, ICHREG(SDM));
2478 2478
2479 if (chip->irq >= 0) 2479 if (chip->irq >= 0) {
2480 synchronize_irq(chip->irq);
2480 free_irq(chip->irq, chip); 2481 free_irq(chip->irq, chip);
2482 chip->irq = -1;
2483 }
2481 pci_disable_device(pci); 2484 pci_disable_device(pci);
2482 pci_save_state(pci); 2485 pci_save_state(pci);
2486 pci_set_power_state(pci, pci_choose_state(pci, state));
2483 return 0; 2487 return 0;
2484} 2488}
2485 2489
@@ -2489,11 +2493,22 @@ static int intel8x0_resume(struct pci_dev *pci)
2489 struct intel8x0 *chip = card->private_data; 2493 struct intel8x0 *chip = card->private_data;
2490 int i; 2494 int i;
2491 2495
2496 pci_set_power_state(pci, PCI_D0);
2492 pci_restore_state(pci); 2497 pci_restore_state(pci);
2493 pci_enable_device(pci); 2498 if (pci_enable_device(pci) < 0) {
2499 printk(KERN_ERR "intel8x0: pci_enable_device failed, "
2500 "disabling device\n");
2501 snd_card_disconnect(card);
2502 return -EIO;
2503 }
2494 pci_set_master(pci); 2504 pci_set_master(pci);
2495 request_irq(pci->irq, snd_intel8x0_interrupt, IRQF_DISABLED|IRQF_SHARED, 2505 if (request_irq(pci->irq, snd_intel8x0_interrupt,
2496 card->shortname, chip); 2506 IRQF_DISABLED|IRQF_SHARED, card->shortname, chip)) {
2507 printk(KERN_ERR "intel8x0: unable to grab IRQ %d, "
2508 "disabling device\n", pci->irq);
2509 snd_card_disconnect(card);
2510 return -EIO;
2511 }
2497 chip->irq = pci->irq; 2512 chip->irq = pci->irq;
2498 synchronize_irq(chip->irq); 2513 synchronize_irq(chip->irq);
2499 snd_intel8x0_chip_init(chip, 0); 2514 snd_intel8x0_chip_init(chip, 0);
diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c
index 6703f5cb5569..bd467c501123 100644
--- a/sound/pci/intel8x0m.c
+++ b/sound/pci/intel8x0m.c
@@ -1045,10 +1045,14 @@ static int intel8x0m_suspend(struct pci_dev *pci, pm_message_t state)
1045 for (i = 0; i < chip->pcm_devs; i++) 1045 for (i = 0; i < chip->pcm_devs; i++)
1046 snd_pcm_suspend_all(chip->pcm[i]); 1046 snd_pcm_suspend_all(chip->pcm[i]);
1047 snd_ac97_suspend(chip->ac97); 1047 snd_ac97_suspend(chip->ac97);
1048 if (chip->irq >= 0) 1048 if (chip->irq >= 0) {
1049 synchronize_irq(chip->irq);
1049 free_irq(chip->irq, chip); 1050 free_irq(chip->irq, chip);
1051 chip->irq = -1;
1052 }
1050 pci_disable_device(pci); 1053 pci_disable_device(pci);
1051 pci_save_state(pci); 1054 pci_save_state(pci);
1055 pci_set_power_state(pci, pci_choose_state(pci, state));
1052 return 0; 1056 return 0;
1053} 1057}
1054 1058
@@ -1057,11 +1061,22 @@ static int intel8x0m_resume(struct pci_dev *pci)
1057 struct snd_card *card = pci_get_drvdata(pci); 1061 struct snd_card *card = pci_get_drvdata(pci);
1058 struct intel8x0m *chip = card->private_data; 1062 struct intel8x0m *chip = card->private_data;
1059 1063
1064 pci_set_power_state(pci, PCI_D0);
1060 pci_restore_state(pci); 1065 pci_restore_state(pci);
1061 pci_enable_device(pci); 1066 if (pci_enable_device(pci) < 0) {
1067 printk(KERN_ERR "intel8x0m: pci_enable_device failed, "
1068 "disabling device\n");
1069 snd_card_disconnect(card);
1070 return -EIO;
1071 }
1062 pci_set_master(pci); 1072 pci_set_master(pci);
1063 request_irq(pci->irq, snd_intel8x0_interrupt, IRQF_DISABLED|IRQF_SHARED, 1073 if (request_irq(pci->irq, snd_intel8x0_interrupt,
1064 card->shortname, chip); 1074 IRQF_DISABLED|IRQF_SHARED, card->shortname, chip)) {
1075 printk(KERN_ERR "intel8x0m: unable to grab IRQ %d, "
1076 "disabling device\n", pci->irq);
1077 snd_card_disconnect(card);
1078 return -EIO;
1079 }
1065 chip->irq = pci->irq; 1080 chip->irq = pci->irq;
1066 snd_intel8x0_chip_init(chip, 0); 1081 snd_intel8x0_chip_init(chip, 0);
1067 snd_ac97_resume(chip->ac97); 1082 snd_ac97_resume(chip->ac97);
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
index 05605f474a72..8cab342bbaaf 100644
--- a/sound/pci/maestro3.c
+++ b/sound/pci/maestro3.c
@@ -2589,12 +2589,9 @@ static int m3_suspend(struct pci_dev *pci, pm_message_t state)
2589 chip->suspend_mem[index++] = 2589 chip->suspend_mem[index++] =
2590 snd_m3_assp_read(chip, MEMTYPE_INTERNAL_DATA, i); 2590 snd_m3_assp_read(chip, MEMTYPE_INTERNAL_DATA, i);
2591 2591
2592 /* power down apci registers */
2593 snd_m3_outw(chip, 0xffff, 0x54);
2594 snd_m3_outw(chip, 0xffff, 0x56);
2595
2596 pci_disable_device(pci); 2592 pci_disable_device(pci);
2597 pci_save_state(pci); 2593 pci_save_state(pci);
2594 pci_set_power_state(pci, pci_choose_state(pci, state));
2598 return 0; 2595 return 0;
2599} 2596}
2600 2597
@@ -2607,8 +2604,14 @@ static int m3_resume(struct pci_dev *pci)
2607 if (chip->suspend_mem == NULL) 2604 if (chip->suspend_mem == NULL)
2608 return 0; 2605 return 0;
2609 2606
2607 pci_set_power_state(pci, PCI_D0);
2610 pci_restore_state(pci); 2608 pci_restore_state(pci);
2611 pci_enable_device(pci); 2609 if (pci_enable_device(pci) < 0) {
2610 printk(KERN_ERR "maestor3: pci_enable_device failed, "
2611 "disabling device\n");
2612 snd_card_disconnect(card);
2613 return -EIO;
2614 }
2612 pci_set_master(pci); 2615 pci_set_master(pci);
2613 2616
2614 /* first lets just bring everything back. .*/ 2617 /* first lets just bring everything back. .*/
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c
index b1bbdb9e3b7b..945d21bf187e 100644
--- a/sound/pci/nm256/nm256.c
+++ b/sound/pci/nm256/nm256.c
@@ -1390,6 +1390,7 @@ static int nm256_suspend(struct pci_dev *pci, pm_message_t state)
1390 chip->coeffs_current = 0; 1390 chip->coeffs_current = 0;
1391 pci_disable_device(pci); 1391 pci_disable_device(pci);
1392 pci_save_state(pci); 1392 pci_save_state(pci);
1393 pci_set_power_state(pci, pci_choose_state(pci, state));
1393 return 0; 1394 return 0;
1394} 1395}
1395 1396
@@ -1401,8 +1402,17 @@ static int nm256_resume(struct pci_dev *pci)
1401 1402
1402 /* Perform a full reset on the hardware */ 1403 /* Perform a full reset on the hardware */
1403 chip->in_resume = 1; 1404 chip->in_resume = 1;
1405
1406 pci_set_power_state(pci, PCI_D0);
1404 pci_restore_state(pci); 1407 pci_restore_state(pci);
1405 pci_enable_device(pci); 1408 if (pci_enable_device(pci) < 0) {
1409 printk(KERN_ERR "nm256: pci_enable_device failed, "
1410 "disabling device\n");
1411 snd_card_disconnect(card);
1412 return -EIO;
1413 }
1414 pci_set_master(pci);
1415
1406 snd_nm256_init_chip(chip); 1416 snd_nm256_init_chip(chip);
1407 1417
1408 /* restore ac97 */ 1418 /* restore ac97 */
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
index ec4899147e1d..56e0c01123e7 100644
--- a/sound/pci/riptide/riptide.c
+++ b/sound/pci/riptide/riptide.c
@@ -1178,9 +1178,9 @@ static int riptide_suspend(struct pci_dev *pci, pm_message_t state)
1178 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 1178 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
1179 snd_pcm_suspend_all(chip->pcm); 1179 snd_pcm_suspend_all(chip->pcm);
1180 snd_ac97_suspend(chip->ac97); 1180 snd_ac97_suspend(chip->ac97);
1181 pci_set_power_state(pci, PCI_D3hot);
1182 pci_disable_device(pci); 1181 pci_disable_device(pci);
1183 pci_save_state(pci); 1182 pci_save_state(pci);
1183 pci_set_power_state(pci, pci_choose_state(pci, state));
1184 return 0; 1184 return 0;
1185} 1185}
1186 1186
@@ -1189,9 +1189,14 @@ static int riptide_resume(struct pci_dev *pci)
1189 struct snd_card *card = pci_get_drvdata(pci); 1189 struct snd_card *card = pci_get_drvdata(pci);
1190 struct snd_riptide *chip = card->private_data; 1190 struct snd_riptide *chip = card->private_data;
1191 1191
1192 pci_restore_state(pci);
1193 pci_enable_device(pci);
1194 pci_set_power_state(pci, PCI_D0); 1192 pci_set_power_state(pci, PCI_D0);
1193 pci_restore_state(pci);
1194 if (pci_enable_device(pci) < 0) {
1195 printk(KERN_ERR "riptide: pci_enable_device failed, "
1196 "disabling device\n");
1197 snd_card_disconnect(card);
1198 return -EIO;
1199 }
1195 pci_set_master(pci); 1200 pci_set_master(pci);
1196 snd_riptide_initialize(chip); 1201 snd_riptide_initialize(chip);
1197 snd_ac97_resume(chip->ac97); 1202 snd_ac97_resume(chip->ac97);
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c
index 0d478871808d..1fbc4321122f 100644
--- a/sound/pci/trident/trident_main.c
+++ b/sound/pci/trident/trident_main.c
@@ -3966,15 +3966,9 @@ int snd_trident_suspend(struct pci_dev *pci, pm_message_t state)
3966 snd_ac97_suspend(trident->ac97); 3966 snd_ac97_suspend(trident->ac97);
3967 snd_ac97_suspend(trident->ac97_sec); 3967 snd_ac97_suspend(trident->ac97_sec);
3968 3968
3969 switch (trident->device) {
3970 case TRIDENT_DEVICE_ID_DX:
3971 case TRIDENT_DEVICE_ID_NX:
3972 break; /* TODO */
3973 case TRIDENT_DEVICE_ID_SI7018:
3974 break;
3975 }
3976 pci_disable_device(pci); 3969 pci_disable_device(pci);
3977 pci_save_state(pci); 3970 pci_save_state(pci);
3971 pci_set_power_state(pci, pci_choose_state(pci, state));
3978 return 0; 3972 return 0;
3979} 3973}
3980 3974
@@ -3983,9 +3977,15 @@ int snd_trident_resume(struct pci_dev *pci)
3983 struct snd_card *card = pci_get_drvdata(pci); 3977 struct snd_card *card = pci_get_drvdata(pci);
3984 struct snd_trident *trident = card->private_data; 3978 struct snd_trident *trident = card->private_data;
3985 3979
3980 pci_set_power_state(pci, PCI_D0);
3986 pci_restore_state(pci); 3981 pci_restore_state(pci);
3987 pci_enable_device(pci); 3982 if (pci_enable_device(pci) < 0) {
3988 pci_set_master(pci); /* to be sure */ 3983 printk(KERN_ERR "trident: pci_enable_device failed, "
3984 "disabling device\n");
3985 snd_card_disconnect(card);
3986 return -EIO;
3987 }
3988 pci_set_master(pci);
3989 3989
3990 switch (trident->device) { 3990 switch (trident->device) {
3991 case TRIDENT_DEVICE_ID_DX: 3991 case TRIDENT_DEVICE_ID_DX:
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index e6990e0bbf23..92b0736c0fdb 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -2185,9 +2185,9 @@ static int snd_via82xx_suspend(struct pci_dev *pci, pm_message_t state)
2185 chip->capture_src_saved[1] = inb(chip->port + VIA_REG_CAPTURE_CHANNEL + 0x10); 2185 chip->capture_src_saved[1] = inb(chip->port + VIA_REG_CAPTURE_CHANNEL + 0x10);
2186 } 2186 }
2187 2187
2188 pci_set_power_state(pci, PCI_D3hot);
2189 pci_disable_device(pci); 2188 pci_disable_device(pci);
2190 pci_save_state(pci); 2189 pci_save_state(pci);
2190 pci_set_power_state(pci, pci_choose_state(pci, state));
2191 return 0; 2191 return 0;
2192} 2192}
2193 2193
@@ -2197,9 +2197,15 @@ static int snd_via82xx_resume(struct pci_dev *pci)
2197 struct via82xx *chip = card->private_data; 2197 struct via82xx *chip = card->private_data;
2198 int i; 2198 int i;
2199 2199
2200 pci_restore_state(pci);
2201 pci_enable_device(pci);
2202 pci_set_power_state(pci, PCI_D0); 2200 pci_set_power_state(pci, PCI_D0);
2201 pci_restore_state(pci);
2202 if (pci_enable_device(pci) < 0) {
2203 printk(KERN_ERR "via82xx: pci_enable_device failed, "
2204 "disabling device\n");
2205 snd_card_disconnect(card);
2206 return -EIO;
2207 }
2208 pci_set_master(pci);
2203 2209
2204 snd_via82xx_chip_init(chip); 2210 snd_via82xx_chip_init(chip);
2205 2211
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c
index 5ab1cf3d434b..feb27c966256 100644
--- a/sound/pci/via82xx_modem.c
+++ b/sound/pci/via82xx_modem.c
@@ -1032,9 +1032,10 @@ static int snd_via82xx_suspend(struct pci_dev *pci, pm_message_t state)
1032 snd_via82xx_channel_reset(chip, &chip->devs[i]); 1032 snd_via82xx_channel_reset(chip, &chip->devs[i]);
1033 synchronize_irq(chip->irq); 1033 synchronize_irq(chip->irq);
1034 snd_ac97_suspend(chip->ac97); 1034 snd_ac97_suspend(chip->ac97);
1035 pci_set_power_state(pci, PCI_D3hot); 1035
1036 pci_disable_device(pci); 1036 pci_disable_device(pci);
1037 pci_save_state(pci); 1037 pci_save_state(pci);
1038 pci_set_power_state(pci, pci_choose_state(pci, state));
1038 return 0; 1039 return 0;
1039} 1040}
1040 1041
@@ -1044,9 +1045,14 @@ static int snd_via82xx_resume(struct pci_dev *pci)
1044 struct via82xx_modem *chip = card->private_data; 1045 struct via82xx_modem *chip = card->private_data;
1045 int i; 1046 int i;
1046 1047
1047 pci_restore_state(pci);
1048 pci_enable_device(pci);
1049 pci_set_power_state(pci, PCI_D0); 1048 pci_set_power_state(pci, PCI_D0);
1049 pci_restore_state(pci);
1050 if (pci_enable_device(pci) < 0) {
1051 printk(KERN_ERR "via82xx-modem: pci_enable_device failed, "
1052 "disabling device\n");
1053 snd_card_disconnect(card);
1054 return -EIO;
1055 }
1050 pci_set_master(pci); 1056 pci_set_master(pci);
1051 1057
1052 snd_via82xx_chip_init(chip); 1058 snd_via82xx_chip_init(chip);
diff --git a/sound/pci/vx222/vx222.c b/sound/pci/vx222/vx222.c
index e7cd8acab59a..af49e8aabf55 100644
--- a/sound/pci/vx222/vx222.c
+++ b/sound/pci/vx222/vx222.c
@@ -266,9 +266,9 @@ static int snd_vx222_suspend(struct pci_dev *pci, pm_message_t state)
266 int err; 266 int err;
267 267
268 err = snd_vx_suspend(&vx->core, state); 268 err = snd_vx_suspend(&vx->core, state);
269 pci_set_power_state(pci, PCI_D3hot);
270 pci_disable_device(pci); 269 pci_disable_device(pci);
271 pci_save_state(pci); 270 pci_save_state(pci);
271 pci_set_power_state(pci, pci_choose_state(pci, state));
272 return err; 272 return err;
273} 273}
274 274
@@ -277,9 +277,14 @@ static int snd_vx222_resume(struct pci_dev *pci)
277 struct snd_card *card = pci_get_drvdata(pci); 277 struct snd_card *card = pci_get_drvdata(pci);
278 struct snd_vx222 *vx = card->private_data; 278 struct snd_vx222 *vx = card->private_data;
279 279
280 pci_restore_state(pci);
281 pci_enable_device(pci);
282 pci_set_power_state(pci, PCI_D0); 280 pci_set_power_state(pci, PCI_D0);
281 pci_restore_state(pci);
282 if (pci_enable_device(pci) < 0) {
283 printk(KERN_ERR "vx222: pci_enable_device failed, "
284 "disabling device\n");
285 snd_card_disconnect(card);
286 return -EIO;
287 }
283 pci_set_master(pci); 288 pci_set_master(pci);
284 return snd_vx_resume(&vx->core); 289 return snd_vx_resume(&vx->core);
285} 290}
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index ebc6da89edf3..a40c1085fd20 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -2218,6 +2218,7 @@ int snd_ymfpci_suspend(struct pci_dev *pci, pm_message_t state)
2218 snd_ymfpci_disable_dsp(chip); 2218 snd_ymfpci_disable_dsp(chip);
2219 pci_disable_device(pci); 2219 pci_disable_device(pci);
2220 pci_save_state(pci); 2220 pci_save_state(pci);
2221 pci_set_power_state(pci, pci_choose_state(pci, state));
2221 return 0; 2222 return 0;
2222} 2223}
2223 2224
@@ -2227,8 +2228,14 @@ int snd_ymfpci_resume(struct pci_dev *pci)
2227 struct snd_ymfpci *chip = card->private_data; 2228 struct snd_ymfpci *chip = card->private_data;
2228 unsigned int i; 2229 unsigned int i;
2229 2230
2231 pci_set_power_state(pci, PCI_D0);
2230 pci_restore_state(pci); 2232 pci_restore_state(pci);
2231 pci_enable_device(pci); 2233 if (pci_enable_device(pci) < 0) {
2234 printk(KERN_ERR "ymfpci: pci_enable_device failed, "
2235 "disabling device\n");
2236 snd_card_disconnect(card);
2237 return -EIO;
2238 }
2232 pci_set_master(pci); 2239 pci_set_master(pci);
2233 snd_ymfpci_aclink_reset(pci); 2240 snd_ymfpci_aclink_reset(pci);
2234 snd_ymfpci_codec_ready(chip, 0); 2241 snd_ymfpci_codec_ready(chip, 0);