Topology: Add Equalizer

This patch adds EQ, bytecontrol, and EQ+volume pipeline m4 macros and an
enhanced topology with EQ for UP2 + HiFiberry. There is not yet FIR/IIR
type select. The EQ type is currently hardcoded into kernel.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
This commit is contained in:
Seppo Ingalsuo 2018-09-06 13:00:17 +03:00 committed by Jaska Uimonen
parent 15030d4cab
commit baa791f6e1
6 changed files with 318 additions and 2 deletions

View File

@ -35,7 +35,8 @@ MACHINES = \
sof-apl-wm8804.tplg \
sof-apl-da7219.tplg \
sof-glk-da7219.tplg \
sof-icl-nocodec.tplg
sof-icl-nocodec.tplg \
sof-apl-eq-pcm512x.tplg
# Uncomment the following line if you want to debug conf files
.PRECIOUS: %.conf
@ -71,4 +72,5 @@ EXTRA_DIST = \
sof-apl-wm8804.m4 \
sof-apl-da7219.m4 \
sof-glk-da7219.m4 \
sof-icl-nocodec.m4
sof-icl-nocodec.m4 \
sof-apl-eq-pcm512x.m4

View File

@ -0,0 +1,54 @@
divert(-1)
dnl Define macro for byte control
dnl CONTROLBYTES_MAX(comment, value)
define(`CONTROLBYTES_MAX',
`#$1'
` max STR($2)')
dnl CONTROLMIXER_TLV(comment, value)
define(`CONTROLBYTES_TLV',
`#$1'
` tlv STR($2)')
dnl CONTROLMIXER_OPS(info, comment, get, put)
define(`CONTROLBYTES_OPS',
`ops."ctl" {'
` info STR($1)'
` #$2'
` }')
dnl CONTROLMIXER_OPS(info, comment, get, put)
define(`CONTROLBYTES_EXTOPS',
`extops."extctl" {'
` #$1'
` get STR($2)'
` put STR($3)'
` }')
dnl C_CONTROLMIXER(name, index, ops, base, num_regs, mask, max, tlv)
define(`C_CONTROLBYTES',
`SectionControlBytes.STR($1) {'
`'
` # control belongs to this index group'
` index STR($2)'
`'
` # control uses bespoke driver get/put/info ID for io ops'
` $3'
` # control uses bespoke driver get/put/info ID for ext ops'
` $4'
`'
` base STR($5)'
` num_regs STR($6)'
` mask STR($7)'
` $8'
` $9'
` access ['
` tlv_write'
` tlv_read'
` tlv_callback'
` ]'
`}')
divert(0)dnl

43
topology/m4/eq.m4 Normal file
View File

@ -0,0 +1,43 @@
divert(-1)
dnl Define macro for Eq effect widget
dnl EQ name)
define(`N_EQ', `EQ'PIPELINE_ID`.'$1)
dnl W_EQ(name, format, periods_sink, periods_source, preload, kcontrols_list)
define(`W_EQ',
`SectionVendorTuples."'N_EQ($1)`_tuples_w" {'
` tokens "sof_comp_tokens"'
` tuples."word" {'
` SOF_TKN_COMP_PERIOD_SINK_COUNT' STR($3)
` SOF_TKN_COMP_PERIOD_SOURCE_COUNT' STR($4)
` SOF_TKN_COMP_PRELOAD_COUNT' STR($5)
` }'
`}'
`SectionData."'N_EQ($1)`_data_w" {'
` tuples "'N_EQ($1)`_tuples_w"'
`}'
`SectionVendorTuples."'N_EQ($1)`_tuples_str" {'
` tokens "sof_comp_tokens"'
` tuples."string" {'
` SOF_TKN_COMP_FORMAT' STR($2)
` }'
`}'
`SectionData."'N_EQ($1)`_data_str" {'
` tuples "'N_EQ($1)`_tuples_str"'
`}'
`SectionWidget."'N_EQ($1)`" {'
` index "'PIPELINE_ID`"'
` type "effect"'
` no_pm "true"'
` data ['
` "'N_EQ($1)`_data_w"'
` "'N_EQ($1)`_data_str"'
` ]'
` bytes ['
$6
` ]'
`}')
divert(0)dnl

View File

@ -0,0 +1,55 @@
#
# Topology for generic Apollolake UP^2 with pcm512x codec.
#
# Include topology builder
include(`utils.m4')
include(`dai.m4')
include(`pipeline.m4')
include(`ssp.m4')
# Include TLV library
include(`common/tlv.m4')
# Include Token library
include(`sof/tokens.m4')
# Include Apollolake DSP configuration
include(`platform/intel/bxt.m4')
#
# Define the pipelines
#
# PCM0 ----> volume -----> SSP5 (pcm512x)
#
# Low Latency playback pipeline 1 on PCM 0 using max 2 channels of s32le.
# Schedule 48 frames per 1000us deadline on core 0 with priority 0
PIPELINE_PCM_ADD(sof/pipe-eq-volume-playback.m4,
1, 0, 2, s32le,
48, 1000, 0, 0)
#
# DAIs configuration
#
# playback DAI is SSP5 using 2 periods
# Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0
DAI_ADD(sof/pipe-dai-playback.m4,
1, SSP, 5, SSP5-Codec,
PIPELINE_SOURCE_1, 2, s24le,
48, 1000, 0, 0)
# PCM Low Latency, id 0
PCM_PLAYBACK_ADD(Port5, 0, PIPELINE_PCM_1)
#
# BE configurations - overrides config in ACPI if present
#
DAI_CONFIG(SSP, 5, 0, SSP5-Codec,
SSP_CONFIG(I2S, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
SSP_CLOCK(bclk, 3072000, codec_slave),
SSP_CLOCK(fsync, 48000, codec_slave),
SSP_TDM(2, 32, 3, 3),
SSP_CONFIG_DATA(SSP, 5, 24)))

View File

@ -0,0 +1,88 @@
# Low Latency Passthrough with volume Pipeline and PCM
#
# Pipeline Endpoints for connection are :-
#
# host PCM_P --> B0 --> EQ 0 --> B1 --> Volume 0 --> B2 --> sink DAI0
# Include topology builder
include(`utils.m4')
include(`buffer.m4')
include(`pcm.m4')
include(`pga.m4')
include(`dai.m4')
include(`mixercontrol.m4')
include(`bytecontrol.m4')
include(`pipeline.m4')
include(`eq.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 -90dB to +6dB for 3dB, vtlv_m90s3),
Channel register and shift for Front Left/Right,
LIST(` ', KCONTROL_CHANNEL(FL, 1, 0), KCONTROL_CHANNEL(FR, 1, 1)))
# EQ Bytes control with max value of 255
C_CONTROLBYTES(EQ, 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(, 10))
#
# Components and Buffers
#
# Host "Passthrough Playback" PCM
# with 2 sink and 0 source periods
W_PCM_PLAYBACK(PCM_ID, Passthrough Playback, 2, 0, 2)
# "Volume" has 2 source and 2 sink periods
W_PGA(0, PIPELINE_FORMAT, 2, 2, 2, LIST(` ', "Master Playback Volume PIPELINE_ID"))
# "EQ 0" has 2 sink period and 2 source periods
W_EQ(0, PIPELINE_FORMAT, 2, 2, 2, LIST(` ', "EQ"))
# Playback Buffers
W_BUFFER(0, COMP_BUFFER_SIZE(2,
COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, SCHEDULE_FRAMES),
PLATFORM_HOST_MEM_CAP)
W_BUFFER(1, COMP_BUFFER_SIZE(2,
COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, SCHEDULE_FRAMES),
PLATFORM_HOST_MEM_CAP)
W_BUFFER(2, COMP_BUFFER_SIZE(2,
COMP_SAMPLE_SIZE(DAI_FORMAT), PIPELINE_CHANNELS, SCHEDULE_FRAMES),
PLATFORM_DAI_MEM_CAP)
#
# Pipeline Graph
#
# host PCM_P --> B0 --> EQ 0 --> B1 --> Volume 0 --> B2 --> sink DAI0
P_GRAPH(pipe-pass-vol-playback-PIPELINE_ID, PIPELINE_ID,
LIST(` ',
`dapm(N_PCMP(PCM_ID), Passthrough Playback PCM_ID)',
`dapm(N_BUFFER(0), N_PCMP(PCM_ID))',
`dapm(N_EQ(0), N_BUFFER(0))',
`dapm(N_BUFFER(1), N_EQ(0))',
`dapm(N_PGA(0), N_BUFFER(1))',
`dapm(N_BUFFER(2), N_PGA(0))'))
#
# Pipeline Source and Sinks
#
indir(`define', concat(`PIPELINE_SOURCE_', PIPELINE_ID), N_BUFFER(2))
indir(`define', concat(`PIPELINE_PCM_', PIPELINE_ID), Passthrough Playback PCM_ID)
#
# PCM Configuration
#
PCM_CAPABILITIES(Passthrough Playback PCM_ID, `S32_LE,S24_LE,S16_LE', 48000, 48000, 2, 8, 2, 16, 192, 16384, 65536, 65536)

View File

@ -0,0 +1,74 @@
#
# Topology for pass through pipeline
#
# Include topology builder
include(`pipeline.m4')
include(`dai.m4')
include(`utils.m4')
# Include TLV library
include(`common/tlv.m4')
# Include Token library
include(`sof/tokens.m4')
# Include Baytrail DSP configuration
include(`dsps/byt.m4')
#
# Machine Specific Config - !! MUST BE SET TO MATCH TEST MACHINE DRIVER !!
#
# TEST_PIPE_NAME - Pipe name
# TEST_DAI_LINK_NAME - BE DAI link name e.g. "NoCodec"
# TEST_SSP_PORT - SSP port number e.g. 2
# TEST_SSP_FORMAT - SSP data format e.g s16le
# TEST_PIPE_FORMAT - Pipeline format e.g. s16le
# TEST_SSP_MCLK - SSP MCLK in Hz
# TEST_SSP_BCLK - SSP BCLK in Hz
# TEST_SSP_PHY_BITS - SSP physical slot size
# TEST_SSP_DATA_BITS - SSP data slot size
#
#
# Define the pipeline
#
# PCM0 <---> SSP TEST_SSP_PORT
#
# Passthrough playback pipeline 1 on PCM 0 using max 2 channels of s24le.
# Schedule 48 frames per 1000us deadline on core 0 with priority 0
# Use DMAC 0 channel 1 for PCM audio playback data
PIPELINE_PCM_DAI_ADD(sof/pipe-TEST_PIPE_NAME-playback.m4,
1, 0, 2, TEST_PIPE_FORMAT,
48, 1000, 0, 0, 0, 1,
SSP, TEST_SSP_PORT, TEST_SSP_FORMAT, 2)
#
# DAI configuration
#
# SSP port TEST_SSP_PORT is our only pipeline DAI
#
# playback DAI is SSP TEST_SSP_PORT using 2 periods
# Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0
DAI_ADD(sof/pipe-dai-playback.m4,
1, SSP, TEST_SSP_PORT, TEST_DAI_LINK_NAME,
PIPELINE_SOURCE_1, 2, TEST_SSP_FORMAT,
48, 1000, 0, 0)
# PCM Passthrough
PCM_PLAYBACK_ADD(Passthrough, 3, 0, 0, PIPELINE_PCM_1)
#
# BE configurations - overrides config in ACPI if present
#
# Clocks masters wrt codec
#
# TEST_SSP_DATA_BITS bit I2S using TEST_SSP_PHY_BITS bit sample conatiner on SSP TEST_SSP_PORT
#
DAI_CONFIG(SSP, TEST_SSP_PORT, TEST_DAI_LINK_NAME, I2S, TEST_SSP_DATA_BITS,
DAI_CLOCK(mclk, TEST_SSP_MCLK, slave),
DAI_CLOCK(bclk, TEST_SSP_BCLK, slave),
DAI_CLOCK(fsync, 48000, slave),
DAI_TDM(2, TEST_SSP_PHY_BITS, 3, 3))