diff options
author | Stephen Warren <swarren@nvidia.com> | 2013-12-10 14:35:25 -0500 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-12-18 13:55:06 -0500 |
commit | e1771bcf99b0dc91f4ba645c1740fd5031702f49 (patch) | |
tree | 56d12a6132a8151ce33bd89899aaa85d2ea40be7 /sound/soc | |
parent | ede38884ac25ed78e43f3480056670963a9980f0 (diff) |
ASoC: SPEAr: remove custom DMA alloc compat function
spear_pcm_request_chan() is almost identical to
dmaengine_pcm_compat_request_channel(), with the exception that the
latter:
a) Assumes that the DAI DMA data is a struct snd_dmaengine_dai_dma_data
pointer rather than some custom type.
b) dma_data->filter_data rather than dma_data should be passed to
snd_dmaengine_pcm_request_channel() as the filter data.
Make minor changes to the SPEAr DAI drivers so that those two conditions
are met. This allows removal of the custom .compat_request_channel().
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/spear/spdif_in.c | 10 | ||||
-rw-r--r-- | sound/soc/spear/spdif_out.c | 10 | ||||
-rw-r--r-- | sound/soc/spear/spear_pcm.c | 21 | ||||
-rw-r--r-- | sound/soc/spear/spear_pcm.h | 4 |
4 files changed, 24 insertions, 21 deletions
diff --git a/sound/soc/spear/spdif_in.c b/sound/soc/spear/spdif_in.c index 4627110f3441..4ab442a63d7e 100644 --- a/sound/soc/spear/spdif_in.c +++ b/sound/soc/spear/spdif_in.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/ioport.h> | 18 | #include <linux/ioport.h> |
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <sound/dmaengine_pcm.h> | ||
21 | #include <sound/pcm.h> | 22 | #include <sound/pcm.h> |
22 | #include <sound/pcm_params.h> | 23 | #include <sound/pcm_params.h> |
23 | #include <sound/soc.h> | 24 | #include <sound/soc.h> |
@@ -38,6 +39,8 @@ struct spdif_in_dev { | |||
38 | struct device *dev; | 39 | struct device *dev; |
39 | void (*reset_perip)(void); | 40 | void (*reset_perip)(void); |
40 | int irq; | 41 | int irq; |
42 | struct snd_dmaengine_dai_dma_data dma_params_rx; | ||
43 | struct snd_dmaengine_pcm_config config; | ||
41 | }; | 44 | }; |
42 | 45 | ||
43 | static void spdif_in_configure(struct spdif_in_dev *host) | 46 | static void spdif_in_configure(struct spdif_in_dev *host) |
@@ -54,7 +57,8 @@ static int spdif_in_dai_probe(struct snd_soc_dai *dai) | |||
54 | { | 57 | { |
55 | struct spdif_in_dev *host = snd_soc_dai_get_drvdata(dai); | 58 | struct spdif_in_dev *host = snd_soc_dai_get_drvdata(dai); |
56 | 59 | ||
57 | dai->capture_dma_data = &host->dma_params; | 60 | host->dma_params_rx.filter_data = &host->dma_params; |
61 | dai->capture_dma_data = &host->dma_params_rx; | ||
58 | 62 | ||
59 | return 0; | 63 | return 0; |
60 | } | 64 | } |
@@ -245,7 +249,6 @@ static int spdif_in_probe(struct platform_device *pdev) | |||
245 | host->dma_params.addr = res_fifo->start; | 249 | host->dma_params.addr = res_fifo->start; |
246 | host->dma_params.max_burst = 16; | 250 | host->dma_params.max_burst = 16; |
247 | host->dma_params.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; | 251 | host->dma_params.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; |
248 | host->dma_params.filter = pdata->filter; | ||
249 | host->reset_perip = pdata->reset_perip; | 252 | host->reset_perip = pdata->reset_perip; |
250 | 253 | ||
251 | host->dev = &pdev->dev; | 254 | host->dev = &pdev->dev; |
@@ -263,7 +266,8 @@ static int spdif_in_probe(struct platform_device *pdev) | |||
263 | if (ret) | 266 | if (ret) |
264 | return ret; | 267 | return ret; |
265 | 268 | ||
266 | return devm_spear_pcm_platform_register(&pdev->dev); | 269 | return devm_spear_pcm_platform_register(&pdev->dev, &host->config, |
270 | pdata->filter); | ||
267 | } | 271 | } |
268 | 272 | ||
269 | static struct platform_driver spdif_in_driver = { | 273 | static struct platform_driver spdif_in_driver = { |
diff --git a/sound/soc/spear/spdif_out.c b/sound/soc/spear/spdif_out.c index 731a1e0cfeaa..fe99f461aff0 100644 --- a/sound/soc/spear/spdif_out.c +++ b/sound/soc/spear/spdif_out.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/ioport.h> | 18 | #include <linux/ioport.h> |
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <sound/dmaengine_pcm.h> | ||
21 | #include <sound/soc.h> | 22 | #include <sound/soc.h> |
22 | #include <sound/spear_dma.h> | 23 | #include <sound/spear_dma.h> |
23 | #include <sound/spear_spdif.h> | 24 | #include <sound/spear_spdif.h> |
@@ -36,6 +37,8 @@ struct spdif_out_dev { | |||
36 | struct spdif_out_params saved_params; | 37 | struct spdif_out_params saved_params; |
37 | u32 running; | 38 | u32 running; |
38 | void __iomem *io_base; | 39 | void __iomem *io_base; |
40 | struct snd_dmaengine_dai_dma_data dma_params_tx; | ||
41 | struct snd_dmaengine_pcm_config config; | ||
39 | }; | 42 | }; |
40 | 43 | ||
41 | static void spdif_out_configure(struct spdif_out_dev *host) | 44 | static void spdif_out_configure(struct spdif_out_dev *host) |
@@ -245,7 +248,8 @@ static int spdif_soc_dai_probe(struct snd_soc_dai *dai) | |||
245 | { | 248 | { |
246 | struct spdif_out_dev *host = snd_soc_dai_get_drvdata(dai); | 249 | struct spdif_out_dev *host = snd_soc_dai_get_drvdata(dai); |
247 | 250 | ||
248 | dai->playback_dma_data = &host->dma_params; | 251 | host->dma_params_tx.filter_data = &host->dma_params; |
252 | dai->playback_dma_data = &host->dma_params_tx; | ||
249 | 253 | ||
250 | return snd_soc_add_dai_controls(dai, spdif_out_controls, | 254 | return snd_soc_add_dai_controls(dai, spdif_out_controls, |
251 | ARRAY_SIZE(spdif_out_controls)); | 255 | ARRAY_SIZE(spdif_out_controls)); |
@@ -304,7 +308,6 @@ static int spdif_out_probe(struct platform_device *pdev) | |||
304 | host->dma_params.addr = res->start + SPDIF_OUT_FIFO_DATA; | 308 | host->dma_params.addr = res->start + SPDIF_OUT_FIFO_DATA; |
305 | host->dma_params.max_burst = 16; | 309 | host->dma_params.max_burst = 16; |
306 | host->dma_params.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; | 310 | host->dma_params.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; |
307 | host->dma_params.filter = pdata->filter; | ||
308 | 311 | ||
309 | dev_set_drvdata(&pdev->dev, host); | 312 | dev_set_drvdata(&pdev->dev, host); |
310 | 313 | ||
@@ -313,7 +316,8 @@ static int spdif_out_probe(struct platform_device *pdev) | |||
313 | if (ret) | 316 | if (ret) |
314 | return ret; | 317 | return ret; |
315 | 318 | ||
316 | return devm_spear_pcm_platform_register(&pdev->dev); | 319 | return devm_spear_pcm_platform_register(&pdev->dev, &host->config, |
320 | pdata->filter); | ||
317 | } | 321 | } |
318 | 322 | ||
319 | #ifdef CONFIG_PM | 323 | #ifdef CONFIG_PM |
diff --git a/sound/soc/spear/spear_pcm.c b/sound/soc/spear/spear_pcm.c index f288724961da..0e5a8f35d0ad 100644 --- a/sound/soc/spear/spear_pcm.c +++ b/sound/soc/spear/spear_pcm.c | |||
@@ -32,26 +32,19 @@ static const struct snd_pcm_hardware spear_pcm_hardware = { | |||
32 | .fifo_size = 0, /* fifo size in bytes */ | 32 | .fifo_size = 0, /* fifo size in bytes */ |
33 | }; | 33 | }; |
34 | 34 | ||
35 | static struct dma_chan *spear_pcm_request_chan(struct snd_soc_pcm_runtime *rtd, | ||
36 | struct snd_pcm_substream *substream) | ||
37 | { | ||
38 | struct spear_dma_data *dma_data; | ||
39 | |||
40 | dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); | ||
41 | |||
42 | return snd_dmaengine_pcm_request_channel(dma_data->filter, dma_data); | ||
43 | } | ||
44 | |||
45 | static const struct snd_dmaengine_pcm_config spear_dmaengine_pcm_config = { | 35 | static const struct snd_dmaengine_pcm_config spear_dmaengine_pcm_config = { |
46 | .pcm_hardware = &spear_pcm_hardware, | 36 | .pcm_hardware = &spear_pcm_hardware, |
47 | .compat_request_channel = spear_pcm_request_chan, | ||
48 | .prealloc_buffer_size = 16 * 1024, | 37 | .prealloc_buffer_size = 16 * 1024, |
49 | }; | 38 | }; |
50 | 39 | ||
51 | int devm_spear_pcm_platform_register(struct device *dev) | 40 | int devm_spear_pcm_platform_register(struct device *dev, |
41 | struct snd_dmaengine_pcm_config *config, | ||
42 | bool (*filter)(struct dma_chan *chan, void *slave)) | ||
52 | { | 43 | { |
53 | return devm_snd_dmaengine_pcm_register(dev, | 44 | *config = spear_dmaengine_pcm_config; |
54 | &spear_dmaengine_pcm_config, | 45 | config->compat_filter_fn = filter; |
46 | |||
47 | return snd_dmaengine_pcm_register(dev, config, | ||
55 | SND_DMAENGINE_PCM_FLAG_NO_DT | | 48 | SND_DMAENGINE_PCM_FLAG_NO_DT | |
56 | SND_DMAENGINE_PCM_FLAG_COMPAT); | 49 | SND_DMAENGINE_PCM_FLAG_COMPAT); |
57 | } | 50 | } |
diff --git a/sound/soc/spear/spear_pcm.h b/sound/soc/spear/spear_pcm.h index 631e2aa1fb33..9b0ca62d6f02 100644 --- a/sound/soc/spear/spear_pcm.h +++ b/sound/soc/spear/spear_pcm.h | |||
@@ -17,6 +17,8 @@ | |||
17 | #ifndef __SPEAR_PCM_H__ | 17 | #ifndef __SPEAR_PCM_H__ |
18 | #define __SPEAR_PCM_H__ | 18 | #define __SPEAR_PCM_H__ |
19 | 19 | ||
20 | int devm_spear_pcm_platform_register(struct device *dev); | 20 | int devm_spear_pcm_platform_register(struct device *dev, |
21 | struct snd_dmaengine_pcm_config *config, | ||
22 | bool (*filter)(struct dma_chan *chan, void *slave)); | ||
21 | 23 | ||
22 | #endif | 24 | #endif |