]>
git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blob - include/trace/events/i2c.h
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /* I2C message transfer tracepoints
4 * Copyright (C) 2013 Red Hat, Inc. All Rights Reserved.
5 * Written by David Howells (dhowells@redhat.com)
8 #define TRACE_SYSTEM i2c
10 #if !defined(_TRACE_I2C_H) || defined(TRACE_HEADER_MULTI_READ)
13 #include <linux/i2c.h>
14 #include <linux/tracepoint.h>
17 * drivers/i2c/i2c-core-base.c
19 extern int i2c_transfer_trace_reg(void);
20 extern void i2c_transfer_trace_unreg(void);
23 * __i2c_transfer() write request
25 TRACE_EVENT_FN(i2c_write
,
26 TP_PROTO(const struct i2c_adapter
*adap
, const struct i2c_msg
*msg
,
28 TP_ARGS(adap
, msg
, num
),
30 __field(int, adapter_nr
)
31 __field(__u16
, msg_nr
)
33 __field(__u16
, flags
)
35 __dynamic_array(__u8
, buf
, msg
->len
) ),
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
);
44 TP_printk("i2c-%d #%u a=%03x f=%04x l=%u [%*phD]",
50 __entry
->len
, __get_dynamic_array(buf
)
52 i2c_transfer_trace_reg
,
53 i2c_transfer_trace_unreg
);
56 * __i2c_transfer() read request
58 TRACE_EVENT_FN(i2c_read
,
59 TP_PROTO(const struct i2c_adapter
*adap
, const struct i2c_msg
*msg
,
61 TP_ARGS(adap
, msg
, num
),
63 __field(int, adapter_nr
)
64 __field(__u16
, msg_nr
)
66 __field(__u16
, flags
)
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
;
76 TP_printk("i2c-%d #%u a=%03x f=%04x l=%u",
83 i2c_transfer_trace_reg
,
84 i2c_transfer_trace_unreg
);
87 * __i2c_transfer() read reply
89 TRACE_EVENT_FN(i2c_reply
,
90 TP_PROTO(const struct i2c_adapter
*adap
, const struct i2c_msg
*msg
,
92 TP_ARGS(adap
, msg
, num
),
94 __field(int, adapter_nr
)
95 __field(__u16
, msg_nr
)
97 __field(__u16
, flags
)
99 __dynamic_array(__u8
, buf
, msg
->len
) ),
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
);
108 TP_printk("i2c-%d #%u a=%03x f=%04x l=%u [%*phD]",
114 __entry
->len
, __get_dynamic_array(buf
)
116 i2c_transfer_trace_reg
,
117 i2c_transfer_trace_unreg
);
120 * __i2c_transfer() result
122 TRACE_EVENT_FN(i2c_result
,
123 TP_PROTO(const struct i2c_adapter
*adap
, int num
, int ret
),
124 TP_ARGS(adap
, num
, ret
),
126 __field(int, adapter_nr
)
127 __field(__u16
, nr_msgs
)
131 __entry
->adapter_nr
= adap
->nr
;
132 __entry
->nr_msgs
= num
;
135 TP_printk("i2c-%d n=%u ret=%d",
140 i2c_transfer_trace_reg
,
141 i2c_transfer_trace_unreg
);
143 #endif /* _TRACE_I2C_H */
145 /* This part must be outside protection */
146 #include <trace/define_trace.h>