Skip to content

Commit

Permalink
Tools: Topology: Add ASRC capture to cavs-nocodec.conf topologies
Browse files Browse the repository at this point in the history
This patch adds ASRC capture from Dmic such as sof-tgl-nocodec.tplg.
Set ASRC_CAPTURE_ENABLE as "true" enables test of ASRC component with IPC4.

Signed-off-by: Andrula Song <[email protected]>
  • Loading branch information
andrula-song committed Aug 25, 2023
1 parent 0d15fa4 commit e84d6ff
Show file tree
Hide file tree
Showing 7 changed files with 1,012 additions and 3 deletions.
112 changes: 112 additions & 0 deletions tools/topology/topology2/cavs-nocodec.conf
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<mixout-gain-smart-amp-dai-copier-playback.conf>
<dai-copier-gain-module-copier-capture.conf>
<dai-copier-eqiir-module-copier-capture.conf>
<asrc-capture.conf>
<gain-module-copier.conf>
<gain-capture.conf>
<gain-copier-capture.conf>
Expand Down Expand Up @@ -59,6 +60,11 @@ Define {
DMIC0_DAI_PIPELINE_SRC 'module-copier.14.2'
DMIC0_DAI_COPIER 'dai-copier.DMIC.NoCodec-6.capture'
DMIC0_DAI_GAIN 'eqiir.14.1'
DMIC0_DAI_ASRC 'asrc.23.1'
ASRC_CAPTURE_ENABLE "false"
DMIC0_ASRC_PCM_CAPS 'ASRC Capture 23'
DMIC0_ASRC_PIPELINE_ID 23
DMIC0_ASRC_PCM_ID 23
DMIC0_NAME 'NoCodec-6'
DMIC1_NAME 'NoCodec-7'
DMIC0_PCM_CAPS 'Gain Capture 13'
Expand Down Expand Up @@ -354,6 +360,112 @@ IncludeByKey.PASSTHROUGH {
}
}

IncludeByKey.NUM_DMICS {
"[1-4]" {
IncludeByKey.ASRC_CAPTURE_ENABLE {
"true" {
Object.Pipeline.asrc-capture [
{
index 23
Object.Widget.host-copier.1 {
stream_name $DMIC0_ASRC_PCM_CAPS
pcm_id $DMIC0_ASRC_PCM_ID
num_input_audio_formats 2
num_output_audio_formats 2
Object.Base.audio_format.1 {
in_bit_depth 32
in_valid_bit_depth 32
out_bit_depth 32
out_valid_bit_depth 32
}
Object.Base.audio_format.2 {
in_channels 4
in_bit_depth 32
in_valid_bit_depth 32
out_channels 4
out_bit_depth 32
out_valid_bit_depth 32
in_ch_cfg $CHANNEL_CONFIG_3_POINT_1
in_ch_map $CHANNEL_MAP_3_POINT_1
out_ch_cfg $CHANNEL_CONFIG_3_POINT_1
out_ch_map $CHANNEL_MAP_3_POINT_1
}
}
Object.Widget.asrc."1" {
rate_in 48000
rate_out 16000
asynchronous_mode 1
operation_mode 0

num_input_audio_formats 2
Object.Base.input_audio_format [
{
in_bit_depth 32
in_valid_bit_depth 32
}
{
in_channels 4
in_bit_depth 32
in_valid_bit_depth 32
in_ch_cfg $CHANNEL_CONFIG_3_POINT_1
in_ch_map $CHANNEL_MAP_3_POINT_1
}
]
num_output_audio_formats 2
Object.Base.output_audio_format [
{
out_bit_depth 32
out_valid_bit_depth 32
}
{
out_channels 4
out_bit_depth 32
out_valid_bit_depth 32
out_ch_cfg $CHANNEL_CONFIG_3_POINT_1
out_ch_map $CHANNEL_MAP_3_POINT_1
}
]
}
Object.Widget.pipeline."1" {
core $DMIC_CORE_ID
}
}
]

Object.Base.route [
{
source $DMIC0_DAI_COPIER
sink $DMIC0_DAI_ASRC
}

{
source $DMIC0_DAI_ASRC
sink "host-copier.$DMIC0_ASRC_PCM_ID.capture"
}
]

Object.PCM.pcm [
{

name "$DMIC0_ASRC_PCM_CAPS"
id 23
direction "capture"
Object.Base.fe_dai."$DMIC0_ASRC_PCM_CAPS" {}

Object.PCM.pcm_caps."capture" {
name $DMIC0_ASRC_PCM_CAPS
# only 32-bit capture supported now
formats 'S32_LE'
channels_min $NUM_DMICS
channels_max $NUM_DMICS
}
}
]
}
}
}
}

