From 178132f541482b238bbd937132c38fa0e7e2a5c9 Mon Sep 17 00:00:00 2001 From: Seppo Ingalsuo Date: Tue, 28 May 2019 09:40:03 +0300 Subject: [PATCH 1/2] Topology: Add support for 4ch 32bit 48kHz DMIC DAI This patch restores the missing configuration into macro intel-generic-dmic.m4. Without this patch the 48 kHz DMIC DAI is not created. Both DMIC FIFOs are available at any channels number and PCM format so there is no need to delete a DAI when 4ch configuration is used. Signed-off-by: Seppo Ingalsuo --- .../platform/intel/intel-generic-dmic.m4 | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/tools/topology/platform/intel/intel-generic-dmic.m4 b/tools/topology/platform/intel/intel-generic-dmic.m4 index 65ea82d4e322..4c2121a23061 100644 --- a/tools/topology/platform/intel/intel-generic-dmic.m4 +++ b/tools/topology/platform/intel/intel-generic-dmic.m4 @@ -18,10 +18,9 @@ dnl frames, deadline, priority, core) # Passthrough capture pipeline using max channels defined by CHANNELS. # Schedule 48 frames per 1000us deadline on core 0 with priority 0 -ifelse(CHANNELS, 4, `', -`PIPELINE_PCM_ADD(sof/pipe-volume-capture.m4, +PIPELINE_PCM_ADD(sof/pipe-volume-capture.m4, DMIC_PIPELINE_48k_ID, DMIC_DAI_LINK_48k_ID, CHANNELS, s32le, - 48, 1000, 0, 0)') + 48, 1000, 0, 0) # Passthrough capture pipeline using max channels defined by CHANNELS. # Schedule 48 frames per 1000us deadline on core 0 with priority 0 @@ -40,11 +39,10 @@ dnl frames, deadline, priority, core) # capture DAI is DMIC 0 using 2 periods # Buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0 -ifelse(CHANNELS, 4, `', -`DAI_ADD(sof/pipe-dai-capture.m4, +DAI_ADD(sof/pipe-dai-capture.m4, DMIC_PIPELINE_48k_ID, DMIC, 0, dmic01, concat(`PIPELINE_SINK_', DMIC_PIPELINE_48k_ID), 2, s32le, - 48, 1000, 0, 0)') + 48, 1000, 0, 0) # capture DAI is DMIC 1 using 2 periods # Buffers use s16le format, with 48 frame per 1000us on core 0 with priority 0 @@ -56,8 +54,7 @@ DAI_ADD(sof/pipe-dai-capture.m4, dnl PCM_DUPLEX_ADD(name, pcm_id, playback, capture) dnl PCM_CAPTURE_ADD(name, pipeline, capture) -ifelse(CHANNELS, 4, `', -`PCM_CAPTURE_ADD(DMIC32, DMIC_DAI_LINK_48k_ID, concat(`PIPELINE_PCM_', DMIC_PIPELINE_48k_ID))') +PCM_CAPTURE_ADD(DMIC32, DMIC_DAI_LINK_48k_ID, concat(`PIPELINE_PCM_', DMIC_PIPELINE_48k_ID)) PCM_CAPTURE_ADD(DMIC16, DMIC_DAI_LINK_16k_ID, concat(`PIPELINE_PCM_', DMIC_PIPELINE_16k_ID)) # @@ -66,7 +63,11 @@ PCM_CAPTURE_ADD(DMIC16, DMIC_DAI_LINK_16k_ID, concat(`PIPELINE_PCM_', DMIC_PIPEL dnl DAI_CONFIG(type, dai_index, link_id, name, ssp_config/dmic_config) ifelse(CHANNELS, 4, -`', `DAI_CONFIG(DMIC, 0, DMIC_DAI_LINK_48k_ID, dmic01, +`DAI_CONFIG(DMIC, 0, DMIC_DAI_LINK_48k_ID, dmic01, + DMIC_CONFIG(1, 500000, 4800000, 40, 60, 48000, + DMIC_WORD_LENGTH(s32le), DMIC, 0, + PDM_CONFIG(DMIC, 0, FOUR_CH_PDM0_PDM1)))', +`DAI_CONFIG(DMIC, 0, DMIC_DAI_LINK_48k_ID, dmic01, DMIC_CONFIG(1, 500000, 4800000, 40, 60, 48000, DMIC_WORD_LENGTH(s32le), DMIC, 0, PDM_CONFIG(DMIC, 0, STEREO_PDM0)))') From a3c2a7d1b393908bcc0d4dcef7b6ff081567f1b1 Mon Sep 17 00:00:00 2001 From: Seppo Ingalsuo Date: Tue, 28 May 2019 09:47:40 +0300 Subject: [PATCH 2/2] Topology: Change 16kHz DMIC DAI into 32bit mode and make scheduling 1ms This patch changes the secondary DMIC FIFO configuration into 32 bits mode for better quality. Since there is volume component in DMIC capture pipelines the conversion to other PCM formats can happen there. Using volume controller with 32 bit input gives a lot better audio quality when the microphone signal needs amplification. The scheduling of 16 kHz DAI is changed to 1000us. The comment of 1000 us is correct but the parameter 48 is not. With 16 frames the scheduling becomes the desired. This change should also save some RAM due to smaller buffers. Signed-off-by: Seppo Ingalsuo --- .../platform/intel/intel-generic-dmic.m4 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/topology/platform/intel/intel-generic-dmic.m4 b/tools/topology/platform/intel/intel-generic-dmic.m4 index 4c2121a23061..8c718cb9c24a 100644 --- a/tools/topology/platform/intel/intel-generic-dmic.m4 +++ b/tools/topology/platform/intel/intel-generic-dmic.m4 @@ -23,10 +23,10 @@ PIPELINE_PCM_ADD(sof/pipe-volume-capture.m4, 48, 1000, 0, 0) # Passthrough capture pipeline using max channels defined by CHANNELS. -# Schedule 48 frames per 1000us deadline on core 0 with priority 0 +# Schedule 16 frames per 1000us deadline on core 0 with priority 0 PIPELINE_PCM_ADD(sof/pipe-volume-capture-16khz.m4, - DMIC_PIPELINE_16k_ID, DMIC_DAI_LINK_16k_ID, CHANNELS, s16le, - 48, 1000, 0, 0) + DMIC_PIPELINE_16k_ID, DMIC_DAI_LINK_16k_ID, CHANNELS, s32le, + 16, 1000, 0, 0) # # DAIs configuration @@ -45,11 +45,11 @@ DAI_ADD(sof/pipe-dai-capture.m4, 48, 1000, 0, 0) # capture DAI is DMIC 1 using 2 periods -# Buffers use s16le format, with 48 frame per 1000us on core 0 with priority 0 +# Buffers use s32le format, with 16 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-capture.m4, DMIC_PIPELINE_16k_ID, DMIC, 1, dmic16k, - concat(`PIPELINE_SINK_', DMIC_PIPELINE_16k_ID), 2, s16le, - 48, 1000, 0, 0) + concat(`PIPELINE_SINK_', DMIC_PIPELINE_16k_ID), 2, s32le, + 16, 1000, 0, 0) dnl PCM_DUPLEX_ADD(name, pcm_id, playback, capture) @@ -75,9 +75,9 @@ ifelse(CHANNELS, 4, ifelse(CHANNELS, 4, `DAI_CONFIG(DMIC, 1, DMIC_DAI_LINK_16k_ID, dmic16k, DMIC_CONFIG(1, 500000, 4800000, 40, 60, 16000, - DMIC_WORD_LENGTH(s16le), DMIC, 1, + DMIC_WORD_LENGTH(s32le), DMIC, 1, PDM_CONFIG(DMIC, 1, FOUR_CH_PDM0_PDM1)))', `DAI_CONFIG(DMIC, 1, DMIC_DAI_LINK_16k_ID, dmic16k, DMIC_CONFIG(1, 500000, 4800000, 40, 60, 16000, - DMIC_WORD_LENGTH(s16le), DMIC, 1, + DMIC_WORD_LENGTH(s32le), DMIC, 1, PDM_CONFIG(DMIC, 1, STEREO_PDM0)))')