From a82591f690bb1ba22881f4f88bf24dbd8994a703 Mon Sep 17 00:00:00 2001 From: Libin Yang Date: Fri, 7 Feb 2020 13:41:09 +0800 Subject: [PATCH 1/3] topology: add pipe-volume-switch-capture pipeline This patch adds the capture pipeline which enables the volume and switch controls. In the switch control, it enables capture LED controlling. Signed-off-by: Libin Yang --- .../sof/pipe-volume-switch-capture.m4 | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 tools/topology/sof/pipe-volume-switch-capture.m4 diff --git a/tools/topology/sof/pipe-volume-switch-capture.m4 b/tools/topology/sof/pipe-volume-switch-capture.m4 new file mode 100644 index 000000000000..ddeedc6dcf6e --- /dev/null +++ b/tools/topology/sof/pipe-volume-switch-capture.m4 @@ -0,0 +1,89 @@ +# Passthrough with volume/switch Pipeline and PCM +# +# Pipeline Endpoints for connection are :- +# +# host PCM_C <-- B0 <-- Volume 0 <-- B1 <-- source DAI0 + +# Include topology builder +include(`utils.m4') +include(`buffer.m4') +include(`pcm.m4') +include(`pga.m4') +include(`dai.m4') +include(`mixercontrol.m4') +include(`pipeline.m4') + +# +# Controls +# +# Volume Mixer control with max value of 32 +C_CONTROLMIXER(Master Capture Volume, PIPELINE_ID, + CONTROLMIXER_OPS(volsw, 256 binds the mixer control to volume get/put handlers, 256, 256), + CONTROLMIXER_MAX(, 80), + false, + CONTROLMIXER_TLV(TLV 80 steps from -50dB to +30dB for 1dB, vtlv_m50s1), + Channel register and shift for Front Left/Right, + LIST(` ', KCONTROL_CHANNEL(FL, 1, 0), KCONTROL_CHANNEL(FR, 1, 1))) + +C_CONTROLMIXER(Master Capture Switch, PIPELINE_ID, + CONTROLMIXER_OPS(volsw, 259 binds the mixer control to switch get/put handlers, 259, 259), + CONTROLMIXER_MAX(max 1 indicates switch type control, 1), + false, + , + Channel register and shift for Front Left/Right, + LIST(` ', KCONTROL_CHANNEL(FL, 2, 0), KCONTROL_CHANNEL(FR, 2, 1)), + "1", "1") + +# +# Volume Configuration +# + +W_VENDORTUPLES(capture_pga_tokens, sof_volume_tokens, +LIST(` ', `SOF_TKN_VOLUME_RAMP_STEP_TYPE "0"' + ` ', `SOF_TKN_VOLUME_RAMP_STEP_MS "250"')) + +W_DATA(capture_pga_conf, capture_pga_tokens) + +# +# Components and Buffers +# + +# Host "Passthrough Capture" PCM +# with 0 sink and 2 source periods +W_PCM_CAPTURE(PCM_ID, Passthrough Capture, 0, 2) + +# "Volume" has x source and 2 sink periods +W_PGA(0, PIPELINE_FORMAT, 2, DAI_PERIODS, capture_pga_conf, LIST(` ', "PIPELINE_ID Master Capture Volume", "PIPELINE_ID Master Capture Switch")) + +# Capture Buffers +W_BUFFER(0, COMP_BUFFER_SIZE(2, + COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)), + PLATFORM_HOST_MEM_CAP) +W_BUFFER(1, COMP_BUFFER_SIZE(DAI_PERIODS, + COMP_SAMPLE_SIZE(DAI_FORMAT), PIPELINE_CHANNELS, COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)), + PLATFORM_DAI_MEM_CAP) + +# +# Pipeline Graph +# +# host PCM_P <-- B0 <-- Volume 0 <-- B1 <-- sink DAI0 + +P_GRAPH(pipe-pass-vol-capture-PIPELINE_ID, PIPELINE_ID, + LIST(` ', + `dapm(N_PCMC(PCM_ID), N_BUFFER(0))', + `dapm(N_BUFFER(0), N_PGA(0))', + `dapm(N_PGA(0), N_BUFFER(1))')) + +# +# Pipeline Source and Sinks +# +indir(`define', concat(`PIPELINE_SINK_', PIPELINE_ID), N_BUFFER(1)) +indir(`define', concat(`PIPELINE_PCM_', PIPELINE_ID), Passthrough Capture PCM_ID) + +# +# PCM Configuration +# + +PCM_CAPABILITIES(Passthrough Capture PCM_ID, `S32_LE,S24_LE,S16_LE', + PCM_MIN_RATE, PCM_MAX_RATE, PIPELINE_CHANNELS, PIPELINE_CHANNELS, + 2, 16, 192, 16384, 65536, 65536) From bdd236320b01b1806634aa3bf0647364c0c1454b Mon Sep 17 00:00:00 2001 From: Libin Yang Date: Wed, 11 Mar 2020 13:31:29 +0800 Subject: [PATCH 2/3] topology: add pipe-highpass-switch-capture pipeline This patch adds the highpass capture pipeline which enables the volume and switch controls. In the switch control, it enables capture LED controlling. Signed-off-by: Libin Yang --- .../sof/pipe-highpass-switch-capture.m4 | 134 ++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 tools/topology/sof/pipe-highpass-switch-capture.m4 diff --git a/tools/topology/sof/pipe-highpass-switch-capture.m4 b/tools/topology/sof/pipe-highpass-switch-capture.m4 new file mode 100644 index 000000000000..8377c8a4520b --- /dev/null +++ b/tools/topology/sof/pipe-highpass-switch-capture.m4 @@ -0,0 +1,134 @@ +# IIR highpass filter, volume/switch control, and PCM +# +# Pipeline Endpoints for connection are :- +# +# host PCM_C <-- B0 <-- Volume <-- B1 <-- EQ_IIR <-- B2 <-- source DAI0 + +# Include topology builder +include(`utils.m4') +include(`buffer.m4') +include(`pcm.m4') +include(`pga.m4') +include(`dai.m4') +include(`mixercontrol.m4') +include(`pipeline.m4') +include(`bytecontrol.m4') +include(`eq_iir.m4') + +# +# Controls +# +# Volume Mixer control with max value of 32 +C_CONTROLMIXER(Master Capture Volume, PIPELINE_ID, + CONTROLMIXER_OPS(volsw, + 256 binds the mixer control to volume get/put handlers, + 256, 256), + CONTROLMIXER_MAX(, 80), + false, + CONTROLMIXER_TLV(TLV 80 steps from -50dB to +30dB for 1dB, vtlv_m50s1), + Channel register and shift for Front Left/Right, + LIST(` ', KCONTROL_CHANNEL(FL, 1, 0), KCONTROL_CHANNEL(FR, 1, 1))) + +C_CONTROLMIXER(Master Capture Switch, PIPELINE_ID, + CONTROLMIXER_OPS(volsw, + 259 binds the mixer control to switch get/put handlers, + 259, 259), + CONTROLMIXER_MAX(max 1 indicates switch type control, 1), + false, + , + Channel register and shift for Front Left/Right, + LIST(` ', KCONTROL_CHANNEL(FL, 2, 0), KCONTROL_CHANNEL(FR, 2, 1)), + "1", "1") +# +# Volume Configuration +# + +define(MY_PGA_TOKENS, concat(`pga_tokens_', PIPELINE_ID)) +define(MY_PGA_CONF, concat(`pga_conf_', PIPELINE_ID)) +W_VENDORTUPLES(MY_PGA_TOKENS, sof_volume_tokens, +LIST(` ', `SOF_TKN_VOLUME_RAMP_STEP_TYPE "0"' + ` ', `SOF_TKN_VOLUME_RAMP_STEP_MS "400"')) + +W_DATA(MY_PGA_CONF, MY_PGA_TOKENS) + +# +# IIR configuration +# + +include(`eq_iir_coef_highpass_40hz_0db_48khz.m4') + +# EQ Bytes control with max value of 255 +define(MY_EQIIR_BYTES, concat(`eqiir_bytes_', PIPELINE_ID)) +C_CONTROLBYTES(MY_EQIIR_BYTES, PIPELINE_ID, + CONTROLBYTES_OPS(bytes, + 258 binds the mixer control to bytes get/put handlers, + 258, 258), + CONTROLBYTES_EXTOPS( + 258 binds the mixer control to bytes get/put handlers, + 258, 258), + , , , + CONTROLBYTES_MAX(, 304), + , + EQIIR_HP40HZ0dB48K_priv) + +# +# Components and Buffers +# + +# Host "Highpass Capture" PCM +# with 0 sink and 2 source periods +W_PCM_CAPTURE(PCM_ID, Highpass Capture, 0, 2) + +# "Volume" has 2 sink and 2 source periods +W_PGA(0, PIPELINE_FORMAT, 2, DAI_PERIODS, MY_PGA_CONF, + LIST(` ', "PIPELINE_ID Master Capture Volume", + "PIPELINE_ID Master Capture Switch")) + +# "EQ_IIR 0" has 2 sink and x source periods +W_EQ_IIR(0, PIPELINE_FORMAT, 2, DAI_PERIODS, + LIST(` ', "MY_EQIIR_BYTES")) + +# Capture Buffers +W_BUFFER(0, COMP_BUFFER_SIZE(2, + COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, + COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)), + PLATFORM_HOST_MEM_CAP) +W_BUFFER(1, COMP_BUFFER_SIZE(2, + COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, + COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)), + PLATFORM_HOST_MEM_CAP) +W_BUFFER(2, COMP_BUFFER_SIZE(DAI_PERIODS, + COMP_SAMPLE_SIZE(DAI_FORMAT), PIPELINE_CHANNELS, + COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)), + PLATFORM_DAI_MEM_CAP) + +# +# Pipeline Graph +# +# host PCM_P <-- B0 <-- Volume 0 <-- B1 <-- EQ_IIR 0 <-- B2 <-- sink DAI0 + +P_GRAPH(pipe-pass-vol-capture-PIPELINE_ID, PIPELINE_ID, + LIST(` ', + `dapm(N_PCMC(PCM_ID), N_BUFFER(0))', + `dapm(N_BUFFER(0), N_PGA(0))', + `dapm(N_PGA(0), N_BUFFER(1))', + `dapm(N_BUFFER(1), N_EQ_IIR(0))', + `dapm(N_EQ_IIR(0), N_BUFFER(2))')) + +# +# Pipeline Source and Sinks +# +indir(`define', concat(`PIPELINE_SINK_', PIPELINE_ID), N_BUFFER(2)) +indir(`define', concat(`PIPELINE_PCM_', PIPELINE_ID), Highpass Capture PCM_ID) + +# +# PCM Configuration +# + +PCM_CAPABILITIES(Highpass Capture PCM_ID, `S32_LE,S24_LE,S16_LE', + PCM_MIN_RATE, PCM_MAX_RATE, PIPELINE_CHANNELS, PIPELINE_CHANNELS, + 2, 16, 192, 16384, 65536, 65536) + +undefine(`MY_PGA_TOKENS') +undefine(`MY_PGA_CONF') +undefine(`MY_EQIIR_BYTES') From 14cbaac70d6bab5197178e5052dd6164b9c395c1 Mon Sep 17 00:00:00 2001 From: Libin Yang Date: Fri, 7 Feb 2020 14:23:11 +0800 Subject: [PATCH 3/3] topology: sof-icl-rt711-rt1308-rt715 add MIC MUTE LED support Add support of MIC Mute LED for capture on sof-icl-rt711-rt1308-rt715 platform. Signed-off-by: Libin Yang --- tools/topology/sof-icl-rt711-rt1308-rt715-hdmi.m4 | 4 ++-- tools/topology/sof-icl-rt711-rt1308-rt715.m4 | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/topology/sof-icl-rt711-rt1308-rt715-hdmi.m4 b/tools/topology/sof-icl-rt711-rt1308-rt715-hdmi.m4 index 17eacf46c31d..ea3c645377bf 100644 --- a/tools/topology/sof-icl-rt711-rt1308-rt715-hdmi.m4 +++ b/tools/topology/sof-icl-rt711-rt1308-rt715-hdmi.m4 @@ -49,7 +49,7 @@ PIPELINE_PCM_ADD(sof/pipe-volume-playback.m4, # Low Latency capture pipeline 2 on PCM 1 using max 2 channels of s32le. # Schedule 48 frames per 1000us deadline on core 0 with priority 0 -PIPELINE_PCM_ADD(sof/pipe-volume-capture.m4, +PIPELINE_PCM_ADD(sof/pipe-volume-switch-capture.m4, 2, 1, 2, s32le, 1000, 0, 0, 48000, 48000, 48000) @@ -71,7 +71,7 @@ PIPELINE_PCM_ADD(sof/pipe-volume-playback.m4, # Low Latency capture pipeline 5 on PCM 4 using max 2 channels of s32le. # Schedule 48 frames per 1000us deadline on core 0 with priority 0 -PIPELINE_PCM_ADD(sof/pipe-highpass-capture.m4, +PIPELINE_PCM_ADD(sof/pipe-highpass-switch-capture.m4, 5, 4, 2, s32le, 1000, 0, 0, 48000, 48000, 48000) diff --git a/tools/topology/sof-icl-rt711-rt1308-rt715.m4 b/tools/topology/sof-icl-rt711-rt1308-rt715.m4 index 4ea201c1eb50..7b420052ba00 100644 --- a/tools/topology/sof-icl-rt711-rt1308-rt715.m4 +++ b/tools/topology/sof-icl-rt711-rt1308-rt715.m4 @@ -42,7 +42,7 @@ PIPELINE_PCM_ADD(sof/pipe-volume-playback.m4, # Low Latency capture pipeline 2 on PCM 1 using max 2 channels of s32le. # Schedule 48 frames per 1000us deadline on core 0 with priority 0 -PIPELINE_PCM_ADD(sof/pipe-volume-capture.m4, +PIPELINE_PCM_ADD(sof/pipe-volume-switch-capture.m4, 2, 1, 2, s32le, 1000, 0, 0, 48000, 48000, 48000) @@ -63,7 +63,7 @@ PIPELINE_PCM_ADD(sof/pipe-volume-playback.m4, # Low Latency capture pipeline 5 on PCM 4 using max 2 channels of s32le. # Schedule 48 frames per 1000us deadline on core 0 with priority 0 -PIPELINE_PCM_ADD(sof/pipe-highpass-capture.m4, +PIPELINE_PCM_ADD(sof/pipe-highpass-switch-capture.m4, 5, 4, 2, s32le, 1000, 0, 0, 48000, 48000, 48000)