aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/fsl/imx-ssi.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/fsl/imx-ssi.c')
-rw-r--r--sound/soc/fsl/imx-ssi.c62
1 files changed, 30 insertions, 32 deletions
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c
index 810c7eeb7b03..902fab02b851 100644
--- a/sound/soc/fsl/imx-ssi.c
+++ b/sound/soc/fsl/imx-ssi.c
@@ -232,23 +232,6 @@ static int imx_ssi_set_dai_clkdiv(struct snd_soc_dai *cpu_dai,
232 return 0; 232 return 0;
233} 233}
234 234
235static int imx_ssi_startup(struct snd_pcm_substream *substream,
236 struct snd_soc_dai *cpu_dai)
237{
238 struct imx_ssi *ssi = snd_soc_dai_get_drvdata(cpu_dai);
239 struct imx_pcm_dma_params *dma_data;
240
241 /* Tx/Rx config */
242 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
243 dma_data = &ssi->dma_params_tx;
244 else
245 dma_data = &ssi->dma_params_rx;
246
247 snd_soc_dai_set_dma_data(cpu_dai, substream, dma_data);
248
249 return 0;
250}
251
252/* 235/*
253 * Should only be called when port is inactive (i.e. SSIEN = 0), 236 * Should only be called when port is inactive (i.e. SSIEN = 0),
254 * although can be called multiple times by upper layers. 237 * although can be called multiple times by upper layers.
@@ -353,7 +336,6 @@ static int imx_ssi_trigger(struct snd_pcm_substream *substream, int cmd,
353} 336}
354 337
355static const struct snd_soc_dai_ops imx_ssi_pcm_dai_ops = { 338static const struct snd_soc_dai_ops imx_ssi_pcm_dai_ops = {
356 .startup = imx_ssi_startup,
357 .hw_params = imx_ssi_hw_params, 339 .hw_params = imx_ssi_hw_params,
358 .set_fmt = imx_ssi_set_dai_fmt, 340 .set_fmt = imx_ssi_set_dai_fmt,
359 .set_clkdiv = imx_ssi_set_dai_clkdiv, 341 .set_clkdiv = imx_ssi_set_dai_clkdiv,
@@ -369,10 +351,14 @@ static int imx_ssi_dai_probe(struct snd_soc_dai *dai)
369 351
370 snd_soc_dai_set_drvdata(dai, ssi); 352 snd_soc_dai_set_drvdata(dai, ssi);
371 353
372 val = SSI_SFCSR_TFWM0(ssi->dma_params_tx.burstsize) | 354 val = SSI_SFCSR_TFWM0(ssi->dma_params_tx.maxburst) |
373 SSI_SFCSR_RFWM0(ssi->dma_params_rx.burstsize); 355 SSI_SFCSR_RFWM0(ssi->dma_params_rx.maxburst);
374 writel(val, ssi->base + SSI_SFCSR); 356 writel(val, ssi->base + SSI_SFCSR);
375 357
358 /* Tx/Rx config */
359 dai->playback_dma_data = &ssi->dma_params_tx;
360 dai->capture_dma_data = &ssi->dma_params_rx;
361
376 return 0; 362 return 0;
377} 363}
378 364
@@ -400,7 +386,7 @@ static struct snd_soc_dai_driver imx_ac97_dai = {
400 .stream_name = "AC97 Playback", 386 .stream_name = "AC97 Playback",
401 .channels_min = 2, 387 .channels_min = 2,
402 .channels_max = 2, 388 .channels_max = 2,
403 .rates = SNDRV_PCM_RATE_48000, 389 .rates = SNDRV_PCM_RATE_8000_48000,
404 .formats = SNDRV_PCM_FMTBIT_S16_LE, 390 .formats = SNDRV_PCM_FMTBIT_S16_LE,
405 }, 391 },
406 .capture = { 392 .capture = {
@@ -413,6 +399,10 @@ static struct snd_soc_dai_driver imx_ac97_dai = {
413 .ops = &imx_ssi_pcm_dai_ops, 399 .ops = &imx_ssi_pcm_dai_ops,
414}; 400};
415 401
402static const struct snd_soc_component_driver imx_component = {
403 .name = DRV_NAME,
404};
405
416static void setup_channel_to_ac97(struct imx_ssi *imx_ssi) 406static void setup_channel_to_ac97(struct imx_ssi *imx_ssi)
417{ 407{
418 void __iomem *base = imx_ssi->base; 408 void __iomem *base = imx_ssi->base;
@@ -575,23 +565,31 @@ static int imx_ssi_probe(struct platform_device *pdev)
575 565
576 writel(0x0, ssi->base + SSI_SIER); 566 writel(0x0, ssi->base + SSI_SIER);
577 567
578 ssi->dma_params_rx.dma_addr = res->start + SSI_SRX0; 568 ssi->dma_params_rx.addr = res->start + SSI_SRX0;
579 ssi->dma_params_tx.dma_addr = res->start + SSI_STX0; 569 ssi->dma_params_tx.addr = res->start + SSI_STX0;
570
571 ssi->dma_params_tx.maxburst = 6;
572 ssi->dma_params_rx.maxburst = 4;
580 573
581 ssi->dma_params_tx.burstsize = 6; 574 ssi->dma_params_tx.filter_data = &ssi->filter_data_tx;
582 ssi->dma_params_rx.burstsize = 4; 575 ssi->dma_params_rx.filter_data = &ssi->filter_data_rx;
583 576
584 res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx0"); 577 res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx0");
585 if (res) 578 if (res) {
586 ssi->dma_params_tx.dma = res->start; 579 imx_pcm_dma_params_init_data(&ssi->filter_data_tx, res->start,
580 false);
581 }
587 582
588 res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx0"); 583 res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx0");
589 if (res) 584 if (res) {
590 ssi->dma_params_rx.dma = res->start; 585 imx_pcm_dma_params_init_data(&ssi->filter_data_rx, res->start,
586 false);
587 }
591 588
592 platform_set_drvdata(pdev, ssi); 589 platform_set_drvdata(pdev, ssi);
593 590
594 ret = snd_soc_register_dai(&pdev->dev, dai); 591 ret = snd_soc_register_component(&pdev->dev, &imx_component,
592 dai, 1);
595 if (ret) { 593 if (ret) {
596 dev_err(&pdev->dev, "register DAI failed\n"); 594 dev_err(&pdev->dev, "register DAI failed\n");
597 goto failed_register; 595 goto failed_register;
@@ -632,7 +630,7 @@ failed_pdev_alloc:
632failed_pdev_fiq_add: 630failed_pdev_fiq_add:
633 platform_device_put(ssi->soc_platform_pdev_fiq); 631 platform_device_put(ssi->soc_platform_pdev_fiq);
634failed_pdev_fiq_alloc: 632failed_pdev_fiq_alloc:
635 snd_soc_unregister_dai(&pdev->dev); 633 snd_soc_unregister_component(&pdev->dev);
636failed_register: 634failed_register:
637 release_mem_region(res->start, resource_size(res)); 635 release_mem_region(res->start, resource_size(res));
638failed_get_resource: 636failed_get_resource:
@@ -650,7 +648,7 @@ static int imx_ssi_remove(struct platform_device *pdev)
650 platform_device_unregister(ssi->soc_platform_pdev); 648 platform_device_unregister(ssi->soc_platform_pdev);
651 platform_device_unregister(ssi->soc_platform_pdev_fiq); 649 platform_device_unregister(ssi->soc_platform_pdev_fiq);
652 650
653 snd_soc_unregister_dai(&pdev->dev); 651 snd_soc_unregister_component(&pdev->dev);
654 652
655 if (ssi->flags & IMX_SSI_USE_AC97) 653 if (ssi->flags & IMX_SSI_USE_AC97)
656 ac97_ssi = NULL; 654 ac97_ssi = NULL;