diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2008-05-13 03:25:39 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-05-19 07:19:17 -0400 |
commit | d55d7a1cbbd069f8368ec5c67480d319e7b227b9 (patch) | |
tree | f528815be38cf942c2e6030e1b3017ab84c800b1 /sound/pci/oxygen/oxygen_pcm.c | |
parent | 4a4bc53bc52978dd6c918531921da925fd047d95 (diff) |
[ALSA] oxygen: add symbols for buffer/period size constraints
Introduce symbols for the buffer/period size constraints so that their
limits and relationships become clearer.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/pci/oxygen/oxygen_pcm.c')
-rw-r--r-- | sound/pci/oxygen/oxygen_pcm.c | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/sound/pci/oxygen/oxygen_pcm.c b/sound/pci/oxygen/oxygen_pcm.c index 9680aa35f81f..09a16e459de9 100644 --- a/sound/pci/oxygen/oxygen_pcm.c +++ b/sound/pci/oxygen/oxygen_pcm.c | |||
@@ -24,6 +24,16 @@ | |||
24 | #include <sound/pcm_params.h> | 24 | #include <sound/pcm_params.h> |
25 | #include "oxygen.h" | 25 | #include "oxygen.h" |
26 | 26 | ||
27 | /* most DMA channels have a 16-bit counter for 32-bit words */ | ||
28 | #define BUFFER_BYTES_MAX ((1 << 16) * 4) | ||
29 | /* the multichannel DMA channel has a 24-bit counter */ | ||
30 | #define BUFFER_BYTES_MAX_MULTICH ((1 << 24) * 4) | ||
31 | |||
32 | #define PERIOD_BYTES_MIN 64 | ||
33 | |||
34 | #define DEFAULT_BUFFER_BYTES (BUFFER_BYTES_MAX / 2) | ||
35 | #define DEFAULT_BUFFER_BYTES_MULTICH (1024 * 1024) | ||
36 | |||
27 | static const struct snd_pcm_hardware oxygen_stereo_hardware = { | 37 | static const struct snd_pcm_hardware oxygen_stereo_hardware = { |
28 | .info = SNDRV_PCM_INFO_MMAP | | 38 | .info = SNDRV_PCM_INFO_MMAP | |
29 | SNDRV_PCM_INFO_MMAP_VALID | | 39 | SNDRV_PCM_INFO_MMAP_VALID | |
@@ -44,11 +54,11 @@ static const struct snd_pcm_hardware oxygen_stereo_hardware = { | |||
44 | .rate_max = 192000, | 54 | .rate_max = 192000, |
45 | .channels_min = 2, | 55 | .channels_min = 2, |
46 | .channels_max = 2, | 56 | .channels_max = 2, |
47 | .buffer_bytes_max = 256 * 1024, | 57 | .buffer_bytes_max = BUFFER_BYTES_MAX, |
48 | .period_bytes_min = 128, | 58 | .period_bytes_min = PERIOD_BYTES_MIN, |
49 | .period_bytes_max = 128 * 1024, | 59 | .period_bytes_max = BUFFER_BYTES_MAX / 2, |
50 | .periods_min = 2, | 60 | .periods_min = 2, |
51 | .periods_max = 2048, | 61 | .periods_max = BUFFER_BYTES_MAX / PERIOD_BYTES_MIN, |
52 | }; | 62 | }; |
53 | static const struct snd_pcm_hardware oxygen_multichannel_hardware = { | 63 | static const struct snd_pcm_hardware oxygen_multichannel_hardware = { |
54 | .info = SNDRV_PCM_INFO_MMAP | | 64 | .info = SNDRV_PCM_INFO_MMAP | |
@@ -70,11 +80,11 @@ static const struct snd_pcm_hardware oxygen_multichannel_hardware = { | |||
70 | .rate_max = 192000, | 80 | .rate_max = 192000, |
71 | .channels_min = 2, | 81 | .channels_min = 2, |
72 | .channels_max = 8, | 82 | .channels_max = 8, |
73 | .buffer_bytes_max = 2048 * 1024, | 83 | .buffer_bytes_max = BUFFER_BYTES_MAX_MULTICH, |
74 | .period_bytes_min = 128, | 84 | .period_bytes_min = PERIOD_BYTES_MIN, |
75 | .period_bytes_max = 256 * 1024, | 85 | .period_bytes_max = BUFFER_BYTES_MAX_MULTICH / 2, |
76 | .periods_min = 2, | 86 | .periods_min = 2, |
77 | .periods_max = 16384, | 87 | .periods_max = BUFFER_BYTES_MAX_MULTICH / PERIOD_BYTES_MIN, |
78 | }; | 88 | }; |
79 | static const struct snd_pcm_hardware oxygen_ac97_hardware = { | 89 | static const struct snd_pcm_hardware oxygen_ac97_hardware = { |
80 | .info = SNDRV_PCM_INFO_MMAP | | 90 | .info = SNDRV_PCM_INFO_MMAP | |
@@ -88,11 +98,11 @@ static const struct snd_pcm_hardware oxygen_ac97_hardware = { | |||
88 | .rate_max = 48000, | 98 | .rate_max = 48000, |
89 | .channels_min = 2, | 99 | .channels_min = 2, |
90 | .channels_max = 2, | 100 | .channels_max = 2, |
91 | .buffer_bytes_max = 256 * 1024, | 101 | .buffer_bytes_max = BUFFER_BYTES_MAX, |
92 | .period_bytes_min = 128, | 102 | .period_bytes_min = PERIOD_BYTES_MIN, |
93 | .period_bytes_max = 128 * 1024, | 103 | .period_bytes_max = BUFFER_BYTES_MAX / 2, |
94 | .periods_min = 2, | 104 | .periods_min = 2, |
95 | .periods_max = 2048, | 105 | .periods_max = BUFFER_BYTES_MAX / PERIOD_BYTES_MIN, |
96 | }; | 106 | }; |
97 | 107 | ||
98 | static const struct snd_pcm_hardware *const oxygen_hardware[PCM_COUNT] = { | 108 | static const struct snd_pcm_hardware *const oxygen_hardware[PCM_COUNT] = { |
@@ -664,12 +674,14 @@ int oxygen_pcm_init(struct oxygen *chip) | |||
664 | snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream, | 674 | snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream, |
665 | SNDRV_DMA_TYPE_DEV, | 675 | SNDRV_DMA_TYPE_DEV, |
666 | snd_dma_pci_data(chip->pci), | 676 | snd_dma_pci_data(chip->pci), |
667 | 512 * 1024, 2048 * 1024); | 677 | DEFAULT_BUFFER_BYTES_MULTICH, |
678 | BUFFER_BYTES_MAX_MULTICH); | ||
668 | if (ins) | 679 | if (ins) |
669 | snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream, | 680 | snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream, |
670 | SNDRV_DMA_TYPE_DEV, | 681 | SNDRV_DMA_TYPE_DEV, |
671 | snd_dma_pci_data(chip->pci), | 682 | snd_dma_pci_data(chip->pci), |
672 | 128 * 1024, 256 * 1024); | 683 | DEFAULT_BUFFER_BYTES, |
684 | BUFFER_BYTES_MAX); | ||
673 | } | 685 | } |
674 | 686 | ||
675 | outs = !!(chip->model->pcm_dev_cfg & PLAYBACK_1_TO_SPDIF); | 687 | outs = !!(chip->model->pcm_dev_cfg & PLAYBACK_1_TO_SPDIF); |
@@ -689,7 +701,8 @@ int oxygen_pcm_init(struct oxygen *chip) | |||
689 | strcpy(pcm->name, "Digital"); | 701 | strcpy(pcm->name, "Digital"); |
690 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 702 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
691 | snd_dma_pci_data(chip->pci), | 703 | snd_dma_pci_data(chip->pci), |
692 | 128 * 1024, 256 * 1024); | 704 | DEFAULT_BUFFER_BYTES, |
705 | BUFFER_BYTES_MAX); | ||
693 | } | 706 | } |
694 | 707 | ||
695 | if (chip->has_ac97_1) { | 708 | if (chip->has_ac97_1) { |
@@ -719,7 +732,8 @@ int oxygen_pcm_init(struct oxygen *chip) | |||
719 | strcpy(pcm->name, outs ? "Front Panel" : "Analog 2"); | 732 | strcpy(pcm->name, outs ? "Front Panel" : "Analog 2"); |
720 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 733 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
721 | snd_dma_pci_data(chip->pci), | 734 | snd_dma_pci_data(chip->pci), |
722 | 128 * 1024, 256 * 1024); | 735 | DEFAULT_BUFFER_BYTES, |
736 | BUFFER_BYTES_MAX); | ||
723 | } | 737 | } |
724 | return 0; | 738 | return 0; |
725 | } | 739 | } |