aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 11:15:58 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:28:42 -0500
commite4f163d96080dda40fd02df725f3672d035e4c5a (patch)
treec97fc3575683cdbd9ea1d25bb92e0519501d2642 /sound
parent7f52bdb61bdb945b29c2a3b3a6d0f8e6e80b8ec8 (diff)
[ALSA] pdaudiocf - Fix PM support
Modules: PDAudioCF driver Fix the PM support on pdaudiocf driver. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pcmcia/pdaudiocf/pdaudiocf.c6
-rw-r--r--sound/pcmcia/pdaudiocf/pdaudiocf.h4
-rw-r--r--sound/pcmcia/pdaudiocf/pdaudiocf_core.c8
3 files changed, 8 insertions, 10 deletions
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c
index 0ba335d045f8..a7cd2d4df757 100644
--- a/sound/pcmcia/pdaudiocf/pdaudiocf.c
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf.c
@@ -217,8 +217,6 @@ static int snd_pdacf_assign_resources(struct snd_pdacf *pdacf, int port, int irq
217 if (err < 0) 217 if (err < 0)
218 return err; 218 return err;
219 219
220 snd_card_set_pm_callback(card, snd_pdacf_suspend, snd_pdacf_resume, pdacf);
221
222 if ((err = snd_card_register(card)) < 0) 220 if ((err = snd_card_register(card)) < 0)
223 return err; 221 return err;
224 222
@@ -339,7 +337,7 @@ static int pdacf_event(event_t event, int priority, event_callback_args_t *args)
339 link->state |= DEV_SUSPEND; 337 link->state |= DEV_SUSPEND;
340 if (chip) { 338 if (chip) {
341 snd_printdd(KERN_DEBUG "snd_pdacf_suspend calling\n"); 339 snd_printdd(KERN_DEBUG "snd_pdacf_suspend calling\n");
342 snd_pdacf_suspend(chip->card, PMSG_SUSPEND); 340 snd_pdacf_suspend(chip, PMSG_SUSPEND);
343 } 341 }
344 /* Fall through... */ 342 /* Fall through... */
345 case CS_EVENT_RESET_PHYSICAL: 343 case CS_EVENT_RESET_PHYSICAL:
@@ -358,7 +356,7 @@ static int pdacf_event(event_t event, int priority, event_callback_args_t *args)
358 pcmcia_request_configuration(link->handle, &link->conf); 356 pcmcia_request_configuration(link->handle, &link->conf);
359 if (chip) { 357 if (chip) {
360 snd_printdd(KERN_DEBUG "calling snd_pdacf_resume\n"); 358 snd_printdd(KERN_DEBUG "calling snd_pdacf_resume\n");
361 snd_pdacf_resume(chip->card); 359 snd_pdacf_resume(chip);
362 } 360 }
363 } 361 }
364 snd_printdd(KERN_DEBUG "resume done!\n"); 362 snd_printdd(KERN_DEBUG "resume done!\n");
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.h b/sound/pcmcia/pdaudiocf/pdaudiocf.h
index ad8f32eedce5..2744f189a613 100644
--- a/sound/pcmcia/pdaudiocf/pdaudiocf.h
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf.h
@@ -134,8 +134,8 @@ struct snd_pdacf *snd_pdacf_create(struct snd_card *card);
134int snd_pdacf_ak4117_create(struct snd_pdacf *pdacf); 134int snd_pdacf_ak4117_create(struct snd_pdacf *pdacf);
135void snd_pdacf_powerdown(struct snd_pdacf *chip); 135void snd_pdacf_powerdown(struct snd_pdacf *chip);
136#ifdef CONFIG_PM 136#ifdef CONFIG_PM
137int snd_pdacf_suspend(struct snd_card *card, pm_message_t state); 137int snd_pdacf_suspend(struct snd_pdacf *chip, pm_message_t state);
138int snd_pdacf_resume(struct snd_card *card); 138int snd_pdacf_resume(struct snd_pdacf *chip);
139#endif 139#endif
140int snd_pdacf_pcm_new(struct snd_pdacf *chip); 140int snd_pdacf_pcm_new(struct snd_pdacf *chip);
141irqreturn_t pdacf_interrupt(int irq, void *dev, struct pt_regs *regs); 141irqreturn_t pdacf_interrupt(int irq, void *dev, struct pt_regs *regs);
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_core.c b/sound/pcmcia/pdaudiocf/pdaudiocf_core.c
index 4f898238e0aa..bd0d70ff3019 100644
--- a/sound/pcmcia/pdaudiocf/pdaudiocf_core.c
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf_core.c
@@ -255,11 +255,11 @@ void snd_pdacf_powerdown(struct snd_pdacf *chip)
255 255
256#ifdef CONFIG_PM 256#ifdef CONFIG_PM
257 257
258int snd_pdacf_suspend(struct snd_card *card, pm_message_t state) 258int snd_pdacf_suspend(struct snd_pdacf *chip, pm_message_t state)
259{ 259{
260 struct snd_pdacf *chip = card->pm_private_data;
261 u16 val; 260 u16 val;
262 261
262 snd_power_change_state(chip->card, SNDRV_CTL_POWER_D3hot);
263 snd_pcm_suspend_all(chip->pcm); 263 snd_pcm_suspend_all(chip->pcm);
264 /* disable interrupts, but use direct write to preserve old register value in chip->regmap */ 264 /* disable interrupts, but use direct write to preserve old register value in chip->regmap */
265 val = inw(chip->port + PDAUDIOCF_REG_IER); 265 val = inw(chip->port + PDAUDIOCF_REG_IER);
@@ -275,9 +275,8 @@ static inline int check_signal(struct snd_pdacf *chip)
275 return (chip->ak4117->rcs0 & AK4117_UNLCK) == 0; 275 return (chip->ak4117->rcs0 & AK4117_UNLCK) == 0;
276} 276}
277 277
278int snd_pdacf_resume(struct snd_card *card) 278int snd_pdacf_resume(struct snd_pdacf *chip)
279{ 279{
280 struct snd_pdacf *chip = card->pm_private_data;
281 int timeout = 40; 280 int timeout = 40;
282 281
283 pdacf_reinit(chip, 1); 282 pdacf_reinit(chip, 1);
@@ -286,6 +285,7 @@ int snd_pdacf_resume(struct snd_card *card)
286 (snd_ak4117_external_rate(chip->ak4117) <= 0 || !check_signal(chip))) 285 (snd_ak4117_external_rate(chip->ak4117) <= 0 || !check_signal(chip)))
287 mdelay(1); 286 mdelay(1);
288 chip->chip_status &= ~PDAUDIOCF_STAT_IS_SUSPENDED; 287 chip->chip_status &= ~PDAUDIOCF_STAT_IS_SUSPENDED;
288 snd_power_change_state(chip->card, SNDRV_CTL_POWER_D0);
289 return 0; 289 return 0;
290} 290}
291#endif 291#endif