From 35fa6e375743ec8b7815af5ab7ffc46c2671bb48 Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Thu, 5 Mar 2020 15:25:13 +0800 Subject: [PATCH 1/7] [HACK]: set alh channel = 2 by default To avoid it is reset to 0 when second alh is registered to the same stream. Signed-off-by: Bard Liao --- src/drivers/intel/cavs/alh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/drivers/intel/cavs/alh.c b/src/drivers/intel/cavs/alh.c index 9fa2ad3f5467..678a97916b8c 100644 --- a/src/drivers/intel/cavs/alh.c +++ b/src/drivers/intel/cavs/alh.c @@ -41,7 +41,7 @@ static int alh_get_hw_params(struct dai *dai, { /* 0 means variable */ params->rate = 0; - params->channels = 0; + params->channels = 2; params->buffer_fmt = 0; params->frame_fmt = 0; From 2ece726f6981df629963de4ccf5127e025512871 Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Wed, 11 Mar 2020 16:38:33 +0800 Subject: [PATCH 2/7] topology: add pipe-dai-sched-playback This is basically the same as pipe-dai-playback.m4, but use SCHED_COMP instead of N_DAI_OUT. Signed-off-by: Bard Liao --- tools/topology/sof/pipe-dai-sched-playback.m4 | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tools/topology/sof/pipe-dai-sched-playback.m4 diff --git a/tools/topology/sof/pipe-dai-sched-playback.m4 b/tools/topology/sof/pipe-dai-sched-playback.m4 new file mode 100644 index 000000000000..2ebf98473a6c --- /dev/null +++ b/tools/topology/sof/pipe-dai-sched-playback.m4 @@ -0,0 +1,24 @@ +# DAI Playback connector + +# Include topology builder +include(`utils.m4') +include(`dai.m4') +include(`pipeline.m4') + +# +# DAI definitions +# +W_DAI_OUT(DAI_TYPE, DAI_INDEX, DAI_BE, DAI_FORMAT, 0, DAI_PERIODS) + +# +# DAI pipeline - always use 0 for DAIs +# +W_PIPELINE(SCHED_COMP, SCHEDULE_PERIOD, SCHEDULE_PRIORITY, SCHEDULE_CORE, SCHEDULE_TIME_DOMAIN, pipe_dai_schedule_plat) + +# +# Graph connections to pipelines + +P_GRAPH(DAI_NAME, PIPELINE_ID, + LIST(` ', `dapm(N_DAI_OUT, DAI_BUF)')) + +indir(`define', concat(`PIPELINE_PLAYBACK_SCHED_COMP_', PIPELINE_ID), N_DAI_OUT) From 5194bf5090d20716e20885e62b0e520da13ecce6 Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Wed, 11 Mar 2020 15:12:29 +0800 Subject: [PATCH 3/7] topology: dai: add DAI_ADD_SCHED to set scheduling component So we can set scheduling component when adding a DAI. Signed-off-by: Bard Liao --- tools/topology/m4/dai.m4 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/topology/m4/dai.m4 b/tools/topology/m4/dai.m4 index e668cae69b0b..8901d218f58d 100644 --- a/tools/topology/m4/dai.m4 +++ b/tools/topology/m4/dai.m4 @@ -200,4 +200,9 @@ define(`DAI_ADD', `DEBUG_DAI($3, $4)' ) +define(`DAI_ADD_SCHED', +`undefine(`SCHED_COMP')' +`define(`SCHED_COMP', $13)' +`DAI_ADD($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)' +) divert(0)dnl From bf2657f16edd919a5b44032421055d2e6a989c48 Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Wed, 11 Mar 2020 16:30:54 +0800 Subject: [PATCH 4/7] topology: add pipe-simple-playback This will create a basic pipeline with a buffer only. Note that we don't implement a SectionGraph to connect the buffer to its starting component, we should define it manually. Signed-off-by: Bard Liao --- tools/topology/sof/pipe-simple-playback.m4 | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tools/topology/sof/pipe-simple-playback.m4 diff --git a/tools/topology/sof/pipe-simple-playback.m4 b/tools/topology/sof/pipe-simple-playback.m4 new file mode 100644 index 000000000000..18b19ffd8d8b --- /dev/null +++ b/tools/topology/sof/pipe-simple-playback.m4 @@ -0,0 +1,26 @@ +# Low Latency Passthrough Pipeline and PCM +# +# Pipeline Endpoints for connection are :- +# +# B0 --> sink DAI0 + +# Include topology builder +include(`utils.m4') +include(`buffer.m4') +include(`dai.m4') +include(`pipeline.m4') + +# +# Components and Buffers +# + +# Playback Buffers +W_BUFFER(0, COMP_BUFFER_SIZE(DAI_PERIODS, + COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)), + PLATFORM_PASS_MEM_CAP) + +# +# Pipeline Source and Sinks +# +indir(`define', concat(`PIPELINE_SOURCE_', PIPELINE_ID), N_BUFFER(0)) + From b9ecd4351cdf8f552589700977e1c633570e3001 Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Wed, 11 Mar 2020 15:19:00 +0800 Subject: [PATCH 5/7] topology: pipe-volume-demux-playback: Move demux after volume So the volume control will apply to both pipelines. Signed-off-by: Bard Liao --- tools/topology/sof/pipe-volume-demux-playback.m4 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/topology/sof/pipe-volume-demux-playback.m4 b/tools/topology/sof/pipe-volume-demux-playback.m4 index 5b3ae308ed8f..4b30c77797e7 100644 --- a/tools/topology/sof/pipe-volume-demux-playback.m4 +++ b/tools/topology/sof/pipe-volume-demux-playback.m4 @@ -8,9 +8,9 @@ # B2 (DAI buffer) # # -# host PCM_P -- B0 --> Demux(M) -- B1 --> volume -- B2 --> sink DAI0 -# | -# pipeline n+1 --> DAI +# host PCM_P -- B0 --> volume -- B1 --> Demux(M) -- B2 --> sink DAI0 +# | +# pipeline n+1 --> DAI # # Include topology builder @@ -86,10 +86,10 @@ W_BUFFER(2, COMP_BUFFER_SIZE(DAI_PERIODS, P_GRAPH(pipe-ll-playback-PIPELINE_ID, PIPELINE_ID, LIST(` ', `dapm(N_BUFFER(0), N_PCMP(PCM_ID))', - `dapm(N_MUXDEMUX(0), N_BUFFER(0))', - `dapm(N_BUFFER(1), N_MUXDEMUX(0))', - `dapm(N_PGA(1), N_BUFFER(1))', - `dapm(N_BUFFER(2), N_PGA(1))')) + `dapm(N_PGA(1), N_BUFFER(0))', + `dapm(N_BUFFER(1), N_PGA(1))', + `dapm(N_MUXDEMUX(0), N_BUFFER(1))', + `dapm(N_BUFFER(2), N_MUXDEMUX(0))')) # # Pipeline Source and Sinks # From 3877357376e7d1ddbfac9575edf0e8327794ccbc Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Wed, 11 Mar 2020 15:30:59 +0800 Subject: [PATCH 6/7] [HACK]: topology: demux_coef_default: modify pipeline ids We presume demux will connect to pipeline with id 1 and 5, but in our case, it is 3 and 4. We have to figure out a way to configure it. Signed-off-by: Bard Liao --- tools/topology/m4/demux_coef_default.m4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/topology/m4/demux_coef_default.m4 b/tools/topology/m4/demux_coef_default.m4 index 503da3039f1b..2bd1a3c49c8b 100644 --- a/tools/topology/m4/demux_coef_default.m4 +++ b/tools/topology/m4/demux_coef_default.m4 @@ -4,8 +4,8 @@ CONTROLBYTES_PRIV(DEMUX_priv, ` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,' ` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,' ` 0x02,0x00,0x02,0x00,0x02,0x00,0x00,0x00,' -` 0x01,0x00,0x00,0x00,0x02,0x01,0x02,0x04,' +` 0x03,0x00,0x00,0x00,0x02,0x01,0x02,0x04,' ` 0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00,' -` 0x05,0x00,0x00,0x00,0x02,0x01,0x02,0x04,' +` 0x04,0x00,0x00,0x00,0x02,0x01,0x02,0x04,' ` 0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00"' ) From 175d8f3d61e748bdb4d52b3781cae40016a530be Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Wed, 11 Mar 2020 15:41:58 +0800 Subject: [PATCH 7/7] topology: sof-icl-rt711-rt1308-rt715-hdmi: Merge two pipeline with demux Now kernel expots one PCM with two CPU dais. So use demux to play with two DAIs. Signed-off-by: Bard Liao --- .../sof-icl-rt711-rt1308-rt715-hdmi.m4 | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/tools/topology/sof-icl-rt711-rt1308-rt715-hdmi.m4 b/tools/topology/sof-icl-rt711-rt1308-rt715-hdmi.m4 index a53b11e0e110..6d54030c9d9d 100644 --- a/tools/topology/sof-icl-rt711-rt1308-rt715-hdmi.m4 +++ b/tools/topology/sof-icl-rt711-rt1308-rt715-hdmi.m4 @@ -53,7 +53,7 @@ PIPELINE_PCM_ADD(sof/pipe-volume-capture.m4, # Low Latency playback pipeline 3 on PCM 2 using max 2 channels of s32le. # Schedule 48 frames per 1000us deadline on core 0 with priority 0 -PIPELINE_PCM_ADD(sof/pipe-volume-playback.m4, +PIPELINE_PCM_ADD(sof/pipe-volume-demux-playback.m4, 3, 2, 2, s32le, 1000, 0, 0, 48000, 48000, 48000) @@ -61,7 +61,7 @@ PIPELINE_PCM_ADD(sof/pipe-volume-playback.m4, ifdef(`MONO', `', `# Low Latency playback pipeline 4 on PCM 3 using max 2 channels of s32le. # Schedule 48 frames per 1000us deadline on core 0 with priority 0 -PIPELINE_PCM_ADD(sof/pipe-volume-playback.m4, +PIPELINE_PCM_ADD(sof/pipe-simple-playback.m4, 4, 3, 2, s32le, 1000, 0, 0, 48000, 48000, 48000)') @@ -127,10 +127,21 @@ DAI_ADD(sof/pipe-dai-playback.m4, ifdef(`MONO', `', `# playback DAI is ALH(SDW2 PIN2) using 2 periods # Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0 -DAI_ADD(sof/pipe-dai-playback.m4, - 4, ALH, 0x202, SDW2-Playback, +DAI_ADD_SCHED(sof/pipe-dai-sched-playback.m4, + 4, ALH, 0x202, SDW1-Playback, PIPELINE_SOURCE_4, 2, s24le, - 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER)') + 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER, + PIPELINE_PLAYBACK_SCHED_COMP_3)') + +# Connect demux to capture +SectionGraph."PIPE_DEMUX" { + index "4" + + lines [ + # mux to 2nd pipeline + dapm(PIPELINE_SOURCE_4, PIPELINE_DEMUX_3) + ] +} # capture DAI is ALH(SDW3 PIN2) using 2 periods # Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0 @@ -165,7 +176,6 @@ dnl PCM_PLAYBACK_ADD(name, pcm_id, playback) PCM_PLAYBACK_ADD(Headphone, 0, PIPELINE_PCM_1) PCM_CAPTURE_ADD(Headset mic, 1, PIPELINE_PCM_2) PCM_PLAYBACK_ADD(SDW1-speakers, 2, PIPELINE_PCM_3) -ifdef(`MONO', `', `PCM_PLAYBACK_ADD(SDW2-speakers, 3, PIPELINE_PCM_4)') PCM_CAPTURE_ADD(Microphones, 4, PIPELINE_PCM_5) PCM_PLAYBACK_ADD(HDMI1, 5, PIPELINE_PCM_6) PCM_PLAYBACK_ADD(HDMI2, 6, PIPELINE_PCM_7) @@ -185,9 +195,6 @@ DAI_CONFIG(ALH, 3, 1, SDW0-Capture) #ALH SDW1 Pin2 (ID: 2) DAI_CONFIG(ALH, 0x102, 2, SDW1-Playback) -#ALH SDW2 Pin2 (ID: 3) -ifdef(`MONO', `', `DAI_CONFIG(ALH, 0x202, 3, SDW2-Playback)') - #ALH SDW3 Pin2 (ID: 4) DAI_CONFIG(ALH, 0x302, 4, SDW3-Capture)