.. | .. |
---|
7 | 7 | #define __UCSI_TRACE_H |
---|
8 | 8 | |
---|
9 | 9 | #include <linux/tracepoint.h> |
---|
10 | | -#include "ucsi.h" |
---|
11 | | -#include "debug.h" |
---|
| 10 | +#include <linux/usb/typec_altmode.h> |
---|
12 | 11 | |
---|
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 | | -); |
---|
| 12 | +const char *ucsi_cmd_str(u64 raw_cmd); |
---|
| 13 | +const char *ucsi_cci_str(u32 cci); |
---|
| 14 | +const char *ucsi_recipient_str(u8 recipient); |
---|
47 | 15 | |
---|
48 | 16 | DECLARE_EVENT_CLASS(ucsi_log_command, |
---|
49 | | - TP_PROTO(struct ucsi_control *ctrl, int ret), |
---|
50 | | - TP_ARGS(ctrl, ret), |
---|
| 17 | + TP_PROTO(u64 command, int ret), |
---|
| 18 | + TP_ARGS(command, ret), |
---|
51 | 19 | TP_STRUCT__entry( |
---|
52 | 20 | __field(u64, ctrl) |
---|
53 | 21 | __field(int, ret) |
---|
54 | 22 | ), |
---|
55 | 23 | TP_fast_assign( |
---|
56 | | - __entry->ctrl = ctrl->raw_cmd; |
---|
| 24 | + __entry->ctrl = command; |
---|
57 | 25 | __entry->ret = ret; |
---|
58 | 26 | ), |
---|
59 | 27 | TP_printk("%s -> %s (err=%d)", ucsi_cmd_str(__entry->ctrl), |
---|
.. | .. |
---|
62 | 30 | ); |
---|
63 | 31 | |
---|
64 | 32 | DEFINE_EVENT(ucsi_log_command, ucsi_run_command, |
---|
65 | | - TP_PROTO(struct ucsi_control *ctrl, int ret), |
---|
66 | | - TP_ARGS(ctrl, ret) |
---|
| 33 | + TP_PROTO(u64 command, int ret), |
---|
| 34 | + TP_ARGS(command, ret) |
---|
67 | 35 | ); |
---|
68 | 36 | |
---|
69 | 37 | 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) |
---|
| 38 | + TP_PROTO(u64 command, int ret), |
---|
| 39 | + TP_ARGS(command, ret) |
---|
89 | 40 | ); |
---|
90 | 41 | |
---|
91 | 42 | DECLARE_EVENT_CLASS(ucsi_log_connector_status, |
---|
.. | .. |
---|
105 | 56 | TP_fast_assign( |
---|
106 | 57 | __entry->port = port - 1; |
---|
107 | 58 | __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; |
---|
| 59 | + __entry->opmode = UCSI_CONSTAT_PWR_OPMODE(status->flags); |
---|
| 60 | + __entry->connected = !!(status->flags & UCSI_CONSTAT_CONNECTED); |
---|
| 61 | + __entry->pwr_dir = !!(status->flags & UCSI_CONSTAT_PWR_DIR); |
---|
| 62 | + __entry->partner_flags = UCSI_CONSTAT_PARTNER_FLAGS(status->flags); |
---|
| 63 | + __entry->partner_type = UCSI_CONSTAT_PARTNER_TYPE(status->flags); |
---|
113 | 64 | __entry->request_data_obj = status->request_data_obj; |
---|
114 | | - __entry->bc_status = status->bc_status; |
---|
| 65 | + __entry->bc_status = UCSI_CONSTAT_BC_STATUS(status->pwr_status); |
---|
115 | 66 | ), |
---|
116 | 67 | TP_printk("port%d status: change=%04x, opmode=%x, connected=%d, " |
---|
117 | 68 | "sourcing=%d, partner_flags=%x, partner_type=%x, " |
---|
.. | .. |
---|
131 | 82 | TP_ARGS(port, status) |
---|
132 | 83 | ); |
---|
133 | 84 | |
---|
| 85 | +DECLARE_EVENT_CLASS(ucsi_log_register_altmode, |
---|
| 86 | + TP_PROTO(u8 recipient, struct typec_altmode *alt), |
---|
| 87 | + TP_ARGS(recipient, alt), |
---|
| 88 | + TP_STRUCT__entry( |
---|
| 89 | + __field(u8, recipient) |
---|
| 90 | + __field(u16, svid) |
---|
| 91 | + __field(u8, mode) |
---|
| 92 | + __field(u32, vdo) |
---|
| 93 | + ), |
---|
| 94 | + TP_fast_assign( |
---|
| 95 | + __entry->recipient = recipient; |
---|
| 96 | + __entry->svid = alt->svid; |
---|
| 97 | + __entry->mode = alt->mode; |
---|
| 98 | + __entry->vdo = alt->vdo; |
---|
| 99 | + ), |
---|
| 100 | + TP_printk("%s alt mode: svid %04x, mode %d vdo %x", |
---|
| 101 | + ucsi_recipient_str(__entry->recipient), __entry->svid, |
---|
| 102 | + __entry->mode, __entry->vdo) |
---|
| 103 | +); |
---|
| 104 | + |
---|
| 105 | +DEFINE_EVENT(ucsi_log_register_altmode, ucsi_register_altmode, |
---|
| 106 | + TP_PROTO(u8 recipient, struct typec_altmode *alt), |
---|
| 107 | + TP_ARGS(recipient, alt) |
---|
| 108 | +); |
---|
| 109 | + |
---|
134 | 110 | #endif /* __UCSI_TRACE_H */ |
---|
135 | 111 | |
---|
136 | 112 | /* This part must be outside protection */ |
---|