Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jarkko Nikula and committed by
Mark Brown
3a45b867 d6ce4cf3

+33 -27
+1 -1
include/sound/soc-dapm.h
··· 469 469 470 470 /* DAPM context */ 471 471 struct snd_soc_dapm_context { 472 - u32 pop_time; 473 472 struct list_head widgets; 474 473 struct list_head paths; 475 474 enum snd_soc_bias_level bias_level; ··· 478 479 479 480 struct device *dev; /* from parent - for debug */ 480 481 struct snd_soc_codec *codec; /* parent codec */ 482 + struct snd_soc_card *card; /* parent card */ 481 483 #ifdef CONFIG_DEBUG_FS 482 484 struct dentry *debugfs_dapm; 483 485 #endif
+2 -1
include/sound/soc.h
··· 457 457 #ifdef CONFIG_DEBUG_FS 458 458 struct dentry *debugfs_codec_root; 459 459 struct dentry *debugfs_reg; 460 - struct dentry *debugfs_pop_time; 461 460 struct dentry *debugfs_dapm; 462 461 #endif 463 462 }; ··· 591 592 592 593 #ifdef CONFIG_DEBUG_FS 593 594 struct dentry *debugfs_card_root; 595 + struct dentry *debugfs_pop_time; 594 596 #endif 597 + u32 pop_time; 595 598 }; 596 599 597 600 /* SoC machine DAI configuration, glues a codec and cpu DAI together */
+3 -3
sound/soc/codecs/cx20442.c
··· 264 264 /* Prevent the codec driver from further accessing the modem */ 265 265 codec->hw_write = NULL; 266 266 cx20442->control_data = NULL; 267 - codec->dapm.pop_time = 0; 267 + codec->card->pop_time = 0; 268 268 } 269 269 270 270 /* Line discipline .hangup() */ ··· 292 292 /* Set up codec driver access to modem controls */ 293 293 cx20442->control_data = tty; 294 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 349 350 350 cx20442->control_data = NULL; 351 351 codec->hw_write = NULL; 352 - codec->dapm.pop_time = 0; 352 + codec->card->pop_time = 0; 353 353 354 354 return 0; 355 355 }
+11 -8
sound/soc/soc-core.c
··· 255 255 printk(KERN_WARNING 256 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 258 codec->dapm.debugfs_dapm = debugfs_create_dir("dapm", 266 259 codec->debugfs_codec_root); 267 260 if (!codec->dapm.debugfs_dapm) ··· 373 380 { 374 381 card->debugfs_card_root = debugfs_create_dir(card->name, 375 382 debugfs_root); 376 - if (!card->debugfs_card_root) 383 + if (!card->debugfs_card_root) { 377 384 dev_warn(card->dev, 378 385 "ASoC: Failed to create codec debugfs directory\n"); 386 + return; 387 + } 388 + 389 + card->debugfs_pop_time = debugfs_create_u32("dapm_pop_time", 0644, 390 + card->debugfs_card_root, 391 + &card->pop_time); 392 + if (!card->debugfs_pop_time) 393 + dev_warn(card->dev, 394 + "Failed to create pop time debugfs file\n"); 379 395 } 380 396 381 397 static void soc_cleanup_card_debugfs(struct snd_soc_card *card) ··· 1428 1426 1429 1427 /* probe the CODEC */ 1430 1428 if (!codec->probed) { 1429 + codec->dapm.card = card; 1431 1430 if (codec->driver->probe) { 1432 1431 ret = codec->driver->probe(codec); 1433 1432 if (ret < 0) {
+16 -14
sound/soc/soc-dapm.c
··· 293 293 unsigned int old, new; 294 294 struct snd_soc_codec *codec = widget->codec; 295 295 struct snd_soc_dapm_context *dapm = widget->dapm; 296 + struct snd_soc_card *card = dapm->card; 296 297 297 298 /* check for valid widgets */ 298 299 if (widget->reg < 0 || widget->id == snd_soc_dapm_input || ··· 313 312 314 313 change = old != new; 315 314 if (change) { 316 - pop_dbg(dapm->pop_time, "pop test %s : %s in %d ms\n", 315 + pop_dbg(card->pop_time, "pop test %s : %s in %d ms\n", 317 316 widget->name, widget->power ? "on" : "off", 318 - dapm->pop_time); 319 - pop_wait(dapm->pop_time); 317 + card->pop_time); 318 + pop_wait(card->pop_time); 320 319 snd_soc_write(codec, widget->reg, new); 321 320 } 322 321 pr_debug("reg %x old %x new %x change %d\n", widget->reg, ··· 721 720 struct list_head *pending) 722 721 { 723 722 struct snd_soc_dapm_widget *w; 723 + struct snd_soc_card *card = dapm->card; 724 724 int reg, power, ret; 725 725 unsigned int value = 0; 726 726 unsigned int mask = 0; ··· 743 741 if (power) 744 742 value |= cur_mask; 745 743 746 - pop_dbg(dapm->pop_time, 744 + pop_dbg(card->pop_time, 747 745 "pop test : Queue %s: reg=0x%x, 0x%x/0x%x\n", 748 746 w->name, reg, value, mask); 749 747 750 748 /* power up pre event */ 751 749 if (w->power && w->event && 752 750 (w->event_flags & SND_SOC_DAPM_PRE_PMU)) { 753 - pop_dbg(dapm->pop_time, "pop test : %s PRE_PMU\n", 751 + pop_dbg(card->pop_time, "pop test : %s PRE_PMU\n", 754 752 w->name); 755 753 ret = w->event(w, NULL, SND_SOC_DAPM_PRE_PMU); 756 754 if (ret < 0) ··· 761 759 /* power down pre event */ 762 760 if (!w->power && w->event && 763 761 (w->event_flags & SND_SOC_DAPM_PRE_PMD)) { 764 - pop_dbg(dapm->pop_time, "pop test : %s PRE_PMD\n", 762 + pop_dbg(card->pop_time, "pop test : %s PRE_PMD\n", 765 763 w->name); 766 764 ret = w->event(w, NULL, SND_SOC_DAPM_PRE_PMD); 767 765 if (ret < 0) ··· 771 769 } 772 770 773 771 if (reg >= 0) { 774 - pop_dbg(dapm->pop_time, 772 + pop_dbg(card->pop_time, 775 773 "pop test : Applying 0x%x/0x%x to %x in %dms\n", 776 - value, mask, reg, dapm->pop_time); 777 - pop_wait(dapm->pop_time); 774 + value, mask, reg, card->pop_time); 775 + pop_wait(card->pop_time); 778 776 snd_soc_update_bits(dapm->codec, reg, mask, value); 779 777 } 780 778 ··· 782 780 /* power up post event */ 783 781 if (w->power && w->event && 784 782 (w->event_flags & SND_SOC_DAPM_POST_PMU)) { 785 - pop_dbg(dapm->pop_time, "pop test : %s POST_PMU\n", 783 + pop_dbg(card->pop_time, "pop test : %s POST_PMU\n", 786 784 w->name); 787 785 ret = w->event(w, 788 786 NULL, SND_SOC_DAPM_POST_PMU); ··· 794 792 /* power down post event */ 795 793 if (!w->power && w->event && 796 794 (w->event_flags & SND_SOC_DAPM_POST_PMD)) { 797 - pop_dbg(dapm->pop_time, "pop test : %s POST_PMD\n", 795 + pop_dbg(card->pop_time, "pop test : %s POST_PMD\n", 798 796 w->name); 799 797 ret = w->event(w, NULL, SND_SOC_DAPM_POST_PMD); 800 798 if (ret < 0) ··· 1014 1012 pr_err("Failed to apply active bias: %d\n", ret); 1015 1013 } 1016 1014 1017 - pop_dbg(dapm->pop_time, "DAPM sequencing finished, waiting %dms\n", 1018 - dapm->pop_time); 1019 - pop_wait(dapm->pop_time); 1015 + pop_dbg(card->pop_time, "DAPM sequencing finished, waiting %dms\n", 1016 + card->pop_time); 1017 + pop_wait(card->pop_time); 1020 1018 1021 1019 return 0; 1022 1020 }