aboutsummaryrefslogtreecommitdiffstats
path: root/include/trace
diff options
context:
space:
mode:
authorAnkit Gupta <ankgupta@codeaurora.org>2015-06-22 18:38:46 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-08-05 15:27:09 -0400
commita9fce374815d8ab94a3e6259802a944e2cc21408 (patch)
tree28f6edf1e905b15f40ac24e17018b54671baa331 /include/trace
parent6497a8757361a88b73fc3814d2ee9b9fc105fa42 (diff)
spmi: add command tracepoints for SPMI
Add tracepoints to retrieve information about read, write and non-data commands. For performance measurement support tracepoints are added at the beginning and at the end of transfers. Following is a list showing the new tracepoint events. The "cmd" parameter here represents the opcode, SID, and full 16-bit address. spmi_write_begin: cmd and data buffer. spmi_write_end : cmd and return value. spmi_read_begin : cmd. spmi_read_end : cmd, return value and data buffer. spmi_cmd : cmd. The reason that cmd appears at both the beginning and at the end event is that SPMI drivers can request commands concurrently. cmd helps in matching the corresponding events. SPMI tracepoints can be enabled like: echo 1 >/sys/kernel/debug/tracing/events/spmi/enable and will dump messages that can be viewed in /sys/kernel/debug/tracing/trace that look like: ... spmi_read_begin: opc=56 sid=00 addr=0x0000 ... spmi_read_end: opc=56 sid=00 addr=0x0000 ret=0 len=02 buf=0x[01-40] ... spmi_write_begin: opc=48 sid=00 addr=0x0000 len=3 buf=0x[ff-ff-ff] Suggested-by: Sagar Dharia <sdharia@codeaurora.org> Acked-by: Steven Rostedt <rostedt@goodmis.org> Reviewed-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Gilad Avidov <gavidov@codeaurora.org> Signed-off-by: Ankit Gupta <ankgupta@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/trace')
-rw-r--r--include/trace/events/spmi.h135
1 files changed, 135 insertions, 0 deletions
diff --git a/include/trace/events/spmi.h b/include/trace/events/spmi.h
new file mode 100644
index 000000000000..62f005ef4c7e
--- /dev/null
+++ b/include/trace/events/spmi.h
@@ -0,0 +1,135 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM spmi
3
4#if !defined(_TRACE_SPMI_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_SPMI_H
6
7#include <linux/spmi.h>
8#include <linux/tracepoint.h>
9
10/*
11 * drivers/spmi/spmi.c
12 */
13
14TRACE_EVENT(spmi_write_begin,
15 TP_PROTO(u8 opcode, u8 sid, u16 addr, u8 len, const u8 *buf),
16 TP_ARGS(opcode, sid, addr, len, buf),
17
18 TP_STRUCT__entry(
19 __field ( u8, opcode )
20 __field ( u8, sid )
21 __field ( u16, addr )
22 __field ( u8, len )
23 __dynamic_array ( u8, buf, len + 1 )
24 ),
25
26 TP_fast_assign(
27 __entry->opcode = opcode;
28 __entry->sid = sid;
29 __entry->addr = addr;
30 __entry->len = len + 1;
31 memcpy(__get_dynamic_array(buf), buf, len + 1);
32 ),
33
34 TP_printk("opc=%d sid=%02d addr=0x%04x len=%d buf=0x[%*phD]",
35 (int)__entry->opcode, (int)__entry->sid,
36 (int)__entry->addr, (int)__entry->len,
37 (int)__entry->len, __get_dynamic_array(buf))
38);
39
40TRACE_EVENT(spmi_write_end,
41 TP_PROTO(u8 opcode, u8 sid, u16 addr, int ret),
42 TP_ARGS(opcode, sid, addr, ret),
43
44 TP_STRUCT__entry(
45 __field ( u8, opcode )
46 __field ( u8, sid )
47 __field ( u16, addr )
48 __field ( int, ret )
49 ),
50
51 TP_fast_assign(
52 __entry->opcode = opcode;
53 __entry->sid = sid;
54 __entry->addr = addr;
55 __entry->ret = ret;
56 ),
57
58 TP_printk("opc=%d sid=%02d addr=0x%04x ret=%d",
59 (int)__entry->opcode, (int)__entry->sid,
60 (int)__entry->addr, __entry->ret)
61);
62
63TRACE_EVENT(spmi_read_begin,
64 TP_PROTO(u8 opcode, u8 sid, u16 addr),
65 TP_ARGS(opcode, sid, addr),
66
67 TP_STRUCT__entry(
68 __field ( u8, opcode )
69 __field ( u8, sid )
70 __field ( u16, addr )
71 ),
72
73 TP_fast_assign(
74 __entry->opcode = opcode;
75 __entry->sid = sid;
76 __entry->addr = addr;
77 ),
78
79 TP_printk("opc=%d sid=%02d addr=0x%04x",
80 (int)__entry->opcode, (int)__entry->sid,
81 (int)__entry->addr)
82);
83
84TRACE_EVENT(spmi_read_end,
85 TP_PROTO(u8 opcode, u8 sid, u16 addr, int ret, u8 len, const u8 *buf),
86 TP_ARGS(opcode, sid, addr, ret, len, buf),
87
88 TP_STRUCT__entry(
89 __field ( u8, opcode )
90 __field ( u8, sid )
91 __field ( u16, addr )
92 __field ( int, ret )
93 __field ( u8, len )
94 __dynamic_array ( u8, buf, len + 1 )
95 ),
96
97 TP_fast_assign(
98 __entry->opcode = opcode;
99 __entry->sid = sid;
100 __entry->addr = addr;
101 __entry->ret = ret;
102 __entry->len = len + 1;
103 memcpy(__get_dynamic_array(buf), buf, len + 1);
104 ),
105
106 TP_printk("opc=%d sid=%02d addr=0x%04x ret=%d len=%02d buf=0x[%*phD]",
107 (int)__entry->opcode, (int)__entry->sid,
108 (int)__entry->addr, __entry->ret, (int)__entry->len,
109 (int)__entry->len, __get_dynamic_array(buf))
110);
111
112TRACE_EVENT(spmi_cmd,
113 TP_PROTO(u8 opcode, u8 sid, int ret),
114 TP_ARGS(opcode, sid, ret),
115
116 TP_STRUCT__entry(
117 __field ( u8, opcode )
118 __field ( u8, sid )
119 __field ( int, ret )
120 ),
121
122 TP_fast_assign(
123 __entry->opcode = opcode;
124 __entry->sid = sid;
125 __entry->ret = ret;
126 ),
127
128 TP_printk("opc=%d sid=%02d ret=%d", (int)__entry->opcode,
129 (int)__entry->sid, ret)
130);
131
132#endif /* _TRACE_SPMI_H */
133
134/* This part must be outside protection */
135#include <trace/define_trace.h>