diff options
author | Jarkko Nikula <jhnikula@gmail.com> | 2010-11-05 14:35:21 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-11-06 11:28:35 -0400 |
commit | 3a45b8672d3f8542e430e7a5c7366ec9bdded054 (patch) | |
tree | e15feaaddb1f81727c0e9c0af3a9b5d642b96684 | |
parent | d6ce4cf3967dca78f967cd0bf70b175084885f40 (diff) |
ASoC: Move pop time from DAPM context to sound card
Based 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
Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r-- | include/sound/soc-dapm.h | 2 | ||||
-rw-r--r-- | include/sound/soc.h | 3 | ||||
-rw-r--r-- | sound/soc/codecs/cx20442.c | 6 | ||||
-rw-r--r-- | sound/soc/soc-core.c | 19 | ||||
-rw-r--r-- | sound/soc/soc-dapm.c | 30 |
5 files changed, 33 insertions, 27 deletions
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 5881876e8f5b..78d3560fa25a 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h | |||
@@ -469,7 +469,6 @@ struct snd_soc_dapm_widget { | |||
469 | 469 | ||
470 | /* DAPM context */ | 470 | /* DAPM context */ |
471 | struct snd_soc_dapm_context { | 471 | struct snd_soc_dapm_context { |
472 | u32 pop_time; | ||
473 | struct list_head widgets; | 472 | struct list_head widgets; |
474 | struct list_head paths; | 473 | struct list_head paths; |
475 | enum snd_soc_bias_level bias_level; | 474 | enum snd_soc_bias_level bias_level; |
@@ -479,6 +478,7 @@ struct snd_soc_dapm_context { | |||
479 | 478 | ||
480 | struct device *dev; /* from parent - for debug */ | 479 | struct device *dev; /* from parent - for debug */ |
481 | struct snd_soc_codec *codec; /* parent codec */ | 480 | struct snd_soc_codec *codec; /* parent codec */ |
481 | struct snd_soc_card *card; /* parent card */ | ||
482 | #ifdef CONFIG_DEBUG_FS | 482 | #ifdef CONFIG_DEBUG_FS |
483 | struct dentry *debugfs_dapm; | 483 | struct dentry *debugfs_dapm; |
484 | #endif | 484 | #endif |
diff --git a/include/sound/soc.h b/include/sound/soc.h index 95ce0ddd36d4..5d3954774ade 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
@@ -457,7 +457,6 @@ struct snd_soc_codec { | |||
457 | #ifdef CONFIG_DEBUG_FS | 457 | #ifdef CONFIG_DEBUG_FS |
458 | struct dentry *debugfs_codec_root; | 458 | struct dentry *debugfs_codec_root; |
459 | struct dentry *debugfs_reg; | 459 | struct dentry *debugfs_reg; |
460 | struct dentry *debugfs_pop_time; | ||
461 | struct dentry *debugfs_dapm; | 460 | struct dentry *debugfs_dapm; |
462 | #endif | 461 | #endif |
463 | }; | 462 | }; |
@@ -592,7 +591,9 @@ struct snd_soc_card { | |||
592 | 591 | ||
593 | #ifdef CONFIG_DEBUG_FS | 592 | #ifdef CONFIG_DEBUG_FS |
594 | struct dentry *debugfs_card_root; | 593 | struct dentry *debugfs_card_root; |
594 | struct dentry *debugfs_pop_time; | ||
595 | #endif | 595 | #endif |
596 | u32 pop_time; | ||
596 | }; | 597 | }; |
597 | 598 | ||
598 | /* SoC machine DAI configuration, glues a codec and cpu DAI together */ | 599 | /* SoC machine DAI configuration, glues a codec and cpu DAI together */ |
diff --git a/sound/soc/codecs/cx20442.c b/sound/soc/codecs/cx20442.c index 11beb1a77c4e..a9521acad99c 100644 --- a/sound/soc/codecs/cx20442.c +++ b/sound/soc/codecs/cx20442.c | |||
@@ -264,7 +264,7 @@ static void v253_close(struct tty_struct *tty) | |||
264 | /* Prevent the codec driver from further accessing the modem */ | 264 | /* Prevent the codec driver from further accessing the modem */ |
265 | codec->hw_write = NULL; | 265 | codec->hw_write = NULL; |
266 | cx20442->control_data = NULL; | 266 | cx20442->control_data = NULL; |
267 | codec->dapm.pop_time = 0; | 267 | codec->card->pop_time = 0; |
268 | } | 268 | } |
269 | 269 | ||
270 | /* Line discipline .hangup() */ | 270 | /* Line discipline .hangup() */ |
@@ -292,7 +292,7 @@ static void v253_receive(struct tty_struct *tty, | |||
292 | /* Set up codec driver access to modem controls */ | 292 | /* Set up codec driver access to modem controls */ |
293 | cx20442->control_data = tty; | 293 | cx20442->control_data = tty; |
294 | codec->hw_write = (hw_write_t)tty->ops->write; | 294 | codec->hw_write = (hw_write_t)tty->ops->write; |
295 | codec->dapm.pop_time = 1; | 295 | codec->card->pop_time = 1; |
296 | } | 296 | } |
297 | } | 297 | } |
298 | 298 | ||
@@ -349,7 +349,7 @@ static int cx20442_codec_probe(struct snd_soc_codec *codec) | |||
349 | 349 | ||
350 | cx20442->control_data = NULL; | 350 | cx20442->control_data = NULL; |
351 | codec->hw_write = NULL; | 351 | codec->hw_write = NULL; |
352 | codec->dapm.pop_time = 0; | 352 | codec->card->pop_time = 0; |
353 | 353 | ||
354 | return 0; | 354 | return 0; |
355 | } | 355 | } |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 57e5d7bfb130..f030521c48d1 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -255,13 +255,6 @@ static void soc_init_codec_debugfs(struct snd_soc_codec *codec) | |||
255 | printk(KERN_WARNING | 255 | printk(KERN_WARNING |
256 | "ASoC: Failed to create codec register debugfs file\n"); | 256 | "ASoC: Failed to create codec register debugfs file\n"); |
257 | 257 | ||
258 | codec->debugfs_pop_time = debugfs_create_u32("dapm_pop_time", 0644, | ||
259 | codec->debugfs_codec_root, | ||
260 | &codec->dapm.pop_time); | ||
261 | if (!codec->debugfs_pop_time) | ||
262 | printk(KERN_WARNING | ||
263 | "Failed to create pop time debugfs file\n"); | ||
264 | |||
265 | codec->dapm.debugfs_dapm = debugfs_create_dir("dapm", | 258 | codec->dapm.debugfs_dapm = debugfs_create_dir("dapm", |
266 | codec->debugfs_codec_root); | 259 | codec->debugfs_codec_root); |
267 | if (!codec->dapm.debugfs_dapm) | 260 | if (!codec->dapm.debugfs_dapm) |
@@ -380,9 +373,18 @@ static void soc_init_card_debugfs(struct snd_soc_card *card) | |||
380 | { | 373 | { |
381 | card->debugfs_card_root = debugfs_create_dir(card->name, | 374 | card->debugfs_card_root = debugfs_create_dir(card->name, |
382 | debugfs_root); | 375 | debugfs_root); |
383 | if (!card->debugfs_card_root) | 376 | if (!card->debugfs_card_root) { |
384 | dev_warn(card->dev, | 377 | dev_warn(card->dev, |
385 | "ASoC: Failed to create codec debugfs directory\n"); | 378 | "ASoC: Failed to create codec debugfs directory\n"); |
379 | return; | ||
380 | } | ||
381 | |||
382 | card->debugfs_pop_time = debugfs_create_u32("dapm_pop_time", 0644, | ||
383 | card->debugfs_card_root, | ||
384 | &card->pop_time); | ||
385 | if (!card->debugfs_pop_time) | ||
386 | dev_warn(card->dev, | ||
387 | "Failed to create pop time debugfs file\n"); | ||
386 | } | 388 | } |
387 | 389 | ||
388 | static void soc_cleanup_card_debugfs(struct snd_soc_card *card) | 390 | 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) | |||
1426 | 1428 | ||
1427 | /* probe the CODEC */ | 1429 | /* probe the CODEC */ |
1428 | if (!codec->probed) { | 1430 | if (!codec->probed) { |
1431 | codec->dapm.card = card; | ||
1429 | if (codec->driver->probe) { | 1432 | if (codec->driver->probe) { |
1430 | ret = codec->driver->probe(codec); | 1433 | ret = codec->driver->probe(codec); |
1431 | if (ret < 0) { | 1434 | if (ret < 0) { |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index b8f653eaffaa..960790cc6fbc 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -293,6 +293,7 @@ static int dapm_update_bits(struct snd_soc_dapm_widget *widget) | |||
293 | unsigned int old, new; | 293 | unsigned int old, new; |
294 | struct snd_soc_codec *codec = widget->codec; | 294 | struct snd_soc_codec *codec = widget->codec; |
295 | struct snd_soc_dapm_context *dapm = widget->dapm; | 295 | struct snd_soc_dapm_context *dapm = widget->dapm; |
296 | struct snd_soc_card *card = dapm->card; | ||
296 | 297 | ||
297 | /* check for valid widgets */ | 298 | /* check for valid widgets */ |
298 | if (widget->reg < 0 || widget->id == snd_soc_dapm_input || | 299 | 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) | |||
312 | 313 | ||
313 | change = old != new; | 314 | change = old != new; |
314 | if (change) { | 315 | if (change) { |
315 | pop_dbg(dapm->pop_time, "pop test %s : %s in %d ms\n", | 316 | pop_dbg(card->pop_time, "pop test %s : %s in %d ms\n", |
316 | widget->name, widget->power ? "on" : "off", | 317 | widget->name, widget->power ? "on" : "off", |
317 | dapm->pop_time); | 318 | card->pop_time); |
318 | pop_wait(dapm->pop_time); | 319 | pop_wait(card->pop_time); |
319 | snd_soc_write(codec, widget->reg, new); | 320 | snd_soc_write(codec, widget->reg, new); |
320 | } | 321 | } |
321 | pr_debug("reg %x old %x new %x change %d\n", widget->reg, | 322 | 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, | |||
720 | struct list_head *pending) | 721 | struct list_head *pending) |
721 | { | 722 | { |
722 | struct snd_soc_dapm_widget *w; | 723 | struct snd_soc_dapm_widget *w; |
724 | struct snd_soc_card *card = dapm->card; | ||
723 | int reg, power, ret; | 725 | int reg, power, ret; |
724 | unsigned int value = 0; | 726 | unsigned int value = 0; |
725 | unsigned int mask = 0; | 727 | unsigned int mask = 0; |
@@ -741,14 +743,14 @@ static void dapm_seq_run_coalesced(struct snd_soc_dapm_context *dapm, | |||
741 | if (power) | 743 | if (power) |
742 | value |= cur_mask; | 744 | value |= cur_mask; |
743 | 745 | ||
744 | pop_dbg(dapm->pop_time, | 746 | pop_dbg(card->pop_time, |
745 | "pop test : Queue %s: reg=0x%x, 0x%x/0x%x\n", | 747 | "pop test : Queue %s: reg=0x%x, 0x%x/0x%x\n", |
746 | w->name, reg, value, mask); | 748 | w->name, reg, value, mask); |
747 | 749 | ||
748 | /* power up pre event */ | 750 | /* power up pre event */ |
749 | if (w->power && w->event && | 751 | if (w->power && w->event && |
750 | (w->event_flags & SND_SOC_DAPM_PRE_PMU)) { | 752 | (w->event_flags & SND_SOC_DAPM_PRE_PMU)) { |
751 | pop_dbg(dapm->pop_time, "pop test : %s PRE_PMU\n", | 753 | pop_dbg(card->pop_time, "pop test : %s PRE_PMU\n", |
752 | w->name); | 754 | w->name); |
753 | ret = w->event(w, NULL, SND_SOC_DAPM_PRE_PMU); | 755 | ret = w->event(w, NULL, SND_SOC_DAPM_PRE_PMU); |
754 | if (ret < 0) | 756 | if (ret < 0) |
@@ -759,7 +761,7 @@ static void dapm_seq_run_coalesced(struct snd_soc_dapm_context *dapm, | |||
759 | /* power down pre event */ | 761 | /* power down pre event */ |
760 | if (!w->power && w->event && | 762 | if (!w->power && w->event && |
761 | (w->event_flags & SND_SOC_DAPM_PRE_PMD)) { | 763 | (w->event_flags & SND_SOC_DAPM_PRE_PMD)) { |
762 | pop_dbg(dapm->pop_time, "pop test : %s PRE_PMD\n", | 764 | pop_dbg(card->pop_time, "pop test : %s PRE_PMD\n", |
763 | w->name); | 765 | w->name); |
764 | ret = w->event(w, NULL, SND_SOC_DAPM_PRE_PMD); | 766 | ret = w->event(w, NULL, SND_SOC_DAPM_PRE_PMD); |
765 | if (ret < 0) | 767 | if (ret < 0) |
@@ -769,10 +771,10 @@ static void dapm_seq_run_coalesced(struct snd_soc_dapm_context *dapm, | |||
769 | } | 771 | } |
770 | 772 | ||
771 | if (reg >= 0) { | 773 | if (reg >= 0) { |
772 | pop_dbg(dapm->pop_time, | 774 | pop_dbg(card->pop_time, |
773 | "pop test : Applying 0x%x/0x%x to %x in %dms\n", | 775 | "pop test : Applying 0x%x/0x%x to %x in %dms\n", |
774 | value, mask, reg, dapm->pop_time); | 776 | value, mask, reg, card->pop_time); |
775 | pop_wait(dapm->pop_time); | 777 | pop_wait(card->pop_time); |
776 | snd_soc_update_bits(dapm->codec, reg, mask, value); | 778 | snd_soc_update_bits(dapm->codec, reg, mask, value); |
777 | } | 779 | } |
778 | 780 | ||
@@ -780,7 +782,7 @@ static void dapm_seq_run_coalesced(struct snd_soc_dapm_context *dapm, | |||
780 | /* power up post event */ | 782 | /* power up post event */ |
781 | if (w->power && w->event && | 783 | if (w->power && w->event && |
782 | (w->event_flags & SND_SOC_DAPM_POST_PMU)) { | 784 | (w->event_flags & SND_SOC_DAPM_POST_PMU)) { |
783 | pop_dbg(dapm->pop_time, "pop test : %s POST_PMU\n", | 785 | pop_dbg(card->pop_time, "pop test : %s POST_PMU\n", |
784 | w->name); | 786 | w->name); |
785 | ret = w->event(w, | 787 | ret = w->event(w, |
786 | NULL, SND_SOC_DAPM_POST_PMU); | 788 | NULL, SND_SOC_DAPM_POST_PMU); |
@@ -792,7 +794,7 @@ static void dapm_seq_run_coalesced(struct snd_soc_dapm_context *dapm, | |||
792 | /* power down post event */ | 794 | /* power down post event */ |
793 | if (!w->power && w->event && | 795 | if (!w->power && w->event && |
794 | (w->event_flags & SND_SOC_DAPM_POST_PMD)) { | 796 | (w->event_flags & SND_SOC_DAPM_POST_PMD)) { |
795 | pop_dbg(dapm->pop_time, "pop test : %s POST_PMD\n", | 797 | pop_dbg(card->pop_time, "pop test : %s POST_PMD\n", |
796 | w->name); | 798 | w->name); |
797 | ret = w->event(w, NULL, SND_SOC_DAPM_POST_PMD); | 799 | ret = w->event(w, NULL, SND_SOC_DAPM_POST_PMD); |
798 | if (ret < 0) | 800 | if (ret < 0) |
@@ -1012,9 +1014,9 @@ static int dapm_power_widgets(struct snd_soc_dapm_context *dapm, int event) | |||
1012 | pr_err("Failed to apply active bias: %d\n", ret); | 1014 | pr_err("Failed to apply active bias: %d\n", ret); |
1013 | } | 1015 | } |
1014 | 1016 | ||
1015 | pop_dbg(dapm->pop_time, "DAPM sequencing finished, waiting %dms\n", | 1017 | pop_dbg(card->pop_time, "DAPM sequencing finished, waiting %dms\n", |
1016 | dapm->pop_time); | 1018 | card->pop_time); |
1017 | pop_wait(dapm->pop_time); | 1019 | pop_wait(card->pop_time); |
1018 | 1020 | ||
1019 | return 0; | 1021 | return 0; |
1020 | } | 1022 | } |