^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * MacBook (Pro) SPI keyboard and touchpad driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (c) 2015-2019 Federico Lorenzi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright (c) 2017-2019 Ronald Tschalär
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #undef TRACE_SYSTEM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #define TRACE_SYSTEM applespi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #if !defined(_APPLESPI_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #define _APPLESPI_TRACE_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/tracepoint.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include "applespi.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) DECLARE_EVENT_CLASS(dump_message_template,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) TP_PROTO(enum applespi_evt_type evt_type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) enum applespi_pkt_type pkt_type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) u8 *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) size_t len),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) TP_ARGS(evt_type, pkt_type, buf, len),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) __field(enum applespi_evt_type, evt_type)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) __field(enum applespi_pkt_type, pkt_type)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) __field(size_t, len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) __dynamic_array(u8, buf, len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) __entry->evt_type = evt_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) __entry->pkt_type = pkt_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) __entry->len = len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) memcpy(__get_dynamic_array(buf), buf, len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) TP_printk("%-6s: %s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) __print_symbolic(__entry->pkt_type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) { PT_READ, "read" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) { PT_WRITE, "write" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) { PT_STATUS, "status" }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) __print_hex(__get_dynamic_array(buf), __entry->len))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) #define DEFINE_DUMP_MESSAGE_EVENT(name) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) DEFINE_EVENT(dump_message_template, name, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) TP_PROTO(enum applespi_evt_type evt_type, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) enum applespi_pkt_type pkt_type, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) u8 *buf, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) size_t len), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) TP_ARGS(evt_type, pkt_type, buf, len) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) DEFINE_DUMP_MESSAGE_EVENT(applespi_tp_ini_cmd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) DEFINE_DUMP_MESSAGE_EVENT(applespi_backlight_cmd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) DEFINE_DUMP_MESSAGE_EVENT(applespi_caps_lock_cmd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) DEFINE_DUMP_MESSAGE_EVENT(applespi_keyboard_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) DEFINE_DUMP_MESSAGE_EVENT(applespi_touchpad_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) DEFINE_DUMP_MESSAGE_EVENT(applespi_unknown_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) DEFINE_DUMP_MESSAGE_EVENT(applespi_bad_crc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) TRACE_EVENT(applespi_irq_received,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) TP_PROTO(enum applespi_evt_type evt_type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) enum applespi_pkt_type pkt_type),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) TP_ARGS(evt_type, pkt_type),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) __field(enum applespi_evt_type, evt_type)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) __field(enum applespi_pkt_type, pkt_type)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) __entry->evt_type = evt_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) __entry->pkt_type = pkt_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) "\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) #endif /* _APPLESPI_TRACE_H_ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) /* This part must be outside protection */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) #undef TRACE_INCLUDE_PATH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) #define TRACE_INCLUDE_PATH ../../drivers/input/keyboard
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) #define TRACE_INCLUDE_FILE applespi_trace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) #include <trace/define_trace.h>