Lines Matching refs:ipc_trace
25 struct iosm_trace *ipc_trace = ipc_imem->trace; in ipc_trace_port_rx() local
27 if (ipc_trace->ipc_rchan) in ipc_trace_port_rx()
28 relay_write(ipc_trace->ipc_rchan, skb->data, skb->len); in ipc_trace_port_rx()
76 struct iosm_trace *ipc_trace = filp->private_data; in ipc_trace_ctrl_file_read() local
80 mutex_lock(&ipc_trace->trc_mutex); in ipc_trace_ctrl_file_read()
81 len = snprintf(buf, sizeof(buf), "%d\n", ipc_trace->mode); in ipc_trace_ctrl_file_read()
82 mutex_unlock(&ipc_trace->trc_mutex); in ipc_trace_ctrl_file_read()
92 struct iosm_trace *ipc_trace = filp->private_data; in ipc_trace_ctrl_file_write() local
100 mutex_lock(&ipc_trace->trc_mutex); in ipc_trace_ctrl_file_write()
101 if (val == TRACE_ENABLE && ipc_trace->mode != TRACE_ENABLE) { in ipc_trace_ctrl_file_write()
102 ipc_trace->channel = ipc_imem_sys_port_open(ipc_trace->ipc_imem, in ipc_trace_ctrl_file_write()
103 ipc_trace->chl_id, in ipc_trace_ctrl_file_write()
105 if (!ipc_trace->channel) { in ipc_trace_ctrl_file_write()
109 ipc_trace->mode = TRACE_ENABLE; in ipc_trace_ctrl_file_write()
110 } else if (val == TRACE_DISABLE && ipc_trace->mode != TRACE_DISABLE) { in ipc_trace_ctrl_file_write()
111 ipc_trace->mode = TRACE_DISABLE; in ipc_trace_ctrl_file_write()
113 ipc_imem_sys_port_close(ipc_trace->ipc_imem, in ipc_trace_ctrl_file_write()
114 ipc_trace->channel); in ipc_trace_ctrl_file_write()
115 relay_flush(ipc_trace->ipc_rchan); in ipc_trace_ctrl_file_write()
119 mutex_unlock(&ipc_trace->trc_mutex); in ipc_trace_ctrl_file_write()
138 struct iosm_trace *ipc_trace; in ipc_trace_init() local
144 ipc_trace = kzalloc(sizeof(*ipc_trace), GFP_KERNEL); in ipc_trace_init()
145 if (!ipc_trace) in ipc_trace_init()
148 ipc_trace->mode = TRACE_DISABLE; in ipc_trace_init()
149 ipc_trace->dev = ipc_imem->dev; in ipc_trace_init()
150 ipc_trace->ipc_imem = ipc_imem; in ipc_trace_init()
151 ipc_trace->chl_id = IPC_MEM_CTRL_CHL_ID_3; in ipc_trace_init()
153 mutex_init(&ipc_trace->trc_mutex); in ipc_trace_init()
155 ipc_trace->ctrl_file = debugfs_create_file(IOSM_TRC_DEBUGFS_TRACE_CTRL, in ipc_trace_init()
158 ipc_trace, &ipc_trace_fops); in ipc_trace_init()
160 ipc_trace->ipc_rchan = relay_open(IOSM_TRC_DEBUGFS_TRACE, in ipc_trace_init()
166 return ipc_trace; in ipc_trace_init()
173 void ipc_trace_deinit(struct iosm_trace *ipc_trace) in ipc_trace_deinit() argument
175 if (!ipc_trace) in ipc_trace_deinit()
178 debugfs_remove(ipc_trace->ctrl_file); in ipc_trace_deinit()
179 relay_close(ipc_trace->ipc_rchan); in ipc_trace_deinit()
180 mutex_destroy(&ipc_trace->trc_mutex); in ipc_trace_deinit()
181 kfree(ipc_trace); in ipc_trace_deinit()