new file mode 100644
@@ -0,0 +1,76 @@
+/* SPDX-License-Identifier: MIT */
+/* Copyright(c) 2019-2021, Celeno Communications Ltd. */
+
+#ifndef CL_COREDUMP_H
+#define CL_COREDUMP_H
+
+#include "hw.h"
+
+#define CL_COREDUMP_V1 1
+#define CL_COREDUMP_MAGIC_LEN 16
+
+struct cl_coredump {
+ char magic[CL_COREDUMP_MAGIC_LEN];
+ __le32 len;
+
+ /* 28 bits of self sizes + 4 bits of CL_COREDUMP_V* indicators */
+ __le32 self_version;
+
+ /* timings */
+ __le64 trig_tv_sec;
+ __le64 trig_tv_nsec;
+
+ /* dump info */
+ __le32 dump_mask;
+
+ u8 reserved[256];
+
+ /* Consists of multiple NLEV elements */
+ u8 data[];
+} __packed;
+
+/* NLEV - Name-Length-Error-Value element */
+struct cl_nlev {
+ char n[CL_COREDUMP_MAGIC_LEN];
+ __le32 l;
+ __le32 e;
+ u8 v[];
+} __packed;
+
+#ifdef CONFIG_CL_DEBUGFS
+
+int cl_coredump_trigger(struct cl_hw *cl_hw);
+bool cl_coredump_recovery(struct cl_hw *cl_hw, int reason);
+bool cl_coredump_is_scheduled(struct cl_hw *cl_hw);
+void cl_coredump_reset_trace(struct cl_hw *cl_hw);
+void cl_coredump_init(struct cl_hw *cl_hw, struct dentry *dir_drv);
+void cl_coredump_close(struct cl_hw *cl_hw);
+
+#else
+
+static inline int cl_coredump_trigger(struct cl_hw *cl_hw)
+{
+ return 0;
+}
+
+static inline bool cl_coredump_recovery(struct cl_hw *cl_hw, int reason)
+{
+ return false;
+}
+
+static inline bool cl_coredump_is_scheduled(struct cl_hw *cl_hw)
+{
+ return false;
+}
+
+static inline void cl_coredump_reset_trace(struct cl_hw *cl_hw)
+{}
+
+static inline void cl_coredump_init(struct cl_hw *cl_hw, struct dentry *dir_drv)
+{}
+
+static inline void cl_coredump_close(struct cl_hw *cl_hw)
+{}
+#endif /* CONFIG_CL_DEBUGFS */
+
+#endif /* CL_COREDUMP_H */