summaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-core.c
diff options
context:
space:
mode:
authorSebastien Guiriec2012-02-15 16:25:31 +0100
committerMark Brown2012-02-15 17:05:18 +0100
commit731f1ab290ca1e59430ab222290d379222eb38a5 (patch)
treeaacd52320691daeb0e41e12336b35a8257931462 /sound/soc/soc-core.c
parentASoC: dapm: Convert pin switches to use snd_soc_card (diff)
downloadkernel-qcow2-linux-731f1ab290ca1e59430ab222290d379222eb38a5.tar.gz
kernel-qcow2-linux-731f1ab290ca1e59430ab222290d379222eb38a5.tar.xz
kernel-qcow2-linux-731f1ab290ca1e59430ab222290d379222eb38a5.zip
ASoC: core: add platform DAPM debugfs support
Allow platform widgets to be visible in debugfs like codec widgets. Signed-off-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r--sound/soc/soc-core.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 50b8b80acdf4..6bad7cd4131e 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -300,6 +300,27 @@ static void soc_cleanup_codec_debugfs(struct snd_soc_codec *codec)
debugfs_remove_recursive(codec->debugfs_codec_root);
}
+static void soc_init_platform_debugfs(struct snd_soc_platform *platform)
+{
+ struct dentry *debugfs_card_root = platform->card->debugfs_card_root;
+
+ platform->debugfs_platform_root = debugfs_create_dir(platform->name,
+ debugfs_card_root);
+ if (!platform->debugfs_platform_root) {
+ dev_warn(platform->dev,
+ "Failed to create platform debugfs directory\n");
+ return;
+ }
+
+ snd_soc_dapm_debugfs_init(&platform->dapm,
+ platform->debugfs_platform_root);
+}
+
+static void soc_cleanup_platform_debugfs(struct snd_soc_platform *platform)
+{
+ debugfs_remove_recursive(platform->debugfs_platform_root);
+}
+
static ssize_t codec_list_read_file(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
@@ -433,6 +454,14 @@ static inline void soc_cleanup_codec_debugfs(struct snd_soc_codec *codec)
{
}
+static inline void soc_init_platform_debugfs(struct snd_soc_platform *platform)
+{
+}
+
+static inline void soc_cleanup_platform_debugfs(struct snd_soc_platform *platform)
+{
+}
+
static inline void soc_init_card_debugfs(struct snd_soc_card *card)
{
}
@@ -920,6 +949,7 @@ static void soc_remove_dai_link(struct snd_soc_card *card, int num, int order)
/* Make sure all DAPM widgets are freed */
snd_soc_dapm_free(&platform->dapm);
+ soc_cleanup_platform_debugfs(platform);
platform->probed = 0;
list_del(&platform->card_list);
module_put(platform->dev->driver->owner);
@@ -1037,6 +1067,8 @@ static int soc_probe_platform(struct snd_soc_card *card,
if (!try_module_get(platform->dev->driver->owner))
return -ENODEV;
+ soc_init_platform_debugfs(platform);
+
if (driver->dapm_widgets)
snd_soc_dapm_new_controls(&platform->dapm,
driver->dapm_widgets, driver->num_dapm_widgets);