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

Commit

Permalink
Merge pull request #4 from ranj063/dai_changes
Browse files Browse the repository at this point in the history
DAI updates - topology changes
  • Loading branch information
lgirdwood authored Jun 26, 2018
2 parents 7b96948 + f73aa73 commit 308cf3d
Show file tree
Hide file tree
Showing 34 changed files with 267 additions and 227 deletions.
4 changes: 3 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ AC_OUTPUT([
rmbox/Makefile
topology/Makefile
topology/common/Makefile
topology/dsps/Makefile
topology/platform/Makefile
topology/platform/intel/Makefile
topology/platform/common/Makefile
topology/m4/Makefile
topology/sof/Makefile
topology/test/Makefile
Expand Down
7 changes: 4 additions & 3 deletions topology/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
# Dependencies
#

SUBDIRS = test m4 sof common dsps
SUBDIRS = test m4 sof common platform

DEPS = \
dsps/*.m4 \
platform/intel/*.m4 \
platform/common/*.m4 \
common/*.m4 \
m4/*.m4 \
sof/*.m4
Expand Down Expand Up @@ -34,7 +35,7 @@ MACHINES = \
.PRECIOUS: %.conf

%.conf : %.m4 ${DEPS}
m4 -I m4 -I common $< > $@
m4 -I m4 -I common -I platform/common $< > $@

%.tplg : %.conf
alsatplg -v 1 -c $< -o $@
Expand Down
92 changes: 0 additions & 92 deletions topology/m4/dai.m4
Original file line number Diff line number Diff line change
Expand Up @@ -121,98 +121,6 @@ define(`D_DAI', `SectionDAI."'N_DAI`" {'
` capture "'$3`"'
`}')

dnl DAI_CLOCK(clock, freq, codec_master)
define(`DAI_CLOCK',
$1 STR($3)
$1_freq STR($2))


dnl DAI_TDM(slots, width, tx_mask, rx_mask)
define(`DAI_TDM',
`tdm_slots 'STR($1)
` tdm_slot_width 'STR($2)
` tx_slots 'STR($3)
` rx_slots 'STR($4)
)
dnl SSP_CONFIG(format, mclk, bclk, fsync, tdm, ssp sample bits)
define(`SSP_CONFIG',
` format "'$1`"'
` '$2
` '$3
` '$4
` '$5
`}'
$6
)

dnl SSP_SAMPLE_BITS(type, idx, valid bits)
define(`SSP_SAMPLE_BITS',
`SectionVendorTuples."'N_DAI_CONFIG($1$2)`_tuples" {'
` tokens "sof_dai_tokens"'
` tuples."word" {'
` SOF_TKN_DAI_SAMPLE_BITS' STR($3)
` }'
`}'
`SectionData."'N_DAI_CONFIG($1$2)`_data" {'
` tuples "'N_DAI_CONFIG($1$2)`_tuples"'
`}'
)

dnl PDM_TUPLES(pdm ctrl id, mic_a_enable, mic_b_enable, polarity_a, polarity_b,
dnl clk_egde, skew)
define(`PDM_TUPLES',
` tuples."short.pdm$1" {'
` SOF_TKN_INTEL_DMIC_PDM_CTRL_ID' STR($1)
` SOF_TKN_INTEL_DMIC_PDM_MIC_A_Enable' STR($2)
` SOF_TKN_INTEL_DMIC_PDM_MIC_B_Enable' STR($3)
` SOF_TKN_INTEL_DMIC_PDM_POLARITY_A' STR($4)
` SOF_TKN_INTEL_DMIC_PDM_POLARITY_B' STR($5)
` SOF_TKN_INTEL_DMIC_PDM_CLK_EDGE' STR($6)
` SOF_TKN_INTEL_DMIC_PDM_SKEW' STR($7)
` }'
)

dnl PDM_CONFIG(type, idx, pdm tuples list)
define(`PDM_CONFIG',
`SectionVendorTuples."'N_DAI_CONFIG($1$2)`_pdm_tuples" {'
` tokens "sof_dmic_pdm_tokens"'
$3
`}'
)

dnl DMIC currently only supports 16 bit or 32-bit word length
dnl DMIC_WORD_LENGTH(frame format)
define(`DMIC_WORD_LENGTH',
`ifelse($1, `s16le', 16, $1, `s32le', 32, `')')

dnl DMIC_CONFIG(driver_version, clk_min, clk_mac, duty_min, duty_max,
dnl req pdm count, sample_rate,
dnl fifo word length, type, idx, pdm controller config)
define(`DMIC_CONFIG',
`SectionVendorTuples."'N_DAI_CONFIG($9$10)`_dmic_tuples" {'
` tokens "sof_dmic_tokens"'
` tuples."word" {'
` SOF_TKN_INTEL_DMIC_DRIVER_VERSION' STR($1)
` SOF_TKN_INTEL_DMIC_CLK_MIN' STR($2)
` SOF_TKN_INTEL_DMIC_CLK_MAX' STR($3)
` SOF_TKN_INTEL_DMIC_DUTY_MIN' STR($4)
` SOF_TKN_INTEL_DMIC_DUTY_MAX' STR($5)
` SOF_TKN_INTEL_DMIC_NUM_PDM_ACTIVE' STR($6)
` SOF_TKN_INTEL_DMIC_SAMPLE_RATE' STR($7)
` SOF_TKN_INTEL_DMIC_FIFO_WORD_LENGTH' STR($8)
` }'
`}'
dnl PDM config for the number of active PDM controllers
$11
`SectionData."'N_DAI_CONFIG($9$10)`_pdm_data" {'
` tuples "'N_DAI_CONFIG($9$10)`_pdm_tuples"'
`}'
`SectionData."'N_DAI_CONFIG($9$10)`_data" {'
` tuples "'N_DAI_CONFIG($9$10)`_dmic_tuples"'

`}'
)

dnl DAI Config)
define(`N_DAI_CONFIG', `DAICONFIG.'$1)

Expand Down
1 change: 1 addition & 0 deletions topology/platform/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SUBDIRS = intel common
2 changes: 2 additions & 0 deletions topology/platform/common/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
EXTRA_DIST = \
ssp.m4
46 changes: 46 additions & 0 deletions topology/platform/common/ssp.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
divert(-1)

dnl SSP related macros

dnl SSP_CLOCK(clock, freq, codec_master)
define(`SSP_CLOCK',
$1 STR($3)
$1_freq STR($2))


dnl SSP_TDM(slots, width, tx_mask, rx_mask)
define(`SSP_TDM',
`tdm_slots 'STR($1)
` tdm_slot_width 'STR($2)
` tx_slots 'STR($3)
` rx_slots 'STR($4)
)
dnl SSP_CONFIG(format, mclk, bclk, fsync, tdm, ssp_config_data)
define(`SSP_CONFIG',
` format "'$1`"'
` '$2
` '$3
` '$4
` '$5
`}'
$6
)

dnl SSP_CONFIG_DATA(type, idx, valid bits, mclk_id)
dnl mclk_id is optional
define(`SSP_CONFIG_DATA',
`SectionVendorTuples."'N_DAI_CONFIG($1$2)`_tuples" {'
` tokens "sof_ssp_tokens"'
` tuples."word" {'
` SOF_TKN_INTEL_SSP_SAMPLE_BITS' STR($3)
` }'
` tuples."short" {'
` SOF_TKN_INTEL_SSP_MCLK_ID' ifelse($4, `', "0", STR($4))
` }'
`}'
`SectionData."'N_DAI_CONFIG($1$2)`_data" {'
` tuples "'N_DAI_CONFIG($1$2)`_tuples"'
`}'
)

divert(0)dnl
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ EXTRA_DIST = \
byt.m4 \
cht.m4 \
hsw.m4 \
cnl.m4
cnl.m4 \
dmic.m4

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
60 changes: 60 additions & 0 deletions topology/platform/intel/dmic.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
divert(-1)

dnl DMIC related macros

dnl PDM_TUPLES(pdm ctrl id, mic_a_enable, mic_b_enable, polarity_a, polarity_b,
dnl clk_egde, skew)
define(`PDM_TUPLES',
` tuples."short.pdm$1" {'
` SOF_TKN_INTEL_DMIC_PDM_CTRL_ID' STR($1)
` SOF_TKN_INTEL_DMIC_PDM_MIC_A_Enable' STR($2)
` SOF_TKN_INTEL_DMIC_PDM_MIC_B_Enable' STR($3)
` SOF_TKN_INTEL_DMIC_PDM_POLARITY_A' STR($4)
` SOF_TKN_INTEL_DMIC_PDM_POLARITY_B' STR($5)
` SOF_TKN_INTEL_DMIC_PDM_CLK_EDGE' STR($6)
` SOF_TKN_INTEL_DMIC_PDM_SKEW' STR($7)
` }'
)

dnl PDM_CONFIG(type, idx, pdm tuples list)
define(`PDM_CONFIG',
`SectionVendorTuples."'N_DAI_CONFIG($1$2)`_pdm_tuples" {'
` tokens "sof_dmic_pdm_tokens"'
$3
`}'
)

dnl DMIC currently only supports 16 bit or 32-bit word length
dnl DMIC_WORD_LENGTH(frame format)
define(`DMIC_WORD_LENGTH',
`ifelse($1, `s16le', 16, $1, `s32le', 32, `')')

dnl DMIC_CONFIG(driver_version, clk_min, clk_mac, duty_min, duty_max,
dnl req pdm count, sample_rate,
dnl fifo word length, type, idx, pdm controller config)
define(`DMIC_CONFIG',
`SectionVendorTuples."'N_DAI_CONFIG($9$10)`_dmic_tuples" {'
` tokens "sof_dmic_tokens"'
` tuples."word" {'
` SOF_TKN_INTEL_DMIC_DRIVER_VERSION' STR($1)
` SOF_TKN_INTEL_DMIC_CLK_MIN' STR($2)
` SOF_TKN_INTEL_DMIC_CLK_MAX' STR($3)
` SOF_TKN_INTEL_DMIC_DUTY_MIN' STR($4)
` SOF_TKN_INTEL_DMIC_DUTY_MAX' STR($5)
` SOF_TKN_INTEL_DMIC_NUM_PDM_ACTIVE' STR($6)
` SOF_TKN_INTEL_DMIC_SAMPLE_RATE' STR($7)
` SOF_TKN_INTEL_DMIC_FIFO_WORD_LENGTH' STR($8)
` }'
`}'
dnl PDM config for the number of active PDM controllers
$11
`SectionData."'N_DAI_CONFIG($9$10)`_pdm_data" {'
` tuples "'N_DAI_CONFIG($9$10)`_pdm_tuples"'
`}'
`SectionData."'N_DAI_CONFIG($9$10)`_data" {'
` tuples "'N_DAI_CONFIG($9$10)`_dmic_tuples"'

`}'
)

divert(0)dnl
File renamed without changes.
13 changes: 7 additions & 6 deletions topology/sof-apl-nocodec.m4
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
include(`pipeline.m4')
include(`utils.m4')
include(`dai.m4')
include(`ssp.m4')

# Include TLV library
include(`common/tlv.m4')
Expand All @@ -14,7 +15,7 @@ include(`common/tlv.m4')
include(`sof/tokens.m4')

# Include Apollolake DSP configuration
include(`dsps/bxt.m4')
include(`platform/intel/bxt.m4')

#
# Define the pipelines
Expand Down Expand Up @@ -91,8 +92,8 @@ PCM_DUPLEX_ADD(Low Latency, 6, 0, 0, PIPELINE_PCM_1, PIPELINE_PCM_2)
# BE configurations - overrides config in ACPI if present
#
DAI_CONFIG(SSP, 2, 0, NoCodec,
SSP_CONFIG(I2S, DAI_CLOCK(mclk, 19200000, codec_mclk_in),
DAI_CLOCK(bclk, 2400000, codec_slave),
DAI_CLOCK(fsync, 48000, codec_slave),
DAI_TDM(2, 25, 3, 3),
SSP_SAMPLE_BITS(SSP, 2, 24)))
SSP_CONFIG(I2S, SSP_CLOCK(mclk, 19200000, codec_mclk_in),
SSP_CLOCK(bclk, 2400000, codec_slave),
SSP_CLOCK(fsync, 48000, codec_slave),
SSP_TDM(2, 25, 3, 3),
SSP_CONFIG_DATA(SSP, 2, 24)))
63 changes: 32 additions & 31 deletions topology/sof-apl-tdf8532.m4
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
include(`utils.m4')
include(`dai.m4')
include(`pipeline.m4')
include(`ssp.m4')

# Include TLV library
include(`common/tlv.m4')
Expand All @@ -14,7 +15,7 @@ include(`common/tlv.m4')
include(`sof/tokens.m4')

# Include Apollolake DSP configuration
include(`dsps/bxt.m4')
include(`platform/intel/bxt.m4')

#
# Define the pipelines
Expand Down Expand Up @@ -179,46 +180,46 @@ PCM_DUPLEX_ADD(Port5, 5, 5, 5, PIPELINE_PCM_9, PIPELINE_PCM_10)
#

DAI_CONFIG(SSP, 4, 4, SSP4-Codec,
SSP_CONFIG(DSP_B, DAI_CLOCK(mclk, 24576000, codec_mclk_in),
DAI_CLOCK(bclk, 12288000, codec_slave),
DAI_CLOCK(fsync, 48000, codec_slave),
DAI_TDM(8, 32, 15, 15),
SSP_SAMPLE_BITS(SSP, 4, 32)))
SSP_CONFIG(DSP_B, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
SSP_CLOCK(bclk, 12288000, codec_slave),
SSP_CLOCK(fsync, 48000, codec_slave),
SSP_TDM(8, 32, 15, 15),
SSP_CONFIG_DATA(SSP, 4, 32)))

DAI_CONFIG(SSP, 2, 2, SSP2-Codec,
SSP_CONFIG(DSP_B, DAI_CLOCK(mclk, 24576000, codec_mclk_in),
DAI_CLOCK(bclk, 12288000, codec_slave),
DAI_CLOCK(fsync, 48000, codec_slave),
DAI_TDM(2, 32, 255, 255),
SSP_SAMPLE_BITS(SSP, 2, 32)))
SSP_CONFIG(DSP_B, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
SSP_CLOCK(bclk, 12288000, codec_slave),
SSP_CLOCK(fsync, 48000, codec_slave),
SSP_TDM(2, 32, 255, 255),
SSP_CONFIG_DATA(SSP, 2, 32)))

DAI_CONFIG(SSP, 0, 0, SSP0-Codec,
SSP_CONFIG(I2S, DAI_CLOCK(mclk, 24576000, codec_mclk_in),
DAI_CLOCK(bclk, 1536000, codec_slave),
DAI_CLOCK(fsync, 48000, codec_slave),
DAI_TDM(2, 16, 3, 3),
SSP_SAMPLE_BITS(SSP, 0, 16)))
SSP_CONFIG(I2S, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
SSP_CLOCK(bclk, 1536000, codec_slave),
SSP_CLOCK(fsync, 48000, codec_slave),
SSP_TDM(2, 16, 3, 3),
SSP_CONFIG_DATA(SSP, 0, 16)))

DAI_CONFIG(SSP, 1, 1, SSP1-Codec,
SSP_CONFIG(I2S, DAI_CLOCK(mclk, 24576000, codec_mclk_in),
DAI_CLOCK(bclk, 1536000, codec_slave),
DAI_CLOCK(fsync, 48000, codec_slave),
DAI_TDM(2, 16, 3, 3),
SSP_SAMPLE_BITS(SSP, 1, 16)))
SSP_CONFIG(I2S, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
SSP_CLOCK(bclk, 1536000, codec_slave),
SSP_CLOCK(fsync, 48000, codec_slave),
SSP_TDM(2, 16, 3, 3),
SSP_CONFIG_DATA(SSP, 1, 16)))

DAI_CONFIG(SSP, 3, 3, SSP3-Codec,
SSP_CONFIG(I2S, DAI_CLOCK(mclk, 24576000, codec_mclk_in),
DAI_CLOCK(bclk, 1536000, codec_slave),
DAI_CLOCK(fsync, 48000, codec_slave),
DAI_TDM(2, 16, 3, 3),
SSP_SAMPLE_BITS(SSP, 3, 16)))
SSP_CONFIG(I2S, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
SSP_CLOCK(bclk, 1536000, codec_slave),
SSP_CLOCK(fsync, 48000, codec_slave),
SSP_TDM(2, 16, 3, 3),
SSP_CONFIG_DATA(SSP, 3, 16)))

DAI_CONFIG(SSP, 5, 5, SSP5-Codec,
SSP_CONFIG(I2S, DAI_CLOCK(mclk, 24576000, codec_mclk_in),
DAI_CLOCK(bclk, 1536000, codec_slave),
DAI_CLOCK(fsync, 48000, codec_slave),
DAI_TDM(2, 16, 3, 3),
SSP_SAMPLE_BITS(SSP, 5, 16)))
SSP_CONFIG(I2S, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
SSP_CLOCK(bclk, 1536000, codec_slave),
SSP_CLOCK(fsync, 48000, codec_slave),
SSP_TDM(2, 16, 3, 3),
SSP_CONFIG_DATA(SSP, 5, 16)))


VIRTUAL_DAPM_ROUTE_IN(BtHfp_ssp0_in, SSP, 0, IN, 0)
Expand Down
Loading

0 comments on commit 308cf3d

Please sign in to comment.