diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-11-17 10:14:10 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-01-03 06:27:58 -0500 |
commit | 09668b441dacdf4640509b640ad73e24efd5204f (patch) | |
tree | 177d0548acbcca4432f82ce6f3aa397cba5ba528 /sound/pci/emu10k1/emupcm.c | |
parent | fe8be10786c040bce53c18048d75b1b23aec64ae (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/emupcm.c')
-rw-r--r-- | sound/pci/emu10k1/emupcm.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c index 8e6caf581c0c..717e92ec9e0a 100644 --- a/sound/pci/emu10k1/emupcm.c +++ b/sound/pci/emu10k1/emupcm.c | |||
@@ -551,6 +551,7 @@ static struct snd_pcm_hardware snd_emu10k1_efx_playback = | |||
551 | { | 551 | { |
552 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_NONINTERLEAVED | | 552 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_NONINTERLEAVED | |
553 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 553 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
554 | SNDRV_PCM_INFO_RESUME | | ||
554 | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_PAUSE), | 555 | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_PAUSE), |
555 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | 556 | .formats = SNDRV_PCM_FMTBIT_S16_LE, |
556 | .rates = SNDRV_PCM_RATE_48000, | 557 | .rates = SNDRV_PCM_RATE_48000, |
@@ -739,6 +740,7 @@ static int snd_emu10k1_playback_trigger(struct snd_pcm_substream *substream, | |||
739 | snd_emu10k1_playback_invalidate_cache(emu, 0, epcm->voices[0]); | 740 | snd_emu10k1_playback_invalidate_cache(emu, 0, epcm->voices[0]); |
740 | /* follow thru */ | 741 | /* follow thru */ |
741 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | 742 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
743 | case SNDRV_PCM_TRIGGER_RESUME: | ||
742 | mix = &emu->pcm_mixer[substream->number]; | 744 | mix = &emu->pcm_mixer[substream->number]; |
743 | snd_emu10k1_playback_prepare_voice(emu, epcm->voices[0], 1, 0, mix); | 745 | snd_emu10k1_playback_prepare_voice(emu, epcm->voices[0], 1, 0, mix); |
744 | snd_emu10k1_playback_prepare_voice(emu, epcm->voices[1], 0, 0, mix); | 746 | snd_emu10k1_playback_prepare_voice(emu, epcm->voices[1], 0, 0, mix); |
@@ -750,6 +752,7 @@ static int snd_emu10k1_playback_trigger(struct snd_pcm_substream *substream, | |||
750 | break; | 752 | break; |
751 | case SNDRV_PCM_TRIGGER_STOP: | 753 | case SNDRV_PCM_TRIGGER_STOP: |
752 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | 754 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
755 | case SNDRV_PCM_TRIGGER_SUSPEND: | ||
753 | epcm->running = 0; | 756 | epcm->running = 0; |
754 | snd_emu10k1_playback_stop_voice(emu, epcm->voices[0]); | 757 | snd_emu10k1_playback_stop_voice(emu, epcm->voices[0]); |
755 | snd_emu10k1_playback_stop_voice(emu, epcm->voices[1]); | 758 | snd_emu10k1_playback_stop_voice(emu, epcm->voices[1]); |
@@ -774,6 +777,7 @@ static int snd_emu10k1_capture_trigger(struct snd_pcm_substream *substream, | |||
774 | spin_lock(&emu->reg_lock); | 777 | spin_lock(&emu->reg_lock); |
775 | switch (cmd) { | 778 | switch (cmd) { |
776 | case SNDRV_PCM_TRIGGER_START: | 779 | case SNDRV_PCM_TRIGGER_START: |
780 | case SNDRV_PCM_TRIGGER_RESUME: | ||
777 | // hmm this should cause full and half full interrupt to be raised? | 781 | // hmm this should cause full and half full interrupt to be raised? |
778 | outl(epcm->capture_ipr, emu->port + IPR); | 782 | outl(epcm->capture_ipr, emu->port + IPR); |
779 | snd_emu10k1_intr_enable(emu, epcm->capture_inte); | 783 | snd_emu10k1_intr_enable(emu, epcm->capture_inte); |
@@ -797,6 +801,7 @@ static int snd_emu10k1_capture_trigger(struct snd_pcm_substream *substream, | |||
797 | epcm->first_ptr = 1; | 801 | epcm->first_ptr = 1; |
798 | break; | 802 | break; |
799 | case SNDRV_PCM_TRIGGER_STOP: | 803 | case SNDRV_PCM_TRIGGER_STOP: |
804 | case SNDRV_PCM_TRIGGER_SUSPEND: | ||
800 | epcm->running = 0; | 805 | epcm->running = 0; |
801 | snd_emu10k1_intr_disable(emu, epcm->capture_inte); | 806 | snd_emu10k1_intr_disable(emu, epcm->capture_inte); |
802 | outl(epcm->capture_ipr, emu->port + IPR); | 807 | outl(epcm->capture_ipr, emu->port + IPR); |
@@ -871,6 +876,7 @@ static int snd_emu10k1_efx_playback_trigger(struct snd_pcm_substream *substream, | |||
871 | 876 | ||
872 | /* follow thru */ | 877 | /* follow thru */ |
873 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | 878 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
879 | case SNDRV_PCM_TRIGGER_RESUME: | ||
874 | snd_emu10k1_playback_prepare_voice(emu, epcm->extra, 1, 1, NULL); | 880 | snd_emu10k1_playback_prepare_voice(emu, epcm->extra, 1, 1, NULL); |
875 | snd_emu10k1_playback_prepare_voice(emu, epcm->voices[0], 0, 0, | 881 | snd_emu10k1_playback_prepare_voice(emu, epcm->voices[0], 0, 0, |
876 | &emu->efx_pcm_mixer[0]); | 882 | &emu->efx_pcm_mixer[0]); |
@@ -883,6 +889,7 @@ static int snd_emu10k1_efx_playback_trigger(struct snd_pcm_substream *substream, | |||
883 | snd_emu10k1_playback_trigger_voice(emu, epcm->voices[i], 0, 0); | 889 | snd_emu10k1_playback_trigger_voice(emu, epcm->voices[i], 0, 0); |
884 | epcm->running = 1; | 890 | epcm->running = 1; |
885 | break; | 891 | break; |
892 | case SNDRV_PCM_TRIGGER_SUSPEND: | ||
886 | case SNDRV_PCM_TRIGGER_STOP: | 893 | case SNDRV_PCM_TRIGGER_STOP: |
887 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | 894 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
888 | epcm->running = 0; | 895 | epcm->running = 0; |
@@ -925,6 +932,7 @@ static struct snd_pcm_hardware snd_emu10k1_playback = | |||
925 | { | 932 | { |
926 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 933 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
927 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 934 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
935 | SNDRV_PCM_INFO_RESUME | | ||
928 | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_PAUSE), | 936 | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_PAUSE), |
929 | .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, | 937 | .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, |
930 | .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_96000, | 938 | .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_96000, |
@@ -948,6 +956,7 @@ static struct snd_pcm_hardware snd_emu10k1_capture = | |||
948 | { | 956 | { |
949 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 957 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
950 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 958 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
959 | SNDRV_PCM_INFO_RESUME | | ||
951 | SNDRV_PCM_INFO_MMAP_VALID), | 960 | SNDRV_PCM_INFO_MMAP_VALID), |
952 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | 961 | .formats = SNDRV_PCM_FMTBIT_S16_LE, |
953 | .rates = SNDRV_PCM_RATE_8000_48000, | 962 | .rates = SNDRV_PCM_RATE_8000_48000, |
@@ -1309,7 +1318,7 @@ int __devinit snd_emu10k1_pcm_multi(struct snd_emu10k1 * emu, int device, struct | |||
1309 | pcm->info_flags = 0; | 1318 | pcm->info_flags = 0; |
1310 | pcm->dev_subclass = SNDRV_PCM_SUBCLASS_GENERIC_MIX; | 1319 | pcm->dev_subclass = SNDRV_PCM_SUBCLASS_GENERIC_MIX; |
1311 | strcpy(pcm->name, "Multichannel Playback"); | 1320 | strcpy(pcm->name, "Multichannel Playback"); |
1312 | emu->pcm = pcm; | 1321 | emu->pcm_multi = pcm; |
1313 | 1322 | ||
1314 | for (substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; substream; substream = substream->next) | 1323 | for (substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; substream; substream = substream->next) |
1315 | if ((err = snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV_SG, snd_dma_pci_data(emu->pci), 64*1024, 64*1024)) < 0) | 1324 | if ((err = snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV_SG, snd_dma_pci_data(emu->pci), 64*1024, 64*1024)) < 0) |
@@ -1556,6 +1565,7 @@ static int snd_emu10k1_fx8010_playback_trigger(struct snd_pcm_substream *substre | |||
1556 | case SNDRV_PCM_TRIGGER_START: | 1565 | case SNDRV_PCM_TRIGGER_START: |
1557 | /* follow thru */ | 1566 | /* follow thru */ |
1558 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | 1567 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
1568 | case SNDRV_PCM_TRIGGER_RESUME: | ||
1559 | #ifdef EMU10K1_SET_AC3_IEC958 | 1569 | #ifdef EMU10K1_SET_AC3_IEC958 |
1560 | { | 1570 | { |
1561 | int i; | 1571 | int i; |
@@ -1576,6 +1586,7 @@ static int snd_emu10k1_fx8010_playback_trigger(struct snd_pcm_substream *substre | |||
1576 | break; | 1586 | break; |
1577 | case SNDRV_PCM_TRIGGER_STOP: | 1587 | case SNDRV_PCM_TRIGGER_STOP: |
1578 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | 1588 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
1589 | case SNDRV_PCM_TRIGGER_SUSPEND: | ||
1579 | snd_emu10k1_fx8010_unregister_irq_handler(emu, pcm->irq); pcm->irq = NULL; | 1590 | snd_emu10k1_fx8010_unregister_irq_handler(emu, pcm->irq); pcm->irq = NULL; |
1580 | snd_emu10k1_ptr_write(emu, emu->gpr_base + pcm->gpr_trigger, 0, 0); | 1591 | snd_emu10k1_ptr_write(emu, emu->gpr_base + pcm->gpr_trigger, 0, 0); |
1581 | pcm->tram_pos = INITIAL_TRAM_POS(pcm->buffer_size); | 1592 | pcm->tram_pos = INITIAL_TRAM_POS(pcm->buffer_size); |
@@ -1605,6 +1616,7 @@ static snd_pcm_uframes_t snd_emu10k1_fx8010_playback_pointer(struct snd_pcm_subs | |||
1605 | static struct snd_pcm_hardware snd_emu10k1_fx8010_playback = | 1616 | static struct snd_pcm_hardware snd_emu10k1_fx8010_playback = |
1606 | { | 1617 | { |
1607 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 1618 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
1619 | SNDRV_PCM_INFO_RESUME | | ||
1608 | /* SNDRV_PCM_INFO_MMAP_VALID | */ SNDRV_PCM_INFO_PAUSE), | 1620 | /* SNDRV_PCM_INFO_MMAP_VALID | */ SNDRV_PCM_INFO_PAUSE), |
1609 | .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, | 1621 | .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, |
1610 | .rates = SNDRV_PCM_RATE_48000, | 1622 | .rates = SNDRV_PCM_RATE_48000, |