root/drivers/usb/typec/ucsi/trace.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   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 <linux/usb/typec_altmode.h>
  11 
  12 const char *ucsi_cmd_str(u64 raw_cmd);
  13 const char *ucsi_ack_str(u8 ack);
  14 const char *ucsi_cci_str(u32 cci);
  15 const char *ucsi_recipient_str(u8 recipient);
  16 
  17 DECLARE_EVENT_CLASS(ucsi_log_ack,
  18         TP_PROTO(u8 ack),
  19         TP_ARGS(ack),
  20         TP_STRUCT__entry(
  21                 __field(u8, ack)
  22         ),
  23         TP_fast_assign(
  24                 __entry->ack = ack;
  25         ),
  26         TP_printk("ACK %s", ucsi_ack_str(__entry->ack))
  27 );
  28 
  29 DEFINE_EVENT(ucsi_log_ack, ucsi_ack,
  30         TP_PROTO(u8 ack),
  31         TP_ARGS(ack)
  32 );
  33 
  34 DECLARE_EVENT_CLASS(ucsi_log_control,
  35         TP_PROTO(struct ucsi_control *ctrl),
  36         TP_ARGS(ctrl),
  37         TP_STRUCT__entry(
  38                 __field(u64, ctrl)
  39         ),
  40         TP_fast_assign(
  41                 __entry->ctrl = ctrl->raw_cmd;
  42         ),
  43         TP_printk("control=%08llx (%s)", __entry->ctrl,
  44                 ucsi_cmd_str(__entry->ctrl))
  45 );
  46 
  47 DEFINE_EVENT(ucsi_log_control, ucsi_command,
  48         TP_PROTO(struct ucsi_control *ctrl),
  49         TP_ARGS(ctrl)
  50 );
  51 
  52 DECLARE_EVENT_CLASS(ucsi_log_command,
  53         TP_PROTO(struct ucsi_control *ctrl, int ret),
  54         TP_ARGS(ctrl, ret),
  55         TP_STRUCT__entry(
  56                 __field(u64, ctrl)
  57                 __field(int, ret)
  58         ),
  59         TP_fast_assign(
  60                 __entry->ctrl = ctrl->raw_cmd;
  61                 __entry->ret = ret;
  62         ),
  63         TP_printk("%s -> %s (err=%d)", ucsi_cmd_str(__entry->ctrl),
  64                 __entry->ret < 0 ? "FAIL" : "OK",
  65                 __entry->ret < 0 ? __entry->ret : 0)
  66 );
  67 
  68 DEFINE_EVENT(ucsi_log_command, ucsi_run_command,
  69         TP_PROTO(struct ucsi_control *ctrl, int ret),
  70         TP_ARGS(ctrl, ret)
  71 );
  72 
  73 DEFINE_EVENT(ucsi_log_command, ucsi_reset_ppm,
  74         TP_PROTO(struct ucsi_control *ctrl, int ret),
  75         TP_ARGS(ctrl, ret)
  76 );
  77 
  78 DECLARE_EVENT_CLASS(ucsi_log_cci,
  79         TP_PROTO(u32 cci),
  80         TP_ARGS(cci),
  81         TP_STRUCT__entry(
  82                 __field(u32, cci)
  83         ),
  84         TP_fast_assign(
  85                 __entry->cci = cci;
  86         ),
  87         TP_printk("CCI=%08x %s", __entry->cci, ucsi_cci_str(__entry->cci))
  88 );
  89 
  90 DEFINE_EVENT(ucsi_log_cci, ucsi_notify,
  91         TP_PROTO(u32 cci),
  92         TP_ARGS(cci)
  93 );
  94 
  95 DECLARE_EVENT_CLASS(ucsi_log_connector_status,
  96         TP_PROTO(int port, struct ucsi_connector_status *status),
  97         TP_ARGS(port, status),
  98         TP_STRUCT__entry(
  99                 __field(int, port)
 100                 __field(u16, change)
 101                 __field(u8, opmode)
 102                 __field(u8, connected)
 103                 __field(u8, pwr_dir)
 104                 __field(u8, partner_flags)
 105                 __field(u8, partner_type)
 106                 __field(u32, request_data_obj)
 107                 __field(u8, bc_status)
 108         ),
 109         TP_fast_assign(
 110                 __entry->port = port - 1;
 111                 __entry->change = status->change;
 112                 __entry->opmode = status->pwr_op_mode;
 113                 __entry->connected = status->connected;
 114                 __entry->pwr_dir = status->pwr_dir;
 115                 __entry->partner_flags = status->partner_flags;
 116                 __entry->partner_type = status->partner_type;
 117                 __entry->request_data_obj = status->request_data_obj;
 118                 __entry->bc_status = status->bc_status;
 119         ),
 120         TP_printk("port%d status: change=%04x, opmode=%x, connected=%d, "
 121                 "sourcing=%d, partner_flags=%x, partner_type=%x, "
 122                 "request_data_obj=%08x, BC status=%x", __entry->port,
 123                 __entry->change, __entry->opmode, __entry->connected,
 124                 __entry->pwr_dir, __entry->partner_flags, __entry->partner_type,
 125                 __entry->request_data_obj, __entry->bc_status)
 126 );
 127 
 128 DEFINE_EVENT(ucsi_log_connector_status, ucsi_connector_change,
 129         TP_PROTO(int port, struct ucsi_connector_status *status),
 130         TP_ARGS(port, status)
 131 );
 132 
 133 DEFINE_EVENT(ucsi_log_connector_status, ucsi_register_port,
 134         TP_PROTO(int port, struct ucsi_connector_status *status),
 135         TP_ARGS(port, status)
 136 );
 137 
 138 DECLARE_EVENT_CLASS(ucsi_log_register_altmode,
 139         TP_PROTO(u8 recipient, struct typec_altmode *alt),
 140         TP_ARGS(recipient, alt),
 141         TP_STRUCT__entry(
 142                 __field(u8, recipient)
 143                 __field(u16, svid)
 144                 __field(u8, mode)
 145                 __field(u32, vdo)
 146         ),
 147         TP_fast_assign(
 148                 __entry->recipient = recipient;
 149                 __entry->svid = alt->svid;
 150                 __entry->mode = alt->mode;
 151                 __entry->vdo = alt->vdo;
 152         ),
 153         TP_printk("%s alt mode: svid %04x, mode %d vdo %x",
 154                   ucsi_recipient_str(__entry->recipient), __entry->svid,
 155                   __entry->mode, __entry->vdo)
 156 );
 157 
 158 DEFINE_EVENT(ucsi_log_register_altmode, ucsi_register_altmode,
 159         TP_PROTO(u8 recipient, struct typec_altmode *alt),
 160         TP_ARGS(recipient, alt)
 161 );
 162 
 163 #endif /* __UCSI_TRACE_H */
 164 
 165 /* This part must be outside protection */
 166 
 167 #undef TRACE_INCLUDE_PATH
 168 #define TRACE_INCLUDE_PATH .
 169 
 170 #undef TRACE_INCLUDE_FILE
 171 #define TRACE_INCLUDE_FILE trace
 172 
 173 #include <trace/define_trace.h>

/* [<][>][^][v][top][bottom][index][help] */