diff options
Diffstat (limited to 'sound/soc/imx/imx-ssi.c')
-rw-r--r-- | sound/soc/imx/imx-ssi.c | 57 |
1 files changed, 39 insertions, 18 deletions
diff --git a/sound/soc/imx/imx-ssi.c b/sound/soc/imx/imx-ssi.c index d4bd345b0a8d..390b6ffc2658 100644 --- a/sound/soc/imx/imx-ssi.c +++ b/sound/soc/imx/imx-ssi.c | |||
@@ -439,7 +439,22 @@ void imx_pcm_free(struct snd_pcm *pcm) | |||
439 | } | 439 | } |
440 | EXPORT_SYMBOL_GPL(imx_pcm_free); | 440 | EXPORT_SYMBOL_GPL(imx_pcm_free); |
441 | 441 | ||
442 | static int imx_ssi_dai_probe(struct snd_soc_dai *dai) | ||
443 | { | ||
444 | struct imx_ssi *ssi = dev_get_drvdata(dai->dev); | ||
445 | uint32_t val; | ||
446 | |||
447 | snd_soc_dai_set_drvdata(dai, ssi); | ||
448 | |||
449 | val = SSI_SFCSR_TFWM0(ssi->dma_params_tx.burstsize) | | ||
450 | SSI_SFCSR_RFWM0(ssi->dma_params_rx.burstsize); | ||
451 | writel(val, ssi->base + SSI_SFCSR); | ||
452 | |||
453 | return 0; | ||
454 | } | ||
455 | |||
442 | static struct snd_soc_dai_driver imx_ssi_dai = { | 456 | static struct snd_soc_dai_driver imx_ssi_dai = { |
457 | .probe = imx_ssi_dai_probe, | ||
443 | .playback = { | 458 | .playback = { |
444 | .channels_min = 2, | 459 | .channels_min = 2, |
445 | .channels_max = 2, | 460 | .channels_max = 2, |
@@ -455,20 +470,6 @@ static struct snd_soc_dai_driver imx_ssi_dai = { | |||
455 | .ops = &imx_ssi_pcm_dai_ops, | 470 | .ops = &imx_ssi_pcm_dai_ops, |
456 | }; | 471 | }; |
457 | 472 | ||
458 | static int imx_ssi_dai_probe(struct snd_soc_dai *dai) | ||
459 | { | ||
460 | struct imx_ssi *ssi = dev_get_drvdata(dai->dev); | ||
461 | uint32_t val; | ||
462 | |||
463 | snd_soc_dai_set_drvdata(dai, ssi); | ||
464 | |||
465 | val = SSI_SFCSR_TFWM0(ssi->dma_params_tx.burstsize) | | ||
466 | SSI_SFCSR_RFWM0(ssi->dma_params_rx.burstsize); | ||
467 | writel(val, ssi->base + SSI_SFCSR); | ||
468 | |||
469 | return 0; | ||
470 | } | ||
471 | |||
472 | static struct snd_soc_dai_driver imx_ac97_dai = { | 473 | static 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) | |||
692 | failed_pdev_add: | 709 | failed_pdev_add: |
693 | platform_device_put(ssi->soc_platform_pdev); | 710 | platform_device_put(ssi->soc_platform_pdev); |
694 | failed_pdev_alloc: | 711 | failed_pdev_alloc: |
712 | platform_device_del(ssi->soc_platform_pdev_fiq); | ||
713 | failed_pdev_fiq_add: | ||
714 | platform_device_put(ssi->soc_platform_pdev_fiq); | ||
715 | failed_pdev_fiq_alloc: | ||
695 | snd_soc_unregister_dai(&pdev->dev); | 716 | snd_soc_unregister_dai(&pdev->dev); |
696 | failed_register: | 717 | failed_register: |
697 | failed_ac97: | 718 | failed_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 | ||