[Sound-open-firmware] [PATCH] topology: Add format and scheduling info to DAI pipelines.
![](https://secure.gravatar.com/avatar/24e6a8158be3c9b52253d878d1487123.jpg?s=120&d=mm&r=g)
Some pipelines can be used to service DAIs before data is sent on to other processing pipelines. Add scheduling and format info to DAI pipelines.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- topology/m4/build.m4 | 12 +++++++++++- topology/reef-apl-nocodec.m4 | 6 ++++-- topology/reef-bdw-rt286.m4 | 6 ++++-- topology/reef-bdw-rt5640.m4 | 6 ++++-- topology/reef-bxt-nocodec.m4 | 6 ++++-- topology/reef-byt-nocodec.m4 | 6 ++++-- topology/reef-byt-rt5640.m4 | 6 ++++-- topology/reef-byt-rt5651.m4 | 6 ++++-- topology/reef-cht-nocodec.m4 | 6 ++++-- topology/reef-hsw-rt5640.m4 | 6 ++++-- 10 files changed, 47 insertions(+), 19 deletions(-)
diff --git a/topology/m4/build.m4 b/topology/m4/build.m4 index 843dcbb..7d248da 100644 --- a/topology/m4/build.m4 +++ b/topology/m4/build.m4 @@ -81,7 +81,7 @@ define(`PIPELINE_ADD', `include($1)' )
-dnl DAI_ADD(pipeline, dai type, dai_index, stream_name, buffer, periods) +dnl DAI_ADD(pipeline, dai type, dai_index, stream_name, buffer, periods, format, frames, deadline, priority, core) define(`DAI_ADD', `undefine(`PIPELINE_ID')' `undefine(`DAI_TYPE')' @@ -89,6 +89,11 @@ define(`DAI_ADD', `undefine(`DAI_SNAME')' `undefine(`DAI_BUF')' `undefine(`DAI_PERIODS')' +`undefine(`DAI_FORMAT')' +`undefine(`SCHEDULE_FRAMES')' +`undefine(`SCHEDULE_DEADLINE')' +`undefine(`SCHEDULE_PRIORITY')' +`undefine(`SCHEDULE_CORE')' `define(`PIPELINE_ID', 0)' `define(`DAI_TYPE', STR($2))' `define(`DAI_INDEX', STR($3))' @@ -96,6 +101,11 @@ define(`DAI_ADD', `define(`DAI_BUF', $5)' `define(`DAI_NAME', $2$3)' `define(`DAI_PERIODS', $6)' +`define(`DAI_FORMAT', $7)' +`define(`SCHEDULE_FRAMES', $8)' +`define(`SCHEDULE_DEADLINE', $9)' +`define(`SCHEDULE_PRIORITY', $10)' +`define(`SCHEDULE_CORE', $11)' `include($1)' )
diff --git a/topology/reef-apl-nocodec.m4 b/topology/reef-apl-nocodec.m4 index 93b57fe..ef80fd3 100644 --- a/topology/reef-apl-nocodec.m4 +++ b/topology/reef-apl-nocodec.m4 @@ -74,10 +74,12 @@ SectionGraph."pipe-apl-nocodec" { #
# playback DAI is SSP2 using I2S DAPM stream and 2 periods -DAI_ADD(sof/pipe-dai-playback.m4, SSP, 2, I2S, PIPELINE_SOURCE_1, 2) +# Buffers use s24le format, with 48 frame per 1000us on core 0 with priorty 0 +DAI_ADD(sof/pipe-dai-playback.m4, SSP, 2, I2S, PIPELINE_SOURCE_1, 2, s24le, 48, 1000, 0, 0)
# capture DAI is SSP2 using I2S DAPM stream and 2 periods -DAI_ADD(sof/pipe-dai-capture.m4, SSP, 2, I2S, PIPELINE_SINK_2, 2) +# Buffers use s24le format, with 48 frame per 1000us on core 0 with priorty 0 +DAI_ADD(sof/pipe-dai-capture.m4, SSP, 2, I2S, PIPELINE_SINK_2, 2, s24le, 48, 1000, 0, 0)
# # BE configurations - overrides config in ACPI if present diff --git a/topology/reef-bdw-rt286.m4 b/topology/reef-bdw-rt286.m4 index e4b600a..e3f8dd9 100644 --- a/topology/reef-bdw-rt286.m4 +++ b/topology/reef-bdw-rt286.m4 @@ -74,10 +74,12 @@ SectionGraph."pipe-bdw-rt286" { #
# playback DAI is SSP0 using I2S DAPM stream and 2 periods -DAI_ADD(sof/pipe-dai-playback.m4, SSP, 0, I2S, PIPELINE_SOURCE_1, 2) +# Buffers use s24le format, with 48 frame per 1000us on core 0 with priorty 0 +DAI_ADD(sof/pipe-dai-playback.m4, SSP, 0, I2S, PIPELINE_SOURCE_1, 2, s24le, 48, 1000, 0, 0)
# capture DAI is SSP0 using I2S DAPM stream and 2 periods -DAI_ADD(sof/pipe-dai-capture.m4, SSP, 0, I2S, PIPELINE_SINK_2, 2) +# Buffers use s24le format, with 48 frame per 1000us on core 0 with priorty 0 +DAI_ADD(sof/pipe-dai-capture.m4, SSP, 0, I2S, PIPELINE_SINK_2, 2, s24le, 48, 1000, 0, 0)
# # BE configurations - overrides config in ACPI if present diff --git a/topology/reef-bdw-rt5640.m4 b/topology/reef-bdw-rt5640.m4 index 5d96236..4344605 100644 --- a/topology/reef-bdw-rt5640.m4 +++ b/topology/reef-bdw-rt5640.m4 @@ -74,10 +74,12 @@ SectionGraph."pipe-bdw-rt5640" { #
# playback DAI is SSP0 using I2S DAPM stream and 2 periods -DAI_ADD(sof/pipe-dai-playback.m4, SSP, 0, I2S, PIPELINE_SOURCE_1, 2) +# Buffers use s24le format, with 48 frame per 1000us on core 0 with priorty 0 +DAI_ADD(sof/pipe-dai-playback.m4, SSP, 0, I2S, PIPELINE_SOURCE_1, 2, s24le, 48, 1000, 0, 0)
# capture DAI is SSP0 using I2S DAPM stream and 2 periods -DAI_ADD(sof/pipe-dai-capture.m4, SSP, 0, I2S, PIPELINE_SINK_2, 2) +# Buffers use s24le format, with 48 frame per 1000us on core 0 with priorty 0 +DAI_ADD(sof/pipe-dai-capture.m4, SSP, 0, I2S, PIPELINE_SINK_2, 2, s24le, 48, 1000, 0, 0)
# # BE configurations - overrides config in ACPI if present diff --git a/topology/reef-bxt-nocodec.m4 b/topology/reef-bxt-nocodec.m4 index a8fd320..2028323 100644 --- a/topology/reef-bxt-nocodec.m4 +++ b/topology/reef-bxt-nocodec.m4 @@ -74,10 +74,12 @@ SectionGraph."pipe-bxt-nocodec" { #
# playback DAI is SSP2 using I2S DAPM stream and 2 periods -DAI_ADD(sof/pipe-dai-playback.m4, SSP, 2, I2S, PIPELINE_SOURCE_1, 2) +# Buffers use s24le format, with 48 frame per 1000us on core 0 with priorty 0 +DAI_ADD(sof/pipe-dai-playback.m4, SSP, 2, I2S, PIPELINE_SOURCE_1, 2, s24le, 48, 1000, 0, 0)
# capture DAI is SSP2 using I2S DAPM stream and 2 periods -DAI_ADD(sof/pipe-dai-capture.m4, SSP, 2, I2S, PIPELINE_SINK_2, 2) +# Buffers use s24le format, with 48 frame per 1000us on core 0 with priorty 0 +DAI_ADD(sof/pipe-dai-capture.m4, SSP, 2, I2S, PIPELINE_SINK_2, 2, s24le, 48, 1000, 0, 0)
# # BE configurations - overrides config in ACPI if present diff --git a/topology/reef-byt-nocodec.m4 b/topology/reef-byt-nocodec.m4 index 01b223d..1c3cf5f 100644 --- a/topology/reef-byt-nocodec.m4 +++ b/topology/reef-byt-nocodec.m4 @@ -65,10 +65,12 @@ SectionGraph."pipe-byt-nocodec" { #
# playback DAI is SSP2 using I2S DAPM stream and 2 periods -DAI_ADD(sof/pipe-dai-playback.m4, SSP, 2, I2S, PIPELINE_SOURCE_1, 2) +# Buffers use s24le format, with 48 frame per 1000us on core 0 with priorty 0 +DAI_ADD(sof/pipe-dai-playback.m4, SSP, 2, I2S, PIPELINE_SOURCE_1, 2, s24le, 48, 1000, 0, 0)
# capture DAI is SSP2 using I2S DAPM stream and 2 periods -DAI_ADD(sof/pipe-dai-capture.m4, SSP, 2, I2S, PIPELINE_SINK_2, 2) +# Buffers use s24le format, with 48 frame per 1000us on core 0 with priorty 0 +DAI_ADD(sof/pipe-dai-capture.m4, SSP, 2, I2S, PIPELINE_SINK_2, 2, s24le, 48, 1000, 0, 0)
# # BE configurations - overrides config in ACPI if present diff --git a/topology/reef-byt-rt5640.m4 b/topology/reef-byt-rt5640.m4 index 00d31c7..0629d43 100644 --- a/topology/reef-byt-rt5640.m4 +++ b/topology/reef-byt-rt5640.m4 @@ -65,10 +65,12 @@ SectionGraph."pipe-byt-rt5640" { #
# playback DAI is SSP2 using I2S DAPM stream and 2 periods -DAI_ADD(sof/pipe-dai-playback.m4, SSP, 2, I2S, PIPELINE_SOURCE_1, 2) +# Buffers use s24le format, with 48 frame per 1000us on core 0 with priorty 0 +DAI_ADD(sof/pipe-dai-playback.m4, SSP, 2, I2S, PIPELINE_SOURCE_1, 2, s24le, 48, 1000, 0, 0)
# capture DAI is SSP2 using I2S DAPM stream and 2 periods -DAI_ADD(sof/pipe-dai-capture.m4, SSP, 2, I2S, PIPELINE_SINK_2, 2) +# Buffers use s24le format, with 48 frame per 1000us on core 0 with priorty 0 +DAI_ADD(sof/pipe-dai-capture.m4, SSP, 2, I2S, PIPELINE_SINK_2, 2, s24le, 48, 1000, 0, 0)
# # BE configurations - overrides config in ACPI if present diff --git a/topology/reef-byt-rt5651.m4 b/topology/reef-byt-rt5651.m4 index fd5263f..1b492b7 100644 --- a/topology/reef-byt-rt5651.m4 +++ b/topology/reef-byt-rt5651.m4 @@ -65,10 +65,12 @@ SectionGraph."pipe-byt-rt5651" { #
# playback DAI is SSP2 using "Audio" DAPM stream name and 2 periods -DAI_ADD(sof/pipe-dai-playback.m4, SSP, 2, Audio, PIPELINE_SOURCE_1, 2) +# Buffers use s24le format, with 48 frame per 1000us on core 0 with priorty 0 +DAI_ADD(sof/pipe-dai-playback.m4, SSP, 2, Audio, PIPELINE_SOURCE_1, 2, s24le, 48, 1000, 0, 0)
# capture DAI is SSP2 using "Audio" DAPM stream name and 2 periods -DAI_ADD(sof/pipe-dai-capture.m4, SSP, 2, Audio, PIPELINE_SINK_2, 2) +# Buffers use s24le format, with 48 frame per 1000us on core 0 with priorty 0 +DAI_ADD(sof/pipe-dai-capture.m4, SSP, 2, Audio, PIPELINE_SINK_2, 2, s24le, 48, 1000, 0, 0)
# # BE configurations - overrides config in ACPI if present diff --git a/topology/reef-cht-nocodec.m4 b/topology/reef-cht-nocodec.m4 index 334443b..ead0f75 100644 --- a/topology/reef-cht-nocodec.m4 +++ b/topology/reef-cht-nocodec.m4 @@ -65,10 +65,12 @@ SectionGraph."pipe-cht-nocodec" { #
# playback DAI is SSP2 using I2S DAPM stream and 2 periods -DAI_ADD(sof/pipe-dai-playback.m4, SSP, 2, I2S, PIPELINE_SOURCE_1, 2) +# Buffers use s24le format, with 48 frame per 1000us on core 0 with priorty 0 +DAI_ADD(sof/pipe-dai-playback.m4, SSP, 2, I2S, PIPELINE_SOURCE_1, 2, s24le, 48, 1000, 0, 0)
# capture DAI is SSP2 using I2S DAPM stream and 2 periods -DAI_ADD(sof/pipe-dai-capture.m4, SSP, 2, I2S, PIPELINE_SINK_2, 2) +# Buffers use s24le format, with 48 frame per 1000us on core 0 with priorty 0 +DAI_ADD(sof/pipe-dai-capture.m4, SSP, 2, I2S, PIPELINE_SINK_2, 2, s24le, 48, 1000, 0, 0)
# # BE configurations - overrides config in ACPI if present diff --git a/topology/reef-hsw-rt5640.m4 b/topology/reef-hsw-rt5640.m4 index 3a76223..e4d9392 100644 --- a/topology/reef-hsw-rt5640.m4 +++ b/topology/reef-hsw-rt5640.m4 @@ -74,10 +74,12 @@ SectionGraph."pipe-hsw-rt5640" { #
# playback DAI is SSP0 using I2S DAPM stream and 2 periods -DAI_ADD(sof/pipe-dai-playback.m4, SSP, 0, I2S, PIPELINE_SOURCE_1, 2) +# Buffers use s24le format, with 48 frame per 1000us on core 0 with priorty 0 +DAI_ADD(sof/pipe-dai-playback.m4, SSP, 0, I2S, PIPELINE_SOURCE_1, 2, s24le, 48, 1000, 0, 0)
# capture DAI is SSP0 using I2S DAPM stream and 2 periods -DAI_ADD(sof/pipe-dai-capture.m4, SSP, 0, I2S, PIPELINE_SINK_2, 2) +# Buffers use s24le format, with 48 frame per 1000us on core 0 with priorty 0 +DAI_ADD(sof/pipe-dai-capture.m4, SSP, 0, I2S, PIPELINE_SINK_2, 2, s24le, 48, 1000, 0, 0)
# # BE configurations - overrides config in ACPI if present
![](https://secure.gravatar.com/avatar/24e6a8158be3c9b52253d878d1487123.jpg?s=120&d=mm&r=g)
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- rmbox/rmbox.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/rmbox/rmbox.c b/rmbox/rmbox.c index 1ea7835..b51ddcc 100644 --- a/rmbox/rmbox.c +++ b/rmbox/rmbox.c @@ -92,7 +92,10 @@ static inline char get_char(uint32_t val, int idx)
static void usage(char *name) { - fprintf(stdout, "%s:\t -i infile -o outfile\n", name); + fprintf(stdout, "Usage %s <option(s)> <file(s)>\n", name); + fprintf(stdout, "%s:\t -i infile -o outfile\tDump infile contents to outfile\n", name); + fprintf(stdout, "%s:\t -c\t\t\tSet timestamp clock in MHz\n", name); + fprintf(stdout, "%s:\t -s\t\t\tTake a snapshot of state\n", name); exit(0); }
@@ -276,9 +279,6 @@ int main(int argc, char *argv[]) } }
- if (argc > 1 && (in_file == NULL || out_file == NULL)) - usage(argv[0]); - /* open infile for reading */ in_fd = fopen(in_file, "r"); if (in_fd == NULL) {
![](https://secure.gravatar.com/avatar/24e6a8158be3c9b52253d878d1487123.jpg?s=120&d=mm&r=g)
Allow timestamp clock frequency to be set in MHz
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- rmbox/rmbox.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-)
diff --git a/rmbox/rmbox.c b/rmbox/rmbox.c index b51ddcc..1f81e06 100644 --- a/rmbox/rmbox.c +++ b/rmbox/rmbox.c @@ -99,23 +99,38 @@ static void usage(char *name) exit(0); }
-static inline float to_usecs(uint32_t time, uint32_t clk) +static float to_usecs(uint32_t time, float clk) { /* trace timestamp uses CPU system clock at default 25MHz ticks */ // TODO: support variable clock rates return (float)time / clk; }
-static void show_trace(uint32_t val, uint32_t addr, uint32_t *timestamp, uint32_t clk) +static void show_trace(uint32_t val, uint32_t addr, uint32_t *timestamp, float clk) { const char *trace; uint32_t class; + uint32_t delta = val - *timestamp; + float fdelta = to_usecs(delta, clk);
/* timestamp or value ? */ if ((addr % 8) == 0) { + + /* buffer wrap ? */ + if (val < *timestamp) { + printf("----------------------------------------" + "----------------------------------------" + "--------------------------------------\n"); + delta = 0; + fdelta = 0.0; + } else { + delta = val - *timestamp; + fdelta = to_usecs(delta, clk); + } + printf("trace.io: timestamp 0x%8.8x (%2.2f us) \tdelta 0x%8.8x (%2.2f us)\t", (uint32_t)val, to_usecs(val, clk), - (uint32_t)val - *timestamp, to_usecs(val - *timestamp, clk)); + (uint32_t)delta, fdelta); *timestamp = val; return; } @@ -258,7 +273,8 @@ int main(int argc, char *argv[]) const char * out_file = NULL, *in_file = "/sys/kernel/debug/sof/mbox"; FILE *in_fd = NULL, *out_fd = NULL; char c, tmp[4] = {0}; - uint32_t addr = 0, val, clk = 25, timestamp = 0; + uint32_t addr = 0, val, timestamp = 0; + float clk = 19.2f;
while ((opt = getopt(argc, argv, "ho:i:s:m:c:")) != -1) { switch (opt) { @@ -269,7 +285,7 @@ int main(int argc, char *argv[]) in_file = optarg; break; case 'c': - clk = atoi(optarg); + clk = atof(optarg); break; case 's': return snapshot(optarg); @@ -301,6 +317,8 @@ int main(int argc, char *argv[])
/* start to converting mailbox */ convert: + fprintf(stdout, "using %2.2fMHz timestamp clock\n", clk); + while (1) { count = fread(&tmp[0], 1, 4, in_fd); if (count != 4)
participants (1)
-
Liam Girdwood