914eb6
From 9c1439a76cea33d2cec65a42d499230d2f9a5205 Mon Sep 17 00:00:00 2001
914eb6
From: Takashi Iwai <tiwai@suse.de>
914eb6
Date: Wed, 9 Jan 2019 12:02:56 +0100
914eb6
Subject: [PATCH 1/7] pcm: Preserve period_event in snd_pcm_hw_sw_params() call
914eb6
914eb6
snd_pcm_hw_sw_params() in pcm_hw.c tries to abuse the reserved bits
914eb6
for passing period_Event flag.  In this hackish way, we clear the
914eb6
reserved bits at beginning, and restore before returning.  However,
914eb6
the code paths that return earlier don't restore the value, hence when
914eb6
user calls this function twice, it may pass an unexpected value.
914eb6
914eb6
This patch fixes the failure, restoring the value always before
914eb6
returning from the function.
914eb6
914eb6
Reported-by: Jamey Sharp <jamey@minilop.net>
914eb6
Signed-off-by: Takashi Iwai <tiwai@suse.de>
914eb6
---
914eb6
 src/pcm/pcm_hw.c | 22 +++++++++++++---------
914eb6
 1 file changed, 13 insertions(+), 9 deletions(-)
914eb6
914eb6
diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c
914eb6
index 59a24200..91370a88 100644
914eb6
--- a/src/pcm/pcm_hw.c
914eb6
+++ b/src/pcm/pcm_hw.c
914eb6
@@ -496,7 +496,7 @@ static int snd_pcm_hw_hw_free(snd_pcm_t *pcm)
914eb6
 static int snd_pcm_hw_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params)
914eb6
 {
914eb6
 	snd_pcm_hw_t *hw = pcm->private_data;
914eb6
-	int fd = hw->fd, err;
914eb6
+	int fd = hw->fd, err = 0;
914eb6
 	int old_period_event = sw_get_period_event(params);
914eb6
 	sw_set_period_event(params, 0);
914eb6
 	if ((snd_pcm_tstamp_t) params->tstamp_mode == pcm->tstamp_mode &&
914eb6
@@ -508,22 +508,25 @@ static int snd_pcm_hw_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params)
914eb6
 	    params->silence_size == pcm->silence_size &&
914eb6
 	    old_period_event == hw->period_event) {
914eb6
 		hw->mmap_control->avail_min = params->avail_min;
914eb6
-		return issue_avail_min(hw);
914eb6
+		err = issue_avail_min(hw);
914eb6
+		goto out;
914eb6
 	}
914eb6
 	if (params->tstamp_type == SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW &&
914eb6
 	    hw->version < SNDRV_PROTOCOL_VERSION(2, 0, 12)) {
914eb6
 		SYSMSG("Kernel doesn't support SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW");
914eb6
-		return -EINVAL;
914eb6
+		err = -EINVAL;
914eb6
+		goto out;
914eb6
 	}
914eb6
 	if (params->tstamp_type == SND_PCM_TSTAMP_TYPE_MONOTONIC &&
914eb6
 	    hw->version < SNDRV_PROTOCOL_VERSION(2, 0, 5)) {
914eb6
 		SYSMSG("Kernel doesn't support SND_PCM_TSTAMP_TYPE_MONOTONIC");
914eb6
-		return -EINVAL;
914eb6
+		err = -EINVAL;
914eb6
+		goto out;
914eb6
 	}
914eb6
 	if (ioctl(fd, SNDRV_PCM_IOCTL_SW_PARAMS, params) < 0) {
914eb6
 		err = -errno;
914eb6
 		SYSMSG("SNDRV_PCM_IOCTL_SW_PARAMS failed (%i)", err);
914eb6
-		return err;
914eb6
+		goto out;
914eb6
 	}
914eb6
 	if ((snd_pcm_tstamp_type_t) params->tstamp_type != pcm->tstamp_type) {
914eb6
 		if (hw->version < SNDRV_PROTOCOL_VERSION(2, 0, 12)) {
914eb6
@@ -532,20 +535,21 @@ static int snd_pcm_hw_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params)
914eb6
 			if (ioctl(fd, SNDRV_PCM_IOCTL_TSTAMP, &on) < 0) {
914eb6
 				err = -errno;
914eb6
 				SNDMSG("TSTAMP failed\n");
914eb6
-				return err;
914eb6
+				goto out;
914eb6
 			}
914eb6
 		}
914eb6
 		pcm->tstamp_type = params->tstamp_type;
