From 71f49b160416d927aeb398d1cffd6e60310aec48 Mon Sep 17 00:00:00 2001 From: Seppo Ingalsuo Date: Tue, 11 Feb 2020 14:18:54 +0200 Subject: [PATCH 1/3] Topology: ASRC: Fix mistake with source and sink buffers count This patch fixes the apply of DAI_PERIODS for playback sink and capture source buffers. Also the comments for components instantiating are fixed to order sink, source as they are in the parameters to avoid confusion. Signed-off-by: Seppo Ingalsuo --- tools/topology/sof/pipe-asrc-capture.m4 | 4 ++-- tools/topology/sof/pipe-asrc-playback.m4 | 4 ++-- tools/topology/sof/pipe-asrc-volume-capture.m4 | 6 +++--- tools/topology/sof/pipe-asrc-volume-playback.m4 | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tools/topology/sof/pipe-asrc-capture.m4 b/tools/topology/sof/pipe-asrc-capture.m4 index 54b7c031cb72..2071c8075627 100644 --- a/tools/topology/sof/pipe-asrc-capture.m4 +++ b/tools/topology/sof/pipe-asrc-capture.m4 @@ -33,8 +33,8 @@ LIST(` ', `SOF_TKN_ASRC_RATE_IN "PIPELINE_RATE"' W_DATA(MY_ASRC_CONF, MY_ASRC_TOKENS) -# "ASRC" has x source and 3 sink periods -W_ASRC(0, PIPELINE_FORMAT, DAI_PERIODS, 3, MY_ASRC_CONF) +# "ASRC" has x 3 sink and x source periods +W_ASRC(0, PIPELINE_FORMAT, 3, DAI_PERIODS, MY_ASRC_CONF) # Capture Buffers W_BUFFER(0, COMP_BUFFER_SIZE(3, diff --git a/tools/topology/sof/pipe-asrc-playback.m4 b/tools/topology/sof/pipe-asrc-playback.m4 index f720a7e9e47f..efad075f3f37 100644 --- a/tools/topology/sof/pipe-asrc-playback.m4 +++ b/tools/topology/sof/pipe-asrc-playback.m4 @@ -37,8 +37,8 @@ LIST(` ', `SOF_TKN_ASRC_RATE_OUT "PIPELINE_RATE"' W_DATA(MY_ASRC_CONF, MY_ASRC_TOKENS) -# "ASRC" has 2 source and 2 sink periods -W_ASRC(0, PIPELINE_FORMAT, 2, 2, MY_ASRC_CONF) +# "ASRC" has x sink and 2 source periods +W_ASRC(0, PIPELINE_FORMAT, DAI_PERIODS, 2, MY_ASRC_CONF) # Playback Buffers W_BUFFER(0, COMP_BUFFER_SIZE(2, diff --git a/tools/topology/sof/pipe-asrc-volume-capture.m4 b/tools/topology/sof/pipe-asrc-volume-capture.m4 index 761d709d191b..129cdb182fc6 100644 --- a/tools/topology/sof/pipe-asrc-volume-capture.m4 +++ b/tools/topology/sof/pipe-asrc-volume-capture.m4 @@ -64,11 +64,11 @@ W_DATA(MY_ASRC_CONF, MY_ASRC_TOKENS) # Components # -# "ASRC" has 3 source and 3 sink periods +# "ASRC" has 3 sink and 3 source periods W_ASRC(0, PIPELINE_FORMAT, 3, 3, MY_ASRC_CONF) -# "Volume" has x source and 3 sink periods -W_PGA(0, PIPELINE_FORMAT, DAI_PERIODS, 3, MY_PGA_CONF, +# "Volume" has 3 sink and x source periods +W_PGA(0, PIPELINE_FORMAT, 3, DAI_PERIODS, MY_PGA_CONF, LIST(` ', "PIPELINE_ID Master Capture Volume")) # Capture Buffers diff --git a/tools/topology/sof/pipe-asrc-volume-playback.m4 b/tools/topology/sof/pipe-asrc-volume-playback.m4 index c39baa37ab67..141e7c5ff63a 100644 --- a/tools/topology/sof/pipe-asrc-volume-playback.m4 +++ b/tools/topology/sof/pipe-asrc-volume-playback.m4 @@ -48,7 +48,7 @@ LIST(` ', `SOF_TKN_ASRC_RATE_OUT "PIPELINE_RATE"' ` ', `SOF_TKN_ASRC_OPERATION_MODE "0"')) W_DATA(MY_ASRC_CONF, MY_ASRC_TOKENS) -# "ASRC" has 2 source and 2 sink periods +# "ASRC" has 2 sink and 2 source periods W_ASRC(0, PIPELINE_FORMAT, 2, 2, MY_ASRC_CONF) # @@ -61,8 +61,8 @@ LIST(` ', `SOF_TKN_VOLUME_RAMP_STEP_TYPE "0"' ` ', `SOF_TKN_VOLUME_RAMP_STEP_MS "250"')) W_DATA(MY_PGA_CONF, MY_PGA_TOKENS) -# "Volume" has 2 source and x sink periods -W_PGA(0, PIPELINE_FORMAT, 2, DAI_PERIODS, MY_PGA_CONF, +# "Volume" has x sink and 2 source periods +W_PGA(0, PIPELINE_FORMAT, DAI_PERIODS, 2, MY_PGA_CONF, LIST(` ', "PIPELINE_ID Master Playback Volume")) # Playback Buffers From dccce1fee779d49910cbf0b1ce91c055c7ec3bb0 Mon Sep 17 00:00:00 2001 From: Seppo Ingalsuo Date: Tue, 11 Feb 2020 14:23:35 +0200 Subject: [PATCH 2/3] Topology: Add capture pipelines to APL ASRC PCM512x demo topology Since the new sof pcm512x machine driver supports the DMIC backend it's practical to move the ASRC capture pipelines into this topology to avoid need to change into nocodec mode for ASRC capture tests. Signed-off-by: Seppo Ingalsuo --- tools/topology/sof-apl-asrc-pcm512x.m4 | 46 +++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/tools/topology/sof-apl-asrc-pcm512x.m4 b/tools/topology/sof-apl-asrc-pcm512x.m4 index a4e4cad4e234..08c055312099 100644 --- a/tools/topology/sof-apl-asrc-pcm512x.m4 +++ b/tools/topology/sof-apl-asrc-pcm512x.m4 @@ -16,6 +16,7 @@ include(`sof/tokens.m4') # Include Apollolake DSP configuration include(`platform/intel/bxt.m4') +include(`platform/intel/dmic.m4') DEBUG_START @@ -23,7 +24,8 @@ DEBUG_START # Define the pipelines # # PCM0 --> ASRC --> Volume --> SSP5 (pcm512x) -# +# PCM5 <-- ASRC <-- Volume <-- DMIC0 (DMIC) +# PCM6 <-- ASRC <-- Volume <-- DMIC1 (DMIC16kHz) dnl PIPELINE_PCM_ADD(pipeline, dnl pipe id, pcm, max channels, format, @@ -38,6 +40,20 @@ PIPELINE_PCM_ADD(sof/pipe-asrc-volume-playback.m4, 1000, 0, 0, 8000, 192000, 48000) +# DMIC capture pipeline 2 on PCM 5 using max 2 channels. +# 1000us deadline on core 0 with priority 0 +PIPELINE_PCM_ADD(sof/pipe-asrc-volume-capture.m4, + 2, 5, 2, s32le, + 1000, 0, 0, + 8000, 192000, 48000) + +# DMIC16kHz capture pipeline 2 on PCM 6 using max 2 channels. +# 1000us deadline on core 0 with priority 0 +PIPELINE_PCM_ADD(sof/pipe-asrc-volume-capture.m4, + 3, 6, 2, s32le, + 1000, 0, 0, + 8000, 192000, 16000) + # # DAIs configuration # @@ -54,9 +70,25 @@ DAI_ADD(sof/pipe-dai-playback.m4, PIPELINE_SOURCE_1, 2, s24le, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) +# capture DAI is DMIC using 2 periods +# Buffers use s32le format, 1000us deadline on core 0 with priority 0 +DAI_ADD(sof/pipe-dai-capture.m4, + 2, DMIC, 0, dmic01, + PIPELINE_SINK_2, 2, s32le, + 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) + +# capture DAI is DMIC16kHz using 2 periods +# Buffers use s16le format, 1000us deadline on core 0 with priority 0 +DAI_ADD(sof/pipe-dai-capture.m4, + 3, DMIC, 1, dmic16k, + PIPELINE_SINK_3, 2, s32le, + 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) + # PCM, id 0 dnl PCM_PLAYBACK_ADD(name, pcm_id, playback) PCM_PLAYBACK_ADD(Port5, 0, PIPELINE_PCM_1) +PCM_CAPTURE_ADD(DMIC, 5, PIPELINE_PCM_2) +PCM_CAPTURE_ADD(DMIC16kHz, 6, PIPELINE_PCM_3) # # BE configurations - overrides config in ACPI if present @@ -70,4 +102,16 @@ DAI_CONFIG(SSP, 5, 0, SSP5-Codec, SSP_TDM(2, 32, 3, 3), SSP_CONFIG_DATA(SSP, 5, 24))) +# DMIC (ID: 1) +DAI_CONFIG(DMIC, 0, 1, dmic01, + DMIC_CONFIG(1, 500000, 4800000, 40, 60, 48000, + DMIC_WORD_LENGTH(s32le), 400, DMIC, 0, + PDM_CONFIG(DMIC, 0, STEREO_PDM0))) + +# DMIC16kHz (ID: 2) +DAI_CONFIG(DMIC, 1, 2, dmic16k, + DMIC_CONFIG(1, 500000, 4800000, 40, 60, 16000, + DMIC_WORD_LENGTH(s32le), 400, DMIC, 1, + PDM_CONFIG(DMIC, 1, STEREO_PDM0))) + DEBUG_END From 0f302e4269aa1407cdc857f2ca6a5e11c97b7076 Mon Sep 17 00:00:00 2001 From: Seppo Ingalsuo Date: Tue, 11 Feb 2020 14:29:01 +0200 Subject: [PATCH 3/3] Topology: Remove ASRC DMIC capture demo topology The DMIC capture is added to APL ASRC PCM512x topology so this topology can be removed. Signed-off-by: Seppo Ingalsuo --- tools/topology/CMakeLists.txt | 1 - tools/topology/sof-apl-asrc-dmic.m4 | 103 ---------------------------- 2 files changed, 104 deletions(-) delete mode 100644 tools/topology/sof-apl-asrc-dmic.m4 diff --git a/tools/topology/CMakeLists.txt b/tools/topology/CMakeLists.txt index a2cb9b3946e7..e854a7d35229 100644 --- a/tools/topology/CMakeLists.txt +++ b/tools/topology/CMakeLists.txt @@ -73,7 +73,6 @@ set(TPLGS "sof-apl-eq-pcm512x\;sof-apl-eq-pcm512x" "sof-apl-eq-dmic\;sof-apl-eq-dmic" "sof-apl-src-dmic\;sof-apl-src-dmic" - "sof-apl-asrc-dmic\;sof-apl-asrc-dmic" "sof-apl-dmic-a2ch\;sof-apl-dmic-a2ch" "sof-apl-dmic-b2ch\;sof-apl-dmic-b2ch" "sof-apl-dmic-a2ch-b2ch\;sof-apl-dmic-a2ch-b2ch" diff --git a/tools/topology/sof-apl-asrc-dmic.m4 b/tools/topology/sof-apl-asrc-dmic.m4 deleted file mode 100644 index a19003e79890..000000000000 --- a/tools/topology/sof-apl-asrc-dmic.m4 +++ /dev/null @@ -1,103 +0,0 @@ -# -# Topology for APL for testing ASRC with DMIC -# - -# Capture configuration -# DAI0 2ch 32b mic1-2 -# DAI1 2ch 32b mic1-2 - -# Include topology builder -include(`utils.m4') -include(`dai.m4') -include(`pipeline.m4') - -# Include TLV library -include(`common/tlv.m4') - -# Include Token library -include(`sof/tokens.m4') - -# Include Apollolake DSP configuration -include(`platform/intel/bxt.m4') -include(`platform/intel/dmic.m4') - -DEBUG_START - -# -# Define the pipelines -# -# PCM6 <--- ASRC <--- Volume <--- DMIC6 (DMIC01) -# PCM7 <--- ASRC <--- Volume <--- DMIC7 (DMIC16k) -# - -dnl PIPELINE_PCM_DAI_ADD(pipeline, -dnl pipe id, pcm, max channels, format, -dnl period, priority, core, -dnl pcm_min_rate, pcm_max_rate, pipeline_rate, -dnl time_domain, sched_comp) - -# ASRC capture pipeline 6 on PCM 6 using max channels 2. -# Set 1000us deadline on core 0 with priority 0 -PIPELINE_PCM_ADD(sof/pipe-asrc-volume-capture.m4, - 6, 6, 2, s32le, - 1000, 0, 0, - 8000, 192000, 48000) - -# ASRC capture pipeline 7 on PCM 7 using max channels 2. -# Set 1000us deadline on core 0 with priority 0 -PIPELINE_PCM_ADD(sof/pipe-asrc-volume-capture.m4, - 7, 7, 2, s32le, - 1000, 0, 0, - 8000, 192000, 16000) - -# -# DAIs configuration -# - -dnl DAI_ADD(pipeline, -dnl pipe id, dai type, dai_index, dai_be, -dnl buffer, periods, format, -dnl deadline, priority, core, time_domain) - -# capture DAI is DMIC 0 using 3 periods -# Buffers use s32le format, 1000us deadline on core 0 with priority 0 -DAI_ADD(sof/pipe-dai-capture.m4, - 6, DMIC, 0, NoCodec-6, - PIPELINE_SINK_6, 3, s32le, - 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) - -# capture DAI is DMIC 1 using 3 periods -# Buffers use s32le format, 1000us deadline on core 0 with priority 0 -DAI_ADD(sof/pipe-dai-capture.m4, - 7, DMIC, 1, NoCodec-7, - PIPELINE_SINK_7, 3, s32le, - 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) - -dnl PCM_DUPLEX_ADD(name, pcm_id, playback, capture) -dnl PCM_CAPTURE_ADD(name, pipeline, capture) -PCM_CAPTURE_ADD(DMIC, 6, PIPELINE_PCM_6) -PCM_CAPTURE_ADD(DMIC16kHz, 7, PIPELINE_PCM_7) - -# -# BE configurations - overrides config in ACPI if present -# - -dnl DAI_CONFIG(type, dai_index, link_id, name, ssp_config/dmic_config) - -DAI_CONFIG(DMIC, 0, 6, NoCodec-6, - dnl DMIC_CONFIG(driver_version, clk_min, clk_mac, duty_min, duty_max, - dnl sample_rate, fifo word length, unmute time, type, - dnl dai_index, pdm controller config) - DMIC_CONFIG(1, 500000, 4800000, 40, 60, 48000, - DMIC_WORD_LENGTH(s32le), 400, DMIC, 0, - PDM_CONFIG(DMIC, 0, STEREO_PDM0))) - -DAI_CONFIG(DMIC, 1, 7, NoCodec-7, - dnl DMIC_CONFIG(driver_version, clk_min, clk_mac, duty_min, duty_max, - dnl sample_rate, fifo word length, unmute time, type, - dnl dai_index, pdm controller config) - DMIC_CONFIG(1, 500000, 4800000, 40, 60, 16000, - DMIC_WORD_LENGTH(s32le), 400, DMIC, 1, - PDM_CONFIG(DMIC, 1, STEREO_PDM0))) - -DEBUG_END