xref: /openbmc/linux/include/trace/events/spi.h (revision a2818ee4)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM spi
4 
5 #if !defined(_TRACE_SPI_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_SPI_H
7 
8 #include <linux/ktime.h>
9 #include <linux/tracepoint.h>
10 
11 DECLARE_EVENT_CLASS(spi_controller,
12 
13 	TP_PROTO(struct spi_controller *controller),
14 
15 	TP_ARGS(controller),
16 
17 	TP_STRUCT__entry(
18 		__field(        int,           bus_num             )
19 	),
20 
21 	TP_fast_assign(
22 		__entry->bus_num = controller->bus_num;
23 	),
24 
25 	TP_printk("spi%d", (int)__entry->bus_num)
26 
27 );
28 
29 DEFINE_EVENT(spi_controller, spi_controller_idle,
30 
31 	TP_PROTO(struct spi_controller *controller),
32 
33 	TP_ARGS(controller)
34 
35 );
36 
37 DEFINE_EVENT(spi_controller, spi_controller_busy,
38 
39 	TP_PROTO(struct spi_controller *controller),
40 
41 	TP_ARGS(controller)
42 
43 );
44 
45 DECLARE_EVENT_CLASS(spi_message,
46 
47 	TP_PROTO(struct spi_message *msg),
48 
49 	TP_ARGS(msg),
50 
51 	TP_STRUCT__entry(
52 		__field(        int,            bus_num         )
53 		__field(        int,            chip_select     )
54 		__field(        struct spi_message *,   msg     )
55 	),
56 
57 	TP_fast_assign(
58 		__entry->bus_num = msg->spi->controller->bus_num;
59 		__entry->chip_select = msg->spi->chip_select;
60 		__entry->msg = msg;
61 	),
62 
63         TP_printk("spi%d.%d %p", (int)__entry->bus_num,
64 		  (int)__entry->chip_select,
65 		  (struct spi_message *)__entry->msg)
66 );
67 
68 DEFINE_EVENT(spi_message, spi_message_submit,
69 
70 	TP_PROTO(struct spi_message *msg),
71 
72 	TP_ARGS(msg)
73 
74 );
75 
76 DEFINE_EVENT(spi_message, spi_message_start,
77 
78 	TP_PROTO(struct spi_message *msg),
79 
80 	TP_ARGS(msg)
81 
82 );
83 
84 TRACE_EVENT(spi_message_done,
85 
86 	TP_PROTO(struct spi_message *msg),
87 
88 	TP_ARGS(msg),
89 
90 	TP_STRUCT__entry(
91 		__field(        int,            bus_num         )
92 		__field(        int,            chip_select     )
93 		__field(        struct spi_message *,   msg     )
94 		__field(        unsigned,       frame           )
95 		__field(        unsigned,       actual          )
96 	),
97 
98 	TP_fast_assign(
99 		__entry->bus_num = msg->spi->controller->bus_num;
100 		__entry->chip_select = msg->spi->chip_select;
101 		__entry->msg = msg;
102 		__entry->frame = msg->frame_length;
103 		__entry->actual = msg->actual_length;
104 	),
105 
106         TP_printk("spi%d.%d %p len=%u/%u", (int)__entry->bus_num,
107 		  (int)__entry->chip_select,
108 		  (struct spi_message *)__entry->msg,
109                   (unsigned)__entry->actual, (unsigned)__entry->frame)
110 );
111 
112 DECLARE_EVENT_CLASS(spi_transfer,
113 
114 	TP_PROTO(struct spi_message *msg, struct spi_transfer *xfer),
115 
116 	TP_ARGS(msg, xfer),
117 
118 	TP_STRUCT__entry(
119 		__field(        int,            bus_num         )
120 		__field(        int,            chip_select     )
121 		__field(        struct spi_transfer *,   xfer   )
122 		__field(        int,            len             )
123 	),
124 
125 	TP_fast_assign(
126 		__entry->bus_num = msg->spi->controller->bus_num;
127 		__entry->chip_select = msg->spi->chip_select;
128 		__entry->xfer = xfer;
129 		__entry->len = xfer->len;
130 	),
131 
132         TP_printk("spi%d.%d %p len=%d", (int)__entry->bus_num,
133 		  (int)__entry->chip_select,
134 		  (struct spi_message *)__entry->xfer,
135 		  (int)__entry->len)
136 );
137 
138 DEFINE_EVENT(spi_transfer, spi_transfer_start,
139 
140 	TP_PROTO(struct spi_message *msg, struct spi_transfer *xfer),
141 
142 	TP_ARGS(msg, xfer)
143 
144 );
145 
146 DEFINE_EVENT(spi_transfer, spi_transfer_stop,
147 
148 	TP_PROTO(struct spi_message *msg, struct spi_transfer *xfer),
149 
150 	TP_ARGS(msg, xfer)
151 
152 );
153 
154 #endif /* _TRACE_POWER_H */
155 
156 /* This part must be outside protection */
157 #include <trace/define_trace.h>
158