diff options
author | Takashi Iwai <tiwai@suse.de> | 2015-03-10 10:16:28 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-03-23 08:17:58 -0400 |
commit | e311782acd196d17d25b323d115709c50c8f7d3f (patch) | |
tree | afdc50298bdc5fe760bd7f501ce152bcc54b25af | |
parent | c4c2533f802d6877803c4d778def43d8a122f27b (diff) |
ALSA: hda - Re-add tracepoints to HD-audio core driver
Now let's take the basic tracepoints back to the HD-audio driver.
The three bus tracepoints, hda_send_cmd, hda_get_response and
hda_unsol_event are revived but in a slightly different form.
Since we don't assign the card number there, print the bus device name
instead.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/hda/Makefile | 3 | ||||
-rw-r--r-- | sound/hda/hdac_bus.c | 7 | ||||
-rw-r--r-- | sound/hda/trace.c | 6 | ||||
-rw-r--r-- | sound/hda/trace.h | 62 | ||||
-rw-r--r-- | sound/pci/hda/Makefile | 1 | ||||
-rw-r--r-- | sound/pci/hda/hda_trace.h | 119 |
6 files changed, 77 insertions, 121 deletions
diff --git a/sound/hda/Makefile b/sound/hda/Makefile index ae8b5128b5c3..eec5da03b41f 100644 --- a/sound/hda/Makefile +++ b/sound/hda/Makefile | |||
@@ -1,3 +1,6 @@ | |||
1 | snd-hda-core-objs := hda_bus_type.o hdac_bus.o hdac_device.o hdac_sysfs.o | 1 | snd-hda-core-objs := hda_bus_type.o hdac_bus.o hdac_device.o hdac_sysfs.o |
2 | 2 | ||
3 | snd-hda-core-objs += trace.o | ||
4 | CFLAGS_trace.o := -I$(src) | ||
5 | |||
3 | obj-$(CONFIG_SND_HDA_CORE) += snd-hda-core.o | 6 | obj-$(CONFIG_SND_HDA_CORE) += snd-hda-core.o |
diff --git a/sound/hda/hdac_bus.c b/sound/hda/hdac_bus.c index 364f64c0e4a3..8e262da74f6a 100644 --- a/sound/hda/hdac_bus.c +++ b/sound/hda/hdac_bus.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/module.h> | 7 | #include <linux/module.h> |
8 | #include <linux/export.h> | 8 | #include <linux/export.h> |
9 | #include <sound/hdaudio.h> | 9 | #include <sound/hdaudio.h> |
10 | #include "trace.h" | ||
10 | 11 | ||
11 | static void process_unsol_events(struct work_struct *work); | 12 | static void process_unsol_events(struct work_struct *work); |
12 | 13 | ||
@@ -82,6 +83,7 @@ int snd_hdac_bus_exec_verb_unlocked(struct hdac_bus *bus, unsigned int addr, | |||
82 | else if (bus->sync_write) | 83 | else if (bus->sync_write) |
83 | res = &tmp; | 84 | res = &tmp; |
84 | for (;;) { | 85 | for (;;) { |
86 | trace_hda_send_cmd(bus, cmd); | ||
85 | err = bus->ops->command(bus, cmd); | 87 | err = bus->ops->command(bus, cmd); |
86 | if (err != -EAGAIN) | 88 | if (err != -EAGAIN) |
87 | break; | 89 | break; |
@@ -90,8 +92,10 @@ int snd_hdac_bus_exec_verb_unlocked(struct hdac_bus *bus, unsigned int addr, | |||
90 | if (err) | 92 | if (err) |
91 | break; | 93 | break; |
92 | } | 94 | } |
93 | if (!err && res) | 95 | if (!err && res) { |
94 | err = bus->ops->get_response(bus, addr, res); | 96 | err = bus->ops->get_response(bus, addr, res); |
97 | trace_hda_get_response(bus, addr, *res); | ||
98 | } | ||
95 | return err; | 99 | return err; |
96 | } | 100 | } |
97 | EXPORT_SYMBOL_GPL(snd_hdac_bus_exec_verb_unlocked); | 101 | EXPORT_SYMBOL_GPL(snd_hdac_bus_exec_verb_unlocked); |
@@ -113,6 +117,7 @@ void snd_hdac_bus_queue_event(struct hdac_bus *bus, u32 res, u32 res_ex) | |||
113 | if (!bus) | 117 | if (!bus) |
114 | return; | 118 | return; |
115 | 119 | ||
120 | trace_hda_unsol_event(bus, res, res_ex); | ||
116 | wp = (bus->unsol_wp + 1) % HDA_UNSOL_QUEUE_SIZE; | 121 | wp = (bus->unsol_wp + 1) % HDA_UNSOL_QUEUE_SIZE; |
117 | bus->unsol_wp = wp; | 122 | bus->unsol_wp = wp; |
118 | 123 | ||
diff --git a/sound/hda/trace.c b/sound/hda/trace.c new file mode 100644 index 000000000000..ca2d6bd94518 --- /dev/null +++ b/sound/hda/trace.c | |||
@@ -0,0 +1,6 @@ | |||
1 | /* | ||
2 | * tracepoint definitions for HD-audio core drivers | ||
3 | */ | ||
4 | |||
5 | #define CREATE_TRACE_POINTS | ||
6 | #include "trace.h" | ||
diff --git a/sound/hda/trace.h b/sound/hda/trace.h new file mode 100644 index 000000000000..33a7eb5573d4 --- /dev/null +++ b/sound/hda/trace.h | |||
@@ -0,0 +1,62 @@ | |||
1 | #undef TRACE_SYSTEM | ||
2 | #define TRACE_SYSTEM hda | ||
3 | |||
4 | #if !defined(__HDAC_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) | ||
5 | #define __HDAC_TRACE_H | ||
6 | |||
7 | #include <linux/tracepoint.h> | ||
8 | #include <linux/device.h> | ||
9 | #include <sound/hdaudio.h> | ||
10 | |||
11 | #ifndef HDAC_MSG_MAX | ||
12 | #define HDAC_MSG_MAX 500 | ||
13 | #endif | ||
14 | |||
15 | struct hdac_bus; | ||
16 | struct hdac_codec; | ||
17 | |||
18 | TRACE_EVENT(hda_send_cmd, | ||
19 | TP_PROTO(struct hdac_bus *bus, unsigned int cmd), | ||
20 | TP_ARGS(bus, cmd), | ||
21 | TP_STRUCT__entry(__dynamic_array(char, msg, HDAC_MSG_MAX)), | ||
22 | TP_fast_assign( | ||
23 | snprintf(__get_str(msg), HDAC_MSG_MAX, | ||
24 | "[%s:%d] val=0x%08x", | ||
25 | dev_name((bus)->dev), (cmd) >> 28, cmd); | ||
26 | ), | ||
27 | TP_printk("%s", __get_str(msg)) | ||
28 | ); | ||
29 | |||
30 | TRACE_EVENT(hda_get_response, | ||
31 | TP_PROTO(struct hdac_bus *bus, unsigned int addr, unsigned int res), | ||
32 | TP_ARGS(bus, addr, res), | ||
33 | TP_STRUCT__entry(__dynamic_array(char, msg, HDAC_MSG_MAX)), | ||
34 | TP_fast_assign( | ||
35 | snprintf(__get_str(msg), HDAC_MSG_MAX, | ||
36 | "[%s:%d] val=0x%08x", | ||
37 | dev_name((bus)->dev), addr, res); | ||
38 | ), | ||
39 | TP_printk("%s", __get_str(msg)) | ||
40 | ); | ||
41 | |||
42 | TRACE_EVENT(hda_unsol_event, | ||
43 | TP_PROTO(struct hdac_bus *bus, u32 res, u32 res_ex), | ||
44 | TP_ARGS(bus, res, res_ex), | ||
45 | TP_STRUCT__entry(__dynamic_array(char, msg, HDAC_MSG_MAX)), | ||
46 | TP_fast_assign( | ||
47 | snprintf(__get_str(msg), HDAC_MSG_MAX, | ||
48 | "[%s:%d] res=0x%08x, res_ex=0x%08x", | ||
49 | dev_name((bus)->dev), res_ex & 0x0f, res, res_ex); | ||
50 | ), | ||
51 | TP_printk("%s", __get_str(msg)) | ||
52 | ); | ||
53 | #endif /* __HDAC_TRACE_H */ | ||
54 | |||
55 | /* This part must be outside protection */ | ||
56 | #undef TRACE_INCLUDE_PATH | ||
57 | #define TRACE_INCLUDE_PATH . | ||
58 | |||
59 | #undef TRACE_INCLUDE_FILE | ||
60 | #define TRACE_INCLUDE_FILE trace | ||
61 | |||
62 | #include <trace/define_trace.h> | ||
diff --git a/sound/pci/hda/Makefile b/sound/pci/hda/Makefile index 96caaebfc19d..af78fb33a4fd 100644 --- a/sound/pci/hda/Makefile +++ b/sound/pci/hda/Makefile | |||
@@ -10,7 +10,6 @@ snd-hda-codec-$(CONFIG_SND_HDA_HWDEP) += hda_hwdep.o | |||
10 | snd-hda-codec-$(CONFIG_SND_HDA_INPUT_BEEP) += hda_beep.o | 10 | snd-hda-codec-$(CONFIG_SND_HDA_INPUT_BEEP) += hda_beep.o |
11 | 11 | ||
12 | # for trace-points | 12 | # for trace-points |
13 | CFLAGS_hda_codec.o := -I$(src) | ||
14 | CFLAGS_hda_controller.o := -I$(src) | 13 | CFLAGS_hda_controller.o := -I$(src) |
15 | 14 | ||
16 | snd-hda-codec-generic-objs := hda_generic.o | 15 | snd-hda-codec-generic-objs := hda_generic.o |
diff --git a/sound/pci/hda/hda_trace.h b/sound/pci/hda/hda_trace.h deleted file mode 100644 index 7fedfa862419..000000000000 --- a/sound/pci/hda/hda_trace.h +++ /dev/null | |||
@@ -1,119 +0,0 @@ | |||
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 | |||
10 | struct hda_bus; | ||
11 | struct hda_codec; | ||
12 | |||
13 | DECLARE_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)->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 | |||
34 | DEFINE_EVENT(hda_cmd, hda_send_cmd, | ||
35 | TP_PROTO(struct hda_codec *codec, unsigned int val), | ||
36 | TP_ARGS(codec, val) | ||
37 | ); | ||
38 | |||
39 | DEFINE_EVENT(hda_cmd, hda_get_response, | ||
40 | TP_PROTO(struct hda_codec *codec, unsigned int val), | ||
41 | TP_ARGS(codec, val) | ||
42 | ); | ||
43 | |||
44 | TRACE_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 | |||
61 | #ifdef CONFIG_PM | ||
62 | DECLARE_EVENT_CLASS(hda_power, | ||
63 | |||
64 | TP_PROTO(struct hda_codec *codec), | ||
65 | |||
66 | TP_ARGS(codec), | ||
67 | |||
68 | TP_STRUCT__entry( | ||
69 | __field( unsigned int, card ) | ||
70 | __field( unsigned int, addr ) | ||
71 | ), | ||
72 | |||
73 | TP_fast_assign( | ||
74 | __entry->card = (codec)->card->number; | ||
75 | __entry->addr = (codec)->addr; | ||
76 | ), | ||
77 | |||
78 | TP_printk("[%d:%d]", __entry->card, __entry->addr) | ||
79 | ); | ||
80 | |||
81 | DEFINE_EVENT(hda_power, hda_power_down, | ||
82 | TP_PROTO(struct hda_codec *codec), | ||
83 | TP_ARGS(codec) | ||
84 | ); | ||
85 | |||
86 | DEFINE_EVENT(hda_power, hda_power_up, | ||
87 | TP_PROTO(struct hda_codec *codec), | ||
88 | TP_ARGS(codec) | ||
89 | ); | ||
90 | #endif /* CONFIG_PM */ | ||
91 | |||
92 | TRACE_EVENT(hda_unsol_event, | ||
93 | |||
94 | TP_PROTO(struct hda_bus *bus, u32 res, u32 res_ex), | ||
95 | |||
96 | TP_ARGS(bus, res, res_ex), | ||
97 | |||
98 | TP_STRUCT__entry( | ||
99 | __field( unsigned int, card ) | ||
100 | __field( u32, res ) | ||
101 | __field( u32, res_ex ) | ||
102 | ), | ||
103 | |||
104 | TP_fast_assign( | ||
105 | __entry->card = (bus)->card->number; | ||
106 | __entry->res = res; | ||
107 | __entry->res_ex = res_ex; | ||
108 | ), | ||
109 | |||
110 | TP_printk("[%d] res=%x, res_ex=%x", __entry->card, | ||
111 | __entry->res, __entry->res_ex) | ||
112 | ); | ||
113 | |||
114 | #endif /* _TRACE_HDA_H */ | ||
115 | |||
116 | /* This part must be outside protection */ | ||
117 | #undef TRACE_INCLUDE_PATH | ||
118 | #define TRACE_INCLUDE_PATH . | ||
119 | #include <trace/define_trace.h> | ||