-
Notifications
You must be signed in to change notification settings - Fork 349
topology2: introduction to topology2.0 #3211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
|
|
||
| # Array of "input-file-name;output-file-name;" | ||
| # Array of "input-file-name;output-file-name;" | ||
| set(TPLGS | ||
| "sof-cnl-nocodec\;sof-cnl-nocodec\;" | ||
| "cavs-nocodec\;cavs-nocodec\;" | ||
| "sof-hda-generic-4ch\;sof-hda-generic-4ch\;" | ||
| "sof-hda-generic-2ch\;sof-hda-generic-2ch\;" | ||
| "sof-tgl-max98373-rt5682\;sof-tgl-max98373-rt5682\;" | ||
| "sof-tgl-sdw-max98373-rt5682-2ch\;sof-tgl-sdw-max98373-rt5682-2ch\;" | ||
| "sof-tgl-sdw-max98373-rt5682-4ch\;sof-tgl-sdw-max98373-rt5682-4ch\;" | ||
| ) | ||
|
|
||
| add_custom_target(topology2 ALL) | ||
|
|
||
| foreach(tplg ${TPLGS}) | ||
| list(GET tplg 0 input) | ||
| list(GET tplg 1 output) | ||
| # Note: this does NOT use VERBATIM, see explanation in ../topology/CMakeLists.txt | ||
|
|
||
| add_custom_command( | ||
| OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${output}.conf | ||
| COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/get_abi.sh ${SOF_ROOT_SOURCE_DIRECTORY} | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/${input}.conf > ${CMAKE_CURRENT_BINARY_DIR}/${output}.conf | ||
| USES_TERMINAL | ||
| ) | ||
|
|
||
| add_custom_command( | ||
| OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${output}.tplg | ||
| COMMAND alsatplg \$\${VERBOSE:+-v 1} -c ${CMAKE_CURRENT_BINARY_DIR}/${output}.conf -o ${output}.tplg | ||
| DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${output}.conf | ||
| USES_TERMINAL | ||
| ) | ||
|
|
||
| add_custom_target(topology2_${output} DEPENDS ${output}.tplg) | ||
| add_dependencies(topology2 topology2_${output}) | ||
| endforeach() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| # | ||
| # Simple Machine - High level topology - Maps to machine driver. | ||
| # | ||
| # PCM 0 <-> copier.host.N.0 <-> copier.SSP.0.M <-> SSP0 | ||
| # | ||
|
|
||
| <include/common/tokens.conf> | ||
| <include/pipelines/cavs/pipeline-passthrough-playback.conf> | ||
| <include/pipelines/cavs/pipeline-passthrough-capture.conf> | ||
| <include/common/connection.conf> | ||
| <include/common/endpoint.conf> | ||
| <include/dais/ssp.conf> | ||
| <include/common/manifest.conf> | ||
|
|
||
| # | ||
| # Pipeline definitions | ||
| # | ||
|
|
||
| # Pipeline ID:1 PCM ID: 0 | ||
| Object.pipeline-passthrough-playback."1.0" { | ||
| pcm_name "Port0" | ||
| format "s32le" | ||
| channels 2 | ||
| rate 48000 | ||
| } | ||
|
|
||
| # Pipeline ID:2 PCM ID: 0 | ||
| Object.pipeline-passthrough-capture."2.0" { | ||
| pcm_name "Port0" | ||
| format "s32le" | ||
| channels 2 | ||
| rate 48000 | ||
| } | ||
|
|
||
| # | ||
| # List of all DAIs | ||
| # | ||
| #SSP Index: 0, Direction: duplex | ||
| Object.SSP."0.0.duplex" { | ||
| dai_name "NoCodec-0" | ||
| id 0 | ||
| format "s24le" | ||
| sample_bits 32 | ||
| quirks 64 | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These should be named boolean attributes rather than a value. e.g. it can then be invoked via |
||
| hw_config."0" { | ||
| mclk_freq 24000000 | ||
| bclk_freq 4800000 | ||
| tdm_slot_width 32 | ||
| } | ||
|
|
||
| # include DAI copier components | ||
| <include/dais/pipe-copier-playback.conf> | ||
| <include/dais/pipe-copier-capture.conf> | ||
| } | ||
|
|
||
| # | ||
| # List of all endpoint connections | ||
| # | ||
| # Connect: Pipeline 1 -> SSP 0 DAI_IN | ||
| Object.connection."endpoint.1.0" { | ||
| source "endpoint.sink.pipeline.1.0" | ||
| sink "endpoint.source.SSP.0.0" | ||
| } | ||
|
|
||
| # Connect: Pipeline 2 <- SSP 0 DAI_OUT | ||
| Object.connection."endpoint.2.0" { | ||
| source "endpoint.sink.SSP.0.0" | ||
| sink "endpoint.source.pipeline.2.0" | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| #!/bin/bash | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
| # Copyright(c) 2019 Intel Corporation. All rights reserved. | ||
|
|
||
| MAJOR=`grep '#define SOF_ABI_MAJOR ' $1/src/include/kernel/abi.h | grep -E ".[[:digit:]]$" -o` | ||
| MINOR=`grep '#define SOF_ABI_MINOR ' $1/src/include/kernel/abi.h | grep -E ".[[:digit:]]$" -o` | ||
| PATCH=`grep '#define SOF_ABI_PATCH ' $1/src/include/kernel/abi.h | grep -E ".[[:digit:]]$" -o` | ||
| MAJOR_SHIFT=`grep '#define SOF_ABI_MAJOR_SHIFT'\ | ||
| $1/src/include/kernel/abi.h | grep -E ".[[:digit:]]$" -o` | ||
| MINOR_SHIFT=`grep '#define SOF_ABI_MINOR_SHIFT'\ | ||
| $1/src/include/kernel/abi.h | grep -E ".[[:digit:]]$" -o` | ||
|
|
||
| major_val=$(($MAJOR << $MAJOR_SHIFT)) | ||
| minor_val=$(($MINOR << $MINOR_SHIFT)) | ||
| abi_version_3_8=$((3<<$MAJOR_SHIFT | 8<<$MINOR_SHIFT)) | ||
| abi_version=$(($major_val | $minor_val)) | ||
| abi_version_3_9_or_greater=$(($abi_version > $abi_version_3_8)) | ||
| abi_version_3_17=$((3<<$MAJOR_SHIFT | 17<<$MINOR_SHIFT)) | ||
| abi_version_3_17_or_greater=$(($abi_version >= $abi_version_3_17)) | ||
|
|
||
| cat $2 | ||
| printf "Object.manifest.\"sof_manifest\" {\n" | ||
| printf "\tdata.\"sof_manifest\" {\n" | ||
| printf "\t\tbytes\t\"0x%02x," $MAJOR | ||
| printf "0x%02x," $MINOR | ||
| printf "0x%02x\"\n" $PATCH | ||
| printf "\t}\n" | ||
| printf "}" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| Class.Custom."connection" { | ||
|
|
||
| @args."type" { | ||
|
||
| type "string" | ||
| } | ||
|
|
||
| @args."pipeline_id" { | ||
| type "integer" | ||
| } | ||
|
|
||
| @args."index" { | ||
| type "integer" | ||
| } | ||
|
|
||
| DefineAttribute."source" {} | ||
|
|
||
| DefineAttribute."sink" {} | ||
|
|
||
| DefineAttribute."control" {} | ||
|
|
||
| attributes { | ||
| mandatory [ | ||
| "source" | ||
| "sink" | ||
| ] | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| Class.Base."data" { | ||
|
|
||
| @args."name" { | ||
| type "string" | ||
| } | ||
|
|
||
| DefineAttribute."bytes" {} | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| Class.Base."endpoint" { | ||
|
|
||
| # sink/source | ||
| @args."type" { | ||
| type "string" | ||
| constraints { | ||
| values [ | ||
| "sink" | ||
| "source" | ||
| ] | ||
| } | ||
| } | ||
|
|
||
| @args."class_name" { | ||
| type "string" | ||
| } | ||
|
|
||
| @args."id" { | ||
| type "integer" | ||
| } | ||
|
|
||
| @args."index" { | ||
| type "integer" | ||
| } | ||
|
|
||
| DefineAttribute."widget" {} | ||
|
|
||
| attributes { | ||
| mandatory [ | ||
| "widget" | ||
| ] | ||
| } | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will need some comment in bases classes describing the attributes |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| Class.Base."manifest" { | ||
| @args."name" { | ||
| type "string" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| Class.PCM."pcm" { | ||
| # | ||
| # Argument used to construct PCM | ||
| # | ||
| @args."pcm_name" { | ||
| type "string" | ||
| } | ||
|
|
||
| @args."direction" { | ||
| type "string" | ||
| } | ||
|
|
||
| @args."pcm_id" { | ||
| type "integer" | ||
| } | ||
|
|
||
| DefineAttribute.compress {} | ||
|
|
||
| DefineAttribute.playback_compatible_d0i3 { | ||
| # Token reference and type | ||
| token_ref "sof_tkn_stream.bool" | ||
| } | ||
|
|
||
| DefineAttribute.capture_compatible_d0i3 { | ||
| # Token reference and type | ||
| token_ref "sof_tkn_stream.bool" | ||
| } | ||
|
|
||
| attributes { | ||
| mandatory [ | ||
| "compress" | ||
| ] | ||
| } | ||
|
|
||
| # Default values for PCM attributes | ||
| compress "false" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| Class.PCM."pcm_caps" { | ||
| # | ||
| # Argument used to construct PCM Capabilities | ||
| # | ||
| @args."pcm_name" { | ||
| type "string" | ||
| } | ||
|
|
||
| @args."direction" { | ||
| type "string" | ||
| } | ||
|
|
||
| @args."pcm_id" { | ||
| type "integer" | ||
| } | ||
|
|
||
| DefineAttribute.formats {} | ||
|
|
||
| DefineAttribute.rates {} | ||
|
|
||
| DefineAttribute.sigbits {} | ||
|
|
||
| DefineAttribute.rate_min {} | ||
|
|
||
| DefineAttribute.rate_max {} | ||
|
|
||
| DefineAttribute.channels_min {} | ||
|
|
||
| DefineAttribute.channels_max {} | ||
|
|
||
| DefineAttribute.periods_min {} | ||
|
|
||
| DefineAttribute.periods_max {} | ||
|
|
||
| DefineAttribute.period_size_min {} | ||
|
|
||
| DefineAttribute.period_size_max {} | ||
|
|
||
| DefineAttribute.buffer_size_min {} | ||
|
|
||
| DefineAttribute.buffer_size_max {} | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These and all other attributes should all have default values. This way it's easy to grep for the value and change the default. |
||
|
|
||
| attributes { | ||
| mandatory [ | ||
| "formats " | ||
| "rate_min" | ||
| "rate_max" | ||
| "channels_min" | ||
| "channels_max" | ||
| "periods_min" | ||
| "periods_max" | ||
| "period_size_min" | ||
| "period_size_max" | ||
| "buffer_size_min" | ||
| "buffer_size_max" | ||
| ] | ||
| } | ||
|
|
||
| # Default attribute values for PCM capabilities | ||
| formats "S32_LE,S24_LE,S16_LE" | ||
| rate_min 48000 | ||
| rate_max 48000 | ||
| channels_min 2 | ||
| channels_max 2 | ||
| periods_min 2 | ||
| periods_max 16 | ||
| period_size_min 192 | ||
| period_size_max 16384 | ||
| buffer_size_min 65536 | ||
| buffer_size_max 65536 | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
best to order this on dependencies, i.e. common at the top