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