914eb6
 	}
914eb6
-	sw_set_period_event(params, old_period_event);
914eb6
 	hw->mmap_control->avail_min = params->avail_min;
914eb6
 	if (hw->period_event != old_period_event) {
914eb6
 		err = snd_pcm_hw_change_timer(pcm, old_period_event);
914eb6
 		if (err < 0)
914eb6
-			return err;
914eb6
+			goto out;
914eb6
 		hw->period_event = old_period_event;
914eb6
 	}
914eb6
-	return 0;
914eb6
+ out:
914eb6
+	sw_set_period_event(params, old_period_event);
914eb6
+	return err;
914eb6
 }
914eb6
 
914eb6
 static int snd_pcm_hw_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t * info)
914eb6
-- 
914eb6
2.20.1
914eb6
914eb6
914eb6
From d8013619c942dd996c32337a9ade429bfaf455ee Mon Sep 17 00:00:00 2001
914eb6
From: Hui Wang <hui.wang@canonical.com>
914eb6
Date: Tue, 27 Nov 2018 09:36:28 +0800
914eb6
Subject: [PATCH 2/7] conf/ucm: Add a UCM profile for Dell WD19 Dock USB-audio
914eb6
914eb6
USB-audio device on Dell WD19 docking station provides two individual
914eb6
output PCM streams, one for headphone Jack and another for speaker out
914eb6
Jack. A UCM profile gives the proper roles for these.
914eb6
914eb6
Signed-off-by: Hui Wang <hui.wang@canonical.com>
914eb6
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
914eb6
---
914eb6
 .../ucm/Dell-WD19-Dock/Dell-WD19-Dock.conf    |  5 ++++
914eb6
 src/conf/ucm/Dell-WD19-Dock/HiFi.conf         | 26 +++++++++++++++++++
914eb6
 src/conf/ucm/Dell-WD19-Dock/Makefile.am       |  4 +++
914eb6
 3 files changed, 35 insertions(+)
914eb6
 create mode 100644 src/conf/ucm/Dell-WD19-Dock/Dell-WD19-Dock.conf
914eb6
 create mode 100644 src/conf/ucm/Dell-WD19-Dock/HiFi.conf
914eb6
 create mode 100644 src/conf/ucm/Dell-WD19-Dock/Makefile.am
914eb6
914eb6
diff --git a/src/conf/ucm/Dell-WD19-Dock/Dell-WD19-Dock.conf b/src/conf/ucm/Dell-WD19-Dock/Dell-WD19-Dock.conf
914eb6
new file mode 100644
914eb6
index 00000000..465ff550
914eb6
--- /dev/null
914eb6
+++ b/src/conf/ucm/Dell-WD19-Dock/Dell-WD19-Dock.conf
914eb6
@@ -0,0 +1,5 @@
914eb6
+Comment "USB-audio on Dell WD19 docking station"
914eb6
+SectionUseCase."HiFi" {
914eb6
+	File "HiFi.conf"
914eb6
+	Comment "Default"
914eb6
+}
914eb6
diff --git a/src/conf/ucm/Dell-WD19-Dock/HiFi.conf b/src/conf/ucm/Dell-WD19-Dock/HiFi.conf
914eb6
new file mode 100644
914eb6
index 00000000..e1427a79
914eb6
--- /dev/null
914eb6
+++ b/src/conf/ucm/Dell-WD19-Dock/HiFi.conf
914eb6
@@ -0,0 +1,26 @@
914eb6
+SectionDevice."Headphone" {
914eb6
+	Comment "Headphone"
914eb6
+
914eb6
+	Value {
914eb6
+		PlaybackChannels "2"
914eb6
+		PlaybackPCM "hw:Dock,0"
914eb6
+	}
914eb6
+}
914eb6
+
914eb6
+SectionDevice."Speaker" {
914eb6
+	Comment "Speaker"
914eb6
+
914eb6
+	Value {
914eb6
+		PlaybackChannels "2"
914eb6
+		PlaybackPCM "hw:Dock,1"
914eb6
+	}
914eb6
+}
914eb6
+
914eb6
+SectionDevice."Mic" {
914eb6
+	Comment "Microphone"
914eb6
+
914eb6
+	Value {
914eb6
+		CaptureChannels "2"
914eb6
+		CapturePCM "hw:Dock,0"
914eb6
+	}
914eb6
+}
914eb6
diff --git a/src/conf/ucm/Dell-WD19-Dock/Makefile.am b/src/conf/ucm/Dell-WD19-Dock/Makefile.am
914eb6
new file mode 100644
914eb6
index 00000000..6549ae1b
914eb6
--- /dev/null
914eb6
+++ b/src/conf/ucm/Dell-WD19-Dock/Makefile.am
914eb6
@@ -0,0 +1,4 @@
914eb6
+alsaconfigdir = @ALSA_CONFIG_DIR@
914eb6
+ucmdir = $(alsaconfigdir)/ucm/Dell-WD19-Dock
914eb6
+ucm_DATA = Dell-WD19-Dock.conf HiFi.conf
914eb6
+EXTRA_DIST = $(ucm_DATA)
914eb6
-- 
914eb6
2.20.1
914eb6
914eb6
914eb6
From 0862458c1339eec025330b39d5199481c335673c Mon Sep 17 00:00:00 2001
914eb6
From: Jaroslav Kysela <perex@perex.cz>
914eb6
Date: Fri, 25 Jan 2019 12:09:31 +0100
914eb6
Subject: [PATCH 3/7] Revert "conf/ucm: Add a UCM profile for Dell WD19 Dock
914eb6
 USB-audio"
