All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] ASoC: Add debugfs listing of registered CODECs
@ 2010-09-15 17:31 Mark Brown
  2010-09-15 17:31 ` [PATCH 2/3] ASoC: Add DAI list to debugfs Mark Brown
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Mark Brown @ 2010-09-15 17:31 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel, patches, Mark Brown

Help with diagnostics for machine driver setup by listing all the
registered CODECs in debugfs.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 sound/soc/soc-core.c |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 59b99fb..5e4a1f4 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -271,6 +271,33 @@ static void soc_cleanup_codec_debugfs(struct snd_soc_codec *codec)
 	debugfs_remove_recursive(codec->debugfs_codec_root);
 }
 
+static ssize_t codec_list_read_file(struct file *file, char __user *user_buf,
+				    size_t count, loff_t *ppos)
+{
+	char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
+	ssize_t ret = 0;
+	struct snd_soc_codec *codec;
+
+	if (!buf)
+		return -ENOMEM;
+
+	list_for_each_entry(codec, &codec_list, list)
+		ret += snprintf(buf + ret, PAGE_SIZE - ret, "%s\n",
+				codec->name);
+
+	if (ret >= 0)
+		ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret);
+
+	kfree(buf);
+
+	return ret;
+}
+
+static const struct file_operations codec_list_fops = {
+	.read = codec_list_read_file,
+	.llseek = default_llseek,/* read accesses f_pos */
+};
+
 #else
 
 static inline void soc_init_codec_debugfs(struct snd_soc_codec *codec)
@@ -3192,6 +3219,11 @@ static int __init snd_soc_init(void)
 		       "ASoC: Failed to create debugfs directory\n");
 		debugfs_root = NULL;
 	}
+
+	if (!debugfs_create_file("codecs", 0444, debugfs_root, NULL,
+				 &codec_list_fops))
+		pr_warn("ASoC: Failed to create CODEC list debugfs file\n");
+
 #endif
 
 	return platform_driver_register(&soc_driver);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] ASoC: Add DAI list to debugfs
  2010-09-15 17:31 [PATCH 1/3] ASoC: Add debugfs listing of registered CODECs Mark Brown
@ 2010-09-15 17:31 ` Mark Brown
  2010-09-15 17:31 ` [PATCH 3/3] ASoC: Add platform listing " Mark Brown
  2010-09-16 13:10 ` [PATCH 1/3] ASoC: Add debugfs listing of registered CODECs Liam Girdwood
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2010-09-15 17:31 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel, patches, Mark Brown

Allow the user to inspect the list of registered DAIs at runtime to
improve diagnostics for machine driver setup.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 sound/soc/soc-core.c |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 5e4a1f4..d4ae93c 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -298,6 +298,32 @@ static const struct file_operations codec_list_fops = {
 	.llseek = default_llseek,/* read accesses f_pos */
 };
 
+static ssize_t dai_list_read_file(struct file *file, char __user *user_buf,
+				  size_t count, loff_t *ppos)
+{
+	char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
+	ssize_t ret = 0;
+	struct snd_soc_dai *dai;
+
+	if (!buf)
+		return -ENOMEM;
+
+	list_for_each_entry(dai, &dai_list, list)
+		ret += snprintf(buf + ret, PAGE_SIZE - ret, "%s\n", dai->name);
+
+	if (ret >= 0)
+		ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret);
+
+	kfree(buf);
+
+	return ret;
+}
+
+static const struct file_operations dai_list_fops = {
+	.read = dai_list_read_file,
+	.llseek = default_llseek,/* read accesses f_pos */
+};
+
 #else
 
 static inline void soc_init_codec_debugfs(struct snd_soc_codec *codec)
@@ -3224,6 +3250,9 @@ static int __init snd_soc_init(void)
 				 &codec_list_fops))
 		pr_warn("ASoC: Failed to create CODEC list debugfs file\n");
 
