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

Commit f58a047

Browse files
committed
topology: move ssp related macros to ssp.m4 in platform/common
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
1 parent a835ff2 commit f58a047

24 files changed

Lines changed: 158 additions & 132 deletions

configure.ac

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ AC_OUTPUT([
2222
topology/common/Makefile
2323
topology/platform/Makefile
2424
topology/platform/intel/Makefile
25+
topology/platform/common/Makefile
2526
topology/m4/Makefile
2627
topology/sof/Makefile
2728
topology/test/Makefile

topology/Makefile.am

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ SUBDIRS = test m4 sof common platform
77

88
DEPS = \
99
platform/intel/*.m4 \
10+
platform/common/*.m4 \
1011
common/*.m4 \
1112
m4/*.m4 \
1213
sof/*.m4
@@ -34,7 +35,7 @@ MACHINES = \
3435
.PRECIOUS: %.conf
3536

3637
%.conf : %.m4 ${DEPS}
37-
m4 -I m4 -I common $< > $@
38+
m4 -I m4 -I common -I platform/common $< > $@
3839

3940
%.tplg : %.conf
4041
alsatplg -v 1 -c $< -o $@

topology/m4/dai.m4

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -121,47 +121,6 @@ define(`D_DAI', `SectionDAI."'N_DAI`" {'
121121
` capture "'$3`"'
122122
`}')
123123

124-
dnl DAI_CLOCK(clock, freq, codec_master)
125-
define(`DAI_CLOCK',
126-
$1 STR($3)
127-
$1_freq STR($2))
128-
129-
130-
dnl DAI_TDM(slots, width, tx_mask, rx_mask)
131-
define(`DAI_TDM',
132-
`tdm_slots 'STR($1)
133-
` tdm_slot_width 'STR($2)
134-
` tx_slots 'STR($3)
135-
` rx_slots 'STR($4)
136-
)
137-
dnl SSP_CONFIG(format, mclk, bclk, fsync, tdm, ssp_config_data)
138-
define(`SSP_CONFIG',
139-
` format "'$1`"'
140-
` '$2
141-
` '$3
142-
` '$4
143-
` '$5
144-
`}'
145-
$6
146-
)
147-
148-
dnl SSP_CONFIG_DATA(type, idx, valid bits, mclk_id)
149-
dnl mclk_id is optional
150-
define(`SSP_CONFIG_DATA',
151-
`SectionVendorTuples."'N_DAI_CONFIG($1$2)`_tuples" {'
152-
` tokens "sof_ssp_tokens"'
153-
` tuples."word" {'
154-
` SOF_TKN_INTEL_SSP_SAMPLE_BITS' STR($3)
155-
` }'
156-
` tuples."short" {'
157-
` SOF_TKN_INTEL_SSP_MCLK_ID' ifelse($4, `', "0", STR($4))
158-
` }'
159-
`}'
160-
`SectionData."'N_DAI_CONFIG($1$2)`_data" {'
161-
` tuples "'N_DAI_CONFIG($1$2)`_tuples"'
162-
`}'
163-
)
164-
165124
dnl PDM_TUPLES(pdm ctrl id, mic_a_enable, mic_b_enable, polarity_a, polarity_b,
166125
dnl clk_egde, skew)
167126
define(`PDM_TUPLES',

topology/platform/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
SUBDIRS = intel
1+
SUBDIRS = intel common
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
EXTRA_DIST = \
2+
ssp.m4

topology/platform/common/ssp.m4

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
divert(-1)
2+
3+
dnl SSP related macros
4+
5+
dnl SSP_CLOCK(clock, freq, codec_master)
6+
define(`SSP_CLOCK',
7+
$1 STR($3)
8+
$1_freq STR($2))
9+
10+
11+
dnl SSP_TDM(slots, width, tx_mask, rx_mask)
12+
define(`SSP_TDM',
13+
`tdm_slots 'STR($1)
14+
` tdm_slot_width 'STR($2)
15+
` tx_slots 'STR($3)
16+
` rx_slots 'STR($4)
17+
)
18+
dnl SSP_CONFIG(format, mclk, bclk, fsync, tdm, ssp_config_data)
19+
define(`SSP_CONFIG',
20+
` format "'$1`"'
21+
` '$2
22+
` '$3
23+
` '$4
24+
` '$5
25+
`}'
26+
$6
27+
)
28+
29+
dnl SSP_CONFIG_DATA(type, idx, valid bits, mclk_id)
30+
dnl mclk_id is optional
31+
define(`SSP_CONFIG_DATA',
32+
`SectionVendorTuples."'N_DAI_CONFIG($1$2)`_tuples" {'
33+
` tokens "sof_ssp_tokens"'
34+
` tuples."word" {'
35+
` SOF_TKN_INTEL_SSP_SAMPLE_BITS' STR($3)
36+
` }'
37+
` tuples."short" {'
38+
` SOF_TKN_INTEL_SSP_MCLK_ID' ifelse($4, `', "0", STR($4))
39+
` }'
40+
`}'
41+
`SectionData."'N_DAI_CONFIG($1$2)`_data" {'
42+
` tuples "'N_DAI_CONFIG($1$2)`_tuples"'
43+
`}'
44+
)
45+
46+
divert(0)dnl

topology/sof-apl-nocodec.m4

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
include(`pipeline.m4')
77
include(`utils.m4')
88
include(`dai.m4')
9+
include(`ssp.m4')
910

1011
# Include TLV library
1112
include(`common/tlv.m4')
@@ -91,8 +92,8 @@ PCM_DUPLEX_ADD(Low Latency, 6, 0, 0, PIPELINE_PCM_1, PIPELINE_PCM_2)
9192
# BE configurations - overrides config in ACPI if present
9293
#
9394
DAI_CONFIG(SSP, 2, 0, NoCodec,
94-
SSP_CONFIG(I2S, DAI_CLOCK(mclk, 19200000, codec_mclk_in),
95-
DAI_CLOCK(bclk, 2400000, codec_slave),
96-
DAI_CLOCK(fsync, 48000, codec_slave),
97-
DAI_TDM(2, 25, 3, 3),
95+
SSP_CONFIG(I2S, SSP_CLOCK(mclk, 19200000, codec_mclk_in),
96+
SSP_CLOCK(bclk, 2400000, codec_slave),
97+
SSP_CLOCK(fsync, 48000, codec_slave),
98+
SSP_TDM(2, 25, 3, 3),
9899
SSP_CONFIG_DATA(SSP, 2, 24)))

topology/sof-apl-tdf8532.m4

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
include(`utils.m4')
77
include(`dai.m4')
88
include(`pipeline.m4')
9+
include(`ssp.m4')
910

1011
# Include TLV library
1112
include(`common/tlv.m4')
@@ -179,45 +180,45 @@ PCM_DUPLEX_ADD(Port5, 5, 5, 5, PIPELINE_PCM_9, PIPELINE_PCM_10)
179180
#
180181

181182
DAI_CONFIG(SSP, 4, 4, SSP4-Codec,
182-
SSP_CONFIG(DSP_B, DAI_CLOCK(mclk, 24576000, codec_mclk_in),
183-
DAI_CLOCK(bclk, 12288000, codec_slave),
184-
DAI_CLOCK(fsync, 48000, codec_slave),
185-
DAI_TDM(8, 32, 15, 15),
183+
SSP_CONFIG(DSP_B, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
184+
SSP_CLOCK(bclk, 12288000, codec_slave),
185+
SSP_CLOCK(fsync, 48000, codec_slave),
186+
SSP_TDM(8, 32, 15, 15),
186187
SSP_CONFIG_DATA(SSP, 4, 32)))
187188

188189
DAI_CONFIG(SSP, 2, 2, SSP2-Codec,
189-
SSP_CONFIG(DSP_B, DAI_CLOCK(mclk, 24576000, codec_mclk_in),
190-
DAI_CLOCK(bclk, 12288000, codec_slave),
191-
DAI_CLOCK(fsync, 48000, codec_slave),
192-
DAI_TDM(2, 32, 255, 255),
190+
SSP_CONFIG(DSP_B, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
191+
SSP_CLOCK(bclk, 12288000, codec_slave),
192+
SSP_CLOCK(fsync, 48000, codec_slave),
193+
SSP_TDM(2, 32, 255, 255),
193194
SSP_CONFIG_DATA(SSP, 2, 32)))
194195

195196
DAI_CONFIG(SSP, 0, 0, SSP0-Codec,
196-
SSP_CONFIG(I2S, DAI_CLOCK(mclk, 24576000, codec_mclk_in),
197-
DAI_CLOCK(bclk, 1536000, codec_slave),
198-
DAI_CLOCK(fsync, 48000, codec_slave),
199-
DAI_TDM(2, 16, 3, 3),
197+
SSP_CONFIG(I2S, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
198+
SSP_CLOCK(bclk, 1536000, codec_slave),
199+
SSP_CLOCK(fsync, 48000, codec_slave),
200+
SSP_TDM(2, 16, 3, 3),
200201
SSP_CONFIG_DATA(SSP, 0, 16)))
201202

202203
DAI_CONFIG(SSP, 1, 1, SSP1-Codec,
203-
SSP_CONFIG(I2S, DAI_CLOCK(mclk, 24576000, codec_mclk_in),
204-
DAI_CLOCK(bclk, 1536000, codec_slave),
205-
DAI_CLOCK(fsync, 48000, codec_slave),
206-
DAI_TDM(2, 16, 3, 3),
204+
SSP_CONFIG(I2S, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
205+
SSP_CLOCK(bclk, 1536000, codec_slave),
206+
SSP_CLOCK(fsync, 48000, codec_slave),
207+
SSP_TDM(2, 16, 3, 3),
207208
SSP_CONFIG_DATA(SSP, 1, 16)))
208209

209210
DAI_CONFIG(SSP, 3, 3, SSP3-Codec,
210-
SSP_CONFIG(I2S, DAI_CLOCK(mclk, 24576000, codec_mclk_in),
211-
DAI_CLOCK(bclk, 1536000, codec_slave),
212-
DAI_CLOCK(fsync, 48000, codec_slave),
213-
DAI_TDM(2, 16, 3, 3),
211+
SSP_CONFIG(I2S, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
212+
SSP_CLOCK(bclk, 1536000, codec_slave),
213+
SSP_CLOCK(fsync, 48000, codec_slave),
214+
SSP_TDM(2, 16, 3, 3),
214215
SSP_CONFIG_DATA(SSP, 3, 16)))
215216

216217
DAI_CONFIG(SSP, 5, 5, SSP5-Codec,
217-
SSP_CONFIG(I2S, DAI_CLOCK(mclk, 24576000, codec_mclk_in),
218-
DAI_CLOCK(bclk, 1536000, codec_slave),
219-
DAI_CLOCK(fsync, 48000, codec_slave),
220-
DAI_TDM(2, 16, 3, 3),
218+
SSP_CONFIG(I2S, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
219+
SSP_CLOCK(bclk, 1536000, codec_slave),
220+
SSP_CLOCK(fsync, 48000, codec_slave),
221+
SSP_TDM(2, 16, 3, 3),
221222
SSP_CONFIG_DATA(SSP, 5, 16)))
222223

223224

topology/sof-bdw-rt286.m4

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
include(`pipeline.m4')
77
include(`utils.m4')
88
include(`dai.m4')
9+
include(`ssp.m4')
910

1011
# Include TLV library
1112
include(`common/tlv.m4')
@@ -91,8 +92,8 @@ PCM_DUPLEX_ADD(Low Latency, 6, 0, 0, PIPELINE_PCM_1, PIPELINE_PCM_2)
9192
# BE configurations - overrides config in ACPI if present
9293
#
9394
DAI_CONFIG(SSP, 0, 0, Codec,
94-
SSP_CONFIG(I2S, DAI_CLOCK(mclk, 24000000, codec_mclk_in),
95-
DAI_CLOCK(bclk, 2400000, codec_slave),
96-
DAI_CLOCK(fsync, 48000, codec_slave),
97-
DAI_TDM(2, 25, 3, 3),
95+
SSP_CONFIG(I2S, SSP_CLOCK(mclk, 24000000, codec_mclk_in),
96+
SSP_CLOCK(bclk, 2400000, codec_slave),
97+
SSP_CLOCK(fsync, 48000, codec_slave),
98+
SSP_TDM(2, 25, 3, 3),
9899
SSP_CONFIG_DATA(SSP, 0, 24)))

topology/sof-bdw-rt5640.m4

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
include(`utils.m4')
77
include(`dai.m4')
88
include(`pipeline.m4')
9+
include(`ssp.m4')
910

1011
# Include TLV library
1112
include(`common/tlv.m4')
@@ -91,8 +92,8 @@ PCM_DUPLEX_ADD(Low Latency, 6, 0, 0, PIPELINE_PCM_1, PIPELINE_PCM_2)
9192
# BE configurations - overrides config in ACPI if present
9293
#
9394
DAI_CONFIG(SSP, 0, 0, Codec,
94-
SSP_CONFIG(I2S, DAI_CLOCK(mclk, 24000000, codec_mclk_in),
95-
DAI_CLOCK(bclk, 2400000, codec_slave),
96-
DAI_CLOCK(fsync, 48000, codec_slave),
97-
DAI_TDM(2, 25, 3, 3),
95+
SSP_CONFIG(I2S, SSP_CLOCK(mclk, 24000000, codec_mclk_in),
96+
SSP_CLOCK(bclk, 2400000, codec_slave),
97+
SSP_CLOCK(fsync, 48000, codec_slave),
98+
SSP_TDM(2, 25, 3, 3),
9899
SSP_CONFIG_DATA(SSP, 0, 24)))

0 commit comments

Comments
 (0)