1 /* SPDX-License-Identifier: GPL-2.0 */
3 * MacBook (Pro) SPI keyboard and touchpad driver
5 * Copyright (c) 2015-2019 Federico Lorenzi
6 * Copyright (c) 2017-2019 Ronald Tschalär
10 #define TRACE_SYSTEM applespi
12 #if !defined(_APPLESPI_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
13 #define _APPLESPI_TRACE_H_
15 #include <linux/types.h>
16 #include <linux/tracepoint.h>
20 DECLARE_EVENT_CLASS(dump_message_template
,
21 TP_PROTO(enum applespi_evt_type evt_type
,
22 enum applespi_pkt_type pkt_type
,
26 TP_ARGS(evt_type
, pkt_type
, buf
, len
),
29 __field(enum applespi_evt_type
, evt_type
)
30 __field(enum applespi_pkt_type
, pkt_type
)
32 __dynamic_array(u8
, buf
, len
)
36 __entry
->evt_type
= evt_type
;
37 __entry
->pkt_type
= pkt_type
;
39 memcpy(__get_dynamic_array(buf
), buf
, len
);
43 __print_symbolic(__entry
->pkt_type
,
45 { PT_WRITE
, "write" },
46 { PT_STATUS
, "status" }
48 __print_hex(__get_dynamic_array(buf
), __entry
->len
))
51 #define DEFINE_DUMP_MESSAGE_EVENT(name) \
52 DEFINE_EVENT(dump_message_template, name, \
53 TP_PROTO(enum applespi_evt_type evt_type, \
54 enum applespi_pkt_type pkt_type, \
57 TP_ARGS(evt_type, pkt_type, buf, len) \
60 DEFINE_DUMP_MESSAGE_EVENT(applespi_tp_ini_cmd
);
61 DEFINE_DUMP_MESSAGE_EVENT(applespi_backlight_cmd
);
62 DEFINE_DUMP_MESSAGE_EVENT(applespi_caps_lock_cmd
);
63 DEFINE_DUMP_MESSAGE_EVENT(applespi_keyboard_data
);
64 DEFINE_DUMP_MESSAGE_EVENT(applespi_touchpad_data
);
65 DEFINE_DUMP_MESSAGE_EVENT(applespi_unknown_data
);
66 DEFINE_DUMP_MESSAGE_EVENT(applespi_bad_crc
);
68 TRACE_EVENT(applespi_irq_received
,
69 TP_PROTO(enum applespi_evt_type evt_type
,
70 enum applespi_pkt_type pkt_type
),
72 TP_ARGS(evt_type
, pkt_type
),
75 __field(enum applespi_evt_type
, evt_type
)
76 __field(enum applespi_pkt_type
, pkt_type
)
80 __entry
->evt_type
= evt_type
;
81 __entry
->pkt_type
= pkt_type
;
87 #endif /* _APPLESPI_TRACE_H_ */
89 /* This part must be outside protection */
90 #undef TRACE_INCLUDE_PATH
91 #define TRACE_INCLUDE_PATH ../../drivers/input/keyboard
92 #define TRACE_INCLUDE_FILE applespi_trace
93 #include <trace/define_trace.h>