Add pipeline and token definitions to allow creation of SOF topology files. The files define standard pipelines and tokens that can be reused to build machine specific topology files.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- topology/sof/pipe-dai.m4 | 24 +++++ topology/sof/pipe-low-latency-capture.m4 | 107 +++++++++++++++++++ topology/sof/pipe-low-latency-playback.m4 | 167 ++++++++++++++++++++++++++++++ topology/sof/pipe-pcm-media.m4 | 136 ++++++++++++++++++++++++ topology/sof/pipe-tone.m4 | 75 ++++++++++++++ topology/sof/tokens.m4 | 38 +++++++ 6 files changed, 547 insertions(+) create mode 100644 topology/sof/pipe-dai.m4 create mode 100644 topology/sof/pipe-low-latency-capture.m4 create mode 100644 topology/sof/pipe-low-latency-playback.m4 create mode 100644 topology/sof/pipe-pcm-media.m4 create mode 100644 topology/sof/pipe-tone.m4 create mode 100644 topology/sof/tokens.m4
diff --git a/topology/sof/pipe-dai.m4 b/topology/sof/pipe-dai.m4 new file mode 100644 index 0000000..06ac453 --- /dev/null +++ b/topology/sof/pipe-dai.m4 @@ -0,0 +1,24 @@ +# DAI connector + +# Include topology builder +include(`local.m4') + +# +# DAI definitions +# +W_DAI_OUT(DAI_SNAME, dai0p_plat_conf) +W_DAI_IN(DAI_SNAME, dai0c_plat_conf) + +#D_DAI(0, 1, 1) + +# +# Graph connections to pipelines + +SectionGraph.STR(DAI_NAME) { + index "0" + + lines [ + dapm(N_DAI_IN, OUT_BUF) + dapm(IN_BUF, N_DAI_OUT) + ] +} diff --git a/topology/sof/pipe-low-latency-capture.m4 b/topology/sof/pipe-low-latency-capture.m4 new file mode 100644 index 0000000..ddb5d8e --- /dev/null +++ b/topology/sof/pipe-low-latency-capture.m4 @@ -0,0 +1,107 @@ +# Low Latency Pipeline and PCM +# +# Pipeline Endpoints for connection are :- +# +# host PCM_C <--B5-- volume(0C) <--B4-- source DAI0 + +# Include topology builder +include(`local.m4') + +# +# Controls +# + +SectionControlMixer.STR(PCM PCM_ID Capture Volume) { + + # control belongs to this index group + index STR(PIPELINE_ID) + + # Channel register and shift for Front Left/Right + channel."FL" { + reg "0" + shift "0" + } + channel."FR" { + reg "0" + shift "1" + } + + # control uses bespoke driver get/put/info ID 0 + ops."ctl" { + info "volsw" + get "256" + put "256" + } + + # TLV 40 steps from -90dB to +20dB for 3dB + max "40" + invert "false" + tlv "vtlv_m90s3" +} + +# +# Components and Buffers +# + +W_PCM_CAPTURE(Low Latency Capture) +W_PGA(Capture Volume) +W_BUFFER(0, BUF_INT_SIZE) +W_BUFFER(1, BUF_PCM_SIZE) + +# +# Pipeline Graph +# +# host PCM <--B1-- volume( <--B0-- source DAI0 + +SectionGraph."pipe-ll-capture-PIPELINE_ID" { + index STR(PIPELINE_ID) + + lines [ + dapm(N_PCM, N_BUFFER(1)) + dapm(N_BUFFER(1), N_PGA(Capture Volume)) + dapm(N_PGA(Capture Volume), N_BUFFER(0)) + ] +} + +# +# Pipeline Configuration. +# + +W_PIPELINE(N_PGA(Capture Volume), SCHEDULE_DEADLINE, pipe_ll_schedule_plat) + +# +# PCM Configuration +# + +SectionPCMCapabilities.STR(Low Latency Capture PCM_ID) { + + formats "S24_LE,S16_LE" + rate_min "48000" + rate_max "48000" + channels_min "2" + channels_max "4" + periods_min "2" + periods_max "4" + period_size_min "192" + period_size_max "16384" + buffer_size_min "384" + buffer_size_max "65536" +} + +# PCM Low Latency Capture +SectionPCM.STR(PCM PCM_ID) { + + index STR(PIPELINE_ID) + + # used for binding to the PCM + id STR(PCM_ID) + + dai.STR(Low Latency Capture PCM_ID) { + id STR(PCM_ID) + } + + pcm."capture" { + + capabilities STR(Low Latency Capture PCM_ID) + } +} diff --git a/topology/sof/pipe-low-latency-playback.m4 b/topology/sof/pipe-low-latency-playback.m4 new file mode 100644 index 0000000..6604ad1 --- /dev/null +++ b/topology/sof/pipe-low-latency-playback.m4 @@ -0,0 +1,167 @@ +# Low Latency Pipeline +# +# Low Latency Playback PCM mixed into single sink pipe. +# Low latency Capture PCM. +# +# Pipeline Endpoints for connection are :- +# +# LL Playback Mixer (Mixer) +# LL Capture Volume B4 (DAI buffer) +# LL Playback Volume B3 (DAI buffer) +# +# +# host PCM_P --B0--> volume(0P) --B1--+ +# |--ll mixer(M) --B2--> volume(LL) ---B3--> sink DAI0 +# pipeline n+1 >---+ +# | +# pipeline n+2 >---+ +# | +# pipeline n+3 >---+ .....etc....more pipes can be mixed here +# + +# Include topology builder +include(`local.m4') + +# +# Controls +# + +SectionControlMixer.STR(PCM PCM_ID Playback Volume) { + + # control belongs to this index group + index STR(PIPELINE_ID) + + # Channel register and shift for Front Left/Right + channel."FL" { + reg "0" + shift "0" + } + channel."FR" { + reg "0" + shift "1" + } + + # control uses bespoke driver get/put/info ID 0 + ops."ctl" { + info "volsw" + get "256" + put "256" + } + + # TLV 32 steps from -90dB to +6dB for 3dB + max "32" + invert "false" + tlv "vtlv_m90s3" +} + +SectionControlMixer.STR(Master Playback Volume) { + + # control belongs to this index group + index STR(PIPELINE_ID) + + # Channel register and shift for Front Left/Right + channel."FL" { + reg "1" + shift "0" + } + channel."FR" { + reg "1" + shift "1" + } + + # control uses bespoke driver get/put/info ID 0 + ops."ctl" { + info "volsw" + get "256" + put "256" + } + + # TLV 32 steps from -90dB to +6dB for 3dB + max "32" + invert "false" + tlv "vtlv_m90s3" +} + +# +# Components and Buffers +# + +W_PCM_PLAYBACK(Low Latency Playback) +W_PGA(Playback Volume) +W_PGA(Mixer Volume) +W_MIXER(0) +W_BUFFER(0, BUF_PCM_SIZE) +W_BUFFER(1, BUF_INT_SIZE) +W_BUFFER(2, BUF_INT_SIZE) +W_BUFFER(3, BUF_INT_SIZE) + +# +# Pipeline Graph +# +# host PCM_P --B0--> volume(0P) --B1--+ +# |--ll mixer(M) --B2--> volume(LL) ---B3--> sink DAI0 +# pipeline n+1 >---+ +# | +# pipeline n+2 >---+ +# | +# pipeline n+3 >---+ .....etc....more pipes can be mixed here +# + +SectionGraph."pipe-ll-playback-PIPELINE_ID" { + index STR(PIPELINE_ID) + + lines [ + dapm(N_BUFFER(0), N_PCM) + dapm(N_PGA(Playback Volume), N_BUFFER(0)) + dapm(N_BUFFER(1), N_PGA(Playback Volume)) + dapm(N_MIXER(0), N_BUFFER(1)) + dapm(N_BUFFER(2), N_MIXER(0)) + dapm(N_PGA(Mixer Volume), N_BUFFER(2)) + dapm(N_BUFFER(3), N_PGA(Mixer Volume)) + ] +} + +# +# Pipeline Configuration. +# + +W_PIPELINE(N_PGA(Mixer Volume), SCHEDULE_DEADLINE, pipe_ll_schedule_plat) + +# +# PCM Configuration +# + +# PCM capabilities supported by FW +SectionPCMCapabilities.STR(Low Latency Playback PCM_ID) { + + formats "S24_LE,S16_LE" + rate_min "48000" + rate_max "48000" + channels_min "2" + channels_max "2" + periods_min "2" + periods_max "4" + period_size_min "192" + period_size_max "16384" + buffer_size_min "384" + buffer_size_max "65536" +} + +# PCM Low Latency Playback +SectionPCM.STR(PCM PCM_ID) { + + index STR(PIPELINE_ID) + + # used for binding to the PCM + id STR(PCM_ID) + + dai.STR(Low Latency Playback PCM_ID) { + id STR(PCM_ID) + } + + # Playback and Capture Configuration + pcm."playback" { + + capabilities STR(Low Latency Playback PCM_ID) + } +} diff --git a/topology/sof/pipe-pcm-media.m4 b/topology/sof/pipe-pcm-media.m4 new file mode 100644 index 0000000..688c81f --- /dev/null +++ b/topology/sof/pipe-pcm-media.m4 @@ -0,0 +1,136 @@ +# Low Power PCM Media Pipeline +# +# Low power PCM media playback with SRC and volume. +# +# Pipeline Endpoints for connection are :- +# +# host PCM_P --B0--> volume(0P) --B1--> SRC -- B2 --> Endpoint Pipeline +# + +# Include topology builder +include(`local.m4') + +# +# Controls +# + +SectionControlMixer.STR(PCM PCM_ID Playback Volume) { + + # control belongs to this index group + index STR(PIPELINE_ID) + + # Channel register and shift for Front Left/Right + channel."FL" { + reg "1" + shift "0" + } + channel."FR" { + reg "1" + shift "1" + } + + # control uses bespoke driver get/put/info ID 0 + ops."ctl" { + info "volsw" + get "256" + put "256" + } + + # TLV 32 steps from -90dB to +6dB for 3dB + max "32" + invert "false" + tlv "vtlv_m90s3" +} + + +# +# SRC Configuration +# + +SectionVendorTuples."media_src_tokens" { + tokens "sof_src_tokens" + + tuples."word" { + SOF_TKN_SRC_RATE_IN 16000 + SOF_TKN_SRC_RATE_IN 44100 + SOF_TKN_SRC_RATE_OUT 48000 + } +} + +SectionData."media_src_conf" { + tuples "media_src_tokens" +} + +# +# Components and Buffers +# + +W_PCM_PLAYBACK(Media Playback) +W_PGA(Playback Volume) +W_SRC(0, media_src_conf) +W_BUFFER(0, BUF_PCM_SIZE) +W_BUFFER(1, BUF_INT_SIZE) +W_BUFFER(2, BUF_INT_SIZE) + +# +# Pipeline Graph +# +# PCM --B0--> volume --B1--> SRC --> B2 --> Endpoint Pipeline +# + +SectionGraph."pipe-media-PIPELINE_ID" { + index STR(PIPELINE_ID) + + lines [ + dapm(N_BUFFER(0), Media Playback PCM_ID) + dapm(N_PGA(Playback Volume), N_BUFFER(0)) + dapm(N_BUFFER(1), N_PGA(Playback Volume)) + dapm(N_SRC(0), N_BUFFER(1)) + dapm(N_BUFFER(2), N_SRC(0)) + ] +} + +# +# Pipeline Configuration. +# + +W_PIPELINE(N_SRC(0), SCHEDULE_DEADLINE, pipe_media_schedule_plat) + +# +# PCM Configuration +# + +# PCM capabilities supported by FW + +SectionPCMCapabilities.STR(Media Playback PCM_ID) { + formats "S24_LE,S16_LE" + rate_min "8000" + rate_max "192000" + channels_min "2" + channels_max "2" + periods_min "2" + periods_max "32" + period_size_min "4096" + period_size_max "262144" + buffer_size_min "8192" + buffer_size_max "8388608" +} + +# PCM Low Latency Playback and Capture +SectionPCM.STR(PCM PCM_ID) { + + index STR(PIPELINE_ID) + + # used for binding to the PCM + id STR(PCM_ID) + + dai.STR(Media Playback PCM_ID) { + id STR(PCM_ID) + } + + # Playback and Capture Configuration + pcm."playback" { + + capabilities STR(Media Playback PCM_ID) + } +} diff --git a/topology/sof/pipe-tone.m4 b/topology/sof/pipe-tone.m4 new file mode 100644 index 0000000..24fe10f --- /dev/null +++ b/topology/sof/pipe-tone.m4 @@ -0,0 +1,75 @@ +# Tone Generator +# +# Multi Frequency Tone Generator. +# +# Pipeline Endpoints for connection are :- +# +# Tone --B0--> volume --B1--> Endpoint Pipeline +# + +# Include topology builder +include(`local.m4') + +# +# Controls +# + +SectionControlMixer.STR(Tone Volume PIPELINE_ID) { + + # control belongs to this index group + index STR(PIPELINE_ID) + + # Channel register and shift for Front Left/Right + channel."FL" { + reg "1" + shift "0" + } + channel."FR" { + reg "1" + shift "1" + } + + # control uses bespoke driver get/put/info ID 0 + ops."ctl" { + info "volsw" + get "256" + put "256" + } + + # TLV 32 steps from -90dB to +6dB for 3dB + max "32" + invert "false" + tlv "vtlv_m90s3" +} + +# +# Components and Buffers +# + +W_TONE(0) +W_PGA(Tone Volume) +W_BUFFER(0, BUF_INT_SIZE) +W_BUFFER(1, BUF_INT_SIZE) + + +# +# Pipeline Graph +# +# Tone --B0--> volume --B1--> Endpoint Pipeline +# + +SectionGraph."pipe-tone-PIPELINE_ID" { + index STR(PIPELINE_ID) + + lines [ + dapm(N_BUFFER(0), N_TONE(0)) + dapm(N_PGA(Tone Volume), N_BUFFER(0)) + dapm(N_BUFFER(1), N_PGA(Tone Volume)) + ] +} + +# +# Pipeline Configuration. +# + +W_PIPELINE(N_TONE(0), SCHEDULE_DEADLINE, pipe_tone_schedule_plat) diff --git a/topology/sof/tokens.m4 b/topology/sof/tokens.m4 new file mode 100644 index 0000000..1ec48df --- /dev/null +++ b/topology/sof/tokens.m4 @@ -0,0 +1,38 @@ + +# +# SOF Tokens for differentiation. +# +# Differentiation can be done at the platform and machine level. +# +# Tokens are GUIDs + +# TODO: pre-process this with UAPI headers GNU cpp. + + +SectionVendorTokens."sof_buffer_tokens" { + SOF_TKN_BUF_SIZE "100" + SOF_TKN_BUF_PRELOAD "101" +} + +SectionVendorTokens."sof_dai_tokens" { + SOF_TKN_DAI_DMAC "151" + SOF_TKN_DAI_DMAC_CHAN "152" + SOF_TKN_DAI_DMAC_CONFIG "153" +} + +SectionVendorTokens."sof_sched_tokens" { + SOF_TKN_SCHED_DEADLINE "200" + SOF_TKN_SCHED_PRIORITY "201" + SOF_TKN_SCHED_MIPS "202" + SOF_TKN_SCHED_CORE "203" +} + +SectionVendorTokens."sof_volume_tokens" { + SOF_TKN_VOLUME_RAMP_STEP_TYPE "250" + SOF_TKN_VOLUME_RAMP_STEP_MS "251" +} + +SectionVendorTokens."sof_src_tokens" { + SOF_TKN_SRC_RATE_IN "300" + SOF_TKN_SRC_RATE_OUT "301" +}