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-mcpdm.c | |
parent | 2735e6cd2b8d7cbf4c096b3cb19d637efb7a3ffc (diff) | |
download | linux-stable-09ae3aaf3cd28422d76b7b78d9491b17330b276a.tar.gz linux-stable-09ae3aaf3cd28422d76b7b78d9491b17330b276a.tar.bz2 linux-stable-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-mcpdm.c')
-rw-r--r-- | sound/soc/omap/omap-mcpdm.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/sound/soc/omap/omap-mcpdm.c b/sound/soc/omap/omap-mcpdm.c index e1d3998cb0a5..49f102a1dbae 100644 --- a/sound/soc/omap/omap-mcpdm.c +++ b/sound/soc/omap/omap-mcpdm.c @@ -39,9 +39,9 @@ #include <sound/pcm.h> #include <sound/pcm_params.h> #include <sound/soc.h> +#include <sound/dmaengine_pcm.h> #include "omap-mcpdm.h" -#include "omap-pcm.h" struct mcpdm_link_config { u32 link_mask; /* channel mask for the direction */ @@ -64,19 +64,14 @@ struct omap_mcpdm { /* McPDM needs to be restarted due to runtime reconfiguration */ bool restart; + + struct snd_dmaengine_dai_dma_data dma_data[2]; + unsigned int dma_req[2]; }; /* * Stream DMA parameters */ -static struct omap_pcm_dma_data omap_mcpdm_dai_dma_params[] = { - { - .name = "Audio playback", - }, - { - .name = "Audio capture", - }, -}; static inline void omap_mcpdm_write(struct omap_mcpdm *mcpdm, u16 reg, u32 val) { @@ -272,7 +267,7 @@ static int omap_mcpdm_dai_startup(struct snd_pcm_substream *substream, mutex_unlock(&mcpdm->mutex); snd_soc_dai_set_dma_data(dai, substream, - &omap_mcpdm_dai_dma_params[substream->stream]); + &mcpdm->dma_data[substream->stream]); return 0; } @@ -302,7 +297,7 @@ static int omap_mcpdm_dai_hw_params(struct snd_pcm_substream *substream, { struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai); int stream = substream->stream; - struct omap_pcm_dma_data *dma_data; + struct snd_dmaengine_dai_dma_data *dma_data; u32 threshold; int channels; int link_mask = 0; @@ -342,14 +337,14 @@ static int omap_mcpdm_dai_hw_params(struct snd_pcm_substream *substream, if (!mcpdm->config[!stream].link_mask) mcpdm->config[!stream].link_mask = 0x3; - dma_data->packet_size = + dma_data->maxburst = (MCPDM_DN_THRES_MAX - threshold) * channels; } else { /* If playback is not running assume a stereo stream to come */ if (!mcpdm->config[!stream].link_mask) mcpdm->config[!stream].link_mask = (0x3 << 3); - dma_data->packet_size = threshold * channels; + dma_data->maxburst = threshold * channels; } /* Check if we need to restart McPDM with this stream */ @@ -475,20 +470,22 @@ static int asoc_mcpdm_probe(struct platform_device *pdev) if (res == NULL) return -ENOMEM; - omap_mcpdm_dai_dma_params[0].port_addr = res->start + MCPDM_REG_DN_DATA; - omap_mcpdm_dai_dma_params[1].port_addr = res->start + MCPDM_REG_UP_DATA; + mcpdm->dma_data[0].addr = res->start + MCPDM_REG_DN_DATA; + mcpdm->dma_data[1].addr = res->start + MCPDM_REG_UP_DATA; res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "dn_link"); if (!res) return -ENODEV; - omap_mcpdm_dai_dma_params[0].dma_req = res->start; + mcpdm->dma_req[0] = res->start; + mcpdm->dma_data[0].filter_data = &mcpdm->dma_req[0]; res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "up_link"); if (!res) return -ENODEV; - omap_mcpdm_dai_dma_params[1].dma_req = res->start; + mcpdm->dma_req[1] = res->start; + mcpdm->dma_data[1].filter_data = &mcpdm->dma_req[1]; res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu"); if (res == NULL) |