diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2008-12-02 11:01:14 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2008-12-02 11:03:40 -0500 |
commit | 87689d567a45f80416feea0a2aa6d3a2a6b8963a (patch) | |
tree | d33d923e9e359f3be124d0a63c30b41637b9f933 /sound/soc/soc-core.c | |
parent | 6308419a199eed66086cd756ab8dc81b88d54a6b (diff) |
ASoC: Push platform registration down into the card
As part of the deprecation of snd_soc_device push the registration of
the platform down into the card structure.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r-- | sound/soc/soc-core.c | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index c4b22e6984e6..fe89260c9028 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -109,9 +109,10 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) | |||
109 | { | 109 | { |
110 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 110 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
111 | struct snd_soc_device *socdev = rtd->socdev; | 111 | struct snd_soc_device *socdev = rtd->socdev; |
112 | struct snd_soc_card *card = socdev->card; | ||
112 | struct snd_pcm_runtime *runtime = substream->runtime; | 113 | struct snd_pcm_runtime *runtime = substream->runtime; |
113 | struct snd_soc_dai_link *machine = rtd->dai; | 114 | struct snd_soc_dai_link *machine = rtd->dai; |
114 | struct snd_soc_platform *platform = socdev->platform; | 115 | struct snd_soc_platform *platform = card->platform; |
115 | struct snd_soc_dai *cpu_dai = machine->cpu_dai; | 116 | struct snd_soc_dai *cpu_dai = machine->cpu_dai; |
116 | struct snd_soc_dai *codec_dai = machine->codec_dai; | 117 | struct snd_soc_dai *codec_dai = machine->codec_dai; |
117 | int ret = 0; | 118 | int ret = 0; |
@@ -302,7 +303,7 @@ static int soc_codec_close(struct snd_pcm_substream *substream) | |||
302 | struct snd_soc_device *socdev = rtd->socdev; | 303 | struct snd_soc_device *socdev = rtd->socdev; |
303 | struct snd_soc_card *card = socdev->card; | 304 | struct snd_soc_card *card = socdev->card; |
304 | struct snd_soc_dai_link *machine = rtd->dai; | 305 | struct snd_soc_dai_link *machine = rtd->dai; |
305 | struct snd_soc_platform *platform = socdev->platform; | 306 | struct snd_soc_platform *platform = card->platform; |
306 | struct snd_soc_dai *cpu_dai = machine->cpu_dai; | 307 | struct snd_soc_dai *cpu_dai = machine->cpu_dai; |
307 | struct snd_soc_dai *codec_dai = machine->codec_dai; | 308 | struct snd_soc_dai *codec_dai = machine->codec_dai; |
308 | struct snd_soc_codec *codec = socdev->codec; | 309 | struct snd_soc_codec *codec = socdev->codec; |
@@ -370,7 +371,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream) | |||
370 | struct snd_soc_device *socdev = rtd->socdev; | 371 | struct snd_soc_device *socdev = rtd->socdev; |
371 | struct snd_soc_card *card = socdev->card; | 372 | struct snd_soc_card *card = socdev->card; |
372 | struct snd_soc_dai_link *machine = rtd->dai; | 373 | struct snd_soc_dai_link *machine = rtd->dai; |
373 | struct snd_soc_platform *platform = socdev->platform; | 374 | struct snd_soc_platform *platform = card->platform; |
374 | struct snd_soc_dai *cpu_dai = machine->cpu_dai; | 375 | struct snd_soc_dai *cpu_dai = machine->cpu_dai; |
375 | struct snd_soc_dai *codec_dai = machine->codec_dai; | 376 | struct snd_soc_dai *codec_dai = machine->codec_dai; |
376 | struct snd_soc_codec *codec = socdev->codec; | 377 | struct snd_soc_codec *codec = socdev->codec; |
@@ -464,7 +465,8 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, | |||
464 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 465 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
465 | struct snd_soc_device *socdev = rtd->socdev; | 466 | struct snd_soc_device *socdev = rtd->socdev; |
466 | struct snd_soc_dai_link *machine = rtd->dai; | 467 | struct snd_soc_dai_link *machine = rtd->dai; |
467 | struct snd_soc_platform *platform = socdev->platform; | 468 | struct snd_soc_card *card = socdev->card; |
469 | struct snd_soc_platform *platform = card->platform; | ||
468 | struct snd_soc_dai *cpu_dai = machine->cpu_dai; | 470 | struct snd_soc_dai *cpu_dai = machine->cpu_dai; |
469 | struct snd_soc_dai *codec_dai = machine->codec_dai; | 471 | struct snd_soc_dai *codec_dai = machine->codec_dai; |
470 | int ret = 0; | 472 | int ret = 0; |
@@ -534,7 +536,8 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream) | |||
534 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 536 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
535 | struct snd_soc_device *socdev = rtd->socdev; | 537 | struct snd_soc_device *socdev = rtd->socdev; |
536 | struct snd_soc_dai_link *machine = rtd->dai; | 538 | struct snd_soc_dai_link *machine = rtd->dai; |
537 | struct snd_soc_platform *platform = socdev->platform; | 539 | struct snd_soc_card *card = socdev->card; |
540 | struct snd_soc_platform *platform = card->platform; | ||
538 | struct snd_soc_dai *cpu_dai = machine->cpu_dai; | 541 | struct snd_soc_dai *cpu_dai = machine->cpu_dai; |
539 | struct snd_soc_dai *codec_dai = machine->codec_dai; | 542 | struct snd_soc_dai *codec_dai = machine->codec_dai; |
540 | struct snd_soc_codec *codec = socdev->codec; | 543 | struct snd_soc_codec *codec = socdev->codec; |
@@ -568,8 +571,9 @@ static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
568 | { | 571 | { |
569 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 572 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
570 | struct snd_soc_device *socdev = rtd->socdev; | 573 | struct snd_soc_device *socdev = rtd->socdev; |
574 | struct snd_soc_card *card= socdev->card; | ||
571 | struct snd_soc_dai_link *machine = rtd->dai; | 575 | struct snd_soc_dai_link *machine = rtd->dai; |
572 | struct snd_soc_platform *platform = socdev->platform; | 576 | struct snd_soc_platform *platform = card->platform; |
573 | struct snd_soc_dai *cpu_dai = machine->cpu_dai; | 577 | struct snd_soc_dai *cpu_dai = machine->cpu_dai; |
574 | struct snd_soc_dai *codec_dai = machine->codec_dai; | 578 | struct snd_soc_dai *codec_dai = machine->codec_dai; |
575 | int ret; | 579 | int ret; |
@@ -610,7 +614,7 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state) | |||
610 | { | 614 | { |
611 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); | 615 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); |
612 | struct snd_soc_card *card = socdev->card; | 616 | struct snd_soc_card *card = socdev->card; |
613 | struct snd_soc_platform *platform = socdev->platform; | 617 | struct snd_soc_platform *platform = card->platform; |
614 | struct snd_soc_codec_device *codec_dev = socdev->codec_dev; | 618 | struct snd_soc_codec_device *codec_dev = socdev->codec_dev; |
615 | struct snd_soc_codec *codec = socdev->codec; | 619 | struct snd_soc_codec *codec = socdev->codec; |
616 | int i; | 620 | int i; |
@@ -686,7 +690,7 @@ static void soc_resume_deferred(struct work_struct *work) | |||
686 | struct snd_soc_card, | 690 | struct snd_soc_card, |
687 | deferred_resume_work); | 691 | deferred_resume_work); |
688 | struct snd_soc_device *socdev = card->socdev; | 692 | struct snd_soc_device *socdev = card->socdev; |
689 | struct snd_soc_platform *platform = socdev->platform; | 693 | struct snd_soc_platform *platform = card->platform; |
690 | struct snd_soc_codec_device *codec_dev = socdev->codec_dev; | 694 | struct snd_soc_codec_device *codec_dev = socdev->codec_dev; |
691 | struct snd_soc_codec *codec = socdev->codec; | 695 | struct snd_soc_codec *codec = socdev->codec; |
692 | struct platform_device *pdev = to_platform_device(socdev->dev); | 696 | struct platform_device *pdev = to_platform_device(socdev->dev); |
@@ -770,7 +774,7 @@ static int soc_probe(struct platform_device *pdev) | |||
770 | int ret = 0, i; | 774 | int ret = 0, i; |
771 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); | 775 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); |
772 | struct snd_soc_card *card = socdev->card; | 776 | struct snd_soc_card *card = socdev->card; |
773 | struct snd_soc_platform *platform = socdev->platform; | 777 | struct snd_soc_platform *platform = card->platform; |
774 | struct snd_soc_codec_device *codec_dev = socdev->codec_dev; | 778 | struct snd_soc_codec_device *codec_dev = socdev->codec_dev; |
775 | 779 | ||
776 | /* Bodge while we push things out of socdev */ | 780 | /* Bodge while we push things out of socdev */ |
@@ -835,7 +839,7 @@ static int soc_remove(struct platform_device *pdev) | |||
835 | int i; | 839 | int i; |
836 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); | 840 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); |
837 | struct snd_soc_card *card = socdev->card; | 841 | struct snd_soc_card *card = socdev->card; |
838 | struct snd_soc_platform *platform = socdev->platform; | 842 | struct snd_soc_platform *platform = card->platform; |
839 | struct snd_soc_codec_device *codec_dev = socdev->codec_dev; | 843 | struct snd_soc_codec_device *codec_dev = socdev->codec_dev; |
840 | 844 | ||
841 | run_delayed_work(&card->delayed_work); | 845 | run_delayed_work(&card->delayed_work); |
@@ -875,6 +879,8 @@ static int soc_new_pcm(struct snd_soc_device *socdev, | |||
875 | struct snd_soc_dai_link *dai_link, int num) | 879 | struct snd_soc_dai_link *dai_link, int num) |
876 | { | 880 | { |
877 | struct snd_soc_codec *codec = socdev->codec; | 881 | struct snd_soc_codec *codec = socdev->codec; |
882 | struct snd_soc_card *card = socdev->card; | ||
883 | struct snd_soc_platform *platform = card->platform; | ||
878 | struct snd_soc_dai *codec_dai = dai_link->codec_dai; | 884 | struct snd_soc_dai *codec_dai = dai_link->codec_dai; |
879 | struct snd_soc_dai *cpu_dai = dai_link->cpu_dai; | 885 | struct snd_soc_dai *cpu_dai = dai_link->cpu_dai; |
880 | struct snd_soc_pcm_runtime *rtd; | 886 | struct snd_soc_pcm_runtime *rtd; |
@@ -910,13 +916,13 @@ static int soc_new_pcm(struct snd_soc_device *socdev, | |||
910 | 916 | ||
911 | dai_link->pcm = pcm; | 917 | dai_link->pcm = pcm; |
912 | pcm->private_data = rtd; | 918 | pcm->private_data = rtd; |
913 | soc_pcm_ops.mmap = socdev->platform->pcm_ops->mmap; | 919 | soc_pcm_ops.mmap = platform->pcm_ops->mmap; |
914 | soc_pcm_ops.pointer = socdev->platform->pcm_ops->pointer; | 920 | soc_pcm_ops.pointer = platform->pcm_ops->pointer; |
915 | soc_pcm_ops.ioctl = socdev->platform->pcm_ops->ioctl; | 921 | soc_pcm_ops.ioctl = platform->pcm_ops->ioctl; |
916 | soc_pcm_ops.copy = socdev->platform->pcm_ops->copy; | 922 | soc_pcm_ops.copy = platform->pcm_ops->copy; |
917 | soc_pcm_ops.silence = socdev->platform->pcm_ops->silence; | 923 | soc_pcm_ops.silence = platform->pcm_ops->silence; |
918 | soc_pcm_ops.ack = socdev->platform->pcm_ops->ack; | 924 | soc_pcm_ops.ack = platform->pcm_ops->ack; |
919 | soc_pcm_ops.page = socdev->platform->pcm_ops->page; | 925 | soc_pcm_ops.page = platform->pcm_ops->page; |
920 | 926 | ||
921 | if (playback) | 927 | if (playback) |
922 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &soc_pcm_ops); | 928 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &soc_pcm_ops); |
@@ -924,14 +930,14 @@ static int soc_new_pcm(struct snd_soc_device *socdev, | |||
924 | if (capture) | 930 | if (capture) |
925 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &soc_pcm_ops); | 931 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &soc_pcm_ops); |
926 | 932 | ||
927 | ret = socdev->platform->pcm_new(codec->card, codec_dai, pcm); | 933 | ret = platform->pcm_new(codec->card, codec_dai, pcm); |
928 | if (ret < 0) { | 934 | if (ret < 0) { |
929 | printk(KERN_ERR "asoc: platform pcm constructor failed\n"); | 935 | printk(KERN_ERR "asoc: platform pcm constructor failed\n"); |
930 | kfree(rtd); | 936 | kfree(rtd); |
931 | return ret; | 937 | return ret; |
932 | } | 938 | } |
933 | 939 | ||
934 | pcm->private_free = socdev->platform->pcm_free; | 940 | pcm->private_free = platform->pcm_free; |
935 | printk(KERN_INFO "asoc: %s <-> %s mapping ok\n", codec_dai->name, | 941 | printk(KERN_INFO "asoc: %s <-> %s mapping ok\n", codec_dai->name, |
936 | cpu_dai->name); | 942 | cpu_dai->name); |
937 | return ret; | 943 | return ret; |