914eb6
914eb6
This reverts commit d8013619c942dd996c32337a9ade429bfaf455ee.
914eb6
914eb6
The USB driver defines identical profile as for WD15.
914eb6
914eb6
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
914eb6
---
914eb6
 .../ucm/Dell-WD19-Dock/Dell-WD19-Dock.conf    |  5 ----
914eb6
 src/conf/ucm/Dell-WD19-Dock/HiFi.conf         | 26 -------------------
914eb6
 src/conf/ucm/Dell-WD19-Dock/Makefile.am       |  4 ---
914eb6
 3 files changed, 35 deletions(-)
914eb6
 delete mode 100644 src/conf/ucm/Dell-WD19-Dock/Dell-WD19-Dock.conf
914eb6
 delete mode 100644 src/conf/ucm/Dell-WD19-Dock/HiFi.conf
914eb6
 delete mode 100644 src/conf/ucm/Dell-WD19-Dock/Makefile.am
914eb6
914eb6
diff --git a/src/conf/ucm/Dell-WD19-Dock/Dell-WD19-Dock.conf b/src/conf/ucm/Dell-WD19-Dock/Dell-WD19-Dock.conf
914eb6
deleted file mode 100644
914eb6
index 465ff550..00000000
914eb6
--- a/src/conf/ucm/Dell-WD19-Dock/Dell-WD19-Dock.conf
914eb6
+++ /dev/null
914eb6
@@ -1,5 +0,0 @@
914eb6
-Comment "USB-audio on Dell WD19 docking station"
914eb6
-SectionUseCase."HiFi" {
914eb6
-	File "HiFi.conf"
914eb6
-	Comment "Default"
914eb6
-}
914eb6
diff --git a/src/conf/ucm/Dell-WD19-Dock/HiFi.conf b/src/conf/ucm/Dell-WD19-Dock/HiFi.conf
914eb6
deleted file mode 100644
914eb6
index e1427a79..00000000
914eb6
--- a/src/conf/ucm/Dell-WD19-Dock/HiFi.conf
914eb6
+++ /dev/null
914eb6
@@ -1,26 +0,0 @@
914eb6
-SectionDevice."Headphone" {
914eb6
-	Comment "Headphone"
914eb6
-
914eb6
-	Value {
914eb6
-		PlaybackChannels "2"
914eb6
-		PlaybackPCM "hw:Dock,0"
914eb6
-	}
914eb6
-}
914eb6
-
914eb6
-SectionDevice."Speaker" {
914eb6
-	Comment "Speaker"
914eb6
-
914eb6
-	Value {
914eb6
-		PlaybackChannels "2"
914eb6
-		PlaybackPCM "hw:Dock,1"
914eb6
-	}
914eb6
-}
914eb6
-
914eb6
-SectionDevice."Mic" {
914eb6
-	Comment "Microphone"
914eb6
-
914eb6
-	Value {
914eb6
-		CaptureChannels "2"
914eb6
-		CapturePCM "hw:Dock,0"
914eb6
-	}
914eb6
-}
914eb6
diff --git a/src/conf/ucm/Dell-WD19-Dock/Makefile.am b/src/conf/ucm/Dell-WD19-Dock/Makefile.am
914eb6
deleted file mode 100644
914eb6
index 6549ae1b..00000000
914eb6
--- a/src/conf/ucm/Dell-WD19-Dock/Makefile.am
914eb6
+++ /dev/null
914eb6
@@ -1,4 +0,0 @@
914eb6
-alsaconfigdir = @ALSA_CONFIG_DIR@
914eb6
-ucmdir = $(alsaconfigdir)/ucm/Dell-WD19-Dock
914eb6
-ucm_DATA = Dell-WD19-Dock.conf HiFi.conf
914eb6
-EXTRA_DIST = $(ucm_DATA)
914eb6
-- 
914eb6
2.20.1
914eb6
914eb6
914eb6
From 7442c8b9be91ef576871eed5efce9499fcdeab4a Mon Sep 17 00:00:00 2001
914eb6
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
914eb6
Date: Tue, 29 Jan 2019 10:48:28 +0000
914eb6
Subject: [PATCH 4/7] ucm: Add ucm files for DB820c board
914eb6
914eb6
DB820c board is based of MSM8996 Qualcomm SoC, which has support for both
914eb6
Digital and Analog audio. Digital audio is over HDMI and analog is over
914eb6
WCD9335 codec via SLIMbus.
914eb6
914eb6
Board itself has HDMI port, a 3.5mm audio Jack and an Audio expansion
914eb6
connector.
914eb6
This patch adds support for HDMI port and 3.5mm jack.
914eb6
914eb6
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
914eb6
Signed-off-by: Takashi Iwai <tiwai@suse.de>
914eb6
---
914eb6
 configure.ac                    |   1 +
