Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a0044463 authored by Takashi Iwai's avatar Takashi Iwai
Browse files

ALSA: rme96: Simplify PM callbacks



This is a similar cleanup like the commit [3db084fd: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent e066d85c
Loading
Loading
Loading
Loading
+0 −13
Original line number Original line Diff line number Diff line
@@ -2358,7 +2358,6 @@ snd_rme96_create_switches(struct snd_card *card,


static int rme96_suspend(struct device *dev)
static int rme96_suspend(struct device *dev)
{
{
	struct pci_dev *pci = to_pci_dev(dev);
	struct snd_card *card = dev_get_drvdata(dev);
	struct snd_card *card = dev_get_drvdata(dev);
	struct rme96 *rme96 = card->private_data;
	struct rme96 *rme96 = card->private_data;


@@ -2381,26 +2380,14 @@ static int rme96_suspend(struct device *dev)
	/* disable the DAC  */
	/* disable the DAC  */
	rme96->areg &= ~RME96_AR_DAC_EN;
	rme96->areg &= ~RME96_AR_DAC_EN;
	writel(rme96->areg, rme96->iobase + RME96_IO_ADDITIONAL_REG);
	writel(rme96->areg, rme96->iobase + RME96_IO_ADDITIONAL_REG);

	pci_disable_device(pci);
	pci_save_state(pci);

	return 0;
	return 0;
}
}


static int rme96_resume(struct device *dev)
static int rme96_resume(struct device *dev)
{
{
	struct pci_dev *pci = to_pci_dev(dev);
	struct snd_card *card = dev_get_drvdata(dev);
	struct snd_card *card = dev_get_drvdata(dev);
	struct rme96 *rme96 = card->private_data;
	struct rme96 *rme96 = card->private_data;


	pci_restore_state(pci);
	if (pci_enable_device(pci) < 0) {
		dev_err(dev, "pci_enable_device failed, disabling device\n");
		snd_card_disconnect(card);
		return -EIO;
	}

	/* reset playback and record buffer pointers */
	/* reset playback and record buffer pointers */
	writel(0, rme96->iobase + RME96_IO_SET_PLAY_POS
	writel(0, rme96->iobase + RME96_IO_SET_PLAY_POS
		  + rme96->playback_pointer);
		  + rme96->playback_pointer);