aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/imx/imx-ssi.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/imx/imx-ssi.c')
-rw-r--r--sound/soc/imx/imx-ssi.c61
1 files changed, 41 insertions, 20 deletions
diff --git a/sound/soc/imx/imx-ssi.c b/sound/soc/imx/imx-ssi.c
index d4bd345b0a8d..30894ea7f333 100644
--- a/sound/soc/imx/imx-ssi.c
+++ b/sound/soc/imx/imx-ssi.c
@@ -439,22 +439,6 @@ void imx_pcm_free(struct snd_pcm *pcm)
439} 439}
440EXPORT_SYMBOL_GPL(imx_pcm_free); 440EXPORT_SYMBOL_GPL(imx_pcm_free);
441 441
442static struct snd_soc_dai_driver imx_ssi_dai = {
443 .playback = {
444 .channels_min = 2,
445 .channels_max = 2,
446 .rates = SNDRV_PCM_RATE_8000_96000,
447 .formats = SNDRV_PCM_FMTBIT_S16_LE,
448 },
449 .capture = {
450 .channels_min = 2,
451 .channels_max = 2,
452 .rates = SNDRV_PCM_RATE_8000_96000,
453 .formats = SNDRV_PCM_FMTBIT_S16_LE,
454 },
455 .ops = &imx_ssi_pcm_dai_ops,
456};
457
458static int imx_ssi_dai_probe(struct snd_soc_dai *dai) 442static int imx_ssi_dai_probe(struct snd_soc_dai *dai)
459{ 443{
460 struct imx_ssi *ssi = dev_get_drvdata(dai->dev); 444 struct imx_ssi *ssi = dev_get_drvdata(dai->dev);
@@ -469,6 +453,23 @@ static int imx_ssi_dai_probe(struct snd_soc_dai *dai)
469 return 0; 453 return 0;
470} 454}
471 455
456static struct snd_soc_dai_driver imx_ssi_dai = {
457 .probe = imx_ssi_dai_probe,
458 .playback = {
459 .channels_min = 1,
460 .channels_max = 2,
461 .rates = SNDRV_PCM_RATE_8000_96000,
462 .formats = SNDRV_PCM_FMTBIT_S16_LE,
463 },
464 .capture = {
465 .channels_min = 1,
466 .channels_max = 2,
467 .rates = SNDRV_PCM_RATE_8000_96000,
468 .formats = SNDRV_PCM_FMTBIT_S16_LE,
469 },
470 .ops = &imx_ssi_pcm_dai_ops,
471};
472
472static struct snd_soc_dai_driver imx_ac97_dai = { 473static struct snd_soc_dai_driver imx_ac97_dai = {
473 .probe = imx_ssi_dai_probe, 474 .probe = imx_ssi_dai_probe,
474 .ac97_control = 1, 475 .ac97_control = 1,
@@ -677,9 +678,25 @@ static int imx_ssi_probe(struct platform_device *pdev)
677 goto failed_register; 678 goto failed_register;
678 } 679 }
679 680
680 ssi->soc_platform_pdev = platform_device_alloc("imx-fiq-pcm-audio", pdev->id); 681 ssi->soc_platform_pdev_fiq = platform_device_alloc("imx-fiq-pcm-audio", pdev->id);
681 if (!ssi->soc_platform_pdev) 682 if (!ssi->soc_platform_pdev_fiq) {
683 ret = -ENOMEM;
684 goto failed_pdev_fiq_alloc;
685 }
686
687 platform_set_drvdata(ssi->soc_platform_pdev_fiq, ssi);
688 ret = platform_device_add(ssi->soc_platform_pdev_fiq);
689 if (ret) {
690 dev_err(&pdev->dev, "failed to add platform device\n");
691 goto failed_pdev_fiq_add;
692 }
693
694 ssi->soc_platform_pdev = platform_device_alloc("imx-pcm-audio", pdev->id);
695 if (!ssi->soc_platform_pdev) {
696 ret = -ENOMEM;
682 goto failed_pdev_alloc; 697 goto failed_pdev_alloc;
698 }
699
683 platform_set_drvdata(ssi->soc_platform_pdev, ssi); 700 platform_set_drvdata(ssi->soc_platform_pdev, ssi);
684 ret = platform_device_add(ssi->soc_platform_pdev); 701 ret = platform_device_add(ssi->soc_platform_pdev);
685 if (ret) { 702 if (ret) {
@@ -692,6 +709,10 @@ static int imx_ssi_probe(struct platform_device *pdev)
692failed_pdev_add: 709failed_pdev_add:
693 platform_device_put(ssi->soc_platform_pdev); 710 platform_device_put(ssi->soc_platform_pdev);
694failed_pdev_alloc: 711failed_pdev_alloc:
712 platform_device_del(ssi->soc_platform_pdev_fiq);
713failed_pdev_fiq_add:
714 platform_device_put(ssi->soc_platform_pdev_fiq);
715failed_pdev_fiq_alloc:
695 snd_soc_unregister_dai(&pdev->dev); 716 snd_soc_unregister_dai(&pdev->dev);
696failed_register: 717failed_register:
697failed_ac97: 718failed_ac97:
@@ -712,8 +733,8 @@ static int __devexit imx_ssi_remove(struct platform_device *pdev)
712 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 733 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
713 struct imx_ssi *ssi = platform_get_drvdata(pdev); 734 struct imx_ssi *ssi = platform_get_drvdata(pdev);
714 735
715 platform_device_del(ssi->soc_platform_pdev); 736 platform_device_unregister(ssi->soc_platform_pdev);
716 platform_device_put(ssi->soc_platform_pdev); 737 platform_device_unregister(ssi->soc_platform_pdev_fiq);
717 738
718 snd_soc_unregister_dai(&pdev->dev); 739 snd_soc_unregister_dai(&pdev->dev);
719 740