1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Copyright (C) 2020-2021 Intel Corporation.
4  */
5 
6 #include <linux/debugfs.h>
7 #include <linux/wwan.h>
8 
9 #include "iosm_ipc_imem.h"
10 #include "iosm_ipc_trace.h"
11 #include "iosm_ipc_debugfs.h"
12 
ipc_debugfs_init(struct iosm_imem * ipc_imem)13 void ipc_debugfs_init(struct iosm_imem *ipc_imem)
14 {
15 	ipc_imem->debugfs_wwan_dir = wwan_get_debugfs_dir(ipc_imem->dev);
16 
17 	ipc_imem->debugfs_dir = debugfs_create_dir(KBUILD_MODNAME,
18 						   ipc_imem->debugfs_wwan_dir);
19 
20 	ipc_imem->trace = ipc_trace_init(ipc_imem);
21 	if (!ipc_imem->trace)
22 		dev_warn(ipc_imem->dev, "trace channel init failed");
23 }
24 
ipc_debugfs_deinit(struct iosm_imem * ipc_imem)25 void ipc_debugfs_deinit(struct iosm_imem *ipc_imem)
26 {
27 	ipc_trace_deinit(ipc_imem->trace);
28 	debugfs_remove_recursive(ipc_imem->debugfs_dir);
29 	wwan_put_debugfs_dir(ipc_imem->debugfs_wwan_dir);
30 }
31