diff options
-rw-r--r-- | sound/soc/imx/imx-pcm-dma-mx2.c | 31 | ||||
-rw-r--r-- | sound/soc/imx/imx-pcm.h | 1 |
2 files changed, 26 insertions, 6 deletions
diff --git a/sound/soc/imx/imx-pcm-dma-mx2.c b/sound/soc/imx/imx-pcm-dma-mx2.c index 3065dfd38b71..047a5db6c491 100644 --- a/sound/soc/imx/imx-pcm-dma-mx2.c +++ b/sound/soc/imx/imx-pcm-dma-mx2.c @@ -35,6 +35,14 @@ #include "imx-ssi.h" #include "imx-pcm.h" +struct asrc_p2p_ops *asrc_pcm_p2p_ops; + +void asrc_p2p_hook(struct asrc_p2p_ops *asrc_p2p_ct) +{ + asrc_pcm_p2p_ops = asrc_p2p_ct; + return ; +} +EXPORT_SYMBOL(asrc_p2p_hook); static void audio_dma_irq(void *data) { @@ -109,14 +117,16 @@ static int imx_ssi_asrc_dma_alloc(struct snd_pcm_substream *substream, iprtd->asrc_dma_data.peripheral_type = IMX_DMATYPE_ASRC; iprtd->asrc_dma_data.priority = DMA_PRIO_HIGH; iprtd->asrc_dma_data.dma_request = - asrc_get_dma_request(iprtd->asrc_index, 1); + iprtd->asrc_pcm_p2p_ops_ko-> + asrc_p2p_get_dma_request(iprtd->asrc_index, 1); iprtd->asrc_dma_chan = dma_request_channel(mask, asrc_filter, iprtd); if (!iprtd->asrc_dma_chan) goto error; slave_config.direction = DMA_TO_DEVICE; - slave_config.dst_addr = asrc_get_per_addr(iprtd->asrc_index, 1); + slave_config.dst_addr = iprtd->asrc_pcm_p2p_ops_ko-> + asrc_p2p_per_addr(iprtd->asrc_index, 1); slave_config.dst_addr_width = buswidth; slave_config.dst_maxburst = dma_params->burstsize * buswidth; @@ -127,7 +137,8 @@ static int imx_ssi_asrc_dma_alloc(struct snd_pcm_substream *substream, iprtd->asrc_p2p_dma_data.peripheral_type = IMX_DMATYPE_ASRC; iprtd->asrc_p2p_dma_data.priority = DMA_PRIO_HIGH; iprtd->asrc_p2p_dma_data.dma_request = - asrc_get_dma_request(iprtd->asrc_index, 0); + iprtd->asrc_pcm_p2p_ops_ko-> + asrc_p2p_get_dma_request(iprtd->asrc_index, 0); iprtd->asrc_p2p_dma_data.dma_request_p2p = dma_params->dma; iprtd->asrc_p2p_dma_chan = dma_request_channel(mask, asrc_p2p_filter, iprtd); @@ -146,7 +157,8 @@ static int imx_ssi_asrc_dma_alloc(struct snd_pcm_substream *substream, } slave_config.direction = DMA_DEV_TO_DEV; - slave_config.src_addr = asrc_get_per_addr(iprtd->asrc_index, 0); + slave_config.src_addr = iprtd->asrc_pcm_p2p_ops_ko-> + asrc_p2p_per_addr(iprtd->asrc_index, 0); slave_config.src_addr_width = buswidth; slave_config.src_maxburst = dma_params->burstsize * buswidth; slave_config.dst_addr = dma_params->dma_addr; @@ -358,7 +370,8 @@ static int snd_imx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) if (iprtd->asrc_enable) { dmaengine_submit(iprtd->asrc_p2p_desc); dmaengine_submit(iprtd->asrc_desc); - asrc_start_conv(iprtd->asrc_index); + iprtd->asrc_pcm_p2p_ops_ko-> + asrc_p2p_start_conv(iprtd->asrc_index); mdelay(1); } else { dmaengine_submit(iprtd->desc); @@ -371,7 +384,8 @@ static int snd_imx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) if (iprtd->asrc_enable) { dmaengine_terminate_all(iprtd->asrc_dma_chan); dmaengine_terminate_all(iprtd->asrc_p2p_dma_chan); - asrc_stop_conv(iprtd->asrc_index); + iprtd->asrc_pcm_p2p_ops_ko-> + asrc_p2p_stop_conv(iprtd->asrc_index); } else { dmaengine_terminate_all(iprtd->dma_chan); } @@ -428,6 +442,11 @@ static int snd_imx_open(struct snd_pcm_substream *substream) iprtd->p2p = (struct asrc_p2p_params *)snd_soc_pcm_get_drvdata(rtd); iprtd->asrc_index = -1; + if (!asrc_pcm_p2p_ops) { + pr_err("ASRC is not loaded!\n"); + return -EINVAL; + } + iprtd->asrc_pcm_p2p_ops_ko = asrc_pcm_p2p_ops; } runtime->private_data = iprtd; diff --git a/sound/soc/imx/imx-pcm.h b/sound/soc/imx/imx-pcm.h index 9b5e1e03fd40..1b126be7a592 100644 --- a/sound/soc/imx/imx-pcm.h +++ b/sound/soc/imx/imx-pcm.h @@ -60,6 +60,7 @@ struct imx_pcm_runtime_data { struct dma_chan *dma_chan; struct imx_dma_data dma_data; int asrc_enable; + struct asrc_p2p_ops *asrc_pcm_p2p_ops_ko; #if defined(CONFIG_MXC_ASRC) || defined(CONFIG_IMX_HAVE_PLATFORM_IMX_ASRC) enum asrc_pair_index asrc_index; |