[Sound-open-firmware] [PATCH] topology: add fake dapm route supported in topology file
To reuse some machine drivers in Linux kernel without hacking dapm route info, some unsupported routes and widgets could be added in toplogy file.
Signed-off-by: Rander Wang rander.wang@linux.intel.com
--- test on cnl apl and byt pass SOF: master da9baf3f3d kernel: v4.14 390a3ece3 SOF-tools: master 86fe688a2b --- topology/m4/utils.m4 | 38 ++++++++++++++++++++++++++++++++++++++ topology/sof-cnl-rt274.m4 | 11 +++++++++++ 2 files changed, 49 insertions(+)
diff --git a/topology/m4/utils.m4 b/topology/m4/utils.m4 index ba87c8d..8821576 100644 --- a/topology/m4/utils.m4 +++ b/topology/m4/utils.m4 @@ -70,5 +70,43 @@ define(`W_DATA', ` tuples STR($2)' `}')
+dnl FAKE_DAPM_ROUTE_OUT(name, dai type, dai index, direction, index) +define(`FAKE_DAPM_ROUTE_OUT', +`SectionWidget.STR($1) {' +` index STR($5)' +` type "aif_out"' +` no_pm "true"' +`}' +`SectionGraph.STR($2) {' +` index STR($5)' +`' +` lines [' +` dapm($1,$2$3.$4)' +` ]' +`}') + +dnl FAKE_DAPM_ROUTE_IN(name, dai type, dai index, direction, index) +define(`FAKE_DAPM_ROUTE_IN', +`SectionWidget.STR($1) {' +` index STR($5)' +` type "aif_in"' +` no_pm "true"' +`}' +`SectionGraph.STR($2) {' +` index STR($5)' +`' +` lines [' +` dapm($2$3.$4, $1)' +` ]' +`}') + +dnl FAKE_WIDGET(name, index) +define(`FAKE_WIDGET', +`SectionWidget.STR($1) {' +` index STR($2)' +` type "mixer"' +` no_pm "true"' +`}') + divert(0) dnl
diff --git a/topology/sof-cnl-rt274.m4 b/topology/sof-cnl-rt274.m4 index 89d5a25..f592b44 100644 --- a/topology/sof-cnl-rt274.m4 +++ b/topology/sof-cnl-rt274.m4 @@ -69,3 +69,14 @@ DAI_CONFIG(SSP, 0, SSP0-Codec, DSP_B, 24, DAI_CLOCK(bclk, 4800000, codec_slave), DAI_CLOCK(fsync, 48000, codec_slave), DAI_TDM(4, 25, 3, 3)) + +FAKE_DAPM_ROUTE_OUT(codec0_out, SSP, 0, OUT, 0) +FAKE_DAPM_ROUTE_OUT(codec1_out, SSP, 0, OUT, 1) +FAKE_DAPM_ROUTE_OUT(ssp0 Tx, SSP, 0, OUT, 2) +FAKE_DAPM_ROUTE_OUT(Capture, SSP, 0, OUT, 3) +FAKE_DAPM_ROUTE_OUT(SoC DMIC, SSP, 0, OUT, 4) +FAKE_DAPM_ROUTE_IN(codec0_in, SSP, 0, IN, 5) +FAKE_WIDGET(DMIC01 Rx, 6) +FAKE_WIDGET(DMic, 7) +FAKE_WIDGET(dmic01_hifi, 8) +FAKE_WIDGET(ssp0 Rx, 9)
On Fri, 2018-05-18 at 15:57 +0800, Rander Wang wrote:
To reuse some machine drivers in Linux kernel without hacking dapm route info, some unsupported routes and widgets could be added in toplogy file.
Can we change "fake" -> "virtual"
Signed-off-by: Rander Wang rander.wang@linux.intel.com
test on cnl apl and byt pass SOF: master da9baf3f3d kernel: v4.14 390a3ece3 SOF-tools: master 86fe688a2b
topology/m4/utils.m4 | 38 ++++++++++++++++++++++++++++++++++++++ topology/sof-cnl-rt274.m4 | 11 +++++++++++ 2 files changed, 49 insertions(+)
diff --git a/topology/m4/utils.m4 b/topology/m4/utils.m4 index ba87c8d..8821576 100644 --- a/topology/m4/utils.m4 +++ b/topology/m4/utils.m4 @@ -70,5 +70,43 @@ define(`W_DATA', ` tuples STR($2)' `}')
+dnl FAKE_DAPM_ROUTE_OUT(name, dai type, dai index, direction, index)
DAPM_VIRTUAL_ROUTE_OUT
+define(`FAKE_DAPM_ROUTE_OUT', +`SectionWidget.STR($1) {' +` index STR($5)' +` type "aif_out"' +` no_pm "true"' +`}' +`SectionGraph.STR($2) {' +` index STR($5)' +`' +` lines [' +` dapm($1,$2$3.$4)' +` ]' +`}')
+dnl FAKE_DAPM_ROUTE_IN(name, dai type, dai index, direction, index) +define(`FAKE_DAPM_ROUTE_IN', +`SectionWidget.STR($1) {' +` index STR($5)' +` type "aif_in"' +` no_pm "true"' +`}' +`SectionGraph.STR($2) {' +` index STR($5)' +`' +` lines [' +` dapm($2$3.$4, $1)' +` ]' +`}')
+dnl FAKE_WIDGET(name, index)
DAPM_VIRTUAL_WIDGET
+define(`FAKE_WIDGET', +`SectionWidget.STR($1) {' +` index STR($2)' +` type "mixer"' +` no_pm "true"' +`}')
divert(0) dnl
diff --git a/topology/sof-cnl-rt274.m4 b/topology/sof-cnl-rt274.m4 index 89d5a25..f592b44 100644 --- a/topology/sof-cnl-rt274.m4 +++ b/topology/sof-cnl-rt274.m4 @@ -69,3 +69,14 @@ DAI_CONFIG(SSP, 0, SSP0-Codec, DSP_B, 24, DAI_CLOCK(bclk, 4800000, codec_slave), DAI_CLOCK(fsync, 48000, codec_slave), DAI_TDM(4, 25, 3, 3))
+FAKE_DAPM_ROUTE_OUT(codec0_out, SSP, 0, OUT, 0) +FAKE_DAPM_ROUTE_OUT(codec1_out, SSP, 0, OUT, 1) +FAKE_DAPM_ROUTE_OUT(ssp0 Tx, SSP, 0, OUT, 2) +FAKE_DAPM_ROUTE_OUT(Capture, SSP, 0, OUT, 3) +FAKE_DAPM_ROUTE_OUT(SoC DMIC, SSP, 0, OUT, 4) +FAKE_DAPM_ROUTE_IN(codec0_in, SSP, 0, IN, 5) +FAKE_WIDGET(DMIC01 Rx, 6) +FAKE_WIDGET(DMic, 7) +FAKE_WIDGET(dmic01_hifi, 8) +FAKE_WIDGET(ssp0 Rx, 9)
On 5/18/18 2:57 AM, Rander Wang wrote:
To reuse some machine drivers in Linux kernel without hacking dapm route info, some unsupported routes and widgets could be added in toplogy file.
I like this. A lot. I wonder if we could go even further? Could we define a set of controls that do nothing but make userspace happy and allow us to reuse existing UCM files as is - which would also remove the need for a dedicated prefix for cards.
Signed-off-by: Rander Wang rander.wang@linux.intel.com
test on cnl apl and byt pass SOF: master da9baf3f3d kernel: v4.14 390a3ece3 SOF-tools: master 86fe688a2b
topology/m4/utils.m4 | 38 ++++++++++++++++++++++++++++++++++++++ topology/sof-cnl-rt274.m4 | 11 +++++++++++ 2 files changed, 49 insertions(+)
diff --git a/topology/m4/utils.m4 b/topology/m4/utils.m4 index ba87c8d..8821576 100644 --- a/topology/m4/utils.m4 +++ b/topology/m4/utils.m4 @@ -70,5 +70,43 @@ define(`W_DATA', ` tuples STR($2)' `}')
+dnl FAKE_DAPM_ROUTE_OUT(name, dai type, dai index, direction, index) +define(`FAKE_DAPM_ROUTE_OUT', +`SectionWidget.STR($1) {' +` index STR($5)' +` type "aif_out"' +` no_pm "true"' +`}' +`SectionGraph.STR($2) {' +` index STR($5)' +`' +` lines [' +` dapm($1,$2$3.$4)' +` ]' +`}')
+dnl FAKE_DAPM_ROUTE_IN(name, dai type, dai index, direction, index) +define(`FAKE_DAPM_ROUTE_IN', +`SectionWidget.STR($1) {' +` index STR($5)' +` type "aif_in"' +` no_pm "true"' +`}' +`SectionGraph.STR($2) {' +` index STR($5)' +`' +` lines [' +` dapm($2$3.$4, $1)' +` ]' +`}')
+dnl FAKE_WIDGET(name, index) +define(`FAKE_WIDGET', +`SectionWidget.STR($1) {' +` index STR($2)' +` type "mixer"' +` no_pm "true"' +`}')
- divert(0) dnl
diff --git a/topology/sof-cnl-rt274.m4 b/topology/sof-cnl-rt274.m4 index 89d5a25..f592b44 100644 --- a/topology/sof-cnl-rt274.m4 +++ b/topology/sof-cnl-rt274.m4 @@ -69,3 +69,14 @@ DAI_CONFIG(SSP, 0, SSP0-Codec, DSP_B, 24, DAI_CLOCK(bclk, 4800000, codec_slave), DAI_CLOCK(fsync, 48000, codec_slave), DAI_TDM(4, 25, 3, 3))
+FAKE_DAPM_ROUTE_OUT(codec0_out, SSP, 0, OUT, 0) +FAKE_DAPM_ROUTE_OUT(codec1_out, SSP, 0, OUT, 1) +FAKE_DAPM_ROUTE_OUT(ssp0 Tx, SSP, 0, OUT, 2) +FAKE_DAPM_ROUTE_OUT(Capture, SSP, 0, OUT, 3) +FAKE_DAPM_ROUTE_OUT(SoC DMIC, SSP, 0, OUT, 4) +FAKE_DAPM_ROUTE_IN(codec0_in, SSP, 0, IN, 5) +FAKE_WIDGET(DMIC01 Rx, 6) +FAKE_WIDGET(DMic, 7) +FAKE_WIDGET(dmic01_hifi, 8) +FAKE_WIDGET(ssp0 Rx, 9)
participants (3)
-
Liam Girdwood
-
Pierre-Louis Bossart
-
Rander Wang