]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blob - include/trace/events/i2c.h
Merge tag 'imx-fixes-5.15-4' of git://git.kernel.org/pub/scm/linux/kernel/git/shawngu...
[mirror_ubuntu-jammy-kernel.git] / include / trace / events / i2c.h
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /* I2C message transfer tracepoints
3 *
4 * Copyright (C) 2013 Red Hat, Inc. All Rights Reserved.
5 * Written by David Howells (dhowells@redhat.com)
6 */
7 #undef TRACE_SYSTEM
8 #define TRACE_SYSTEM i2c
9
10 #if !defined(_TRACE_I2C_H) || defined(TRACE_HEADER_MULTI_READ)
11 #define _TRACE_I2C_H
12
13 #include <linux/i2c.h>
14 #include <linux/tracepoint.h>
15
16 /*
17 * drivers/i2c/i2c-core-base.c
18 */
19 extern int i2c_transfer_trace_reg(void);
20 extern void i2c_transfer_trace_unreg(void);
21
22 /*
23 * __i2c_transfer() write request
24 */
25 TRACE_EVENT_FN(i2c_write,
26 TP_PROTO(const struct i2c_adapter *adap, const struct i2c_msg *msg,
27 int num),
28 TP_ARGS(adap, msg, num),
29 TP_STRUCT__entry(
30 __field(int, adapter_nr )
31 __field(__u16, msg_nr )
32 __field(__u16, addr )
33 __field(__u16, flags )
34 __field(__u16, len )
35 __dynamic_array(__u8, buf, msg->len) ),
36 TP_fast_assign(
37 __entry->adapter_nr = adap->nr;
38 __entry->msg_nr = num;
39 __entry->addr = msg->addr;
40 __entry->flags = msg->flags;
41 __entry->len = msg->len;
42 memcpy(__get_dynamic_array(buf), msg->buf, msg->len);
43 ),
44 TP_printk("i2c-%d #%u a=%03x f=%04x l=%u [%*phD]",
45 __entry->adapter_nr,
46 __entry->msg_nr,
47 __entry->addr,
48 __entry->flags,
49 __entry->len,
50 __entry->len, __get_dynamic_array(buf)
51 ),
52 i2c_transfer_trace_reg,
53 i2c_transfer_trace_unreg);
54
55 /*
56 * __i2c_transfer() read request
57 */
58 TRACE_EVENT_FN(i2c_read,
59 TP_PROTO(const struct i2c_adapter *adap, const struct i2c_msg *msg,
60 int num),
61 TP_ARGS(adap, msg, num),
62 TP_STRUCT__entry(
63 __field(int, adapter_nr )
64 __field(__u16, msg_nr )
65 __field(__u16, addr )
66 __field(__u16, flags )
67 __field(__u16, len )
68 ),
69 TP_fast_assign(
70 __entry->adapter_nr = adap->nr;
71 __entry->msg_nr = num;
72 __entry->addr = msg->addr;
73 __entry->flags = msg->flags;
74 __entry->len = msg->len;
75 ),
76 TP_printk("i2c-%d #%u a=%03x f=%04x l=%u",
77 __entry->adapter_nr,
78 __entry->msg_nr,
79 __entry->addr,
80 __entry->flags,
81 __entry->len
82 ),
83 i2c_transfer_trace_reg,
84 i2c_transfer_trace_unreg);
85
86 /*
87 * __i2c_transfer() read reply
88 */
89 TRACE_EVENT_FN(i2c_reply,
90 TP_PROTO(const struct i2c_adapter *adap, const struct i2c_msg *msg,
91 int num),
92 TP_ARGS(adap, msg, num),
93 TP_STRUCT__entry(
94 __field(int, adapter_nr )
95 __field(__u16, msg_nr )
96 __field(__u16, addr )
97 __field(__u16, flags )
98 __field(__u16, len )
99 __dynamic_array(__u8, buf, msg->len) ),
100 TP_fast_assign(
101 __entry->adapter_nr = adap->nr;
102 __entry->msg_nr = num;
103 __entry->addr = msg->addr;
104 __entry->flags = msg->flags;
105 __entry->len = msg->len;
106 memcpy(__get_dynamic_array(buf), msg->buf, msg->len);
107 ),
108 TP_printk("i2c-%d #%u a=%03x f=%04x l=%u [%*phD]",
109 __entry->adapter_nr,
110 __entry->msg_nr,
111 __entry->addr,
112 __entry->flags,
113 __entry->len,
114 __entry->len, __get_dynamic_array(buf)
115 ),
116 i2c_transfer_trace_reg,
117 i2c_transfer_trace_unreg);
118
119 /*
120 * __i2c_transfer() result
121 */
122 TRACE_EVENT_FN(i2c_result,
123 TP_PROTO(const struct i2c_adapter *adap, int num, int ret),
124 TP_ARGS(adap, num, ret),
125 TP_STRUCT__entry(
126 __field(int, adapter_nr )
127 __field(__u16, nr_msgs )
128 __field(__s16, ret )
129 ),
130 TP_fast_assign(
131 __entry->adapter_nr = adap->nr;
132 __entry->nr_msgs = num;
133 __entry->ret = ret;
134 ),
135 TP_printk("i2c-%d n=%u ret=%d",
136 __entry->adapter_nr,
137 __entry->nr_msgs,
138 __entry->ret
139 ),
140 i2c_transfer_trace_reg,
141 i2c_transfer_trace_unreg);
142
143 #endif /* _TRACE_I2C_H */
144
145 /* This part must be outside protection */
146 #include <trace/define_trace.h>