aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/mxs
diff options
context:
space:
mode:
authorShawn Guo <shawn.guo@linaro.org>2012-05-11 10:24:16 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-05-12 06:04:58 -0400
commit4da3fe7851f9288c2479186d390b0de28d51bdb0 (patch)
tree53904cf3ba487e755b1f32e76134b41dd001a6e1 /sound/soc/mxs
parent065899c9974c4adf45ddc308d84a2a7df519f70b (diff)
ASoC: mxs: mxs-pcm does not need to be a plaform_driver
Same as the commit 518de86 (ASoC: tegra: register 'platform' from DAIs, get rid of pdev), it makes mxs-pcm not a platform_driver but helper to register "platform", so that the platform_device for mxs-pcm can be saved completely. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/mxs')
-rw-r--r--sound/soc/mxs/mxs-pcm.c24
-rw-r--r--sound/soc/mxs/mxs-pcm.h3
-rw-r--r--sound/soc/mxs/mxs-saif.c18
-rw-r--r--sound/soc/mxs/mxs-saif.h1
-rw-r--r--sound/soc/mxs/mxs-sgtl5000.c4
5 files changed, 15 insertions, 35 deletions
diff --git a/sound/soc/mxs/mxs-pcm.c b/sound/soc/mxs/mxs-pcm.c
index e373fbbc97a0..373dec90579f 100644
--- a/sound/soc/mxs/mxs-pcm.c
+++ b/sound/soc/mxs/mxs-pcm.c
@@ -220,28 +220,16 @@ static struct snd_soc_platform_driver mxs_soc_platform = {
220 .pcm_free = mxs_pcm_free, 220 .pcm_free = mxs_pcm_free,
221}; 221};
222 222
223static int __devinit mxs_soc_platform_probe(struct platform_device *pdev) 223int __devinit mxs_pcm_platform_register(struct device *dev)
224{ 224{
225 return snd_soc_register_platform(&pdev->dev, &mxs_soc_platform); 225 return snd_soc_register_platform(dev, &mxs_soc_platform);
226} 226}
227EXPORT_SYMBOL_GPL(mxs_pcm_platform_register);
227 228
228static int __devexit mxs_soc_platform_remove(struct platform_device *pdev) 229void __devexit mxs_pcm_platform_unregister(struct device *dev)
229{ 230{
230 snd_soc_unregister_platform(&pdev->dev); 231 snd_soc_unregister_platform(dev);
231
232 return 0;
233} 232}
234 233EXPORT_SYMBOL_GPL(mxs_pcm_platform_unregister);
235static struct platform_driver mxs_pcm_driver = {
236 .driver = {
237 .name = "mxs-pcm-audio",
238 .owner = THIS_MODULE,
239 },
240 .probe = mxs_soc_platform_probe,
241 .remove = __devexit_p(mxs_soc_platform_remove),
242};
243
244module_platform_driver(mxs_pcm_driver);
245 234
246MODULE_LICENSE("GPL"); 235MODULE_LICENSE("GPL");
247MODULE_ALIAS("platform:mxs-pcm-audio");
diff --git a/sound/soc/mxs/mxs-pcm.h b/sound/soc/mxs/mxs-pcm.h
index 5f01a9124b3d..35ba2ca42384 100644
--- a/sound/soc/mxs/mxs-pcm.h
+++ b/sound/soc/mxs/mxs-pcm.h
@@ -24,4 +24,7 @@ struct mxs_pcm_dma_params {
24 int chan_num; 24 int chan_num;
25}; 25};
26 26
27int mxs_pcm_platform_register(struct device *dev);
28void mxs_pcm_platform_unregister(struct device *dev);
29
27#endif 30#endif
diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c
index a7b8657690a9..356aad83c1fe 100644
--- a/sound/soc/mxs/mxs-saif.c
+++ b/sound/soc/mxs/mxs-saif.c
@@ -708,24 +708,14 @@ static int __devinit mxs_saif_probe(struct platform_device *pdev)
708 goto failed_get_resource; 708 goto failed_get_resource;
709 } 709 }
710 710
711 saif->soc_platform_pdev = platform_device_alloc( 711 ret = mxs_pcm_platform_register(&pdev->dev);
712 "mxs-pcm-audio", pdev->id);
713 if (!saif->soc_platform_pdev) {
714 ret = -ENOMEM;
715 goto failed_pdev_alloc;
716 }
717
718 platform_set_drvdata(saif->soc_platform_pdev, saif);
719 ret = platform_device_add(saif->soc_platform_pdev);
720 if (ret) { 712 if (ret) {
721 dev_err(&pdev->dev, "failed to add soc platform device\n"); 713 dev_err(&pdev->dev, "register PCM failed: %d\n", ret);
722 goto failed_pdev_add; 714 goto failed_pdev_alloc;
723 } 715 }
724 716
725 return 0; 717 return 0;
726 718
727failed_pdev_add:
728 platform_device_put(saif->soc_platform_pdev);
729failed_pdev_alloc: 719failed_pdev_alloc:
730 snd_soc_unregister_dai(&pdev->dev); 720 snd_soc_unregister_dai(&pdev->dev);
731failed_get_resource: 721failed_get_resource:
@@ -738,7 +728,7 @@ static int __devexit mxs_saif_remove(struct platform_device *pdev)
738{ 728{
739 struct mxs_saif *saif = platform_get_drvdata(pdev); 729 struct mxs_saif *saif = platform_get_drvdata(pdev);
740 730
741 platform_device_unregister(saif->soc_platform_pdev); 731 mxs_pcm_platform_unregister(&pdev->dev);
742 snd_soc_unregister_dai(&pdev->dev); 732 snd_soc_unregister_dai(&pdev->dev);
743 clk_put(saif->clk); 733 clk_put(saif->clk);
744 734
diff --git a/sound/soc/mxs/mxs-saif.h b/sound/soc/mxs/mxs-saif.h
index 12c91e4eb941..3cb342e5bc90 100644
--- a/sound/soc/mxs/mxs-saif.h
+++ b/sound/soc/mxs/mxs-saif.h
@@ -123,7 +123,6 @@ struct mxs_saif {
123 unsigned int cur_rate; 123 unsigned int cur_rate;
124 unsigned int ongoing; 124 unsigned int ongoing;
125 125
126 struct platform_device *soc_platform_pdev;
127 u32 fifo_underrun; 126 u32 fifo_underrun;
128 u32 fifo_overrun; 127 u32 fifo_overrun;
129}; 128};
diff --git a/sound/soc/mxs/mxs-sgtl5000.c b/sound/soc/mxs/mxs-sgtl5000.c
index 60f052b7cf22..e9e6112ff196 100644
--- a/sound/soc/mxs/mxs-sgtl5000.c
+++ b/sound/soc/mxs/mxs-sgtl5000.c
@@ -90,7 +90,7 @@ static struct snd_soc_dai_link mxs_sgtl5000_dai[] = {
90 .codec_dai_name = "sgtl5000", 90 .codec_dai_name = "sgtl5000",
91 .codec_name = "sgtl5000.0-000a", 91 .codec_name = "sgtl5000.0-000a",
92 .cpu_dai_name = "mxs-saif.0", 92 .cpu_dai_name = "mxs-saif.0",
93 .platform_name = "mxs-pcm-audio.0", 93 .platform_name = "mxs-saif.0",
94 .ops = &mxs_sgtl5000_hifi_ops, 94 .ops = &mxs_sgtl5000_hifi_ops,
95 }, { 95 }, {
96 .name = "HiFi Rx", 96 .name = "HiFi Rx",
@@ -98,7 +98,7 @@ static struct snd_soc_dai_link mxs_sgtl5000_dai[] = {
98 .codec_dai_name = "sgtl5000", 98 .codec_dai_name = "sgtl5000",
99 .codec_name = "sgtl5000.0-000a", 99 .codec_name = "sgtl5000.0-000a",
100 .cpu_dai_name = "mxs-saif.1", 100 .cpu_dai_name = "mxs-saif.1",
101 .platform_name = "mxs-pcm-audio.1", 101 .platform_name = "mxs-saif.1",
102 .ops = &mxs_sgtl5000_hifi_ops, 102 .ops = &mxs_sgtl5000_hifi_ops,
103 }, 103 },
104}; 104};