diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-07-23 05:04:13 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-07-23 05:09:03 -0400 |
commit | cedb8118e8cef21a2b73fd9cb70660ac19124c16 (patch) | |
tree | 080bc68c721b8ed24ebff7c809b7e74f6959148f | |
parent | 79452f0a28aa5a40522c487b42a5fc423647ad98 (diff) |
ALSA: pcm - Add logging of hwptr updates and interrupt updates
Added the logging functionality to xrun_debug to record the hwptr
updates via snd_pcm_update_hw_ptr() and snd_pcm_update_hwptr_interrupt(),
corresponding to 16 and 8, respectively.
For example,
# echo 9 > /proc/asound/card0/pcm0p/xrun_debug
will record the position and other parameters at each period interrupt
together with the normal XRUN debugging.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | Documentation/sound/alsa/Procfile.txt | 5 | ||||
-rw-r--r-- | sound/core/pcm_lib.c | 25 |
2 files changed, 30 insertions, 0 deletions
diff --git a/Documentation/sound/alsa/Procfile.txt b/Documentation/sound/alsa/Procfile.txt index 381908d8ca42..719a819f8cc2 100644 --- a/Documentation/sound/alsa/Procfile.txt +++ b/Documentation/sound/alsa/Procfile.txt | |||
@@ -101,6 +101,8 @@ card*/pcm*/xrun_debug | |||
101 | bit 0 = Enable XRUN/jiffies debug messages | 101 | bit 0 = Enable XRUN/jiffies debug messages |
102 | bit 1 = Show stack trace at XRUN / jiffies check | 102 | bit 1 = Show stack trace at XRUN / jiffies check |
103 | bit 2 = Enable additional jiffies check | 103 | bit 2 = Enable additional jiffies check |
104 | bit 3 = Log hwptr update at each period interrupt | ||
105 | bit 4 = Log hwptr update at each snd_pcm_update_hw_ptr() | ||
104 | 106 | ||
105 | When the bit 0 is set, the driver will show the messages to | 107 | When the bit 0 is set, the driver will show the messages to |
106 | kernel log when an xrun is detected. The debug message is | 108 | kernel log when an xrun is detected. The debug message is |
@@ -117,6 +119,9 @@ card*/pcm*/xrun_debug | |||
117 | buggy) hardware that doesn't give smooth pointer updates. | 119 | buggy) hardware that doesn't give smooth pointer updates. |
118 | This feature is enabled via the bit 2. | 120 | This feature is enabled via the bit 2. |
119 | 121 | ||
122 | Bits 3 and 4 are for logging the hwptr records. Note that | ||
123 | these will give flood of kernel messages. | ||
124 | |||
120 | card*/pcm*/sub*/info | 125 | card*/pcm*/sub*/info |
121 | The general information of this PCM sub-stream. | 126 | The general information of this PCM sub-stream. |
122 | 127 | ||
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 3b673e2f991d..065eaf0a386c 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c | |||
@@ -233,6 +233,18 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream) | |||
233 | xrun(substream); | 233 | xrun(substream); |
234 | return -EPIPE; | 234 | return -EPIPE; |
235 | } | 235 | } |
236 | if (xrun_debug(substream, 8)) { | ||
237 | char name[16]; | ||
238 | pcm_debug_name(substream, name, sizeof(name)); | ||
239 | snd_printd("period_update: %s: pos=0x%x/0x%x/0x%x, " | ||
240 | "hwptr=0x%lx, hw_base=0x%lx, hw_intr=0x%lx\n", | ||
241 | name, pos, | ||
242 | (int)runtime->period_size, | ||
243 | (int)runtime->buffer_size, | ||
244 | (long)old_hw_ptr, | ||
245 | (long)runtime->hw_ptr_base, | ||
246 | (long)runtime->hw_ptr_interrupt); | ||
247 | } | ||
236 | hw_base = runtime->hw_ptr_base; | 248 | hw_base = runtime->hw_ptr_base; |
237 | new_hw_ptr = hw_base + pos; | 249 | new_hw_ptr = hw_base + pos; |
238 | hw_ptr_interrupt = runtime->hw_ptr_interrupt + runtime->period_size; | 250 | hw_ptr_interrupt = runtime->hw_ptr_interrupt + runtime->period_size; |
@@ -353,6 +365,19 @@ int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream) | |||
353 | xrun(substream); | 365 | xrun(substream); |
354 | return -EPIPE; | 366 | return -EPIPE; |
355 | } | 367 | } |
368 | if (xrun_debug(substream, 16)) { | ||
369 | char name[16]; | ||
370 | pcm_debug_name(substream, name, sizeof(name)); | ||
371 | snd_printd("hw_update: %s: pos=0x%x/0x%x/0x%x, " | ||
372 | "hwptr=0x%lx, hw_base=0x%lx, hw_intr=0x%lx\n", | ||
373 | name, pos, | ||
374 | (int)runtime->period_size, | ||
375 | (int)runtime->buffer_size, | ||
376 | (long)old_hw_ptr, | ||
377 | (long)runtime->hw_ptr_base, | ||
378 | (long)runtime->hw_ptr_interrupt); | ||
379 | } | ||
380 | |||
356 | hw_base = runtime->hw_ptr_base; | 381 | hw_base = runtime->hw_ptr_base; |
357 | new_hw_ptr = hw_base + pos; | 382 | new_hw_ptr = hw_base + pos; |
358 | 383 | ||