aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/Kconfig12
-rw-r--r--sound/core/oss/pcm_oss.c8
-rw-r--r--sound/core/pcm.c12
-rw-r--r--sound/core/pcm_lib.c6
-rw-r--r--sound/core/pcm_memory.c8
5 files changed, 30 insertions, 16 deletions
diff --git a/sound/core/Kconfig b/sound/core/Kconfig
index 8efc1b12f3a8..4262a1c87731 100644
--- a/sound/core/Kconfig
+++ b/sound/core/Kconfig
@@ -142,7 +142,7 @@ config SND_SUPPORT_OLD_API
142 142
143config SND_VERBOSE_PROCFS 143config SND_VERBOSE_PROCFS
144 bool "Verbose procfs contents" 144 bool "Verbose procfs contents"
145 depends on SND 145 depends on SND && PROC_FS
146 default y 146 default y
147 help 147 help
148 Say Y here to include code for verbose procfs contents (provides 148 Say Y here to include code for verbose procfs contents (provides
@@ -171,3 +171,13 @@ config SND_DEBUG_DETECT
171 help 171 help
172 Say Y here to enable extra-verbose log messages printed when 172 Say Y here to enable extra-verbose log messages printed when
173 detecting devices. 173 detecting devices.
174
175config SND_PCM_XRUN_DEBUG
176 bool "Enable PCM ring buffer overrun/underrun debugging"
177 default n
178 depends on SND_DEBUG && SND_VERBOSE_PROCFS
179 help
180 Say Y to enable the PCM ring buffer overrun/underrun debugging.
181 It is usually not required, but if you have trouble with
182 sound clicking when system is loaded, it may help to determine
183 the process or driver which causes the scheduling gaps.
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index c5978d6c6080..ac990bf0b48f 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -1242,6 +1242,8 @@ static int snd_pcm_oss_set_format(struct snd_pcm_oss_file *pcm_oss_file, int for
1242 1242
1243 if (format != AFMT_QUERY) { 1243 if (format != AFMT_QUERY) {
1244 formats = snd_pcm_oss_get_formats(pcm_oss_file); 1244 formats = snd_pcm_oss_get_formats(pcm_oss_file);
1245 if (formats < 0)
1246 return formats;
1245 if (!(formats & format)) 1247 if (!(formats & format))
1246 format = AFMT_U8; 1248 format = AFMT_U8;
1247 for (idx = 1; idx >= 0; --idx) { 1249 for (idx = 1; idx >= 0; --idx) {
@@ -2212,7 +2214,7 @@ static int snd_pcm_oss_mmap(struct file *file, struct vm_area_struct *area)
2212 return 0; 2214 return 0;
2213} 2215}
2214 2216
2215#ifdef CONFIG_PROC_FS 2217#ifdef CONFIG_SND_VERBOSE_PROCFS
2216/* 2218/*
2217 * /proc interface 2219 * /proc interface
2218 */ 2220 */
@@ -2366,10 +2368,10 @@ static void snd_pcm_oss_proc_done(struct snd_pcm *pcm)
2366 } 2368 }
2367 } 2369 }
2368} 2370}
2369#else /* !CONFIG_PROC_FS */ 2371#else /* !CONFIG_SND_VERBOSE_PROCFS */
2370#define snd_pcm_oss_proc_init(pcm) 2372#define snd_pcm_oss_proc_init(pcm)
2371#define snd_pcm_oss_proc_done(pcm) 2373#define snd_pcm_oss_proc_done(pcm)
2372#endif /* CONFIG_PROC_FS */ 2374#endif /* CONFIG_SND_VERBOSE_PROCFS */
2373 2375
2374/* 2376/*
2375 * ENTRY functions 2377 * ENTRY functions
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 122e10a61ab9..84b00038236d 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -142,7 +142,7 @@ static int snd_pcm_control_ioctl(struct snd_card *card,
142 return -ENOIOCTLCMD; 142 return -ENOIOCTLCMD;
143} 143}
144 144
145#if defined(CONFIG_PROC_FS) && defined(CONFIG_SND_VERBOSE_PROCFS) 145#ifdef CONFIG_SND_VERBOSE_PROCFS
146 146
147#define STATE(v) [SNDRV_PCM_STATE_##v] = #v 147#define STATE(v) [SNDRV_PCM_STATE_##v] = #v
148#define STREAM(v) [SNDRV_PCM_STREAM_##v] = #v 148#define STREAM(v) [SNDRV_PCM_STREAM_##v] = #v
@@ -436,7 +436,7 @@ static void snd_pcm_substream_proc_status_read(struct snd_info_entry *entry,
436 snd_iprintf(buffer, "appl_ptr : %ld\n", runtime->control->appl_ptr); 436 snd_iprintf(buffer, "appl_ptr : %ld\n", runtime->control->appl_ptr);
437} 437}
438 438
439#ifdef CONFIG_SND_DEBUG 439#ifdef CONFIG_SND_PCM_XRUN_DEBUG
440static void snd_pcm_xrun_debug_read(struct snd_info_entry *entry, 440static void snd_pcm_xrun_debug_read(struct snd_info_entry *entry,
441 struct snd_info_buffer *buffer) 441 struct snd_info_buffer *buffer)
442{ 442{
@@ -480,7 +480,7 @@ static int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr)
480 } 480 }
481 pstr->proc_info_entry = entry; 481 pstr->proc_info_entry = entry;
482 482
483#ifdef CONFIG_SND_DEBUG 483#ifdef CONFIG_SND_PCM_XRUN_DEBUG
484 if ((entry = snd_info_create_card_entry(pcm->card, "xrun_debug", 484 if ((entry = snd_info_create_card_entry(pcm->card, "xrun_debug",
485 pstr->proc_root)) != NULL) { 485 pstr->proc_root)) != NULL) {
486 entry->c.text.read_size = 64; 486 entry->c.text.read_size = 64;
@@ -501,7 +501,7 @@ static int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr)
501 501
502static int snd_pcm_stream_proc_done(struct snd_pcm_str *pstr) 502static int snd_pcm_stream_proc_done(struct snd_pcm_str *pstr)
503{ 503{
504#ifdef CONFIG_SND_DEBUG 504#ifdef CONFIG_SND_PCM_XRUN_DEBUG
505 if (pstr->proc_xrun_debug_entry) { 505 if (pstr->proc_xrun_debug_entry) {
506 snd_info_unregister(pstr->proc_xrun_debug_entry); 506 snd_info_unregister(pstr->proc_xrun_debug_entry);
507 pstr->proc_xrun_debug_entry = NULL; 507 pstr->proc_xrun_debug_entry = NULL;
@@ -599,12 +599,12 @@ static int snd_pcm_substream_proc_done(struct snd_pcm_substream *substream)
599 } 599 }
600 return 0; 600 return 0;
601} 601}
602#else /* !CONFIG_PROC_FS */ 602#else /* !CONFIG_SND_VERBOSE_PROCFS */
603static inline int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr) { return 0; } 603static inline int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr) { return 0; }
604static inline int snd_pcm_stream_proc_done(struct snd_pcm_str *pstr) { return 0; } 604static inline int snd_pcm_stream_proc_done(struct snd_pcm_str *pstr) { return 0; }
605static inline int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream) { return 0; } 605static inline int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream) { return 0; }
606static inline int snd_pcm_substream_proc_done(struct snd_pcm_substream *substream) { return 0; } 606static inline int snd_pcm_substream_proc_done(struct snd_pcm_substream *substream) { return 0; }
607#endif /* CONFIG_PROC_FS */ 607#endif /* CONFIG_SND_VERBOSE_PROCFS */
608 608
609/** 609/**
610 * snd_pcm_new_stream - create a new PCM stream 610 * snd_pcm_new_stream - create a new PCM stream
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index 230a940d00bd..eedc6cb038bb 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -130,7 +130,7 @@ void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_ufram
130static void xrun(struct snd_pcm_substream *substream) 130static void xrun(struct snd_pcm_substream *substream)
131{ 131{
132 snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN); 132 snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN);
133#ifdef CONFIG_SND_DEBUG 133#ifdef CONFIG_SND_PCM_XRUN_DEBUG
134 if (substream->pstr->xrun_debug) { 134 if (substream->pstr->xrun_debug) {
135 snd_printd(KERN_DEBUG "XRUN: pcmC%dD%d%c\n", 135 snd_printd(KERN_DEBUG "XRUN: pcmC%dD%d%c\n",
136 substream->pcm->card->number, 136 substream->pcm->card->number,
@@ -204,7 +204,7 @@ static inline int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *subs
204 delta = hw_ptr_interrupt - new_hw_ptr; 204 delta = hw_ptr_interrupt - new_hw_ptr;
205 if (delta > 0) { 205 if (delta > 0) {
206 if ((snd_pcm_uframes_t)delta < runtime->buffer_size / 2) { 206 if ((snd_pcm_uframes_t)delta < runtime->buffer_size / 2) {
207#ifdef CONFIG_SND_DEBUG 207#ifdef CONFIG_SND_PCM_XRUN_DEBUG
208 if (runtime->periods > 1 && substream->pstr->xrun_debug) { 208 if (runtime->periods > 1 && substream->pstr->xrun_debug) {
209 snd_printd(KERN_ERR "Unexpected hw_pointer value [1] (stream = %i, delta: -%ld, max jitter = %ld): wrong interrupt acknowledge?\n", substream->stream, (long) delta, runtime->buffer_size / 2); 209 snd_printd(KERN_ERR "Unexpected hw_pointer value [1] (stream = %i, delta: -%ld, max jitter = %ld): wrong interrupt acknowledge?\n", substream->stream, (long) delta, runtime->buffer_size / 2);
210 if (substream->pstr->xrun_debug > 1) 210 if (substream->pstr->xrun_debug > 1)
@@ -249,7 +249,7 @@ int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream)
249 delta = old_hw_ptr - new_hw_ptr; 249 delta = old_hw_ptr - new_hw_ptr;
250 if (delta > 0) { 250 if (delta > 0) {
251 if ((snd_pcm_uframes_t)delta < runtime->buffer_size / 2) { 251 if ((snd_pcm_uframes_t)delta < runtime->buffer_size / 2) {
252#ifdef CONFIG_SND_DEBUG 252#ifdef CONFIG_SND_PCM_XRUN_DEBUG
253 if (runtime->periods > 2 && substream->pstr->xrun_debug) { 253 if (runtime->periods > 2 && substream->pstr->xrun_debug) {
254 snd_printd(KERN_ERR "Unexpected hw_pointer value [2] (stream = %i, delta: -%ld, max jitter = %ld): wrong interrupt acknowledge?\n", substream->stream, (long) delta, runtime->buffer_size / 2); 254 snd_printd(KERN_ERR "Unexpected hw_pointer value [2] (stream = %i, delta: -%ld, max jitter = %ld): wrong interrupt acknowledge?\n", substream->stream, (long) delta, runtime->buffer_size / 2);
255 if (substream->pstr->xrun_debug > 1) 255 if (substream->pstr->xrun_debug > 1)
diff --git a/sound/core/pcm_memory.c b/sound/core/pcm_memory.c
index a0119ae67dcd..428f8c169ee1 100644
--- a/sound/core/pcm_memory.c
+++ b/sound/core/pcm_memory.c
@@ -100,8 +100,10 @@ static void snd_pcm_lib_preallocate_dma_free(struct snd_pcm_substream *substream
100int snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream) 100int 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 snd_info_unregister(substream->proc_prealloc_entry); 104 snd_info_unregister(substream->proc_prealloc_entry);
104 substream->proc_prealloc_entry = NULL; 105 substream->proc_prealloc_entry = NULL;
106#endif
105 return 0; 107 return 0;
106} 108}
107 109
@@ -124,7 +126,7 @@ int snd_pcm_lib_preallocate_free_for_all(struct snd_pcm *pcm)
124 return 0; 126 return 0;
125} 127}
126 128
127#ifdef CONFIG_PROC_FS 129#ifdef CONFIG_SND_VERBOSE_PROCFS
128/* 130/*
129 * read callback for prealloc proc file 131 * read callback for prealloc proc file
130 * 132 *
@@ -203,9 +205,9 @@ static inline void preallocate_info_init(struct snd_pcm_substream *substream)
203 substream->proc_prealloc_entry = entry; 205 substream->proc_prealloc_entry = entry;
204} 206}
205 207
206#else /* !CONFIG_PROC_FS */ 208#else /* !CONFIG_SND_VERBOSE_PROCFS */
207#define preallocate_info_init(s) 209#define preallocate_info_init(s)
208#endif 210#endif /* CONFIG_SND_VERBOSE_PROCFS */
209 211
210/* 212/*
211 * pre-allocate the buffer and create a proc file for the substream 213 * pre-allocate the buffer and create a proc file for the substream