diff options
author | Vinod Koul <vinod.koul@intel.com> | 2017-06-30 09:06:05 +0530 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2017-06-30 13:27:55 +0100 |
commit | 5cdf6c09ca9de3f037ba2d770206f3374459602d (patch) | |
tree | e9513d3eb62be6b9dfc7ca88f197e217c866285c /sound/soc/intel/skylake/skl-debug.c | |
parent | 46b5a4d249ac6798cee28de9f51ef80777d16a3e (diff) | |
download | op-kernel-dev-5cdf6c09ca9de3f037ba2d770206f3374459602d.zip op-kernel-dev-5cdf6c09ca9de3f037ba2d770206f3374459602d.tar.gz |
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.c | 55 |
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 0000000..6bc4565 --- /dev/null +++ b/sound/soc/intel/skylake/skl-debug.c @@ -0,0 +1,55 @@ +/* + * skl-debug.c - Debugfs for skl driver + * + * Copyright (C) 2016-17 Intel Corp + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + */ + +#include <linux/pci.h> +#include <linux/debugfs.h> +#include "skl.h" + +struct skl_debug { + struct skl *skl; + struct device *dev; + + struct dentry *fs; +}; + +struct skl_debug *skl_debugfs_init(struct skl *skl) +{ + struct skl_debug *d; + + d = devm_kzalloc(&skl->pci->dev, sizeof(*d), GFP_KERNEL); + if (!d) + return NULL; + + /* create the debugfs dir with platform component's debugfs as parent */ + d->fs = debugfs_create_dir("dsp", + skl->platform->component.debugfs_root); + if (IS_ERR(d->fs) || !d->fs) { + dev_err(&skl->pci->dev, "debugfs root creation failed\n"); + return NULL; + } + + d->skl = skl; + d->dev = &skl->pci->dev; + + return d; +} + +void skl_debugfs_exit(struct skl_debug *d) +{ + debugfs_remove_recursive(d->fs); + + kfree(d); + +} |