Commit 977732b0 authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branch 'asoc/topic/dma' into asoc-next

parents 4b578955 acde50a7
...@@ -90,11 +90,6 @@ void snd_dmaengine_pcm_set_config_from_dai_data( ...@@ -90,11 +90,6 @@ void snd_dmaengine_pcm_set_config_from_dai_data(
* makes sense if SND_DMAENGINE_PCM_FLAG_COMPAT is set as well. * makes sense if SND_DMAENGINE_PCM_FLAG_COMPAT is set as well.
*/ */
#define SND_DMAENGINE_PCM_FLAG_NO_DT BIT(1) #define SND_DMAENGINE_PCM_FLAG_NO_DT BIT(1)
/*
* The platforms dmaengine driver does not support reporting the amount of
* bytes that are still left to transfer.
*/
#define SND_DMAENGINE_PCM_FLAG_NO_RESIDUE BIT(2)
/* /*
* The PCM is half duplex and the DMA channel is shared between capture and * The PCM is half duplex and the DMA channel is shared between capture and
* playback. * playback.
......
...@@ -124,8 +124,7 @@ static const struct snd_dmaengine_pcm_config atmel_dmaengine_pcm_config = { ...@@ -124,8 +124,7 @@ static const struct snd_dmaengine_pcm_config atmel_dmaengine_pcm_config = {
int atmel_pcm_dma_platform_register(struct device *dev) int atmel_pcm_dma_platform_register(struct device *dev)
{ {
return snd_dmaengine_pcm_register(dev, &atmel_dmaengine_pcm_config, return snd_dmaengine_pcm_register(dev, &atmel_dmaengine_pcm_config, 0);
SND_DMAENGINE_PCM_FLAG_NO_RESIDUE);
} }
EXPORT_SYMBOL(atmel_pcm_dma_platform_register); EXPORT_SYMBOL(atmel_pcm_dma_platform_register);
......
...@@ -60,7 +60,6 @@ int devm_ep93xx_pcm_platform_register(struct device *dev) ...@@ -60,7 +60,6 @@ int devm_ep93xx_pcm_platform_register(struct device *dev)
{ {
return devm_snd_dmaengine_pcm_register(dev, return devm_snd_dmaengine_pcm_register(dev,
&ep93xx_dmaengine_pcm_config, &ep93xx_dmaengine_pcm_config,
SND_DMAENGINE_PCM_FLAG_NO_RESIDUE |
SND_DMAENGINE_PCM_FLAG_NO_DT | SND_DMAENGINE_PCM_FLAG_NO_DT |
SND_DMAENGINE_PCM_FLAG_COMPAT); SND_DMAENGINE_PCM_FLAG_COMPAT);
} }
......
...@@ -664,8 +664,7 @@ static int fsl_sai_probe(struct platform_device *pdev) ...@@ -664,8 +664,7 @@ static int fsl_sai_probe(struct platform_device *pdev)
if (sai->sai_on_imx) if (sai->sai_on_imx)
return imx_pcm_dma_init(pdev); return imx_pcm_dma_init(pdev);
else else
return devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, return devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0);
SND_DMAENGINE_PCM_FLAG_NO_RESIDUE);
} }
static const struct of_device_id fsl_sai_ids[] = { static const struct of_device_id fsl_sai_ids[] = {
......
...@@ -24,6 +24,12 @@ ...@@ -24,6 +24,12 @@
#include <sound/dmaengine_pcm.h> #include <sound/dmaengine_pcm.h>
/*
* The platforms dmaengine driver does not support reporting the amount of
* bytes that are still left to transfer.
*/
#define SND_DMAENGINE_PCM_FLAG_NO_RESIDUE BIT(31)
struct dmaengine_pcm { struct dmaengine_pcm {
struct dma_chan *chan[SNDRV_PCM_STREAM_LAST + 1]; struct dma_chan *chan[SNDRV_PCM_STREAM_LAST + 1];
const struct snd_dmaengine_pcm_config *config; const struct snd_dmaengine_pcm_config *config;
...@@ -222,14 +228,18 @@ static struct dma_chan *dmaengine_pcm_compat_request_channel( ...@@ -222,14 +228,18 @@ static struct dma_chan *dmaengine_pcm_compat_request_channel(
return snd_dmaengine_pcm_request_channel(fn, dma_data->filter_data); return snd_dmaengine_pcm_request_channel(fn, dma_data->filter_data);
} }
static bool dmaengine_pcm_can_report_residue(struct dma_chan *chan) static bool dmaengine_pcm_can_report_residue(struct device *dev,
struct dma_chan *chan)
{ {
struct dma_slave_caps dma_caps; struct dma_slave_caps dma_caps;
int ret; int ret;
ret = dma_get_slave_caps(chan, &dma_caps); ret = dma_get_slave_caps(chan, &dma_caps);
if (ret != 0) if (ret != 0) {
return true; dev_warn(dev, "Failed to get DMA channel capabilities, falling back to period counting: %d\n",
ret);
return false;
}
if (dma_caps.residue_granularity == DMA_RESIDUE_GRANULARITY_DESCRIPTOR) if (dma_caps.residue_granularity == DMA_RESIDUE_GRANULARITY_DESCRIPTOR)
return false; return false;
...@@ -289,14 +299,7 @@ static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd) ...@@ -289,14 +299,7 @@ static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd)
if (ret) if (ret)
return ret; return ret;
/* if (!dmaengine_pcm_can_report_residue(dev, pcm->chan[i]))
* This will only return false if we know for sure that at least
* one channel does not support residue reporting. If the DMA
* driver does not implement the slave_caps API we rely having
* the NO_RESIDUE flag set manually in case residue reporting is
* not supported.
*/
if (!dmaengine_pcm_can_report_residue(pcm->chan[i]))
pcm->flags |= SND_DMAENGINE_PCM_FLAG_NO_RESIDUE; pcm->flags |= SND_DMAENGINE_PCM_FLAG_NO_RESIDUE;
} }
......
...@@ -147,7 +147,6 @@ int ux500_pcm_register_platform(struct platform_device *pdev) ...@@ -147,7 +147,6 @@ int ux500_pcm_register_platform(struct platform_device *pdev)
pcm_config = &ux500_dmaengine_pcm_config; pcm_config = &ux500_dmaengine_pcm_config;
ret = snd_dmaengine_pcm_register(&pdev->dev, pcm_config, ret = snd_dmaengine_pcm_register(&pdev->dev, pcm_config,
SND_DMAENGINE_PCM_FLAG_NO_RESIDUE |
SND_DMAENGINE_PCM_FLAG_COMPAT); SND_DMAENGINE_PCM_FLAG_COMPAT);
if (ret < 0) { if (ret < 0) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment