xref: /freebsd/sys/contrib/dev/mediatek/mt76/mt792x_trace.h (revision eba230afba4932f02a1ca44efc797cf7499a5cb0)
1 /* SPDX-License-Identifier: ISC */
2 /*
3  * Copyright (C) 2023 Lorenzo Bianconi <lorenzo@kernel.org>
4  */
5 
6 #if !defined(__MT792X_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
7 #define __MT792X_TRACE_H
8 
9 #include <linux/tracepoint.h>
10 #include "mt792x.h"
11 
12 #undef TRACE_SYSTEM
13 #define TRACE_SYSTEM mt792x
14 
15 #define MAXNAME		32
16 #define DEV_ENTRY	__array(char, wiphy_name, 32)
17 #define DEV_ASSIGN	strscpy(__entry->wiphy_name,	\
18 				wiphy_name(mt76_hw(dev)->wiphy), MAXNAME)
19 #define DEV_PR_FMT	"%s"
20 #define DEV_PR_ARG	__entry->wiphy_name
21 #define LP_STATE_PR_ARG	__entry->lp_state ? "lp ready" : "lp not ready"
22 
23 TRACE_EVENT(lp_event,
24 	TP_PROTO(struct mt792x_dev *dev, u8 lp_state),
25 
26 	TP_ARGS(dev, lp_state),
27 
28 	TP_STRUCT__entry(
29 		DEV_ENTRY
30 		__field(u8, lp_state)
31 	),
32 
33 	TP_fast_assign(
34 		DEV_ASSIGN;
35 		__entry->lp_state = lp_state;
36 	),
37 
38 	TP_printk(
39 		DEV_PR_FMT " %s",
40 		DEV_PR_ARG, LP_STATE_PR_ARG
41 	)
42 );
43 
44 #endif
45 
46 #undef TRACE_INCLUDE_PATH
47 #define TRACE_INCLUDE_PATH .
48 #undef TRACE_INCLUDE_FILE
49 #define TRACE_INCLUDE_FILE mt792x_trace
50 
51 #include <trace/define_trace.h>
52