914eb6
 src/conf/ucm/DB820c/DB820c.conf |   9 +++
914eb6
 src/conf/ucm/DB820c/HDMI        |  37 +++++++++++
914eb6
 src/conf/ucm/DB820c/HiFi        | 110 ++++++++++++++++++++++++++++++++
914eb6
 src/conf/ucm/DB820c/Makefile.am |   4 ++
914eb6
 src/conf/ucm/Makefile.am        |   1 +
914eb6
 6 files changed, 162 insertions(+)
914eb6
 create mode 100644 src/conf/ucm/DB820c/DB820c.conf
914eb6
 create mode 100644 src/conf/ucm/DB820c/HDMI
914eb6
 create mode 100644 src/conf/ucm/DB820c/HiFi
914eb6
 create mode 100644 src/conf/ucm/DB820c/Makefile.am
914eb6
914eb6
diff --git a/configure.ac b/configure.ac
914eb6
index a0c346ef..e9e1a369 100644
914eb6
--- a/configure.ac
914eb6
+++ b/configure.ac
914eb6
@@ -747,6 +747,7 @@ AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \
914eb6
 	  src/conf/ucm/cube-i1_TF-Defaultstring-CherryTrailCR/Makefile \
914eb6
 	  src/conf/ucm/DAISY-I2S/Makefile \
914eb6
 	  src/conf/ucm/DB410c/Makefile \
914eb6
+	  src/conf/ucm/DB820c/Makefile \
914eb6
 	  src/conf/ucm/Dell-WD15-Dock/Makefile \
914eb6
 	  src/conf/ucm/GoogleNyan/Makefile \
914eb6
 	  src/conf/ucm/gpd-win-pocket-rt5645/Makefile \
