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
18 changes: 18 additions & 0 deletions tools/topology/m4/eq_iir_coef_highpass_50hz_20db_16khz.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 50 Hz second order high-pass and +20 dB gain 13-Aug-2019
CONTROLBYTES_PRIV(EQIIR_HP50HZ20dB16K_priv,
` bytes "0x53,0x4f,0x46,0x00,0x00,0x00,0x00,0x00,'
` 0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x03,'
` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'
` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'
` 0x58,0x00,0x00,0x00,0x02,0x00,0x00,0x00,'
` 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'
` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'
` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'
` 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,'
` 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'
` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'
` 0x00,0x00,0x00,0x00,0x57,0xb1,0xc0,0xc1,'
` 0xd2,0x13,0x39,0x7e,0x45,0x3b,0xa2,0x1f,'
` 0x76,0x89,0xbb,0xc0,0x45,0x3b,0xa2,0x1f,'
` 0xfc,0xff,0xff,0xff,0xd0,0x4f,0x00,0x00"'
)
2 changes: 1 addition & 1 deletion tools/topology/m4/eq_iir_coef_highpass_50hz_20db_48khz.m4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# 50 Hz second order high-pass and +20 dB gain 18-Dec-2018
CONTROLBYTES_PRIV(EQIIR_priv,
CONTROLBYTES_PRIV(EQIIR_HP50HZ20dB48K_priv,
` bytes "0x53,0x4f,0x46,0x00,0x00,0x00,0x00,0x00,'
` 0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x03,'
` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'
Expand Down
10 changes: 6 additions & 4 deletions tools/topology/platform/intel/intel-generic-dmic.m4
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ dnl pcm_min_rate, pcm_max_rate, pipeline_rate,
dnl time_domain, sched_comp)

# Passthrough capture pipeline using max channels defined by CHANNELS.

