[Sound-open-firmware] [PATCH v3 2/8] topology: add kcontrol for tone component

Ranjani Sridharan ranjani.sridharan at linux.intel.com
Mon Mar 5 21:40:18 CET 2018


This patch adds the changes to add kcontrols to the tone component

Signed-off-by: Ranjani Sridharan <ranjani.sridharan at linux.intel.com>
---
 topology/m4/local.m4      |  2 +-
 topology/sof/pipe-tone.m4 | 30 +++++++++++++++++++++++++++++-
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/topology/m4/local.m4 b/topology/m4/local.m4
index 1ebe19d..b2d4f28 100644
--- a/topology/m4/local.m4
+++ b/topology/m4/local.m4
@@ -240,7 +240,7 @@ define(`W_MIXER',
 dnl Tone name)
 define(`N_TONE', `TONE'PIPELINE_ID`.'$1)
 
-dnl W_TONE(name, format, periods_sink, periods_source, preload)
+dnl W_TONE(name, format, periods_sink, periods_source, preload, kcontrols_list)
 define(`W_TONE',
 `SectionVendorTuples."'N_TONE($1)`_tuples_w" {'
 `	tokens "sof_comp_tokens"'
diff --git a/topology/sof/pipe-tone.m4 b/topology/sof/pipe-tone.m4
index f53f77f..50a1050 100644
--- a/topology/sof/pipe-tone.m4
+++ b/topology/sof/pipe-tone.m4
@@ -43,12 +43,40 @@ SectionControlMixer.STR(Tone Volume PIPELINE_ID) {
 	tlv "vtlv_m90s3"
 }
 
+SectionControlMixer.STR(Tone Switch PIPELINE_ID) {
+
+	# control belongs to this index group
+	index STR(PIPELINE_ID)
+
+	# Channel register and shift for Front Left/Right
+	channel."FL" {
+		reg "2"
+		shift "0"
+	}
+	channel."FR" {
+		reg "2"
+		shift "1"
+	}
+
+	# control uses bespoke driver get/put/info ID 0
+	ops."ctl" {
+		info "volsw"
+		# 256 binds the mixer control to volume get/put handlers
+		get "256"
+		put "256"
+	}
+
+	# max 1 indicates switch type mixer control
+	max "1"
+	invert "false"
+}
+
 #
 # Components and Buffers
 #
 
 # "Tone 0" has 2 sink period and 0 source periods
-W_TONE(0, PIPELINE_FORMAT, 2, 0, 0)
+W_TONE(0, PIPELINE_FORMAT, 2, 0, 0, LIST(`		', "Tone Switch PIPELINE_ID"))
 
 # "Tone Volume" has 2 sink period and 2 source periods
 W_PGA(0, PIPELINE_FORMAT, 2, 2, 0, LIST(`		', "Tone Volume PIPELINE_ID"))
-- 
2.14.1



More information about the Sound-open-firmware mailing list