From eae2a959206102d96be29f62ebb2c0928ab4a9b8 Mon Sep 17 00:00:00 2001 From: Jerzy Kasenberg Date: Mon, 11 Dec 2023 13:59:44 +0100 Subject: [PATCH] hw/drivers/i2s: Fix sample count for nrfx in i2s buffers For i2s in (microphone) sample_count was never set. It resulted in buffers returned to i2s client with no data. Now capacity is copied to sample_count as it is actual number of samples that were captured. Same fix was applied long time ago to STM32F4 driver. --- hw/drivers/i2s/i2s_nrfx/src/i2s_nrfx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/drivers/i2s/i2s_nrfx/src/i2s_nrfx.c b/hw/drivers/i2s/i2s_nrfx/src/i2s_nrfx.c index 734c01ad99..174cde34e1 100644 --- a/hw/drivers/i2s/i2s_nrfx/src/i2s_nrfx.c +++ b/hw/drivers/i2s/i2s_nrfx/src/i2s_nrfx.c @@ -94,6 +94,7 @@ i2s_nrfx_data_handler(const nrfx_i2s_buffers_t *p_released, uint32_t status) assert(buffer->sample_data == p_released->p_tx_buffer || buffer->sample_data == p_released->p_rx_buffer); i2s_nrfx.nrfx_buffers[0] = i2s_nrfx.nrfx_buffers[1]; i2s_nrfx.nrfx_buffers[1] = NULL; + buffer->sample_count = buffer->capacity; i2s_driver_buffer_put(i2s_nrfx.i2s, buffer); } if (i2s_nrfx.running && i2s_nrfx.nrfx_queued_count < 2) {