Skip to content

Commit 689b91e

Browse files
singalsulgirdwood
authored andcommitted
Tools: Topology1: Add sof-hda-generic topology with SRC
This patch adds to sof-hda-generic.m4 macros HSSFX, HSSFX_FILTER1, and HSSFX_FILTER2 those can be used to customize stream effect for PCM 30. The macro defaults to volume so the default topology build is not impacted. The CMakeLists.txt in development is updated to build topologies sof-hda-generic-src.tplg, sof-hda-generic-2ch-src.tplg, and sof-hda-generic-4ch-src.tplg. The stream effect is set with HSSFX to src-volume. The pipeline pipe-host-src-volume-playback.m4 is added. It is similar as pipe-host-volume-playback.m4 but a sample rate converter (SRC) is added after PCM, before volume. The PCM capability is changed to min 8000, max 192000 Hz. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
1 parent ba209af commit 689b91e

File tree

3 files changed

+119
-2
lines changed

3 files changed

+119
-2
lines changed

tools/topology/topology1/development/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ set(TPLGS
3333
"sof-imx8mp-compr-pcm-cap-wm8960\;sof-imx8mp-compr-pcm-cap-wm8960"
3434
"sof-apl-nocodec-demux-eq-4ch4ch\;sof-apl-nocodec-demux-eq-4ch4ch"
3535
"sof-apl-nocodec-demux-eq-2ch4ch\;sof-apl-nocodec-demux-eq-2ch4ch"
36-
3736
"sof-hda-generic-kwd\;sof-hda-generic-2ch-kwd\;-DCHANNELS=2\;-DDYNAMIC=1"
3837
"sof-hda-generic-kwd\;sof-hda-generic-4ch-kwd\;-DCHANNELS=4\;-DDYNAMIC=1"
3938
)
@@ -60,6 +59,9 @@ set(TPLGS_UP
6059
"sof-hda-generic\;sof-hda-generic-2ch-drc\;-DCHANNELS=2\;-DHSPROC=drc\;-DDMICPROC_FILTER1=eq_iir_coef_highpass_40hz_20db_48khz.m4\;-DDMIC16KPROC_FILTER1=eq_iir_coef_highpass_40hz_20db_16khz.m4\;-DDYNAMIC=1"
6160
"sof-hda-generic\;sof-hda-generic-2ch-mfcc\;-DCHANNELS=2\;-DHSPROC=volume\;-DDMICPROC_FILTER1=eq_iir_coef_highpass_40hz_20db_48khz.m4\;-DDMIC16KPROC_FILTER1=eq_iir_coef_highpass_40hz_20db_16khz.m4\;-DDYNAMIC=1\;-DDMIC16KPROC=eq-iir-mfcc"
6261
"sof-tgl-rt711-rt1308\;sof-tgl-sdw-max98373-rt5682-dmic4ch-ampref\;-DCHANNELS=4\;-DEXT_AMP\;-DEXT_AMP_REF\;-DDMICPROC_FILTER1=eq_iir_coef_highpass_40hz_20db_48khz.m4\;-DDMIC16KPROC_FILTER1=eq_iir_coef_highpass_40hz_20db_16khz.m4\;-DPLATFORM=tgl"
62+
"sof-hda-generic\;sof-hda-generic-src\;-DCHANNELS=0\;-DHSSFX=src-volume\;-DDMICPROC_FILTER1=eq_iir_coef_highpass_40hz_20db_48khz.m4\;-DDMIC16KPROC_FILTER1=eq_iir_coef_highpass_40hz_20db_16khz.m4"
63+
"sof-hda-generic\;sof-hda-generic-2ch-src\;-DCHANNELS=2\;-DHSSFX=src-volume\;-DDMICPROC_FILTER1=eq_iir_coef_highpass_40hz_20db_48khz.m4\;-DDMIC16KPROC_FILTER1=eq_iir_coef_highpass_40hz_20db_16khz.m4"
64+
"sof-hda-generic\;sof-hda-generic-4ch-src\;-DCHANNELS=4\;-DHSSFX=src-volume\;-DDMICPROC_FILTER1=eq_iir_coef_highpass_40hz_20db_48khz.m4\;-DDMIC16KPROC_FILTER1=eq_iir_coef_highpass_40hz_20db_16khz.m4"
6365
)
6466

