1 /* SPDX-License-Identifier: ISC */
2 /*
3  * Copyright (C) 2016 Felix Fietkau <nbd@nbd.name>
4  */
5 
6 #if !defined(__MT76_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
7 #define __MT76_TRACE_H
8 
9 #include <linux/tracepoint.h>
10 #include "mt76.h"
11 
12 #undef TRACE_SYSTEM
13 #define TRACE_SYSTEM mt76
14 
15 #define MAXNAME		32
16 #define DEV_ENTRY	__array(char, wiphy_name, 32)
17 #define DEV_ASSIGN	strlcpy(__entry->wiphy_name,	\
18 				wiphy_name(dev->hw->wiphy), MAXNAME)
19 #define DEV_PR_FMT	"%s"
20 #define DEV_PR_ARG	__entry->wiphy_name
21 
22 #define REG_ENTRY	__field(u32, reg) __field(u32, val)
23 #define REG_ASSIGN	__entry->reg = reg; __entry->val = val
24 #define REG_PR_FMT	" %04x=%08x"
25 #define REG_PR_ARG	__entry->reg, __entry->val
26 
27 DECLARE_EVENT_CLASS(dev_reg_evt,
28 	TP_PROTO(struct mt76_dev *dev, u32 reg, u32 val),
29 	TP_ARGS(dev, reg, val),
30 	TP_STRUCT__entry(
31 		DEV_ENTRY
32 		REG_ENTRY
33 	),
34 	TP_fast_assign(
35 		DEV_ASSIGN;
36 		REG_ASSIGN;
37 	),
38 	TP_printk(
39 		DEV_PR_FMT REG_PR_FMT,
40 		DEV_PR_ARG, REG_PR_ARG
41 	)
42 );
43 
44 DEFINE_EVENT(dev_reg_evt, reg_rr,
45 	TP_PROTO(struct mt76_dev *dev, u32 reg, u32 val),
46 	TP_ARGS(dev, reg, val)
47 );
48 
49 DEFINE_EVENT(dev_reg_evt, reg_wr,
50 	TP_PROTO(struct mt76_dev *dev, u32 reg, u32 val),
51 	TP_ARGS(dev, reg, val)
52 );
53 
54 #endif
55 
56 #undef TRACE_INCLUDE_PATH
57 #define TRACE_INCLUDE_PATH .
58 #undef TRACE_INCLUDE_FILE
59 #define TRACE_INCLUDE_FILE trace
60 
61 #include <trace/define_trace.h>
62