From 3c2f5c67534f8774442b23478ff9e09e4122b86d Mon Sep 17 00:00:00 2001 From: Eddy Hsu Date: Wed, 23 Oct 2024 20:35:28 +0000 Subject: [PATCH] Add topology1 for CTC. Add topology1 for CTC component. Signed-off-by: Eddy Hsu --- .../m4/google_ctc_audio_processing.m4 | 65 +++++++++++++ .../topology1/sof/pipe-ctc-playback.m4 | 93 +++++++++++++++++++ 2 files changed, 158 insertions(+) create mode 100644 tools/topology/topology1/m4/google_ctc_audio_processing.m4 create mode 100644 tools/topology/topology1/sof/pipe-ctc-playback.m4 diff --git a/tools/topology/topology1/m4/google_ctc_audio_processing.m4 b/tools/topology/topology1/m4/google_ctc_audio_processing.m4 new file mode 100644 index 000000000000..ea5f383ea590 --- /dev/null +++ b/tools/topology/topology1/m4/google_ctc_audio_processing.m4 @@ -0,0 +1,65 @@ +divert(-1) + +dnl Define macro for CTC Processing effect widget +DECLARE_SOF_RT_UUID("google-ctc-audio-processing", google_ctc_audio_processing_uuid, +0xbf0e1bbc, 0xdc6a, 0x45fe, 0xbc, 0x90, 0x25, 0x54, 0xcb, 0x13, 0x7a, 0xb4) + +dnl N_GOOGLE_CTC_AUDIO_PROCESSING(name) +define(`N_GOOGLE_CTC_AUDIO_PROCESSING', `GOOGLE_CTC_AUDIO_PROCESSING'PIPELINE_ID`.'$1) + +dnl W_GOOGLE_CTC_AUDIO_PROCESSING(name, format, periods_sink, periods_source, core, kcontrols_list) +define(`W_GOOGLE_CTC_AUDIO_PROCESSING', +`SectionVendorTuples."'N_GOOGLE_CTC_AUDIO_PROCESSING($1)`_tuples_uuid" {' +` tokens "sof_comp_tokens"' +` tuples."uuid" {' +` SOF_TKN_COMP_UUID' STR(google_ctc_audio_processing_uuid) +` }' +`}' +`SectionData."'N_GOOGLE_CTC_AUDIO_PROCESSING($1)`_data_uuid" {' +` tuples "'N_GOOGLE_CTC_AUDIO_PROCESSING($1)`_tuples_uuid"' +`}' +`SectionVendorTuples."'N_GOOGLE_CTC_AUDIO_PROCESSING($1)`_tuples_w" {' +` tokens "sof_comp_tokens"' +` tuples."word" {' +` SOF_TKN_COMP_PERIOD_SINK_COUNT' STR($3) +` SOF_TKN_COMP_PERIOD_SOURCE_COUNT' STR($4) +` SOF_TKN_COMP_CORE_ID' STR($5) +` }' +`}' +`SectionData."'N_GOOGLE_CTC_AUDIO_PROCESSING($1)`_data_w" {' +` tuples "'N_GOOGLE_CTC_AUDIO_PROCESSING($1)`_tuples_w"' +`}' +`SectionVendorTuples."'N_GOOGLE_CTC_AUDIO_PROCESSING($1)`_tuples_str" {' +` tokens "sof_comp_tokens"' +` tuples."string" {' +` SOF_TKN_COMP_FORMAT' STR($2) +` }' +`}' +`SectionData."'N_GOOGLE_CTC_AUDIO_PROCESSING($1)`_data_str" {' +` tuples "'N_GOOGLE_CTC_AUDIO_PROCESSING($1)`_tuples_str"' +`}' +`SectionVendorTuples."'N_GOOGLE_CTC_AUDIO_PROCESSING($1)`_tuples_str_type" {' +` tokens "sof_process_tokens"' +` tuples."string" {' +` SOF_TKN_PROCESS_TYPE' "GCTCP" +` }' +`}' +`SectionData."'N_GOOGLE_CTC_AUDIO_PROCESSING($1)`_data_str_type" {' +` tuples "'N_GOOGLE_CTC_AUDIO_PROCESSING($1)`_tuples_str_type"' +`}' +`SectionWidget."'N_GOOGLE_CTC_AUDIO_PROCESSING($1)`" {' +` index "'PIPELINE_ID`"' +` type "effect"' +` no_pm "true"' +` data [' +` "'N_GOOGLE_CTC_AUDIO_PROCESSING($1)`_data_uuid"' +` "'N_GOOGLE_CTC_AUDIO_PROCESSING($1)`_data_w"' +` "'N_GOOGLE_CTC_AUDIO_PROCESSING($1)`_data_str"' +` "'N_GOOGLE_CTC_AUDIO_PROCESSING($1)`_data_str_type"' +` ]' +` bytes [' + $6 +` ]' +`}') + +divert(0)dnl diff --git a/tools/topology/topology1/sof/pipe-ctc-playback.m4 b/tools/topology/topology1/sof/pipe-ctc-playback.m4 new file mode 100644 index 000000000000..cf81080da084 --- /dev/null +++ b/tools/topology/topology1/sof/pipe-ctc-playback.m4 @@ -0,0 +1,93 @@ +# CTC Pipeline and PCM +# +# Pipeline Endpoints for connection are :- +# +# host PCM_P --> B0 --> CTC --> B1 --> sink DAI0 + +# Include topology builder +include(`utils.m4') +include(`buffer.m4') +include(`pcm.m4') +include(`dai.m4') +include(`pipeline.m4') +include(`bytecontrol.m4') + +include(`google_ctc_audio_processing.m4') + +# +# Controls +# + +define(DEF_CTC_PRIV, concat(`ctc_priv_', PIPELINE_ID)) +define(DEF_CTC_BYTES, concat(`ctc_bytes_', PIPELINE_ID)) + +CONTROLBYTES_PRIV(DEF_CTC_PRIV, +` bytes "0x53,0x4f,0x46,0x34,0x00,0x00,0x00,0x00,' +` 0x18,0x10,0x00,0x00,0x00,0xD0,0x01,0x03,' +` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,' +` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,' +` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,' +` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,' +` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,' +` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00"' +) + +# CTC Bytes control +C_CONTROLBYTES(DEF_CTC_BYTES, PIPELINE_ID, + CONTROLBYTES_OPS(bytes, + 258 binds the mixer control to bytes get/put handlers, + 258, 258), + CONTROLBYTES_EXTOPS(258 binds the mixer control to bytes get/put handlers, + 258, 258), + , , , + CONTROLBYTES_MAX(void, 4124), + , + DEF_CTC_PRIV) + +# +# Components and Buffers +# + +ifdef(`CA_SCHEDULE_CORE',`', `define(`CA_SCHEDULE_CORE', `SCHEDULE_CORE')') + +# Host "Playback with codec adapter" PCM +# with DAI_PERIODS sink and 0 source periods +W_PCM_PLAYBACK(PCM_ID, Passthrough Playback, DAI_PERIODS, 0, SCHEDULE_CORE) + +W_GOOGLE_CTC_AUDIO_PROCESSING(0, PIPELINE_FORMAT, 2, 2, SCHEDULE_CORE, + LIST(` ', "DEF_CTC_BYTES")) + +# Playback Buffers +W_BUFFER(0, COMP_BUFFER_SIZE(2, + COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)), + PLATFORM_HOST_MEM_CAP) +W_BUFFER(1, COMP_BUFFER_SIZE(DAI_PERIODS, + COMP_SAMPLE_SIZE(DAI_FORMAT), PIPELINE_CHANNELS, COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)), + PLATFORM_DAI_MEM_CAP) + +# +# Pipeline Graph +# +# host PCM_P --> B0 --> CTC -> B1 --> sink DAI0 + +P_GRAPH(pipe-ctc-playback-PIPELINE_ID, PIPELINE_ID, + LIST(` ', + `dapm(N_BUFFER(0), N_PCMP(PCM_ID))', + `dapm(N_GOOGLE_CTC_AUDIO_PROCESSING(0), N_BUFFER(0))', + `dapm(N_BUFFER(1), N_GOOGLE_CTC_AUDIO_PROCESSING(0))')) + +# +# Pipeline Source and Sinks +# +indir(`define', concat(`PIPELINE_SOURCE_', PIPELINE_ID), N_BUFFER(2)) +indir(`define', concat(`PIPELINE_PCM_', PIPELINE_ID), CTC Playback PCM_ID) + +# +# PCM Configuration +# + +PCM_CAPABILITIES(CTC Playback PCM_ID, CAPABILITY_FORMAT_NAME(PIPELINE_FORMAT), PCM_MIN_RATE, PCM_MAX_RATE, 2, PIPELINE_CHANNELS, 2, 16, 192, 16384, 65536, 65536) + +undefine(`CA_SCHEDULE_CORE') +undefine(`DEF_CTC_PRIV') +undefine(`DEF_CTC_BYTES')