Skip to content

Commit 67d7e24

Browse files
author
Codrin Ciubotariu
committed
ALSA: dmaengine_pcm: add workaround for MCHP-PDMC
Add workaround to clear PDMC's channel index when used as BE with ASRC. Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
1 parent e1cdc13 commit 67d7e24

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

sound/core/pcm_dmaengine.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,20 @@ static void dmaengine_pcm_dma_complete(void *arg)
135135
struct snd_pcm_substream *substream = arg;
136136
struct dmaengine_pcm_runtime_data *prtd = substream_to_prtd(substream);
137137

138+
/*
139+
* workaround to clear mchp-pdmc's channel index when used as BE with
140+
* mchp-asrc
141+
*/
142+
if (substream->pcm->internal &&
143+
!strncmp(prtd->dma_chan->slave->driver->name, "mchp-pdmc", sizeof("mchp-pdmc"))) {
144+
unsigned int sample_size = samples_to_bytes(substream->runtime, 1);
145+
u8 *dma_ptr = substream->runtime->dma_area + prtd->pos;
146+
u8 *dma_ptr_end = dma_ptr + snd_pcm_lib_period_bytes(substream);
147+
148+
for (; dma_ptr < dma_ptr_end; dma_ptr += sample_size)
149+
*dma_ptr = 0;
150+
}
151+
138152
prtd->pos += snd_pcm_lib_period_bytes(substream);
139153
if (prtd->pos >= snd_pcm_lib_buffer_bytes(substream))
140154
prtd->pos = 0;

0 commit comments

Comments
 (0)