Skip to content

Commit

Permalink
Tools: Topology1: Add IIR and IIR+FIR HDA generic playback topologies
Browse files Browse the repository at this point in the history
This patch removes non-practical sof-hda-generic-loud topologies and
generates instead IIR and IIR+FIR topologies for headphone/speaker
path for no-DMIC/2ch-DMIC/4ch-DMIC platforms. The IIR and FIR are
by default programmed for pass-through without any processing.

sof-hda-generic-iir.tplg
sof-hda-generic-iir-2ch.tplg
sof-hda-generic-iir-4ch.tplg
sof-hda-generic-iir-fir.tplg
sof-hda-generic-iir-fir-2ch.tplg
sof-hda-generic-iir-fir-4ch.tplg

The custom topologies can be used e.g. copying them to
/lib/firmware/intel/sof-tplg-custom/ and by adding
to /etc/modprobe.d/sof.conf the following lines with desired
configuration un-commmented.

#options snd_sof_pci tplg_filename="sof-hda-generic-iir.tplg" tplg_path="intel/sof-tplg-custom"
#options snd_sof_pci tplg_filename="sof-hda-generic-iir-fir.tplg" tplg_path="intel/sof-tplg-custom"
#options snd_sof_pci tplg_filename="sof-hda-generic-iir-2ch.tplg" tplg_path="intel/sof-tplg-custom"
#options snd_sof_pci tplg_filename="sof-hda-generic-iir-fir-2ch.tplg" tplg_path="intel/sof-tplg-custom"
#options snd_sof_pci tplg_filename="sof-hda-generic-iir-4ch.tplg" tplg_path="intel/sof-tplg-custom"
#options snd_sof_pci tplg_filename="sof-hda-generic-iir-fir-4ch.tplg" tplg_path="intel/sof-tplg-custom"

The patch contains a fix for pipeline with FIR to undefine the
related macros to avoid them to possibly impact another FIR instance.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
  • Loading branch information