+	if (!debugfs_create_file("dais", 0444, debugfs_root, NULL,
+				 &dai_list_fops))
+		pr_warn("ASoC: Failed to create DAI list debugfs file\n");
 #endif
 
 	return platform_driver_register(&soc_driver);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] ASoC: Add platform listing to debugfs
  2010-09-15 17:31 [PATCH 1/3] ASoC: Add debugfs listing of registered CODECs Mark Brown
  2010-09-15 17:31 ` [PATCH 2/3] ASoC: Add DAI list to debugfs Mark Brown
@ 2010-09-15 17:31 ` Mark Brown
  2010-09-16 13:10 ` [PATCH 1/3] ASoC: Add debugfs listing of registered CODECs Liam Girdwood
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2010-09-15 17:31 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel, patches, Mark Brown

List registered platforms in debugfs to improve debugability of machine
drivers.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 sound/soc/soc-core.c |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index d4ae93c..8d8c5cd 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -324,6 +324,34 @@ static const struct file_operations dai_list_fops = {
 	.llseek = default_llseek,/* read accesses f_pos */
 };
 
+static ssize_t platform_list_read_file(struct file *file,
+				       char __user *user_buf,
+				       size_t count, loff_t *ppos)
+{
+	char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
+	ssize_t ret = 0;
+	struct snd_soc_platform *platform;
+
+	if (!buf)
+		return -ENOMEM;
+
+	list_for_each_entry(platform, &platform_list, list)
+		ret += snprintf(buf + ret, PAGE_SIZE - ret, "%s\n",
+				platform->name);
+
+	if (ret >= 0)
+		ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret);
+
+	kfree(buf);
+
+	return ret;
+}
+
+static const struct file_operations platform_list_fops = {
+	.read = platform_list_read_file,
+	.llseek = default_llseek,/* read accesses f_pos */
+};
+
 #else
 
 static inline void soc_init_codec_debugfs(struct snd_soc_codec *codec)
@@ -3253,6 +3281,10 @@ static int __init snd_soc_init(void)
 	if (!debugfs_create_file("dais", 0444, debugfs_root, NULL,
 				 &dai_list_fops))
 		pr_warn("ASoC: Failed to create DAI list debugfs file\n");
+
+	if (!debugfs_create_file("platforms", 0444, debugfs_root, NULL,
+				 &platform_list_fops))
+		pr_warn("ASoC: Failed to create platform list debugfs file\n");
 #endif
 
 	return platform_driver_register(&soc_driver);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/3] ASoC: Add debugfs listing of registered CODECs
  2010-09-15 17:31 [PATCH 1/3] ASoC: Add debugfs listing of registered CODECs Mark Brown
  2010-09-15 17:31 ` [PATCH 2/3] ASoC: Add DAI list to debugfs Mark Brown
  2010-09-15 17:31 ` [PATCH 3/3] ASoC: Add platform listing " Mark Brown
@ 2010-09-16 13:10 ` Liam Girdwood
  2 siblings, 0 replies; 4+ messages in thread
From: Liam Girdwood @ 2010-09-16 13:10 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel, patches

On Wed, 2010-09-15 at 18:31 +0100, Mark Brown wrote:
> Help with diagnostics for machine driver setup by listing all the
> registered CODECs in debugfs.
> 
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> ---
>  sound/soc/soc-core.c |   32 ++++++++++++++++++++++++++++++++
>  1 files changed, 32 insertions(+), 0 deletions(-)
> 

All

Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>

-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-09-16 13:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-15 17:31 [PATCH 1/3] ASoC: Add debugfs listing of registered CODECs Mark Brown
2010-09-15 17:31 ` [PATCH 2/3] ASoC: Add DAI list to debugfs Mark Brown
2010-09-15 17:31 ` [PATCH 3/3] ASoC: Add platform listing " Mark Brown
2010-09-16 13:10 ` [PATCH 1/3] ASoC: Add debugfs listing of registered CODECs Liam Girdwood

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.