6567
add_custom_target(dev_topologies1 ALL)

tools/topology/topology1/sof-hda-generic.m4

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
ifdef(`DMICPROC', , `define(DMICPROC, eq-iir-volume)')
66
ifdef(`DMIC16KPROC', , `define(DMIC16KPROC, eq-iir-volume)')
77
ifdef(`HSPROC', , `define(HSPROC, volume)')
8+
ifdef(`HSSFX', , `define(HSSFX, volume)')
89

910
# Include topology builder
1011
include(`utils.m4')
@@ -95,9 +96,13 @@ DAI_ADD(PIPE_HEADSET_PLAYBACK,
9596
NOT_USED_IGNORED, 2, s32le,
9697
1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER, 2, 48000)
9798

99+
# If HSSFX_FILTERx is defined set PIPELINE_FILTERx
100+
ifdef(`HSSFX_FILTER1', `define(PIPELINE_FILTER1, HSSFX_FILTER1)', `undefine(`PIPELINE_FILTER1')')
101+
ifdef(`HSSFX_FILTER2', `define(PIPELINE_FILTER2, HSSFX_FILTER2)', `undefine(`PIPELINE_FILTER2')')
102+
98103
# Low Latency playback pipeline 1 on PCM 30 using max 2 channels of s32le.
99104
# 1000us deadline on core 0 with priority 0
100-
PIPELINE_PCM_ADD(sof/pipe-host-volume-playback.m4,
105+
PIPELINE_PCM_ADD(sof/pipe-host-HSSFX-playback.m4,
101106
30, 0, 2, s32le,
102107
1000, 0, 0,
103108
48000, 48000, 48000,
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# Host PCM Volume playback pipeline
2+
#
3+
# Pipeline Endpoints for connection are :-
4+
#
5+
# host PCM_P --> B0 --> SRC 0 --> B1 --> Volume 0 --> B2 --> [other pipeline]
6+
7+
# Include topology builder
8+
include(`utils.m4')
9+
include(`buffer.m4')
10+
include(`pcm.m4')
11+
include(`src.m4')
12+
include(`pga.m4')
13+
include(`dai.m4')
14+
include(`mixercontrol.m4')
15+
include(`pipeline.m4')
16+
17+
#
18+
# Controls
19+
#
20+
# Volume Mixer control with max value of 32
21+
C_CONTROLMIXER(Playback Volume, PIPELINE_ID,
22+
CONTROLMIXER_OPS(volsw, 256 binds the mixer control to volume get/put handlers, 256, 256),
23+
CONTROLMIXER_MAX(, 32),
24+
false,
25+
CONTROLMIXER_TLV(TLV 32 steps from -64dB to 0dB for 2dB, vtlv_m64s2),
26+
Channel register and shift for Front Left/Right,
27+
VOLUME_CHANNEL_MAP)
28+
29+
#
30+
# Volume configuration
31+
#
32+
33+
define(DEF_PGA_TOKENS, concat(`pga_tokens_', PIPELINE_ID))
34+
define(DEF_PGA_CONF, concat(`pga_conf_', PIPELINE_ID))
35+
36+
W_VENDORTUPLES(DEF_PGA_TOKENS, sof_volume_tokens,
37+
LIST(` ', `SOF_TKN_VOLUME_RAMP_STEP_TYPE "0"'
38+
` ', `SOF_TKN_VOLUME_RAMP_STEP_MS "20"'))
39+
40+
W_DATA(DEF_PGA_CONF, DEF_PGA_TOKENS)
41+
42+
define(DEF_SRC_TOKENS, concat(`src_tokens_', PIPELINE_ID))
43+
define(DEF_SRC_CONF, concat(`src_conf_', PIPELINE_ID))
44+
45+
W_VENDORTUPLES(DEF_SRC_TOKENS, sof_src_tokens,
46+
LIST(` ', `SOF_TKN_SRC_RATE_OUT "PIPELINE_RATE"'))
47+
48+
W_DATA(DEF_SRC_CONF, DEF_SRC_TOKENS)
49+
50+
#
51+
# Components and Buffers
52+
#
53+
54+
# Host "Playback" PCM
55+
# with 2 sink and 0 source periods
56+
W_PCM_PLAYBACK(PCM_ID, Playback, 2, 0, SCHEDULE_CORE)
57+
58+
# "SRC" has 2 source and 2 sink periods
59+
W_SRC(0, PIPELINE_FORMAT, 2, 2, DEF_SRC_CONF)
60+
61+
# "Volume" has 2 source and x sink periods
62+
W_PGA(0, PIPELINE_FORMAT, DAI_PERIODS, 2, DEF_PGA_CONF, SCHEDULE_CORE,
63+
LIST(` ', "PIPELINE_ID Playback Volume"))
64+
65+
# Playback Buffers
66+
W_BUFFER(0, COMP_BUFFER_SIZE(2,
67+
COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)),
68+
PLATFORM_HOST_MEM_CAP, SCHEDULE_CORE)
69+
W_BUFFER(1, COMP_BUFFER_SIZE(2,
70+
COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)),
71+
PLATFORM_HOST_MEM_CAP, SCHEDULE_CORE)
72+
W_BUFFER(2, COMP_BUFFER_SIZE(DAI_PERIODS,
73+
COMP_SAMPLE_SIZE(DAI_FORMAT), PIPELINE_CHANNELS, COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)),
74+
PLATFORM_DAI_MEM_CAP, SCHEDULE_CORE)
75+
76+
#
77+
# Pipeline Graph
78+
#
79+
# host PCM_P --> B0 -- SRC 0 --> B1 --> Volume 0 --> B2 --> sink DAI0
80+
81+
P_GRAPH(pipe-host-volume-playback, PIPELINE_ID,
82+
LIST(` ',
83+
`dapm(N_BUFFER(0), N_PCMP(PCM_ID))',
84+
`dapm(N_SRC(0), N_BUFFER(0))',
85+
`dapm(N_BUFFER(1), N_SRC(0))',
86+
`dapm(N_PGA(0), N_BUFFER(1))',
87+
`dapm(N_BUFFER(2), N_PGA(0))'))
88+
89+
#
90+
# Pipeline Source and Sinks
91+
#
92+
indir(`define', concat(`PIPELINE_SOURCE_', PIPELINE_ID), N_BUFFER(2))
93+
indir(`define', concat(`PIPELINE_PCM_', PIPELINE_ID), Playback PCM_ID)
94+
95+
#
96+
# Pipeline Configuration.
97+
#
98+
99+
W_PIPELINE(SCHED_COMP, SCHEDULE_PERIOD, SCHEDULE_PRIORITY, SCHEDULE_CORE, SCHEDULE_TIME_DOMAIN, pipe_media_schedule_plat)
100+
101+
#
102+
# PCM Configuration
103+
104+
#
105+
PCM_CAPABILITIES(Playback PCM_ID, CAPABILITY_FORMAT_NAME(PIPELINE_FORMAT), 8000, 192000, 2, PIPELINE_CHANNELS, 2, 16, 192, 16384, 65536, 65536)
106+
107+
undefine(`DEF_PGA_TOKENS')
108+
undefine(`DEF_PGA_CONF')
109+
undefine(`DEF_SRC_TOKENS')
110+
undefine(`DEF_SRC_CONF')

0 commit comments

Comments
 (0)