singalsu authored and kv2019i committed Aug 25, 2023
1 parent 0d15fa4 commit 6cebb32
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tools/topology/topology1/development/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,12 @@ set(TPLGS_UP
"sof-hda-generic\;sof-hda-generic-tdfb_50mm-2ch\;-DCHANNELS=2\;-DHSPROC=volume\;-DDMIC16KPROC=tdfb-eq-iir-volume\;-DDMIC16KPROC_FILTER1=tdfb/coef_line2_50mm_azm90_90_13el0_0_13deg_16khz.m4\;-DDMICPROC=tdfb-eq-iir-volume\;-DDMICPROC_FILTER1=tdfb/coef_line2_50mm_azm90_90_13el0_0_13deg_48khz.m4\;-DDMICPROC_FILTER2=eq_iir_coef_highpass_40hz_20db_48khz.m4\;-DDMIC16KPROC_FILTER2=eq_iir_coef_highpass_40hz_20db_16khz.m4"
"sof-hda-generic\;sof-hda-generic-tdfb_68mm-2ch\;-DCHANNELS=2\;-DHSPROC=volume\;-DDMIC16KPROC=tdfb-eq-iir-volume\;-DDMIC16KPROC_FILTER1=tdfb/coef_line2_68mm_azm90_90_13el0_0_13deg_16khz.m4\;-DDMICPROC=tdfb-eq-iir-volume\;-DDMICPROC_FILTER1=tdfb/coef_line2_68mm_azm90_90_13el0_0_13deg_48khz.m4\;-DDMICPROC_FILTER2=eq_iir_coef_highpass_40hz_20db_48khz.m4\;-DDMIC16KPROC_FILTER2=eq_iir_coef_highpass_40hz_20db_16khz.m4"
"sof-hda-generic\;sof-hda-generic-tdfb_0mm36mm146mm182mm-4ch\;-DCHANNELS=2\;-DHSPROC=volume\;-DDMIC16KPROC=tdfb-eq-iir-volume\;-DDMIC16KPROC_FILTER1=tdfb/coef_line4_0mm36mm146mm182mm_azm90_90_13el0_0_13deg_16khz.m4\;-DDMICPROC=tdfb-eq-iir-volume\;-DDMICPROC_FILTER1=tdfb/coef_line4_0mm36mm146mm182mm_azm90_90_13el0_0_13deg_48khz.m4\;-DDMICPROC_FILTER2=eq_iir_coef_highpass_40hz_20db_48khz.m4\;-DDMIC16KPROC_FILTER2=eq_iir_coef_highpass_40hz_20db_16khz.m4"
"sof-hda-generic\;sof-hda-generic-loud\;-DCHANNELS=0\;-DHSPROC=eq-iir-eq-fir-volume\;-DDMICPROC_FILTER1=eq_iir_coef_highpass_40hz_20db_48khz.m4\;-DDMIC16KPROC_FILTER1=eq_iir_coef_highpass_40hz_20db_16khz.m4\;-DHSPROC_FILTER1=eq_iir_coef_pass.m4\;-DHSPROC_FILTER2=eq_fir_coef_loudness.m4\;-DDYNAMIC=1"
"sof-hda-generic\;sof-hda-generic-2ch-loud\;-DCHANNELS=2\;-DHSPROC=eq-iir-eq-fir-volume\;-DDMICPROC_FILTER1=eq_iir_coef_highpass_40hz_20db_48khz.m4\;-DDMIC16KPROC_FILTER1=eq_iir_coef_highpass_40hz_20db_16khz.m4\;-DHSPROC_FILTER1=eq_iir_coef_pass.m4\;-DHSPROC_FILTER2=eq_fir_coef_loudness.m4\;-DDYNAMIC=1"
"sof-hda-generic\;sof-hda-generic-4ch-loud\;-DCHANNELS=4\;-DHSPROC=eq-iir-eq-fir-volume\;-DDMICPROC_FILTER1=eq_iir_coef_highpass_40hz_20db_48khz.m4\;-DDMIC16KPROC_FILTER1=eq_iir_coef_highpass_40hz_20db_16khz.m4\;-DHSPROC_FILTER1=eq_iir_coef_pass.m4\;-DHSPROC_FILTER2=eq_fir_coef_loudness.m4\;-DDYNAMIC=1"
"sof-hda-generic\;sof-hda-generic-iir\;-DCHANNELS=0\;-DHSPROC=eq-iir-volume\;-DDMICPROC_FILTER1=eq_iir_coef_highpass_40hz_20db_48khz.m4\;-DDMIC16KPROC_FILTER1=eq_iir_coef_highpass_40hz_20db_16khz.m4\;-DHSPROC_FILTER1=eq_iir_coef_pass.m4\;-DDYNAMIC=1"
"sof-hda-generic\;sof-hda-generic-iir-2ch\;-DCHANNELS=2\;-DHSPROC=eq-iir-volume\;-DDMICPROC_FILTER1=eq_iir_coef_highpass_40hz_20db_48khz.m4\;-DDMIC16KPROC_FILTER1=eq_iir_coef_highpass_40hz_20db_16khz.m4\;-DHSPROC_FILTER1=eq_iir_coef_pass.m4\;-DDYNAMIC=1"
"sof-hda-generic\;sof-hda-generic-iir-4ch\;-DCHANNELS=4\;-DHSPROC=eq-iir-volume\;-DDMICPROC_FILTER1=eq_iir_coef_highpass_40hz_20db_48khz.m4\;-DDMIC16KPROC_FILTER1=eq_iir_coef_highpass_40hz_20db_16khz.m4\;-DHSPROC_FILTER1=eq_iir_coef_pass.m4\;-DDYNAMIC=1"
"sof-hda-generic\;sof-hda-generic-iir-fir\;-DCHANNELS=0\;-DHSPROC=eq-iir-eq-fir-volume\;-DDMICPROC_FILTER1=eq_iir_coef_highpass_40hz_20db_48khz.m4\;-DDMIC16KPROC_FILTER1=eq_iir_coef_highpass_40hz_20db_16khz.m4\;-DHSPROC_FILTER1=eq_iir_coef_pass.m4\;-DHSPROC_FILTER2=eq_fir_coef_pass.m4\;-DDYNAMIC=1"
"sof-hda-generic\;sof-hda-generic-iir-fir-2ch\;-DCHANNELS=2\;-DHSPROC=eq-iir-eq-fir-volume\;-DDMICPROC_FILTER1=eq_iir_coef_highpass_40hz_20db_48khz.m4\;-DDMIC16KPROC_FILTER1=eq_iir_coef_highpass_40hz_20db_16khz.m4\;-DHSPROC_FILTER1=eq_iir_coef_pass.m4\;-DHSPROC_FILTER2=eq_fir_coef_pass.m4\;-DDYNAMIC=1"
"sof-hda-generic\;sof-hda-generic-iir-fir-4ch\;-DCHANNELS=4\;-DHSPROC=eq-iir-eq-fir-volume\;-DDMICPROC_FILTER1=eq_iir_coef_highpass_40hz_20db_48khz.m4\;-DDMIC16KPROC_FILTER1=eq_iir_coef_highpass_40hz_20db_16khz.m4\;-DHSPROC_FILTER1=eq_iir_coef_pass.m4\;-DHSPROC_FILTER2=eq_fir_coef_pass.m4\;-DDYNAMIC=1"
"sof-hda-generic\;sof-hda-generic-multiband-drc\;-DCHANNELS=0\;-DHSPROC=multiband-drc\;-DDYNAMIC=1"
"sof-hda-generic\;sof-hda-generic-2ch-multiband-drc\;-DCHANNELS=2\;-DHSPROC=multiband-drc\;-DDMICPROC_FILTER1=eq_iir_coef_highpass_40hz_20db_48khz.m4\;-DDMIC16KPROC_FILTER1=eq_iir_coef_highpass_40hz_20db_16khz.m4\;-DDYNAMIC=1"
"sof-hda-generic\;sof-hda-generic-drc\;-DCHANNELS=0\;-DHSPROC=drc\;-DDYNAMIC=1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ include(`pipeline.m4')
include(`eq_iir.m4')
include(`eq_fir.m4')

#
# Controls
#
# Volume Mixer control with max value of 32
Expand Down Expand Up @@ -146,5 +147,7 @@ indir(`define', concat(`PIPELINE_MIXER_', PIPELINE_ID), N_MIXER(0))

undefine(`DEF_EQIIR_COEF')
undefine(`DEF_EQIIR_PRIV')
undefine(`DEF_EQFIR_COEF')
undefine(`DEF_EQFIR_PRIV')
undefine(`DEF_PGA_TOKENS')
undefine(`DEF_PGA_CONF')
121 changes: 121 additions & 0 deletions tools/topology/topology1/sof/pipe-mixer-eq-iir-volume-dai-playback.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Mixer DAI Playback connector
#
# DAI playback starting with a LL mixer
#
# Pipeline Endpoints for connection are :-
#
# LL Playback Mixer (Mixer)
# LL Playback Volume B3 (DAI buffer)
#
# DAI_BUF --> ll mixer(M) --> B0 --> EQ_IIR 0 --> B1 --> volume(LL) --> B2 --> sink DAI
#
# the ll mixer is connected to one DAI_BUF by default. Additional ones can be added later

# Include topology builder
include(`utils.m4')
include(`mixer.m4')
include(`mixercontrol.m4')
include(`bytecontrol.m4')
include(`pga.m4')
include(`buffer.m4')
include(`dai.m4')
include(`pipeline.m4')
include(`eq_iir.m4')

#
# Controls
#
# Volume Mixer control with max value of 32
C_CONTROLMIXER(Master Playback Volume, PIPELINE_ID,
CONTROLMIXER_OPS(volsw, 256 binds the mixer control to volume get/put handlers, 256, 256),
CONTROLMIXER_MAX(, 32),
false,
CONTROLMIXER_TLV(TLV 32 steps from -64dB to 0dB for 2dB, vtlv_m64s2),
Channel register and shift for Front Left/Right,
VOLUME_CHANNEL_MAP)

#
# Volume configuration
#

define(DEF_PGA_TOKENS, concat(`pga_tokens_', PIPELINE_ID))
define(DEF_PGA_CONF, concat(`pga_conf_', PIPELINE_ID))

W_VENDORTUPLES(DEF_PGA_TOKENS, sof_volume_tokens,
LIST(` ', `SOF_TKN_VOLUME_RAMP_STEP_TYPE "0"'
` ', `SOF_TKN_VOLUME_RAMP_STEP_MS "20"'))

W_DATA(DEF_PGA_CONF, DEF_PGA_TOKENS)

# Mixer 0 has 2 sink and source periods.
W_MIXER(0, PIPELINE_FORMAT, 2, 2, SCHEDULE_CORE)

#
# IIR EQ
#

define(DEF_EQIIR_COEF, concat(`eqiir_coef_', PIPELINE_ID))
define(DEF_EQIIR_PRIV, concat(`eqiir_priv_', PIPELINE_ID))

# By default, use coefficients for pass frequency response
ifdef(`PIPELINE_FILTER1', , `define(PIPELINE_FILTER1, eq_iir_coef_pass.m4)')
include(PIPELINE_FILTER1)

# EQ Bytes control with max value of 255
C_CONTROLBYTES(DEF_EQIIR_COEF, 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(, 1024),
,
DEF_EQIIR_PRIV)

# "EQ 0" has 2 sink period and 2 source periods
W_EQ_IIR(0, PIPELINE_FORMAT, 2, 2, SCHEDULE_CORE,
LIST(` ', "DEF_EQIIR_COEF"))

# "Master Playback Volume" has 2 source and x sink periods for DAI ping-pong
W_PGA(0, PIPELINE_FORMAT, DAI_PERIODS, 2, DEF_PGA_CONF, SCHEDULE_CORE,
LIST(` ', "PIPELINE_ID Master Playback Volume"))

#
# DAI definitions
#
W_DAI_OUT(DAI_TYPE, DAI_INDEX, DAI_BE, DAI_FORMAT, 0, DAI_PERIODS, SCHEDULE_CORE)

#
# DAI pipeline - always use 0 for DAIs - FIXME WHY 0?
#
W_PIPELINE(N_DAI_OUT, SCHEDULE_PERIOD, SCHEDULE_PRIORITY, SCHEDULE_CORE, SCHEDULE_TIME_DOMAIN, pipe_dai_schedule_plat)

# Low Latency Buffers
W_BUFFER(0, COMP_BUFFER_SIZE(2,
COMP_SAMPLE_SIZE(DAI_FORMAT), DAI_CHANNELS, COMP_PERIOD_FRAMES(DAI_RATE, SCHEDULE_PERIOD)),
PLATFORM_COMP_MEM_CAP)
W_BUFFER(1, COMP_BUFFER_SIZE(2,
COMP_SAMPLE_SIZE(DAI_FORMAT), DAI_CHANNELS,COMP_PERIOD_FRAMES(DAI_RATE, SCHEDULE_PERIOD)),
PLATFORM_COMP_MEM_CAP)
W_BUFFER(2, COMP_BUFFER_SIZE(2,
COMP_SAMPLE_SIZE(DAI_FORMAT), DAI_CHANNELS,COMP_PERIOD_FRAMES(DAI_RATE, SCHEDULE_PERIOD)),
PLATFORM_COMP_MEM_CAP)

#
# Graph connections to pipelines
# we don't connect `dapm(N_MIXER(0), DAI_BUF)' due to forward dependencies
#
P_GRAPH(DAI_NAME, PIPELINE_ID,
LIST(` ',
`dapm(N_BUFFER(0), N_MIXER(0))',
`dapm(N_EQ_IIR(0), N_BUFFER(0))',
`dapm(N_BUFFER(1), N_EQ_IIR(0))',
`dapm(N_PGA(0), N_BUFFER(1))',
`dapm(N_BUFFER(2), N_PGA(0))'
`dapm(N_DAI_OUT, N_BUFFER(2))'))

indir(`define', concat(`PIPELINE_PLAYBACK_SCHED_COMP_', PIPELINE_ID), N_DAI_OUT)
indir(`define', concat(`PIPELINE_MIXER_', PIPELINE_ID), N_MIXER(0))

undefine(`DEF_EQIIR_COEF')
undefine(`DEF_EQIIR_PRIV')
undefine(`DEF_PGA_TOKENS')
undefine(`DEF_PGA_CONF')

0 comments on commit 6cebb32

Please sign in to comment.