Object.Pipeline.dai-copier-gain-module-copier-capture [
{
index 8
Expand Down
10 changes: 7 additions & 3 deletions tools/topology/topology2/include/components/asrc.conf
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,12 @@ Class.Widget."asrc" {
]

!mandatory [
"format"
"rate_out"
"asynchronous_mode"
"operation_mode"
"num_input_audio_formats"
"num_output_audio_formats"
"num_input_pins"
"num_output_pins"
]

#
Expand All @@ -94,6 +96,8 @@ Class.Widget."asrc" {
# Default attributes for asrc
#
type "asrc"
uuid "f6:72:ec:c8:26:85:af:4f:9d:39:a2:3d:0b:54:1d:e2"
uuid "2d:40:b4:66:68:b4:f2:42:81:a7:b3:71:21:86:3d:d4"
no_pm "true"
num_input_pins 1
num_output_pins 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#asrc format array
num_output_audio_formats 2

Object.Base.output_audio_format [
# 8khz output
{
out_rate 8000
out_bit_depth 32
out_valid_bit_depth 32
}
# 16khz output
{
out_rate 16000
out_bit_depth 32
out_valid_bit_depth 32
}

num_input_audio_formats 1

Object.Base.input_audio_format [
{
in_rate 24000
in_bit_depth 32
in_valid_bit_depth 32
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#asrc format array
num_output_audio_formats 14

Object.Base.output_audio_format [
# 8khz output
{
out_rate 8000
out_bit_depth 32
out_valid_bit_depth 32
}
# 11.025 khz output
{
out_rate 11025
out_bit_depth 32
out_valid_bit_depth 32
obs "$[($out_channels * (($[($out_rate + 999)] / 1000) + 4)) * ($out_bit_depth / 8)]"
}
# 12khz output
{
out_rate 12000
out_bit_depth 32
out_valid_bit_depth 32
}
# 16khz output
{
out_rate 16000
out_bit_depth 32
out_valid_bit_depth 32
}
# 22.05khz output
{
out_rate 22050
out_bit_depth 32
out_valid_bit_depth 32
}
# 24khz output
{
out_rate 24000
out_bit_depth 32
out_valid_bit_depth 32
}
# 32khz output
{
out_rate 32000
out_bit_depth 32
out_valid_bit_depth 32
}
# 44.1khz output
{
out_rate 44100
out_bit_depth 32
out_valid_bit_depth 32
obs "$[($out_channels * (($[($out_rate + 999)] / 1000) + 4)) * ($out_bit_depth / 8)]"
}
# 48khz output
{
out_rate 48000
out_bit_depth 32
out_valid_bit_depth 32
}
# 64khz output
{
out_rate 64000
out_bit_depth 32
out_valid_bit_depth 32
}
# 88.2khz output
{
out_rate 88200
out_bit_depth 32
out_valid_bit_depth 32
obs "$[($out_channels * (($[($out_rate + 999)] / 1000) + 4)) * ($out_bit_depth / 8)]"
}
# 96khz output
{
out_rate 96000
out_bit_depth 32
out_valid_bit_depth 32
}
# 176.4khz output
{
out_rate 176400
out_bit_depth 32
out_valid_bit_depth 32
obs "$[($out_channels * (($[($out_rate + 999)] / 1000) + 4)) * ($out_bit_depth / 8)]"
}
# 192khz output
{
out_rate 192000
out_bit_depth 32
out_valid_bit_depth 32
}
]

num_input_audio_formats 1

Object.Base.input_audio_format [
{
in_rate 48000
in_bit_depth 32
in_valid_bit_depth 32
}
]
Loading

0 comments on commit e84d6ff

Please sign in to comment.