forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/usb/typec/ucsi/trace.h
....@@ -7,53 +7,21 @@
77 #define __UCSI_TRACE_H
88
99 #include <linux/tracepoint.h>
10
-#include "ucsi.h"
11
-#include "debug.h"
10
+#include <linux/usb/typec_altmode.h>
1211
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);
4715
4816 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),
5119 TP_STRUCT__entry(
5220 __field(u64, ctrl)
5321 __field(int, ret)
5422 ),
5523 TP_fast_assign(
56
- __entry->ctrl = ctrl->raw_cmd;
24
+ __entry->ctrl = command;
5725 __entry->ret = ret;
5826 ),
5927 TP_printk("%s -> %s (err=%d)", ucsi_cmd_str(__entry->ctrl),
....@@ -62,30 +30,13 @@
6230 );
6331
6432 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)
6735 );
6836
6937 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)
8940 );
9041
9142 DECLARE_EVENT_CLASS(ucsi_log_connector_status,
....@@ -105,13 +56,13 @@
10556 TP_fast_assign(
10657 __entry->port = port - 1;
10758 __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);
11364 __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);
11566 ),
11667 TP_printk("port%d status: change=%04x, opmode=%x, connected=%d, "
11768 "sourcing=%d, partner_flags=%x, partner_type=%x, "
....@@ -131,6 +82,31 @@
13182 TP_ARGS(port, status)
13283 );
13384
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
+
134110 #endif /* __UCSI_TRACE_H */
135111
136112 /* This part must be outside protection */