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