# Set 1000us deadline on core 0 with priority 0
PIPELINE_PCM_ADD(sof/pipe-volume-capture.m4,
PIPELINE_PCM_ADD(sof/pipe-eq-capture.m4,
DMIC_PIPELINE_48k_ID, DMIC_DAI_LINK_48k_ID, CHANNELS, s32le,
1000, 0, 0, 48000, 48000, 48000)

# Passthrough capture pipeline using max channels defined by CHANNELS.

# Schedule with 1000us deadline on core 0 with priority 0
PIPELINE_PCM_ADD(sof/pipe-volume-capture-16khz.m4,
PIPELINE_PCM_ADD(sof/pipe-eq-capture-16khz.m4,
DMIC_PIPELINE_16k_ID, DMIC_DAI_LINK_16k_ID, CHANNELS, s32le,
1000, 0, 0, 16000, 16000, 16000)

Expand Down Expand Up @@ -66,11 +68,11 @@ dnl DAI_CONFIG(type, dai_index, link_id, name, ssp_config/dmic_config)
ifelse(CHANNELS, 4,
`DAI_CONFIG(DMIC, 0, DMIC_DAI_LINK_48k_ID, dmic01,
DMIC_CONFIG(1, 500000, 4800000, 40, 60, 48000,
DMIC_WORD_LENGTH(s32le), 400, DMIC, 0,
DMIC_WORD_LENGTH(s32le), 200, DMIC, 0,
PDM_CONFIG(DMIC, 0, FOUR_CH_PDM0_PDM1)))',
`DAI_CONFIG(DMIC, 0, DMIC_DAI_LINK_48k_ID, dmic01,
DMIC_CONFIG(1, 500000, 4800000, 40, 60, 48000,
DMIC_WORD_LENGTH(s32le), 400, DMIC, 0,
DMIC_WORD_LENGTH(s32le), 200, DMIC, 0,
PDM_CONFIG(DMIC, 0, STEREO_PDM0)))')

ifelse(CHANNELS, 4,
Expand Down
108 changes: 108 additions & 0 deletions tools/topology/sof/pipe-eq-capture-16khz.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Capture EQ Pipeline and PCM, 16 kHz

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the reason this is fixed to 16kHz simply because that is what the tuning parameters were set for?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's Intel FW legacy to setup the DAI for 48 kHz and 16 kHz configurations and we are following it. The 16 kHz is a typical sample rate for automatic speech recognition. Though in SOF case it could be a different rate to match needs.

#
# Pipeline Endpoints for connection are :-
#
# host PCM_C <-- B0 <-- Volume 0 <-- B1 <--EQ_IIR 0 <-- B2 <-- sink DAI0

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

#
# Controls
#

# Volume Mixer control with max value of 32
C_CONTROLMIXER(Master Capture Volume, PIPELINE_ID,
CONTROLMIXER_OPS(volsw,
256 binds the mixer control to volume get/put handlers,
256, 256),
CONTROLMIXER_MAX(, 70),
false,
CONTROLMIXER_TLV(TLV 80 steps from -50dB to +20dB for 1dB, vtlv_m50s1),
Channel register and shift for Front Left/Right,
LIST(` ', KCONTROL_CHANNEL(FL, 1, 0), KCONTROL_CHANNEL(FR, 1, 1)))

# Volume Configuration
W_VENDORTUPLES(capture_pga_tokens, sof_volume_tokens,
LIST(` ', `SOF_TKN_VOLUME_RAMP_STEP_TYPE "0"'
` ', `SOF_TKN_VOLUME_RAMP_STEP_MS "250"'))

W_DATA(capture_pga_conf, capture_pga_tokens)

# Use 50 Hz highpass response with +20 dB gain
include(`eq_iir_coef_highpass_50hz_20db_16khz.m4')

# EQ Bytes control with max value of 255
C_CONTROLBYTES(EQIIR_C16, 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(, 304),
,
EQIIR_HP50HZ20dB16K_priv)

#
# Components and Buffers
#

# Host "Highpass Capture" PCM
# with 0 sink and 2 source periods
W_PCM_CAPTURE(PCM_ID, Highpass Capture, 0, 2)

# "Volume" has 2 source and 2 sink periods
W_PGA(0, PIPELINE_FORMAT, 2, 2,
capture_pga_conf, LIST(` ',
"PIPELINE_ID Master Capture Volume"))

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

# Capture Buffers
W_BUFFER(0, COMP_BUFFER_SIZE(2,
COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS,
eval(PCM_MAX_RATE / SCHEDULE_PERIOD)), PLATFORM_PASS_MEM_CAP)

W_BUFFER(1, COMP_BUFFER_SIZE(2,
COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS,
eval(PCM_MAX_RATE / SCHEDULE_PERIOD)), PLATFORM_PASS_MEM_CAP)

W_BUFFER(2, COMP_BUFFER_SIZE(2,
COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS,
eval(PCM_MAX_RATE / SCHEDULE_PERIOD)), PLATFORM_PASS_MEM_CAP)

#
# Pipeline Graph
#
# host PCM_C <-- B0 <-- Volume 0 <-- B1 <--EQ_IIR 0 <-- B2 <-- sink DAI0

P_GRAPH(pipe-pass-capture-PIPELINE_ID, PIPELINE_ID,
LIST(` ',
`dapm(N_PCMC(PCM_ID), N_BUFFER(0))',
`dapm(N_BUFFER(0), N_PGA(0))',
`dapm(N_PGA(0), N_BUFFER(1))',
`dapm(N_BUFFER(1), N_EQ_IIR(0))',
`dapm(N_EQ_IIR(0), N_BUFFER(2))'))

#
# Pipeline Source and Sinks
#
indir(`define', concat(`PIPELINE_SINK_', PIPELINE_ID), N_BUFFER(2))
indir(`define', concat(`PIPELINE_PCM_', PIPELINE_ID), Highpass Capture PCM_ID)

#
# PCM Configuration
#

PCM_CAPABILITIES(Highpass Capture PCM_ID, `S32_LE,S24_LE,S16_LE', 16000, 16000,
PIPELINE_CHANNELS, PIPELINE_CHANNELS, 2, 16, 192, 16384, 65536, 65536)
69 changes: 53 additions & 16 deletions tools/topology/sof/pipe-eq-capture.m4
Original file line number Diff line number Diff line change
@@ -1,33 +1,57 @@
# Capture EQ Pipeline and PCM
# Capture EQ Pipeline and PCM, 48 kHz
#
# Pipeline Endpoints for connection are :-
#
# host PCM_C <--- B1 <--- EQ_IIR 0 <-- B0 <-- sink DAI0
# host PCM_C <-- B0 <-- Volume 0 <-- B1 <--EQ_IIR 0 <-- B2 <-- sink DAI0

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

#
# Controls
#

# Volume Mixer control with max value of 32
C_CONTROLMIXER(Master Capture Volume, PIPELINE_ID,
CONTROLMIXER_OPS(volsw,
256 binds the mixer control to volume get/put handlers,
256, 256),
CONTROLMIXER_MAX(, 70),
false,
CONTROLMIXER_TLV(TLV 80 steps from -50dB to +20dB for 1dB, vtlv_m50s1),
Channel register and shift for Front Left/Right,
LIST(` ', KCONTROL_CHANNEL(FL, 1, 0), KCONTROL_CHANNEL(FR, 1, 1)))

# Volume Configuration
W_VENDORTUPLES(capture_pga_tokens, sof_volume_tokens,
LIST(` ', `SOF_TKN_VOLUME_RAMP_STEP_TYPE "0"'
` ', `SOF_TKN_VOLUME_RAMP_STEP_MS "250"'))

W_DATA(capture_pga_conf, capture_pga_tokens)

# Use 50 Hz highpass response with +20 dB gain
include(`eq_iir_coef_highpass_50hz_20db_48khz.m4')

# EQ Bytes control with max value of 255
C_CONTROLBYTES(EQIIR, 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),
C_CONTROLBYTES(EQIIR_C48, 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(, 304),
,
EQIIR_priv)
EQIIR_HP50HZ20dB48K_priv)

#
# Components and Buffers
Expand All @@ -37,37 +61,50 @@ C_CONTROLBYTES(EQIIR, PIPELINE_ID,
# with 0 sink and 2 source periods
W_PCM_CAPTURE(PCM_ID, Highpass Capture, 0, 2)

# "Volume" has 2 source and 2 sink periods
W_PGA(0, PIPELINE_FORMAT, 2, 2,
capture_pga_conf, LIST(` ',
"PIPELINE_ID Master Capture Volume"))

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

# Capture Buffers
W_BUFFER(0, COMP_BUFFER_SIZE(2,
COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, eval(PCM_MAX_RATE / SCHEDULE_PERIOD)),
PLATFORM_PASS_MEM_CAP)
COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS,
eval(PCM_MAX_RATE / SCHEDULE_PERIOD)), PLATFORM_PASS_MEM_CAP)

W_BUFFER(1, COMP_BUFFER_SIZE(2,
COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, eval(PCM_MAX_RATE / SCHEDULE_PERIOD)),
PLATFORM_PASS_MEM_CAP)
COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS,
eval(PCM_MAX_RATE / SCHEDULE_PERIOD)), PLATFORM_PASS_MEM_CAP)

W_BUFFER(2, COMP_BUFFER_SIZE(2,
COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS,
eval(PCM_MAX_RATE / SCHEDULE_PERIOD)), PLATFORM_PASS_MEM_CAP)

#
# Pipeline Graph
#
# host PCM_C <--- B1 <--- EQ_IIR 0 <-- B0 <-- sink DAI0
# host PCM_C <-- B0 <-- Volume 0 <-- B1 <--EQ_IIR 0 <-- B2 <-- sink DAI0

P_GRAPH(pipe-pass-capture-PIPELINE_ID, PIPELINE_ID,
LIST(` ',
`dapm(N_PCMC(PCM_ID), N_BUFFER(1))',
`dapm(N_PCMC(PCM_ID), N_BUFFER(0))',
`dapm(N_BUFFER(0), N_PGA(0))',
`dapm(N_PGA(0), N_BUFFER(1))',
`dapm(N_BUFFER(1), N_EQ_IIR(0))',
`dapm(N_EQ_IIR(0), N_BUFFER(0))'))
`dapm(N_EQ_IIR(0), N_BUFFER(2))'))

#
# Pipeline Source and Sinks
#
indir(`define', concat(`PIPELINE_SINK_', PIPELINE_ID), N_BUFFER(0))
indir(`define', concat(`PIPELINE_SINK_', PIPELINE_ID), N_BUFFER(2))
indir(`define', concat(`PIPELINE_PCM_', PIPELINE_ID), Highpass Capture PCM_ID)

#
# PCM Configuration
#

PCM_CAPABILITIES(Highpass Capture PCM_ID, `S32_LE,S24_LE,S16_LE', PCM_MIN_RATE, PCM_MAX_RATE, PIPELINE_CHANNELS, PIPELINE_CHANNELS, 2, 16, 192, 16384, 65536, 65536)
PCM_CAPABILITIES(Highpass Capture PCM_ID, `S32_LE,S24_LE,S16_LE', PCM_MIN_RATE,
PCM_MAX_RATE, PIPELINE_CHANNELS, PIPELINE_CHANNELS,
2, 16, 192, 16384, 65536, 65536)
4 changes: 3 additions & 1 deletion tools/topology/sof/pipe-volume-capture-16khz.m4
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,6 @@ indir(`define', concat(`PIPELINE_PCM_', PIPELINE_ID), Passthrough Capture PCM_ID
# PCM Configuration
#

PCM_CAPABILITIES(Passthrough Capture PCM_ID, `S32_LE,S24_LE,S16_LE', 16000, 16000, 2, PIPELINE_CHANNELS, 2, 16, 192, 16384, 65536, 65536)
PCM_CAPABILITIES(Passthrough Capture PCM_ID, `S32_LE,S24_LE,S16_LE',
16000, 16000, PIPELINE_CHANNELS, PIPELINE_CHANNELS,
2, 16, 192, 16384, 65536, 65536)
5 changes: 3 additions & 2 deletions tools/topology/sof/pipe-volume-capture.m4
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,6 @@ indir(`define', concat(`PIPELINE_PCM_', PIPELINE_ID), Passthrough Capture PCM_ID
# PCM Configuration
#

PCM_CAPABILITIES(Passthrough Capture PCM_ID, `S32_LE,S24_LE,S16_LE', PCM_MIN_RATE, PCM_MAX_RATE, 2, PIPELINE_CHANNELS, 2, 16, 192, 16384, 65536, 65536)

PCM_CAPABILITIES(Passthrough Capture PCM_ID, `S32_LE,S24_LE,S16_LE',
PCM_MIN_RATE, PCM_MAX_RATE, PIPELINE_CHANNELS, PIPELINE_CHANNELS,
2, 16, 192, 16384, 65536, 65536)
Loading