Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 16061
b: refs/heads/master
c: 0e2364a
h: refs/heads/master
i:
  16059: c965aee
v: v3
  • Loading branch information
Takashi Iwai authored and Jaroslav Kysela committed Jan 3, 2006
1 parent c592e9d commit 56f5627
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5809c6c41ae95ce3f45ad14d31503deb1fa8268a
refs/heads/master: 0e2364a7013688c06d1a9454a2c20567027f6a6e
28 changes: 18 additions & 10 deletions trunk/sound/pci/maestro3.c
Original file line number Diff line number Diff line change
Expand Up @@ -2546,14 +2546,16 @@ static int snd_m3_free(struct snd_m3 *chip)
* APM support
*/
#ifdef CONFIG_PM
static int m3_suspend(struct snd_card *card, pm_message_t state)
static int m3_suspend(struct pci_dev *pci, pm_message_t state)
{
struct snd_m3 *chip = card->pm_private_data;
struct snd_card *card = pci_get_drvdata(pci);
struct snd_m3 *chip = card->private_data;
int i, index;

if (chip->suspend_mem == NULL)
return 0;

snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
snd_pcm_suspend_all(chip->pcm);
snd_ac97_suspend(chip->ac97);

Expand All @@ -2574,20 +2576,23 @@ static int m3_suspend(struct snd_card *card, pm_message_t state)
snd_m3_outw(chip, 0xffff, 0x54);
snd_m3_outw(chip, 0xffff, 0x56);

pci_disable_device(chip->pci);
pci_disable_device(pci);
pci_save_state(pci);
return 0;
}

static int m3_resume(struct snd_card *card)
static int m3_resume(struct pci_dev *pci)
{
struct snd_m3 *chip = card->pm_private_data;
struct snd_card *card = pci_get_drvdata(pci);
struct snd_m3 *chip = card->private_data;
int i, index;

if (chip->suspend_mem == NULL)
return 0;

pci_enable_device(chip->pci);
pci_set_master(chip->pci);
pci_restore_state(pci);
pci_enable_device(pci);
pci_set_master(pci);

/* first lets just bring everything back. .*/
snd_m3_outw(chip, 0, 0x54);
Expand Down Expand Up @@ -2617,6 +2622,7 @@ static int m3_resume(struct snd_card *card)
snd_m3_enable_ints(chip);
snd_m3_amp_enable(chip, 1);

snd_power_change_state(card, SNDRV_CTL_POWER_D0);
return 0;
}
#endif /* CONFIG_PM */
Expand Down Expand Up @@ -2748,8 +2754,6 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci,
chip->suspend_mem = vmalloc(sizeof(u16) * (REV_B_CODE_MEMORY_LENGTH + REV_B_DATA_MEMORY_LENGTH));
if (chip->suspend_mem == NULL)
snd_printk(KERN_WARNING "can't allocate apm buffer\n");
else
snd_card_set_pm_callback(card, m3_suspend, m3_resume, chip);
#endif

if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
Expand Down Expand Up @@ -2825,6 +2829,7 @@ snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
snd_card_free(card);
return err;
}
card->private_data = chip;

sprintf(card->shortname, "ESS %s PCI", card->driver);
sprintf(card->longname, "%s at 0x%lx, irq %d",
Expand Down Expand Up @@ -2860,7 +2865,10 @@ static struct pci_driver driver = {
.id_table = snd_m3_ids,
.probe = snd_m3_probe,
.remove = __devexit_p(snd_m3_remove),
SND_PCI_PM_CALLBACKS
#ifdef CONFIG_PM
.suspend = m3_suspend,
.resume = m3_resume,
#endif
};

static int __init alsa_card_m3_init(void)
Expand Down

0 comments on commit 56f5627

Please sign in to comment.