1 /* SPDX-License-Identifier: GPL-2.0-only 2 * 3 * Copyright (C) 2020-2021 Intel Corporation. 4 */ 5 6 #ifndef IOSM_IPC_TRACE_H 7 #define IOSM_IPC_TRACE_H 8 9 #include <linux/debugfs.h> 10 #include <linux/relay.h> 11 12 #include "iosm_ipc_chnl_cfg.h" 13 #include "iosm_ipc_imem_ops.h" 14 15 /** 16 * enum trace_ctrl_mode - State of trace channel 17 * @TRACE_DISABLE: mode for disable trace 18 * @TRACE_ENABLE: mode for enable trace 19 */ 20 enum trace_ctrl_mode { 21 TRACE_DISABLE = 0, 22 TRACE_ENABLE, 23 }; 24 25 /** 26 * struct iosm_trace - Struct for trace interface 27 * @ipc_rchan: Pointer to relay channel 28 * @ctrl_file: Pointer to trace control file 29 * @ipc_imem: Imem instance 30 * @dev: Pointer to device struct 31 * @channel: Channel instance 32 * @chl_id: Channel Indentifier 33 * @trc_mutex: Mutex used for read and write mode 34 * @mode: Mode for enable and disable trace 35 */ 36 37 struct iosm_trace { 38 struct rchan *ipc_rchan; 39 struct dentry *ctrl_file; 40 struct iosm_imem *ipc_imem; 41 struct device *dev; 42 struct ipc_mem_channel *channel; 43 enum ipc_channel_id chl_id; 44 struct mutex trc_mutex; /* Mutex used for read and write mode */ 45 enum trace_ctrl_mode mode; 46 }; 47 48 struct iosm_trace *ipc_trace_init(struct iosm_imem *ipc_imem); 49 void ipc_trace_deinit(struct iosm_trace *ipc_trace); 50 void ipc_trace_port_rx(struct iosm_trace *ipc_trace, struct sk_buff *skb); 51 #endif 52