diff options
| author | Takashi Iwai <tiwai@suse.de> | 2011-07-12 11:27:46 -0400 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2011-07-12 11:31:46 -0400 |
| commit | acfa634f7e199193ec28282e82a5a6dd8edebcb7 (patch) | |
| tree | 49193fcf5bb5c21f61d1ff7d8a7e404ce4e774ad /sound | |
| parent | 30b4503378c976cf66201a1e81820519f6bd79ac (diff) | |
ALSA: hda - Add Kconfig for the default buffer size
Add a Kconfig entry to specify the default buffer size.
Distros using PulseAudio can choose a larger value here.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
| -rw-r--r-- | sound/pci/hda/Kconfig | 13 | ||||
| -rw-r--r-- | sound/pci/hda/hda_intel.c | 8 |
2 files changed, 20 insertions, 1 deletions
diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig index 70762fca57ee..1f1a4ae4b791 100644 --- a/sound/pci/hda/Kconfig +++ b/sound/pci/hda/Kconfig | |||
| @@ -14,6 +14,19 @@ menuconfig SND_HDA_INTEL | |||
| 14 | 14 | ||
| 15 | if SND_HDA_INTEL | 15 | if SND_HDA_INTEL |
| 16 | 16 | ||
| 17 | config SND_HDA_PREALLOC_SIZE | ||
| 18 | int "Pre-allocated buffer size for HD-audio driver" | ||
| 19 | range 0 32768 | ||
| 20 | default 64 | ||
| 21 | help | ||
| 22 | Speficies the default pre-allocated buffer-size in kB for | ||
| 23 | HD-audio driver. A larger buffer (e.g. 2048) is preferred | ||
| 24 | for systems with PulseAudio. The default 64 is chosen just | ||
| 25 | from the compatibility reason. | ||
| 26 | |||
| 27 | Note that the pre-allocation size can be changed dynamically | ||
| 28 | via a proc file (/proc/asound/card*/pcm*/sub*/prealloc), too. | ||
| 29 | |||
| 17 | config SND_HDA_HWDEP | 30 | config SND_HDA_HWDEP |
| 18 | bool "Build hwdep interface for HD-audio driver" | 31 | bool "Build hwdep interface for HD-audio driver" |
| 19 | select SND_HWDEP | 32 | select SND_HWDEP |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 25619cd18831..5ce9531cba67 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
| @@ -2075,6 +2075,8 @@ static void azx_pcm_free(struct snd_pcm *pcm) | |||
| 2075 | } | 2075 | } |
| 2076 | } | 2076 | } |
| 2077 | 2077 | ||
| 2078 | #define MAX_PREALLOC_SIZE (32 * 1024 * 1024) | ||
| 2079 | |||
| 2078 | static int | 2080 | static int |
| 2079 | azx_attach_pcm_stream(struct hda_bus *bus, struct hda_codec *codec, | 2081 | azx_attach_pcm_stream(struct hda_bus *bus, struct hda_codec *codec, |
| 2080 | struct hda_pcm *cpcm) | 2082 | struct hda_pcm *cpcm) |
| @@ -2083,6 +2085,7 @@ azx_attach_pcm_stream(struct hda_bus *bus, struct hda_codec *codec, | |||
| 2083 | struct snd_pcm *pcm; | 2085 | struct snd_pcm *pcm; |
| 2084 | struct azx_pcm *apcm; | 2086 | struct azx_pcm *apcm; |
| 2085 | int pcm_dev = cpcm->device; | 2087 | int pcm_dev = cpcm->device; |
| 2088 | unsigned int size; | ||
| 2086 | int s, err; | 2089 | int s, err; |
| 2087 | 2090 | ||
| 2088 | if (pcm_dev >= HDA_MAX_PCMS) { | 2091 | if (pcm_dev >= HDA_MAX_PCMS) { |
| @@ -2118,9 +2121,12 @@ azx_attach_pcm_stream(struct hda_bus *bus, struct hda_codec *codec, | |||
| 2118 | snd_pcm_set_ops(pcm, s, &azx_pcm_ops); | 2121 | snd_pcm_set_ops(pcm, s, &azx_pcm_ops); |
| 2119 | } | 2122 | } |
| 2120 | /* buffer pre-allocation */ | 2123 | /* buffer pre-allocation */ |
| 2124 | size = CONFIG_SND_HDA_PREALLOC_SIZE * 1024; | ||
| 2125 | if (size > MAX_PREALLOC_SIZE) | ||
| 2126 | size = MAX_PREALLOC_SIZE; | ||
| 2121 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, | 2127 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, |
| 2122 | snd_dma_pci_data(chip->pci), | 2128 | snd_dma_pci_data(chip->pci), |
| 2123 | 1024 * 64, 32 * 1024 * 1024); | 2129 | size, MAX_PREALLOC_SIZE); |
| 2124 | return 0; | 2130 | return 0; |
| 2125 | } | 2131 | } |
| 2126 | 2132 | ||
