Commit e4f163d9 authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

[ALSA] pdaudiocf - Fix PM support

Modules: PDAudioCF driver

Fix the PM support on pdaudiocf driver.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 7f52bdb6
...@@ -217,8 +217,6 @@ static int snd_pdacf_assign_resources(struct snd_pdacf *pdacf, int port, int irq ...@@ -217,8 +217,6 @@ static int snd_pdacf_assign_resources(struct snd_pdacf *pdacf, int port, int irq
if (err < 0) if (err < 0)
return err; return err;
snd_card_set_pm_callback(card, snd_pdacf_suspend, snd_pdacf_resume, pdacf);
if ((err = snd_card_register(card)) < 0) if ((err = snd_card_register(card)) < 0)
return err; return err;
...@@ -339,7 +337,7 @@ static int pdacf_event(event_t event, int priority, event_callback_args_t *args) ...@@ -339,7 +337,7 @@ static int pdacf_event(event_t event, int priority, event_callback_args_t *args)
link->state |= DEV_SUSPEND; link->state |= DEV_SUSPEND;
if (chip) { if (chip) {
snd_printdd(KERN_DEBUG "snd_pdacf_suspend calling\n"); snd_printdd(KERN_DEBUG "snd_pdacf_suspend calling\n");
snd_pdacf_suspend(chip->card, PMSG_SUSPEND); snd_pdacf_suspend(chip, PMSG_SUSPEND);
} }
/* Fall through... */ /* Fall through... */
case CS_EVENT_RESET_PHYSICAL: case CS_EVENT_RESET_PHYSICAL:
...@@ -358,7 +356,7 @@ static int pdacf_event(event_t event, int priority, event_callback_args_t *args) ...@@ -358,7 +356,7 @@ static int pdacf_event(event_t event, int priority, event_callback_args_t *args)
pcmcia_request_configuration(link->handle, &link->conf); pcmcia_request_configuration(link->handle, &link->conf);
if (chip) { if (chip) {
snd_printdd(KERN_DEBUG "calling snd_pdacf_resume\n"); snd_printdd(KERN_DEBUG "calling snd_pdacf_resume\n");
snd_pdacf_resume(chip->card); snd_pdacf_resume(chip);
} }
} }
snd_printdd(KERN_DEBUG "resume done!\n"); snd_printdd(KERN_DEBUG "resume done!\n");
......
...@@ -134,8 +134,8 @@ struct snd_pdacf *snd_pdacf_create(struct snd_card *card); ...@@ -134,8 +134,8 @@ struct snd_pdacf *snd_pdacf_create(struct snd_card *card);
int snd_pdacf_ak4117_create(struct snd_pdacf *pdacf); int snd_pdacf_ak4117_create(struct snd_pdacf *pdacf);
void snd_pdacf_powerdown(struct snd_pdacf *chip); void snd_pdacf_powerdown(struct snd_pdacf *chip);
#ifdef CONFIG_PM #ifdef CONFIG_PM
int snd_pdacf_suspend(struct snd_card *card, pm_message_t state); int snd_pdacf_suspend(struct snd_pdacf *chip, pm_message_t state);
int snd_pdacf_resume(struct snd_card *card); int snd_pdacf_resume(struct snd_pdacf *chip);
#endif #endif
int snd_pdacf_pcm_new(struct snd_pdacf *chip); int snd_pdacf_pcm_new(struct snd_pdacf *chip);
irqreturn_t pdacf_interrupt(int irq, void *dev, struct pt_regs *regs); irqreturn_t pdacf_interrupt(int irq, void *dev, struct pt_regs *regs);
......
...@@ -255,11 +255,11 @@ void snd_pdacf_powerdown(struct snd_pdacf *chip) ...@@ -255,11 +255,11 @@ void snd_pdacf_powerdown(struct snd_pdacf *chip)
#ifdef CONFIG_PM #ifdef CONFIG_PM
int snd_pdacf_suspend(struct snd_card *card, pm_message_t state) int snd_pdacf_suspend(struct snd_pdacf *chip, pm_message_t state)
{ {
struct snd_pdacf *chip = card->pm_private_data;
u16 val; u16 val;
snd_power_change_state(chip->card, SNDRV_CTL_POWER_D3hot);
snd_pcm_suspend_all(chip->pcm); snd_pcm_suspend_all(chip->pcm);
/* disable interrupts, but use direct write to preserve old register value in chip->regmap */ /* disable interrupts, but use direct write to preserve old register value in chip->regmap */
val = inw(chip->port + PDAUDIOCF_REG_IER); val = inw(chip->port + PDAUDIOCF_REG_IER);
...@@ -275,9 +275,8 @@ static inline int check_signal(struct snd_pdacf *chip) ...@@ -275,9 +275,8 @@ static inline int check_signal(struct snd_pdacf *chip)
return (chip->ak4117->rcs0 & AK4117_UNLCK) == 0; return (chip->ak4117->rcs0 & AK4117_UNLCK) == 0;
} }
int snd_pdacf_resume(struct snd_card *card) int snd_pdacf_resume(struct snd_pdacf *chip)
{ {
struct snd_pdacf *chip = card->pm_private_data;
int timeout = 40; int timeout = 40;
pdacf_reinit(chip, 1); pdacf_reinit(chip, 1);
...@@ -286,6 +285,7 @@ int snd_pdacf_resume(struct snd_card *card) ...@@ -286,6 +285,7 @@ int snd_pdacf_resume(struct snd_card *card)
(snd_ak4117_external_rate(chip->ak4117) <= 0 || !check_signal(chip))) (snd_ak4117_external_rate(chip->ak4117) <= 0 || !check_signal(chip)))
mdelay(1); mdelay(1);
chip->chip_status &= ~PDAUDIOCF_STAT_IS_SUSPENDED; chip->chip_status &= ~PDAUDIOCF_STAT_IS_SUSPENDED;
snd_power_change_state(chip->card, SNDRV_CTL_POWER_D0);
return 0; return 0;
} }
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment