Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
CONFIG_CAVS_LPS=y
CONFIG_COMP_IIR=y
CONFIG_COMP_CODEC_ADAPTER=y
CONFIG_DTS_CODEC=y
1 change: 1 addition & 0 deletions tools/topology/topology1/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ set(TPLGS
"sof-tgl-max98373-rt5682\;sof-tgl-rt5682-ssp0-max98373-ssp2-xperi\;-DAMP_SSP=2\;-DINCLUDE_IIR_EQ=1"
"sof-adl-nau8825\;sof-adl-nau8825\;-DNO_AMP\;-DBT_OFFLOAD"
"sof-adl-nau8825\;sof-adl-max98373-nau8825\;-DAMP_SSP=1\;-DSMART_AMP\;-DBT_OFFLOAD"
"sof-adl-nau8825\;sof-adl-max98373-nau8825-dts\;-DAMP_SSP=1\;-DSMART_AMP\;-DBT_OFFLOAD\;-DDTS=`DTS'"
"sof-adl-nau8825\;sof-adl-max98360a-nau8825\;-DAMP_SSP=1\;-DBT_OFFLOAD"
"sof-adl-nau8825\;sof-adl-rt1019-nau8825\;-DAMP_SSP=2"
"sof-tgl-sdw-max98373-rt5682\;sof-tgl-sdw-max98373-rt5682\;-DCHANNELS=4\;-DPLATFORM=tgl"
Expand Down
64 changes: 64 additions & 0 deletions tools/topology/topology1/m4/dts_codec_adapter.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@


# DTS codec setup config
define(`CA_SETUP_CONTROLBYTES',
`` bytes "0x53,0x4f,0x46,0x00,0x00,0x00,0x00,0x00,'
` 0x14,0x00,0x00,0x00,0x00,0x10,0x00,0x03,'
` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'
` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'
` 0x00,0x01,0x41,0x57,0x00,0x00,0x00,0x00,'
` 0x80,0xbb,0x00,0x00,0x20,0x00,0x00,0x00,'
` 0x02,0x00,0x00,0x00"''
)
define(`CA_SETUP_CONTROLBYTES_MAX', 8192)
define(`CA_SETUP_CONTROLBYTES_NAME', `DTS Codec Setup ')

define(`CA_RUNTIME_CONTROLBYTES',
`` bytes "0x53,0x4f,0x46,0x00,0x01,0x00,0x00,0x00,'
` 0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x03,'
` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'
` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00"''
)
define(`CA_RUNTIME_CONTROLBYTES_MAX', 8192)
define(`CA_RUNTIME_CONTROLBYTES_NAME', `DTS Codec Runtime ')

define(`CA_SCHEDULE_CORE', 0)

DECLARE_SOF_RT_UUID("DTS codec", dts_uuid, 0xd95fc34f, 0x370f, 0x4ac7, 0xbc, 0x86, 0xbf, 0xdc, 0x5b, 0xe2, 0x41, 0xe6)
define(`CA_UUID', dts_uuid)


include(`codec_adapter.m4')


define(CA_SETUP_CONFIG, concat(`ca_setup_config_', PIPELINE_ID))
define(CA_SETUP_CONTROLBYTES_NAME_PIPE, concat(CA_SETUP_CONTROLBYTES_NAME, PIPELINE_ID))


# Codec adapter setup config
CONTROLBYTES_PRIV(CA_SETUP_CONFIG, CA_SETUP_CONTROLBYTES)

# Codec adapter Bytes control for setup config
C_CONTROLBYTES(CA_SETUP_CONTROLBYTES_NAME_PIPE, PIPELINE_ID,
CONTROLBYTES_OPS(bytes),
CONTROLBYTES_EXTOPS(void, 258, 258),
, , ,
CONTROLBYTES_MAX(void, CA_SETUP_CONTROLBYTES_MAX),
,
CA_SETUP_CONFIG)

define(CA_RUNTIME_PARAMS, concat(`ca_runtime_params_', PIPELINE_ID))
define(CA_RUNTIME_CONTROLBYTES_NAME_PIPE, concat(CA_RUNTIME_CONTROLBYTES_NAME, PIPELINE_ID))

# Codec adapter runtime params
CONTROLBYTES_PRIV(CA_RUNTIME_PARAMS, CA_RUNTIME_CONTROLBYTES)

# Codec adapter Bytes control for runtime config
C_CONTROLBYTES(CA_RUNTIME_CONTROLBYTES_NAME_PIPE, PIPELINE_ID,
CONTROLBYTES_OPS(bytes),
CONTROLBYTES_EXTOPS(void, 258, 258),
, , ,
CONTROLBYTES_MAX(void, CA_RUNTIME_CONTROLBYTES_MAX),
,
CA_RUNTIME_PARAMS)

7 changes: 5 additions & 2 deletions tools/topology/topology1/sof-adl-nau8825.m4
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ define(`SMART_PCM_ID', 0)
define(`SMART_PCM_NAME', `smart373-spk')

# Include Smart Amplifier support
include(`sof-smart-amplifier.m4')')')
ifdef(`DTS',`
include(`sof-eq-iir-dts-codec-smart-amplifier.m4')',`
include(`sof-smart-amplifier.m4')')')')

# Define pipeline id for intel-generic-dmic-kwd.m4
# to generate dmic setting with kwd when we have dmic
Expand Down Expand Up @@ -173,7 +175,8 @@ PIPELINE_PCM_ADD(sof/pipe-volume-demux-playback.m4,

# Low Latency playback pipeline 2 on PCM 1 using max 2 channels of s32le.
# Schedule 48 frames per 1000us deadline with priority 0 on core 0
PIPELINE_PCM_ADD(sof/pipe-volume-playback.m4,
PIPELINE_PCM_ADD(
ifdef(`DTS', sof/pipe-eq-iir-dts-codec-playback.m4, sof/pipe-volume-playback.m4),
2, 1, 2, s32le,
1000, 0, 0,
48000, 48000, 48000)
Expand Down
231 changes: 231 additions & 0 deletions tools/topology/topology1/sof-eq-iir-dts-codec-smart-amplifier.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
#
# Unified topology for smart amplifier implementation.
#

# Include topology builder
include(`utils.m4')
include(`dai.m4')
include(`pipeline.m4')

ifelse(SDW, `1',
`include(`alh.m4')',
`include(`ssp.m4')')

# Include Token library
include(`sof/tokens.m4')

DEBUG_START

# define the default macros.
# define them in your specific platform .m4 if needed.


ifelse(SDW, `1',
`
# ALH related
# define(`SMART_ALH_INDEX', 1) define smart amplifier ALH index
ifdef(`SMART_ALH_INDEX',`',`errprint(note: Need to define ALH index for sof-smart-amplifier
)')
ifdef(`SMART_ALH_PLAYBACK_NAME',`',`errprint(note: Need to define ALH BE dai_link name for sof-smart-amplifier
)')
ifdef(`SMART_ALH_CAPTURE_NAME',`',`errprint(note: Need to define ALH BE dai_link name for sof-smart-amplifier
)')
',
`
# SSP related
# define(`SMART_SSP_INDEX', 1) define smart amplifier SSP index
ifdef(`SMART_SSP_INDEX',`',`errprint(note: Need to define SSP index for sof-smart-amplifier
)')
# define(`SMART_SSP_NAME', `SSP1-Codec') define SSP BE dai_link name
ifdef(`SMART_SSP_NAME',`',`errprint(note: Need to define SSP BE dai_link name for sof-smart-amplifier
)')
# define(`SMART_SSP_QUIRK', 0) define SSP quirk for special use, e.g. set SSP_QUIRK_LBM to verify
# smart_amp nocodec mode. Set it to 0 by default for normal mode.
ifdef(`SMART_SSP_QUIRK',`',`define(`SMART_SSP_QUIRK', 0)')
# define(`SSP_MCLK', ) define SSP mclk if not done yet
ifdef(`SSP_MCLK',`',`define(`SSP_MCLK', 19200000)')
')

# define(`SMART_BE_ID', 7) define BE dai_link ID
ifdef(`SMART_BE_ID',`',`errprint(note: Need to define SSP BE dai_link ID for sof-smart-amplifier
)')
# Playback related
# define(`SMART_PB_PPL_ID', 1)
ifdef(`SMART_PB_PPL_ID',`',`errprint(note: Need to define playback pipeline ID for sof-smart-amplifier
)')
# define(`SMART_PB_CH_NUM', 2)
ifdef(`SMART_PB_CH_NUM',`',`errprint(note: Need to define playback channel number for sof-smart-amplifier
)')
define(`SMART_PIPE_SOURCE', concat(`PIPELINE_SOURCE_', SMART_PB_PPL_ID))
# define(`SMART_TX_CHANNELS', 4)
ifdef(`SMART_TX_CHANNELS',`',`errprint(note: Need to define DAI TX channel number for sof-smart-amplifier
)')
# define(`SMART_RX_CHANNELS', 8)
ifdef(`SMART_RX_CHANNELS',`',`errprint(note: Need to define DAI RX channel number for sof-smart-amplifier
)')
# define(`SMART_FB_CHANNELS', 4)
ifdef(`SMART_FB_CHANNELS',`',`errprint(note: Need to define feedback channel number for sof-smart-amplifier
)')
define(`SMART_PB_PPL_NAME', concat(`PIPELINE_PCM_', SMART_PB_PPL_ID))
# Ref capture related
# define(`SMART_REF_PPL_ID', 11)
ifdef(`SMART_REF_PPL_ID',`',`errprint(note: Need to define Echo Ref pipeline ID for sof-smart-amplifier
)')
# define(`SMART_REF_CH_NUM', 4)
ifdef(`SMART_REF_CH_NUM',`',`errprint(note: Need to define Echo Ref channel number for sof-smart-amplifier
)')
define(`SMART_PIPE_SINK', concat(`PIPELINE_SINK_', SMART_REF_PPL_ID))
# define(`N_SMART_DEMUX', `MUXDEMUX'SMART_REF_PPL_ID`.'$1)
define(`SMART_REF_PPL_NAME', concat(`PIPELINE_PCM_', SMART_REF_PPL_ID))
# PCM related
# define(`SMART_PCM_ID', 0)
ifdef(`SMART_PCM_ID',`',`errprint(note: Need to define PCM ID for sof-smart-amplifier
)')
# define(`SMART_PCM_NAME', `smart373-spk')
ifdef(`SMART_PCM_NAME',`',`errprint(note: Need to define Echo Ref pipeline ID for sof-smart-amplifier
)')

ifelse(SDW, `1',
`
#
# Define the pipelines
#
# PCM2 ----> smart_amp ----> ALH(ALH_INDEX)
# ^
# |
# |
# PCM3 <---- demux <----- ALH(ALH_INDEX + 1)
#
'
,`
#
# Define the pipelines
#
# PCM0 ----> smart_amp ----> SSP(SSP_INDEX)
# ^
# |
# |
# PCM0 <---- demux <----- SSP(SSP_INDEX)
#
')

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)

# Demux pipeline 1 on PCM 0 using max 2 channels of s32le.
# Set 1000us deadline on core 0 with priority 0
PIPELINE_PCM_ADD(sof/pipe-eq-iir-dts-codec-smart-amp-playback.m4,
SMART_PB_PPL_ID, SMART_PCM_ID, SMART_PB_CH_NUM, s32le,
1000, 0, 0,
48000, 48000, 48000)

# Low Latency capture pipeline 2 on PCM 0 using max 2 channels of s32le.
# Set 1000us deadline on core 0 with priority 0
ifelse(SDW, `1',
`
PIPELINE_PCM_ADD(sof/pipe-amp-ref-capture.m4,
SMART_REF_PPL_ID, eval(SMART_PCM_ID + 1), SMART_REF_CH_NUM, s32le,
1000, 0, 0,
48000, 48000, 48000)
',
`
PIPELINE_PCM_ADD(sof/pipe-amp-ref-capture.m4,
SMART_REF_PPL_ID, SMART_PCM_ID, SMART_REF_CH_NUM, s32le,
1000, 0, 0,
48000, 48000, 48000)
')

#
# DAIs configuration
#

dnl DAI_ADD(pipeline,
dnl pipe id, dai type, dai_index, dai_be,
dnl buffer, periods, format,
dnl deadline, priority, core, time_domain)

ifelse(SDW, `1',
`
# playback DAI is ALH(ALH_INDEX) using 2 periods
# Buffers use s32le format, 1000us deadline on core 0 with priority 0
DAI_ADD(sof/pipe-dai-playback.m4,
SMART_PB_PPL_ID, ALH, SMART_ALH_INDEX, SMART_ALH_PLAYBACK_NAME,
SMART_PIPE_SOURCE, 2, s24le,
1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER)

# capture DAI is ALH(ALH_INDEX) using 2 periods
# Buffers use s32le format, 1000us deadline on core 0 with priority 0
DAI_ADD(sof/pipe-dai-capture.m4,
SMART_REF_PPL_ID, ALH, eval(SMART_ALH_INDEX + 1), SMART_ALH_CAPTURE_NAME,
SMART_PIPE_SINK, 2, s24le,
1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER)
',
`
# playback DAI is SSP(SPP_INDEX) using 2 periods
# Buffers use s32le format, 1000us deadline on core 0 with priority 0
DAI_ADD(sof/pipe-dai-playback.m4,
SMART_PB_PPL_ID, SSP, SMART_SSP_INDEX, SMART_SSP_NAME,
SMART_PIPE_SOURCE, 2, s32le,
1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER)

# capture DAI is SSP(SSP_INDEX) using 2 periods
# Buffers use s32le format, 1000us deadline on core 0 with priority 0
DAI_ADD(sof/pipe-dai-capture.m4,
SMART_REF_PPL_ID, SSP, SMART_SSP_INDEX, SMART_SSP_NAME,
SMART_PIPE_SINK, 2, s32le,
1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER)
')

# Connect demux to smart_amp
ifdef(`N_SMART_REF_BUF',`',`errprint(note: Need to define ref buffer name for connection
)')
ifdef(`N_SMART_DEMUX',`',`errprint(note: Need to define demux widget name for connection
)')
SectionGraph."PIPE_SMART_AMP" {
index "0"

lines [
# demux to smart_amp
dapm(N_SMART_REF_BUF, N_SMART_DEMUX)
]
}

# PCM for SMART_AMP Playback and EchoRef.
ifelse(SDW, `1',
`
PCM_PLAYBACK_ADD(SMART_PCM_NAME, SMART_PCM_ID, SMART_PB_PPL_NAME)
PCM_CAPTURE_ADD(echo, eval(SMART_PCM_ID + 1), SMART_REF_PPL_NAME)
',
`
dnl PCM_DUPLEX_ADD(name, pcm_id, playback, capture)
PCM_DUPLEX_ADD(SMART_PCM_NAME, SMART_PCM_ID, SMART_PB_PPL_NAME, SMART_REF_PPL_NAME)
')

#
# BE configurations - overrides config in ACPI if present
#

ifelse(SDW, `1',
`
#ALH ALH Pin2 (ID: SMART_BE_ID)
DAI_CONFIG(ALH, SMART_ALH_INDEX, SMART_BE_ID, SMART_ALH_PLAYBACK_NAME,
ALH_CONFIG(ALH_CONFIG_DATA(ALH, SMART_ALH_INDEX, 48000, SMART_TX_CHANNELS)))

#ALH ALH Pin3 (ID: SMART_BE_ID + 1)
DAI_CONFIG(ALH, eval(SMART_ALH_INDEX + 1), eval(SMART_BE_ID + 1), SMART_ALH_CAPTURE_NAME,
ALH_CONFIG(ALH_CONFIG_DATA(ALH, eval(SMART_ALH_INDEX + 1), 48000, SMART_RX_CHANNELS)))
',
`
#SSP SSP_INDEX (ID: SMART_BE_ID)
DAI_CONFIG(SSP, SMART_SSP_INDEX, SMART_BE_ID, SMART_SSP_NAME,
SSP_CONFIG(DSP_B, SSP_CLOCK(mclk, SSP_MCLK, codec_mclk_in),
SSP_CLOCK(bclk, 12288000, codec_slave),
SSP_CLOCK(fsync, 48000, codec_slave),
SSP_TDM(8, 32, 15, 255),
SSP_CONFIG_DATA(SSP, SMART_SSP_INDEX, 32, 0, SMART_SSP_QUIRK)))
')

DEBUG_END
Loading