diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2013-04-03 11:06:05 +0200 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-04-03 18:12:58 +0100 |
commit | 09ae3aaf3cd28422d76b7b78d9491b17330b276a (patch) | |
tree | ba7414aaa0041f445f482bc3a18a76aa416b83ca /sound/soc/omap/omap-pcm.c | |
parent | 2735e6cd2b8d7cbf4c096b3cb19d637efb7a3ffc (diff) | |
download | lwn-09ae3aaf3cd28422d76b7b78d9491b17330b276a.tar.gz lwn-09ae3aaf3cd28422d76b7b78d9491b17330b276a.zip |
ASoC: omap: Use common DAI DMA data
Use the common DAI DMA data struct for omap, this allows us to use the common
helper function to configure the DMA slave config based on the DAI DMA data.
For omap-dmic and omap-mcpdm also move the DMA data from a global variable to
the driver state struct.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/omap/omap-pcm.c')
-rw-r--r-- | sound/soc/omap/omap-pcm.c | 42 |
1 files changed, 5 insertions, 37 deletions
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c index 6c842c7ef9e6..c8e272f9c2de 100644 --- a/sound/soc/omap/omap-pcm.c +++ b/sound/soc/omap/omap-pcm.c @@ -32,8 +32,6 @@ #include <sound/dmaengine_pcm.h> #include <sound/soc.h> -#include "omap-pcm.h" - #ifdef CONFIG_ARCH_OMAP1 #define pcm_omap1510() cpu_is_omap1510() #else @@ -56,25 +54,6 @@ static const struct snd_pcm_hardware omap_pcm_hardware = { .buffer_bytes_max = 128 * 1024, }; -static int omap_pcm_get_dma_buswidth(int num_bits) -{ - int buswidth; - - switch (num_bits) { - case 16: - buswidth = DMA_SLAVE_BUSWIDTH_2_BYTES; - break; - case 32: - buswidth = DMA_SLAVE_BUSWIDTH_4_BYTES; - break; - default: - buswidth = -EINVAL; - break; - } - return buswidth; -} - - /* this may get called several times by oss emulation */ static int omap_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) @@ -105,20 +84,9 @@ static int omap_pcm_hw_params(struct snd_pcm_substream *substream, if (err) return err; - /* Override the *_dma addr_width if requested by the DAI driver */ - if (dma_data->data_type) { - int buswidth = omap_pcm_get_dma_buswidth(dma_data->data_type); - - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) - config.dst_addr_width = buswidth; - else - config.src_addr_width = buswidth; - } - - config.src_addr = dma_data->port_addr; - config.dst_addr = dma_data->port_addr; - config.src_maxburst = dma_data->packet_size; - config.dst_maxburst = dma_data->packet_size; + snd_dmaengine_pcm_set_config_from_dai_data(substream, + snd_soc_dai_get_dma_data(rtd->cpu_dai, substream), + &config); return dmaengine_slave_config(chan, &config); } @@ -144,14 +112,14 @@ static snd_pcm_uframes_t omap_pcm_pointer(struct snd_pcm_substream *substream) static int omap_pcm_open(struct snd_pcm_substream *substream) { struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct omap_pcm_dma_data *dma_data; + struct snd_dmaengine_dai_dma_data *dma_data; snd_soc_set_runtime_hwparams(substream, &omap_pcm_hardware); dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); return snd_dmaengine_pcm_open(substream, omap_dma_filter_fn, - &dma_data->dma_req); + dma_data->filter_data); } static int omap_pcm_mmap(struct snd_pcm_substream *substream, |