Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * MacBook (Pro) SPI keyboard and touchpad driver
0004  *
0005  * Copyright (c) 2015-2019 Federico Lorenzi
0006  * Copyright (c) 2017-2019 Ronald Tschalär
0007  */
0008 
0009 #undef TRACE_SYSTEM
0010 #define TRACE_SYSTEM applespi
0011 
0012 #if !defined(_APPLESPI_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
0013 #define _APPLESPI_TRACE_H_
0014 
0015 #include <linux/types.h>
0016 #include <linux/tracepoint.h>
0017 
0018 #include "applespi.h"
0019 
0020 DECLARE_EVENT_CLASS(dump_message_template,
0021     TP_PROTO(enum applespi_evt_type evt_type,
0022          enum applespi_pkt_type pkt_type,
0023          u8 *buf,
0024          size_t len),
0025 
0026     TP_ARGS(evt_type, pkt_type, buf, len),
0027 
0028     TP_STRUCT__entry(
0029         __field(enum applespi_evt_type, evt_type)
0030         __field(enum applespi_pkt_type, pkt_type)
0031         __field(size_t, len)
0032         __dynamic_array(u8, buf, len)
0033     ),
0034 
0035     TP_fast_assign(
0036         __entry->evt_type = evt_type;
0037         __entry->pkt_type = pkt_type;
0038         __entry->len = len;
0039         memcpy(__get_dynamic_array(buf), buf, len);
0040     ),
0041 
0042     TP_printk("%-6s: %s",
0043           __print_symbolic(__entry->pkt_type,
0044                    { PT_READ, "read" },
0045                    { PT_WRITE, "write" },
0046                    { PT_STATUS, "status" }
0047           ),
0048           __print_hex(__get_dynamic_array(buf), __entry->len))
0049 );
0050 
0051 #define DEFINE_DUMP_MESSAGE_EVENT(name)         \
0052 DEFINE_EVENT(dump_message_template, name,       \
0053     TP_PROTO(enum applespi_evt_type evt_type,   \
0054          enum applespi_pkt_type pkt_type,   \
0055          u8 *buf,               \
0056          size_t len),               \
0057     TP_ARGS(evt_type, pkt_type, buf, len)       \
0058 )
0059 
0060 DEFINE_DUMP_MESSAGE_EVENT(applespi_tp_ini_cmd);
0061 DEFINE_DUMP_MESSAGE_EVENT(applespi_backlight_cmd);
0062 DEFINE_DUMP_MESSAGE_EVENT(applespi_caps_lock_cmd);
0063 DEFINE_DUMP_MESSAGE_EVENT(applespi_keyboard_data);
0064 DEFINE_DUMP_MESSAGE_EVENT(applespi_touchpad_data);
0065 DEFINE_DUMP_MESSAGE_EVENT(applespi_unknown_data);
0066 DEFINE_DUMP_MESSAGE_EVENT(applespi_bad_crc);
0067 
0068 TRACE_EVENT(applespi_irq_received,
0069     TP_PROTO(enum applespi_evt_type evt_type,
0070          enum applespi_pkt_type pkt_type),
0071 
0072     TP_ARGS(evt_type, pkt_type),
0073 
0074     TP_STRUCT__entry(
0075         __field(enum applespi_evt_type, evt_type)
0076         __field(enum applespi_pkt_type, pkt_type)
0077     ),
0078 
0079     TP_fast_assign(
0080         __entry->evt_type = evt_type;
0081         __entry->pkt_type = pkt_type;
0082     ),
0083 
0084     "\n"
0085 );
0086 
0087 #endif /* _APPLESPI_TRACE_H_ */
0088 
0089 /* This part must be outside protection */
0090 #undef TRACE_INCLUDE_PATH
0091 #define TRACE_INCLUDE_PATH ../../drivers/input/keyboard
0092 #define TRACE_INCLUDE_FILE applespi_trace
0093 #include <trace/define_trace.h>