Skip to contentSkip to conversation

ASoC: imx: Open code dma channel request

PATCH In review Mark Brown 2 participants 3 messages Oct 19, 2013

Subsystems (4)
lore
Share & tools
lore

Mark Brown

author maintainer
#0 lore raw

PATCH 1/1 ASoC: imx: Open code dma channel request

From: Mark Brown <[email protected]>

Currently the imx DMA code is one of the few users relying on the fact that the compat code uses the dma_data as the filter data for non-DT channel requests. Since the rest of the core expects this to be a struct snd_dmaengine_dai_data this isn't terribly helpful this will be changed to use the already existing filter data so avoid breaking imx by open coding the current behaviour.

---
 sound/soc/fsl/imx-pcm-dma.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
sound/soc/fsl/imx-pcm-dma.c +12 -0
index 4dc1296..318f1fc 100644
@@ -35,6 +35,17 @@ static bool filter(struct dma_chan *chan, void *param)
 	return true;
 }
 
+static struct dma_chan *imx_compat_request_channel(
+	struct snd_soc_pcm_runtime *rtd,
+	struct snd_pcm_substream *substream)
+{
+	struct snd_dmaengine_dai_dma_data *dma_data;
+
+	dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
+
+	return snd_dmaengine_pcm_request_channel(filter, dma_data);
+}
+
 static const struct snd_pcm_hardware imx_pcm_hardware = {
 	.info = SNDRV_PCM_INFO_INTERLEAVED |
 		SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -58,6 +69,7 @@ static const struct snd_dmaengine_pcm_config imx_dmaengine_pcm_config = {
 	.pcm_hardware = &imx_pcm_hardware,
 	.prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config,
 	.compat_filter_fn = filter,
+	.compat_request_channel = imx_compat_request_channel,
 	.prealloc_buffer_size = IMX_SSI_DMABUF_SIZE,
 };
 
Signature · 1 line
1.8.4.rc3
#1 lore raw
Quoted 10 lines · Mark Brown

From: Mark Brown <[email protected]>

Currently the imx DMA code is one of the few users relying on the fact that the compat code uses the dma_data as the filter data for non-DT channel requests. Since the rest of the core expects this to be a struct snd_dmaengine_dai_data this isn't terribly helpful this will be changed to use the already existing filter data so avoid breaking imx by open coding the current behaviour.

Since the driver is already using the generic struct adding this to the other patch makes more sense to me:

sound/soc/fsl/imx-pcm-dma.c +1 -3
@@ -25,12 +25,10 @@
 
 static bool filter(struct dma_chan *chan, void *param)
 {
-	struct snd_dmaengine_dai_dma_data *dma_data = param;
-
 	if (!imx_dma_is_general_purpose(chan))
 		return false;
 
-	chan->private = dma_data->filter_data;
+	chan->private = param;
 
 	return true;
 }
author maintainer
#2 lore raw
Quoted 2 lines · Lars-Peter Clausen

Since the driver is already using the generic struct adding this to the other patch makes more sense to me:

You're quite right, to be honest I didn't even look at what the data was
- I was just doing a mechanical conversion to let me get on with the Samsung driver.