aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-core.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2010-09-15 13:19:07 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-09-16 09:14:02 -0400
commitf320878032be5c755509583c8a24b57d2ee50b20 (patch)
tree0c93ef9f5470c924626437f842365b4999aad3ad /sound/soc/soc-core.c
parentc3c5a19a50866869996cc219aed2021acf091d6e (diff)
ASoC: Add DAI list to debugfs
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> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r--sound/soc/soc-core.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 94a2edf9cfd5..63d93b3b7b7a 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -297,6 +297,32 @@ static const struct file_operations codec_list_fops = {
297 .llseek = default_llseek,/* read accesses f_pos */ 297 .llseek = default_llseek,/* read accesses f_pos */
298}; 298};
299 299
300static ssize_t dai_list_read_file(struct file *file, char __user *user_buf,
301 size_t count, loff_t *ppos)
302{
303 char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
304 ssize_t ret = 0;
305 struct snd_soc_dai *dai;
306
307 if (!buf)
308 return -ENOMEM;
309
310 list_for_each_entry(dai, &dai_list, list)
311 ret += snprintf(buf + ret, PAGE_SIZE - ret, "%s\n", dai->name);
312
313 if (ret >= 0)
314 ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret);
315
316 kfree(buf);
317
318 return ret;
319}
320
321static const struct file_operations dai_list_fops = {
322 .read = dai_list_read_file,
323 .llseek = default_llseek,/* read accesses f_pos */
324};
325
300#else 326#else
301 327
302static inline void soc_init_codec_debugfs(struct snd_soc_codec *codec) 328static inline void soc_init_codec_debugfs(struct snd_soc_codec *codec)
@@ -3223,6 +3249,9 @@ static int __init snd_soc_init(void)
3223 &codec_list_fops)) 3249 &codec_list_fops))
3224 pr_warn("ASoC: Failed to create CODEC list debugfs file\n"); 3250 pr_warn("ASoC: Failed to create CODEC list debugfs file\n");
3225 3251
3252 if (!debugfs_create_file("dais", 0444, debugfs_root, NULL,
3253 &dai_list_fops))
3254 pr_warn("ASoC: Failed to create DAI list debugfs file\n");
3226#endif 3255#endif
3227 3256
3228 return platform_driver_register(&soc_driver); 3257 return platform_driver_register(&soc_driver);