aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2011-08-02 09:39:31 -0400
committerTakashi Iwai <tiwai@suse.de>2011-08-04 11:02:37 -0400
commitd66fee5d65d947da32783ab0c32511ffe55ff5f3 (patch)
tree7c924a588a9f3683e7ae26ff4f80077ad2d964eb /sound
parentc3540b81ee707bc8a7a83e850adf5feb3b84c04d (diff)
ALSA: hda - Add basic tracepoints
Add a few tracepoints to HD-audio driver. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/Makefile3
-rw-r--r--sound/pci/hda/hda_codec.c11
-rw-r--r--sound/pci/hda/hda_trace.h95
3 files changed, 108 insertions, 1 deletions
diff --git a/sound/pci/hda/Makefile b/sound/pci/hda/Makefile
index 87365d5ea2a9..f928d6634723 100644
--- a/sound/pci/hda/Makefile
+++ b/sound/pci/hda/Makefile
@@ -6,6 +6,9 @@ snd-hda-codec-$(CONFIG_PROC_FS) += hda_proc.o
6snd-hda-codec-$(CONFIG_SND_HDA_HWDEP) += hda_hwdep.o 6snd-hda-codec-$(CONFIG_SND_HDA_HWDEP) += hda_hwdep.o
7snd-hda-codec-$(CONFIG_SND_HDA_INPUT_BEEP) += hda_beep.o 7snd-hda-codec-$(CONFIG_SND_HDA_INPUT_BEEP) += hda_beep.o
8 8
9# for trace-points
10CFLAGS_hda_codec.o := -I$(src)
11
9snd-hda-codec-realtek-objs := patch_realtek.o 12snd-hda-codec-realtek-objs := patch_realtek.o
10snd-hda-codec-cmedia-objs := patch_cmedia.o 13snd-hda-codec-cmedia-objs := patch_cmedia.o
11snd-hda-codec-analog-objs := patch_analog.o 14snd-hda-codec-analog-objs := patch_analog.o
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 3e7850c238c3..e105b653130d 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -34,6 +34,9 @@
34#include "hda_beep.h" 34#include "hda_beep.h"
35#include <sound/hda_hwdep.h> 35#include <sound/hda_hwdep.h>
36 36
37#define CREATE_TRACE_POINTS
38#include "hda_trace.h"
39
37/* 40/*
38 * vendor / preset table 41 * vendor / preset table
39 */ 42 */
@@ -208,15 +211,19 @@ static int codec_exec_verb(struct hda_codec *codec, unsigned int cmd,
208 again: 211 again:
209 snd_hda_power_up(codec); 212 snd_hda_power_up(codec);
210 mutex_lock(&bus->cmd_mutex); 213 mutex_lock(&bus->cmd_mutex);
214 trace_hda_send_cmd(codec, cmd);
211 err = bus->ops.command(bus, cmd); 215 err = bus->ops.command(bus, cmd);
212 if (!err && res) 216 if (!err && res) {
213 *res = bus->ops.get_response(bus, codec->addr); 217 *res = bus->ops.get_response(bus, codec->addr);
218 trace_hda_get_response(codec, *res);
219 }
214 mutex_unlock(&bus->cmd_mutex); 220 mutex_unlock(&bus->cmd_mutex);
215 snd_hda_power_down(codec); 221 snd_hda_power_down(codec);
216 if (res && *res == -1 && bus->rirb_error) { 222 if (res && *res == -1 && bus->rirb_error) {
217 if (bus->response_reset) { 223 if (bus->response_reset) {
218 snd_printd("hda_codec: resetting BUS due to " 224 snd_printd("hda_codec: resetting BUS due to "
219 "fatal communication error\n"); 225 "fatal communication error\n");
226 trace_hda_bus_reset(bus);
220 bus->ops.bus_reset(bus); 227 bus->ops.bus_reset(bus);
221 } 228 }
222 goto again; 229 goto again;
@@ -4083,6 +4090,7 @@ static void hda_power_work(struct work_struct *work)
4083 return; 4090 return;
4084 } 4091 }
4085 4092
4093 trace_hda_power_down(codec);
4086 hda_call_codec_suspend(codec); 4094 hda_call_codec_suspend(codec);
4087 if (bus->ops.pm_notify) 4095 if (bus->ops.pm_notify)
4088 bus->ops.pm_notify(bus); 4096 bus->ops.pm_notify(bus);
@@ -4121,6 +4129,7 @@ void snd_hda_power_up(struct hda_codec *codec)
4121 if (codec->power_on || codec->power_transition) 4129 if (codec->power_on || codec->power_transition)
4122 return; 4130 return;
4123 4131
4132 trace_hda_power_up(codec);
4124 snd_hda_update_power_acct(codec); 4133 snd_hda_update_power_acct(codec);
4125 codec->power_on = 1; 4134 codec->power_on = 1;
4126 codec->power_jiffies = jiffies; 4135 codec->power_jiffies = jiffies;
diff --git a/sound/pci/hda/hda_trace.h b/sound/pci/hda/hda_trace.h
new file mode 100644
index 000000000000..b446cfcf60de
--- /dev/null
+++ b/sound/pci/hda/hda_trace.h
@@ -0,0 +1,95 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM hda
3#define TRACE_INCLUDE_FILE hda_trace
4
5#if !defined(_TRACE_HDA_H) || defined(TRACE_HEADER_MULTI_READ)
6#define _TRACE_HDA_H
7
8#include <linux/tracepoint.h>
9
10struct hda_bus;
11struct hda_codec;
12
13DECLARE_EVENT_CLASS(hda_cmd,
14
15 TP_PROTO(struct hda_codec *codec, unsigned int val),
16
17 TP_ARGS(codec, val),
18
19 TP_STRUCT__entry(
20 __field( unsigned int, card )
21 __field( unsigned int, addr )
22 __field( unsigned int, val )
23 ),
24
25 TP_fast_assign(
26 __entry->card = (codec)->bus->card->number;
27 __entry->addr = (codec)->addr;
28 __entry->val = (val);
29 ),
30
31 TP_printk("[%d:%d] val=%x", __entry->card, __entry->addr, __entry->val)
32);
33
34DEFINE_EVENT(hda_cmd, hda_send_cmd,
35 TP_PROTO(struct hda_codec *codec, unsigned int val),
36 TP_ARGS(codec, val)
37);
38
39DEFINE_EVENT(hda_cmd, hda_get_response,
40 TP_PROTO(struct hda_codec *codec, unsigned int val),
41 TP_ARGS(codec, val)
42);
43
44TRACE_EVENT(hda_bus_reset,
45
46 TP_PROTO(struct hda_bus *bus),
47
48 TP_ARGS(bus),
49
50 TP_STRUCT__entry(
51 __field( unsigned int, card )
52 ),
53
54 TP_fast_assign(
55 __entry->card = (bus)->card->number;
56 ),
57
58 TP_printk("[%d]", __entry->card)
59);
60
61DECLARE_EVENT_CLASS(hda_power,
62
63 TP_PROTO(struct hda_codec *codec),
64
65 TP_ARGS(codec),
66
67 TP_STRUCT__entry(
68 __field( unsigned int, card )
69 __field( unsigned int, addr )
70 ),
71
72 TP_fast_assign(
73 __entry->card = (codec)->bus->card->number;
74 __entry->addr = (codec)->addr;
75 ),
76
77 TP_printk("[%d:%d]", __entry->card, __entry->addr)
78);
79
80DEFINE_EVENT(hda_power, hda_power_down,
81 TP_PROTO(struct hda_codec *codec),
82 TP_ARGS(codec)
83);
84
85DEFINE_EVENT(hda_power, hda_power_up,
86 TP_PROTO(struct hda_codec *codec),
87 TP_ARGS(codec)
88);
89
90#endif /* _TRACE_HDA_H */
91
92/* This part must be outside protection */
93#undef TRACE_INCLUDE_PATH
94#define TRACE_INCLUDE_PATH .
95#include <trace/define_trace.h>