Skip to content
This repository was archived by the owner on Jan 17, 2019. It is now read-only.

Commit 57b5212

Browse files
authored
Merge pull request #68 from juimonen/eq_test
[RFC] generic effect type with fir and iir eq
2 parents 15030d4 + 6b56daf commit 57b5212

10 files changed

Lines changed: 628 additions & 2 deletions

topology/Makefile.am

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ MACHINES = \
3535
sof-apl-wm8804.tplg \
3636
sof-apl-da7219.tplg \
3737
sof-glk-da7219.tplg \
38-
sof-icl-nocodec.tplg
38+
sof-icl-nocodec.tplg \
39+
sof-apl-eq-pcm512x.tplg
3940

4041
# Uncomment the following line if you want to debug conf files
4142
.PRECIOUS: %.conf
@@ -71,4 +72,5 @@ EXTRA_DIST = \
7172
sof-apl-wm8804.m4 \
7273
sof-apl-da7219.m4 \
7374
sof-glk-da7219.m4 \
74-
sof-icl-nocodec.m4
75+
sof-icl-nocodec.m4 \
76+
sof-apl-eq-pcm512x.m4

topology/m4/bytecontrol.m4

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
divert(-1)
2+
3+
dnl Define macro for byte control
4+
5+
dnl CONTROLBYTES_MAX(comment, value)
6+
define(`CONTROLBYTES_MAX',
7+
`#$1'
8+
` max STR($2)')
9+
10+
dnl CONTROLMIXER_TLV(comment, value)
11+
define(`CONTROLBYTES_TLV',
12+
`#$1'
13+
` tlv STR($2)')
14+
15+
dnl CONTROLMIXER_OPS(info, comment, get, put)
16+
define(`CONTROLBYTES_OPS',
17+
`ops."ctl" {'
18+
` info STR($1)'
19+
` #$2'
20+
` }')
21+
22+
dnl CONTROLMIXER_OPS(info, comment, get, put)
23+
define(`CONTROLBYTES_EXTOPS',
24+
`extops."extctl" {'
25+
` #$1'
26+
` get STR($2)'
27+
` put STR($3)'
28+
` }')
29+
30+
define(`CONTROLBYTES_PRIV',
31+
`SectionData.STR($1) {'
32+
` $2'
33+
`}')
34+
35+
dnl C_CONTROLMIXER(name, index, ops, base, num_regs, mask, max, tlv, priv)
36+
define(`C_CONTROLBYTES',
37+
`SectionControlBytes.STR($1) {'
38+
`'
39+
` # control belongs to this index group'
40+
` index STR($2)'
41+
`'
42+
` # control uses bespoke driver get/put/info ID for io ops'
43+
` $3'
44+
` # control uses bespoke driver get/put/info ID for ext ops'
45+
` $4'
46+
`'
47+
` base STR($5)'
48+
` num_regs STR($6)'
49+
` mask STR($7)'
50+
` $8'
51+
` $9'
52+
` access ['
53+
` tlv_write'
54+
` tlv_read'
55+
` tlv_callback'
56+
` ]'
57+
` data ['
58+
` $10'
59+
` ]'
60+
`}')
61+
62+
divert(0)dnl

topology/m4/eq_fir.m4

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
divert(-1)
2+
3+
dnl Define macro for Eq effect widget
4+
5+
dnl EQ name)
6+
define(`N_EQ_FIR', `EQFIR'PIPELINE_ID`.'$1)
7+
8+
dnl W_EQ(name, format, periods_sink, periods_source, preload, kcontrols_list)
9+
define(`W_EQ_FIR',
10+
`SectionVendorTuples."'N_EQ_FIR($1)`_tuples_w" {'
11+
` tokens "sof_comp_tokens"'
12+
` tuples."word" {'
13+
` SOF_TKN_COMP_PERIOD_SINK_COUNT' STR($3)
14+
` SOF_TKN_COMP_PERIOD_SOURCE_COUNT' STR($4)
15+
` SOF_TKN_COMP_PRELOAD_COUNT' STR($5)
16+
` }'
17+
`}'
18+
`SectionData."'N_EQ_FIR($1)`_data_w" {'
19+
` tuples "'N_EQ_FIR($1)`_tuples_w"'
20+
`}'
21+
`SectionVendorTuples."'N_EQ_FIR($1)`_tuples_str" {'
22+
` tokens "sof_comp_tokens"'
23+
` tuples."string" {'
24+
` SOF_TKN_COMP_FORMAT' STR($2)
25+
` }'
26+
`}'
27+
`SectionData."'N_EQ_FIR($1)`_data_str" {'
28+
` tuples "'N_EQ_FIR($1)`_tuples_str"'
29+
`}'
30+
`SectionVendorTuples."'N_EQ_FIR($1)`_tuples_str_type" {'
31+
` tokens "sof_effect_tokens"'
32+
` tuples."string" {'
33+
` SOF_TKN_EFFECT_TYPE' "EQFIR"
34+
` }'
35+
`}'
36+
`SectionData."'N_EQ_FIR($1)`_data_str_type" {'
37+
` tuples "'N_EQ_FIR($1)`_tuples_str_type"'
38+
`}'
39+
`SectionWidget."'N_EQ_FIR($1)`" {'
40+
` index "'PIPELINE_ID`"'
41+
` type "effect"'
42+
` no_pm "true"'
43+
` data ['
44+
` "'N_EQ_FIR($1)`_data_w"'
45+
` "'N_EQ_FIR($1)`_data_str"'
46+
` "'N_EQ_FIR($1)`_data_str_type"'
47+
` ]'
48+
` bytes ['
49+
$6
50+
` ]'
51+
`}')
52+
53+
divert(0)dnl

topology/m4/eq_iir.m4

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
divert(-1)
2+
3+
dnl Define macro for Eq effect widget
4+
5+
dnl EQ name)
6+
define(`N_EQ_IIR', `EQIIR'PIPELINE_ID`.'$1)
7+
8+
dnl W_EQ(name, format, periods_sink, periods_source, preload, kcontrols_list)
9+
define(`W_EQ_IIR',
10+
`SectionVendorTuples."'N_EQ_IIR($1)`_tuples_w" {'
11+
` tokens "sof_comp_tokens"'
12+
` tuples."word" {'
13+
` SOF_TKN_COMP_PERIOD_SINK_COUNT' STR($3)
14+
` SOF_TKN_COMP_PERIOD_SOURCE_COUNT' STR($4)
15+
` SOF_TKN_COMP_PRELOAD_COUNT' STR($5)
16+
` }'
17+
`}'
18+
`SectionData."'N_EQ_IIR($1)`_data_w" {'
19+
` tuples "'N_EQ_IIR($1)`_tuples_w"'
20+
`}'
21+
`SectionVendorTuples."'N_EQ_IIR($1)`_tuples_str" {'
22+
` tokens "sof_comp_tokens"'
23+
` tuples."string" {'
24+
` SOF_TKN_COMP_FORMAT' STR($2)
25+
` }'
26+
`}'
27+
`SectionData."'N_EQ_IIR($1)`_data_str" {'
28+
` tuples "'N_EQ_IIR($1)`_tuples_str"'
29+
`}'
30+
`SectionVendorTuples."'N_EQ_IIR($1)`_tuples_str_type" {'
31+
` tokens "sof_effect_tokens"'
32+
` tuples."string" {'
33+
` SOF_TKN_EFFECT_TYPE' "EQIIR"
34+
` }'
35+
`}'
36+
`SectionData."'N_EQ_IIR($1)`_data_str_type" {'
37+
` tuples "'N_EQ_IIR($1)`_tuples_str_type"'
38+
`}'
39+
`SectionWidget."'N_EQ_IIR($1)`" {'
40+
` index "'PIPELINE_ID`"'
41+
` type "effect"'
42+
` no_pm "true"'
43+
` data ['
44+
` "'N_EQ_IIR($1)`_data_w"'
45+
` "'N_EQ_IIR($1)`_data_str"'
46+
` "'N_EQ_IIR($1)`_data_str_type"'
47+
` ]'
48+
` bytes ['
49+
$6
50+
` ]'
51+
`}')
52+
53+
divert(0)dnl

topology/sof-apl-eq-pcm512x.m4

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#
2+
# Topology for generic Apollolake UP^2 with pcm512x codec.
3+
#
4+
5+
# Include topology builder
6+
include(`utils.m4')
7+
include(`dai.m4')
8+
include(`pipeline.m4')
9+
include(`ssp.m4')
10+
11+
# Include TLV library
12+
include(`common/tlv.m4')
13+
14+
# Include Token library
15+
include(`sof/tokens.m4')
16+
17+
# Include Apollolake DSP configuration
18+
include(`platform/intel/bxt.m4')
19+
20+
#
21+
# Define the pipelines
22+
#
23+
# PCM0 ----> volume -----> SSP5 (pcm512x)
24+
#
25+
26+
# Low Latency playback pipeline 1 on PCM 0 using max 2 channels of s32le.
27+
# Schedule 48 frames per 1000us deadline on core 0 with priority 0
28+
PIPELINE_PCM_ADD(sof/pipe-eq-volume-playback.m4,
29+
1, 0, 2, s32le,
30+
48, 1000, 0, 0)
31+
32+
#
33+
# DAIs configuration
34+
#
35+
36+
# playback DAI is SSP5 using 2 periods
37+
# Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0
38+
DAI_ADD(sof/pipe-dai-playback.m4,
39+
1, SSP, 5, SSP5-Codec,
40+
PIPELINE_SOURCE_1, 2, s24le,
41+
48, 1000, 0, 0)
42+
43+
# PCM Low Latency, id 0
44+
PCM_PLAYBACK_ADD(Port5, 0, PIPELINE_PCM_1)
45+
46+
#
47+
# BE configurations - overrides config in ACPI if present
48+
#
49+
50+
DAI_CONFIG(SSP, 5, 0, SSP5-Codec,
51+
SSP_CONFIG(I2S, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
52+
SSP_CLOCK(bclk, 3072000, codec_slave),
53+
SSP_CLOCK(fsync, 48000, codec_slave),
54+
SSP_TDM(2, 32, 3, 3),
55+
SSP_CONFIG_DATA(SSP, 5, 24)))
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Low Latency Passthrough with volume Pipeline and PCM
2+
#
3+
# Pipeline Endpoints for connection are :-
4+
#
5+
# host PCM_P --> B0 --> EQ 0 --> B1 --> Volume 0 --> B2 --> sink DAI0
6+
7+
# Include topology builder
8+
include(`utils.m4')
9+
include(`buffer.m4')
10+
include(`pcm.m4')
11+
include(`pga.m4')
12+
include(`dai.m4')
13+
include(`mixercontrol.m4')
14+
include(`bytecontrol.m4')
15+
include(`pipeline.m4')
16+
include(`eq_fir.m4')
17+
18+
#
19+
# Controls
20+
#
21+
# Volume Mixer control with max value of 32
22+
C_CONTROLMIXER(Master Playback Volume, PIPELINE_ID,
23+
CONTROLMIXER_OPS(volsw, 256 binds the mixer control to volume get/put handlers, 256, 256),
24+
CONTROLMIXER_MAX(, 32),
25+
false,
26+
CONTROLMIXER_TLV(TLV 32 steps from -90dB to +6dB for 3dB, vtlv_m90s3),
27+
Channel register and shift for Front Left/Right,
28+
LIST(` ', KCONTROL_CHANNEL(FL, 1, 0), KCONTROL_CHANNEL(FR, 1, 1)))
29+
30+
# EQ initial parameters, in this case flat response
31+
CONTROLBYTES_PRIV(EQFIR_priv,
32+
` bytes "0x18,0x00,0x00,0x00,0x02,0x00,0x01,0x00,'
33+
` 0x00,0x00,0x00,0x00,0x04,0x00,0xff,0xff,'
34+
` 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00"'
35+
)
36+
37+
# EQ Bytes control with max value of 255
38+
C_CONTROLBYTES(EQFIR, PIPELINE_ID,
39+
CONTROLBYTES_OPS(bytes, 258 binds the mixer control to bytes get/put handlers, 258, 258),
40+
CONTROLBYTES_EXTOPS(258 binds the mixer control to bytes get/put handlers, 258, 258),
41+
, , ,
42+
CONTROLBYTES_MAX(, 316),
43+
,
44+
EQFIR_priv)
45+
46+
#
47+
# Components and Buffers
48+
#
49+
50+
# Host "Passthrough Playback" PCM
51+
# with 2 sink and 0 source periods
52+
W_PCM_PLAYBACK(PCM_ID, Passthrough Playback, 2, 0, 2)
53+
54+
# "Volume" has 2 source and 2 sink periods
55+
W_PGA(0, PIPELINE_FORMAT, 2, 2, 2, LIST(` ', "Master Playback Volume PIPELINE_ID"))
56+
57+
# "EQ 0" has 2 sink period and 2 source periods
58+
W_EQ_FIR(0, PIPELINE_FORMAT, 2, 2, 2, LIST(` ', "EQFIR"))
59+
60+
# Playback Buffers
61+
W_BUFFER(0, COMP_BUFFER_SIZE(2,
62+
COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, SCHEDULE_FRAMES),
63+
PLATFORM_HOST_MEM_CAP)
64+
W_BUFFER(1, COMP_BUFFER_SIZE(2,
65+
COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, SCHEDULE_FRAMES),
66+
PLATFORM_HOST_MEM_CAP)
67+
W_BUFFER(2, COMP_BUFFER_SIZE(2,
68+
COMP_SAMPLE_SIZE(DAI_FORMAT), PIPELINE_CHANNELS, SCHEDULE_FRAMES),
69+
PLATFORM_DAI_MEM_CAP)
70+
71+
#
72+
# Pipeline Graph
73+
#
74+
# host PCM_P --> B0 --> EQ 0 --> B1 --> Volume 0 --> B2 --> sink DAI0
75+
76+
P_GRAPH(pipe-pass-vol-playback-PIPELINE_ID, PIPELINE_ID,
77+
LIST(` ',
78+
`dapm(N_PCMP(PCM_ID), Passthrough Playback PCM_ID)',
79+
`dapm(N_BUFFER(0), N_PCMP(PCM_ID))',
80+
`dapm(N_EQ_FIR(0), N_BUFFER(0))',
81+
`dapm(N_BUFFER(1), N_EQ_FIR(0))',
82+
`dapm(N_PGA(0), N_BUFFER(1))',
83+
`dapm(N_BUFFER(2), N_PGA(0))'))
84+
85+
#
86+
# Pipeline Source and Sinks
87+
#
88+
indir(`define', concat(`PIPELINE_SOURCE_', PIPELINE_ID), N_BUFFER(2))
89+
indir(`define', concat(`PIPELINE_PCM_', PIPELINE_ID), Passthrough Playback PCM_ID)
90+
91+
92+
#
93+
# PCM Configuration
94+
95+
#
96+
PCM_CAPABILITIES(Passthrough Playback PCM_ID, `S32_LE,S24_LE,S16_LE', 48000, 48000, 2, 8, 2, 16, 192, 16384, 65536, 65536)
97+

0 commit comments

Comments
 (0)