aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/atmel/atmel-pcm-dma.c3
-rw-r--r--sound/soc/cirrus/ep93xx-pcm.c1
-rw-r--r--sound/soc/fsl/fsl_sai.c3
-rw-r--r--sound/soc/soc-generic-dmaengine-pcm.c25
-rw-r--r--sound/soc/ux500/ux500_pcm.c1
5 files changed, 16 insertions, 17 deletions
diff --git a/sound/soc/atmel/atmel-pcm-dma.c b/sound/soc/atmel/atmel-pcm-dma.c
index b6625c8c411b..dd57a9eac171 100644
--- a/sound/soc/atmel/atmel-pcm-dma.c
+++ b/sound/soc/atmel/atmel-pcm-dma.c
@@ -124,8 +124,7 @@ static const struct snd_dmaengine_pcm_config atmel_dmaengine_pcm_config = {
124 124
125int atmel_pcm_dma_platform_register(struct device *dev) 125int atmel_pcm_dma_platform_register(struct device *dev)
126{ 126{
127 return snd_dmaengine_pcm_register(dev, &atmel_dmaengine_pcm_config, 127 return snd_dmaengine_pcm_register(dev, &atmel_dmaengine_pcm_config, 0);
128 SND_DMAENGINE_PCM_FLAG_NO_RESIDUE);
129} 128}
130EXPORT_SYMBOL(atmel_pcm_dma_platform_register); 129EXPORT_SYMBOL(atmel_pcm_dma_platform_register);
131 130
diff --git a/sound/soc/cirrus/ep93xx-pcm.c b/sound/soc/cirrus/ep93xx-pcm.c
index 5f664471d99e..67a73330db5e 100644
--- a/sound/soc/cirrus/ep93xx-pcm.c
+++ b/sound/soc/cirrus/ep93xx-pcm.c
@@ -60,7 +60,6 @@ int devm_ep93xx_pcm_platform_register(struct device *dev)
60{ 60{
61 return devm_snd_dmaengine_pcm_register(dev, 61 return devm_snd_dmaengine_pcm_register(dev,
62 &ep93xx_dmaengine_pcm_config, 62 &ep93xx_dmaengine_pcm_config,
63 SND_DMAENGINE_PCM_FLAG_NO_RESIDUE |
64 SND_DMAENGINE_PCM_FLAG_NO_DT | 63 SND_DMAENGINE_PCM_FLAG_NO_DT |
65 SND_DMAENGINE_PCM_FLAG_COMPAT); 64 SND_DMAENGINE_PCM_FLAG_COMPAT);
66} 65}
diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index ec79c3d5e65e..ee2671b80592 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -664,8 +664,7 @@ static int fsl_sai_probe(struct platform_device *pdev)
664 if (sai->sai_on_imx) 664 if (sai->sai_on_imx)
665 return imx_pcm_dma_init(pdev); 665 return imx_pcm_dma_init(pdev);
666 else 666 else
667 return devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 667 return devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0);
668 SND_DMAENGINE_PCM_FLAG_NO_RESIDUE);
669} 668}
670 669
671static const struct of_device_id fsl_sai_ids[] = { 670static const struct of_device_id fsl_sai_ids[] = {
diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c
index c9917ca5de1a..6fd1906af387 100644
--- a/sound/soc/soc-generic-dmaengine-pcm.c
+++ b/sound/soc/soc-generic-dmaengine-pcm.c
@@ -24,6 +24,12 @@
24 24
25#include <sound/dmaengine_pcm.h> 25#include <sound/dmaengine_pcm.h>
26 26
27/*
28 * The platforms dmaengine driver does not support reporting the amount of
29 * bytes that are still left to transfer.
30 */
31#define SND_DMAENGINE_PCM_FLAG_NO_RESIDUE BIT(31)
32
27struct dmaengine_pcm { 33struct dmaengine_pcm {
28 struct dma_chan *chan[SNDRV_PCM_STREAM_LAST + 1]; 34 struct dma_chan *chan[SNDRV_PCM_STREAM_LAST + 1];
29 const struct snd_dmaengine_pcm_config *config; 35 const struct snd_dmaengine_pcm_config *config;
@@ -222,14 +228,18 @@ static struct dma_chan *dmaengine_pcm_compat_request_channel(
222 return snd_dmaengine_pcm_request_channel(fn, dma_data->filter_data); 228 return snd_dmaengine_pcm_request_channel(fn, dma_data->filter_data);
223} 229}
224 230
225static bool dmaengine_pcm_can_report_residue(struct dma_chan *chan) 231static bool dmaengine_pcm_can_report_residue(struct device *dev,
232 struct dma_chan *chan)
226{ 233{
227 struct dma_slave_caps dma_caps; 234 struct dma_slave_caps dma_caps;
228 int ret; 235 int ret;
229 236
230 ret = dma_get_slave_caps(chan, &dma_caps); 237 ret = dma_get_slave_caps(chan, &dma_caps);
231 if (ret != 0) 238 if (ret != 0) {
232 return true; 239 dev_warn(dev, "Failed to get DMA channel capabilities, falling back to period counting: %d\n",
240 ret);
241 return false;
242 }
233 243
234 if (dma_caps.residue_granularity == DMA_RESIDUE_GRANULARITY_DESCRIPTOR) 244 if (dma_caps.residue_granularity == DMA_RESIDUE_GRANULARITY_DESCRIPTOR)
235 return false; 245 return false;
@@ -289,14 +299,7 @@ static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd)
289 if (ret) 299 if (ret)
290 return ret; 300 return ret;
291 301
292 /* 302 if (!dmaengine_pcm_can_report_residue(dev, pcm->chan[i]))
293 * This will only return false if we know for sure that at least
294 * one channel does not support residue reporting. If the DMA
295 * driver does not implement the slave_caps API we rely having
296 * the NO_RESIDUE flag set manually in case residue reporting is
297 * not supported.
298 */
299 if (!dmaengine_pcm_can_report_residue(pcm->chan[i]))
300 pcm->flags |= SND_DMAENGINE_PCM_FLAG_NO_RESIDUE; 303 pcm->flags |= SND_DMAENGINE_PCM_FLAG_NO_RESIDUE;
301 } 304 }
302 305
diff --git a/sound/soc/ux500/ux500_pcm.c b/sound/soc/ux500/ux500_pcm.c
index 51a66a87305a..f12c01dddc8d 100644
--- a/sound/soc/ux500/ux500_pcm.c
+++ b/sound/soc/ux500/ux500_pcm.c
@@ -147,7 +147,6 @@ int ux500_pcm_register_platform(struct platform_device *pdev)
147 pcm_config = &ux500_dmaengine_pcm_config; 147 pcm_config = &ux500_dmaengine_pcm_config;
148 148
149 ret = snd_dmaengine_pcm_register(&pdev->dev, pcm_config, 149 ret = snd_dmaengine_pcm_register(&pdev->dev, pcm_config,
150 SND_DMAENGINE_PCM_FLAG_NO_RESIDUE |
151 SND_DMAENGINE_PCM_FLAG_COMPAT); 150 SND_DMAENGINE_PCM_FLAG_COMPAT);
152 if (ret < 0) { 151 if (ret < 0) {
153 dev_err(&pdev->dev, 152 dev_err(&pdev->dev,