aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-10-16 09:10:08 -0400
committerTakashi Iwai <tiwai@suse.de>2012-10-30 05:39:59 -0400
commit1a8506d4402b6e96c2ed778dc7ccbb48d1e02fce (patch)
tree23172e90d10c71f3b4bb20eec44b90f150c28f09
parent4ee3bffca4fad13a4cb672158dce0def41ab3a54 (diff)
ALSA: hda - Add tracepoints to HD-audio controller driver
Add a couple of tracepoints to snd-hda-intel for tracing the position and the trigger timings. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/Makefile1
-rw-r--r--sound/pci/hda/hda_intel.c9
-rw-r--r--sound/pci/hda/hda_intel_trace.h62
3 files changed, 71 insertions, 1 deletions
diff --git a/sound/pci/hda/Makefile b/sound/pci/hda/Makefile
index bd4149f1aaf4..24a251497a1f 100644
--- a/sound/pci/hda/Makefile
+++ b/sound/pci/hda/Makefile
@@ -8,6 +8,7 @@ snd-hda-codec-$(CONFIG_SND_HDA_INPUT_BEEP) += hda_beep.o
8 8
9# for trace-points 9# for trace-points
10CFLAGS_hda_codec.o := -I$(src) 10CFLAGS_hda_codec.o := -I$(src)
11CFLAGS_hda_intel.o := -I$(src)
11 12
12snd-hda-codec-realtek-objs := patch_realtek.o 13snd-hda-codec-realtek-objs := patch_realtek.o
13snd-hda-codec-cmedia-objs := patch_cmedia.o 14snd-hda-codec-cmedia-objs := patch_cmedia.o
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index d96a14e1fa95..d7481f0c194a 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -527,6 +527,9 @@ struct azx {
527 struct list_head list; 527 struct list_head list;
528}; 528};
529 529
530#define CREATE_TRACE_POINTS
531#include "hda_intel_trace.h"
532
530/* driver types */ 533/* driver types */
531enum { 534enum {
532 AZX_DRIVER_ICH, 535 AZX_DRIVER_ICH,
@@ -2059,6 +2062,9 @@ static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
2059 int rstart = 0, start, nsync = 0, sbits = 0; 2062 int rstart = 0, start, nsync = 0, sbits = 0;
2060 int nwait, timeout; 2063 int nwait, timeout;
2061 2064
2065 azx_dev = get_azx_dev(substream);
2066 trace_azx_pcm_trigger(chip, azx_dev, cmd);
2067
2062 switch (cmd) { 2068 switch (cmd) {
2063 case SNDRV_PCM_TRIGGER_START: 2069 case SNDRV_PCM_TRIGGER_START:
2064 rstart = 1; 2070 rstart = 1;
@@ -2231,6 +2237,7 @@ static unsigned int azx_get_position(struct azx *chip,
2231{ 2237{
2232 unsigned int pos; 2238 unsigned int pos;
2233 int stream = azx_dev->substream->stream; 2239 int stream = azx_dev->substream->stream;
2240 int delay = 0;
2234 2241
2235 switch (chip->position_fix[stream]) { 2242 switch (chip->position_fix[stream]) {
2236 case POS_FIX_LPIB: 2243 case POS_FIX_LPIB:
@@ -2264,7 +2271,6 @@ static unsigned int azx_get_position(struct azx *chip,
2264 chip->position_fix[stream] == POS_FIX_POSBUF && 2271 chip->position_fix[stream] == POS_FIX_POSBUF &&
2265 (chip->driver_caps & AZX_DCAPS_COUNT_LPIB_DELAY)) { 2272 (chip->driver_caps & AZX_DCAPS_COUNT_LPIB_DELAY)) {
2266 unsigned int lpib_pos = azx_sd_readl(azx_dev, SD_LPIB); 2273 unsigned int lpib_pos = azx_sd_readl(azx_dev, SD_LPIB);
2267 int delay;
2268 if (stream == SNDRV_PCM_STREAM_PLAYBACK) 2274 if (stream == SNDRV_PCM_STREAM_PLAYBACK)
2269 delay = pos - lpib_pos; 2275 delay = pos - lpib_pos;
2270 else 2276 else
@@ -2279,6 +2285,7 @@ static unsigned int azx_get_position(struct azx *chip,
2279 azx_dev->substream->runtime->delay = 2285 azx_dev->substream->runtime->delay =
2280 bytes_to_frames(azx_dev->substream->runtime, delay); 2286 bytes_to_frames(azx_dev->substream->runtime, delay);
2281 } 2287 }
2288 trace_azx_get_position(chip, azx_dev, pos, delay);
2282 return pos; 2289 return pos;
2283} 2290}
2284 2291
diff --git a/sound/pci/hda/hda_intel_trace.h b/sound/pci/hda/hda_intel_trace.h
new file mode 100644
index 000000000000..7b5e4c2cf9d5
--- /dev/null
+++ b/sound/pci/hda/hda_intel_trace.h
@@ -0,0 +1,62 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM hda_intel
3#define TRACE_INCLUDE_FILE hda_intel_trace
4
5#if !defined(_TRACE_HDA_INTEL_H) || defined(TRACE_HEADER_MULTI_READ)
6#define _TRACE_HDA_INTEL_H
7
8#include <linux/tracepoint.h>
9
10struct azx;
11struct azx_dev;
12
13TRACE_EVENT(azx_pcm_trigger,
14
15 TP_PROTO(struct azx *chip, struct azx_dev *dev, int cmd),
16
17 TP_ARGS(chip, dev, cmd),
18
19 TP_STRUCT__entry(
20 __field( int, card )
21 __field( int, idx )
22 __field( int, cmd )
23 ),
24
25 TP_fast_assign(
26 __entry->card = (chip)->card->number;
27 __entry->idx = (dev)->index;
28 __entry->cmd = cmd;
29 ),
30
31 TP_printk("[%d:%d] cmd=%d", __entry->card, __entry->idx, __entry->cmd)
32);
33
34TRACE_EVENT(azx_get_position,
35
36 TP_PROTO(struct azx *chip, struct azx_dev *dev, unsigned int pos, unsigned int delay),
37
38 TP_ARGS(chip, dev, pos, delay),
39
40 TP_STRUCT__entry(
41 __field( int, card )
42 __field( int, idx )
43 __field( unsigned int, pos )
44 __field( unsigned int, delay )
45 ),
46
47 TP_fast_assign(
48 __entry->card = (chip)->card->number;
49 __entry->idx = (dev)->index;
50 __entry->pos = pos;
51 __entry->delay = delay;
52 ),
53
54 TP_printk("[%d:%d] pos=%u, delay=%u", __entry->card, __entry->idx, __entry->pos, __entry->delay)
55);
56
57#endif /* _TRACE_HDA_INTEL_H */
58
59/* This part must be outside protection */
60#undef TRACE_INCLUDE_PATH
61#define TRACE_INCLUDE_PATH .
62#include <trace/define_trace.h>