aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/emu10k1/p16v.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 10:14:10 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:27:58 -0500
commit09668b441dacdf4640509b640ad73e24efd5204f (patch)
tree177d0548acbcca4432f82ce6f3aa397cba5ba528 /sound/pci/emu10k1/p16v.c
parentfe8be10786c040bce53c18048d75b1b23aec64ae (diff)
[ALSA] emu10k1 - Add PM support
Modules: EMU10K1/EMU10K2 driver Add PM support to emu10k1 driver. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/emu10k1/p16v.c')
-rw-r--r--sound/pci/emu10k1/p16v.c43
1 files changed, 42 insertions, 1 deletions
diff --git a/sound/pci/emu10k1/p16v.c b/sound/pci/emu10k1/p16v.c
index 90470de8bb8e..adce6af98d01 100644
--- a/sound/pci/emu10k1/p16v.c
+++ b/sound/pci/emu10k1/p16v.c
@@ -125,6 +125,7 @@ static struct snd_pcm_hardware snd_p16v_playback_hw = {
125 .info = (SNDRV_PCM_INFO_MMAP | 125 .info = (SNDRV_PCM_INFO_MMAP |
126 SNDRV_PCM_INFO_INTERLEAVED | 126 SNDRV_PCM_INFO_INTERLEAVED |
127 SNDRV_PCM_INFO_BLOCK_TRANSFER | 127 SNDRV_PCM_INFO_BLOCK_TRANSFER |
128 SNDRV_PCM_INFO_RESUME |
128 SNDRV_PCM_INFO_MMAP_VALID), 129 SNDRV_PCM_INFO_MMAP_VALID),
129 .formats = SNDRV_PCM_FMTBIT_S32_LE, /* Only supports 24-bit samples padded to 32 bits. */ 130 .formats = SNDRV_PCM_FMTBIT_S32_LE, /* Only supports 24-bit samples padded to 32 bits. */
130 .rates = SNDRV_PCM_RATE_192000 | SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_44100, 131 .rates = SNDRV_PCM_RATE_192000 | SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_44100,
@@ -144,6 +145,7 @@ static struct snd_pcm_hardware snd_p16v_capture_hw = {
144 .info = (SNDRV_PCM_INFO_MMAP | 145 .info = (SNDRV_PCM_INFO_MMAP |
145 SNDRV_PCM_INFO_INTERLEAVED | 146 SNDRV_PCM_INFO_INTERLEAVED |
146 SNDRV_PCM_INFO_BLOCK_TRANSFER | 147 SNDRV_PCM_INFO_BLOCK_TRANSFER |
148 SNDRV_PCM_INFO_RESUME |
147 SNDRV_PCM_INFO_MMAP_VALID), 149 SNDRV_PCM_INFO_MMAP_VALID),
148 .formats = SNDRV_PCM_FMTBIT_S32_LE, 150 .formats = SNDRV_PCM_FMTBIT_S32_LE,
149 .rates = SNDRV_PCM_RATE_192000 | SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_44100, 151 .rates = SNDRV_PCM_RATE_192000 | SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_44100,
@@ -611,7 +613,7 @@ int snd_p16v_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm **rpcm)
611 pcm->info_flags = 0; 613 pcm->info_flags = 0;
612 pcm->dev_subclass = SNDRV_PCM_SUBCLASS_GENERIC_MIX; 614 pcm->dev_subclass = SNDRV_PCM_SUBCLASS_GENERIC_MIX;
613 strcpy(pcm->name, "p16v"); 615 strcpy(pcm->name, "p16v");
614 emu->pcm = pcm; 616 emu->pcm_p16v = pcm;
615 617
616 for(substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; 618 for(substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream;
617 substream; 619 substream;
@@ -1030,3 +1032,42 @@ int snd_p16v_mixer(struct snd_emu10k1 *emu)
1030 return 0; 1032 return 0;
1031} 1033}
1032 1034
1035#ifdef CONFIG_PM
1036
1037#define NUM_CHS 1 /* up to 4, but only first channel is used */
1038
1039int __devinit snd_p16v_alloc_pm_buffer(struct snd_emu10k1 *emu)
1040{
1041 emu->p16v_saved = vmalloc(NUM_CHS * 4 * 0x80);
1042 if (! emu->p16v_saved)
1043 return -ENOMEM;
1044 return 0;
1045}
1046
1047void snd_p16v_free_pm_buffer(struct snd_emu10k1 *emu)
1048{
1049 vfree(emu->p16v_saved);
1050}
1051
1052void snd_p16v_suspend(struct snd_emu10k1 *emu)
1053{
1054 int i, ch;
1055 unsigned int *val;
1056
1057 val = emu->p16v_saved;
1058 for (ch = 0; ch < NUM_CHS; ch++)
1059 for (i = 0; i < 0x80; i++, val++)
1060 *val = snd_emu10k1_ptr20_read(emu, i, ch);
1061}
1062
1063void snd_p16v_resume(struct snd_emu10k1 *emu)
1064{
1065 int i, ch;
1066 unsigned int *val;
1067
1068 val = emu->p16v_saved;
1069 for (ch = 0; ch < NUM_CHS; ch++)
1070 for (i = 0; i < 0x80; i++, val++)
1071 snd_emu10k1_ptr20_write(emu, i, ch, *val);
1072}
1073#endif