Skip to content

Commit e1771bc

Browse files
Stephen Warrenbroonie
authored andcommitted
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>
1 parent ede3888 commit e1771bc

5 files changed

Lines changed: 24 additions & 22 deletions

File tree

‎include/sound/spear_dma.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ struct spear_dma_data {
2929
dma_addr_t addr;
3030
u32 max_burst;
3131
enum dma_slave_buswidth addr_width;
32-
bool (*filter)(struct dma_chan *chan, void *slave);
3332
};
3433

3534
#endif /* SPEAR_DMA_H */

‎sound/soc/spear/spdif_in.c‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <linux/ioport.h>
1919
#include <linux/module.h>
2020
#include <linux/platform_device.h>
21+
#include <sound/dmaengine_pcm.h>
2122
#include <sound/pcm.h>
2223
#include <sound/pcm_params.h>
2324
#include <sound/soc.h>
@@ -38,6 +39,8 @@ struct spdif_in_dev {
3839
struct device *dev;
3940
void (*reset_perip)(void);
4041
int irq;
42+
struct snd_dmaengine_dai_dma_data dma_params_rx;
43+
struct snd_dmaengine_pcm_config config;
4144
};
4245

4346
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)
5457
{
5558
struct spdif_in_dev *host = snd_soc_dai_get_drvdata(dai);
5659

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;
5862

5963
return 0;
6064
}
@@ -245,7 +249,6 @@ static int spdif_in_probe(struct platform_device *pdev)
245249
host->dma_params.addr = res_fifo->start;
246250
host->dma_params.max_burst = 16;
247251
host->dma_params.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
248-
host->dma_params.filter = pdata->filter;
249252
host->reset_perip = pdata->reset_perip;
250253

251254
host->dev = &pdev->dev;
@@ -263,7 +266,8 @@ static int spdif_in_probe(struct platform_device *pdev)
263266
if (ret)
264267
return ret;
265268

266-
return devm_spear_pcm_platform_register(&pdev->dev);
269+
return devm_spear_pcm_platform_register(&pdev->dev, &host->config,
270+
pdata->filter);
267271
}
268272

269273
static struct platform_driver spdif_in_driver = {

‎sound/soc/spear/spdif_out.c‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <linux/ioport.h>
1919
#include <linux/module.h>
2020
#include <linux/platform_device.h>
21+
#include <sound/dmaengine_pcm.h>
2122
#include <sound/soc.h>
2223
#include <sound/spear_dma.h>
2324
#include <sound/spear_spdif.h>
@@ -36,6 +37,8 @@ struct spdif_out_dev {
3637
struct spdif_out_params saved_params;
3738
u32 running;
3839
void __iomem *io_base;
40+
struct snd_dmaengine_dai_dma_data dma_params_tx;
41+
struct snd_dmaengine_pcm_config config;
3942
};
4043

4144
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)
245248
{
246249
struct spdif_out_dev *host = snd_soc_dai_get_drvdata(dai);
247250

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;
249253

250254
return snd_soc_add_dai_controls(dai, spdif_out_controls,
251255
ARRAY_SIZE(spdif_out_controls));
@@ -304,7 +308,6 @@ static int spdif_out_probe(struct platform_device *pdev)
304308
host->dma_params.addr = res->start + SPDIF_OUT_FIFO_DATA;
305309
host->dma_params.max_burst = 16;
306310
host->dma_params.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
307-
host->dma_params.filter = pdata->filter;
308311

309312
dev_set_drvdata(&pdev->dev, host);
310313

@@ -313,7 +316,8 @@ static int spdif_out_probe(struct platform_device *pdev)
313316
if (ret)
314317
return ret;
315318

316-
return devm_spear_pcm_platform_register(&pdev->dev);
319+
return devm_spear_pcm_platform_register(&pdev->dev, &host->config,
320+
pdata->filter);
317321
}
318322

319323
#ifdef CONFIG_PM

‎sound/soc/spear/spear_pcm.c‎

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,19 @@ static const struct snd_pcm_hardware spear_pcm_hardware = {
3232
.fifo_size = 0, /* fifo size in bytes */
3333
};
3434

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-
4535
static const struct snd_dmaengine_pcm_config spear_dmaengine_pcm_config = {
4636
.pcm_hardware = &spear_pcm_hardware,
47-
.compat_request_channel = spear_pcm_request_chan,
4837
.prealloc_buffer_size = 16 * 1024,
4938
};
5039

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))
5243
{
53-
return devm_snd_dmaengine_pcm_register(dev,
54-
&spear_dmaengine_pcm_config,
44+
*config = spear_dmaengine_pcm_config;
45+
config->compat_filter_fn = filter;
46+
47+
return snd_dmaengine_pcm_register(dev, config,
5548
SND_DMAENGINE_PCM_FLAG_NO_DT |
5649
SND_DMAENGINE_PCM_FLAG_COMPAT);
5750
}

‎sound/soc/spear/spear_pcm.h‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#ifndef __SPEAR_PCM_H__
1818
#define __SPEAR_PCM_H__
1919

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));
2123

2224
#endif

0 commit comments

Comments
 (0)