[Sound-open-firmware] [PATCH] topology: bind kcontrols to PGA widgets.

Liam Girdwood liam.r.girdwood at linux.intel.com
Fri Sep 1 00:51:21 CEST 2017


Add an parameter to bind TLV volume kcontrol to volume widget.

Signed-off-by: Liam Girdwood <liam.r.girdwood at linux.intel.com>
---
 topology/m4/local.m4                          | 13 ++++++----
 topology/sof/pipe-low-latency-capture.m4      |  8 +++---
 topology/sof/pipe-low-latency-playback.m4     | 16 ++++++------
 topology/sof/pipe-passthrough-vol-playback.m4 | 36 ++++++++++++++++++++++++---
 topology/sof/pipe-pcm-media.m4                |  6 ++---
 topology/sof/pipe-tone.m4                     |  6 ++---
 6 files changed, 59 insertions(+), 26 deletions(-)

diff --git a/topology/m4/local.m4 b/topology/m4/local.m4
index 7bcebee..5da77e2 100644
--- a/topology/m4/local.m4
+++ b/topology/m4/local.m4
@@ -142,14 +142,14 @@ define(`W_PCM_CAPTURE',
 dnl PGA name)
 define(`N_PGA', `PGA'PIPELINE_ID`.'$1)
 
-dnl W_PGA(name, format, periods_sink, periods_source, preload)
+dnl W_PGA(name, kcontrol, format, periods_sink, periods_source, preload)
 define(`W_PGA',
 `SectionVendorTuples."'N_PGA($1)`_tuples_w" {'
 `	tokens "sof_comp_tokens"'
 `	tuples."word" {'
-`		SOF_TKN_COMP_PERIOD_SINK_COUNT'		STR($3)
-`		SOF_TKN_COMP_PERIOD_SOURCE_COUNT'	STR($4)
-`		SOF_TKN_COMP_PRELOAD_COUNT'		STR($5)
+`		SOF_TKN_COMP_PERIOD_SINK_COUNT'		STR($4)
+`		SOF_TKN_COMP_PERIOD_SOURCE_COUNT'	STR($5)
+`		SOF_TKN_COMP_PRELOAD_COUNT'		STR($6)
 `	}'
 `}'
 `SectionData."'N_PGA($1)`_data_w" {'
@@ -158,7 +158,7 @@ define(`W_PGA',
 `SectionVendorTuples."'N_PGA($1)`_tuples_str" {'
 `	tokens "sof_comp_tokens"'
 `	tuples."string" {'
-`		SOF_TKN_COMP_FORMAT'	STR($2)
+`		SOF_TKN_COMP_FORMAT'	STR($3)
 `	}'
 `}'
 `SectionData."'N_PGA($1)`_data_str" {'
@@ -172,6 +172,9 @@ define(`W_PGA',
 `		"'N_PGA($1)`_data_w"'
 `		"'N_PGA($1)`_data_str"'
 `	]'
+`	mixer ['
+`		"'$2`"'
+`	]'
 `}')
 
 dnl Mixer Name)
diff --git a/topology/sof/pipe-low-latency-capture.m4 b/topology/sof/pipe-low-latency-capture.m4
index 3b53d0a..111aa86 100644
--- a/topology/sof/pipe-low-latency-capture.m4
+++ b/topology/sof/pipe-low-latency-capture.m4
@@ -48,7 +48,7 @@ SectionControlMixer.STR(PCM PCM_ID Capture Volume) {
 W_PCM_CAPTURE(Low Latency Capture, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 0, 2, 0)
 
 # "Capture Volume" has 2 sink and source periods for host and DAI ping-pong
-W_PGA(Capture Volume, PIPELINE_FORMAT, 2, 2, 0)
+W_PGA(0, PCM PCM_ID Capture Volume, PIPELINE_FORMAT, 2, 2, 0)
 
 # Capture Buffers
 W_BUFFER(0, COMP_BUFFER_SIZE(2,
@@ -67,8 +67,8 @@ SectionGraph."pipe-ll-capture-PIPELINE_ID" {
 	lines [
 		dapm(Low Latency Capture PCM_ID, N_PCM)
 		dapm(N_PCM, N_BUFFER(1))
-		dapm(N_BUFFER(1), N_PGA(Capture Volume))
-		dapm(N_PGA(Capture Volume), N_BUFFER(0))
+		dapm(N_BUFFER(1), N_PGA(0))
+		dapm(N_PGA(0), N_BUFFER(0))
 	]
 }
 
@@ -81,7 +81,7 @@ indir(`define', concat(`PIPELINE_SINK_', PIPELINE_ID), N_BUFFER(0))
 # Pipeline Configuration.
 #
 
-W_PIPELINE(N_PGA(Capture Volume), SCHEDULE_DEADLINE, SCHEDULE_PRIORITY, SCHEDULE_FRAMES, SCHEDULE_CORE, pipe_ll_schedule_plat)
+W_PIPELINE(N_PGA(0), SCHEDULE_DEADLINE, SCHEDULE_PRIORITY, SCHEDULE_FRAMES, SCHEDULE_CORE, pipe_ll_schedule_plat)
 
 #
 # PCM Configuration
diff --git a/topology/sof/pipe-low-latency-playback.m4 b/topology/sof/pipe-low-latency-playback.m4
index 00f7447..a860c82 100644
--- a/topology/sof/pipe-low-latency-playback.m4
+++ b/topology/sof/pipe-low-latency-playback.m4
@@ -91,10 +91,10 @@ SectionControlMixer.STR(Master Playback Volume) {
 W_PCM_PLAYBACK(Low Latency Playback, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 2, 0, 2)
 
 # "Playback Volume" has 1 sink period and 2 source periods for host ping-pong
-W_PGA(Playback Volume, PIPELINE_FORMAT, 1, 2, 1)
+W_PGA(0, PCM PCM_ID Playback Volume, PIPELINE_FORMAT, 1, 2, 1)
 
-# "Mixer Volume" has 1 source and 2 sink periods for DAI ping-pong
-W_PGA(Mixer Volume, PIPELINE_FORMAT, 2, 1, 1)
+# "Master Playback Volume" has 1 source and 2 sink periods for DAI ping-pong
+W_PGA(1, Master Playback Volume, PIPELINE_FORMAT, 2, 1, 1)
 
 # Mixer 0 has 1 sink and source periods.
 W_MIXER(0, PIPELINE_FORMAT, 1, 1, 1)
@@ -127,12 +127,12 @@ SectionGraph."pipe-ll-playback-PIPELINE_ID" {
 	lines [
 		dapm(N_PCM, Low Latency Playback PCM_ID)
 		dapm(N_BUFFER(0), N_PCM)
-		dapm(N_PGA(Playback Volume), N_BUFFER(0))
-		dapm(N_BUFFER(1), N_PGA(Playback Volume))
+		dapm(N_PGA(0), N_BUFFER(0))
+		dapm(N_BUFFER(1), N_PGA(0))
 		dapm(N_MIXER(0), N_BUFFER(1))
 		dapm(N_BUFFER(2), N_MIXER(0))
-		dapm(N_PGA(Mixer Volume), N_BUFFER(2))
-		dapm(N_BUFFER(3), N_PGA(Mixer Volume))
+		dapm(N_PGA(1), N_BUFFER(2))
+		dapm(N_BUFFER(3), N_PGA(1))
 	]
 }
 
@@ -146,7 +146,7 @@ indir(`define', concat(`PIPELINE_MIXER_', PIPELINE_ID), N_MIXER(0))
 # Pipeline Configuration.
 #
 
-W_PIPELINE(N_PGA(Mixer Volume), SCHEDULE_DEADLINE, SCHEDULE_PRIORITY, SCHEDULE_FRAMES, SCHEDULE_CORE, pipe_ll_schedule_plat)
+W_PIPELINE(N_PGA(1), SCHEDULE_DEADLINE, SCHEDULE_PRIORITY, SCHEDULE_FRAMES, SCHEDULE_CORE, pipe_ll_schedule_plat)
 
 #
 # PCM Configuration
diff --git a/topology/sof/pipe-passthrough-vol-playback.m4 b/topology/sof/pipe-passthrough-vol-playback.m4
index ae2b569..bf131c3 100644
--- a/topology/sof/pipe-passthrough-vol-playback.m4
+++ b/topology/sof/pipe-passthrough-vol-playback.m4
@@ -7,6 +7,36 @@
 # Include topology builder
 include(`local.m4')
 
+#
+# Controls
+#
+SectionControlMixer.STR(Master Playback Volume) {
+
+	# control belongs to this index group
+	index STR(PIPELINE_ID)
+
+	# Channel register and shift for Front Left/Right
+	channel."FL" {
+		reg "1"
+		shift "0"
+	}
+	channel."FR" {
+		reg "1"
+		shift "1"
+	}
+
+	# control uses bespoke driver get/put/info ID 0
+	ops."ctl" {
+		info "volsw"
+		get "256"
+		put "256"
+	}
+
+	# TLV 32 steps from -90dB to +6dB for 3dB
+	max "32"
+	invert "false"
+	tlv "vtlv_m90s3"
+}
 
 #
 # Components and Buffers
@@ -17,7 +47,7 @@ include(`local.m4')
 W_PCM_PLAYBACK(Passthrough Playback, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 2, 0, 2)
 
 # "Volume" has 2 source and 2 sink periods
-W_PGA(Volume, PIPELINE_FORMAT, 2, 2, 2)
+W_PGA(0, Master Playback Volume, PIPELINE_FORMAT, 2, 2, 2)
 
 # Playback Buffers
 W_BUFFER(0, COMP_BUFFER_SIZE(2,
@@ -48,8 +78,8 @@ SectionGraph."pipe-pass-vol-playback-PIPELINE_ID" {
 	lines [
 		dapm(N_PCM, Passthrough Playback PCM_ID)
 		dapm(N_BUFFER(0), N_PCM)
-		dapm(N_PGA(Volume), N_BUFFER(0))
-		dapm(N_BUFFER(1), N_PGA(Volume))
+		dapm(N_PGA(0), N_BUFFER(0))
+		dapm(N_BUFFER(1), N_PGA(0))
 		dapm(N_DAI_OUT, N_BUFFER(1))
 	]
 }
diff --git a/topology/sof/pipe-pcm-media.m4 b/topology/sof/pipe-pcm-media.m4
index fd6db04..0ce6faa 100644
--- a/topology/sof/pipe-pcm-media.m4
+++ b/topology/sof/pipe-pcm-media.m4
@@ -70,7 +70,7 @@ SectionData."media_src_conf" {
 W_PCM_PLAYBACK(Media Playback, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 2, 0, 2)
 
 # "Playback Volume" has 2 sink period and 2 source periods for host ping-pong
-W_PGA(Playback Volume, PIPELINE_FORMAT, 2, 2, 2)
+W_PGA(0, PCM PCM_ID Playback Volume, PIPELINE_FORMAT, 2, 2, 2)
 
 # "SRC 0" has 2 sink and source periods.
 W_SRC(0, media_src_conf, PIPELINE_FORMAT, 2, 2, 2)
@@ -95,8 +95,8 @@ SectionGraph."pipe-media-PIPELINE_ID" {
 	lines [
 		dapm(N_PCM, Media Playback PCM_ID)
 		dapm(N_BUFFER(0), N_PCM)
-		dapm(N_PGA(Playback Volume), N_BUFFER(0))
-		dapm(N_BUFFER(1), N_PGA(Playback Volume))
+		dapm(N_PGA(0), N_BUFFER(0))
+		dapm(N_BUFFER(1), N_PGA(0))
 		dapm(N_SRC(0), N_BUFFER(1))
 		dapm(N_BUFFER(2), N_SRC(0))
 	]
diff --git a/topology/sof/pipe-tone.m4 b/topology/sof/pipe-tone.m4
index 386ddd3..0cfb73c 100644
--- a/topology/sof/pipe-tone.m4
+++ b/topology/sof/pipe-tone.m4
@@ -50,7 +50,7 @@ SectionControlMixer.STR(Tone Volume PIPELINE_ID) {
 W_TONE(0, PIPELINE_FORMAT, 2, 0, 0)
 
 # "Tone Volume" has 2 sink period and 2 source periods
-W_PGA(Tone Volume, PIPELINE_FORMAT, 2, 2, 0)
+W_PGA(0, Tone Volume PIPELINE_ID, PIPELINE_FORMAT, 2, 2, 0)
 
 # Low Latency Buffers
 W_BUFFER(0,COMP_BUFFER_SIZE(2,
@@ -70,8 +70,8 @@ SectionGraph."pipe-tone-PIPELINE_ID" {
 
 	lines [
 		dapm(N_BUFFER(0), N_TONE(0))
-		dapm(N_PGA(Tone Volume), N_BUFFER(0))
-		dapm(N_BUFFER(1), N_PGA(Tone Volume))
+		dapm(N_PGA(0), N_BUFFER(0))
+		dapm(N_BUFFER(1), N_PGA(0))
 	]
 }
 
-- 
2.11.0



More information about the Sound-open-firmware mailing list