1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #undef TRACE_SYSTEM
4 #define TRACE_SYSTEM fsi_master_i2cr
5 
6 #if !defined(_TRACE_FSI_MASTER_I2CR_H) || defined(TRACE_HEADER_MULTI_READ)
7 #define _TRACE_FSI_MASTER_I2CR_H
8 
9 #include <linux/tracepoint.h>
10 
11 TRACE_EVENT(i2cr_i2c_error,
12 	TP_PROTO(const struct i2c_client *client, uint32_t command, int rc),
13 	TP_ARGS(client, command, rc),
14 	TP_STRUCT__entry(
15 		__field(int, bus)
16 		__field(int, rc)
17 		__array(unsigned char, command, sizeof(uint32_t))
18 		__field(unsigned short, addr)
19 	),
20 	TP_fast_assign(
21 		__entry->bus = client->adapter->nr;
22 		__entry->rc = rc;
23 		memcpy(__entry->command, &command, sizeof(uint32_t));
24 		__entry->addr = client->addr;
25 	),
26 	TP_printk("%d-%02x command:{ %*ph } rc:%d", __entry->bus, __entry->addr,
27 		  (int)sizeof(uint32_t), __entry->command, __entry->rc)
28 );
29 
30 TRACE_EVENT(i2cr_read,
31 	TP_PROTO(const struct i2c_client *client, uint32_t command, uint64_t *data),
32 	TP_ARGS(client, command, data),
33 	TP_STRUCT__entry(
34 		__field(int, bus)
35 		__array(unsigned char, data, sizeof(uint64_t))
36 		__array(unsigned char, command, sizeof(uint32_t))
37 		__field(unsigned short, addr)
38 	),
39 	TP_fast_assign(
40 		__entry->bus = client->adapter->nr;
41 		memcpy(__entry->data, data, sizeof(uint64_t));
42 		memcpy(__entry->command, &command, sizeof(uint32_t));
43 		__entry->addr = client->addr;
44 	),
45 	TP_printk("%d-%02x command:{ %*ph } { %*ph }", __entry->bus, __entry->addr,
46 		  (int)sizeof(uint32_t), __entry->command, (int)sizeof(uint64_t), __entry->data)
47 );
48 
49 TRACE_EVENT(i2cr_status,
50 	TP_PROTO(const struct i2c_client *client, uint64_t status),
51 	TP_ARGS(client, status),
52 	TP_STRUCT__entry(
53 		__field(uint64_t, status)
54 		__field(int, bus)
55 		__field(unsigned short, addr)
56 	),
57 	TP_fast_assign(
58 		__entry->status = status;
59 		__entry->bus = client->adapter->nr;
60 		__entry->addr = client->addr;
61 	),
62 	TP_printk("%d-%02x %016llx", __entry->bus, __entry->addr, __entry->status)
63 );
64 
65 TRACE_EVENT(i2cr_status_error,
66 	TP_PROTO(const struct i2c_client *client, uint64_t status, uint64_t error, uint64_t log),
67 	TP_ARGS(client, status, error, log),
68 	TP_STRUCT__entry(
69 		__field(uint64_t, error)
70 		__field(uint64_t, log)
71 		__field(uint64_t, status)
72 		__field(int, bus)
73 		__field(unsigned short, addr)
74 	),
75 	TP_fast_assign(
76 		__entry->error = error;
77 		__entry->log = log;
78 		__entry->status = status;
79 		__entry->bus = client->adapter->nr;
80 		__entry->addr = client->addr;
81 	),
82 	TP_printk("%d-%02x status:%016llx error:%016llx log:%016llx", __entry->bus, __entry->addr,
83 		  __entry->status, __entry->error, __entry->log)
84 );
85 
86 TRACE_EVENT(i2cr_write,
87 	TP_PROTO(const struct i2c_client *client, uint32_t command, uint64_t data),
88 	TP_ARGS(client, command, data),
89 	TP_STRUCT__entry(
90 		__field(int, bus)
91 		__array(unsigned char, data, sizeof(uint64_t))
92 		__array(unsigned char, command, sizeof(uint32_t))
93 		__field(unsigned short, addr)
94 	),
95 	TP_fast_assign(
96 		__entry->bus = client->adapter->nr;
97 		memcpy(__entry->data, &data, sizeof(uint64_t));
98 		memcpy(__entry->command, &command, sizeof(uint32_t));
99 		__entry->addr = client->addr;
100 	),
101 	TP_printk("%d-%02x command:{ %*ph } { %*ph }", __entry->bus, __entry->addr,
102 		  (int)sizeof(uint32_t), __entry->command, (int)sizeof(uint64_t), __entry->data)
103 );
104 
105 #endif
106 
107 #include <trace/define_trace.h>
108