1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * I2C slave tracepoints
5 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
8 #define TRACE_SYSTEM i2c_slave
10 #if !defined(_TRACE_I2C_SLAVE_H) || defined(TRACE_HEADER_MULTI_READ)
11 #define _TRACE_I2C_SLAVE_H
13 #include <linux/i2c.h>
14 #include <linux/tracepoint.h>
16 TRACE_DEFINE_ENUM(I2C_SLAVE_READ_REQUESTED
);
17 TRACE_DEFINE_ENUM(I2C_SLAVE_WRITE_REQUESTED
);
18 TRACE_DEFINE_ENUM(I2C_SLAVE_READ_PROCESSED
);
19 TRACE_DEFINE_ENUM(I2C_SLAVE_WRITE_RECEIVED
);
20 TRACE_DEFINE_ENUM(I2C_SLAVE_STOP
);
22 #define show_event_type(type) \
23 __print_symbolic(type, \
24 { I2C_SLAVE_READ_REQUESTED, "RD_REQ" }, \
25 { I2C_SLAVE_WRITE_REQUESTED, "WR_REQ" }, \
26 { I2C_SLAVE_READ_PROCESSED, "RD_PRO" }, \
27 { I2C_SLAVE_WRITE_RECEIVED, "WR_RCV" }, \
28 { I2C_SLAVE_STOP, " STOP" })
30 TRACE_EVENT(i2c_slave
,
31 TP_PROTO(const struct i2c_client
*client
, enum i2c_slave_event event
,
32 __u8
*val
, int cb_ret
),
33 TP_ARGS(client
, event
, val
, cb_ret
),
35 __field(int, adapter_nr
)
39 __field(enum i2c_slave_event
, event
)
40 __array(__u8
, buf
, 1) ),
43 __entry
->adapter_nr
= client
->adapter
->nr
;
44 __entry
->addr
= client
->addr
;
45 __entry
->event
= event
;
46 __entry
->ret
= cb_ret
;
48 case I2C_SLAVE_READ_REQUESTED
:
49 case I2C_SLAVE_READ_PROCESSED
:
50 case I2C_SLAVE_WRITE_RECEIVED
:
52 memcpy(__entry
->buf
, val
, __entry
->len
);
59 TP_printk("i2c-%d a=%03x ret=%d %s [%*phD]",
60 __entry
->adapter_nr
, __entry
->addr
, __entry
->ret
,
61 show_event_type(__entry
->event
), __entry
->len
, __entry
->buf
64 #endif /* _TRACE_I2C_SLAVE_H */
66 /* This part must be outside protection */
67 #include <trace/define_trace.h>