#
# Topology for i.MX8MP board with wm8904 codec
#
# Include topology builder
include(`utils.m4')
include(`dai.m4')
include(`pipeline.m4')
include(`sai.m4')
include(`pcm.m4')
include(`buffer.m4')
# Include TLV library
include(`common/tlv.m4')
# Include Token library
include(`sof/tokens.m4')
# Include DSP configuration
include(`platform/imx/imx8.m4')
#
# Define the pipelines
#
# PCM0 <----> volume <-----> SAI3 (wm8904)
#
dnl PIPELINE_PCM_ADD(pipeline,
dnl pipe id, pcm, max channels, format,
dnl period, priority, core,
dnl pcm_min_rate, pcm_max_rate, pipeline_rate,
dnl time_domain, sched_comp)
# Low Latency playback pipeline 1 on PCM 0 using max 2 channels of s32le.
# Set 1000us deadline with priority 0 on core 0
PIPELINE_PCM_ADD(sof/pipe-`PPROC'-playback-4test.m4,
1, 0, 2, s32le,
1000, 0, 0,
44100, 44100, 44100)
# Low Latency capture pipeline 2 on PCM 0 using max 2 channels of s32le.
# Set 1000us deadline with priority 0 on core 0
PIPELINE_PCM_ADD(sof/pipe-volume-capture.m4,
2, 0, 2, s32le,
1000, 0, 0,
44100, 44100, 44100)
#
# DAIs configuration
#
dnl DAI_ADD(pipeline,
dnl pipe id, dai type, dai_index, dai_be,
dnl buffer, periods, format,
dnl period, priority, core, time_domain)
# playback DAI is SAI3 using 2 periods
# Buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0
DAI_ADD(sof/pipe-dai-playback.m4,
1, SAI, 3, sai3-wm8904-hifi,
PIPELINE_SOURCE_1, 2, s32le,
1000, 0, 0, SCHEDULE_TIME_DOMAIN_DMA)
# capture DAI is SAI3 using 2 periods
# Buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0
DAI_ADD(sof/pipe-dai-capture.m4,
2, SAI, 3, sai3-wm8904-hifi,
PIPELINE_SINK_2, 2, s32le,
1000, 0, 0)
# PCM Low Latency, id 0
dnl PCM_DUPLEX_ADD(name, pcm_id, playback, capture)
PCM_DUPLEX_ADD(Port0, 0, PIPELINE_PCM_1, PIPELINE_PCM_2)
dnl DAI_CONFIG(type, idx, link_id, name, sai_config)
DAI_CONFIG(SAI, 3, 0, sai3-wm8904-hifi,
SAI_CONFIG(I2S, SAI_CLOCK(mclk, 11565177, codec_mclk_in),
SAI_CLOCK(bclk, 1411200, codec_provider),
SAI_CLOCK(fsync, 44100, codec_provider),
SAI_TDM(2, 32, 3, 3),
SAI_CONFIG_DATA(SAI, 3, 0)))
and this pipe-volume-playback-4test.m :
# Low Latency Passthrough with volume Pipeline and PCM
#
# Pipeline Endpoints for connection are :-
#
# host PCM_P --> B0 --> Volume 0 --> B1 --> 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') # ADDED
include(`pipeline.m4')
include(`amp.m4') # ADDED
#
# 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 "2"'
` ', `SOF_TKN_VOLUME_RAMP_STEP_MS "20"'))
W_DATA(DEF_PGA_CONF, DEF_PGA_TOKENS)
############### ADDED ###############
# Amp Parameters
include(`amp_bytes.m4')
# Amp Bytes control with max value of 140
# The max size needs to also take into account the space required to hold the control data IPC message
# struct sof_ipc_ctrl_data requires 92 bytes
# AMP priv in amp_bytes.m4 (ABI header (32 bytes) + 2 dwords) requires 40 bytes
# Therefore at least 132 bytes are required for this kcontrol
# Any value lower than that would end up in a topology load error
C_CONTROLBYTES(AMP, PIPELINE_ID,
CONTROLBYTES_OPS(bytes, 258 binds the control to bytes get/put handlers, 258, 258),
CONTROLBYTES_EXTOPS(258 binds the control to bytes get/put handlers, 258, 258),
, , ,
CONTROLBYTES_MAX(, 140),
,
AMP_priv)
#####################################
#
# Components and Buffers
#
# Host "Passthrough Playback" PCM
# with 2 sink and 0 source periods
W_PCM_PLAYBACK(PCM_ID, Passthrough Playback, 2, 0, SCHEDULE_CORE)
# "Volume" has 2 source and x sink periods
W_PGA(0, PIPELINE_FORMAT, DAI_PERIODS, 2, DEF_PGA_CONF, SCHEDULE_CORE,
LIST(` ', "PIPELINE_ID Master Playback Volume"))
############### ADDED ###############
# "Amp" has 2 sink periods and 2 source periods
W_AMP(0, PIPELINE_FORMAT, 2, 2, SCHEDULE_CORE,
LIST(` ', "AMP"))
#####################################
# Playback Buffers
W_BUFFER(0, COMP_BUFFER_SIZE(2,
COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)),
PLATFORM_HOST_MEM_CAP, SCHEDULE_CORE)
W_BUFFER(1, COMP_BUFFER_SIZE(DAI_PERIODS,
COMP_SAMPLE_SIZE(DAI_FORMAT), PIPELINE_CHANNELS, COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)),
PLATFORM_DAI_MEM_CAP, SCHEDULE_CORE)
############### ADDED ###############
# W_BUFFER(name, size, capabilities)
W_BUFFER(2, COMP_BUFFER_SIZE(2,
COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)),
PLATFORM_HOST_MEM_CAP)
#####################################
#
# Pipeline Graph
#
# host PCM_P --> B2 --> Amp -> B0 --> Volume 0 --> B1 --> sink DAI0
P_GRAPH(pipe-volume-playback-4test, PIPELINE_ID,
LIST(` ',
`dapm(N_BUFFER(2), N_PCMP(PCM_ID))',
`dapm(N_AMP(0), N_BUFFER(2))',
`dapm(N_BUFFER(0), N_AMP(0))',
`dapm(N_PGA(0), N_BUFFER(0))',
`dapm(N_BUFFER(1), N_PGA(0))'))
#
# Pipeline Source and Sinks
#
indir(`define', concat(`PIPELINE_SOURCE_', PIPELINE_ID), N_BUFFER(1))
indir(`define', concat(`PIPELINE_PCM_', PIPELINE_ID), Passthrough Playback PCM_ID)
ifdef(`CHANNELS_MIN',`define(`LOCAL_CHANNELS_MIN', `CHANNELS_MIN')',
`define(`LOCAL_CHANNELS_MIN', `2')')
#
# PCM Configuration
#
PCM_CAPABILITIES(Passthrough Playback PCM_ID, CAPABILITY_FORMAT_NAME(PIPELINE_FORMAT), PCM_MIN_RATE, PCM_MAX_RATE, LOCAL_CHANNELS_MIN, PIPELINE_CHANNELS, 2, 16, 192, 16384, 65536, 65536)
undefine(`LOCAL_CHANNELS_MIN')
undefine(`DEF_PGA_TOKENS')
undefine(`DEF_PGA_CONF')
Could you explain me if this function COMP_GET_IPC(dev, sof_ipc_comp_process) is still needed? , Sorry if my questions are too basic.
How could i test this firmware from the tutorial ?
Hello, I follow the tutorial , I modify a little the file amp.c taking into count the switch.c and volume.c , The files compiles.
The code amp.c is:
I used the next topology file from here :
and this pipe-volume-playback-4test.m :
Could you explain me if this function COMP_GET_IPC(dev, sof_ipc_comp_process) is still needed? , Sorry if my questions are too basic. How could i test this firmware from the tutorial ?
Thanks in advanced