From 2615914122cdcc353557fc15c2f7e65d8e82c0a4 Mon Sep 17 00:00:00 2001 From: Janusz Jankowski Date: Fri, 16 Nov 2018 14:49:00 +0100 Subject: [PATCH] dai: dmic: fix 16 bit capture Signed-off-by: Janusz Jankowski --- src/audio/dai.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/audio/dai.c b/src/audio/dai.c index 733ec2879..c5c1b3277 100644 --- a/src/audio/dai.c +++ b/src/audio/dai.c @@ -319,12 +319,23 @@ static int dai_capture_params(struct comp_dev *dev) /* set up DMA configuration */ config->direction = DMA_DIR_DEV_TO_MEM; - config->src_width = comp_sample_bytes(dev); - config->dest_width = comp_sample_bytes(dev); config->cyclic = 1; config->timer_delay = dev->pipeline->ipc_pipe.timer_delay; config->src_dev = dd->dai->plat_data.fifo[1].handshake; + /* TODO: Make this code platform-specific or move it driver callback */ + if (dd->dai->type == SOF_DAI_INTEL_DMIC) { + /* For DMIC the DMA src and dest widths should always be 4 bytes + * due to 32 bit FIFO packer. Setting width to 2 bytes for + * 16 bit format would result in recording at double rate. + */ + config->src_width = 4; + config->dest_width = 4; + } else { + config->src_width = comp_sample_bytes(dev); + config->dest_width = comp_sample_bytes(dev); + } + /* set up local and host DMA elems to reset values */ dma_buffer = list_first_item(&dev->bsink_list, struct comp_buffer, source_list);