aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-core.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2008-11-18 15:50:34 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2008-11-21 09:02:01 -0500
commit875065491fba8eb13219f16c36e79a6fb4e15c68 (patch)
treeb95327a466e6b79cb5d8a1d9be0f33697dd05db8 /sound/soc/soc-core.c
parent9b0db7e7fd20d5a38844e9435f7d4246ea44978a (diff)
ASoC: Rename snd_soc_card to snd_soc_machine
One of the issues with the ASoC v1 API which has been addressed in the ASoC v2 work that Liam Girdwood has done is that the ALSA card provided by ASoC is distributed around the ASoC structures. For example, machine wide data such as the struct snd_card are maintained as part of the CODEC data structure, preventing the use of multiple codecs. This has been addressed by refactoring the data structures so that all the data for the ALSA card is contained in a single structure snd_soc_card which replaces the existing snd_soc_machine and snd_soc_device. Begin the process of backporting this by renaming struct snd_soc_machine to struct snd_soc_card, better reflecting its function and bringing it closer to standard ALSA terminology. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r--sound/soc/soc-core.c90
1 files changed, 45 insertions, 45 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 9feaa7b6dc34..c5cb9516fea4 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -620,7 +620,7 @@ static struct snd_pcm_ops soc_pcm_ops = {
620static int soc_suspend(struct platform_device *pdev, pm_message_t state) 620static int soc_suspend(struct platform_device *pdev, pm_message_t state)
621{ 621{
622 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 622 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
623 struct snd_soc_machine *machine = socdev->machine; 623 struct snd_soc_card *card = socdev->card;
624 struct snd_soc_platform *platform = socdev->platform; 624 struct snd_soc_platform *platform = socdev->platform;
625 struct snd_soc_codec_device *codec_dev = socdev->codec_dev; 625 struct snd_soc_codec_device *codec_dev = socdev->codec_dev;
626 struct snd_soc_codec *codec = socdev->codec; 626 struct snd_soc_codec *codec = socdev->codec;
@@ -644,14 +644,14 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state)
644 } 644 }
645 645
646 /* suspend all pcms */ 646 /* suspend all pcms */
647 for (i = 0; i < machine->num_links; i++) 647 for (i = 0; i < card->num_links; i++)
648 snd_pcm_suspend_all(machine->dai_link[i].pcm); 648 snd_pcm_suspend_all(card->dai_link[i].pcm);
649 649
650 if (machine->suspend_pre) 650 if (card->suspend_pre)
651 machine->suspend_pre(pdev, state); 651 card->suspend_pre(pdev, state);
652 652
653 for (i = 0; i < machine->num_links; i++) { 653 for (i = 0; i < card->num_links; i++) {
654 struct snd_soc_dai *cpu_dai = machine->dai_link[i].cpu_dai; 654 struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai;
655 if (cpu_dai->suspend && cpu_dai->type != SND_SOC_DAI_AC97) 655 if (cpu_dai->suspend && cpu_dai->type != SND_SOC_DAI_AC97)
656 cpu_dai->suspend(pdev, cpu_dai); 656 cpu_dai->suspend(pdev, cpu_dai);
657 if (platform->suspend) 657 if (platform->suspend)
@@ -676,14 +676,14 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state)
676 if (codec_dev->suspend) 676 if (codec_dev->suspend)
677 codec_dev->suspend(pdev, state); 677 codec_dev->suspend(pdev, state);
678 678
679 for (i = 0; i < machine->num_links; i++) { 679 for (i = 0; i < card->num_links; i++) {
680 struct snd_soc_dai *cpu_dai = machine->dai_link[i].cpu_dai; 680 struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai;
681 if (cpu_dai->suspend && cpu_dai->type == SND_SOC_DAI_AC97) 681 if (cpu_dai->suspend && cpu_dai->type == SND_SOC_DAI_AC97)
682 cpu_dai->suspend(pdev, cpu_dai); 682 cpu_dai->suspend(pdev, cpu_dai);
683 } 683 }
684 684
685 if (machine->suspend_post) 685 if (card->suspend_post)
686 machine->suspend_post(pdev, state); 686 card->suspend_post(pdev, state);
687 687
688 return 0; 688 return 0;
689} 689}
@@ -696,7 +696,7 @@ static void soc_resume_deferred(struct work_struct *work)
696 struct snd_soc_device *socdev = container_of(work, 696 struct snd_soc_device *socdev = container_of(work,
697 struct snd_soc_device, 697 struct snd_soc_device,
698 deferred_resume_work); 698 deferred_resume_work);
699 struct snd_soc_machine *machine = socdev->machine; 699 struct snd_soc_card *card = socdev->card;
700 struct snd_soc_platform *platform = socdev->platform; 700 struct snd_soc_platform *platform = socdev->platform;
701 struct snd_soc_codec_device *codec_dev = socdev->codec_dev; 701 struct snd_soc_codec_device *codec_dev = socdev->codec_dev;
702 struct snd_soc_codec *codec = socdev->codec; 702 struct snd_soc_codec *codec = socdev->codec;
@@ -709,11 +709,11 @@ static void soc_resume_deferred(struct work_struct *work)
709 709
710 dev_info(socdev->dev, "starting resume work\n"); 710 dev_info(socdev->dev, "starting resume work\n");
711 711
712 if (machine->resume_pre) 712 if (card->resume_pre)
713 machine->resume_pre(pdev); 713 card->resume_pre(pdev);
714 714
715 for (i = 0; i < machine->num_links; i++) { 715 for (i = 0; i < card->num_links; i++) {
716 struct snd_soc_dai *cpu_dai = machine->dai_link[i].cpu_dai; 716 struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai;
717 if (cpu_dai->resume && cpu_dai->type == SND_SOC_DAI_AC97) 717 if (cpu_dai->resume && cpu_dai->type == SND_SOC_DAI_AC97)
718 cpu_dai->resume(pdev, cpu_dai); 718 cpu_dai->resume(pdev, cpu_dai);
719 } 719 }
@@ -739,16 +739,16 @@ static void soc_resume_deferred(struct work_struct *work)
739 dai->dai_ops.digital_mute(dai, 0); 739 dai->dai_ops.digital_mute(dai, 0);
740 } 740 }
741 741
742 for (i = 0; i < machine->num_links; i++) { 742 for (i = 0; i < card->num_links; i++) {
743 struct snd_soc_dai *cpu_dai = machine->dai_link[i].cpu_dai; 743 struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai;
744 if (cpu_dai->resume && cpu_dai->type != SND_SOC_DAI_AC97) 744 if (cpu_dai->resume && cpu_dai->type != SND_SOC_DAI_AC97)
745 cpu_dai->resume(pdev, cpu_dai); 745 cpu_dai->resume(pdev, cpu_dai);
746 if (platform->resume) 746 if (platform->resume)
747 platform->resume(pdev, cpu_dai); 747 platform->resume(pdev, cpu_dai);
748 } 748 }
749 749
750 if (machine->resume_post) 750 if (card->resume_post)
751 machine->resume_post(pdev); 751 card->resume_post(pdev);
752 752
753 dev_info(socdev->dev, "resume work completed\n"); 753 dev_info(socdev->dev, "resume work completed\n");
754 754
@@ -779,18 +779,18 @@ static int soc_probe(struct platform_device *pdev)
779{ 779{
780 int ret = 0, i; 780 int ret = 0, i;
781 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 781 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
782 struct snd_soc_machine *machine = socdev->machine; 782 struct snd_soc_card *card = socdev->card;
783 struct snd_soc_platform *platform = socdev->platform; 783 struct snd_soc_platform *platform = socdev->platform;
784 struct snd_soc_codec_device *codec_dev = socdev->codec_dev; 784 struct snd_soc_codec_device *codec_dev = socdev->codec_dev;
785 785
786 if (machine->probe) { 786 if (card->probe) {
787 ret = machine->probe(pdev); 787 ret = card->probe(pdev);
788 if (ret < 0) 788 if (ret < 0)
789 return ret; 789 return ret;
790 } 790 }
791 791
792 for (i = 0; i < machine->num_links; i++) { 792 for (i = 0; i < card->num_links; i++) {
793 struct snd_soc_dai *cpu_dai = machine->dai_link[i].cpu_dai; 793 struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai;
794 if (cpu_dai->probe) { 794 if (cpu_dai->probe) {
795 ret = cpu_dai->probe(pdev, cpu_dai); 795 ret = cpu_dai->probe(pdev, cpu_dai);
796 if (ret < 0) 796 if (ret < 0)
@@ -825,13 +825,13 @@ platform_err:
825 825
826cpu_dai_err: 826cpu_dai_err:
827 for (i--; i >= 0; i--) { 827 for (i--; i >= 0; i--) {
828 struct snd_soc_dai *cpu_dai = machine->dai_link[i].cpu_dai; 828 struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai;
829 if (cpu_dai->remove) 829 if (cpu_dai->remove)
830 cpu_dai->remove(pdev, cpu_dai); 830 cpu_dai->remove(pdev, cpu_dai);
831 } 831 }
832 832
833 if (machine->remove) 833 if (card->remove)
834 machine->remove(pdev); 834 card->remove(pdev);
835 835
836 return ret; 836 return ret;
837} 837}
@@ -841,7 +841,7 @@ static int soc_remove(struct platform_device *pdev)
841{ 841{
842 int i; 842 int i;
843 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 843 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
844 struct snd_soc_machine *machine = socdev->machine; 844 struct snd_soc_card *card = socdev->card;
845 struct snd_soc_platform *platform = socdev->platform; 845 struct snd_soc_platform *platform = socdev->platform;
846 struct snd_soc_codec_device *codec_dev = socdev->codec_dev; 846 struct snd_soc_codec_device *codec_dev = socdev->codec_dev;
847 847
@@ -853,14 +853,14 @@ static int soc_remove(struct platform_device *pdev)
853 if (codec_dev->remove) 853 if (codec_dev->remove)
854 codec_dev->remove(pdev); 854 codec_dev->remove(pdev);
855 855
856 for (i = 0; i < machine->num_links; i++) { 856 for (i = 0; i < card->num_links; i++) {
857 struct snd_soc_dai *cpu_dai = machine->dai_link[i].cpu_dai; 857 struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai;
858 if (cpu_dai->remove) 858 if (cpu_dai->remove)
859 cpu_dai->remove(pdev, cpu_dai); 859 cpu_dai->remove(pdev, cpu_dai);
860 } 860 }
861 861
862 if (machine->remove) 862 if (card->remove)
863 machine->remove(pdev); 863 card->remove(pdev);
864 864
865 return 0; 865 return 0;
866} 866}
@@ -1212,7 +1212,7 @@ EXPORT_SYMBOL_GPL(snd_soc_test_bits);
1212int snd_soc_new_pcms(struct snd_soc_device *socdev, int idx, const char *xid) 1212int snd_soc_new_pcms(struct snd_soc_device *socdev, int idx, const char *xid)
1213{ 1213{
1214 struct snd_soc_codec *codec = socdev->codec; 1214 struct snd_soc_codec *codec = socdev->codec;
1215 struct snd_soc_machine *machine = socdev->machine; 1215 struct snd_soc_card *card = socdev->card;
1216 int ret = 0, i; 1216 int ret = 0, i;
1217 1217
1218 mutex_lock(&codec->mutex); 1218 mutex_lock(&codec->mutex);
@@ -1231,11 +1231,11 @@ int snd_soc_new_pcms(struct snd_soc_device *socdev, int idx, const char *xid)
1231 strncpy(codec->card->driver, codec->name, sizeof(codec->card->driver)); 1231 strncpy(codec->card->driver, codec->name, sizeof(codec->card->driver));
1232 1232
1233 /* create the pcms */ 1233 /* create the pcms */
1234 for (i = 0; i < machine->num_links; i++) { 1234 for (i = 0; i < card->num_links; i++) {
1235 ret = soc_new_pcm(socdev, &machine->dai_link[i], i); 1235 ret = soc_new_pcm(socdev, &card->dai_link[i], i);
1236 if (ret < 0) { 1236 if (ret < 0) {
1237 printk(KERN_ERR "asoc: can't create pcm %s\n", 1237 printk(KERN_ERR "asoc: can't create pcm %s\n",
1238 machine->dai_link[i].stream_name); 1238 card->dai_link[i].stream_name);
1239 mutex_unlock(&codec->mutex); 1239 mutex_unlock(&codec->mutex);
1240 return ret; 1240 return ret;
1241 } 1241 }
@@ -1258,26 +1258,26 @@ EXPORT_SYMBOL_GPL(snd_soc_new_pcms);
1258int snd_soc_register_card(struct snd_soc_device *socdev) 1258int snd_soc_register_card(struct snd_soc_device *socdev)
1259{ 1259{
1260 struct snd_soc_codec *codec = socdev->codec; 1260 struct snd_soc_codec *codec = socdev->codec;
1261 struct snd_soc_machine *machine = socdev->machine; 1261 struct snd_soc_card *card = socdev->card;
1262 int ret = 0, i, ac97 = 0, err = 0; 1262 int ret = 0, i, ac97 = 0, err = 0;
1263 1263
1264 for (i = 0; i < machine->num_links; i++) { 1264 for (i = 0; i < card->num_links; i++) {
1265 if (socdev->machine->dai_link[i].init) { 1265 if (card->dai_link[i].init) {
1266 err = socdev->machine->dai_link[i].init(codec); 1266 err = card->dai_link[i].init(codec);
1267 if (err < 0) { 1267 if (err < 0) {
1268 printk(KERN_ERR "asoc: failed to init %s\n", 1268 printk(KERN_ERR "asoc: failed to init %s\n",
1269 socdev->machine->dai_link[i].stream_name); 1269 card->dai_link[i].stream_name);
1270 continue; 1270 continue;
1271 } 1271 }
1272 } 1272 }
1273 if (socdev->machine->dai_link[i].codec_dai->type == 1273 if (card->dai_link[i].codec_dai->type ==
1274 SND_SOC_DAI_AC97_BUS) 1274 SND_SOC_DAI_AC97_BUS)
1275 ac97 = 1; 1275 ac97 = 1;
1276 } 1276 }
1277 snprintf(codec->card->shortname, sizeof(codec->card->shortname), 1277 snprintf(codec->card->shortname, sizeof(codec->card->shortname),
1278 "%s", machine->name); 1278 "%s", card->name);
1279 snprintf(codec->card->longname, sizeof(codec->card->longname), 1279 snprintf(codec->card->longname, sizeof(codec->card->longname),
1280 "%s (%s)", machine->name, codec->name); 1280 "%s (%s)", card->name, codec->name);
1281 1281
1282 ret = snd_card_register(codec->card); 1282 ret = snd_card_register(codec->card);
1283 if (ret < 0) { 1283 if (ret < 0) {