diff mbox series

[07/13] ASoC: Intel: catpt: Event tracing

Message ID 20200807110649.17114-8-cezary.rojewski@intel.com
State New
Headers show
Series ASoC: Intel: Catpt - Lynx and Wildcat point | expand

Commit Message

Cezary Rojewski Aug. 7, 2020, 11:06 a.m. UTC
Define tracing macros for easy catpt debug. These are divided into
memory, registry and ipc event categories.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 sound/soc/intel/catpt/trace.h | 169 ++++++++++++++++++++++++++++++++++
 1 file changed, 169 insertions(+)
 create mode 100644 sound/soc/intel/catpt/trace.h
diff mbox series

Patch

diff --git a/sound/soc/intel/catpt/trace.h b/sound/soc/intel/catpt/trace.h
new file mode 100644
index 000000000000..92f79667b73b
--- /dev/null
+++ b/sound/soc/intel/catpt/trace.h
@@ -0,0 +1,169 @@ 
+/* SPDX-License-Identifier: GPL-2.0
+ *
+ * Copyright(c) 2020 Intel Corporation. All rights reserved.
+ *
+ * Author: Cezary Rojewski <cezary.rojewski@intel.com>
+ */
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM intel_catpt
+
+#if !defined(__SND_SOC_INTEL_CATPT_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
+#define __SND_SOC_INTEL_CATPT_TRACE_H
+
+#include <linux/types.h>
+#include <linux/tracepoint.h>
+
+struct catpt_mbank;
+struct catpt_mregion;
+
+TRACE_EVENT(catpt_mbank,
+	TP_PROTO(struct catpt_mbank *sram, const char *action,
+		 u32 start, u32 end),
+
+	TP_ARGS(sram, action, start, end),
+
+	TP_STRUCT__entry(
+		__field(u32, bank_start)
+		__field(u32, bank_end)
+		__string(action, action)
+		__field(u32, start)
+		__field(u32, end)
+	),
+
+	TP_fast_assign(
+		__entry->bank_start = sram->start;
+		__entry->bank_end = sram->end;
+		__assign_str(action, action);
+		__entry->start = start;
+		__entry->end = end;
+	),
+
+	TP_printk("[0x%08x-%08x] %s 0x%08x-%08x",
+		  __entry->bank_start, __entry->bank_end,
+		  __get_str(action),
+		  __entry->start, __entry->end)
+);
+
+TRACE_EVENT(catpt_mregion,
+	TP_PROTO(struct catpt_mregion *r1, struct catpt_mregion *r2,
+		 const char *action),
+
+	TP_ARGS(r1, r2, action),
+
+	TP_STRUCT__entry(
+		__field(u32, r1_start)
+		__field(u32, r1_end)
+		__field(u32, r2_start)
+		__field(u32, r2_end)
+		__string(action, action)
+	),
+
+	TP_fast_assign(
+		__entry->r1_start = r1->start;
+		__entry->r1_end = r1->end;
+		__entry->r2_start = r2->start;
+		__entry->r2_end = r2->end;
+		__assign_str(action, action);
+	),
+
+	TP_printk("0x%08x-%08x %s 0x%08x-%08x",
+		  __entry->r1_start, __entry->r1_end,
+		  __get_str(action),
+		  __entry->r2_start, __entry->r2_end)
+);
+
+TRACE_EVENT(catpt_updatel,
+
+	TP_PROTO(const char *title, u32 mask, u32 old, u32 new),
+
+	TP_ARGS(title, mask, old, new),
+
+	TP_STRUCT__entry(
+		__string(title, title)
+		__field(u32, mask)
+		__field(u32, old)
+		__field(u32, new)
+	),
+
+	TP_fast_assign(
+		__assign_str(title, title);
+		__entry->mask = mask;
+		__entry->old = old;
+		__entry->new = new;
+	),
+
+	TP_printk("%s [0x%08x] 0x%08x -> 0x%08x",
+		  __get_str(title),
+		  __entry->mask,
+		  __entry->old,
+		  __entry->new)
+);
+
+DECLARE_EVENT_CLASS(catpt_ipc_msg,
+
+	TP_PROTO(u32 header),
+
+	TP_ARGS(header),
+
+	TP_STRUCT__entry(
+		__field(u32, header)
+	),
+
+	TP_fast_assign(
+		__entry->header = header;
+	),
+
+	TP_printk("0x%08x", __entry->header)
+);
+
+DEFINE_EVENT(catpt_ipc_msg, catpt_irq,
+	TP_PROTO(u32 header),
+	TP_ARGS(header)
+);
+
+DEFINE_EVENT(catpt_ipc_msg, catpt_ipc_request,
+	TP_PROTO(u32 header),
+	TP_ARGS(header)
+);
+
+DEFINE_EVENT(catpt_ipc_msg, catpt_ipc_reply,
+	TP_PROTO(u32 header),
+	TP_ARGS(header)
+);
+
+DEFINE_EVENT(catpt_ipc_msg, catpt_ipc_notify,
+	TP_PROTO(u32 header),
+	TP_ARGS(header)
+);
+
+TRACE_EVENT_CONDITION(catpt_ipc_payload,
+
+	TP_PROTO(const u8 *data, size_t size),
+
+	TP_ARGS(data, size),
+
+	TP_CONDITION(data && size),
+
+	TP_STRUCT__entry(
+		__dynamic_array(u8, buf, size)
+	),
+
+	TP_fast_assign(
+		memcpy(__get_dynamic_array(buf), data, size);
+	),
+
+	TP_printk("%u byte(s)%s",
+		  __get_dynamic_array_len(buf),
+		  __print_hex_dump("", DUMP_PREFIX_NONE, 16, 4,
+				   __get_dynamic_array(buf),
+				   __get_dynamic_array_len(buf), false))
+);
+
+#endif /* __SND_SOC_INTEL_CATPT_TRACE_H */
+
+/* This part must be outside protection */
+#undef TRACE_INCLUDE_PATH
+#define TRACE_INCLUDE_PATH .
+#define TRACE_INCLUDE_FILE trace
+#include <trace/define_trace.h>