aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/pcm.h1
-rw-r--r--sound/core/pcm_memory.c23
2 files changed, 24 insertions, 0 deletions
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 016c41893b06..ec006ed8cd59 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -384,6 +384,7 @@ struct snd_pcm_substream {
384 struct snd_info_entry *proc_sw_params_entry; 384 struct snd_info_entry *proc_sw_params_entry;
385 struct snd_info_entry *proc_status_entry; 385 struct snd_info_entry *proc_status_entry;
386 struct snd_info_entry *proc_prealloc_entry; 386 struct snd_info_entry *proc_prealloc_entry;
387 struct snd_info_entry *proc_prealloc_max_entry;
387#endif 388#endif
388 /* misc flags */ 389 /* misc flags */
389 unsigned int hw_opened: 1; 390 unsigned int hw_opened: 1;
diff --git a/sound/core/pcm_memory.c b/sound/core/pcm_memory.c
index be030cb4d373..95b1b2f0b1e2 100644
--- a/sound/core/pcm_memory.c
+++ b/sound/core/pcm_memory.c
@@ -101,6 +101,8 @@ int snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream)
101{ 101{
102 snd_pcm_lib_preallocate_dma_free(substream); 102 snd_pcm_lib_preallocate_dma_free(substream);
103#ifdef CONFIG_SND_VERBOSE_PROCFS 103#ifdef CONFIG_SND_VERBOSE_PROCFS
104 snd_info_free_entry(substream->proc_prealloc_max_entry);
105 substream->proc_prealloc_max_entry = NULL;
104 snd_info_free_entry(substream->proc_prealloc_entry); 106 snd_info_free_entry(substream->proc_prealloc_entry);
105 substream->proc_prealloc_entry = NULL; 107 substream->proc_prealloc_entry = NULL;
106#endif 108#endif
@@ -142,6 +144,18 @@ static void snd_pcm_lib_preallocate_proc_read(struct snd_info_entry *entry,
142} 144}
143 145
144/* 146/*
147 * read callback for prealloc_max proc file
148 *
149 * prints the maximum allowed size in kB.
150 */
151static void snd_pcm_lib_preallocate_max_proc_read(struct snd_info_entry *entry,
152 struct snd_info_buffer *buffer)
153{
154 struct snd_pcm_substream *substream = entry->private_data;
155 snd_iprintf(buffer, "%lu\n", (unsigned long) substream->dma_max / 1024);
156}
157
158/*
145 * write callback for prealloc proc file 159 * write callback for prealloc proc file
146 * 160 *
147 * accepts the preallocation size in kB. 161 * accepts the preallocation size in kB.
@@ -203,6 +217,15 @@ static inline void preallocate_info_init(struct snd_pcm_substream *substream)
203 } 217 }
204 } 218 }
205 substream->proc_prealloc_entry = entry; 219 substream->proc_prealloc_entry = entry;
220 if ((entry = snd_info_create_card_entry(substream->pcm->card, "prealloc_max", substream->proc_root)) != NULL) {
221 entry->c.text.read = snd_pcm_lib_preallocate_max_proc_read;
222 entry->private_data = substream;
223 if (snd_info_register(entry) < 0) {
224 snd_info_free_entry(entry);
225 entry = NULL;
226 }
227 }
228 substream->proc_prealloc_max_entry = entry;
206} 229}
207 230
208#else /* !CONFIG_SND_VERBOSE_PROCFS */ 231#else /* !CONFIG_SND_VERBOSE_PROCFS */