sound card dir under debugfs
cover sound card dir under debugfs
Hi
Part of the cross-device discussion raised the question that should the pop time to be per card instead of per device. Here's the set that introduces card dir under debugs/asoc/ and moves codec dirs and dapm_pop_time there.
This goes on top "ASoC: Decouple DAPM from CODECs".
Signature · 1 line
Jarkko
PATCH 1/3 ASoC: Add sound card directory under debugfs/asoc/
There will be need to have sound card specific debugfs entries. This patch introduces a new debugfs/asoc/{card->name}/ directory but does not add yet any entries there.
--- include/sound/soc.h | 4 ++++ sound/soc/soc-core.c | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 0 deletions(-)
include/sound/soc.h +4 -0
@@ -589,6 +589,10 @@ struct snd_soc_card {struct list_head codec_dev_list;struct list_head platform_dev_list;struct list_head dai_dev_list; + +#ifdef CONFIG_DEBUG_FS +struct dentry *debugfs_card_root; +#endif };/* SoC machine DAI configuration, glues a codec and cpu DAI together */
sound/soc/soc-core.c +18 -0
@@ -374,6 +374,20 @@ static const struct file_operations platform_list_fops = { .llseek = default_llseek,/* read accesses f_pos */ }; +static void soc_init_card_debugfs (struct snd_soc_card *card) +{ + card->debugfs_card_root =debugfs_create_dir (card->name, + debugfs_root); +if (!card->debugfs_card_root) +dev_warn (card->dev, +"ASoC: Failed to create codec debugfs directory\n" ); +} + +static void soc_cleanup_card_debugfs (struct snd_soc_card *card) +{ +debugfs_remove_recursive (card->debugfs_card_root); +} +#else static inline void soc_init_codec_debugfs (struct snd_soc_codec *codec)
@@ -1667,6 +1681,8 @@ static int soc_probe(struct platform_device *pdev)INIT_LIST_HEAD (&card->codec_dev_list);INIT_LIST_HEAD (&card->platform_dev_list); +soc_init_card_debugfs (card); + ret =snd_soc_register_card (card);if (ret !=0 ) {dev_err (&pdev->dev,"Failed to register card\n" );
@@ -1694,6 +1710,8 @@ static int soc_remove(struct platform_device *pdev)for (i =0 ; i < card->num_rtd; i++)soc_remove_dai_link (card, i); +soc_cleanup_card_debugfs (card); +/* remove the card */ if (card->remove) card->remove (pdev);
Signature · 1 line
1.7.2.3
PATCH 2/3 ASoC: Move codec debugfs directories under parent card directory
In reply to Jarkko NikulaMake use of sound card debugfs directory and move codec directories under the parent card debugfs directory.
debugfs/asoc/{codec dir} -> debugfs/asoc/{card->name}/{codec dir}.
--- sound/soc/soc-core.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
sound/soc/soc-core.c +4 -2
@@ -238,8 +238,10 @@ static const struct file_operations codec_reg_fops = {static void soc_init_codec_debugfs (struct snd_soc_codec *codec) { - codec->debugfs_codec_root =debugfs_create_dir (codec->name , - debugfs_root); +struct dentry *debugfs_card_root = codec->card->debugfs_card_root; + + codec->debugfs_codec_root =debugfs_create_dir (codec->name, + debugfs_card_root);if (!codec->debugfs_codec_root) {printk (KERN_WARNING "ASoC: Failed to create codec debugfs directory\n" );
Signature · 1 line
1.7.2.3
PATCH 3/3 ASoC: Move pop time from DAPM context to sound card
In reply to Jarkko NikulaBased on discussion the dapm_pop_time in debugsfs should be per card rather than per device. Single pop time value for entire card is cleaner when the DAPM sequencing is extended to cross-device paths.
debugfs/asoc/{card->name}/{codec dir}/dapm_pop_time ->
debugfs/asoc/{card->name}/dapm_pop_time
--- include/sound/soc-dapm.h | 2 +- include/sound/soc.h | 3 ++- sound/soc/codecs/cx20442.c | 6 +++--- sound/soc/soc-core.c | 19 +++++++++++-------- sound/soc/soc-dapm.c | 30 ++++++++++++++++-------------- 5 files changed, 33 insertions(+), 27 deletions(-)
include/sound/soc-dapm.h +1 -1
@@ -469,7 +469,6 @@ struct snd_soc_dapm_widget {/* DAPM context */ struct snd_soc_dapm_context { -u32 pop_time;struct list_head widgets;struct list_head paths;enum snd_soc_bias_level bias_level;
@@ -479,6 +478,7 @@ struct snd_soc_dapm_context {struct device *dev;/* from parent - for debug */ struct snd_soc_codec *codec;/* parent codec */ +struct snd_soc_card *card;/* parent card */ #ifdef CONFIG_DEBUG_FS struct dentry *debugfs_dapm;#endif
include/sound/soc.h +2 -1
@@ -457,7 +457,6 @@ struct snd_soc_codec {#ifdef CONFIG_DEBUG_FS struct dentry *debugfs_codec_root;struct dentry *debugfs_reg; -struct dentry *debugfs_pop_time;struct dentry *debugfs_dapm;#endif };
@@ -592,7 +591,9 @@ struct snd_soc_card {#ifdef CONFIG_DEBUG_FS struct dentry *debugfs_card_root; +struct dentry *debugfs_pop_time;#endif +u32 pop_time; };/* SoC machine DAI configuration, glues a codec and cpu DAI together */
sound/soc/codecs/cx20442.c +3 -3
@@ -264,7 +264,7 @@ static void v253_close(struct tty_struct *tty)/* Prevent the codec driver from further accessing the modem */ codec->hw_write =NULL ; cx20442->control_data =NULL ; - codec->dapm.pop_time =0 ; + codec->card->pop_time =0 ; }/* Line discipline .hangup() */
@@ -292,7 +292,7 @@ static void v253_receive(struct tty_struct *tty,/* Set up codec driver access to modem controls */ cx20442->control_data = tty; codec->hw_write = (hw_write_t )tty->ops->write; - codec->dapm.pop_time =1 ; + codec->card->pop_time =1 ; } }
@@ -349,7 +349,7 @@ static int cx20442_codec_probe(struct snd_soc_codec *codec) cx20442->control_data =NULL ; codec->hw_write =NULL ; - codec->dapm.pop_time =0 ; + codec->card->pop_time =0 ;return 0 ; }
sound/soc/soc-core.c +11 -8
@@ -255,13 +255,6 @@ static void soc_init_codec_debugfs(struct snd_soc_codec *codec)printk (KERN_WARNING "ASoC: Failed to create codec register debugfs file\n" ); - codec->debugfs_pop_time =debugfs_create_u32 ("dapm_pop_time" ,0644 , - codec->debugfs_codec_root, - &codec->dapm.pop_time); -if (!codec->debugfs_pop_time) -printk (KERN_WARNING -"Failed to create pop time debugfs file\n" ); - codec->dapm.debugfs_dapm =debugfs_create_dir ("dapm" , codec->debugfs_codec_root);if (!codec->dapm.debugfs_dapm)
@@ -380,9 +373,18 @@ static void soc_init_card_debugfs(struct snd_soc_card *card) { card->debugfs_card_root =debugfs_create_dir (card->name, debugfs_root); -if (!card->debugfs_card_root) +if (!card->debugfs_card_root) {dev_warn (card->dev,"ASoC: Failed to create codec debugfs directory\n" ); +return ; + } + + card->debugfs_pop_time =debugfs_create_u32 ("dapm_pop_time" ,0644 , + card->debugfs_card_root, + &card->pop_time); +if (!card->debugfs_pop_time) +dev_warn (card->dev, +"Failed to create pop time debugfs file\n" ); }static void soc_cleanup_card_debugfs (struct snd_soc_card *card)
@@ -1426,6 +1428,7 @@ static int soc_probe_dai_link(struct snd_soc_card *card, int num)/* probe the CODEC */ if (!codec->probed) { + codec->dapm.card = card;if (codec->driver->probe) { ret = codec->driver->probe (codec);if (ret <0 ) {
sound/soc/soc-dapm.c +16 -14
@@ -293,6 +293,7 @@ static int dapm_update_bits(struct snd_soc_dapm_widget *widget)unsigned int old, new;struct snd_soc_codec *codec = widget->codec;struct snd_soc_dapm_context *dapm = widget->dapm; +struct snd_soc_card *card = dapm->card;/* check for valid widgets */ if (widget->reg < 0 || widget->id == snd_soc_dapm_input ||
@@ -312,10 +313,10 @@ static int dapm_update_bits(struct snd_soc_dapm_widget *widget) change = old != new;if (change) { -pop_dbg (dapm->pop_time,"pop test %s : %s in %d ms\n" , +pop_dbg (card->pop_time,"pop test %s : %s in %d ms\n" , widget->name, widget->power ?"on" :"off" , - dapm->pop_time); -pop_wait (dapm->pop_time); + card->pop_time); +pop_wait (card->pop_time);snd_soc_write (codec, widget->reg, new); } pr_debug("reg %x old %x new %x change %d\n", widget->reg,
@@ -720,6 +721,7 @@ static void dapm_seq_run_coalesced(struct snd_soc_dapm_context *dapm, struct list_head *pending) {struct snd_soc_dapm_widget *w; +struct snd_soc_card *card = dapm->card;int reg, power, ret;unsigned int value =0 ;unsigned int mask =0 ;
@@ -741,14 +743,14 @@ static void dapm_seq_run_coalesced(struct snd_soc_dapm_context *dapm,if (power) value |= cur_mask; -pop_dbg (dapm->pop_time, +pop_dbg (card->pop_time,"pop test : Queue %s: reg=0x%x, 0x%x/0x%x\n" , w->name, reg, value, mask);/* power up pre event */ if (w->power && w->event && (w->event_flags &SND_SOC_DAPM_PRE_PMU )) { -pop_dbg (dapm->pop_time,"pop test : %s PRE_PMU\n" , +pop_dbg (card->pop_time,"pop test : %s PRE_PMU\n" , w->name); ret = w->event (w,NULL ,SND_SOC_DAPM_PRE_PMU );if (ret <0 )
@@ -759,7 +761,7 @@ static void dapm_seq_run_coalesced(struct snd_soc_dapm_context *dapm,/* power down pre event */ if (!w->power && w->event && (w->event_flags &SND_SOC_DAPM_PRE_PMD )) { -pop_dbg (dapm->pop_time,"pop test : %s PRE_PMD\n" , +pop_dbg (card->pop_time,"pop test : %s PRE_PMD\n" , w->name); ret = w->event (w,NULL ,SND_SOC_DAPM_PRE_PMD );if (ret <0 )
@@ -769,10 +771,10 @@ static void dapm_seq_run_coalesced(struct snd_soc_dapm_context *dapm, }if (reg >=0 ) { -pop_dbg (dapm->pop_time, +pop_dbg (card->pop_time,"pop test : Applying 0x%x/0x%x to %x in %dms\n" , - value, mask, reg, dapm->pop_time); -pop_wait (dapm->pop_time); + value, mask, reg, card->pop_time); +pop_wait (card->pop_time);snd_soc_update_bits (dapm->codec, reg, mask, value); }
@@ -780,7 +782,7 @@ static void dapm_seq_run_coalesced(struct snd_soc_dapm_context *dapm,/* power up post event */ if (w->power && w->event && (w->event_flags &SND_SOC_DAPM_POST_PMU )) { -pop_dbg (dapm->pop_time,"pop test : %s POST_PMU\n" , +pop_dbg (card->pop_time,"pop test : %s POST_PMU\n" , w->name); ret = w->event (w,NULL ,SND_SOC_DAPM_POST_PMU );
@@ -792,7 +794,7 @@ static void dapm_seq_run_coalesced(struct snd_soc_dapm_context *dapm,/* power down post event */ if (!w->power && w->event && (w->event_flags &SND_SOC_DAPM_POST_PMD )) { -pop_dbg (dapm->pop_time,"pop test : %s POST_PMD\n" , +pop_dbg (card->pop_time,"pop test : %s POST_PMD\n" , w->name); ret = w->event (w,NULL ,SND_SOC_DAPM_POST_PMD );if (ret <0 )
@@ -1012,9 +1014,9 @@ static int dapm_power_widgets(struct snd_soc_dapm_context *dapm, int event)pr_err ("Failed to apply active bias: %d\n" , ret); } -pop_dbg (dapm->pop_time,"DAPM sequencing finished, waiting %dms\n" , - dapm->pop_time); -pop_wait (dapm->pop_time); +pop_dbg (card->pop_time,"DAPM sequencing finished, waiting %dms\n" , + card->pop_time); +pop_wait (card->pop_time);return 0 ; }
Signature · 1 line
1.7.2.3
Quoted 1 line · Jarkko Nikula
This goes on top "ASoC: Decouple DAPM from CODECs".
As requested please resubmit that with a fixed changelog.
Quoted 5 lines · On Fri, 5 Nov 2010 14:36:17 -0400 Mark Brown…
Quoted 1 line · Jarkko Nikula
This goes on top "ASoC: Decouple DAPM from CODECs".
As requested please resubmit that with a fixed changelog.
Now I don't get it? This is new stuff. The patch that needs an updated changelog will come later.
Signature · 1 line
Jarkko
Quoted 8 lines · Jarkko Nikula
Quoted 3 lines · Mark Brown
Quoted 1 line
This goes on top "ASoC: Decouple DAPM from CODECs".
As requested please resubmit that with a fixed changelog.
Now I don't get it? This is new stuff. The patch that needs an updated changelog will come later.
Please resubmit the stuff you're depending on.
Quoted 11 lines · On Fri, 5 Nov 2010 18:39:37 +0000 Mark Brown…
Quoted 8 lines · Jarkko Nikula
Quoted 3 lines · Mark Brown
Quoted 1 line
This goes on top "ASoC: Decouple DAPM from CODECs".
As requested please resubmit that with a fixed changelog.
Now I don't get it? This is new stuff. The patch that needs an updated changelog will come later.
Please resubmit the stuff you're depending on.
Only dependency is this which got applied as far as I got it:
http://mailman.alsa-project.org/pipermail/alsa-devel/2010-November/033419.html
Signature · 1 line
Jarkko
Quoted 7 lines · Jarkko Nikula
Quoted 1 line · Mark Brown
Please resubmit the stuff you're depending on.
Only dependency is this which got applied as far as I got it:
http://mailman.alsa-project.org/pipermail/alsa-devel/2010-November/033419.html
Oh, in which case there's no need to note the dependency since it's already in the tree :) Saying something like "recently merged" helps here - otherwise I'll tend to read a message like that as saying that the patch can't currently be applied due to other outstanding work.
Quoted 5 lines · On Fri, 5 Nov 2010 14:46:03 -0400 Mark Brown…
Quoted 3 lines · Jarkko Nikula
Quoted 1 line · Mark Brown
Please resubmit the stuff you're depending on.
Quoted 8 lines
Quoted 3 lines
Only dependency is this which got applied as far as I got it:
http://mailman.alsa-project.org/pipermail/alsa-devel/2010-November/033419.html
Oh, in which case there's no need to note the dependency since it's already in the tree :) Saying something like "recently merged" helps here - otherwise I'll tend to read a message like that as saying that the patch can't currently be applied due to other outstanding work.
Heh, I try to be more verbose in the future :-)
Signature · 1 line
Jarkko
Quoted 1 line · Jarkko Nikula
Heh, I try to be more verbose in the future :-)
No problem. Things look good to me on first read through, but obviously we need to wait for Liam's review.
Liam Girdwood
Acked-byQuoted 6 lines · Mark Brown
Quoted 1 line · Jarkko Nikula
Heh, I try to be more verbose in the future :-)
No problem. Things look good to me on first read through, but obviously we need to wait for Liam's review.
All
Signature · 3 lines
Freelance Developer, SlimLogic Ltd ASoC and Voltage Regulator Maintainer. http://www.slimlogic.co.uk