aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/soc/soc-core.c66
-rw-r--r--sound/soc/soc-dapm.c3
-rw-r--r--sound/soc/soc-pcm.c8
3 files changed, 54 insertions, 23 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index d29c68ad83c7..9dfa2e241865 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -292,6 +292,9 @@ static const struct file_operations codec_reg_fops = {
292 292
293static void soc_init_component_debugfs(struct snd_soc_component *component) 293static void soc_init_component_debugfs(struct snd_soc_component *component)
294{ 294{
295 if (!component->card->debugfs_card_root)
296 return;
297
295 if (component->debugfs_prefix) { 298 if (component->debugfs_prefix) {
296 char *name; 299 char *name;
297 300
@@ -455,6 +458,9 @@ static const struct file_operations platform_list_fops = {
455 458
456static void soc_init_card_debugfs(struct snd_soc_card *card) 459static void soc_init_card_debugfs(struct snd_soc_card *card)
457{ 460{
461 if (!snd_soc_debugfs_root)
462 return;
463
458 card->debugfs_card_root = debugfs_create_dir(card->name, 464 card->debugfs_card_root = debugfs_create_dir(card->name,
459 snd_soc_debugfs_root); 465 snd_soc_debugfs_root);
460 if (!card->debugfs_card_root) { 466 if (!card->debugfs_card_root) {
@@ -476,6 +482,34 @@ static void soc_cleanup_card_debugfs(struct snd_soc_card *card)
476 debugfs_remove_recursive(card->debugfs_card_root); 482 debugfs_remove_recursive(card->debugfs_card_root);
477} 483}
478 484
485
486static void snd_soc_debugfs_init(void)
487{
488 snd_soc_debugfs_root = debugfs_create_dir("asoc", NULL);
489 if (IS_ERR(snd_soc_debugfs_root) || !snd_soc_debugfs_root) {
490 pr_warn("ASoC: Failed to create debugfs directory\n");
491 snd_soc_debugfs_root = NULL;
492 return;
493 }
494
495 if (!debugfs_create_file("codecs", 0444, snd_soc_debugfs_root, NULL,
496 &codec_list_fops))
497 pr_warn("ASoC: Failed to create CODEC list debugfs file\n");
498
499 if (!debugfs_create_file("dais", 0444, snd_soc_debugfs_root, NULL,
500 &dai_list_fops))
501 pr_warn("ASoC: Failed to create DAI list debugfs file\n");
502
503 if (!debugfs_create_file("platforms", 0444, snd_soc_debugfs_root, NULL,
504 &platform_list_fops))
505 pr_warn("ASoC: Failed to create platform list debugfs file\n");
506}
507
508static void snd_soc_debugfs_exit(void)
509{
510 debugfs_remove_recursive(snd_soc_debugfs_root);
511}
512
479#else 513#else
480 514
481#define soc_init_codec_debugfs NULL 515#define soc_init_codec_debugfs NULL
@@ -497,6 +531,15 @@ static inline void soc_init_card_debugfs(struct snd_soc_card *card)
497static inline void soc_cleanup_card_debugfs(struct snd_soc_card *card) 531static inline void soc_cleanup_card_debugfs(struct snd_soc_card *card)
498{ 532{
499} 533}
534
535static inline void snd_soc_debugfs_init(void)
536{
537}
538
539static inline void snd_soc_debugfs_exit(void)
540{
541}
542
500#endif 543#endif
501 544
502struct snd_pcm_substream *snd_soc_get_dai_substream(struct snd_soc_card *card, 545struct snd_pcm_substream *snd_soc_get_dai_substream(struct snd_soc_card *card,
@@ -3580,26 +3623,7 @@ EXPORT_SYMBOL_GPL(snd_soc_of_get_dai_link_codecs);
3580 3623
3581static int __init snd_soc_init(void) 3624static int __init snd_soc_init(void)
3582{ 3625{
3583#ifdef CONFIG_DEBUG_FS 3626 snd_soc_debugfs_init();
3584 snd_soc_debugfs_root = debugfs_create_dir("asoc", NULL);
3585 if (IS_ERR(snd_soc_debugfs_root) || !snd_soc_debugfs_root) {
3586 pr_warn("ASoC: Failed to create debugfs directory\n");
3587 snd_soc_debugfs_root = NULL;
3588 }
3589
3590 if (!debugfs_create_file("codecs", 0444, snd_soc_debugfs_root, NULL,
3591 &codec_list_fops))
3592 pr_warn("ASoC: Failed to create CODEC list debugfs file\n");
3593
3594 if (!debugfs_create_file("dais", 0444, snd_soc_debugfs_root, NULL,
3595 &dai_list_fops))
3596 pr_warn("ASoC: Failed to create DAI list debugfs file\n");
3597
3598 if (!debugfs_create_file("platforms", 0444, snd_soc_debugfs_root, NULL,
3599 &platform_list_fops))
3600 pr_warn("ASoC: Failed to create platform list debugfs file\n");
3601#endif
3602
3603 snd_soc_util_init(); 3627 snd_soc_util_init();
3604 3628
3605 return platform_driver_register(&soc_driver); 3629 return platform_driver_register(&soc_driver);
@@ -3609,9 +3633,9 @@ module_init(snd_soc_init);
3609static void __exit snd_soc_exit(void) 3633static void __exit snd_soc_exit(void)
3610{ 3634{
3611 snd_soc_util_exit(); 3635 snd_soc_util_exit();
3636 snd_soc_debugfs_exit();
3612 3637
3613#ifdef CONFIG_DEBUG_FS 3638#ifdef CONFIG_DEBUG_FS
3614 debugfs_remove_recursive(snd_soc_debugfs_root);
3615#endif 3639#endif
3616 platform_driver_unregister(&soc_driver); 3640 platform_driver_unregister(&soc_driver);
3617} 3641}
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index b6f88202b8c9..1fd2d458824e 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1898,6 +1898,9 @@ void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm,
1898{ 1898{
1899 struct dentry *d; 1899 struct dentry *d;
1900 1900
1901 if (!parent)
1902 return;
1903
1901 dapm->debugfs_dapm = debugfs_create_dir("dapm", parent); 1904 dapm->debugfs_dapm = debugfs_create_dir("dapm", parent);
1902 1905
1903 if (!dapm->debugfs_dapm) { 1906 if (!dapm->debugfs_dapm) {
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 9c514fde7154..b0d61e6531e6 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -1097,8 +1097,9 @@ static int dpcm_be_connect(struct snd_soc_pcm_runtime *fe,
1097 stream ? "<-" : "->", be->dai_link->name); 1097 stream ? "<-" : "->", be->dai_link->name);
1098 1098
1099#ifdef CONFIG_DEBUG_FS 1099#ifdef CONFIG_DEBUG_FS
1100 dpcm->debugfs_state = debugfs_create_u32(be->dai_link->name, 0644, 1100 if (fe->debugfs_dpcm_root)
1101 fe->debugfs_dpcm_root, &dpcm->state); 1101 dpcm->debugfs_state = debugfs_create_u32(be->dai_link->name, 0644,
1102 fe->debugfs_dpcm_root, &dpcm->state);
1102#endif 1103#endif
1103 return 1; 1104 return 1;
1104} 1105}
@@ -2807,6 +2808,9 @@ void soc_dpcm_debugfs_add(struct snd_soc_pcm_runtime *rtd)
2807 if (!rtd->dai_link) 2808 if (!rtd->dai_link)
2808 return; 2809 return;
2809 2810
2811 if (!rtd->card->debugfs_card_root)
2812 return;
2813
2810 rtd->debugfs_dpcm_root = debugfs_create_dir(rtd->dai_link->name, 2814 rtd->debugfs_dpcm_root = debugfs_create_dir(rtd->dai_link->name,
2811 rtd->card->debugfs_card_root); 2815 rtd->card->debugfs_card_root);
2812 if (!rtd->debugfs_dpcm_root) { 2816 if (!rtd->debugfs_dpcm_root) {