1 /* SPDX-License-Identifier: GPL-2.0 */ 2 3 #undef TRACE_SYSTEM 4 #define TRACE_SYSTEM ucsi 5 6 #if !defined(__UCSI_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) 7 #define __UCSI_TRACE_H 8 9 #include <linux/tracepoint.h> 10 #include "ucsi.h" 11 #include "debug.h" 12 13 DECLARE_EVENT_CLASS(ucsi_log_ack, 14 TP_PROTO(u8 ack), 15 TP_ARGS(ack), 16 TP_STRUCT__entry( 17 __field(u8, ack) 18 ), 19 TP_fast_assign( 20 __entry->ack = ack; 21 ), 22 TP_printk("ACK %s", ucsi_ack_str(__entry->ack)) 23 ); 24 25 DEFINE_EVENT(ucsi_log_ack, ucsi_ack, 26 TP_PROTO(u8 ack), 27 TP_ARGS(ack) 28 ); 29 30 DECLARE_EVENT_CLASS(ucsi_log_control, 31 TP_PROTO(struct ucsi_control *ctrl), 32 TP_ARGS(ctrl), 33 TP_STRUCT__entry( 34 __field(u64, ctrl) 35 ), 36 TP_fast_assign( 37 __entry->ctrl = ctrl->raw_cmd; 38 ), 39 TP_printk("control=%08llx (%s)", __entry->ctrl, 40 ucsi_cmd_str(__entry->ctrl)) 41 ); 42 43 DEFINE_EVENT(ucsi_log_control, ucsi_command, 44 TP_PROTO(struct ucsi_control *ctrl), 45 TP_ARGS(ctrl) 46 ); 47 48 DECLARE_EVENT_CLASS(ucsi_log_command, 49 TP_PROTO(struct ucsi_control *ctrl, int ret), 50 TP_ARGS(ctrl, ret), 51 TP_STRUCT__entry( 52 __field(u64, ctrl) 53 __field(int, ret) 54 ), 55 TP_fast_assign( 56 __entry->ctrl = ctrl->raw_cmd; 57 __entry->ret = ret; 58 ), 59 TP_printk("%s -> %s (err=%d)", ucsi_cmd_str(__entry->ctrl), 60 __entry->ret < 0 ? "FAIL" : "OK", 61 __entry->ret < 0 ? __entry->ret : 0) 62 ); 63 64 DEFINE_EVENT(ucsi_log_command, ucsi_run_command, 65 TP_PROTO(struct ucsi_control *ctrl, int ret), 66 TP_ARGS(ctrl, ret) 67 ); 68 69 DEFINE_EVENT(ucsi_log_command, ucsi_reset_ppm, 70 TP_PROTO(struct ucsi_control *ctrl, int ret), 71 TP_ARGS(ctrl, ret) 72 ); 73 74 DECLARE_EVENT_CLASS(ucsi_log_cci, 75 TP_PROTO(u32 cci), 76 TP_ARGS(cci), 77 TP_STRUCT__entry( 78 __field(u32, cci) 79 ), 80 TP_fast_assign( 81 __entry->cci = cci; 82 ), 83 TP_printk("CCI=%08x %s", __entry->cci, ucsi_cci_str(__entry->cci)) 84 ); 85 86 DEFINE_EVENT(ucsi_log_cci, ucsi_notify, 87 TP_PROTO(u32 cci), 88 TP_ARGS(cci) 89 ); 90 91 DECLARE_EVENT_CLASS(ucsi_log_connector_status, 92 TP_PROTO(int port, struct ucsi_connector_status *status), 93 TP_ARGS(port, status), 94 TP_STRUCT__entry( 95 __field(int, port) 96 __field(u16, change) 97 __field(u8, opmode) 98 __field(u8, connected) 99 __field(u8, pwr_dir) 100 __field(u8, partner_flags) 101 __field(u8, partner_type) 102 __field(u32, request_data_obj) 103 __field(u8, bc_status) 104 ), 105 TP_fast_assign( 106 __entry->port = port - 1; 107 __entry->change = status->change; 108 __entry->opmode = status->pwr_op_mode; 109 __entry->connected = status->connected; 110 __entry->pwr_dir = status->pwr_dir; 111 __entry->partner_flags = status->partner_flags; 112 __entry->partner_type = status->partner_type; 113 __entry->request_data_obj = status->request_data_obj; 114 __entry->bc_status = status->bc_status; 115 ), 116 TP_printk("port%d status: change=%04x, opmode=%x, connected=%d, " 117 "sourcing=%d, partner_flags=%x, partner_type=%x, " 118 "request_data_obj=%08x, BC status=%x", __entry->port, 119 __entry->change, __entry->opmode, __entry->connected, 120 __entry->pwr_dir, __entry->partner_flags, __entry->partner_type, 121 __entry->request_data_obj, __entry->bc_status) 122 ); 123 124 DEFINE_EVENT(ucsi_log_connector_status, ucsi_connector_change, 125 TP_PROTO(int port, struct ucsi_connector_status *status), 126 TP_ARGS(port, status) 127 ); 128 129 DEFINE_EVENT(ucsi_log_connector_status, ucsi_register_port, 130 TP_PROTO(int port, struct ucsi_connector_status *status), 131 TP_ARGS(port, status) 132 ); 133 134 #endif /* __UCSI_TRACE_H */ 135 136 /* This part must be outside protection */ 137 138 #undef TRACE_INCLUDE_PATH 139 #define TRACE_INCLUDE_PATH . 140 141 #undef TRACE_INCLUDE_FILE 142 #define TRACE_INCLUDE_FILE trace 143 144 #include <trace/define_trace.h> 145