aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 10:13:05 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:27:55 -0500
commit11d3824ad7d6240d7ce44bdf1d9e81e62a903f72 (patch)
tree14561c3817dfb06bf4b59c77beaa86fc41bf88d7
parent3fcf7d2cd8e0ebce10e4bf89da175ff9bd6aa2da (diff)
[ALSA] ak4531 - Add PM support
Modules: AK4531 codec Add PM support to AK4531 codec driver. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--include/sound/ak4531_codec.h5
-rw-r--r--sound/pci/ac97/ak4531_codec.c36
2 files changed, 40 insertions, 1 deletions
diff --git a/include/sound/ak4531_codec.h b/include/sound/ak4531_codec.h
index 4e7c661af484..edf04070ce7c 100644
--- a/include/sound/ak4531_codec.h
+++ b/include/sound/ak4531_codec.h
@@ -77,4 +77,9 @@ struct snd_ak4531 {
77int snd_ak4531_mixer(struct snd_card *card, struct snd_ak4531 *_ak4531, 77int snd_ak4531_mixer(struct snd_card *card, struct snd_ak4531 *_ak4531,
78 struct snd_ak4531 **rak4531); 78 struct snd_ak4531 **rak4531);
79 79
80#ifdef CONFIG_PM
81void snd_ak4531_suspend(struct snd_ak4531 *ak4531);
82void snd_ak4531_resume(struct snd_ak4531 *ak4531);
83#endif
84
80#endif /* __SOUND_AK4531_CODEC_H */ 85#endif /* __SOUND_AK4531_CODEC_H */
diff --git a/sound/pci/ac97/ak4531_codec.c b/sound/pci/ac97/ak4531_codec.c
index 088d8dc336be..3eb885584e9a 100644
--- a/sound/pci/ac97/ak4531_codec.c
+++ b/sound/pci/ac97/ak4531_codec.c
@@ -371,7 +371,7 @@ int snd_ak4531_mixer(struct snd_card *card, struct snd_ak4531 *_ak4531,
371 ak4531->write(ak4531, AK4531_RESET, 0x03); /* no RST, PD */ 371 ak4531->write(ak4531, AK4531_RESET, 0x03); /* no RST, PD */
372 udelay(100); 372 udelay(100);
373 ak4531->write(ak4531, AK4531_CLOCK, 0x00); /* CODEC ADC and CODEC DAC use {LR,B}CLK2 and run off LRCLK2 PLL */ 373 ak4531->write(ak4531, AK4531_CLOCK, 0x00); /* CODEC ADC and CODEC DAC use {LR,B}CLK2 and run off LRCLK2 PLL */
374 for (idx = 0; idx < 0x19; idx++) { 374 for (idx = 0; idx <= 0x19; idx++) {
375 if (idx == AK4531_RESET || idx == AK4531_CLOCK) 375 if (idx == AK4531_RESET || idx == AK4531_CLOCK)
376 continue; 376 continue;
377 ak4531->write(ak4531, idx, ak4531->regs[idx] = snd_ak4531_initial_map[idx]); /* recording source is mixer */ 377 ak4531->write(ak4531, idx, ak4531->regs[idx] = snd_ak4531_initial_map[idx]); /* recording source is mixer */
@@ -396,6 +396,36 @@ int snd_ak4531_mixer(struct snd_card *card, struct snd_ak4531 *_ak4531,
396} 396}
397 397
398/* 398/*
399 * power management
400 */
401#ifdef CONFIG_PM
402void snd_ak4531_suspend(struct snd_ak4531 *ak4531)
403{
404 /* mute */
405 ak4531->write(ak4531, AK4531_LMASTER, 0x9f);
406 ak4531->write(ak4531, AK4531_RMASTER, 0x9f);
407 /* powerdown */
408 ak4531->write(ak4531, AK4531_RESET, 0x01);
409}
410
411void snd_ak4531_resume(struct snd_ak4531 *ak4531)
412{
413 int idx;
414
415 /* initialize */
416 ak4531->write(ak4531, AK4531_RESET, 0x03);
417 udelay(100);
418 ak4531->write(ak4531, AK4531_CLOCK, 0x00);
419 /* restore mixer registers */
420 for (idx = 0; idx <= 0x19; idx++) {
421 if (idx == AK4531_RESET || idx == AK4531_CLOCK)
422 continue;
423 ak4531->write(ak4531, idx, ak4531->regs[idx]);
424 }
425}
426#endif
427
428/*
399 429
400 */ 430 */
401 431
@@ -420,6 +450,10 @@ static void snd_ak4531_proc_init(struct snd_card *card, struct snd_ak4531 *ak453
420} 450}
421 451
422EXPORT_SYMBOL(snd_ak4531_mixer); 452EXPORT_SYMBOL(snd_ak4531_mixer);
453#ifdef CONFIG_PM
454EXPORT_SYMBOL(snd_ak4531_suspend);
455EXPORT_SYMBOL(snd_ak4531_resume);
456#endif
423 457
424/* 458/*
425 * INIT part 459 * INIT part