Skip to content

Commit

Permalink
ALSA: Convert to new pm_ops for PCI drivers
Browse files Browse the repository at this point in the history
Straightforward conversion to the new pm_ops from the legacy
suspend/resume ops.

Since we change vx222, vx_core and vxpocket have to be converted,
too.

Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
tiwai committed Jul 3, 2012
1 parent 284e7ca commit 68cb2b5
Show file tree
Hide file tree
Showing 59 changed files with 496 additions and 325 deletions.
3 changes: 1 addition & 2 deletions include/sound/cs46xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -1730,8 +1730,7 @@ int snd_cs46xx_create(struct snd_card *card,
struct pci_dev *pci,
int external_amp, int thinkpad,
struct snd_cs46xx **rcodec);
int snd_cs46xx_suspend(struct pci_dev *pci, pm_message_t state);
int snd_cs46xx_resume(struct pci_dev *pci);
extern const struct dev_pm_ops snd_cs46xx_pm;

int snd_cs46xx_pcm(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm);
int snd_cs46xx_pcm_rear(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm);
Expand Down
3 changes: 1 addition & 2 deletions include/sound/trident.h
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,7 @@ void snd_trident_free_voice(struct snd_trident * trident, struct snd_trident_voi
void snd_trident_start_voice(struct snd_trident * trident, unsigned int voice);
void snd_trident_stop_voice(struct snd_trident * trident, unsigned int voice);
void snd_trident_write_voice_regs(struct snd_trident * trident, struct snd_trident_voice *voice);
int snd_trident_suspend(struct pci_dev *pci, pm_message_t state);
int snd_trident_resume(struct pci_dev *pci);
extern const struct dev_pm_ops snd_trident_pm;

/* TLB memory allocation */
struct snd_util_memblk *snd_trident_alloc_pages(struct snd_trident *trident,
Expand Down
2 changes: 1 addition & 1 deletion include/sound/vx_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ int vx_change_frequency(struct vx_core *chip);
/*
* PM
*/
int snd_vx_suspend(struct vx_core *card, pm_message_t state);
int snd_vx_suspend(struct vx_core *card);
int snd_vx_resume(struct vx_core *card);

/*
Expand Down
3 changes: 1 addition & 2 deletions include/sound/ymfpci.h
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,7 @@ int snd_ymfpci_create(struct snd_card *card,
struct snd_ymfpci ** rcodec);
void snd_ymfpci_free_gameport(struct snd_ymfpci *chip);

int snd_ymfpci_suspend(struct pci_dev *pci, pm_message_t state);
int snd_ymfpci_resume(struct pci_dev *pci);
extern const struct dev_pm_ops snd_ymfpci_pm;

int snd_ymfpci_pcm(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm);
int snd_ymfpci_pcm2(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm);
Expand Down
2 changes: 1 addition & 1 deletion sound/drivers/vx/vx_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ EXPORT_SYMBOL(snd_vx_dsp_load);
/*
* suspend
*/
int snd_vx_suspend(struct vx_core *chip, pm_message_t state)
int snd_vx_suspend(struct vx_core *chip)
{
unsigned int i;

Expand Down
24 changes: 15 additions & 9 deletions sound/pci/ali5451/ali5451.c
Original file line number Diff line number Diff line change
Expand Up @@ -1884,9 +1884,10 @@ static int __devinit snd_ali_mixer(struct snd_ali * codec)
}

#ifdef CONFIG_PM
static int ali_suspend(struct pci_dev *pci, pm_message_t state)
static int ali_suspend(struct device *dev)
{
struct snd_card *card = pci_get_drvdata(pci);
struct pci_dev *pci = to_pci_dev(dev);
struct snd_card *card = dev_get_drvdata(dev);
struct snd_ali *chip = card->private_data;
struct snd_ali_image *im;
int i, j;
Expand Down Expand Up @@ -1929,13 +1930,14 @@ static int ali_suspend(struct pci_dev *pci, pm_message_t state)

pci_disable_device(pci);
pci_save_state(pci);
pci_set_power_state(pci, pci_choose_state(pci, state));
pci_set_power_state(pci, PCI_D3hot);
return 0;
}

static int ali_resume(struct pci_dev *pci)
static int ali_resume(struct device *dev)
{
struct snd_card *card = pci_get_drvdata(pci);
struct pci_dev *pci = to_pci_dev(dev);
struct snd_card *card = dev_get_drvdata(dev);
struct snd_ali *chip = card->private_data;
struct snd_ali_image *im;
int i, j;
Expand Down Expand Up @@ -1982,6 +1984,11 @@ static int ali_resume(struct pci_dev *pci)
snd_power_change_state(card, SNDRV_CTL_POWER_D0);
return 0;
}

static SIMPLE_DEV_PM_OPS(ali_pm, ali_suspend, ali_resume);
#define ALI_PM_OPS &ali_pm
#else
#define ALI_PM_OPS NULL
#endif /* CONFIG_PM */

static int snd_ali_free(struct snd_ali * codec)
Expand Down Expand Up @@ -2299,10 +2306,9 @@ static struct pci_driver ali5451_driver = {
.id_table = snd_ali_ids,
.probe = snd_ali_probe,
.remove = __devexit_p(snd_ali_remove),
#ifdef CONFIG_PM
.suspend = ali_suspend,
.resume = ali_resume,
#endif
.driver = {
.pm = ALI_PM_OPS,
},
};

module_pci_driver(ali5451_driver);
24 changes: 15 additions & 9 deletions sound/pci/als300.c
Original file line number Diff line number Diff line change
Expand Up @@ -766,9 +766,10 @@ static int __devinit snd_als300_create(struct snd_card *card,
}

#ifdef CONFIG_PM
static int snd_als300_suspend(struct pci_dev *pci, pm_message_t state)
static int snd_als300_suspend(struct device *dev)
{
struct snd_card *card = pci_get_drvdata(pci);
struct pci_dev *pci = to_pci_dev(dev);
struct snd_card *card = dev_get_drvdata(dev);
struct snd_als300 *chip = card->private_data;

snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
Expand All @@ -777,13 +778,14 @@ static int snd_als300_suspend(struct pci_dev *pci, pm_message_t state)

pci_disable_device(pci);
pci_save_state(pci);
pci_set_power_state(pci, pci_choose_state(pci, state));
pci_set_power_state(pci, PCI_D3hot);
return 0;
}

static int snd_als300_resume(struct pci_dev *pci)
static int snd_als300_resume(struct device *dev)
{
struct snd_card *card = pci_get_drvdata(pci);
struct pci_dev *pci = to_pci_dev(dev);
struct snd_card *card = dev_get_drvdata(dev);
struct snd_als300 *chip = card->private_data;

pci_set_power_state(pci, PCI_D0);
Expand All @@ -802,6 +804,11 @@ static int snd_als300_resume(struct pci_dev *pci)
snd_power_change_state(card, SNDRV_CTL_POWER_D0);
return 0;
}

static SIMPLE_DEV_PM_OPS(snd_als300_pm, snd_als300_suspend, snd_als300_resume);
#define SND_ALS300_PM_OPS &snd_als300_pm
#else
#define SND_ALS300_PM_OPS NULL
#endif

static int __devinit snd_als300_probe(struct pci_dev *pci,
Expand Down Expand Up @@ -857,10 +864,9 @@ static struct pci_driver als300_driver = {
.id_table = snd_als300_ids,
.probe = snd_als300_probe,
.remove = __devexit_p(snd_als300_remove),
#ifdef CONFIG_PM
.suspend = snd_als300_suspend,
.resume = snd_als300_resume,
#endif
.driver = {
.pm = SND_ALS300_PM_OPS,
},
};

module_pci_driver(als300_driver);
25 changes: 15 additions & 10 deletions sound/pci/als4000.c
Original file line number Diff line number Diff line change
Expand Up @@ -988,9 +988,10 @@ static void __devexit snd_card_als4000_remove(struct pci_dev *pci)
}

#ifdef CONFIG_PM
static int snd_als4000_suspend(struct pci_dev *pci, pm_message_t state)
static int snd_als4000_suspend(struct device *dev)
{
struct snd_card *card = pci_get_drvdata(pci);
struct pci_dev *pci = to_pci_dev(dev);
struct snd_card *card = dev_get_drvdata(dev);
struct snd_card_als4000 *acard = card->private_data;
struct snd_sb *chip = acard->chip;

Expand All @@ -1001,13 +1002,14 @@ static int snd_als4000_suspend(struct pci_dev *pci, pm_message_t state)

pci_disable_device(pci);
pci_save_state(pci);
pci_set_power_state(pci, pci_choose_state(pci, state));
pci_set_power_state(pci, PCI_D3hot);
return 0;
}

static int snd_als4000_resume(struct pci_dev *pci)
static int snd_als4000_resume(struct device *dev)
{
struct snd_card *card = pci_get_drvdata(pci);
struct pci_dev *pci = to_pci_dev(dev);
struct snd_card *card = dev_get_drvdata(dev);
struct snd_card_als4000 *acard = card->private_data;
struct snd_sb *chip = acard->chip;

Expand All @@ -1033,18 +1035,21 @@ static int snd_als4000_resume(struct pci_dev *pci)
snd_power_change_state(card, SNDRV_CTL_POWER_D0);
return 0;
}
#endif /* CONFIG_PM */

static SIMPLE_DEV_PM_OPS(snd_als4000_pm, snd_als4000_suspend, snd_als4000_resume);
#define SND_ALS4000_PM_OPS &snd_als4000_pm
#else
#define SND_ALS4000_PM_OPS NULL
#endif /* CONFIG_PM */

static struct pci_driver als4000_driver = {
.name = KBUILD_MODNAME,
.id_table = snd_als4000_ids,
.probe = snd_card_als4000_probe,
.remove = __devexit_p(snd_card_als4000_remove),
#ifdef CONFIG_PM
.suspend = snd_als4000_suspend,
.resume = snd_als4000_resume,
#endif
.driver = {
.pm = SND_ALS4000_PM_OPS,
},
};

module_pci_driver(als4000_driver);
24 changes: 15 additions & 9 deletions sound/pci/atiixp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1462,9 +1462,10 @@ static int __devinit snd_atiixp_mixer_new(struct atiixp *chip, int clock,
/*
* power management
*/
static int snd_atiixp_suspend(struct pci_dev *pci, pm_message_t state)
static int snd_atiixp_suspend(struct device *dev)
{
struct snd_card *card = pci_get_drvdata(pci);
struct pci_dev *pci = to_pci_dev(dev);
struct snd_card *card = dev_get_drvdata(dev);
struct atiixp *chip = card->private_data;
int i;

Expand All @@ -1484,13 +1485,14 @@ static int snd_atiixp_suspend(struct pci_dev *pci, pm_message_t state)

pci_disable_device(pci);
pci_save_state(pci);
pci_set_power_state(pci, pci_choose_state(pci, state));
pci_set_power_state(pci, PCI_D3hot);
return 0;
}

static int snd_atiixp_resume(struct pci_dev *pci)
static int snd_atiixp_resume(struct device *dev)
{
struct snd_card *card = pci_get_drvdata(pci);
struct pci_dev *pci = to_pci_dev(dev);
struct snd_card *card = dev_get_drvdata(dev);
struct atiixp *chip = card->private_data;
int i;

Expand Down Expand Up @@ -1526,6 +1528,11 @@ static int snd_atiixp_resume(struct pci_dev *pci)
snd_power_change_state(card, SNDRV_CTL_POWER_D0);
return 0;
}

static SIMPLE_DEV_PM_OPS(snd_atiixp_pm, snd_atiixp_suspend, snd_atiixp_resume);
#define SND_ATIIXP_PM_OPS &snd_atiixp_pm
#else
#define SND_ATIIXP_PM_OPS NULL
#endif /* CONFIG_PM */


Expand Down Expand Up @@ -1705,10 +1712,9 @@ static struct pci_driver atiixp_driver = {
.id_table = snd_atiixp_ids,
.probe = snd_atiixp_probe,
.remove = __devexit_p(snd_atiixp_remove),
#ifdef CONFIG_PM
.suspend = snd_atiixp_suspend,
.resume = snd_atiixp_resume,
#endif
.driver = {
.pm = SND_ATIIXP_PM_OPS,
},
};

module_pci_driver(atiixp_driver);
25 changes: 15 additions & 10 deletions sound/pci/atiixp_modem.c
Original file line number Diff line number Diff line change
Expand Up @@ -1117,9 +1117,10 @@ static int __devinit snd_atiixp_mixer_new(struct atiixp_modem *chip, int clock)
/*
* power management
*/
static int snd_atiixp_suspend(struct pci_dev *pci, pm_message_t state)
static int snd_atiixp_suspend(struct device *dev)
{
struct snd_card *card = pci_get_drvdata(pci);
struct pci_dev *pci = to_pci_dev(dev);
struct snd_card *card = dev_get_drvdata(dev);
struct atiixp_modem *chip = card->private_data;
int i;

Expand All @@ -1133,13 +1134,14 @@ static int snd_atiixp_suspend(struct pci_dev *pci, pm_message_t state)

pci_disable_device(pci);
pci_save_state(pci);
pci_set_power_state(pci, pci_choose_state(pci, state));
pci_set_power_state(pci, PCI_D3hot);
return 0;
}

static int snd_atiixp_resume(struct pci_dev *pci)
static int snd_atiixp_resume(struct device *dev)
{
struct snd_card *card = pci_get_drvdata(pci);
struct pci_dev *pci = to_pci_dev(dev);
struct snd_card *card = dev_get_drvdata(dev);
struct atiixp_modem *chip = card->private_data;
int i;

Expand All @@ -1162,8 +1164,12 @@ static int snd_atiixp_resume(struct pci_dev *pci)
snd_power_change_state(card, SNDRV_CTL_POWER_D0);
return 0;
}
#endif /* CONFIG_PM */

static SIMPLE_DEV_PM_OPS(snd_atiixp_pm, snd_atiixp_suspend, snd_atiixp_resume);
#define SND_ATIIXP_PM_OPS &snd_atiixp_pm
#else
#define SND_ATIIXP_PM_OPS NULL
#endif /* CONFIG_PM */

#ifdef CONFIG_PROC_FS
/*
Expand Down Expand Up @@ -1336,10 +1342,9 @@ static struct pci_driver atiixp_modem_driver = {
.id_table = snd_atiixp_ids,
.probe = snd_atiixp_probe,
.remove = __devexit_p(snd_atiixp_remove),
#ifdef CONFIG_PM
.suspend = snd_atiixp_suspend,
.resume = snd_atiixp_resume,
#endif
.driver = {
.pm = SND_ATIIXP_PM_OPS,
},
};

module_pci_driver(atiixp_modem_driver);
25 changes: 15 additions & 10 deletions sound/pci/azt3328.c
Original file line number Diff line number Diff line change
Expand Up @@ -2794,9 +2794,10 @@ snd_azf3328_resume_ac97(const struct snd_azf3328 *chip)
}

static int
snd_azf3328_suspend(struct pci_dev *pci, pm_message_t state)
snd_azf3328_suspend(struct device *dev)
{
struct snd_card *card = pci_get_drvdata(pci);
struct pci_dev *pci = to_pci_dev(dev);
struct snd_card *card = dev_get_drvdata(dev);
struct snd_azf3328 *chip = card->private_data;
u16 *saved_regs_ctrl_u16;

Expand Down Expand Up @@ -2824,14 +2825,15 @@ snd_azf3328_suspend(struct pci_dev *pci, pm_message_t state)

pci_disable_device(pci);
pci_save_state(pci);
pci_set_power_state(pci, pci_choose_state(pci, state));
pci_set_power_state(pci, PCI_D3hot);
return 0;
}

static int
snd_azf3328_resume(struct pci_dev *pci)
snd_azf3328_resume(struct device *dev)
{
struct snd_card *card = pci_get_drvdata(pci);
struct pci_dev *pci = to_pci_dev(dev);
struct snd_card *card = dev_get_drvdata(dev);
const struct snd_azf3328 *chip = card->private_data;

pci_set_power_state(pci, PCI_D0);
Expand Down Expand Up @@ -2859,18 +2861,21 @@ snd_azf3328_resume(struct pci_dev *pci)
snd_power_change_state(card, SNDRV_CTL_POWER_D0);
return 0;
}
#endif /* CONFIG_PM */

static SIMPLE_DEV_PM_OPS(snd_azf3328_pm, snd_azf3328_suspend, snd_azf3328_resume);
#define SND_AZF3328_PM_OPS &snd_azf3328_pm
#else
#define SND_AZF3328_PM_OPS NULL
#endif /* CONFIG_PM */

static struct pci_driver azf3328_driver = {
.name = KBUILD_MODNAME,
.id_table = snd_azf3328_ids,
.probe = snd_azf3328_probe,
.remove = __devexit_p(snd_azf3328_remove),
#ifdef CONFIG_PM
.suspend = snd_azf3328_suspend,
.resume = snd_azf3328_resume,
#endif
.driver = {
.pm = SND_AZF3328_PM_OPS,
},
};

module_pci_driver(azf3328_driver);
Loading

0 comments on commit 68cb2b5

Please sign in to comment.