From 0ed702386131aee004b1bc457ef4b1a535ecc4d7 Mon Sep 17 00:00:00 2001 From: Jaska Uimonen Date: Fri, 25 Sep 2020 15:11:02 +0300 Subject: [PATCH] topology: add dmic channel maps for different channel counts Volume and switch controls in the dmic pipeline need different channel maps based on dmic channel count. This will enable the control of all channel volumes and mutes from user space. Signed-off-by: Jaska Uimonen --- .../platform/intel/intel-generic-dmic.m4 | 21 +++++++++++++++++++ .../sof/pipe-eq-iir-volume-capture.m4 | 4 ++-- .../pipe-tdfb-eq-iir-volume-capture-16khz.m4 | 4 ++-- .../sof/pipe-tdfb-eq-iir-volume-capture.m4 | 4 ++-- .../sof/pipe-tdfb-volume-capture-16khz.m4 | 4 ++-- .../topology/sof/pipe-tdfb-volume-capture.m4 | 4 ++-- 6 files changed, 31 insertions(+), 10 deletions(-) diff --git a/tools/topology/platform/intel/intel-generic-dmic.m4 b/tools/topology/platform/intel/intel-generic-dmic.m4 index 66d6f38c3..06325c041 100644 --- a/tools/topology/platform/intel/intel-generic-dmic.m4 +++ b/tools/topology/platform/intel/intel-generic-dmic.m4 @@ -22,6 +22,27 @@ ifdef(`DMIC_PCM_CHANNELS', `', `define(DMIC_PCM_CHANNELS, CHANNELS)') ifdef(`DMIC16K_DAI_CHANNELS', `', `define(DMIC16K_DAI_CHANNELS, CHANNELS)') ifdef(`DMIC16K_PCM_CHANNELS', `', `define(DMIC16K_PCM_CHANNELS, CHANNELS)') +ifelse(CHANNELS, 1, `define(DMIC_VOL_CH_MAPS, LIST(` ', KCONTROL_CHANNEL(FL, 1, 0)))') +ifelse(CHANNELS, 2, `define(DMIC_VOL_CH_MAPS, LIST(` ', KCONTROL_CHANNEL(FL, 1, 0), + KCONTROL_CHANNEL(FR, 1, 1)))') +ifelse(CHANNELS, 3, `define(DMIC_VOL_CH_MAPS, LIST(` ', KCONTROL_CHANNEL(FL, 1, 0), + KCONTROL_CHANNEL(FC, 1, 1), + KCONTROL_CHANNEL(FR, 1, 2)))') +ifelse(CHANNELS, 4, `define(DMIC_VOL_CH_MAPS, LIST(` ', KCONTROL_CHANNEL(FLW, 1, 0), + KCONTROL_CHANNEL(FL, 1, 1), + KCONTROL_CHANNEL(FR, 1, 2), + KCONTROL_CHANNEL(FRW, 1, 3)))') + +ifelse(CHANNELS, 1, `define(DMIC_SW_CH_MAPS, LIST(` ', KCONTROL_CHANNEL(FL, 2, 0)))') +ifelse(CHANNELS, 2, `define(DMIC_SW_CH_MAPS, LIST(` ', KCONTROL_CHANNEL(FL, 2, 0), + KCONTROL_CHANNEL(FR, 2, 1)))') +ifelse(CHANNELS, 3, `define(DMIC_SW_CH_MAPS, LIST(` ', KCONTROL_CHANNEL(FL, 2, 0), + KCONTROL_CHANNEL(FC, 2, 1), + KCONTROL_CHANNEL(FR, 2, 2)))') +ifelse(CHANNELS, 4, `define(DMIC_SW_CH_MAPS, LIST(` ', KCONTROL_CHANNEL(FLW, 2, 0), + KCONTROL_CHANNEL(FL, 2, 1), + KCONTROL_CHANNEL(FR, 2, 2), + KCONTROL_CHANNEL(FRW, 2, 3)))') # # Define the pipelines # diff --git a/tools/topology/sof/pipe-eq-iir-volume-capture.m4 b/tools/topology/sof/pipe-eq-iir-volume-capture.m4 index eba886c1e..88da1f5e5 100644 --- a/tools/topology/sof/pipe-eq-iir-volume-capture.m4 +++ b/tools/topology/sof/pipe-eq-iir-volume-capture.m4 @@ -33,7 +33,7 @@ C_CONTROLMIXER(Capture Volume, PIPELINE_ID, false, CONTROLMIXER_TLV(TLV 80 steps from -50dB to +20dB for 1dB, vtlv_m50s1), Channel register and shift for Front Left/Right, - LIST(` ', KCONTROL_CHANNEL(FL, 1, 0), KCONTROL_CHANNEL(FR, 1, 1))) + DMIC_VOL_CH_MAPS) undefine(`CONTROL_NAME') define(`CONTROL_NAME', `CONTROL_NAME_SWITCH') @@ -45,7 +45,7 @@ C_CONTROLMIXER(Capture Switch, PIPELINE_ID, false, , Channel register and shift for Front Left/Right, - LIST(` ', KCONTROL_CHANNEL(FL, 2, 0), KCONTROL_CHANNEL(FR, 2, 1)), + DMIC_SW_CH_MAPS, "1", "1") # Volume Configuration diff --git a/tools/topology/sof/pipe-tdfb-eq-iir-volume-capture-16khz.m4 b/tools/topology/sof/pipe-tdfb-eq-iir-volume-capture-16khz.m4 index fbd1f7b17..52179e2d8 100644 --- a/tools/topology/sof/pipe-tdfb-eq-iir-volume-capture-16khz.m4 +++ b/tools/topology/sof/pipe-tdfb-eq-iir-volume-capture-16khz.m4 @@ -53,7 +53,7 @@ C_CONTROLMIXER(Capture Volume, PIPELINE_ID, false, CONTROLMIXER_TLV(TLV 80 steps from -50dB to +20dB for 1dB, vtlv_m50s1), Channel register and shift for Front Left/Right, - LIST(` ', KCONTROL_CHANNEL(FL, 1, 0), KCONTROL_CHANNEL(FR, 1, 1))) + DMIC_VOL_CH_MAPS) undefine(`CONTROL_NAME') define(`CONTROL_NAME', `CONTROL_NAME_SWITCH') @@ -65,7 +65,7 @@ C_CONTROLMIXER(Capture Switch, PIPELINE_ID, false, , Channel register and shift for Front Left/Right, - LIST(` ', KCONTROL_CHANNEL(FL, 2, 0), KCONTROL_CHANNEL(FR, 2, 1)), + DMIC_SW_CH_MAPS, "1", "1") # Volume Configuration diff --git a/tools/topology/sof/pipe-tdfb-eq-iir-volume-capture.m4 b/tools/topology/sof/pipe-tdfb-eq-iir-volume-capture.m4 index df2c0d7fd..c1db7c5a8 100644 --- a/tools/topology/sof/pipe-tdfb-eq-iir-volume-capture.m4 +++ b/tools/topology/sof/pipe-tdfb-eq-iir-volume-capture.m4 @@ -53,7 +53,7 @@ C_CONTROLMIXER(Capture Volume, PIPELINE_ID, false, CONTROLMIXER_TLV(TLV 80 steps from -50dB to +20dB for 1dB, vtlv_m50s1), Channel register and shift for Front Left/Right, - LIST(` ', KCONTROL_CHANNEL(FL, 1, 0), KCONTROL_CHANNEL(FR, 1, 1))) + DMIC_VOL_CH_MAPS) undefine(`CONTROL_NAME') define(`CONTROL_NAME', `CONTROL_NAME_SWITCH') @@ -65,7 +65,7 @@ C_CONTROLMIXER(Capture Switch, PIPELINE_ID, false, , Channel register and shift for Front Left/Right, - LIST(` ', KCONTROL_CHANNEL(FL, 2, 0), KCONTROL_CHANNEL(FR, 2, 1)), + DMIC_SW_CH_MAPS, "1", "1") # Volume Configuration diff --git a/tools/topology/sof/pipe-tdfb-volume-capture-16khz.m4 b/tools/topology/sof/pipe-tdfb-volume-capture-16khz.m4 index a0ff4de39..cf243b076 100644 --- a/tools/topology/sof/pipe-tdfb-volume-capture-16khz.m4 +++ b/tools/topology/sof/pipe-tdfb-volume-capture-16khz.m4 @@ -52,7 +52,7 @@ C_CONTROLMIXER(Capture Volume, PIPELINE_ID, false, CONTROLMIXER_TLV(TLV 80 steps from -50dB to +20dB for 1dB, vtlv_m50s1), Channel register and shift for Front Left/Right, - LIST(` ', KCONTROL_CHANNEL(FL, 1, 0), KCONTROL_CHANNEL(FR, 1, 1))) + DMIC_VOL_CH_MAPS) undefine(`CONTROL_NAME') define(`CONTROL_NAME', `CONTROL_NAME_SWITCH') @@ -64,7 +64,7 @@ C_CONTROLMIXER(Capture Switch, PIPELINE_ID, false, , Channel register and shift for Front Left/Right, - LIST(` ', KCONTROL_CHANNEL(FL, 2, 0), KCONTROL_CHANNEL(FR, 2, 1)), + DMIC_SW_CH_MAPS, "1", "1") # Volume Configuration diff --git a/tools/topology/sof/pipe-tdfb-volume-capture.m4 b/tools/topology/sof/pipe-tdfb-volume-capture.m4 index 649563e8c..540b6067b 100644 --- a/tools/topology/sof/pipe-tdfb-volume-capture.m4 +++ b/tools/topology/sof/pipe-tdfb-volume-capture.m4 @@ -52,7 +52,7 @@ C_CONTROLMIXER(Capture Volume, PIPELINE_ID, false, CONTROLMIXER_TLV(TLV 80 steps from -50dB to +20dB for 1dB, vtlv_m50s1), Channel register and shift for Front Left/Right, - LIST(` ', KCONTROL_CHANNEL(FL, 1, 0), KCONTROL_CHANNEL(FR, 1, 1))) + DMIC_VOL_CH_MAPS) undefine(`CONTROL_NAME') define(`CONTROL_NAME', `CONTROL_NAME_SWITCH') @@ -64,7 +64,7 @@ C_CONTROLMIXER(Capture Switch, PIPELINE_ID, false, , Channel register and shift for Front Left/Right, - LIST(` ', KCONTROL_CHANNEL(FL, 2, 0), KCONTROL_CHANNEL(FR, 2, 1)), + DMIC_SW_CH_MAPS), "1", "1") # Volume Configuration