aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-core.c
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2014-11-10 16:41:52 -0500
committerMark Brown <broonie@kernel.org>2014-11-18 10:38:03 -0500
commitbc2632140435cc84f9817f1c362479b23dbdfebc (patch)
treeb0fa79ee19c71ddd1a243721f1e91380a3fe1b19 /sound/soc/soc-core.c
parent4bafcf074aca3bd191e4d93c6a140ca52654f192 (diff)
ASoC: Rename snd_soc_dai_driver struct ac97_control field to bus_control
Setting the ac97_control field on a CPU DAI tells the ASoC core that this DAI in addition to audio data also transports control data to the CODEC. This causes the core to suspend the DAI after the CODEC and resume it before the CODEC so communication to the CODEC is still possible. This is not necessarily something that is specific to AC'97 and can be used by other buses with the same requirement. This patch renames the flag from ac97_control to bus_control to make this explicit. While we are at it also change the type from int to bool. The following semantich patch was used for automatic conversion of the drivers: // <smpl> @@ identifier drv; @@ struct snd_soc_dai_driver drv = { - .ac97_control + .bus_control = - 1 + true }; // </smpl> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r--sound/soc/soc-core.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index fba6e28e18d3..f5bebca84b71 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -550,7 +550,7 @@ int snd_soc_suspend(struct device *dev)
550 if (card->rtd[i].dai_link->ignore_suspend) 550 if (card->rtd[i].dai_link->ignore_suspend)
551 continue; 551 continue;
552 552
553 if (cpu_dai->driver->suspend && !cpu_dai->driver->ac97_control) 553 if (cpu_dai->driver->suspend && !cpu_dai->driver->bus_control)
554 cpu_dai->driver->suspend(cpu_dai); 554 cpu_dai->driver->suspend(cpu_dai);
555 if (platform->driver->suspend && !platform->suspended) { 555 if (platform->driver->suspend && !platform->suspended) {
556 platform->driver->suspend(cpu_dai); 556 platform->driver->suspend(cpu_dai);
@@ -629,7 +629,7 @@ int snd_soc_suspend(struct device *dev)
629 if (card->rtd[i].dai_link->ignore_suspend) 629 if (card->rtd[i].dai_link->ignore_suspend)
630 continue; 630 continue;
631 631
632 if (cpu_dai->driver->suspend && cpu_dai->driver->ac97_control) 632 if (cpu_dai->driver->suspend && cpu_dai->driver->bus_control)
633 cpu_dai->driver->suspend(cpu_dai); 633 cpu_dai->driver->suspend(cpu_dai);
634 634
635 /* deactivate pins to sleep state */ 635 /* deactivate pins to sleep state */
@@ -665,14 +665,14 @@ static void soc_resume_deferred(struct work_struct *work)
665 if (card->resume_pre) 665 if (card->resume_pre)
666 card->resume_pre(card); 666 card->resume_pre(card);
667 667
668 /* resume AC97 DAIs */ 668 /* resume control bus DAIs */
669 for (i = 0; i < card->num_rtd; i++) { 669 for (i = 0; i < card->num_rtd; i++) {
670 struct snd_soc_dai *cpu_dai = card->rtd[i].cpu_dai; 670 struct snd_soc_dai *cpu_dai = card->rtd[i].cpu_dai;
671 671
672 if (card->rtd[i].dai_link->ignore_suspend) 672 if (card->rtd[i].dai_link->ignore_suspend)
673 continue; 673 continue;
674 674
675 if (cpu_dai->driver->resume && cpu_dai->driver->ac97_control) 675 if (cpu_dai->driver->resume && cpu_dai->driver->bus_control)
676 cpu_dai->driver->resume(cpu_dai); 676 cpu_dai->driver->resume(cpu_dai);
677 } 677 }
678 678
@@ -733,7 +733,7 @@ static void soc_resume_deferred(struct work_struct *work)
733 if (card->rtd[i].dai_link->ignore_suspend) 733 if (card->rtd[i].dai_link->ignore_suspend)
734 continue; 734 continue;
735 735
736 if (cpu_dai->driver->resume && !cpu_dai->driver->ac97_control) 736 if (cpu_dai->driver->resume && !cpu_dai->driver->bus_control)
737 cpu_dai->driver->resume(cpu_dai); 737 cpu_dai->driver->resume(cpu_dai);
738 if (platform->driver->resume && platform->suspended) { 738 if (platform->driver->resume && platform->suspended) {
739 platform->driver->resume(cpu_dai); 739 platform->driver->resume(cpu_dai);
@@ -758,7 +758,8 @@ static void soc_resume_deferred(struct work_struct *work)
758int snd_soc_resume(struct device *dev) 758int snd_soc_resume(struct device *dev)
759{ 759{
760 struct snd_soc_card *card = dev_get_drvdata(dev); 760 struct snd_soc_card *card = dev_get_drvdata(dev);
761 int i, ac97_control = 0; 761 bool bus_control = false;
762 int i;
762 763
763 /* If the card is not initialized yet there is nothing to do */ 764 /* If the card is not initialized yet there is nothing to do */
764 if (!card->instantiated) 765 if (!card->instantiated)
@@ -781,17 +782,18 @@ int snd_soc_resume(struct device *dev)
781 } 782 }
782 } 783 }
783 784
784 /* AC97 devices might have other drivers hanging off them so 785 /*
785 * need to resume immediately. Other drivers don't have that 786 * DAIs that also act as the control bus master might have other drivers
786 * problem and may take a substantial amount of time to resume 787 * hanging off them so need to resume immediately. Other drivers don't
788 * have that problem and may take a substantial amount of time to resume
787 * due to I/O costs and anti-pop so handle them out of line. 789 * due to I/O costs and anti-pop so handle them out of line.
788 */ 790 */
789 for (i = 0; i < card->num_rtd; i++) { 791 for (i = 0; i < card->num_rtd; i++) {
790 struct snd_soc_dai *cpu_dai = card->rtd[i].cpu_dai; 792 struct snd_soc_dai *cpu_dai = card->rtd[i].cpu_dai;
791 ac97_control |= cpu_dai->driver->ac97_control; 793 bus_control |= cpu_dai->driver->bus_control;
792 } 794 }
793 if (ac97_control) { 795 if (bus_control) {
794 dev_dbg(dev, "ASoC: Resuming AC97 immediately\n"); 796 dev_dbg(dev, "ASoC: Resuming control bus master immediately\n");
795 soc_resume_deferred(&card->deferred_resume_work); 797 soc_resume_deferred(&card->deferred_resume_work);
796 } else { 798 } else {
797 dev_dbg(dev, "ASoC: Scheduling resume work\n"); 799 dev_dbg(dev, "ASoC: Scheduling resume work\n");