aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/intel/skylake/skl-debug.c
diff options
context:
space:
mode:
authorVinod Koul <vinod.koul@intel.com>2017-06-29 23:36:05 -0400
committerMark Brown <broonie@kernel.org>2017-06-30 08:27:55 -0400
commit5cdf6c09ca9de3f037ba2d770206f3374459602d (patch)
treee9513d3eb62be6b9dfc7ca88f197e217c866285c /sound/soc/intel/skylake/skl-debug.c
parent46b5a4d249ac6798cee28de9f51ef80777d16a3e (diff)
ASoC: Intel: Skylake: Add debugfs support
For debug, the kernel debugfs mechanism is available. We can add various debug options for driver like module configuration read, firmware register read etc. This patch adds debugfs as a child to asoc plaform component and caller is added for skylake driver to do init and cleanup of debugfs. Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Vunny Sodhi <vunnyx.sodhi@intel.com> Signed-off-by: Guneshwor Singh <guneshwor.o.singh@intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/intel/skylake/skl-debug.c')
-rw-r--r--sound/soc/intel/skylake/skl-debug.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/sound/soc/intel/skylake/skl-debug.c b/sound/soc/intel/skylake/skl-debug.c
new file mode 100644
index 000000000000..6bc4565773c5
--- /dev/null
+++ b/sound/soc/intel/skylake/skl-debug.c
@@ -0,0 +1,55 @@
1/*
2 * skl-debug.c - Debugfs for skl driver
3 *
4 * Copyright (C) 2016-17 Intel Corp
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 */
15
16#include <linux/pci.h>
17#include <linux/debugfs.h>
18#include "skl.h"
19
20struct skl_debug {
21 struct skl *skl;
22 struct device *dev;
23
24 struct dentry *fs;
25};
26
27struct skl_debug *skl_debugfs_init(struct skl *skl)
28{
29 struct skl_debug *d;
30
31 d = devm_kzalloc(&skl->pci->dev, sizeof(*d), GFP_KERNEL);
32 if (!d)
33 return NULL;
34
35 /* create the debugfs dir with platform component's debugfs as parent */
36 d->fs = debugfs_create_dir("dsp",
37 skl->platform->component.debugfs_root);
38 if (IS_ERR(d->fs) || !d->fs) {
39 dev_err(&skl->pci->dev, "debugfs root creation failed\n");
40 return NULL;
41 }
42
43 d->skl = skl;
44 d->dev = &skl->pci->dev;
45
46 return d;
47}
48
49void skl_debugfs_exit(struct skl_debug *d)
50{
51 debugfs_remove_recursive(d->fs);
52
53 kfree(d);
54
55}