Blame SOURCES/alsa-lib-1.1.6-post.patch

e0581f
From 93e03bdc2a3dcd5d12516f5de78e14d88a32ff2c Mon Sep 17 00:00:00 2001
e0581f
From: Jaroslav Kysela <perex@perex.cz>
e0581f
Date: Wed, 4 Apr 2018 09:58:12 +0200
e0581f
Subject: [PATCH 01/26] alsa.conf: change the location for add-on configs to
e0581f
 /etc/alsa/conf.d
e0581f
e0581f
The add-on configuration files should be placed to a volatile place.
e0581f
e0581f
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
e0581f
---
e0581f
 src/conf/alsa.conf | 8 +-------
e0581f
 1 file changed, 1 insertion(+), 7 deletions(-)
e0581f
e0581f
diff --git a/src/conf/alsa.conf b/src/conf/alsa.conf
e0581f
index f22918fb..bb00ff40 100644
e0581f
--- a/src/conf/alsa.conf
e0581f
+++ b/src/conf/alsa.conf
e0581f
@@ -8,13 +8,7 @@
e0581f
 	{
e0581f
 		func load
e0581f
 		files [
e0581f
-			{
e0581f
-				@func concat
e0581f
-				strings [
e0581f
-					{ @func datadir }
e0581f
-					"/alsa.conf.d/"
e0581f
-				]
e0581f
-			}
e0581f
+			"/etc/alsa/conf.d"
e0581f
 			"/etc/asound.conf"
e0581f
 			"~/.asoundrc"
e0581f
 		]
e0581f
-- 
e0581f
2.13.6
e0581f
e0581f
e0581f
From 78505dccd23546cc77e5221cb21c01325bc0138d Mon Sep 17 00:00:00 2001
e0581f
From: Jaroslav Kysela <perex@perex.cz>
e0581f
Date: Wed, 4 Apr 2018 10:02:49 +0200
e0581f
Subject: [PATCH 02/26] conf: remove alsa.conf.d from the datadir
e0581f
e0581f
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
e0581f
---
e0581f
 src/conf/Makefile.am             | 2 +-
e0581f
 src/conf/alsa.conf.d/Makefile.am | 8 --------
e0581f
 src/conf/alsa.conf.d/README      | 2 --
e0581f
 3 files changed, 1 insertion(+), 11 deletions(-)
e0581f
 delete mode 100644 src/conf/alsa.conf.d/Makefile.am
e0581f
 delete mode 100644 src/conf/alsa.conf.d/README
e0581f
e0581f
diff --git a/src/conf/Makefile.am b/src/conf/Makefile.am
e0581f
index ef2ea9c1..2b46f95c 100644
e0581f
--- a/src/conf/Makefile.am
e0581f
+++ b/src/conf/Makefile.am
e0581f
@@ -1,4 +1,4 @@
e0581f
-SUBDIRS=cards pcm alsa.conf.d
e0581f
+SUBDIRS=cards pcm
e0581f
 
e0581f
 if BUILD_UCM
e0581f
 SUBDIRS += ucm
e0581f
diff --git a/src/conf/alsa.conf.d/Makefile.am b/src/conf/alsa.conf.d/Makefile.am
e0581f
deleted file mode 100644
e0581f
index c91661e9..00000000
e0581f
--- a/src/conf/alsa.conf.d/Makefile.am
e0581f
+++ /dev/null
e0581f
@@ -1,8 +0,0 @@
e0581f
-alsaconfigdir = @ALSA_CONFIG_DIR@
e0581f
-alsadir = $(alsaconfigdir)/alsa.conf.d
e0581f
-cfg_files = README
e0581f
-
e0581f
-alsa_DATA = $(cfg_files)
e0581f
-
e0581f
-EXTRA_DIST = \
e0581f
-	$(cfg_files)
e0581f
diff --git a/src/conf/alsa.conf.d/README b/src/conf/alsa.conf.d/README
e0581f
deleted file mode 100644
e0581f
index 99978848..00000000
e0581f
--- a/src/conf/alsa.conf.d/README
e0581f
+++ /dev/null
e0581f
@@ -1,2 +0,0 @@
e0581f
-You can place files named *.conf in this folder and they will be processed
e0581f
-when initialising alsa-lib.
e0581f
-- 
e0581f
2.13.6
e0581f
e0581f
e0581f
From 17bc74d3a25f0d4b1ca25d2d92fcad9c2a9d7f79 Mon Sep 17 00:00:00 2001
e0581f
From: Jaroslav Kysela <perex@perex.cz>
e0581f
Date: Tue, 10 Apr 2018 08:57:07 +0200
e0581f
Subject: [PATCH 03/26] configure: remove src/conf/alsa.conf.d/Makefile
e0581f
e0581f
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
e0581f
---
e0581f
 configure.ac | 2 +-
e0581f
 1 file changed, 1 insertion(+), 1 deletion(-)
e0581f
e0581f
diff --git a/configure.ac b/configure.ac
e0581f
index cce195ae..5bc1994f 100644
e0581f
--- a/configure.ac
e0581f
+++ b/configure.ac
e0581f
@@ -713,7 +713,7 @@ AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \
e0581f
 	  src/rawmidi/Makefile src/timer/Makefile \
e0581f
           src/hwdep/Makefile src/seq/Makefile src/ucm/Makefile \
e0581f
           src/alisp/Makefile src/topology/Makefile \
e0581f
-	  src/conf/Makefile src/conf/alsa.conf.d/Makefile \
e0581f
+	  src/conf/Makefile \
e0581f
 	  src/conf/cards/Makefile \
e0581f
 	  src/conf/pcm/Makefile \
e0581f
 	  src/conf/ucm/Makefile \
e0581f
-- 
e0581f
2.13.6
e0581f
e0581f
e0581f
From 3778a30bb0095c7d3275735718f33058e3c198d5 Mon Sep 17 00:00:00 2001
e0581f
From: Kirill Marinushkin <k.marinushkin@gmail.com>
e0581f
Date: Mon, 16 Apr 2018 20:26:38 +0200
e0581f
Subject: [PATCH 04/26] ASoC: topology: Fix bclk and fsync inversion in
e0581f
 set_link_hw_format()
e0581f
e0581f
The values of bclk and fsync are inverted WRT the codec. But the existing
e0581f
solution already works for Broadwell, see the alsa-lib config:
e0581f
e0581f
`alsa-lib/src/conf/topology/broadwell/broadwell.conf`
e0581f
e0581f
This commit provides the backwards-compatible solution to fix this misuse.
e0581f
This commit goes in pair with the corresponding patch for linux.
e0581f
e0581f
Signed-off-by: Kirill Marinushkin <k.marinushkin@gmail.com>
e0581f
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
e0581f
Tested-by: Pan Xiuli <xiuli.pan@linux.intel.com>
e0581f
Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
e0581f
Cc: Jaroslav Kysela <perex@perex.cz>
e0581f
Cc: Takashi Iwai <tiwai@suse.de>
e0581f
Cc: Mark Brown <broonie@kernel.org>
e0581f
Cc: Liam Girdwood <liam.r.girdwood@linux.intel.com>
e0581f
Cc: linux-kernel@vger.kernel.org
e0581f
Cc: alsa-devel@alsa-project.org
e0581f
Signed-off-by: Takashi Iwai <tiwai@suse.de>
e0581f
---
e0581f
 include/sound/asoc.h                       | 16 ++++++++++++++--
e0581f
 include/topology.h                         |  4 ++--
e0581f
 src/conf/topology/broadwell/broadwell.conf |  4 ++--
e0581f
 src/topology/pcm.c                         | 30 ++++++++++++++++++++++++++----
e0581f
 4 files changed, 44 insertions(+), 10 deletions(-)
e0581f
e0581f
diff --git a/include/sound/asoc.h b/include/sound/asoc.h
e0581f
index 0f5d9f9a..89b00703 100644
e0581f
--- a/include/sound/asoc.h
e0581f
+++ b/include/sound/asoc.h
e0581f
@@ -156,6 +156,18 @@
e0581f
 #define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS    (1 << 2)
e0581f
 #define SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP            (1 << 3)
e0581f
 
e0581f
+/* DAI topology BCLK parameter
e0581f
+ * For the backwards capability, by default codec is bclk master
e0581f
+ */
e0581f
+#define SND_SOC_TPLG_BCLK_CM         0 /* codec is bclk master */
e0581f
+#define SND_SOC_TPLG_BCLK_CS         1 /* codec is bclk slave */
e0581f
+
e0581f
+/* DAI topology FSYNC parameter
e0581f
+ * For the backwards capability, by default codec is fsync master
e0581f
+ */
e0581f
+#define SND_SOC_TPLG_FSYNC_CM         0 /* codec is fsync master */
e0581f
+#define SND_SOC_TPLG_FSYNC_CS         1 /* codec is fsync slave */
e0581f
+
e0581f
 /*
e0581f
  * Block Header.
e0581f
  * This header precedes all object and object arrays below.
e0581f
@@ -311,8 +323,8 @@ struct snd_soc_tplg_hw_config {
e0581f
 	__u8 clock_gated;	/* 1 if clock can be gated to save power */
e0581f
 	__u8 invert_bclk;	/* 1 for inverted BCLK, 0 for normal */
e0581f
 	__u8 invert_fsync;	/* 1 for inverted frame clock, 0 for normal */
e0581f
-	__u8 bclk_master;	/* 1 for master of BCLK, 0 for slave */
e0581f
-	__u8 fsync_master;	/* 1 for master of FSYNC, 0 for slave */
e0581f
+	__u8 bclk_master;	/* SND_SOC_TPLG_BCLK_ value */
e0581f
+	__u8 fsync_master;	/* SND_SOC_TPLG_FSYNC_ value */
e0581f
 	__u8 mclk_direction;    /* 0 for input, 1 for output */
e0581f
 	__le16 reserved;	/* for 32bit alignment */
e0581f
 	__le32 mclk_rate;	/* MCLK or SYSCLK freqency in Hz */
e0581f
diff --git a/include/topology.h b/include/topology.h
e0581f
index 8779da4d..5d7b46df 100644
e0581f
--- a/include/topology.h
e0581f
+++ b/include/topology.h
e0581f
@@ -1000,8 +1000,8 @@ struct snd_tplg_hw_config_template {
e0581f
 	unsigned char clock_gated;      /* 1 if clock can be gated to save power */
e0581f
 	unsigned char  invert_bclk;     /* 1 for inverted BCLK, 0 for normal */
e0581f
 	unsigned char  invert_fsync;    /* 1 for inverted frame clock, 0 for normal */
e0581f
-	unsigned char  bclk_master;     /* 1 for master of BCLK, 0 for slave */
e0581f
-	unsigned char  fsync_master;    /* 1 for master of FSYNC, 0 for slave */
e0581f
+	unsigned char  bclk_master;     /* SND_SOC_TPLG_BCLK_ value */
e0581f
+	unsigned char  fsync_master;    /* SND_SOC_TPLG_FSYNC_ value */
e0581f
 	unsigned char  mclk_direction;  /* 0 for input, 1 for output */
e0581f
 	unsigned short reserved;        /* for 32bit alignment */
e0581f
 	unsigned int mclk_rate;	        /* MCLK or SYSCLK freqency in Hz */
e0581f
diff --git a/src/conf/topology/broadwell/broadwell.conf b/src/conf/topology/broadwell/broadwell.conf
e0581f
index b8405d93..09fc4daa 100644
e0581f
--- a/src/conf/topology/broadwell/broadwell.conf
e0581f
+++ b/src/conf/topology/broadwell/broadwell.conf
e0581f
@@ -393,8 +393,8 @@ SectionGraph."dsp" {
e0581f
 SectionHWConfig."CodecHWConfig" {
e0581f
 	id "1"
e0581f
 	format "I2S"		# physical audio format.
e0581f
-	bclk   "master"		# Platform is master of bit clock
e0581f
-	fsync  "master"		# platform is master of fsync
e0581f
+	bclk   "codec_slave"	# platform is master of bit clock (codec is slave)
e0581f
+	fsync  "codec_slave"	# platform is master of fsync (codec is slave)
e0581f
 }
e0581f
 
e0581f
 SectionLink."Codec" {
e0581f
diff --git a/src/topology/pcm.c b/src/topology/pcm.c
e0581f
index bb47b9af..d0395182 100644
e0581f
--- a/src/topology/pcm.c
e0581f
+++ b/src/topology/pcm.c
e0581f
@@ -1141,8 +1141,19 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg,
e0581f
 			if (snd_config_get_string(n, &val) < 0)
e0581f
 				return -EINVAL;
e0581f
 
e0581f
-			if (!strcmp(val, "master"))
e0581f
-				hw_cfg->bclk_master = true;
e0581f
+			if (!strcmp(val, "master")) {
e0581f
+				/* For backwards capability,
e0581f
+				 * "master" == "codec is slave"
e0581f
+				 */
e0581f
+				SNDERR("warning: deprecated bclk value '%s'\n",
e0581f
+				       val);
e0581f
+
e0581f
+				hw_cfg->bclk_master = SND_SOC_TPLG_BCLK_CS;
e0581f
+			} else if (!strcmp(val, "codec_slave")) {
e0581f
+				hw_cfg->bclk_master = SND_SOC_TPLG_BCLK_CS;
e0581f
+			} else if (!strcmp(val, "codec_master")) {
e0581f
+				hw_cfg->bclk_master = SND_SOC_TPLG_BCLK_CM;
e0581f
+			}
e0581f
 			continue;
e0581f
 		}
e0581f
 
e0581f
@@ -1167,8 +1178,19 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg,
e0581f
 			if (snd_config_get_string(n, &val) < 0)
e0581f
 				return -EINVAL;
e0581f
 
e0581f
-			if (!strcmp(val, "master"))
e0581f
-				hw_cfg->fsync_master = true;
e0581f
+			if (!strcmp(val, "master")) {
e0581f
+				/* For backwards capability,
e0581f
+				 * "master" == "codec is slave"
e0581f
+				 */
e0581f
+				SNDERR("warning: deprecated fsync value '%s'\n",
e0581f
+				       val);
e0581f
+
e0581f
+				hw_cfg->fsync_master = SND_SOC_TPLG_FSYNC_CS;
e0581f
+			} else if (!strcmp(val, "codec_slave")) {
e0581f
+				hw_cfg->fsync_master = SND_SOC_TPLG_FSYNC_CS;
e0581f
+			} else if (!strcmp(val, "codec_master")) {
e0581f
+				hw_cfg->fsync_master = SND_SOC_TPLG_FSYNC_CM;
e0581f
+			}
e0581f
 			continue;
e0581f
 		}
e0581f
 
e0581f
-- 
e0581f
2.13.6
e0581f
e0581f
e0581f
From bdb709ab2a091743980c9154950c01f0c540476b Mon Sep 17 00:00:00 2001
e0581f
From: Kirill Marinushkin <k.marinushkin@gmail.com>
e0581f
Date: Mon, 16 Apr 2018 20:26:39 +0200
e0581f
Subject: [PATCH 05/26] ASoC: topology: Add missing clock gating parameter when
e0581f
 parsing hw_configs
e0581f
e0581f
Clock gating parameter is a part of `dai_fmt`. It is supported by
e0581f
`alsa-lib` when creating a topology binary file, but ignored by kernel
e0581f
when loading this topology file.
e0581f
e0581f
After applying this commit, the clock gating parameter is not ignored any
e0581f
more. This solution is backwards compatible. The existing behaviour is
e0581f
not broken, because by default the parameter value is 0 and is ignored.
e0581f
e0581f
snd_soc_tplg_hw_config.clock_gated = 0 => no effect
e0581f
snd_soc_tplg_hw_config.clock_gated = 1 => SND_SOC_DAIFMT_GATED
e0581f
snd_soc_tplg_hw_config.clock_gated = 2 => SND_SOC_DAIFMT_CONT
e0581f
e0581f
For example, the following config, based on
e0581f
alsa-lib/src/conf/topology/broadwell/broadwell.conf, is now supported:
e0581f
e0581f
~~~~
e0581f
SectionHWConfig."CodecHWConfig" {
e0581f
        id "1"
e0581f
        format "I2S"            # physical audio format.
e0581f
        pm_gate_clocks "true"   # clock can be gated
e0581f
}
e0581f
e0581f
SectionLink."Codec" {
e0581f
e0581f
        # used for binding to the physical link
e0581f
        id "0"
e0581f
e0581f
        hw_configs [
e0581f
                "CodecHWConfig"
e0581f
        ]
e0581f
e0581f
        default_hw_conf_id "1"
e0581f
}
e0581f
~~~~
e0581f
e0581f
Signed-off-by: Kirill Marinushkin <k.marinushkin@gmail.com>
e0581f
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
e0581f
Cc: Jaroslav Kysela <perex@perex.cz>
e0581f
Cc: Takashi Iwai <tiwai@suse.de>
e0581f
Cc: Mark Brown <broonie@kernel.org>
e0581f
Cc: Pan Xiuli <xiuli.pan@linux.intel.com>
e0581f
Cc: Liam Girdwood <liam.r.girdwood@linux.intel.com>
e0581f
Cc: linux-kernel@vger.kernel.org
e0581f
Cc: alsa-devel@alsa-project.org
e0581f
Signed-off-by: Takashi Iwai <tiwai@suse.de>
e0581f
---
e0581f
 include/sound/asoc.h | 7 ++++++-
e0581f
 include/topology.h   | 2 +-
e0581f
 src/topology/pcm.c   | 6 +++++-
e0581f
 3 files changed, 12 insertions(+), 3 deletions(-)
e0581f
e0581f
diff --git a/include/sound/asoc.h b/include/sound/asoc.h
e0581f
index 89b00703..297e837c 100644
e0581f
--- a/include/sound/asoc.h
e0581f
+++ b/include/sound/asoc.h
e0581f
@@ -135,6 +135,11 @@
e0581f
 #define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_CHANNELS      (1 << 1)
e0581f
 #define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS    (1 << 2)
e0581f
 
e0581f
+/* DAI clock gating */
e0581f
+#define SND_SOC_TPLG_DAI_CLK_GATE_UNDEFINED	0
e0581f
+#define SND_SOC_TPLG_DAI_CLK_GATE_GATED	1
e0581f
+#define SND_SOC_TPLG_DAI_CLK_GATE_CONT		2
e0581f
+
e0581f
 /* DAI physical PCM data formats.
e0581f
  * Add new formats to the end of the list.
e0581f
  */
e0581f
@@ -320,7 +325,7 @@ struct snd_soc_tplg_hw_config {
e0581f
 	__le32 size;            /* in bytes of this structure */
e0581f
 	__le32 id;		/* unique ID - - used to match */
e0581f
 	__le32 fmt;		/* SND_SOC_DAI_FORMAT_ format value */
e0581f
-	__u8 clock_gated;	/* 1 if clock can be gated to save power */
e0581f
+	__u8 clock_gated;	/* SND_SOC_TPLG_DAI_CLK_GATE_ value */
e0581f
 	__u8 invert_bclk;	/* 1 for inverted BCLK, 0 for normal */
e0581f
 	__u8 invert_fsync;	/* 1 for inverted frame clock, 0 for normal */
e0581f
 	__u8 bclk_master;	/* SND_SOC_TPLG_BCLK_ value */
e0581f
diff --git a/include/topology.h b/include/topology.h
e0581f
index 5d7b46df..3793115c 100644
e0581f
--- a/include/topology.h
e0581f
+++ b/include/topology.h
e0581f
@@ -997,7 +997,7 @@ struct snd_tplg_pcm_template {
e0581f
 struct snd_tplg_hw_config_template {
e0581f
 	int id;                         /* unique ID - - used to match */
e0581f
 	unsigned int fmt;               /* SND_SOC_DAI_FORMAT_ format value */
e0581f
-	unsigned char clock_gated;      /* 1 if clock can be gated to save power */
e0581f
+	unsigned char clock_gated;      /* SND_SOC_TPLG_DAI_CLK_GATE_ value */
e0581f
 	unsigned char  invert_bclk;     /* 1 for inverted BCLK, 0 for normal */
e0581f
 	unsigned char  invert_fsync;    /* 1 for inverted frame clock, 0 for normal */
e0581f
 	unsigned char  bclk_master;     /* SND_SOC_TPLG_BCLK_ value */
e0581f
diff --git a/src/topology/pcm.c b/src/topology/pcm.c
e0581f
index d0395182..b53f6b03 100644
e0581f
--- a/src/topology/pcm.c
e0581f
+++ b/src/topology/pcm.c
e0581f
@@ -1233,7 +1233,11 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg,
e0581f
 				return -EINVAL;
e0581f
 
e0581f
 			if (!strcmp(val, "true"))
e0581f
-				hw_cfg->clock_gated = true;
e0581f
+				hw_cfg->clock_gated =
e0581f
+					SND_SOC_TPLG_DAI_CLK_GATE_GATED;
e0581f
+			else
e0581f
+				hw_cfg->clock_gated =
e0581f
+					SND_SOC_TPLG_DAI_CLK_GATE_CONT;
e0581f
 			continue;
e0581f
 		}
e0581f
 
e0581f
-- 
e0581f
2.13.6
e0581f
e0581f
e0581f
From 7cf73b56e4505ad194f5789293494a6ebaa1feff Mon Sep 17 00:00:00 2001
e0581f
From: Kirill Marinushkin <k.marinushkin@gmail.com>
e0581f
Date: Mon, 16 Apr 2018 20:26:40 +0200
e0581f
Subject: [PATCH 06/26] ASoC: topology: Add definitions for mclk_direction
e0581f
 values
e0581f
e0581f
Current comment makes not clear the direction of mclk. Previously, similar
e0581f
description caused a misunderstanding for bclk_master and fsync_master.
e0581f
e0581f
This commit solves the potential confusion the same way it is solved for
e0581f
bclk_master and fsync_master.
e0581f
e0581f
Signed-off-by: Kirill Marinushkin <k.marinushkin@gmail.com>
e0581f
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
e0581f
Cc: Jaroslav Kysela <perex@perex.cz>
e0581f
Cc: Takashi Iwai <tiwai@suse.de>
e0581f
Cc: Mark Brown <broonie@kernel.org>
e0581f
Cc: Pan Xiuli <xiuli.pan@linux.intel.com>
e0581f
Cc: Liam Girdwood <liam.r.girdwood@linux.intel.com>
e0581f
Cc: alsa-devel@alsa-project.org
e0581f
Signed-off-by: Takashi Iwai <tiwai@suse.de>
e0581f
---
e0581f
 include/sound/asoc.h |  6 +++++-
e0581f
 include/topology.h   |  2 +-
e0581f
 src/topology/pcm.c   | 15 +++++++++++++--
e0581f
 3 files changed, 19 insertions(+), 4 deletions(-)
e0581f
e0581f
diff --git a/include/sound/asoc.h b/include/sound/asoc.h
e0581f
index 297e837c..bb8aec78 100644
e0581f
--- a/include/sound/asoc.h
e0581f
+++ b/include/sound/asoc.h
e0581f
@@ -140,6 +140,10 @@
e0581f
 #define SND_SOC_TPLG_DAI_CLK_GATE_GATED	1
e0581f
 #define SND_SOC_TPLG_DAI_CLK_GATE_CONT		2
e0581f
 
e0581f
+/* DAI mclk_direction */
e0581f
+#define SND_SOC_TPLG_MCLK_CO            0 /* for codec, mclk is output */
e0581f
+#define SND_SOC_TPLG_MCLK_CI            1 /* for codec, mclk is input */
e0581f
+
e0581f
 /* DAI physical PCM data formats.
e0581f
  * Add new formats to the end of the list.
e0581f
  */
e0581f
@@ -330,7 +334,7 @@ struct snd_soc_tplg_hw_config {
e0581f
 	__u8 invert_fsync;	/* 1 for inverted frame clock, 0 for normal */
e0581f
 	__u8 bclk_master;	/* SND_SOC_TPLG_BCLK_ value */
e0581f
 	__u8 fsync_master;	/* SND_SOC_TPLG_FSYNC_ value */
e0581f
-	__u8 mclk_direction;    /* 0 for input, 1 for output */
e0581f
+	__u8 mclk_direction;    /* SND_SOC_TPLG_MCLK_ value */
e0581f
 	__le16 reserved;	/* for 32bit alignment */
e0581f
 	__le32 mclk_rate;	/* MCLK or SYSCLK freqency in Hz */
e0581f
 	__le32 bclk_rate;	/* BCLK freqency in Hz */
e0581f
diff --git a/include/topology.h b/include/topology.h
e0581f
index 3793115c..27da7308 100644
e0581f
--- a/include/topology.h
e0581f
+++ b/include/topology.h
e0581f
@@ -1002,7 +1002,7 @@ struct snd_tplg_hw_config_template {
e0581f
 	unsigned char  invert_fsync;    /* 1 for inverted frame clock, 0 for normal */
e0581f
 	unsigned char  bclk_master;     /* SND_SOC_TPLG_BCLK_ value */
e0581f
 	unsigned char  fsync_master;    /* SND_SOC_TPLG_FSYNC_ value */
e0581f
-	unsigned char  mclk_direction;  /* 0 for input, 1 for output */
e0581f
+	unsigned char  mclk_direction;  /* SND_SOC_TPLG_MCLK_ value */
e0581f
 	unsigned short reserved;        /* for 32bit alignment */
e0581f
 	unsigned int mclk_rate;	        /* MCLK or SYSCLK freqency in Hz */
e0581f
 	unsigned int bclk_rate;	        /* BCLK freqency in Hz */
e0581f
diff --git a/src/topology/pcm.c b/src/topology/pcm.c
e0581f
index b53f6b03..2ce1651b 100644
e0581f
--- a/src/topology/pcm.c
e0581f
+++ b/src/topology/pcm.c
e0581f
@@ -1223,8 +1223,19 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg,
e0581f
 			if (snd_config_get_string(n, &val) < 0)
e0581f
 				return -EINVAL;
e0581f
 
e0581f
-			if (!strcmp(val, "master"))
e0581f
-				hw_cfg->mclk_direction = true;
e0581f
+			if (!strcmp(val, "master")) {
e0581f
+				/* For backwards capability,
e0581f
+				 * "master" == "for codec, mclk is input"
e0581f
+				 */
e0581f
+				SNDERR("warning: deprecated mclk value '%s'\n",
e0581f
+				       val);
e0581f
+
e0581f
+				hw_cfg->mclk_direction = SND_SOC_TPLG_MCLK_CI;
e0581f
+			} else if (!strcmp(val, "codec_mclk_in")) {
e0581f
+				hw_cfg->mclk_direction = SND_SOC_TPLG_MCLK_CI;
e0581f
+			} else if (!strcmp(val, "codec_mclk_out")) {
e0581f
+				hw_cfg->mclk_direction = SND_SOC_TPLG_MCLK_CO;
e0581f
+			}
e0581f
 			continue;
e0581f
 		}
e0581f
 
e0581f
-- 
e0581f
2.13.6
e0581f
e0581f
e0581f
From 4493f6a560a315970f5b068126120526a04ae6a2 Mon Sep 17 00:00:00 2001
e0581f
From: Kirill Marinushkin <k.marinushkin@gmail.com>
e0581f
Date: Mon, 16 Apr 2018 20:26:41 +0200
e0581f
Subject: [PATCH 07/26] ASoC: topology: Add alias conf parameter names for
e0581f
 hw_configs
e0581f
e0581f
Currently, some parameter names in conf differ from field names in struct.
e0581f
These look like typos.
e0581f
e0581f
This commit suggests to add aliases for such parameters, so that the names
e0581f
in conf are similar to names in struct. This solution is backwards
e0581f
compatible.
e0581f
e0581f
If the difference between conf names and struct names is done on purpose -
e0581f
this commit can be dropped.
e0581f
e0581f
Signed-off-by: Kirill Marinushkin <k.marinushkin@gmail.com>
e0581f
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
e0581f
Cc: Jaroslav Kysela <perex@perex.cz>
e0581f
Cc: Takashi Iwai <tiwai@suse.de>
e0581f
Cc: Mark Brown <broonie@kernel.org>
e0581f
Cc: Pan Xiuli <xiuli.pan@linux.intel.com>
e0581f
Cc: Liam Girdwood <liam.r.girdwood@linux.intel.com>
e0581f
Cc: alsa-devel@alsa-project.org
e0581f
Signed-off-by: Takashi Iwai <tiwai@suse.de>
e0581f
---
e0581f
 src/topology/pcm.c | 30 ++++++++++++++++++++----------
e0581f
 1 file changed, 20 insertions(+), 10 deletions(-)
e0581f
e0581f
diff --git a/src/topology/pcm.c b/src/topology/pcm.c
e0581f
index 2ce1651b..8ebfafd8 100644
e0581f
--- a/src/topology/pcm.c
e0581f
+++ b/src/topology/pcm.c
e0581f
@@ -1126,7 +1126,8 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg,
e0581f
 			continue;
e0581f
 		}
e0581f
 
e0581f
-		if (strcmp(id, "format") == 0) {
e0581f
+		if (strcmp(id, "format") == 0 ||
e0581f
+		    strcmp(id, "fmt") == 0) {
e0581f
 			if (snd_config_get_string(n, &val) < 0)
e0581f
 				return -EINVAL;
e0581f
 
e0581f
@@ -1137,7 +1138,8 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg,
e0581f
 			continue;
e0581f
 		}
e0581f
 
e0581f
-		if (strcmp(id, "bclk") == 0) {
e0581f
+		if (strcmp(id, "bclk") == 0 ||
e0581f
+		    strcmp(id, "bclk_master") == 0) {
e0581f
 			if (snd_config_get_string(n, &val) < 0)
e0581f
 				return -EINVAL;
e0581f
 
e0581f
@@ -1157,7 +1159,8 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg,
e0581f
 			continue;
e0581f
 		}
e0581f
 
e0581f
-		if (strcmp(id, "bclk_freq") == 0) {
e0581f
+		if (strcmp(id, "bclk_freq") == 0 ||
e0581f
+		    strcmp(id, "bclk_rate") == 0) {
e0581f
 			if (snd_config_get_string(n, &val) < 0)
e0581f
 				return -EINVAL;
e0581f
 
e0581f
@@ -1165,7 +1168,8 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg,
e0581f
 			continue;
e0581f
 		}
e0581f
 
e0581f
-		if (strcmp(id, "bclk_invert") == 0) {
e0581f
+		if (strcmp(id, "bclk_invert") == 0 ||
e0581f
+		    strcmp(id, "invert_bclk") == 0) {
e0581f
 			if (snd_config_get_string(n, &val) < 0)
e0581f
 				return -EINVAL;
e0581f
 
e0581f
@@ -1174,7 +1178,8 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg,
e0581f
 			continue;
e0581f
 		}
e0581f
 
e0581f
-		if (strcmp(id, "fsync") == 0) {
e0581f
+		if (strcmp(id, "fsync") == 0 ||
e0581f
+		    strcmp(id, "fsync_master") == 0) {
e0581f
 			if (snd_config_get_string(n, &val) < 0)
e0581f
 				return -EINVAL;
e0581f
 
e0581f
@@ -1194,7 +1199,8 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg,
e0581f
 			continue;
e0581f
 		}
e0581f
 
e0581f
-		if (strcmp(id, "fsync_invert") == 0) {
e0581f
+		if (strcmp(id, "fsync_invert") == 0 ||
e0581f
+		    strcmp(id, "invert_fsync") == 0) {
e0581f
 			if (snd_config_get_string(n, &val) < 0)
e0581f
 				return -EINVAL;
e0581f
 
e0581f
@@ -1203,7 +1209,8 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg,
e0581f
 			continue;
e0581f
 		}
e0581f
 
e0581f
-		if (strcmp(id, "fsync_freq") == 0) {
e0581f
+		if (strcmp(id, "fsync_freq") == 0 ||
e0581f
+		    strcmp(id, "fsync_rate") == 0) {
e0581f
 			if (snd_config_get_string(n, &val) < 0)
e0581f
 				return -EINVAL;
e0581f
 
e0581f
@@ -1211,7 +1218,8 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg,
e0581f
 			continue;
e0581f
 		}
e0581f
 
e0581f
-		if (strcmp(id, "mclk_freq") == 0) {
e0581f
+		if (strcmp(id, "mclk_freq") == 0 ||
e0581f
+		    strcmp(id, "mclk_rate") == 0) {
e0581f
 			if (snd_config_get_string(n, &val) < 0)
e0581f
 				return -EINVAL;
e0581f
 
e0581f
@@ -1219,7 +1227,8 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg,
e0581f
 			continue;
e0581f
 		}
e0581f
 
e0581f
-		if (strcmp(id, "mclk") == 0) {
e0581f
+		if (strcmp(id, "mclk") == 0 ||
e0581f
+		    strcmp(id, "mclk_direction") == 0) {
e0581f
 			if (snd_config_get_string(n, &val) < 0)
e0581f
 				return -EINVAL;
e0581f
 
e0581f
@@ -1239,7 +1248,8 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg,
e0581f
 			continue;
e0581f
 		}
e0581f
 
e0581f
-		if (strcmp(id, "pm_gate_clocks") == 0) {
e0581f
+		if (strcmp(id, "pm_gate_clocks") == 0 ||
e0581f
+		    strcmp(id, "clock_gated") == 0) {
e0581f
 			if (snd_config_get_string(n, &val) < 0)
e0581f
 				return -EINVAL;
e0581f
 
e0581f
-- 
e0581f
2.13.6
e0581f
e0581f
e0581f
From 23a20cda111232b5d21dde12d10e19e4ecb71cea Mon Sep 17 00:00:00 2001
e0581f
From: Ricard Wanderlof <ricard.wanderlof@axis.com>
e0581f
Date: Wed, 18 Apr 2018 17:03:09 +0200
e0581f
Subject: [PATCH 08/26] pcm: softvol: Allow up to 90 dB of gain
e0581f
e0581f
The gain algorithm used in softvol can handle gain factors of up to
e0581f
32767 which is slightly more than 90 dB, so allow a max_dB of 90 dB.
e0581f
This doesn't affect existing asound.conf files, but does allow a
e0581f
max_dB of up to 90 dB when needed.
e0581f
e0581f
Tested using Audacity that there is no undue distorsion or other
e0581f
artefacts when 90 dB of gain is applied to a suitable signal (i.e.
e0581f
a signal quiet enough not be clipped whan applying 90 dB of gain).
e0581f
e0581f
Signed-off-by: Ricard Wanderlof <ricardw@axis.com>
e0581f
Signed-off-by: Takashi Iwai <tiwai@suse.de>
e0581f
---
e0581f
 src/pcm/pcm_softvol.c | 6 +++++-
e0581f
 1 file changed, 5 insertions(+), 1 deletion(-)
e0581f
e0581f
diff --git a/src/pcm/pcm_softvol.c b/src/pcm/pcm_softvol.c
e0581f
index 8bb4a397..0eaeacef 100644
e0581f
--- a/src/pcm/pcm_softvol.c
e0581f
+++ b/src/pcm/pcm_softvol.c
e0581f
@@ -59,7 +59,11 @@ typedef struct {
e0581f
 #define PRESET_RESOLUTION	256
e0581f
 #define PRESET_MIN_DB		-51.0
e0581f
 #define ZERO_DB                  0.0
e0581f
-#define MAX_DB_UPPER_LIMIT      50
e0581f
+/*
e0581f
+ * The gain algorithm as it stands supports gain factors up to 32767, which
e0581f
+ * is a fraction more than 90 dB, so set 90 dB as the maximum possible gain.
e0581f
+ */
e0581f
+#define MAX_DB_UPPER_LIMIT      90
e0581f
 
e0581f
 static const unsigned int preset_dB_value[PRESET_RESOLUTION] = {
e0581f
 	0x00b8, 0x00bd, 0x00c1, 0x00c5, 0x00ca, 0x00cf, 0x00d4, 0x00d9,
e0581f
-- 
e0581f
2.13.6
e0581f
e0581f
e0581f
From 181f8e251bc05832f9c9401544e680ea0572a2e3 Mon Sep 17 00:00:00 2001
e0581f
From: Hui Wang <hui.wang@canonical.com>
e0581f
Date: Wed, 2 May 2018 14:08:05 +0800
e0581f
Subject: [PATCH 09/26] ucm: adding the folder of card_long_name when finding
e0581f
 verb conf file
e0581f
e0581f
The board configuration file and verb conf file are allowed to be
e0581f
in the folder named of card_long_name, so when finding the verb conf
e0581f
file, we need to check if it is in the folder of card_long_name or
e0581f
card_name.
e0581f
e0581f
Signed-off-by: Hui Wang <hui.wang@canonical.com>
e0581f
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
e0581f
---
e0581f
 src/ucm/parser.c | 10 ++++++++--
e0581f
 1 file changed, 8 insertions(+), 2 deletions(-)
e0581f
e0581f
diff --git a/src/ucm/parser.c b/src/ucm/parser.c
e0581f
index 2d76152f..219edb96 100644
e0581f
--- a/src/ucm/parser.c
e0581f
+++ b/src/ucm/parser.c
e0581f
@@ -1056,6 +1056,7 @@ static int parse_verb_file(snd_use_case_mgr_t *uc_mgr,
e0581f
 	char filename[MAX_FILE];
e0581f
 	char *env = getenv(ALSA_CONFIG_UCM_VAR);
e0581f
 	int err;
e0581f
+	char *folder_name;
e0581f
 
e0581f
 	/* allocate verb */
e0581f
 	verb = calloc(1, sizeof(struct use_case_verb));
e0581f
@@ -1082,12 +1083,17 @@ static int parse_verb_file(snd_use_case_mgr_t *uc_mgr,
e0581f
 	}
e0581f
 
e0581f
 	/* open Verb file for reading */
e0581f
+	if (!strncmp(uc_mgr->conf_file_name, uc_mgr->card_long_name, MAX_CARD_LONG_NAME))
e0581f
+		folder_name = uc_mgr->card_long_name;
e0581f
+	else
e0581f
+		folder_name = uc_mgr->card_name;
e0581f
+
e0581f
 	if (env)
e0581f
 		snprintf(filename, sizeof(filename), "%s/%s/%s",
e0581f
-			 env, uc_mgr->card_name, file);
e0581f
+			 env, folder_name, file);
e0581f
 	else
e0581f
 		snprintf(filename, sizeof(filename), "%s/ucm/%s/%s",
e0581f
-			 snd_config_topdir(), uc_mgr->card_name, file);
e0581f
+			 snd_config_topdir(), folder_name, file);
e0581f
 	filename[sizeof(filename)-1] = '\0';
e0581f
 	
e0581f
 	err = uc_mgr_config_load(filename, &cfg;;
e0581f
-- 
e0581f
2.13.6
e0581f
e0581f
e0581f
From 81db276f8c2235adc83e9698b0174265f6482655 Mon Sep 17 00:00:00 2001
e0581f
From: Hui Wang <hui.wang@canonical.com>
e0581f
Date: Wed, 2 May 2018 14:08:06 +0800
e0581f
Subject: [PATCH 10/26] conf/ucm: increase the input volume for LineIn
e0581f
e0581f
Otherwise, the boost value is 0, and the sound captured from that
e0581f
LineIn jack is too weak for users.
e0581f
e0581f
Signed-off-by: Hui Wang <hui.wang@canonical.com>
e0581f
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
e0581f
---
e0581f
 src/conf/ucm/HDAudio-Lenovo-DualCodecs/HiFi.conf | 1 +
e0581f
 1 file changed, 1 insertion(+)
e0581f
e0581f
diff --git a/src/conf/ucm/HDAudio-Lenovo-DualCodecs/HiFi.conf b/src/conf/ucm/HDAudio-Lenovo-DualCodecs/HiFi.conf
e0581f
index 50967896..ece780da 100644
e0581f
--- a/src/conf/ucm/HDAudio-Lenovo-DualCodecs/HiFi.conf
e0581f
+++ b/src/conf/ucm/HDAudio-Lenovo-DualCodecs/HiFi.conf
e0581f
@@ -99,6 +99,7 @@ SectionDevice."LineIn" {
e0581f
 	EnableSequence [
e0581f
 		cdev "hw:PCH"
e0581f
 		cset "name='Input Source' Line"
e0581f
+		cset "name='Line Boost Volume' 3"
e0581f
 	]
e0581f
 }
e0581f
 
e0581f
-- 
e0581f
2.13.6
e0581f
e0581f
e0581f
From f7c38c29d1be8bab9dd4f406aea3b0e9151c1c06 Mon Sep 17 00:00:00 2001
e0581f
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
e0581f
Date: Sat, 28 Apr 2018 21:51:56 +0200
e0581f
Subject: [PATCH 11/26] conf/ucm: chtrt5645: Cleanup and playback fixes
e0581f
e0581f
Apply cleanup and playback fixes changes from:
e0581f
https://github.com/plbossart/UCM.git
e0581f
e0581f
Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
e0581f
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
e0581f
[hdegoede@redhat.com: Modify commit msg and paths for merging into alsa-lib]
e0581f
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
e0581f
Signed-off-by: Takashi Iwai <tiwai@suse.de>
e0581f
---
e0581f
 src/conf/ucm/chtrt5645/HiFi.conf | 157 ++++++++++++++++++++++++++++++++-------
e0581f
 1 file changed, 129 insertions(+), 28 deletions(-)
e0581f
e0581f
diff --git a/src/conf/ucm/chtrt5645/HiFi.conf b/src/conf/ucm/chtrt5645/HiFi.conf
e0581f
index 0c2c83cc..f63392d4 100644
e0581f
--- a/src/conf/ucm/chtrt5645/HiFi.conf
e0581f
+++ b/src/conf/ucm/chtrt5645/HiFi.conf
e0581f
@@ -11,51 +11,146 @@ SectionVerb {
e0581f
 	EnableSequence [
e0581f
 		cdev "hw:chtrt5645"
e0581f
 
e0581f
-		# Enable audio output path
e0581f
-		cset "name='codec_out1 mix 0 pcm0_in Switch' on"
e0581f
-		cset "name='media0_out mix 0 media1_in Switch' on"
e0581f
+		# media mixer settings
e0581f
+		#   compress
e0581f
+		cset "name='media0_in Gain 0 Switch' on"
e0581f
+		cset "name='media0_in Gain 0 Volume' 0"
e0581f
 
e0581f
-		cset "name='media1_in Gain 0 Ramp Delay' 50"
e0581f
+		#   normal
e0581f
 		cset "name='media1_in Gain 0 Switch' on"
e0581f
-		cset "name='media1_in Gain 0 Volume' 80% 80%"
e0581f
+		cset "name='media1_in Gain 0 Volume' 0"
e0581f
+		#   swm loopback
e0581f
+		cset "name='media2_in Gain 0 Switch' off"
e0581f
+		cset "name='media2_in Gain 0 Volume' 0%"
e0581f
+		#   deep buffer
e0581f
+		cset "name='media3_in Gain 0 Switch' on"
e0581f
+		cset "name='media3_in Gain 0 Volume' 0"
e0581f
+
e0581f
+		cset "name='media0_out mix 0 media0_in Switch' on"
e0581f
+		cset "name='media0_out mix 0 media1_in Switch' on"
e0581f
+		cset "name='media0_out mix 0 media2_in Switch' off"
e0581f
+		cset "name='media0_out mix 0 media3_in Switch' on"
e0581f
+
e0581f
+		cset "name='media1_out mix 0 media0_in Switch' off"
e0581f
+		cset "name='media1_out mix 0 media1_in Switch' off"
e0581f
+		cset "name='media1_out mix 0 media2_in Switch' off"
e0581f
+		cset "name='media1_out mix 0 media3_in Switch' off"
e0581f
 
e0581f
-		cset "name='pcm0_in Gain 0 Ramp Delay' 50"
e0581f
 		cset "name='pcm0_in Gain 0 Switch' on"
e0581f
-		cset "name='pcm0_in Gain 0 Volume' 80% 80%"
e0581f
+		cset "name='pcm0_in Gain 0 Volume' 0"
e0581f
+
e0581f
+		cset "name='pcm1_in Gain 0 Switch' off"
e0581f
+		cset "name='pcm1_in Gain 0 Volume' 0%"
e0581f
+
e0581f
+		# codec0_out settings (used if ssp2 is connected to aif1)
e0581f
+		cset "name='codec_out0 mix 0 codec_in0 Switch' off"
e0581f
+		cset "name='codec_out0 mix 0 codec_in1 Switch' off"
e0581f
+		cset "name='codec_out0 mix 0 media_loop1_in Switch' off"
e0581f
+		cset "name='codec_out0 mix 0 media_loop2_in Switch' off"
e0581f
+		cset "name='codec_out0 mix 0 pcm0_in Switch' on"
e0581f
+		cset "name='codec_out0 mix 0 pcm1_in Switch' off"
e0581f
+		cset "name='codec_out0 mix 0 sprot_loop_in Switch' off"
e0581f
+		cset "name='codec_out0 Gain 0 Switch' on"
e0581f
+		cset "name='codec_out0 Gain 0 Volume' 0"
e0581f
+
e0581f
+		# modem_out settings (used if ssp0 is connected to aif2)
e0581f
+		cset "name='modem_out mix 0 codec_in0 Switch' off"
e0581f
+		cset "name='modem_out mix 0 codec_in1 Switch' off"
e0581f
+		cset "name='modem_out mix 0 media_loop1_in Switch' off"
e0581f
+		cset "name='modem_out mix 0 media_loop2_in Switch' off"
e0581f
+		cset "name='modem_out mix 0 pcm0_in Switch' on"
e0581f
+		cset "name='modem_out mix 0 pcm1_in Switch' off"
e0581f
+		cset "name='modem_out mix 0 sprot_loop_in Switch' off"
e0581f
+		cset "name='modem_out Gain 0 Switch' on"
e0581f
+		cset "name='modem_out Gain 0 Volume' 0"
e0581f
+
e0581f
+		# input settings
e0581f
+		# pcm1_out settings
e0581f
+
e0581f
+		# input used when SSP2 is connected
e0581f
+		cset "name='codec_in0 Gain 0 Switch' on"
e0581f
+		cset "name='codec_in0 Gain 0 Volume' 0"
e0581f
 
e0581f
-		cset "name='codec_out1 Gain 0 Ramp Delay' 50"
e0581f
-		cset "name='codec_out1 Gain 0 Switch' on"
e0581f
-		cset "name='codec_out1 Gain 0 Volume' 70% 70%"
e0581f
+		# input used when SSP0 is connected
e0581f
+		cset "name='modem_in Gain 0 Switch' on"
e0581f
+		cset "name='modem_in Gain 0 Volume' 0"
e0581f
 
e0581f
-		# Enable audio input path
e0581f
-		cset "name='pcm1_out mix 0 media_loop2_in Switch' on"
e0581f
-		cset "name='media_loop2_out mix 0 codec_in0 Switch' on"
e0581f
+		cset "name='pcm1_out mix 0 codec_in0 Switch' on"
e0581f
+		cset "name='pcm1_out mix 0 modem_in Switch' on"
e0581f
+		cset "name='pcm1_out mix 0 codec_in1 Switch' off"
e0581f
+		cset "name='pcm1_out mix 0 media_loop1_in Switch' off"
e0581f
+		cset "name='pcm1_out mix 0 media_loop2_in Switch' off"
e0581f
+		cset "name='pcm1_out mix 0 pcm0_in Switch' off"
e0581f
+		cset "name='pcm1_out mix 0 pcm1_in Switch' off"
e0581f
+		cset "name='pcm1_out mix 0 sprot_loop_in Switch' off"
e0581f
 
e0581f
-		cset "name='codec_in0 Gain 0 Ramp Delay' 50"
e0581f
-		cset "name='codec_in0 Gain 0 Switch' on"
e0581f
-		cset "name='codec_in0 Gain 0 Volume' 80% 80%"
e0581f
+		cset "name='pcm1_out Gain 0 Switch' on"
e0581f
+		cset "name='pcm1_out Gain 0 Volume' 0"
e0581f
 
e0581f
-		cset "name='media_loop2_out Gain 0 Ramp Delay' 50"
e0581f
-		cset "name='media_loop2_out Gain 0 Switch' on"
e0581f
-		cset "name='media_loop2_out Gain 0 Volume' 80% 80%"
e0581f
+		# disable codec_out1
e0581f
+		cset "name='codec_out1 mix 0 codec_in0 Switch' off"
e0581f
+		cset "name='codec_out1 mix 0 codec_in1 Switch' off"
e0581f
+		cset "name='codec_out1 mix 0 media_loop1_in Switch' off"
e0581f
+		cset "name='codec_out1 mix 0 media_loop2_in Switch' off"
e0581f
+		cset "name='codec_out1 mix 0 pcm0_in Switch' off"
e0581f
+		cset "name='codec_out1 mix 0 pcm1_in Switch' off"
e0581f
+		cset "name='codec_out1 mix 0 sprot_loop_in Switch' off"
e0581f
+		cset "name='codec_out1 Gain 0 Switch' off"
e0581f
+		cset "name='codec_out1 Gain 0 Volume' 0%"
e0581f
 
e0581f
-		cset "name='pcm1_out Gain 0 Ramp Delay' 50"
e0581f
-		cset "name='pcm1_out Gain 0 Switch' on"
e0581f
-		cset "name='pcm1_out Gain 0 Volume' 80% 80%"
e0581f
+		# disable codec_in1
e0581f
+		cset "name='codec_in1 Gain 0 Switch' off"
e0581f
+		cset "name='codec_in1 Gain 0 Volume' 0%"
e0581f
+
e0581f
+		# disable all loops
e0581f
+		cset "name='media_loop1_out mix 0 codec_in0 Switch' off"
e0581f
+		cset "name='media_loop1_out mix 0 codec_in1 Switch' off"
e0581f
+		cset "name='media_loop1_out mix 0 media_loop1_in Switch' off"
e0581f
+		cset "name='media_loop1_out mix 0 media_loop2_in Switch' off"
e0581f
+		cset "name='media_loop1_out mix 0 pcm0_in Switch' off"
e0581f
+		cset "name='media_loop1_out mix 0 pcm1_in Switch' off"
e0581f
+		cset "name='media_loop1_out mix 0 sprot_loop_in Switch' off"
e0581f
+
e0581f
+		cset "name='media_loop2_out mix 0 codec_in0 Switch' off"
e0581f
+		cset "name='media_loop2_out mix 0 codec_in1 Switch' off"
e0581f
+		cset "name='media_loop2_out mix 0 media_loop1_in Switch' off"
e0581f
+		cset "name='media_loop2_out mix 0 media_loop2_in Switch' off"
e0581f
+		cset "name='media_loop2_out mix 0 pcm0_in Switch' off"
e0581f
+		cset "name='media_loop2_out mix 0 pcm1_in Switch' off"
e0581f
+		cset "name='media_loop2_out mix 0 sprot_loop_in Switch' off"
e0581f
+
e0581f
+		cset "name='sprot_loop_out mix 0 codec_in0 Switch' off"
e0581f
+		cset "name='sprot_loop_out mix 0 codec_in1 Switch' off"
e0581f
+		cset "name='sprot_loop_out mix 0 media_loop1_in Switch' off"
e0581f
+		cset "name='sprot_loop_out mix 0 media_loop2_in Switch' off"
e0581f
+		cset "name='sprot_loop_out mix 0 pcm0_in Switch' off"
e0581f
+		cset "name='sprot_loop_out mix 0 pcm1_in Switch' off"
e0581f
+		cset "name='sprot_loop_out mix 0 sprot_loop_in Switch' off"
e0581f
 
e0581f
 		# Output Configuration
e0581f
-		cset "name='DAC L2 Mux' 'IF1 DAC'"
e0581f
-		cset "name='DAC R2 Mux' 'IF1 DAC'"
e0581f
+		cset "name='DAC1 L Mux' IF1 DAC"
e0581f
+		cset "name='DAC1 R Mux' IF1 DAC"
e0581f
+		cset "name='DAC1 MIXL DAC1 Switch' 1"
e0581f
+		cset "name='DAC1 MIXR DAC1 Switch' 1"
e0581f
+		cset "name='Stereo DAC MIXL DAC L1 Switch' 1"
e0581f
+		cset "name='Stereo DAC MIXR DAC R1 Switch' 1"
e0581f
+
e0581f
+		cset "name='DAC L2 Mux' IF2 DAC"
e0581f
+		cset "name='DAC R2 Mux' IF2 DAC"
e0581f
 		cset "name='Mono DAC MIXL DAC L2 Switch' on"
e0581f
 		cset "name='Mono DAC MIXR DAC R2 Switch' on"
e0581f
 		cset "name='DAC2 Playback Switch' on"
e0581f
 
e0581f
+		cset "name='HPOVOL MIXL DAC1 Switch' on"
e0581f
+		cset "name='HPOVOL MIXR DAC1 Switch' on"
e0581f
 		cset "name='HPOVOL MIXL DAC2 Switch' on"
e0581f
 		cset "name='HPOVOL MIXR DAC2 Switch' on"
e0581f
 		cset "name='HPO MIX HPVOL Switch' on"
e0581f
 		cset "name='HPOVOL L Switch' on"
e0581f
 		cset "name='HPOVOL R Switch' on"
e0581f
 
e0581f
+		cset "name='SPK MIXL DAC L1 Switch' on"
e0581f
+		cset "name='SPK MIXR DAC R1 Switch' on"
e0581f
 		cset "name='SPK MIXL DAC L2 Switch' on"
e0581f
 		cset "name='SPK MIXR DAC R2 Switch' on"
e0581f
 		cset "name='SPOL MIX SPKVOL L Switch' on"
e0581f
@@ -105,15 +200,18 @@ SectionDevice."Speaker" {
e0581f
 	}
e0581f
 
e0581f
 	ConflictingDevice [
e0581f
-		"Headphone"
e0581f
+		"Headphones"
e0581f
 	]
e0581f
 
e0581f
 	EnableSequence [
e0581f
 		cdev "hw:chtrt5645"
e0581f
 
e0581f
+		cset "name='Headphone Switch' off"
e0581f
+		cset "name='Headphone Channel Switch' off"
e0581f
+
e0581f
 		cset "name='Ext Spk Switch' on"
e0581f
 		cset "name='Speaker Channel Switch' on"
e0581f
-		cset "name='Speaker Playback Volume' 39"
e0581f
+		cset "name='Speaker Playback Volume' 31"
e0581f
 	]
e0581f
 
e0581f
 	DisableSequence [
e0581f
@@ -124,7 +222,7 @@ SectionDevice."Speaker" {
e0581f
 	]
e0581f
 }
e0581f
 
e0581f
-SectionDevice."Headphone".0 {
e0581f
+SectionDevice."Headphones" {
e0581f
 	Comment "Headphones"
e0581f
 
e0581f
 	Value {
e0581f
@@ -140,9 +238,12 @@ SectionDevice."Headphone".0 {
e0581f
 	EnableSequence [
e0581f
 		cdev "hw:chtrt5645"
e0581f
 
e0581f
+		cset "name='Ext Spk Switch' off"
e0581f
+		cset "name='Speaker Channel Switch' off"
e0581f
+
e0581f
 		cset "name='Headphone Switch' on"
e0581f
 		cset "name='Headphone Channel Switch' on"
e0581f
-		cset "name='Headphone Playback Volume' 39"
e0581f
+		cset "name='Headphone Playback Volume' 31"
e0581f
 	]
e0581f
 
e0581f
 	DisableSequence [
e0581f
-- 
e0581f
2.13.6
e0581f
e0581f
e0581f
From 4c0d983d7b4402e7275455ac43f39049b45037ea Mon Sep 17 00:00:00 2001
e0581f
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
e0581f
Date: Sat, 28 Apr 2018 21:51:57 +0200
e0581f
Subject: [PATCH 12/26] conf/ucm: chtrt5645: Microphone recording fixes
e0581f
e0581f
Apply microphone recording changes from:
e0581f
https://github.com/plbossart/UCM.git
e0581f
e0581f
Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
e0581f
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
e0581f
[hdegoede@redhat.com: Drop non generic DMIC changes]
e0581f
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
e0581f
Signed-off-by: Takashi Iwai <tiwai@suse.de>
e0581f
---
e0581f
 src/conf/ucm/chtrt5645/HiFi.conf | 50 ++++++++++++++++++++++++++++++++--------
e0581f
 1 file changed, 41 insertions(+), 9 deletions(-)
e0581f
e0581f
diff --git a/src/conf/ucm/chtrt5645/HiFi.conf b/src/conf/ucm/chtrt5645/HiFi.conf
e0581f
index f63392d4..b97a9c00 100644
e0581f
--- a/src/conf/ucm/chtrt5645/HiFi.conf
e0581f
+++ b/src/conf/ucm/chtrt5645/HiFi.conf
e0581f
@@ -4,8 +4,8 @@ SectionVerb {
e0581f
 		TQ "HiFi"
e0581f
 
e0581f
 		# ALSA PCM device for HiFi
e0581f
-		PlaybackPCM "hw:chtrt5645,0"
e0581f
-		CapturePCM "hw:chtrt5645,0"
e0581f
+		PlaybackPCM "hw:chtrt5645"
e0581f
+		CapturePCM "hw:chtrt5645"
e0581f
 	}
e0581f
 
e0581f
 	EnableSequence [
e0581f
@@ -255,7 +255,7 @@ SectionDevice."Headphones" {
e0581f
 }
e0581f
 
e0581f
 SectionDevice."Mic".0 {
e0581f
-	Comment "Internal Microphone"
e0581f
+	Comment "Internal Analog Microphones"
e0581f
 
e0581f
 	Value {
e0581f
 		CaptureChannels "2"
e0581f
@@ -266,15 +266,33 @@ SectionDevice."Mic".0 {
e0581f
 		cdev "hw:chtrt5645"
e0581f
 
e0581f
 		cset "name='Int Mic Switch' on"
e0581f
-		cset "name='Sto1 ADC MIXL ADC2 Switch' on"
e0581f
-		cset "name='Sto1 ADC MIXR ADC2 Switch' on"
e0581f
+
e0581f
+		cset "name='Sto1 ADC MIXL ADC1 Switch' on"
e0581f
+		cset "name='Sto1 ADC MIXR ADC1 Switch' on"
e0581f
+		cset "name='Sto1 ADC MIXL ADC2 Switch' off"
e0581f
+		cset "name='Sto1 ADC MIXR ADC2 Switch' off"
e0581f
+
e0581f
+		cset "name='Mono ADC MIXL ADC1 Switch' on"
e0581f
+		cset "name='Mono ADC MIXR ADC1 Switch' on"
e0581f
+		cset "name='Mono ADC MIXL ADC2 Switch' off"
e0581f
+		cset "name='Mono ADC MIXR ADC2 Switch' off"
e0581f
+
e0581f
+		cset "name='RECMIXL BST1 Switch' on"
e0581f
+		cset "name='RECMIXR BST1 Switch' on"
e0581f
+
e0581f
 	]
e0581f
 
e0581f
 	DisableSequence [
e0581f
 		cdev "hw:chtrt5645"
e0581f
 
e0581f
-		cset "name='Sto1 ADC MIXL ADC2 Switch' off"
e0581f
-		cset "name='Sto1 ADC MIXR ADC2 Switch' off"
e0581f
+		cset "name='Sto1 ADC MIXL ADC1 Switch' off"
e0581f
+		cset "name='Sto1 ADC MIXR ADC1 Switch' off"
e0581f
+		cset "name='Mono ADC MIXL ADC1 Switch' off"
e0581f
+		cset "name='Mono ADC MIXR ADC1 Switch' off"
e0581f
+
e0581f
+		cset "name='RECMIXL BST1 Switch' off"
e0581f
+		cset "name='RECMIXR BST1 Switch' off"
e0581f
+
e0581f
 		cset "name='Int Mic Switch' off"
e0581f
 	]
e0581f
 }
e0581f
@@ -292,19 +310,33 @@ SectionDevice."HSMic".0 {
e0581f
 		cdev "hw:chtrt5645"
e0581f
 
e0581f
 		cset "name='Headset Mic Switch' on"
e0581f
-		cset "name='RECMIXL BST1 Switch' on"
e0581f
-		cset "name='RECMIXR BST1 Switch' on"
e0581f
+
e0581f
 		cset "name='Sto1 ADC MIXL ADC1 Switch' on"
e0581f
 		cset "name='Sto1 ADC MIXR ADC1 Switch' on"
e0581f
+		cset "name='Sto1 ADC MIXL ADC2 Switch' off"
e0581f
+		cset "name='Sto1 ADC MIXR ADC2 Switch' off"
e0581f
+
e0581f
+		cset "name='Mono ADC MIXL ADC1 Switch' on"
e0581f
+		cset "name='Mono ADC MIXR ADC1 Switch' on"
e0581f
+		cset "name='Mono ADC MIXL ADC2 Switch' off"
e0581f
+		cset "name='Mono ADC MIXR ADC2 Switch' off"
e0581f
+
e0581f
+		cset "name='RECMIXL BST1 Switch' on"
e0581f
+		cset "name='RECMIXR BST1 Switch' on"
e0581f
+
e0581f
 	]
e0581f
 
e0581f
 	DisableSequence [
e0581f
 		cdev "hw:chtrt5645"
e0581f
 
e0581f
 		cset "name='Headset Mic Switch' off"
e0581f
+
e0581f
 		cset "name='RECMIXL BST1 Switch' off"
e0581f
 		cset "name='RECMIXR BST1 Switch' off"
e0581f
 		cset "name='Sto1 ADC MIXL ADC1 Switch' off"
e0581f
 		cset "name='Sto1 ADC MIXR ADC1 Switch' off"
e0581f
+		cset "name='Mono ADC MIXL ADC1 Switch' on"
e0581f
+		cset "name='Mono ADC MIXR ADC1 Switch' on"
e0581f
+
e0581f
 	]
e0581f
 }
e0581f
-- 
e0581f
2.13.6
e0581f
e0581f
e0581f
From 76bc53e69a12163a86e6746fd3011de6b1652043 Mon Sep 17 00:00:00 2001
e0581f
From: Hans de Goede <hdegoede@redhat.com>
e0581f
Date: Sat, 28 Apr 2018 21:51:58 +0200
e0581f
Subject: [PATCH 13/26] conf/ucm: chtrt5645: Fix recording from internal analog
e0581f
 microphone
e0581f
e0581f
The internal analog mic switch is called 'Int Analog Mic Switch'
e0581f
(not 'Int Mic Switch') and is connected to BST2 not BST1.
e0581f
e0581f
Also change the analog mic volume levels so that we get better
e0581f
audio / less noise.
e0581f
e0581f
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
e0581f
Signed-off-by: Takashi Iwai <tiwai@suse.de>
e0581f
---
e0581f
 src/conf/ucm/chtrt5645/HiFi.conf | 38 ++++++++++++++++++++++++--------------
e0581f
 1 file changed, 24 insertions(+), 14 deletions(-)
e0581f
e0581f
diff --git a/src/conf/ucm/chtrt5645/HiFi.conf b/src/conf/ucm/chtrt5645/HiFi.conf
e0581f
index b97a9c00..e81866cf 100644
e0581f
--- a/src/conf/ucm/chtrt5645/HiFi.conf
e0581f
+++ b/src/conf/ucm/chtrt5645/HiFi.conf
e0581f
@@ -160,15 +160,24 @@ SectionVerb {
e0581f
 
e0581f
 		# Input Configuration
e0581f
 		cset "name='Stereo1 DMIC Mux' 0"
e0581f
+		cset "name='Stereo1 ADC1 Mux' 1"
e0581f
 		cset "name='Stereo1 ADC2 Mux' 1"
e0581f
 		cset "name='ADC Capture Switch' on"
e0581f
-		cset "name='ADC Capture Volume' 31"
e0581f
-		cset "name='ADC Boost Capture Volume' 3"
e0581f
-		cset "name='Mono ADC Capture Volume' 63"
e0581f
-		cset "name='Mono ADC Boost Capture Volume' 2"
e0581f
-		cset "name='IN Capture Volume' 63"
e0581f
+		# 55/63
e0581f
+		cset "name='ADC Capture Volume' 55"
e0581f
+		# set ADC Boost to 0/3, higher vals cause a lot of white noise
e0581f
+		cset "name='ADC Boost Capture Volume' 0"
e0581f
+		# 55/63
e0581f
+		cset "name='Mono ADC Capture Volume' 55"
e0581f
+		# 0/3
e0581f
+		cset "name='Mono ADC Boost Capture Volume' 0"
e0581f
+		# 27/31
e0581f
+		cset "name='IN Capture Volume' 27"
e0581f
 		cset "name='I2S2 Func Switch' on"
e0581f
-
e0581f
+		# 3/12 the headphone mic tends to be quite loud
e0581f
+		cset "name='IN1 Boost' 3"
e0581f
+		# 8/8 the internal analog mic tends to be quite soft
e0581f
+		cset "name='IN2 Boost' 8"
e0581f
 	]
e0581f
 
e0581f
 	DisableSequence [
e0581f
@@ -243,7 +252,8 @@ SectionDevice."Headphones" {
e0581f
 
e0581f
 		cset "name='Headphone Switch' on"
e0581f
 		cset "name='Headphone Channel Switch' on"
e0581f
-		cset "name='Headphone Playback Volume' 31"
e0581f
+		# 25/39 higher values cause crackling on some boards
e0581f
+		cset "name='Headphone Playback Volume' 25"
e0581f
 	]
e0581f
 
e0581f
 	DisableSequence [
e0581f
@@ -255,7 +265,7 @@ SectionDevice."Headphones" {
e0581f
 }
e0581f
 
e0581f
 SectionDevice."Mic".0 {
e0581f
-	Comment "Internal Analog Microphones"
e0581f
+	Comment "Internal Analog Microphone"
e0581f
 
e0581f
 	Value {
e0581f
 		CaptureChannels "2"
e0581f
@@ -265,7 +275,7 @@ SectionDevice."Mic".0 {
e0581f
 	EnableSequence [
e0581f
 		cdev "hw:chtrt5645"
e0581f
 
e0581f
-		cset "name='Int Mic Switch' on"
e0581f
+		cset "name='Int Analog Mic Switch' on"
e0581f
 
e0581f
 		cset "name='Sto1 ADC MIXL ADC1 Switch' on"
e0581f
 		cset "name='Sto1 ADC MIXR ADC1 Switch' on"
e0581f
@@ -277,8 +287,8 @@ SectionDevice."Mic".0 {
e0581f
 		cset "name='Mono ADC MIXL ADC2 Switch' off"
e0581f
 		cset "name='Mono ADC MIXR ADC2 Switch' off"
e0581f
 
e0581f
-		cset "name='RECMIXL BST1 Switch' on"
e0581f
-		cset "name='RECMIXR BST1 Switch' on"
e0581f
+		cset "name='RECMIXL BST2 Switch' on"
e0581f
+		cset "name='RECMIXR BST2 Switch' on"
e0581f
 
e0581f
 	]
e0581f
 
e0581f
@@ -290,10 +300,10 @@ SectionDevice."Mic".0 {
e0581f
 		cset "name='Mono ADC MIXL ADC1 Switch' off"
e0581f
 		cset "name='Mono ADC MIXR ADC1 Switch' off"
e0581f
 
e0581f
-		cset "name='RECMIXL BST1 Switch' off"
e0581f
-		cset "name='RECMIXR BST1 Switch' off"
e0581f
+		cset "name='RECMIXL BST2 Switch' off"
e0581f
+		cset "name='RECMIXR BST2 Switch' off"
e0581f
 
e0581f
-		cset "name='Int Mic Switch' off"
e0581f
+		cset "name='Int Analog Mic Switch' off"
e0581f
 	]
e0581f
 }
e0581f
 
e0581f
-- 
e0581f
2.13.6
e0581f
e0581f
e0581f
From c22a7f423ddef2a1376bc84f2aafc0a167192ab6 Mon Sep 17 00:00:00 2001
e0581f
From: Hans de Goede <hdegoede@redhat.com>
e0581f
Date: Sat, 28 Apr 2018 21:51:59 +0200
e0581f
Subject: [PATCH 14/26] conf/ucm: chtrt5645: At config for the Asus T100HA
e0581f
e0581f
The Asus T100HA uses a digital mic rather then an analog one, add
e0581f
long-name config specific for the T100HA, which is a copy of the standard
e0581f
chtrt5645 config with the internal analog mic section replaced with one
e0581f
for the digital mic found on the Asus T100HA.
e0581f
e0581f
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
e0581f
Signed-off-by: Takashi Iwai <tiwai@suse.de>
e0581f
---
e0581f
 configure.ac                                       |   1 +
e0581f
 .../ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN.conf   |   5 +
e0581f
 .../HiFi.conf                                      | 348 +++++++++++++++++++++
e0581f
 .../Makefile.am                                    |   4 +
e0581f
 src/conf/ucm/Makefile.am                           |   1 +
e0581f
 5 files changed, 359 insertions(+)
e0581f
 create mode 100644 src/conf/ucm/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN.conf
e0581f
 create mode 100644 src/conf/ucm/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN/HiFi.conf
e0581f
 create mode 100644 src/conf/ucm/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN/Makefile.am
e0581f
e0581f
diff --git a/configure.ac b/configure.ac
e0581f
index 5bc1994f..94baf055 100644
e0581f
--- a/configure.ac
e0581f
+++ b/configure.ac
e0581f
@@ -717,6 +717,7 @@ AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \
e0581f
 	  src/conf/cards/Makefile \
e0581f
 	  src/conf/pcm/Makefile \
e0581f
 	  src/conf/ucm/Makefile \
e0581f
+	  src/conf/ucm/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN/Makefile \
e0581f
 	  src/conf/ucm/broadwell-rt286/Makefile \
e0581f
 	  src/conf/ucm/broxton-rt298/Makefile \
e0581f
 	  src/conf/ucm/bytcr-rt5651/Makefile \
e0581f
diff --git a/src/conf/ucm/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN.conf b/src/conf/ucm/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN.conf
e0581f
new file mode 100644
e0581f
index 00000000..5afe5f0b
e0581f
--- /dev/null
e0581f
+++ b/src/conf/ucm/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN.conf
e0581f
@@ -0,0 +1,5 @@
e0581f
+Comment "Intel SoC Audio Device"
e0581f
+SectionUseCase."HiFi" {
e0581f
+	File "../ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN/HiFi.conf"
e0581f
+	Comment "Default"
e0581f
+}
e0581f
diff --git a/src/conf/ucm/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN/HiFi.conf b/src/conf/ucm/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN/HiFi.conf
e0581f
new file mode 100644
e0581f
index 00000000..78bf9823
e0581f
--- /dev/null
e0581f
+++ b/src/conf/ucm/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN/HiFi.conf
e0581f
@@ -0,0 +1,348 @@
e0581f
+SectionVerb {
e0581f
+	# ALSA PCM
e0581f
+	Value {
e0581f
+		TQ "HiFi"
e0581f
+
e0581f
+		# ALSA PCM device for HiFi
e0581f
+		PlaybackPCM "hw:chtrt5645"
e0581f
+		CapturePCM "hw:chtrt5645"
e0581f
+	}
e0581f
+
e0581f
+	EnableSequence [
e0581f
+		cdev "hw:chtrt5645"
e0581f
+
e0581f
+		# media mixer settings
e0581f
+		#   compress
e0581f
+		cset "name='media0_in Gain 0 Switch' on"
e0581f
+		cset "name='media0_in Gain 0 Volume' 0"
e0581f
+
e0581f
+		#   normal
e0581f
+		cset "name='media1_in Gain 0 Switch' on"
e0581f
+		cset "name='media1_in Gain 0 Volume' 0"
e0581f
+		#   swm loopback
e0581f
+		cset "name='media2_in Gain 0 Switch' off"
e0581f
+		cset "name='media2_in Gain 0 Volume' 0%"
e0581f
+		#   deep buffer
e0581f
+		cset "name='media3_in Gain 0 Switch' on"
e0581f
+		cset "name='media3_in Gain 0 Volume' 0"
e0581f
+
e0581f
+		cset "name='media0_out mix 0 media0_in Switch' on"
e0581f
+		cset "name='media0_out mix 0 media1_in Switch' on"
e0581f
+		cset "name='media0_out mix 0 media2_in Switch' off"
e0581f
+		cset "name='media0_out mix 0 media3_in Switch' on"
e0581f
+
e0581f
+		cset "name='media1_out mix 0 media0_in Switch' off"
e0581f
+		cset "name='media1_out mix 0 media1_in Switch' off"
e0581f
+		cset "name='media1_out mix 0 media2_in Switch' off"
e0581f
+		cset "name='media1_out mix 0 media3_in Switch' off"
e0581f
+
e0581f
+		cset "name='pcm0_in Gain 0 Switch' on"
e0581f
+		cset "name='pcm0_in Gain 0 Volume' 0"
e0581f
+
e0581f
+		cset "name='pcm1_in Gain 0 Switch' off"
e0581f
+		cset "name='pcm1_in Gain 0 Volume' 0%"
e0581f
+
e0581f
+		# codec0_out settings (used if ssp2 is connected to aif1)
e0581f
+		cset "name='codec_out0 mix 0 codec_in0 Switch' off"
e0581f
+		cset "name='codec_out0 mix 0 codec_in1 Switch' off"
e0581f
+		cset "name='codec_out0 mix 0 media_loop1_in Switch' off"
e0581f
+		cset "name='codec_out0 mix 0 media_loop2_in Switch' off"
e0581f
+		cset "name='codec_out0 mix 0 pcm0_in Switch' on"
e0581f
+		cset "name='codec_out0 mix 0 pcm1_in Switch' off"
e0581f
+		cset "name='codec_out0 mix 0 sprot_loop_in Switch' off"
e0581f
+		cset "name='codec_out0 Gain 0 Switch' on"
e0581f
+		cset "name='codec_out0 Gain 0 Volume' 0"
e0581f
+
e0581f
+		# modem_out settings (used if ssp0 is connected to aif2)
e0581f
+		cset "name='modem_out mix 0 codec_in0 Switch' off"
e0581f
+		cset "name='modem_out mix 0 codec_in1 Switch' off"
e0581f
+		cset "name='modem_out mix 0 media_loop1_in Switch' off"
e0581f
+		cset "name='modem_out mix 0 media_loop2_in Switch' off"
e0581f
+		cset "name='modem_out mix 0 pcm0_in Switch' on"
e0581f
+		cset "name='modem_out mix 0 pcm1_in Switch' off"
e0581f
+		cset "name='modem_out mix 0 sprot_loop_in Switch' off"
e0581f
+		cset "name='modem_out Gain 0 Switch' on"
e0581f
+		cset "name='modem_out Gain 0 Volume' 0"
e0581f
+
e0581f
+		# input settings
e0581f
+		# pcm1_out settings
e0581f
+
e0581f
+		# input used when SSP2 is connected
e0581f
+		cset "name='codec_in0 Gain 0 Switch' on"
e0581f
+		cset "name='codec_in0 Gain 0 Volume' 0"
e0581f
+
e0581f
+		# input used when SSP0 is connected
e0581f
+		cset "name='modem_in Gain 0 Switch' on"
e0581f
+		cset "name='modem_in Gain 0 Volume' 0"
e0581f
+
e0581f
+		cset "name='pcm1_out mix 0 codec_in0 Switch' on"
e0581f
+		cset "name='pcm1_out mix 0 modem_in Switch' on"
e0581f
+		cset "name='pcm1_out mix 0 codec_in1 Switch' off"
e0581f
+		cset "name='pcm1_out mix 0 media_loop1_in Switch' off"
e0581f
+		cset "name='pcm1_out mix 0 media_loop2_in Switch' off"
e0581f
+		cset "name='pcm1_out mix 0 pcm0_in Switch' off"
e0581f
+		cset "name='pcm1_out mix 0 pcm1_in Switch' off"
e0581f
+		cset "name='pcm1_out mix 0 sprot_loop_in Switch' off"
e0581f
+
e0581f
+		cset "name='pcm1_out Gain 0 Switch' on"
e0581f
+		cset "name='pcm1_out Gain 0 Volume' 0"
e0581f
+
e0581f
+		# disable codec_out1
e0581f
+		cset "name='codec_out1 mix 0 codec_in0 Switch' off"
e0581f
+		cset "name='codec_out1 mix 0 codec_in1 Switch' off"
e0581f
+		cset "name='codec_out1 mix 0 media_loop1_in Switch' off"
e0581f
+		cset "name='codec_out1 mix 0 media_loop2_in Switch' off"
e0581f
+		cset "name='codec_out1 mix 0 pcm0_in Switch' off"
e0581f
+		cset "name='codec_out1 mix 0 pcm1_in Switch' off"
e0581f
+		cset "name='codec_out1 mix 0 sprot_loop_in Switch' off"
e0581f
+		cset "name='codec_out1 Gain 0 Switch' off"
e0581f
+		cset "name='codec_out1 Gain 0 Volume' 0%"
e0581f
+
e0581f
+		# disable codec_in1
e0581f
+		cset "name='codec_in1 Gain 0 Switch' off"
e0581f
+		cset "name='codec_in1 Gain 0 Volume' 0%"
e0581f
+
e0581f
+		# disable all loops
e0581f
+		cset "name='media_loop1_out mix 0 codec_in0 Switch' off"
e0581f
+		cset "name='media_loop1_out mix 0 codec_in1 Switch' off"
e0581f
+		cset "name='media_loop1_out mix 0 media_loop1_in Switch' off"
e0581f
+		cset "name='media_loop1_out mix 0 media_loop2_in Switch' off"
e0581f
+		cset "name='media_loop1_out mix 0 pcm0_in Switch' off"
e0581f
+		cset "name='media_loop1_out mix 0 pcm1_in Switch' off"
e0581f
+		cset "name='media_loop1_out mix 0 sprot_loop_in Switch' off"
e0581f
+
e0581f
+		cset "name='media_loop2_out mix 0 codec_in0 Switch' off"
e0581f
+		cset "name='media_loop2_out mix 0 codec_in1 Switch' off"
e0581f
+		cset "name='media_loop2_out mix 0 media_loop1_in Switch' off"
e0581f
+		cset "name='media_loop2_out mix 0 media_loop2_in Switch' off"
e0581f
+		cset "name='media_loop2_out mix 0 pcm0_in Switch' off"
e0581f
+		cset "name='media_loop2_out mix 0 pcm1_in Switch' off"
e0581f
+		cset "name='media_loop2_out mix 0 sprot_loop_in Switch' off"
e0581f
+
e0581f
+		cset "name='sprot_loop_out mix 0 codec_in0 Switch' off"
e0581f
+		cset "name='sprot_loop_out mix 0 codec_in1 Switch' off"
e0581f
+		cset "name='sprot_loop_out mix 0 media_loop1_in Switch' off"
e0581f
+		cset "name='sprot_loop_out mix 0 media_loop2_in Switch' off"
e0581f
+		cset "name='sprot_loop_out mix 0 pcm0_in Switch' off"
e0581f
+		cset "name='sprot_loop_out mix 0 pcm1_in Switch' off"
e0581f
+		cset "name='sprot_loop_out mix 0 sprot_loop_in Switch' off"
e0581f
+
e0581f
+		# Output Configuration
e0581f
+		cset "name='DAC1 L Mux' IF1 DAC"
e0581f
+		cset "name='DAC1 R Mux' IF1 DAC"
e0581f
+		cset "name='DAC1 MIXL DAC1 Switch' 1"
e0581f
+		cset "name='DAC1 MIXR DAC1 Switch' 1"
e0581f
+		cset "name='Stereo DAC MIXL DAC L1 Switch' 1"
e0581f
+		cset "name='Stereo DAC MIXR DAC R1 Switch' 1"
e0581f
+
e0581f
+		cset "name='DAC L2 Mux' IF2 DAC"
e0581f
+		cset "name='DAC R2 Mux' IF2 DAC"
e0581f
+		cset "name='Mono DAC MIXL DAC L2 Switch' on"
e0581f
+		cset "name='Mono DAC MIXR DAC R2 Switch' on"
e0581f
+		cset "name='DAC2 Playback Switch' on"
e0581f
+
e0581f
+		cset "name='HPOVOL MIXL DAC1 Switch' on"
e0581f
+		cset "name='HPOVOL MIXR DAC1 Switch' on"
e0581f
+		cset "name='HPOVOL MIXL DAC2 Switch' on"
e0581f
+		cset "name='HPOVOL MIXR DAC2 Switch' on"
e0581f
+		cset "name='HPO MIX HPVOL Switch' on"
e0581f
+		cset "name='HPOVOL L Switch' on"
e0581f
+		cset "name='HPOVOL R Switch' on"
e0581f
+
e0581f
+		cset "name='SPK MIXL DAC L1 Switch' on"
e0581f
+		cset "name='SPK MIXR DAC R1 Switch' on"
e0581f
+		cset "name='SPK MIXL DAC L2 Switch' on"
e0581f
+		cset "name='SPK MIXR DAC R2 Switch' on"
e0581f
+		cset "name='SPOL MIX SPKVOL L Switch' on"
e0581f
+		cset "name='SPOR MIX SPKVOL R Switch' on"
e0581f
+		cset "name='SPKVOL L Switch' on"
e0581f
+		cset "name='SPKVOL R Switch' on"
e0581f
+
e0581f
+		# Input Configuration
e0581f
+		cset "name='Stereo1 DMIC Mux' 0"
e0581f
+		cset "name='Stereo1 ADC1 Mux' 1"
e0581f
+		cset "name='Stereo1 ADC2 Mux' 1"
e0581f
+		cset "name='ADC Capture Switch' on"
e0581f
+		# 55/63
e0581f
+		cset "name='ADC Capture Volume' 55"
e0581f
+		# set ADC Boost to 0/3, higher vals cause a lot of white noise
e0581f
+		cset "name='ADC Boost Capture Volume' 0"
e0581f
+		# 55/63
e0581f
+		cset "name='Mono ADC Capture Volume' 55"
e0581f
+		# 0/3
e0581f
+		cset "name='Mono ADC Boost Capture Volume' 0"
e0581f
+		# 27/31
e0581f
+		cset "name='IN Capture Volume' 27"
e0581f
+		cset "name='I2S2 Func Switch' on"
e0581f
+		# 3/12 the headphone mic tends to be quite loud
e0581f
+		cset "name='IN1 Boost' 3"
e0581f
+		# 8/8 the internal analog mic tends to be quite soft
e0581f
+		cset "name='IN2 Boost' 8"
e0581f
+	]
e0581f
+
e0581f
+	DisableSequence [
e0581f
+		cdev "hw:chtrt5645"
e0581f
+
e0581f
+		# Disable audio output path
e0581f
+		cset "name='codec_out1 mix 0 pcm0_in Switch' off"
e0581f
+		cset "name='media0_out mix 0 media1_in Switch' off"
e0581f
+
e0581f
+		cset "name='media1_in Gain 0 Switch' off"
e0581f
+		cset "name='pcm0_in Gain 0 Switch' off"
e0581f
+		cset "name='codec_out1 Gain 0 Switch' off"
e0581f
+
e0581f
+		# Disable audio input path
e0581f
+		cset "name='pcm1_out mix 0 media_loop2_in Switch' off"
e0581f
+		cset "name='media_loop2_out mix 0 codec_in0 Switch' off"
e0581f
+
e0581f
+		cset "name='media_loop2_out Gain 0 Switch' off"
e0581f
+		cset "name='pcm1_out Gain 0 Switch' off"
e0581f
+		cset "name='codec_in0 Gain 0 Switch' off"
e0581f
+	]
e0581f
+}
e0581f
+
e0581f
+SectionDevice."Speaker" {
e0581f
+	Comment "Speaker"
e0581f
+
e0581f
+	Value {
e0581f
+		PlaybackChannels "2"
e0581f
+	}
e0581f
+
e0581f
+	ConflictingDevice [
e0581f
+		"Headphones"
e0581f
+	]
e0581f
+
e0581f
+	EnableSequence [
e0581f
+		cdev "hw:chtrt5645"
e0581f
+
e0581f
+		cset "name='Headphone Switch' off"
e0581f
+		cset "name='Headphone Channel Switch' off"
e0581f
+
e0581f
+		cset "name='Ext Spk Switch' on"
e0581f
+		cset "name='Speaker Channel Switch' on"
e0581f
+		cset "name='Speaker Playback Volume' 31"
e0581f
+	]
e0581f
+
e0581f
+	DisableSequence [
e0581f
+		cdev "hw:chtrt5645"
e0581f
+
e0581f
+		cset "name='Ext Spk Switch' off"
e0581f
+		cset "name='Speaker Channel Switch' off"
e0581f
+	]
e0581f
+}
e0581f
+
e0581f
+SectionDevice."Headphones" {
e0581f
+	Comment "Headphones"
e0581f
+
e0581f
+	Value {
e0581f
+		PlaybackChannels "2"
e0581f
+		JackControl "Headphone Jack"
e0581f
+		JackHWMute "Speaker"
e0581f
+	}
e0581f
+
e0581f
+	ConflictingDevice [
e0581f
+		"Speaker"
e0581f
+	]
e0581f
+
e0581f
+	EnableSequence [
e0581f
+		cdev "hw:chtrt5645"
e0581f
+
e0581f
+		cset "name='Ext Spk Switch' off"
e0581f
+		cset "name='Speaker Channel Switch' off"
e0581f
+
e0581f
+		cset "name='Headphone Switch' on"
e0581f
+		cset "name='Headphone Channel Switch' on"
e0581f
+		# 25/39 higher values cause crackling on some boards
e0581f
+		cset "name='Headphone Playback Volume' 25"
e0581f
+	]
e0581f
+
e0581f
+	DisableSequence [
e0581f
+		cdev "hw:chtrt5645"
e0581f
+
e0581f
+		cset "name='Headphone Switch' off"
e0581f
+		cset "name='Headphone Channel Switch' off"
e0581f
+	]
e0581f
+}
e0581f
+
e0581f
+SectionDevice."DMic".0 {
e0581f
+	Comment "Internal Microphone"
e0581f
+
e0581f
+	Value {
e0581f
+		CaptureChannels "2"
e0581f
+		CapturePriority "150"
e0581f
+	}
e0581f
+
e0581f
+	EnableSequence [
e0581f
+		cdev "hw:chtrt5645"
e0581f
+
e0581f
+		cset "name='Int Mic Switch' on"
e0581f
+
e0581f
+		cset "name='Stereo1 DMIC Mux' DMIC1"
e0581f
+		cset "name='Stereo1 ADC2 Mux' DMIC"
e0581f
+		cset "name='Mono ADC L2 Mux' DMIC"
e0581f
+		cset "name='Mono ADC R2 Mux' DMIC"
e0581f
+
e0581f
+		cset "name='Sto1 ADC MIXL ADC1 Switch' off"
e0581f
+		cset "name='Sto1 ADC MIXR ADC1 Switch' off"
e0581f
+		cset "name='Sto1 ADC MIXL ADC2 Switch' on"
e0581f
+		cset "name='Sto1 ADC MIXR ADC2 Switch' on"
e0581f
+		cset "name='Mono ADC MIXL ADC1 Switch' off"
e0581f
+		cset "name='Mono ADC MIXR ADC1 Switch' off"
e0581f
+		cset "name='Mono ADC MIXL ADC2 Switch' on"
e0581f
+		cset "name='Mono ADC MIXR ADC2 Switch' on"
e0581f
+	]
e0581f
+
e0581f
+	DisableSequence [
e0581f
+		cdev "hw:chtrt5645"
e0581f
+
e0581f
+		cset "name='Sto1 ADC MIXL ADC2 Switch' off"
e0581f
+		cset "name='Sto1 ADC MIXR ADC2 Switch' off"
e0581f
+		cset "name='Mono ADC MIXL ADC2 Switch' off"
e0581f
+		cset "name='Mono ADC MIXR ADC2 Switch' off"
e0581f
+		cset "name='Int Mic Switch' off"
e0581f
+	]
e0581f
+}
e0581f
+
e0581f
+SectionDevice."HSMic".0 {
e0581f
+	Comment "Headset Microphone"
e0581f
+
e0581f
+	Value {
e0581f
+		CaptureChannels "2"
e0581f
+		JackControl "Headset Mic Jack"
e0581f
+		JackHWMute "DMic"
e0581f
+	}
e0581f
+
e0581f
+	EnableSequence [
e0581f
+		cdev "hw:chtrt5645"
e0581f
+
e0581f
+		cset "name='Headset Mic Switch' on"
e0581f
+
e0581f
+		cset "name='Sto1 ADC MIXL ADC1 Switch' on"
e0581f
+		cset "name='Sto1 ADC MIXR ADC1 Switch' on"
e0581f
+		cset "name='Sto1 ADC MIXL ADC2 Switch' off"
e0581f
+		cset "name='Sto1 ADC MIXR ADC2 Switch' off"
e0581f
+
e0581f
+		cset "name='Mono ADC MIXL ADC1 Switch' on"
e0581f
+		cset "name='Mono ADC MIXR ADC1 Switch' on"
e0581f
+		cset "name='Mono ADC MIXL ADC2 Switch' off"
e0581f
+		cset "name='Mono ADC MIXR ADC2 Switch' off"
e0581f
+
e0581f
+		cset "name='RECMIXL BST1 Switch' on"
e0581f
+		cset "name='RECMIXR BST1 Switch' on"
e0581f
+
e0581f
+	]
e0581f
+
e0581f
+	DisableSequence [
e0581f
+		cdev "hw:chtrt5645"
e0581f
+
e0581f
+		cset "name='Headset Mic Switch' off"
e0581f
+
e0581f
+		cset "name='RECMIXL BST1 Switch' off"
e0581f
+		cset "name='RECMIXR BST1 Switch' off"
e0581f
+		cset "name='Sto1 ADC MIXL ADC1 Switch' off"
e0581f
+		cset "name='Sto1 ADC MIXR ADC1 Switch' off"
e0581f
+		cset "name='Mono ADC MIXL ADC1 Switch' on"
e0581f
+		cset "name='Mono ADC MIXR ADC1 Switch' on"
e0581f
+
e0581f
+	]
e0581f
+}
e0581f
diff --git a/src/conf/ucm/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN/Makefile.am b/src/conf/ucm/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN/Makefile.am
e0581f
new file mode 100644
e0581f
index 00000000..dd8b372a
e0581f
--- /dev/null
e0581f
+++ b/src/conf/ucm/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN/Makefile.am
e0581f
@@ -0,0 +1,4 @@
e0581f
+alsaconfigdir = @ALSA_CONFIG_DIR@
e0581f
+ucmdir = $(alsaconfigdir)/ucm/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN
e0581f
+ucm_DATA = ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN.conf HiFi.conf
e0581f
+EXTRA_DIST = $(ucm_DATA)
e0581f
diff --git a/src/conf/ucm/Makefile.am b/src/conf/ucm/Makefile.am
e0581f
index 3b4f13a8..e496ca89 100644
e0581f
--- a/src/conf/ucm/Makefile.am
e0581f
+++ b/src/conf/ucm/Makefile.am
e0581f
@@ -1,4 +1,5 @@
e0581f
 SUBDIRS=\
e0581f
+ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN \
e0581f
 broadwell-rt286 \
e0581f
 broxton-rt298 \
e0581f
 bytcr-rt5651 \
e0581f
-- 
e0581f
2.13.6
e0581f
e0581f
e0581f
From 5a2df9449d0b17e3579bde60ba48244ba24ea604 Mon Sep 17 00:00:00 2001
e0581f
From: Hans de Goede <hdegoede@redhat.com>
e0581f
Date: Sat, 28 Apr 2018 21:52:00 +0200
e0581f
Subject: [PATCH 15/26] conf/ucm: chtrt5645: At config for the Lenovo Ideapad
e0581f
 Miix 320
e0581f
e0581f
The Lenovo Ideapad Miix 320 uses a digital mic connected to the DMIC2 input
e0581f
(unlike the Asus T100HA which has it connected to the DMIC1 input), add a
e0581f
long-name config specific for the Miix 320, which is a copy of the standard
e0581f
chtrt5645 config with the internal analog mic section replaced with one
e0581f
for a digital mic connected to the DMIC2 input.
e0581f
e0581f
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
e0581f
Signed-off-by: Takashi Iwai <tiwai@suse.de>
e0581f
---
e0581f
 configure.ac                                       |   1 +
e0581f
 .../HiFi.conf                                      | 350 +++++++++++++++++++++
e0581f
 ...ENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216.conf |   5 +
e0581f
 .../Makefile.am                                    |   4 +
e0581f
 src/conf/ucm/Makefile.am                           |   1 +
e0581f
 5 files changed, 361 insertions(+)
e0581f
 create mode 100644 src/conf/ucm/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216/HiFi.conf
e0581f
 create mode 100644 src/conf/ucm/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216.conf
e0581f
 create mode 100644 src/conf/ucm/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216/Makefile.am
e0581f
e0581f
diff --git a/configure.ac b/configure.ac
e0581f
index 94baf055..3ee989eb 100644
e0581f
--- a/configure.ac
e0581f
+++ b/configure.ac
e0581f
@@ -729,6 +729,7 @@ AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \
e0581f
 	  src/conf/ucm/gpd-win-pocket-rt5645/Makefile \
e0581f
 	  src/conf/ucm/HDAudio-Gigabyte-ALC1220DualCodecs/Makefile \
e0581f
 	  src/conf/ucm/HDAudio-Lenovo-DualCodecs/Makefile \
e0581f
+	  src/conf/ucm/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216/Makefile \
e0581f
 	  src/conf/ucm/PandaBoard/Makefile \
e0581f
 	  src/conf/ucm/PandaBoardES/Makefile \
e0581f
 	  src/conf/ucm/PAZ00/Makefile \
e0581f
diff --git a/src/conf/ucm/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216/HiFi.conf b/src/conf/ucm/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216/HiFi.conf
e0581f
new file mode 100644
e0581f
index 00000000..8cc9c7f2
e0581f
--- /dev/null
e0581f
+++ b/src/conf/ucm/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216/HiFi.conf
e0581f
@@ -0,0 +1,350 @@
e0581f
+SectionVerb {
e0581f
+	# ALSA PCM
e0581f
+	Value {
e0581f
+		TQ "HiFi"
e0581f
+
e0581f
+		# ALSA PCM device for HiFi
e0581f
+		PlaybackPCM "hw:chtrt5645"
e0581f
+		CapturePCM "hw:chtrt5645"
e0581f
+	}
e0581f
+
e0581f
+	EnableSequence [
e0581f
+		cdev "hw:chtrt5645"
e0581f
+
e0581f
+		# media mixer settings
e0581f
+		#   compress
e0581f
+		cset "name='media0_in Gain 0 Switch' on"
e0581f
+		cset "name='media0_in Gain 0 Volume' 0"
e0581f
+
e0581f
+		#   normal
e0581f
+		cset "name='media1_in Gain 0 Switch' on"
e0581f
+		cset "name='media1_in Gain 0 Volume' 0"
e0581f
+		#   swm loopback
e0581f
+		cset "name='media2_in Gain 0 Switch' off"
e0581f
+		cset "name='media2_in Gain 0 Volume' 0%"
e0581f
+		#   deep buffer
e0581f
+		cset "name='media3_in Gain 0 Switch' on"
e0581f
+		cset "name='media3_in Gain 0 Volume' 0"
e0581f
+
e0581f
+		cset "name='media0_out mix 0 media0_in Switch' on"
e0581f
+		cset "name='media0_out mix 0 media1_in Switch' on"
e0581f
+		cset "name='media0_out mix 0 media2_in Switch' off"
e0581f
+		cset "name='media0_out mix 0 media3_in Switch' on"
e0581f
+
e0581f
+		cset "name='media1_out mix 0 media0_in Switch' off"
e0581f
+		cset "name='media1_out mix 0 media1_in Switch' off"
e0581f
+		cset "name='media1_out mix 0 media2_in Switch' off"
e0581f
+		cset "name='media1_out mix 0 media3_in Switch' off"
e0581f
+
e0581f
+		cset "name='pcm0_in Gain 0 Switch' on"
e0581f
+		cset "name='pcm0_in Gain 0 Volume' 0"
e0581f
+
e0581f
+		cset "name='pcm1_in Gain 0 Switch' off"
e0581f
+		cset "name='pcm1_in Gain 0 Volume' 0%"
e0581f
+
e0581f
+		# codec0_out settings (used if ssp2 is connected to aif1)
e0581f
+		cset "name='codec_out0 mix 0 codec_in0 Switch' off"
e0581f
+		cset "name='codec_out0 mix 0 codec_in1 Switch' off"
e0581f
+		cset "name='codec_out0 mix 0 media_loop1_in Switch' off"
e0581f
+		cset "name='codec_out0 mix 0 media_loop2_in Switch' off"
e0581f
+		cset "name='codec_out0 mix 0 pcm0_in Switch' on"
e0581f
+		cset "name='codec_out0 mix 0 pcm1_in Switch' off"
e0581f
+		cset "name='codec_out0 mix 0 sprot_loop_in Switch' off"
e0581f
+		cset "name='codec_out0 Gain 0 Switch' on"
e0581f
+		cset "name='codec_out0 Gain 0 Volume' 0"
e0581f
+
e0581f
+		# modem_out settings (used if ssp0 is connected to aif2)
e0581f
+		cset "name='modem_out mix 0 codec_in0 Switch' off"
e0581f
+		cset "name='modem_out mix 0 codec_in1 Switch' off"
e0581f
+		cset "name='modem_out mix 0 media_loop1_in Switch' off"
e0581f
+		cset "name='modem_out mix 0 media_loop2_in Switch' off"
e0581f
+		cset "name='modem_out mix 0 pcm0_in Switch' on"
e0581f
+		cset "name='modem_out mix 0 pcm1_in Switch' off"
e0581f
+		cset "name='modem_out mix 0 sprot_loop_in Switch' off"
e0581f
+		cset "name='modem_out Gain 0 Switch' on"
e0581f
+		cset "name='modem_out Gain 0 Volume' 0"
e0581f
+
e0581f
+		# input settings
e0581f
+		# pcm1_out settings
e0581f
+
e0581f
+		# input used when SSP2 is connected
e0581f
+		cset "name='codec_in0 Gain 0 Switch' on"
e0581f
+		cset "name='codec_in0 Gain 0 Volume' 0"
e0581f
+
e0581f
+		# input used when SSP0 is connected
e0581f
+		cset "name='modem_in Gain 0 Switch' on"
e0581f
+		cset "name='modem_in Gain 0 Volume' 0"
e0581f
+
e0581f
+		cset "name='pcm1_out mix 0 codec_in0 Switch' on"
e0581f
+		cset "name='pcm1_out mix 0 modem_in Switch' on"
e0581f
+		cset "name='pcm1_out mix 0 codec_in1 Switch' off"
e0581f
+		cset "name='pcm1_out mix 0 media_loop1_in Switch' off"
e0581f
+		cset "name='pcm1_out mix 0 media_loop2_in Switch' off"
e0581f
+		cset "name='pcm1_out mix 0 pcm0_in Switch' off"
e0581f
+		cset "name='pcm1_out mix 0 pcm1_in Switch' off"
e0581f
+		cset "name='pcm1_out mix 0 sprot_loop_in Switch' off"
e0581f
+
e0581f
+		cset "name='pcm1_out Gain 0 Switch' on"
e0581f
+		cset "name='pcm1_out Gain 0 Volume' 0"
e0581f
+
e0581f
+		# disable codec_out1
e0581f
+		cset "name='codec_out1 mix 0 codec_in0 Switch' off"
e0581f
+		cset "name='codec_out1 mix 0 codec_in1 Switch' off"
e0581f
+		cset "name='codec_out1 mix 0 media_loop1_in Switch' off"
e0581f
+		cset "name='codec_out1 mix 0 media_loop2_in Switch' off"
e0581f
+		cset "name='codec_out1 mix 0 pcm0_in Switch' off"
e0581f
+		cset "name='codec_out1 mix 0 pcm1_in Switch' off"
e0581f
+		cset "name='codec_out1 mix 0 sprot_loop_in Switch' off"
e0581f
+		cset "name='codec_out1 Gain 0 Switch' off"
e0581f
+		cset "name='codec_out1 Gain 0 Volume' 0%"
e0581f
+
e0581f
+		# disable codec_in1
e0581f
+		cset "name='codec_in1 Gain 0 Switch' off"
e0581f
+		cset "name='codec_in1 Gain 0 Volume' 0%"
e0581f
+
e0581f
+		# disable all loops
e0581f
+		cset "name='media_loop1_out mix 0 codec_in0 Switch' off"
e0581f
+		cset "name='media_loop1_out mix 0 codec_in1 Switch' off"
e0581f
+		cset "name='media_loop1_out mix 0 media_loop1_in Switch' off"
e0581f
+		cset "name='media_loop1_out mix 0 media_loop2_in Switch' off"
e0581f
+		cset "name='media_loop1_out mix 0 pcm0_in Switch' off"
e0581f
+		cset "name='media_loop1_out mix 0 pcm1_in Switch' off"
e0581f
+		cset "name='media_loop1_out mix 0 sprot_loop_in Switch' off"
e0581f
+
e0581f
+		cset "name='media_loop2_out mix 0 codec_in0 Switch' off"
e0581f
+		cset "name='media_loop2_out mix 0 codec_in1 Switch' off"
e0581f
+		cset "name='media_loop2_out mix 0 media_loop1_in Switch' off"
e0581f
+		cset "name='media_loop2_out mix 0 media_loop2_in Switch' off"
e0581f
+		cset "name='media_loop2_out mix 0 pcm0_in Switch' off"
e0581f
+		cset "name='media_loop2_out mix 0 pcm1_in Switch' off"
e0581f
+		cset "name='media_loop2_out mix 0 sprot_loop_in Switch' off"
e0581f
+
e0581f
+		cset "name='sprot_loop_out mix 0 codec_in0 Switch' off"
e0581f
+		cset "name='sprot_loop_out mix 0 codec_in1 Switch' off"
e0581f
+		cset "name='sprot_loop_out mix 0 media_loop1_in Switch' off"
e0581f
+		cset "name='sprot_loop_out mix 0 media_loop2_in Switch' off"
e0581f
+		cset "name='sprot_loop_out mix 0 pcm0_in Switch' off"
e0581f
+		cset "name='sprot_loop_out mix 0 pcm1_in Switch' off"
e0581f
+		cset "name='sprot_loop_out mix 0 sprot_loop_in Switch' off"
e0581f
+
e0581f
+		# Output Configuration
e0581f
+		cset "name='DAC1 L Mux' IF1 DAC"
e0581f
+		cset "name='DAC1 R Mux' IF1 DAC"
e0581f
+		cset "name='DAC1 MIXL DAC1 Switch' 1"
e0581f
+		cset "name='DAC1 MIXR DAC1 Switch' 1"
e0581f
+		cset "name='Stereo DAC MIXL DAC L1 Switch' 1"
e0581f
+		cset "name='Stereo DAC MIXR DAC R1 Switch' 1"
e0581f
+
e0581f
+		cset "name='DAC L2 Mux' IF2 DAC"
e0581f
+		cset "name='DAC R2 Mux' IF2 DAC"
e0581f
+		cset "name='Mono DAC MIXL DAC L2 Switch' on"
e0581f
+		cset "name='Mono DAC MIXR DAC R2 Switch' on"
e0581f
+		cset "name='DAC2 Playback Switch' on"
e0581f
+
e0581f
+		cset "name='HPOVOL MIXL DAC1 Switch' on"
e0581f
+		cset "name='HPOVOL MIXR DAC1 Switch' on"
e0581f
+		cset "name='HPOVOL MIXL DAC2 Switch' on"
e0581f
+		cset "name='HPOVOL MIXR DAC2 Switch' on"
e0581f
+		cset "name='HPO MIX HPVOL Switch' on"
e0581f
+		cset "name='HPOVOL L Switch' on"
e0581f
+		cset "name='HPOVOL R Switch' on"
e0581f
+
e0581f
+		cset "name='SPK MIXL DAC L1 Switch' on"
e0581f
+		cset "name='SPK MIXR DAC R1 Switch' on"
e0581f
+		cset "name='SPK MIXL DAC L2 Switch' on"
e0581f
+		cset "name='SPK MIXR DAC R2 Switch' on"
e0581f
+		cset "name='SPOL MIX SPKVOL L Switch' on"
e0581f
+		cset "name='SPOR MIX SPKVOL R Switch' on"
e0581f
+		cset "name='SPKVOL L Switch' on"
e0581f
+		cset "name='SPKVOL R Switch' on"
e0581f
+
e0581f
+		# Input Configuration
e0581f
+		cset "name='Stereo1 DMIC Mux' 0"
e0581f
+		cset "name='Stereo1 ADC1 Mux' 1"
e0581f
+		cset "name='Stereo1 ADC2 Mux' 1"
e0581f
+		cset "name='ADC Capture Switch' on"
e0581f
+		# 55/63
e0581f
+		cset "name='ADC Capture Volume' 55"
e0581f
+		# set ADC Boost to 0/3, higher vals cause a lot of white noise
e0581f
+		cset "name='ADC Boost Capture Volume' 0"
e0581f
+		# 55/63
e0581f
+		cset "name='Mono ADC Capture Volume' 55"
e0581f
+		# 0/3
e0581f
+		cset "name='Mono ADC Boost Capture Volume' 0"
e0581f
+		# 27/31
e0581f
+		cset "name='IN Capture Volume' 27"
e0581f
+		cset "name='I2S2 Func Switch' on"
e0581f
+		# 3/12 the headphone mic tends to be quite loud
e0581f
+		cset "name='IN1 Boost' 3"
e0581f
+		# 8/8 the internal analog mic tends to be quite soft
e0581f
+		cset "name='IN2 Boost' 8"
e0581f
+	]
e0581f
+
e0581f
+	DisableSequence [
e0581f
+		cdev "hw:chtrt5645"
e0581f
+
e0581f
+		# Disable audio output path
e0581f
+		cset "name='codec_out1 mix 0 pcm0_in Switch' off"
e0581f
+		cset "name='media0_out mix 0 media1_in Switch' off"
e0581f
+
e0581f
+		cset "name='media1_in Gain 0 Switch' off"
e0581f
+		cset "name='pcm0_in Gain 0 Switch' off"
e0581f
+		cset "name='codec_out1 Gain 0 Switch' off"
e0581f
+
e0581f
+		# Disable audio input path
e0581f
+		cset "name='pcm1_out mix 0 media_loop2_in Switch' off"
e0581f
+		cset "name='media_loop2_out mix 0 codec_in0 Switch' off"
e0581f
+
e0581f
+		cset "name='media_loop2_out Gain 0 Switch' off"
e0581f
+		cset "name='pcm1_out Gain 0 Switch' off"
e0581f
+		cset "name='codec_in0 Gain 0 Switch' off"
e0581f
+	]
e0581f
+}
e0581f
+
e0581f
+SectionDevice."Speaker" {
e0581f
+	Comment "Speaker"
e0581f
+
e0581f
+	Value {
e0581f
+		PlaybackChannels "2"
e0581f
+	}
e0581f
+
e0581f
+	ConflictingDevice [
e0581f
+		"Headphones"
e0581f
+	]
e0581f
+
e0581f
+	EnableSequence [
e0581f
+		cdev "hw:chtrt5645"
e0581f
+
e0581f
+		cset "name='Headphone Switch' off"
e0581f
+		cset "name='Headphone Channel Switch' off"
e0581f
+
e0581f
+		cset "name='Ext Spk Switch' on"
e0581f
+		cset "name='Speaker Channel Switch' on"
e0581f
+		cset "name='Speaker Playback Volume' 31"
e0581f
+	]
e0581f
+
e0581f
+	DisableSequence [
e0581f
+		cdev "hw:chtrt5645"
e0581f
+
e0581f
+		cset "name='Ext Spk Switch' off"
e0581f
+		cset "name='Speaker Channel Switch' off"
e0581f
+	]
e0581f
+}
e0581f
+
e0581f
+SectionDevice."Headphones" {
e0581f
+	Comment "Headphones"
e0581f
+
e0581f
+	Value {
e0581f
+		PlaybackChannels "2"
e0581f
+		JackControl "Headphone Jack"
e0581f
+		JackHWMute "Speaker"
e0581f
+	}
e0581f
+
e0581f
+	ConflictingDevice [
e0581f
+		"Speaker"
e0581f
+	]
e0581f
+
e0581f
+	EnableSequence [
e0581f
+		cdev "hw:chtrt5645"
e0581f
+
e0581f
+		cset "name='Ext Spk Switch' off"
e0581f
+		cset "name='Speaker Channel Switch' off"
e0581f
+
e0581f
+		cset "name='Headphone Switch' on"
e0581f
+		cset "name='Headphone Channel Switch' on"
e0581f
+		# 25/39 higher values cause crackling on some boards
e0581f
+		cset "name='Headphone Playback Volume' 25"
e0581f
+	]
e0581f
+
e0581f
+	DisableSequence [
e0581f
+		cdev "hw:chtrt5645"
e0581f
+
e0581f
+		cset "name='Headphone Switch' off"
e0581f
+		cset "name='Headphone Channel Switch' off"
e0581f
+	]
e0581f
+}
e0581f
+
e0581f
+SectionDevice."DMic".0 {
e0581f
+	Comment "Internal Microphone"
e0581f
+
e0581f
+	Value {
e0581f
+		CaptureChannels "2"
e0581f
+		CapturePriority "150"
e0581f
+	}
e0581f
+
e0581f
+	EnableSequence [
e0581f
+		cdev "hw:chtrt5645"
e0581f
+
e0581f
+		cset "name='Int Mic Switch' on"
e0581f
+
e0581f
+		cset "name='Stereo1 DMIC Mux' DMIC2"
e0581f
+		cset "name='Stereo1 ADC2 Mux' DMIC"
e0581f
+		cset "name='Mono DMIC L Mux' DMIC2"
e0581f
+		cset "name='Mono DMIC R Mux' DMIC2"
e0581f
+		cset "name='Mono ADC L2 Mux' DMIC"
e0581f
+		cset "name='Mono ADC R2 Mux' DMIC"
e0581f
+
e0581f
+		cset "name='Sto1 ADC MIXL ADC1 Switch' off"
e0581f
+		cset "name='Sto1 ADC MIXR ADC1 Switch' off"
e0581f
+		cset "name='Sto1 ADC MIXL ADC2 Switch' on"
e0581f
+		cset "name='Sto1 ADC MIXR ADC2 Switch' on"
e0581f
+		cset "name='Mono ADC MIXL ADC1 Switch' off"
e0581f
+		cset "name='Mono ADC MIXR ADC1 Switch' off"
e0581f
+		cset "name='Mono ADC MIXL ADC2 Switch' on"
e0581f
+		cset "name='Mono ADC MIXR ADC2 Switch' on"
e0581f
+	]
e0581f
+
e0581f
+	DisableSequence [
e0581f
+		cdev "hw:chtrt5645"
e0581f
+
e0581f
+		cset "name='Sto1 ADC MIXL ADC2 Switch' off"
e0581f
+		cset "name='Sto1 ADC MIXR ADC2 Switch' off"
e0581f
+		cset "name='Mono ADC MIXL ADC2 Switch' off"
e0581f
+		cset "name='Mono ADC MIXR ADC2 Switch' off"
e0581f
+		cset "name='Int Mic Switch' off"
e0581f
+	]
e0581f
+}
e0581f
+
e0581f
+SectionDevice."HSMic".0 {
e0581f
+	Comment "Headset Microphone"
e0581f
+
e0581f
+	Value {
e0581f
+		CaptureChannels "2"
e0581f
+		JackControl "Headset Mic Jack"
e0581f
+		JackHWMute "DMic"
e0581f
+	}
e0581f
+
e0581f
+	EnableSequence [
e0581f
+		cdev "hw:chtrt5645"
e0581f
+
e0581f
+		cset "name='Headset Mic Switch' on"
e0581f
+
e0581f
+		cset "name='Sto1 ADC MIXL ADC1 Switch' on"
e0581f
+		cset "name='Sto1 ADC MIXR ADC1 Switch' on"
e0581f
+		cset "name='Sto1 ADC MIXL ADC2 Switch' off"
e0581f
+		cset "name='Sto1 ADC MIXR ADC2 Switch' off"
e0581f
+
e0581f
+		cset "name='Mono ADC MIXL ADC1 Switch' on"
e0581f
+		cset "name='Mono ADC MIXR ADC1 Switch' on"
e0581f
+		cset "name='Mono ADC MIXL ADC2 Switch' off"
e0581f
+		cset "name='Mono ADC MIXR ADC2 Switch' off"
e0581f
+
e0581f
+		cset "name='RECMIXL BST1 Switch' on"
e0581f
+		cset "name='RECMIXR BST1 Switch' on"
e0581f
+
e0581f
+	]
e0581f
+
e0581f
+	DisableSequence [
e0581f
+		cdev "hw:chtrt5645"
e0581f
+
e0581f
+		cset "name='Headset Mic Switch' off"
e0581f
+
e0581f
+		cset "name='RECMIXL BST1 Switch' off"
e0581f
+		cset "name='RECMIXR BST1 Switch' off"
e0581f
+		cset "name='Sto1 ADC MIXL ADC1 Switch' off"
e0581f
+		cset "name='Sto1 ADC MIXR ADC1 Switch' off"
e0581f
+		cset "name='Mono ADC MIXL ADC1 Switch' on"
e0581f
+		cset "name='Mono ADC MIXR ADC1 Switch' on"
e0581f
+
e0581f
+	]
e0581f
+}
e0581f
diff --git a/src/conf/ucm/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216.conf b/src/conf/ucm/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216.conf
e0581f
new file mode 100644
e0581f
index 00000000..50bda000
e0581f
--- /dev/null
e0581f
+++ b/src/conf/ucm/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216.conf
e0581f
@@ -0,0 +1,5 @@
e0581f
+Comment "Intel SoC Audio Device"
e0581f
+SectionUseCase."HiFi" {
e0581f
+	File "../LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216/HiFi.conf"
e0581f
+	Comment "Default"
e0581f
+}
e0581f
diff --git a/src/conf/ucm/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216/Makefile.am b/src/conf/ucm/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216/Makefile.am
e0581f
new file mode 100644
e0581f
index 00000000..18963c21
e0581f
--- /dev/null
e0581f
+++ b/src/conf/ucm/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216/Makefile.am
e0581f
@@ -0,0 +1,4 @@
e0581f
+alsaconfigdir = @ALSA_CONFIG_DIR@
e0581f
+ucmdir = $(alsaconfigdir)/ucm/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216
e0581f
+ucm_DATA = LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216.conf HiFi.conf
e0581f
+EXTRA_DIST = $(ucm_DATA)
e0581f
diff --git a/src/conf/ucm/Makefile.am b/src/conf/ucm/Makefile.am
e0581f
index e496ca89..02df25f0 100644
e0581f
--- a/src/conf/ucm/Makefile.am
e0581f
+++ b/src/conf/ucm/Makefile.am
e0581f
@@ -11,6 +11,7 @@ GoogleNyan \
e0581f
 gpd-win-pocket-rt5645 \
e0581f
 HDAudio-Gigabyte-ALC1220DualCodecs \
e0581f
 HDAudio-Lenovo-DualCodecs \
e0581f
+LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216 \
e0581f
 PandaBoard \
e0581f
 PandaBoardES \
e0581f
 PAZ00 \
e0581f
-- 
e0581f
2.13.6
e0581f
e0581f
e0581f
From 8ebb40c96970c913719a75deb2fe82ba2e257386 Mon Sep 17 00:00:00 2001
e0581f
From: Takashi Iwai <tiwai@suse.de>
e0581f
Date: Wed, 2 May 2018 16:23:21 +0200
e0581f
Subject: [PATCH 16/26] conf/ucm: Add a UCM profile for Dell WD15 Dock
e0581f
 USB-audio
e0581f
e0581f
USB-audio device on Dell WD15 docking station provides two individual
e0581f
PCM streams, one for headphone and another for line out.  A UCM
e0581f
profile gives the proper roles for these.
e0581f
e0581f
Signed-off-by: Takashi Iwai <tiwai@suse.de>
e0581f
---
e0581f
 src/conf/ucm/Dell-WD15-Dock/Dell-WD15-Dock.conf |  5 +++++
e0581f
 src/conf/ucm/Dell-WD15-Dock/HiFi.conf           | 26 +++++++++++++++++++++++++
e0581f
 src/conf/ucm/Dell-WD15-Dock/Makefile.am         |  4 ++++
e0581f
 src/conf/ucm/Makefile.am                        |  1 +
e0581f
 4 files changed, 36 insertions(+)
e0581f
 create mode 100644 src/conf/ucm/Dell-WD15-Dock/Dell-WD15-Dock.conf
e0581f
 create mode 100644 src/conf/ucm/Dell-WD15-Dock/HiFi.conf
e0581f
 create mode 100644 src/conf/ucm/Dell-WD15-Dock/Makefile.am
e0581f
e0581f
diff --git a/src/conf/ucm/Dell-WD15-Dock/Dell-WD15-Dock.conf b/src/conf/ucm/Dell-WD15-Dock/Dell-WD15-Dock.conf
e0581f
new file mode 100644
e0581f
index 00000000..f4f0a8d9
e0581f
--- /dev/null
e0581f
+++ b/src/conf/ucm/Dell-WD15-Dock/Dell-WD15-Dock.conf
e0581f
@@ -0,0 +1,5 @@
e0581f
+Comment "USB-audio on Dell WD15 docking station"
e0581f
+SectionUseCase."HiFi" {
e0581f
+	File "HiFi.conf"
e0581f
+	Comment "Default"
e0581f
+}
e0581f
diff --git a/src/conf/ucm/Dell-WD15-Dock/HiFi.conf b/src/conf/ucm/Dell-WD15-Dock/HiFi.conf
e0581f
new file mode 100644
e0581f
index 00000000..b07f3440
e0581f
--- /dev/null
e0581f
+++ b/src/conf/ucm/Dell-WD15-Dock/HiFi.conf
e0581f
@@ -0,0 +1,26 @@
e0581f
+SectionDevice."Headphone" {
e0581f
+	Comment "Headphone"
e0581f
+
e0581f
+	Value {
e0581f
+		PlaybackChannels "2"
e0581f
+		PlaybackPCM "hw:WD15Dock,0"
e0581f
+	}
e0581f
+}
e0581f
+
e0581f
+SectionDevice."LineOut" {
e0581f
+	Comment "Line Out"
e0581f
+
e0581f
+	Value {
e0581f
+		PlaybackChannels "2"
e0581f
+		PlaybackPCM "hw:WD15Dock,1"
e0581f
+	}
e0581f
+}
e0581f
+
e0581f
+SectionDevice."Mic" {
e0581f
+	Comment "Microphone"
e0581f
+
e0581f
+	Value {
e0581f
+		CaptureChannels "2"
e0581f
+		CapturePCM "hw:WD15Dock,0"
e0581f
+	}
e0581f
+}
e0581f
diff --git a/src/conf/ucm/Dell-WD15-Dock/Makefile.am b/src/conf/ucm/Dell-WD15-Dock/Makefile.am
e0581f
new file mode 100644
e0581f
index 00000000..7ab58730
e0581f
--- /dev/null
e0581f
+++ b/src/conf/ucm/Dell-WD15-Dock/Makefile.am
e0581f
@@ -0,0 +1,4 @@
e0581f
+alsaconfigdir = @ALSA_CONFIG_DIR@
e0581f
+ucmdir = $(alsaconfigdir)/ucm/Dell-WD15-Dock
e0581f
+ucm_DATA = Dell-WD15-Dock.conf HiFi.conf
e0581f
+EXTRA_DIST = $(ucm_DATA)
e0581f
diff --git a/src/conf/ucm/Makefile.am b/src/conf/ucm/Makefile.am
e0581f
index 02df25f0..38fc6b25 100644
e0581f
--- a/src/conf/ucm/Makefile.am
e0581f
+++ b/src/conf/ucm/Makefile.am
e0581f
@@ -7,6 +7,7 @@ chtrt5645 \
e0581f
 chtrt5645-mono-speaker-analog-mic \
e0581f
 DAISY-I2S \
e0581f
 DB410c \
e0581f
+Dell-WD15-Dock \
e0581f
 GoogleNyan \
e0581f
 gpd-win-pocket-rt5645 \
e0581f
 HDAudio-Gigabyte-ALC1220DualCodecs \
e0581f
-- 
e0581f
2.13.6
e0581f
e0581f
e0581f
From 44f499bb22f3923f966e11a234455e3d06936b8b Mon Sep 17 00:00:00 2001
e0581f
From: Takashi Iwai <tiwai@suse.de>
e0581f
Date: Thu, 3 May 2018 08:40:20 +0200
e0581f
Subject: [PATCH 17/26] configure: Fix forgotten ucm entry
e0581f
e0581f
The previous commit forgot to add to configure.ac.  Fix it.
e0581f
e0581f
Signed-off-by: Takashi Iwai <tiwai@suse.de>
e0581f
---
e0581f
 configure.ac | 1 +
e0581f
 1 file changed, 1 insertion(+)
e0581f
e0581f
diff --git a/configure.ac b/configure.ac
e0581f
index 3ee989eb..693b5d53 100644
e0581f
--- a/configure.ac
e0581f
+++ b/configure.ac
e0581f
@@ -725,6 +725,7 @@ AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \
e0581f
 	  src/conf/ucm/chtrt5645-mono-speaker-analog-mic/Makefile \
e0581f
 	  src/conf/ucm/DAISY-I2S/Makefile \
e0581f
 	  src/conf/ucm/DB410c/Makefile \
e0581f
+	  src/conf/ucm/Dell-WD15-Dock/Makefile \
e0581f
 	  src/conf/ucm/GoogleNyan/Makefile \
e0581f
 	  src/conf/ucm/gpd-win-pocket-rt5645/Makefile \
e0581f
 	  src/conf/ucm/HDAudio-Gigabyte-ALC1220DualCodecs/Makefile \
e0581f
-- 
e0581f
2.13.6
e0581f
e0581f
e0581f
From 5eb78219f6bc0114cbb6518dae1c9256a63ec23a Mon Sep 17 00:00:00 2001
e0581f
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
e0581f
Date: Tue, 15 May 2018 21:36:34 +0900
e0581f
Subject: [PATCH 18/26] control: add a series of macro for offset of several
e0581f
 types of TLV
e0581f
e0581f
In development period for Linux v4.18, a series of SNDRV_CTL_TLVO_XXX
e0581f
macro was introduced to kernel stuffs for position offset of TLV data.
e0581f
e0581f
This commit adds these macros to backport header in this library.
e0581f
e0581f
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
e0581f
Signed-off-by: Takashi Iwai <tiwai@suse.de>
e0581f
---
e0581f
 include/sound/tlv.h | 16 ++++++++++++++++
e0581f
 1 file changed, 16 insertions(+)
e0581f
e0581f
diff --git a/include/sound/tlv.h b/include/sound/tlv.h
e0581f
index b4df440c..2ea47685 100644
e0581f
--- a/include/sound/tlv.h
e0581f
+++ b/include/sound/tlv.h
e0581f
@@ -41,6 +41,10 @@
e0581f
 #define SNDRV_CTL_TLVD_LENGTH(...) \
e0581f
 	((unsigned int)sizeof((const unsigned int[]) { __VA_ARGS__ }))
e0581f
 
e0581f
+/* Accessor offsets for TLV data items */
e0581f
+#define SNDRV_CTL_TLVO_TYPE		0
e0581f
+#define SNDRV_CTL_TLVO_LEN		1
e0581f
+
e0581f
 #define SNDRV_CTL_TLVD_CONTAINER_ITEM(...) \
e0581f
 	SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_CONTAINER, __VA_ARGS__)
e0581f
 #define SNDRV_CTL_TLVD_DECLARE_CONTAINER(name, ...) \
e0581f
@@ -60,6 +64,10 @@
e0581f
 		SNDRV_CTL_TLVD_DB_SCALE_ITEM(min, step, mute) \
e0581f
 	}
e0581f
 
e0581f
+/* Accessor offsets for min, mute and step items in dB scale type TLV */
e0581f
+#define SNDRV_CTL_TLVO_DB_SCALE_MIN		2
e0581f
+#define SNDRV_CTL_TLVO_DB_SCALE_MUTE_AND_STEP	3
e0581f
+
e0581f
 /* dB scale specified with min/max values instead of step */
e0581f
 #define SNDRV_CTL_TLVD_DB_MINMAX_ITEM(min_dB, max_dB) \
e0581f
 	SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_MINMAX, (min_dB), (max_dB))
e0581f
@@ -74,6 +82,10 @@
e0581f
 		SNDRV_CTL_TLVD_DB_MINMAX_MUTE_ITEM(min_dB, max_dB) \
e0581f
 	}
e0581f
 
e0581f
+/* Accessor offsets for min, max items in db-minmax types of TLV. */
e0581f
+#define SNDRV_CTL_TLVO_DB_MINMAX_MIN	2
e0581f
+#define SNDRV_CTL_TLVO_DB_MINMAX_MAX	3
e0581f
+
e0581f
 /* linear volume between min_dB and max_dB (.01dB unit) */
e0581f
 #define SNDRV_CTL_TLVD_DB_LINEAR_ITEM(min_dB, max_dB) \
e0581f
 	SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_LINEAR, (min_dB), (max_dB))
e0581f
@@ -82,6 +94,10 @@
e0581f
 		SNDRV_CTL_TLVD_DB_LINEAR_ITEM(min_dB, max_dB) \
e0581f
 	}
e0581f
 
e0581f
+/* Accessor offsets for min, max items in db-linear type of TLV. */
e0581f
+#define SNDRV_CTL_TLVO_DB_LINEAR_MIN	2
e0581f
+#define SNDRV_CTL_TLVO_DB_LINEAR_MAX	3
e0581f
+
e0581f
 /* dB range container:
e0581f
  * Items in dB range container must be ordered by their values and by their
e0581f
  * dB values. This implies that larger values must correspond with larger
e0581f
-- 
e0581f
2.13.6
e0581f
e0581f
e0581f
From f61193c96c52cbd99e22d9cbb94937374ce2cb39 Mon Sep 17 00:00:00 2001
e0581f
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
e0581f
Date: Tue, 15 May 2018 21:36:35 +0900
e0581f
Subject: [PATCH 19/26] control: use position offset macro of TLV data
e0581f
e0581f
A series of SNDRV_CTL_TLVO_XXX macro was introduced for position offset
e0581f
of TLV data. This commit applies a code optimization.
e0581f
e0581f
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
e0581f
Signed-off-by: Takashi Iwai <tiwai@suse.de>
e0581f
---
e0581f
 src/control/control.c       | 12 ++++----
e0581f
 src/control/control_hw.c    |  6 ++--
e0581f
 src/control/control_local.h |  1 +
e0581f
 src/control/tlv.c           | 72 ++++++++++++++++++++++++---------------------
e0581f
 4 files changed, 51 insertions(+), 40 deletions(-)
e0581f
e0581f
diff --git a/src/control/control.c b/src/control/control.c
e0581f
index 11f7815a..82cd1a05 100644
e0581f
--- a/src/control/control.c
e0581f
+++ b/src/control/control.c
e0581f
@@ -938,10 +938,10 @@ int snd_ctl_elem_tlv_read(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
e0581f
 	 * and compare the returned value after ioctl for checking
e0581f
 	 * the validity of TLV.
e0581f
 	 */
e0581f
-	tlv[0] = -1;
e0581f
-	tlv[1] = 0;
e0581f
+	tlv[SNDRV_CTL_TLVO_TYPE] = -1;
e0581f
+	tlv[SNDRV_CTL_TLVO_LEN] = 0;
e0581f
 	err = snd_ctl_tlv_do(ctl, 0, id, tlv, tlv_size);
e0581f
-	if (err >= 0 && tlv[0] == (unsigned int)-1)
e0581f
+	if (err >= 0 && tlv[SNDRV_CTL_TLVO_TYPE] == (unsigned int)-1)
e0581f
 		err = -ENXIO;
e0581f
 	return err;
e0581f
 }
e0581f
@@ -967,7 +967,8 @@ int snd_ctl_elem_tlv_write(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
e0581f
 			   const unsigned int *tlv)
e0581f
 {
e0581f
 	assert(ctl && id && (id->name[0] || id->numid) && tlv);
e0581f
-	return snd_ctl_tlv_do(ctl, 1, id, (unsigned int *)tlv, tlv[1] + 2 * sizeof(unsigned int));
e0581f
+	return snd_ctl_tlv_do(ctl, 1, id, (unsigned int *)tlv,
e0581f
+			tlv[SNDRV_CTL_TLVO_LEN] + 2 * sizeof(unsigned int));
e0581f
 }
e0581f
 
e0581f
 /**
e0581f
@@ -991,7 +992,8 @@ int snd_ctl_elem_tlv_command(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
e0581f
 			     const unsigned int *tlv)
e0581f
 {
e0581f
 	assert(ctl && id && (id->name[0] || id->numid) && tlv);
e0581f
-	return snd_ctl_tlv_do(ctl, -1, id, (unsigned int *)tlv, tlv[1] + 2 * sizeof(unsigned int));
e0581f
+	return snd_ctl_tlv_do(ctl, -1, id, (unsigned int *)tlv,
e0581f
+			tlv[SNDRV_CTL_TLVO_LEN] + 2 * sizeof(unsigned int));
e0581f
 }
e0581f
 
e0581f
 /**
e0581f
diff --git a/src/control/control_hw.c b/src/control/control_hw.c
e0581f
index 4cbd306f..68eca522 100644
e0581f
--- a/src/control/control_hw.c
e0581f
+++ b/src/control/control_hw.c
e0581f
@@ -240,11 +240,13 @@ static int snd_ctl_hw_elem_tlv(snd_ctl_t *handle, int op_flag,
e0581f
 		return -errno;
e0581f
 	}
e0581f
 	if (op_flag == 0) {
e0581f
-		if (xtlv->tlv[1] + 2 * sizeof(unsigned int) > tlv_size) {
e0581f
+		unsigned int size;
e0581f
+		size = xtlv->tlv[SNDRV_CTL_TLVO_LEN] + 2 * sizeof(unsigned int);
e0581f
+		if (size > tlv_size) {
e0581f
 			free(xtlv);
e0581f
 			return -EFAULT;
e0581f
 		}
e0581f
-		memcpy(tlv, xtlv->tlv, xtlv->tlv[1] + 2 * sizeof(unsigned int));
e0581f
+		memcpy(tlv, xtlv->tlv, size);
e0581f
 	}
e0581f
 	free(xtlv);
e0581f
 	return 0;
e0581f
diff --git a/src/control/control_local.h b/src/control/control_local.h
e0581f
index 30218c6c..9568968e 100644
e0581f
--- a/src/control/control_local.h
e0581f
+++ b/src/control/control_local.h
e0581f
@@ -20,6 +20,7 @@
e0581f
  */
e0581f
 
e0581f
 #include "local.h"
e0581f
+#include <sound/tlv.h>
e0581f
 
e0581f
 typedef struct _snd_ctl_ops {
e0581f
 	int (*close)(snd_ctl_t *handle);
e0581f
diff --git a/src/control/tlv.c b/src/control/tlv.c
e0581f
index 467023b3..d6944b52 100644
e0581f
--- a/src/control/tlv.c
e0581f
+++ b/src/control/tlv.c
e0581f
@@ -65,8 +65,8 @@ int snd_tlv_parse_dB_info(unsigned int *tlv,
e0581f
 	int err;
e0581f
 
e0581f
 	*db_tlvp = NULL;
e0581f
-	type = tlv[0];
e0581f
-	size = tlv[1];
e0581f
+	type = tlv[SNDRV_CTL_TLVO_TYPE];
e0581f
+	size = tlv[SNDRV_CTL_TLVO_LEN];
e0581f
 	tlv_size -= 2 * sizeof(int);
e0581f
 	if (size > tlv_size) {
e0581f
 		SNDERR("TLV size error");
e0581f
@@ -83,7 +83,7 @@ int snd_tlv_parse_dB_info(unsigned int *tlv,
e0581f
 				return err; /* error */
e0581f
 			if (err > 0)
e0581f
 				return err; /* found */
e0581f
-			len = int_index(tlv[1]) + 2;
e0581f
+			len = int_index(tlv[SNDRV_CTL_TLVO_LEN]) + 2;
e0581f
 			size -= len * sizeof(int);
e0581f
 			tlv += len;
e0581f
 		}
e0581f
@@ -131,10 +131,10 @@ int snd_tlv_get_dB_range(unsigned int *tlv, long rangemin, long rangemax,
e0581f
 {
e0581f
 	int err;
e0581f
 
e0581f
-	switch (tlv[0]) {
e0581f
+	switch (tlv[SNDRV_CTL_TLVO_TYPE]) {
e0581f
 	case SND_CTL_TLVT_DB_RANGE: {
e0581f
 		unsigned int pos, len;
e0581f
-		len = int_index(tlv[1]);
e0581f
+		len = int_index(tlv[SNDRV_CTL_TLVO_LEN]);
e0581f
 		if (len > MAX_TLV_RANGE_SIZE)
e0581f
 			return -EINVAL;
e0581f
 		pos = 2;
e0581f
@@ -167,22 +167,23 @@ int snd_tlv_get_dB_range(unsigned int *tlv, long rangemin, long rangemax,
e0581f
 	}
e0581f
 	case SND_CTL_TLVT_DB_SCALE: {
e0581f
 		int step;
e0581f
-		if (tlv[3] & 0x10000)
e0581f
+		if (tlv[SNDRV_CTL_TLVO_DB_SCALE_MUTE_AND_STEP] & 0x10000)
e0581f
 			*min = SND_CTL_TLV_DB_GAIN_MUTE;
e0581f
 		else
e0581f
-			*min = (int)tlv[2];
e0581f
-		step = (tlv[3] & 0xffff);
e0581f
-		*max = (int)tlv[2] + step * (rangemax - rangemin);
e0581f
+			*min = (int)tlv[SNDRV_CTL_TLVO_DB_SCALE_MIN];
e0581f
+		step = (tlv[SNDRV_CTL_TLVO_DB_SCALE_MUTE_AND_STEP] & 0xffff);
e0581f
+		*max = (int)tlv[SNDRV_CTL_TLVO_DB_SCALE_MIN] +
e0581f
+						step * (rangemax - rangemin);
e0581f
 		return 0;
e0581f
 	}
e0581f
 	case SND_CTL_TLVT_DB_MINMAX:
e0581f
 	case SND_CTL_TLVT_DB_LINEAR:
e0581f
-		*min = (int)tlv[2];
e0581f
-		*max = (int)tlv[3];
e0581f
+		*min = (int)tlv[SNDRV_CTL_TLVO_DB_LINEAR_MIN];
e0581f
+		*max = (int)tlv[SNDRV_CTL_TLVO_DB_LINEAR_MAX];
e0581f
 		return 0;
e0581f
 	case SND_CTL_TLVT_DB_MINMAX_MUTE:
e0581f
 		*min = SND_CTL_TLV_DB_GAIN_MUTE;
e0581f
-		*max = (int)tlv[3];
e0581f
+		*max = (int)tlv[SNDRV_CTL_TLVO_DB_MINMAX_MAX];
e0581f
 		return 0;
e0581f
 	}
e0581f
 	return -EINVAL;
e0581f
@@ -200,10 +201,12 @@ int snd_tlv_get_dB_range(unsigned int *tlv, long rangemin, long rangemax,
e0581f
 int snd_tlv_convert_to_dB(unsigned int *tlv, long rangemin, long rangemax,
e0581f
 			  long volume, long *db_gain)
e0581f
 {
e0581f
-	switch (tlv[0]) {
e0581f
+	unsigned int type = tlv[SNDRV_CTL_TLVO_TYPE];
e0581f
+
e0581f
+	switch (type) {
e0581f
 	case SND_CTL_TLVT_DB_RANGE: {
e0581f
 		unsigned int pos, len;
e0581f
-		len = int_index(tlv[1]);
e0581f
+		len = int_index(tlv[SNDRV_CTL_TLVO_LEN]);
e0581f
 		if (len > MAX_TLV_RANGE_SIZE)
e0581f
 			return -EINVAL;
e0581f
 		pos = 2;
e0581f
@@ -220,9 +223,9 @@ int snd_tlv_convert_to_dB(unsigned int *tlv, long rangemin, long rangemax,
e0581f
 	}
e0581f
 	case SND_CTL_TLVT_DB_SCALE: {
e0581f
 		int min, step, mute;
e0581f
-		min = tlv[2];
e0581f
-		step = (tlv[3] & 0xffff);
e0581f
-		mute = (tlv[3] >> 16) & 1;
e0581f
+		min = tlv[SNDRV_CTL_TLVO_DB_SCALE_MIN];
e0581f
+		step = (tlv[SNDRV_CTL_TLVO_DB_SCALE_MUTE_AND_STEP] & 0xffff);
e0581f
+		mute = (tlv[SNDRV_CTL_TLVO_DB_SCALE_MUTE_AND_STEP] >> 16) & 1;
e0581f
 		if (mute && volume <= rangemin)
e0581f
 			*db_gain = SND_CTL_TLV_DB_GAIN_MUTE;
e0581f
 		else
e0581f
@@ -232,10 +235,10 @@ int snd_tlv_convert_to_dB(unsigned int *tlv, long rangemin, long rangemax,
e0581f
 	case SND_CTL_TLVT_DB_MINMAX:
e0581f
 	case SND_CTL_TLVT_DB_MINMAX_MUTE: {
e0581f
 		int mindb, maxdb;
e0581f
-		mindb = tlv[2];
e0581f
-		maxdb = tlv[3];
e0581f
+		mindb = tlv[SNDRV_CTL_TLVO_DB_MINMAX_MIN];
e0581f
+		maxdb = tlv[SNDRV_CTL_TLVO_DB_MINMAX_MAX];
e0581f
 		if (volume <= rangemin || rangemax <= rangemin) {
e0581f
-			if (tlv[0] == SND_CTL_TLVT_DB_MINMAX_MUTE)
e0581f
+			if (type == SND_CTL_TLVT_DB_MINMAX_MUTE)
e0581f
 				*db_gain = SND_CTL_TLV_DB_GAIN_MUTE;
e0581f
 			else
e0581f
 				*db_gain = mindb;
e0581f
@@ -248,8 +251,8 @@ int snd_tlv_convert_to_dB(unsigned int *tlv, long rangemin, long rangemax,
e0581f
 	}
e0581f
 #ifndef HAVE_SOFT_FLOAT
e0581f
 	case SND_CTL_TLVT_DB_LINEAR: {
e0581f
-		int mindb = tlv[2];
e0581f
-		int maxdb = tlv[3];
e0581f
+		int mindb = tlv[SNDRV_CTL_TLVO_DB_LINEAR_MIN];
e0581f
+		int maxdb = tlv[SNDRV_CTL_TLVO_DB_LINEAR_MAX];
e0581f
 		if (volume <= rangemin || rangemax <= rangemin)
e0581f
 			*db_gain = mindb;
e0581f
 		else if (volume >= rangemax)
e0581f
@@ -289,11 +292,13 @@ int snd_tlv_convert_to_dB(unsigned int *tlv, long rangemin, long rangemax,
e0581f
 int snd_tlv_convert_from_dB(unsigned int *tlv, long rangemin, long rangemax,
e0581f
 			    long db_gain, long *value, int xdir)
e0581f
 {
e0581f
-	switch (tlv[0]) {
e0581f
+	unsigned int type = tlv[SNDRV_CTL_TLVO_TYPE];
e0581f
+
e0581f
+	switch (type) {
e0581f
 	case SND_CTL_TLVT_DB_RANGE: {
e0581f
 		long dbmin, dbmax, prev_submax;
e0581f
 		unsigned int pos, len;
e0581f
-		len = int_index(tlv[1]);
e0581f
+		len = int_index(tlv[SNDRV_CTL_TLVO_LEN]);
e0581f
 		if (len < 6 || len > MAX_TLV_RANGE_SIZE)
e0581f
 			return -EINVAL;
e0581f
 		pos = 2;
e0581f
@@ -324,13 +329,14 @@ int snd_tlv_convert_from_dB(unsigned int *tlv, long rangemin, long rangemax,
e0581f
 		return 0;
e0581f
 	}
e0581f
 	case SND_CTL_TLVT_DB_SCALE: {
e0581f
-		int min, step, max;
e0581f
-		min = tlv[2];
e0581f
-		step = (tlv[3] & 0xffff);
e0581f
+		int min, step, max, mute;
e0581f
+		min = tlv[SNDRV_CTL_TLVO_DB_SCALE_MIN];
e0581f
+		step = tlv[SNDRV_CTL_TLVO_DB_SCALE_MUTE_AND_STEP] & 0xffff;
e0581f
+		mute = tlv[SNDRV_CTL_TLVO_DB_SCALE_MUTE_AND_STEP] & 0x10000;
e0581f
 		max = min + (int)(step * (rangemax - rangemin));
e0581f
 		if (db_gain <= min)
e0581f
 			if (db_gain > SND_CTL_TLV_DB_GAIN_MUTE && xdir > 0 &&
e0581f
-			    (tlv[3] & 0x10000))
e0581f
+			    mute)
e0581f
 				*value = rangemin + 1;
e0581f
 			else
e0581f
 				*value = rangemin;
e0581f
@@ -348,11 +354,11 @@ int snd_tlv_convert_from_dB(unsigned int *tlv, long rangemin, long rangemax,
e0581f
 	case SND_CTL_TLVT_DB_MINMAX:
e0581f
 	case SND_CTL_TLVT_DB_MINMAX_MUTE: {
e0581f
 		int min, max;
e0581f
-		min = tlv[2];
e0581f
-		max = tlv[3];
e0581f
+		min = tlv[SNDRV_CTL_TLVO_DB_MINMAX_MIN];
e0581f
+		max = tlv[SNDRV_CTL_TLVO_DB_MINMAX_MAX];
e0581f
 		if (db_gain <= min)
e0581f
 			if (db_gain > SND_CTL_TLV_DB_GAIN_MUTE && xdir > 0 &&
e0581f
-			    tlv[0] == SND_CTL_TLVT_DB_MINMAX_MUTE)
e0581f
+			    type == SND_CTL_TLVT_DB_MINMAX_MUTE)
e0581f
 				*value = rangemin + 1;
e0581f
 			else
e0581f
 				*value = rangemin;
e0581f
@@ -370,8 +376,8 @@ int snd_tlv_convert_from_dB(unsigned int *tlv, long rangemin, long rangemax,
e0581f
 #ifndef HAVE_SOFT_FLOAT
e0581f
 	case SND_CTL_TLVT_DB_LINEAR: {
e0581f
 		int min, max;
e0581f
-		min = tlv[2];
e0581f
-		max = tlv[3];
e0581f
+		min = tlv[SNDRV_CTL_TLVO_DB_LINEAR_MIN];
e0581f
+		max = tlv[SNDRV_CTL_TLVO_DB_LINEAR_MAX];
e0581f
 		if (db_gain <= min)
e0581f
 			*value = rangemin;
e0581f
 		else if (db_gain >= max)
e0581f
-- 
e0581f
2.13.6
e0581f
e0581f
e0581f
From 33f0888f0da191af49f17916f6548076d7125ea9 Mon Sep 17 00:00:00 2001
e0581f
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
e0581f
Date: Tue, 15 May 2018 21:36:36 +0900
e0581f
Subject: [PATCH 20/26] hcontrol: use position offset macro of TLV data
e0581f
e0581f
A series of SNDRV_CTL_TLVO_XXX macro was introduced for position offset
e0581f
of TLV data. This commit applies a code optimization.
e0581f
e0581f
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
e0581f
Signed-off-by: Takashi Iwai <tiwai@suse.de>
e0581f
---
e0581f
 src/control/hcontrol.c | 4 ++--
e0581f
 1 file changed, 2 insertions(+), 2 deletions(-)
e0581f
e0581f
diff --git a/src/control/hcontrol.c b/src/control/hcontrol.c
e0581f
index 7e775248..0cac8956 100644
e0581f
--- a/src/control/hcontrol.c
e0581f
+++ b/src/control/hcontrol.c
e0581f
@@ -870,7 +870,7 @@ int snd_hctl_elem_tlv_write(snd_hctl_elem_t *elem, const unsigned int *tlv)
e0581f
 {
e0581f
 	assert(elem);
e0581f
 	assert(tlv);
e0581f
-	assert(tlv[1] >= 4);
e0581f
+	assert(tlv[SNDRV_CTL_TLVO_LEN] >= 4);
e0581f
 	return snd_ctl_elem_tlv_write(elem->hctl->ctl, &elem->id, tlv);
e0581f
 }
e0581f
 
e0581f
@@ -886,7 +886,7 @@ int snd_hctl_elem_tlv_command(snd_hctl_elem_t *elem, const unsigned int *tlv)
e0581f
 {
e0581f
 	assert(elem);
e0581f
 	assert(tlv);
e0581f
-	assert(tlv[1] >= 4);
e0581f
+	assert(tlv[SNDRV_CTL_TLVO_LEN] >= 4);
e0581f
 	return snd_ctl_elem_tlv_command(elem->hctl->ctl, &elem->id, tlv);
e0581f
 }
e0581f
 
e0581f
-- 
e0581f
2.13.6
e0581f
e0581f
e0581f
From b0b720513ee35ec0a5afada0b240310f2f2e1b30 Mon Sep 17 00:00:00 2001
e0581f
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
e0581f
Date: Tue, 15 May 2018 21:36:37 +0900
e0581f
Subject: [PATCH 21/26] pcm: hw: use position offset macro of TLV data
e0581f
e0581f
A series of SNDRV_CTL_TLVO_XXX macro was introduced for position offset
e0581f
of TLV data. This commit applies a code optimization.
e0581f
e0581f
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
e0581f
Signed-off-by: Takashi Iwai <tiwai@suse.de>
e0581f
---
e0581f
 src/pcm/pcm_hw.c | 10 ++++++----
e0581f
 1 file changed, 6 insertions(+), 4 deletions(-)
e0581f
e0581f
diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c
e0581f
index 65b198c5..a728b23b 100644
e0581f
--- a/src/pcm/pcm_hw.c
e0581f
+++ b/src/pcm/pcm_hw.c
e0581f
@@ -1199,6 +1199,7 @@ snd_pcm_query_chmaps_from_hw(int card, int dev, int subdev,
e0581f
 	snd_ctl_t *ctl;
e0581f
 	snd_ctl_elem_id_t id = {0};
e0581f
 	unsigned int tlv[2048], *start;
e0581f
+	unsigned int type;
e0581f
 	snd_pcm_chmap_query_t **map;
e0581f
 	int i, ret, nums;
e0581f
 
e0581f
@@ -1223,9 +1224,10 @@ snd_pcm_query_chmaps_from_hw(int card, int dev, int subdev,
e0581f
 	/* FIXME: the parser below assumes that the TLV only contains
e0581f
 	 * chmap-related blocks
e0581f
 	 */
e0581f
-	if (tlv[0] != SND_CTL_TLVT_CONTAINER) {
e0581f
-		if (!is_chmap_type(tlv[0])) {
e0581f
-			SYSMSG("Invalid TLV type %d\n", tlv[0]);
e0581f
+	type = tlv[SNDRV_CTL_TLVO_TYPE];
e0581f
+	if (type != SND_CTL_TLVT_CONTAINER) {
e0581f
+		if (!is_chmap_type(type)) {
e0581f
+			SYSMSG("Invalid TLV type %d\n", type);
e0581f
 			return NULL;
e0581f
 		}
e0581f
 		start = tlv;
e0581f
@@ -1234,7 +1236,7 @@ snd_pcm_query_chmaps_from_hw(int card, int dev, int subdev,
e0581f
 		unsigned int *p;
e0581f
 		int size;
e0581f
 		start = tlv + 2;
e0581f
-		size = tlv[1];
e0581f
+		size = tlv[SNDRV_CTL_TLVO_LEN];
e0581f
 		nums = 0;
e0581f
 		for (p = start; size > 0; ) {
e0581f
 			if (!is_chmap_type(p[0])) {
e0581f
-- 
e0581f
2.13.6
e0581f
e0581f
e0581f
From 6dc2ed4090bee0e5516839173166c6a35c3d80be Mon Sep 17 00:00:00 2001
e0581f
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
e0581f
Date: Tue, 15 May 2018 21:36:38 +0900
e0581f
Subject: [PATCH 22/26] pcm: softvol: use position offset macro of TLV data
e0581f
e0581f
A series of SNDRV_CTL_TLVO_XXX macro was introduced for position offset
e0581f
of TLV data. This commit applies a code optimization.
e0581f
e0581f
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
e0581f
Signed-off-by: Takashi Iwai <tiwai@suse.de>
e0581f
---
e0581f
 src/pcm/pcm_softvol.c | 11 +++++++----
e0581f
 1 file changed, 7 insertions(+), 4 deletions(-)
e0581f
e0581f
diff --git a/src/pcm/pcm_softvol.c b/src/pcm/pcm_softvol.c
e0581f
index 0eaeacef..f08208f8 100644
e0581f
--- a/src/pcm/pcm_softvol.c
e0581f
+++ b/src/pcm/pcm_softvol.c
e0581f
@@ -31,6 +31,8 @@
e0581f
 #include "pcm_local.h"
e0581f
 #include "pcm_plugin.h"
e0581f
 
e0581f
+#include <sound/tlv.h>
e0581f
+
e0581f
 #ifndef PIC
e0581f
 /* entry for static linking */
e0581f
 const char *_snd_module_pcm_softvol = "";
e0581f
@@ -708,10 +710,11 @@ static void snd_pcm_softvol_dump(snd_pcm_t *pcm, snd_output_t *out)
e0581f
 static int add_tlv_info(snd_pcm_softvol_t *svol, snd_ctl_elem_info_t *cinfo)
e0581f
 {
e0581f
 	unsigned int tlv[4];
e0581f
-	tlv[0] = SND_CTL_TLVT_DB_SCALE;
e0581f
-	tlv[1] = 2 * sizeof(int);
e0581f
-	tlv[2] = (int)(svol->min_dB * 100);
e0581f
-	tlv[3] = (int)((svol->max_dB - svol->min_dB) * 100 / svol->max_val);
e0581f
+	tlv[SNDRV_CTL_TLVO_TYPE] = SND_CTL_TLVT_DB_SCALE;
e0581f
+	tlv[SNDRV_CTL_TLVO_LEN] = 2 * sizeof(int);
e0581f
+	tlv[SNDRV_CTL_TLVO_DB_SCALE_MIN] = (int)(svol->min_dB * 100);
e0581f
+	tlv[SNDRV_CTL_TLVO_DB_SCALE_MUTE_AND_STEP] =
e0581f
+		(int)((svol->max_dB - svol->min_dB) * 100 / svol->max_val);
e0581f
 	return snd_ctl_elem_tlv_write(svol->ctl, &cinfo->id, tlv);
e0581f
 }
e0581f
 
e0581f
-- 
e0581f
2.13.6
e0581f
e0581f
e0581f
From 275a438d425c3477be21e1929061f0c1605876f2 Mon Sep 17 00:00:00 2001
e0581f
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
e0581f
Date: Tue, 15 May 2018 21:36:39 +0900
e0581f
Subject: [PATCH 23/26] test: use position offset macro of TLV data
e0581f
e0581f
A series of SNDRV_CTL_TLVO_XXX macro was introduced for position offset
e0581f
of TLV data. This commit applies a code optimization.
e0581f
e0581f
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
e0581f
Signed-off-by: Takashi Iwai <tiwai@suse.de>
e0581f
---
e0581f
 test/user-ctl-element-set.c | 2 +-
e0581f
 1 file changed, 1 insertion(+), 1 deletion(-)
e0581f
e0581f
diff --git a/test/user-ctl-element-set.c b/test/user-ctl-element-set.c
e0581f
index e94152b9..fee130e2 100644
e0581f
--- a/test/user-ctl-element-set.c
e0581f
+++ b/test/user-ctl-element-set.c
e0581f
@@ -660,7 +660,7 @@ static int check_tlv(struct elem_set_trial *trial)
e0581f
 	if (err < 0)
e0581f
 		return err;
e0581f
 
e0581f
-	len = tlv[1] + sizeof(unsigned int) * 2;
e0581f
+	len = tlv[SNDRV_CTL_TLVO_LEN] + sizeof(unsigned int) * 2;
e0581f
 	curr = malloc(len);
e0581f
 	if (curr == NULL) {
e0581f
 		free(tlv);
e0581f
-- 
e0581f
2.13.6
e0581f
e0581f
e0581f
From 9ee3e4338f46f18a5cddc267bbb19c7a222c5801 Mon Sep 17 00:00:00 2001
e0581f
From: Takashi Iwai <tiwai@suse.de>
e0581f
Date: Tue, 22 May 2018 14:10:59 +0200
e0581f
Subject: [PATCH 24/26] conf: USB-audio: Fix for Xonar U7 SPDIF device
e0581f
e0581f
Add the entry for Xonar U7 to make SPDIF working on it.
e0581f
e0581f
Reported-by: Steve Banks <eassbank@gmail.com>
e0581f
Signed-off-by: Takashi Iwai <tiwai@suse.de>
e0581f
---
e0581f
 src/conf/cards/USB-Audio.conf | 1 +
e0581f
 1 file changed, 1 insertion(+)
e0581f
e0581f
diff --git a/src/conf/cards/USB-Audio.conf b/src/conf/cards/USB-Audio.conf
e0581f
index 2b8f9a29..05779c47 100644
e0581f
--- a/src/conf/cards/USB-Audio.conf
e0581f
+++ b/src/conf/cards/USB-Audio.conf
e0581f
@@ -38,6 +38,7 @@ USB-Audio.pcm.surround40_type {
e0581f
 USB-Audio.pcm.iec958_device {
e0581f
 	# "NoiseBlaster 3000" 42
e0581f
 	"USB Sound Blaster HD" 1
e0581f
+	"Xonar U7" 1
e0581f
 
e0581f
 	# The below don't have digital in/out, so prevent them from being opened.
e0581f
 	"Andrea PureAudio USB-SA Headset" 999
e0581f
-- 
e0581f
2.13.6
e0581f
e0581f
e0581f
From 4740dd97bf54d67f0edef80e1b9e86c04c8ed402 Mon Sep 17 00:00:00 2001
e0581f
From: Jaroslav Kysela <perex@perex.cz>
e0581f
Date: Wed, 23 May 2018 10:33:40 +0200
e0581f
Subject: [PATCH 25/26] pcm: add missing flags initialization for the fallback
e0581f
 control data
e0581f
e0581f
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
e0581f
---
e0581f
 src/pcm/pcm_hw.c | 2 +-
e0581f
 1 file changed, 1 insertion(+), 1 deletion(-)
e0581f
e0581f
diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c
e0581f
index a728b23b..59a24200 100644
e0581f
--- a/src/pcm/pcm_hw.c
e0581f
+++ b/src/pcm/pcm_hw.c
e0581f
@@ -1018,7 +1018,7 @@ static int map_status_and_control_data(snd_pcm_t *pcm, bool force_fallback)
e0581f
 	snd_pcm_set_appl_ptr(pcm, &hw->mmap_control->appl_ptr, hw->fd,
e0581f
 			     SNDRV_PCM_MMAP_OFFSET_CONTROL);
e0581f
 	if (hw->mmap_control_fallbacked) {
e0581f
-		unsigned int flags;
e0581f
+		unsigned int flags = 0;
e0581f
 		/* read appl_ptr and avail_min from kernel when device opened
e0581f
 		 * with SND_PCM_APPEND flag
e0581f
 		 */
e0581f
-- 
e0581f
2.13.6
e0581f
e0581f
e0581f
From ad5aea89226f131f27790c98c4638e4596060f81 Mon Sep 17 00:00:00 2001
e0581f
From: Jaroslav Kysela <perex@perex.cz>
e0581f
Date: Wed, 23 May 2018 10:36:17 +0200
e0581f
Subject: [PATCH 26/26] pcm ioplug: fix some coverity issues (switch, missing
e0581f
 unlock in snd_pcm_ioplug_drain())
e0581f
e0581f
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
e0581f
---
e0581f
 src/pcm/pcm_ioplug.c | 3 +++
e0581f
 1 file changed, 3 insertions(+)
e0581f
e0581f
diff --git a/src/pcm/pcm_ioplug.c b/src/pcm/pcm_ioplug.c
e0581f
index db64853b..4d44ae22 100644
e0581f
--- a/src/pcm/pcm_ioplug.c
e0581f
+++ b/src/pcm/pcm_ioplug.c
e0581f
@@ -533,6 +533,7 @@ static int snd_pcm_ioplug_drain(snd_pcm_t *pcm)
e0581f
 	case SND_PCM_STATE_OPEN:
e0581f
 	case SND_PCM_STATE_DISCONNECTED:
e0581f
 	case SND_PCM_STATE_SUSPENDED:
e0581f
+		snd_pcm_unlock(pcm);
e0581f
 		return -EBADFD;
e0581f
 	case SND_PCM_STATE_PREPARED:
e0581f
 		if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
e0581f
@@ -545,6 +546,8 @@ static int snd_pcm_ioplug_drain(snd_pcm_t *pcm)
e0581f
 	case SND_PCM_STATE_RUNNING:
e0581f
 		io->data->state = SND_PCM_STATE_DRAINING;
e0581f
 		break;
e0581f
+	default:
e0581f
+		break;
e0581f
 	}
e0581f
 
e0581f
 	if (io->data->state == SND_PCM_STATE_DRAINING) {
e0581f
-- 
e0581f
2.13.6
e0581f