diff options
author | Xiubo Li <Li.Xiubo@freescale.com> | 2014-03-24 10:32:28 (GMT) |
---|---|---|
committer | Matthew Weigel <Matthew.Weigel@freescale.com> | 2014-12-11 18:36:29 (GMT) |
commit | 6313b89ee179e04f83641703a07f47c202098f2a (patch) | |
tree | 2abf48edc90d6dbfc4b81bf4f71aa9a508dbd44e /sound | |
parent | 114fcf4aca99672e839c4f9a23fcd3c9f018c699 (diff) | |
download | linux-fsl-qoriq-6313b89ee179e04f83641703a07f47c202098f2a.tar.xz |
ASoC: fsl-sai: backport to 3.12
Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Change-Id: I4e1f12afb9aefa0de69bcbab393eb8ec28f56df1
Reviewed-on: http://git.am.freescale.net:8181/19754
Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com>
Reviewed-by: Zhengxiong Jin <Jason.Jin@freescale.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/fsl/fsl_sai.c | 39 | ||||
-rw-r--r-- | sound/soc/fsl/fsl_sai.h | 2 |
2 files changed, 39 insertions, 2 deletions
diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c index 10535bd..7286824 100644 --- a/sound/soc/fsl/fsl_sai.c +++ b/sound/soc/fsl/fsl_sai.c @@ -484,6 +484,41 @@ static struct regmap_config fsl_sai_regmap_config = { .writeable_reg = fsl_sai_writeable_reg, }; +static bool fsl_sai_filter(struct dma_chan *chan, void *param) +{ + struct snd_dmaengine_dai_dma_data *dma_data = param; + + chan->private = dma_data->filter_data; + + return true; +} + +static const struct snd_pcm_hardware fsl_sai_pcm_hardware = { + .info = SNDRV_PCM_INFO_INTERLEAVED | + SNDRV_PCM_INFO_BLOCK_TRANSFER | + SNDRV_PCM_INFO_MMAP | + SNDRV_PCM_INFO_MMAP_VALID | + SNDRV_PCM_INFO_PAUSE | + SNDRV_PCM_INFO_RESUME, + .formats = SNDRV_PCM_FMTBIT_S16_LE, + .rate_min = 8000, + .channels_min = 2, + .channels_max = 2, + .buffer_bytes_max = FSL_SAI_DMABUF_SIZE, + .period_bytes_min = 128, + .period_bytes_max = 65535, + .periods_min = 2, + .periods_max = 255, + .fifo_size = 0, +}; + +static const struct snd_dmaengine_pcm_config fsl_sai_dmaengine_pcm_config = { + .pcm_hardware = &fsl_sai_pcm_hardware, + .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config, + .compat_filter_fn = fsl_sai_filter, + .prealloc_buffer_size = FSL_SAI_DMABUF_SIZE, +}; + static int fsl_sai_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; @@ -526,7 +561,8 @@ static int fsl_sai_probe(struct platform_device *pdev) if (ret) return ret; - ret = snd_dmaengine_pcm_register(&pdev->dev, NULL, + ret = snd_dmaengine_pcm_register(&pdev->dev, + &fsl_sai_dmaengine_pcm_config, SND_DMAENGINE_PCM_FLAG_NO_RESIDUE); if (ret) snd_soc_unregister_component(&pdev->dev); @@ -550,7 +586,6 @@ static const struct of_device_id fsl_sai_ids[] = { static struct platform_driver fsl_sai_driver = { .probe = fsl_sai_probe, .remove = fsl_sai_remove, - .driver = { .name = "fsl-sai", .owner = THIS_MODULE, diff --git a/sound/soc/fsl/fsl_sai.h b/sound/soc/fsl/fsl_sai.h index e432260..fc12d96 100644 --- a/sound/soc/fsl/fsl_sai.h +++ b/sound/soc/fsl/fsl_sai.h @@ -11,6 +11,8 @@ #include <sound/dmaengine_pcm.h> +#define FSL_SAI_DMABUF_SIZE (64 * 1024) + #define FSL_SAI_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\ SNDRV_PCM_FMTBIT_S20_3LE |\ SNDRV_PCM_FMTBIT_S24_LE) |