1 // SPDX-License-Identifier: GPL-2.0-only
2 /* Copyright(c) 2023 Intel Corporation */
4 #include <linux/debugfs.h>
5 #include "adf_accel_devices.h"
7 #include "adf_common_drv.h"
8 #include "adf_cnv_dbgfs.h"
10 #include "adf_fw_counters.h"
11 #include "adf_heartbeat_dbgfs.h"
12 #include "adf_pm_dbgfs.h"
13 #include "adf_tl_debugfs.h"
16 * adf_dbgfs_init() - add persistent debugfs entries
17 * @accel_dev: Pointer to acceleration device.
19 * This function creates debugfs entries that are persistent through a device
20 * state change (from up to down or vice versa).
22 void adf_dbgfs_init(struct adf_accel_dev *accel_dev)
24 char name[ADF_DEVICE_NAME_LENGTH];
26 /* Create dev top level debugfs entry */
27 snprintf(name, sizeof(name), "%s%s_%s", ADF_DEVICE_NAME_PREFIX,
28 accel_dev->hw_device->dev_class->name,
29 pci_name(accel_dev->accel_pci_dev.pci_dev));
31 accel_dev->debugfs_dir = debugfs_create_dir(name, NULL);
33 adf_cfg_dev_dbgfs_add(accel_dev);
35 EXPORT_SYMBOL_GPL(adf_dbgfs_init);
38 * adf_dbgfs_exit() - remove persistent debugfs entries
39 * @accel_dev: Pointer to acceleration device.
41 void adf_dbgfs_exit(struct adf_accel_dev *accel_dev)
43 adf_cfg_dev_dbgfs_rm(accel_dev);
44 debugfs_remove(accel_dev->debugfs_dir);
46 EXPORT_SYMBOL_GPL(adf_dbgfs_exit);
49 * adf_dbgfs_add() - add non-persistent debugfs entries
50 * @accel_dev: Pointer to acceleration device.
52 * This function creates debugfs entries that are not persistent through
53 * a device state change (from up to down or vice versa).
55 void adf_dbgfs_add(struct adf_accel_dev *accel_dev)
57 if (!accel_dev->is_vf) {
58 adf_fw_counters_dbgfs_add(accel_dev);
59 adf_heartbeat_dbgfs_add(accel_dev);
60 adf_pm_dbgfs_add(accel_dev);
61 adf_cnv_dbgfs_add(accel_dev);
62 adf_tl_dbgfs_add(accel_dev);
67 * adf_dbgfs_rm() - remove non-persistent debugfs entries
68 * @accel_dev: Pointer to acceleration device.
70 void adf_dbgfs_rm(struct adf_accel_dev *accel_dev)
72 if (!accel_dev->is_vf) {
73 adf_tl_dbgfs_rm(accel_dev);
74 adf_cnv_dbgfs_rm(accel_dev);
75 adf_pm_dbgfs_rm(accel_dev);
76 adf_heartbeat_dbgfs_rm(accel_dev);
77 adf_fw_counters_dbgfs_rm(accel_dev);