aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/dmaengine_pcm.h5
-rw-r--r--sound/soc/soc-generic-dmaengine-pcm.c23
2 files changed, 27 insertions, 1 deletions
diff --git a/include/sound/dmaengine_pcm.h b/include/sound/dmaengine_pcm.h
index 1a7897ab3572..e7052862d6b2 100644
--- a/include/sound/dmaengine_pcm.h
+++ b/include/sound/dmaengine_pcm.h
@@ -86,6 +86,11 @@ void snd_dmaengine_pcm_set_config_from_dai_data(
86 * makes sense if SND_DMAENGINE_PCM_FLAG_COMPAT is set as well. 86 * makes sense if SND_DMAENGINE_PCM_FLAG_COMPAT is set as well.
87 */ 87 */
88#define SND_DMAENGINE_PCM_FLAG_NO_DT BIT(1) 88#define SND_DMAENGINE_PCM_FLAG_NO_DT BIT(1)
89/*
90 * The platforms dmaengine driver does not support reporting the ammount of
91 * bytes that are still left to transfer.
92 */
93#define SND_DMAENGINE_PCM_FLAG_NO_RESIDUE BIT(2)
89 94
90/** 95/**
91 * struct snd_dmaengine_pcm_config - Configuration data for dmaengine based PCM 96 * struct snd_dmaengine_pcm_config - Configuration data for dmaengine based PCM
diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c
index d6e638056389..ae0c37e66ae0 100644
--- a/sound/soc/soc-generic-dmaengine-pcm.c
+++ b/sound/soc/soc-generic-dmaengine-pcm.c
@@ -193,6 +193,23 @@ static const struct snd_soc_platform_driver dmaengine_pcm_platform = {
193 .probe_order = SND_SOC_COMP_ORDER_LATE, 193 .probe_order = SND_SOC_COMP_ORDER_LATE,
194}; 194};
195 195
196static const struct snd_pcm_ops dmaengine_no_residue_pcm_ops = {
197 .open = dmaengine_pcm_open,
198 .close = snd_dmaengine_pcm_close,
199 .ioctl = snd_pcm_lib_ioctl,
200 .hw_params = dmaengine_pcm_hw_params,
201 .hw_free = snd_pcm_lib_free_pages,
202 .trigger = snd_dmaengine_pcm_trigger,
203 .pointer = snd_dmaengine_pcm_pointer_no_residue,
204};
205
206static const struct snd_soc_platform_driver dmaengine_no_residue_pcm_platform = {
207 .ops = &dmaengine_no_residue_pcm_ops,
208 .pcm_new = dmaengine_pcm_new,
209 .pcm_free = dmaengine_pcm_free,
210 .probe_order = SND_SOC_COMP_ORDER_LATE,
211};
212
196static const char * const dmaengine_pcm_dma_channel_names[] = { 213static const char * const dmaengine_pcm_dma_channel_names[] = {
197 [SNDRV_PCM_STREAM_PLAYBACK] = "tx", 214 [SNDRV_PCM_STREAM_PLAYBACK] = "tx",
198 [SNDRV_PCM_STREAM_CAPTURE] = "rx", 215 [SNDRV_PCM_STREAM_CAPTURE] = "rx",
@@ -226,7 +243,11 @@ int snd_dmaengine_pcm_register(struct device *dev,
226 } 243 }
227 } 244 }
228 245
229 return snd_soc_add_platform(dev, &pcm->platform, 246 if (flags & SND_DMAENGINE_PCM_FLAG_NO_RESIDUE)
247 return snd_soc_add_platform(dev, &pcm->platform,
248 &dmaengine_no_residue_pcm_platform);
249 else
250 return snd_soc_add_platform(dev, &pcm->platform,
230 &dmaengine_pcm_platform); 251 &dmaengine_pcm_platform);
231} 252}
232EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_register); 253EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_register);