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

Loopback mode kcontrol support #13

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
10 changes: 7 additions & 3 deletions topology/m4/dai.m4
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ define(`N_DAI', DAI_NAME)
define(`N_DAI_OUT', DAI_NAME`.OUT')
define(`N_DAI_IN', DAI_NAME`.IN')

dnl W_DAI_OUT(type, index, dai_link, format, periods_sink, periods_source, preload)
dnl W_DAI_OUT(type, index, dai_link, format, periods_sink, periods_source, preload, bespoke_data)
define(`W_DAI_OUT',
`SectionVendorTuples."'N_DAI_OUT($2)`_tuples_w_comp" {'
` tokens "sof_comp_tokens"'
Expand Down Expand Up @@ -47,6 +47,7 @@ define(`W_DAI_OUT',
`SectionData."'N_DAI_OUT($2)`_data_comp_str" {'
` tuples "'N_DAI_OUT($2)`_tuples_comp_str"'
`}'
$8
`SectionWidget."'N_DAI_OUT`" {'
` index "'PIPELINE_ID`"'
` type "dai_in"'
Expand All @@ -57,6 +58,7 @@ define(`W_DAI_OUT',
` "'N_DAI_OUT($2)`_data_w_comp"'
` "'N_DAI_OUT($2)`_data_str"'
` "'N_DAI_OUT($2)`_data_comp_str"'
`ifelse($8, `', `',` "'N_DAI_OUT($2)`_data_bespoke_w"')'
` ]'
`}')

Expand Down Expand Up @@ -159,8 +161,8 @@ define(`DAI_CONFIG',

dnl DAI_ADD(pipeline,
dnl pipe id, dai type, dai_index, dai_be,
dnl buffer, periods, format,
dnl frames, deadline, priority, core)
dnl buffer, periods, format,frames, deadline,
dnl priority, core, bespoken_config)
define(`DAI_ADD',
`undefine(`PIPELINE_ID')'
`undefine(`DAI_TYPE')'
Expand All @@ -173,6 +175,7 @@ define(`DAI_ADD',
`undefine(`SCHEDULE_DEADLINE')'
`undefine(`SCHEDULE_PRIORITY')'
`undefine(`SCHEDULE_CORE')'
`undefine(`DAI_BESPOKE_CONFIG')'
`define(`PIPELINE_ID', $2)'
`define(`DAI_TYPE', STR($3))'
`define(`DAI_INDEX', STR($4))'
Expand All @@ -185,6 +188,7 @@ define(`DAI_ADD',
`define(`SCHEDULE_DEADLINE', $10)'
`define(`SCHEDULE_PRIORITY', $11)'
`define(`SCHEDULE_CORE', $12)'
`define(`DAI_BESPOKE_CONFIG', $13)'
`include($1)'
)

Expand Down
14 changes: 14 additions & 0 deletions topology/platform/common/ssp.m4
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,18 @@ define(`SSP_CONFIG_DATA',
`}'
)

dnl SSP_BESPOKE_DATA(type, idx, value)
dnl value is optional
define(`SSP_BESPOKE_DATA',
`SectionVendorTuples."$1$2.OUT_tuples_bespoke_w" {'
` tokens "sof_dai_tokens"'
` tuples."word" {'
` SOF_TKN_DAI_BESPOKE_CONFIG' ifelse($3, `', "0", STR($3))
Copy link
Member

Choose a reason for hiding this comment

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

The presence of this data implies that there a bespoke config data available so there is no need for a token that says bespoke data available. I'd expect to see tokens in here things that are not generic and specific to SSP only like SSP clock source, M/N dividers, etc

You could even additionally create an advance mode SSP_BESPOKE_REGS macro that has a token for each register so that register values can be assigned here.

Copy link
Member

Choose a reason for hiding this comment

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

The user could then decide if he was using export mode or normal bespoke data, since we are always passing a macro to the DAI macro to expand.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lgirdwood
This DATA is bind to the SectionWidget for DAI COMP.
We already had some DATA for SectionBE for BE DAI to config SSP clock and other things.
Do you mean we may have other run-time reconfigurable setting to SSP?
That we can use the topology to create kcontrol for some debug use config,

Copy link
Member

Choose a reason for hiding this comment

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

Yes, the intention is that we can bind multiple data objects to the widget each containing multiple tuples (but lets start with just 1 data object today).

he "create loopback kcontrol" flag will be a boolean token in this object and so will any member of the following structure that cant be defined in the standard ALSA topology structure for BE/DAI.

struct sof_ipc_dai_ssp_params {
uint16_t mode; // FIXME: do we need this?
uint16_t mclk_id;

uint32_t mclk_rate;	/* mclk frequency in Hz */
uint32_t fsync_rate;	/* fsync frequency in Hz */
uint32_t bclk_rate;	/* bclk frequency in Hz */

/* TDM */
uint32_t tdm_slots;
uint32_t rx_slots;
uint32_t tx_slots;

/* data */
uint32_t sample_valid_bits;
uint16_t tdm_slot_width;
uint16_t reserved2;	/* alignment */

/* MCLK */
uint32_t mclk_direction;
uint32_t mclk_keep_active;
uint32_t bclk_keep_active;
uint32_t fs_keep_active;

//uint32_t quirks; // FIXME: is 32 bits enough ?

/* private data, e.g. for quirks */
//uint32_t pdata[10]; // FIXME: would really need ~16 u32

} attribute((packed));

e.g. checking the driver I can see we parse for SOF_TKN_INTEL_SSP_MCLK_KEEP_ACTIVE but we don't set this in any private data yet in topology. This token and any others specific to SSP should be added to this data object alongside the "create lbm kcontrol".

` }'
`}'
`SectionData."$1$2.OUT_data_bespoke_w" {'
` tuples "$1$2.OUT_tuples_bespoke_w"'
`}'
)

divert(0)dnl
18 changes: 12 additions & 6 deletions topology/sof-apl-nocodec.m4
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ PIPELINE_PCM_DAI_ADD(sof/pipe-volume-capture.m4,
DAI_ADD(sof/pipe-dai-playback.m4,
1, SSP, 0, NoCodec-0,
PIPELINE_SOURCE_1, 2, s16le,
48, 1000, 0, 0)
48, 1000, 0, 0,
SSP_BESPOKE_DATA(SSP, 0, 1))

# capture DAI is SSP0 using 2 periods
# Buffers use s16le format, with 48 frame per 1000us on core 0 with priority 0
Expand All @@ -130,7 +131,8 @@ DAI_ADD(sof/pipe-dai-capture.m4,
DAI_ADD(sof/pipe-dai-playback.m4,
3, SSP, 1, NoCodec-1,
PIPELINE_SOURCE_3, 2, s16le,
48, 1000, 0, 0)
48, 1000, 0, 0,
SSP_BESPOKE_DATA(SSP, 1, 1))

# capture DAI is SSP1 using 2 periods
# Buffers use s16le format, with 48 frame per 1000us on core 0 with priority 0
Expand All @@ -144,7 +146,8 @@ DAI_ADD(sof/pipe-dai-capture.m4,
DAI_ADD(sof/pipe-dai-playback.m4,
5, SSP, 2, NoCodec-2,
PIPELINE_SOURCE_5, 2, s16le,
48, 1000, 0, 0)
48, 1000, 0, 0,
SSP_BESPOKE_DATA(SSP, 2, 1))

# capture DAI is SSP2 using 2 periods
# Buffers use s16le format, with 48 frame per 1000us on core 0 with priority 0
Expand All @@ -158,7 +161,8 @@ DAI_ADD(sof/pipe-dai-capture.m4,
DAI_ADD(sof/pipe-dai-playback.m4,
7, SSP, 3, NoCodec-3,
PIPELINE_SOURCE_7, 2, s16le,
48, 1000, 0, 0)
48, 1000, 0, 0,
SSP_BESPOKE_DATA(SSP, 3, 1))

# capture DAI is SSP3 using 2 periods
# Buffers use s16le format, with 48 frame per 1000us on core 0 with priority 0
Expand All @@ -172,7 +176,8 @@ DAI_ADD(sof/pipe-dai-capture.m4,
#DAI_ADD(sof/pipe-dai-playback.m4,
# 9, SSP, 4, NoCodec,
# PIPELINE_SOURCE_9, 2, s16le,
# 48, 1000, 0, 0)
# 48, 1000, 0, 0,
# SSP_BESPOKE_DATA(SSP, 4, 1))

# capture DAI is SSP4 using 2 periods
# Buffers use s16le format, with 48 frame per 1000us on core 0 with priority 0
Expand All @@ -186,7 +191,8 @@ DAI_ADD(sof/pipe-dai-capture.m4,
#DAI_ADD(sof/pipe-dai-playback.m4,
# 11, SSP, 5, NoCodec,
# PIPELINE_SOURCE_11, 2, s16le,
# 48, 1000, 0, 0)
# 48, 1000, 0, 0,
# SSP_BESPOKE_DATA(SSP, 5, 1))

# capture DAI is SSP5 using 2 periods
# Buffers use s16le format, with 48 frame per 1000us on core 0 with priority 0
Expand Down
3 changes: 2 additions & 1 deletion topology/sof-apl-pcm512x.m4
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ DAI_ADD(sof/pipe-dai-capture.m4,
DAI_ADD(sof/pipe-dai-playback.m4,
2, SSP, 5, SSP5-Codec,
PIPELINE_SOURCE_2, 2, s16le,
48, 1000, 0, 0)
48, 1000, 0, 0,
SSP_BESPOKE_DATA(SSP, 5, 1))

# capture DAI is SSP5 using 2 periods
# Buffers use s16le format, with 48 frame per 1000us on core 0 with priority 0
Expand Down
15 changes: 10 additions & 5 deletions topology/sof-apl-tdf8532.m4
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ PIPELINE_PCM_DAI_ADD(sof/pipe-volume-capture.m4,
DAI_ADD(sof/pipe-dai-playback.m4,
4, SSP, 0, SSP0-Codec,
PIPELINE_SOURCE_4, 2, s16le,
48, 1000, 0, 0)
48, 1000, 0, 0,
SSP_BESPOKE_DATA(SSP, 0, 1))

# capture DAI is SSP0 using 2 periods
# Buffers use s16le format, with 48 frame per 1000us on core 0 with priority 0
Expand All @@ -123,7 +124,8 @@ DAI_ADD(sof/pipe-dai-capture.m4,
DAI_ADD(sof/pipe-dai-playback.m4,
2, SSP, 2, SSP2-Codec,
PIPELINE_SOURCE_2, 2, s32le,
48, 1000, 0, 0)
48, 1000, 0, 0,
SSP_BESPOKE_DATA(SSP, 2, 1))

# capture DAI is SSP2 using 2 periods
# Buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0
Expand All @@ -137,7 +139,8 @@ DAI_ADD(sof/pipe-dai-capture.m4,
DAI_ADD(sof/pipe-dai-playback.m4,
7, SSP, 3, SSP3-Codec,
PIPELINE_SOURCE_7, 2, s16le,
48, 1000, 0, 0)
48, 1000, 0, 0,
SSP_BESPOKE_DATA(SSP, 3, 1))

# capture DAI is SSP3 using 2 periods
# Buffers use s16le format, with 48 frame per 1000us on core 0 with priority 0
Expand All @@ -151,14 +154,16 @@ DAI_ADD(sof/pipe-dai-capture.m4,
DAI_ADD(sof/pipe-dai-playback.m4,
1, SSP, 4, SSP4-Codec,
PIPELINE_SOURCE_1, 2, s32le,
48, 1000, 0, 0)
48, 1000, 0, 0,
SSP_BESPOKE_DATA(SSP, 4, 1))

# playback DAI is SSP5 using 2 periods
# Buffers use s16le format, with 48 frame per 1000us on core 0 with priority 0
DAI_ADD(sof/pipe-dai-playback.m4,
9, SSP, 5, SSP5-Codec,
PIPELINE_SOURCE_9, 2, s16le,
48, 1000, 0, 0)
48, 1000, 0, 0,
SSP_BESPOKE_DATA(SSP, 5, 1))

# capture DAI is SSP5 using 2 periods
# Buffers use s16le format, with 48 frame per 1000us on core 0 with priority 0
Expand Down
3 changes: 2 additions & 1 deletion topology/sof-bdw-rt286.m4
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ SectionGraph."pipe-bdw-rt286" {
DAI_ADD(sof/pipe-dai-playback.m4,
1, SSP, 0, Codec,
PIPELINE_SOURCE_1, 2, s24le,
48, 1000, 0, 0)
48, 1000, 0, 0,
SSP_BESPOKE_DATA(SSP, 0, 1))

# capture DAI is SSP0 using 2 periods
# Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0
Expand Down
3 changes: 2 additions & 1 deletion topology/sof-bdw-rt5640.m4
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ SectionGraph."pipe-bdw-rt5640" {
DAI_ADD(sof/pipe-dai-playback.m4,
1, SSP, 0, Codec,
PIPELINE_SOURCE_1, 2, s24le,
48, 1000, 0, 0)
48, 1000, 0, 0,
SSP_BESPOKE_DATA(SSP, 0, 1))

# capture DAI is SSP0 using 2 periods
# Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0
Expand Down
3 changes: 2 additions & 1 deletion topology/sof-byt-da7213.m4
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ SectionGraph."pipe-byt-da7212" {
DAI_ADD(sof/pipe-dai-playback.m4,
1, SSP, 2, SSP2-Codec,
PIPELINE_SOURCE_1, 2, s24le,
48, 1000, 0, 0)
48, 1000, 0, 0,
SSP_BESPOKE_DATA(SSP, 2, 1))

# capture DAI is SSP2 using 2 periods
# Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0
Expand Down
3 changes: 2 additions & 1 deletion topology/sof-byt-nocodec.m4
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ SectionGraph."pipe-byt-nocodec" {
DAI_ADD(sof/pipe-dai-playback.m4,
1, SSP, 2, NoCodec-2,
PIPELINE_SOURCE_1, 2, s24le,
48, 1000, 0, 0)
48, 1000, 0, 0,
SSP_BESPOKE_DATA(SSP, 2, 1))

# capture DAI is SSP2 using 2 periods
# Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0
Expand Down
3 changes: 2 additions & 1 deletion topology/sof-byt-rt5640.m4
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ SectionGraph."pipe-byt-rt5640" {
DAI_ADD(sof/pipe-dai-playback.m4,
1, SSP, 2, SSP2-Codec,
PIPELINE_SOURCE_1, 2, s24le,
48, 1000, 0, 0)
48, 1000, 0, 0,
SSP_BESPOKE_DATA(SSP, 2, 1))

# capture DAI is SSP2 using 2 periods
# Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0
Expand Down
3 changes: 2 additions & 1 deletion topology/sof-byt-rt5645.m4
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ SectionGraph."pipe-byt-rt5645" {
DAI_ADD(sof/pipe-dai-playback.m4,
1, SSP, 2, SSP2-Codec,
PIPELINE_SOURCE_1, 2, s24le,
48, 1000, 0, 0)
48, 1000, 0, 0,
SSP_BESPOKE_DATA(SSP, 2, 1))

# capture DAI is SSP2 using 2 periods
# Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0
Expand Down
3 changes: 2 additions & 1 deletion topology/sof-byt-rt5651.m4
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ SectionGraph."pipe-byt-rt5651" {
DAI_ADD(sof/pipe-dai-playback.m4,
1, SSP, 2, SSP2-Codec,
PIPELINE_SOURCE_1, 2, s24le,
48, 1000, 0, 0)
48, 1000, 0, 0,
SSP_BESPOKE_DATA(SSP, 2, 1))

# capture DAI is SSP2 using 2 periods
# Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0
Expand Down
3 changes: 2 additions & 1 deletion topology/sof-cht-max98090.m4
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ SectionGraph."pipe-cht-max98090" {
DAI_ADD(sof/pipe-dai-playback.m4,
1, SSP, 2, SSP2-Codec,
PIPELINE_SOURCE_1, 2, s16le,
48, 1000, 0, 0)
48, 1000, 0, 0,
SSP_BESPOKE_DATA(SSP, 2, 1))

# capture DAI is SSP2 using 2 periods
# Buffers use s16le format, with 48 frame per 1000us on core 0 with priority 0
Expand Down
3 changes: 2 additions & 1 deletion topology/sof-cht-nocodec.m4
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ SectionGraph."pipe-cht-nocodec" {
DAI_ADD(sof/pipe-dai-playback.m4,
1, SSP, 2, NoCodec-2,
PIPELINE_SOURCE_1, 2, s24le,
48, 1000, 0, 0)
48, 1000, 0, 0,
SSP_BESPOKE_DATA(SSP, 2, 1))

# capture DAI is SSP2 using 2 periods
# Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0
Expand Down
3 changes: 2 additions & 1 deletion topology/sof-cnl-rt274.m4
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ PIPELINE_PCM_DAI_ADD(sof/pipe-volume-capture.m4,
DAI_ADD(sof/pipe-dai-playback.m4,
1, SSP, 0, SSP0-Codec,
PIPELINE_SOURCE_1, 2, s24le,
48, 1000, 0, 0)
48, 1000, 0, 0,
SSP_BESPOKE_DATA(SSP, 0, 1))

# capture DAI is SSP0 using 2 periods
# Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0
Expand Down
3 changes: 2 additions & 1 deletion topology/sof-hsw-rt5640.m4
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ SectionGraph."pipe-hsw-rt5640" {
DAI_ADD(sof/pipe-dai-playback.m4,
1, SSP, 0, Codec,
PIPELINE_SOURCE_1, 2, s24le,
48, 1000, 0, 0)
48, 1000, 0, 0,
SSP_BESPOKE_DATA(SSP, 0, 1))

# capture DAI is SSP0 using 2 periods
# Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0
Expand Down
2 changes: 1 addition & 1 deletion topology/sof/pipe-dai-playback.m4
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ include(`pipeline.m4')
#
# DAI definitions
#
W_DAI_OUT(DAI_TYPE, DAI_INDEX, DAI_BE, DAI_FORMAT, 0, 2, 2)
W_DAI_OUT(DAI_TYPE, DAI_INDEX, DAI_BE, DAI_FORMAT, 0, 2, 2, DAI_BESPOKE_CONFIG)

#
# DAI pipeline - always use 0 for DAIs
Expand Down
1 change: 1 addition & 0 deletions topology/sof/tokens.m4
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ SectionVendorTokens."sof_dai_tokens" {
SOF_TKN_DAI_DMAC_CONFIG "153"
SOF_TKN_DAI_TYPE "154"
SOF_TKN_DAI_INDEX "155"
SOF_TKN_DAI_BESPOKE_CONFIG "157"
}

SectionVendorTokens."sof_sched_tokens" {
Expand Down
3 changes: 2 additions & 1 deletion topology/test/test-all.m4
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ PIPELINE_PCM_DAI_ADD(sof/pipe-TEST_PIPE_NAME-capture.m4,
DAI_ADD(sof/pipe-dai-playback.m4,
1, TEST_DAI_TYPE, TEST_DAI_PORT, TEST_DAI_LINK_NAME,
PIPELINE_SOURCE_1, 2, TEST_DAI_FORMAT,
48, 1000, 0, 0)
48, 1000, 0, 0,
SSP_BESPOKE_DATA(TEST_DAI_TYPE, TEST_DAI_PORT, 1))

# capture DAI is SSP TEST_DAI_PORT using 2 periods
# Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0
Expand Down