914eb6
diff --git a/src/conf/ucm/DB820c/DB820c.conf b/src/conf/ucm/DB820c/DB820c.conf
914eb6
new file mode 100644
914eb6
index 00000000..58b7ff4e
914eb6
--- /dev/null
914eb6
+++ b/src/conf/ucm/DB820c/DB820c.conf
914eb6
@@ -0,0 +1,9 @@
914eb6
+SectionUseCase."HiFi" {
914eb6
+	File "HiFi"
914eb6
+	Comment "HiFi quality Music."
914eb6
+}
914eb6
+
914eb6
+SectionUseCase."HDMI" {
914eb6
+	File "HDMI"
914eb6
+	Comment "HDMI output."
914eb6
+}
914eb6
diff --git a/src/conf/ucm/DB820c/HDMI b/src/conf/ucm/DB820c/HDMI
914eb6
new file mode 100644
914eb6
index 00000000..39b28692
914eb6
--- /dev/null
914eb6
+++ b/src/conf/ucm/DB820c/HDMI
914eb6
@@ -0,0 +1,37 @@
914eb6
+# Use case configuration for DB820c board.
914eb6
+# Author: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
914eb6
+
914eb6
+SectionVerb {
914eb6
+        EnableSequence [
914eb6
+			cdev "hw:0"
914eb6
+			cset "name='HDMI Mixer MultiMedia1' 1"
914eb6
+        ]
914eb6
+
914eb6
+        DisableSequence [
914eb6
+			cdev "hw:0"
914eb6
+			cset "name='HDMI Mixer MultiMedia1' 0"
914eb6
+		]
914eb6
+        Value {
914eb6
+                TQ "HiFi"
914eb6
+                PlaybackPCM "plughw:0,0"
914eb6
+        }
914eb6
+}
914eb6
+
914eb6
+SectionDevice."HDMI-stereo" {
914eb6
+        #Name "HDMI-stereo"
914eb6
+        Comment "HDMI Digital Stereo Output"
914eb6
+
914eb6
+        EnableSequence [
914eb6
+			cdev "hw:0"
914eb6
+			cset "name='HDMI Mixer MultiMedia1' 1"
914eb6
+        ]
914eb6
+
914eb6
+        DisableSequence [
914eb6
+			cdev "hw:0"
914eb6
+			cset "name='HDMI Mixer MultiMedia1' 0"
914eb6
+        ]
914eb6
+
914eb6
+        Value {
914eb6
+                PlaybackChannels "2"
914eb6
+        }
914eb6
+}
914eb6
diff --git a/src/conf/ucm/DB820c/HiFi b/src/conf/ucm/DB820c/HiFi
914eb6
new file mode 100644
914eb6
index 00000000..4457329f
914eb6
--- /dev/null
914eb6
+++ b/src/conf/ucm/DB820c/HiFi
914eb6
@@ -0,0 +1,110 @@
914eb6
+# Use case configuration for DB820c board.
914eb6
+# Author: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
914eb6
+
914eb6
+SectionVerb {
914eb6
+
914eb6
+	EnableSequence [
914eb6
+		cdev "hw:0"
914eb6
+		cset "name='SLIM RX0 MUX' ZERO"
914eb6
+		cset "name='SLIM RX1 MUX' ZERO"
914eb6
+		cset "name='SLIM RX2 MUX' ZERO"
914eb6
+		cset "name='SLIM RX3 MUX' ZERO"
914eb6
+		cset "name='SLIM RX4 MUX' ZERO"
914eb6
+		cset "name='SLIM RX5 MUX' AIF4_PB"
914eb6
+		cset "name='SLIM RX6 MUX' AIF4_PB"
914eb6
+		cset "name='SLIM RX7 MUX' ZERO"
914eb6
+		cset "name='RX INT1_2 MUX' RX5"
914eb6
+		cset "name='RX INT2_2 MUX' RX6"
914eb6
+		## gain to  0dB
914eb6
+		cset "name='RX5 Digital Volume' 68"
914eb6
+		## gain to  0dB
914eb6
+		cset "name='RX6 Digital Volume' 68"
914eb6
+		cset "name='SLIMBUS_6_RX Audio Mixer MultiMedia2' 1"
914eb6
+		cset "name='MultiMedia3 Mixer SLIMBUS_0_TX' 1"
914eb6
+		cset "name='RX INT1 DEM MUX' CLSH_DSM_OUT"
914eb6
+		cset "name='RX INT2 DEM MUX' CLSH_DSM_OUT"
914eb6
+		cset "name='AIF1_CAP Mixer SLIM TX0' 1"
914eb6
+		cset "name='SLIM TX0 MUX' DEC0"
914eb6
+		cset "name='ADC2 Volume' 12"
914eb6
+		cset "name='ADC MUX0' AMIC"
914eb6
+		cset "name='AMIC MUX0' ADC2"
914eb6
+	]
914eb6
+
914eb6
+	DisableSequence [
914eb6
+                cdev "hw:0"
914eb6
+		cset "name='SLIMBUS_6_RX Audio Mixer MultiMedia2' 0"
914eb6
+		cset "name='MultiMedia3 Mixer SLIMBUS_0_TX' 0"
914eb6
+	]
914eb6
+
914eb6
+	# ALSA PCM
914eb6
+	Value {
914eb6
+		# ALSA PCM device for HiFi
914eb6
+		PlaybackPCM "plughw:0,1"
914eb6
+		CapturePCM "plughw:0,2"
914eb6
+	}
914eb6
+}
914eb6
+
914eb6
+SectionDevice."Headphones" {
914eb6
+	Comment "Headphones playback"
914eb6
+
914eb6
+	EnableSequence [
914eb6
+		cdev "hw:0"
914eb6
+		cset "name='SLIM RX0 MUX' ZERO"
914eb6
+		cset "name='SLIM RX1 MUX' ZERO"
914eb6
+		cset "name='SLIM RX2 MUX' ZERO"
914eb6
+		cset "name='SLIM RX3 MUX' ZERO"
914eb6
+		cset "name='SLIM RX4 MUX' ZERO"
914eb6
+		cset "name='SLIM RX5 MUX' AIF4_PB"
914eb6
+		cset "name='SLIM RX6 MUX' AIF4_PB"
914eb6
+		cset "name='SLIM RX7 MUX' ZERO"
914eb6
+		cset "name='RX INT1_2 MUX' RX5"
914eb6
+		cset "name='RX INT2_2 MUX' RX6"
914eb6
+		## gain to  0dB
914eb6
+		cset "name='RX5 Digital Volume' 68"
914eb6
+		## gain to  0dB
914eb6
+		cset "name='RX6 Digital Volume' 68"
914eb6
+		cset "name='SLIMBUS_6_RX Audio Mixer MultiMedia2' 1"
914eb6
+		cset "name='RX INT1 DEM MUX' CLSH_DSM_OUT"
914eb6
+		cset "name='RX INT2 DEM MUX' CLSH_DSM_OUT"
914eb6
+	]
914eb6
+
914eb6
+	DisableSequence [
914eb6
+		cdev "hw:0"
914eb6
+		cset "name='RX5 Digital Volume' 0"
914eb6
+		cset "name='RX6 Digital Volume' 0"
914eb6
+		cset "name='SLIM RX5 MUX' ZERO"
914eb6
+		cset "name='SLIM RX6 MUX' ZERO"
914eb6
+		cset "name='SLIMBUS_6_RX Audio Mixer MultiMedia2' 0"
914eb6
+	]
914eb6
+
914eb6
+	Value {
914eb6
+		PlaybackChannels "2"
914eb6
+	}
914eb6
+}
914eb6
+
914eb6
+SectionDevice."Handset" {
914eb6
+	Comment "Headset Microphone"
914eb6
+
914eb6
+	EnableSequence [
914eb6
+		cdev "hw:0"
914eb6
+		cset "name='MultiMedia3 Mixer SLIMBUS_0_TX' 1"
914eb6
+		cset "name='AIF1_CAP Mixer SLIM TX0' 1"
914eb6
+		cset "name='SLIM TX0 MUX' DEC0"
914eb6
+		cset "name='ADC2 Volume' 12"
914eb6
+		cset "name='ADC MUX0' AMIC"
914eb6
+		cset "name='AMIC MUX0' ADC2"
914eb6
+	]
914eb6
+
914eb6
+	DisableSequence [
914eb6
+		cdev "hw:0"
914eb6
+		cset "name='MultiMedia3 Mixer SLIMBUS_0_TX' 0"
914eb6
+		cset "name='AIF1_CAP Mixer SLIM TX0' 0"
914eb6
+		cset "name='AMIC MUX0' ZERO"
914eb6
+		cset "name='SLIM TX0 MUX' ZERO"
914eb6
+		cset "name='ADC2 Volume' 0"
914eb6
+	]
914eb6
+
914eb6
+	Value {
914eb6
+		CaptureChannels "1"
914eb6
+	}
914eb6
+}
914eb6
diff --git a/src/conf/ucm/DB820c/Makefile.am b/src/conf/ucm/DB820c/Makefile.am
914eb6
new file mode 100644
914eb6
index 00000000..16e985e5
914eb6
--- /dev/null
914eb6
+++ b/src/conf/ucm/DB820c/Makefile.am
914eb6
@@ -0,0 +1,4 @@
914eb6
+alsaconfigdir = @ALSA_CONFIG_DIR@
914eb6
+ucmdir = $(alsaconfigdir)/ucm/DB820c
914eb6
+ucm_DATA = DB820c.conf HDMI HiFi
914eb6
+EXTRA_DIST = $(ucm_DATA)
914eb6
diff --git a/src/conf/ucm/Makefile.am b/src/conf/ucm/Makefile.am
914eb6
index ee850ee6..e9f88ed6 100644
914eb6
--- a/src/conf/ucm/Makefile.am
914eb6
+++ b/src/conf/ucm/Makefile.am
914eb6
@@ -31,6 +31,7 @@ chtrt5650 \
914eb6
 cube-i1_TF-Defaultstring-CherryTrailCR \
