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

Commit 6b56daf

Browse files
author
Jaska Uimonen
committed
Topology: Add generic type string to effect widgets data field
Adding type string to widget data allows the driver to identify different effects. As an example use this in the equalizer. Also modify equalizer to pass default parameters in control's private data. Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
1 parent baa791f commit 6b56daf

8 files changed

Lines changed: 366 additions & 56 deletions

File tree

topology/m4/bytecontrol.m4

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ define(`CONTROLBYTES_EXTOPS',
2727
` put STR($3)'
2828
` }')
2929

30-
dnl C_CONTROLMIXER(name, index, ops, base, num_regs, mask, max, tlv)
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)
3136
define(`C_CONTROLBYTES',
3237
`SectionControlBytes.STR($1) {'
3338
`'
@@ -49,6 +54,9 @@ define(`C_CONTROLBYTES',
4954
` tlv_read'
5055
` tlv_callback'
5156
` ]'
57+
` data ['
58+
` $10'
59+
` ]'
5260
`}')
5361

5462
divert(0)dnl

topology/m4/eq.m4

Lines changed: 0 additions & 43 deletions
This file was deleted.

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
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+
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
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_iir.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(EQIIR_priv,
32+
` bytes "0x38,0x00,0x00,0x00,0x02,0x00,0x00,0x00,'
33+
` 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'
34+
` 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,'
35+
` 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'
36+
` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'
37+
` 0x00,0x00,0x00,0x00,0x9e,0x73,0x13,0x20,'
38+
` 0x00,0x00,0x00,0x00,0xb2,0x7f,0x00,0x00"'
39+
)
40+
41+
# EQ Bytes control with max value of 255
42+
C_CONTROLBYTES(EQIIR, PIPELINE_ID,
43+
CONTROLBYTES_OPS(bytes, 258 binds the mixer control to bytes get/put handlers, 258, 258),
44+
CONTROLBYTES_EXTOPS(258 binds the mixer control to bytes get/put handlers, 258, 258),
45+
, , ,
46+
CONTROLBYTES_MAX(, 316),
47+
,
48+
EQIIR_priv)
49+
50+
#
51+
# Components and Buffers
52+
#
53+
54+
# Host "Passthrough Playback" PCM
55+
# with 2 sink and 0 source periods
56+
W_PCM_PLAYBACK(PCM_ID, Passthrough Playback, 2, 0, 2)
57+
58+
# "Volume" has 2 source and 2 sink periods
59+
W_PGA(0, PIPELINE_FORMAT, 2, 2, 2, LIST(` ', "Master Playback Volume PIPELINE_ID"))
60+
61+
# "EQ 0" has 2 sink period and 2 source periods
62+
W_EQ_IIR(0, PIPELINE_FORMAT, 2, 2, 2, LIST(` ', "EQIIR"))
63+
64+
# Playback Buffers
65+
W_BUFFER(0, COMP_BUFFER_SIZE(2,
66+
COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, SCHEDULE_FRAMES),
67+
PLATFORM_HOST_MEM_CAP)
68+
W_BUFFER(1, COMP_BUFFER_SIZE(2,
69+
COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, SCHEDULE_FRAMES),
70+
PLATFORM_HOST_MEM_CAP)
71+
W_BUFFER(2, COMP_BUFFER_SIZE(2,
72+
COMP_SAMPLE_SIZE(DAI_FORMAT), PIPELINE_CHANNELS, SCHEDULE_FRAMES),
73+
PLATFORM_DAI_MEM_CAP)
74+
75+
#
76+
# Pipeline Graph
77+
#
78+
# host PCM_P --> B0 --> EQ 0 --> B1 --> Volume 0 --> B2 --> sink DAI0
79+
80+
P_GRAPH(pipe-pass-vol-playback-PIPELINE_ID, PIPELINE_ID,
81+
LIST(` ',
82+
`dapm(N_PCMP(PCM_ID), Passthrough Playback PCM_ID)',
83+
`dapm(N_BUFFER(0), N_PCMP(PCM_ID))',
84+
`dapm(N_EQ_IIR(0), N_BUFFER(0))',
85+
`dapm(N_BUFFER(1), N_EQ_IIR(0))',
86+
`dapm(N_PGA(0), N_BUFFER(1))',
87+
`dapm(N_BUFFER(2), N_PGA(0))'))
88+
89+
#
90+
# Pipeline Source and Sinks
91+
#
92+
indir(`define', concat(`PIPELINE_SOURCE_', PIPELINE_ID), N_BUFFER(2))
93+
indir(`define', concat(`PIPELINE_PCM_', PIPELINE_ID), Passthrough Playback PCM_ID)
94+
95+
96+
#
97+
# PCM Configuration
98+
99+
#
100+
PCM_CAPABILITIES(Passthrough Playback PCM_ID, `S32_LE,S24_LE,S16_LE', 48000, 48000, 2, 8, 2, 16, 192, 16384, 65536, 65536)
101+

0 commit comments

Comments
 (0)