914eb6
 DAISY-I2S \
914eb6
 DB410c \
914eb6
+DB820c \
914eb6
 Dell-WD15-Dock \
914eb6
 GoogleNyan \
914eb6
 gpd-win-pocket-rt5645 \
914eb6
-- 
914eb6
2.20.1
914eb6
914eb6
914eb6
From 4d9374e61d23a5fc219ec172fe9613017f9ae79c Mon Sep 17 00:00:00 2001
914eb6
From: Hans de Goede <hdegoede@redhat.com>
914eb6
Date: Sun, 3 Feb 2019 12:37:41 +0100
914eb6
Subject: [PATCH 5/7] ucm: bytcr/PlatformEnableSeq.conf update some comments
914eb6
914eb6
Commit f91cc3c7d6b7 ("Update chtrt5645 ucm variants to use
914eb6
bytcr/PlatformEnableSeq.conf component") updated the
914eb6
following 2 comments:
914eb6
914eb6
 # codec0_out settings (used if SSP2 is connected to aif1)
914eb6
 # modem_out settings (used if SSP0 is connected to aif2)
914eb6
914eb6
Specifically it added the " to aif1" resp. " to aif2" part of the comments.
914eb6
914eb6
This is not correct, AIF1 / AIF2 are something which is present on
914eb6
Realtek codecs only, and either one can be used indepedent of
914eb6
SSP0 or SSP2 being used (the comments in the chtrt5645 UCM profile
914eb6
before this change were wrong / outdated).
914eb6
914eb6
Besides there not being any relationship between SSP0 or SSP2 being
914eb6
used, bytcr/PlatformEnableSeq.conf is also used with other codecs,
914eb6
e.g. the ESS8316 codec where this is not applicable at all.
914eb6
914eb6
Therefor this commit removes the " to aif?" part of the comments again
914eb6
to avoid confusing people reading this in the future.
914eb6
914eb6
Cc: Russell Parker <russell.parker7@gmail.com>
914eb6
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
914eb6
Signed-off-by: Takashi Iwai <tiwai@suse.de>
914eb6
---
914eb6
 src/conf/ucm/platforms/bytcr/PlatformEnableSeq.conf | 4 ++--
914eb6
 1 file changed, 2 insertions(+), 2 deletions(-)
914eb6
914eb6
diff --git a/src/conf/ucm/platforms/bytcr/PlatformEnableSeq.conf b/src/conf/ucm/platforms/bytcr/PlatformEnableSeq.conf
914eb6
index 6f5e899c..b5ee2b41 100644
914eb6
--- a/src/conf/ucm/platforms/bytcr/PlatformEnableSeq.conf
914eb6
+++ b/src/conf/ucm/platforms/bytcr/PlatformEnableSeq.conf
914eb6
@@ -29,7 +29,7 @@ cset "name='pcm0_in Gain 0 Volume' 0"
914eb6
 cset "name='pcm1_in Gain 0 Switch' off"
914eb6
 cset "name='pcm1_in Gain 0 Volume' 0%"
914eb6
 
914eb6
-# codec0_out settings (used if SSP2 is connected to aif1)
914eb6
+# codec0_out settings (used if SSP2 is connected)
914eb6
 cset "name='codec_out0 mix 0 codec_in0 Switch' off"
914eb6
 cset "name='codec_out0 mix 0 codec_in1 Switch' off"
914eb6
 cset "name='codec_out0 mix 0 media_loop1_in Switch' off"
914eb6
@@ -40,7 +40,7 @@ cset "name='codec_out0 mix 0 sprot_loop_in Switch' off"
914eb6
 cset "name='codec_out0 Gain 0 Switch' on"
914eb6
 cset "name='codec_out0 Gain 0 Volume' 0"
914eb6
 
914eb6
-# modem_out settings (used if SSP0 is connected to aif2)
914eb6
+# modem_out settings (used if SSP0 is connected)
914eb6
 cset "name='modem_out mix 0 codec_in0 Switch' off"
914eb6
 cset "name='modem_out mix 0 codec_in1 Switch' off"
914eb6
 cset "name='modem_out mix 0 media_loop1_in Switch' off"
914eb6
-- 
914eb6
2.20.1
914eb6
914eb6
914eb6
From 7cea8c156204ebae7c0dc60801dde5ddfa5bb7d0 Mon Sep 17 00:00:00 2001
914eb6
From: Brendan Shanks <brendan.shanks@teradek.com>
914eb6
Date: Mon, 11 Feb 2019 11:51:26 -0800
914eb6
Subject: [PATCH 6/7] pcm: dshare: Fix overflow when slave_hw_ptr rolls over
914eb6
 boundary
914eb6
MIME-Version: 1.0
914eb6
Content-Type: text/plain; charset=UTF-8
914eb6
Content-Transfer-Encoding: 8bit
914eb6
914eb6
In snd_pcm_dshare_sync_area() when 'slave_hw_ptr' rolls over
914eb6
'slave_boundary', the wrong variable is checked ('dshare->slave_hw_ptr' vs
914eb6
the local 'slave_hw_ptr'). In some cases, this results in 'slave_hw_ptr'
914eb6
not rolling over correctly. 'slave_size' and 'size' are then much too
914eb6
large, and the for loop blocks for several minutes copying samples.
914eb6
914eb6
This was likely only triggered on 32-bit systems, since the PCM boundary
914eb6
is computed based on LONG_MAX and is much larger on 64-bit systems.
914eb6
914eb6
This same change was made to pcm_dmix in commit
914eb6
6c7f60f7a982fdba828e4530a9d7aa0aa2b704ae ("Fix boundary overlap”) from
914eb6
June 2005.
914eb6
914eb6
Signed-off-by: Brendan Shanks <brendan.shanks@teradek.com>
914eb6
Signed-off-by: Takashi Iwai <tiwai@suse.de>
914eb6
---
914eb6
 src/pcm/pcm_dshare.c | 2 +-
914eb6
 1 file changed, 1 insertion(+), 1 deletion(-)
914eb6
914eb6
diff --git a/src/pcm/pcm_dshare.c b/src/pcm/pcm_dshare.c
914eb6
index 2bb735fe..f135b5df 100644
914eb6
--- a/src/pcm/pcm_dshare.c
914eb6
+++ b/src/pcm/pcm_dshare.c
914eb6
@@ -121,7 +121,7 @@ static void snd_pcm_dshare_sync_area(snd_pcm_t *pcm)
914eb6
 	 */
914eb6
 	slave_hw_ptr -= slave_hw_ptr % dshare->slave_period_size;
914eb6
 	slave_hw_ptr += dshare->slave_buffer_size;
914eb6
-	if (dshare->slave_hw_ptr > dshare->slave_boundary)
914eb6
+	if (slave_hw_ptr >= dshare->slave_boundary)
914eb6
 		slave_hw_ptr -= dshare->slave_boundary;
914eb6
 	if (slave_hw_ptr < dshare->slave_appl_ptr)
914eb6
 		slave_size = slave_hw_ptr + (dshare->slave_boundary - dshare->slave_appl_ptr);
914eb6
-- 
914eb6
2.20.1
914eb6
914eb6
914eb6
From deb07a0b208225393efc6347556310f3d8adb54d Mon Sep 17 00:00:00 2001
914eb6
From: Jaroslav Kysela <perex@perex.cz>
914eb6
Date: Fri, 1 Mar 2019 12:43:19 +0100
914eb6
Subject: [PATCH 7/7] test/latency: use frame bytes correctly in writebuf()
914eb6
914eb6
Reported-by: Alessandro Lapini <alessandro.lapini@gmail.com>
914eb6
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
914eb6
---
914eb6
 test/latency.c | 3 ++-
914eb6
 1 file changed, 2 insertions(+), 1 deletion(-)
914eb6
914eb6
diff --git a/test/latency.c b/test/latency.c
914eb6
index e926856b..ddd5a7af 100644
914eb6
--- a/test/latency.c
914eb6
+++ b/test/latency.c
914eb6
@@ -374,6 +374,7 @@ long readbuf(snd_pcm_t *handle, char *buf, long len, size_t *frames, size_t *max
914eb6
 long writebuf(snd_pcm_t *handle, char *buf, long len, size_t *frames)
914eb6
 {
914eb6
 	long r;
914eb6
+	int frame_bytes = (snd_pcm_format_width(format) / 8) * channels;
914eb6
 
914eb6
 	while (len > 0) {
914eb6
 		r = snd_pcm_writei(handle, buf, len);
914eb6
@@ -383,7 +384,7 @@ long writebuf(snd_pcm_t *handle, char *buf, long len, size_t *frames)
914eb6
 		if (r < 0)
914eb6
 			return r;
914eb6
 		// showstat(handle, 0);
914eb6
-		buf += r * 4;
914eb6
+		buf += r * frame_bytes;
914eb6
 		len -= r;
914eb6
 		*frames += r;
914eb6
 	}
914eb6
-- 
914eb6
2.20.1
914eb6