From cd68dfb05deb32f155da38598ba252196b176257 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 14 Nov 2017 09:19:52 +0100 Subject: [PATCH 001/120] updated to 1.1.5 --- alsa-lib.spec | 7 +++++-- sources | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 8c8a152..f054560 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -4,8 +4,8 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib -Version: 1.1.4.1 -Release: 3%{?prever_dot}%{?dist} +Version: 1.1.5 +Release: 1%{?prever_dot}%{?dist} License: LGPLv2+ Group: System Environment/Libraries URL: http://www.alsa-project.org/ @@ -119,6 +119,9 @@ find %{buildroot} -name '*.la' -delete %{_datadir}/alsa/ucm %changelog +* Tue Nov 14 2017 Jaroslav Kysela - 1.1.5-1 +- Updated to 1.1.5 + * Wed Aug 02 2017 Fedora Release Engineering - 1.1.4.1-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild diff --git a/sources b/sources index 80d6d02..b65b4de 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -MD5 (alsa-lib-1.1.4.1.tar.bz2) = 29fa3e69122d3cf3e8f0e01a0cb1d183 +SHA512 (alsa-lib-1.1.5.tar.bz2) = c79ceaa1ebfeda2caf41a0495ea31dd2748a11795989aebc341ae13a5c96d21495e4542571d5590e68b2575ceddd6e84059a950ddb78e6c0b9d94861faee4f58 From fa583d9f417f7b52291bf2fd627a1d833bb6d42a Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 7 Feb 2018 02:09:13 +0000 Subject: [PATCH 002/120] - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- alsa-lib.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index f054560..35ba870 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -5,7 +5,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: 1.1.5 -Release: 1%{?prever_dot}%{?dist} +Release: 2%{?prever_dot}%{?dist} License: LGPLv2+ Group: System Environment/Libraries URL: http://www.alsa-project.org/ @@ -119,6 +119,9 @@ find %{buildroot} -name '*.la' -delete %{_datadir}/alsa/ucm %changelog +* Wed Feb 07 2018 Fedora Release Engineering - 1.1.5-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + * Tue Nov 14 2017 Jaroslav Kysela - 1.1.5-1 - Updated to 1.1.5 From e8c265aa38ccb16970e7e6fdb15d6349426eca55 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 3 Apr 2018 09:38:08 +0200 Subject: [PATCH 003/120] updated to 1.1.6 --- alsa-lib.spec | 9 ++++++--- sources | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 35ba870..5ea7b42 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -4,8 +4,8 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib -Version: 1.1.5 -Release: 2%{?prever_dot}%{?dist} +Version: 1.1.6 +Release: 1%{?prever_dot}%{?dist} License: LGPLv2+ Group: System Environment/Libraries URL: http://www.alsa-project.org/ @@ -102,7 +102,7 @@ find %{buildroot} -name '*.la' -delete %config %{_sysconfdir}/asound.conf /%{_lib}/libasound.so.* %{_bindir}/aserver -#%{_libdir}/alsa-lib/ +#{_libdir}/alsa-lib/ %{_datadir}/alsa/ %exclude %{_datadir}/alsa/ucm /lib/modprobe.d/dist-* @@ -119,6 +119,9 @@ find %{buildroot} -name '*.la' -delete %{_datadir}/alsa/ucm %changelog +* Tue Apr 03 2018 Jaroslav Kysela - 1.1.6-1 +- Updated to 1.1.6 + * Wed Feb 07 2018 Fedora Release Engineering - 1.1.5-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild diff --git a/sources b/sources index b65b4de..fd984bd 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ SHA512 (alsa-lib-1.1.5.tar.bz2) = c79ceaa1ebfeda2caf41a0495ea31dd2748a11795989aebc341ae13a5c96d21495e4542571d5590e68b2575ceddd6e84059a950ddb78e6c0b9d94861faee4f58 +SHA512 (alsa-lib-1.1.6.tar.bz2) = 00117769a3d5c609019b975188d6e7a07d035bd0461f54c5f291e14667620506f1adb6d61350f78d54648850f31965aae3ab0e697bf9e09c988e2d15bf6b09f0 From 3d7c9fbc9a0984012dedc51701e3f108dd22e496 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 4 Apr 2018 10:21:40 +0200 Subject: [PATCH 004/120] changed add-on directory to /etc/alsa/conf.d --- alsa-lib.spec | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 5ea7b42..5bfb86f 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -5,7 +5,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: 1.1.6 -Release: 1%{?prever_dot}%{?dist} +Release: 2%{?prever_dot}%{?dist} License: LGPLv2+ Group: System Environment/Libraries URL: http://www.alsa-project.org/ @@ -16,6 +16,7 @@ Source11: modprobe-dist-alsa.conf Source12: modprobe-dist-oss.conf Patch0: alsa-lib-1.0.24-config.patch Patch1: alsa-lib-1.0.14-glibc-open.patch +Patch10: alsa-lib-addon-dir.patch BuildRequires: doxygen BuildRequires: autoconf automake libtool @@ -55,6 +56,7 @@ Manager allows configuration of Audio input/output names and routing %setup -q -n %{name}-%{version}%{?prever}%{?postver} %patch0 -p1 -b .config %patch1 -p1 -b .glibc-open +%patch10 -p1 -b .addon-dir %build autoreconf -vif @@ -119,6 +121,9 @@ find %{buildroot} -name '*.la' -delete %{_datadir}/alsa/ucm %changelog +* Wed Apr 04 2018 Jaroslav Kysela - 1.1.6-2 +- Changed add-on directory to /etc/alsa/conf.d + * Tue Apr 03 2018 Jaroslav Kysela - 1.1.6-1 - Updated to 1.1.6 From 401ece2e1a0148b2c8dbc4b0df6c90651ec3ef49 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 4 Apr 2018 10:51:41 +0200 Subject: [PATCH 005/120] add missing alsa-lib-addon-dir.patch --- alsa-lib-addon-dir.patch | 85 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 alsa-lib-addon-dir.patch diff --git a/alsa-lib-addon-dir.patch b/alsa-lib-addon-dir.patch new file mode 100644 index 0000000..7cc32fa --- /dev/null +++ b/alsa-lib-addon-dir.patch @@ -0,0 +1,85 @@ +From 93e03bdc2a3dcd5d12516f5de78e14d88a32ff2c Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 4 Apr 2018 09:58:12 +0200 +Subject: [PATCH 1/2] alsa.conf: change the location for add-on configs to + /etc/alsa/conf.d + +The add-on configuration files should be placed to a volatile place. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/alsa.conf | 8 +------- + 1 file changed, 1 insertion(+), 7 deletions(-) + +diff --git a/src/conf/alsa.conf b/src/conf/alsa.conf +index f22918fb..bb00ff40 100644 +--- a/src/conf/alsa.conf ++++ b/src/conf/alsa.conf +@@ -8,13 +8,7 @@ + { + func load + files [ +- { +- @func concat +- strings [ +- { @func datadir } +- "/alsa.conf.d/" +- ] +- } ++ "/etc/alsa/conf.d" + "/etc/asound.conf" + "~/.asoundrc" + ] +-- +2.13.6 + + +From 78505dccd23546cc77e5221cb21c01325bc0138d Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 4 Apr 2018 10:02:49 +0200 +Subject: [PATCH 2/2] conf: remove alsa.conf.d from the datadir + +Signed-off-by: Jaroslav Kysela +--- + src/conf/Makefile.am | 2 +- + src/conf/alsa.conf.d/Makefile.am | 8 -------- + src/conf/alsa.conf.d/README | 2 -- + 3 files changed, 1 insertion(+), 11 deletions(-) + delete mode 100644 src/conf/alsa.conf.d/Makefile.am + delete mode 100644 src/conf/alsa.conf.d/README + +diff --git a/src/conf/Makefile.am b/src/conf/Makefile.am +index ef2ea9c1..2b46f95c 100644 +--- a/src/conf/Makefile.am ++++ b/src/conf/Makefile.am +@@ -1,4 +1,4 @@ +-SUBDIRS=cards pcm alsa.conf.d ++SUBDIRS=cards pcm + + if BUILD_UCM + SUBDIRS += ucm +diff --git a/src/conf/alsa.conf.d/Makefile.am b/src/conf/alsa.conf.d/Makefile.am +deleted file mode 100644 +index c91661e9..00000000 +--- a/src/conf/alsa.conf.d/Makefile.am ++++ /dev/null +@@ -1,8 +0,0 @@ +-alsaconfigdir = @ALSA_CONFIG_DIR@ +-alsadir = $(alsaconfigdir)/alsa.conf.d +-cfg_files = README +- +-alsa_DATA = $(cfg_files) +- +-EXTRA_DIST = \ +- $(cfg_files) +diff --git a/src/conf/alsa.conf.d/README b/src/conf/alsa.conf.d/README +deleted file mode 100644 +index 99978848..00000000 +--- a/src/conf/alsa.conf.d/README ++++ /dev/null +@@ -1,2 +0,0 @@ +-You can place files named *.conf in this folder and they will be processed +-when initialising alsa-lib. +-- +2.13.6 + From 68558e01e819128673f35a0348a30d7c5056b3a7 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 12 Jul 2018 20:09:31 +0000 Subject: [PATCH 006/120] - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- alsa-lib.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 5bfb86f..c4e2ace 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -5,7 +5,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: 1.1.6 -Release: 2%{?prever_dot}%{?dist} +Release: 3%{?prever_dot}%{?dist} License: LGPLv2+ Group: System Environment/Libraries URL: http://www.alsa-project.org/ @@ -121,6 +121,9 @@ find %{buildroot} -name '*.la' -delete %{_datadir}/alsa/ucm %changelog +* Thu Jul 12 2018 Fedora Release Engineering - 1.1.6-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + * Wed Apr 04 2018 Jaroslav Kysela - 1.1.6-2 - Changed add-on directory to /etc/alsa/conf.d From d7051cd0e9781b1b825a22c591aaf03341456f07 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 16 Oct 2018 10:27:40 +0200 Subject: [PATCH 007/120] updated to 1.1.7 --- alsa-lib-addon-dir.patch | 85 ---------------------------------------- alsa-lib.spec | 40 ++++++++++++++----- 2 files changed, 30 insertions(+), 95 deletions(-) delete mode 100644 alsa-lib-addon-dir.patch diff --git a/alsa-lib-addon-dir.patch b/alsa-lib-addon-dir.patch deleted file mode 100644 index 7cc32fa..0000000 --- a/alsa-lib-addon-dir.patch +++ /dev/null @@ -1,85 +0,0 @@ -From 93e03bdc2a3dcd5d12516f5de78e14d88a32ff2c Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 4 Apr 2018 09:58:12 +0200 -Subject: [PATCH 1/2] alsa.conf: change the location for add-on configs to - /etc/alsa/conf.d - -The add-on configuration files should be placed to a volatile place. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/alsa.conf | 8 +------- - 1 file changed, 1 insertion(+), 7 deletions(-) - -diff --git a/src/conf/alsa.conf b/src/conf/alsa.conf -index f22918fb..bb00ff40 100644 ---- a/src/conf/alsa.conf -+++ b/src/conf/alsa.conf -@@ -8,13 +8,7 @@ - { - func load - files [ -- { -- @func concat -- strings [ -- { @func datadir } -- "/alsa.conf.d/" -- ] -- } -+ "/etc/alsa/conf.d" - "/etc/asound.conf" - "~/.asoundrc" - ] --- -2.13.6 - - -From 78505dccd23546cc77e5221cb21c01325bc0138d Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 4 Apr 2018 10:02:49 +0200 -Subject: [PATCH 2/2] conf: remove alsa.conf.d from the datadir - -Signed-off-by: Jaroslav Kysela ---- - src/conf/Makefile.am | 2 +- - src/conf/alsa.conf.d/Makefile.am | 8 -------- - src/conf/alsa.conf.d/README | 2 -- - 3 files changed, 1 insertion(+), 11 deletions(-) - delete mode 100644 src/conf/alsa.conf.d/Makefile.am - delete mode 100644 src/conf/alsa.conf.d/README - -diff --git a/src/conf/Makefile.am b/src/conf/Makefile.am -index ef2ea9c1..2b46f95c 100644 ---- a/src/conf/Makefile.am -+++ b/src/conf/Makefile.am -@@ -1,4 +1,4 @@ --SUBDIRS=cards pcm alsa.conf.d -+SUBDIRS=cards pcm - - if BUILD_UCM - SUBDIRS += ucm -diff --git a/src/conf/alsa.conf.d/Makefile.am b/src/conf/alsa.conf.d/Makefile.am -deleted file mode 100644 -index c91661e9..00000000 ---- a/src/conf/alsa.conf.d/Makefile.am -+++ /dev/null -@@ -1,8 +0,0 @@ --alsaconfigdir = @ALSA_CONFIG_DIR@ --alsadir = $(alsaconfigdir)/alsa.conf.d --cfg_files = README -- --alsa_DATA = $(cfg_files) -- --EXTRA_DIST = \ -- $(cfg_files) -diff --git a/src/conf/alsa.conf.d/README b/src/conf/alsa.conf.d/README -deleted file mode 100644 -index 99978848..00000000 ---- a/src/conf/alsa.conf.d/README -+++ /dev/null -@@ -1,2 +0,0 @@ --You can place files named *.conf in this folder and they will be processed --when initialising alsa-lib. --- -2.13.6 - diff --git a/alsa-lib.spec b/alsa-lib.spec index c4e2ace..6062eaa 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -4,8 +4,8 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib -Version: 1.1.6 -Release: 3%{?prever_dot}%{?dist} +Version: 1.1.7 +Release: 1%{?prever_dot}%{?dist} License: LGPLv2+ Group: System Environment/Libraries URL: http://www.alsa-project.org/ @@ -16,7 +16,6 @@ Source11: modprobe-dist-alsa.conf Source12: modprobe-dist-oss.conf Patch0: alsa-lib-1.0.24-config.patch Patch1: alsa-lib-1.0.14-glibc-open.patch -Patch10: alsa-lib-addon-dir.patch BuildRequires: doxygen BuildRequires: autoconf automake libtool @@ -44,19 +43,29 @@ This package includes the ALSA development libraries for developing against the ALSA libraries and interfaces. %package -n alsa-ucm -Summary: ALSA Universal Configuration Manager -Group: System Environment/Libraries -Requires: %{name} = %{version}-%{release} +Summary: ALSA Use Case Manager configuration +Group: System Environment/Libraries +BuildArch: noarch +Requires: %{name} = %{version}-%{release} %description -n alsa-ucm -The Advanced Linux Sound Architecture (ALSA) Universal Configuration -Manager allows configuration of Audio input/output names and routing +The Advanced Linux Sound Architecture (ALSA) Use Case Manager configuration +contains alsa-lib configuration of Audio input/output names and routing + +%package -n alsa-topology +Summary: ALSA Topology configuration +Group: System Environment/Libraries +BuildArch: noarch +Requires: %{name} = %{version}-%{release} + +%description -n alsa-topology +The Advanced Linux Sound Architecture (ALSA) topology configuration +contains alsa-lib configuration of SoC topology %prep %setup -q -n %{name}-%{version}%{?prever}%{?postver} %patch0 -p1 -b .config %patch1 -p1 -b .glibc-open -%patch10 -p1 -b .addon-dir %build autoreconf -vif @@ -90,7 +99,10 @@ install -p -m 644 %{SOURCE12} . # Create UCM directory mkdir -p %{buildroot}/%{_datadir}/alsa/ucm -#Remove libtool archives. +# Create topology directory +mkdir -p %{buildroot}/%{_datadir}/alsa/topology + +# Remove libtool archives. find %{buildroot} -name '*.la' -delete %post -p /sbin/ldconfig @@ -107,6 +119,7 @@ find %{buildroot} -name '*.la' -delete #{_libdir}/alsa-lib/ %{_datadir}/alsa/ %exclude %{_datadir}/alsa/ucm +%exclude %{_datadir}/alsa/topology /lib/modprobe.d/dist-* %files devel @@ -120,7 +133,14 @@ find %{buildroot} -name '*.la' -delete %files -n alsa-ucm %{_datadir}/alsa/ucm +%files -n alsa-topology +%{_datadir}/alsa/topology + %changelog +* Tue Oct 16 2018 Jaroslav Kysela - 1.1.7-1 +- Moved topology files to alsa-topology +- Updated to 1.1.7 + * Thu Jul 12 2018 Fedora Release Engineering - 1.1.6-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild From 2963703767408417a99e37b9ef9a9e7e70645184 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 16 Oct 2018 10:39:03 +0200 Subject: [PATCH 008/120] update sources --- sources | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sources b/sources index fd984bd..300b38d 100644 --- a/sources +++ b/sources @@ -1,2 +1 @@ -SHA512 (alsa-lib-1.1.5.tar.bz2) = c79ceaa1ebfeda2caf41a0495ea31dd2748a11795989aebc341ae13a5c96d21495e4542571d5590e68b2575ceddd6e84059a950ddb78e6c0b9d94861faee4f58 -SHA512 (alsa-lib-1.1.6.tar.bz2) = 00117769a3d5c609019b975188d6e7a07d035bd0461f54c5f291e14667620506f1adb6d61350f78d54648850f31965aae3ab0e697bf9e09c988e2d15bf6b09f0 +SHA512 (alsa-lib-1.1.7.tar.bz2) = 7cc81464d876a137e9ac9700420bfff7cd528338bdc6e0bdbe313d45c5b97c81f1a9483df0556fe390d54a9db747fbec62e843b42d2cbc740d5a91b015714f6c From 76897df30a961ff7ce2346c3c7c40b8793959380 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 16 Oct 2018 17:34:41 +0200 Subject: [PATCH 009/120] eliminate some lint errors --- alsa-lib.spec | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 6062eaa..d8fd09b 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -79,6 +79,8 @@ make %{?_smp_mflags} V=1 make doc %install +%global sysmodprobedir %{_prefix}/lib/modprobe.d + make DESTDIR=%{buildroot} install # We need the library to be available even before /usr might be mounted @@ -91,8 +93,8 @@ mkdir -p -m 755 %{buildroot}/etc install -p -m 644 %{SOURCE10} %{buildroot}/etc # Install the modprobe files for ALSA -mkdir -p -m 755 %{buildroot}/lib/modprobe.d/ -install -p -m 644 %{SOURCE11} %{buildroot}/lib/modprobe.d/dist-alsa.conf +mkdir -p -m 755 %{buildroot}%{sysmodprobedir} +install -p -m 644 %{SOURCE11} %{buildroot}%{sysmodprobedir}/dist-alsa.conf # bug#926973, place this file to the doc directory install -p -m 644 %{SOURCE12} . @@ -120,7 +122,7 @@ find %{buildroot} -name '*.la' -delete %{_datadir}/alsa/ %exclude %{_datadir}/alsa/ucm %exclude %{_datadir}/alsa/topology -/lib/modprobe.d/dist-* +%{sysmodprobedir}/dist-* %files devel %doc TODO doc/doxygen/ From 4a1704a9539609f8666a2a499d0bd31843d564ac Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 24 Oct 2018 12:36:19 +0200 Subject: [PATCH 010/120] fix pcm interval regression --- alsa-git.patch | 305 +++++++++++++++++++++++++++++++++++++++++++++++++ alsa-lib.spec | 14 ++- 2 files changed, 313 insertions(+), 6 deletions(-) create mode 100644 alsa-git.patch diff --git a/alsa-git.patch b/alsa-git.patch new file mode 100644 index 0000000..8794e18 --- /dev/null +++ b/alsa-git.patch @@ -0,0 +1,305 @@ +From 6eced6b4b6dca9f62ea3d13a40c5991231df3c5c Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Thu, 18 Oct 2018 09:38:38 +0200 +Subject: [PATCH 1/6] conf/ucm/Dell-WD15-Dock: Fix incorrect device names + +The device name string for Dell WD15 (and its variants) dock is set as +"WD15Dock", while the actual device name to be used is "Dock". + +Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1112292 +Fixes: 8ebb40c96970 ("conf/ucm: Add a UCM profile for Dell WD15 Dock USB-audio") +Signed-off-by: Takashi Iwai +--- + src/conf/ucm/Dell-WD15-Dock/HiFi.conf | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/conf/ucm/Dell-WD15-Dock/HiFi.conf b/src/conf/ucm/Dell-WD15-Dock/HiFi.conf +index b07f3440..1b6bd212 100644 +--- a/src/conf/ucm/Dell-WD15-Dock/HiFi.conf ++++ b/src/conf/ucm/Dell-WD15-Dock/HiFi.conf +@@ -3,7 +3,7 @@ SectionDevice."Headphone" { + + Value { + PlaybackChannels "2" +- PlaybackPCM "hw:WD15Dock,0" ++ PlaybackPCM "hw:Dock,0" + } + } + +@@ -12,7 +12,7 @@ SectionDevice."LineOut" { + + Value { + PlaybackChannels "2" +- PlaybackPCM "hw:WD15Dock,1" ++ PlaybackPCM "hw:Dock,1" + } + } + +@@ -21,6 +21,6 @@ SectionDevice."Mic" { + + Value { + CaptureChannels "2" +- CapturePCM "hw:WD15Dock,0" ++ CapturePCM "hw:Dock,0" + } + } +-- +2.13.6 + + +From 6852f88e80e442ba5d7f2044cf0fbbe72d46fefa Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 23 Oct 2018 10:03:17 +0200 +Subject: [PATCH 2/6] test/latecy: fix typo in tstamp compare + +Signed-off-by: Jaroslav Kysela +--- + test/latency.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/test/latency.c b/test/latency.c +index f3590b3f..e926856b 100644 +--- a/test/latency.c ++++ b/test/latency.c +@@ -673,7 +673,7 @@ int main(int argc, char *argv[]) + printf("Capture:\n"); + showstat(chandle, frames_in); + showinmax(in_max); +- if (p_tstamp.tv_sec == p_tstamp.tv_sec && ++ if (p_tstamp.tv_sec == c_tstamp.tv_sec && + p_tstamp.tv_usec == c_tstamp.tv_usec) + printf("Hardware sync\n"); + snd_pcm_drop(chandle); +-- +2.13.6 + + +From 82ae026f49e6e22f4775ae23e33324535025a5c6 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 23 Oct 2018 10:17:12 +0200 +Subject: [PATCH 3/6] test/code: make it work again + +Signed-off-by: Jaroslav Kysela +--- + test/code.c | 40 +++++++++++++++++++++------------------- + 1 file changed, 21 insertions(+), 19 deletions(-) + +diff --git a/test/code.c b/test/code.c +index e2032de5..3706243e 100644 +--- a/test/code.c ++++ b/test/code.c +@@ -3,11 +3,7 @@ + #include + #include + #include +-#include +- +-#ifndef __builtin_expect +-#include +-#endif ++#include + + #define rdtscll(val) \ + __asm__ __volatile__("rdtsc" : "=A" (val)) +@@ -72,21 +68,21 @@ static inline void atomic_add(volatile int *dst, int v) + + static double detect_cpu_clock() + { +- struct timeval tm_begin, tm_end; ++ struct timespec tm_begin, tm_end; + unsigned long long tsc_begin, tsc_end; + + /* Warm cache */ +- gettimeofday(&tm_begin, 0); ++ clock_gettime(CLOCK_MONOTONIC, &tm_begin); + + rdtscll(tsc_begin); +- gettimeofday(&tm_begin, 0); ++ clock_gettime(CLOCK_MONOTONIC, &tm_begin); + + usleep(1000000); + + rdtscll(tsc_end); +- gettimeofday(&tm_end, 0); ++ clock_gettime(CLOCK_MONOTONIC, &tm_end); + +- return (tsc_end - tsc_begin) / (tm_end.tv_sec - tm_begin.tv_sec + (tm_end.tv_usec - tm_begin.tv_usec) / 1e6); ++ return (tsc_end - tsc_begin) / (tm_end.tv_sec - tm_begin.tv_sec + (tm_end.tv_nsec - tm_begin.tv_nsec) / 1e9); + } + + void mix_areas_srv(unsigned int size, +@@ -146,11 +142,17 @@ void mix_areas0(unsigned int size, + } + } + +-#define MIX_AREAS1 mix_areas1 +-#define MIX_AREAS1_MMX mix_areas1_mmx ++#define MIX_AREAS_16 mix_areas1 ++#define MIX_AREAS_16_MMX mix_areas1_mmx ++#define MIX_AREAS_32 mix_areas1_32 ++#define MIX_AREAS_24 mix_areas1_24 ++#define MIX_AREAS_24_CMOV mix_areas1_24_cmov ++#define XADD "addl" ++#define XSUB "subl" + #include "../src/pcm/pcm_dmix_i386.h" +-#undef MIX_AREAS1 +-#undef MIX_AREAS1_MMX ++static void *ptr_mix_areas1_32 __attribute__((unused)) = &mix_areas1_32; ++static void *ptr_mix_areas1_24 __attribute__((unused)) = &mix_areas1_24; ++static void *ptr_mix_areas1_24_cmov __attribute__((unused)) = &mix_areas1_24_cmov; + + void mix_areas2(unsigned int size, + volatile s16 *dst, const s16 *src, +@@ -319,11 +321,11 @@ int main(int argc, char **argv) + + printf(" \r"); + printf("Summary (the best times):\n"); +- printf("mix_areas_srv : %lld %f%%\n", diffS, 100*2*44100.0*diffS/(size*n*cpu_clock)); +- printf("mix_areas0 : %lld %f%%\n", diff0, 100*2*44100.0*diff0/(size*n*cpu_clock)); +- printf("mix_areas1 : %lld %f%%\n", diff1, 100*2*44100.0*diff1/(size*n*cpu_clock)); +- printf("mix_areas1_mmx: %lld %f%%\n", diff1_mmx, 100*2*44100.0*diff1_mmx/(size*n*cpu_clock)); +- printf("mix_areas2 : %lld %f%%\n", diff2, 100*2*44100.0*diff2/(size*n*cpu_clock)); ++ printf("mix_areas_srv : %8lld %f%%\n", diffS, 100*2*44100.0*diffS/(size*n*cpu_clock)); ++ printf("mix_areas0 : %8lld %f%%\n", diff0, 100*2*44100.0*diff0/(size*n*cpu_clock)); ++ printf("mix_areas1 : %8lld %f%%\n", diff1, 100*2*44100.0*diff1/(size*n*cpu_clock)); ++ printf("mix_areas1_mmx : %8lld %f%%\n", diff1_mmx, 100*2*44100.0*diff1_mmx/(size*n*cpu_clock)); ++ printf("mix_areas2 : %8lld %f%%\n", diff2, 100*2*44100.0*diff2/(size*n*cpu_clock)); + + printf("\n"); + printf("areas1/srv ratio : %f\n", (double)diff1 / diffS); +-- +2.13.6 + + +From 956bc152e7f77714a3be58dccf91ef8542c34556 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 23 Oct 2018 10:18:24 +0200 +Subject: [PATCH 4/6] test: rename code to more approriate mixtest + +Signed-off-by: Jaroslav Kysela +--- + test/Makefile.am | 2 +- + test/{code.c => mixtest.c} | 0 + 2 files changed, 1 insertion(+), 1 deletion(-) + rename test/{code.c => mixtest.c} (100%) + +diff --git a/test/Makefile.am b/test/Makefile.am +index 5f35159a..99c2c4ff 100644 +--- a/test/Makefile.am ++++ b/test/Makefile.am +@@ -20,7 +20,7 @@ oldapi_LDADD=../src/libasound.la + queue_timer_LDADD=../src/libasound.la + namehint_LDADD=../src/libasound.la + client_event_filter_LDADD=../src/libasound.la +-code_CFLAGS=-Wall -pipe -g -O2 ++mixtest_CFLAGS=-Wall -pipe -g -O2 + chmap_LDADD=../src/libasound.la + audio_time_LDADD=../src/libasound.la + pcm_multi_thread_LDADD=../src/libasound.la +diff --git a/test/code.c b/test/mixtest.c +similarity index 100% +rename from test/code.c +rename to test/mixtest.c +-- +2.13.6 + + +From 92172adb0b733de5a52f1671a279b3079cf0a657 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 23 Oct 2018 10:20:20 +0200 +Subject: [PATCH 5/6] test/audio_time: remove unused variables + +Signed-off-by: Jaroslav Kysela +--- + test/audio_time.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/test/audio_time.c b/test/audio_time.c +index a54c10dc..530922d9 100644 +--- a/test/audio_time.c ++++ b/test/audio_time.c +@@ -115,9 +115,7 @@ int main(int argc, char *argv[]) + snd_pcm_sw_params_t *swparams_p; + snd_pcm_sw_params_t *swparams_c; + +- snd_pcm_uframes_t curr_count_c; + snd_pcm_uframes_t frame_count_c = 0; +- snd_pcm_uframes_t curr_count_p; + snd_pcm_uframes_t frame_count_p = 0; + + snd_pcm_sframes_t delay_p, delay_c; +-- +2.13.6 + + +From b420056604f06117c967b65d43d01536c5ffcbc9 Mon Sep 17 00:00:00 2001 +From: Timo Wischer +Date: Thu, 18 Oct 2018 13:33:24 +0200 +Subject: [PATCH 6/6] pcm: interval: Interpret (x x+1] correctly and return x+1 + +Without this change an interval of (x x+1] will be interpreted as an +empty interval but the right value would be x+1. +This leads to a failing snd_pcm_hw_params() call which returns -EINVAL. + +An example issue log is given in the following: +snd_pcm_hw_params failed with err -22 (Invalid argument) +ACCESS: MMAP_NONINTERLEAVED +FORMAT: S16_LE +SUBFORMAT: STD +SAMPLE_BITS: 16 +FRAME_BITS: 16 +CHANNELS: 1 +RATE: 16000 +PERIOD_TIME: (15999 16000] +PERIOD_SIZE: (255 256] +PERIOD_BYTES: (510 512] +PERIODS: [2 3) +BUFFER_TIME: 32000 +BUFFER_SIZE: 512 +BUFFER_BYTES: 1024 + +In case of (x x+1) we have to interpret it anyway as a single value of x to +compensate rounding issues. +For example the period size will result in an interval of (352 353) when +the period time is 16ms and the sample rate 22050 Hz +(16ms * 22,05 kHz = 352,8 frames). But 352 has to be chosen to allow a +buffer size of 705 (32ms * 22,05 kHz = 705,6 frames) which has to be >= 2x +period size to avoid Xruns. The buffer size will not end up with an +interval of (705 706) simular to the period size because +snd_pcm_rate_hw_refine_cchange() calls snd_interval_floor() for the buffer +size. Therefore this value will be interpreted as an integer interval +instead of a real interval further on. + +This issue seems to exist since the change of 9bb985c38 ("pcm: +snd_interval_refine_first/last: exclude value only if also excluded +before") + +Signed-off-by: Timo Wischer +Signed-off-by: Jaroslav Kysela +--- + src/pcm/interval_inline.h | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/pcm/interval_inline.h b/src/pcm/interval_inline.h +index a68e292b..d9a30b2a 100644 +--- a/src/pcm/interval_inline.h ++++ b/src/pcm/interval_inline.h +@@ -51,12 +51,14 @@ INTERVAL_INLINE int snd_interval_single(const snd_interval_t *i) + { + assert(!snd_interval_empty(i)); + return (i->min == i->max || +- (i->min + 1 == i->max && i->openmax)); ++ (i->min + 1 == i->max && (i->openmin || i->openmax))); + } + + INTERVAL_INLINE int snd_interval_value(const snd_interval_t *i) + { + assert(snd_interval_single(i)); ++ if (i->openmin && !i->openmax) ++ return i->max; + return i->min; + } + +-- +2.13.6 + diff --git a/alsa-lib.spec b/alsa-lib.spec index d8fd09b..08f8a9e 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -5,7 +5,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: 1.1.7 -Release: 1%{?prever_dot}%{?dist} +Release: 2%{?prever_dot}%{?dist} License: LGPLv2+ Group: System Environment/Libraries URL: http://www.alsa-project.org/ @@ -14,8 +14,9 @@ Source: ftp://ftp.alsa-project.org/pub/lib/%{name}-%{version}%{?prever}%{?post Source10: asound.conf Source11: modprobe-dist-alsa.conf Source12: modprobe-dist-oss.conf -Patch0: alsa-lib-1.0.24-config.patch -Patch1: alsa-lib-1.0.14-glibc-open.patch +Patch0: alsa-git.patch +Patch1: alsa-lib-1.0.24-config.patch +Patch2: alsa-lib-1.0.14-glibc-open.patch BuildRequires: doxygen BuildRequires: autoconf automake libtool @@ -64,8 +65,9 @@ contains alsa-lib configuration of SoC topology %prep %setup -q -n %{name}-%{version}%{?prever}%{?postver} -%patch0 -p1 -b .config -%patch1 -p1 -b .glibc-open +%patch0 -p1 -b .alsa-git +%patch1 -p1 -b .config +%patch2 -p1 -b .glibc-open %build autoreconf -vif @@ -139,7 +141,7 @@ find %{buildroot} -name '*.la' -delete %{_datadir}/alsa/topology %changelog -* Tue Oct 16 2018 Jaroslav Kysela - 1.1.7-1 +* Wed Oct 24 2018 Jaroslav Kysela - 1.1.7-2 - Moved topology files to alsa-topology - Updated to 1.1.7 From f1d50d1ffd7983e674a62efd39ac7f07175469a5 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 24 Oct 2018 12:41:58 +0200 Subject: [PATCH 011/120] fix alsa-git.patch --- alsa-git.patch | 185 ------------------------------------------------- 1 file changed, 185 deletions(-) diff --git a/alsa-git.patch b/alsa-git.patch index 8794e18..783d364 100644 --- a/alsa-git.patch +++ b/alsa-git.patch @@ -47,191 +47,6 @@ index b07f3440..1b6bd212 100644 2.13.6 -From 6852f88e80e442ba5d7f2044cf0fbbe72d46fefa Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 23 Oct 2018 10:03:17 +0200 -Subject: [PATCH 2/6] test/latecy: fix typo in tstamp compare - -Signed-off-by: Jaroslav Kysela ---- - test/latency.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/test/latency.c b/test/latency.c -index f3590b3f..e926856b 100644 ---- a/test/latency.c -+++ b/test/latency.c -@@ -673,7 +673,7 @@ int main(int argc, char *argv[]) - printf("Capture:\n"); - showstat(chandle, frames_in); - showinmax(in_max); -- if (p_tstamp.tv_sec == p_tstamp.tv_sec && -+ if (p_tstamp.tv_sec == c_tstamp.tv_sec && - p_tstamp.tv_usec == c_tstamp.tv_usec) - printf("Hardware sync\n"); - snd_pcm_drop(chandle); --- -2.13.6 - - -From 82ae026f49e6e22f4775ae23e33324535025a5c6 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 23 Oct 2018 10:17:12 +0200 -Subject: [PATCH 3/6] test/code: make it work again - -Signed-off-by: Jaroslav Kysela ---- - test/code.c | 40 +++++++++++++++++++++------------------- - 1 file changed, 21 insertions(+), 19 deletions(-) - -diff --git a/test/code.c b/test/code.c -index e2032de5..3706243e 100644 ---- a/test/code.c -+++ b/test/code.c -@@ -3,11 +3,7 @@ - #include - #include - #include --#include -- --#ifndef __builtin_expect --#include --#endif -+#include - - #define rdtscll(val) \ - __asm__ __volatile__("rdtsc" : "=A" (val)) -@@ -72,21 +68,21 @@ static inline void atomic_add(volatile int *dst, int v) - - static double detect_cpu_clock() - { -- struct timeval tm_begin, tm_end; -+ struct timespec tm_begin, tm_end; - unsigned long long tsc_begin, tsc_end; - - /* Warm cache */ -- gettimeofday(&tm_begin, 0); -+ clock_gettime(CLOCK_MONOTONIC, &tm_begin); - - rdtscll(tsc_begin); -- gettimeofday(&tm_begin, 0); -+ clock_gettime(CLOCK_MONOTONIC, &tm_begin); - - usleep(1000000); - - rdtscll(tsc_end); -- gettimeofday(&tm_end, 0); -+ clock_gettime(CLOCK_MONOTONIC, &tm_end); - -- return (tsc_end - tsc_begin) / (tm_end.tv_sec - tm_begin.tv_sec + (tm_end.tv_usec - tm_begin.tv_usec) / 1e6); -+ return (tsc_end - tsc_begin) / (tm_end.tv_sec - tm_begin.tv_sec + (tm_end.tv_nsec - tm_begin.tv_nsec) / 1e9); - } - - void mix_areas_srv(unsigned int size, -@@ -146,11 +142,17 @@ void mix_areas0(unsigned int size, - } - } - --#define MIX_AREAS1 mix_areas1 --#define MIX_AREAS1_MMX mix_areas1_mmx -+#define MIX_AREAS_16 mix_areas1 -+#define MIX_AREAS_16_MMX mix_areas1_mmx -+#define MIX_AREAS_32 mix_areas1_32 -+#define MIX_AREAS_24 mix_areas1_24 -+#define MIX_AREAS_24_CMOV mix_areas1_24_cmov -+#define XADD "addl" -+#define XSUB "subl" - #include "../src/pcm/pcm_dmix_i386.h" --#undef MIX_AREAS1 --#undef MIX_AREAS1_MMX -+static void *ptr_mix_areas1_32 __attribute__((unused)) = &mix_areas1_32; -+static void *ptr_mix_areas1_24 __attribute__((unused)) = &mix_areas1_24; -+static void *ptr_mix_areas1_24_cmov __attribute__((unused)) = &mix_areas1_24_cmov; - - void mix_areas2(unsigned int size, - volatile s16 *dst, const s16 *src, -@@ -319,11 +321,11 @@ int main(int argc, char **argv) - - printf(" \r"); - printf("Summary (the best times):\n"); -- printf("mix_areas_srv : %lld %f%%\n", diffS, 100*2*44100.0*diffS/(size*n*cpu_clock)); -- printf("mix_areas0 : %lld %f%%\n", diff0, 100*2*44100.0*diff0/(size*n*cpu_clock)); -- printf("mix_areas1 : %lld %f%%\n", diff1, 100*2*44100.0*diff1/(size*n*cpu_clock)); -- printf("mix_areas1_mmx: %lld %f%%\n", diff1_mmx, 100*2*44100.0*diff1_mmx/(size*n*cpu_clock)); -- printf("mix_areas2 : %lld %f%%\n", diff2, 100*2*44100.0*diff2/(size*n*cpu_clock)); -+ printf("mix_areas_srv : %8lld %f%%\n", diffS, 100*2*44100.0*diffS/(size*n*cpu_clock)); -+ printf("mix_areas0 : %8lld %f%%\n", diff0, 100*2*44100.0*diff0/(size*n*cpu_clock)); -+ printf("mix_areas1 : %8lld %f%%\n", diff1, 100*2*44100.0*diff1/(size*n*cpu_clock)); -+ printf("mix_areas1_mmx : %8lld %f%%\n", diff1_mmx, 100*2*44100.0*diff1_mmx/(size*n*cpu_clock)); -+ printf("mix_areas2 : %8lld %f%%\n", diff2, 100*2*44100.0*diff2/(size*n*cpu_clock)); - - printf("\n"); - printf("areas1/srv ratio : %f\n", (double)diff1 / diffS); --- -2.13.6 - - -From 956bc152e7f77714a3be58dccf91ef8542c34556 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 23 Oct 2018 10:18:24 +0200 -Subject: [PATCH 4/6] test: rename code to more approriate mixtest - -Signed-off-by: Jaroslav Kysela ---- - test/Makefile.am | 2 +- - test/{code.c => mixtest.c} | 0 - 2 files changed, 1 insertion(+), 1 deletion(-) - rename test/{code.c => mixtest.c} (100%) - -diff --git a/test/Makefile.am b/test/Makefile.am -index 5f35159a..99c2c4ff 100644 ---- a/test/Makefile.am -+++ b/test/Makefile.am -@@ -20,7 +20,7 @@ oldapi_LDADD=../src/libasound.la - queue_timer_LDADD=../src/libasound.la - namehint_LDADD=../src/libasound.la - client_event_filter_LDADD=../src/libasound.la --code_CFLAGS=-Wall -pipe -g -O2 -+mixtest_CFLAGS=-Wall -pipe -g -O2 - chmap_LDADD=../src/libasound.la - audio_time_LDADD=../src/libasound.la - pcm_multi_thread_LDADD=../src/libasound.la -diff --git a/test/code.c b/test/mixtest.c -similarity index 100% -rename from test/code.c -rename to test/mixtest.c --- -2.13.6 - - -From 92172adb0b733de5a52f1671a279b3079cf0a657 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 23 Oct 2018 10:20:20 +0200 -Subject: [PATCH 5/6] test/audio_time: remove unused variables - -Signed-off-by: Jaroslav Kysela ---- - test/audio_time.c | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/test/audio_time.c b/test/audio_time.c -index a54c10dc..530922d9 100644 ---- a/test/audio_time.c -+++ b/test/audio_time.c -@@ -115,9 +115,7 @@ int main(int argc, char *argv[]) - snd_pcm_sw_params_t *swparams_p; - snd_pcm_sw_params_t *swparams_c; - -- snd_pcm_uframes_t curr_count_c; - snd_pcm_uframes_t frame_count_c = 0; -- snd_pcm_uframes_t curr_count_p; - snd_pcm_uframes_t frame_count_p = 0; - - snd_pcm_sframes_t delay_p, delay_c; --- -2.13.6 - - From b420056604f06117c967b65d43d01536c5ffcbc9 Mon Sep 17 00:00:00 2001 From: Timo Wischer Date: Thu, 18 Oct 2018 13:33:24 +0200 From 7eb207d622e63a6d471275e4b25294aad39f3892 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Tue, 25 Dec 2018 15:16:10 +0100 Subject: [PATCH 012/120] Fix broken chtrt5645 UCM profile, fixing mic input on chtrt5645 devices --- alsa-lib-1.1.7-ucm-chtrt5645.patch | 9 +++++++++ alsa-lib.spec | 8 +++++++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 alsa-lib-1.1.7-ucm-chtrt5645.patch diff --git a/alsa-lib-1.1.7-ucm-chtrt5645.patch b/alsa-lib-1.1.7-ucm-chtrt5645.patch new file mode 100644 index 0000000..206f274 --- /dev/null +++ b/alsa-lib-1.1.7-ucm-chtrt5645.patch @@ -0,0 +1,9 @@ +diff -up alsa-lib-1.1.7/src/conf/ucm/chtrt5645/HiFi.conf~ alsa-lib-1.1.7/src/conf/ucm/chtrt5645/HiFi.conf +--- alsa-lib-1.1.7/src/conf/ucm/chtrt5645/HiFi.conf~ 2018-10-16 10:08:35.000000000 +0200 ++++ alsa-lib-1.1.7/src/conf/ucm/chtrt5645/HiFi.conf 2018-12-25 14:46:21.860175750 +0100 +@@ -1,3 +1,5 @@ ++ ++ + SectionVerb { + # ALSA PCM + Value { diff --git a/alsa-lib.spec b/alsa-lib.spec index 08f8a9e..d81fd20 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -5,7 +5,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: 1.1.7 -Release: 2%{?prever_dot}%{?dist} +Release: 3%{?prever_dot}%{?dist} License: LGPLv2+ Group: System Environment/Libraries URL: http://www.alsa-project.org/ @@ -17,6 +17,8 @@ Source12: modprobe-dist-oss.conf Patch0: alsa-git.patch Patch1: alsa-lib-1.0.24-config.patch Patch2: alsa-lib-1.0.14-glibc-open.patch +# Fixed differently upstream, drop on next rebase +Patch3: alsa-lib-1.1.7-ucm-chtrt5645.patch BuildRequires: doxygen BuildRequires: autoconf automake libtool @@ -68,6 +70,7 @@ contains alsa-lib configuration of SoC topology %patch0 -p1 -b .alsa-git %patch1 -p1 -b .config %patch2 -p1 -b .glibc-open +%patch3 -p1 %build autoreconf -vif @@ -141,6 +144,9 @@ find %{buildroot} -name '*.la' -delete %{_datadir}/alsa/topology %changelog +* Tue Dec 25 2018 Hans de Goede - 1.1.7-3 +- Fix broken chtrt5645 UCM profile, fixing mic input on chtrt5645 devices + * Wed Oct 24 2018 Jaroslav Kysela - 1.1.7-2 - Moved topology files to alsa-topology - Updated to 1.1.7 From 726283646108b16340db6f705bdb8848ed7f3de7 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 7 Jan 2019 14:27:49 +0100 Subject: [PATCH 013/120] updated to 1.1.8 --- alsa-lib-1.1.7-ucm-chtrt5645.patch | 9 --------- alsa-lib.spec | 10 +++++----- sources | 2 +- 3 files changed, 6 insertions(+), 15 deletions(-) delete mode 100644 alsa-lib-1.1.7-ucm-chtrt5645.patch diff --git a/alsa-lib-1.1.7-ucm-chtrt5645.patch b/alsa-lib-1.1.7-ucm-chtrt5645.patch deleted file mode 100644 index 206f274..0000000 --- a/alsa-lib-1.1.7-ucm-chtrt5645.patch +++ /dev/null @@ -1,9 +0,0 @@ -diff -up alsa-lib-1.1.7/src/conf/ucm/chtrt5645/HiFi.conf~ alsa-lib-1.1.7/src/conf/ucm/chtrt5645/HiFi.conf ---- alsa-lib-1.1.7/src/conf/ucm/chtrt5645/HiFi.conf~ 2018-10-16 10:08:35.000000000 +0200 -+++ alsa-lib-1.1.7/src/conf/ucm/chtrt5645/HiFi.conf 2018-12-25 14:46:21.860175750 +0100 -@@ -1,3 +1,5 @@ -+ -+ - SectionVerb { - # ALSA PCM - Value { diff --git a/alsa-lib.spec b/alsa-lib.spec index d81fd20..6e28536 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -4,8 +4,8 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib -Version: 1.1.7 -Release: 3%{?prever_dot}%{?dist} +Version: 1.1.8 +Release: 1%{?prever_dot}%{?dist} License: LGPLv2+ Group: System Environment/Libraries URL: http://www.alsa-project.org/ @@ -17,8 +17,6 @@ Source12: modprobe-dist-oss.conf Patch0: alsa-git.patch Patch1: alsa-lib-1.0.24-config.patch Patch2: alsa-lib-1.0.14-glibc-open.patch -# Fixed differently upstream, drop on next rebase -Patch3: alsa-lib-1.1.7-ucm-chtrt5645.patch BuildRequires: doxygen BuildRequires: autoconf automake libtool @@ -70,7 +68,6 @@ contains alsa-lib configuration of SoC topology %patch0 -p1 -b .alsa-git %patch1 -p1 -b .config %patch2 -p1 -b .glibc-open -%patch3 -p1 %build autoreconf -vif @@ -144,6 +141,9 @@ find %{buildroot} -name '*.la' -delete %{_datadir}/alsa/topology %changelog +* Mon Jan 7 2019 Jaroslav Kysela - 1.1.8-1 +- Updated to 1.1.8 + * Tue Dec 25 2018 Hans de Goede - 1.1.7-3 - Fix broken chtrt5645 UCM profile, fixing mic input on chtrt5645 devices diff --git a/sources b/sources index 300b38d..8b47b43 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (alsa-lib-1.1.7.tar.bz2) = 7cc81464d876a137e9ac9700420bfff7cd528338bdc6e0bdbe313d45c5b97c81f1a9483df0556fe390d54a9db747fbec62e843b42d2cbc740d5a91b015714f6c +SHA512 (alsa-lib-1.1.8.tar.bz2) = 50ae107c6efe8200b4c41e0463e099d16e149332f1d3a22c3e81d3e7d980b7f93f3610fc9711ef62067caeb1054e7ea612ba3903bf8a91ebeffa48687cf80eed From 80c5721219abe607622d9e73763e5bd6e34a3f2d Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 7 Jan 2019 14:39:36 +0100 Subject: [PATCH 014/120] remove obsolete alsa-git.patch contents --- alsa-git.patch | 120 ------------------------------------------------- 1 file changed, 120 deletions(-) diff --git a/alsa-git.patch b/alsa-git.patch index 783d364..e69de29 100644 --- a/alsa-git.patch +++ b/alsa-git.patch @@ -1,120 +0,0 @@ -From 6eced6b4b6dca9f62ea3d13a40c5991231df3c5c Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Thu, 18 Oct 2018 09:38:38 +0200 -Subject: [PATCH 1/6] conf/ucm/Dell-WD15-Dock: Fix incorrect device names - -The device name string for Dell WD15 (and its variants) dock is set as -"WD15Dock", while the actual device name to be used is "Dock". - -Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1112292 -Fixes: 8ebb40c96970 ("conf/ucm: Add a UCM profile for Dell WD15 Dock USB-audio") -Signed-off-by: Takashi Iwai ---- - src/conf/ucm/Dell-WD15-Dock/HiFi.conf | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/src/conf/ucm/Dell-WD15-Dock/HiFi.conf b/src/conf/ucm/Dell-WD15-Dock/HiFi.conf -index b07f3440..1b6bd212 100644 ---- a/src/conf/ucm/Dell-WD15-Dock/HiFi.conf -+++ b/src/conf/ucm/Dell-WD15-Dock/HiFi.conf -@@ -3,7 +3,7 @@ SectionDevice."Headphone" { - - Value { - PlaybackChannels "2" -- PlaybackPCM "hw:WD15Dock,0" -+ PlaybackPCM "hw:Dock,0" - } - } - -@@ -12,7 +12,7 @@ SectionDevice."LineOut" { - - Value { - PlaybackChannels "2" -- PlaybackPCM "hw:WD15Dock,1" -+ PlaybackPCM "hw:Dock,1" - } - } - -@@ -21,6 +21,6 @@ SectionDevice."Mic" { - - Value { - CaptureChannels "2" -- CapturePCM "hw:WD15Dock,0" -+ CapturePCM "hw:Dock,0" - } - } --- -2.13.6 - - -From b420056604f06117c967b65d43d01536c5ffcbc9 Mon Sep 17 00:00:00 2001 -From: Timo Wischer -Date: Thu, 18 Oct 2018 13:33:24 +0200 -Subject: [PATCH 6/6] pcm: interval: Interpret (x x+1] correctly and return x+1 - -Without this change an interval of (x x+1] will be interpreted as an -empty interval but the right value would be x+1. -This leads to a failing snd_pcm_hw_params() call which returns -EINVAL. - -An example issue log is given in the following: -snd_pcm_hw_params failed with err -22 (Invalid argument) -ACCESS: MMAP_NONINTERLEAVED -FORMAT: S16_LE -SUBFORMAT: STD -SAMPLE_BITS: 16 -FRAME_BITS: 16 -CHANNELS: 1 -RATE: 16000 -PERIOD_TIME: (15999 16000] -PERIOD_SIZE: (255 256] -PERIOD_BYTES: (510 512] -PERIODS: [2 3) -BUFFER_TIME: 32000 -BUFFER_SIZE: 512 -BUFFER_BYTES: 1024 - -In case of (x x+1) we have to interpret it anyway as a single value of x to -compensate rounding issues. -For example the period size will result in an interval of (352 353) when -the period time is 16ms and the sample rate 22050 Hz -(16ms * 22,05 kHz = 352,8 frames). But 352 has to be chosen to allow a -buffer size of 705 (32ms * 22,05 kHz = 705,6 frames) which has to be >= 2x -period size to avoid Xruns. The buffer size will not end up with an -interval of (705 706) simular to the period size because -snd_pcm_rate_hw_refine_cchange() calls snd_interval_floor() for the buffer -size. Therefore this value will be interpreted as an integer interval -instead of a real interval further on. - -This issue seems to exist since the change of 9bb985c38 ("pcm: -snd_interval_refine_first/last: exclude value only if also excluded -before") - -Signed-off-by: Timo Wischer -Signed-off-by: Jaroslav Kysela ---- - src/pcm/interval_inline.h | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/src/pcm/interval_inline.h b/src/pcm/interval_inline.h -index a68e292b..d9a30b2a 100644 ---- a/src/pcm/interval_inline.h -+++ b/src/pcm/interval_inline.h -@@ -51,12 +51,14 @@ INTERVAL_INLINE int snd_interval_single(const snd_interval_t *i) - { - assert(!snd_interval_empty(i)); - return (i->min == i->max || -- (i->min + 1 == i->max && i->openmax)); -+ (i->min + 1 == i->max && (i->openmin || i->openmax))); - } - - INTERVAL_INLINE int snd_interval_value(const snd_interval_t *i) - { - assert(snd_interval_single(i)); -+ if (i->openmin && !i->openmax) -+ return i->max; - return i->min; - } - --- -2.13.6 - From f31fd6be796020f6a9115ad43cc69d24e6346cac Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 22 Jan 2019 18:38:30 +0100 Subject: [PATCH 015/120] Remove obsolete ldconfig scriptlets References: https://fedoraproject.org/wiki/Changes/RemoveObsoleteScriptlets Signed-off-by: Igor Gnatenko --- alsa-lib.spec | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 6e28536..f3f2740 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -20,7 +20,6 @@ Patch2: alsa-lib-1.0.14-glibc-open.patch BuildRequires: doxygen BuildRequires: autoconf automake libtool -Requires(post): /sbin/ldconfig, coreutils %description The Advanced Linux Sound Architecture (ALSA) provides audio and MIDI @@ -109,9 +108,7 @@ mkdir -p %{buildroot}/%{_datadir}/alsa/topology # Remove libtool archives. find %{buildroot} -name '*.la' -delete -%post -p /sbin/ldconfig - -%postun -p /sbin/ldconfig +%ldconfig_scriptlets %files %{!?_licensedir:%global license %%doc} From ba4f5b19d7d191e4dae3425d6d71a5302af99137 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Mon, 28 Jan 2019 20:17:38 +0100 Subject: [PATCH 016/120] Remove obsolete Group tag References: https://fedoraproject.org/wiki/Changes/Remove_Group_Tag --- alsa-lib.spec | 4 ---- 1 file changed, 4 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index f3f2740..c8d0db9 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -7,7 +7,6 @@ Name: alsa-lib Version: 1.1.8 Release: 1%{?prever_dot}%{?dist} License: LGPLv2+ -Group: System Environment/Libraries URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/lib/%{name}-%{version}%{?prever}%{?postver}.tar.bz2 @@ -31,7 +30,6 @@ the older OSS API, providing binary compatibility for most OSS programs. %package devel Summary: Development files from the ALSA library -Group: Development/Libraries Requires: %{name} = %{version}-%{release} Requires: pkgconfig @@ -44,7 +42,6 @@ against the ALSA libraries and interfaces. %package -n alsa-ucm Summary: ALSA Use Case Manager configuration -Group: System Environment/Libraries BuildArch: noarch Requires: %{name} = %{version}-%{release} @@ -54,7 +51,6 @@ contains alsa-lib configuration of Audio input/output names and routing %package -n alsa-topology Summary: ALSA Topology configuration -Group: System Environment/Libraries BuildArch: noarch Requires: %{name} = %{version}-%{release} From b9d13c609ed2a8f1616f9ce450de657e84357a6e Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 31 Jan 2019 13:12:57 +0000 Subject: [PATCH 017/120] - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- alsa-lib.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index c8d0db9..ad9da03 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -5,7 +5,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: 1.1.8 -Release: 1%{?prever_dot}%{?dist} +Release: 2%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -134,6 +134,9 @@ find %{buildroot} -name '*.la' -delete %{_datadir}/alsa/topology %changelog +* Thu Jan 31 2019 Fedora Release Engineering - 1.1.8-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + * Mon Jan 7 2019 Jaroslav Kysela - 1.1.8-1 - Updated to 1.1.8 From 8c75636abba982ee9ac77d3383af1f7098bf4514 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 10 May 2019 09:38:58 +0200 Subject: [PATCH 018/120] updated to 1.1.9 --- ...4-config.patch => alsa-lib-1.1.9-config.patch | 12 ++++++------ alsa-lib.spec | 16 +++++++++++----- sources | 2 +- 3 files changed, 18 insertions(+), 12 deletions(-) rename alsa-lib-1.0.24-config.patch => alsa-lib-1.1.9-config.patch (82%) diff --git a/alsa-lib-1.0.24-config.patch b/alsa-lib-1.1.9-config.patch similarity index 82% rename from alsa-lib-1.0.24-config.patch rename to alsa-lib-1.1.9-config.patch index f0e50e3..f8c2c59 100644 --- a/alsa-lib-1.0.24-config.patch +++ b/alsa-lib-1.1.9-config.patch @@ -1,8 +1,8 @@ diff --git a/src/conf/alsa.conf b/src/conf/alsa.conf -index 1889f01..60c12ac 100644 +index 09980586..c4525f0b 100644 --- a/src/conf/alsa.conf +++ b/src/conf/alsa.conf -@@ -66,8 +66,7 @@ defaults.pcm.nonblock 1 +@@ -67,8 +67,7 @@ defaults.pcm.nonblock 1 defaults.pcm.compat 0 defaults.pcm.minperiodtime 5000 # in us defaults.pcm.ipc_key 5678293 @@ -10,13 +10,13 @@ index 1889f01..60c12ac 100644 -defaults.pcm.ipc_perm 0660 +defaults.pcm.ipc_perm 0600 defaults.pcm.dmix.max_periods 0 + defaults.pcm.dmix.channels 2 defaults.pcm.dmix.rate 48000 - defaults.pcm.dmix.format "unchanged" diff --git a/src/conf/pcm/dmix.conf b/src/conf/pcm/dmix.conf -index e62cb29..a005488 100644 +index 7fa5c8b2..97936a82 100644 --- a/src/conf/pcm/dmix.conf +++ b/src/conf/pcm/dmix.conf -@@ -41,10 +41,6 @@ pcm.!dmix { +@@ -48,10 +48,6 @@ pcm.!dmix { @func refer name defaults.pcm.ipc_key } @@ -28,7 +28,7 @@ index e62cb29..a005488 100644 @func refer name defaults.pcm.ipc_perm diff --git a/src/conf/pcm/dsnoop.conf b/src/conf/pcm/dsnoop.conf -index 49cfca9..842e1fb 100644 +index abbd44f7..528fb6ad 100644 --- a/src/conf/pcm/dsnoop.conf +++ b/src/conf/pcm/dsnoop.conf @@ -41,10 +41,6 @@ pcm.!dsnoop { diff --git a/alsa-lib.spec b/alsa-lib.spec index ad9da03..83c2d79 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -4,8 +4,8 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib -Version: 1.1.8 -Release: 2%{?prever_dot}%{?dist} +Version: 1.1.9 +Release: 1%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -13,8 +13,8 @@ Source: ftp://ftp.alsa-project.org/pub/lib/%{name}-%{version}%{?prever}%{?post Source10: asound.conf Source11: modprobe-dist-alsa.conf Source12: modprobe-dist-oss.conf -Patch0: alsa-git.patch -Patch1: alsa-lib-1.0.24-config.patch +#Patch0: alsa-git.patch +Patch1: alsa-lib-1.1.9-config.patch Patch2: alsa-lib-1.0.14-glibc-open.patch BuildRequires: doxygen @@ -60,7 +60,7 @@ contains alsa-lib configuration of SoC topology %prep %setup -q -n %{name}-%{version}%{?prever}%{?postver} -%patch0 -p1 -b .alsa-git +#%patch0 -p1 -b .alsa-git %patch1 -p1 -b .config %patch2 -p1 -b .glibc-open @@ -104,6 +104,9 @@ mkdir -p %{buildroot}/%{_datadir}/alsa/topology # Remove libtool archives. find %{buildroot} -name '*.la' -delete +# Remove /usr/include/asoundlib.h +rm %{buildroot}/%{_includedir}/asoundlib.h + %ldconfig_scriptlets %files @@ -134,6 +137,9 @@ find %{buildroot} -name '*.la' -delete %{_datadir}/alsa/topology %changelog +* Fri May 10 2019 Jaroslav Kysela - 1.1.9-1 +- Updated to 1.1.9 + * Thu Jan 31 2019 Fedora Release Engineering - 1.1.8-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild diff --git a/sources b/sources index 8b47b43..d98b561 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (alsa-lib-1.1.8.tar.bz2) = 50ae107c6efe8200b4c41e0463e099d16e149332f1d3a22c3e81d3e7d980b7f93f3610fc9711ef62067caeb1054e7ea612ba3903bf8a91ebeffa48687cf80eed +SHA512 (alsa-lib-1.1.9.tar.bz2) = 402e39cca82d17555e3e52ef06b8ed9dcf58531da393809a7b5cf18658299fa90ee8a60bfc5213482d7a02b13140c441f1333b144556f44ab4adb786a2fb3c49 From 5a37d4cfd71d9719ffb081f8d69abd79fd8d5213 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 24 Jul 2019 17:47:39 +0000 Subject: [PATCH 019/120] - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- alsa-lib.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 83c2d79..4cf36ea 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -5,7 +5,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: 1.1.9 -Release: 1%{?prever_dot}%{?dist} +Release: 2%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -137,6 +137,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Wed Jul 24 2019 Fedora Release Engineering - 1.1.9-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + * Fri May 10 2019 Jaroslav Kysela - 1.1.9-1 - Updated to 1.1.9 From df1ce312c51ea58e2733db4f9bdcb91c7015b732 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 13 Nov 2019 16:14:16 +0100 Subject: [PATCH 020/120] updated to 1.2.1 --- .gitignore | 2 ++ alsa-lib.spec | 33 ++++++++++++++++++++++++++++----- sources | 4 +++- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index f2c97a9..164c3cd 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ /alsa-lib-1.*.tar.bz2 +/alsa-topology-conf-1.2.1.tar.bz2 +/alsa-ucm-conf-1.2.1.tar.bz2 diff --git a/alsa-lib.spec b/alsa-lib.spec index 4cf36ea..4900974 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -2,14 +2,20 @@ #define prever_dot .rc3 #define postver a +%define version_alsa_lib 1.2.1 +%define version_alsa_ucm 1.2.1 +%define version_alsa_tplg 1.2.1 + Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib -Version: 1.1.9 -Release: 2%{?prever_dot}%{?dist} +Version: %{version_alsa_lib} +Release: 1%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/lib/%{name}-%{version}%{?prever}%{?postver}.tar.bz2 +Source1: ftp://ftp.alsa-project.org/pub/lib/alsa-ucm-conf-%{version_alsa_ucm}.tar.bz2 +Source2: ftp://ftp.alsa-project.org/pub/lib/alsa-topology-conf-%{version_alsa_tplg}.tar.bz2 Source10: asound.conf Source11: modprobe-dist-alsa.conf Source12: modprobe-dist-oss.conf @@ -43,7 +49,7 @@ against the ALSA libraries and interfaces. %package -n alsa-ucm Summary: ALSA Use Case Manager configuration BuildArch: noarch -Requires: %{name} = %{version}-%{release} +Requires: %{name} >= %{version_alsa_ucm} %description -n alsa-ucm The Advanced Linux Sound Architecture (ALSA) Use Case Manager configuration @@ -52,7 +58,7 @@ contains alsa-lib configuration of Audio input/output names and routing %package -n alsa-topology Summary: ALSA Topology configuration BuildArch: noarch -Requires: %{name} = %{version}-%{release} +Requires: %{name} >= %{version_alsa_tplg} %description -n alsa-topology The Advanced Linux Sound Architecture (ALSA) topology configuration @@ -84,6 +90,8 @@ make DESTDIR=%{buildroot} install mkdir -p %{buildroot}/%{_lib} mv %{buildroot}%{_libdir}/libasound.so.* %{buildroot}/%{_lib} ln -snf ../../%{_lib}/libasound.so.2 %{buildroot}%{_libdir}/libasound.so +mv %{buildroot}%{_libdir}/libatopology.so.* %{buildroot}/%{_lib} +ln -snf ../../%{_lib}/libatopology.so.2 %{buildroot}%{_libdir}/libatopology.so # Install global configuration files mkdir -p -m 755 %{buildroot}/etc @@ -95,12 +103,19 @@ install -p -m 644 %{SOURCE11} %{buildroot}%{sysmodprobedir}/dist-alsa.conf # bug#926973, place this file to the doc directory install -p -m 644 %{SOURCE12} . -# Create UCM directory +# Create UCM directories mkdir -p %{buildroot}/%{_datadir}/alsa/ucm +mkdir -p %{buildroot}/%{_datadir}/alsa/ucm2 + +# Unpack UCMs +tar xvJf %{SOURCE1} -C %{buildroot}/%{_datadir}/alsa ucm ucm2 # Create topology directory mkdir -p %{buildroot}/%{_datadir}/alsa/topology +# Unpack topologies +tar xvJf %{SOURCE2} -C %{buildroot}/%{_datadir}/alsa topology + # Remove libtool archives. find %{buildroot} -name '*.la' -delete @@ -115,10 +130,12 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %doc doc/asoundrc.txt modprobe-dist-oss.conf %config %{_sysconfdir}/asound.conf /%{_lib}/libasound.so.* +/%{_lib}/libatopology.so.* %{_bindir}/aserver #{_libdir}/alsa-lib/ %{_datadir}/alsa/ %exclude %{_datadir}/alsa/ucm +%exclude %{_datadir}/alsa/ucm2 %exclude %{_datadir}/alsa/topology %{sysmodprobedir}/dist-* @@ -127,16 +144,22 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_includedir}/alsa/ %{_includedir}/sys/asoundlib.h %{_libdir}/libasound.so +%{_libdir}/libatopology.so %{_libdir}/pkgconfig/alsa.pc +%{_libdir}/pkgconfig/alsa-topology.pc %{_datadir}/aclocal/alsa.m4 %files -n alsa-ucm %{_datadir}/alsa/ucm +%{_datadir}/alsa/ucm2 %files -n alsa-topology %{_datadir}/alsa/topology %changelog +* Wed Nov 13 2019 Jaroslav Kysela - 1.2.1-1 +- Updated to 1.2.1 + * Wed Jul 24 2019 Fedora Release Engineering - 1.1.9-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild diff --git a/sources b/sources index d98b561..05c95a3 100644 --- a/sources +++ b/sources @@ -1 +1,3 @@ -SHA512 (alsa-lib-1.1.9.tar.bz2) = 402e39cca82d17555e3e52ef06b8ed9dcf58531da393809a7b5cf18658299fa90ee8a60bfc5213482d7a02b13140c441f1333b144556f44ab4adb786a2fb3c49 +SHA512 (alsa-lib-1.2.1.tar.bz2) = 3bc0eef8eb0e16a521781ee4303df7b9c313432f174625fa77d54ed1650ced74efa47e215d26f94af36a1a275bb9975a9c51a51983b5303de1b19bf562bc1dd9 +SHA512 (alsa-ucm-conf-1.2.1.tar.bz2) = f86b94f8b5309f06a4aa9aecdd586cd69c618eedae7914857cf2ee4292fe1ce826781da636e53a0a8206ac78315e6b248cba8111f1647ca075ea60224b41efd9 +SHA512 (alsa-topology-conf-1.2.1.tar.bz2) = 2a17493ba563ee45362e4d2e63fd432d63aed0c817cb42d204d64924f12451d7a03dfa947edf4eb1b644c42c93e15c5d4d4e19d8b942db6a847cfd104ba4ec73 From 47b7323709fb53bddb7634aba672f6c3560f6a1c Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 13 Nov 2019 17:27:51 +0100 Subject: [PATCH 021/120] improve .gitignore for ucm/topology tar balls --- .gitignore | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 164c3cd..19dc3be 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ /alsa-lib-1.*.tar.bz2 -/alsa-topology-conf-1.2.1.tar.bz2 -/alsa-ucm-conf-1.2.1.tar.bz2 +/alsa-topology-conf-1.*.tar.bz2 +/alsa-ucm-conf-1.*.tar.bz2 From 2c612e6db8934360b0dbeda9145380059ec8bce2 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 14 Nov 2019 13:15:20 +0100 Subject: [PATCH 022/120] fix the license for alsa-ucm and alsa-topology packages (BSD) --- alsa-lib.spec | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/alsa-lib.spec b/alsa-lib.spec index 4900974..26a4dc9 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -49,6 +49,7 @@ against the ALSA libraries and interfaces. %package -n alsa-ucm Summary: ALSA Use Case Manager configuration BuildArch: noarch +License: BSD Requires: %{name} >= %{version_alsa_ucm} %description -n alsa-ucm @@ -58,6 +59,7 @@ contains alsa-lib configuration of Audio input/output names and routing %package -n alsa-topology Summary: ALSA Topology configuration BuildArch: noarch +License: BSD Requires: %{name} >= %{version_alsa_tplg} %description -n alsa-topology @@ -150,10 +152,12 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/aclocal/alsa.m4 %files -n alsa-ucm +# BSD %{_datadir}/alsa/ucm %{_datadir}/alsa/ucm2 %files -n alsa-topology +# BSD %{_datadir}/alsa/topology %changelog From fdad002f5cf9b8daa9a8cbcf75080dd2630f7164 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 14 Nov 2019 18:18:51 +0100 Subject: [PATCH 023/120] replaced source files --- alsa-lib.spec | 4 ++-- sources | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 26a4dc9..55de115 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 1%{?prever_dot}%{?dist} +Release: 3%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -161,7 +161,7 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog -* Wed Nov 13 2019 Jaroslav Kysela - 1.2.1-1 +* Wed Nov 13 2019 Jaroslav Kysela - 1.2.1-3 - Updated to 1.2.1 * Wed Jul 24 2019 Fedora Release Engineering - 1.1.9-2 diff --git a/sources b/sources index 05c95a3..83ebb1a 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (alsa-lib-1.2.1.tar.bz2) = 3bc0eef8eb0e16a521781ee4303df7b9c313432f174625fa77d54ed1650ced74efa47e215d26f94af36a1a275bb9975a9c51a51983b5303de1b19bf562bc1dd9 -SHA512 (alsa-ucm-conf-1.2.1.tar.bz2) = f86b94f8b5309f06a4aa9aecdd586cd69c618eedae7914857cf2ee4292fe1ce826781da636e53a0a8206ac78315e6b248cba8111f1647ca075ea60224b41efd9 +SHA512 (alsa-lib-1.2.1.tar.bz2) = a5bd60ed0cfca3911db534364554412c479d2cb6ded6c8e7011d2510797a6cbd10613d6e1d42cb589afec8e7408c8fd5465360ddd14df8701af7dc414961c19e +SHA512 (alsa-ucm-conf-1.2.1.tar.bz2) = 277e335fff02973628454aca4c8e275e49965cfe1b4a0bc7a6c4833ea14537b39f8175dd0c974577aa98c95e4f7f0981078d70f8a5f083f7c15ab2445f851255 SHA512 (alsa-topology-conf-1.2.1.tar.bz2) = 2a17493ba563ee45362e4d2e63fd432d63aed0c817cb42d204d64924f12451d7a03dfa947edf4eb1b644c42c93e15c5d4d4e19d8b942db6a847cfd104ba4ec73 From eedc42cda2de5b7bcd7b8c26b0efd189571cc5fc Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 19 Nov 2019 16:31:15 +0100 Subject: [PATCH 024/120] updated to 1.2.1.1 --- alsa-lib.spec | 7 +++++-- sources | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 55de115..448a2d8 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -2,14 +2,14 @@ #define prever_dot .rc3 #define postver a -%define version_alsa_lib 1.2.1 +%define version_alsa_lib 1.2.1.1 %define version_alsa_ucm 1.2.1 %define version_alsa_tplg 1.2.1 Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 3%{?prever_dot}%{?dist} +Release: 1%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -161,6 +161,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Tue Nov 19 2019 Jaroslav Kysela - 1.2.1.1-1 +- Updated to 1.2.1.1 + * Wed Nov 13 2019 Jaroslav Kysela - 1.2.1-3 - Updated to 1.2.1 diff --git a/sources b/sources index 83ebb1a..9d65dc2 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (alsa-lib-1.2.1.tar.bz2) = a5bd60ed0cfca3911db534364554412c479d2cb6ded6c8e7011d2510797a6cbd10613d6e1d42cb589afec8e7408c8fd5465360ddd14df8701af7dc414961c19e +SHA512 (alsa-lib-1.2.1.1.tar.bz2) = 8a0b6f1ecc58d60991b4509e791b1581eebae57cd754b0b4829e66b1cfee81d588b04f42a17f598f06310b9658d9f46fd748cca516cc48b6f2989389c22c42e9 SHA512 (alsa-ucm-conf-1.2.1.tar.bz2) = 277e335fff02973628454aca4c8e275e49965cfe1b4a0bc7a6c4833ea14537b39f8175dd0c974577aa98c95e4f7f0981078d70f8a5f083f7c15ab2445f851255 SHA512 (alsa-topology-conf-1.2.1.tar.bz2) = 2a17493ba563ee45362e4d2e63fd432d63aed0c817cb42d204d64924f12451d7a03dfa947edf4eb1b644c42c93e15c5d4d4e19d8b942db6a847cfd104ba4ec73 From c4ac9c1e91ac739299fae10493875ccf13f56d09 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 29 Nov 2019 16:44:49 +0100 Subject: [PATCH 025/120] updated to 1.2.1.2 --- alsa-lib.spec | 11 +++++++---- sources | 4 +++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 448a2d8..5dd6dd9 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -2,8 +2,8 @@ #define prever_dot .rc3 #define postver a -%define version_alsa_lib 1.2.1.1 -%define version_alsa_ucm 1.2.1 +%define version_alsa_lib 1.2.1.2 +%define version_alsa_ucm 1.2.1.2 %define version_alsa_tplg 1.2.1 Summary: The Advanced Linux Sound Architecture (ALSA) library @@ -110,13 +110,13 @@ mkdir -p %{buildroot}/%{_datadir}/alsa/ucm mkdir -p %{buildroot}/%{_datadir}/alsa/ucm2 # Unpack UCMs -tar xvJf %{SOURCE1} -C %{buildroot}/%{_datadir}/alsa ucm ucm2 +tar xvjf %{SOURCE1} -C %{buildroot}/%{_datadir}/alsa ucm ucm2 # Create topology directory mkdir -p %{buildroot}/%{_datadir}/alsa/topology # Unpack topologies -tar xvJf %{SOURCE2} -C %{buildroot}/%{_datadir}/alsa topology +tar xvjf %{SOURCE2} -C %{buildroot}/%{_datadir}/alsa topology # Remove libtool archives. find %{buildroot} -name '*.la' -delete @@ -161,6 +161,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Fri Nov 29 2019 Jaroslav Kysela - 1.2.1.2-1 +- Updated to 1.2.1.2 + * Tue Nov 19 2019 Jaroslav Kysela - 1.2.1.1-1 - Updated to 1.2.1.1 diff --git a/sources b/sources index 9d65dc2..01cab82 100644 --- a/sources +++ b/sources @@ -1,3 +1,5 @@ SHA512 (alsa-lib-1.2.1.1.tar.bz2) = 8a0b6f1ecc58d60991b4509e791b1581eebae57cd754b0b4829e66b1cfee81d588b04f42a17f598f06310b9658d9f46fd748cca516cc48b6f2989389c22c42e9 SHA512 (alsa-ucm-conf-1.2.1.tar.bz2) = 277e335fff02973628454aca4c8e275e49965cfe1b4a0bc7a6c4833ea14537b39f8175dd0c974577aa98c95e4f7f0981078d70f8a5f083f7c15ab2445f851255 -SHA512 (alsa-topology-conf-1.2.1.tar.bz2) = 2a17493ba563ee45362e4d2e63fd432d63aed0c817cb42d204d64924f12451d7a03dfa947edf4eb1b644c42c93e15c5d4d4e19d8b942db6a847cfd104ba4ec73 +SHA512 (alsa-topology-conf-1.2.1.tar.bz2) = 3480e58f12aeca04b0c1821e074daeb369949acbcf7bc61b09895ee43de84cb716566518a56a4d681babbb3f13faace5a16fff079d8bdaefc7c27fc1382cd41a +SHA512 (alsa-ucm-conf-1.2.1.2.tar.bz2) = e498c4355a765eb6ecd03f03611c8904f757bf73619a3c8159c044f80a4c3ab5cbd343692c227e13c6da307fc2e35259b4726902d3ab8e03eff11aa1c74027d5 +SHA512 (alsa-lib-1.2.1.2.tar.bz2) = e8286fd55f63ee0d95513279d0885c287533de89b7af6c338413dec5d38ba4f5a15da1a4a4ce36e052614e4b730e3778782dab9979d82958283be17b48604913 From 212f5ac0a9ef52603e1f13300ac3b6292b9c1f6d Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 3 Dec 2019 21:01:13 +0100 Subject: [PATCH 026/120] UCM2 fixes from upstream --- alsa-git.patch | 773 +++++++++++++++++++++++++++++++++++++++++++++++++ alsa-lib.spec | 5 +- 2 files changed, 777 insertions(+), 1 deletion(-) diff --git a/alsa-git.patch b/alsa-git.patch index e69de29..d59cdc5 100644 --- a/alsa-git.patch +++ b/alsa-git.patch @@ -0,0 +1,773 @@ +From c79f09e1f5e8b559b58dacdb00708d995b2e3aa5 Mon Sep 17 00:00:00 2001 +From: paulhsia +Date: Sat, 30 Nov 2019 03:35:30 +0800 +Subject: [PATCH 01/10] ucm: Use strncmp to avoid access-out-of-boundary + +If the length of the identifier is less than the length of the prefix, +access-out-of-boundary will occur in memcmp(). + +Signed-off-by: paulhsia +Signed-off-by: Jaroslav Kysela +--- + src/ucm/main.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/src/ucm/main.c b/src/ucm/main.c +index b0b6ffb3..252e50d9 100644 +--- a/src/ucm/main.c ++++ b/src/ucm/main.c +@@ -61,11 +61,13 @@ static int check_identifier(const char *identifier, const char *prefix) + { + int len; + +- if (strcmp(identifier, prefix) == 0) +- return 1; + len = strlen(prefix); +- if (memcmp(identifier, prefix, len) == 0 && identifier[len] == '/') ++ if (strncmp(identifier, prefix, len) != 0) ++ return 0; ++ ++ if (identifier[len] == 0 || identifier[len] == '/') + return 1; ++ + return 0; + } + +-- +2.20.1 + + +From 9baf64da2f26844434ecea4825052937a3abe06c Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 29 Nov 2019 22:28:26 +0100 +Subject: [PATCH 02/10] ucm: return always at least NULL if no list is + available in snd_use_case_get_list() + +Signed-off-by: Jaroslav Kysela +--- + src/ucm/main.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/src/ucm/main.c b/src/ucm/main.c +index 252e50d9..b80db65f 100644 +--- a/src/ucm/main.c ++++ b/src/ucm/main.c +@@ -1160,8 +1160,10 @@ static int get_supcon_device_list(snd_use_case_mgr_t *uc_mgr, + + modifier = find_modifier(uc_mgr, verb, name, 0); + if (modifier) { +- if (modifier->dev_list.type != type) ++ if (modifier->dev_list.type != type) { ++ *list = NULL; + return 0; ++ } + return get_list(&modifier->dev_list.list, list, + struct dev_list_node, list, + name); +@@ -1169,8 +1171,10 @@ static int get_supcon_device_list(snd_use_case_mgr_t *uc_mgr, + + device = find_device(uc_mgr, verb, name, 0); + if (device) { +- if (device->dev_list.type != type) ++ if (device->dev_list.type != type) { ++ *list = NULL; + return 0; ++ } + return get_list(&device->dev_list.list, list, + struct dev_list_node, list, + name); +-- +2.20.1 + + +From ebdd2b6cdb8119cf75f0dd0a3b283d271b3a547e Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Sat, 30 Nov 2019 20:31:55 +0100 +Subject: [PATCH 03/10] ucm: add _identifiers list + +Signed-off-by: Jaroslav Kysela +--- + include/use-case.h | 1 + + src/ucm/main.c | 268 ++++++++++++++++++++++++++++++++++----------- + 2 files changed, 208 insertions(+), 61 deletions(-) + +diff --git a/include/use-case.h b/include/use-case.h +index 8e7e838c..85c58ac0 100644 +--- a/include/use-case.h ++++ b/include/use-case.h +@@ -206,6 +206,7 @@ int snd_use_case_free_list(const char *list[], int items); + * - _enadevs - get list of enabled devices + * - _enamods - get list of enabled modifiers + * ++ * - _identifiers/{modifier}|{device}[/{verb}] - list of value identifiers + * - _supporteddevs/{modifier}|{device}[/{verb}] - list of supported devices + * - _conflictingdevs/{modifier}|{device}[/{verb}] - list of conflicting devices + * +diff --git a/src/ucm/main.c b/src/ucm/main.c +index b80db65f..d2078a23 100644 +--- a/src/ucm/main.c ++++ b/src/ucm/main.c +@@ -1072,7 +1072,6 @@ int snd_use_case_mgr_reset(snd_use_case_mgr_t *uc_mgr) + /** + * \brief Get list of verbs in pair verbname+comment + * \param list Returned list +- * \param verbname For verb (NULL = current) + * \return Number of list entries if success, otherwise a negative error code + */ + static int get_verb_list(snd_use_case_mgr_t *uc_mgr, const char **list[]) +@@ -1181,7 +1180,6 @@ static int get_supcon_device_list(snd_use_case_mgr_t *uc_mgr, + } + + return -ENOENT; +- + } + + /** +@@ -1210,41 +1208,201 @@ static int get_conflicting_device_list(snd_use_case_mgr_t *uc_mgr, + + #ifndef DOC_HIDDEN + struct myvalue { +- struct list_head list; +- char *value; ++ struct list_head list; ++ const char *text; + }; + #endif + ++/** ++ * \brief Convert myvalue list string list ++ * \param list myvalue list ++ * \param res string list ++ * \retval Number of list entries if success, otherwise a negativer error code ++ */ ++static int myvalue_to_str_list(struct list_head *list, char ***res) ++{ ++ struct list_head *pos; ++ struct myvalue *value; ++ char **p; ++ int cnt; ++ ++ cnt = alloc_str_list(list, 1, res); ++ if (cnt < 0) ++ return cnt; ++ p = *res; ++ list_for_each(pos, list) { ++ value = list_entry(pos, struct myvalue, list); ++ *p = strdup(value->text); ++ if (*p == NULL) { ++ snd_use_case_free_list((const char **)p, cnt); ++ return -ENOMEM; ++ } ++ p++; ++ } ++ return cnt; ++} ++ ++/** ++ * \brief Free myvalue list ++ * \param list myvalue list ++ */ ++static void myvalue_list_free(struct list_head *list) ++{ ++ struct list_head *pos, *npos; ++ struct myvalue *value; ++ ++ list_for_each_safe(pos, npos, list) { ++ value = list_entry(pos, struct myvalue, list); ++ list_del(&value->list); ++ free(value); ++ } ++} ++ ++/** ++ * \brief Merge one value to the myvalue list ++ * \param list The list with values ++ * \param value The value to be merged (without duplicates) ++ * \return 1 if dup, 0 if success, otherwise a negative error code ++ */ ++static int merge_value(struct list_head *list, const char *text) ++{ ++ struct list_head *pos; ++ struct myvalue *value; ++ ++ list_for_each(pos, list) { ++ value = list_entry(pos, struct myvalue, list); ++ if (strcmp(value->text, text) == 0) ++ return 1; ++ } ++ value = malloc(sizeof(*value)); ++ if (value == NULL) ++ return -ENOMEM; ++ value->text = text; ++ list_add_tail(&value->list, list); ++ return 0; ++} ++ ++/** ++ * \brief Find all values for given identifier ++ * \param list Returned list ++ * \param source Source list with ucm_value structures ++ * \return Zero if success, otherwise a negative error code ++ */ ++static int add_identifiers(struct list_head *list, ++ struct list_head *source) ++{ ++ struct ucm_value *v; ++ struct list_head *pos; ++ int err; ++ ++ list_for_each(pos, source) { ++ v = list_entry(pos, struct ucm_value, list); ++ err = merge_value(list, v->name); ++ if (err < 0) ++ return err; ++ } ++ return 0; ++} ++ ++/** ++ * \brief Find all values for given identifier ++ * \param list Returned list ++ * \param identifier Identifier ++ * \param source Source list with ucm_value structures ++ */ + static int add_values(struct list_head *list, + const char *identifier, + struct list_head *source) + { +- struct ucm_value *v; +- struct myvalue *val; +- struct list_head *pos, *pos1; +- int match; ++ struct ucm_value *v; ++ struct list_head *pos; ++ int err; + +- list_for_each(pos, source) { +- v = list_entry(pos, struct ucm_value, list); +- if (check_identifier(identifier, v->name)) { +- match = 0; +- list_for_each(pos1, list) { +- val = list_entry(pos1, struct myvalue, list); +- if (strcmp(val->value, v->data) == 0) { +- match = 1; +- break; +- } +- } +- if (!match) { +- val = malloc(sizeof(struct myvalue)); +- if (val == NULL) +- return -ENOMEM; +- val->value = v->data; +- list_add_tail(&val->list, list); +- } +- } +- } +- return 0; ++ list_for_each(pos, source) { ++ v = list_entry(pos, struct ucm_value, list); ++ if (check_identifier(identifier, v->name)) { ++ err = merge_value(list, v->data); ++ if (err < 0) ++ return err; ++ } ++ } ++ return 0; ++} ++ ++/** ++ * \brief compare two identifiers ++ */ ++static int identifier_cmp(const void *_a, const void *_b) ++{ ++ const char * const *a = _a; ++ const char * const *b = _b; ++ return strcmp(*a, *b); ++} ++ ++/** ++ * \brief Get list of available identifiers ++ * \param list Returned list ++ * \param name Name of verb or modifier to query ++ * \return Number of list entries if success, otherwise a negative error code ++ */ ++static int get_identifiers_list(snd_use_case_mgr_t *uc_mgr, ++ const char **list[], char *name) ++{ ++ struct use_case_verb *verb; ++ struct use_case_modifier *modifier; ++ struct use_case_device *device; ++ struct list_head mylist; ++ struct list_head *value_list; ++ char *str, **res; ++ int err; ++ ++ if (!name) ++ return -ENOENT; ++ ++ str = strchr(name, '/'); ++ if (str) { ++ *str = '\0'; ++ verb = find_verb(uc_mgr, str + 1); ++ } ++ else { ++ verb = uc_mgr->active_verb; ++ } ++ if (!verb) ++ return -ENOENT; ++ ++ value_list = NULL; ++ modifier = find_modifier(uc_mgr, verb, name, 0); ++ if (modifier) { ++ value_list = &modifier->value_list; ++ } else { ++ device = find_device(uc_mgr, verb, name, 0); ++ if (device) ++ value_list = &device->value_list; ++ } ++ if (value_list == NULL) ++ return -ENOENT; ++ ++ INIT_LIST_HEAD(&mylist); ++ err = add_identifiers(&mylist, &uc_mgr->value_list); ++ if (err < 0) ++ goto __fail; ++ err = add_identifiers(&mylist, &verb->value_list); ++ if (err < 0) ++ goto __fail; ++ err = add_identifiers(&mylist, value_list); ++ if (err < 0) ++ goto __fail; ++ err = myvalue_to_str_list(&mylist, &res); ++ if (err > 0) ++ *list = (const char **)res; ++ else if (err == 0) ++ *list = NULL; ++__fail: ++ myvalue_list_free(&mylist); ++ if (err <= 0) ++ return err; ++ qsort(*list, err, sizeof(char *), identifier_cmp); ++ return err; + } + + /** +@@ -1258,8 +1416,7 @@ static int get_value_list(snd_use_case_mgr_t *uc_mgr, + const char **list[], + char *verbname) + { +- struct list_head mylist, *pos, *npos; +- struct myvalue *val; ++ struct list_head mylist, *pos; + struct use_case_verb *verb; + struct use_case_device *dev; + struct use_case_modifier *mod; +@@ -1292,26 +1449,13 @@ static int get_value_list(snd_use_case_mgr_t *uc_mgr, + if (err < 0) + goto __fail; + } +- err = alloc_str_list(&mylist, 1, &res); +- if (err >= 0) { ++ err = myvalue_to_str_list(&mylist, &res); ++ if (err > 0) + *list = (const char **)res; +- list_for_each(pos, &mylist) { +- val = list_entry(pos, struct myvalue, list); +- *res = strdup(val->value); +- if (*res == NULL) { +- snd_use_case_free_list((const char **)res, err); +- err = -ENOMEM; +- goto __fail; +- } +- res++; +- } +- } ++ else if (err == 0) ++ *list = NULL; + __fail: +- list_for_each_safe(pos, npos, &mylist) { +- val = list_entry(pos, struct myvalue, list); +- list_del(&val->list); +- free(val); +- } ++ myvalue_list_free(&mylist); + return err; + } + +@@ -1381,21 +1525,23 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, + } else { + str = NULL; + } +- if (check_identifier(identifier, "_devices")) +- err = get_device_list(uc_mgr, list, str); ++ if (check_identifier(identifier, "_devices")) ++ err = get_device_list(uc_mgr, list, str); + else if (check_identifier(identifier, "_modifiers")) +- err = get_modifier_list(uc_mgr, list, str); +- else if (check_identifier(identifier, "_supporteddevs")) +- err = get_supported_device_list(uc_mgr, list, str); +- else if (check_identifier(identifier, "_conflictingdevs")) +- err = get_conflicting_device_list(uc_mgr, list, str); ++ err = get_modifier_list(uc_mgr, list, str); ++ else if (check_identifier(identifier, "_identifiers")) ++ err = get_identifiers_list(uc_mgr, list, str); ++ else if (check_identifier(identifier, "_supporteddevs")) ++ err = get_supported_device_list(uc_mgr, list, str); ++ else if (check_identifier(identifier, "_conflictingdevs")) ++ err = get_conflicting_device_list(uc_mgr, list, str); + else if (identifier[0] == '_') + err = -ENOENT; +- else +- err = get_value_list(uc_mgr, identifier, list, str); +- if (str) +- free(str); +- } ++ else ++ err = get_value_list(uc_mgr, identifier, list, str); ++ if (str) ++ free(str); ++ } + __end: + pthread_mutex_unlock(&uc_mgr->mutex); + return err; +-- +2.20.1 + + +From 5ee5ef31b5ff3fb7c904054cb9cac7478a727f7c Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Sun, 1 Dec 2019 14:26:40 +0100 +Subject: [PATCH 04/10] namehint: correct the @args check + +BugLink: https://github.com/alsa-project/alsa-plugins/issues/3 +Signed-off-by: Jaroslav Kysela +--- + src/control/namehint.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/src/control/namehint.c b/src/control/namehint.c +index 808df6b5..4927ef97 100644 +--- a/src/control/namehint.c ++++ b/src/control/namehint.c +@@ -348,6 +348,12 @@ static int try_config(snd_config_t *config, + goto __cleanup; + if (snd_config_search(res, "@args", &cfg) >= 0) { + snd_config_for_each(i, next, cfg) { ++ /* skip the argument list */ ++ snd_config_get_id(snd_config_iterator_entry(i), &str); ++ while (*str && *str >= '0' && *str <= '9') str++; ++ if (*str == '\0') ++ continue; ++ /* the argument definition must have the default */ + if (snd_config_search(snd_config_iterator_entry(i), + "default", NULL) < 0) { + err = -EINVAL; +-- +2.20.1 + + +From 6055f8a584296abfc0cec0439ceb708f0eddcc9d Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Sun, 1 Dec 2019 14:30:54 +0100 +Subject: [PATCH 05/10] namehint: improve the previous patch (check the + returned value) + +Signed-off-by: Jaroslav Kysela +--- + src/control/namehint.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/control/namehint.c b/src/control/namehint.c +index 4927ef97..60c48ae3 100644 +--- a/src/control/namehint.c ++++ b/src/control/namehint.c +@@ -349,7 +349,8 @@ static int try_config(snd_config_t *config, + if (snd_config_search(res, "@args", &cfg) >= 0) { + snd_config_for_each(i, next, cfg) { + /* skip the argument list */ +- snd_config_get_id(snd_config_iterator_entry(i), &str); ++ if (snd_config_get_id(snd_config_iterator_entry(i), &str) < 0) ++ continue; + while (*str && *str >= '0' && *str <= '9') str++; + if (*str == '\0') + continue; +-- +2.20.1 + + +From 4dddcf733d56a13f4d042fefa1fb6230c09f1f65 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 2 Dec 2019 11:56:30 +0100 +Subject: [PATCH 06/10] ucm: docs - allow spaces in device names for JackHWMute + +Signed-off-by: Jaroslav Kysela +--- + include/use-case.h | 25 +++++++++++++------------ + 1 file changed, 13 insertions(+), 12 deletions(-) + +diff --git a/include/use-case.h b/include/use-case.h +index 85c58ac0..e1f58027 100644 +--- a/include/use-case.h ++++ b/include/use-case.h +@@ -326,7 +326,7 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, + * - Valid values: "soft" (software attenuation) + * - EDIDFile + * - Path to EDID file for HDMI devices +- * - JackControl, JackDev, JackHWMute ++ * - JackControl, JackDev + * - Jack information for a device. The jack status can be reported via + * a kcontrol and/or via an input device. **JackControl** is the + * kcontrol name of the jack, and **JackDev** is the input device id of +@@ -334,17 +334,18 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, + * JackDev value should be "foo"). UCM configuration files should + * contain both JackControl and JackDev when possible, because + * applications are likely to support only one or the other. +- * +- * If **JackHWMute** is set, it indicates that when the jack is plugged +- * in, the hardware automatically mutes some other device(s). The +- * JackHWMute value is a space-separated list of device names (this +- * isn't compatible with device names with spaces in them, so don't use +- * such device names!). Note that JackHWMute should be used only when +- * the hardware enforces the automatic muting. If the hardware doesn't +- * enforce any muting, it may still be tempting to set JackHWMute to +- * trick upper software layers to e.g. automatically mute speakers when +- * headphones are plugged in, but that's application policy +- * configuration that doesn't belong to UCM configuration files. ++ * - JackHWMute ++ * If this value is set, it indicates that when the jack is plugged ++ * in, the hardware automatically mutes some other device(s). The ++ * value is a space-separated list of device names. If the device ++ * name contains space, it must be enclosed to ' or ", e.g.: ++ * JackHWMute "'Dock Headphone' Headphone" ++ * Note that JackHWMute should be used only when the hardware enforces ++ * the automatic muting. If the hardware doesn't enforce any muting, it ++ * may still be tempting to set JackHWMute to trick upper software layers ++ * to e.g. automatically mute speakers when headphones are plugged in, ++ * but that's application policy configuration that doesn't belong ++ * to UCM configuration files. + * - MinBufferLevel + * - This is used on platform where reported buffer level is not accurate. + * E.g. "512", which holds 512 samples in device buffer. Note: this will +-- +2.20.1 + + +From 2a286ca9a8415571181ce58027686ec332a834e9 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 2 Dec 2019 11:57:18 +0100 +Subject: [PATCH 07/10] use-case: docs - add PlaybackMixerCopy and + CaptureMixerCopy + +Signed-off-by: Jaroslav Kysela +--- + include/use-case.h | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/include/use-case.h b/include/use-case.h +index e1f58027..71fcc949 100644 +--- a/include/use-case.h ++++ b/include/use-case.h +@@ -309,8 +309,14 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, + * - PlaybackMixerElem + * - mixer element playback identifier + * - can be parsed using snd_use_case_parse_selem_id() ++ * - PlaybackMixerCopy ++ * - additional mixer element playback identifier ++ * - can be parsed using snd_use_case_parse_selem_id() ++ * - those elements should copy the volume and switch settings ++ * - element identifiers are separated using the | character + * - PlaybackMasterElem + * - mixer element playback identifier for the master control ++ * - can be parsed using snd_use_case_parse_selem_id() + * - PlaybackMasterType + * - type of the master volume control + * - Valid values: "soft" (software attenuation) +@@ -319,8 +325,14 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, + * - CaptureMixerElem + * - mixer element capture identifier + * - can be parsed using snd_use_case_parse_selem_id() ++ * - CaptureMixerCopy ++ * - additional mixer element capture identifier ++ * - can be parsed using snd_use_case_parse_selem_id() ++ * - those elements should copy the volume and switch settings ++ * - element identifiers are separated using the | character + * - CaptureMasterElem + * - mixer element playback identifier for the master control ++ * - can be parsed using snd_use_case_parse_selem_id() + * - CaptureMasterType + * - type of the master volume control + * - Valid values: "soft" (software attenuation) +-- +2.20.1 + + +From a0fc4447bb7c7f9a850a0a85f3a5a32c1509caf4 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 3 Dec 2019 15:01:04 +0100 +Subject: [PATCH 08/10] ucm: docs - add JackCTL, rearrange JackControl and + JackDev + +Signed-off-by: Jaroslav Kysela +--- + include/use-case.h | 22 ++++++++++++++-------- + 1 file changed, 14 insertions(+), 8 deletions(-) + +diff --git a/include/use-case.h b/include/use-case.h +index 71fcc949..25998cb9 100644 +--- a/include/use-case.h ++++ b/include/use-case.h +@@ -338,14 +338,20 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, + * - Valid values: "soft" (software attenuation) + * - EDIDFile + * - Path to EDID file for HDMI devices +- * - JackControl, JackDev +- * - Jack information for a device. The jack status can be reported via +- * a kcontrol and/or via an input device. **JackControl** is the +- * kcontrol name of the jack, and **JackDev** is the input device id of +- * the jack (if the full input device path is /dev/input/by-id/foo, the +- * JackDev value should be "foo"). UCM configuration files should +- * contain both JackControl and JackDev when possible, because +- * applications are likely to support only one or the other. ++ * - JackCTL ++ * - jack control device name ++ * - JackControl ++ * - jack control identificator ++ * - can be parsed using snd_use_case_parse_ctl_elem_id() ++ * - UCM configuration files should contain both JackControl and JackDev ++ * when possible, because applications are likely to support only one ++ * or the other ++ * - JackDev ++ * - the input device id of the jack (if the full input device path is ++ * /dev/input/by-id/foo, the JackDev value should be "foo") ++ * - UCM configuration files should contain both JackControl and JackDev ++ * when possible, because applications are likely to support only one ++ * or the other + * - JackHWMute + * If this value is set, it indicates that when the jack is plugged + * in, the hardware automatically mutes some other device(s). The +-- +2.20.1 + + +From e59034a0bec257cc7422a1e9436d936be8696a6f Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Tue, 3 Dec 2019 18:27:39 +0100 +Subject: [PATCH 09/10] ucm: Do not fail to parse configs on cards with an + empty CardComponents lists + +Since the UCM profiles for all Bay- and Cherry-Trail SST cards have been +moved over to UCM2, parsing them fails with: + +ALSA lib ucm_subs.c:220:(uc_mgr_get_substituted_value) variable '${CardComponents}' is not defined in this context! + +This completely breaks audio support on all Bay- and Cherry-Trail devices. + +This is caused by these non-SOF ASoC using cards having an empty +CardComponents list. Which in itself is fine, but is rejected by +the ucm_subs.c code. This commit changes the ucm_subs code to accept +an empty string as a valid value for CardComponents restoring audio +functionality on these boards. + +Signed-off-by: Hans de Goede +Signed-off-by: Jaroslav Kysela +--- + src/ucm/ucm_subs.c | 20 ++++++++++++-------- + 1 file changed, 12 insertions(+), 8 deletions(-) + +diff --git a/src/ucm/ucm_subs.c b/src/ucm/ucm_subs.c +index 00afa9e3..90e395f0 100644 +--- a/src/ucm/ucm_subs.c ++++ b/src/ucm/ucm_subs.c +@@ -25,6 +25,7 @@ + */ + + #include "ucm_local.h" ++#include + #include + #include + +@@ -145,10 +146,11 @@ static char *rval_sysfs(snd_use_case_mgr_t *uc_mgr ATTRIBUTE_UNUSED, const char + return strdup(path); + } + +-#define MATCH_VARIABLE(name, id, fcn) \ ++#define MATCH_VARIABLE(name, id, fcn, empty_ok) \ + if (strncmp((name), (id), sizeof(id) - 1) == 0) { \ + rval = fcn(uc_mgr); \ + idsize = sizeof(id) - 1; \ ++ allow_empty = (empty_ok); \ + goto __rval; \ + } + +@@ -189,12 +191,14 @@ int uc_mgr_get_substituted_value(snd_use_case_mgr_t *uc_mgr, + + while (*value) { + if (*value == '$' && *(value+1) == '{') { +- MATCH_VARIABLE(value, "${ConfName}", rval_conf_name); +- MATCH_VARIABLE(value, "${CardId}", rval_card_id); +- MATCH_VARIABLE(value, "${CardDriver}", rval_card_driver); +- MATCH_VARIABLE(value, "${CardName}", rval_card_name); +- MATCH_VARIABLE(value, "${CardLongName}", rval_card_longname); +- MATCH_VARIABLE(value, "${CardComponents}", rval_card_components); ++ bool allow_empty = false; ++ ++ MATCH_VARIABLE(value, "${ConfName}", rval_conf_name, false); ++ MATCH_VARIABLE(value, "${CardId}", rval_card_id, false); ++ MATCH_VARIABLE(value, "${CardDriver}", rval_card_driver, false); ++ MATCH_VARIABLE(value, "${CardName}", rval_card_name, false); ++ MATCH_VARIABLE(value, "${CardLongName}", rval_card_longname, false); ++ MATCH_VARIABLE(value, "${CardComponents}", rval_card_components, true); + MATCH_VARIABLE2(value, "${env:", rval_env); + MATCH_VARIABLE2(value, "${sys:", rval_sysfs); + err = -EINVAL; +@@ -208,7 +212,7 @@ int uc_mgr_get_substituted_value(snd_use_case_mgr_t *uc_mgr, + } + goto __error; + __rval: +- if (rval == NULL || rval[0] == '\0') { ++ if (rval == NULL || (!allow_empty && rval[0] == '\0')) { + free(rval); + strncpy(r, value, idsize); + r[idsize] = '\0'; +-- +2.20.1 + + +From 8e2c70add782f997f7c269ed3f722888e56ff024 Mon Sep 17 00:00:00 2001 +From: Fabrice Fontaine +Date: Tue, 3 Dec 2019 18:56:40 +0100 +Subject: [PATCH 10/10] src/ucm/main.c: fix build without mixer + +Commit 4ce38a5ff466d18039b2606938f866ea3a6c9f3c breaks the build without +mixer on: + + CCLD libasound.la +/home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/8.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: ucm/.libs/libucm.a(main.o): in function `snd_use_case_set': +main.c:(.text+0x185c): undefined reference to `snd_mixer_selem_id_parse' + +Fixes: http://autobuild.buildroot.org/results/4d91c9f82a2a61c50c457a851073b85cc09ea345 + +Signed-off-by: Fabrice Fontaine +Signed-off-by: Jaroslav Kysela +--- + src/ucm/main.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/ucm/main.c b/src/ucm/main.c +index d2078a23..61922f10 100644 +--- a/src/ucm/main.c ++++ b/src/ucm/main.c +@@ -2115,8 +2115,10 @@ int snd_use_case_parse_selem_id(snd_mixer_selem_id_t *dst, + const char *ucm_id, + const char *value) + { ++#ifdef BUILD_MIXER + if (strcmp(ucm_id, "PlaybackMixerId") == 0 || + strcmp(ucm_id, "CaptureMixerId") == 0) + return snd_mixer_selem_id_parse(dst, value); ++#endif + return -EINVAL; + } +-- +2.20.1 + diff --git a/alsa-lib.spec b/alsa-lib.spec index 5dd6dd9..4d4f398 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 1%{?prever_dot}%{?dist} +Release: 2%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -161,6 +161,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Tue Dec 3 2019 Jaroslav Kysela - 1.2.1.2-2 +- Fixed more UCM2 related issues + * Fri Nov 29 2019 Jaroslav Kysela - 1.2.1.2-1 - Updated to 1.2.1.2 From 04d13aff9a6d00006487b4c8e6194703c622bf2c Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 3 Dec 2019 21:15:52 +0100 Subject: [PATCH 027/120] UCM2 fixes, enable alsa-git.patch --- alsa-lib.spec | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 4d4f398..298e5ec 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 2%{?prever_dot}%{?dist} +Release: 3%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -19,7 +19,7 @@ Source2: ftp://ftp.alsa-project.org/pub/lib/alsa-topology-conf-%{version_alsa_t Source10: asound.conf Source11: modprobe-dist-alsa.conf Source12: modprobe-dist-oss.conf -#Patch0: alsa-git.patch +Patch0: alsa-git.patch Patch1: alsa-lib-1.1.9-config.patch Patch2: alsa-lib-1.0.14-glibc-open.patch @@ -68,7 +68,7 @@ contains alsa-lib configuration of SoC topology %prep %setup -q -n %{name}-%{version}%{?prever}%{?postver} -#%patch0 -p1 -b .alsa-git +%patch0 -p1 -b .alsa-git %patch1 -p1 -b .config %patch2 -p1 -b .glibc-open @@ -161,7 +161,7 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog -* Tue Dec 3 2019 Jaroslav Kysela - 1.2.1.2-2 +* Tue Dec 3 2019 Jaroslav Kysela - 1.2.1.2-3 - Fixed more UCM2 related issues * Fri Nov 29 2019 Jaroslav Kysela - 1.2.1.2-1 From c40825430a791aebdbc90e3c65b6407bdf6a5d0e Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 9 Dec 2019 13:42:45 +0100 Subject: [PATCH 028/120] UCM2 fixes for sof-hda-dsp --- alsa-lib.spec | 7 ++- alsa-ucm-conf.patch | 102 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 alsa-ucm-conf.patch diff --git a/alsa-lib.spec b/alsa-lib.spec index 298e5ec..cd8cd72 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 3%{?prever_dot}%{?dist} +Release: 4%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -19,6 +19,7 @@ Source2: ftp://ftp.alsa-project.org/pub/lib/alsa-topology-conf-%{version_alsa_t Source10: asound.conf Source11: modprobe-dist-alsa.conf Source12: modprobe-dist-oss.conf +Source40: alsa-ucm-conf.patch Patch0: alsa-git.patch Patch1: alsa-lib-1.1.9-config.patch Patch2: alsa-lib-1.0.14-glibc-open.patch @@ -111,6 +112,7 @@ mkdir -p %{buildroot}/%{_datadir}/alsa/ucm2 # Unpack UCMs tar xvjf %{SOURCE1} -C %{buildroot}/%{_datadir}/alsa ucm ucm2 +patch -d %{buildroot}/%{_datadir}/alsa -p1 < %{SOURCE40} # Create topology directory mkdir -p %{buildroot}/%{_datadir}/alsa/topology @@ -161,6 +163,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Mon Dec 9 2019 Jaroslav Kysela - 1.2.1.2-4 +- Fixes for sof-hda-dsp UCM2 configuration + * Tue Dec 3 2019 Jaroslav Kysela - 1.2.1.2-3 - Fixed more UCM2 related issues diff --git a/alsa-ucm-conf.patch b/alsa-ucm-conf.patch new file mode 100644 index 0000000..3bccad3 --- /dev/null +++ b/alsa-ucm-conf.patch @@ -0,0 +1,102 @@ +From 2882eb5085db58b60ff6dd0f61912d32ccbdf911 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 5 Dec 2019 17:46:53 +0100 +Subject: [PATCH 1/3] sof-hda-dsp: Fix the Dmic0 CaptureMixerElem for v1.4.1 + firmware + +Signed-off-by: Jaroslav Kysela +--- + ucm2/sof-hda-dsp/HiFi.conf | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ucm2/sof-hda-dsp/HiFi.conf b/ucm2/sof-hda-dsp/HiFi.conf +index f1c81a1..500cbae 100644 +--- a/ucm2/sof-hda-dsp/HiFi.conf ++++ b/ucm2/sof-hda-dsp/HiFi.conf +@@ -162,7 +162,7 @@ SectionDevice."DigitalMic" { + Control "name='Dmic0 Capture Switch'" + } + True { +- CaptureMixerElem "Dmic0 Capture" ++ CaptureMixerElem "Dmic0" + CaptureVolume "Dmic0 Capture Volume" + CaptureSwitch "Dmic0 Capture Switch" + } +-- +2.20.1 + + +From adeb572487081f4f88318583d6eefb0ea1b61361 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 6 Dec 2019 11:12:39 +0100 +Subject: [PATCH 2/3] sof-hda-dsp: Use more strict names according latest + use-case.h + +Also remove ConflictinDevice section from the digital microphone. +Those paths are independent. + +BugLink: https://github.com/alsa-project/alsa-ucm-conf/pull/7 +Signed-off-by: Jaroslav Kysela +--- + ucm2/sof-hda-dsp/HiFi.conf | 15 ++++++--------- + 1 file changed, 6 insertions(+), 9 deletions(-) + +diff --git a/ucm2/sof-hda-dsp/HiFi.conf b/ucm2/sof-hda-dsp/HiFi.conf +index 500cbae..5c7236d 100644 +--- a/ucm2/sof-hda-dsp/HiFi.conf ++++ b/ucm2/sof-hda-dsp/HiFi.conf +@@ -6,7 +6,7 @@ SectionVerb { + ] + } + +-SectionDevice."Headphones" { ++SectionDevice."Headphones1" { + Comment "Headphones" + + EnableSequence [ +@@ -87,8 +87,9 @@ If.monomic { + Control "name='Input Source'" + ControlEnum "Headphone Mic" + } ++ After.SectionDevice "Mic" + True { +- SectionDevice."HeadphonesMic" { ++ SectionDevice."Headphones2" { + Comment "Headphones Stereo Microphone" + + ConflictingDevice [ +@@ -106,7 +107,7 @@ If.monomic { + } + } + +- SectionDevice."HeadsetMic" { ++ SectionDevice."Headset" { + Comment "Headset Mono Microphone" + + EnableSequence [ +@@ -121,7 +122,7 @@ If.monomic { + } + } + False { +- SectionDevice."HeadphonesMic" { ++ SectionDevice."Headphones2" { + Comment "Headphones Stereo Microphone" + + Value { +@@ -133,13 +134,9 @@ If.monomic { + } + } + +-SectionDevice."DigitalMic" { ++SectionDevice."Mic" { + Comment "Digital Microphone" + +- ConflictingDevice [ +- "HeadsetMic" +- ] +- + Value { + CapturePriority 100 + CapturePCM "hw:${CardId},6" +-- +2.20.1 From d9eb8077ac7f9962bbd2921c6879977d6abfc53a Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Tue, 28 Jan 2020 11:27:30 +0000 Subject: [PATCH 029/120] - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- alsa-lib.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index cd8cd72..bb82196 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 4%{?prever_dot}%{?dist} +Release: 5%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -163,6 +163,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Tue Jan 28 2020 Fedora Release Engineering - 1.2.1.2-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + * Mon Dec 9 2019 Jaroslav Kysela - 1.2.1.2-4 - Fixes for sof-hda-dsp UCM2 configuration From 12283435830e8dc982293bef9fc2b1b130350f0f Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Sun, 9 Feb 2020 20:05:41 +0100 Subject: [PATCH 030/120] more UCM2 fixes from upstream --- alsa-git.patch | 21887 +++++++++++++++++++++++++++++++++++++++++- alsa-lib.spec | 3 + alsa-ucm-conf.patch | 5554 ++++++++++- 3 files changed, 27420 insertions(+), 24 deletions(-) diff --git a/alsa-git.patch b/alsa-git.patch index d59cdc5..cc848a7 100644 --- a/alsa-git.patch +++ b/alsa-git.patch @@ -1,7 +1,7 @@ From c79f09e1f5e8b559b58dacdb00708d995b2e3aa5 Mon Sep 17 00:00:00 2001 From: paulhsia Date: Sat, 30 Nov 2019 03:35:30 +0800 -Subject: [PATCH 01/10] ucm: Use strncmp to avoid access-out-of-boundary +Subject: [PATCH 01/69] ucm: Use strncmp to avoid access-out-of-boundary If the length of the identifier is less than the length of the prefix, access-out-of-boundary will occur in memcmp(). @@ -34,13 +34,13 @@ index b0b6ffb3..252e50d9 100644 } -- -2.20.1 +2.24.1 From 9baf64da2f26844434ecea4825052937a3abe06c Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 29 Nov 2019 22:28:26 +0100 -Subject: [PATCH 02/10] ucm: return always at least NULL if no list is +Subject: [PATCH 02/69] ucm: return always at least NULL if no list is available in snd_use_case_get_list() Signed-off-by: Jaroslav Kysela @@ -77,13 +77,13 @@ index 252e50d9..b80db65f 100644 struct dev_list_node, list, name); -- -2.20.1 +2.24.1 From ebdd2b6cdb8119cf75f0dd0a3b283d271b3a547e Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Sat, 30 Nov 2019 20:31:55 +0100 -Subject: [PATCH 03/10] ucm: add _identifiers list +Subject: [PATCH 03/69] ucm: add _identifiers list Signed-off-by: Jaroslav Kysela --- @@ -431,13 +431,13 @@ index b80db65f..d2078a23 100644 pthread_mutex_unlock(&uc_mgr->mutex); return err; -- -2.20.1 +2.24.1 From 5ee5ef31b5ff3fb7c904054cb9cac7478a727f7c Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Sun, 1 Dec 2019 14:26:40 +0100 -Subject: [PATCH 04/10] namehint: correct the @args check +Subject: [PATCH 04/69] namehint: correct the @args check BugLink: https://github.com/alsa-project/alsa-plugins/issues/3 Signed-off-by: Jaroslav Kysela @@ -463,13 +463,13 @@ index 808df6b5..4927ef97 100644 "default", NULL) < 0) { err = -EINVAL; -- -2.20.1 +2.24.1 From 6055f8a584296abfc0cec0439ceb708f0eddcc9d Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Sun, 1 Dec 2019 14:30:54 +0100 -Subject: [PATCH 05/10] namehint: improve the previous patch (check the +Subject: [PATCH 05/69] namehint: improve the previous patch (check the returned value) Signed-off-by: Jaroslav Kysela @@ -492,13 +492,13 @@ index 4927ef97..60c48ae3 100644 if (*str == '\0') continue; -- -2.20.1 +2.24.1 From 4dddcf733d56a13f4d042fefa1fb6230c09f1f65 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 2 Dec 2019 11:56:30 +0100 -Subject: [PATCH 06/10] ucm: docs - allow spaces in device names for JackHWMute +Subject: [PATCH 06/69] ucm: docs - allow spaces in device names for JackHWMute Signed-off-by: Jaroslav Kysela --- @@ -549,13 +549,13 @@ index 85c58ac0..e1f58027 100644 * - This is used on platform where reported buffer level is not accurate. * E.g. "512", which holds 512 samples in device buffer. Note: this will -- -2.20.1 +2.24.1 From 2a286ca9a8415571181ce58027686ec332a834e9 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 2 Dec 2019 11:57:18 +0100 -Subject: [PATCH 07/10] use-case: docs - add PlaybackMixerCopy and +Subject: [PATCH 07/69] use-case: docs - add PlaybackMixerCopy and CaptureMixerCopy Signed-off-by: Jaroslav Kysela @@ -598,13 +598,13 @@ index e1f58027..71fcc949 100644 * - type of the master volume control * - Valid values: "soft" (software attenuation) -- -2.20.1 +2.24.1 From a0fc4447bb7c7f9a850a0a85f3a5a32c1509caf4 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 3 Dec 2019 15:01:04 +0100 -Subject: [PATCH 08/10] ucm: docs - add JackCTL, rearrange JackControl and +Subject: [PATCH 08/69] ucm: docs - add JackCTL, rearrange JackControl and JackDev Signed-off-by: Jaroslav Kysela @@ -646,13 +646,13 @@ index 71fcc949..25998cb9 100644 * If this value is set, it indicates that when the jack is plugged * in, the hardware automatically mutes some other device(s). The -- -2.20.1 +2.24.1 From e59034a0bec257cc7422a1e9436d936be8696a6f Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Tue, 3 Dec 2019 18:27:39 +0100 -Subject: [PATCH 09/10] ucm: Do not fail to parse configs on cards with an +Subject: [PATCH 09/69] ucm: Do not fail to parse configs on cards with an empty CardComponents lists Since the UCM profiles for all Bay- and Cherry-Trail SST cards have been @@ -730,13 +730,13 @@ index 00afa9e3..90e395f0 100644 strncpy(r, value, idsize); r[idsize] = '\0'; -- -2.20.1 +2.24.1 From 8e2c70add782f997f7c269ed3f722888e56ff024 Mon Sep 17 00:00:00 2001 From: Fabrice Fontaine Date: Tue, 3 Dec 2019 18:56:40 +0100 -Subject: [PATCH 10/10] src/ucm/main.c: fix build without mixer +Subject: [PATCH 10/69] src/ucm/main.c: fix build without mixer Commit 4ce38a5ff466d18039b2606938f866ea3a6c9f3c breaks the build without mixer on: @@ -769,5 +769,21852 @@ index d2078a23..61922f10 100644 return -EINVAL; } -- -2.20.1 +2.24.1 + + +From ad8527d81b09c4d0edd054b5b1468ce1c50b23cb Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 4 Dec 2019 09:49:40 +0100 +Subject: [PATCH 11/69] alsa.m4: another try to fix the libatopology detection + +Signed-off-by: Jaroslav Kysela +--- + utils/alsa.m4 | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/utils/alsa.m4 b/utils/alsa.m4 +index 4c457f0d..320e4336 100644 +--- a/utils/alsa.m4 ++++ b/utils/alsa.m4 +@@ -22,6 +22,7 @@ alsa_save_CFLAGS="$CFLAGS" + alsa_save_LDFLAGS="$LDFLAGS" + alsa_save_LIBS="$LIBS" + alsa_found=yes ++alsa_topology_found=no + + dnl + dnl Get the cflags and libraries for alsa +@@ -158,11 +159,17 @@ AC_CHECK_LIB([asound], [snd_ctl_open],, + alsa_found=no] + ) + if test "x$enable_atopology" = "xyes"; then ++alsa_topology_found=yes + AC_CHECK_LIB([atopology], [snd_tplg_new],, + [ifelse([$3], , [AC_MSG_ERROR(No linkable libatopology was found.)]) +- alsa_found=no] ++ alsa_topology_found=no, ++] + ) + fi ++else ++if test "x$enable_atopology" = "xyes"; then ++ alsa_topology_found=yes ++fi + fi + + if test "x$alsa_found" = "xyes" ; then +@@ -183,7 +190,7 @@ fi + + dnl add the alsa topology library; must be at the end + AC_MSG_CHECKING(for ALSA topology LDFLAGS) +-if test "x$enable_atopology" = "xyes"; then ++if test "x$alsa_topology_found" = "xyes"; then + ALSA_TOPOLOGY_LIBS="$ALSA_TOPOLOGY_LIBS -latopology" + fi + AC_MSG_RESULT($ALSA_TOPOLOGY_LIBS) +-- +2.24.1 + + +From 555a5dbdabc5ed3be1ca81865abdb997bc3a6082 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 5 Dec 2019 16:59:05 +0100 +Subject: [PATCH 12/69] ucm: docs - add Mic/DigitalMic and multiple devices + comments + +Signed-off-by: Jaroslav Kysela +--- + include/use-case.h | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/include/use-case.h b/include/use-case.h +index 25998cb9..1736da25 100644 +--- a/include/use-case.h ++++ b/include/use-case.h +@@ -114,10 +114,18 @@ extern "C" { + * + * Physical system devices the render and capture audio. Devices can be OR'ed + * together to support audio on simultaneous devices. ++ * ++ * If multiple devices with the same name exists, the number suffixes should ++ * be added to these names like HDMI1,HDMI2,HDMI3 etc. No number gaps are ++ * allowed. The names with numbers must be continuous. ++ * ++ * The preference of the devices is determined by the priority value. + */ + #define SND_USE_CASE_DEV_NONE "None" /**< None Device */ + #define SND_USE_CASE_DEV_SPEAKER "Speaker" /**< Speaker Device */ + #define SND_USE_CASE_DEV_LINE "Line" /**< Line Device */ ++#define SND_USE_CASE_DEV_MIC "Mic" /**< Integrated Analog Microphone */ ++#define SND_USE_CASE_DEV_DIGITAL_MIC "DigitalMic" /**< Integrated Digital Microphone */ + #define SND_USE_CASE_DEV_HEADPHONES "Headphones" /**< Headphones Device */ + #define SND_USE_CASE_DEV_HEADSET "Headset" /**< Headset Device */ + #define SND_USE_CASE_DEV_HANDSET "Handset" /**< Handset Device */ +-- +2.24.1 + + +From 1ad660ddeecb2a364f1ca62aa60f256f7029cfdc Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 5 Dec 2019 17:01:31 +0100 +Subject: [PATCH 13/69] ucm: docs - remove DigitalMic, it does not have sense + +Signed-off-by: Jaroslav Kysela +--- + include/use-case.h | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/include/use-case.h b/include/use-case.h +index 1736da25..214a2a4c 100644 +--- a/include/use-case.h ++++ b/include/use-case.h +@@ -124,8 +124,7 @@ extern "C" { + #define SND_USE_CASE_DEV_NONE "None" /**< None Device */ + #define SND_USE_CASE_DEV_SPEAKER "Speaker" /**< Speaker Device */ + #define SND_USE_CASE_DEV_LINE "Line" /**< Line Device */ +-#define SND_USE_CASE_DEV_MIC "Mic" /**< Integrated Analog Microphone */ +-#define SND_USE_CASE_DEV_DIGITAL_MIC "DigitalMic" /**< Integrated Digital Microphone */ ++#define SND_USE_CASE_DEV_MIC "Mic" /**< Integrated Microphone */ + #define SND_USE_CASE_DEV_HEADPHONES "Headphones" /**< Headphones Device */ + #define SND_USE_CASE_DEV_HEADSET "Headset" /**< Headset Device */ + #define SND_USE_CASE_DEV_HANDSET "Handset" /**< Handset Device */ +-- +2.24.1 + + +From 5473c5d677915b88d5c93d5bcc6cd16bb6a40342 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 5 Dec 2019 17:19:06 +0100 +Subject: [PATCH 14/69] ucm: docs - change the Mic description to simple + Microphone Device + +Signed-off-by: Jaroslav Kysela +--- + include/use-case.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/use-case.h b/include/use-case.h +index 214a2a4c..b04f7b9d 100644 +--- a/include/use-case.h ++++ b/include/use-case.h +@@ -124,7 +124,7 @@ extern "C" { + #define SND_USE_CASE_DEV_NONE "None" /**< None Device */ + #define SND_USE_CASE_DEV_SPEAKER "Speaker" /**< Speaker Device */ + #define SND_USE_CASE_DEV_LINE "Line" /**< Line Device */ +-#define SND_USE_CASE_DEV_MIC "Mic" /**< Integrated Microphone */ ++#define SND_USE_CASE_DEV_MIC "Mic" /**< Microphone Device */ + #define SND_USE_CASE_DEV_HEADPHONES "Headphones" /**< Headphones Device */ + #define SND_USE_CASE_DEV_HEADSET "Headset" /**< Headset Device */ + #define SND_USE_CASE_DEV_HANDSET "Handset" /**< Handset Device */ +-- +2.24.1 + + +From ca67e823833213e140a09ce43b6399b7676616df Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 6 Dec 2019 11:11:54 +0100 +Subject: [PATCH 15/69] ucm: docs - add note about the sequences and device + split + +Signed-off-by: Jaroslav Kysela +--- + include/use-case.h | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/include/use-case.h b/include/use-case.h +index b04f7b9d..2efcb4d8 100644 +--- a/include/use-case.h ++++ b/include/use-case.h +@@ -119,6 +119,11 @@ extern "C" { + * be added to these names like HDMI1,HDMI2,HDMI3 etc. No number gaps are + * allowed. The names with numbers must be continuous. + * ++ * If EnableSequence/DisableSequence controls independent paths in the hardware ++ * it is also recommended to split playback and capture UCM devices and use ++ * the number suffixes. Example use case: Use the integrated microphone ++ * in the laptop instead the microphone in headphones. ++ * + * The preference of the devices is determined by the priority value. + */ + #define SND_USE_CASE_DEV_NONE "None" /**< None Device */ +-- +2.24.1 + + +From f828dfe549fbab0a920768c63ebd3478272954eb Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 10 Dec 2019 11:48:06 +0100 +Subject: [PATCH 16/69] ucm: docs - remove MixerCopy values, add Priority for + verb, improve priority docs + +Signed-off-by: Jaroslav Kysela +--- + include/use-case.h | 18 ++++++------------ + 1 file changed, 6 insertions(+), 12 deletions(-) + +diff --git a/include/use-case.h b/include/use-case.h +index 2efcb4d8..134303af 100644 +--- a/include/use-case.h ++++ b/include/use-case.h +@@ -274,6 +274,10 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, + * Recommended names for values: + * - TQ + * - Tone Quality ++ * - Priority ++ * - priority value (1-10000), higher value means higher priority ++ * - valid only for verbs ++ * - for devices - PlaybackPriority and CapturePriority + * - PlaybackPCM + * - full PCM playback device name + * - PlaybackPCMIsDummy +@@ -301,7 +305,7 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, + * - playback control switch identifier string + * - can be parsed using snd_use_case_parse_ctl_elem_id() + * - PlaybackPriority +- * - priority value (1-10000), default value is 100, higher value means lower priority ++ * - priority value (1-10000), higher value means higher priority + * - CaptureRate + * - capture device sample rate + * - CaptureChannels +@@ -315,17 +319,12 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, + * - capture control switch identifier string + * - can be parsed using snd_use_case_parse_ctl_elem_id() + * - CapturePriority +- * - priority value (1-10000), default value is 100, higher value means lower priority ++ * - priority value (1-10000), higher value means higher priority + * - PlaybackMixer + * - name of playback mixer + * - PlaybackMixerElem + * - mixer element playback identifier + * - can be parsed using snd_use_case_parse_selem_id() +- * - PlaybackMixerCopy +- * - additional mixer element playback identifier +- * - can be parsed using snd_use_case_parse_selem_id() +- * - those elements should copy the volume and switch settings +- * - element identifiers are separated using the | character + * - PlaybackMasterElem + * - mixer element playback identifier for the master control + * - can be parsed using snd_use_case_parse_selem_id() +@@ -337,11 +336,6 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, + * - CaptureMixerElem + * - mixer element capture identifier + * - can be parsed using snd_use_case_parse_selem_id() +- * - CaptureMixerCopy +- * - additional mixer element capture identifier +- * - can be parsed using snd_use_case_parse_selem_id() +- * - those elements should copy the volume and switch settings +- * - element identifiers are separated using the | character + * - CaptureMasterElem + * - mixer element playback identifier for the master control + * - can be parsed using snd_use_case_parse_selem_id() +-- +2.24.1 + + +From 1744159180ac94a72036d7232e674c58cedee70a Mon Sep 17 00:00:00 2001 +From: Libin Yang +Date: Wed, 11 Dec 2019 14:07:19 +0800 +Subject: [PATCH 17/69] ucm: setup conf_format after getting + ALSA_CONFIG_UCM_VAR successfully + +Set the conf_format to 1 after getting ALSA_CONFIG_UCM_VAR successfully. +Otherwise, the conf_format is not set in this scenario. + +Signed-off-by: Libin Yang +Signed-off-by: Jaroslav Kysela +--- + src/ucm/parser.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/ucm/parser.c b/src/ucm/parser.c +index ba500277..d61124a3 100644 +--- a/src/ucm/parser.c ++++ b/src/ucm/parser.c +@@ -89,6 +89,8 @@ static void configuration_filename(snd_use_case_mgr_t *uc_mgr, + env = getenv(ALSA_CONFIG_UCM2_VAR); + if (env == NULL) { + env = getenv(ALSA_CONFIG_UCM_VAR); ++ if (env) ++ uc_mgr->conf_format = 1; + } else { + uc_mgr->conf_format = 2; + } +-- +2.24.1 + + +From 9980e18c3c99da42a90a98b140a0ffe7d0f92cd3 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 12 Dec 2019 18:42:33 +0100 +Subject: [PATCH 18/69] alsa-lib: fix the array parser (unique compound keys) + +The code from the old import may merge arrays wrongly and +the result is a compound with same keys like: + +Input: + + lines [ + "SSP0.OUT, , BUF1.3" + ] + lines [ + "BUF2.0, , SSP0.IN" + ] + +Parsed contents: + + lines { + 0 'SSP0.OUT, , BUF1.3' + 0 'BUF2.0, , SSP0.IN' + } + +Proper parsed contents (create+merge mode): + + lines { + 0 'SSP0.OUT, , BUF1.3' + 1 'BUF2.0, , SSP0.IN' + } + +Signed-off-by: Jaroslav Kysela +--- + src/conf.c | 20 +++++++++++++++++--- + 1 file changed, 17 insertions(+), 3 deletions(-) + +diff --git a/src/conf.c b/src/conf.c +index e4306504..3e753b26 100644 +--- a/src/conf.c ++++ b/src/conf.c +@@ -1226,7 +1226,7 @@ static int parse_value(snd_config_t **_n, snd_config_t *parent, input_t *input, + static int parse_defs(snd_config_t *parent, input_t *input, int skip, int override); + static int parse_array_defs(snd_config_t *farther, input_t *input, int skip, int override); + +-static int parse_array_def(snd_config_t *parent, input_t *input, int idx, int skip, int override) ++static int parse_array_def(snd_config_t *parent, input_t *input, int *idx, int skip, int override) + { + char *id = NULL; + int c; +@@ -1234,8 +1234,21 @@ static int parse_array_def(snd_config_t *parent, input_t *input, int idx, int sk + snd_config_t *n = NULL; + + if (!skip) { ++ snd_config_t *g; + char static_id[12]; +- snprintf(static_id, sizeof(static_id), "%i", idx); ++ while (1) { ++ snprintf(static_id, sizeof(static_id), "%i", *idx); ++ if (_snd_config_search(parent, static_id, -1, &g) == 0) { ++ if (override) { ++ snd_config_delete(n); ++ } else { ++ /* merge */ ++ (*idx)++; ++ continue; ++ } ++ } ++ break; ++ } + id = strdup(static_id); + if (id == NULL) + return -ENOMEM; +@@ -1306,9 +1319,10 @@ static int parse_array_defs(snd_config_t *parent, input_t *input, int skip, int + unget_char(c, input); + if (c == ']') + return 0; +- err = parse_array_def(parent, input, idx++, skip, override); ++ err = parse_array_def(parent, input, &idx, skip, override); + if (err < 0) + return err; ++ idx++; + } + return 0; + } +-- +2.24.1 + + +From 075ee165e647a6b434f63ca578f2f8faff2a55f6 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 13 Dec 2019 16:09:35 +0100 +Subject: [PATCH 19/69] topology: remove vendor_fd/name from snd_tplg structure + - not used + +Signed-off-by: Jaroslav Kysela +--- + src/topology/tplg_local.h | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h +index c32267d2..22648fa5 100644 +--- a/src/topology/tplg_local.h ++++ b/src/topology/tplg_local.h +@@ -60,11 +60,6 @@ typedef enum _snd_pcm_rates { + } snd_pcm_rates_t; + + struct snd_tplg { +- +- /* opaque vendor data */ +- int vendor_fd; +- char *vendor_name; +- + /* out file */ + int out_fd; + +-- +2.24.1 + + +From ce74829db630a49569c79aea4aeb288fdd458dd8 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 13 Dec 2019 17:01:03 +0100 +Subject: [PATCH 20/69] topology: file position and size cleanups + +- try to use size_t/ssize_t +- track the position in own variable, do not use lseek + +Signed-off-by: Jaroslav Kysela +--- + src/topology/builder.c | 121 ++++++++++++++++++-------------------- + src/topology/tplg_local.h | 3 +- + 2 files changed, 60 insertions(+), 64 deletions(-) + +diff --git a/src/topology/builder.c b/src/topology/builder.c +index 5ae3ae89..4e6cbbb0 100644 +--- a/src/topology/builder.c ++++ b/src/topology/builder.c +@@ -23,28 +23,41 @@ + /* verbose output detailing each object size and file position */ + static void verbose(snd_tplg_t *tplg, const char *fmt, ...) + { +- int offset; + va_list va; + + if (!tplg->verbose) + return; + +- offset = lseek(tplg->out_fd, 0, SEEK_CUR); +- + va_start(va, fmt); +- fprintf(stdout, "0x%6.6x/%6.6d -", offset, offset); ++ fprintf(stdout, "0x%6.6zx/%6.6zd -", tplg->out_pos, tplg->out_pos); + vfprintf(stdout, fmt, va); + va_end(va); + } + ++/* write a block, track the position */ ++static ssize_t twrite(snd_tplg_t *tplg, void *data, size_t data_size) ++{ ++ ssize_t r = write(tplg->out_fd, data, data_size); ++ if (r != (ssize_t)data_size) { ++ if (r < 0) { ++ SNDERR("error: unable to write: %s", strerror(errno)); ++ return -errno; ++ } ++ tplg->out_pos += r; ++ SNDERR("error: unable to write (partial)"); ++ return -EIO; ++ } ++ tplg->out_pos += r; ++ return r; ++} ++ + /* write out block header to output file */ +-static int write_block_header(snd_tplg_t *tplg, unsigned int type, +- unsigned int vendor_type, unsigned int version, unsigned int index, +- size_t payload_size, int count) ++static ssize_t write_block_header(snd_tplg_t *tplg, unsigned int type, ++ unsigned int vendor_type, ++ unsigned int version, unsigned int index, ++ size_t payload_size, int count) + { + struct snd_soc_tplg_hdr hdr; +- size_t bytes; +- int offset = lseek(tplg->out_fd, 0, SEEK_CUR); + + memset(&hdr, 0, sizeof(hdr)); + hdr.magic = SND_SOC_TPLG_MAGIC; +@@ -58,13 +71,13 @@ static int write_block_header(snd_tplg_t *tplg, unsigned int type, + hdr.count = count; + + /* make sure file offset is aligned with the calculated HDR offset */ +- if ((unsigned int)offset != tplg->next_hdr_pos) { +- SNDERR("error: New header is at offset 0x%x but file" +- " offset 0x%x is %s by %d bytes\n", +- tplg->next_hdr_pos, offset, +- (unsigned int)offset > tplg->next_hdr_pos ? "ahead" : "behind", +- abs(offset - tplg->next_hdr_pos)); +- exit(-EINVAL); ++ if (tplg->out_pos != tplg->next_hdr_pos) { ++ SNDERR("error: New header is at offset 0x%zx but file" ++ " offset 0x%zx is %s by %ld bytes\n", ++ tplg->next_hdr_pos, tplg->out_pos, ++ tplg->out_pos > tplg->next_hdr_pos ? "ahead" : "behind", ++ labs(tplg->out_pos - tplg->next_hdr_pos)); ++ return -EINVAL; + } + + verbose(tplg, " header index %d type %d count %d size 0x%lx/%ld vendor %d " +@@ -74,22 +87,16 @@ static int write_block_header(snd_tplg_t *tplg, unsigned int type, + + tplg->next_hdr_pos += hdr.payload_size + sizeof(hdr); + +- bytes = write(tplg->out_fd, &hdr, sizeof(hdr)); +- if (bytes != sizeof(hdr)) { +- SNDERR("error: can't write section header %lu\n", +- (long unsigned int)bytes); +- return bytes; +- } +- +- return bytes; ++ return twrite(tplg, &hdr, sizeof(hdr)); + } + + static int write_elem_block(snd_tplg_t *tplg, +- struct list_head *base, int size, int tplg_type, const char *obj_name) ++ struct list_head *base, size_t size, int tplg_type, const char *obj_name) + { + struct list_head *pos, *sub_pos, *sub_base; + struct tplg_elem *elem, *elem_next; +- int ret, wsize = 0, total_size = 0, count = 0, block_size = 0; ++ size_t total_size = 0, count = 0, block_size = 0; ++ ssize_t ret, wsize; + + sub_base = base; + list_for_each(pos, base) { +@@ -129,12 +136,9 @@ static int write_elem_block(snd_tplg_t *tplg, + elem->route->control, + elem->route->sink, elem->size); + +- wsize = write(tplg->out_fd, elem->obj, elem->size); +- if (wsize < 0) { +- SNDERR("error: failed to write %s %d\n", +- obj_name, ret); +- return ret; +- } ++ wsize = twrite(tplg, elem->obj, elem->size); ++ if (wsize < 0) ++ return size; + + total_size += wsize; + /* get to the end of sub list */ +@@ -151,7 +155,7 @@ static int write_elem_block(snd_tplg_t *tplg, + + /* make sure we have written the correct size */ + if (total_size != size) { +- SNDERR("error: size mismatch. Expected %d wrote %d\n", ++ SNDERR("error: size mismatch. Expected %zu wrote %zu\n", + size, total_size); + return -EIO; + } +@@ -179,8 +183,7 @@ static int calc_block_size(struct list_head *base) + return size; + } + +-static int write_block(snd_tplg_t *tplg, struct list_head *base, +- int type) ++static int write_block(snd_tplg_t *tplg, struct list_head *base, int type) + { + int size; + +@@ -231,44 +234,36 @@ static int write_block(snd_tplg_t *tplg, struct list_head *base, + } + + /* write the manifest including its private data */ +-static int write_manifest_data(snd_tplg_t *tplg) ++static ssize_t write_manifest_data(snd_tplg_t *tplg) + { +- int ret; ++ ssize_t ret; + + /* write the header for this block */ + ret = write_block_header(tplg, SND_SOC_TPLG_TYPE_MANIFEST, 0, + tplg->version, 0, + sizeof(tplg->manifest) + tplg->manifest.priv.size, 1); + if (ret < 0) { +- SNDERR("error: failed to write manifest block %d\n", ret); ++ SNDERR("error: failed to write manifest block\n"); + return ret; + } + + verbose(tplg, "manifest : write %d bytes\n", sizeof(tplg->manifest)); +- ret = write(tplg->out_fd, &tplg->manifest, sizeof(tplg->manifest)); +- if (ret < 0) { +- SNDERR("error: failed to write manifest %d\n", ret); +- return ret; ++ ret = twrite(tplg, &tplg->manifest, sizeof(tplg->manifest)); ++ if (ret >= 0) { ++ verbose(tplg, "manifest : write %d priv bytes\n", tplg->manifest.priv.size); ++ ret = twrite(tplg, tplg->manifest_pdata, tplg->manifest.priv.size); + } +- +- verbose(tplg, "manifest : write %d priv bytes\n", tplg->manifest.priv.size); +- ret = write(tplg->out_fd, tplg->manifest_pdata, tplg->manifest.priv.size); +- if (ret < 0) { +- SNDERR("error: failed to write manifest priv data %d\n", ret); +- return ret; +- } +- +- return 0; ++ return ret; + } + + int tplg_write_data(snd_tplg_t *tplg) + { +- int ret; ++ ssize_t ret; + + /* write manifest */ + ret = write_manifest_data(tplg); + if (ret < 0) { +- SNDERR("failed to write manifest %d\n", ret); ++ SNDERR("failed to write manifest %zd\n", ret); + return ret; + } + +@@ -276,7 +271,7 @@ int tplg_write_data(snd_tplg_t *tplg) + ret = write_block(tplg, &tplg->mixer_list, + SND_TPLG_TYPE_MIXER); + if (ret < 0) { +- SNDERR("failed to write control elems %d\n", ret); ++ SNDERR("failed to write control elems %zd\n", ret); + return ret; + } + +@@ -284,7 +279,7 @@ int tplg_write_data(snd_tplg_t *tplg) + ret = write_block(tplg, &tplg->enum_list, + SND_TPLG_TYPE_ENUM); + if (ret < 0) { +- SNDERR("failed to write control elems %d\n", ret); ++ SNDERR("failed to write control elems %zd\n", ret); + return ret; + } + +@@ -292,7 +287,7 @@ int tplg_write_data(snd_tplg_t *tplg) + ret = write_block(tplg, &tplg->bytes_ext_list, + SND_TPLG_TYPE_BYTES); + if (ret < 0) { +- SNDERR("failed to write control elems %d\n", ret); ++ SNDERR("failed to write control elems %zd\n", ret); + return ret; + } + +@@ -300,7 +295,7 @@ int tplg_write_data(snd_tplg_t *tplg) + ret = write_block(tplg, &tplg->widget_list, + SND_TPLG_TYPE_DAPM_WIDGET); + if (ret < 0) { +- SNDERR("failed to write widget elems %d\n", ret); ++ SNDERR("failed to write widget elems %zd\n", ret); + return ret; + } + +@@ -308,7 +303,7 @@ int tplg_write_data(snd_tplg_t *tplg) + ret = write_block(tplg, &tplg->pcm_list, + SND_TPLG_TYPE_PCM); + if (ret < 0) { +- SNDERR("failed to write pcm elems %d\n", ret); ++ SNDERR("failed to write pcm elems %zd\n", ret); + return ret; + } + +@@ -316,7 +311,7 @@ int tplg_write_data(snd_tplg_t *tplg) + ret = write_block(tplg, &tplg->dai_list, + SND_TPLG_TYPE_DAI); + if (ret < 0) { +- SNDERR("failed to write physical dai elems %d\n", ret); ++ SNDERR("failed to write physical dai elems %zd\n", ret); + return ret; + } + +@@ -324,7 +319,7 @@ int tplg_write_data(snd_tplg_t *tplg) + ret = write_block(tplg, &tplg->be_list, + SND_TPLG_TYPE_BE); + if (ret < 0) { +- SNDERR("failed to write be elems %d\n", ret); ++ SNDERR("failed to write be elems %zd\n", ret); + return ret; + } + +@@ -332,7 +327,7 @@ int tplg_write_data(snd_tplg_t *tplg) + ret = write_block(tplg, &tplg->cc_list, + SND_TPLG_TYPE_CC); + if (ret < 0) { +- SNDERR("failed to write cc elems %d\n", ret); ++ SNDERR("failed to write cc elems %zd\n", ret); + return ret; + } + +@@ -340,7 +335,7 @@ int tplg_write_data(snd_tplg_t *tplg) + ret = write_block(tplg, &tplg->route_list, + SND_TPLG_TYPE_DAPM_GRAPH); + if (ret < 0) { +- SNDERR("failed to write graph elems %d\n", ret); ++ SNDERR("failed to write graph elems %zd\n", ret); + return ret; + } + +@@ -348,7 +343,7 @@ int tplg_write_data(snd_tplg_t *tplg) + ret = write_block(tplg, &tplg->pdata_list, + SND_TPLG_TYPE_DATA); + if (ret < 0) { +- SNDERR("failed to write private data %d\n", ret); ++ SNDERR("failed to write private data %zd\n", ret); + return ret; + } + +diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h +index 22648fa5..7b8abcde 100644 +--- a/src/topology/tplg_local.h ++++ b/src/topology/tplg_local.h +@@ -62,12 +62,13 @@ typedef enum _snd_pcm_rates { + struct snd_tplg { + /* out file */ + int out_fd; ++ size_t out_pos; + + int verbose; + unsigned int version; + + /* runtime state */ +- unsigned int next_hdr_pos; ++ size_t next_hdr_pos; + int index; + int channel_idx; + +-- +2.24.1 + + +From 012bd3b28c0d2744db482caca630d5b0a19e4dab Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 13 Dec 2019 18:24:55 +0100 +Subject: [PATCH 21/69] topology: use an array describing blocks for the main + build loop + +Signed-off-by: Jaroslav Kysela +--- + src/topology/builder.c | 146 +++++++++++++++++++---------------------- + 1 file changed, 67 insertions(+), 79 deletions(-) + +diff --git a/src/topology/builder.c b/src/topology/builder.c +index 4e6cbbb0..ec1af42d 100644 +--- a/src/topology/builder.c ++++ b/src/topology/builder.c +@@ -258,93 +258,81 @@ static ssize_t write_manifest_data(snd_tplg_t *tplg) + + int tplg_write_data(snd_tplg_t *tplg) + { ++ struct wtable { ++ const char *name; ++ struct list_head *list; ++ int type; ++ } *wptr, wtable[] = { ++ { ++ .name = "control mixer elements", ++ .list = &tplg->mixer_list, ++ .type = SND_TPLG_TYPE_MIXER, ++ }, ++ { ++ .name = "control enum elements", ++ .list = &tplg->enum_list, ++ .type = SND_TPLG_TYPE_ENUM, ++ }, ++ { ++ .name = "control extended (bytes) elements", ++ .list = &tplg->bytes_ext_list, ++ .type = SND_TPLG_TYPE_BYTES, ++ }, ++ { ++ .name = "dapm widget elements", ++ .list = &tplg->widget_list, ++ .type = SND_TPLG_TYPE_DAPM_WIDGET, ++ }, ++ { ++ .name = "pcm elements", ++ .list = &tplg->pcm_list, ++ .type = SND_TPLG_TYPE_PCM, ++ }, ++ { ++ .name = "physical dai elements", ++ .list = &tplg->dai_list, ++ .type = SND_TPLG_TYPE_DAI, ++ }, ++ { ++ .name = "be elements", ++ .list = &tplg->be_list, ++ .type = SND_TPLG_TYPE_BE, ++ }, ++ { ++ .name = "cc elements", ++ .list = &tplg->cc_list, ++ .type = SND_TPLG_TYPE_CC, ++ }, ++ { ++ .name = "route (dapm graph) elements", ++ .list = &tplg->route_list, ++ .type = SND_TPLG_TYPE_DAPM_GRAPH, ++ }, ++ { ++ .name = "private data elements", ++ .list = &tplg->pdata_list, ++ .type = SND_TPLG_TYPE_DATA, ++ }, ++ }; ++ + ssize_t ret; ++ unsigned int index; + + /* write manifest */ + ret = write_manifest_data(tplg); + if (ret < 0) { +- SNDERR("failed to write manifest %zd\n", ret); +- return ret; +- } +- +- /* write mixer elems. */ +- ret = write_block(tplg, &tplg->mixer_list, +- SND_TPLG_TYPE_MIXER); +- if (ret < 0) { +- SNDERR("failed to write control elems %zd\n", ret); +- return ret; +- } +- +- /* write enum control elems. */ +- ret = write_block(tplg, &tplg->enum_list, +- SND_TPLG_TYPE_ENUM); +- if (ret < 0) { +- SNDERR("failed to write control elems %zd\n", ret); +- return ret; +- } +- +- /* write bytes extended control elems. */ +- ret = write_block(tplg, &tplg->bytes_ext_list, +- SND_TPLG_TYPE_BYTES); +- if (ret < 0) { +- SNDERR("failed to write control elems %zd\n", ret); +- return ret; +- } +- +- /* write widget elems */ +- ret = write_block(tplg, &tplg->widget_list, +- SND_TPLG_TYPE_DAPM_WIDGET); +- if (ret < 0) { +- SNDERR("failed to write widget elems %zd\n", ret); +- return ret; +- } +- +- /* write pcm elems */ +- ret = write_block(tplg, &tplg->pcm_list, +- SND_TPLG_TYPE_PCM); +- if (ret < 0) { +- SNDERR("failed to write pcm elems %zd\n", ret); +- return ret; +- } +- +- /* write physical dai elems */ +- ret = write_block(tplg, &tplg->dai_list, +- SND_TPLG_TYPE_DAI); +- if (ret < 0) { +- SNDERR("failed to write physical dai elems %zd\n", ret); +- return ret; +- } +- +- /* write be elems */ +- ret = write_block(tplg, &tplg->be_list, +- SND_TPLG_TYPE_BE); +- if (ret < 0) { +- SNDERR("failed to write be elems %zd\n", ret); +- return ret; +- } +- +- /* write cc elems */ +- ret = write_block(tplg, &tplg->cc_list, +- SND_TPLG_TYPE_CC); +- if (ret < 0) { +- SNDERR("failed to write cc elems %zd\n", ret); +- return ret; +- } +- +- /* write route elems */ +- ret = write_block(tplg, &tplg->route_list, +- SND_TPLG_TYPE_DAPM_GRAPH); +- if (ret < 0) { +- SNDERR("failed to write graph elems %zd\n", ret); ++ SNDERR("failed to write manifest %d\n", ret); + return ret; + } + +- /* write private data */ +- ret = write_block(tplg, &tplg->pdata_list, +- SND_TPLG_TYPE_DATA); +- if (ret < 0) { +- SNDERR("failed to write private data %zd\n", ret); +- return ret; ++ /* write all blocks */ ++ for (index = 0; index < ARRAY_SIZE(wtable); index++) { ++ wptr = &wtable[index]; ++ ret = write_block(tplg, wptr->list, wptr->type); ++ if (ret < 0) { ++ SNDERR("failed to write %s: %s\n", wptr->name, snd_strerror(-ret)); ++ return ret; ++ } + } + + return 0; +-- +2.24.1 + + +From f1f5b48d0cfbce0cc6400daba0020d9385d6645e Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 13 Dec 2019 18:26:20 +0100 +Subject: [PATCH 22/69] topology: use size_t for calc_block_size() + +Signed-off-by: Jaroslav Kysela +--- + src/topology/builder.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/src/topology/builder.c b/src/topology/builder.c +index ec1af42d..bbee71d6 100644 +--- a/src/topology/builder.c ++++ b/src/topology/builder.c +@@ -163,11 +163,11 @@ static int write_elem_block(snd_tplg_t *tplg, + return 0; + } + +-static int calc_block_size(struct list_head *base) ++static size_t calc_block_size(struct list_head *base) + { + struct list_head *pos; + struct tplg_elem *elem; +- int size = 0; ++ size_t size = 0; + + list_for_each(pos, base) { + +@@ -185,14 +185,14 @@ static int calc_block_size(struct list_head *base) + + static int write_block(snd_tplg_t *tplg, struct list_head *base, int type) + { +- int size; ++ size_t size; + + /* calculate the block size in bytes for all elems in this list */ + size = calc_block_size(base); +- if (size <= 0) ++ if (size == 0) + return size; + +- verbose(tplg, " block size for type %d is %d\n", type, size); ++ verbose(tplg, " block size for type %d is %zd\n", type, size); + + /* write each elem for this block */ + switch (type) { +-- +2.24.1 + + +From 4dcceb5f866deda09e971b1c31d46403c3bd8e9e Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 13 Dec 2019 18:49:29 +0100 +Subject: [PATCH 23/69] topology: merge write_block to tplg_write_data + +Signed-off-by: Jaroslav Kysela +--- + src/topology/builder.c | 95 +++++++++++++++--------------------------- + 1 file changed, 33 insertions(+), 62 deletions(-) + +diff --git a/src/topology/builder.c b/src/topology/builder.c +index bbee71d6..f530fcd8 100644 +--- a/src/topology/builder.c ++++ b/src/topology/builder.c +@@ -183,56 +183,6 @@ static size_t calc_block_size(struct list_head *base) + return size; + } + +-static int write_block(snd_tplg_t *tplg, struct list_head *base, int type) +-{ +- size_t size; +- +- /* calculate the block size in bytes for all elems in this list */ +- size = calc_block_size(base); +- if (size == 0) +- return size; +- +- verbose(tplg, " block size for type %d is %zd\n", type, size); +- +- /* write each elem for this block */ +- switch (type) { +- case SND_TPLG_TYPE_MIXER: +- return write_elem_block(tplg, base, size, +- SND_SOC_TPLG_TYPE_MIXER, "mixer"); +- case SND_TPLG_TYPE_BYTES: +- return write_elem_block(tplg, base, size, +- SND_SOC_TPLG_TYPE_BYTES, "bytes"); +- case SND_TPLG_TYPE_ENUM: +- return write_elem_block(tplg, base, size, +- SND_SOC_TPLG_TYPE_ENUM, "enum"); +- case SND_TPLG_TYPE_DAPM_GRAPH: +- return write_elem_block(tplg, base, size, +- SND_SOC_TPLG_TYPE_DAPM_GRAPH, "route"); +- case SND_TPLG_TYPE_DAPM_WIDGET: +- return write_elem_block(tplg, base, size, +- SND_SOC_TPLG_TYPE_DAPM_WIDGET, "widget"); +- case SND_TPLG_TYPE_PCM: +- return write_elem_block(tplg, base, size, +- SND_SOC_TPLG_TYPE_PCM, "pcm"); +- case SND_TPLG_TYPE_BE: +- return write_elem_block(tplg, base, size, +- SND_SOC_TPLG_TYPE_BACKEND_LINK, "be"); +- case SND_TPLG_TYPE_CC: +- return write_elem_block(tplg, base, size, +- SND_SOC_TPLG_TYPE_CODEC_LINK, "cc"); +- case SND_TPLG_TYPE_DATA: +- return write_elem_block(tplg, base, size, +- SND_SOC_TPLG_TYPE_PDATA, "data"); +- case SND_TPLG_TYPE_DAI: +- return write_elem_block(tplg, base, size, +- SND_SOC_TPLG_TYPE_DAI, "dai"); +- default: +- return -EINVAL; +- } +- +- return 0; +-} +- + /* write the manifest including its private data */ + static ssize_t write_manifest_data(snd_tplg_t *tplg) + { +@@ -262,60 +212,72 @@ int tplg_write_data(snd_tplg_t *tplg) + const char *name; + struct list_head *list; + int type; ++ int tsoc; + } *wptr, wtable[] = { + { +- .name = "control mixer elements", ++ .name = "control mixer", + .list = &tplg->mixer_list, + .type = SND_TPLG_TYPE_MIXER, ++ .tsoc = SND_SOC_TPLG_TYPE_MIXER, + }, + { +- .name = "control enum elements", ++ .name = "control enum", + .list = &tplg->enum_list, + .type = SND_TPLG_TYPE_ENUM, ++ .tsoc = SND_SOC_TPLG_TYPE_ENUM, + }, + { +- .name = "control extended (bytes) elements", ++ .name = "control extended (bytes)", + .list = &tplg->bytes_ext_list, + .type = SND_TPLG_TYPE_BYTES, ++ .tsoc = SND_SOC_TPLG_TYPE_BYTES, + }, + { +- .name = "dapm widget elements", ++ .name = "dapm widget", + .list = &tplg->widget_list, + .type = SND_TPLG_TYPE_DAPM_WIDGET, ++ .tsoc = SND_SOC_TPLG_TYPE_DAPM_WIDGET, + }, + { +- .name = "pcm elements", ++ .name = "pcm", + .list = &tplg->pcm_list, + .type = SND_TPLG_TYPE_PCM, ++ .tsoc = SND_SOC_TPLG_TYPE_PCM, + }, + { +- .name = "physical dai elements", ++ .name = "physical dai", + .list = &tplg->dai_list, + .type = SND_TPLG_TYPE_DAI, ++ .tsoc = SND_SOC_TPLG_TYPE_DAI, + }, + { +- .name = "be elements", ++ .name = "be", + .list = &tplg->be_list, + .type = SND_TPLG_TYPE_BE, ++ .tsoc = SND_SOC_TPLG_TYPE_BACKEND_LINK, + }, + { +- .name = "cc elements", ++ .name = "cc", + .list = &tplg->cc_list, + .type = SND_TPLG_TYPE_CC, ++ .tsoc = SND_SOC_TPLG_TYPE_CODEC_LINK, + }, + { +- .name = "route (dapm graph) elements", ++ .name = "route (dapm graph)", + .list = &tplg->route_list, + .type = SND_TPLG_TYPE_DAPM_GRAPH, ++ .tsoc = SND_SOC_TPLG_TYPE_DAPM_GRAPH, + }, + { +- .name = "private data elements", ++ .name = "private data", + .list = &tplg->pdata_list, + .type = SND_TPLG_TYPE_DATA, ++ .tsoc = SND_SOC_TPLG_TYPE_PDATA, + }, + }; + + ssize_t ret; ++ size_t size; + unsigned int index; + + /* write manifest */ +@@ -328,9 +290,18 @@ int tplg_write_data(snd_tplg_t *tplg) + /* write all blocks */ + for (index = 0; index < ARRAY_SIZE(wtable); index++) { + wptr = &wtable[index]; +- ret = write_block(tplg, wptr->list, wptr->type); ++ /* calculate the block size in bytes for all elems in this list */ ++ size = calc_block_size(wptr->list); ++ if (size == 0) ++ continue; ++ verbose(tplg, " block size for type %s (%d:%d) is %zd\n", ++ wptr->name, wptr->type, ++ wptr->tsoc, size); ++ ret = write_elem_block(tplg, wptr->list, size, ++ wptr->tsoc, wptr->name); + if (ret < 0) { +- SNDERR("failed to write %s: %s\n", wptr->name, snd_strerror(-ret)); ++ SNDERR("failed to write %s elements: %s\n", ++ wptr->name, snd_strerror(-ret)); + return ret; + } + } +-- +2.24.1 + + +From c9e9ee3c40e9f50889f2bb4065c4556184998e8f Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 13 Dec 2019 18:53:41 +0100 +Subject: [PATCH 24/69] topology: make vebose output more nice + +Signed-off-by: Jaroslav Kysela +--- + src/topology/builder.c | 18 ++++++++++-------- + 1 file changed, 10 insertions(+), 8 deletions(-) + +diff --git a/src/topology/builder.c b/src/topology/builder.c +index f530fcd8..1a22a453 100644 +--- a/src/topology/builder.c ++++ b/src/topology/builder.c +@@ -29,7 +29,7 @@ static void verbose(snd_tplg_t *tplg, const char *fmt, ...) + return; + + va_start(va, fmt); +- fprintf(stdout, "0x%6.6zx/%6.6zd -", tplg->out_pos, tplg->out_pos); ++ fprintf(stdout, "0x%6.6zx/%6.6zd - ", tplg->out_pos, tplg->out_pos); + vfprintf(stdout, fmt, va); + va_end(va); + } +@@ -80,7 +80,7 @@ static ssize_t write_block_header(snd_tplg_t *tplg, unsigned int type, + return -EINVAL; + } + +- verbose(tplg, " header index %d type %d count %d size 0x%lx/%ld vendor %d " ++ verbose(tplg, "header index %d type %d count %d size 0x%lx/%ld vendor %d " + "version %d\n", index, type, count, + (long unsigned int)payload_size, (long int)payload_size, + vendor_type, version); +@@ -128,10 +128,10 @@ static int write_elem_block(snd_tplg_t *tplg, + continue; + + if (elem->type != SND_TPLG_TYPE_DAPM_GRAPH) +- verbose(tplg, " %s '%s': write %d bytes\n", ++ verbose(tplg, "%s '%s': write %d bytes\n", + obj_name, elem->id, elem->size); + else +- verbose(tplg, " %s '%s -> %s -> %s': write %d bytes\n", ++ verbose(tplg, "%s '%s -> %s -> %s': write %d bytes\n", + obj_name, elem->route->source, + elem->route->control, + elem->route->sink, elem->size); +@@ -197,10 +197,10 @@ static ssize_t write_manifest_data(snd_tplg_t *tplg) + return ret; + } + +- verbose(tplg, "manifest : write %d bytes\n", sizeof(tplg->manifest)); ++ verbose(tplg, "manifest: write %d bytes\n", sizeof(tplg->manifest)); + ret = twrite(tplg, &tplg->manifest, sizeof(tplg->manifest)); + if (ret >= 0) { +- verbose(tplg, "manifest : write %d priv bytes\n", tplg->manifest.priv.size); ++ verbose(tplg, "manifest: write %d priv bytes\n", tplg->manifest.priv.size); + ret = twrite(tplg, tplg->manifest_pdata, tplg->manifest.priv.size); + } + return ret; +@@ -294,9 +294,9 @@ int tplg_write_data(snd_tplg_t *tplg) + size = calc_block_size(wptr->list); + if (size == 0) + continue; +- verbose(tplg, " block size for type %s (%d:%d) is %zd\n", ++ verbose(tplg, "block size for type %s (%d:%d) is 0x%zx/%zd\n", + wptr->name, wptr->type, +- wptr->tsoc, size); ++ wptr->tsoc, size, size); + ret = write_elem_block(tplg, wptr->list, size, + wptr->tsoc, wptr->name); + if (ret < 0) { +@@ -306,5 +306,7 @@ int tplg_write_data(snd_tplg_t *tplg) + } + } + ++ verbose(tplg, "total size is 0x%zx/%zd\n", tplg->out_pos, tplg->out_pos); ++ + return 0; + } +-- +2.24.1 + + +From 3b9e39dab5ebfb525b4437a644fe54569e419874 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 13 Dec 2019 21:23:52 +0100 +Subject: [PATCH 25/69] topology: use list_insert() macro in tplg_elem_insert() + +Signed-off-by: Jaroslav Kysela +--- + src/topology/elem.c | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +diff --git a/src/topology/elem.c b/src/topology/elem.c +index a9d1d854..2066fad8 100644 +--- a/src/topology/elem.c ++++ b/src/topology/elem.c +@@ -131,7 +131,7 @@ struct tplg_elem *tplg_elem_lookup(struct list_head *base, const char* id, + return NULL; + } + +-/* insert a new element into list in the ascending order of index value*/ ++/* insert a new element into list in the ascending order of index value */ + static void tplg_elem_insert(struct tplg_elem *elem_p, struct list_head *list) + { + struct list_head *pos, *p = &(elem_p->list); +@@ -142,10 +142,8 @@ static void tplg_elem_insert(struct tplg_elem *elem_p, struct list_head *list) + if (elem_p->index < elem->index) + break; + } +- p->prev = pos->prev; +- pos->prev->next = p; +- pos->prev = p; +- p->next = pos; ++ /* insert item before pos */ ++ list_insert(p, pos->prev, pos); + } + + /* create a new common element and object */ +-- +2.24.1 + + +From 0d6949b7f1f99bf3fcd5cce78483c10f9ca35264 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 13 Dec 2019 21:52:13 +0100 +Subject: [PATCH 26/69] topology: dapm - coding fixes + +Signed-off-by: Jaroslav Kysela +--- + src/topology/dapm.c | 15 +++++++-------- + 1 file changed, 7 insertions(+), 8 deletions(-) + +diff --git a/src/topology/dapm.c b/src/topology/dapm.c +index 97c9695b..cd80a4c0 100644 +--- a/src/topology/dapm.c ++++ b/src/topology/dapm.c +@@ -152,8 +152,7 @@ static int copy_dapm_control(struct tplg_elem *elem, struct tplg_elem *ref) + } + + /* check referenced controls for a widget */ +-static int tplg_build_widget(snd_tplg_t *tplg, +- struct tplg_elem *elem) ++static int tplg_build_widget(snd_tplg_t *tplg, struct tplg_elem *elem) + { + struct tplg_ref *ref; + struct list_head *base, *pos; +@@ -164,7 +163,7 @@ static int tplg_build_widget(snd_tplg_t *tplg, + /* A widget's private data sits before the embedded controls. + * So merge the private data blocks at first + */ +- list_for_each(pos, base) { ++ list_for_each(pos, base) { + ref = list_entry(pos, struct tplg_ref, list); + + if (ref->type != SND_TPLG_TYPE_DATA) +@@ -314,7 +313,7 @@ int tplg_build_routes(snd_tplg_t *tplg) + return 0; + } + +-struct tplg_elem* tplg_elem_new_route(snd_tplg_t *tplg) ++struct tplg_elem *tplg_elem_new_route(snd_tplg_t *tplg) + { + struct tplg_elem *elem; + struct snd_soc_tplg_dapm_graph_elem *line; +@@ -342,7 +341,7 @@ struct tplg_elem* tplg_elem_new_route(snd_tplg_t *tplg) + + /* line is defined as '"source, control, sink"' */ + static int tplg_parse_line(const char *text, +- struct snd_soc_tplg_dapm_graph_elem *line) ++ struct snd_soc_tplg_dapm_graph_elem *line) + { + char buf[LINE_SIZE]; + unsigned int len, i; +@@ -422,7 +421,7 @@ static int tplg_parse_routes(snd_tplg_t *tplg, snd_config_t *cfg, int index) + } + + int tplg_parse_dapm_graph(snd_tplg_t *tplg, snd_config_t *cfg, +- void *private ATTRIBUTE_UNUSED) ++ void *private ATTRIBUTE_UNUSED) + { + snd_config_iterator_t i, next; + snd_config_t *n; +@@ -472,7 +471,7 @@ int tplg_parse_dapm_graph(snd_tplg_t *tplg, snd_config_t *cfg, + + /* DAPM Widget */ + int tplg_parse_dapm_widget(snd_tplg_t *tplg, +- snd_config_t *cfg, void *private ATTRIBUTE_UNUSED) ++ snd_config_t *cfg, void *private ATTRIBUTE_UNUSED) + { + struct snd_soc_tplg_dapm_widget *widget; + struct tplg_elem *elem; +@@ -645,7 +644,7 @@ int tplg_add_route(snd_tplg_t *tplg, struct snd_tplg_graph_elem *t) + snd_strlcpy(line->source, t->src, SNDRV_CTL_ELEM_ID_NAME_MAXLEN); + if (t->ctl) + snd_strlcpy(line->control, t->ctl, +- SNDRV_CTL_ELEM_ID_NAME_MAXLEN); ++ SNDRV_CTL_ELEM_ID_NAME_MAXLEN); + snd_strlcpy(line->sink, t->sink, SNDRV_CTL_ELEM_ID_NAME_MAXLEN); + + return 0; +-- +2.24.1 + + +From 2b50b594dcbf69f8dcc6e8cf673748f7063c3c17 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 13 Dec 2019 21:56:58 +0100 +Subject: [PATCH 27/69] topology: dapm - merge identical index blocks like for + other elems + +Signed-off-by: Jaroslav Kysela +--- + src/topology/dapm.c | 14 +++++++------- + src/topology/elem.c | 2 +- + src/topology/tplg_local.h | 1 + + 3 files changed, 9 insertions(+), 8 deletions(-) + +diff --git a/src/topology/dapm.c b/src/topology/dapm.c +index cd80a4c0..ce469131 100644 +--- a/src/topology/dapm.c ++++ b/src/topology/dapm.c +@@ -313,7 +313,7 @@ int tplg_build_routes(snd_tplg_t *tplg) + return 0; + } + +-struct tplg_elem *tplg_elem_new_route(snd_tplg_t *tplg) ++struct tplg_elem *tplg_elem_new_route(snd_tplg_t *tplg, int index) + { + struct tplg_elem *elem; + struct snd_soc_tplg_dapm_graph_elem *line; +@@ -322,7 +322,8 @@ struct tplg_elem *tplg_elem_new_route(snd_tplg_t *tplg) + if (!elem) + return NULL; + +- list_add_tail(&elem->list, &tplg->route_list); ++ elem->index = index; ++ tplg_elem_insert(elem, &tplg->route_list); + strcpy(elem->id, "line"); + elem->type = SND_TPLG_TYPE_DAPM_GRAPH; + elem->size = sizeof(*line); +@@ -403,10 +404,9 @@ static int tplg_parse_routes(snd_tplg_t *tplg, snd_config_t *cfg, int index) + if (snd_config_get_string(n, &val) < 0) + continue; + +- elem = tplg_elem_new_route(tplg); ++ elem = tplg_elem_new_route(tplg, index); + if (!elem) + return -ENOMEM; +- elem->index = index; + line = elem->route; + + err = tplg_parse_line(val, line); +@@ -628,7 +628,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, + return 0; + } + +-int tplg_add_route(snd_tplg_t *tplg, struct snd_tplg_graph_elem *t) ++int tplg_add_route(snd_tplg_t *tplg, struct snd_tplg_graph_elem *t, int index) + { + struct tplg_elem *elem; + struct snd_soc_tplg_dapm_graph_elem *line; +@@ -636,7 +636,7 @@ int tplg_add_route(snd_tplg_t *tplg, struct snd_tplg_graph_elem *t) + if (!t->src || !t->sink) + return -EINVAL; + +- elem = tplg_elem_new_route(tplg); ++ elem = tplg_elem_new_route(tplg, index); + if (!elem) + return -ENOMEM; + +@@ -656,7 +656,7 @@ int tplg_add_graph_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) + int i, ret; + + for (i = 0; i < gt->count; i++) { +- ret = tplg_add_route(tplg, gt->elem + i); ++ ret = tplg_add_route(tplg, gt->elem + i, t->index); + if (ret < 0) + return ret; + } +diff --git a/src/topology/elem.c b/src/topology/elem.c +index 2066fad8..140cdd32 100644 +--- a/src/topology/elem.c ++++ b/src/topology/elem.c +@@ -132,7 +132,7 @@ struct tplg_elem *tplg_elem_lookup(struct list_head *base, const char* id, + } + + /* insert a new element into list in the ascending order of index value */ +-static void tplg_elem_insert(struct tplg_elem *elem_p, struct list_head *list) ++void tplg_elem_insert(struct tplg_elem *elem_p, struct list_head *list) + { + struct list_head *pos, *p = &(elem_p->list); + struct tplg_elem *elem; +diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h +index 7b8abcde..11efce6d 100644 +--- a/src/topology/tplg_local.h ++++ b/src/topology/tplg_local.h +@@ -273,6 +273,7 @@ int tplg_ref_add_elem(struct tplg_elem *elem, struct tplg_elem *elem_ref); + struct tplg_elem *tplg_elem_new(void); + void tplg_elem_free(struct tplg_elem *elem); + void tplg_elem_free_list(struct list_head *base); ++void tplg_elem_insert(struct tplg_elem *elem_p, struct list_head *list); + struct tplg_elem *tplg_elem_lookup(struct list_head *base, + const char* id, + unsigned int type, +-- +2.24.1 + + +From 780f17126aa8d54fc09694cbf652d4135eb731c0 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 13 Dec 2019 22:07:46 +0100 +Subject: [PATCH 28/69] topology: more coding fixes + +Signed-off-by: Jaroslav Kysela +--- + src/topology/channel.c | 4 ++-- + src/topology/ctl.c | 15 ++++++++------- + src/topology/elem.c | 6 ++++-- + src/topology/ops.c | 6 +++--- + src/topology/pcm.c | 20 ++++++++++++-------- + src/topology/text.c | 2 +- + 6 files changed, 30 insertions(+), 23 deletions(-) + +diff --git a/src/topology/channel.c b/src/topology/channel.c +index 8516b23f..60f7e219 100644 +--- a/src/topology/channel.c ++++ b/src/topology/channel.c +@@ -74,8 +74,8 @@ static int lookup_channel(const char *c) + } + + /* Parse a channel mapping. */ +-int tplg_parse_channel(snd_tplg_t *tplg, +- snd_config_t *cfg, void *private) ++int tplg_parse_channel(snd_tplg_t *tplg, snd_config_t *cfg, ++ void *private) + { + snd_config_iterator_t i, next; + snd_config_t *n; +diff --git a/src/topology/ctl.c b/src/topology/ctl.c +index a0962522..1db0b16e 100644 +--- a/src/topology/ctl.c ++++ b/src/topology/ctl.c +@@ -46,7 +46,7 @@ static const struct ctl_access_elem ctl_access[] = { + + /* find CTL access strings and conver to values */ + static int parse_access_values(snd_config_t *cfg, +- struct snd_soc_tplg_ctl_hdr *hdr) ++ struct snd_soc_tplg_ctl_hdr *hdr) + { + snd_config_iterator_t i, next; + snd_config_t *n; +@@ -77,7 +77,7 @@ static int parse_access_values(snd_config_t *cfg, + + /* Parse Access */ + int parse_access(snd_config_t *cfg, +- struct snd_soc_tplg_ctl_hdr *hdr) ++ struct snd_soc_tplg_ctl_hdr *hdr) + { + snd_config_iterator_t i, next; + snd_config_t *n; +@@ -118,7 +118,7 @@ static int copy_tlv(struct tplg_elem *elem, struct tplg_elem *ref) + + /* check referenced TLV for a mixer control */ + static int tplg_build_mixer_control(snd_tplg_t *tplg, +- struct tplg_elem *elem) ++ struct tplg_elem *elem) + { + struct tplg_ref *ref; + struct list_head *base, *pos; +@@ -157,7 +157,7 @@ static int tplg_build_mixer_control(snd_tplg_t *tplg, + } + + static void copy_enum_texts(struct tplg_elem *enum_elem, +- struct tplg_elem *ref_elem) ++ struct tplg_elem *ref_elem) + { + struct snd_soc_tplg_enum_control *ec = enum_elem->enum_ctrl; + struct tplg_texts *texts = ref_elem->texts; +@@ -169,7 +169,7 @@ static void copy_enum_texts(struct tplg_elem *enum_elem, + + /* check referenced text for a enum control */ + static int tplg_build_enum_control(snd_tplg_t *tplg, +- struct tplg_elem *elem) ++ struct tplg_elem *elem) + { + struct tplg_ref *ref; + struct list_head *base, *pos; +@@ -331,7 +331,7 @@ static int tplg_parse_tlv_dbscale(snd_config_t *cfg, struct tplg_elem *elem) + + /* Parse TLV */ + int tplg_parse_tlv(snd_tplg_t *tplg, snd_config_t *cfg, +- void *private ATTRIBUTE_UNUSED) ++ void *private ATTRIBUTE_UNUSED) + { + snd_config_iterator_t i, next; + snd_config_t *n; +@@ -364,7 +364,8 @@ int tplg_parse_tlv(snd_tplg_t *tplg, snd_config_t *cfg, + + /* Parse Control Bytes */ + int tplg_parse_control_bytes(snd_tplg_t *tplg, +- snd_config_t *cfg, void *private ATTRIBUTE_UNUSED) ++ snd_config_t *cfg, ++ void *private ATTRIBUTE_UNUSED) + { + struct snd_soc_tplg_bytes_control *be; + struct tplg_elem *elem; +diff --git a/src/topology/elem.c b/src/topology/elem.c +index 140cdd32..d8618cc9 100644 +--- a/src/topology/elem.c ++++ b/src/topology/elem.c +@@ -107,7 +107,7 @@ void tplg_elem_free_list(struct list_head *base) + } + + struct tplg_elem *tplg_elem_lookup(struct list_head *base, const char* id, +- unsigned int type, int index) ++ unsigned int type, int index) + { + struct list_head *pos; + struct tplg_elem *elem; +@@ -148,7 +148,9 @@ void tplg_elem_insert(struct tplg_elem *elem_p, struct list_head *list) + + /* create a new common element and object */ + struct tplg_elem* tplg_elem_new_common(snd_tplg_t *tplg, +- snd_config_t *cfg, const char *name, enum snd_tplg_type type) ++ snd_config_t *cfg, ++ const char *name, ++ enum snd_tplg_type type) + { + struct tplg_elem *elem; + const char *id, *val = NULL; +diff --git a/src/topology/ops.c b/src/topology/ops.c +index 6f8dc1ff..0f4295a2 100644 +--- a/src/topology/ops.c ++++ b/src/topology/ops.c +@@ -48,8 +48,8 @@ static int lookup_ops(const char *c) + /* Parse Control operations. Ops can come from standard names above or + * bespoke driver controls with numbers >= 256 + */ +-int tplg_parse_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, +- snd_config_t *cfg, void *private) ++int tplg_parse_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, snd_config_t *cfg, ++ void *private) + { + snd_config_iterator_t i, next; + snd_config_t *n; +@@ -88,7 +88,7 @@ int tplg_parse_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, + * bespoke driver controls with numbers >= 256 + */ + int tplg_parse_ext_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, +- snd_config_t *cfg, void *private) ++ snd_config_t *cfg, void *private) + { + snd_config_iterator_t i, next; + snd_config_t *n; +diff --git a/src/topology/pcm.c b/src/topology/pcm.c +index 553fd822..98a8df97 100644 +--- a/src/topology/pcm.c ++++ b/src/topology/pcm.c +@@ -63,7 +63,8 @@ struct tplg_elem *lookup_pcm_dai_stream(struct list_head *base, const char* id) + + /* copy referenced caps to the parent (pcm or be dai) */ + static void copy_stream_caps(const char *id ATTRIBUTE_UNUSED, +- struct snd_soc_tplg_stream_caps *caps, struct tplg_elem *ref_elem) ++ struct snd_soc_tplg_stream_caps *caps, ++ struct tplg_elem *ref_elem) + { + struct snd_soc_tplg_stream_caps *ref_caps = ref_elem->stream_caps; + +@@ -75,7 +76,8 @@ static void copy_stream_caps(const char *id ATTRIBUTE_UNUSED, + + /* find and copy the referenced stream caps */ + static int tplg_build_stream_caps(snd_tplg_t *tplg, +- const char *id, int index, struct snd_soc_tplg_stream_caps *caps) ++ const char *id, int index, ++ struct snd_soc_tplg_stream_caps *caps) + { + struct tplg_elem *ref_elem = NULL; + unsigned int i; +@@ -207,7 +209,8 @@ int tplg_build_dais(snd_tplg_t *tplg, unsigned int type) + } + + static int tplg_build_stream_cfg(snd_tplg_t *tplg, +- struct snd_soc_tplg_stream *stream, int num_streams, int index) ++ struct snd_soc_tplg_stream *stream, ++ int num_streams, int index) + { + struct snd_soc_tplg_stream *strm; + struct tplg_elem *ref_elem; +@@ -367,7 +370,8 @@ static int split_rate(struct snd_soc_tplg_stream_caps *caps, char *str) + + /* Parse pcm stream capabilities */ + int tplg_parse_stream_caps(snd_tplg_t *tplg, +- snd_config_t *cfg, void *private ATTRIBUTE_UNUSED) ++ snd_config_t *cfg, ++ void *private ATTRIBUTE_UNUSED) + { + struct snd_soc_tplg_stream_caps *sc; + struct tplg_elem *elem; +@@ -637,8 +641,8 @@ static int parse_flag(snd_config_t *n, unsigned int mask_in, + } + + /* Parse PCM (for front end DAI & DAI link) in text conf file */ +-int tplg_parse_pcm(snd_tplg_t *tplg, +- snd_config_t *cfg, void *private ATTRIBUTE_UNUSED) ++int tplg_parse_pcm(snd_tplg_t *tplg, snd_config_t *cfg, ++ void *private ATTRIBUTE_UNUSED) + { + struct snd_soc_tplg_pcm *pcm; + struct tplg_elem *elem; +@@ -746,8 +750,8 @@ int tplg_parse_pcm(snd_tplg_t *tplg, + } + + /* Parse physical DAI */ +-int tplg_parse_dai(snd_tplg_t *tplg, +- snd_config_t *cfg, void *private ATTRIBUTE_UNUSED) ++int tplg_parse_dai(snd_tplg_t *tplg, snd_config_t *cfg, ++ void *private ATTRIBUTE_UNUSED) + { + struct snd_soc_tplg_dai *dai; + struct tplg_elem *elem; +diff --git a/src/topology/text.c b/src/topology/text.c +index 72647fe0..f301a4de 100644 +--- a/src/topology/text.c ++++ b/src/topology/text.c +@@ -59,7 +59,7 @@ static int parse_text_values(snd_config_t *cfg, struct tplg_elem *elem) + + /* Parse Text data */ + int tplg_parse_text(snd_tplg_t *tplg, snd_config_t *cfg, +- void *private ATTRIBUTE_UNUSED) ++ void *private ATTRIBUTE_UNUSED) + { + snd_config_iterator_t i, next; + snd_config_t *n; +-- +2.24.1 + + +From ae564665ec261cf104de499b1cdda3564070fc65 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Fri, 20 Dec 2019 15:46:48 +0100 +Subject: [PATCH 29/69] Fix alsa/sound/*.h for external programs + +The recent update of sound/*.h to sync with the latest Linus uapi +files broke the build of alsa-tools programs. These files used to be +a modified version of Linux sound/* header files, so that they could +be built without Linux headers. The special prefix like __user and +other things were worked around there. + +We may do that again, but a better approach is to fix those things in +Linux kernel uapi side, while we keep the minimal workaround in +alsa-lib such as the __u16 and co type definitions. + +This patch is such an attempt, namely: +- Keep the original $LINUX/uapi/sound/*.h in include/sound/uapi + directory +- The "fixes" are applied to some uapi headers, so that they don't + contain Linux-specific prefix and use of opaque struct like + snd_ctl_elem_id +- The uapi headers are included indirectly from include/sound/*.h +- Some headers have inclusion of type_compat.h for the Linux variable + types and prefixes +- type_compat.h tries to use when __linux__ is + defined, instead of the own conflicting definitions + +The last type might need a bit more adjustment depending on the +compiler, but it can be fixed locally without disturbing else. + +Signed-off-by: Takashi Iwai +--- + configure.ac | 3 +- + include/sound/Makefile.am | 6 +- + include/sound/asequencer.h | 613 +---------------- + include/sound/asoc.h | 634 +----------------- + include/sound/asound.h | 1039 +---------------------------- + include/sound/asound_fm.h | 136 +--- + include/sound/emu10k1.h | 383 +---------- + include/sound/hdsp.h | 113 +--- + include/sound/hdspm.h | 234 +------ + include/sound/sb16_csp.h | 124 +--- + include/sound/sscape_ioctl.h | 22 +- + include/sound/tlv.h | 118 +--- + include/sound/type_compat.h | 13 + + include/sound/uapi/Makefile.am | 6 + + include/sound/uapi/asequencer.h | 612 +++++++++++++++++ + include/sound/uapi/asoc.h | 633 ++++++++++++++++++ + include/sound/uapi/asound.h | 1038 ++++++++++++++++++++++++++++ + include/sound/uapi/asound_fm.h | 135 ++++ + include/sound/uapi/emu10k1.h | 395 +++++++++++ + include/sound/uapi/hdsp.h | 109 +++ + include/sound/uapi/hdspm.h | 230 +++++++ + include/sound/uapi/sb16_csp.h | 123 ++++ + include/sound/uapi/sscape_ioctl.h | 21 + + include/sound/uapi/tlv.h | 117 ++++ + src/topology/tplg_local.h | 3 +- + 25 files changed, 3452 insertions(+), 3408 deletions(-) + create mode 100644 include/sound/uapi/Makefile.am + create mode 100644 include/sound/uapi/asequencer.h + create mode 100644 include/sound/uapi/asoc.h + create mode 100644 include/sound/uapi/asound.h + create mode 100644 include/sound/uapi/asound_fm.h + create mode 100644 include/sound/uapi/emu10k1.h + create mode 100644 include/sound/uapi/hdsp.h + create mode 100644 include/sound/uapi/hdspm.h + create mode 100644 include/sound/uapi/sb16_csp.h + create mode 100644 include/sound/uapi/sscape_ioctl.h + create mode 100644 include/sound/uapi/tlv.h + +diff --git a/configure.ac b/configure.ac +index 119ef600..886f87bc 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -707,7 +707,8 @@ if test ! -L "$srcdir"/include/alsa ; then + fi + + AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \ +- include/Makefile include/sound/Makefile src/Versions src/Makefile \ ++ include/Makefile include/sound/Makefile include/sound/uapi/Makefile \ ++ src/Versions src/Makefile \ + src/control/Makefile src/mixer/Makefile \ + src/pcm/Makefile src/pcm/scopes/Makefile \ + src/rawmidi/Makefile src/timer/Makefile \ +diff --git a/include/sound/Makefile.am b/include/sound/Makefile.am +index 99c42211..ccc7d273 100644 +--- a/include/sound/Makefile.am ++++ b/include/sound/Makefile.am +@@ -1,7 +1,9 @@ ++SUBDIRS = uapi ++ + alsasoundincludedir = ${includedir}/alsa/sound + + alsasoundinclude_HEADERS = asound_fm.h hdsp.h hdspm.h sb16_csp.h \ +- sscape_ioctl.h emu10k1.h type_compat.h \ +- asoc.h tlv.h ++ sscape_ioctl.h emu10k1.h asoc.h tlv.h \ ++ type_compat.h + + noinst_HEADERS = asound.h asequencer.h +diff --git a/include/sound/asequencer.h b/include/sound/asequencer.h +index a75e14ed..e539a77e 100644 +--- a/include/sound/asequencer.h ++++ b/include/sound/asequencer.h +@@ -1,612 +1 @@ +-/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ +-/* +- * Main header file for the ALSA sequencer +- * Copyright (c) 1998-1999 by Frank van de Pol +- * (c) 1998-1999 by Jaroslav Kysela +- * +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this program; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- * +- */ +-#ifndef _UAPI__SOUND_ASEQUENCER_H +-#define _UAPI__SOUND_ASEQUENCER_H +- +-#include +- +-/** version of the sequencer */ +-#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 2) +- +-/** +- * definition of sequencer event types +- */ +- +-/** system messages +- * event data type = #snd_seq_result +- */ +-#define SNDRV_SEQ_EVENT_SYSTEM 0 +-#define SNDRV_SEQ_EVENT_RESULT 1 +- +-/** note messages (channel specific) +- * event data type = #snd_seq_ev_note +- */ +-#define SNDRV_SEQ_EVENT_NOTE 5 +-#define SNDRV_SEQ_EVENT_NOTEON 6 +-#define SNDRV_SEQ_EVENT_NOTEOFF 7 +-#define SNDRV_SEQ_EVENT_KEYPRESS 8 +- +-/** control messages (channel specific) +- * event data type = #snd_seq_ev_ctrl +- */ +-#define SNDRV_SEQ_EVENT_CONTROLLER 10 +-#define SNDRV_SEQ_EVENT_PGMCHANGE 11 +-#define SNDRV_SEQ_EVENT_CHANPRESS 12 +-#define SNDRV_SEQ_EVENT_PITCHBEND 13 /**< from -8192 to 8191 */ +-#define SNDRV_SEQ_EVENT_CONTROL14 14 /**< 14 bit controller value */ +-#define SNDRV_SEQ_EVENT_NONREGPARAM 15 /**< 14 bit NRPN address + 14 bit unsigned value */ +-#define SNDRV_SEQ_EVENT_REGPARAM 16 /**< 14 bit RPN address + 14 bit unsigned value */ +- +-/** synchronisation messages +- * event data type = #snd_seq_ev_ctrl +- */ +-#define SNDRV_SEQ_EVENT_SONGPOS 20 /* Song Position Pointer with LSB and MSB values */ +-#define SNDRV_SEQ_EVENT_SONGSEL 21 /* Song Select with song ID number */ +-#define SNDRV_SEQ_EVENT_QFRAME 22 /* midi time code quarter frame */ +-#define SNDRV_SEQ_EVENT_TIMESIGN 23 /* SMF Time Signature event */ +-#define SNDRV_SEQ_EVENT_KEYSIGN 24 /* SMF Key Signature event */ +- +-/** timer messages +- * event data type = snd_seq_ev_queue_control +- */ +-#define SNDRV_SEQ_EVENT_START 30 /* midi Real Time Start message */ +-#define SNDRV_SEQ_EVENT_CONTINUE 31 /* midi Real Time Continue message */ +-#define SNDRV_SEQ_EVENT_STOP 32 /* midi Real Time Stop message */ +-#define SNDRV_SEQ_EVENT_SETPOS_TICK 33 /* set tick queue position */ +-#define SNDRV_SEQ_EVENT_SETPOS_TIME 34 /* set realtime queue position */ +-#define SNDRV_SEQ_EVENT_TEMPO 35 /* (SMF) Tempo event */ +-#define SNDRV_SEQ_EVENT_CLOCK 36 /* midi Real Time Clock message */ +-#define SNDRV_SEQ_EVENT_TICK 37 /* midi Real Time Tick message */ +-#define SNDRV_SEQ_EVENT_QUEUE_SKEW 38 /* skew queue tempo */ +- +-/** others +- * event data type = none +- */ +-#define SNDRV_SEQ_EVENT_TUNE_REQUEST 40 /* tune request */ +-#define SNDRV_SEQ_EVENT_RESET 41 /* reset to power-on state */ +-#define SNDRV_SEQ_EVENT_SENSING 42 /* "active sensing" event */ +- +-/** echo back, kernel private messages +- * event data type = any type +- */ +-#define SNDRV_SEQ_EVENT_ECHO 50 /* echo event */ +-#define SNDRV_SEQ_EVENT_OSS 51 /* OSS raw event */ +- +-/** system status messages (broadcast for subscribers) +- * event data type = snd_seq_addr +- */ +-#define SNDRV_SEQ_EVENT_CLIENT_START 60 /* new client has connected */ +-#define SNDRV_SEQ_EVENT_CLIENT_EXIT 61 /* client has left the system */ +-#define SNDRV_SEQ_EVENT_CLIENT_CHANGE 62 /* client status/info has changed */ +-#define SNDRV_SEQ_EVENT_PORT_START 63 /* new port was created */ +-#define SNDRV_SEQ_EVENT_PORT_EXIT 64 /* port was deleted from system */ +-#define SNDRV_SEQ_EVENT_PORT_CHANGE 65 /* port status/info has changed */ +- +-/** port connection changes +- * event data type = snd_seq_connect +- */ +-#define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */ +-#define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */ +- +-/* 70-89: synthesizer events - obsoleted */ +- +-/** user-defined events with fixed length +- * event data type = any +- */ +-#define SNDRV_SEQ_EVENT_USR0 90 +-#define SNDRV_SEQ_EVENT_USR1 91 +-#define SNDRV_SEQ_EVENT_USR2 92 +-#define SNDRV_SEQ_EVENT_USR3 93 +-#define SNDRV_SEQ_EVENT_USR4 94 +-#define SNDRV_SEQ_EVENT_USR5 95 +-#define SNDRV_SEQ_EVENT_USR6 96 +-#define SNDRV_SEQ_EVENT_USR7 97 +-#define SNDRV_SEQ_EVENT_USR8 98 +-#define SNDRV_SEQ_EVENT_USR9 99 +- +-/* 100-118: instrument layer - obsoleted */ +-/* 119-129: reserved */ +- +-/* 130-139: variable length events +- * event data type = snd_seq_ev_ext +- * (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set) +- */ +-#define SNDRV_SEQ_EVENT_SYSEX 130 /* system exclusive data (variable length) */ +-#define SNDRV_SEQ_EVENT_BOUNCE 131 /* error event */ +-/* 132-134: reserved */ +-#define SNDRV_SEQ_EVENT_USR_VAR0 135 +-#define SNDRV_SEQ_EVENT_USR_VAR1 136 +-#define SNDRV_SEQ_EVENT_USR_VAR2 137 +-#define SNDRV_SEQ_EVENT_USR_VAR3 138 +-#define SNDRV_SEQ_EVENT_USR_VAR4 139 +- +-/* 150-151: kernel events with quote - DO NOT use in user clients */ +-#define SNDRV_SEQ_EVENT_KERNEL_ERROR 150 +-#define SNDRV_SEQ_EVENT_KERNEL_QUOTE 151 /* obsolete */ +- +-/* 152-191: reserved */ +- +-/* 192-254: hardware specific events */ +- +-/* 255: special event */ +-#define SNDRV_SEQ_EVENT_NONE 255 +- +- +-typedef unsigned char snd_seq_event_type_t; +- +-/** event address */ +-struct snd_seq_addr { +- unsigned char client; /**< Client number: 0..255, 255 = broadcast to all clients */ +- unsigned char port; /**< Port within client: 0..255, 255 = broadcast to all ports */ +-}; +- +-/** port connection */ +-struct snd_seq_connect { +- struct snd_seq_addr sender; +- struct snd_seq_addr dest; +-}; +- +- +-#define SNDRV_SEQ_ADDRESS_UNKNOWN 253 /* unknown source */ +-#define SNDRV_SEQ_ADDRESS_SUBSCRIBERS 254 /* send event to all subscribed ports */ +-#define SNDRV_SEQ_ADDRESS_BROADCAST 255 /* send event to all queues/clients/ports/channels */ +-#define SNDRV_SEQ_QUEUE_DIRECT 253 /* direct dispatch */ +- +- /* event mode flag - NOTE: only 8 bits available! */ +-#define SNDRV_SEQ_TIME_STAMP_TICK (0<<0) /* timestamp in clock ticks */ +-#define SNDRV_SEQ_TIME_STAMP_REAL (1<<0) /* timestamp in real time */ +-#define SNDRV_SEQ_TIME_STAMP_MASK (1<<0) +- +-#define SNDRV_SEQ_TIME_MODE_ABS (0<<1) /* absolute timestamp */ +-#define SNDRV_SEQ_TIME_MODE_REL (1<<1) /* relative to current time */ +-#define SNDRV_SEQ_TIME_MODE_MASK (1<<1) +- +-#define SNDRV_SEQ_EVENT_LENGTH_FIXED (0<<2) /* fixed event size */ +-#define SNDRV_SEQ_EVENT_LENGTH_VARIABLE (1<<2) /* variable event size */ +-#define SNDRV_SEQ_EVENT_LENGTH_VARUSR (2<<2) /* variable event size - user memory space */ +-#define SNDRV_SEQ_EVENT_LENGTH_MASK (3<<2) +- +-#define SNDRV_SEQ_PRIORITY_NORMAL (0<<4) /* normal priority */ +-#define SNDRV_SEQ_PRIORITY_HIGH (1<<4) /* event should be processed before others */ +-#define SNDRV_SEQ_PRIORITY_MASK (1<<4) +- +- +- /* note event */ +-struct snd_seq_ev_note { +- unsigned char channel; +- unsigned char note; +- unsigned char velocity; +- unsigned char off_velocity; /* only for SNDRV_SEQ_EVENT_NOTE */ +- unsigned int duration; /* only for SNDRV_SEQ_EVENT_NOTE */ +-}; +- +- /* controller event */ +-struct snd_seq_ev_ctrl { +- unsigned char channel; +- unsigned char unused1, unused2, unused3; /* pad */ +- unsigned int param; +- signed int value; +-}; +- +- /* generic set of bytes (12x8 bit) */ +-struct snd_seq_ev_raw8 { +- unsigned char d[12]; /* 8 bit value */ +-}; +- +- /* generic set of integers (3x32 bit) */ +-struct snd_seq_ev_raw32 { +- unsigned int d[3]; /* 32 bit value */ +-}; +- +- /* external stored data */ +-struct snd_seq_ev_ext { +- unsigned int len; /* length of data */ +- void *ptr; /* pointer to data (note: maybe 64-bit) */ +-} __attribute__((packed)); +- +-struct snd_seq_result { +- int event; /* processed event type */ +- int result; +-}; +- +- +-struct snd_seq_real_time { +- unsigned int tv_sec; /* seconds */ +- unsigned int tv_nsec; /* nanoseconds */ +-}; +- +-typedef unsigned int snd_seq_tick_time_t; /* midi ticks */ +- +-union snd_seq_timestamp { +- snd_seq_tick_time_t tick; +- struct snd_seq_real_time time; +-}; +- +-struct snd_seq_queue_skew { +- unsigned int value; +- unsigned int base; +-}; +- +- /* queue timer control */ +-struct snd_seq_ev_queue_control { +- unsigned char queue; /* affected queue */ +- unsigned char pad[3]; /* reserved */ +- union { +- signed int value; /* affected value (e.g. tempo) */ +- union snd_seq_timestamp time; /* time */ +- unsigned int position; /* sync position */ +- struct snd_seq_queue_skew skew; +- unsigned int d32[2]; +- unsigned char d8[8]; +- } param; +-}; +- +- /* quoted event - inside the kernel only */ +-struct snd_seq_ev_quote { +- struct snd_seq_addr origin; /* original sender */ +- unsigned short value; /* optional data */ +- struct snd_seq_event *event; /* quoted event */ +-} __attribute__((packed)); +- +- +- /* sequencer event */ +-struct snd_seq_event { +- snd_seq_event_type_t type; /* event type */ +- unsigned char flags; /* event flags */ +- char tag; +- +- unsigned char queue; /* schedule queue */ +- union snd_seq_timestamp time; /* schedule time */ +- +- +- struct snd_seq_addr source; /* source address */ +- struct snd_seq_addr dest; /* destination address */ +- +- union { /* event data... */ +- struct snd_seq_ev_note note; +- struct snd_seq_ev_ctrl control; +- struct snd_seq_ev_raw8 raw8; +- struct snd_seq_ev_raw32 raw32; +- struct snd_seq_ev_ext ext; +- struct snd_seq_ev_queue_control queue; +- union snd_seq_timestamp time; +- struct snd_seq_addr addr; +- struct snd_seq_connect connect; +- struct snd_seq_result result; +- struct snd_seq_ev_quote quote; +- } data; +-}; +- +- +-/* +- * bounce event - stored as variable size data +- */ +-struct snd_seq_event_bounce { +- int err; +- struct snd_seq_event event; +- /* external data follows here. */ +-}; +- +- +- /* system information */ +-struct snd_seq_system_info { +- int queues; /* maximum queues count */ +- int clients; /* maximum clients count */ +- int ports; /* maximum ports per client */ +- int channels; /* maximum channels per port */ +- int cur_clients; /* current clients */ +- int cur_queues; /* current queues */ +- char reserved[24]; +-}; +- +- +- /* system running information */ +-struct snd_seq_running_info { +- unsigned char client; /* client id */ +- unsigned char big_endian; /* 1 = big-endian */ +- unsigned char cpu_mode; /* 4 = 32bit, 8 = 64bit */ +- unsigned char pad; /* reserved */ +- unsigned char reserved[12]; +-}; +- +- +- /* known client numbers */ +-#define SNDRV_SEQ_CLIENT_SYSTEM 0 +- /* internal client numbers */ +-#define SNDRV_SEQ_CLIENT_DUMMY 14 /* midi through */ +-#define SNDRV_SEQ_CLIENT_OSS 15 /* oss sequencer emulator */ +- +- +- /* client types */ +-typedef int __bitwise snd_seq_client_type_t; +-#define NO_CLIENT ((__force snd_seq_client_type_t) 0) +-#define USER_CLIENT ((__force snd_seq_client_type_t) 1) +-#define KERNEL_CLIENT ((__force snd_seq_client_type_t) 2) +- +- /* event filter flags */ +-#define SNDRV_SEQ_FILTER_BROADCAST (1<<0) /* accept broadcast messages */ +-#define SNDRV_SEQ_FILTER_MULTICAST (1<<1) /* accept multicast messages */ +-#define SNDRV_SEQ_FILTER_BOUNCE (1<<2) /* accept bounce event in error */ +-#define SNDRV_SEQ_FILTER_USE_EVENT (1<<31) /* use event filter */ +- +-struct snd_seq_client_info { +- int client; /* client number to inquire */ +- snd_seq_client_type_t type; /* client type */ +- char name[64]; /* client name */ +- unsigned int filter; /* filter flags */ +- unsigned char multicast_filter[8]; /* multicast filter bitmap */ +- unsigned char event_filter[32]; /* event filter bitmap */ +- int num_ports; /* RO: number of ports */ +- int event_lost; /* number of lost events */ +- int card; /* RO: card number[kernel] */ +- int pid; /* RO: pid[user] */ +- char reserved[56]; /* for future use */ +-}; +- +- +-/* client pool size */ +-struct snd_seq_client_pool { +- int client; /* client number to inquire */ +- int output_pool; /* outgoing (write) pool size */ +- int input_pool; /* incoming (read) pool size */ +- int output_room; /* minimum free pool size for select/blocking mode */ +- int output_free; /* unused size */ +- int input_free; /* unused size */ +- char reserved[64]; +-}; +- +- +-/* Remove events by specified criteria */ +- +-#define SNDRV_SEQ_REMOVE_INPUT (1<<0) /* Flush input queues */ +-#define SNDRV_SEQ_REMOVE_OUTPUT (1<<1) /* Flush output queues */ +-#define SNDRV_SEQ_REMOVE_DEST (1<<2) /* Restrict by destination q:client:port */ +-#define SNDRV_SEQ_REMOVE_DEST_CHANNEL (1<<3) /* Restrict by channel */ +-#define SNDRV_SEQ_REMOVE_TIME_BEFORE (1<<4) /* Restrict to before time */ +-#define SNDRV_SEQ_REMOVE_TIME_AFTER (1<<5) /* Restrict to time or after */ +-#define SNDRV_SEQ_REMOVE_TIME_TICK (1<<6) /* Time is in ticks */ +-#define SNDRV_SEQ_REMOVE_EVENT_TYPE (1<<7) /* Restrict to event type */ +-#define SNDRV_SEQ_REMOVE_IGNORE_OFF (1<<8) /* Do not flush off events */ +-#define SNDRV_SEQ_REMOVE_TAG_MATCH (1<<9) /* Restrict to events with given tag */ +- +-struct snd_seq_remove_events { +- unsigned int remove_mode; /* Flags that determine what gets removed */ +- +- union snd_seq_timestamp time; +- +- unsigned char queue; /* Queue for REMOVE_DEST */ +- struct snd_seq_addr dest; /* Address for REMOVE_DEST */ +- unsigned char channel; /* Channel for REMOVE_DEST */ +- +- int type; /* For REMOVE_EVENT_TYPE */ +- char tag; /* Tag for REMOVE_TAG */ +- +- int reserved[10]; /* To allow for future binary compatibility */ +- +-}; +- +- +- /* known port numbers */ +-#define SNDRV_SEQ_PORT_SYSTEM_TIMER 0 +-#define SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE 1 +- +- /* port capabilities (32 bits) */ +-#define SNDRV_SEQ_PORT_CAP_READ (1<<0) /* readable from this port */ +-#define SNDRV_SEQ_PORT_CAP_WRITE (1<<1) /* writable to this port */ +- +-#define SNDRV_SEQ_PORT_CAP_SYNC_READ (1<<2) +-#define SNDRV_SEQ_PORT_CAP_SYNC_WRITE (1<<3) +- +-#define SNDRV_SEQ_PORT_CAP_DUPLEX (1<<4) +- +-#define SNDRV_SEQ_PORT_CAP_SUBS_READ (1<<5) /* allow read subscription */ +-#define SNDRV_SEQ_PORT_CAP_SUBS_WRITE (1<<6) /* allow write subscription */ +-#define SNDRV_SEQ_PORT_CAP_NO_EXPORT (1<<7) /* routing not allowed */ +- +- /* port type */ +-#define SNDRV_SEQ_PORT_TYPE_SPECIFIC (1<<0) /* hardware specific */ +-#define SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC (1<<1) /* generic MIDI device */ +-#define SNDRV_SEQ_PORT_TYPE_MIDI_GM (1<<2) /* General MIDI compatible device */ +-#define SNDRV_SEQ_PORT_TYPE_MIDI_GS (1<<3) /* GS compatible device */ +-#define SNDRV_SEQ_PORT_TYPE_MIDI_XG (1<<4) /* XG compatible device */ +-#define SNDRV_SEQ_PORT_TYPE_MIDI_MT32 (1<<5) /* MT-32 compatible device */ +-#define SNDRV_SEQ_PORT_TYPE_MIDI_GM2 (1<<6) /* General MIDI 2 compatible device */ +- +-/* other standards...*/ +-#define SNDRV_SEQ_PORT_TYPE_SYNTH (1<<10) /* Synth device (no MIDI compatible - direct wavetable) */ +-#define SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11) /* Sampling device (support sample download) */ +-#define SNDRV_SEQ_PORT_TYPE_SAMPLE (1<<12) /* Sampling device (sample can be downloaded at any time) */ +-/*...*/ +-#define SNDRV_SEQ_PORT_TYPE_HARDWARE (1<<16) /* driver for a hardware device */ +-#define SNDRV_SEQ_PORT_TYPE_SOFTWARE (1<<17) /* implemented in software */ +-#define SNDRV_SEQ_PORT_TYPE_SYNTHESIZER (1<<18) /* generates sound */ +-#define SNDRV_SEQ_PORT_TYPE_PORT (1<<19) /* connects to other device(s) */ +-#define SNDRV_SEQ_PORT_TYPE_APPLICATION (1<<20) /* application (sequencer/editor) */ +- +-/* misc. conditioning flags */ +-#define SNDRV_SEQ_PORT_FLG_GIVEN_PORT (1<<0) +-#define SNDRV_SEQ_PORT_FLG_TIMESTAMP (1<<1) +-#define SNDRV_SEQ_PORT_FLG_TIME_REAL (1<<2) +- +-struct snd_seq_port_info { +- struct snd_seq_addr addr; /* client/port numbers */ +- char name[64]; /* port name */ +- +- unsigned int capability; /* port capability bits */ +- unsigned int type; /* port type bits */ +- int midi_channels; /* channels per MIDI port */ +- int midi_voices; /* voices per MIDI port */ +- int synth_voices; /* voices per SYNTH port */ +- +- int read_use; /* R/O: subscribers for output (from this port) */ +- int write_use; /* R/O: subscribers for input (to this port) */ +- +- void *kernel; /* reserved for kernel use (must be NULL) */ +- unsigned int flags; /* misc. conditioning */ +- unsigned char time_queue; /* queue # for timestamping */ +- char reserved[59]; /* for future use */ +-}; +- +- +-/* queue flags */ +-#define SNDRV_SEQ_QUEUE_FLG_SYNC (1<<0) /* sync enabled */ +- +-/* queue information */ +-struct snd_seq_queue_info { +- int queue; /* queue id */ +- +- /* +- * security settings, only owner of this queue can start/stop timer +- * etc. if the queue is locked for other clients +- */ +- int owner; /* client id for owner of the queue */ +- unsigned locked:1; /* timing queue locked for other queues */ +- char name[64]; /* name of this queue */ +- unsigned int flags; /* flags */ +- char reserved[60]; /* for future use */ +- +-}; +- +-/* queue info/status */ +-struct snd_seq_queue_status { +- int queue; /* queue id */ +- int events; /* read-only - queue size */ +- snd_seq_tick_time_t tick; /* current tick */ +- struct snd_seq_real_time time; /* current time */ +- int running; /* running state of queue */ +- int flags; /* various flags */ +- char reserved[64]; /* for the future */ +-}; +- +- +-/* queue tempo */ +-struct snd_seq_queue_tempo { +- int queue; /* sequencer queue */ +- unsigned int tempo; /* current tempo, us/tick */ +- int ppq; /* time resolution, ticks/quarter */ +- unsigned int skew_value; /* queue skew */ +- unsigned int skew_base; /* queue skew base */ +- char reserved[24]; /* for the future */ +-}; +- +- +-/* sequencer timer sources */ +-#define SNDRV_SEQ_TIMER_ALSA 0 /* ALSA timer */ +-#define SNDRV_SEQ_TIMER_MIDI_CLOCK 1 /* Midi Clock (CLOCK event) */ +-#define SNDRV_SEQ_TIMER_MIDI_TICK 2 /* Midi Timer Tick (TICK event) */ +- +-/* queue timer info */ +-struct snd_seq_queue_timer { +- int queue; /* sequencer queue */ +- int type; /* source timer type */ +- union { +- struct { +- struct snd_timer_id id; /* ALSA's timer ID */ +- unsigned int resolution; /* resolution in Hz */ +- } alsa; +- } u; +- char reserved[64]; /* for the future use */ +-}; +- +- +-struct snd_seq_queue_client { +- int queue; /* sequencer queue */ +- int client; /* sequencer client */ +- int used; /* queue is used with this client +- (must be set for accepting events) */ +- /* per client watermarks */ +- char reserved[64]; /* for future use */ +-}; +- +- +-#define SNDRV_SEQ_PORT_SUBS_EXCLUSIVE (1<<0) /* exclusive connection */ +-#define SNDRV_SEQ_PORT_SUBS_TIMESTAMP (1<<1) +-#define SNDRV_SEQ_PORT_SUBS_TIME_REAL (1<<2) +- +-struct snd_seq_port_subscribe { +- struct snd_seq_addr sender; /* sender address */ +- struct snd_seq_addr dest; /* destination address */ +- unsigned int voices; /* number of voices to be allocated (0 = don't care) */ +- unsigned int flags; /* modes */ +- unsigned char queue; /* input time-stamp queue (optional) */ +- unsigned char pad[3]; /* reserved */ +- char reserved[64]; +-}; +- +-/* type of query subscription */ +-#define SNDRV_SEQ_QUERY_SUBS_READ 0 +-#define SNDRV_SEQ_QUERY_SUBS_WRITE 1 +- +-struct snd_seq_query_subs { +- struct snd_seq_addr root; /* client/port id to be searched */ +- int type; /* READ or WRITE */ +- int index; /* 0..N-1 */ +- int num_subs; /* R/O: number of subscriptions on this port */ +- struct snd_seq_addr addr; /* R/O: result */ +- unsigned char queue; /* R/O: result */ +- unsigned int flags; /* R/O: result */ +- char reserved[64]; /* for future use */ +-}; +- +- +-/* +- * IOCTL commands +- */ +- +-#define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int) +-#define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int) +-#define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct snd_seq_system_info) +-#define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct snd_seq_running_info) +- +-#define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct snd_seq_client_info) +-#define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct snd_seq_client_info) +- +-#define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct snd_seq_port_info) +-#define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct snd_seq_port_info) +-#define SNDRV_SEQ_IOCTL_GET_PORT_INFO _IOWR('S', 0x22, struct snd_seq_port_info) +-#define SNDRV_SEQ_IOCTL_SET_PORT_INFO _IOW ('S', 0x23, struct snd_seq_port_info) +- +-#define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct snd_seq_port_subscribe) +-#define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct snd_seq_port_subscribe) +- +-#define SNDRV_SEQ_IOCTL_CREATE_QUEUE _IOWR('S', 0x32, struct snd_seq_queue_info) +-#define SNDRV_SEQ_IOCTL_DELETE_QUEUE _IOW ('S', 0x33, struct snd_seq_queue_info) +-#define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct snd_seq_queue_info) +-#define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct snd_seq_queue_info) +-#define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct snd_seq_queue_info) +-#define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct snd_seq_queue_status) +-#define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct snd_seq_queue_tempo) +-#define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct snd_seq_queue_tempo) +-#define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct snd_seq_queue_timer) +-#define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct snd_seq_queue_timer) +-#define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT _IOWR('S', 0x49, struct snd_seq_queue_client) +-#define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT _IOW ('S', 0x4a, struct snd_seq_queue_client) +-#define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct snd_seq_client_pool) +-#define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct snd_seq_client_pool) +-#define SNDRV_SEQ_IOCTL_REMOVE_EVENTS _IOW ('S', 0x4e, struct snd_seq_remove_events) +-#define SNDRV_SEQ_IOCTL_QUERY_SUBS _IOWR('S', 0x4f, struct snd_seq_query_subs) +-#define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION _IOWR('S', 0x50, struct snd_seq_port_subscribe) +-#define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT _IOWR('S', 0x51, struct snd_seq_client_info) +-#define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct snd_seq_port_info) +- +-#endif /* _UAPI__SOUND_ASEQUENCER_H */ ++#include +diff --git a/include/sound/asoc.h b/include/sound/asoc.h +index a74ca232..185bba81 100644 +--- a/include/sound/asoc.h ++++ b/include/sound/asoc.h +@@ -1,633 +1 @@ +-/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +-/* +- * uapi/sound/asoc.h -- ALSA SoC Firmware Controls and DAPM +- * +- * Copyright (C) 2012 Texas Instruments Inc. +- * Copyright (C) 2015 Intel Corporation. +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License version 2 as +- * published by the Free Software Foundation. +- * +- * Simple file API to load FW that includes mixers, coefficients, DAPM graphs, +- * algorithms, equalisers, DAIs, widgets etc. +-*/ +- +-#ifndef __LINUX_UAPI_SND_ASOC_H +-#define __LINUX_UAPI_SND_ASOC_H +- +-#include +-#include +- +-/* +- * Maximum number of channels topology kcontrol can represent. +- */ +-#define SND_SOC_TPLG_MAX_CHAN 8 +- +-/* +- * Maximum number of PCM formats capability +- */ +-#define SND_SOC_TPLG_MAX_FORMATS 16 +- +-/* +- * Maximum number of PCM stream configs +- */ +-#define SND_SOC_TPLG_STREAM_CONFIG_MAX 8 +- +-/* +- * Maximum number of physical link's hardware configs +- */ +-#define SND_SOC_TPLG_HW_CONFIG_MAX 8 +- +-/* individual kcontrol info types - can be mixed with other types */ +-#define SND_SOC_TPLG_CTL_VOLSW 1 +-#define SND_SOC_TPLG_CTL_VOLSW_SX 2 +-#define SND_SOC_TPLG_CTL_VOLSW_XR_SX 3 +-#define SND_SOC_TPLG_CTL_ENUM 4 +-#define SND_SOC_TPLG_CTL_BYTES 5 +-#define SND_SOC_TPLG_CTL_ENUM_VALUE 6 +-#define SND_SOC_TPLG_CTL_RANGE 7 +-#define SND_SOC_TPLG_CTL_STROBE 8 +- +- +-/* individual widget kcontrol info types - can be mixed with other types */ +-#define SND_SOC_TPLG_DAPM_CTL_VOLSW 64 +-#define SND_SOC_TPLG_DAPM_CTL_ENUM_DOUBLE 65 +-#define SND_SOC_TPLG_DAPM_CTL_ENUM_VIRT 66 +-#define SND_SOC_TPLG_DAPM_CTL_ENUM_VALUE 67 +-#define SND_SOC_TPLG_DAPM_CTL_PIN 68 +- +-/* DAPM widget types - add new items to the end */ +-#define SND_SOC_TPLG_DAPM_INPUT 0 +-#define SND_SOC_TPLG_DAPM_OUTPUT 1 +-#define SND_SOC_TPLG_DAPM_MUX 2 +-#define SND_SOC_TPLG_DAPM_MIXER 3 +-#define SND_SOC_TPLG_DAPM_PGA 4 +-#define SND_SOC_TPLG_DAPM_OUT_DRV 5 +-#define SND_SOC_TPLG_DAPM_ADC 6 +-#define SND_SOC_TPLG_DAPM_DAC 7 +-#define SND_SOC_TPLG_DAPM_SWITCH 8 +-#define SND_SOC_TPLG_DAPM_PRE 9 +-#define SND_SOC_TPLG_DAPM_POST 10 +-#define SND_SOC_TPLG_DAPM_AIF_IN 11 +-#define SND_SOC_TPLG_DAPM_AIF_OUT 12 +-#define SND_SOC_TPLG_DAPM_DAI_IN 13 +-#define SND_SOC_TPLG_DAPM_DAI_OUT 14 +-#define SND_SOC_TPLG_DAPM_DAI_LINK 15 +-#define SND_SOC_TPLG_DAPM_BUFFER 16 +-#define SND_SOC_TPLG_DAPM_SCHEDULER 17 +-#define SND_SOC_TPLG_DAPM_EFFECT 18 +-#define SND_SOC_TPLG_DAPM_SIGGEN 19 +-#define SND_SOC_TPLG_DAPM_SRC 20 +-#define SND_SOC_TPLG_DAPM_ASRC 21 +-#define SND_SOC_TPLG_DAPM_ENCODER 22 +-#define SND_SOC_TPLG_DAPM_DECODER 23 +-#define SND_SOC_TPLG_DAPM_LAST SND_SOC_TPLG_DAPM_DECODER +- +-/* Header magic number and string sizes */ +-#define SND_SOC_TPLG_MAGIC 0x41536F43 /* ASoC */ +- +-/* string sizes */ +-#define SND_SOC_TPLG_NUM_TEXTS 16 +- +-/* ABI version */ +-#define SND_SOC_TPLG_ABI_VERSION 0x5 /* current version */ +-#define SND_SOC_TPLG_ABI_VERSION_MIN 0x4 /* oldest version supported */ +- +-/* Max size of TLV data */ +-#define SND_SOC_TPLG_TLV_SIZE 32 +- +-/* +- * File and Block header data types. +- * Add new generic and vendor types to end of list. +- * Generic types are handled by the core whilst vendors types are passed +- * to the component drivers for handling. +- */ +-#define SND_SOC_TPLG_TYPE_MIXER 1 +-#define SND_SOC_TPLG_TYPE_BYTES 2 +-#define SND_SOC_TPLG_TYPE_ENUM 3 +-#define SND_SOC_TPLG_TYPE_DAPM_GRAPH 4 +-#define SND_SOC_TPLG_TYPE_DAPM_WIDGET 5 +-#define SND_SOC_TPLG_TYPE_DAI_LINK 6 +-#define SND_SOC_TPLG_TYPE_PCM 7 +-#define SND_SOC_TPLG_TYPE_MANIFEST 8 +-#define SND_SOC_TPLG_TYPE_CODEC_LINK 9 +-#define SND_SOC_TPLG_TYPE_BACKEND_LINK 10 +-#define SND_SOC_TPLG_TYPE_PDATA 11 +-#define SND_SOC_TPLG_TYPE_DAI 12 +-#define SND_SOC_TPLG_TYPE_MAX SND_SOC_TPLG_TYPE_DAI +- +-/* vendor block IDs - please add new vendor types to end */ +-#define SND_SOC_TPLG_TYPE_VENDOR_FW 1000 +-#define SND_SOC_TPLG_TYPE_VENDOR_CONFIG 1001 +-#define SND_SOC_TPLG_TYPE_VENDOR_COEFF 1002 +-#define SND_SOC_TPLG_TYPEVENDOR_CODEC 1003 +- +-#define SND_SOC_TPLG_STREAM_PLAYBACK 0 +-#define SND_SOC_TPLG_STREAM_CAPTURE 1 +- +-/* vendor tuple types */ +-#define SND_SOC_TPLG_TUPLE_TYPE_UUID 0 +-#define SND_SOC_TPLG_TUPLE_TYPE_STRING 1 +-#define SND_SOC_TPLG_TUPLE_TYPE_BOOL 2 +-#define SND_SOC_TPLG_TUPLE_TYPE_BYTE 3 +-#define SND_SOC_TPLG_TUPLE_TYPE_WORD 4 +-#define SND_SOC_TPLG_TUPLE_TYPE_SHORT 5 +- +-/* DAI flags */ +-#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_RATES (1 << 0) +-#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_CHANNELS (1 << 1) +-#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2) +- +-/* DAI clock gating */ +-#define SND_SOC_TPLG_DAI_CLK_GATE_UNDEFINED 0 +-#define SND_SOC_TPLG_DAI_CLK_GATE_GATED 1 +-#define SND_SOC_TPLG_DAI_CLK_GATE_CONT 2 +- +-/* DAI mclk_direction */ +-#define SND_SOC_TPLG_MCLK_CO 0 /* for codec, mclk is output */ +-#define SND_SOC_TPLG_MCLK_CI 1 /* for codec, mclk is input */ +- +-/* DAI physical PCM data formats. +- * Add new formats to the end of the list. +- */ +-#define SND_SOC_DAI_FORMAT_I2S 1 /* I2S mode */ +-#define SND_SOC_DAI_FORMAT_RIGHT_J 2 /* Right Justified mode */ +-#define SND_SOC_DAI_FORMAT_LEFT_J 3 /* Left Justified mode */ +-#define SND_SOC_DAI_FORMAT_DSP_A 4 /* L data MSB after FRM LRC */ +-#define SND_SOC_DAI_FORMAT_DSP_B 5 /* L data MSB during FRM LRC */ +-#define SND_SOC_DAI_FORMAT_AC97 6 /* AC97 */ +-#define SND_SOC_DAI_FORMAT_PDM 7 /* Pulse density modulation */ +- +-/* left and right justified also known as MSB and LSB respectively */ +-#define SND_SOC_DAI_FORMAT_MSB SND_SOC_DAI_FORMAT_LEFT_J +-#define SND_SOC_DAI_FORMAT_LSB SND_SOC_DAI_FORMAT_RIGHT_J +- +-/* DAI link flags */ +-#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_RATES (1 << 0) +-#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_CHANNELS (1 << 1) +-#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2) +-#define SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP (1 << 3) +- +-/* DAI topology BCLK parameter +- * For the backwards capability, by default codec is bclk master +- */ +-#define SND_SOC_TPLG_BCLK_CM 0 /* codec is bclk master */ +-#define SND_SOC_TPLG_BCLK_CS 1 /* codec is bclk slave */ +- +-/* DAI topology FSYNC parameter +- * For the backwards capability, by default codec is fsync master +- */ +-#define SND_SOC_TPLG_FSYNC_CM 0 /* codec is fsync master */ +-#define SND_SOC_TPLG_FSYNC_CS 1 /* codec is fsync slave */ +- +-/* +- * Block Header. +- * This header precedes all object and object arrays below. +- */ +-struct snd_soc_tplg_hdr { +- __le32 magic; /* magic number */ +- __le32 abi; /* ABI version */ +- __le32 version; /* optional vendor specific version details */ +- __le32 type; /* SND_SOC_TPLG_TYPE_ */ +- __le32 size; /* size of this structure */ +- __le32 vendor_type; /* optional vendor specific type info */ +- __le32 payload_size; /* data bytes, excluding this header */ +- __le32 index; /* identifier for block */ +- __le32 count; /* number of elements in block */ +-} __attribute__((packed)); +- +-/* vendor tuple for uuid */ +-struct snd_soc_tplg_vendor_uuid_elem { +- __le32 token; +- char uuid[16]; +-} __attribute__((packed)); +- +-/* vendor tuple for a bool/byte/short/word value */ +-struct snd_soc_tplg_vendor_value_elem { +- __le32 token; +- __le32 value; +-} __attribute__((packed)); +- +-/* vendor tuple for string */ +-struct snd_soc_tplg_vendor_string_elem { +- __le32 token; +- char string[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; +-} __attribute__((packed)); +- +-struct snd_soc_tplg_vendor_array { +- __le32 size; /* size in bytes of the array, including all elements */ +- __le32 type; /* SND_SOC_TPLG_TUPLE_TYPE_ */ +- __le32 num_elems; /* number of elements in array */ +- union { +- struct snd_soc_tplg_vendor_uuid_elem uuid[0]; +- struct snd_soc_tplg_vendor_value_elem value[0]; +- struct snd_soc_tplg_vendor_string_elem string[0]; +- }; +-} __attribute__((packed)); +- +-/* +- * Private data. +- * All topology objects may have private data that can be used by the driver or +- * firmware. Core will ignore this data. +- */ +-struct snd_soc_tplg_private { +- __le32 size; /* in bytes of private data */ +- union { +- char data[0]; +- struct snd_soc_tplg_vendor_array array[0]; +- }; +-} __attribute__((packed)); +- +-/* +- * Kcontrol TLV data. +- */ +-struct snd_soc_tplg_tlv_dbscale { +- __le32 min; +- __le32 step; +- __le32 mute; +-} __attribute__((packed)); +- +-struct snd_soc_tplg_ctl_tlv { +- __le32 size; /* in bytes of this structure */ +- __le32 type; /* SNDRV_CTL_TLVT_*, type of TLV */ +- union { +- __le32 data[SND_SOC_TPLG_TLV_SIZE]; +- struct snd_soc_tplg_tlv_dbscale scale; +- }; +-} __attribute__((packed)); +- +-/* +- * Kcontrol channel data +- */ +-struct snd_soc_tplg_channel { +- __le32 size; /* in bytes of this structure */ +- __le32 reg; +- __le32 shift; +- __le32 id; /* ID maps to Left, Right, LFE etc */ +-} __attribute__((packed)); +- +-/* +- * Genericl Operations IDs, for binding Kcontrol or Bytes ext ops +- * Kcontrol ops need get/put/info. +- * Bytes ext ops need get/put. +- */ +-struct snd_soc_tplg_io_ops { +- __le32 get; +- __le32 put; +- __le32 info; +-} __attribute__((packed)); +- +-/* +- * kcontrol header +- */ +-struct snd_soc_tplg_ctl_hdr { +- __le32 size; /* in bytes of this structure */ +- __le32 type; +- char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; +- __le32 access; +- struct snd_soc_tplg_io_ops ops; +- struct snd_soc_tplg_ctl_tlv tlv; +-} __attribute__((packed)); +- +-/* +- * Stream Capabilities +- */ +-struct snd_soc_tplg_stream_caps { +- __le32 size; /* in bytes of this structure */ +- char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; +- __le64 formats; /* supported formats SNDRV_PCM_FMTBIT_* */ +- __le32 rates; /* supported rates SNDRV_PCM_RATE_* */ +- __le32 rate_min; /* min rate */ +- __le32 rate_max; /* max rate */ +- __le32 channels_min; /* min channels */ +- __le32 channels_max; /* max channels */ +- __le32 periods_min; /* min number of periods */ +- __le32 periods_max; /* max number of periods */ +- __le32 period_size_min; /* min period size bytes */ +- __le32 period_size_max; /* max period size bytes */ +- __le32 buffer_size_min; /* min buffer size bytes */ +- __le32 buffer_size_max; /* max buffer size bytes */ +- __le32 sig_bits; /* number of bits of content */ +-} __attribute__((packed)); +- +-/* +- * FE or BE Stream configuration supported by SW/FW +- */ +-struct snd_soc_tplg_stream { +- __le32 size; /* in bytes of this structure */ +- char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* Name of the stream */ +- __le64 format; /* SNDRV_PCM_FMTBIT_* */ +- __le32 rate; /* SNDRV_PCM_RATE_* */ +- __le32 period_bytes; /* size of period in bytes */ +- __le32 buffer_bytes; /* size of buffer in bytes */ +- __le32 channels; /* channels */ +-} __attribute__((packed)); +- +- +-/* +- * Describes a physical link's runtime supported hardware config, +- * i.e. hardware audio formats. +- */ +-struct snd_soc_tplg_hw_config { +- __le32 size; /* in bytes of this structure */ +- __le32 id; /* unique ID - - used to match */ +- __le32 fmt; /* SND_SOC_DAI_FORMAT_ format value */ +- __u8 clock_gated; /* SND_SOC_TPLG_DAI_CLK_GATE_ value */ +- __u8 invert_bclk; /* 1 for inverted BCLK, 0 for normal */ +- __u8 invert_fsync; /* 1 for inverted frame clock, 0 for normal */ +- __u8 bclk_master; /* SND_SOC_TPLG_BCLK_ value */ +- __u8 fsync_master; /* SND_SOC_TPLG_FSYNC_ value */ +- __u8 mclk_direction; /* SND_SOC_TPLG_MCLK_ value */ +- __le16 reserved; /* for 32bit alignment */ +- __le32 mclk_rate; /* MCLK or SYSCLK freqency in Hz */ +- __le32 bclk_rate; /* BCLK freqency in Hz */ +- __le32 fsync_rate; /* frame clock in Hz */ +- __le32 tdm_slots; /* number of TDM slots in use */ +- __le32 tdm_slot_width; /* width in bits for each slot */ +- __le32 tx_slots; /* bit mask for active Tx slots */ +- __le32 rx_slots; /* bit mask for active Rx slots */ +- __le32 tx_channels; /* number of Tx channels */ +- __le32 tx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */ +- __le32 rx_channels; /* number of Rx channels */ +- __le32 rx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */ +-} __attribute__((packed)); +- +-/* +- * Manifest. List totals for each payload type. Not used in parsing, but will +- * be passed to the component driver before any other objects in order for any +- * global component resource allocations. +- * +- * File block representation for manifest :- +- * +-----------------------------------+----+ +- * | struct snd_soc_tplg_hdr | 1 | +- * +-----------------------------------+----+ +- * | struct snd_soc_tplg_manifest | 1 | +- * +-----------------------------------+----+ +- */ +-struct snd_soc_tplg_manifest { +- __le32 size; /* in bytes of this structure */ +- __le32 control_elems; /* number of control elements */ +- __le32 widget_elems; /* number of widget elements */ +- __le32 graph_elems; /* number of graph elements */ +- __le32 pcm_elems; /* number of PCM elements */ +- __le32 dai_link_elems; /* number of DAI link elements */ +- __le32 dai_elems; /* number of physical DAI elements */ +- __le32 reserved[20]; /* reserved for new ABI element types */ +- struct snd_soc_tplg_private priv; +-} __attribute__((packed)); +- +-/* +- * Mixer kcontrol. +- * +- * File block representation for mixer kcontrol :- +- * +-----------------------------------+----+ +- * | struct snd_soc_tplg_hdr | 1 | +- * +-----------------------------------+----+ +- * | struct snd_soc_tplg_mixer_control | N | +- * +-----------------------------------+----+ +- */ +-struct snd_soc_tplg_mixer_control { +- struct snd_soc_tplg_ctl_hdr hdr; +- __le32 size; /* in bytes of this structure */ +- __le32 min; +- __le32 max; +- __le32 platform_max; +- __le32 invert; +- __le32 num_channels; +- struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN]; +- struct snd_soc_tplg_private priv; +-} __attribute__((packed)); +- +-/* +- * Enumerated kcontrol +- * +- * File block representation for enum kcontrol :- +- * +-----------------------------------+----+ +- * | struct snd_soc_tplg_hdr | 1 | +- * +-----------------------------------+----+ +- * | struct snd_soc_tplg_enum_control | N | +- * +-----------------------------------+----+ +- */ +-struct snd_soc_tplg_enum_control { +- struct snd_soc_tplg_ctl_hdr hdr; +- __le32 size; /* in bytes of this structure */ +- __le32 num_channels; +- struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN]; +- __le32 items; +- __le32 mask; +- __le32 count; +- char texts[SND_SOC_TPLG_NUM_TEXTS][SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; +- __le32 values[SND_SOC_TPLG_NUM_TEXTS * SNDRV_CTL_ELEM_ID_NAME_MAXLEN / 4]; +- struct snd_soc_tplg_private priv; +-} __attribute__((packed)); +- +-/* +- * Bytes kcontrol +- * +- * File block representation for bytes kcontrol :- +- * +-----------------------------------+----+ +- * | struct snd_soc_tplg_hdr | 1 | +- * +-----------------------------------+----+ +- * | struct snd_soc_tplg_bytes_control | N | +- * +-----------------------------------+----+ +- */ +-struct snd_soc_tplg_bytes_control { +- struct snd_soc_tplg_ctl_hdr hdr; +- __le32 size; /* in bytes of this structure */ +- __le32 max; +- __le32 mask; +- __le32 base; +- __le32 num_regs; +- struct snd_soc_tplg_io_ops ext_ops; +- struct snd_soc_tplg_private priv; +-} __attribute__((packed)); +- +-/* +- * DAPM Graph Element +- * +- * File block representation for DAPM graph elements :- +- * +-------------------------------------+----+ +- * | struct snd_soc_tplg_hdr | 1 | +- * +-------------------------------------+----+ +- * | struct snd_soc_tplg_dapm_graph_elem | N | +- * +-------------------------------------+----+ +- */ +-struct snd_soc_tplg_dapm_graph_elem { +- char sink[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; +- char control[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; +- char source[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; +-} __attribute__((packed)); +- +-/* +- * DAPM Widget. +- * +- * File block representation for DAPM widget :- +- * +-------------------------------------+-----+ +- * | struct snd_soc_tplg_hdr | 1 | +- * +-------------------------------------+-----+ +- * | struct snd_soc_tplg_dapm_widget | N | +- * +-------------------------------------+-----+ +- * | struct snd_soc_tplg_enum_control | 0|1 | +- * | struct snd_soc_tplg_mixer_control | 0|N | +- * +-------------------------------------+-----+ +- * +- * Optional enum or mixer control can be appended to the end of each widget +- * in the block. +- */ +-struct snd_soc_tplg_dapm_widget { +- __le32 size; /* in bytes of this structure */ +- __le32 id; /* SND_SOC_DAPM_CTL */ +- char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; +- char sname[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; +- +- __le32 reg; /* negative reg = no direct dapm */ +- __le32 shift; /* bits to shift */ +- __le32 mask; /* non-shifted mask */ +- __le32 subseq; /* sort within widget type */ +- __le32 invert; /* invert the power bit */ +- __le32 ignore_suspend; /* kept enabled over suspend */ +- __le16 event_flags; +- __le16 event_type; +- __le32 num_kcontrols; +- struct snd_soc_tplg_private priv; +- /* +- * kcontrols that relate to this widget +- * follow here after widget private data +- */ +-} __attribute__((packed)); +- +- +-/* +- * Describes SW/FW specific features of PCM (FE DAI & DAI link). +- * +- * File block representation for PCM :- +- * +-----------------------------------+-----+ +- * | struct snd_soc_tplg_hdr | 1 | +- * +-----------------------------------+-----+ +- * | struct snd_soc_tplg_pcm | N | +- * +-----------------------------------+-----+ +- */ +-struct snd_soc_tplg_pcm { +- __le32 size; /* in bytes of this structure */ +- char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; +- char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; +- __le32 pcm_id; /* unique ID - used to match with DAI link */ +- __le32 dai_id; /* unique ID - used to match */ +- __le32 playback; /* supports playback mode */ +- __le32 capture; /* supports capture mode */ +- __le32 compress; /* 1 = compressed; 0 = PCM */ +- struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */ +- __le32 num_streams; /* number of streams */ +- struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */ +- __le32 flag_mask; /* bitmask of flags to configure */ +- __le32 flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */ +- struct snd_soc_tplg_private priv; +-} __attribute__((packed)); +- +- +-/* +- * Describes the physical link runtime supported configs or params +- * +- * File block representation for physical link config :- +- * +-----------------------------------+-----+ +- * | struct snd_soc_tplg_hdr | 1 | +- * +-----------------------------------+-----+ +- * | struct snd_soc_tplg_link_config | N | +- * +-----------------------------------+-----+ +- */ +-struct snd_soc_tplg_link_config { +- __le32 size; /* in bytes of this structure */ +- __le32 id; /* unique ID - used to match */ +- char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */ +- char stream_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* stream name - used to match */ +- struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */ +- __le32 num_streams; /* number of streams */ +- struct snd_soc_tplg_hw_config hw_config[SND_SOC_TPLG_HW_CONFIG_MAX]; /* hw configs */ +- __le32 num_hw_configs; /* number of hw configs */ +- __le32 default_hw_config_id; /* default hw config ID for init */ +- __le32 flag_mask; /* bitmask of flags to configure */ +- __le32 flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */ +- struct snd_soc_tplg_private priv; +-} __attribute__((packed)); +- +-/* +- * Describes SW/FW specific features of physical DAI. +- * It can be used to configure backend DAIs for DPCM. +- * +- * File block representation for physical DAI :- +- * +-----------------------------------+-----+ +- * | struct snd_soc_tplg_hdr | 1 | +- * +-----------------------------------+-----+ +- * | struct snd_soc_tplg_dai | N | +- * +-----------------------------------+-----+ +- */ +-struct snd_soc_tplg_dai { +- __le32 size; /* in bytes of this structure */ +- char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */ +- __le32 dai_id; /* unique ID - used to match */ +- __le32 playback; /* supports playback mode */ +- __le32 capture; /* supports capture mode */ +- struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */ +- __le32 flag_mask; /* bitmask of flags to configure */ +- __le32 flags; /* SND_SOC_TPLG_DAI_FLGBIT_* */ +- struct snd_soc_tplg_private priv; +-} __attribute__((packed)); +- +-/* +- * Old version of ABI structs, supported for backward compatibility. +- */ +- +-/* Manifest v4 */ +-struct snd_soc_tplg_manifest_v4 { +- __le32 size; /* in bytes of this structure */ +- __le32 control_elems; /* number of control elements */ +- __le32 widget_elems; /* number of widget elements */ +- __le32 graph_elems; /* number of graph elements */ +- __le32 pcm_elems; /* number of PCM elements */ +- __le32 dai_link_elems; /* number of DAI link elements */ +- struct snd_soc_tplg_private priv; +-} __packed; +- +-/* Stream Capabilities v4 */ +-struct snd_soc_tplg_stream_caps_v4 { +- __le32 size; /* in bytes of this structure */ +- char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; +- __le64 formats; /* supported formats SNDRV_PCM_FMTBIT_* */ +- __le32 rates; /* supported rates SNDRV_PCM_RATE_* */ +- __le32 rate_min; /* min rate */ +- __le32 rate_max; /* max rate */ +- __le32 channels_min; /* min channels */ +- __le32 channels_max; /* max channels */ +- __le32 periods_min; /* min number of periods */ +- __le32 periods_max; /* max number of periods */ +- __le32 period_size_min; /* min period size bytes */ +- __le32 period_size_max; /* max period size bytes */ +- __le32 buffer_size_min; /* min buffer size bytes */ +- __le32 buffer_size_max; /* max buffer size bytes */ +-} __packed; +- +-/* PCM v4 */ +-struct snd_soc_tplg_pcm_v4 { +- __le32 size; /* in bytes of this structure */ +- char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; +- char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; +- __le32 pcm_id; /* unique ID - used to match with DAI link */ +- __le32 dai_id; /* unique ID - used to match */ +- __le32 playback; /* supports playback mode */ +- __le32 capture; /* supports capture mode */ +- __le32 compress; /* 1 = compressed; 0 = PCM */ +- struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */ +- __le32 num_streams; /* number of streams */ +- struct snd_soc_tplg_stream_caps_v4 caps[2]; /* playback and capture for DAI */ +-} __packed; +- +-/* Physical link config v4 */ +-struct snd_soc_tplg_link_config_v4 { +- __le32 size; /* in bytes of this structure */ +- __le32 id; /* unique ID - used to match */ +- struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */ +- __le32 num_streams; /* number of streams */ +-} __packed; +- +-#endif ++#include +diff --git a/include/sound/asound.h b/include/sound/asound.h +index df1153ce..3be4d850 100644 +--- a/include/sound/asound.h ++++ b/include/sound/asound.h +@@ -1,1038 +1 @@ +-/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ +-/* +- * Advanced Linux Sound Architecture - ALSA - Driver +- * Copyright (c) 1994-2003 by Jaroslav Kysela , +- * Abramo Bagnara +- * +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this program; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- * +- */ +- +-#ifndef _UAPI__SOUND_ASOUND_H +-#define _UAPI__SOUND_ASOUND_H +- +-#if defined(__KERNEL__) || defined(__linux__) +-#include +-#else +-#include +-#endif +- +-#ifndef __KERNEL__ +-#include +-#include +-#endif +- +-/* +- * protocol version +- */ +- +-#define SNDRV_PROTOCOL_VERSION(major, minor, subminor) (((major)<<16)|((minor)<<8)|(subminor)) +-#define SNDRV_PROTOCOL_MAJOR(version) (((version)>>16)&0xffff) +-#define SNDRV_PROTOCOL_MINOR(version) (((version)>>8)&0xff) +-#define SNDRV_PROTOCOL_MICRO(version) ((version)&0xff) +-#define SNDRV_PROTOCOL_INCOMPATIBLE(kversion, uversion) \ +- (SNDRV_PROTOCOL_MAJOR(kversion) != SNDRV_PROTOCOL_MAJOR(uversion) || \ +- (SNDRV_PROTOCOL_MAJOR(kversion) == SNDRV_PROTOCOL_MAJOR(uversion) && \ +- SNDRV_PROTOCOL_MINOR(kversion) != SNDRV_PROTOCOL_MINOR(uversion))) +- +-/**************************************************************************** +- * * +- * Digital audio interface * +- * * +- ****************************************************************************/ +- +-struct snd_aes_iec958 { +- unsigned char status[24]; /* AES/IEC958 channel status bits */ +- unsigned char subcode[147]; /* AES/IEC958 subcode bits */ +- unsigned char pad; /* nothing */ +- unsigned char dig_subframe[4]; /* AES/IEC958 subframe bits */ +-}; +- +-/**************************************************************************** +- * * +- * CEA-861 Audio InfoFrame. Used in HDMI and DisplayPort * +- * * +- ****************************************************************************/ +- +-struct snd_cea_861_aud_if { +- unsigned char db1_ct_cc; /* coding type and channel count */ +- unsigned char db2_sf_ss; /* sample frequency and size */ +- unsigned char db3; /* not used, all zeros */ +- unsigned char db4_ca; /* channel allocation code */ +- unsigned char db5_dminh_lsv; /* downmix inhibit & level-shit values */ +-}; +- +-/**************************************************************************** +- * * +- * Section for driver hardware dependent interface - /dev/snd/hw? * +- * * +- ****************************************************************************/ +- +-#define SNDRV_HWDEP_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1) +- +-enum { +- SNDRV_HWDEP_IFACE_OPL2 = 0, +- SNDRV_HWDEP_IFACE_OPL3, +- SNDRV_HWDEP_IFACE_OPL4, +- SNDRV_HWDEP_IFACE_SB16CSP, /* Creative Signal Processor */ +- SNDRV_HWDEP_IFACE_EMU10K1, /* FX8010 processor in EMU10K1 chip */ +- SNDRV_HWDEP_IFACE_YSS225, /* Yamaha FX processor */ +- SNDRV_HWDEP_IFACE_ICS2115, /* Wavetable synth */ +- SNDRV_HWDEP_IFACE_SSCAPE, /* Ensoniq SoundScape ISA card (MC68EC000) */ +- SNDRV_HWDEP_IFACE_VX, /* Digigram VX cards */ +- SNDRV_HWDEP_IFACE_MIXART, /* Digigram miXart cards */ +- SNDRV_HWDEP_IFACE_USX2Y, /* Tascam US122, US224 & US428 usb */ +- SNDRV_HWDEP_IFACE_EMUX_WAVETABLE, /* EmuX wavetable */ +- SNDRV_HWDEP_IFACE_BLUETOOTH, /* Bluetooth audio */ +- SNDRV_HWDEP_IFACE_USX2Y_PCM, /* Tascam US122, US224 & US428 rawusb pcm */ +- SNDRV_HWDEP_IFACE_PCXHR, /* Digigram PCXHR */ +- SNDRV_HWDEP_IFACE_SB_RC, /* SB Extigy/Audigy2NX remote control */ +- SNDRV_HWDEP_IFACE_HDA, /* HD-audio */ +- SNDRV_HWDEP_IFACE_USB_STREAM, /* direct access to usb stream */ +- SNDRV_HWDEP_IFACE_FW_DICE, /* TC DICE FireWire device */ +- SNDRV_HWDEP_IFACE_FW_FIREWORKS, /* Echo Audio Fireworks based device */ +- SNDRV_HWDEP_IFACE_FW_BEBOB, /* BridgeCo BeBoB based device */ +- SNDRV_HWDEP_IFACE_FW_OXFW, /* Oxford OXFW970/971 based device */ +- SNDRV_HWDEP_IFACE_FW_DIGI00X, /* Digidesign Digi 002/003 family */ +- SNDRV_HWDEP_IFACE_FW_TASCAM, /* TASCAM FireWire series */ +- SNDRV_HWDEP_IFACE_LINE6, /* Line6 USB processors */ +- SNDRV_HWDEP_IFACE_FW_MOTU, /* MOTU FireWire series */ +- SNDRV_HWDEP_IFACE_FW_FIREFACE, /* RME Fireface series */ +- +- /* Don't forget to change the following: */ +- SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_FW_FIREFACE +-}; +- +-struct snd_hwdep_info { +- unsigned int device; /* WR: device number */ +- int card; /* R: card number */ +- unsigned char id[64]; /* ID (user selectable) */ +- unsigned char name[80]; /* hwdep name */ +- int iface; /* hwdep interface */ +- unsigned char reserved[64]; /* reserved for future */ +-}; +- +-/* generic DSP loader */ +-struct snd_hwdep_dsp_status { +- unsigned int version; /* R: driver-specific version */ +- unsigned char id[32]; /* R: driver-specific ID string */ +- unsigned int num_dsps; /* R: number of DSP images to transfer */ +- unsigned int dsp_loaded; /* R: bit flags indicating the loaded DSPs */ +- unsigned int chip_ready; /* R: 1 = initialization finished */ +- unsigned char reserved[16]; /* reserved for future use */ +-}; +- +-struct snd_hwdep_dsp_image { +- unsigned int index; /* W: DSP index */ +- unsigned char name[64]; /* W: ID (e.g. file name) */ +- unsigned char __user *image; /* W: binary image */ +- size_t length; /* W: size of image in bytes */ +- unsigned long driver_data; /* W: driver-specific data */ +-}; +- +-#define SNDRV_HWDEP_IOCTL_PVERSION _IOR ('H', 0x00, int) +-#define SNDRV_HWDEP_IOCTL_INFO _IOR ('H', 0x01, struct snd_hwdep_info) +-#define SNDRV_HWDEP_IOCTL_DSP_STATUS _IOR('H', 0x02, struct snd_hwdep_dsp_status) +-#define SNDRV_HWDEP_IOCTL_DSP_LOAD _IOW('H', 0x03, struct snd_hwdep_dsp_image) +- +-/***************************************************************************** +- * * +- * Digital Audio (PCM) interface - /dev/snd/pcm?? * +- * * +- *****************************************************************************/ +- +-#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 14) +- +-typedef unsigned long snd_pcm_uframes_t; +-typedef signed long snd_pcm_sframes_t; +- +-enum { +- SNDRV_PCM_CLASS_GENERIC = 0, /* standard mono or stereo device */ +- SNDRV_PCM_CLASS_MULTI, /* multichannel device */ +- SNDRV_PCM_CLASS_MODEM, /* software modem class */ +- SNDRV_PCM_CLASS_DIGITIZER, /* digitizer class */ +- /* Don't forget to change the following: */ +- SNDRV_PCM_CLASS_LAST = SNDRV_PCM_CLASS_DIGITIZER, +-}; +- +-enum { +- SNDRV_PCM_SUBCLASS_GENERIC_MIX = 0, /* mono or stereo subdevices are mixed together */ +- SNDRV_PCM_SUBCLASS_MULTI_MIX, /* multichannel subdevices are mixed together */ +- /* Don't forget to change the following: */ +- SNDRV_PCM_SUBCLASS_LAST = SNDRV_PCM_SUBCLASS_MULTI_MIX, +-}; +- +-enum { +- SNDRV_PCM_STREAM_PLAYBACK = 0, +- SNDRV_PCM_STREAM_CAPTURE, +- SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE, +-}; +- +-typedef int __bitwise snd_pcm_access_t; +-#define SNDRV_PCM_ACCESS_MMAP_INTERLEAVED ((__force snd_pcm_access_t) 0) /* interleaved mmap */ +-#define SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED ((__force snd_pcm_access_t) 1) /* noninterleaved mmap */ +-#define SNDRV_PCM_ACCESS_MMAP_COMPLEX ((__force snd_pcm_access_t) 2) /* complex mmap */ +-#define SNDRV_PCM_ACCESS_RW_INTERLEAVED ((__force snd_pcm_access_t) 3) /* readi/writei */ +-#define SNDRV_PCM_ACCESS_RW_NONINTERLEAVED ((__force snd_pcm_access_t) 4) /* readn/writen */ +-#define SNDRV_PCM_ACCESS_LAST SNDRV_PCM_ACCESS_RW_NONINTERLEAVED +- +-typedef int __bitwise snd_pcm_format_t; +-#define SNDRV_PCM_FORMAT_S8 ((__force snd_pcm_format_t) 0) +-#define SNDRV_PCM_FORMAT_U8 ((__force snd_pcm_format_t) 1) +-#define SNDRV_PCM_FORMAT_S16_LE ((__force snd_pcm_format_t) 2) +-#define SNDRV_PCM_FORMAT_S16_BE ((__force snd_pcm_format_t) 3) +-#define SNDRV_PCM_FORMAT_U16_LE ((__force snd_pcm_format_t) 4) +-#define SNDRV_PCM_FORMAT_U16_BE ((__force snd_pcm_format_t) 5) +-#define SNDRV_PCM_FORMAT_S24_LE ((__force snd_pcm_format_t) 6) /* low three bytes */ +-#define SNDRV_PCM_FORMAT_S24_BE ((__force snd_pcm_format_t) 7) /* low three bytes */ +-#define SNDRV_PCM_FORMAT_U24_LE ((__force snd_pcm_format_t) 8) /* low three bytes */ +-#define SNDRV_PCM_FORMAT_U24_BE ((__force snd_pcm_format_t) 9) /* low three bytes */ +-#define SNDRV_PCM_FORMAT_S32_LE ((__force snd_pcm_format_t) 10) +-#define SNDRV_PCM_FORMAT_S32_BE ((__force snd_pcm_format_t) 11) +-#define SNDRV_PCM_FORMAT_U32_LE ((__force snd_pcm_format_t) 12) +-#define SNDRV_PCM_FORMAT_U32_BE ((__force snd_pcm_format_t) 13) +-#define SNDRV_PCM_FORMAT_FLOAT_LE ((__force snd_pcm_format_t) 14) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */ +-#define SNDRV_PCM_FORMAT_FLOAT_BE ((__force snd_pcm_format_t) 15) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */ +-#define SNDRV_PCM_FORMAT_FLOAT64_LE ((__force snd_pcm_format_t) 16) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */ +-#define SNDRV_PCM_FORMAT_FLOAT64_BE ((__force snd_pcm_format_t) 17) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */ +-#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE ((__force snd_pcm_format_t) 18) /* IEC-958 subframe, Little Endian */ +-#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE ((__force snd_pcm_format_t) 19) /* IEC-958 subframe, Big Endian */ +-#define SNDRV_PCM_FORMAT_MU_LAW ((__force snd_pcm_format_t) 20) +-#define SNDRV_PCM_FORMAT_A_LAW ((__force snd_pcm_format_t) 21) +-#define SNDRV_PCM_FORMAT_IMA_ADPCM ((__force snd_pcm_format_t) 22) +-#define SNDRV_PCM_FORMAT_MPEG ((__force snd_pcm_format_t) 23) +-#define SNDRV_PCM_FORMAT_GSM ((__force snd_pcm_format_t) 24) +-#define SNDRV_PCM_FORMAT_S20_LE ((__force snd_pcm_format_t) 25) /* in four bytes, LSB justified */ +-#define SNDRV_PCM_FORMAT_S20_BE ((__force snd_pcm_format_t) 26) /* in four bytes, LSB justified */ +-#define SNDRV_PCM_FORMAT_U20_LE ((__force snd_pcm_format_t) 27) /* in four bytes, LSB justified */ +-#define SNDRV_PCM_FORMAT_U20_BE ((__force snd_pcm_format_t) 28) /* in four bytes, LSB justified */ +-/* gap in the numbering for a future standard linear format */ +-#define SNDRV_PCM_FORMAT_SPECIAL ((__force snd_pcm_format_t) 31) +-#define SNDRV_PCM_FORMAT_S24_3LE ((__force snd_pcm_format_t) 32) /* in three bytes */ +-#define SNDRV_PCM_FORMAT_S24_3BE ((__force snd_pcm_format_t) 33) /* in three bytes */ +-#define SNDRV_PCM_FORMAT_U24_3LE ((__force snd_pcm_format_t) 34) /* in three bytes */ +-#define SNDRV_PCM_FORMAT_U24_3BE ((__force snd_pcm_format_t) 35) /* in three bytes */ +-#define SNDRV_PCM_FORMAT_S20_3LE ((__force snd_pcm_format_t) 36) /* in three bytes */ +-#define SNDRV_PCM_FORMAT_S20_3BE ((__force snd_pcm_format_t) 37) /* in three bytes */ +-#define SNDRV_PCM_FORMAT_U20_3LE ((__force snd_pcm_format_t) 38) /* in three bytes */ +-#define SNDRV_PCM_FORMAT_U20_3BE ((__force snd_pcm_format_t) 39) /* in three bytes */ +-#define SNDRV_PCM_FORMAT_S18_3LE ((__force snd_pcm_format_t) 40) /* in three bytes */ +-#define SNDRV_PCM_FORMAT_S18_3BE ((__force snd_pcm_format_t) 41) /* in three bytes */ +-#define SNDRV_PCM_FORMAT_U18_3LE ((__force snd_pcm_format_t) 42) /* in three bytes */ +-#define SNDRV_PCM_FORMAT_U18_3BE ((__force snd_pcm_format_t) 43) /* in three bytes */ +-#define SNDRV_PCM_FORMAT_G723_24 ((__force snd_pcm_format_t) 44) /* 8 samples in 3 bytes */ +-#define SNDRV_PCM_FORMAT_G723_24_1B ((__force snd_pcm_format_t) 45) /* 1 sample in 1 byte */ +-#define SNDRV_PCM_FORMAT_G723_40 ((__force snd_pcm_format_t) 46) /* 8 Samples in 5 bytes */ +-#define SNDRV_PCM_FORMAT_G723_40_1B ((__force snd_pcm_format_t) 47) /* 1 sample in 1 byte */ +-#define SNDRV_PCM_FORMAT_DSD_U8 ((__force snd_pcm_format_t) 48) /* DSD, 1-byte samples DSD (x8) */ +-#define SNDRV_PCM_FORMAT_DSD_U16_LE ((__force snd_pcm_format_t) 49) /* DSD, 2-byte samples DSD (x16), little endian */ +-#define SNDRV_PCM_FORMAT_DSD_U32_LE ((__force snd_pcm_format_t) 50) /* DSD, 4-byte samples DSD (x32), little endian */ +-#define SNDRV_PCM_FORMAT_DSD_U16_BE ((__force snd_pcm_format_t) 51) /* DSD, 2-byte samples DSD (x16), big endian */ +-#define SNDRV_PCM_FORMAT_DSD_U32_BE ((__force snd_pcm_format_t) 52) /* DSD, 4-byte samples DSD (x32), big endian */ +-#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U32_BE +-#define SNDRV_PCM_FORMAT_FIRST SNDRV_PCM_FORMAT_S8 +- +-#ifdef SNDRV_LITTLE_ENDIAN +-#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE +-#define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_LE +-#define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_LE +-#define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_LE +-#define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_LE +-#define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_LE +-#define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_LE +-#define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_LE +-#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE +-#define SNDRV_PCM_FORMAT_S20 SNDRV_PCM_FORMAT_S20_LE +-#define SNDRV_PCM_FORMAT_U20 SNDRV_PCM_FORMAT_U20_LE +-#endif +-#ifdef SNDRV_BIG_ENDIAN +-#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_BE +-#define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_BE +-#define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_BE +-#define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_BE +-#define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_BE +-#define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_BE +-#define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_BE +-#define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_BE +-#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE +-#define SNDRV_PCM_FORMAT_S20 SNDRV_PCM_FORMAT_S20_BE +-#define SNDRV_PCM_FORMAT_U20 SNDRV_PCM_FORMAT_U20_BE +-#endif +- +-typedef int __bitwise snd_pcm_subformat_t; +-#define SNDRV_PCM_SUBFORMAT_STD ((__force snd_pcm_subformat_t) 0) +-#define SNDRV_PCM_SUBFORMAT_LAST SNDRV_PCM_SUBFORMAT_STD +- +-#define SNDRV_PCM_INFO_MMAP 0x00000001 /* hardware supports mmap */ +-#define SNDRV_PCM_INFO_MMAP_VALID 0x00000002 /* period data are valid during transfer */ +-#define SNDRV_PCM_INFO_DOUBLE 0x00000004 /* Double buffering needed for PCM start/stop */ +-#define SNDRV_PCM_INFO_BATCH 0x00000010 /* double buffering */ +-#define SNDRV_PCM_INFO_SYNC_APPLPTR 0x00000020 /* need the explicit sync of appl_ptr update */ +-#define SNDRV_PCM_INFO_INTERLEAVED 0x00000100 /* channels are interleaved */ +-#define SNDRV_PCM_INFO_NONINTERLEAVED 0x00000200 /* channels are not interleaved */ +-#define SNDRV_PCM_INFO_COMPLEX 0x00000400 /* complex frame organization (mmap only) */ +-#define SNDRV_PCM_INFO_BLOCK_TRANSFER 0x00010000 /* hardware transfer block of samples */ +-#define SNDRV_PCM_INFO_OVERRANGE 0x00020000 /* hardware supports ADC (capture) overrange detection */ +-#define SNDRV_PCM_INFO_RESUME 0x00040000 /* hardware supports stream resume after suspend */ +-#define SNDRV_PCM_INFO_PAUSE 0x00080000 /* pause ioctl is supported */ +-#define SNDRV_PCM_INFO_HALF_DUPLEX 0x00100000 /* only half duplex */ +-#define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000 /* playback and capture stream are somewhat correlated */ +-#define SNDRV_PCM_INFO_SYNC_START 0x00400000 /* pcm support some kind of sync go */ +-#define SNDRV_PCM_INFO_NO_PERIOD_WAKEUP 0x00800000 /* period wakeup can be disabled */ +-#define SNDRV_PCM_INFO_HAS_WALL_CLOCK 0x01000000 /* (Deprecated)has audio wall clock for audio/system time sync */ +-#define SNDRV_PCM_INFO_HAS_LINK_ATIME 0x01000000 /* report hardware link audio time, reset on startup */ +-#define SNDRV_PCM_INFO_HAS_LINK_ABSOLUTE_ATIME 0x02000000 /* report absolute hardware link audio time, not reset on startup */ +-#define SNDRV_PCM_INFO_HAS_LINK_ESTIMATED_ATIME 0x04000000 /* report estimated link audio time */ +-#define SNDRV_PCM_INFO_HAS_LINK_SYNCHRONIZED_ATIME 0x08000000 /* report synchronized audio/system time */ +- +-#define SNDRV_PCM_INFO_DRAIN_TRIGGER 0x40000000 /* internal kernel flag - trigger in drain */ +-#define SNDRV_PCM_INFO_FIFO_IN_FRAMES 0x80000000 /* internal kernel flag - FIFO size is in frames */ +- +- +- +-typedef int __bitwise snd_pcm_state_t; +-#define SNDRV_PCM_STATE_OPEN ((__force snd_pcm_state_t) 0) /* stream is open */ +-#define SNDRV_PCM_STATE_SETUP ((__force snd_pcm_state_t) 1) /* stream has a setup */ +-#define SNDRV_PCM_STATE_PREPARED ((__force snd_pcm_state_t) 2) /* stream is ready to start */ +-#define SNDRV_PCM_STATE_RUNNING ((__force snd_pcm_state_t) 3) /* stream is running */ +-#define SNDRV_PCM_STATE_XRUN ((__force snd_pcm_state_t) 4) /* stream reached an xrun */ +-#define SNDRV_PCM_STATE_DRAINING ((__force snd_pcm_state_t) 5) /* stream is draining */ +-#define SNDRV_PCM_STATE_PAUSED ((__force snd_pcm_state_t) 6) /* stream is paused */ +-#define SNDRV_PCM_STATE_SUSPENDED ((__force snd_pcm_state_t) 7) /* hardware is suspended */ +-#define SNDRV_PCM_STATE_DISCONNECTED ((__force snd_pcm_state_t) 8) /* hardware is disconnected */ +-#define SNDRV_PCM_STATE_LAST SNDRV_PCM_STATE_DISCONNECTED +- +-enum { +- SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000, +- SNDRV_PCM_MMAP_OFFSET_STATUS = 0x80000000, +- SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000, +-}; +- +-union snd_pcm_sync_id { +- unsigned char id[16]; +- unsigned short id16[8]; +- unsigned int id32[4]; +-}; +- +-struct snd_pcm_info { +- unsigned int device; /* RO/WR (control): device number */ +- unsigned int subdevice; /* RO/WR (control): subdevice number */ +- int stream; /* RO/WR (control): stream direction */ +- int card; /* R: card number */ +- unsigned char id[64]; /* ID (user selectable) */ +- unsigned char name[80]; /* name of this device */ +- unsigned char subname[32]; /* subdevice name */ +- int dev_class; /* SNDRV_PCM_CLASS_* */ +- int dev_subclass; /* SNDRV_PCM_SUBCLASS_* */ +- unsigned int subdevices_count; +- unsigned int subdevices_avail; +- union snd_pcm_sync_id sync; /* hardware synchronization ID */ +- unsigned char reserved[64]; /* reserved for future... */ +-}; +- +-typedef int snd_pcm_hw_param_t; +-#define SNDRV_PCM_HW_PARAM_ACCESS 0 /* Access type */ +-#define SNDRV_PCM_HW_PARAM_FORMAT 1 /* Format */ +-#define SNDRV_PCM_HW_PARAM_SUBFORMAT 2 /* Subformat */ +-#define SNDRV_PCM_HW_PARAM_FIRST_MASK SNDRV_PCM_HW_PARAM_ACCESS +-#define SNDRV_PCM_HW_PARAM_LAST_MASK SNDRV_PCM_HW_PARAM_SUBFORMAT +- +-#define SNDRV_PCM_HW_PARAM_SAMPLE_BITS 8 /* Bits per sample */ +-#define SNDRV_PCM_HW_PARAM_FRAME_BITS 9 /* Bits per frame */ +-#define SNDRV_PCM_HW_PARAM_CHANNELS 10 /* Channels */ +-#define SNDRV_PCM_HW_PARAM_RATE 11 /* Approx rate */ +-#define SNDRV_PCM_HW_PARAM_PERIOD_TIME 12 /* Approx distance between +- * interrupts in us +- */ +-#define SNDRV_PCM_HW_PARAM_PERIOD_SIZE 13 /* Approx frames between +- * interrupts +- */ +-#define SNDRV_PCM_HW_PARAM_PERIOD_BYTES 14 /* Approx bytes between +- * interrupts +- */ +-#define SNDRV_PCM_HW_PARAM_PERIODS 15 /* Approx interrupts per +- * buffer +- */ +-#define SNDRV_PCM_HW_PARAM_BUFFER_TIME 16 /* Approx duration of buffer +- * in us +- */ +-#define SNDRV_PCM_HW_PARAM_BUFFER_SIZE 17 /* Size of buffer in frames */ +-#define SNDRV_PCM_HW_PARAM_BUFFER_BYTES 18 /* Size of buffer in bytes */ +-#define SNDRV_PCM_HW_PARAM_TICK_TIME 19 /* Approx tick duration in us */ +-#define SNDRV_PCM_HW_PARAM_FIRST_INTERVAL SNDRV_PCM_HW_PARAM_SAMPLE_BITS +-#define SNDRV_PCM_HW_PARAM_LAST_INTERVAL SNDRV_PCM_HW_PARAM_TICK_TIME +- +-#define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */ +-#define SNDRV_PCM_HW_PARAMS_EXPORT_BUFFER (1<<1) /* export buffer */ +-#define SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP (1<<2) /* disable period wakeups */ +- +-struct snd_interval { +- unsigned int min, max; +- unsigned int openmin:1, +- openmax:1, +- integer:1, +- empty:1; +-}; +- +-#define SNDRV_MASK_MAX 256 +- +-struct snd_mask { +- __u32 bits[(SNDRV_MASK_MAX+31)/32]; +-}; +- +-struct snd_pcm_hw_params { +- unsigned int flags; +- struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK - +- SNDRV_PCM_HW_PARAM_FIRST_MASK + 1]; +- struct snd_mask mres[5]; /* reserved masks */ +- struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL - +- SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1]; +- struct snd_interval ires[9]; /* reserved intervals */ +- unsigned int rmask; /* W: requested masks */ +- unsigned int cmask; /* R: changed masks */ +- unsigned int info; /* R: Info flags for returned setup */ +- unsigned int msbits; /* R: used most significant bits */ +- unsigned int rate_num; /* R: rate numerator */ +- unsigned int rate_den; /* R: rate denominator */ +- snd_pcm_uframes_t fifo_size; /* R: chip FIFO size in frames */ +- unsigned char reserved[64]; /* reserved for future */ +-}; +- +-enum { +- SNDRV_PCM_TSTAMP_NONE = 0, +- SNDRV_PCM_TSTAMP_ENABLE, +- SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_ENABLE, +-}; +- +-struct snd_pcm_sw_params { +- int tstamp_mode; /* timestamp mode */ +- unsigned int period_step; +- unsigned int sleep_min; /* min ticks to sleep */ +- snd_pcm_uframes_t avail_min; /* min avail frames for wakeup */ +- snd_pcm_uframes_t xfer_align; /* obsolete: xfer size need to be a multiple */ +- snd_pcm_uframes_t start_threshold; /* min hw_avail frames for automatic start */ +- snd_pcm_uframes_t stop_threshold; /* min avail frames for automatic stop */ +- snd_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */ +- snd_pcm_uframes_t silence_size; /* silence block size */ +- snd_pcm_uframes_t boundary; /* pointers wrap point */ +- unsigned int proto; /* protocol version */ +- unsigned int tstamp_type; /* timestamp type (req. proto >= 2.0.12) */ +- unsigned char reserved[56]; /* reserved for future */ +-}; +- +-struct snd_pcm_channel_info { +- unsigned int channel; +- __kernel_off_t offset; /* mmap offset */ +- unsigned int first; /* offset to first sample in bits */ +- unsigned int step; /* samples distance in bits */ +-}; +- +-enum { +- /* +- * first definition for backwards compatibility only, +- * maps to wallclock/link time for HDAudio playback and DEFAULT/DMA time for everything else +- */ +- SNDRV_PCM_AUDIO_TSTAMP_TYPE_COMPAT = 0, +- +- /* timestamp definitions */ +- SNDRV_PCM_AUDIO_TSTAMP_TYPE_DEFAULT = 1, /* DMA time, reported as per hw_ptr */ +- SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK = 2, /* link time reported by sample or wallclock counter, reset on startup */ +- SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_ABSOLUTE = 3, /* link time reported by sample or wallclock counter, not reset on startup */ +- SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_ESTIMATED = 4, /* link time estimated indirectly */ +- SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED = 5, /* link time synchronized with system time */ +- SNDRV_PCM_AUDIO_TSTAMP_TYPE_LAST = SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED +-}; +- +-struct snd_pcm_status { +- snd_pcm_state_t state; /* stream state */ +- struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */ +- struct timespec tstamp; /* reference timestamp */ +- snd_pcm_uframes_t appl_ptr; /* appl ptr */ +- snd_pcm_uframes_t hw_ptr; /* hw ptr */ +- snd_pcm_sframes_t delay; /* current delay in frames */ +- snd_pcm_uframes_t avail; /* number of frames available */ +- snd_pcm_uframes_t avail_max; /* max frames available on hw since last status */ +- snd_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */ +- snd_pcm_state_t suspended_state; /* suspended stream state */ +- __u32 audio_tstamp_data; /* needed for 64-bit alignment, used for configs/report to/from userspace */ +- struct timespec audio_tstamp; /* sample counter, wall clock, PHC or on-demand sync'ed */ +- struct timespec driver_tstamp; /* useful in case reference system tstamp is reported with delay */ +- __u32 audio_tstamp_accuracy; /* in ns units, only valid if indicated in audio_tstamp_data */ +- unsigned char reserved[52-2*sizeof(struct timespec)]; /* must be filled with zero */ +-}; +- +-struct snd_pcm_mmap_status { +- snd_pcm_state_t state; /* RO: state - SNDRV_PCM_STATE_XXXX */ +- int pad1; /* Needed for 64 bit alignment */ +- snd_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */ +- struct timespec tstamp; /* Timestamp */ +- snd_pcm_state_t suspended_state; /* RO: suspended stream state */ +- struct timespec audio_tstamp; /* from sample counter or wall clock */ +-}; +- +-struct snd_pcm_mmap_control { +- snd_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */ +- snd_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */ +-}; +- +-#define SNDRV_PCM_SYNC_PTR_HWSYNC (1<<0) /* execute hwsync */ +-#define SNDRV_PCM_SYNC_PTR_APPL (1<<1) /* get appl_ptr from driver (r/w op) */ +-#define SNDRV_PCM_SYNC_PTR_AVAIL_MIN (1<<2) /* get avail_min from driver */ +- +-struct snd_pcm_sync_ptr { +- unsigned int flags; +- union { +- struct snd_pcm_mmap_status status; +- unsigned char reserved[64]; +- } s; +- union { +- struct snd_pcm_mmap_control control; +- unsigned char reserved[64]; +- } c; +-}; +- +-struct snd_xferi { +- snd_pcm_sframes_t result; +- void __user *buf; +- snd_pcm_uframes_t frames; +-}; +- +-struct snd_xfern { +- snd_pcm_sframes_t result; +- void __user * __user *bufs; +- snd_pcm_uframes_t frames; +-}; +- +-enum { +- SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, /* gettimeofday equivalent */ +- SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, /* posix_clock_monotonic equivalent */ +- SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW, /* monotonic_raw (no NTP) */ +- SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW, +-}; +- +-/* channel positions */ +-enum { +- SNDRV_CHMAP_UNKNOWN = 0, +- SNDRV_CHMAP_NA, /* N/A, silent */ +- SNDRV_CHMAP_MONO, /* mono stream */ +- /* this follows the alsa-lib mixer channel value + 3 */ +- SNDRV_CHMAP_FL, /* front left */ +- SNDRV_CHMAP_FR, /* front right */ +- SNDRV_CHMAP_RL, /* rear left */ +- SNDRV_CHMAP_RR, /* rear right */ +- SNDRV_CHMAP_FC, /* front center */ +- SNDRV_CHMAP_LFE, /* LFE */ +- SNDRV_CHMAP_SL, /* side left */ +- SNDRV_CHMAP_SR, /* side right */ +- SNDRV_CHMAP_RC, /* rear center */ +- /* new definitions */ +- SNDRV_CHMAP_FLC, /* front left center */ +- SNDRV_CHMAP_FRC, /* front right center */ +- SNDRV_CHMAP_RLC, /* rear left center */ +- SNDRV_CHMAP_RRC, /* rear right center */ +- SNDRV_CHMAP_FLW, /* front left wide */ +- SNDRV_CHMAP_FRW, /* front right wide */ +- SNDRV_CHMAP_FLH, /* front left high */ +- SNDRV_CHMAP_FCH, /* front center high */ +- SNDRV_CHMAP_FRH, /* front right high */ +- SNDRV_CHMAP_TC, /* top center */ +- SNDRV_CHMAP_TFL, /* top front left */ +- SNDRV_CHMAP_TFR, /* top front right */ +- SNDRV_CHMAP_TFC, /* top front center */ +- SNDRV_CHMAP_TRL, /* top rear left */ +- SNDRV_CHMAP_TRR, /* top rear right */ +- SNDRV_CHMAP_TRC, /* top rear center */ +- /* new definitions for UAC2 */ +- SNDRV_CHMAP_TFLC, /* top front left center */ +- SNDRV_CHMAP_TFRC, /* top front right center */ +- SNDRV_CHMAP_TSL, /* top side left */ +- SNDRV_CHMAP_TSR, /* top side right */ +- SNDRV_CHMAP_LLFE, /* left LFE */ +- SNDRV_CHMAP_RLFE, /* right LFE */ +- SNDRV_CHMAP_BC, /* bottom center */ +- SNDRV_CHMAP_BLC, /* bottom left center */ +- SNDRV_CHMAP_BRC, /* bottom right center */ +- SNDRV_CHMAP_LAST = SNDRV_CHMAP_BRC, +-}; +- +-#define SNDRV_CHMAP_POSITION_MASK 0xffff +-#define SNDRV_CHMAP_PHASE_INVERSE (0x01 << 16) +-#define SNDRV_CHMAP_DRIVER_SPEC (0x02 << 16) +- +-#define SNDRV_PCM_IOCTL_PVERSION _IOR('A', 0x00, int) +-#define SNDRV_PCM_IOCTL_INFO _IOR('A', 0x01, struct snd_pcm_info) +-#define SNDRV_PCM_IOCTL_TSTAMP _IOW('A', 0x02, int) +-#define SNDRV_PCM_IOCTL_TTSTAMP _IOW('A', 0x03, int) +-#define SNDRV_PCM_IOCTL_USER_PVERSION _IOW('A', 0x04, int) +-#define SNDRV_PCM_IOCTL_HW_REFINE _IOWR('A', 0x10, struct snd_pcm_hw_params) +-#define SNDRV_PCM_IOCTL_HW_PARAMS _IOWR('A', 0x11, struct snd_pcm_hw_params) +-#define SNDRV_PCM_IOCTL_HW_FREE _IO('A', 0x12) +-#define SNDRV_PCM_IOCTL_SW_PARAMS _IOWR('A', 0x13, struct snd_pcm_sw_params) +-#define SNDRV_PCM_IOCTL_STATUS _IOR('A', 0x20, struct snd_pcm_status) +-#define SNDRV_PCM_IOCTL_DELAY _IOR('A', 0x21, snd_pcm_sframes_t) +-#define SNDRV_PCM_IOCTL_HWSYNC _IO('A', 0x22) +-#define SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct snd_pcm_sync_ptr) +-#define SNDRV_PCM_IOCTL_STATUS_EXT _IOWR('A', 0x24, struct snd_pcm_status) +-#define SNDRV_PCM_IOCTL_CHANNEL_INFO _IOR('A', 0x32, struct snd_pcm_channel_info) +-#define SNDRV_PCM_IOCTL_PREPARE _IO('A', 0x40) +-#define SNDRV_PCM_IOCTL_RESET _IO('A', 0x41) +-#define SNDRV_PCM_IOCTL_START _IO('A', 0x42) +-#define SNDRV_PCM_IOCTL_DROP _IO('A', 0x43) +-#define SNDRV_PCM_IOCTL_DRAIN _IO('A', 0x44) +-#define SNDRV_PCM_IOCTL_PAUSE _IOW('A', 0x45, int) +-#define SNDRV_PCM_IOCTL_REWIND _IOW('A', 0x46, snd_pcm_uframes_t) +-#define SNDRV_PCM_IOCTL_RESUME _IO('A', 0x47) +-#define SNDRV_PCM_IOCTL_XRUN _IO('A', 0x48) +-#define SNDRV_PCM_IOCTL_FORWARD _IOW('A', 0x49, snd_pcm_uframes_t) +-#define SNDRV_PCM_IOCTL_WRITEI_FRAMES _IOW('A', 0x50, struct snd_xferi) +-#define SNDRV_PCM_IOCTL_READI_FRAMES _IOR('A', 0x51, struct snd_xferi) +-#define SNDRV_PCM_IOCTL_WRITEN_FRAMES _IOW('A', 0x52, struct snd_xfern) +-#define SNDRV_PCM_IOCTL_READN_FRAMES _IOR('A', 0x53, struct snd_xfern) +-#define SNDRV_PCM_IOCTL_LINK _IOW('A', 0x60, int) +-#define SNDRV_PCM_IOCTL_UNLINK _IO('A', 0x61) +- +-/***************************************************************************** +- * * +- * MIDI v1.0 interface * +- * * +- *****************************************************************************/ +- +-/* +- * Raw MIDI section - /dev/snd/midi?? +- */ +- +-#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0) +- +-enum { +- SNDRV_RAWMIDI_STREAM_OUTPUT = 0, +- SNDRV_RAWMIDI_STREAM_INPUT, +- SNDRV_RAWMIDI_STREAM_LAST = SNDRV_RAWMIDI_STREAM_INPUT, +-}; +- +-#define SNDRV_RAWMIDI_INFO_OUTPUT 0x00000001 +-#define SNDRV_RAWMIDI_INFO_INPUT 0x00000002 +-#define SNDRV_RAWMIDI_INFO_DUPLEX 0x00000004 +- +-struct snd_rawmidi_info { +- unsigned int device; /* RO/WR (control): device number */ +- unsigned int subdevice; /* RO/WR (control): subdevice number */ +- int stream; /* WR: stream */ +- int card; /* R: card number */ +- unsigned int flags; /* SNDRV_RAWMIDI_INFO_XXXX */ +- unsigned char id[64]; /* ID (user selectable) */ +- unsigned char name[80]; /* name of device */ +- unsigned char subname[32]; /* name of active or selected subdevice */ +- unsigned int subdevices_count; +- unsigned int subdevices_avail; +- unsigned char reserved[64]; /* reserved for future use */ +-}; +- +-struct snd_rawmidi_params { +- int stream; +- size_t buffer_size; /* queue size in bytes */ +- size_t avail_min; /* minimum avail bytes for wakeup */ +- unsigned int no_active_sensing: 1; /* do not send active sensing byte in close() */ +- unsigned char reserved[16]; /* reserved for future use */ +-}; +- +-struct snd_rawmidi_status { +- int stream; +- struct timespec tstamp; /* Timestamp */ +- size_t avail; /* available bytes */ +- size_t xruns; /* count of overruns since last status (in bytes) */ +- unsigned char reserved[16]; /* reserved for future use */ +-}; +- +-#define SNDRV_RAWMIDI_IOCTL_PVERSION _IOR('W', 0x00, int) +-#define SNDRV_RAWMIDI_IOCTL_INFO _IOR('W', 0x01, struct snd_rawmidi_info) +-#define SNDRV_RAWMIDI_IOCTL_PARAMS _IOWR('W', 0x10, struct snd_rawmidi_params) +-#define SNDRV_RAWMIDI_IOCTL_STATUS _IOWR('W', 0x20, struct snd_rawmidi_status) +-#define SNDRV_RAWMIDI_IOCTL_DROP _IOW('W', 0x30, int) +-#define SNDRV_RAWMIDI_IOCTL_DRAIN _IOW('W', 0x31, int) +- +-/* +- * Timer section - /dev/snd/timer +- */ +- +-#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 6) +- +-enum { +- SNDRV_TIMER_CLASS_NONE = -1, +- SNDRV_TIMER_CLASS_SLAVE = 0, +- SNDRV_TIMER_CLASS_GLOBAL, +- SNDRV_TIMER_CLASS_CARD, +- SNDRV_TIMER_CLASS_PCM, +- SNDRV_TIMER_CLASS_LAST = SNDRV_TIMER_CLASS_PCM, +-}; +- +-/* slave timer classes */ +-enum { +- SNDRV_TIMER_SCLASS_NONE = 0, +- SNDRV_TIMER_SCLASS_APPLICATION, +- SNDRV_TIMER_SCLASS_SEQUENCER, /* alias */ +- SNDRV_TIMER_SCLASS_OSS_SEQUENCER, /* alias */ +- SNDRV_TIMER_SCLASS_LAST = SNDRV_TIMER_SCLASS_OSS_SEQUENCER, +-}; +- +-/* global timers (device member) */ +-#define SNDRV_TIMER_GLOBAL_SYSTEM 0 +-#define SNDRV_TIMER_GLOBAL_RTC 1 /* unused */ +-#define SNDRV_TIMER_GLOBAL_HPET 2 +-#define SNDRV_TIMER_GLOBAL_HRTIMER 3 +- +-/* info flags */ +-#define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */ +- +-struct snd_timer_id { +- int dev_class; +- int dev_sclass; +- int card; +- int device; +- int subdevice; +-}; +- +-struct snd_timer_ginfo { +- struct snd_timer_id tid; /* requested timer ID */ +- unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */ +- int card; /* card number */ +- unsigned char id[64]; /* timer identification */ +- unsigned char name[80]; /* timer name */ +- unsigned long reserved0; /* reserved for future use */ +- unsigned long resolution; /* average period resolution in ns */ +- unsigned long resolution_min; /* minimal period resolution in ns */ +- unsigned long resolution_max; /* maximal period resolution in ns */ +- unsigned int clients; /* active timer clients */ +- unsigned char reserved[32]; +-}; +- +-struct snd_timer_gparams { +- struct snd_timer_id tid; /* requested timer ID */ +- unsigned long period_num; /* requested precise period duration (in seconds) - numerator */ +- unsigned long period_den; /* requested precise period duration (in seconds) - denominator */ +- unsigned char reserved[32]; +-}; +- +-struct snd_timer_gstatus { +- struct snd_timer_id tid; /* requested timer ID */ +- unsigned long resolution; /* current period resolution in ns */ +- unsigned long resolution_num; /* precise current period resolution (in seconds) - numerator */ +- unsigned long resolution_den; /* precise current period resolution (in seconds) - denominator */ +- unsigned char reserved[32]; +-}; +- +-struct snd_timer_select { +- struct snd_timer_id id; /* bind to timer ID */ +- unsigned char reserved[32]; /* reserved */ +-}; +- +-struct snd_timer_info { +- unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */ +- int card; /* card number */ +- unsigned char id[64]; /* timer identificator */ +- unsigned char name[80]; /* timer name */ +- unsigned long reserved0; /* reserved for future use */ +- unsigned long resolution; /* average period resolution in ns */ +- unsigned char reserved[64]; /* reserved */ +-}; +- +-#define SNDRV_TIMER_PSFLG_AUTO (1<<0) /* auto start, otherwise one-shot */ +-#define SNDRV_TIMER_PSFLG_EXCLUSIVE (1<<1) /* exclusive use, precise start/stop/pause/continue */ +-#define SNDRV_TIMER_PSFLG_EARLY_EVENT (1<<2) /* write early event to the poll queue */ +- +-struct snd_timer_params { +- unsigned int flags; /* flags - SNDRV_TIMER_PSFLG_* */ +- unsigned int ticks; /* requested resolution in ticks */ +- unsigned int queue_size; /* total size of queue (32-1024) */ +- unsigned int reserved0; /* reserved, was: failure locations */ +- unsigned int filter; /* event filter (bitmask of SNDRV_TIMER_EVENT_*) */ +- unsigned char reserved[60]; /* reserved */ +-}; +- +-struct snd_timer_status { +- struct timespec tstamp; /* Timestamp - last update */ +- unsigned int resolution; /* current period resolution in ns */ +- unsigned int lost; /* counter of master tick lost */ +- unsigned int overrun; /* count of read queue overruns */ +- unsigned int queue; /* used queue size */ +- unsigned char reserved[64]; /* reserved */ +-}; +- +-#define SNDRV_TIMER_IOCTL_PVERSION _IOR('T', 0x00, int) +-#define SNDRV_TIMER_IOCTL_NEXT_DEVICE _IOWR('T', 0x01, struct snd_timer_id) +-#define SNDRV_TIMER_IOCTL_TREAD _IOW('T', 0x02, int) +-#define SNDRV_TIMER_IOCTL_GINFO _IOWR('T', 0x03, struct snd_timer_ginfo) +-#define SNDRV_TIMER_IOCTL_GPARAMS _IOW('T', 0x04, struct snd_timer_gparams) +-#define SNDRV_TIMER_IOCTL_GSTATUS _IOWR('T', 0x05, struct snd_timer_gstatus) +-#define SNDRV_TIMER_IOCTL_SELECT _IOW('T', 0x10, struct snd_timer_select) +-#define SNDRV_TIMER_IOCTL_INFO _IOR('T', 0x11, struct snd_timer_info) +-#define SNDRV_TIMER_IOCTL_PARAMS _IOW('T', 0x12, struct snd_timer_params) +-#define SNDRV_TIMER_IOCTL_STATUS _IOR('T', 0x14, struct snd_timer_status) +-/* The following four ioctls are changed since 1.0.9 due to confliction */ +-#define SNDRV_TIMER_IOCTL_START _IO('T', 0xa0) +-#define SNDRV_TIMER_IOCTL_STOP _IO('T', 0xa1) +-#define SNDRV_TIMER_IOCTL_CONTINUE _IO('T', 0xa2) +-#define SNDRV_TIMER_IOCTL_PAUSE _IO('T', 0xa3) +- +-struct snd_timer_read { +- unsigned int resolution; +- unsigned int ticks; +-}; +- +-enum { +- SNDRV_TIMER_EVENT_RESOLUTION = 0, /* val = resolution in ns */ +- SNDRV_TIMER_EVENT_TICK, /* val = ticks */ +- SNDRV_TIMER_EVENT_START, /* val = resolution in ns */ +- SNDRV_TIMER_EVENT_STOP, /* val = 0 */ +- SNDRV_TIMER_EVENT_CONTINUE, /* val = resolution in ns */ +- SNDRV_TIMER_EVENT_PAUSE, /* val = 0 */ +- SNDRV_TIMER_EVENT_EARLY, /* val = 0, early event */ +- SNDRV_TIMER_EVENT_SUSPEND, /* val = 0 */ +- SNDRV_TIMER_EVENT_RESUME, /* val = resolution in ns */ +- /* master timer events for slave timer instances */ +- SNDRV_TIMER_EVENT_MSTART = SNDRV_TIMER_EVENT_START + 10, +- SNDRV_TIMER_EVENT_MSTOP = SNDRV_TIMER_EVENT_STOP + 10, +- SNDRV_TIMER_EVENT_MCONTINUE = SNDRV_TIMER_EVENT_CONTINUE + 10, +- SNDRV_TIMER_EVENT_MPAUSE = SNDRV_TIMER_EVENT_PAUSE + 10, +- SNDRV_TIMER_EVENT_MSUSPEND = SNDRV_TIMER_EVENT_SUSPEND + 10, +- SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10, +-}; +- +-struct snd_timer_tread { +- int event; +- struct timespec tstamp; +- unsigned int val; +-}; +- +-/**************************************************************************** +- * * +- * Section for driver control interface - /dev/snd/control? * +- * * +- ****************************************************************************/ +- +-#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7) +- +-struct snd_ctl_card_info { +- int card; /* card number */ +- int pad; /* reserved for future (was type) */ +- unsigned char id[16]; /* ID of card (user selectable) */ +- unsigned char driver[16]; /* Driver name */ +- unsigned char name[32]; /* Short name of soundcard */ +- unsigned char longname[80]; /* name + info text about soundcard */ +- unsigned char reserved_[16]; /* reserved for future (was ID of mixer) */ +- unsigned char mixername[80]; /* visual mixer identification */ +- unsigned char components[128]; /* card components / fine identification, delimited with one space (AC97 etc..) */ +-}; +- +-typedef int __bitwise snd_ctl_elem_type_t; +-#define SNDRV_CTL_ELEM_TYPE_NONE ((__force snd_ctl_elem_type_t) 0) /* invalid */ +-#define SNDRV_CTL_ELEM_TYPE_BOOLEAN ((__force snd_ctl_elem_type_t) 1) /* boolean type */ +-#define SNDRV_CTL_ELEM_TYPE_INTEGER ((__force snd_ctl_elem_type_t) 2) /* integer type */ +-#define SNDRV_CTL_ELEM_TYPE_ENUMERATED ((__force snd_ctl_elem_type_t) 3) /* enumerated type */ +-#define SNDRV_CTL_ELEM_TYPE_BYTES ((__force snd_ctl_elem_type_t) 4) /* byte array */ +-#define SNDRV_CTL_ELEM_TYPE_IEC958 ((__force snd_ctl_elem_type_t) 5) /* IEC958 (S/PDIF) setup */ +-#define SNDRV_CTL_ELEM_TYPE_INTEGER64 ((__force snd_ctl_elem_type_t) 6) /* 64-bit integer type */ +-#define SNDRV_CTL_ELEM_TYPE_LAST SNDRV_CTL_ELEM_TYPE_INTEGER64 +- +-typedef int __bitwise snd_ctl_elem_iface_t; +-#define SNDRV_CTL_ELEM_IFACE_CARD ((__force snd_ctl_elem_iface_t) 0) /* global control */ +-#define SNDRV_CTL_ELEM_IFACE_HWDEP ((__force snd_ctl_elem_iface_t) 1) /* hardware dependent device */ +-#define SNDRV_CTL_ELEM_IFACE_MIXER ((__force snd_ctl_elem_iface_t) 2) /* virtual mixer device */ +-#define SNDRV_CTL_ELEM_IFACE_PCM ((__force snd_ctl_elem_iface_t) 3) /* PCM device */ +-#define SNDRV_CTL_ELEM_IFACE_RAWMIDI ((__force snd_ctl_elem_iface_t) 4) /* RawMidi device */ +-#define SNDRV_CTL_ELEM_IFACE_TIMER ((__force snd_ctl_elem_iface_t) 5) /* timer device */ +-#define SNDRV_CTL_ELEM_IFACE_SEQUENCER ((__force snd_ctl_elem_iface_t) 6) /* sequencer client */ +-#define SNDRV_CTL_ELEM_IFACE_LAST SNDRV_CTL_ELEM_IFACE_SEQUENCER +- +-#define SNDRV_CTL_ELEM_ACCESS_READ (1<<0) +-#define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1) +-#define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE) +-#define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */ +-#define SNDRV_CTL_ELEM_ACCESS_TIMESTAMP (1<<3) /* when was control changed */ +-#define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1<<4) /* TLV read is possible */ +-#define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1<<5) /* TLV write is possible */ +-#define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE) +-#define SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND (1<<6) /* TLV command is possible */ +-#define SNDRV_CTL_ELEM_ACCESS_INACTIVE (1<<8) /* control does actually nothing, but may be updated */ +-#define SNDRV_CTL_ELEM_ACCESS_LOCK (1<<9) /* write lock */ +-#define SNDRV_CTL_ELEM_ACCESS_OWNER (1<<10) /* write lock owner */ +-#define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK (1<<28) /* kernel use a TLV callback */ +-#define SNDRV_CTL_ELEM_ACCESS_USER (1<<29) /* user space element */ +-/* bits 30 and 31 are obsoleted (for indirect access) */ +- +-/* for further details see the ACPI and PCI power management specification */ +-#define SNDRV_CTL_POWER_D0 0x0000 /* full On */ +-#define SNDRV_CTL_POWER_D1 0x0100 /* partial On */ +-#define SNDRV_CTL_POWER_D2 0x0200 /* partial On */ +-#define SNDRV_CTL_POWER_D3 0x0300 /* Off */ +-#define SNDRV_CTL_POWER_D3hot (SNDRV_CTL_POWER_D3|0x0000) /* Off, with power */ +-#define SNDRV_CTL_POWER_D3cold (SNDRV_CTL_POWER_D3|0x0001) /* Off, without power */ +- +-#define SNDRV_CTL_ELEM_ID_NAME_MAXLEN 44 +- +-struct snd_ctl_elem_id { +- unsigned int numid; /* numeric identifier, zero = invalid */ +- snd_ctl_elem_iface_t iface; /* interface identifier */ +- unsigned int device; /* device/client number */ +- unsigned int subdevice; /* subdevice (substream) number */ +- unsigned char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* ASCII name of item */ +- unsigned int index; /* index of item */ +-}; +- +-struct snd_ctl_elem_list { +- unsigned int offset; /* W: first element ID to get */ +- unsigned int space; /* W: count of element IDs to get */ +- unsigned int used; /* R: count of element IDs set */ +- unsigned int count; /* R: count of all elements */ +- struct snd_ctl_elem_id __user *pids; /* R: IDs */ +- unsigned char reserved[50]; +-}; +- +-struct snd_ctl_elem_info { +- struct snd_ctl_elem_id id; /* W: element ID */ +- snd_ctl_elem_type_t type; /* R: value type - SNDRV_CTL_ELEM_TYPE_* */ +- unsigned int access; /* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */ +- unsigned int count; /* count of values */ +- __kernel_pid_t owner; /* owner's PID of this control */ +- union { +- struct { +- long min; /* R: minimum value */ +- long max; /* R: maximum value */ +- long step; /* R: step (0 variable) */ +- } integer; +- struct { +- long long min; /* R: minimum value */ +- long long max; /* R: maximum value */ +- long long step; /* R: step (0 variable) */ +- } integer64; +- struct { +- unsigned int items; /* R: number of items */ +- unsigned int item; /* W: item number */ +- char name[64]; /* R: value name */ +- __u64 names_ptr; /* W: names list (ELEM_ADD only) */ +- unsigned int names_length; +- } enumerated; +- unsigned char reserved[128]; +- } value; +- union { +- unsigned short d[4]; /* dimensions */ +- unsigned short *d_ptr; /* indirect - obsoleted */ +- } dimen; +- unsigned char reserved[64-4*sizeof(unsigned short)]; +-}; +- +-struct snd_ctl_elem_value { +- struct snd_ctl_elem_id id; /* W: element ID */ +- unsigned int indirect: 1; /* W: indirect access - obsoleted */ +- union { +- union { +- long value[128]; +- long *value_ptr; /* obsoleted */ +- } integer; +- union { +- long long value[64]; +- long long *value_ptr; /* obsoleted */ +- } integer64; +- union { +- unsigned int item[128]; +- unsigned int *item_ptr; /* obsoleted */ +- } enumerated; +- union { +- unsigned char data[512]; +- unsigned char *data_ptr; /* obsoleted */ +- } bytes; +- struct snd_aes_iec958 iec958; +- } value; /* RO */ +- struct timespec tstamp; +- unsigned char reserved[128-sizeof(struct timespec)]; +-}; +- +-struct snd_ctl_tlv { +- unsigned int numid; /* control element numeric identification */ +- unsigned int length; /* in bytes aligned to 4 */ +- unsigned int tlv[0]; /* first TLV */ +-}; +- +-#define SNDRV_CTL_IOCTL_PVERSION _IOR('U', 0x00, int) +-#define SNDRV_CTL_IOCTL_CARD_INFO _IOR('U', 0x01, struct snd_ctl_card_info) +-#define SNDRV_CTL_IOCTL_ELEM_LIST _IOWR('U', 0x10, struct snd_ctl_elem_list) +-#define SNDRV_CTL_IOCTL_ELEM_INFO _IOWR('U', 0x11, struct snd_ctl_elem_info) +-#define SNDRV_CTL_IOCTL_ELEM_READ _IOWR('U', 0x12, struct snd_ctl_elem_value) +-#define SNDRV_CTL_IOCTL_ELEM_WRITE _IOWR('U', 0x13, struct snd_ctl_elem_value) +-#define SNDRV_CTL_IOCTL_ELEM_LOCK _IOW('U', 0x14, struct snd_ctl_elem_id) +-#define SNDRV_CTL_IOCTL_ELEM_UNLOCK _IOW('U', 0x15, struct snd_ctl_elem_id) +-#define SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS _IOWR('U', 0x16, int) +-#define SNDRV_CTL_IOCTL_ELEM_ADD _IOWR('U', 0x17, struct snd_ctl_elem_info) +-#define SNDRV_CTL_IOCTL_ELEM_REPLACE _IOWR('U', 0x18, struct snd_ctl_elem_info) +-#define SNDRV_CTL_IOCTL_ELEM_REMOVE _IOWR('U', 0x19, struct snd_ctl_elem_id) +-#define SNDRV_CTL_IOCTL_TLV_READ _IOWR('U', 0x1a, struct snd_ctl_tlv) +-#define SNDRV_CTL_IOCTL_TLV_WRITE _IOWR('U', 0x1b, struct snd_ctl_tlv) +-#define SNDRV_CTL_IOCTL_TLV_COMMAND _IOWR('U', 0x1c, struct snd_ctl_tlv) +-#define SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE _IOWR('U', 0x20, int) +-#define SNDRV_CTL_IOCTL_HWDEP_INFO _IOR('U', 0x21, struct snd_hwdep_info) +-#define SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE _IOR('U', 0x30, int) +-#define SNDRV_CTL_IOCTL_PCM_INFO _IOWR('U', 0x31, struct snd_pcm_info) +-#define SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE _IOW('U', 0x32, int) +-#define SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE _IOWR('U', 0x40, int) +-#define SNDRV_CTL_IOCTL_RAWMIDI_INFO _IOWR('U', 0x41, struct snd_rawmidi_info) +-#define SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE _IOW('U', 0x42, int) +-#define SNDRV_CTL_IOCTL_POWER _IOWR('U', 0xd0, int) +-#define SNDRV_CTL_IOCTL_POWER_STATE _IOR('U', 0xd1, int) +- +-/* +- * Read interface. +- */ +- +-enum sndrv_ctl_event_type { +- SNDRV_CTL_EVENT_ELEM = 0, +- SNDRV_CTL_EVENT_LAST = SNDRV_CTL_EVENT_ELEM, +-}; +- +-#define SNDRV_CTL_EVENT_MASK_VALUE (1<<0) /* element value was changed */ +-#define SNDRV_CTL_EVENT_MASK_INFO (1<<1) /* element info was changed */ +-#define SNDRV_CTL_EVENT_MASK_ADD (1<<2) /* element was added */ +-#define SNDRV_CTL_EVENT_MASK_TLV (1<<3) /* element TLV tree was changed */ +-#define SNDRV_CTL_EVENT_MASK_REMOVE (~0U) /* element was removed */ +- +-struct snd_ctl_event { +- int type; /* event type - SNDRV_CTL_EVENT_* */ +- union { +- struct { +- unsigned int mask; +- struct snd_ctl_elem_id id; +- } elem; +- unsigned char data8[60]; +- } data; +-}; +- +-/* +- * Control names +- */ +- +-#define SNDRV_CTL_NAME_NONE "" +-#define SNDRV_CTL_NAME_PLAYBACK "Playback " +-#define SNDRV_CTL_NAME_CAPTURE "Capture " +- +-#define SNDRV_CTL_NAME_IEC958_NONE "" +-#define SNDRV_CTL_NAME_IEC958_SWITCH "Switch" +-#define SNDRV_CTL_NAME_IEC958_VOLUME "Volume" +-#define SNDRV_CTL_NAME_IEC958_DEFAULT "Default" +-#define SNDRV_CTL_NAME_IEC958_MASK "Mask" +-#define SNDRV_CTL_NAME_IEC958_CON_MASK "Con Mask" +-#define SNDRV_CTL_NAME_IEC958_PRO_MASK "Pro Mask" +-#define SNDRV_CTL_NAME_IEC958_PCM_STREAM "PCM Stream" +-#define SNDRV_CTL_NAME_IEC958(expl,direction,what) "IEC958 " expl SNDRV_CTL_NAME_##direction SNDRV_CTL_NAME_IEC958_##what +- +-#endif /* _UAPI__SOUND_ASOUND_H */ ++#include +diff --git a/include/sound/asound_fm.h b/include/sound/asound_fm.h +index 8471f404..3e5da4d0 100644 +--- a/include/sound/asound_fm.h ++++ b/include/sound/asound_fm.h +@@ -1,135 +1 @@ +-/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ +-#ifndef __SOUND_ASOUND_FM_H +-#define __SOUND_ASOUND_FM_H +- +-/* +- * Advanced Linux Sound Architecture - ALSA +- * +- * Interface file between ALSA driver & user space +- * Copyright (c) 1994-98 by Jaroslav Kysela , +- * 4Front Technologies +- * +- * Direct FM control +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this program; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- * +- */ +- +-#define SNDRV_DM_FM_MODE_OPL2 0x00 +-#define SNDRV_DM_FM_MODE_OPL3 0x01 +- +-struct snd_dm_fm_info { +- unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */ +- unsigned char rhythm; /* percussion mode flag */ +-}; +- +-/* +- * Data structure composing an FM "note" or sound event. +- */ +- +-struct snd_dm_fm_voice { +- unsigned char op; /* operator cell (0 or 1) */ +- unsigned char voice; /* FM voice (0 to 17) */ +- +- unsigned char am; /* amplitude modulation */ +- unsigned char vibrato; /* vibrato effect */ +- unsigned char do_sustain; /* sustain phase */ +- unsigned char kbd_scale; /* keyboard scaling */ +- unsigned char harmonic; /* 4 bits: harmonic and multiplier */ +- unsigned char scale_level; /* 2 bits: decrease output freq rises */ +- unsigned char volume; /* 6 bits: volume */ +- +- unsigned char attack; /* 4 bits: attack rate */ +- unsigned char decay; /* 4 bits: decay rate */ +- unsigned char sustain; /* 4 bits: sustain level */ +- unsigned char release; /* 4 bits: release rate */ +- +- unsigned char feedback; /* 3 bits: feedback for op0 */ +- unsigned char connection; /* 0 for serial, 1 for parallel */ +- unsigned char left; /* stereo left */ +- unsigned char right; /* stereo right */ +- unsigned char waveform; /* 3 bits: waveform shape */ +-}; +- +-/* +- * This describes an FM note by its voice, octave, frequency number (10bit) +- * and key on/off. +- */ +- +-struct snd_dm_fm_note { +- unsigned char voice; /* 0-17 voice channel */ +- unsigned char octave; /* 3 bits: what octave to play */ +- unsigned int fnum; /* 10 bits: frequency number */ +- unsigned char key_on; /* set for active, clear for silent */ +-}; +- +-/* +- * FM parameters that apply globally to all voices, and thus are not "notes" +- */ +- +-struct snd_dm_fm_params { +- unsigned char am_depth; /* amplitude modulation depth (1=hi) */ +- unsigned char vib_depth; /* vibrato depth (1=hi) */ +- unsigned char kbd_split; /* keyboard split */ +- unsigned char rhythm; /* percussion mode select */ +- +- /* This block is the percussion instrument data */ +- unsigned char bass; +- unsigned char snare; +- unsigned char tomtom; +- unsigned char cymbal; +- unsigned char hihat; +-}; +- +-/* +- * FM mode ioctl settings +- */ +- +-#define SNDRV_DM_FM_IOCTL_INFO _IOR('H', 0x20, struct snd_dm_fm_info) +-#define SNDRV_DM_FM_IOCTL_RESET _IO ('H', 0x21) +-#define SNDRV_DM_FM_IOCTL_PLAY_NOTE _IOW('H', 0x22, struct snd_dm_fm_note) +-#define SNDRV_DM_FM_IOCTL_SET_VOICE _IOW('H', 0x23, struct snd_dm_fm_voice) +-#define SNDRV_DM_FM_IOCTL_SET_PARAMS _IOW('H', 0x24, struct snd_dm_fm_params) +-#define SNDRV_DM_FM_IOCTL_SET_MODE _IOW('H', 0x25, int) +-/* for OPL3 only */ +-#define SNDRV_DM_FM_IOCTL_SET_CONNECTION _IOW('H', 0x26, int) +-/* SBI patch management */ +-#define SNDRV_DM_FM_IOCTL_CLEAR_PATCHES _IO ('H', 0x40) +- +-#define SNDRV_DM_FM_OSS_IOCTL_RESET 0x20 +-#define SNDRV_DM_FM_OSS_IOCTL_PLAY_NOTE 0x21 +-#define SNDRV_DM_FM_OSS_IOCTL_SET_VOICE 0x22 +-#define SNDRV_DM_FM_OSS_IOCTL_SET_PARAMS 0x23 +-#define SNDRV_DM_FM_OSS_IOCTL_SET_MODE 0x24 +-#define SNDRV_DM_FM_OSS_IOCTL_SET_OPL 0x25 +- +-/* +- * Patch Record - fixed size for write +- */ +- +-#define FM_KEY_SBI "SBI\032" +-#define FM_KEY_2OP "2OP\032" +-#define FM_KEY_4OP "4OP\032" +- +-struct sbi_patch { +- unsigned char prog; +- unsigned char bank; +- char key[4]; +- char name[25]; +- char extension[7]; +- unsigned char data[32]; +-}; +- +-#endif /* __SOUND_ASOUND_FM_H */ ++#include +diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h +index 042c5a6f..f06ecee5 100644 +--- a/include/sound/emu10k1.h ++++ b/include/sound/emu10k1.h +@@ -1,381 +1,2 @@ +-/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ +-/* +- * Copyright (c) by Jaroslav Kysela , +- * Creative Labs, Inc. +- * Definitions for EMU10K1 (SB Live!) chips +- * +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this program; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- * +- */ +-#ifndef _UAPI__SOUND_EMU10K1_H +-#define _UAPI__SOUND_EMU10K1_H +- +-#include +-#include +- +-/* +- * ---- FX8010 ---- +- */ +- +-#define EMU10K1_CARD_CREATIVE 0x00000000 +-#define EMU10K1_CARD_EMUAPS 0x00000001 +- +-#define EMU10K1_FX8010_PCM_COUNT 8 +- +-/* +- * Following definition is copied from linux/types.h to support compiling +- * this header file in userspace since they are not generally available for +- * uapi headers. +- */ +-#define __EMU10K1_DECLARE_BITMAP(name,bits) \ +- unsigned long name[(bits) / (sizeof(unsigned long) * 8)] +- +-/* instruction set */ +-#define iMAC0 0x00 /* R = A + (X * Y >> 31) ; saturation */ +-#define iMAC1 0x01 /* R = A + (-X * Y >> 31) ; saturation */ +-#define iMAC2 0x02 /* R = A + (X * Y >> 31) ; wraparound */ +-#define iMAC3 0x03 /* R = A + (-X * Y >> 31) ; wraparound */ +-#define iMACINT0 0x04 /* R = A + X * Y ; saturation */ +-#define iMACINT1 0x05 /* R = A + X * Y ; wraparound (31-bit) */ +-#define iACC3 0x06 /* R = A + X + Y ; saturation */ +-#define iMACMV 0x07 /* R = A, acc += X * Y >> 31 */ +-#define iANDXOR 0x08 /* R = (A & X) ^ Y */ +-#define iTSTNEG 0x09 /* R = (A >= Y) ? X : ~X */ +-#define iLIMITGE 0x0a /* R = (A >= Y) ? X : Y */ +-#define iLIMITLT 0x0b /* R = (A < Y) ? X : Y */ +-#define iLOG 0x0c /* R = linear_data, A (log_data), X (max_exp), Y (format_word) */ +-#define iEXP 0x0d /* R = log_data, A (linear_data), X (max_exp), Y (format_word) */ +-#define iINTERP 0x0e /* R = A + (X * (Y - A) >> 31) ; saturation */ +-#define iSKIP 0x0f /* R = A (cc_reg), X (count), Y (cc_test) */ +- +-/* GPRs */ +-#define FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x0f */ +-#define EXTIN(x) (0x10 + (x)) /* x = 0x00 - 0x0f */ +-#define EXTOUT(x) (0x20 + (x)) /* x = 0x00 - 0x0f physical outs -> FXWC low 16 bits */ +-#define FXBUS2(x) (0x30 + (x)) /* x = 0x00 - 0x0f copies of fx buses for capture -> FXWC high 16 bits */ +- /* NB: 0x31 and 0x32 are shared with Center/LFE on SB live 5.1 */ +- +-#define C_00000000 0x40 +-#define C_00000001 0x41 +-#define C_00000002 0x42 +-#define C_00000003 0x43 +-#define C_00000004 0x44 +-#define C_00000008 0x45 +-#define C_00000010 0x46 +-#define C_00000020 0x47 +-#define C_00000100 0x48 +-#define C_00010000 0x49 +-#define C_00080000 0x4a +-#define C_10000000 0x4b +-#define C_20000000 0x4c +-#define C_40000000 0x4d +-#define C_80000000 0x4e +-#define C_7fffffff 0x4f +-#define C_ffffffff 0x50 +-#define C_fffffffe 0x51 +-#define C_c0000000 0x52 +-#define C_4f1bbcdc 0x53 +-#define C_5a7ef9db 0x54 +-#define C_00100000 0x55 /* ?? */ +-#define GPR_ACCU 0x56 /* ACCUM, accumulator */ +-#define GPR_COND 0x57 /* CCR, condition register */ +-#define GPR_NOISE0 0x58 /* noise source */ +-#define GPR_NOISE1 0x59 /* noise source */ +-#define GPR_IRQ 0x5a /* IRQ register */ +-#define GPR_DBAC 0x5b /* TRAM Delay Base Address Counter */ +-#define GPR(x) (FXGPREGBASE + (x)) /* free GPRs: x = 0x00 - 0xff */ +-#define ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */ +-#define ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */ +-#define ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */ +-#define ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */ +- +-#define A_ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */ +-#define A_ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */ +-#define A_ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */ +-#define A_ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */ +-#define A_ITRAM_CTL(x) (A_TANKMEMCTLREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */ +-#define A_ETRAM_CTL(x) (A_TANKMEMCTLREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */ +- +-#define A_FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x3f FX buses */ +-#define A_EXTIN(x) (0x40 + (x)) /* x = 0x00 - 0x0f physical ins */ +-#define A_P16VIN(x) (0x50 + (x)) /* x = 0x00 - 0x0f p16v ins (A2 only) "EMU32 inputs" */ +-#define A_EXTOUT(x) (0x60 + (x)) /* x = 0x00 - 0x1f physical outs -> A_FXWC1 0x79-7f unknown */ +-#define A_FXBUS2(x) (0x80 + (x)) /* x = 0x00 - 0x1f extra outs used for EFX capture -> A_FXWC2 */ +-#define A_EMU32OUTH(x) (0xa0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_10 - _1F" - ??? */ +-#define A_EMU32OUTL(x) (0xb0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_1 - _F" - ??? */ +-#define A3_EMU32IN(x) (0x160 + (x)) /* x = 0x00 - 0x3f "EMU32_IN_00 - _3F" - Only when .device = 0x0008 */ +-#define A3_EMU32OUT(x) (0x1E0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_00 - _3F" - Only when .device = 0x0008 */ +-#define A_GPR(x) (A_FXGPREGBASE + (x)) +- +-/* cc_reg constants */ +-#define CC_REG_NORMALIZED C_00000001 +-#define CC_REG_BORROW C_00000002 +-#define CC_REG_MINUS C_00000004 +-#define CC_REG_ZERO C_00000008 +-#define CC_REG_SATURATE C_00000010 +-#define CC_REG_NONZERO C_00000100 +- +-/* FX buses */ +-#define FXBUS_PCM_LEFT 0x00 +-#define FXBUS_PCM_RIGHT 0x01 +-#define FXBUS_PCM_LEFT_REAR 0x02 +-#define FXBUS_PCM_RIGHT_REAR 0x03 +-#define FXBUS_MIDI_LEFT 0x04 +-#define FXBUS_MIDI_RIGHT 0x05 +-#define FXBUS_PCM_CENTER 0x06 +-#define FXBUS_PCM_LFE 0x07 +-#define FXBUS_PCM_LEFT_FRONT 0x08 +-#define FXBUS_PCM_RIGHT_FRONT 0x09 +-#define FXBUS_MIDI_REVERB 0x0c +-#define FXBUS_MIDI_CHORUS 0x0d +-#define FXBUS_PCM_LEFT_SIDE 0x0e +-#define FXBUS_PCM_RIGHT_SIDE 0x0f +-#define FXBUS_PT_LEFT 0x14 +-#define FXBUS_PT_RIGHT 0x15 +- +-/* Inputs */ +-#define EXTIN_AC97_L 0x00 /* AC'97 capture channel - left */ +-#define EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */ +-#define EXTIN_SPDIF_CD_L 0x02 /* internal S/PDIF CD - onboard - left */ +-#define EXTIN_SPDIF_CD_R 0x03 /* internal S/PDIF CD - onboard - right */ +-#define EXTIN_ZOOM_L 0x04 /* Zoom Video I2S - left */ +-#define EXTIN_ZOOM_R 0x05 /* Zoom Video I2S - right */ +-#define EXTIN_TOSLINK_L 0x06 /* LiveDrive - TOSLink Optical - left */ +-#define EXTIN_TOSLINK_R 0x07 /* LiveDrive - TOSLink Optical - right */ +-#define EXTIN_LINE1_L 0x08 /* LiveDrive - Line/Mic 1 - left */ +-#define EXTIN_LINE1_R 0x09 /* LiveDrive - Line/Mic 1 - right */ +-#define EXTIN_COAX_SPDIF_L 0x0a /* LiveDrive - Coaxial S/PDIF - left */ +-#define EXTIN_COAX_SPDIF_R 0x0b /* LiveDrive - Coaxial S/PDIF - right */ +-#define EXTIN_LINE2_L 0x0c /* LiveDrive - Line/Mic 2 - left */ +-#define EXTIN_LINE2_R 0x0d /* LiveDrive - Line/Mic 2 - right */ +- +-/* Outputs */ +-#define EXTOUT_AC97_L 0x00 /* AC'97 playback channel - left */ +-#define EXTOUT_AC97_R 0x01 /* AC'97 playback channel - right */ +-#define EXTOUT_TOSLINK_L 0x02 /* LiveDrive - TOSLink Optical - left */ +-#define EXTOUT_TOSLINK_R 0x03 /* LiveDrive - TOSLink Optical - right */ +-#define EXTOUT_AC97_CENTER 0x04 /* SB Live 5.1 - center */ +-#define EXTOUT_AC97_LFE 0x05 /* SB Live 5.1 - LFE */ +-#define EXTOUT_HEADPHONE_L 0x06 /* LiveDrive - Headphone - left */ +-#define EXTOUT_HEADPHONE_R 0x07 /* LiveDrive - Headphone - right */ +-#define EXTOUT_REAR_L 0x08 /* Rear channel - left */ +-#define EXTOUT_REAR_R 0x09 /* Rear channel - right */ +-#define EXTOUT_ADC_CAP_L 0x0a /* ADC Capture buffer - left */ +-#define EXTOUT_ADC_CAP_R 0x0b /* ADC Capture buffer - right */ +-#define EXTOUT_MIC_CAP 0x0c /* MIC Capture buffer */ +-#define EXTOUT_AC97_REAR_L 0x0d /* SB Live 5.1 (c) 2003 - Rear Left */ +-#define EXTOUT_AC97_REAR_R 0x0e /* SB Live 5.1 (c) 2003 - Rear Right */ +-#define EXTOUT_ACENTER 0x11 /* Analog Center */ +-#define EXTOUT_ALFE 0x12 /* Analog LFE */ +- +-/* Audigy Inputs */ +-#define A_EXTIN_AC97_L 0x00 /* AC'97 capture channel - left */ +-#define A_EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */ +-#define A_EXTIN_SPDIF_CD_L 0x02 /* digital CD left */ +-#define A_EXTIN_SPDIF_CD_R 0x03 /* digital CD left */ +-#define A_EXTIN_OPT_SPDIF_L 0x04 /* audigy drive Optical SPDIF - left */ +-#define A_EXTIN_OPT_SPDIF_R 0x05 /* right */ +-#define A_EXTIN_LINE2_L 0x08 /* audigy drive line2/mic2 - left */ +-#define A_EXTIN_LINE2_R 0x09 /* right */ +-#define A_EXTIN_ADC_L 0x0a /* Philips ADC - left */ +-#define A_EXTIN_ADC_R 0x0b /* right */ +-#define A_EXTIN_AUX2_L 0x0c /* audigy drive aux2 - left */ +-#define A_EXTIN_AUX2_R 0x0d /* - right */ +- +-/* Audigiy Outputs */ +-#define A_EXTOUT_FRONT_L 0x00 /* digital front left */ +-#define A_EXTOUT_FRONT_R 0x01 /* right */ +-#define A_EXTOUT_CENTER 0x02 /* digital front center */ +-#define A_EXTOUT_LFE 0x03 /* digital front lfe */ +-#define A_EXTOUT_HEADPHONE_L 0x04 /* headphone audigy drive left */ +-#define A_EXTOUT_HEADPHONE_R 0x05 /* right */ +-#define A_EXTOUT_REAR_L 0x06 /* digital rear left */ +-#define A_EXTOUT_REAR_R 0x07 /* right */ +-#define A_EXTOUT_AFRONT_L 0x08 /* analog front left */ +-#define A_EXTOUT_AFRONT_R 0x09 /* right */ +-#define A_EXTOUT_ACENTER 0x0a /* analog center */ +-#define A_EXTOUT_ALFE 0x0b /* analog LFE */ +-#define A_EXTOUT_ASIDE_L 0x0c /* analog side left - Audigy 2 ZS */ +-#define A_EXTOUT_ASIDE_R 0x0d /* right - Audigy 2 ZS */ +-#define A_EXTOUT_AREAR_L 0x0e /* analog rear left */ +-#define A_EXTOUT_AREAR_R 0x0f /* right */ +-#define A_EXTOUT_AC97_L 0x10 /* AC97 left (front) */ +-#define A_EXTOUT_AC97_R 0x11 /* right */ +-#define A_EXTOUT_ADC_CAP_L 0x16 /* ADC capture buffer left */ +-#define A_EXTOUT_ADC_CAP_R 0x17 /* right */ +-#define A_EXTOUT_MIC_CAP 0x18 /* Mic capture buffer */ +- +-/* Audigy constants */ +-#define A_C_00000000 0xc0 +-#define A_C_00000001 0xc1 +-#define A_C_00000002 0xc2 +-#define A_C_00000003 0xc3 +-#define A_C_00000004 0xc4 +-#define A_C_00000008 0xc5 +-#define A_C_00000010 0xc6 +-#define A_C_00000020 0xc7 +-#define A_C_00000100 0xc8 +-#define A_C_00010000 0xc9 +-#define A_C_00000800 0xca +-#define A_C_10000000 0xcb +-#define A_C_20000000 0xcc +-#define A_C_40000000 0xcd +-#define A_C_80000000 0xce +-#define A_C_7fffffff 0xcf +-#define A_C_ffffffff 0xd0 +-#define A_C_fffffffe 0xd1 +-#define A_C_c0000000 0xd2 +-#define A_C_4f1bbcdc 0xd3 +-#define A_C_5a7ef9db 0xd4 +-#define A_C_00100000 0xd5 +-#define A_GPR_ACCU 0xd6 /* ACCUM, accumulator */ +-#define A_GPR_COND 0xd7 /* CCR, condition register */ +-#define A_GPR_NOISE0 0xd8 /* noise source */ +-#define A_GPR_NOISE1 0xd9 /* noise source */ +-#define A_GPR_IRQ 0xda /* IRQ register */ +-#define A_GPR_DBAC 0xdb /* TRAM Delay Base Address Counter - internal */ +-#define A_GPR_DBACE 0xde /* TRAM Delay Base Address Counter - external */ +- +-/* definitions for debug register */ +-#define EMU10K1_DBG_ZC 0x80000000 /* zero tram counter */ +-#define EMU10K1_DBG_SATURATION_OCCURED 0x02000000 /* saturation control */ +-#define EMU10K1_DBG_SATURATION_ADDR 0x01ff0000 /* saturation address */ +-#define EMU10K1_DBG_SINGLE_STEP 0x00008000 /* single step mode */ +-#define EMU10K1_DBG_STEP 0x00004000 /* start single step */ +-#define EMU10K1_DBG_CONDITION_CODE 0x00003e00 /* condition code */ +-#define EMU10K1_DBG_SINGLE_STEP_ADDR 0x000001ff /* single step address */ +- +-/* tank memory address line */ +-#ifndef __KERNEL__ +-#define TANKMEMADDRREG_ADDR_MASK 0x000fffff /* 20 bit tank address field */ +-#define TANKMEMADDRREG_CLEAR 0x00800000 /* Clear tank memory */ +-#define TANKMEMADDRREG_ALIGN 0x00400000 /* Align read or write relative to tank access */ +-#define TANKMEMADDRREG_WRITE 0x00200000 /* Write to tank memory */ +-#define TANKMEMADDRREG_READ 0x00100000 /* Read from tank memory */ +-#endif +- +-struct snd_emu10k1_fx8010_info { +- unsigned int internal_tram_size; /* in samples */ +- unsigned int external_tram_size; /* in samples */ +- char fxbus_names[16][32]; /* names of FXBUSes */ +- char extin_names[16][32]; /* names of external inputs */ +- char extout_names[32][32]; /* names of external outputs */ +- unsigned int gpr_controls; /* count of GPR controls */ +-}; +- +-#define EMU10K1_GPR_TRANSLATION_NONE 0 +-#define EMU10K1_GPR_TRANSLATION_TABLE100 1 +-#define EMU10K1_GPR_TRANSLATION_BASS 2 +-#define EMU10K1_GPR_TRANSLATION_TREBLE 3 +-#define EMU10K1_GPR_TRANSLATION_ONOFF 4 +- +-struct snd_emu10k1_fx8010_control_gpr { +- struct snd_ctl_elem_id id; /* full control ID definition */ +- unsigned int vcount; /* visible count */ +- unsigned int count; /* count of GPR (1..16) */ +- unsigned short gpr[32]; /* GPR number(s) */ +- unsigned int value[32]; /* initial values */ +- unsigned int min; /* minimum range */ +- unsigned int max; /* maximum range */ +- unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */ +- const unsigned int *tlv; +-}; +- +-/* old ABI without TLV support */ +-struct snd_emu10k1_fx8010_control_old_gpr { +- struct snd_ctl_elem_id id; +- unsigned int vcount; +- unsigned int count; +- unsigned short gpr[32]; +- unsigned int value[32]; +- unsigned int min; +- unsigned int max; +- unsigned int translation; +-}; +- +-struct snd_emu10k1_fx8010_code { +- char name[128]; +- +- __EMU10K1_DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */ +- __u32 __user *gpr_map; /* initializers */ +- +- unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */ +- struct snd_emu10k1_fx8010_control_gpr __user *gpr_add_controls; /* GPR controls to add/replace */ +- +- unsigned int gpr_del_control_count; /* count of GPR controls to remove */ +- struct snd_ctl_elem_id __user *gpr_del_controls; /* IDs of GPR controls to remove */ +- +- unsigned int gpr_list_control_count; /* count of GPR controls to list */ +- unsigned int gpr_list_control_total; /* total count of GPR controls */ +- struct snd_emu10k1_fx8010_control_gpr __user *gpr_list_controls; /* listed GPR controls */ +- +- __EMU10K1_DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */ +- __u32 __user *tram_data_map; /* data initializers */ +- __u32 __user *tram_addr_map; /* map initializers */ +- +- __EMU10K1_DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */ +- __u32 __user *code; /* one instruction - 64 bits */ +-}; +- +-struct snd_emu10k1_fx8010_tram { +- unsigned int address; /* 31.bit == 1 -> external TRAM */ +- unsigned int size; /* size in samples (4 bytes) */ +- unsigned int *samples; /* pointer to samples (20-bit) */ +- /* NULL->clear memory */ +-}; +- +-struct snd_emu10k1_fx8010_pcm_rec { +- unsigned int substream; /* substream number */ +- unsigned int res1; /* reserved */ +- unsigned int channels; /* 16-bit channels count, zero = remove this substream */ +- unsigned int tram_start; /* ring buffer position in TRAM (in samples) */ +- unsigned int buffer_size; /* count of buffered samples */ +- unsigned short gpr_size; /* GPR containing size of ringbuffer in samples (host) */ +- unsigned short gpr_ptr; /* GPR containing current pointer in the ring buffer (host = reset, FX8010) */ +- unsigned short gpr_count; /* GPR containing count of samples between two interrupts (host) */ +- unsigned short gpr_tmpcount; /* GPR containing current count of samples to interrupt (host = set, FX8010) */ +- unsigned short gpr_trigger; /* GPR containing trigger (activate) information (host) */ +- unsigned short gpr_running; /* GPR containing info if PCM is running (FX8010) */ +- unsigned char pad; /* reserved */ +- unsigned char etram[32]; /* external TRAM address & data (one per channel) */ +- unsigned int res2; /* reserved */ +-}; +- +-#define SNDRV_EMU10K1_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1) +- +-#define SNDRV_EMU10K1_IOCTL_INFO _IOR ('H', 0x10, struct snd_emu10k1_fx8010_info) +-#define SNDRV_EMU10K1_IOCTL_CODE_POKE _IOW ('H', 0x11, struct snd_emu10k1_fx8010_code) +-#define SNDRV_EMU10K1_IOCTL_CODE_PEEK _IOWR('H', 0x12, struct snd_emu10k1_fx8010_code) +-#define SNDRV_EMU10K1_IOCTL_TRAM_SETUP _IOW ('H', 0x20, int) +-#define SNDRV_EMU10K1_IOCTL_TRAM_POKE _IOW ('H', 0x21, struct snd_emu10k1_fx8010_tram) +-#define SNDRV_EMU10K1_IOCTL_TRAM_PEEK _IOWR('H', 0x22, struct snd_emu10k1_fx8010_tram) +-#define SNDRV_EMU10K1_IOCTL_PCM_POKE _IOW ('H', 0x30, struct snd_emu10k1_fx8010_pcm_rec) +-#define SNDRV_EMU10K1_IOCTL_PCM_PEEK _IOWR('H', 0x31, struct snd_emu10k1_fx8010_pcm_rec) +-#define SNDRV_EMU10K1_IOCTL_PVERSION _IOR ('H', 0x40, int) +-#define SNDRV_EMU10K1_IOCTL_STOP _IO ('H', 0x80) +-#define SNDRV_EMU10K1_IOCTL_CONTINUE _IO ('H', 0x81) +-#define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO ('H', 0x82) +-#define SNDRV_EMU10K1_IOCTL_SINGLE_STEP _IOW ('H', 0x83, int) +-#define SNDRV_EMU10K1_IOCTL_DBG_READ _IOR ('H', 0x84, int) +- +-/* typedefs for compatibility to user-space */ +-typedef struct snd_emu10k1_fx8010_info emu10k1_fx8010_info_t; +-typedef struct snd_emu10k1_fx8010_control_gpr emu10k1_fx8010_control_gpr_t; +-typedef struct snd_emu10k1_fx8010_code emu10k1_fx8010_code_t; +-typedef struct snd_emu10k1_fx8010_tram emu10k1_fx8010_tram_t; +-typedef struct snd_emu10k1_fx8010_pcm_rec emu10k1_fx8010_pcm_t; +- +-#endif /* _UAPI__SOUND_EMU10K1_H */ ++#include ++#include +diff --git a/include/sound/hdsp.h b/include/sound/hdsp.h +index 5dc0c3db..78fb745b 100644 +--- a/include/sound/hdsp.h ++++ b/include/sound/hdsp.h +@@ -1,111 +1,2 @@ +-/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ +-#ifndef __SOUND_HDSP_H +-#define __SOUND_HDSP_H +- +-/* +- * Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org) +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this program; if not, write to the Free Software +- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +- */ +- +-#include +- +-#define HDSP_MATRIX_MIXER_SIZE 2048 +- +-enum HDSP_IO_Type { +- Digiface, +- Multiface, +- H9652, +- H9632, +- RPM, +- Undefined, +-}; +- +-struct hdsp_peak_rms { +- __u32 input_peaks[26]; +- __u32 playback_peaks[26]; +- __u32 output_peaks[28]; +- __u64 input_rms[26]; +- __u64 playback_rms[26]; +- /* These are only used for H96xx cards */ +- __u64 output_rms[26]; +-}; +- +-#define SNDRV_HDSP_IOCTL_GET_PEAK_RMS _IOR('H', 0x40, struct hdsp_peak_rms) +- +-struct hdsp_config_info { +- unsigned char pref_sync_ref; +- unsigned char wordclock_sync_check; +- unsigned char spdif_sync_check; +- unsigned char adatsync_sync_check; +- unsigned char adat_sync_check[3]; +- unsigned char spdif_in; +- unsigned char spdif_out; +- unsigned char spdif_professional; +- unsigned char spdif_emphasis; +- unsigned char spdif_nonaudio; +- unsigned int spdif_sample_rate; +- unsigned int system_sample_rate; +- unsigned int autosync_sample_rate; +- unsigned char system_clock_mode; +- unsigned char clock_source; +- unsigned char autosync_ref; +- unsigned char line_out; +- unsigned char passthru; +- unsigned char da_gain; +- unsigned char ad_gain; +- unsigned char phone_gain; +- unsigned char xlr_breakout_cable; +- unsigned char analog_extension_board; +-}; +- +-#define SNDRV_HDSP_IOCTL_GET_CONFIG_INFO _IOR('H', 0x41, struct hdsp_config_info) +- +-struct hdsp_firmware { +- void __user *firmware_data; /* 24413 x 4 bytes */ +-}; +- +-#define SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE _IOW('H', 0x42, struct hdsp_firmware) +- +-struct hdsp_version { +- enum HDSP_IO_Type io_type; +- unsigned short firmware_rev; +-}; +- +-#define SNDRV_HDSP_IOCTL_GET_VERSION _IOR('H', 0x43, struct hdsp_version) +- +-struct hdsp_mixer { +- unsigned short matrix[HDSP_MATRIX_MIXER_SIZE]; +-}; +- +-#define SNDRV_HDSP_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdsp_mixer) +- +-struct hdsp_9632_aeb { +- int aebi; +- int aebo; +-}; +- +-#define SNDRV_HDSP_IOCTL_GET_9632_AEB _IOR('H', 0x45, struct hdsp_9632_aeb) +- +-/* typedefs for compatibility to user-space */ +-typedef enum HDSP_IO_Type HDSP_IO_Type; +-typedef struct hdsp_peak_rms hdsp_peak_rms_t; +-typedef struct hdsp_config_info hdsp_config_info_t; +-typedef struct hdsp_firmware hdsp_firmware_t; +-typedef struct hdsp_version hdsp_version_t; +-typedef struct hdsp_mixer hdsp_mixer_t; +-typedef struct hdsp_9632_aeb hdsp_9632_aeb_t; +- +-#endif /* __SOUND_HDSP_H */ ++#include ++#include +diff --git a/include/sound/hdspm.h b/include/sound/hdspm.h +index a38f3f79..af6d19ed 100644 +--- a/include/sound/hdspm.h ++++ b/include/sound/hdspm.h +@@ -1,232 +1,2 @@ +-/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ +-#ifndef __SOUND_HDSPM_H +-#define __SOUND_HDSPM_H +-/* +- * Copyright (C) 2003 Winfried Ritsch (IEM) +- * based on hdsp.h from Thomas Charbonnel (thomas@undata.org) +- * +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this program; if not, write to the Free Software +- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +- */ +- +-#include +- +-/* Maximum channels is 64 even on 56Mode you have 64playbacks to matrix */ +-#define HDSPM_MAX_CHANNELS 64 +- +-enum hdspm_io_type { +- MADI, +- MADIface, +- AIO, +- AES32, +- RayDAT +-}; +- +-enum hdspm_speed { +- ss, +- ds, +- qs +-}; +- +-/* -------------------- IOCTL Peak/RMS Meters -------------------- */ +- +-struct hdspm_peak_rms { +- __u32 input_peaks[64]; +- __u32 playback_peaks[64]; +- __u32 output_peaks[64]; +- +- __u64 input_rms[64]; +- __u64 playback_rms[64]; +- __u64 output_rms[64]; +- +- __u8 speed; /* enum {ss, ds, qs} */ +- int status2; +-}; +- +-#define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS \ +- _IOR('H', 0x42, struct hdspm_peak_rms) +- +-/* ------------ CONFIG block IOCTL ---------------------- */ +- +-struct hdspm_config { +- unsigned char pref_sync_ref; +- unsigned char wordclock_sync_check; +- unsigned char madi_sync_check; +- unsigned int system_sample_rate; +- unsigned int autosync_sample_rate; +- unsigned char system_clock_mode; +- unsigned char clock_source; +- unsigned char autosync_ref; +- unsigned char line_out; +- unsigned int passthru; +- unsigned int analog_out; +-}; +- +-#define SNDRV_HDSPM_IOCTL_GET_CONFIG \ +- _IOR('H', 0x41, struct hdspm_config) +- +-/* +- * If there's a TCO (TimeCode Option) board installed, +- * there are further options and status data available. +- * The hdspm_ltc structure contains the current SMPTE +- * timecode and some status information and can be +- * obtained via SNDRV_HDSPM_IOCTL_GET_LTC or in the +- * hdspm_status struct. +- */ +- +-enum hdspm_ltc_format { +- format_invalid, +- fps_24, +- fps_25, +- fps_2997, +- fps_30 +-}; +- +-enum hdspm_ltc_frame { +- frame_invalid, +- drop_frame, +- full_frame +-}; +- +-enum hdspm_ltc_input_format { +- ntsc, +- pal, +- no_video +-}; +- +-struct hdspm_ltc { +- unsigned int ltc; +- +- enum hdspm_ltc_format format; +- enum hdspm_ltc_frame frame; +- enum hdspm_ltc_input_format input_format; +-}; +- +-#define SNDRV_HDSPM_IOCTL_GET_LTC _IOR('H', 0x46, struct hdspm_ltc) +- +-/* +- * The status data reflects the device's current state +- * as determined by the card's configuration and +- * connection status. +- */ +- +-enum hdspm_sync { +- hdspm_sync_no_lock = 0, +- hdspm_sync_lock = 1, +- hdspm_sync_sync = 2 +-}; +- +-enum hdspm_madi_input { +- hdspm_input_optical = 0, +- hdspm_input_coax = 1 +-}; +- +-enum hdspm_madi_channel_format { +- hdspm_format_ch_64 = 0, +- hdspm_format_ch_56 = 1 +-}; +- +-enum hdspm_madi_frame_format { +- hdspm_frame_48 = 0, +- hdspm_frame_96 = 1 +-}; +- +-enum hdspm_syncsource { +- syncsource_wc = 0, +- syncsource_madi = 1, +- syncsource_tco = 2, +- syncsource_sync = 3, +- syncsource_none = 4 +-}; +- +-struct hdspm_status { +- __u8 card_type; /* enum hdspm_io_type */ +- enum hdspm_syncsource autosync_source; +- +- __u64 card_clock; +- __u32 master_period; +- +- union { +- struct { +- __u8 sync_wc; /* enum hdspm_sync */ +- __u8 sync_madi; /* enum hdspm_sync */ +- __u8 sync_tco; /* enum hdspm_sync */ +- __u8 sync_in; /* enum hdspm_sync */ +- __u8 madi_input; /* enum hdspm_madi_input */ +- __u8 channel_format; /* enum hdspm_madi_channel_format */ +- __u8 frame_format; /* enum hdspm_madi_frame_format */ +- } madi; +- } card_specific; +-}; +- +-#define SNDRV_HDSPM_IOCTL_GET_STATUS \ +- _IOR('H', 0x47, struct hdspm_status) +- +-/* +- * Get information about the card and its add-ons. +- */ +- +-#define HDSPM_ADDON_TCO 1 +- +-struct hdspm_version { +- __u8 card_type; /* enum hdspm_io_type */ +- char cardname[20]; +- unsigned int serial; +- unsigned short firmware_rev; +- int addons; +-}; +- +-#define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x48, struct hdspm_version) +- +-/* ------------- get Matrix Mixer IOCTL --------------- */ +- +-/* MADI mixer: 64inputs+64playback in 64outputs = 8192 => *4Byte = +- * 32768 Bytes +- */ +- +-/* organisation is 64 channelfader in a continuous memory block */ +-/* equivalent to hardware definition, maybe for future feature of mmap of +- * them +- */ +-/* each of 64 outputs has 64 infader and 64 outfader: +- Ins to Outs mixer[out].in[in], Outstreams to Outs mixer[out].pb[pb] */ +- +-#define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS +- +-struct hdspm_channelfader { +- unsigned int in[HDSPM_MIXER_CHANNELS]; +- unsigned int pb[HDSPM_MIXER_CHANNELS]; +-}; +- +-struct hdspm_mixer { +- struct hdspm_channelfader ch[HDSPM_MIXER_CHANNELS]; +-}; +- +-struct hdspm_mixer_ioctl { +- struct hdspm_mixer *mixer; +-}; +- +-/* use indirect access due to the limit of ioctl bit size */ +-#define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdspm_mixer_ioctl) +- +-/* typedefs for compatibility to user-space */ +-typedef struct hdspm_peak_rms hdspm_peak_rms_t; +-typedef struct hdspm_config_info hdspm_config_info_t; +-typedef struct hdspm_version hdspm_version_t; +-typedef struct hdspm_channelfader snd_hdspm_channelfader_t; +-typedef struct hdspm_mixer hdspm_mixer_t; +- +- +-#endif ++#include ++#include +diff --git a/include/sound/sb16_csp.h b/include/sound/sb16_csp.h +index e6485148..24121fcb 100644 +--- a/include/sound/sb16_csp.h ++++ b/include/sound/sb16_csp.h +@@ -1,123 +1 @@ +-/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ +-/* +- * Copyright (c) 1999 by Uros Bizjak +- * Takashi Iwai +- * +- * SB16ASP/AWE32 CSP control +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this program; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- * +- */ +-#ifndef _UAPI__SOUND_SB16_CSP_H +-#define _UAPI__SOUND_SB16_CSP_H +- +- +-/* CSP modes */ +-#define SNDRV_SB_CSP_MODE_NONE 0x00 +-#define SNDRV_SB_CSP_MODE_DSP_READ 0x01 /* Record from DSP */ +-#define SNDRV_SB_CSP_MODE_DSP_WRITE 0x02 /* Play to DSP */ +-#define SNDRV_SB_CSP_MODE_QSOUND 0x04 /* QSound */ +- +-/* CSP load flags */ +-#define SNDRV_SB_CSP_LOAD_FROMUSER 0x01 +-#define SNDRV_SB_CSP_LOAD_INITBLOCK 0x02 +- +-/* CSP sample width */ +-#define SNDRV_SB_CSP_SAMPLE_8BIT 0x01 +-#define SNDRV_SB_CSP_SAMPLE_16BIT 0x02 +- +-/* CSP channels */ +-#define SNDRV_SB_CSP_MONO 0x01 +-#define SNDRV_SB_CSP_STEREO 0x02 +- +-/* CSP rates */ +-#define SNDRV_SB_CSP_RATE_8000 0x01 +-#define SNDRV_SB_CSP_RATE_11025 0x02 +-#define SNDRV_SB_CSP_RATE_22050 0x04 +-#define SNDRV_SB_CSP_RATE_44100 0x08 +-#define SNDRV_SB_CSP_RATE_ALL 0x0f +- +-/* CSP running state */ +-#define SNDRV_SB_CSP_ST_IDLE 0x00 +-#define SNDRV_SB_CSP_ST_LOADED 0x01 +-#define SNDRV_SB_CSP_ST_RUNNING 0x02 +-#define SNDRV_SB_CSP_ST_PAUSED 0x04 +-#define SNDRV_SB_CSP_ST_AUTO 0x08 +-#define SNDRV_SB_CSP_ST_QSOUND 0x10 +- +-/* maximum QSound value (180 degrees right) */ +-#define SNDRV_SB_CSP_QSOUND_MAX_RIGHT 0x20 +- +-/* maximum microcode RIFF file size */ +-#define SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE 0x3000 +- +-/* microcode header */ +-struct snd_sb_csp_mc_header { +- char codec_name[16]; /* id name of codec */ +- unsigned short func_req; /* requested function */ +-}; +- +-/* microcode to be loaded */ +-struct snd_sb_csp_microcode { +- struct snd_sb_csp_mc_header info; +- unsigned char data[SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE]; +-}; +- +-/* start CSP with sample_width in mono/stereo */ +-struct snd_sb_csp_start { +- int sample_width; /* sample width, look above */ +- int channels; /* channels, look above */ +-}; +- +-/* CSP information */ +-struct snd_sb_csp_info { +- char codec_name[16]; /* id name of codec */ +- unsigned short func_nr; /* function number */ +- unsigned int acc_format; /* accepted PCM formats */ +- unsigned short acc_channels; /* accepted channels */ +- unsigned short acc_width; /* accepted sample width */ +- unsigned short acc_rates; /* accepted sample rates */ +- unsigned short csp_mode; /* CSP mode, see above */ +- unsigned short run_channels; /* current channels */ +- unsigned short run_width; /* current sample width */ +- unsigned short version; /* version id: 0x10 - 0x1f */ +- unsigned short state; /* state bits */ +-}; +- +-/* HWDEP controls */ +-/* get CSP information */ +-#define SNDRV_SB_CSP_IOCTL_INFO _IOR('H', 0x10, struct snd_sb_csp_info) +-/* load microcode to CSP */ +-/* NOTE: struct snd_sb_csp_microcode overflows the max size (13 bits) +- * defined for some architectures like MIPS, and it leads to build errors. +- * (x86 and co have 14-bit size, thus it's valid, though.) +- * As a workaround for skipping the size-limit check, here we don't use the +- * normal _IOW() macro but _IOC() with the manual argument. +- */ +-#define SNDRV_SB_CSP_IOCTL_LOAD_CODE \ +- _IOC(_IOC_WRITE, 'H', 0x11, sizeof(struct snd_sb_csp_microcode)) +-/* unload microcode from CSP */ +-#define SNDRV_SB_CSP_IOCTL_UNLOAD_CODE _IO('H', 0x12) +-/* start CSP */ +-#define SNDRV_SB_CSP_IOCTL_START _IOW('H', 0x13, struct snd_sb_csp_start) +-/* stop CSP */ +-#define SNDRV_SB_CSP_IOCTL_STOP _IO('H', 0x14) +-/* pause CSP and DMA transfer */ +-#define SNDRV_SB_CSP_IOCTL_PAUSE _IO('H', 0x15) +-/* restart CSP and DMA transfer */ +-#define SNDRV_SB_CSP_IOCTL_RESTART _IO('H', 0x16) +- +- +-#endif /* _UAPI__SOUND_SB16_CSP_H */ ++#include +diff --git a/include/sound/sscape_ioctl.h b/include/sound/sscape_ioctl.h +index c6653ebf..23b48d33 100644 +--- a/include/sound/sscape_ioctl.h ++++ b/include/sound/sscape_ioctl.h +@@ -1,21 +1 @@ +-#ifndef SSCAPE_IOCTL_H +-#define SSCAPE_IOCTL_H +- +- +-struct sscape_bootblock +-{ +- unsigned char code[256]; +- unsigned version; +-}; +- +-#define SSCAPE_MICROCODE_SIZE 65536 +- +-struct sscape_microcode +-{ +- unsigned char *code; +-}; +- +-#define SND_SSCAPE_LOAD_BOOTB _IOWR('P', 100, struct sscape_bootblock) +-#define SND_SSCAPE_LOAD_MCODE _IOW ('P', 101, struct sscape_microcode) +- +-#endif ++#include +diff --git a/include/sound/tlv.h b/include/sound/tlv.h +index 7d6d65f6..e435a5fc 100644 +--- a/include/sound/tlv.h ++++ b/include/sound/tlv.h +@@ -1,117 +1 @@ +-/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ +-/* +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- */ +- +-#ifndef __UAPI_SOUND_TLV_H +-#define __UAPI_SOUND_TLV_H +- +-#define SNDRV_CTL_TLVT_CONTAINER 0 /* one level down - group of TLVs */ +-#define SNDRV_CTL_TLVT_DB_SCALE 1 /* dB scale */ +-#define SNDRV_CTL_TLVT_DB_LINEAR 2 /* linear volume */ +-#define SNDRV_CTL_TLVT_DB_RANGE 3 /* dB range container */ +-#define SNDRV_CTL_TLVT_DB_MINMAX 4 /* dB scale with min/max */ +-#define SNDRV_CTL_TLVT_DB_MINMAX_MUTE 5 /* dB scale with min/max with mute */ +- +-/* +- * channel-mapping TLV items +- * TLV length must match with num_channels +- */ +-#define SNDRV_CTL_TLVT_CHMAP_FIXED 0x101 /* fixed channel position */ +-#define SNDRV_CTL_TLVT_CHMAP_VAR 0x102 /* channels freely swappable */ +-#define SNDRV_CTL_TLVT_CHMAP_PAIRED 0x103 /* pair-wise swappable */ +- +-/* +- * TLV structure is right behind the struct snd_ctl_tlv: +- * unsigned int type - see SNDRV_CTL_TLVT_* +- * unsigned int length +- * .... data aligned to sizeof(unsigned int), use +- * block_length = (length + (sizeof(unsigned int) - 1)) & +- * ~(sizeof(unsigned int) - 1)) .... +- */ +-#define SNDRV_CTL_TLVD_ITEM(type, ...) \ +- (type), SNDRV_CTL_TLVD_LENGTH(__VA_ARGS__), __VA_ARGS__ +-#define SNDRV_CTL_TLVD_LENGTH(...) \ +- ((unsigned int)sizeof((const unsigned int[]) { __VA_ARGS__ })) +- +-/* Accessor offsets for TLV data items */ +-#define SNDRV_CTL_TLVO_TYPE 0 +-#define SNDRV_CTL_TLVO_LEN 1 +- +-#define SNDRV_CTL_TLVD_CONTAINER_ITEM(...) \ +- SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_CONTAINER, __VA_ARGS__) +-#define SNDRV_CTL_TLVD_DECLARE_CONTAINER(name, ...) \ +- unsigned int name[] = { \ +- SNDRV_CTL_TLVD_CONTAINER_ITEM(__VA_ARGS__) \ +- } +- +-#define SNDRV_CTL_TLVD_DB_SCALE_MASK 0xffff +-#define SNDRV_CTL_TLVD_DB_SCALE_MUTE 0x10000 +-#define SNDRV_CTL_TLVD_DB_SCALE_ITEM(min, step, mute) \ +- SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_SCALE, \ +- (min), \ +- ((step) & SNDRV_CTL_TLVD_DB_SCALE_MASK) | \ +- ((mute) ? SNDRV_CTL_TLVD_DB_SCALE_MUTE : 0)) +-#define SNDRV_CTL_TLVD_DECLARE_DB_SCALE(name, min, step, mute) \ +- unsigned int name[] = { \ +- SNDRV_CTL_TLVD_DB_SCALE_ITEM(min, step, mute) \ +- } +- +-/* Accessor offsets for min, mute and step items in dB scale type TLV */ +-#define SNDRV_CTL_TLVO_DB_SCALE_MIN 2 +-#define SNDRV_CTL_TLVO_DB_SCALE_MUTE_AND_STEP 3 +- +-/* dB scale specified with min/max values instead of step */ +-#define SNDRV_CTL_TLVD_DB_MINMAX_ITEM(min_dB, max_dB) \ +- SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_MINMAX, (min_dB), (max_dB)) +-#define SNDRV_CTL_TLVD_DB_MINMAX_MUTE_ITEM(min_dB, max_dB) \ +- SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_MINMAX_MUTE, (min_dB), (max_dB)) +-#define SNDRV_CTL_TLVD_DECLARE_DB_MINMAX(name, min_dB, max_dB) \ +- unsigned int name[] = { \ +- SNDRV_CTL_TLVD_DB_MINMAX_ITEM(min_dB, max_dB) \ +- } +-#define SNDRV_CTL_TLVD_DECLARE_DB_MINMAX_MUTE(name, min_dB, max_dB) \ +- unsigned int name[] = { \ +- SNDRV_CTL_TLVD_DB_MINMAX_MUTE_ITEM(min_dB, max_dB) \ +- } +- +-/* Accessor offsets for min, max items in db-minmax types of TLV. */ +-#define SNDRV_CTL_TLVO_DB_MINMAX_MIN 2 +-#define SNDRV_CTL_TLVO_DB_MINMAX_MAX 3 +- +-/* linear volume between min_dB and max_dB (.01dB unit) */ +-#define SNDRV_CTL_TLVD_DB_LINEAR_ITEM(min_dB, max_dB) \ +- SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_LINEAR, (min_dB), (max_dB)) +-#define SNDRV_CTL_TLVD_DECLARE_DB_LINEAR(name, min_dB, max_dB) \ +- unsigned int name[] = { \ +- SNDRV_CTL_TLVD_DB_LINEAR_ITEM(min_dB, max_dB) \ +- } +- +-/* Accessor offsets for min, max items in db-linear type of TLV. */ +-#define SNDRV_CTL_TLVO_DB_LINEAR_MIN 2 +-#define SNDRV_CTL_TLVO_DB_LINEAR_MAX 3 +- +-/* dB range container: +- * Items in dB range container must be ordered by their values and by their +- * dB values. This implies that larger values must correspond with larger +- * dB values (which is also required for all other mixer controls). +- */ +-/* Each item is: */ +-#define SNDRV_CTL_TLVD_DB_RANGE_ITEM(...) \ +- SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_RANGE, __VA_ARGS__) +-#define SNDRV_CTL_TLVD_DECLARE_DB_RANGE(name, ...) \ +- unsigned int name[] = { \ +- SNDRV_CTL_TLVD_DB_RANGE_ITEM(__VA_ARGS__) \ +- } +- +-#define SNDRV_CTL_TLVD_DB_GAIN_MUTE -9999999 +- +-#endif ++#include +diff --git a/include/sound/type_compat.h b/include/sound/type_compat.h +index e973ff31..d4790c1f 100644 +--- a/include/sound/type_compat.h ++++ b/include/sound/type_compat.h +@@ -3,6 +3,9 @@ + + #ifndef DOC_HIDDEN + #include ++#ifdef __linux__ ++#include ++#else + typedef uint8_t __u8; + typedef uint16_t __u16; + typedef uint32_t __u32; +@@ -37,6 +40,16 @@ typedef int32_t __s32; + #define __be32 __u32 + #define __be16 __u16 + #define __be8 __u8 ++#endif ++ ++#ifndef __user ++#define __user ++#endif ++ ++#ifndef __packed ++#define __packed __attribute__((__packed__)) ++#endif ++ + #endif /* DOC_HIDDEN */ + + #endif /* __TYPE_COMPAT_H */ +diff --git a/include/sound/uapi/Makefile.am b/include/sound/uapi/Makefile.am +new file mode 100644 +index 00000000..99197108 +--- /dev/null ++++ b/include/sound/uapi/Makefile.am +@@ -0,0 +1,6 @@ ++alsasounduapiincludedir = ${includedir}/alsa/sound/uapi ++ ++alsasounduapiinclude_HEADERS = asound_fm.h hdsp.h hdspm.h sb16_csp.h \ ++ sscape_ioctl.h emu10k1.h asoc.h tlv.h ++ ++noinst_HEADERS = asound.h asequencer.h +diff --git a/include/sound/uapi/asequencer.h b/include/sound/uapi/asequencer.h +new file mode 100644 +index 00000000..a75e14ed +--- /dev/null ++++ b/include/sound/uapi/asequencer.h +@@ -0,0 +1,612 @@ ++/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ ++/* ++ * Main header file for the ALSA sequencer ++ * Copyright (c) 1998-1999 by Frank van de Pol ++ * (c) 1998-1999 by Jaroslav Kysela ++ * ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * ++ */ ++#ifndef _UAPI__SOUND_ASEQUENCER_H ++#define _UAPI__SOUND_ASEQUENCER_H ++ ++#include ++ ++/** version of the sequencer */ ++#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 2) ++ ++/** ++ * definition of sequencer event types ++ */ ++ ++/** system messages ++ * event data type = #snd_seq_result ++ */ ++#define SNDRV_SEQ_EVENT_SYSTEM 0 ++#define SNDRV_SEQ_EVENT_RESULT 1 ++ ++/** note messages (channel specific) ++ * event data type = #snd_seq_ev_note ++ */ ++#define SNDRV_SEQ_EVENT_NOTE 5 ++#define SNDRV_SEQ_EVENT_NOTEON 6 ++#define SNDRV_SEQ_EVENT_NOTEOFF 7 ++#define SNDRV_SEQ_EVENT_KEYPRESS 8 ++ ++/** control messages (channel specific) ++ * event data type = #snd_seq_ev_ctrl ++ */ ++#define SNDRV_SEQ_EVENT_CONTROLLER 10 ++#define SNDRV_SEQ_EVENT_PGMCHANGE 11 ++#define SNDRV_SEQ_EVENT_CHANPRESS 12 ++#define SNDRV_SEQ_EVENT_PITCHBEND 13 /**< from -8192 to 8191 */ ++#define SNDRV_SEQ_EVENT_CONTROL14 14 /**< 14 bit controller value */ ++#define SNDRV_SEQ_EVENT_NONREGPARAM 15 /**< 14 bit NRPN address + 14 bit unsigned value */ ++#define SNDRV_SEQ_EVENT_REGPARAM 16 /**< 14 bit RPN address + 14 bit unsigned value */ ++ ++/** synchronisation messages ++ * event data type = #snd_seq_ev_ctrl ++ */ ++#define SNDRV_SEQ_EVENT_SONGPOS 20 /* Song Position Pointer with LSB and MSB values */ ++#define SNDRV_SEQ_EVENT_SONGSEL 21 /* Song Select with song ID number */ ++#define SNDRV_SEQ_EVENT_QFRAME 22 /* midi time code quarter frame */ ++#define SNDRV_SEQ_EVENT_TIMESIGN 23 /* SMF Time Signature event */ ++#define SNDRV_SEQ_EVENT_KEYSIGN 24 /* SMF Key Signature event */ ++ ++/** timer messages ++ * event data type = snd_seq_ev_queue_control ++ */ ++#define SNDRV_SEQ_EVENT_START 30 /* midi Real Time Start message */ ++#define SNDRV_SEQ_EVENT_CONTINUE 31 /* midi Real Time Continue message */ ++#define SNDRV_SEQ_EVENT_STOP 32 /* midi Real Time Stop message */ ++#define SNDRV_SEQ_EVENT_SETPOS_TICK 33 /* set tick queue position */ ++#define SNDRV_SEQ_EVENT_SETPOS_TIME 34 /* set realtime queue position */ ++#define SNDRV_SEQ_EVENT_TEMPO 35 /* (SMF) Tempo event */ ++#define SNDRV_SEQ_EVENT_CLOCK 36 /* midi Real Time Clock message */ ++#define SNDRV_SEQ_EVENT_TICK 37 /* midi Real Time Tick message */ ++#define SNDRV_SEQ_EVENT_QUEUE_SKEW 38 /* skew queue tempo */ ++ ++/** others ++ * event data type = none ++ */ ++#define SNDRV_SEQ_EVENT_TUNE_REQUEST 40 /* tune request */ ++#define SNDRV_SEQ_EVENT_RESET 41 /* reset to power-on state */ ++#define SNDRV_SEQ_EVENT_SENSING 42 /* "active sensing" event */ ++ ++/** echo back, kernel private messages ++ * event data type = any type ++ */ ++#define SNDRV_SEQ_EVENT_ECHO 50 /* echo event */ ++#define SNDRV_SEQ_EVENT_OSS 51 /* OSS raw event */ ++ ++/** system status messages (broadcast for subscribers) ++ * event data type = snd_seq_addr ++ */ ++#define SNDRV_SEQ_EVENT_CLIENT_START 60 /* new client has connected */ ++#define SNDRV_SEQ_EVENT_CLIENT_EXIT 61 /* client has left the system */ ++#define SNDRV_SEQ_EVENT_CLIENT_CHANGE 62 /* client status/info has changed */ ++#define SNDRV_SEQ_EVENT_PORT_START 63 /* new port was created */ ++#define SNDRV_SEQ_EVENT_PORT_EXIT 64 /* port was deleted from system */ ++#define SNDRV_SEQ_EVENT_PORT_CHANGE 65 /* port status/info has changed */ ++ ++/** port connection changes ++ * event data type = snd_seq_connect ++ */ ++#define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */ ++#define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */ ++ ++/* 70-89: synthesizer events - obsoleted */ ++ ++/** user-defined events with fixed length ++ * event data type = any ++ */ ++#define SNDRV_SEQ_EVENT_USR0 90 ++#define SNDRV_SEQ_EVENT_USR1 91 ++#define SNDRV_SEQ_EVENT_USR2 92 ++#define SNDRV_SEQ_EVENT_USR3 93 ++#define SNDRV_SEQ_EVENT_USR4 94 ++#define SNDRV_SEQ_EVENT_USR5 95 ++#define SNDRV_SEQ_EVENT_USR6 96 ++#define SNDRV_SEQ_EVENT_USR7 97 ++#define SNDRV_SEQ_EVENT_USR8 98 ++#define SNDRV_SEQ_EVENT_USR9 99 ++ ++/* 100-118: instrument layer - obsoleted */ ++/* 119-129: reserved */ ++ ++/* 130-139: variable length events ++ * event data type = snd_seq_ev_ext ++ * (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set) ++ */ ++#define SNDRV_SEQ_EVENT_SYSEX 130 /* system exclusive data (variable length) */ ++#define SNDRV_SEQ_EVENT_BOUNCE 131 /* error event */ ++/* 132-134: reserved */ ++#define SNDRV_SEQ_EVENT_USR_VAR0 135 ++#define SNDRV_SEQ_EVENT_USR_VAR1 136 ++#define SNDRV_SEQ_EVENT_USR_VAR2 137 ++#define SNDRV_SEQ_EVENT_USR_VAR3 138 ++#define SNDRV_SEQ_EVENT_USR_VAR4 139 ++ ++/* 150-151: kernel events with quote - DO NOT use in user clients */ ++#define SNDRV_SEQ_EVENT_KERNEL_ERROR 150 ++#define SNDRV_SEQ_EVENT_KERNEL_QUOTE 151 /* obsolete */ ++ ++/* 152-191: reserved */ ++ ++/* 192-254: hardware specific events */ ++ ++/* 255: special event */ ++#define SNDRV_SEQ_EVENT_NONE 255 ++ ++ ++typedef unsigned char snd_seq_event_type_t; ++ ++/** event address */ ++struct snd_seq_addr { ++ unsigned char client; /**< Client number: 0..255, 255 = broadcast to all clients */ ++ unsigned char port; /**< Port within client: 0..255, 255 = broadcast to all ports */ ++}; ++ ++/** port connection */ ++struct snd_seq_connect { ++ struct snd_seq_addr sender; ++ struct snd_seq_addr dest; ++}; ++ ++ ++#define SNDRV_SEQ_ADDRESS_UNKNOWN 253 /* unknown source */ ++#define SNDRV_SEQ_ADDRESS_SUBSCRIBERS 254 /* send event to all subscribed ports */ ++#define SNDRV_SEQ_ADDRESS_BROADCAST 255 /* send event to all queues/clients/ports/channels */ ++#define SNDRV_SEQ_QUEUE_DIRECT 253 /* direct dispatch */ ++ ++ /* event mode flag - NOTE: only 8 bits available! */ ++#define SNDRV_SEQ_TIME_STAMP_TICK (0<<0) /* timestamp in clock ticks */ ++#define SNDRV_SEQ_TIME_STAMP_REAL (1<<0) /* timestamp in real time */ ++#define SNDRV_SEQ_TIME_STAMP_MASK (1<<0) ++ ++#define SNDRV_SEQ_TIME_MODE_ABS (0<<1) /* absolute timestamp */ ++#define SNDRV_SEQ_TIME_MODE_REL (1<<1) /* relative to current time */ ++#define SNDRV_SEQ_TIME_MODE_MASK (1<<1) ++ ++#define SNDRV_SEQ_EVENT_LENGTH_FIXED (0<<2) /* fixed event size */ ++#define SNDRV_SEQ_EVENT_LENGTH_VARIABLE (1<<2) /* variable event size */ ++#define SNDRV_SEQ_EVENT_LENGTH_VARUSR (2<<2) /* variable event size - user memory space */ ++#define SNDRV_SEQ_EVENT_LENGTH_MASK (3<<2) ++ ++#define SNDRV_SEQ_PRIORITY_NORMAL (0<<4) /* normal priority */ ++#define SNDRV_SEQ_PRIORITY_HIGH (1<<4) /* event should be processed before others */ ++#define SNDRV_SEQ_PRIORITY_MASK (1<<4) ++ ++ ++ /* note event */ ++struct snd_seq_ev_note { ++ unsigned char channel; ++ unsigned char note; ++ unsigned char velocity; ++ unsigned char off_velocity; /* only for SNDRV_SEQ_EVENT_NOTE */ ++ unsigned int duration; /* only for SNDRV_SEQ_EVENT_NOTE */ ++}; ++ ++ /* controller event */ ++struct snd_seq_ev_ctrl { ++ unsigned char channel; ++ unsigned char unused1, unused2, unused3; /* pad */ ++ unsigned int param; ++ signed int value; ++}; ++ ++ /* generic set of bytes (12x8 bit) */ ++struct snd_seq_ev_raw8 { ++ unsigned char d[12]; /* 8 bit value */ ++}; ++ ++ /* generic set of integers (3x32 bit) */ ++struct snd_seq_ev_raw32 { ++ unsigned int d[3]; /* 32 bit value */ ++}; ++ ++ /* external stored data */ ++struct snd_seq_ev_ext { ++ unsigned int len; /* length of data */ ++ void *ptr; /* pointer to data (note: maybe 64-bit) */ ++} __attribute__((packed)); ++ ++struct snd_seq_result { ++ int event; /* processed event type */ ++ int result; ++}; ++ ++ ++struct snd_seq_real_time { ++ unsigned int tv_sec; /* seconds */ ++ unsigned int tv_nsec; /* nanoseconds */ ++}; ++ ++typedef unsigned int snd_seq_tick_time_t; /* midi ticks */ ++ ++union snd_seq_timestamp { ++ snd_seq_tick_time_t tick; ++ struct snd_seq_real_time time; ++}; ++ ++struct snd_seq_queue_skew { ++ unsigned int value; ++ unsigned int base; ++}; ++ ++ /* queue timer control */ ++struct snd_seq_ev_queue_control { ++ unsigned char queue; /* affected queue */ ++ unsigned char pad[3]; /* reserved */ ++ union { ++ signed int value; /* affected value (e.g. tempo) */ ++ union snd_seq_timestamp time; /* time */ ++ unsigned int position; /* sync position */ ++ struct snd_seq_queue_skew skew; ++ unsigned int d32[2]; ++ unsigned char d8[8]; ++ } param; ++}; ++ ++ /* quoted event - inside the kernel only */ ++struct snd_seq_ev_quote { ++ struct snd_seq_addr origin; /* original sender */ ++ unsigned short value; /* optional data */ ++ struct snd_seq_event *event; /* quoted event */ ++} __attribute__((packed)); ++ ++ ++ /* sequencer event */ ++struct snd_seq_event { ++ snd_seq_event_type_t type; /* event type */ ++ unsigned char flags; /* event flags */ ++ char tag; ++ ++ unsigned char queue; /* schedule queue */ ++ union snd_seq_timestamp time; /* schedule time */ ++ ++ ++ struct snd_seq_addr source; /* source address */ ++ struct snd_seq_addr dest; /* destination address */ ++ ++ union { /* event data... */ ++ struct snd_seq_ev_note note; ++ struct snd_seq_ev_ctrl control; ++ struct snd_seq_ev_raw8 raw8; ++ struct snd_seq_ev_raw32 raw32; ++ struct snd_seq_ev_ext ext; ++ struct snd_seq_ev_queue_control queue; ++ union snd_seq_timestamp time; ++ struct snd_seq_addr addr; ++ struct snd_seq_connect connect; ++ struct snd_seq_result result; ++ struct snd_seq_ev_quote quote; ++ } data; ++}; ++ ++ ++/* ++ * bounce event - stored as variable size data ++ */ ++struct snd_seq_event_bounce { ++ int err; ++ struct snd_seq_event event; ++ /* external data follows here. */ ++}; ++ ++ ++ /* system information */ ++struct snd_seq_system_info { ++ int queues; /* maximum queues count */ ++ int clients; /* maximum clients count */ ++ int ports; /* maximum ports per client */ ++ int channels; /* maximum channels per port */ ++ int cur_clients; /* current clients */ ++ int cur_queues; /* current queues */ ++ char reserved[24]; ++}; ++ ++ ++ /* system running information */ ++struct snd_seq_running_info { ++ unsigned char client; /* client id */ ++ unsigned char big_endian; /* 1 = big-endian */ ++ unsigned char cpu_mode; /* 4 = 32bit, 8 = 64bit */ ++ unsigned char pad; /* reserved */ ++ unsigned char reserved[12]; ++}; ++ ++ ++ /* known client numbers */ ++#define SNDRV_SEQ_CLIENT_SYSTEM 0 ++ /* internal client numbers */ ++#define SNDRV_SEQ_CLIENT_DUMMY 14 /* midi through */ ++#define SNDRV_SEQ_CLIENT_OSS 15 /* oss sequencer emulator */ ++ ++ ++ /* client types */ ++typedef int __bitwise snd_seq_client_type_t; ++#define NO_CLIENT ((__force snd_seq_client_type_t) 0) ++#define USER_CLIENT ((__force snd_seq_client_type_t) 1) ++#define KERNEL_CLIENT ((__force snd_seq_client_type_t) 2) ++ ++ /* event filter flags */ ++#define SNDRV_SEQ_FILTER_BROADCAST (1<<0) /* accept broadcast messages */ ++#define SNDRV_SEQ_FILTER_MULTICAST (1<<1) /* accept multicast messages */ ++#define SNDRV_SEQ_FILTER_BOUNCE (1<<2) /* accept bounce event in error */ ++#define SNDRV_SEQ_FILTER_USE_EVENT (1<<31) /* use event filter */ ++ ++struct snd_seq_client_info { ++ int client; /* client number to inquire */ ++ snd_seq_client_type_t type; /* client type */ ++ char name[64]; /* client name */ ++ unsigned int filter; /* filter flags */ ++ unsigned char multicast_filter[8]; /* multicast filter bitmap */ ++ unsigned char event_filter[32]; /* event filter bitmap */ ++ int num_ports; /* RO: number of ports */ ++ int event_lost; /* number of lost events */ ++ int card; /* RO: card number[kernel] */ ++ int pid; /* RO: pid[user] */ ++ char reserved[56]; /* for future use */ ++}; ++ ++ ++/* client pool size */ ++struct snd_seq_client_pool { ++ int client; /* client number to inquire */ ++ int output_pool; /* outgoing (write) pool size */ ++ int input_pool; /* incoming (read) pool size */ ++ int output_room; /* minimum free pool size for select/blocking mode */ ++ int output_free; /* unused size */ ++ int input_free; /* unused size */ ++ char reserved[64]; ++}; ++ ++ ++/* Remove events by specified criteria */ ++ ++#define SNDRV_SEQ_REMOVE_INPUT (1<<0) /* Flush input queues */ ++#define SNDRV_SEQ_REMOVE_OUTPUT (1<<1) /* Flush output queues */ ++#define SNDRV_SEQ_REMOVE_DEST (1<<2) /* Restrict by destination q:client:port */ ++#define SNDRV_SEQ_REMOVE_DEST_CHANNEL (1<<3) /* Restrict by channel */ ++#define SNDRV_SEQ_REMOVE_TIME_BEFORE (1<<4) /* Restrict to before time */ ++#define SNDRV_SEQ_REMOVE_TIME_AFTER (1<<5) /* Restrict to time or after */ ++#define SNDRV_SEQ_REMOVE_TIME_TICK (1<<6) /* Time is in ticks */ ++#define SNDRV_SEQ_REMOVE_EVENT_TYPE (1<<7) /* Restrict to event type */ ++#define SNDRV_SEQ_REMOVE_IGNORE_OFF (1<<8) /* Do not flush off events */ ++#define SNDRV_SEQ_REMOVE_TAG_MATCH (1<<9) /* Restrict to events with given tag */ ++ ++struct snd_seq_remove_events { ++ unsigned int remove_mode; /* Flags that determine what gets removed */ ++ ++ union snd_seq_timestamp time; ++ ++ unsigned char queue; /* Queue for REMOVE_DEST */ ++ struct snd_seq_addr dest; /* Address for REMOVE_DEST */ ++ unsigned char channel; /* Channel for REMOVE_DEST */ ++ ++ int type; /* For REMOVE_EVENT_TYPE */ ++ char tag; /* Tag for REMOVE_TAG */ ++ ++ int reserved[10]; /* To allow for future binary compatibility */ ++ ++}; ++ ++ ++ /* known port numbers */ ++#define SNDRV_SEQ_PORT_SYSTEM_TIMER 0 ++#define SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE 1 ++ ++ /* port capabilities (32 bits) */ ++#define SNDRV_SEQ_PORT_CAP_READ (1<<0) /* readable from this port */ ++#define SNDRV_SEQ_PORT_CAP_WRITE (1<<1) /* writable to this port */ ++ ++#define SNDRV_SEQ_PORT_CAP_SYNC_READ (1<<2) ++#define SNDRV_SEQ_PORT_CAP_SYNC_WRITE (1<<3) ++ ++#define SNDRV_SEQ_PORT_CAP_DUPLEX (1<<4) ++ ++#define SNDRV_SEQ_PORT_CAP_SUBS_READ (1<<5) /* allow read subscription */ ++#define SNDRV_SEQ_PORT_CAP_SUBS_WRITE (1<<6) /* allow write subscription */ ++#define SNDRV_SEQ_PORT_CAP_NO_EXPORT (1<<7) /* routing not allowed */ ++ ++ /* port type */ ++#define SNDRV_SEQ_PORT_TYPE_SPECIFIC (1<<0) /* hardware specific */ ++#define SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC (1<<1) /* generic MIDI device */ ++#define SNDRV_SEQ_PORT_TYPE_MIDI_GM (1<<2) /* General MIDI compatible device */ ++#define SNDRV_SEQ_PORT_TYPE_MIDI_GS (1<<3) /* GS compatible device */ ++#define SNDRV_SEQ_PORT_TYPE_MIDI_XG (1<<4) /* XG compatible device */ ++#define SNDRV_SEQ_PORT_TYPE_MIDI_MT32 (1<<5) /* MT-32 compatible device */ ++#define SNDRV_SEQ_PORT_TYPE_MIDI_GM2 (1<<6) /* General MIDI 2 compatible device */ ++ ++/* other standards...*/ ++#define SNDRV_SEQ_PORT_TYPE_SYNTH (1<<10) /* Synth device (no MIDI compatible - direct wavetable) */ ++#define SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11) /* Sampling device (support sample download) */ ++#define SNDRV_SEQ_PORT_TYPE_SAMPLE (1<<12) /* Sampling device (sample can be downloaded at any time) */ ++/*...*/ ++#define SNDRV_SEQ_PORT_TYPE_HARDWARE (1<<16) /* driver for a hardware device */ ++#define SNDRV_SEQ_PORT_TYPE_SOFTWARE (1<<17) /* implemented in software */ ++#define SNDRV_SEQ_PORT_TYPE_SYNTHESIZER (1<<18) /* generates sound */ ++#define SNDRV_SEQ_PORT_TYPE_PORT (1<<19) /* connects to other device(s) */ ++#define SNDRV_SEQ_PORT_TYPE_APPLICATION (1<<20) /* application (sequencer/editor) */ ++ ++/* misc. conditioning flags */ ++#define SNDRV_SEQ_PORT_FLG_GIVEN_PORT (1<<0) ++#define SNDRV_SEQ_PORT_FLG_TIMESTAMP (1<<1) ++#define SNDRV_SEQ_PORT_FLG_TIME_REAL (1<<2) ++ ++struct snd_seq_port_info { ++ struct snd_seq_addr addr; /* client/port numbers */ ++ char name[64]; /* port name */ ++ ++ unsigned int capability; /* port capability bits */ ++ unsigned int type; /* port type bits */ ++ int midi_channels; /* channels per MIDI port */ ++ int midi_voices; /* voices per MIDI port */ ++ int synth_voices; /* voices per SYNTH port */ ++ ++ int read_use; /* R/O: subscribers for output (from this port) */ ++ int write_use; /* R/O: subscribers for input (to this port) */ ++ ++ void *kernel; /* reserved for kernel use (must be NULL) */ ++ unsigned int flags; /* misc. conditioning */ ++ unsigned char time_queue; /* queue # for timestamping */ ++ char reserved[59]; /* for future use */ ++}; ++ ++ ++/* queue flags */ ++#define SNDRV_SEQ_QUEUE_FLG_SYNC (1<<0) /* sync enabled */ ++ ++/* queue information */ ++struct snd_seq_queue_info { ++ int queue; /* queue id */ ++ ++ /* ++ * security settings, only owner of this queue can start/stop timer ++ * etc. if the queue is locked for other clients ++ */ ++ int owner; /* client id for owner of the queue */ ++ unsigned locked:1; /* timing queue locked for other queues */ ++ char name[64]; /* name of this queue */ ++ unsigned int flags; /* flags */ ++ char reserved[60]; /* for future use */ ++ ++}; ++ ++/* queue info/status */ ++struct snd_seq_queue_status { ++ int queue; /* queue id */ ++ int events; /* read-only - queue size */ ++ snd_seq_tick_time_t tick; /* current tick */ ++ struct snd_seq_real_time time; /* current time */ ++ int running; /* running state of queue */ ++ int flags; /* various flags */ ++ char reserved[64]; /* for the future */ ++}; ++ ++ ++/* queue tempo */ ++struct snd_seq_queue_tempo { ++ int queue; /* sequencer queue */ ++ unsigned int tempo; /* current tempo, us/tick */ ++ int ppq; /* time resolution, ticks/quarter */ ++ unsigned int skew_value; /* queue skew */ ++ unsigned int skew_base; /* queue skew base */ ++ char reserved[24]; /* for the future */ ++}; ++ ++ ++/* sequencer timer sources */ ++#define SNDRV_SEQ_TIMER_ALSA 0 /* ALSA timer */ ++#define SNDRV_SEQ_TIMER_MIDI_CLOCK 1 /* Midi Clock (CLOCK event) */ ++#define SNDRV_SEQ_TIMER_MIDI_TICK 2 /* Midi Timer Tick (TICK event) */ ++ ++/* queue timer info */ ++struct snd_seq_queue_timer { ++ int queue; /* sequencer queue */ ++ int type; /* source timer type */ ++ union { ++ struct { ++ struct snd_timer_id id; /* ALSA's timer ID */ ++ unsigned int resolution; /* resolution in Hz */ ++ } alsa; ++ } u; ++ char reserved[64]; /* for the future use */ ++}; ++ ++ ++struct snd_seq_queue_client { ++ int queue; /* sequencer queue */ ++ int client; /* sequencer client */ ++ int used; /* queue is used with this client ++ (must be set for accepting events) */ ++ /* per client watermarks */ ++ char reserved[64]; /* for future use */ ++}; ++ ++ ++#define SNDRV_SEQ_PORT_SUBS_EXCLUSIVE (1<<0) /* exclusive connection */ ++#define SNDRV_SEQ_PORT_SUBS_TIMESTAMP (1<<1) ++#define SNDRV_SEQ_PORT_SUBS_TIME_REAL (1<<2) ++ ++struct snd_seq_port_subscribe { ++ struct snd_seq_addr sender; /* sender address */ ++ struct snd_seq_addr dest; /* destination address */ ++ unsigned int voices; /* number of voices to be allocated (0 = don't care) */ ++ unsigned int flags; /* modes */ ++ unsigned char queue; /* input time-stamp queue (optional) */ ++ unsigned char pad[3]; /* reserved */ ++ char reserved[64]; ++}; ++ ++/* type of query subscription */ ++#define SNDRV_SEQ_QUERY_SUBS_READ 0 ++#define SNDRV_SEQ_QUERY_SUBS_WRITE 1 ++ ++struct snd_seq_query_subs { ++ struct snd_seq_addr root; /* client/port id to be searched */ ++ int type; /* READ or WRITE */ ++ int index; /* 0..N-1 */ ++ int num_subs; /* R/O: number of subscriptions on this port */ ++ struct snd_seq_addr addr; /* R/O: result */ ++ unsigned char queue; /* R/O: result */ ++ unsigned int flags; /* R/O: result */ ++ char reserved[64]; /* for future use */ ++}; ++ ++ ++/* ++ * IOCTL commands ++ */ ++ ++#define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int) ++#define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int) ++#define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct snd_seq_system_info) ++#define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct snd_seq_running_info) ++ ++#define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct snd_seq_client_info) ++#define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct snd_seq_client_info) ++ ++#define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct snd_seq_port_info) ++#define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct snd_seq_port_info) ++#define SNDRV_SEQ_IOCTL_GET_PORT_INFO _IOWR('S', 0x22, struct snd_seq_port_info) ++#define SNDRV_SEQ_IOCTL_SET_PORT_INFO _IOW ('S', 0x23, struct snd_seq_port_info) ++ ++#define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct snd_seq_port_subscribe) ++#define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct snd_seq_port_subscribe) ++ ++#define SNDRV_SEQ_IOCTL_CREATE_QUEUE _IOWR('S', 0x32, struct snd_seq_queue_info) ++#define SNDRV_SEQ_IOCTL_DELETE_QUEUE _IOW ('S', 0x33, struct snd_seq_queue_info) ++#define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct snd_seq_queue_info) ++#define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct snd_seq_queue_info) ++#define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct snd_seq_queue_info) ++#define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct snd_seq_queue_status) ++#define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct snd_seq_queue_tempo) ++#define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct snd_seq_queue_tempo) ++#define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct snd_seq_queue_timer) ++#define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct snd_seq_queue_timer) ++#define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT _IOWR('S', 0x49, struct snd_seq_queue_client) ++#define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT _IOW ('S', 0x4a, struct snd_seq_queue_client) ++#define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct snd_seq_client_pool) ++#define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct snd_seq_client_pool) ++#define SNDRV_SEQ_IOCTL_REMOVE_EVENTS _IOW ('S', 0x4e, struct snd_seq_remove_events) ++#define SNDRV_SEQ_IOCTL_QUERY_SUBS _IOWR('S', 0x4f, struct snd_seq_query_subs) ++#define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION _IOWR('S', 0x50, struct snd_seq_port_subscribe) ++#define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT _IOWR('S', 0x51, struct snd_seq_client_info) ++#define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct snd_seq_port_info) ++ ++#endif /* _UAPI__SOUND_ASEQUENCER_H */ +diff --git a/include/sound/uapi/asoc.h b/include/sound/uapi/asoc.h +new file mode 100644 +index 00000000..a74ca232 +--- /dev/null ++++ b/include/sound/uapi/asoc.h +@@ -0,0 +1,633 @@ ++/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ ++/* ++ * uapi/sound/asoc.h -- ALSA SoC Firmware Controls and DAPM ++ * ++ * Copyright (C) 2012 Texas Instruments Inc. ++ * Copyright (C) 2015 Intel Corporation. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ * Simple file API to load FW that includes mixers, coefficients, DAPM graphs, ++ * algorithms, equalisers, DAIs, widgets etc. ++*/ ++ ++#ifndef __LINUX_UAPI_SND_ASOC_H ++#define __LINUX_UAPI_SND_ASOC_H ++ ++#include ++#include ++ ++/* ++ * Maximum number of channels topology kcontrol can represent. ++ */ ++#define SND_SOC_TPLG_MAX_CHAN 8 ++ ++/* ++ * Maximum number of PCM formats capability ++ */ ++#define SND_SOC_TPLG_MAX_FORMATS 16 ++ ++/* ++ * Maximum number of PCM stream configs ++ */ ++#define SND_SOC_TPLG_STREAM_CONFIG_MAX 8 ++ ++/* ++ * Maximum number of physical link's hardware configs ++ */ ++#define SND_SOC_TPLG_HW_CONFIG_MAX 8 ++ ++/* individual kcontrol info types - can be mixed with other types */ ++#define SND_SOC_TPLG_CTL_VOLSW 1 ++#define SND_SOC_TPLG_CTL_VOLSW_SX 2 ++#define SND_SOC_TPLG_CTL_VOLSW_XR_SX 3 ++#define SND_SOC_TPLG_CTL_ENUM 4 ++#define SND_SOC_TPLG_CTL_BYTES 5 ++#define SND_SOC_TPLG_CTL_ENUM_VALUE 6 ++#define SND_SOC_TPLG_CTL_RANGE 7 ++#define SND_SOC_TPLG_CTL_STROBE 8 ++ ++ ++/* individual widget kcontrol info types - can be mixed with other types */ ++#define SND_SOC_TPLG_DAPM_CTL_VOLSW 64 ++#define SND_SOC_TPLG_DAPM_CTL_ENUM_DOUBLE 65 ++#define SND_SOC_TPLG_DAPM_CTL_ENUM_VIRT 66 ++#define SND_SOC_TPLG_DAPM_CTL_ENUM_VALUE 67 ++#define SND_SOC_TPLG_DAPM_CTL_PIN 68 ++ ++/* DAPM widget types - add new items to the end */ ++#define SND_SOC_TPLG_DAPM_INPUT 0 ++#define SND_SOC_TPLG_DAPM_OUTPUT 1 ++#define SND_SOC_TPLG_DAPM_MUX 2 ++#define SND_SOC_TPLG_DAPM_MIXER 3 ++#define SND_SOC_TPLG_DAPM_PGA 4 ++#define SND_SOC_TPLG_DAPM_OUT_DRV 5 ++#define SND_SOC_TPLG_DAPM_ADC 6 ++#define SND_SOC_TPLG_DAPM_DAC 7 ++#define SND_SOC_TPLG_DAPM_SWITCH 8 ++#define SND_SOC_TPLG_DAPM_PRE 9 ++#define SND_SOC_TPLG_DAPM_POST 10 ++#define SND_SOC_TPLG_DAPM_AIF_IN 11 ++#define SND_SOC_TPLG_DAPM_AIF_OUT 12 ++#define SND_SOC_TPLG_DAPM_DAI_IN 13 ++#define SND_SOC_TPLG_DAPM_DAI_OUT 14 ++#define SND_SOC_TPLG_DAPM_DAI_LINK 15 ++#define SND_SOC_TPLG_DAPM_BUFFER 16 ++#define SND_SOC_TPLG_DAPM_SCHEDULER 17 ++#define SND_SOC_TPLG_DAPM_EFFECT 18 ++#define SND_SOC_TPLG_DAPM_SIGGEN 19 ++#define SND_SOC_TPLG_DAPM_SRC 20 ++#define SND_SOC_TPLG_DAPM_ASRC 21 ++#define SND_SOC_TPLG_DAPM_ENCODER 22 ++#define SND_SOC_TPLG_DAPM_DECODER 23 ++#define SND_SOC_TPLG_DAPM_LAST SND_SOC_TPLG_DAPM_DECODER ++ ++/* Header magic number and string sizes */ ++#define SND_SOC_TPLG_MAGIC 0x41536F43 /* ASoC */ ++ ++/* string sizes */ ++#define SND_SOC_TPLG_NUM_TEXTS 16 ++ ++/* ABI version */ ++#define SND_SOC_TPLG_ABI_VERSION 0x5 /* current version */ ++#define SND_SOC_TPLG_ABI_VERSION_MIN 0x4 /* oldest version supported */ ++ ++/* Max size of TLV data */ ++#define SND_SOC_TPLG_TLV_SIZE 32 ++ ++/* ++ * File and Block header data types. ++ * Add new generic and vendor types to end of list. ++ * Generic types are handled by the core whilst vendors types are passed ++ * to the component drivers for handling. ++ */ ++#define SND_SOC_TPLG_TYPE_MIXER 1 ++#define SND_SOC_TPLG_TYPE_BYTES 2 ++#define SND_SOC_TPLG_TYPE_ENUM 3 ++#define SND_SOC_TPLG_TYPE_DAPM_GRAPH 4 ++#define SND_SOC_TPLG_TYPE_DAPM_WIDGET 5 ++#define SND_SOC_TPLG_TYPE_DAI_LINK 6 ++#define SND_SOC_TPLG_TYPE_PCM 7 ++#define SND_SOC_TPLG_TYPE_MANIFEST 8 ++#define SND_SOC_TPLG_TYPE_CODEC_LINK 9 ++#define SND_SOC_TPLG_TYPE_BACKEND_LINK 10 ++#define SND_SOC_TPLG_TYPE_PDATA 11 ++#define SND_SOC_TPLG_TYPE_DAI 12 ++#define SND_SOC_TPLG_TYPE_MAX SND_SOC_TPLG_TYPE_DAI ++ ++/* vendor block IDs - please add new vendor types to end */ ++#define SND_SOC_TPLG_TYPE_VENDOR_FW 1000 ++#define SND_SOC_TPLG_TYPE_VENDOR_CONFIG 1001 ++#define SND_SOC_TPLG_TYPE_VENDOR_COEFF 1002 ++#define SND_SOC_TPLG_TYPEVENDOR_CODEC 1003 ++ ++#define SND_SOC_TPLG_STREAM_PLAYBACK 0 ++#define SND_SOC_TPLG_STREAM_CAPTURE 1 ++ ++/* vendor tuple types */ ++#define SND_SOC_TPLG_TUPLE_TYPE_UUID 0 ++#define SND_SOC_TPLG_TUPLE_TYPE_STRING 1 ++#define SND_SOC_TPLG_TUPLE_TYPE_BOOL 2 ++#define SND_SOC_TPLG_TUPLE_TYPE_BYTE 3 ++#define SND_SOC_TPLG_TUPLE_TYPE_WORD 4 ++#define SND_SOC_TPLG_TUPLE_TYPE_SHORT 5 ++ ++/* DAI flags */ ++#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_RATES (1 << 0) ++#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_CHANNELS (1 << 1) ++#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2) ++ ++/* DAI clock gating */ ++#define SND_SOC_TPLG_DAI_CLK_GATE_UNDEFINED 0 ++#define SND_SOC_TPLG_DAI_CLK_GATE_GATED 1 ++#define SND_SOC_TPLG_DAI_CLK_GATE_CONT 2 ++ ++/* DAI mclk_direction */ ++#define SND_SOC_TPLG_MCLK_CO 0 /* for codec, mclk is output */ ++#define SND_SOC_TPLG_MCLK_CI 1 /* for codec, mclk is input */ ++ ++/* DAI physical PCM data formats. ++ * Add new formats to the end of the list. ++ */ ++#define SND_SOC_DAI_FORMAT_I2S 1 /* I2S mode */ ++#define SND_SOC_DAI_FORMAT_RIGHT_J 2 /* Right Justified mode */ ++#define SND_SOC_DAI_FORMAT_LEFT_J 3 /* Left Justified mode */ ++#define SND_SOC_DAI_FORMAT_DSP_A 4 /* L data MSB after FRM LRC */ ++#define SND_SOC_DAI_FORMAT_DSP_B 5 /* L data MSB during FRM LRC */ ++#define SND_SOC_DAI_FORMAT_AC97 6 /* AC97 */ ++#define SND_SOC_DAI_FORMAT_PDM 7 /* Pulse density modulation */ ++ ++/* left and right justified also known as MSB and LSB respectively */ ++#define SND_SOC_DAI_FORMAT_MSB SND_SOC_DAI_FORMAT_LEFT_J ++#define SND_SOC_DAI_FORMAT_LSB SND_SOC_DAI_FORMAT_RIGHT_J ++ ++/* DAI link flags */ ++#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_RATES (1 << 0) ++#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_CHANNELS (1 << 1) ++#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2) ++#define SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP (1 << 3) ++ ++/* DAI topology BCLK parameter ++ * For the backwards capability, by default codec is bclk master ++ */ ++#define SND_SOC_TPLG_BCLK_CM 0 /* codec is bclk master */ ++#define SND_SOC_TPLG_BCLK_CS 1 /* codec is bclk slave */ ++ ++/* DAI topology FSYNC parameter ++ * For the backwards capability, by default codec is fsync master ++ */ ++#define SND_SOC_TPLG_FSYNC_CM 0 /* codec is fsync master */ ++#define SND_SOC_TPLG_FSYNC_CS 1 /* codec is fsync slave */ ++ ++/* ++ * Block Header. ++ * This header precedes all object and object arrays below. ++ */ ++struct snd_soc_tplg_hdr { ++ __le32 magic; /* magic number */ ++ __le32 abi; /* ABI version */ ++ __le32 version; /* optional vendor specific version details */ ++ __le32 type; /* SND_SOC_TPLG_TYPE_ */ ++ __le32 size; /* size of this structure */ ++ __le32 vendor_type; /* optional vendor specific type info */ ++ __le32 payload_size; /* data bytes, excluding this header */ ++ __le32 index; /* identifier for block */ ++ __le32 count; /* number of elements in block */ ++} __attribute__((packed)); ++ ++/* vendor tuple for uuid */ ++struct snd_soc_tplg_vendor_uuid_elem { ++ __le32 token; ++ char uuid[16]; ++} __attribute__((packed)); ++ ++/* vendor tuple for a bool/byte/short/word value */ ++struct snd_soc_tplg_vendor_value_elem { ++ __le32 token; ++ __le32 value; ++} __attribute__((packed)); ++ ++/* vendor tuple for string */ ++struct snd_soc_tplg_vendor_string_elem { ++ __le32 token; ++ char string[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; ++} __attribute__((packed)); ++ ++struct snd_soc_tplg_vendor_array { ++ __le32 size; /* size in bytes of the array, including all elements */ ++ __le32 type; /* SND_SOC_TPLG_TUPLE_TYPE_ */ ++ __le32 num_elems; /* number of elements in array */ ++ union { ++ struct snd_soc_tplg_vendor_uuid_elem uuid[0]; ++ struct snd_soc_tplg_vendor_value_elem value[0]; ++ struct snd_soc_tplg_vendor_string_elem string[0]; ++ }; ++} __attribute__((packed)); ++ ++/* ++ * Private data. ++ * All topology objects may have private data that can be used by the driver or ++ * firmware. Core will ignore this data. ++ */ ++struct snd_soc_tplg_private { ++ __le32 size; /* in bytes of private data */ ++ union { ++ char data[0]; ++ struct snd_soc_tplg_vendor_array array[0]; ++ }; ++} __attribute__((packed)); ++ ++/* ++ * Kcontrol TLV data. ++ */ ++struct snd_soc_tplg_tlv_dbscale { ++ __le32 min; ++ __le32 step; ++ __le32 mute; ++} __attribute__((packed)); ++ ++struct snd_soc_tplg_ctl_tlv { ++ __le32 size; /* in bytes of this structure */ ++ __le32 type; /* SNDRV_CTL_TLVT_*, type of TLV */ ++ union { ++ __le32 data[SND_SOC_TPLG_TLV_SIZE]; ++ struct snd_soc_tplg_tlv_dbscale scale; ++ }; ++} __attribute__((packed)); ++ ++/* ++ * Kcontrol channel data ++ */ ++struct snd_soc_tplg_channel { ++ __le32 size; /* in bytes of this structure */ ++ __le32 reg; ++ __le32 shift; ++ __le32 id; /* ID maps to Left, Right, LFE etc */ ++} __attribute__((packed)); ++ ++/* ++ * Genericl Operations IDs, for binding Kcontrol or Bytes ext ops ++ * Kcontrol ops need get/put/info. ++ * Bytes ext ops need get/put. ++ */ ++struct snd_soc_tplg_io_ops { ++ __le32 get; ++ __le32 put; ++ __le32 info; ++} __attribute__((packed)); ++ ++/* ++ * kcontrol header ++ */ ++struct snd_soc_tplg_ctl_hdr { ++ __le32 size; /* in bytes of this structure */ ++ __le32 type; ++ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; ++ __le32 access; ++ struct snd_soc_tplg_io_ops ops; ++ struct snd_soc_tplg_ctl_tlv tlv; ++} __attribute__((packed)); ++ ++/* ++ * Stream Capabilities ++ */ ++struct snd_soc_tplg_stream_caps { ++ __le32 size; /* in bytes of this structure */ ++ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; ++ __le64 formats; /* supported formats SNDRV_PCM_FMTBIT_* */ ++ __le32 rates; /* supported rates SNDRV_PCM_RATE_* */ ++ __le32 rate_min; /* min rate */ ++ __le32 rate_max; /* max rate */ ++ __le32 channels_min; /* min channels */ ++ __le32 channels_max; /* max channels */ ++ __le32 periods_min; /* min number of periods */ ++ __le32 periods_max; /* max number of periods */ ++ __le32 period_size_min; /* min period size bytes */ ++ __le32 period_size_max; /* max period size bytes */ ++ __le32 buffer_size_min; /* min buffer size bytes */ ++ __le32 buffer_size_max; /* max buffer size bytes */ ++ __le32 sig_bits; /* number of bits of content */ ++} __attribute__((packed)); ++ ++/* ++ * FE or BE Stream configuration supported by SW/FW ++ */ ++struct snd_soc_tplg_stream { ++ __le32 size; /* in bytes of this structure */ ++ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* Name of the stream */ ++ __le64 format; /* SNDRV_PCM_FMTBIT_* */ ++ __le32 rate; /* SNDRV_PCM_RATE_* */ ++ __le32 period_bytes; /* size of period in bytes */ ++ __le32 buffer_bytes; /* size of buffer in bytes */ ++ __le32 channels; /* channels */ ++} __attribute__((packed)); ++ ++ ++/* ++ * Describes a physical link's runtime supported hardware config, ++ * i.e. hardware audio formats. ++ */ ++struct snd_soc_tplg_hw_config { ++ __le32 size; /* in bytes of this structure */ ++ __le32 id; /* unique ID - - used to match */ ++ __le32 fmt; /* SND_SOC_DAI_FORMAT_ format value */ ++ __u8 clock_gated; /* SND_SOC_TPLG_DAI_CLK_GATE_ value */ ++ __u8 invert_bclk; /* 1 for inverted BCLK, 0 for normal */ ++ __u8 invert_fsync; /* 1 for inverted frame clock, 0 for normal */ ++ __u8 bclk_master; /* SND_SOC_TPLG_BCLK_ value */ ++ __u8 fsync_master; /* SND_SOC_TPLG_FSYNC_ value */ ++ __u8 mclk_direction; /* SND_SOC_TPLG_MCLK_ value */ ++ __le16 reserved; /* for 32bit alignment */ ++ __le32 mclk_rate; /* MCLK or SYSCLK freqency in Hz */ ++ __le32 bclk_rate; /* BCLK freqency in Hz */ ++ __le32 fsync_rate; /* frame clock in Hz */ ++ __le32 tdm_slots; /* number of TDM slots in use */ ++ __le32 tdm_slot_width; /* width in bits for each slot */ ++ __le32 tx_slots; /* bit mask for active Tx slots */ ++ __le32 rx_slots; /* bit mask for active Rx slots */ ++ __le32 tx_channels; /* number of Tx channels */ ++ __le32 tx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */ ++ __le32 rx_channels; /* number of Rx channels */ ++ __le32 rx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */ ++} __attribute__((packed)); ++ ++/* ++ * Manifest. List totals for each payload type. Not used in parsing, but will ++ * be passed to the component driver before any other objects in order for any ++ * global component resource allocations. ++ * ++ * File block representation for manifest :- ++ * +-----------------------------------+----+ ++ * | struct snd_soc_tplg_hdr | 1 | ++ * +-----------------------------------+----+ ++ * | struct snd_soc_tplg_manifest | 1 | ++ * +-----------------------------------+----+ ++ */ ++struct snd_soc_tplg_manifest { ++ __le32 size; /* in bytes of this structure */ ++ __le32 control_elems; /* number of control elements */ ++ __le32 widget_elems; /* number of widget elements */ ++ __le32 graph_elems; /* number of graph elements */ ++ __le32 pcm_elems; /* number of PCM elements */ ++ __le32 dai_link_elems; /* number of DAI link elements */ ++ __le32 dai_elems; /* number of physical DAI elements */ ++ __le32 reserved[20]; /* reserved for new ABI element types */ ++ struct snd_soc_tplg_private priv; ++} __attribute__((packed)); ++ ++/* ++ * Mixer kcontrol. ++ * ++ * File block representation for mixer kcontrol :- ++ * +-----------------------------------+----+ ++ * | struct snd_soc_tplg_hdr | 1 | ++ * +-----------------------------------+----+ ++ * | struct snd_soc_tplg_mixer_control | N | ++ * +-----------------------------------+----+ ++ */ ++struct snd_soc_tplg_mixer_control { ++ struct snd_soc_tplg_ctl_hdr hdr; ++ __le32 size; /* in bytes of this structure */ ++ __le32 min; ++ __le32 max; ++ __le32 platform_max; ++ __le32 invert; ++ __le32 num_channels; ++ struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN]; ++ struct snd_soc_tplg_private priv; ++} __attribute__((packed)); ++ ++/* ++ * Enumerated kcontrol ++ * ++ * File block representation for enum kcontrol :- ++ * +-----------------------------------+----+ ++ * | struct snd_soc_tplg_hdr | 1 | ++ * +-----------------------------------+----+ ++ * | struct snd_soc_tplg_enum_control | N | ++ * +-----------------------------------+----+ ++ */ ++struct snd_soc_tplg_enum_control { ++ struct snd_soc_tplg_ctl_hdr hdr; ++ __le32 size; /* in bytes of this structure */ ++ __le32 num_channels; ++ struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN]; ++ __le32 items; ++ __le32 mask; ++ __le32 count; ++ char texts[SND_SOC_TPLG_NUM_TEXTS][SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; ++ __le32 values[SND_SOC_TPLG_NUM_TEXTS * SNDRV_CTL_ELEM_ID_NAME_MAXLEN / 4]; ++ struct snd_soc_tplg_private priv; ++} __attribute__((packed)); ++ ++/* ++ * Bytes kcontrol ++ * ++ * File block representation for bytes kcontrol :- ++ * +-----------------------------------+----+ ++ * | struct snd_soc_tplg_hdr | 1 | ++ * +-----------------------------------+----+ ++ * | struct snd_soc_tplg_bytes_control | N | ++ * +-----------------------------------+----+ ++ */ ++struct snd_soc_tplg_bytes_control { ++ struct snd_soc_tplg_ctl_hdr hdr; ++ __le32 size; /* in bytes of this structure */ ++ __le32 max; ++ __le32 mask; ++ __le32 base; ++ __le32 num_regs; ++ struct snd_soc_tplg_io_ops ext_ops; ++ struct snd_soc_tplg_private priv; ++} __attribute__((packed)); ++ ++/* ++ * DAPM Graph Element ++ * ++ * File block representation for DAPM graph elements :- ++ * +-------------------------------------+----+ ++ * | struct snd_soc_tplg_hdr | 1 | ++ * +-------------------------------------+----+ ++ * | struct snd_soc_tplg_dapm_graph_elem | N | ++ * +-------------------------------------+----+ ++ */ ++struct snd_soc_tplg_dapm_graph_elem { ++ char sink[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; ++ char control[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; ++ char source[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; ++} __attribute__((packed)); ++ ++/* ++ * DAPM Widget. ++ * ++ * File block representation for DAPM widget :- ++ * +-------------------------------------+-----+ ++ * | struct snd_soc_tplg_hdr | 1 | ++ * +-------------------------------------+-----+ ++ * | struct snd_soc_tplg_dapm_widget | N | ++ * +-------------------------------------+-----+ ++ * | struct snd_soc_tplg_enum_control | 0|1 | ++ * | struct snd_soc_tplg_mixer_control | 0|N | ++ * +-------------------------------------+-----+ ++ * ++ * Optional enum or mixer control can be appended to the end of each widget ++ * in the block. ++ */ ++struct snd_soc_tplg_dapm_widget { ++ __le32 size; /* in bytes of this structure */ ++ __le32 id; /* SND_SOC_DAPM_CTL */ ++ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; ++ char sname[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; ++ ++ __le32 reg; /* negative reg = no direct dapm */ ++ __le32 shift; /* bits to shift */ ++ __le32 mask; /* non-shifted mask */ ++ __le32 subseq; /* sort within widget type */ ++ __le32 invert; /* invert the power bit */ ++ __le32 ignore_suspend; /* kept enabled over suspend */ ++ __le16 event_flags; ++ __le16 event_type; ++ __le32 num_kcontrols; ++ struct snd_soc_tplg_private priv; ++ /* ++ * kcontrols that relate to this widget ++ * follow here after widget private data ++ */ ++} __attribute__((packed)); ++ ++ ++/* ++ * Describes SW/FW specific features of PCM (FE DAI & DAI link). ++ * ++ * File block representation for PCM :- ++ * +-----------------------------------+-----+ ++ * | struct snd_soc_tplg_hdr | 1 | ++ * +-----------------------------------+-----+ ++ * | struct snd_soc_tplg_pcm | N | ++ * +-----------------------------------+-----+ ++ */ ++struct snd_soc_tplg_pcm { ++ __le32 size; /* in bytes of this structure */ ++ char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; ++ char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; ++ __le32 pcm_id; /* unique ID - used to match with DAI link */ ++ __le32 dai_id; /* unique ID - used to match */ ++ __le32 playback; /* supports playback mode */ ++ __le32 capture; /* supports capture mode */ ++ __le32 compress; /* 1 = compressed; 0 = PCM */ ++ struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */ ++ __le32 num_streams; /* number of streams */ ++ struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */ ++ __le32 flag_mask; /* bitmask of flags to configure */ ++ __le32 flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */ ++ struct snd_soc_tplg_private priv; ++} __attribute__((packed)); ++ ++ ++/* ++ * Describes the physical link runtime supported configs or params ++ * ++ * File block representation for physical link config :- ++ * +-----------------------------------+-----+ ++ * | struct snd_soc_tplg_hdr | 1 | ++ * +-----------------------------------+-----+ ++ * | struct snd_soc_tplg_link_config | N | ++ * +-----------------------------------+-----+ ++ */ ++struct snd_soc_tplg_link_config { ++ __le32 size; /* in bytes of this structure */ ++ __le32 id; /* unique ID - used to match */ ++ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */ ++ char stream_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* stream name - used to match */ ++ struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */ ++ __le32 num_streams; /* number of streams */ ++ struct snd_soc_tplg_hw_config hw_config[SND_SOC_TPLG_HW_CONFIG_MAX]; /* hw configs */ ++ __le32 num_hw_configs; /* number of hw configs */ ++ __le32 default_hw_config_id; /* default hw config ID for init */ ++ __le32 flag_mask; /* bitmask of flags to configure */ ++ __le32 flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */ ++ struct snd_soc_tplg_private priv; ++} __attribute__((packed)); ++ ++/* ++ * Describes SW/FW specific features of physical DAI. ++ * It can be used to configure backend DAIs for DPCM. ++ * ++ * File block representation for physical DAI :- ++ * +-----------------------------------+-----+ ++ * | struct snd_soc_tplg_hdr | 1 | ++ * +-----------------------------------+-----+ ++ * | struct snd_soc_tplg_dai | N | ++ * +-----------------------------------+-----+ ++ */ ++struct snd_soc_tplg_dai { ++ __le32 size; /* in bytes of this structure */ ++ char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */ ++ __le32 dai_id; /* unique ID - used to match */ ++ __le32 playback; /* supports playback mode */ ++ __le32 capture; /* supports capture mode */ ++ struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */ ++ __le32 flag_mask; /* bitmask of flags to configure */ ++ __le32 flags; /* SND_SOC_TPLG_DAI_FLGBIT_* */ ++ struct snd_soc_tplg_private priv; ++} __attribute__((packed)); ++ ++/* ++ * Old version of ABI structs, supported for backward compatibility. ++ */ ++ ++/* Manifest v4 */ ++struct snd_soc_tplg_manifest_v4 { ++ __le32 size; /* in bytes of this structure */ ++ __le32 control_elems; /* number of control elements */ ++ __le32 widget_elems; /* number of widget elements */ ++ __le32 graph_elems; /* number of graph elements */ ++ __le32 pcm_elems; /* number of PCM elements */ ++ __le32 dai_link_elems; /* number of DAI link elements */ ++ struct snd_soc_tplg_private priv; ++} __packed; ++ ++/* Stream Capabilities v4 */ ++struct snd_soc_tplg_stream_caps_v4 { ++ __le32 size; /* in bytes of this structure */ ++ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; ++ __le64 formats; /* supported formats SNDRV_PCM_FMTBIT_* */ ++ __le32 rates; /* supported rates SNDRV_PCM_RATE_* */ ++ __le32 rate_min; /* min rate */ ++ __le32 rate_max; /* max rate */ ++ __le32 channels_min; /* min channels */ ++ __le32 channels_max; /* max channels */ ++ __le32 periods_min; /* min number of periods */ ++ __le32 periods_max; /* max number of periods */ ++ __le32 period_size_min; /* min period size bytes */ ++ __le32 period_size_max; /* max period size bytes */ ++ __le32 buffer_size_min; /* min buffer size bytes */ ++ __le32 buffer_size_max; /* max buffer size bytes */ ++} __packed; ++ ++/* PCM v4 */ ++struct snd_soc_tplg_pcm_v4 { ++ __le32 size; /* in bytes of this structure */ ++ char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; ++ char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; ++ __le32 pcm_id; /* unique ID - used to match with DAI link */ ++ __le32 dai_id; /* unique ID - used to match */ ++ __le32 playback; /* supports playback mode */ ++ __le32 capture; /* supports capture mode */ ++ __le32 compress; /* 1 = compressed; 0 = PCM */ ++ struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */ ++ __le32 num_streams; /* number of streams */ ++ struct snd_soc_tplg_stream_caps_v4 caps[2]; /* playback and capture for DAI */ ++} __packed; ++ ++/* Physical link config v4 */ ++struct snd_soc_tplg_link_config_v4 { ++ __le32 size; /* in bytes of this structure */ ++ __le32 id; /* unique ID - used to match */ ++ struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */ ++ __le32 num_streams; /* number of streams */ ++} __packed; ++ ++#endif +diff --git a/include/sound/uapi/asound.h b/include/sound/uapi/asound.h +new file mode 100644 +index 00000000..df1153ce +--- /dev/null ++++ b/include/sound/uapi/asound.h +@@ -0,0 +1,1038 @@ ++/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ ++/* ++ * Advanced Linux Sound Architecture - ALSA - Driver ++ * Copyright (c) 1994-2003 by Jaroslav Kysela , ++ * Abramo Bagnara ++ * ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * ++ */ ++ ++#ifndef _UAPI__SOUND_ASOUND_H ++#define _UAPI__SOUND_ASOUND_H ++ ++#if defined(__KERNEL__) || defined(__linux__) ++#include ++#else ++#include ++#endif ++ ++#ifndef __KERNEL__ ++#include ++#include ++#endif ++ ++/* ++ * protocol version ++ */ ++ ++#define SNDRV_PROTOCOL_VERSION(major, minor, subminor) (((major)<<16)|((minor)<<8)|(subminor)) ++#define SNDRV_PROTOCOL_MAJOR(version) (((version)>>16)&0xffff) ++#define SNDRV_PROTOCOL_MINOR(version) (((version)>>8)&0xff) ++#define SNDRV_PROTOCOL_MICRO(version) ((version)&0xff) ++#define SNDRV_PROTOCOL_INCOMPATIBLE(kversion, uversion) \ ++ (SNDRV_PROTOCOL_MAJOR(kversion) != SNDRV_PROTOCOL_MAJOR(uversion) || \ ++ (SNDRV_PROTOCOL_MAJOR(kversion) == SNDRV_PROTOCOL_MAJOR(uversion) && \ ++ SNDRV_PROTOCOL_MINOR(kversion) != SNDRV_PROTOCOL_MINOR(uversion))) ++ ++/**************************************************************************** ++ * * ++ * Digital audio interface * ++ * * ++ ****************************************************************************/ ++ ++struct snd_aes_iec958 { ++ unsigned char status[24]; /* AES/IEC958 channel status bits */ ++ unsigned char subcode[147]; /* AES/IEC958 subcode bits */ ++ unsigned char pad; /* nothing */ ++ unsigned char dig_subframe[4]; /* AES/IEC958 subframe bits */ ++}; ++ ++/**************************************************************************** ++ * * ++ * CEA-861 Audio InfoFrame. Used in HDMI and DisplayPort * ++ * * ++ ****************************************************************************/ ++ ++struct snd_cea_861_aud_if { ++ unsigned char db1_ct_cc; /* coding type and channel count */ ++ unsigned char db2_sf_ss; /* sample frequency and size */ ++ unsigned char db3; /* not used, all zeros */ ++ unsigned char db4_ca; /* channel allocation code */ ++ unsigned char db5_dminh_lsv; /* downmix inhibit & level-shit values */ ++}; ++ ++/**************************************************************************** ++ * * ++ * Section for driver hardware dependent interface - /dev/snd/hw? * ++ * * ++ ****************************************************************************/ ++ ++#define SNDRV_HWDEP_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1) ++ ++enum { ++ SNDRV_HWDEP_IFACE_OPL2 = 0, ++ SNDRV_HWDEP_IFACE_OPL3, ++ SNDRV_HWDEP_IFACE_OPL4, ++ SNDRV_HWDEP_IFACE_SB16CSP, /* Creative Signal Processor */ ++ SNDRV_HWDEP_IFACE_EMU10K1, /* FX8010 processor in EMU10K1 chip */ ++ SNDRV_HWDEP_IFACE_YSS225, /* Yamaha FX processor */ ++ SNDRV_HWDEP_IFACE_ICS2115, /* Wavetable synth */ ++ SNDRV_HWDEP_IFACE_SSCAPE, /* Ensoniq SoundScape ISA card (MC68EC000) */ ++ SNDRV_HWDEP_IFACE_VX, /* Digigram VX cards */ ++ SNDRV_HWDEP_IFACE_MIXART, /* Digigram miXart cards */ ++ SNDRV_HWDEP_IFACE_USX2Y, /* Tascam US122, US224 & US428 usb */ ++ SNDRV_HWDEP_IFACE_EMUX_WAVETABLE, /* EmuX wavetable */ ++ SNDRV_HWDEP_IFACE_BLUETOOTH, /* Bluetooth audio */ ++ SNDRV_HWDEP_IFACE_USX2Y_PCM, /* Tascam US122, US224 & US428 rawusb pcm */ ++ SNDRV_HWDEP_IFACE_PCXHR, /* Digigram PCXHR */ ++ SNDRV_HWDEP_IFACE_SB_RC, /* SB Extigy/Audigy2NX remote control */ ++ SNDRV_HWDEP_IFACE_HDA, /* HD-audio */ ++ SNDRV_HWDEP_IFACE_USB_STREAM, /* direct access to usb stream */ ++ SNDRV_HWDEP_IFACE_FW_DICE, /* TC DICE FireWire device */ ++ SNDRV_HWDEP_IFACE_FW_FIREWORKS, /* Echo Audio Fireworks based device */ ++ SNDRV_HWDEP_IFACE_FW_BEBOB, /* BridgeCo BeBoB based device */ ++ SNDRV_HWDEP_IFACE_FW_OXFW, /* Oxford OXFW970/971 based device */ ++ SNDRV_HWDEP_IFACE_FW_DIGI00X, /* Digidesign Digi 002/003 family */ ++ SNDRV_HWDEP_IFACE_FW_TASCAM, /* TASCAM FireWire series */ ++ SNDRV_HWDEP_IFACE_LINE6, /* Line6 USB processors */ ++ SNDRV_HWDEP_IFACE_FW_MOTU, /* MOTU FireWire series */ ++ SNDRV_HWDEP_IFACE_FW_FIREFACE, /* RME Fireface series */ ++ ++ /* Don't forget to change the following: */ ++ SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_FW_FIREFACE ++}; ++ ++struct snd_hwdep_info { ++ unsigned int device; /* WR: device number */ ++ int card; /* R: card number */ ++ unsigned char id[64]; /* ID (user selectable) */ ++ unsigned char name[80]; /* hwdep name */ ++ int iface; /* hwdep interface */ ++ unsigned char reserved[64]; /* reserved for future */ ++}; ++ ++/* generic DSP loader */ ++struct snd_hwdep_dsp_status { ++ unsigned int version; /* R: driver-specific version */ ++ unsigned char id[32]; /* R: driver-specific ID string */ ++ unsigned int num_dsps; /* R: number of DSP images to transfer */ ++ unsigned int dsp_loaded; /* R: bit flags indicating the loaded DSPs */ ++ unsigned int chip_ready; /* R: 1 = initialization finished */ ++ unsigned char reserved[16]; /* reserved for future use */ ++}; ++ ++struct snd_hwdep_dsp_image { ++ unsigned int index; /* W: DSP index */ ++ unsigned char name[64]; /* W: ID (e.g. file name) */ ++ unsigned char __user *image; /* W: binary image */ ++ size_t length; /* W: size of image in bytes */ ++ unsigned long driver_data; /* W: driver-specific data */ ++}; ++ ++#define SNDRV_HWDEP_IOCTL_PVERSION _IOR ('H', 0x00, int) ++#define SNDRV_HWDEP_IOCTL_INFO _IOR ('H', 0x01, struct snd_hwdep_info) ++#define SNDRV_HWDEP_IOCTL_DSP_STATUS _IOR('H', 0x02, struct snd_hwdep_dsp_status) ++#define SNDRV_HWDEP_IOCTL_DSP_LOAD _IOW('H', 0x03, struct snd_hwdep_dsp_image) ++ ++/***************************************************************************** ++ * * ++ * Digital Audio (PCM) interface - /dev/snd/pcm?? * ++ * * ++ *****************************************************************************/ ++ ++#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 14) ++ ++typedef unsigned long snd_pcm_uframes_t; ++typedef signed long snd_pcm_sframes_t; ++ ++enum { ++ SNDRV_PCM_CLASS_GENERIC = 0, /* standard mono or stereo device */ ++ SNDRV_PCM_CLASS_MULTI, /* multichannel device */ ++ SNDRV_PCM_CLASS_MODEM, /* software modem class */ ++ SNDRV_PCM_CLASS_DIGITIZER, /* digitizer class */ ++ /* Don't forget to change the following: */ ++ SNDRV_PCM_CLASS_LAST = SNDRV_PCM_CLASS_DIGITIZER, ++}; ++ ++enum { ++ SNDRV_PCM_SUBCLASS_GENERIC_MIX = 0, /* mono or stereo subdevices are mixed together */ ++ SNDRV_PCM_SUBCLASS_MULTI_MIX, /* multichannel subdevices are mixed together */ ++ /* Don't forget to change the following: */ ++ SNDRV_PCM_SUBCLASS_LAST = SNDRV_PCM_SUBCLASS_MULTI_MIX, ++}; ++ ++enum { ++ SNDRV_PCM_STREAM_PLAYBACK = 0, ++ SNDRV_PCM_STREAM_CAPTURE, ++ SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE, ++}; ++ ++typedef int __bitwise snd_pcm_access_t; ++#define SNDRV_PCM_ACCESS_MMAP_INTERLEAVED ((__force snd_pcm_access_t) 0) /* interleaved mmap */ ++#define SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED ((__force snd_pcm_access_t) 1) /* noninterleaved mmap */ ++#define SNDRV_PCM_ACCESS_MMAP_COMPLEX ((__force snd_pcm_access_t) 2) /* complex mmap */ ++#define SNDRV_PCM_ACCESS_RW_INTERLEAVED ((__force snd_pcm_access_t) 3) /* readi/writei */ ++#define SNDRV_PCM_ACCESS_RW_NONINTERLEAVED ((__force snd_pcm_access_t) 4) /* readn/writen */ ++#define SNDRV_PCM_ACCESS_LAST SNDRV_PCM_ACCESS_RW_NONINTERLEAVED ++ ++typedef int __bitwise snd_pcm_format_t; ++#define SNDRV_PCM_FORMAT_S8 ((__force snd_pcm_format_t) 0) ++#define SNDRV_PCM_FORMAT_U8 ((__force snd_pcm_format_t) 1) ++#define SNDRV_PCM_FORMAT_S16_LE ((__force snd_pcm_format_t) 2) ++#define SNDRV_PCM_FORMAT_S16_BE ((__force snd_pcm_format_t) 3) ++#define SNDRV_PCM_FORMAT_U16_LE ((__force snd_pcm_format_t) 4) ++#define SNDRV_PCM_FORMAT_U16_BE ((__force snd_pcm_format_t) 5) ++#define SNDRV_PCM_FORMAT_S24_LE ((__force snd_pcm_format_t) 6) /* low three bytes */ ++#define SNDRV_PCM_FORMAT_S24_BE ((__force snd_pcm_format_t) 7) /* low three bytes */ ++#define SNDRV_PCM_FORMAT_U24_LE ((__force snd_pcm_format_t) 8) /* low three bytes */ ++#define SNDRV_PCM_FORMAT_U24_BE ((__force snd_pcm_format_t) 9) /* low three bytes */ ++#define SNDRV_PCM_FORMAT_S32_LE ((__force snd_pcm_format_t) 10) ++#define SNDRV_PCM_FORMAT_S32_BE ((__force snd_pcm_format_t) 11) ++#define SNDRV_PCM_FORMAT_U32_LE ((__force snd_pcm_format_t) 12) ++#define SNDRV_PCM_FORMAT_U32_BE ((__force snd_pcm_format_t) 13) ++#define SNDRV_PCM_FORMAT_FLOAT_LE ((__force snd_pcm_format_t) 14) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */ ++#define SNDRV_PCM_FORMAT_FLOAT_BE ((__force snd_pcm_format_t) 15) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */ ++#define SNDRV_PCM_FORMAT_FLOAT64_LE ((__force snd_pcm_format_t) 16) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */ ++#define SNDRV_PCM_FORMAT_FLOAT64_BE ((__force snd_pcm_format_t) 17) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */ ++#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE ((__force snd_pcm_format_t) 18) /* IEC-958 subframe, Little Endian */ ++#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE ((__force snd_pcm_format_t) 19) /* IEC-958 subframe, Big Endian */ ++#define SNDRV_PCM_FORMAT_MU_LAW ((__force snd_pcm_format_t) 20) ++#define SNDRV_PCM_FORMAT_A_LAW ((__force snd_pcm_format_t) 21) ++#define SNDRV_PCM_FORMAT_IMA_ADPCM ((__force snd_pcm_format_t) 22) ++#define SNDRV_PCM_FORMAT_MPEG ((__force snd_pcm_format_t) 23) ++#define SNDRV_PCM_FORMAT_GSM ((__force snd_pcm_format_t) 24) ++#define SNDRV_PCM_FORMAT_S20_LE ((__force snd_pcm_format_t) 25) /* in four bytes, LSB justified */ ++#define SNDRV_PCM_FORMAT_S20_BE ((__force snd_pcm_format_t) 26) /* in four bytes, LSB justified */ ++#define SNDRV_PCM_FORMAT_U20_LE ((__force snd_pcm_format_t) 27) /* in four bytes, LSB justified */ ++#define SNDRV_PCM_FORMAT_U20_BE ((__force snd_pcm_format_t) 28) /* in four bytes, LSB justified */ ++/* gap in the numbering for a future standard linear format */ ++#define SNDRV_PCM_FORMAT_SPECIAL ((__force snd_pcm_format_t) 31) ++#define SNDRV_PCM_FORMAT_S24_3LE ((__force snd_pcm_format_t) 32) /* in three bytes */ ++#define SNDRV_PCM_FORMAT_S24_3BE ((__force snd_pcm_format_t) 33) /* in three bytes */ ++#define SNDRV_PCM_FORMAT_U24_3LE ((__force snd_pcm_format_t) 34) /* in three bytes */ ++#define SNDRV_PCM_FORMAT_U24_3BE ((__force snd_pcm_format_t) 35) /* in three bytes */ ++#define SNDRV_PCM_FORMAT_S20_3LE ((__force snd_pcm_format_t) 36) /* in three bytes */ ++#define SNDRV_PCM_FORMAT_S20_3BE ((__force snd_pcm_format_t) 37) /* in three bytes */ ++#define SNDRV_PCM_FORMAT_U20_3LE ((__force snd_pcm_format_t) 38) /* in three bytes */ ++#define SNDRV_PCM_FORMAT_U20_3BE ((__force snd_pcm_format_t) 39) /* in three bytes */ ++#define SNDRV_PCM_FORMAT_S18_3LE ((__force snd_pcm_format_t) 40) /* in three bytes */ ++#define SNDRV_PCM_FORMAT_S18_3BE ((__force snd_pcm_format_t) 41) /* in three bytes */ ++#define SNDRV_PCM_FORMAT_U18_3LE ((__force snd_pcm_format_t) 42) /* in three bytes */ ++#define SNDRV_PCM_FORMAT_U18_3BE ((__force snd_pcm_format_t) 43) /* in three bytes */ ++#define SNDRV_PCM_FORMAT_G723_24 ((__force snd_pcm_format_t) 44) /* 8 samples in 3 bytes */ ++#define SNDRV_PCM_FORMAT_G723_24_1B ((__force snd_pcm_format_t) 45) /* 1 sample in 1 byte */ ++#define SNDRV_PCM_FORMAT_G723_40 ((__force snd_pcm_format_t) 46) /* 8 Samples in 5 bytes */ ++#define SNDRV_PCM_FORMAT_G723_40_1B ((__force snd_pcm_format_t) 47) /* 1 sample in 1 byte */ ++#define SNDRV_PCM_FORMAT_DSD_U8 ((__force snd_pcm_format_t) 48) /* DSD, 1-byte samples DSD (x8) */ ++#define SNDRV_PCM_FORMAT_DSD_U16_LE ((__force snd_pcm_format_t) 49) /* DSD, 2-byte samples DSD (x16), little endian */ ++#define SNDRV_PCM_FORMAT_DSD_U32_LE ((__force snd_pcm_format_t) 50) /* DSD, 4-byte samples DSD (x32), little endian */ ++#define SNDRV_PCM_FORMAT_DSD_U16_BE ((__force snd_pcm_format_t) 51) /* DSD, 2-byte samples DSD (x16), big endian */ ++#define SNDRV_PCM_FORMAT_DSD_U32_BE ((__force snd_pcm_format_t) 52) /* DSD, 4-byte samples DSD (x32), big endian */ ++#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U32_BE ++#define SNDRV_PCM_FORMAT_FIRST SNDRV_PCM_FORMAT_S8 ++ ++#ifdef SNDRV_LITTLE_ENDIAN ++#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE ++#define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_LE ++#define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_LE ++#define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_LE ++#define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_LE ++#define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_LE ++#define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_LE ++#define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_LE ++#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE ++#define SNDRV_PCM_FORMAT_S20 SNDRV_PCM_FORMAT_S20_LE ++#define SNDRV_PCM_FORMAT_U20 SNDRV_PCM_FORMAT_U20_LE ++#endif ++#ifdef SNDRV_BIG_ENDIAN ++#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_BE ++#define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_BE ++#define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_BE ++#define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_BE ++#define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_BE ++#define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_BE ++#define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_BE ++#define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_BE ++#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE ++#define SNDRV_PCM_FORMAT_S20 SNDRV_PCM_FORMAT_S20_BE ++#define SNDRV_PCM_FORMAT_U20 SNDRV_PCM_FORMAT_U20_BE ++#endif ++ ++typedef int __bitwise snd_pcm_subformat_t; ++#define SNDRV_PCM_SUBFORMAT_STD ((__force snd_pcm_subformat_t) 0) ++#define SNDRV_PCM_SUBFORMAT_LAST SNDRV_PCM_SUBFORMAT_STD ++ ++#define SNDRV_PCM_INFO_MMAP 0x00000001 /* hardware supports mmap */ ++#define SNDRV_PCM_INFO_MMAP_VALID 0x00000002 /* period data are valid during transfer */ ++#define SNDRV_PCM_INFO_DOUBLE 0x00000004 /* Double buffering needed for PCM start/stop */ ++#define SNDRV_PCM_INFO_BATCH 0x00000010 /* double buffering */ ++#define SNDRV_PCM_INFO_SYNC_APPLPTR 0x00000020 /* need the explicit sync of appl_ptr update */ ++#define SNDRV_PCM_INFO_INTERLEAVED 0x00000100 /* channels are interleaved */ ++#define SNDRV_PCM_INFO_NONINTERLEAVED 0x00000200 /* channels are not interleaved */ ++#define SNDRV_PCM_INFO_COMPLEX 0x00000400 /* complex frame organization (mmap only) */ ++#define SNDRV_PCM_INFO_BLOCK_TRANSFER 0x00010000 /* hardware transfer block of samples */ ++#define SNDRV_PCM_INFO_OVERRANGE 0x00020000 /* hardware supports ADC (capture) overrange detection */ ++#define SNDRV_PCM_INFO_RESUME 0x00040000 /* hardware supports stream resume after suspend */ ++#define SNDRV_PCM_INFO_PAUSE 0x00080000 /* pause ioctl is supported */ ++#define SNDRV_PCM_INFO_HALF_DUPLEX 0x00100000 /* only half duplex */ ++#define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000 /* playback and capture stream are somewhat correlated */ ++#define SNDRV_PCM_INFO_SYNC_START 0x00400000 /* pcm support some kind of sync go */ ++#define SNDRV_PCM_INFO_NO_PERIOD_WAKEUP 0x00800000 /* period wakeup can be disabled */ ++#define SNDRV_PCM_INFO_HAS_WALL_CLOCK 0x01000000 /* (Deprecated)has audio wall clock for audio/system time sync */ ++#define SNDRV_PCM_INFO_HAS_LINK_ATIME 0x01000000 /* report hardware link audio time, reset on startup */ ++#define SNDRV_PCM_INFO_HAS_LINK_ABSOLUTE_ATIME 0x02000000 /* report absolute hardware link audio time, not reset on startup */ ++#define SNDRV_PCM_INFO_HAS_LINK_ESTIMATED_ATIME 0x04000000 /* report estimated link audio time */ ++#define SNDRV_PCM_INFO_HAS_LINK_SYNCHRONIZED_ATIME 0x08000000 /* report synchronized audio/system time */ ++ ++#define SNDRV_PCM_INFO_DRAIN_TRIGGER 0x40000000 /* internal kernel flag - trigger in drain */ ++#define SNDRV_PCM_INFO_FIFO_IN_FRAMES 0x80000000 /* internal kernel flag - FIFO size is in frames */ ++ ++ ++ ++typedef int __bitwise snd_pcm_state_t; ++#define SNDRV_PCM_STATE_OPEN ((__force snd_pcm_state_t) 0) /* stream is open */ ++#define SNDRV_PCM_STATE_SETUP ((__force snd_pcm_state_t) 1) /* stream has a setup */ ++#define SNDRV_PCM_STATE_PREPARED ((__force snd_pcm_state_t) 2) /* stream is ready to start */ ++#define SNDRV_PCM_STATE_RUNNING ((__force snd_pcm_state_t) 3) /* stream is running */ ++#define SNDRV_PCM_STATE_XRUN ((__force snd_pcm_state_t) 4) /* stream reached an xrun */ ++#define SNDRV_PCM_STATE_DRAINING ((__force snd_pcm_state_t) 5) /* stream is draining */ ++#define SNDRV_PCM_STATE_PAUSED ((__force snd_pcm_state_t) 6) /* stream is paused */ ++#define SNDRV_PCM_STATE_SUSPENDED ((__force snd_pcm_state_t) 7) /* hardware is suspended */ ++#define SNDRV_PCM_STATE_DISCONNECTED ((__force snd_pcm_state_t) 8) /* hardware is disconnected */ ++#define SNDRV_PCM_STATE_LAST SNDRV_PCM_STATE_DISCONNECTED ++ ++enum { ++ SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000, ++ SNDRV_PCM_MMAP_OFFSET_STATUS = 0x80000000, ++ SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000, ++}; ++ ++union snd_pcm_sync_id { ++ unsigned char id[16]; ++ unsigned short id16[8]; ++ unsigned int id32[4]; ++}; ++ ++struct snd_pcm_info { ++ unsigned int device; /* RO/WR (control): device number */ ++ unsigned int subdevice; /* RO/WR (control): subdevice number */ ++ int stream; /* RO/WR (control): stream direction */ ++ int card; /* R: card number */ ++ unsigned char id[64]; /* ID (user selectable) */ ++ unsigned char name[80]; /* name of this device */ ++ unsigned char subname[32]; /* subdevice name */ ++ int dev_class; /* SNDRV_PCM_CLASS_* */ ++ int dev_subclass; /* SNDRV_PCM_SUBCLASS_* */ ++ unsigned int subdevices_count; ++ unsigned int subdevices_avail; ++ union snd_pcm_sync_id sync; /* hardware synchronization ID */ ++ unsigned char reserved[64]; /* reserved for future... */ ++}; ++ ++typedef int snd_pcm_hw_param_t; ++#define SNDRV_PCM_HW_PARAM_ACCESS 0 /* Access type */ ++#define SNDRV_PCM_HW_PARAM_FORMAT 1 /* Format */ ++#define SNDRV_PCM_HW_PARAM_SUBFORMAT 2 /* Subformat */ ++#define SNDRV_PCM_HW_PARAM_FIRST_MASK SNDRV_PCM_HW_PARAM_ACCESS ++#define SNDRV_PCM_HW_PARAM_LAST_MASK SNDRV_PCM_HW_PARAM_SUBFORMAT ++ ++#define SNDRV_PCM_HW_PARAM_SAMPLE_BITS 8 /* Bits per sample */ ++#define SNDRV_PCM_HW_PARAM_FRAME_BITS 9 /* Bits per frame */ ++#define SNDRV_PCM_HW_PARAM_CHANNELS 10 /* Channels */ ++#define SNDRV_PCM_HW_PARAM_RATE 11 /* Approx rate */ ++#define SNDRV_PCM_HW_PARAM_PERIOD_TIME 12 /* Approx distance between ++ * interrupts in us ++ */ ++#define SNDRV_PCM_HW_PARAM_PERIOD_SIZE 13 /* Approx frames between ++ * interrupts ++ */ ++#define SNDRV_PCM_HW_PARAM_PERIOD_BYTES 14 /* Approx bytes between ++ * interrupts ++ */ ++#define SNDRV_PCM_HW_PARAM_PERIODS 15 /* Approx interrupts per ++ * buffer ++ */ ++#define SNDRV_PCM_HW_PARAM_BUFFER_TIME 16 /* Approx duration of buffer ++ * in us ++ */ ++#define SNDRV_PCM_HW_PARAM_BUFFER_SIZE 17 /* Size of buffer in frames */ ++#define SNDRV_PCM_HW_PARAM_BUFFER_BYTES 18 /* Size of buffer in bytes */ ++#define SNDRV_PCM_HW_PARAM_TICK_TIME 19 /* Approx tick duration in us */ ++#define SNDRV_PCM_HW_PARAM_FIRST_INTERVAL SNDRV_PCM_HW_PARAM_SAMPLE_BITS ++#define SNDRV_PCM_HW_PARAM_LAST_INTERVAL SNDRV_PCM_HW_PARAM_TICK_TIME ++ ++#define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */ ++#define SNDRV_PCM_HW_PARAMS_EXPORT_BUFFER (1<<1) /* export buffer */ ++#define SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP (1<<2) /* disable period wakeups */ ++ ++struct snd_interval { ++ unsigned int min, max; ++ unsigned int openmin:1, ++ openmax:1, ++ integer:1, ++ empty:1; ++}; ++ ++#define SNDRV_MASK_MAX 256 ++ ++struct snd_mask { ++ __u32 bits[(SNDRV_MASK_MAX+31)/32]; ++}; ++ ++struct snd_pcm_hw_params { ++ unsigned int flags; ++ struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK - ++ SNDRV_PCM_HW_PARAM_FIRST_MASK + 1]; ++ struct snd_mask mres[5]; /* reserved masks */ ++ struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL - ++ SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1]; ++ struct snd_interval ires[9]; /* reserved intervals */ ++ unsigned int rmask; /* W: requested masks */ ++ unsigned int cmask; /* R: changed masks */ ++ unsigned int info; /* R: Info flags for returned setup */ ++ unsigned int msbits; /* R: used most significant bits */ ++ unsigned int rate_num; /* R: rate numerator */ ++ unsigned int rate_den; /* R: rate denominator */ ++ snd_pcm_uframes_t fifo_size; /* R: chip FIFO size in frames */ ++ unsigned char reserved[64]; /* reserved for future */ ++}; ++ ++enum { ++ SNDRV_PCM_TSTAMP_NONE = 0, ++ SNDRV_PCM_TSTAMP_ENABLE, ++ SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_ENABLE, ++}; ++ ++struct snd_pcm_sw_params { ++ int tstamp_mode; /* timestamp mode */ ++ unsigned int period_step; ++ unsigned int sleep_min; /* min ticks to sleep */ ++ snd_pcm_uframes_t avail_min; /* min avail frames for wakeup */ ++ snd_pcm_uframes_t xfer_align; /* obsolete: xfer size need to be a multiple */ ++ snd_pcm_uframes_t start_threshold; /* min hw_avail frames for automatic start */ ++ snd_pcm_uframes_t stop_threshold; /* min avail frames for automatic stop */ ++ snd_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */ ++ snd_pcm_uframes_t silence_size; /* silence block size */ ++ snd_pcm_uframes_t boundary; /* pointers wrap point */ ++ unsigned int proto; /* protocol version */ ++ unsigned int tstamp_type; /* timestamp type (req. proto >= 2.0.12) */ ++ unsigned char reserved[56]; /* reserved for future */ ++}; ++ ++struct snd_pcm_channel_info { ++ unsigned int channel; ++ __kernel_off_t offset; /* mmap offset */ ++ unsigned int first; /* offset to first sample in bits */ ++ unsigned int step; /* samples distance in bits */ ++}; ++ ++enum { ++ /* ++ * first definition for backwards compatibility only, ++ * maps to wallclock/link time for HDAudio playback and DEFAULT/DMA time for everything else ++ */ ++ SNDRV_PCM_AUDIO_TSTAMP_TYPE_COMPAT = 0, ++ ++ /* timestamp definitions */ ++ SNDRV_PCM_AUDIO_TSTAMP_TYPE_DEFAULT = 1, /* DMA time, reported as per hw_ptr */ ++ SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK = 2, /* link time reported by sample or wallclock counter, reset on startup */ ++ SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_ABSOLUTE = 3, /* link time reported by sample or wallclock counter, not reset on startup */ ++ SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_ESTIMATED = 4, /* link time estimated indirectly */ ++ SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED = 5, /* link time synchronized with system time */ ++ SNDRV_PCM_AUDIO_TSTAMP_TYPE_LAST = SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED ++}; ++ ++struct snd_pcm_status { ++ snd_pcm_state_t state; /* stream state */ ++ struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */ ++ struct timespec tstamp; /* reference timestamp */ ++ snd_pcm_uframes_t appl_ptr; /* appl ptr */ ++ snd_pcm_uframes_t hw_ptr; /* hw ptr */ ++ snd_pcm_sframes_t delay; /* current delay in frames */ ++ snd_pcm_uframes_t avail; /* number of frames available */ ++ snd_pcm_uframes_t avail_max; /* max frames available on hw since last status */ ++ snd_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */ ++ snd_pcm_state_t suspended_state; /* suspended stream state */ ++ __u32 audio_tstamp_data; /* needed for 64-bit alignment, used for configs/report to/from userspace */ ++ struct timespec audio_tstamp; /* sample counter, wall clock, PHC or on-demand sync'ed */ ++ struct timespec driver_tstamp; /* useful in case reference system tstamp is reported with delay */ ++ __u32 audio_tstamp_accuracy; /* in ns units, only valid if indicated in audio_tstamp_data */ ++ unsigned char reserved[52-2*sizeof(struct timespec)]; /* must be filled with zero */ ++}; ++ ++struct snd_pcm_mmap_status { ++ snd_pcm_state_t state; /* RO: state - SNDRV_PCM_STATE_XXXX */ ++ int pad1; /* Needed for 64 bit alignment */ ++ snd_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */ ++ struct timespec tstamp; /* Timestamp */ ++ snd_pcm_state_t suspended_state; /* RO: suspended stream state */ ++ struct timespec audio_tstamp; /* from sample counter or wall clock */ ++}; ++ ++struct snd_pcm_mmap_control { ++ snd_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */ ++ snd_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */ ++}; ++ ++#define SNDRV_PCM_SYNC_PTR_HWSYNC (1<<0) /* execute hwsync */ ++#define SNDRV_PCM_SYNC_PTR_APPL (1<<1) /* get appl_ptr from driver (r/w op) */ ++#define SNDRV_PCM_SYNC_PTR_AVAIL_MIN (1<<2) /* get avail_min from driver */ ++ ++struct snd_pcm_sync_ptr { ++ unsigned int flags; ++ union { ++ struct snd_pcm_mmap_status status; ++ unsigned char reserved[64]; ++ } s; ++ union { ++ struct snd_pcm_mmap_control control; ++ unsigned char reserved[64]; ++ } c; ++}; ++ ++struct snd_xferi { ++ snd_pcm_sframes_t result; ++ void __user *buf; ++ snd_pcm_uframes_t frames; ++}; ++ ++struct snd_xfern { ++ snd_pcm_sframes_t result; ++ void __user * __user *bufs; ++ snd_pcm_uframes_t frames; ++}; ++ ++enum { ++ SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, /* gettimeofday equivalent */ ++ SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, /* posix_clock_monotonic equivalent */ ++ SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW, /* monotonic_raw (no NTP) */ ++ SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW, ++}; ++ ++/* channel positions */ ++enum { ++ SNDRV_CHMAP_UNKNOWN = 0, ++ SNDRV_CHMAP_NA, /* N/A, silent */ ++ SNDRV_CHMAP_MONO, /* mono stream */ ++ /* this follows the alsa-lib mixer channel value + 3 */ ++ SNDRV_CHMAP_FL, /* front left */ ++ SNDRV_CHMAP_FR, /* front right */ ++ SNDRV_CHMAP_RL, /* rear left */ ++ SNDRV_CHMAP_RR, /* rear right */ ++ SNDRV_CHMAP_FC, /* front center */ ++ SNDRV_CHMAP_LFE, /* LFE */ ++ SNDRV_CHMAP_SL, /* side left */ ++ SNDRV_CHMAP_SR, /* side right */ ++ SNDRV_CHMAP_RC, /* rear center */ ++ /* new definitions */ ++ SNDRV_CHMAP_FLC, /* front left center */ ++ SNDRV_CHMAP_FRC, /* front right center */ ++ SNDRV_CHMAP_RLC, /* rear left center */ ++ SNDRV_CHMAP_RRC, /* rear right center */ ++ SNDRV_CHMAP_FLW, /* front left wide */ ++ SNDRV_CHMAP_FRW, /* front right wide */ ++ SNDRV_CHMAP_FLH, /* front left high */ ++ SNDRV_CHMAP_FCH, /* front center high */ ++ SNDRV_CHMAP_FRH, /* front right high */ ++ SNDRV_CHMAP_TC, /* top center */ ++ SNDRV_CHMAP_TFL, /* top front left */ ++ SNDRV_CHMAP_TFR, /* top front right */ ++ SNDRV_CHMAP_TFC, /* top front center */ ++ SNDRV_CHMAP_TRL, /* top rear left */ ++ SNDRV_CHMAP_TRR, /* top rear right */ ++ SNDRV_CHMAP_TRC, /* top rear center */ ++ /* new definitions for UAC2 */ ++ SNDRV_CHMAP_TFLC, /* top front left center */ ++ SNDRV_CHMAP_TFRC, /* top front right center */ ++ SNDRV_CHMAP_TSL, /* top side left */ ++ SNDRV_CHMAP_TSR, /* top side right */ ++ SNDRV_CHMAP_LLFE, /* left LFE */ ++ SNDRV_CHMAP_RLFE, /* right LFE */ ++ SNDRV_CHMAP_BC, /* bottom center */ ++ SNDRV_CHMAP_BLC, /* bottom left center */ ++ SNDRV_CHMAP_BRC, /* bottom right center */ ++ SNDRV_CHMAP_LAST = SNDRV_CHMAP_BRC, ++}; ++ ++#define SNDRV_CHMAP_POSITION_MASK 0xffff ++#define SNDRV_CHMAP_PHASE_INVERSE (0x01 << 16) ++#define SNDRV_CHMAP_DRIVER_SPEC (0x02 << 16) ++ ++#define SNDRV_PCM_IOCTL_PVERSION _IOR('A', 0x00, int) ++#define SNDRV_PCM_IOCTL_INFO _IOR('A', 0x01, struct snd_pcm_info) ++#define SNDRV_PCM_IOCTL_TSTAMP _IOW('A', 0x02, int) ++#define SNDRV_PCM_IOCTL_TTSTAMP _IOW('A', 0x03, int) ++#define SNDRV_PCM_IOCTL_USER_PVERSION _IOW('A', 0x04, int) ++#define SNDRV_PCM_IOCTL_HW_REFINE _IOWR('A', 0x10, struct snd_pcm_hw_params) ++#define SNDRV_PCM_IOCTL_HW_PARAMS _IOWR('A', 0x11, struct snd_pcm_hw_params) ++#define SNDRV_PCM_IOCTL_HW_FREE _IO('A', 0x12) ++#define SNDRV_PCM_IOCTL_SW_PARAMS _IOWR('A', 0x13, struct snd_pcm_sw_params) ++#define SNDRV_PCM_IOCTL_STATUS _IOR('A', 0x20, struct snd_pcm_status) ++#define SNDRV_PCM_IOCTL_DELAY _IOR('A', 0x21, snd_pcm_sframes_t) ++#define SNDRV_PCM_IOCTL_HWSYNC _IO('A', 0x22) ++#define SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct snd_pcm_sync_ptr) ++#define SNDRV_PCM_IOCTL_STATUS_EXT _IOWR('A', 0x24, struct snd_pcm_status) ++#define SNDRV_PCM_IOCTL_CHANNEL_INFO _IOR('A', 0x32, struct snd_pcm_channel_info) ++#define SNDRV_PCM_IOCTL_PREPARE _IO('A', 0x40) ++#define SNDRV_PCM_IOCTL_RESET _IO('A', 0x41) ++#define SNDRV_PCM_IOCTL_START _IO('A', 0x42) ++#define SNDRV_PCM_IOCTL_DROP _IO('A', 0x43) ++#define SNDRV_PCM_IOCTL_DRAIN _IO('A', 0x44) ++#define SNDRV_PCM_IOCTL_PAUSE _IOW('A', 0x45, int) ++#define SNDRV_PCM_IOCTL_REWIND _IOW('A', 0x46, snd_pcm_uframes_t) ++#define SNDRV_PCM_IOCTL_RESUME _IO('A', 0x47) ++#define SNDRV_PCM_IOCTL_XRUN _IO('A', 0x48) ++#define SNDRV_PCM_IOCTL_FORWARD _IOW('A', 0x49, snd_pcm_uframes_t) ++#define SNDRV_PCM_IOCTL_WRITEI_FRAMES _IOW('A', 0x50, struct snd_xferi) ++#define SNDRV_PCM_IOCTL_READI_FRAMES _IOR('A', 0x51, struct snd_xferi) ++#define SNDRV_PCM_IOCTL_WRITEN_FRAMES _IOW('A', 0x52, struct snd_xfern) ++#define SNDRV_PCM_IOCTL_READN_FRAMES _IOR('A', 0x53, struct snd_xfern) ++#define SNDRV_PCM_IOCTL_LINK _IOW('A', 0x60, int) ++#define SNDRV_PCM_IOCTL_UNLINK _IO('A', 0x61) ++ ++/***************************************************************************** ++ * * ++ * MIDI v1.0 interface * ++ * * ++ *****************************************************************************/ ++ ++/* ++ * Raw MIDI section - /dev/snd/midi?? ++ */ ++ ++#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0) ++ ++enum { ++ SNDRV_RAWMIDI_STREAM_OUTPUT = 0, ++ SNDRV_RAWMIDI_STREAM_INPUT, ++ SNDRV_RAWMIDI_STREAM_LAST = SNDRV_RAWMIDI_STREAM_INPUT, ++}; ++ ++#define SNDRV_RAWMIDI_INFO_OUTPUT 0x00000001 ++#define SNDRV_RAWMIDI_INFO_INPUT 0x00000002 ++#define SNDRV_RAWMIDI_INFO_DUPLEX 0x00000004 ++ ++struct snd_rawmidi_info { ++ unsigned int device; /* RO/WR (control): device number */ ++ unsigned int subdevice; /* RO/WR (control): subdevice number */ ++ int stream; /* WR: stream */ ++ int card; /* R: card number */ ++ unsigned int flags; /* SNDRV_RAWMIDI_INFO_XXXX */ ++ unsigned char id[64]; /* ID (user selectable) */ ++ unsigned char name[80]; /* name of device */ ++ unsigned char subname[32]; /* name of active or selected subdevice */ ++ unsigned int subdevices_count; ++ unsigned int subdevices_avail; ++ unsigned char reserved[64]; /* reserved for future use */ ++}; ++ ++struct snd_rawmidi_params { ++ int stream; ++ size_t buffer_size; /* queue size in bytes */ ++ size_t avail_min; /* minimum avail bytes for wakeup */ ++ unsigned int no_active_sensing: 1; /* do not send active sensing byte in close() */ ++ unsigned char reserved[16]; /* reserved for future use */ ++}; ++ ++struct snd_rawmidi_status { ++ int stream; ++ struct timespec tstamp; /* Timestamp */ ++ size_t avail; /* available bytes */ ++ size_t xruns; /* count of overruns since last status (in bytes) */ ++ unsigned char reserved[16]; /* reserved for future use */ ++}; ++ ++#define SNDRV_RAWMIDI_IOCTL_PVERSION _IOR('W', 0x00, int) ++#define SNDRV_RAWMIDI_IOCTL_INFO _IOR('W', 0x01, struct snd_rawmidi_info) ++#define SNDRV_RAWMIDI_IOCTL_PARAMS _IOWR('W', 0x10, struct snd_rawmidi_params) ++#define SNDRV_RAWMIDI_IOCTL_STATUS _IOWR('W', 0x20, struct snd_rawmidi_status) ++#define SNDRV_RAWMIDI_IOCTL_DROP _IOW('W', 0x30, int) ++#define SNDRV_RAWMIDI_IOCTL_DRAIN _IOW('W', 0x31, int) ++ ++/* ++ * Timer section - /dev/snd/timer ++ */ ++ ++#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 6) ++ ++enum { ++ SNDRV_TIMER_CLASS_NONE = -1, ++ SNDRV_TIMER_CLASS_SLAVE = 0, ++ SNDRV_TIMER_CLASS_GLOBAL, ++ SNDRV_TIMER_CLASS_CARD, ++ SNDRV_TIMER_CLASS_PCM, ++ SNDRV_TIMER_CLASS_LAST = SNDRV_TIMER_CLASS_PCM, ++}; ++ ++/* slave timer classes */ ++enum { ++ SNDRV_TIMER_SCLASS_NONE = 0, ++ SNDRV_TIMER_SCLASS_APPLICATION, ++ SNDRV_TIMER_SCLASS_SEQUENCER, /* alias */ ++ SNDRV_TIMER_SCLASS_OSS_SEQUENCER, /* alias */ ++ SNDRV_TIMER_SCLASS_LAST = SNDRV_TIMER_SCLASS_OSS_SEQUENCER, ++}; ++ ++/* global timers (device member) */ ++#define SNDRV_TIMER_GLOBAL_SYSTEM 0 ++#define SNDRV_TIMER_GLOBAL_RTC 1 /* unused */ ++#define SNDRV_TIMER_GLOBAL_HPET 2 ++#define SNDRV_TIMER_GLOBAL_HRTIMER 3 ++ ++/* info flags */ ++#define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */ ++ ++struct snd_timer_id { ++ int dev_class; ++ int dev_sclass; ++ int card; ++ int device; ++ int subdevice; ++}; ++ ++struct snd_timer_ginfo { ++ struct snd_timer_id tid; /* requested timer ID */ ++ unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */ ++ int card; /* card number */ ++ unsigned char id[64]; /* timer identification */ ++ unsigned char name[80]; /* timer name */ ++ unsigned long reserved0; /* reserved for future use */ ++ unsigned long resolution; /* average period resolution in ns */ ++ unsigned long resolution_min; /* minimal period resolution in ns */ ++ unsigned long resolution_max; /* maximal period resolution in ns */ ++ unsigned int clients; /* active timer clients */ ++ unsigned char reserved[32]; ++}; ++ ++struct snd_timer_gparams { ++ struct snd_timer_id tid; /* requested timer ID */ ++ unsigned long period_num; /* requested precise period duration (in seconds) - numerator */ ++ unsigned long period_den; /* requested precise period duration (in seconds) - denominator */ ++ unsigned char reserved[32]; ++}; ++ ++struct snd_timer_gstatus { ++ struct snd_timer_id tid; /* requested timer ID */ ++ unsigned long resolution; /* current period resolution in ns */ ++ unsigned long resolution_num; /* precise current period resolution (in seconds) - numerator */ ++ unsigned long resolution_den; /* precise current period resolution (in seconds) - denominator */ ++ unsigned char reserved[32]; ++}; ++ ++struct snd_timer_select { ++ struct snd_timer_id id; /* bind to timer ID */ ++ unsigned char reserved[32]; /* reserved */ ++}; ++ ++struct snd_timer_info { ++ unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */ ++ int card; /* card number */ ++ unsigned char id[64]; /* timer identificator */ ++ unsigned char name[80]; /* timer name */ ++ unsigned long reserved0; /* reserved for future use */ ++ unsigned long resolution; /* average period resolution in ns */ ++ unsigned char reserved[64]; /* reserved */ ++}; ++ ++#define SNDRV_TIMER_PSFLG_AUTO (1<<0) /* auto start, otherwise one-shot */ ++#define SNDRV_TIMER_PSFLG_EXCLUSIVE (1<<1) /* exclusive use, precise start/stop/pause/continue */ ++#define SNDRV_TIMER_PSFLG_EARLY_EVENT (1<<2) /* write early event to the poll queue */ ++ ++struct snd_timer_params { ++ unsigned int flags; /* flags - SNDRV_TIMER_PSFLG_* */ ++ unsigned int ticks; /* requested resolution in ticks */ ++ unsigned int queue_size; /* total size of queue (32-1024) */ ++ unsigned int reserved0; /* reserved, was: failure locations */ ++ unsigned int filter; /* event filter (bitmask of SNDRV_TIMER_EVENT_*) */ ++ unsigned char reserved[60]; /* reserved */ ++}; ++ ++struct snd_timer_status { ++ struct timespec tstamp; /* Timestamp - last update */ ++ unsigned int resolution; /* current period resolution in ns */ ++ unsigned int lost; /* counter of master tick lost */ ++ unsigned int overrun; /* count of read queue overruns */ ++ unsigned int queue; /* used queue size */ ++ unsigned char reserved[64]; /* reserved */ ++}; ++ ++#define SNDRV_TIMER_IOCTL_PVERSION _IOR('T', 0x00, int) ++#define SNDRV_TIMER_IOCTL_NEXT_DEVICE _IOWR('T', 0x01, struct snd_timer_id) ++#define SNDRV_TIMER_IOCTL_TREAD _IOW('T', 0x02, int) ++#define SNDRV_TIMER_IOCTL_GINFO _IOWR('T', 0x03, struct snd_timer_ginfo) ++#define SNDRV_TIMER_IOCTL_GPARAMS _IOW('T', 0x04, struct snd_timer_gparams) ++#define SNDRV_TIMER_IOCTL_GSTATUS _IOWR('T', 0x05, struct snd_timer_gstatus) ++#define SNDRV_TIMER_IOCTL_SELECT _IOW('T', 0x10, struct snd_timer_select) ++#define SNDRV_TIMER_IOCTL_INFO _IOR('T', 0x11, struct snd_timer_info) ++#define SNDRV_TIMER_IOCTL_PARAMS _IOW('T', 0x12, struct snd_timer_params) ++#define SNDRV_TIMER_IOCTL_STATUS _IOR('T', 0x14, struct snd_timer_status) ++/* The following four ioctls are changed since 1.0.9 due to confliction */ ++#define SNDRV_TIMER_IOCTL_START _IO('T', 0xa0) ++#define SNDRV_TIMER_IOCTL_STOP _IO('T', 0xa1) ++#define SNDRV_TIMER_IOCTL_CONTINUE _IO('T', 0xa2) ++#define SNDRV_TIMER_IOCTL_PAUSE _IO('T', 0xa3) ++ ++struct snd_timer_read { ++ unsigned int resolution; ++ unsigned int ticks; ++}; ++ ++enum { ++ SNDRV_TIMER_EVENT_RESOLUTION = 0, /* val = resolution in ns */ ++ SNDRV_TIMER_EVENT_TICK, /* val = ticks */ ++ SNDRV_TIMER_EVENT_START, /* val = resolution in ns */ ++ SNDRV_TIMER_EVENT_STOP, /* val = 0 */ ++ SNDRV_TIMER_EVENT_CONTINUE, /* val = resolution in ns */ ++ SNDRV_TIMER_EVENT_PAUSE, /* val = 0 */ ++ SNDRV_TIMER_EVENT_EARLY, /* val = 0, early event */ ++ SNDRV_TIMER_EVENT_SUSPEND, /* val = 0 */ ++ SNDRV_TIMER_EVENT_RESUME, /* val = resolution in ns */ ++ /* master timer events for slave timer instances */ ++ SNDRV_TIMER_EVENT_MSTART = SNDRV_TIMER_EVENT_START + 10, ++ SNDRV_TIMER_EVENT_MSTOP = SNDRV_TIMER_EVENT_STOP + 10, ++ SNDRV_TIMER_EVENT_MCONTINUE = SNDRV_TIMER_EVENT_CONTINUE + 10, ++ SNDRV_TIMER_EVENT_MPAUSE = SNDRV_TIMER_EVENT_PAUSE + 10, ++ SNDRV_TIMER_EVENT_MSUSPEND = SNDRV_TIMER_EVENT_SUSPEND + 10, ++ SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10, ++}; ++ ++struct snd_timer_tread { ++ int event; ++ struct timespec tstamp; ++ unsigned int val; ++}; ++ ++/**************************************************************************** ++ * * ++ * Section for driver control interface - /dev/snd/control? * ++ * * ++ ****************************************************************************/ ++ ++#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7) ++ ++struct snd_ctl_card_info { ++ int card; /* card number */ ++ int pad; /* reserved for future (was type) */ ++ unsigned char id[16]; /* ID of card (user selectable) */ ++ unsigned char driver[16]; /* Driver name */ ++ unsigned char name[32]; /* Short name of soundcard */ ++ unsigned char longname[80]; /* name + info text about soundcard */ ++ unsigned char reserved_[16]; /* reserved for future (was ID of mixer) */ ++ unsigned char mixername[80]; /* visual mixer identification */ ++ unsigned char components[128]; /* card components / fine identification, delimited with one space (AC97 etc..) */ ++}; ++ ++typedef int __bitwise snd_ctl_elem_type_t; ++#define SNDRV_CTL_ELEM_TYPE_NONE ((__force snd_ctl_elem_type_t) 0) /* invalid */ ++#define SNDRV_CTL_ELEM_TYPE_BOOLEAN ((__force snd_ctl_elem_type_t) 1) /* boolean type */ ++#define SNDRV_CTL_ELEM_TYPE_INTEGER ((__force snd_ctl_elem_type_t) 2) /* integer type */ ++#define SNDRV_CTL_ELEM_TYPE_ENUMERATED ((__force snd_ctl_elem_type_t) 3) /* enumerated type */ ++#define SNDRV_CTL_ELEM_TYPE_BYTES ((__force snd_ctl_elem_type_t) 4) /* byte array */ ++#define SNDRV_CTL_ELEM_TYPE_IEC958 ((__force snd_ctl_elem_type_t) 5) /* IEC958 (S/PDIF) setup */ ++#define SNDRV_CTL_ELEM_TYPE_INTEGER64 ((__force snd_ctl_elem_type_t) 6) /* 64-bit integer type */ ++#define SNDRV_CTL_ELEM_TYPE_LAST SNDRV_CTL_ELEM_TYPE_INTEGER64 ++ ++typedef int __bitwise snd_ctl_elem_iface_t; ++#define SNDRV_CTL_ELEM_IFACE_CARD ((__force snd_ctl_elem_iface_t) 0) /* global control */ ++#define SNDRV_CTL_ELEM_IFACE_HWDEP ((__force snd_ctl_elem_iface_t) 1) /* hardware dependent device */ ++#define SNDRV_CTL_ELEM_IFACE_MIXER ((__force snd_ctl_elem_iface_t) 2) /* virtual mixer device */ ++#define SNDRV_CTL_ELEM_IFACE_PCM ((__force snd_ctl_elem_iface_t) 3) /* PCM device */ ++#define SNDRV_CTL_ELEM_IFACE_RAWMIDI ((__force snd_ctl_elem_iface_t) 4) /* RawMidi device */ ++#define SNDRV_CTL_ELEM_IFACE_TIMER ((__force snd_ctl_elem_iface_t) 5) /* timer device */ ++#define SNDRV_CTL_ELEM_IFACE_SEQUENCER ((__force snd_ctl_elem_iface_t) 6) /* sequencer client */ ++#define SNDRV_CTL_ELEM_IFACE_LAST SNDRV_CTL_ELEM_IFACE_SEQUENCER ++ ++#define SNDRV_CTL_ELEM_ACCESS_READ (1<<0) ++#define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1) ++#define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE) ++#define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */ ++#define SNDRV_CTL_ELEM_ACCESS_TIMESTAMP (1<<3) /* when was control changed */ ++#define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1<<4) /* TLV read is possible */ ++#define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1<<5) /* TLV write is possible */ ++#define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE) ++#define SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND (1<<6) /* TLV command is possible */ ++#define SNDRV_CTL_ELEM_ACCESS_INACTIVE (1<<8) /* control does actually nothing, but may be updated */ ++#define SNDRV_CTL_ELEM_ACCESS_LOCK (1<<9) /* write lock */ ++#define SNDRV_CTL_ELEM_ACCESS_OWNER (1<<10) /* write lock owner */ ++#define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK (1<<28) /* kernel use a TLV callback */ ++#define SNDRV_CTL_ELEM_ACCESS_USER (1<<29) /* user space element */ ++/* bits 30 and 31 are obsoleted (for indirect access) */ ++ ++/* for further details see the ACPI and PCI power management specification */ ++#define SNDRV_CTL_POWER_D0 0x0000 /* full On */ ++#define SNDRV_CTL_POWER_D1 0x0100 /* partial On */ ++#define SNDRV_CTL_POWER_D2 0x0200 /* partial On */ ++#define SNDRV_CTL_POWER_D3 0x0300 /* Off */ ++#define SNDRV_CTL_POWER_D3hot (SNDRV_CTL_POWER_D3|0x0000) /* Off, with power */ ++#define SNDRV_CTL_POWER_D3cold (SNDRV_CTL_POWER_D3|0x0001) /* Off, without power */ ++ ++#define SNDRV_CTL_ELEM_ID_NAME_MAXLEN 44 ++ ++struct snd_ctl_elem_id { ++ unsigned int numid; /* numeric identifier, zero = invalid */ ++ snd_ctl_elem_iface_t iface; /* interface identifier */ ++ unsigned int device; /* device/client number */ ++ unsigned int subdevice; /* subdevice (substream) number */ ++ unsigned char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* ASCII name of item */ ++ unsigned int index; /* index of item */ ++}; ++ ++struct snd_ctl_elem_list { ++ unsigned int offset; /* W: first element ID to get */ ++ unsigned int space; /* W: count of element IDs to get */ ++ unsigned int used; /* R: count of element IDs set */ ++ unsigned int count; /* R: count of all elements */ ++ struct snd_ctl_elem_id __user *pids; /* R: IDs */ ++ unsigned char reserved[50]; ++}; ++ ++struct snd_ctl_elem_info { ++ struct snd_ctl_elem_id id; /* W: element ID */ ++ snd_ctl_elem_type_t type; /* R: value type - SNDRV_CTL_ELEM_TYPE_* */ ++ unsigned int access; /* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */ ++ unsigned int count; /* count of values */ ++ __kernel_pid_t owner; /* owner's PID of this control */ ++ union { ++ struct { ++ long min; /* R: minimum value */ ++ long max; /* R: maximum value */ ++ long step; /* R: step (0 variable) */ ++ } integer; ++ struct { ++ long long min; /* R: minimum value */ ++ long long max; /* R: maximum value */ ++ long long step; /* R: step (0 variable) */ ++ } integer64; ++ struct { ++ unsigned int items; /* R: number of items */ ++ unsigned int item; /* W: item number */ ++ char name[64]; /* R: value name */ ++ __u64 names_ptr; /* W: names list (ELEM_ADD only) */ ++ unsigned int names_length; ++ } enumerated; ++ unsigned char reserved[128]; ++ } value; ++ union { ++ unsigned short d[4]; /* dimensions */ ++ unsigned short *d_ptr; /* indirect - obsoleted */ ++ } dimen; ++ unsigned char reserved[64-4*sizeof(unsigned short)]; ++}; ++ ++struct snd_ctl_elem_value { ++ struct snd_ctl_elem_id id; /* W: element ID */ ++ unsigned int indirect: 1; /* W: indirect access - obsoleted */ ++ union { ++ union { ++ long value[128]; ++ long *value_ptr; /* obsoleted */ ++ } integer; ++ union { ++ long long value[64]; ++ long long *value_ptr; /* obsoleted */ ++ } integer64; ++ union { ++ unsigned int item[128]; ++ unsigned int *item_ptr; /* obsoleted */ ++ } enumerated; ++ union { ++ unsigned char data[512]; ++ unsigned char *data_ptr; /* obsoleted */ ++ } bytes; ++ struct snd_aes_iec958 iec958; ++ } value; /* RO */ ++ struct timespec tstamp; ++ unsigned char reserved[128-sizeof(struct timespec)]; ++}; ++ ++struct snd_ctl_tlv { ++ unsigned int numid; /* control element numeric identification */ ++ unsigned int length; /* in bytes aligned to 4 */ ++ unsigned int tlv[0]; /* first TLV */ ++}; ++ ++#define SNDRV_CTL_IOCTL_PVERSION _IOR('U', 0x00, int) ++#define SNDRV_CTL_IOCTL_CARD_INFO _IOR('U', 0x01, struct snd_ctl_card_info) ++#define SNDRV_CTL_IOCTL_ELEM_LIST _IOWR('U', 0x10, struct snd_ctl_elem_list) ++#define SNDRV_CTL_IOCTL_ELEM_INFO _IOWR('U', 0x11, struct snd_ctl_elem_info) ++#define SNDRV_CTL_IOCTL_ELEM_READ _IOWR('U', 0x12, struct snd_ctl_elem_value) ++#define SNDRV_CTL_IOCTL_ELEM_WRITE _IOWR('U', 0x13, struct snd_ctl_elem_value) ++#define SNDRV_CTL_IOCTL_ELEM_LOCK _IOW('U', 0x14, struct snd_ctl_elem_id) ++#define SNDRV_CTL_IOCTL_ELEM_UNLOCK _IOW('U', 0x15, struct snd_ctl_elem_id) ++#define SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS _IOWR('U', 0x16, int) ++#define SNDRV_CTL_IOCTL_ELEM_ADD _IOWR('U', 0x17, struct snd_ctl_elem_info) ++#define SNDRV_CTL_IOCTL_ELEM_REPLACE _IOWR('U', 0x18, struct snd_ctl_elem_info) ++#define SNDRV_CTL_IOCTL_ELEM_REMOVE _IOWR('U', 0x19, struct snd_ctl_elem_id) ++#define SNDRV_CTL_IOCTL_TLV_READ _IOWR('U', 0x1a, struct snd_ctl_tlv) ++#define SNDRV_CTL_IOCTL_TLV_WRITE _IOWR('U', 0x1b, struct snd_ctl_tlv) ++#define SNDRV_CTL_IOCTL_TLV_COMMAND _IOWR('U', 0x1c, struct snd_ctl_tlv) ++#define SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE _IOWR('U', 0x20, int) ++#define SNDRV_CTL_IOCTL_HWDEP_INFO _IOR('U', 0x21, struct snd_hwdep_info) ++#define SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE _IOR('U', 0x30, int) ++#define SNDRV_CTL_IOCTL_PCM_INFO _IOWR('U', 0x31, struct snd_pcm_info) ++#define SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE _IOW('U', 0x32, int) ++#define SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE _IOWR('U', 0x40, int) ++#define SNDRV_CTL_IOCTL_RAWMIDI_INFO _IOWR('U', 0x41, struct snd_rawmidi_info) ++#define SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE _IOW('U', 0x42, int) ++#define SNDRV_CTL_IOCTL_POWER _IOWR('U', 0xd0, int) ++#define SNDRV_CTL_IOCTL_POWER_STATE _IOR('U', 0xd1, int) ++ ++/* ++ * Read interface. ++ */ ++ ++enum sndrv_ctl_event_type { ++ SNDRV_CTL_EVENT_ELEM = 0, ++ SNDRV_CTL_EVENT_LAST = SNDRV_CTL_EVENT_ELEM, ++}; ++ ++#define SNDRV_CTL_EVENT_MASK_VALUE (1<<0) /* element value was changed */ ++#define SNDRV_CTL_EVENT_MASK_INFO (1<<1) /* element info was changed */ ++#define SNDRV_CTL_EVENT_MASK_ADD (1<<2) /* element was added */ ++#define SNDRV_CTL_EVENT_MASK_TLV (1<<3) /* element TLV tree was changed */ ++#define SNDRV_CTL_EVENT_MASK_REMOVE (~0U) /* element was removed */ ++ ++struct snd_ctl_event { ++ int type; /* event type - SNDRV_CTL_EVENT_* */ ++ union { ++ struct { ++ unsigned int mask; ++ struct snd_ctl_elem_id id; ++ } elem; ++ unsigned char data8[60]; ++ } data; ++}; ++ ++/* ++ * Control names ++ */ ++ ++#define SNDRV_CTL_NAME_NONE "" ++#define SNDRV_CTL_NAME_PLAYBACK "Playback " ++#define SNDRV_CTL_NAME_CAPTURE "Capture " ++ ++#define SNDRV_CTL_NAME_IEC958_NONE "" ++#define SNDRV_CTL_NAME_IEC958_SWITCH "Switch" ++#define SNDRV_CTL_NAME_IEC958_VOLUME "Volume" ++#define SNDRV_CTL_NAME_IEC958_DEFAULT "Default" ++#define SNDRV_CTL_NAME_IEC958_MASK "Mask" ++#define SNDRV_CTL_NAME_IEC958_CON_MASK "Con Mask" ++#define SNDRV_CTL_NAME_IEC958_PRO_MASK "Pro Mask" ++#define SNDRV_CTL_NAME_IEC958_PCM_STREAM "PCM Stream" ++#define SNDRV_CTL_NAME_IEC958(expl,direction,what) "IEC958 " expl SNDRV_CTL_NAME_##direction SNDRV_CTL_NAME_IEC958_##what ++ ++#endif /* _UAPI__SOUND_ASOUND_H */ +diff --git a/include/sound/uapi/asound_fm.h b/include/sound/uapi/asound_fm.h +new file mode 100644 +index 00000000..8471f404 +--- /dev/null ++++ b/include/sound/uapi/asound_fm.h +@@ -0,0 +1,135 @@ ++/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ ++#ifndef __SOUND_ASOUND_FM_H ++#define __SOUND_ASOUND_FM_H ++ ++/* ++ * Advanced Linux Sound Architecture - ALSA ++ * ++ * Interface file between ALSA driver & user space ++ * Copyright (c) 1994-98 by Jaroslav Kysela , ++ * 4Front Technologies ++ * ++ * Direct FM control ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * ++ */ ++ ++#define SNDRV_DM_FM_MODE_OPL2 0x00 ++#define SNDRV_DM_FM_MODE_OPL3 0x01 ++ ++struct snd_dm_fm_info { ++ unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */ ++ unsigned char rhythm; /* percussion mode flag */ ++}; ++ ++/* ++ * Data structure composing an FM "note" or sound event. ++ */ ++ ++struct snd_dm_fm_voice { ++ unsigned char op; /* operator cell (0 or 1) */ ++ unsigned char voice; /* FM voice (0 to 17) */ ++ ++ unsigned char am; /* amplitude modulation */ ++ unsigned char vibrato; /* vibrato effect */ ++ unsigned char do_sustain; /* sustain phase */ ++ unsigned char kbd_scale; /* keyboard scaling */ ++ unsigned char harmonic; /* 4 bits: harmonic and multiplier */ ++ unsigned char scale_level; /* 2 bits: decrease output freq rises */ ++ unsigned char volume; /* 6 bits: volume */ ++ ++ unsigned char attack; /* 4 bits: attack rate */ ++ unsigned char decay; /* 4 bits: decay rate */ ++ unsigned char sustain; /* 4 bits: sustain level */ ++ unsigned char release; /* 4 bits: release rate */ ++ ++ unsigned char feedback; /* 3 bits: feedback for op0 */ ++ unsigned char connection; /* 0 for serial, 1 for parallel */ ++ unsigned char left; /* stereo left */ ++ unsigned char right; /* stereo right */ ++ unsigned char waveform; /* 3 bits: waveform shape */ ++}; ++ ++/* ++ * This describes an FM note by its voice, octave, frequency number (10bit) ++ * and key on/off. ++ */ ++ ++struct snd_dm_fm_note { ++ unsigned char voice; /* 0-17 voice channel */ ++ unsigned char octave; /* 3 bits: what octave to play */ ++ unsigned int fnum; /* 10 bits: frequency number */ ++ unsigned char key_on; /* set for active, clear for silent */ ++}; ++ ++/* ++ * FM parameters that apply globally to all voices, and thus are not "notes" ++ */ ++ ++struct snd_dm_fm_params { ++ unsigned char am_depth; /* amplitude modulation depth (1=hi) */ ++ unsigned char vib_depth; /* vibrato depth (1=hi) */ ++ unsigned char kbd_split; /* keyboard split */ ++ unsigned char rhythm; /* percussion mode select */ ++ ++ /* This block is the percussion instrument data */ ++ unsigned char bass; ++ unsigned char snare; ++ unsigned char tomtom; ++ unsigned char cymbal; ++ unsigned char hihat; ++}; ++ ++/* ++ * FM mode ioctl settings ++ */ ++ ++#define SNDRV_DM_FM_IOCTL_INFO _IOR('H', 0x20, struct snd_dm_fm_info) ++#define SNDRV_DM_FM_IOCTL_RESET _IO ('H', 0x21) ++#define SNDRV_DM_FM_IOCTL_PLAY_NOTE _IOW('H', 0x22, struct snd_dm_fm_note) ++#define SNDRV_DM_FM_IOCTL_SET_VOICE _IOW('H', 0x23, struct snd_dm_fm_voice) ++#define SNDRV_DM_FM_IOCTL_SET_PARAMS _IOW('H', 0x24, struct snd_dm_fm_params) ++#define SNDRV_DM_FM_IOCTL_SET_MODE _IOW('H', 0x25, int) ++/* for OPL3 only */ ++#define SNDRV_DM_FM_IOCTL_SET_CONNECTION _IOW('H', 0x26, int) ++/* SBI patch management */ ++#define SNDRV_DM_FM_IOCTL_CLEAR_PATCHES _IO ('H', 0x40) ++ ++#define SNDRV_DM_FM_OSS_IOCTL_RESET 0x20 ++#define SNDRV_DM_FM_OSS_IOCTL_PLAY_NOTE 0x21 ++#define SNDRV_DM_FM_OSS_IOCTL_SET_VOICE 0x22 ++#define SNDRV_DM_FM_OSS_IOCTL_SET_PARAMS 0x23 ++#define SNDRV_DM_FM_OSS_IOCTL_SET_MODE 0x24 ++#define SNDRV_DM_FM_OSS_IOCTL_SET_OPL 0x25 ++ ++/* ++ * Patch Record - fixed size for write ++ */ ++ ++#define FM_KEY_SBI "SBI\032" ++#define FM_KEY_2OP "2OP\032" ++#define FM_KEY_4OP "4OP\032" ++ ++struct sbi_patch { ++ unsigned char prog; ++ unsigned char bank; ++ char key[4]; ++ char name[25]; ++ char extension[7]; ++ unsigned char data[32]; ++}; ++ ++#endif /* __SOUND_ASOUND_FM_H */ +diff --git a/include/sound/uapi/emu10k1.h b/include/sound/uapi/emu10k1.h +new file mode 100644 +index 00000000..c1150e4d +--- /dev/null ++++ b/include/sound/uapi/emu10k1.h +@@ -0,0 +1,395 @@ ++/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ ++/* ++ * Copyright (c) by Jaroslav Kysela , ++ * Creative Labs, Inc. ++ * Definitions for EMU10K1 (SB Live!) chips ++ * ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * ++ */ ++#ifndef _UAPI__SOUND_EMU10K1_H ++#define _UAPI__SOUND_EMU10K1_H ++ ++/* ++ * ---- FX8010 ---- ++ */ ++ ++#define EMU10K1_CARD_CREATIVE 0x00000000 ++#define EMU10K1_CARD_EMUAPS 0x00000001 ++ ++#define EMU10K1_FX8010_PCM_COUNT 8 ++ ++/* ++ * Following definition is copied from linux/types.h to support compiling ++ * this header file in userspace since they are not generally available for ++ * uapi headers. ++ */ ++#define __EMU10K1_DECLARE_BITMAP(name,bits) \ ++ unsigned long name[(bits) / (sizeof(unsigned long) * 8)] ++ ++/* instruction set */ ++#define iMAC0 0x00 /* R = A + (X * Y >> 31) ; saturation */ ++#define iMAC1 0x01 /* R = A + (-X * Y >> 31) ; saturation */ ++#define iMAC2 0x02 /* R = A + (X * Y >> 31) ; wraparound */ ++#define iMAC3 0x03 /* R = A + (-X * Y >> 31) ; wraparound */ ++#define iMACINT0 0x04 /* R = A + X * Y ; saturation */ ++#define iMACINT1 0x05 /* R = A + X * Y ; wraparound (31-bit) */ ++#define iACC3 0x06 /* R = A + X + Y ; saturation */ ++#define iMACMV 0x07 /* R = A, acc += X * Y >> 31 */ ++#define iANDXOR 0x08 /* R = (A & X) ^ Y */ ++#define iTSTNEG 0x09 /* R = (A >= Y) ? X : ~X */ ++#define iLIMITGE 0x0a /* R = (A >= Y) ? X : Y */ ++#define iLIMITLT 0x0b /* R = (A < Y) ? X : Y */ ++#define iLOG 0x0c /* R = linear_data, A (log_data), X (max_exp), Y (format_word) */ ++#define iEXP 0x0d /* R = log_data, A (linear_data), X (max_exp), Y (format_word) */ ++#define iINTERP 0x0e /* R = A + (X * (Y - A) >> 31) ; saturation */ ++#define iSKIP 0x0f /* R = A (cc_reg), X (count), Y (cc_test) */ ++ ++/* GPRs */ ++#define FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x0f */ ++#define EXTIN(x) (0x10 + (x)) /* x = 0x00 - 0x0f */ ++#define EXTOUT(x) (0x20 + (x)) /* x = 0x00 - 0x0f physical outs -> FXWC low 16 bits */ ++#define FXBUS2(x) (0x30 + (x)) /* x = 0x00 - 0x0f copies of fx buses for capture -> FXWC high 16 bits */ ++ /* NB: 0x31 and 0x32 are shared with Center/LFE on SB live 5.1 */ ++ ++#define C_00000000 0x40 ++#define C_00000001 0x41 ++#define C_00000002 0x42 ++#define C_00000003 0x43 ++#define C_00000004 0x44 ++#define C_00000008 0x45 ++#define C_00000010 0x46 ++#define C_00000020 0x47 ++#define C_00000100 0x48 ++#define C_00010000 0x49 ++#define C_00080000 0x4a ++#define C_10000000 0x4b ++#define C_20000000 0x4c ++#define C_40000000 0x4d ++#define C_80000000 0x4e ++#define C_7fffffff 0x4f ++#define C_ffffffff 0x50 ++#define C_fffffffe 0x51 ++#define C_c0000000 0x52 ++#define C_4f1bbcdc 0x53 ++#define C_5a7ef9db 0x54 ++#define C_00100000 0x55 /* ?? */ ++#define GPR_ACCU 0x56 /* ACCUM, accumulator */ ++#define GPR_COND 0x57 /* CCR, condition register */ ++#define GPR_NOISE0 0x58 /* noise source */ ++#define GPR_NOISE1 0x59 /* noise source */ ++#define GPR_IRQ 0x5a /* IRQ register */ ++#define GPR_DBAC 0x5b /* TRAM Delay Base Address Counter */ ++#define GPR(x) (FXGPREGBASE + (x)) /* free GPRs: x = 0x00 - 0xff */ ++#define ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */ ++#define ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */ ++#define ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */ ++#define ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */ ++ ++#define A_ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */ ++#define A_ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */ ++#define A_ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */ ++#define A_ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */ ++#define A_ITRAM_CTL(x) (A_TANKMEMCTLREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */ ++#define A_ETRAM_CTL(x) (A_TANKMEMCTLREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */ ++ ++#define A_FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x3f FX buses */ ++#define A_EXTIN(x) (0x40 + (x)) /* x = 0x00 - 0x0f physical ins */ ++#define A_P16VIN(x) (0x50 + (x)) /* x = 0x00 - 0x0f p16v ins (A2 only) "EMU32 inputs" */ ++#define A_EXTOUT(x) (0x60 + (x)) /* x = 0x00 - 0x1f physical outs -> A_FXWC1 0x79-7f unknown */ ++#define A_FXBUS2(x) (0x80 + (x)) /* x = 0x00 - 0x1f extra outs used for EFX capture -> A_FXWC2 */ ++#define A_EMU32OUTH(x) (0xa0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_10 - _1F" - ??? */ ++#define A_EMU32OUTL(x) (0xb0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_1 - _F" - ??? */ ++#define A3_EMU32IN(x) (0x160 + (x)) /* x = 0x00 - 0x3f "EMU32_IN_00 - _3F" - Only when .device = 0x0008 */ ++#define A3_EMU32OUT(x) (0x1E0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_00 - _3F" - Only when .device = 0x0008 */ ++#define A_GPR(x) (A_FXGPREGBASE + (x)) ++ ++/* cc_reg constants */ ++#define CC_REG_NORMALIZED C_00000001 ++#define CC_REG_BORROW C_00000002 ++#define CC_REG_MINUS C_00000004 ++#define CC_REG_ZERO C_00000008 ++#define CC_REG_SATURATE C_00000010 ++#define CC_REG_NONZERO C_00000100 ++ ++/* FX buses */ ++#define FXBUS_PCM_LEFT 0x00 ++#define FXBUS_PCM_RIGHT 0x01 ++#define FXBUS_PCM_LEFT_REAR 0x02 ++#define FXBUS_PCM_RIGHT_REAR 0x03 ++#define FXBUS_MIDI_LEFT 0x04 ++#define FXBUS_MIDI_RIGHT 0x05 ++#define FXBUS_PCM_CENTER 0x06 ++#define FXBUS_PCM_LFE 0x07 ++#define FXBUS_PCM_LEFT_FRONT 0x08 ++#define FXBUS_PCM_RIGHT_FRONT 0x09 ++#define FXBUS_MIDI_REVERB 0x0c ++#define FXBUS_MIDI_CHORUS 0x0d ++#define FXBUS_PCM_LEFT_SIDE 0x0e ++#define FXBUS_PCM_RIGHT_SIDE 0x0f ++#define FXBUS_PT_LEFT 0x14 ++#define FXBUS_PT_RIGHT 0x15 ++ ++/* Inputs */ ++#define EXTIN_AC97_L 0x00 /* AC'97 capture channel - left */ ++#define EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */ ++#define EXTIN_SPDIF_CD_L 0x02 /* internal S/PDIF CD - onboard - left */ ++#define EXTIN_SPDIF_CD_R 0x03 /* internal S/PDIF CD - onboard - right */ ++#define EXTIN_ZOOM_L 0x04 /* Zoom Video I2S - left */ ++#define EXTIN_ZOOM_R 0x05 /* Zoom Video I2S - right */ ++#define EXTIN_TOSLINK_L 0x06 /* LiveDrive - TOSLink Optical - left */ ++#define EXTIN_TOSLINK_R 0x07 /* LiveDrive - TOSLink Optical - right */ ++#define EXTIN_LINE1_L 0x08 /* LiveDrive - Line/Mic 1 - left */ ++#define EXTIN_LINE1_R 0x09 /* LiveDrive - Line/Mic 1 - right */ ++#define EXTIN_COAX_SPDIF_L 0x0a /* LiveDrive - Coaxial S/PDIF - left */ ++#define EXTIN_COAX_SPDIF_R 0x0b /* LiveDrive - Coaxial S/PDIF - right */ ++#define EXTIN_LINE2_L 0x0c /* LiveDrive - Line/Mic 2 - left */ ++#define EXTIN_LINE2_R 0x0d /* LiveDrive - Line/Mic 2 - right */ ++ ++/* Outputs */ ++#define EXTOUT_AC97_L 0x00 /* AC'97 playback channel - left */ ++#define EXTOUT_AC97_R 0x01 /* AC'97 playback channel - right */ ++#define EXTOUT_TOSLINK_L 0x02 /* LiveDrive - TOSLink Optical - left */ ++#define EXTOUT_TOSLINK_R 0x03 /* LiveDrive - TOSLink Optical - right */ ++#define EXTOUT_AC97_CENTER 0x04 /* SB Live 5.1 - center */ ++#define EXTOUT_AC97_LFE 0x05 /* SB Live 5.1 - LFE */ ++#define EXTOUT_HEADPHONE_L 0x06 /* LiveDrive - Headphone - left */ ++#define EXTOUT_HEADPHONE_R 0x07 /* LiveDrive - Headphone - right */ ++#define EXTOUT_REAR_L 0x08 /* Rear channel - left */ ++#define EXTOUT_REAR_R 0x09 /* Rear channel - right */ ++#define EXTOUT_ADC_CAP_L 0x0a /* ADC Capture buffer - left */ ++#define EXTOUT_ADC_CAP_R 0x0b /* ADC Capture buffer - right */ ++#define EXTOUT_MIC_CAP 0x0c /* MIC Capture buffer */ ++#define EXTOUT_AC97_REAR_L 0x0d /* SB Live 5.1 (c) 2003 - Rear Left */ ++#define EXTOUT_AC97_REAR_R 0x0e /* SB Live 5.1 (c) 2003 - Rear Right */ ++#define EXTOUT_ACENTER 0x11 /* Analog Center */ ++#define EXTOUT_ALFE 0x12 /* Analog LFE */ ++ ++/* Audigy Inputs */ ++#define A_EXTIN_AC97_L 0x00 /* AC'97 capture channel - left */ ++#define A_EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */ ++#define A_EXTIN_SPDIF_CD_L 0x02 /* digital CD left */ ++#define A_EXTIN_SPDIF_CD_R 0x03 /* digital CD left */ ++#define A_EXTIN_OPT_SPDIF_L 0x04 /* audigy drive Optical SPDIF - left */ ++#define A_EXTIN_OPT_SPDIF_R 0x05 /* right */ ++#define A_EXTIN_LINE2_L 0x08 /* audigy drive line2/mic2 - left */ ++#define A_EXTIN_LINE2_R 0x09 /* right */ ++#define A_EXTIN_ADC_L 0x0a /* Philips ADC - left */ ++#define A_EXTIN_ADC_R 0x0b /* right */ ++#define A_EXTIN_AUX2_L 0x0c /* audigy drive aux2 - left */ ++#define A_EXTIN_AUX2_R 0x0d /* - right */ ++ ++/* Audigiy Outputs */ ++#define A_EXTOUT_FRONT_L 0x00 /* digital front left */ ++#define A_EXTOUT_FRONT_R 0x01 /* right */ ++#define A_EXTOUT_CENTER 0x02 /* digital front center */ ++#define A_EXTOUT_LFE 0x03 /* digital front lfe */ ++#define A_EXTOUT_HEADPHONE_L 0x04 /* headphone audigy drive left */ ++#define A_EXTOUT_HEADPHONE_R 0x05 /* right */ ++#define A_EXTOUT_REAR_L 0x06 /* digital rear left */ ++#define A_EXTOUT_REAR_R 0x07 /* right */ ++#define A_EXTOUT_AFRONT_L 0x08 /* analog front left */ ++#define A_EXTOUT_AFRONT_R 0x09 /* right */ ++#define A_EXTOUT_ACENTER 0x0a /* analog center */ ++#define A_EXTOUT_ALFE 0x0b /* analog LFE */ ++#define A_EXTOUT_ASIDE_L 0x0c /* analog side left - Audigy 2 ZS */ ++#define A_EXTOUT_ASIDE_R 0x0d /* right - Audigy 2 ZS */ ++#define A_EXTOUT_AREAR_L 0x0e /* analog rear left */ ++#define A_EXTOUT_AREAR_R 0x0f /* right */ ++#define A_EXTOUT_AC97_L 0x10 /* AC97 left (front) */ ++#define A_EXTOUT_AC97_R 0x11 /* right */ ++#define A_EXTOUT_ADC_CAP_L 0x16 /* ADC capture buffer left */ ++#define A_EXTOUT_ADC_CAP_R 0x17 /* right */ ++#define A_EXTOUT_MIC_CAP 0x18 /* Mic capture buffer */ ++ ++/* Audigy constants */ ++#define A_C_00000000 0xc0 ++#define A_C_00000001 0xc1 ++#define A_C_00000002 0xc2 ++#define A_C_00000003 0xc3 ++#define A_C_00000004 0xc4 ++#define A_C_00000008 0xc5 ++#define A_C_00000010 0xc6 ++#define A_C_00000020 0xc7 ++#define A_C_00000100 0xc8 ++#define A_C_00010000 0xc9 ++#define A_C_00000800 0xca ++#define A_C_10000000 0xcb ++#define A_C_20000000 0xcc ++#define A_C_40000000 0xcd ++#define A_C_80000000 0xce ++#define A_C_7fffffff 0xcf ++#define A_C_ffffffff 0xd0 ++#define A_C_fffffffe 0xd1 ++#define A_C_c0000000 0xd2 ++#define A_C_4f1bbcdc 0xd3 ++#define A_C_5a7ef9db 0xd4 ++#define A_C_00100000 0xd5 ++#define A_GPR_ACCU 0xd6 /* ACCUM, accumulator */ ++#define A_GPR_COND 0xd7 /* CCR, condition register */ ++#define A_GPR_NOISE0 0xd8 /* noise source */ ++#define A_GPR_NOISE1 0xd9 /* noise source */ ++#define A_GPR_IRQ 0xda /* IRQ register */ ++#define A_GPR_DBAC 0xdb /* TRAM Delay Base Address Counter - internal */ ++#define A_GPR_DBACE 0xde /* TRAM Delay Base Address Counter - external */ ++ ++/* definitions for debug register */ ++#define EMU10K1_DBG_ZC 0x80000000 /* zero tram counter */ ++#define EMU10K1_DBG_SATURATION_OCCURED 0x02000000 /* saturation control */ ++#define EMU10K1_DBG_SATURATION_ADDR 0x01ff0000 /* saturation address */ ++#define EMU10K1_DBG_SINGLE_STEP 0x00008000 /* single step mode */ ++#define EMU10K1_DBG_STEP 0x00004000 /* start single step */ ++#define EMU10K1_DBG_CONDITION_CODE 0x00003e00 /* condition code */ ++#define EMU10K1_DBG_SINGLE_STEP_ADDR 0x000001ff /* single step address */ ++ ++/* tank memory address line */ ++#ifndef __KERNEL__ ++#define TANKMEMADDRREG_ADDR_MASK 0x000fffff /* 20 bit tank address field */ ++#define TANKMEMADDRREG_CLEAR 0x00800000 /* Clear tank memory */ ++#define TANKMEMADDRREG_ALIGN 0x00400000 /* Align read or write relative to tank access */ ++#define TANKMEMADDRREG_WRITE 0x00200000 /* Write to tank memory */ ++#define TANKMEMADDRREG_READ 0x00100000 /* Read from tank memory */ ++#endif ++ ++struct snd_emu10k1_fx8010_info { ++ unsigned int internal_tram_size; /* in samples */ ++ unsigned int external_tram_size; /* in samples */ ++ char fxbus_names[16][32]; /* names of FXBUSes */ ++ char extin_names[16][32]; /* names of external inputs */ ++ char extout_names[32][32]; /* names of external outputs */ ++ unsigned int gpr_controls; /* count of GPR controls */ ++}; ++ ++#define EMU10K1_GPR_TRANSLATION_NONE 0 ++#define EMU10K1_GPR_TRANSLATION_TABLE100 1 ++#define EMU10K1_GPR_TRANSLATION_BASS 2 ++#define EMU10K1_GPR_TRANSLATION_TREBLE 3 ++#define EMU10K1_GPR_TRANSLATION_ONOFF 4 ++ ++enum emu10k1_ctl_elem_iface { ++ EMU10K1_CTL_ELEM_IFACE_MIXER = 2, /* virtual mixer device */ ++ EMU10K1_CTL_ELEM_IFACE_PCM = 3, /* PCM device */ ++}; ++ ++struct emu10k1_ctl_elem_id { ++ unsigned int pad; /* don't use */ ++ int iface; /* interface identifier */ ++ unsigned int device; /* device/client number */ ++ unsigned int subdevice; /* subdevice (substream) number */ ++ unsigned char name[44]; /* ASCII name of item */ ++ unsigned int index; /* index of item */ ++}; ++ ++struct snd_emu10k1_fx8010_control_gpr { ++ struct emu10k1_ctl_elem_id id; /* full control ID definition */ ++ unsigned int vcount; /* visible count */ ++ unsigned int count; /* count of GPR (1..16) */ ++ unsigned short gpr[32]; /* GPR number(s) */ ++ unsigned int value[32]; /* initial values */ ++ unsigned int min; /* minimum range */ ++ unsigned int max; /* maximum range */ ++ unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */ ++ const unsigned int *tlv; ++}; ++ ++/* old ABI without TLV support */ ++struct snd_emu10k1_fx8010_control_old_gpr { ++ struct emu10k1_ctl_elem_id id; ++ unsigned int vcount; ++ unsigned int count; ++ unsigned short gpr[32]; ++ unsigned int value[32]; ++ unsigned int min; ++ unsigned int max; ++ unsigned int translation; ++}; ++ ++struct snd_emu10k1_fx8010_code { ++ char name[128]; ++ ++ __EMU10K1_DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */ ++ __u32 *gpr_map; /* initializers */ ++ ++ unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */ ++ struct snd_emu10k1_fx8010_control_gpr *gpr_add_controls; /* GPR controls to add/replace */ ++ ++ unsigned int gpr_del_control_count; /* count of GPR controls to remove */ ++ struct emu10k1_ctl_elem_id *gpr_del_controls; /* IDs of GPR controls to remove */ ++ ++ unsigned int gpr_list_control_count; /* count of GPR controls to list */ ++ unsigned int gpr_list_control_total; /* total count of GPR controls */ ++ struct snd_emu10k1_fx8010_control_gpr *gpr_list_controls; /* listed GPR controls */ ++ ++ __EMU10K1_DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */ ++ __u32 *tram_data_map; /* data initializers */ ++ __u32 *tram_addr_map; /* map initializers */ ++ ++ __EMU10K1_DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */ ++ __u32 *code; /* one instruction - 64 bits */ ++}; ++ ++struct snd_emu10k1_fx8010_tram { ++ unsigned int address; /* 31.bit == 1 -> external TRAM */ ++ unsigned int size; /* size in samples (4 bytes) */ ++ unsigned int *samples; /* pointer to samples (20-bit) */ ++ /* NULL->clear memory */ ++}; ++ ++struct snd_emu10k1_fx8010_pcm_rec { ++ unsigned int substream; /* substream number */ ++ unsigned int res1; /* reserved */ ++ unsigned int channels; /* 16-bit channels count, zero = remove this substream */ ++ unsigned int tram_start; /* ring buffer position in TRAM (in samples) */ ++ unsigned int buffer_size; /* count of buffered samples */ ++ unsigned short gpr_size; /* GPR containing size of ringbuffer in samples (host) */ ++ unsigned short gpr_ptr; /* GPR containing current pointer in the ring buffer (host = reset, FX8010) */ ++ unsigned short gpr_count; /* GPR containing count of samples between two interrupts (host) */ ++ unsigned short gpr_tmpcount; /* GPR containing current count of samples to interrupt (host = set, FX8010) */ ++ unsigned short gpr_trigger; /* GPR containing trigger (activate) information (host) */ ++ unsigned short gpr_running; /* GPR containing info if PCM is running (FX8010) */ ++ unsigned char pad; /* reserved */ ++ unsigned char etram[32]; /* external TRAM address & data (one per channel) */ ++ unsigned int res2; /* reserved */ ++}; ++ ++#define SNDRV_EMU10K1_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1) ++ ++#define SNDRV_EMU10K1_IOCTL_INFO _IOR ('H', 0x10, struct snd_emu10k1_fx8010_info) ++#define SNDRV_EMU10K1_IOCTL_CODE_POKE _IOW ('H', 0x11, struct snd_emu10k1_fx8010_code) ++#define SNDRV_EMU10K1_IOCTL_CODE_PEEK _IOWR('H', 0x12, struct snd_emu10k1_fx8010_code) ++#define SNDRV_EMU10K1_IOCTL_TRAM_SETUP _IOW ('H', 0x20, int) ++#define SNDRV_EMU10K1_IOCTL_TRAM_POKE _IOW ('H', 0x21, struct snd_emu10k1_fx8010_tram) ++#define SNDRV_EMU10K1_IOCTL_TRAM_PEEK _IOWR('H', 0x22, struct snd_emu10k1_fx8010_tram) ++#define SNDRV_EMU10K1_IOCTL_PCM_POKE _IOW ('H', 0x30, struct snd_emu10k1_fx8010_pcm_rec) ++#define SNDRV_EMU10K1_IOCTL_PCM_PEEK _IOWR('H', 0x31, struct snd_emu10k1_fx8010_pcm_rec) ++#define SNDRV_EMU10K1_IOCTL_PVERSION _IOR ('H', 0x40, int) ++#define SNDRV_EMU10K1_IOCTL_STOP _IO ('H', 0x80) ++#define SNDRV_EMU10K1_IOCTL_CONTINUE _IO ('H', 0x81) ++#define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO ('H', 0x82) ++#define SNDRV_EMU10K1_IOCTL_SINGLE_STEP _IOW ('H', 0x83, int) ++#define SNDRV_EMU10K1_IOCTL_DBG_READ _IOR ('H', 0x84, int) ++ ++#ifndef __KERNEL__ ++/* typedefs for compatibility to user-space */ ++typedef struct snd_emu10k1_fx8010_info emu10k1_fx8010_info_t; ++typedef struct snd_emu10k1_fx8010_control_gpr emu10k1_fx8010_control_gpr_t; ++typedef struct snd_emu10k1_fx8010_code emu10k1_fx8010_code_t; ++typedef struct snd_emu10k1_fx8010_tram emu10k1_fx8010_tram_t; ++typedef struct snd_emu10k1_fx8010_pcm_rec emu10k1_fx8010_pcm_t; ++typedef struct emu10k1_ctl_elem_id emu10k1_ctl_elem_id_t; ++#endif ++ ++#endif /* _UAPI__SOUND_EMU10K1_H */ +diff --git a/include/sound/uapi/hdsp.h b/include/sound/uapi/hdsp.h +new file mode 100644 +index 00000000..88c92a3f +--- /dev/null ++++ b/include/sound/uapi/hdsp.h +@@ -0,0 +1,109 @@ ++/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ ++#ifndef __SOUND_HDSP_H ++#define __SOUND_HDSP_H ++ ++/* ++ * Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org) ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ++ */ ++ ++#define HDSP_MATRIX_MIXER_SIZE 2048 ++ ++enum HDSP_IO_Type { ++ Digiface, ++ Multiface, ++ H9652, ++ H9632, ++ RPM, ++ Undefined, ++}; ++ ++struct hdsp_peak_rms { ++ __u32 input_peaks[26]; ++ __u32 playback_peaks[26]; ++ __u32 output_peaks[28]; ++ __u64 input_rms[26]; ++ __u64 playback_rms[26]; ++ /* These are only used for H96xx cards */ ++ __u64 output_rms[26]; ++}; ++ ++#define SNDRV_HDSP_IOCTL_GET_PEAK_RMS _IOR('H', 0x40, struct hdsp_peak_rms) ++ ++struct hdsp_config_info { ++ unsigned char pref_sync_ref; ++ unsigned char wordclock_sync_check; ++ unsigned char spdif_sync_check; ++ unsigned char adatsync_sync_check; ++ unsigned char adat_sync_check[3]; ++ unsigned char spdif_in; ++ unsigned char spdif_out; ++ unsigned char spdif_professional; ++ unsigned char spdif_emphasis; ++ unsigned char spdif_nonaudio; ++ unsigned int spdif_sample_rate; ++ unsigned int system_sample_rate; ++ unsigned int autosync_sample_rate; ++ unsigned char system_clock_mode; ++ unsigned char clock_source; ++ unsigned char autosync_ref; ++ unsigned char line_out; ++ unsigned char passthru; ++ unsigned char da_gain; ++ unsigned char ad_gain; ++ unsigned char phone_gain; ++ unsigned char xlr_breakout_cable; ++ unsigned char analog_extension_board; ++}; ++ ++#define SNDRV_HDSP_IOCTL_GET_CONFIG_INFO _IOR('H', 0x41, struct hdsp_config_info) ++ ++struct hdsp_firmware { ++ void *firmware_data; /* 24413 x 4 bytes */ ++}; ++ ++#define SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE _IOW('H', 0x42, struct hdsp_firmware) ++ ++struct hdsp_version { ++ enum HDSP_IO_Type io_type; ++ unsigned short firmware_rev; ++}; ++ ++#define SNDRV_HDSP_IOCTL_GET_VERSION _IOR('H', 0x43, struct hdsp_version) ++ ++struct hdsp_mixer { ++ unsigned short matrix[HDSP_MATRIX_MIXER_SIZE]; ++}; ++ ++#define SNDRV_HDSP_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdsp_mixer) ++ ++struct hdsp_9632_aeb { ++ int aebi; ++ int aebo; ++}; ++ ++#define SNDRV_HDSP_IOCTL_GET_9632_AEB _IOR('H', 0x45, struct hdsp_9632_aeb) ++ ++/* typedefs for compatibility to user-space */ ++typedef enum HDSP_IO_Type HDSP_IO_Type; ++typedef struct hdsp_peak_rms hdsp_peak_rms_t; ++typedef struct hdsp_config_info hdsp_config_info_t; ++typedef struct hdsp_firmware hdsp_firmware_t; ++typedef struct hdsp_version hdsp_version_t; ++typedef struct hdsp_mixer hdsp_mixer_t; ++typedef struct hdsp_9632_aeb hdsp_9632_aeb_t; ++ ++#endif /* __SOUND_HDSP_H */ +diff --git a/include/sound/uapi/hdspm.h b/include/sound/uapi/hdspm.h +new file mode 100644 +index 00000000..2d91f90e +--- /dev/null ++++ b/include/sound/uapi/hdspm.h +@@ -0,0 +1,230 @@ ++/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ ++#ifndef __SOUND_HDSPM_H ++#define __SOUND_HDSPM_H ++/* ++ * Copyright (C) 2003 Winfried Ritsch (IEM) ++ * based on hdsp.h from Thomas Charbonnel (thomas@undata.org) ++ * ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ++ */ ++ ++/* Maximum channels is 64 even on 56Mode you have 64playbacks to matrix */ ++#define HDSPM_MAX_CHANNELS 64 ++ ++enum hdspm_io_type { ++ MADI, ++ MADIface, ++ AIO, ++ AES32, ++ RayDAT ++}; ++ ++enum hdspm_speed { ++ ss, ++ ds, ++ qs ++}; ++ ++/* -------------------- IOCTL Peak/RMS Meters -------------------- */ ++ ++struct hdspm_peak_rms { ++ __u32 input_peaks[64]; ++ __u32 playback_peaks[64]; ++ __u32 output_peaks[64]; ++ ++ __u64 input_rms[64]; ++ __u64 playback_rms[64]; ++ __u64 output_rms[64]; ++ ++ __u8 speed; /* enum {ss, ds, qs} */ ++ int status2; ++}; ++ ++#define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS \ ++ _IOR('H', 0x42, struct hdspm_peak_rms) ++ ++/* ------------ CONFIG block IOCTL ---------------------- */ ++ ++struct hdspm_config { ++ unsigned char pref_sync_ref; ++ unsigned char wordclock_sync_check; ++ unsigned char madi_sync_check; ++ unsigned int system_sample_rate; ++ unsigned int autosync_sample_rate; ++ unsigned char system_clock_mode; ++ unsigned char clock_source; ++ unsigned char autosync_ref; ++ unsigned char line_out; ++ unsigned int passthru; ++ unsigned int analog_out; ++}; ++ ++#define SNDRV_HDSPM_IOCTL_GET_CONFIG \ ++ _IOR('H', 0x41, struct hdspm_config) ++ ++/* ++ * If there's a TCO (TimeCode Option) board installed, ++ * there are further options and status data available. ++ * The hdspm_ltc structure contains the current SMPTE ++ * timecode and some status information and can be ++ * obtained via SNDRV_HDSPM_IOCTL_GET_LTC or in the ++ * hdspm_status struct. ++ */ ++ ++enum hdspm_ltc_format { ++ format_invalid, ++ fps_24, ++ fps_25, ++ fps_2997, ++ fps_30 ++}; ++ ++enum hdspm_ltc_frame { ++ frame_invalid, ++ drop_frame, ++ full_frame ++}; ++ ++enum hdspm_ltc_input_format { ++ ntsc, ++ pal, ++ no_video ++}; ++ ++struct hdspm_ltc { ++ unsigned int ltc; ++ ++ enum hdspm_ltc_format format; ++ enum hdspm_ltc_frame frame; ++ enum hdspm_ltc_input_format input_format; ++}; ++ ++#define SNDRV_HDSPM_IOCTL_GET_LTC _IOR('H', 0x46, struct hdspm_ltc) ++ ++/* ++ * The status data reflects the device's current state ++ * as determined by the card's configuration and ++ * connection status. ++ */ ++ ++enum hdspm_sync { ++ hdspm_sync_no_lock = 0, ++ hdspm_sync_lock = 1, ++ hdspm_sync_sync = 2 ++}; ++ ++enum hdspm_madi_input { ++ hdspm_input_optical = 0, ++ hdspm_input_coax = 1 ++}; ++ ++enum hdspm_madi_channel_format { ++ hdspm_format_ch_64 = 0, ++ hdspm_format_ch_56 = 1 ++}; ++ ++enum hdspm_madi_frame_format { ++ hdspm_frame_48 = 0, ++ hdspm_frame_96 = 1 ++}; ++ ++enum hdspm_syncsource { ++ syncsource_wc = 0, ++ syncsource_madi = 1, ++ syncsource_tco = 2, ++ syncsource_sync = 3, ++ syncsource_none = 4 ++}; ++ ++struct hdspm_status { ++ __u8 card_type; /* enum hdspm_io_type */ ++ enum hdspm_syncsource autosync_source; ++ ++ __u64 card_clock; ++ __u32 master_period; ++ ++ union { ++ struct { ++ __u8 sync_wc; /* enum hdspm_sync */ ++ __u8 sync_madi; /* enum hdspm_sync */ ++ __u8 sync_tco; /* enum hdspm_sync */ ++ __u8 sync_in; /* enum hdspm_sync */ ++ __u8 madi_input; /* enum hdspm_madi_input */ ++ __u8 channel_format; /* enum hdspm_madi_channel_format */ ++ __u8 frame_format; /* enum hdspm_madi_frame_format */ ++ } madi; ++ } card_specific; ++}; ++ ++#define SNDRV_HDSPM_IOCTL_GET_STATUS \ ++ _IOR('H', 0x47, struct hdspm_status) ++ ++/* ++ * Get information about the card and its add-ons. ++ */ ++ ++#define HDSPM_ADDON_TCO 1 ++ ++struct hdspm_version { ++ __u8 card_type; /* enum hdspm_io_type */ ++ char cardname[20]; ++ unsigned int serial; ++ unsigned short firmware_rev; ++ int addons; ++}; ++ ++#define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x48, struct hdspm_version) ++ ++/* ------------- get Matrix Mixer IOCTL --------------- */ ++ ++/* MADI mixer: 64inputs+64playback in 64outputs = 8192 => *4Byte = ++ * 32768 Bytes ++ */ ++ ++/* organisation is 64 channelfader in a continuous memory block */ ++/* equivalent to hardware definition, maybe for future feature of mmap of ++ * them ++ */ ++/* each of 64 outputs has 64 infader and 64 outfader: ++ Ins to Outs mixer[out].in[in], Outstreams to Outs mixer[out].pb[pb] */ ++ ++#define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS ++ ++struct hdspm_channelfader { ++ unsigned int in[HDSPM_MIXER_CHANNELS]; ++ unsigned int pb[HDSPM_MIXER_CHANNELS]; ++}; ++ ++struct hdspm_mixer { ++ struct hdspm_channelfader ch[HDSPM_MIXER_CHANNELS]; ++}; ++ ++struct hdspm_mixer_ioctl { ++ struct hdspm_mixer *mixer; ++}; ++ ++/* use indirect access due to the limit of ioctl bit size */ ++#define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdspm_mixer_ioctl) ++ ++/* typedefs for compatibility to user-space */ ++typedef struct hdspm_peak_rms hdspm_peak_rms_t; ++typedef struct hdspm_config_info hdspm_config_info_t; ++typedef struct hdspm_version hdspm_version_t; ++typedef struct hdspm_channelfader snd_hdspm_channelfader_t; ++typedef struct hdspm_mixer hdspm_mixer_t; ++ ++ ++#endif +diff --git a/include/sound/uapi/sb16_csp.h b/include/sound/uapi/sb16_csp.h +new file mode 100644 +index 00000000..e6485148 +--- /dev/null ++++ b/include/sound/uapi/sb16_csp.h +@@ -0,0 +1,123 @@ ++/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ ++/* ++ * Copyright (c) 1999 by Uros Bizjak ++ * Takashi Iwai ++ * ++ * SB16ASP/AWE32 CSP control ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * ++ */ ++#ifndef _UAPI__SOUND_SB16_CSP_H ++#define _UAPI__SOUND_SB16_CSP_H ++ ++ ++/* CSP modes */ ++#define SNDRV_SB_CSP_MODE_NONE 0x00 ++#define SNDRV_SB_CSP_MODE_DSP_READ 0x01 /* Record from DSP */ ++#define SNDRV_SB_CSP_MODE_DSP_WRITE 0x02 /* Play to DSP */ ++#define SNDRV_SB_CSP_MODE_QSOUND 0x04 /* QSound */ ++ ++/* CSP load flags */ ++#define SNDRV_SB_CSP_LOAD_FROMUSER 0x01 ++#define SNDRV_SB_CSP_LOAD_INITBLOCK 0x02 ++ ++/* CSP sample width */ ++#define SNDRV_SB_CSP_SAMPLE_8BIT 0x01 ++#define SNDRV_SB_CSP_SAMPLE_16BIT 0x02 ++ ++/* CSP channels */ ++#define SNDRV_SB_CSP_MONO 0x01 ++#define SNDRV_SB_CSP_STEREO 0x02 ++ ++/* CSP rates */ ++#define SNDRV_SB_CSP_RATE_8000 0x01 ++#define SNDRV_SB_CSP_RATE_11025 0x02 ++#define SNDRV_SB_CSP_RATE_22050 0x04 ++#define SNDRV_SB_CSP_RATE_44100 0x08 ++#define SNDRV_SB_CSP_RATE_ALL 0x0f ++ ++/* CSP running state */ ++#define SNDRV_SB_CSP_ST_IDLE 0x00 ++#define SNDRV_SB_CSP_ST_LOADED 0x01 ++#define SNDRV_SB_CSP_ST_RUNNING 0x02 ++#define SNDRV_SB_CSP_ST_PAUSED 0x04 ++#define SNDRV_SB_CSP_ST_AUTO 0x08 ++#define SNDRV_SB_CSP_ST_QSOUND 0x10 ++ ++/* maximum QSound value (180 degrees right) */ ++#define SNDRV_SB_CSP_QSOUND_MAX_RIGHT 0x20 ++ ++/* maximum microcode RIFF file size */ ++#define SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE 0x3000 ++ ++/* microcode header */ ++struct snd_sb_csp_mc_header { ++ char codec_name[16]; /* id name of codec */ ++ unsigned short func_req; /* requested function */ ++}; ++ ++/* microcode to be loaded */ ++struct snd_sb_csp_microcode { ++ struct snd_sb_csp_mc_header info; ++ unsigned char data[SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE]; ++}; ++ ++/* start CSP with sample_width in mono/stereo */ ++struct snd_sb_csp_start { ++ int sample_width; /* sample width, look above */ ++ int channels; /* channels, look above */ ++}; ++ ++/* CSP information */ ++struct snd_sb_csp_info { ++ char codec_name[16]; /* id name of codec */ ++ unsigned short func_nr; /* function number */ ++ unsigned int acc_format; /* accepted PCM formats */ ++ unsigned short acc_channels; /* accepted channels */ ++ unsigned short acc_width; /* accepted sample width */ ++ unsigned short acc_rates; /* accepted sample rates */ ++ unsigned short csp_mode; /* CSP mode, see above */ ++ unsigned short run_channels; /* current channels */ ++ unsigned short run_width; /* current sample width */ ++ unsigned short version; /* version id: 0x10 - 0x1f */ ++ unsigned short state; /* state bits */ ++}; ++ ++/* HWDEP controls */ ++/* get CSP information */ ++#define SNDRV_SB_CSP_IOCTL_INFO _IOR('H', 0x10, struct snd_sb_csp_info) ++/* load microcode to CSP */ ++/* NOTE: struct snd_sb_csp_microcode overflows the max size (13 bits) ++ * defined for some architectures like MIPS, and it leads to build errors. ++ * (x86 and co have 14-bit size, thus it's valid, though.) ++ * As a workaround for skipping the size-limit check, here we don't use the ++ * normal _IOW() macro but _IOC() with the manual argument. ++ */ ++#define SNDRV_SB_CSP_IOCTL_LOAD_CODE \ ++ _IOC(_IOC_WRITE, 'H', 0x11, sizeof(struct snd_sb_csp_microcode)) ++/* unload microcode from CSP */ ++#define SNDRV_SB_CSP_IOCTL_UNLOAD_CODE _IO('H', 0x12) ++/* start CSP */ ++#define SNDRV_SB_CSP_IOCTL_START _IOW('H', 0x13, struct snd_sb_csp_start) ++/* stop CSP */ ++#define SNDRV_SB_CSP_IOCTL_STOP _IO('H', 0x14) ++/* pause CSP and DMA transfer */ ++#define SNDRV_SB_CSP_IOCTL_PAUSE _IO('H', 0x15) ++/* restart CSP and DMA transfer */ ++#define SNDRV_SB_CSP_IOCTL_RESTART _IO('H', 0x16) ++ ++ ++#endif /* _UAPI__SOUND_SB16_CSP_H */ +diff --git a/include/sound/uapi/sscape_ioctl.h b/include/sound/uapi/sscape_ioctl.h +new file mode 100644 +index 00000000..c6653ebf +--- /dev/null ++++ b/include/sound/uapi/sscape_ioctl.h +@@ -0,0 +1,21 @@ ++#ifndef SSCAPE_IOCTL_H ++#define SSCAPE_IOCTL_H ++ ++ ++struct sscape_bootblock ++{ ++ unsigned char code[256]; ++ unsigned version; ++}; ++ ++#define SSCAPE_MICROCODE_SIZE 65536 ++ ++struct sscape_microcode ++{ ++ unsigned char *code; ++}; ++ ++#define SND_SSCAPE_LOAD_BOOTB _IOWR('P', 100, struct sscape_bootblock) ++#define SND_SSCAPE_LOAD_MCODE _IOW ('P', 101, struct sscape_microcode) ++ ++#endif +diff --git a/include/sound/uapi/tlv.h b/include/sound/uapi/tlv.h +new file mode 100644 +index 00000000..7d6d65f6 +--- /dev/null ++++ b/include/sound/uapi/tlv.h +@@ -0,0 +1,117 @@ ++/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ ++/* ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ */ ++ ++#ifndef __UAPI_SOUND_TLV_H ++#define __UAPI_SOUND_TLV_H ++ ++#define SNDRV_CTL_TLVT_CONTAINER 0 /* one level down - group of TLVs */ ++#define SNDRV_CTL_TLVT_DB_SCALE 1 /* dB scale */ ++#define SNDRV_CTL_TLVT_DB_LINEAR 2 /* linear volume */ ++#define SNDRV_CTL_TLVT_DB_RANGE 3 /* dB range container */ ++#define SNDRV_CTL_TLVT_DB_MINMAX 4 /* dB scale with min/max */ ++#define SNDRV_CTL_TLVT_DB_MINMAX_MUTE 5 /* dB scale with min/max with mute */ ++ ++/* ++ * channel-mapping TLV items ++ * TLV length must match with num_channels ++ */ ++#define SNDRV_CTL_TLVT_CHMAP_FIXED 0x101 /* fixed channel position */ ++#define SNDRV_CTL_TLVT_CHMAP_VAR 0x102 /* channels freely swappable */ ++#define SNDRV_CTL_TLVT_CHMAP_PAIRED 0x103 /* pair-wise swappable */ ++ ++/* ++ * TLV structure is right behind the struct snd_ctl_tlv: ++ * unsigned int type - see SNDRV_CTL_TLVT_* ++ * unsigned int length ++ * .... data aligned to sizeof(unsigned int), use ++ * block_length = (length + (sizeof(unsigned int) - 1)) & ++ * ~(sizeof(unsigned int) - 1)) .... ++ */ ++#define SNDRV_CTL_TLVD_ITEM(type, ...) \ ++ (type), SNDRV_CTL_TLVD_LENGTH(__VA_ARGS__), __VA_ARGS__ ++#define SNDRV_CTL_TLVD_LENGTH(...) \ ++ ((unsigned int)sizeof((const unsigned int[]) { __VA_ARGS__ })) ++ ++/* Accessor offsets for TLV data items */ ++#define SNDRV_CTL_TLVO_TYPE 0 ++#define SNDRV_CTL_TLVO_LEN 1 ++ ++#define SNDRV_CTL_TLVD_CONTAINER_ITEM(...) \ ++ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_CONTAINER, __VA_ARGS__) ++#define SNDRV_CTL_TLVD_DECLARE_CONTAINER(name, ...) \ ++ unsigned int name[] = { \ ++ SNDRV_CTL_TLVD_CONTAINER_ITEM(__VA_ARGS__) \ ++ } ++ ++#define SNDRV_CTL_TLVD_DB_SCALE_MASK 0xffff ++#define SNDRV_CTL_TLVD_DB_SCALE_MUTE 0x10000 ++#define SNDRV_CTL_TLVD_DB_SCALE_ITEM(min, step, mute) \ ++ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_SCALE, \ ++ (min), \ ++ ((step) & SNDRV_CTL_TLVD_DB_SCALE_MASK) | \ ++ ((mute) ? SNDRV_CTL_TLVD_DB_SCALE_MUTE : 0)) ++#define SNDRV_CTL_TLVD_DECLARE_DB_SCALE(name, min, step, mute) \ ++ unsigned int name[] = { \ ++ SNDRV_CTL_TLVD_DB_SCALE_ITEM(min, step, mute) \ ++ } ++ ++/* Accessor offsets for min, mute and step items in dB scale type TLV */ ++#define SNDRV_CTL_TLVO_DB_SCALE_MIN 2 ++#define SNDRV_CTL_TLVO_DB_SCALE_MUTE_AND_STEP 3 ++ ++/* dB scale specified with min/max values instead of step */ ++#define SNDRV_CTL_TLVD_DB_MINMAX_ITEM(min_dB, max_dB) \ ++ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_MINMAX, (min_dB), (max_dB)) ++#define SNDRV_CTL_TLVD_DB_MINMAX_MUTE_ITEM(min_dB, max_dB) \ ++ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_MINMAX_MUTE, (min_dB), (max_dB)) ++#define SNDRV_CTL_TLVD_DECLARE_DB_MINMAX(name, min_dB, max_dB) \ ++ unsigned int name[] = { \ ++ SNDRV_CTL_TLVD_DB_MINMAX_ITEM(min_dB, max_dB) \ ++ } ++#define SNDRV_CTL_TLVD_DECLARE_DB_MINMAX_MUTE(name, min_dB, max_dB) \ ++ unsigned int name[] = { \ ++ SNDRV_CTL_TLVD_DB_MINMAX_MUTE_ITEM(min_dB, max_dB) \ ++ } ++ ++/* Accessor offsets for min, max items in db-minmax types of TLV. */ ++#define SNDRV_CTL_TLVO_DB_MINMAX_MIN 2 ++#define SNDRV_CTL_TLVO_DB_MINMAX_MAX 3 ++ ++/* linear volume between min_dB and max_dB (.01dB unit) */ ++#define SNDRV_CTL_TLVD_DB_LINEAR_ITEM(min_dB, max_dB) \ ++ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_LINEAR, (min_dB), (max_dB)) ++#define SNDRV_CTL_TLVD_DECLARE_DB_LINEAR(name, min_dB, max_dB) \ ++ unsigned int name[] = { \ ++ SNDRV_CTL_TLVD_DB_LINEAR_ITEM(min_dB, max_dB) \ ++ } ++ ++/* Accessor offsets for min, max items in db-linear type of TLV. */ ++#define SNDRV_CTL_TLVO_DB_LINEAR_MIN 2 ++#define SNDRV_CTL_TLVO_DB_LINEAR_MAX 3 ++ ++/* dB range container: ++ * Items in dB range container must be ordered by their values and by their ++ * dB values. This implies that larger values must correspond with larger ++ * dB values (which is also required for all other mixer controls). ++ */ ++/* Each item is: */ ++#define SNDRV_CTL_TLVD_DB_RANGE_ITEM(...) \ ++ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_RANGE, __VA_ARGS__) ++#define SNDRV_CTL_TLVD_DECLARE_DB_RANGE(name, ...) \ ++ unsigned int name[] = { \ ++ SNDRV_CTL_TLVD_DB_RANGE_ITEM(__VA_ARGS__) \ ++ } ++ ++#define SNDRV_CTL_TLVD_DB_GAIN_MUTE -9999999 ++ ++#endif +diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h +index 11efce6d..101491a4 100644 +--- a/src/topology/tplg_local.h ++++ b/src/topology/tplg_local.h +@@ -18,8 +18,7 @@ + #include "list.h" + #include "topology.h" + +-#define __packed __attribute__((__packed__)) +- ++#include + #include + #include + #include +-- +2.24.1 + + +From 75584fe660880b332fbf60dd7968e2ed8b49a38b Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Fri, 20 Dec 2019 16:12:50 +0100 +Subject: [PATCH 30/69] type_compat: Add missing __s64 and __u64 definitions + for non-Linux + +Just for the case without Linux-compatible definitions. + +Signed-off-by: Takashi Iwai +--- + include/sound/type_compat.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/include/sound/type_compat.h b/include/sound/type_compat.h +index d4790c1f..5b765f44 100644 +--- a/include/sound/type_compat.h ++++ b/include/sound/type_compat.h +@@ -9,9 +9,11 @@ + typedef uint8_t __u8; + typedef uint16_t __u16; + typedef uint32_t __u32; ++typedef uint64_t __u64; + typedef int8_t __s8; + typedef int16_t __s16; + typedef int32_t __s32; ++typedef int64_t __s64; + + #include + #include +-- +2.24.1 + + +From 59792f467b38d6a4c4dffdb30528f7fb03d23d96 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Fri, 20 Dec 2019 17:12:37 +0100 +Subject: [PATCH 31/69] uapi: Move typedefs from uapi to sound/* + +For keeping uapi/*.h cleaner. + +Signed-off-by: Takashi Iwai +--- + include/sound/emu10k1.h | 9 +++++++++ + include/sound/hdsp.h | 10 ++++++++++ + include/sound/hdspm.h | 8 ++++++++ + include/sound/sb16_csp.h | 4 ++++ + include/sound/uapi/emu10k1.h | 10 ---------- + include/sound/uapi/hdsp.h | 9 --------- + include/sound/uapi/hdspm.h | 8 -------- + 7 files changed, 31 insertions(+), 27 deletions(-) + +diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h +index f06ecee5..0832f95b 100644 +--- a/include/sound/emu10k1.h ++++ b/include/sound/emu10k1.h +@@ -1,2 +1,11 @@ + #include + #include ++#ifndef __emu10k1_type_defined ++#define __emu10k1_type_defined ++typedef struct snd_emu10k1_fx8010_info emu10k1_fx8010_info_t; ++typedef struct snd_emu10k1_fx8010_control_gpr emu10k1_fx8010_control_gpr_t; ++typedef struct snd_emu10k1_fx8010_code emu10k1_fx8010_code_t; ++typedef struct snd_emu10k1_fx8010_tram emu10k1_fx8010_tram_t; ++typedef struct snd_emu10k1_fx8010_pcm_rec emu10k1_fx8010_pcm_t; ++typedef struct emu10k1_ctl_elem_id emu10k1_ctl_elem_id_t; ++#endif +diff --git a/include/sound/hdsp.h b/include/sound/hdsp.h +index 78fb745b..e8f93156 100644 +--- a/include/sound/hdsp.h ++++ b/include/sound/hdsp.h +@@ -1,2 +1,12 @@ + #include + #include ++#ifndef __hdsp_type_defined ++#define __hdsp_type_defined ++typedef enum HDSP_IO_Type HDSP_IO_Type; ++typedef struct hdsp_peak_rms hdsp_peak_rms_t; ++typedef struct hdsp_config_info hdsp_config_info_t; ++typedef struct hdsp_firmware hdsp_firmware_t; ++typedef struct hdsp_version hdsp_version_t; ++typedef struct hdsp_mixer hdsp_mixer_t; ++typedef struct hdsp_9632_aeb hdsp_9632_aeb_t; ++#endif +diff --git a/include/sound/hdspm.h b/include/sound/hdspm.h +index af6d19ed..d9095d9f 100644 +--- a/include/sound/hdspm.h ++++ b/include/sound/hdspm.h +@@ -1,2 +1,10 @@ + #include + #include ++#ifndef __hdspm_type_defined ++#define __hdspm_type_defined ++typedef struct hdspm_peak_rms hdspm_peak_rms_t; ++typedef struct hdspm_config_info hdspm_config_info_t; ++typedef struct hdspm_version hdspm_version_t; ++typedef struct hdspm_channelfader snd_hdspm_channelfader_t; ++typedef struct hdspm_mixer hdspm_mixer_t; ++#endif +diff --git a/include/sound/sb16_csp.h b/include/sound/sb16_csp.h +index 24121fcb..fd02bc56 100644 +--- a/include/sound/sb16_csp.h ++++ b/include/sound/sb16_csp.h +@@ -1 +1,5 @@ + #include ++#ifndef __sb16_csp_type_defined ++#define __sb16_csp_type_defined ++typedef struct snd_sb_csp_microcode snd_sb_csp_microcode_t; ++#endif +diff --git a/include/sound/uapi/emu10k1.h b/include/sound/uapi/emu10k1.h +index c1150e4d..6bcd76f6 100644 +--- a/include/sound/uapi/emu10k1.h ++++ b/include/sound/uapi/emu10k1.h +@@ -382,14 +382,4 @@ struct snd_emu10k1_fx8010_pcm_rec { + #define SNDRV_EMU10K1_IOCTL_SINGLE_STEP _IOW ('H', 0x83, int) + #define SNDRV_EMU10K1_IOCTL_DBG_READ _IOR ('H', 0x84, int) + +-#ifndef __KERNEL__ +-/* typedefs for compatibility to user-space */ +-typedef struct snd_emu10k1_fx8010_info emu10k1_fx8010_info_t; +-typedef struct snd_emu10k1_fx8010_control_gpr emu10k1_fx8010_control_gpr_t; +-typedef struct snd_emu10k1_fx8010_code emu10k1_fx8010_code_t; +-typedef struct snd_emu10k1_fx8010_tram emu10k1_fx8010_tram_t; +-typedef struct snd_emu10k1_fx8010_pcm_rec emu10k1_fx8010_pcm_t; +-typedef struct emu10k1_ctl_elem_id emu10k1_ctl_elem_id_t; +-#endif +- + #endif /* _UAPI__SOUND_EMU10K1_H */ +diff --git a/include/sound/uapi/hdsp.h b/include/sound/uapi/hdsp.h +index 88c92a3f..7ac2d3f2 100644 +--- a/include/sound/uapi/hdsp.h ++++ b/include/sound/uapi/hdsp.h +@@ -97,13 +97,4 @@ struct hdsp_9632_aeb { + + #define SNDRV_HDSP_IOCTL_GET_9632_AEB _IOR('H', 0x45, struct hdsp_9632_aeb) + +-/* typedefs for compatibility to user-space */ +-typedef enum HDSP_IO_Type HDSP_IO_Type; +-typedef struct hdsp_peak_rms hdsp_peak_rms_t; +-typedef struct hdsp_config_info hdsp_config_info_t; +-typedef struct hdsp_firmware hdsp_firmware_t; +-typedef struct hdsp_version hdsp_version_t; +-typedef struct hdsp_mixer hdsp_mixer_t; +-typedef struct hdsp_9632_aeb hdsp_9632_aeb_t; +- + #endif /* __SOUND_HDSP_H */ +diff --git a/include/sound/uapi/hdspm.h b/include/sound/uapi/hdspm.h +index 2d91f90e..3fbfd9dc 100644 +--- a/include/sound/uapi/hdspm.h ++++ b/include/sound/uapi/hdspm.h +@@ -219,12 +219,4 @@ struct hdspm_mixer_ioctl { + /* use indirect access due to the limit of ioctl bit size */ + #define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdspm_mixer_ioctl) + +-/* typedefs for compatibility to user-space */ +-typedef struct hdspm_peak_rms hdspm_peak_rms_t; +-typedef struct hdspm_config_info hdspm_config_info_t; +-typedef struct hdspm_version hdspm_version_t; +-typedef struct hdspm_channelfader snd_hdspm_channelfader_t; +-typedef struct hdspm_mixer hdspm_mixer_t; +- +- + #endif +-- +2.24.1 + + +From 9e2bbccfcc8069a676519149a280f20c1e05f0ac Mon Sep 17 00:00:00 2001 +From: David Ward +Date: Fri, 3 Jan 2020 13:05:51 -0500 +Subject: [PATCH 32/69] Update the attributes.m4 macro file from xine +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This file was imported from the xine project. Update it to the current +revision, which resolves the "no AC_LANG_SOURCE call detected in body" +warnings with Autoconf 2.68 or later. + +Cc: Diego Pettenò +Signed-off-by: David Ward +Signed-off-by: Jaroslav Kysela +--- + m4/attributes.m4 | 33 ++++++++++++++++++++------------- + 1 file changed, 20 insertions(+), 13 deletions(-) + +diff --git a/m4/attributes.m4 b/m4/attributes.m4 +index e86456a4..3d9c256a 100644 +--- a/m4/attributes.m4 ++++ b/m4/attributes.m4 +@@ -1,6 +1,6 @@ + dnl Macros to check the presence of generic (non-typed) symbols. +-dnl Copyright (c) 2006-2007 Diego Pettenò +-dnl Copyright (c) 2006-2007 xine project ++dnl Copyright (c) 2006-2008 Diego Pettenò ++dnl Copyright (c) 2006-2008 xine project + dnl + dnl This program is free software; you can redistribute it and/or modify + dnl it under the terms of the GNU General Public License as published by +@@ -25,7 +25,7 @@ dnl License when using or distributing such scripts, even though portions + dnl of the text of the Macro appear in them. The GNU General Public + dnl License (GPL) does govern all other use of the material that + dnl constitutes the Autoconf Macro. +-dnl ++dnl + dnl This special exception to the GPL applies to versions of the + dnl Autoconf Macro released by this project. When you make and + dnl distribute a modified version of the Autoconf Macro, you may extend +@@ -39,7 +39,7 @@ AC_DEFUN([CC_CHECK_CFLAGS_SILENT], [ + AC_CACHE_VAL(AS_TR_SH([cc_cv_cflags_$1]), + [ac_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $1" +- AC_COMPILE_IFELSE([int a;], ++ AC_COMPILE_IFELSE([AC_LANG_SOURCE([int a;])], + [eval "AS_TR_SH([cc_cv_cflags_$1])='yes'"], + [eval "AS_TR_SH([cc_cv_cflags_$1])='no'"]) + CFLAGS="$ac_save_CFLAGS" +@@ -71,7 +71,7 @@ AC_DEFUN([CC_CHECK_CFLAG_APPEND], [ + ) + + AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes], +- [CFLAGS="$CFLAGS $1"; $2], [$3]) ++ [CFLAGS="$CFLAGS $1"; DEBUG_CFLAGS="$DEBUG_CFLAGS $1"; $2], [$3]) + ]) + + dnl CC_CHECK_CFLAGS_APPEND([FLAG1 FLAG2], [action-if-found], [action-if-not]) +@@ -89,7 +89,7 @@ AC_DEFUN([CC_CHECK_LDFLAGS], [ + AS_TR_SH([cc_cv_ldflags_$1]), + [ac_save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $1" +- AC_LINK_IFELSE([int main() { return 1; }], ++ AC_LINK_IFELSE([AC_LANG_SOURCE([int main() { return 1; }])], + [eval "AS_TR_SH([cc_cv_ldflags_$1])='yes'"], + [eval "AS_TR_SH([cc_cv_ldflags_$1])="]) + LDFLAGS="$ac_save_LDFLAGS" +@@ -109,14 +109,21 @@ AC_DEFUN([CC_NOUNDEFINED], [ + dnl FreeBSD (et al.) does not complete linking for shared objects when pthreads + dnl are requested, as different implementations are present; to avoid problems + dnl use -Wl,-z,defs only for those platform not behaving this way. +- *-freebsd*) ;; ++ dnl ++ dnl MinGW platforms: for libraries required -no-undefined, ++ dnl use it only for libraries in mingw32-w64 ++ ++ *-freebsd* | *-openbsd*) ;; ++ *-mingw*) ++ LDFLAGS_NOUNDEFINED="-no-undefined" ++ ;; + *) + dnl First of all check for the --no-undefined variant of GNU ld. This allows + dnl for a much more readable commandline, so that people can understand what + dnl it does without going to look for what the heck -z defs does. +- for possible_flags in "-Wl,--no-undefined" "-Wl,-z,defs"; do ++ for possible_flags in "-Wl,--no-undefined" "-Wl,-z,defs"; do + CC_CHECK_LDFLAGS([$possible_flags], [LDFLAGS_NOUNDEFINED="$possible_flags"]) +- break ++ if test "x$LDFLAGS_NOUNDEFINED" = "x"; then break; fi + done + ;; + esac +@@ -147,7 +154,7 @@ AC_DEFUN([CC_CHECK_ATTRIBUTE], [ + AS_TR_SH([cc_cv_attribute_$1]), + [ac_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $cc_cv_werror" +- AC_COMPILE_IFELSE([$3], ++ AC_COMPILE_IFELSE([AC_LANG_SOURCE([$3])], + [eval "AS_TR_SH([cc_cv_attribute_$1])='yes'"], + [eval "AS_TR_SH([cc_cv_attribute_$1])='no'"]) + CFLAGS="$ac_save_CFLAGS" +@@ -257,7 +264,7 @@ AC_DEFUN([CC_FLAG_VISIBILITY], [ + cc_cv_flag_visibility='yes', + cc_cv_flag_visibility='no') + CFLAGS="$cc_flag_visibility_save_CFLAGS"]) +- ++ + AS_IF([test "x$cc_cv_flag_visibility" = "xyes"], + [AC_DEFINE([SUPPORT_FLAG_VISIBILITY], 1, + [Define this if the compiler supports the -fvisibility flag]) +@@ -295,11 +302,11 @@ AC_DEFUN([CC_ATTRIBUTE_ALIGNED], [ + [ac_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $cc_cv_werror" + for cc_attribute_align_try in 64 32 16 8 4 2; do +- AC_COMPILE_IFELSE([ ++ AC_COMPILE_IFELSE([AC_LANG_SOURCE([ + int main() { + static char c __attribute__ ((aligned($cc_attribute_align_try))) = 0; + return c; +- }], [cc_cv_attribute_aligned=$cc_attribute_align_try; break]) ++ }])], [cc_cv_attribute_aligned=$cc_attribute_align_try; break]) + done + CFLAGS="$ac_save_CFLAGS" + ]) +-- +2.24.1 + + +From f373bf1f6eea0f2037a7714e9b55aa65fa00b889 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Sat, 14 Dec 2019 13:36:09 +0100 +Subject: [PATCH 33/69] topology: avoid to use the atoi() directly when + expected + +Signed-off-by: Jaroslav Kysela +--- + src/topology/channel.c | 10 +-- + src/topology/ctl.c | 37 +++++----- + src/topology/dapm.c | 32 +++++---- + src/topology/data.c | 14 ++-- + src/topology/elem.c | 9 ++- + src/topology/ops.c | 2 +- + src/topology/parser.c | 29 ++++++++ + src/topology/pcm.c | 148 +++++++++++++++++--------------------- + src/topology/tplg_local.h | 2 + + 9 files changed, 150 insertions(+), 133 deletions(-) + +diff --git a/src/topology/channel.c b/src/topology/channel.c +index 60f7e219..4569eb31 100644 +--- a/src/topology/channel.c ++++ b/src/topology/channel.c +@@ -80,8 +80,8 @@ int tplg_parse_channel(snd_tplg_t *tplg, snd_config_t *cfg, + snd_config_iterator_t i, next; + snd_config_t *n; + struct snd_soc_tplg_channel *channel = private; +- const char *id, *value; +- int channel_id; ++ const char *id; ++ int channel_id, value; + + if (tplg->channel_idx >= SND_SOC_TPLG_MAX_CHAN) + return -EINVAL; +@@ -109,13 +109,13 @@ int tplg_parse_channel(snd_tplg_t *tplg, snd_config_t *cfg, + continue; + + /* get value */ +- if (snd_config_get_string(n, &value) < 0) ++ if (tplg_get_integer(n, &value, 0) < 0) + continue; + + if (strcmp(id, "reg") == 0) +- channel->reg = atoi(value); ++ channel->reg = value; + else if (strcmp(id, "shift") == 0) +- channel->shift = atoi(value); ++ channel->shift = value; + + tplg_dbg("\t\t%s = %s\n", id, value); + } +diff --git a/src/topology/ctl.c b/src/topology/ctl.c +index 1db0b16e..e1896f46 100644 +--- a/src/topology/ctl.c ++++ b/src/topology/ctl.c +@@ -286,7 +286,8 @@ static int tplg_parse_tlv_dbscale(snd_config_t *cfg, struct tplg_elem *elem) + snd_config_t *n; + struct snd_soc_tplg_ctl_tlv *tplg_tlv; + struct snd_soc_tplg_tlv_dbscale *scale; +- const char *id = NULL, *value = NULL; ++ const char *id = NULL; ++ int val; + + tplg_dbg(" scale: %s\n", elem->id); + +@@ -310,18 +311,18 @@ static int tplg_parse_tlv_dbscale(snd_config_t *cfg, struct tplg_elem *elem) + } + + /* get value */ +- if (snd_config_get_string(n, &value) < 0) ++ if (tplg_get_integer(n, &val, 0)) + continue; + +- tplg_dbg("\t%s = %s\n", id, value); ++ tplg_dbg("\t%s = %i\n", id, val); + + /* get TLV data */ + if (strcmp(id, "min") == 0) +- scale->min = atoi(value); ++ scale->min = val; + else if (strcmp(id, "step") == 0) +- scale->step = atoi(value); ++ scale->step = val; + else if (strcmp(id, "mute") == 0) +- scale->mute = atoi(value); ++ scale->mute = val; + else + SNDERR("error: unknown key %s\n", id); + } +@@ -372,7 +373,7 @@ int tplg_parse_control_bytes(snd_tplg_t *tplg, + snd_config_iterator_t i, next; + snd_config_t *n; + const char *id, *val = NULL; +- int err; ++ int err, ival; + bool access_set = false, tlv_set = false; + + elem = tplg_elem_new_common(tplg, cfg, NULL, SND_TPLG_TYPE_BYTES); +@@ -398,37 +399,37 @@ int tplg_parse_control_bytes(snd_tplg_t *tplg, + continue; + + if (strcmp(id, "base") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ if (tplg_get_integer(n, &ival, 0)) + return -EINVAL; + +- be->base = atoi(val); ++ be->base = ival; + tplg_dbg("\t%s: %d\n", id, be->base); + continue; + } + + if (strcmp(id, "num_regs") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ if (tplg_get_integer(n, &ival, 0)) + return -EINVAL; + +- be->num_regs = atoi(val); ++ be->num_regs = ival; + tplg_dbg("\t%s: %d\n", id, be->num_regs); + continue; + } + + if (strcmp(id, "max") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ if (tplg_get_integer(n, &ival, 0)) + return -EINVAL; + +- be->max = atoi(val); ++ be->max = ival; + tplg_dbg("\t%s: %d\n", id, be->max); + continue; + } + + if (strcmp(id, "mask") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ if (tplg_get_integer(n, &ival, 16)) + return -EINVAL; + +- be->mask = strtol(val, NULL, 16); ++ be->mask = ival; + tplg_dbg("\t%s: %d\n", id, be->mask); + continue; + } +@@ -598,7 +599,7 @@ int tplg_parse_control_mixer(snd_tplg_t *tplg, + snd_config_iterator_t i, next; + snd_config_t *n; + const char *id, *val = NULL; +- int err, j; ++ int err, j, ival; + bool access_set = false, tlv_set = false; + + elem = tplg_elem_new_common(tplg, cfg, NULL, SND_TPLG_TYPE_MIXER); +@@ -647,10 +648,10 @@ int tplg_parse_control_mixer(snd_tplg_t *tplg, + } + + if (strcmp(id, "max") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ if (tplg_get_integer(n, &ival, 0)) + return -EINVAL; + +- mc->max = atoi(val); ++ mc->max = ival; + tplg_dbg("\t%s: %d\n", id, mc->max); + continue; + } +diff --git a/src/topology/dapm.c b/src/topology/dapm.c +index ce469131..c6fd793d 100644 +--- a/src/topology/dapm.c ++++ b/src/topology/dapm.c +@@ -426,7 +426,7 @@ int tplg_parse_dapm_graph(snd_tplg_t *tplg, snd_config_t *cfg, + snd_config_iterator_t i, next; + snd_config_t *n; + int err; +- const char *graph_id, *val = NULL; ++ const char *graph_id; + int index = -1; + + if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) { +@@ -445,9 +445,10 @@ int tplg_parse_dapm_graph(snd_tplg_t *tplg, snd_config_t *cfg, + } + + if (strcmp(id, "index") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ if (tplg_get_integer(n, &index, 0)) ++ return -EINVAL; ++ if (index < 0) + return -EINVAL; +- index = atoi(val); + } + + if (strcmp(id, "lines") == 0) { +@@ -479,6 +480,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, + snd_config_t *n; + const char *id, *val = NULL; + int widget_type, err; ++ int ival; + + elem = tplg_elem_new_common(tplg, cfg, NULL, SND_TPLG_TYPE_DAPM_WIDGET); + if (!elem) +@@ -540,55 +542,55 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, + } + + if (strcmp(id, "shift") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ if (tplg_get_integer(n, &ival, 0)) + return -EINVAL; + +- widget->shift = atoi(val); ++ widget->shift = ival; + tplg_dbg("\t%s: %d\n", id, widget->shift); + continue; + } + + if (strcmp(id, "reg") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ if (tplg_get_integer(n, &ival, 0)) + return -EINVAL; + +- widget->reg = atoi(val); ++ widget->reg = ival; + tplg_dbg("\t%s: %d\n", id, widget->reg); + continue; + } + + if (strcmp(id, "invert") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ if (tplg_get_integer(n, &ival, 0)) + return -EINVAL; + +- widget->invert = atoi(val); ++ widget->invert = ival; + tplg_dbg("\t%s: %d\n", id, widget->invert); + continue; + } + + if (strcmp(id, "subseq") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ if (tplg_get_integer(n, &ival, 0)) + return -EINVAL; + +- widget->subseq= atoi(val); ++ widget->subseq = ival; + tplg_dbg("\t%s: %d\n", id, widget->subseq); + continue; + } + + if (strcmp(id, "event_type") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ if (tplg_get_integer(n, &ival, 0)) + return -EINVAL; + +- widget->event_type = atoi(val); ++ widget->event_type = ival; + tplg_dbg("\t%s: %d\n", id, widget->event_type); + continue; + } + + if (strcmp(id, "event_flags") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ if (tplg_get_integer(n, &ival, 0)) + return -EINVAL; + +- widget->event_flags = atoi(val); ++ widget->event_flags = ival; + tplg_dbg("\t%s: %d\n", id, widget->event_flags); + continue; + } +diff --git a/src/topology/data.c b/src/topology/data.c +index 729ce1f4..0edfe54f 100644 +--- a/src/topology/data.c ++++ b/src/topology/data.c +@@ -800,10 +800,10 @@ int tplg_parse_tokens(snd_tplg_t *tplg, snd_config_t *cfg, + { + snd_config_iterator_t i, next; + snd_config_t *n; +- const char *id, *value; ++ const char *id; + struct tplg_elem *elem; + struct tplg_vendor_tokens *tokens; +- int num_tokens = 0; ++ int num_tokens = 0, value; + + elem = tplg_elem_new_common(tplg, cfg, NULL, SND_TPLG_TYPE_TOKEN); + if (!elem) +@@ -830,12 +830,12 @@ int tplg_parse_tokens(snd_tplg_t *tplg, snd_config_t *cfg, + if (snd_config_get_id(n, &id) < 0) + continue; + +- if (snd_config_get_string(n, &value) < 0) ++ if (tplg_get_integer(n, &value, 0)) + continue; + + snd_strlcpy(tokens->token[tokens->num_tokens].id, id, + SNDRV_CTL_ELEM_ID_NAME_MAXLEN); +- tokens->token[tokens->num_tokens].value = atoi(value); ++ tokens->token[tokens->num_tokens].value = value; + tplg_dbg("\t\t %s : %d\n", tokens->token[tokens->num_tokens].id, + tokens->token[tokens->num_tokens].value); + tokens->num_tokens++; +@@ -1013,7 +1013,7 @@ int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg, + snd_config_iterator_t i, next; + snd_config_t *n; + const char *id, *val = NULL; +- int err = 0; ++ int err = 0, ival; + struct tplg_elem *elem; + + elem = tplg_elem_new_common(tplg, cfg, NULL, SND_TPLG_TYPE_DATA); +@@ -1071,10 +1071,10 @@ int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg, + } + + if (strcmp(id, "type") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ if (tplg_get_integer(n, &ival, 0)) + return -EINVAL; + +- elem->vendor_type = atoi(val); ++ elem->vendor_type = ival; + tplg_dbg("\t%s: %d\n", id, elem->index); + continue; + } +diff --git a/src/topology/elem.c b/src/topology/elem.c +index d8618cc9..f2076f79 100644 +--- a/src/topology/elem.c ++++ b/src/topology/elem.c +@@ -153,7 +153,7 @@ struct tplg_elem* tplg_elem_new_common(snd_tplg_t *tplg, + enum snd_tplg_type type) + { + struct tplg_elem *elem; +- const char *id, *val = NULL; ++ const char *id; + int obj_size = 0; + void *obj; + snd_config_iterator_t i, next; +@@ -178,11 +178,14 @@ struct tplg_elem* tplg_elem_new_common(snd_tplg_t *tplg, + if (snd_config_get_id(n, &id)) + continue; + if (strcmp(id, "index") == 0) { +- if (snd_config_get_string(n, &val) < 0) { ++ if (tplg_get_integer(n, &elem->index, 0)) { ++ free(elem); ++ return NULL; ++ } ++ if (elem->index < 0) { + free(elem); + return NULL; + } +- elem->index = atoi(val); + } + } + } else if (name != NULL) +diff --git a/src/topology/ops.c b/src/topology/ops.c +index 0f4295a2..073acdcb 100644 +--- a/src/topology/ops.c ++++ b/src/topology/ops.c +@@ -42,7 +42,7 @@ static int lookup_ops(const char *c) + } + + /* cant find string name in our table so we use its ID number */ +- return atoi(c); ++ return strtol(c, NULL, 0); + } + + /* Parse Control operations. Ops can come from standard names above or +diff --git a/src/topology/parser.c b/src/topology/parser.c +index 5940692d..7e657809 100644 +--- a/src/topology/parser.c ++++ b/src/topology/parser.c +@@ -21,6 +21,35 @@ + #include "list.h" + #include "tplg_local.h" + ++/* ++ * Get integer value ++ */ ++int tplg_get_integer(snd_config_t *n, int *val, int base) ++{ ++ const char *str; ++ long lval; ++ int err; ++ ++ switch (snd_config_get_type(n)) { ++ case SND_CONFIG_TYPE_INTEGER: ++ err = snd_config_get_integer(n, &lval); ++ if (err < 0) ++ return err; ++ if (lval < INT_MIN || lval > INT_MAX) ++ return -EINVAL; ++ *val = lval; ++ return err; ++ case SND_CONFIG_TYPE_STRING: ++ err = snd_config_get_string(n, &str); ++ if (err < 0) ++ return err; ++ *val = strtol(str, NULL, base); ++ return 0; ++ default: ++ return -EINVAL; ++ } ++} ++ + /* + * Parse compound + */ +diff --git a/src/topology/pcm.c b/src/topology/pcm.c +index 98a8df97..d6c52b47 100644 +--- a/src/topology/pcm.c ++++ b/src/topology/pcm.c +@@ -368,6 +368,24 @@ static int split_rate(struct snd_soc_tplg_stream_caps *caps, char *str) + return 0; + } + ++static int parse_unsigned(snd_config_t *n, unsigned int *dst) ++{ ++ int ival; ++ ++ if (tplg_get_integer(n, &ival, 0) < 0) ++ return -EINVAL; ++ ++ *dst = ival; ++#if TPLG_DEBUG ++ { ++ const char *id; ++ if (snd_config_get_id(n, &id) >= 0) ++ tplg_dbg("\t\t%s: %d\n", id, *dst); ++ } ++#endif ++ return 0; ++} ++ + /* Parse pcm stream capabilities */ + int tplg_parse_stream_caps(snd_tplg_t *tplg, + snd_config_t *cfg, +@@ -402,10 +420,10 @@ int tplg_parse_stream_caps(snd_tplg_t *tplg, + if (id[0] == '#') + continue; + +- if (snd_config_get_string(n, &val) < 0) +- return -EINVAL; +- + if (strcmp(id, "formats") == 0) { ++ if (snd_config_get_string(n, &val) < 0) ++ return -EINVAL; ++ + s = strdup(val); + if (s == NULL) + return -ENOMEM; +@@ -421,6 +439,9 @@ int tplg_parse_stream_caps(snd_tplg_t *tplg, + } + + if (strcmp(id, "rates") == 0) { ++ if (snd_config_get_string(n, &val) < 0) ++ return -EINVAL; ++ + s = strdup(val); + if (!s) + return -ENOMEM; +@@ -436,68 +457,68 @@ int tplg_parse_stream_caps(snd_tplg_t *tplg, + } + + if (strcmp(id, "rate_min") == 0) { +- sc->rate_min = atoi(val); +- tplg_dbg("\t\t%s: %d\n", id, sc->rate_min); ++ if (parse_unsigned(n, &sc->rate_min)) ++ return -EINVAL; + continue; + } + + if (strcmp(id, "rate_max") == 0) { +- sc->rate_max = atoi(val); +- tplg_dbg("\t\t%s: %d\n", id, sc->rate_max); ++ if (parse_unsigned(n, &sc->rate_max)) ++ return -EINVAL; + continue; + } + + if (strcmp(id, "channels_min") == 0) { +- sc->channels_min = atoi(val); +- tplg_dbg("\t\t%s: %d\n", id, sc->channels_min); ++ if (parse_unsigned(n, &sc->channels_min)) ++ return -EINVAL; + continue; + } + + if (strcmp(id, "channels_max") == 0) { +- sc->channels_max = atoi(val); +- tplg_dbg("\t\t%s: %d\n", id, sc->channels_max); ++ if (parse_unsigned(n, &sc->channels_max)) ++ return -EINVAL; + continue; + } + + if (strcmp(id, "periods_min") == 0) { +- sc->periods_min = atoi(val); +- tplg_dbg("\t\t%s: %d\n", id, sc->periods_min); ++ if (parse_unsigned(n, &sc->periods_min)) ++ return -EINVAL; + continue; + } + + if (strcmp(id, "periods_max") == 0) { +- sc->periods_max = atoi(val); +- tplg_dbg("\t\t%s: %d\n", id, sc->periods_max); ++ if (parse_unsigned(n, &sc->periods_max)) ++ return -EINVAL; + continue; + } + + if (strcmp(id, "period_size_min") == 0) { +- sc->period_size_min = atoi(val); +- tplg_dbg("\t\t%s: %d\n", id, sc->period_size_min); ++ if (parse_unsigned(n, &sc->period_size_min)) ++ return -EINVAL; + continue; + } + + if (strcmp(id, "period_size_max") == 0) { +- sc->period_size_max = atoi(val); +- tplg_dbg("\t\t%s: %d\n", id, sc->period_size_max); ++ if (parse_unsigned(n, &sc->period_size_max)) ++ return -EINVAL; + continue; + } + + if (strcmp(id, "buffer_size_min") == 0) { +- sc->buffer_size_min = atoi(val); +- tplg_dbg("\t\t%s: %d\n", id, sc->buffer_size_min); ++ if (parse_unsigned(n, &sc->buffer_size_min)) ++ return -EINVAL; + continue; + } + + if (strcmp(id, "buffer_size_max") == 0) { +- sc->buffer_size_max = atoi(val); +- tplg_dbg("\t\t%s: %d\n", id, sc->buffer_size_max); ++ if (parse_unsigned(n, &sc->buffer_size_max)) ++ return -EINVAL; + continue; + } + + if (strcmp(id, "sig_bits") == 0) { +- sc->sig_bits = atoi(val); +- tplg_dbg("\t\t%s: %d\n", id, sc->sig_bits); ++ if (parse_unsigned(n, &sc->sig_bits)) ++ return -EINVAL; + continue; + } + +@@ -674,11 +695,8 @@ int tplg_parse_pcm(snd_tplg_t *tplg, snd_config_t *cfg, + continue; + + if (strcmp(id, "id") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ if (parse_unsigned(n, &pcm->pcm_id)) + return -EINVAL; +- +- pcm->pcm_id = atoi(val); +- tplg_dbg("\t%s: %d\n", id, pcm->pcm_id); + continue; + } + +@@ -784,30 +802,21 @@ int tplg_parse_dai(snd_tplg_t *tplg, snd_config_t *cfg, + continue; + + if (strcmp(id, "id") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ if (parse_unsigned(n, &dai->dai_id)) + return -EINVAL; +- +- dai->dai_id = atoi(val); +- tplg_dbg("\t%s: %d\n", id, dai->dai_id); + continue; + } + + if (strcmp(id, "playback") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ if (parse_unsigned(n, &dai->playback)) + return -EINVAL; +- +- dai->playback = atoi(val); +- tplg_dbg("\t%s: %d\n", id, dai->playback); + continue; + } + + + if (strcmp(id, "capture") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ if (parse_unsigned(n, &dai->capture)) + return -EINVAL; +- +- dai->capture = atoi(val); +- tplg_dbg("\t%s: %d\n", id, dai->capture); + continue; + } + +@@ -949,11 +958,8 @@ int tplg_parse_link(snd_tplg_t *tplg, + continue; + + if (strcmp(id, "id") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ if (parse_unsigned(n, &link->id)) + return -EINVAL; +- +- link->id = atoi(val); +- tplg_dbg("\t%s: %d\n", id, link->id); + continue; + } + +@@ -975,10 +981,8 @@ int tplg_parse_link(snd_tplg_t *tplg, + } + + if (strcmp(id, "default_hw_conf_id") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ if (parse_unsigned(n, &link->default_hw_config_id)) + return -EINVAL; +- +- link->default_hw_config_id = atoi(val); + continue; + } + +@@ -1030,7 +1034,7 @@ int tplg_parse_cc(snd_tplg_t *tplg, + struct tplg_elem *elem; + snd_config_iterator_t i, next; + snd_config_t *n; +- const char *id, *val = NULL; ++ const char *id; + + elem = tplg_elem_new_common(tplg, cfg, NULL, SND_TPLG_TYPE_CC); + if (!elem) +@@ -1054,11 +1058,8 @@ int tplg_parse_cc(snd_tplg_t *tplg, + continue; + + if (strcmp(id, "id") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ if (parse_unsigned(n, &link->id)) + return -EINVAL; +- +- link->id = atoi(val); +- tplg_dbg("\t%s: %d\n", id, link->id); + continue; + } + +@@ -1130,11 +1131,8 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, + continue; + + if (strcmp(id, "id") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ if (parse_unsigned(n, &hw_cfg->id)) + return -EINVAL; +- +- hw_cfg->id = atoi(val); +- tplg_dbg("\t%s: %d\n", id, hw_cfg->id); + continue; + } + +@@ -1173,10 +1171,8 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, + + if (strcmp(id, "bclk_freq") == 0 || + strcmp(id, "bclk_rate") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ if (parse_unsigned(n, &hw_cfg->bclk_rate)) + return -EINVAL; +- +- hw_cfg->bclk_rate = atoi(val); + continue; + } + +@@ -1223,19 +1219,15 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, + + if (strcmp(id, "fsync_freq") == 0 || + strcmp(id, "fsync_rate") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ if (parse_unsigned(n, &hw_cfg->fsync_rate)) + return -EINVAL; +- +- hw_cfg->fsync_rate = atoi(val); + continue; + } + + if (strcmp(id, "mclk_freq") == 0 || + strcmp(id, "mclk_rate") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ if (parse_unsigned(n, &hw_cfg->mclk_rate)) + return -EINVAL; +- +- hw_cfg->mclk_rate = atoi(val); + continue; + } + +@@ -1275,50 +1267,38 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, + } + + if (strcmp(id, "tdm_slots") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ if (parse_unsigned(n, &hw_cfg->tdm_slots)) + return -EINVAL; +- +- hw_cfg->tdm_slots = atoi(val); + continue; + } + + if (strcmp(id, "tdm_slot_width") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ if (parse_unsigned(n, &hw_cfg->tdm_slot_width)) + return -EINVAL; +- +- hw_cfg->tdm_slot_width = atoi(val); + continue; + } + + if (strcmp(id, "tx_slots") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ if (parse_unsigned(n, &hw_cfg->tx_slots)) + return -EINVAL; +- +- hw_cfg->tx_slots = atoi(val); + continue; + } + + if (strcmp(id, "rx_slots") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ if (parse_unsigned(n, &hw_cfg->rx_slots)) + return -EINVAL; +- +- hw_cfg->rx_slots = atoi(val); + continue; + } + + if (strcmp(id, "tx_channels") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ if (parse_unsigned(n, &hw_cfg->tx_channels)) + return -EINVAL; +- +- hw_cfg->tx_channels = atoi(val); + continue; + } + + if (strcmp(id, "rx_channels") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ if (parse_unsigned(n, &hw_cfg->rx_channels)) + return -EINVAL; +- +- hw_cfg->rx_channels = atoi(val); + continue; + } + +diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h +index 101491a4..991e0b41 100644 +--- a/src/topology/tplg_local.h ++++ b/src/topology/tplg_local.h +@@ -280,6 +280,8 @@ struct tplg_elem *tplg_elem_lookup(struct list_head *base, + struct tplg_elem* tplg_elem_new_common(snd_tplg_t *tplg, + snd_config_t *cfg, const char *name, enum snd_tplg_type type); + ++int tplg_get_integer(snd_config_t *n, int *val, int base); ++ + int tplg_parse_channel(snd_tplg_t *tplg ATTRIBUTE_UNUSED, + snd_config_t *cfg, void *private); + +-- +2.24.1 + + +From 5925a6d870331c631f85ed4e18a8c5e6459b3c36 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Sat, 14 Dec 2019 13:50:04 +0100 +Subject: [PATCH 34/69] topology: use snd_config_get_bool() instead own + implementation + +Signed-off-by: Jaroslav Kysela +--- + src/topology/ctl.c | 9 +++------ + src/topology/dapm.c | 9 ++++----- + src/topology/data.c | 15 ++++++++++++--- + src/topology/pcm.c | 29 +++++++++++++++-------------- + 4 files changed, 34 insertions(+), 28 deletions(-) + +diff --git a/src/topology/ctl.c b/src/topology/ctl.c +index e1896f46..9190efef 100644 +--- a/src/topology/ctl.c ++++ b/src/topology/ctl.c +@@ -657,13 +657,10 @@ int tplg_parse_control_mixer(snd_tplg_t *tplg, + } + + if (strcmp(id, "invert") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ ival = snd_config_get_bool(n); ++ if (ival < 0) + return -EINVAL; +- +- if (strcmp(val, "true") == 0) +- mc->invert = 1; +- else if (strcmp(val, "false") == 0) +- mc->invert = 0; ++ mc->invert = ival; + + tplg_dbg("\t%s: %d\n", id, mc->invert); + continue; +diff --git a/src/topology/dapm.c b/src/topology/dapm.c +index c6fd793d..ad709210 100644 +--- a/src/topology/dapm.c ++++ b/src/topology/dapm.c +@@ -479,8 +479,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, + snd_config_iterator_t i, next; + snd_config_t *n; + const char *id, *val = NULL; +- int widget_type, err; +- int ival; ++ int widget_type, err, ival; + + elem = tplg_elem_new_common(tplg, cfg, NULL, SND_TPLG_TYPE_DAPM_WIDGET); + if (!elem) +@@ -531,11 +530,11 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, + } + + if (strcmp(id, "no_pm") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ ival = snd_config_get_bool(n); ++ if (ival < 0) + return -EINVAL; + +- if (strcmp(val, "true") == 0) +- widget->reg = -1; ++ widget->reg = ival ? -1 : 0; + + tplg_dbg("\t%s: %s\n", id, val); + continue; +diff --git a/src/topology/data.c b/src/topology/data.c +index 0edfe54f..6b1337b3 100644 +--- a/src/topology/data.c ++++ b/src/topology/data.c +@@ -557,6 +557,7 @@ static int parse_tuple_set(snd_config_t *cfg, + unsigned int type, num_tuples = 0; + struct tplg_tuple *tuple; + unsigned long int tuple_val; ++ int ival; + + snd_config_get_id(cfg, &id); + +@@ -607,25 +608,33 @@ static int parse_tuple_set(snd_config_t *cfg, + + switch (type) { + case SND_SOC_TPLG_TUPLE_TYPE_UUID: ++ if (snd_config_get_string(n, &value) < 0) ++ continue; + if (get_uuid(value, tuple->uuid) < 0) + goto err; + break; + + case SND_SOC_TPLG_TUPLE_TYPE_STRING: ++ if (snd_config_get_string(n, &value) < 0) ++ continue; + snd_strlcpy(tuple->string, value, + SNDRV_CTL_ELEM_ID_NAME_MAXLEN); + tplg_dbg("\t\t%s = %s\n", tuple->token, tuple->string); + break; + + case SND_SOC_TPLG_TUPLE_TYPE_BOOL: +- if (strcmp(value, "true") == 0) +- tuple->value = 1; ++ ival = snd_config_get_bool(n); ++ if (ival < 0) ++ continue; ++ tuple->value = ival; + tplg_dbg("\t\t%s = %d\n", tuple->token, tuple->value); + break; + + case SND_SOC_TPLG_TUPLE_TYPE_BYTE: + case SND_SOC_TPLG_TUPLE_TYPE_SHORT: + case SND_SOC_TPLG_TUPLE_TYPE_WORD: ++ if (snd_config_get_string(n, &value) < 0) ++ continue; + errno = 0; + /* no support for negative value */ + tuple_val = strtoul(value, NULL, 0); +@@ -1012,7 +1021,7 @@ int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg, + { + snd_config_iterator_t i, next; + snd_config_t *n; +- const char *id, *val = NULL; ++ const char *id; + int err = 0, ival; + struct tplg_elem *elem; + +diff --git a/src/topology/pcm.c b/src/topology/pcm.c +index d6c52b47..6364e24f 100644 +--- a/src/topology/pcm.c ++++ b/src/topology/pcm.c +@@ -669,8 +669,8 @@ int tplg_parse_pcm(snd_tplg_t *tplg, snd_config_t *cfg, + struct tplg_elem *elem; + snd_config_iterator_t i, next; + snd_config_t *n; +- const char *id, *val = NULL; +- int err; ++ const char *id; ++ int err, ival; + + elem = tplg_elem_new_common(tplg, cfg, NULL, SND_TPLG_TYPE_PCM); + if (!elem) +@@ -709,11 +709,11 @@ int tplg_parse_pcm(snd_tplg_t *tplg, snd_config_t *cfg, + } + + if (strcmp(id, "compress") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ ival = snd_config_get_bool(n); ++ if (ival < 0) + return -EINVAL; + +- if (strcmp(val, "true") == 0) +- pcm->compress = 1; ++ pcm->compress = ival; + + tplg_dbg("\t%s: %s\n", id, val); + continue; +@@ -1107,7 +1107,7 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, + snd_config_iterator_t i, next; + snd_config_t *n; + const char *id, *val = NULL; +- int ret; ++ int ret, ival; + + elem = tplg_elem_new_common(tplg, cfg, NULL, SND_TPLG_TYPE_HW_CONFIG); + if (!elem) +@@ -1178,11 +1178,11 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, + + if (strcmp(id, "bclk_invert") == 0 || + strcmp(id, "invert_bclk") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ ival = snd_config_get_bool(n); ++ if (ival < 0) + return -EINVAL; + +- if (!strcmp(val, "true")) +- hw_cfg->invert_bclk = true; ++ hw_cfg->invert_bclk = ival; + continue; + } + +@@ -1209,11 +1209,11 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, + + if (strcmp(id, "fsync_invert") == 0 || + strcmp(id, "invert_fsync") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ ival = snd_config_get_bool(n); ++ if (ival < 0) + return -EINVAL; + +- if (!strcmp(val, "true")) +- hw_cfg->invert_fsync = true; ++ hw_cfg->invert_fsync = ival; + continue; + } + +@@ -1254,10 +1254,11 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, + + if (strcmp(id, "pm_gate_clocks") == 0 || + strcmp(id, "clock_gated") == 0) { +- if (snd_config_get_string(n, &val) < 0) ++ ival = snd_config_get_bool(n); ++ if (ival < 0) + return -EINVAL; + +- if (!strcmp(val, "true")) ++ if (ival) + hw_cfg->clock_gated = + SND_SOC_TPLG_DAI_CLK_GATE_GATED; + else +-- +2.24.1 + + +From 1047a5f3c0d39a3b0579db027f52d7facdf44077 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Sat, 14 Dec 2019 13:52:18 +0100 +Subject: [PATCH 35/69] topology: fix tplg_get_integer() - handle errno == + ERANGE + +Signed-off-by: Jaroslav Kysela +--- + src/topology/parser.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/src/topology/parser.c b/src/topology/parser.c +index 7e657809..667c8d45 100644 +--- a/src/topology/parser.c ++++ b/src/topology/parser.c +@@ -36,14 +36,19 @@ int tplg_get_integer(snd_config_t *n, int *val, int base) + if (err < 0) + return err; + if (lval < INT_MIN || lval > INT_MAX) +- return -EINVAL; ++ return -ERANGE; + *val = lval; + return err; + case SND_CONFIG_TYPE_STRING: + err = snd_config_get_string(n, &str); + if (err < 0) + return err; ++ errno = 0; + *val = strtol(str, NULL, base); ++ if (errno == ERANGE) ++ return -ERANGE; ++ if (errno && *val == 0) ++ return -EINVAL; + return 0; + default: + return -EINVAL; +-- +2.24.1 + + +From 14e43a11873d14ec6f16967c83629237ef44ac38 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Sat, 14 Dec 2019 14:05:49 +0100 +Subject: [PATCH 36/69] topology: add tplg_get_unsigned() function + +Signed-off-by: Jaroslav Kysela +--- + src/topology/data.c | 19 +++++----------- + src/topology/parser.c | 47 +++++++++++++++++++++++++++++++++++++++ + src/topology/pcm.c | 13 ++--------- + src/topology/tplg_local.h | 1 + + 4 files changed, 55 insertions(+), 25 deletions(-) + +diff --git a/src/topology/data.c b/src/topology/data.c +index 6b1337b3..9807445e 100644 +--- a/src/topology/data.c ++++ b/src/topology/data.c +@@ -556,7 +556,7 @@ static int parse_tuple_set(snd_config_t *cfg, + struct tplg_tuple_set *set; + unsigned int type, num_tuples = 0; + struct tplg_tuple *tuple; +- unsigned long int tuple_val; ++ unsigned int tuple_val; + int ival; + + snd_config_get_id(cfg, &id); +@@ -598,10 +598,6 @@ static int parse_tuple_set(snd_config_t *cfg, + if (snd_config_get_id(n, &id) < 0) + continue; + +- /* get value */ +- if (snd_config_get_string(n, &value) < 0) +- continue; +- + tuple = &set->tuple[set->num_tuples]; + snd_strlcpy(tuple->token, id, + SNDRV_CTL_ELEM_ID_NAME_MAXLEN); +@@ -633,14 +629,9 @@ static int parse_tuple_set(snd_config_t *cfg, + case SND_SOC_TPLG_TUPLE_TYPE_BYTE: + case SND_SOC_TPLG_TUPLE_TYPE_SHORT: + case SND_SOC_TPLG_TUPLE_TYPE_WORD: +- if (snd_config_get_string(n, &value) < 0) +- continue; +- errno = 0; +- /* no support for negative value */ +- tuple_val = strtoul(value, NULL, 0); +- if ((errno == ERANGE && tuple_val == ULONG_MAX) +- || (errno != 0 && tuple_val == 0)) { +- SNDERR("error: tuple %s:strtoul fail\n", id); ++ ival = tplg_get_unsigned(n, &tuple_val, 0); ++ if (ival < 0) { ++ SNDERR("error: tuple %s: %s\n", id, snd_strerror(ival)); + goto err; + } + +@@ -654,7 +645,7 @@ static int parse_tuple_set(snd_config_t *cfg, + goto err; + } + +- tuple->value = (unsigned int) tuple_val; ++ tuple->value = tuple_val; + tplg_dbg("\t\t%s = 0x%x\n", tuple->token, tuple->value); + break; + +diff --git a/src/topology/parser.c b/src/topology/parser.c +index 667c8d45..f56ad97e 100644 +--- a/src/topology/parser.c ++++ b/src/topology/parser.c +@@ -55,6 +55,53 @@ int tplg_get_integer(snd_config_t *n, int *val, int base) + } + } + ++/* ++ * Get unsigned integer value ++ */ ++int tplg_get_unsigned(snd_config_t *n, unsigned *val, int base) ++{ ++ const char *str; ++ long lval; ++ long long llval; ++ unsigned long uval; ++ int err; ++ ++ switch (snd_config_get_type(n)) { ++ case SND_CONFIG_TYPE_INTEGER: ++ err = snd_config_get_integer(n, &lval); ++ if (err < 0) ++ return err; ++ if (lval < 0 || lval > UINT_MAX) ++ return -ERANGE; ++ *val = lval; ++ return err; ++ case SND_CONFIG_TYPE_INTEGER64: ++ err = snd_config_get_integer64(n, &llval); ++ if (err < 0) ++ return err; ++ if (llval < 0 || llval > UINT_MAX) ++ return -ERANGE; ++ *val = llval; ++ return err; ++ case SND_CONFIG_TYPE_STRING: ++ err = snd_config_get_string(n, &str); ++ if (err < 0) ++ return err; ++ errno = 0; ++ uval = strtoul(str, NULL, base); ++ if (errno == ERANGE && uval == ULONG_MAX) ++ return -ERANGE; ++ if (errno && uval == 0) ++ return -EINVAL; ++ if (uval > UINT_MAX) ++ return -ERANGE; ++ *val = uval; ++ return 0; ++ default: ++ return -EINVAL; ++ } ++} ++ + /* + * Parse compound + */ +diff --git a/src/topology/pcm.c b/src/topology/pcm.c +index 6364e24f..9b87549c 100644 +--- a/src/topology/pcm.c ++++ b/src/topology/pcm.c +@@ -606,8 +606,7 @@ static int tplg_parse_fe_dai(snd_tplg_t *tplg ATTRIBUTE_UNUSED, + struct snd_soc_tplg_pcm *pcm = elem->pcm; + snd_config_iterator_t i, next; + snd_config_t *n; +- const char *id, *value = NULL; +- unsigned long int id_val; ++ const char *id; + + snd_config_get_id(cfg, &id); + tplg_dbg("\t\tFE DAI %s:\n", id); +@@ -622,19 +621,11 @@ static int tplg_parse_fe_dai(snd_tplg_t *tplg ATTRIBUTE_UNUSED, + continue; + + if (strcmp(id, "id") == 0) { +- if (snd_config_get_string(n, &value) < 0) +- continue; +- errno = 0; +- /* no support for negative value */ +- id_val = strtoul(value, NULL, 0); +- if ((errno == ERANGE && id_val == ULONG_MAX) +- || (errno != 0 && id_val == 0) +- || id_val > UINT_MAX) { ++ if (tplg_get_unsigned(n, &pcm->dai_id, 0)) { + SNDERR("error: invalid fe dai ID\n"); + return -EINVAL; + } + +- pcm->dai_id = (int) id_val; + tplg_dbg("\t\t\tindex: %d\n", pcm->dai_id); + } + } +diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h +index 991e0b41..e16c78d4 100644 +--- a/src/topology/tplg_local.h ++++ b/src/topology/tplg_local.h +@@ -281,6 +281,7 @@ struct tplg_elem* tplg_elem_new_common(snd_tplg_t *tplg, + snd_config_t *cfg, const char *name, enum snd_tplg_type type); + + int tplg_get_integer(snd_config_t *n, int *val, int base); ++int tplg_get_unsigned(snd_config_t *n, unsigned *val, int base); + + int tplg_parse_channel(snd_tplg_t *tplg ATTRIBUTE_UNUSED, + snd_config_t *cfg, void *private); +-- +2.24.1 + + +From 39fb37fef5bd3b3fa7a63e06a5f0a147197fddb9 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Sat, 14 Dec 2019 19:13:53 +0100 +Subject: [PATCH 37/69] topology: convert builder to use the mallocated memory + +Signed-off-by: Jaroslav Kysela +--- + src/topology/builder.c | 88 +++++++++++++++++++++++++++++++-------- + src/topology/parser.c | 74 +++++++++++++------------------- + src/topology/tplg_local.h | 5 ++- + 3 files changed, 103 insertions(+), 64 deletions(-) + +diff --git a/src/topology/builder.c b/src/topology/builder.c +index 1a22a453..40943b56 100644 +--- a/src/topology/builder.c ++++ b/src/topology/builder.c +@@ -29,7 +29,7 @@ static void verbose(snd_tplg_t *tplg, const char *fmt, ...) + return; + + va_start(va, fmt); +- fprintf(stdout, "0x%6.6zx/%6.6zd - ", tplg->out_pos, tplg->out_pos); ++ fprintf(stdout, "0x%6.6zx/%6.6zd - ", tplg->bin_pos, tplg->bin_pos); + vfprintf(stdout, fmt, va); + va_end(va); + } +@@ -37,18 +37,11 @@ static void verbose(snd_tplg_t *tplg, const char *fmt, ...) + /* write a block, track the position */ + static ssize_t twrite(snd_tplg_t *tplg, void *data, size_t data_size) + { +- ssize_t r = write(tplg->out_fd, data, data_size); +- if (r != (ssize_t)data_size) { +- if (r < 0) { +- SNDERR("error: unable to write: %s", strerror(errno)); +- return -errno; +- } +- tplg->out_pos += r; +- SNDERR("error: unable to write (partial)"); ++ if (tplg->bin_pos + data_size > tplg->bin_size) + return -EIO; +- } +- tplg->out_pos += r; +- return r; ++ memcpy(tplg->bin + tplg->bin_pos, data, data_size); ++ tplg->bin_pos += data_size; ++ return data_size; + } + + /* write out block header to output file */ +@@ -71,12 +64,12 @@ static ssize_t write_block_header(snd_tplg_t *tplg, unsigned int type, + hdr.count = count; + + /* make sure file offset is aligned with the calculated HDR offset */ +- if (tplg->out_pos != tplg->next_hdr_pos) { ++ if (tplg->bin_pos != tplg->next_hdr_pos) { + SNDERR("error: New header is at offset 0x%zx but file" + " offset 0x%zx is %s by %ld bytes\n", +- tplg->next_hdr_pos, tplg->out_pos, +- tplg->out_pos > tplg->next_hdr_pos ? "ahead" : "behind", +- labs(tplg->out_pos - tplg->next_hdr_pos)); ++ tplg->next_hdr_pos, tplg->bin_pos, ++ tplg->bin_pos > tplg->next_hdr_pos ? "ahead" : "behind", ++ labs(tplg->bin_pos - tplg->next_hdr_pos)); + return -EINVAL; + } + +@@ -163,6 +156,41 @@ static int write_elem_block(snd_tplg_t *tplg, + return 0; + } + ++static size_t calc_manifest_size(snd_tplg_t *tplg) ++{ ++ return sizeof(struct snd_soc_tplg_hdr) + ++ sizeof(tplg->manifest) + ++ tplg->manifest.priv.size; ++} ++ ++static size_t calc_real_size(struct list_head *base) ++{ ++ struct list_head *pos; ++ struct tplg_elem *elem, *elem_next; ++ size_t size = 0; ++ ++ list_for_each(pos, base) { ++ ++ elem = list_entry(pos, struct tplg_elem, list); ++ ++ /* compound elems have already been copied to other elems */ ++ if (elem->compound_elem) ++ continue; ++ ++ if (elem->size <= 0) ++ continue; ++ ++ size += elem->size; ++ ++ elem_next = list_entry(pos->next, struct tplg_elem, list); ++ ++ if ((pos->next == base) || (elem_next->index != elem->index)) ++ size += sizeof(struct snd_soc_tplg_hdr); ++ } ++ ++ return size; ++} ++ + static size_t calc_block_size(struct list_head *base) + { + struct list_head *pos; +@@ -277,9 +305,27 @@ int tplg_write_data(snd_tplg_t *tplg) + }; + + ssize_t ret; +- size_t size; ++ size_t total_size, size; + unsigned int index; + ++ /* calculate total size */ ++ total_size = calc_manifest_size(tplg); ++ for (index = 0; index < ARRAY_SIZE(wtable); index++) { ++ wptr = &wtable[index]; ++ size = calc_real_size(wptr->list); ++ total_size += size; ++ } ++ ++ /* allocate new binary output */ ++ free(tplg->bin); ++ tplg->bin = malloc(total_size); ++ tplg->bin_pos = 0; ++ tplg->bin_size = total_size; ++ if (tplg->bin == NULL) { ++ tplg->bin_size = 0; ++ return -ENOMEM; ++ } ++ + /* write manifest */ + ret = write_manifest_data(tplg); + if (ret < 0) { +@@ -306,7 +352,13 @@ int tplg_write_data(snd_tplg_t *tplg) + } + } + +- verbose(tplg, "total size is 0x%zx/%zd\n", tplg->out_pos, tplg->out_pos); ++ verbose(tplg, "total size is 0x%zx/%zd\n", tplg->bin_pos, tplg->bin_pos); ++ ++ if (total_size != tplg->bin_pos) { ++ SNDERR("total size mismatch (%zd != %zd)\n", ++ total_size, tplg->bin_pos); ++ return -EINVAL; ++ } + + return 0; + } +diff --git a/src/topology/parser.c b/src/topology/parser.c +index f56ad97e..98a9f9e9 100644 +--- a/src/topology/parser.c ++++ b/src/topology/parser.c +@@ -393,50 +393,29 @@ static int tplg_build_integ(snd_tplg_t *tplg) + return err; + } + +-int snd_tplg_build_file(snd_tplg_t *tplg, const char *infile, +- const char *outfile) ++int snd_tplg_build_file(snd_tplg_t *tplg, ++ const char *infile, ++ const char *outfile) + { + snd_config_t *cfg = NULL; + int err = 0; + +- tplg->out_fd = +- open(outfile, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); +- if (tplg->out_fd < 0) { +- SNDERR("error: failed to open %s err %d\n", +- outfile, -errno); +- return -errno; +- } +- + err = tplg_load_config(infile, &cfg); + if (err < 0) { + SNDERR("error: failed to load topology file %s\n", + infile); +- goto out_close; ++ return err; + } + + err = tplg_parse_config(tplg, cfg); + if (err < 0) { + SNDERR("error: failed to parse topology\n"); +- goto out; +- } +- +- err = tplg_build_integ(tplg); +- if (err < 0) { +- SNDERR("error: failed to check topology integrity\n"); +- goto out; +- } +- +- err = tplg_write_data(tplg); +- if (err < 0) { +- SNDERR("error: failed to write data %d\n", err); +- goto out; ++ return err; + } + +-out: + snd_config_delete(cfg); +-out_close: +- close(tplg->out_fd); +- return err; ++ ++ return snd_tplg_build(tplg, outfile); + } + + int snd_tplg_add_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) +@@ -468,31 +447,38 @@ int snd_tplg_add_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) + + int snd_tplg_build(snd_tplg_t *tplg, const char *outfile) + { +- int err; +- +- tplg->out_fd = +- open(outfile, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); +- if (tplg->out_fd < 0) { +- SNDERR("error: failed to open %s err %d\n", +- outfile, -errno); +- return -errno; +- } ++ int fd, err; ++ ssize_t r; + + err = tplg_build_integ(tplg); + if (err < 0) { + SNDERR("error: failed to check topology integrity\n"); +- goto out; ++ return err; + } + + err = tplg_write_data(tplg); + if (err < 0) { + SNDERR("error: failed to write data %d\n", err); +- goto out; ++ return err; + } + +-out: +- close(tplg->out_fd); +- return err; ++ fd = open(outfile, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); ++ if (fd < 0) { ++ SNDERR("error: failed to open %s err %d\n", outfile, -errno); ++ return -errno; ++ } ++ r = write(fd, tplg->bin, tplg->bin_size); ++ close(fd); ++ if (r < 0) { ++ err = -errno; ++ SNDERR("error: write error: %s\n", strerror(errno)); ++ return err; ++ } ++ if ((size_t)r != tplg->bin_size) { ++ SNDERR("error: partial write (%zd != %zd)\n", r, tplg->bin_size); ++ return -EIO; ++ } ++ return 0; + } + + int snd_tplg_set_manifest_data(snd_tplg_t *tplg, const void *data, int len) +@@ -571,8 +557,8 @@ snd_tplg_t *snd_tplg_new(void) + + void snd_tplg_free(snd_tplg_t *tplg) + { +- if (tplg->manifest_pdata) +- free(tplg->manifest_pdata); ++ free(tplg->bin); ++ free(tplg->manifest_pdata); + + tplg_elem_free_list(&tplg->tlv_list); + tplg_elem_free_list(&tplg->widget_list); +diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h +index e16c78d4..87e6c9a5 100644 +--- a/src/topology/tplg_local.h ++++ b/src/topology/tplg_local.h +@@ -60,8 +60,9 @@ typedef enum _snd_pcm_rates { + + struct snd_tplg { + /* out file */ +- int out_fd; +- size_t out_pos; ++ unsigned char *bin; ++ size_t bin_pos; ++ size_t bin_size; + + int verbose; + unsigned int version; +-- +2.24.1 + + +From bee8d4fcaa52d00950d035ec561513c2b9e7cac7 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Sat, 14 Dec 2019 19:20:02 +0100 +Subject: [PATCH 38/69] topology: add binary output from the builder + +- snd_tplg_build_bin() +- snd_tplg_build_bin_file() + +Signed-off-by: Jaroslav Kysela +--- + include/topology.h | 22 +++++++++++- + src/topology/parser.c | 79 ++++++++++++++++++++++++++++++++++++------- + 2 files changed, 87 insertions(+), 14 deletions(-) + +diff --git a/include/topology.h b/include/topology.h +index 27da7308..c9ef554a 100644 +--- a/include/topology.h ++++ b/include/topology.h +@@ -791,7 +791,18 @@ void snd_tplg_free(snd_tplg_t *tplg); + * \return Zero on success, otherwise a negative error code + */ + int snd_tplg_build_file(snd_tplg_t *tplg, const char *infile, +- const char *outfile); ++ const char *outfile); ++ ++/** ++ * \brief Parse and build topology text file into binary file. ++ * \param tplg Topology instance. ++ * \param infile Topology text input file to be parsed ++ * \param bin Binary topology output buffer (malloc). ++ * \param size Binary topology output buffer size in bytes. ++ * \return Zero on success, otherwise a negative error code ++ */ ++int snd_tplg_build_bin_file(snd_tplg_t *tplg, const char *infile, ++ void **bin, size_t *size); + + /** + * \brief Enable verbose reporting of binary file output +@@ -1089,6 +1100,15 @@ int snd_tplg_add_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t); + */ + int snd_tplg_build(snd_tplg_t *tplg, const char *outfile); + ++/** ++ * \brief Build all registered topology data into memory. ++ * \param tplg Topology instance. ++ * \param bin Binary topology output buffer (malloc). ++ * \param size Binary topology output buffer size in bytes. ++ * \return Zero on success, otherwise a negative error code ++ */ ++int snd_tplg_build_bin(snd_tplg_t *tplg, void **bin, size_t *size); ++ + /** + * \brief Attach private data to topology manifest. + * \param tplg Topology instance. +diff --git a/src/topology/parser.c b/src/topology/parser.c +index 98a9f9e9..861565b7 100644 +--- a/src/topology/parser.c ++++ b/src/topology/parser.c +@@ -393,9 +393,7 @@ static int tplg_build_integ(snd_tplg_t *tplg) + return err; + } + +-int snd_tplg_build_file(snd_tplg_t *tplg, +- const char *infile, +- const char *outfile) ++static int tplg_load(snd_tplg_t *tplg, const char *infile) + { + snd_config_t *cfg = NULL; + int err = 0; +@@ -414,10 +412,53 @@ int snd_tplg_build_file(snd_tplg_t *tplg, + } + + snd_config_delete(cfg); ++ return 0; ++} ++ ++static int tplg_build(snd_tplg_t *tplg) ++{ ++ int err; ++ ++ err = tplg_build_integ(tplg); ++ if (err < 0) { ++ SNDERR("error: failed to check topology integrity\n"); ++ return err; ++ } ++ ++ err = tplg_write_data(tplg); ++ if (err < 0) { ++ SNDERR("error: failed to write data %d\n", err); ++ return err; ++ } ++ return 0; ++} ++ ++int snd_tplg_build_file(snd_tplg_t *tplg, ++ const char *infile, ++ const char *outfile) ++{ ++ int err; ++ ++ err = tplg_load(tplg, infile); ++ if (err < 0) ++ return err; + + return snd_tplg_build(tplg, outfile); + } + ++int snd_tplg_build_bin_file(snd_tplg_t *tplg, ++ const char *infile, ++ void **bin, size_t *size) ++{ ++ int err; ++ ++ err = tplg_load(tplg, infile); ++ if (err < 0) ++ return err; ++ ++ return snd_tplg_build_bin(tplg, bin, size); ++} ++ + int snd_tplg_add_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) + { + switch (t->type) { +@@ -450,17 +491,9 @@ int snd_tplg_build(snd_tplg_t *tplg, const char *outfile) + int fd, err; + ssize_t r; + +- err = tplg_build_integ(tplg); +- if (err < 0) { +- SNDERR("error: failed to check topology integrity\n"); +- return err; +- } +- +- err = tplg_write_data(tplg); +- if (err < 0) { +- SNDERR("error: failed to write data %d\n", err); ++ err = tplg_build(tplg); ++ if (err < 0) + return err; +- } + + fd = open(outfile, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); + if (fd < 0) { +@@ -481,6 +514,26 @@ int snd_tplg_build(snd_tplg_t *tplg, const char *outfile) + return 0; + } + ++int snd_tplg_build_bin(snd_tplg_t *tplg, ++ void **bin, size_t *size) ++{ ++ int err; ++ ++ err = tplg_build(tplg); ++ if (err < 0) ++ return err; ++ ++ err = tplg_build(tplg); ++ if (err < 0) ++ return err; ++ ++ *bin = tplg->bin; ++ *size = tplg->bin_size; ++ tplg->bin = NULL; ++ tplg->bin_size = tplg->bin_pos = 0; ++ return 0; ++} ++ + int snd_tplg_set_manifest_data(snd_tplg_t *tplg, const void *data, int len) + { + if (len <= 0) +-- +2.24.1 + + +From 22b66731f3dc0eb5149a99ff547eeb84eaf8d54b Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Sat, 14 Dec 2019 20:32:24 +0100 +Subject: [PATCH 39/69] topology: parser - recode tplg_parse_config() + +Signed-off-by: Jaroslav Kysela +--- + src/topology/parser.c | 225 +++++++++++++++----------------------- + src/topology/tplg_local.h | 67 +++--------- + 2 files changed, 108 insertions(+), 184 deletions(-) + +diff --git a/src/topology/parser.c b/src/topology/parser.c +index 861565b7..82af7cc5 100644 +--- a/src/topology/parser.c ++++ b/src/topology/parser.c +@@ -142,9 +142,88 @@ int tplg_parse_compound(snd_tplg_t *tplg, snd_config_t *cfg, + + static int tplg_parse_config(snd_tplg_t *tplg, snd_config_t *cfg) + { ++ static struct _parser { ++ const char *id; ++ int (*parser)(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); ++ } *p, parsers[] = { ++ { ++ .id = "SectionTLV", ++ .parser = tplg_parse_tlv ++ }, ++ { ++ .id = "SectionControlMixer", ++ .parser = tplg_parse_control_mixer ++ }, ++ { ++ .id = "SectionControlEnum", ++ .parser = tplg_parse_control_enum ++ }, ++ { ++ .id = "SectionControlBytes", ++ .parser = tplg_parse_control_bytes ++ }, ++ { ++ .id = "SectionWidget", ++ .parser = tplg_parse_dapm_widget ++ }, ++ { ++ .id = "SectionPCMCapabilities", ++ .parser = tplg_parse_stream_caps ++ }, ++ { ++ .id = "SectionPCM", ++ .parser = tplg_parse_pcm ++ }, ++ { ++ .id = "SectionDAI", ++ .parser = tplg_parse_dai ++ }, ++ { ++ .id = "SectionHWConfig", ++ .parser = tplg_parse_hw_config ++ }, ++ { ++ .id = "SectionLink", ++ .parser = tplg_parse_link ++ }, ++ { ++ .id = "SectionBE", ++ .parser = tplg_parse_link ++ }, ++ { ++ .id = "SectionCC", ++ .parser = tplg_parse_cc ++ }, ++ { ++ .id = "SectionGraph", ++ .parser = tplg_parse_dapm_graph ++ }, ++ { ++ .id = "SectionText", ++ .parser = tplg_parse_text ++ }, ++ { ++ .id = "SectionData", ++ .parser = tplg_parse_data ++ }, ++ { ++ .id = "SectionVendorTokens", ++ .parser = tplg_parse_tokens ++ }, ++ { ++ .id = "SectionVendorTuples", ++ .parser = tplg_parse_tuples ++ }, ++ { ++ .id = "SectionManifest", ++ .parser = tplg_parse_manifest_data ++ }, ++ }; ++ int (*parser)(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); + snd_config_iterator_t i, next; + snd_config_t *n; + const char *id; ++ unsigned int idx; + int err; + + if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) { +@@ -159,145 +238,23 @@ static int tplg_parse_config(snd_tplg_t *tplg, snd_config_t *cfg) + if (snd_config_get_id(n, &id) < 0) + continue; + +- if (strcmp(id, "SectionTLV") == 0) { +- err = tplg_parse_compound(tplg, n, tplg_parse_tlv, +- NULL); +- if (err < 0) +- return err; +- continue; ++ parser = NULL; ++ for (idx = 0; idx < ARRAY_SIZE(parsers); idx++) { ++ p = &parsers[idx]; ++ if (strcmp(id, p->id) == 0) { ++ parser = p->parser; ++ break; ++ } + } + +- if (strcmp(id, "SectionControlMixer") == 0) { +- err = tplg_parse_compound(tplg, n, +- tplg_parse_control_mixer, NULL); +- if (err < 0) +- return err; ++ if (parser == NULL) { ++ SNDERR("error: unknown section %s\n", id); + continue; + } + +- if (strcmp(id, "SectionControlEnum") == 0) { +- err = tplg_parse_compound(tplg, n, +- tplg_parse_control_enum, NULL); +- if (err < 0) +- return err; +- continue; +- } +- +- if (strcmp(id, "SectionControlBytes") == 0) { +- err = tplg_parse_compound(tplg, n, +- tplg_parse_control_bytes, NULL); +- if (err < 0) +- return err; +- continue; +- } +- +- if (strcmp(id, "SectionWidget") == 0) { +- err = tplg_parse_compound(tplg, n, +- tplg_parse_dapm_widget, NULL); +- if (err < 0) +- return err; +- continue; +- } +- +- if (strcmp(id, "SectionPCMCapabilities") == 0) { +- err = tplg_parse_compound(tplg, n, +- tplg_parse_stream_caps, NULL); +- if (err < 0) +- return err; +- continue; +- } +- +- if (strcmp(id, "SectionPCM") == 0) { +- err = tplg_parse_compound(tplg, n, +- tplg_parse_pcm, NULL); +- if (err < 0) +- return err; +- continue; +- } +- +- if (strcmp(id, "SectionDAI") == 0) { +- err = tplg_parse_compound(tplg, n, +- tplg_parse_dai, NULL); +- if (err < 0) +- return err; +- continue; +- } +- +- if (strcmp(id, "SectionHWConfig") == 0) { +- err = tplg_parse_compound(tplg, n, tplg_parse_hw_config, +- NULL); +- if (err < 0) +- return err; +- continue; +- } +- +- if (strcmp(id, "SectionLink") == 0 +- || strcmp(id, "SectionBE") == 0) { +- err = tplg_parse_compound(tplg, n, tplg_parse_link, +- NULL); +- if (err < 0) +- return err; +- continue; +- } +- +- if (strcmp(id, "SectionCC") == 0) { +- err = tplg_parse_compound(tplg, n, tplg_parse_cc, +- NULL); +- if (err < 0) +- return err; +- continue; +- } +- +- if (strcmp(id, "SectionGraph") == 0) { +- err = tplg_parse_compound(tplg, n, +- tplg_parse_dapm_graph, NULL); +- if (err < 0) +- return err; +- continue; +- } +- +- if (strcmp(id, "SectionText") == 0) { +- err = tplg_parse_compound(tplg, n, tplg_parse_text, +- NULL); +- if (err < 0) +- return err; +- continue; +- } +- +- if (strcmp(id, "SectionData") == 0) { +- err = tplg_parse_compound(tplg, n, tplg_parse_data, +- NULL); +- if (err < 0) +- return err; +- continue; +- } +- +- if (strcmp(id, "SectionVendorTokens") == 0) { +- err = tplg_parse_compound(tplg, n, tplg_parse_tokens, +- NULL); +- if (err < 0) +- return err; +- continue; +- } +- +- if (strcmp(id, "SectionVendorTuples") == 0) { +- err = tplg_parse_compound(tplg, n, tplg_parse_tuples, +- NULL); +- if (err < 0) +- return err; +- continue; +- } +- +- if (strcmp(id, "SectionManifest") == 0) { +- err = tplg_parse_compound(tplg, n, +- tplg_parse_manifest_data, +- NULL); +- if (err < 0) +- return err; +- continue; +- } +- +- SNDERR("error: unknown section %s\n", id); ++ err = tplg_parse_compound(tplg, n, parser, NULL); ++ if (err < 0) ++ return err; + } + return 0; + } +diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h +index 87e6c9a5..77a68189 100644 +--- a/src/topology/tplg_local.h ++++ b/src/topology/tplg_local.h +@@ -202,59 +202,26 @@ int tplg_parse_compound(snd_tplg_t *tplg, snd_config_t *cfg, + + int tplg_write_data(snd_tplg_t *tplg); + +-int tplg_parse_tlv(snd_tplg_t *tplg, snd_config_t *cfg, +- void *private ATTRIBUTE_UNUSED); +- +-int tplg_parse_text(snd_tplg_t *tplg, snd_config_t *cfg, +- void *private ATTRIBUTE_UNUSED); +- +-int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg, +- void *private ATTRIBUTE_UNUSED); +- +-int tplg_parse_tokens(snd_tplg_t *tplg, snd_config_t *cfg, +- void *private ATTRIBUTE_UNUSED); +- +-int tplg_parse_tuples(snd_tplg_t *tplg, snd_config_t *cfg, +- void *private ATTRIBUTE_UNUSED); ++int tplg_parse_tlv(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); ++int tplg_parse_text(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); ++int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); ++int tplg_parse_tokens(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); ++int tplg_parse_tuples(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); ++int tplg_parse_manifest_data(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); ++int tplg_parse_control_bytes(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); ++int tplg_parse_control_enum(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); ++int tplg_parse_control_mixer(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); ++int tplg_parse_dapm_graph(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); ++int tplg_parse_dapm_widget(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); ++int tplg_parse_stream_caps(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); ++int tplg_parse_pcm(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); ++int tplg_parse_dai(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); ++int tplg_parse_link(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); ++int tplg_parse_cc(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); ++int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); + + void tplg_free_tuples(void *obj); + +-int tplg_parse_manifest_data(snd_tplg_t *tplg, snd_config_t *cfg, +- void *private ATTRIBUTE_UNUSED); +- +-int tplg_parse_control_bytes(snd_tplg_t *tplg, +- snd_config_t *cfg, void *private ATTRIBUTE_UNUSED); +- +-int tplg_parse_control_enum(snd_tplg_t *tplg, snd_config_t *cfg, +- void *private ATTRIBUTE_UNUSED); +- +-int tplg_parse_control_mixer(snd_tplg_t *tplg, +- snd_config_t *cfg, void *private ATTRIBUTE_UNUSED); +- +-int tplg_parse_dapm_graph(snd_tplg_t *tplg, snd_config_t *cfg, +- void *private ATTRIBUTE_UNUSED); +- +-int tplg_parse_dapm_widget(snd_tplg_t *tplg, +- snd_config_t *cfg, void *private ATTRIBUTE_UNUSED); +- +-int tplg_parse_stream_caps(snd_tplg_t *tplg, +- snd_config_t *cfg, void *private ATTRIBUTE_UNUSED); +- +-int tplg_parse_pcm(snd_tplg_t *tplg, +- snd_config_t *cfg, void *private ATTRIBUTE_UNUSED); +- +-int tplg_parse_dai(snd_tplg_t *tplg, snd_config_t *cfg, +- void *private ATTRIBUTE_UNUSED); +- +-int tplg_parse_link(snd_tplg_t *tplg, +- snd_config_t *cfg, void *private ATTRIBUTE_UNUSED); +- +-int tplg_parse_cc(snd_tplg_t *tplg, +- snd_config_t *cfg, void *private ATTRIBUTE_UNUSED); +- +-int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, +- void *private ATTRIBUTE_UNUSED); +- + int tplg_build_data(snd_tplg_t *tplg); + int tplg_build_manifest_data(snd_tplg_t *tplg); + int tplg_build_controls(snd_tplg_t *tplg); +-- +2.24.1 + + +From d52eaba63dfe1d845663a4cd1bf676fafc43874a Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Sun, 15 Dec 2019 16:03:29 +0100 +Subject: [PATCH 40/69] topology: add snd_tplg_load() remove + snd_tplg_build_bin_file() + +Signed-off-by: Jaroslav Kysela +--- + include/topology.h | 16 ++++---- + src/topology/parser.c | 96 +++++++++++++++---------------------------- + 2 files changed, 41 insertions(+), 71 deletions(-) + +diff --git a/include/topology.h b/include/topology.h +index c9ef554a..c9f4ffea 100644 +--- a/include/topology.h ++++ b/include/topology.h +@@ -784,25 +784,23 @@ snd_tplg_t *snd_tplg_new(void); + void snd_tplg_free(snd_tplg_t *tplg); + + /** +- * \brief Parse and build topology text file into binary file. ++ * \brief Load topology from the text buffer. + * \param tplg Topology instance. +- * \param infile Topology text input file to be parsed +- * \param outfile Binary topology output file. ++ * \param buf Text buffer. ++ * \param size Text buffer size in bytes. + * \return Zero on success, otherwise a negative error code + */ +-int snd_tplg_build_file(snd_tplg_t *tplg, const char *infile, +- const char *outfile); ++int snd_tplg_load(snd_tplg_t *tplg, const char *buf, size_t size); + + /** + * \brief Parse and build topology text file into binary file. + * \param tplg Topology instance. + * \param infile Topology text input file to be parsed +- * \param bin Binary topology output buffer (malloc). +- * \param size Binary topology output buffer size in bytes. ++ * \param outfile Binary topology output file. + * \return Zero on success, otherwise a negative error code + */ +-int snd_tplg_build_bin_file(snd_tplg_t *tplg, const char *infile, +- void **bin, size_t *size); ++int snd_tplg_build_file(snd_tplg_t *tplg, const char *infile, ++ const char *outfile); + + /** + * \brief Enable verbose reporting of binary file output +diff --git a/src/topology/parser.c b/src/topology/parser.c +index 82af7cc5..ed864d32 100644 +--- a/src/topology/parser.c ++++ b/src/topology/parser.c +@@ -259,52 +259,30 @@ static int tplg_parse_config(snd_tplg_t *tplg, snd_config_t *cfg) + return 0; + } + +-static int tplg_load_config(const char *file, snd_config_t **cfg) ++static int tplg_load_config(snd_tplg_t *tplg, snd_input_t *in) + { +- FILE *fp; +- snd_input_t *in; + snd_config_t *top; + int ret; + +- fp = fopen(file, "r"); +- if (fp == NULL) { +- SNDERR("error: could not open configuration file %s", +- file); +- return -errno; +- } +- +- ret = snd_input_stdio_attach(&in, fp, 1); +- if (ret < 0) { +- fclose(fp); +- SNDERR("error: could not attach stdio %s", file); +- return ret; +- } + ret = snd_config_top(&top); + if (ret < 0) +- goto err; ++ return ret; + + ret = snd_config_load(top, in); + if (ret < 0) { +- SNDERR("error: could not load configuration file %s", +- file); +- goto err_load; ++ SNDERR("error: could not load configuration"); ++ snd_config_delete(top); ++ return ret; + } + +- ret = snd_input_close(in); ++ ret = tplg_parse_config(tplg, top); ++ snd_config_delete(top); + if (ret < 0) { +- in = NULL; +- goto err_load; ++ SNDERR("error: failed to parse topology"); ++ return ret; + } + +- *cfg = top; + return 0; +- +-err_load: +- snd_config_delete(top); +-err: +- if (in) +- snd_input_close(in); +- return ret; + } + + static int tplg_build_integ(snd_tplg_t *tplg) +@@ -350,26 +328,20 @@ static int tplg_build_integ(snd_tplg_t *tplg) + return err; + } + +-static int tplg_load(snd_tplg_t *tplg, const char *infile) ++int snd_tplg_load(snd_tplg_t *tplg, const char *buf, size_t size) + { +- snd_config_t *cfg = NULL; +- int err = 0; +- +- err = tplg_load_config(infile, &cfg); +- if (err < 0) { +- SNDERR("error: failed to load topology file %s\n", +- infile); +- return err; +- } ++ snd_input_t *in; ++ int err; + +- err = tplg_parse_config(tplg, cfg); ++ err = snd_input_buffer_open(&in, buf, size); + if (err < 0) { +- SNDERR("error: failed to parse topology\n"); ++ SNDERR("error: could not create input buffer"); + return err; + } + +- snd_config_delete(cfg); +- return 0; ++ err = tplg_load_config(tplg, in); ++ snd_input_close(in); ++ return err; + } + + static int tplg_build(snd_tplg_t *tplg) +@@ -394,26 +366,30 @@ int snd_tplg_build_file(snd_tplg_t *tplg, + const char *infile, + const char *outfile) + { ++ FILE *fp; ++ snd_input_t *in; + int err; + +- err = tplg_load(tplg, infile); +- if (err < 0) +- return err; +- +- return snd_tplg_build(tplg, outfile); +-} ++ fp = fopen(infile, "r"); ++ if (fp == NULL) { ++ SNDERR("error: could not open configuration file %s", ++ infile); ++ return -errno; ++ } + +-int snd_tplg_build_bin_file(snd_tplg_t *tplg, +- const char *infile, +- void **bin, size_t *size) +-{ +- int err; ++ err = snd_input_stdio_attach(&in, fp, 1); ++ if (err < 0) { ++ fclose(fp); ++ SNDERR("error: could not attach stdio %s", infile); ++ return err; ++ } + +- err = tplg_load(tplg, infile); ++ err = tplg_load_config(tplg, in); ++ snd_input_close(in); + if (err < 0) + return err; + +- return snd_tplg_build_bin(tplg, bin, size); ++ return snd_tplg_build(tplg, outfile); + } + + int snd_tplg_add_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) +@@ -476,10 +452,6 @@ int snd_tplg_build_bin(snd_tplg_t *tplg, + { + int err; + +- err = tplg_build(tplg); +- if (err < 0) +- return err; +- + err = tplg_build(tplg); + if (err < 0) + return err; +-- +2.24.1 + + +From 4f076f5b69a873418ecb826a4198e4d95a3a2a6f Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Sun, 15 Dec 2019 16:15:29 +0100 +Subject: [PATCH 41/69] topology: move the topology element table from builder + to elem + +- use offsetof() for the lists +- add other info to describe the elements +- use the table in the element constructor + +Signed-off-by: Jaroslav Kysela +--- + src/topology/builder.c | 98 ++++------------ + src/topology/ctl.c | 7 +- + src/topology/elem.c | 232 +++++++++++++++++++++++++++----------- + src/topology/tplg_local.h | 15 +++ + 4 files changed, 199 insertions(+), 153 deletions(-) + +diff --git a/src/topology/builder.c b/src/topology/builder.c +index 40943b56..cadb5583 100644 +--- a/src/topology/builder.c ++++ b/src/topology/builder.c +@@ -236,83 +236,20 @@ static ssize_t write_manifest_data(snd_tplg_t *tplg) + + int tplg_write_data(snd_tplg_t *tplg) + { +- struct wtable { +- const char *name; +- struct list_head *list; +- int type; +- int tsoc; +- } *wptr, wtable[] = { +- { +- .name = "control mixer", +- .list = &tplg->mixer_list, +- .type = SND_TPLG_TYPE_MIXER, +- .tsoc = SND_SOC_TPLG_TYPE_MIXER, +- }, +- { +- .name = "control enum", +- .list = &tplg->enum_list, +- .type = SND_TPLG_TYPE_ENUM, +- .tsoc = SND_SOC_TPLG_TYPE_ENUM, +- }, +- { +- .name = "control extended (bytes)", +- .list = &tplg->bytes_ext_list, +- .type = SND_TPLG_TYPE_BYTES, +- .tsoc = SND_SOC_TPLG_TYPE_BYTES, +- }, +- { +- .name = "dapm widget", +- .list = &tplg->widget_list, +- .type = SND_TPLG_TYPE_DAPM_WIDGET, +- .tsoc = SND_SOC_TPLG_TYPE_DAPM_WIDGET, +- }, +- { +- .name = "pcm", +- .list = &tplg->pcm_list, +- .type = SND_TPLG_TYPE_PCM, +- .tsoc = SND_SOC_TPLG_TYPE_PCM, +- }, +- { +- .name = "physical dai", +- .list = &tplg->dai_list, +- .type = SND_TPLG_TYPE_DAI, +- .tsoc = SND_SOC_TPLG_TYPE_DAI, +- }, +- { +- .name = "be", +- .list = &tplg->be_list, +- .type = SND_TPLG_TYPE_BE, +- .tsoc = SND_SOC_TPLG_TYPE_BACKEND_LINK, +- }, +- { +- .name = "cc", +- .list = &tplg->cc_list, +- .type = SND_TPLG_TYPE_CC, +- .tsoc = SND_SOC_TPLG_TYPE_CODEC_LINK, +- }, +- { +- .name = "route (dapm graph)", +- .list = &tplg->route_list, +- .type = SND_TPLG_TYPE_DAPM_GRAPH, +- .tsoc = SND_SOC_TPLG_TYPE_DAPM_GRAPH, +- }, +- { +- .name = "private data", +- .list = &tplg->pdata_list, +- .type = SND_TPLG_TYPE_DATA, +- .tsoc = SND_SOC_TPLG_TYPE_PDATA, +- }, +- }; +- ++ struct tplg_table *tptr; ++ struct list_head *list; + ssize_t ret; + size_t total_size, size; + unsigned int index; + + /* calculate total size */ + total_size = calc_manifest_size(tplg); +- for (index = 0; index < ARRAY_SIZE(wtable); index++) { +- wptr = &wtable[index]; +- size = calc_real_size(wptr->list); ++ for (index = 0; index < tplg_table_items; index++) { ++ tptr = &tplg_table[index]; ++ if (!tptr->build) ++ continue; ++ list = (struct list_head *)((void *)tplg + tptr->loff); ++ size = calc_real_size(list); + total_size += size; + } + +@@ -334,20 +271,23 @@ int tplg_write_data(snd_tplg_t *tplg) + } + + /* write all blocks */ +- for (index = 0; index < ARRAY_SIZE(wtable); index++) { +- wptr = &wtable[index]; ++ for (index = 0; index < tplg_table_items; index++) { ++ tptr = &tplg_table[index]; ++ if (!tptr->build) ++ continue; ++ list = (struct list_head *)((void *)tplg + tptr->loff); + /* calculate the block size in bytes for all elems in this list */ +- size = calc_block_size(wptr->list); ++ size = calc_block_size(list); + if (size == 0) + continue; + verbose(tplg, "block size for type %s (%d:%d) is 0x%zx/%zd\n", +- wptr->name, wptr->type, +- wptr->tsoc, size, size); +- ret = write_elem_block(tplg, wptr->list, size, +- wptr->tsoc, wptr->name); ++ tptr->name, tptr->type, ++ tptr->tsoc, size, size); ++ ret = write_elem_block(tplg, list, size, ++ tptr->tsoc, tptr->name); + if (ret < 0) { + SNDERR("failed to write %s elements: %s\n", +- wptr->name, snd_strerror(-ret)); ++ tptr->name, snd_strerror(-ret)); + return ret; + } + } +diff --git a/src/topology/ctl.c b/src/topology/ctl.c +index 9190efef..539329cd 100644 +--- a/src/topology/ctl.c ++++ b/src/topology/ctl.c +@@ -284,18 +284,13 @@ static int tplg_parse_tlv_dbscale(snd_config_t *cfg, struct tplg_elem *elem) + { + snd_config_iterator_t i, next; + snd_config_t *n; +- struct snd_soc_tplg_ctl_tlv *tplg_tlv; ++ struct snd_soc_tplg_ctl_tlv *tplg_tlv = elem->tlv; + struct snd_soc_tplg_tlv_dbscale *scale; + const char *id = NULL; + int val; + + tplg_dbg(" scale: %s\n", elem->id); + +- tplg_tlv = calloc(1, sizeof(*tplg_tlv)); +- if (!tplg_tlv) +- return -ENOMEM; +- +- elem->tlv = tplg_tlv; + tplg_tlv->size = sizeof(struct snd_soc_tplg_ctl_tlv); + tplg_tlv->type = SNDRV_CTL_TLVT_DB_SCALE; + scale = &tplg_tlv->scale; +diff --git a/src/topology/elem.c b/src/topology/elem.c +index f2076f79..92ca7da4 100644 +--- a/src/topology/elem.c ++++ b/src/topology/elem.c +@@ -20,6 +20,154 @@ + #include "list.h" + #include "tplg_local.h" + ++struct tplg_table tplg_table[] = { ++ { ++ .name = "manifest", ++ .loff = offsetof(snd_tplg_t, manifest_list), ++ .type = SND_TPLG_TYPE_MANIFEST, ++ .tsoc = SND_SOC_TPLG_TYPE_MANIFEST, ++ .size = sizeof(struct snd_soc_tplg_manifest), ++ .enew = 1, ++ }, ++ { ++ .name = "control mixer", ++ .loff = offsetof(snd_tplg_t, mixer_list), ++ .type = SND_TPLG_TYPE_MIXER, ++ .tsoc = SND_SOC_TPLG_TYPE_MIXER, ++ .size = sizeof(struct snd_soc_tplg_mixer_control), ++ .build = 1, ++ .enew = 1, ++ }, ++ { ++ .name = "control enum", ++ .loff = offsetof(snd_tplg_t, enum_list), ++ .type = SND_TPLG_TYPE_ENUM, ++ .tsoc = SND_SOC_TPLG_TYPE_ENUM, ++ .size = sizeof(struct snd_soc_tplg_enum_control), ++ .build = 1, ++ .enew = 1, ++ }, ++ { ++ .name = "control extended (bytes)", ++ .loff = offsetof(snd_tplg_t, bytes_ext_list), ++ .type = SND_TPLG_TYPE_BYTES, ++ .tsoc = SND_SOC_TPLG_TYPE_BYTES, ++ .size = sizeof(struct snd_soc_tplg_bytes_control), ++ .build = 1, ++ .enew = 1, ++ }, ++ { ++ .name = "dapm widget", ++ .loff = offsetof(snd_tplg_t, widget_list), ++ .type = SND_TPLG_TYPE_DAPM_WIDGET, ++ .tsoc = SND_SOC_TPLG_TYPE_DAPM_WIDGET, ++ .size = sizeof(struct snd_soc_tplg_dapm_widget), ++ .build = 1, ++ .enew = 1, ++ }, ++ { ++ .name = "pcm", ++ .loff = offsetof(snd_tplg_t, pcm_list), ++ .type = SND_TPLG_TYPE_PCM, ++ .tsoc = SND_SOC_TPLG_TYPE_PCM, ++ .size = sizeof(struct snd_soc_tplg_pcm), ++ .build = 1, ++ .enew = 1, ++ }, ++ { ++ .name = "physical dai", ++ .loff = offsetof(snd_tplg_t, dai_list), ++ .type = SND_TPLG_TYPE_DAI, ++ .tsoc = SND_SOC_TPLG_TYPE_DAI, ++ .size = sizeof(struct snd_soc_tplg_dai), ++ .build = 1, ++ .enew = 1, ++ }, ++ { ++ .name = "be", ++ .loff = offsetof(snd_tplg_t, be_list), ++ .type = SND_TPLG_TYPE_BE, ++ .tsoc = SND_SOC_TPLG_TYPE_BACKEND_LINK, ++ .size = sizeof(struct snd_soc_tplg_link_config), ++ .build = 1, ++ .enew = 1, ++ }, ++ { ++ .name = "cc", ++ .loff = offsetof(snd_tplg_t, cc_list), ++ .type = SND_TPLG_TYPE_CC, ++ .tsoc = SND_SOC_TPLG_TYPE_CODEC_LINK, ++ .size = sizeof(struct snd_soc_tplg_link_config), ++ .build = 1, ++ .enew = 1, ++ }, ++ { ++ .name = "route (dapm graph)", ++ .loff = offsetof(snd_tplg_t, route_list), ++ .type = SND_TPLG_TYPE_DAPM_GRAPH, ++ .tsoc = SND_SOC_TPLG_TYPE_DAPM_GRAPH, ++ .build = 1, ++ }, ++ { ++ .name = "private data", ++ .loff = offsetof(snd_tplg_t, pdata_list), ++ .type = SND_TPLG_TYPE_DATA, ++ .tsoc = SND_SOC_TPLG_TYPE_PDATA, ++ .build = 1, ++ .enew = 1, ++ }, ++ { ++ .name = "text", ++ .loff = offsetof(snd_tplg_t, text_list), ++ .type = SND_TPLG_TYPE_TEXT, ++ .size = sizeof(struct tplg_texts), ++ .enew = 1, ++ }, ++ { ++ .name = "tlv", ++ .loff = offsetof(snd_tplg_t, tlv_list), ++ .type = SND_TPLG_TYPE_TLV, ++ .size = sizeof(struct snd_soc_tplg_ctl_tlv), ++ .enew = 1, ++ }, ++ { ++ .name = "stream config", ++ .loff = offsetof(snd_tplg_t, pcm_config_list), ++ .type = SND_TPLG_TYPE_STREAM_CONFIG, ++ .size = sizeof(struct snd_soc_tplg_stream), ++ .enew = 1, ++ }, ++ { ++ .name = "stream capabilities", ++ .loff = offsetof(snd_tplg_t, pcm_caps_list), ++ .type = SND_TPLG_TYPE_STREAM_CAPS, ++ .size = sizeof(struct snd_soc_tplg_stream_caps), ++ .enew = 1, ++ }, ++ { ++ .name = "token", ++ .loff = offsetof(snd_tplg_t, token_list), ++ .type = SND_TPLG_TYPE_TOKEN, ++ .enew = 1, ++ }, ++ { ++ .name = "tuple", ++ .loff = offsetof(snd_tplg_t, tuple_list), ++ .type = SND_TPLG_TYPE_TUPLE, ++ .free = tplg_free_tuples, ++ .enew = 1, ++ }, ++ { ++ .name = "hw config", ++ .loff = offsetof(snd_tplg_t, hw_cfg_list), ++ .type = SND_TPLG_TYPE_HW_CONFIG, ++ .size = sizeof(struct snd_soc_tplg_hw_config), ++ .enew = 1, ++ } ++}; ++ ++unsigned int tplg_table_items = ARRAY_SIZE(tplg_table); ++ + int tplg_ref_add(struct tplg_elem *elem, int type, const char* id) + { + struct tplg_ref *ref; +@@ -152,9 +300,12 @@ struct tplg_elem* tplg_elem_new_common(snd_tplg_t *tplg, + const char *name, + enum snd_tplg_type type) + { ++ struct tplg_table *tptr; + struct tplg_elem *elem; ++ struct list_head *list; + const char *id; + int obj_size = 0; ++ unsigned index; + void *obj; + snd_config_iterator_t i, next; + snd_config_t *n; +@@ -191,79 +342,24 @@ struct tplg_elem* tplg_elem_new_common(snd_tplg_t *tplg, + } else if (name != NULL) + snd_strlcpy(elem->id, name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN); + +- switch (type) { +- case SND_TPLG_TYPE_DATA: +- tplg_elem_insert(elem, &tplg->pdata_list); +- break; +- case SND_TPLG_TYPE_MANIFEST: +- tplg_elem_insert(elem, &tplg->manifest_list); +- obj_size = sizeof(struct snd_soc_tplg_manifest); +- break; +- case SND_TPLG_TYPE_TEXT: +- tplg_elem_insert(elem, &tplg->text_list); +- obj_size = sizeof(struct tplg_texts); +- break; +- case SND_TPLG_TYPE_TLV: +- tplg_elem_insert(elem, &tplg->tlv_list); +- elem->size = sizeof(struct snd_soc_tplg_ctl_tlv); +- break; +- case SND_TPLG_TYPE_BYTES: +- tplg_elem_insert(elem, &tplg->bytes_ext_list); +- obj_size = sizeof(struct snd_soc_tplg_bytes_control); +- break; +- case SND_TPLG_TYPE_ENUM: +- tplg_elem_insert(elem, &tplg->enum_list); +- obj_size = sizeof(struct snd_soc_tplg_enum_control); +- break; +- case SND_TPLG_TYPE_MIXER: +- tplg_elem_insert(elem, &tplg->mixer_list); +- obj_size = sizeof(struct snd_soc_tplg_mixer_control); +- break; +- case SND_TPLG_TYPE_DAPM_WIDGET: +- tplg_elem_insert(elem, &tplg->widget_list); +- obj_size = sizeof(struct snd_soc_tplg_dapm_widget); +- break; +- case SND_TPLG_TYPE_STREAM_CONFIG: +- tplg_elem_insert(elem, &tplg->pcm_config_list); +- obj_size = sizeof(struct snd_soc_tplg_stream); ++ for (index = 0; index < tplg_table_items; index++) { ++ tptr = &tplg_table[index]; ++ if (!tptr->enew) ++ continue; ++ if ((int)type != tptr->type) ++ continue; + break; +- case SND_TPLG_TYPE_STREAM_CAPS: +- tplg_elem_insert(elem, &tplg->pcm_caps_list); +- obj_size = sizeof(struct snd_soc_tplg_stream_caps); +- break; +- case SND_TPLG_TYPE_PCM: +- tplg_elem_insert(elem, &tplg->pcm_list); +- obj_size = sizeof(struct snd_soc_tplg_pcm); +- break; +- case SND_TPLG_TYPE_DAI: +- tplg_elem_insert(elem, &tplg->dai_list); +- obj_size = sizeof(struct snd_soc_tplg_dai); +- break; +- case SND_TPLG_TYPE_BE: +- case SND_TPLG_TYPE_LINK: +- tplg_elem_insert(elem, &tplg->be_list); +- obj_size = sizeof(struct snd_soc_tplg_link_config); +- break; +- case SND_TPLG_TYPE_CC: +- tplg_elem_insert(elem, &tplg->cc_list); +- obj_size = sizeof(struct snd_soc_tplg_link_config); +- break; +- case SND_TPLG_TYPE_TOKEN: +- tplg_elem_insert(elem, &tplg->token_list); +- break; +- case SND_TPLG_TYPE_TUPLE: +- tplg_elem_insert(elem, &tplg->tuple_list); +- elem->free = tplg_free_tuples; +- break; +- case SND_TPLG_TYPE_HW_CONFIG: +- tplg_elem_insert(elem, &tplg->hw_cfg_list); +- obj_size = sizeof(struct snd_soc_tplg_hw_config); +- break; +- default: ++ } ++ if (index >= tplg_table_items) { + free(elem); + return NULL; + } + ++ list = (struct list_head *)((void *)tplg + tptr->loff); ++ tplg_elem_insert(elem, list); ++ obj_size = tptr->size; ++ elem->free = tptr->free; ++ + /* create new object too if required */ + if (obj_size > 0) { + obj = calloc(1, obj_size); +diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h +index 77a68189..0987898f 100644 +--- a/src/topology/tplg_local.h ++++ b/src/topology/tplg_local.h +@@ -196,6 +196,21 @@ struct map_elem { + int id; + }; + ++/* mapping table */ ++struct tplg_table { ++ const char *name; ++ off_t loff; ++ size_t size; ++ int type; ++ int tsoc; ++ unsigned build: 1; ++ unsigned enew: 1; ++ void (*free)(void *); ++}; ++ ++extern struct tplg_table tplg_table[]; ++extern unsigned int tplg_table_items; ++ + int tplg_parse_compound(snd_tplg_t *tplg, snd_config_t *cfg, + int (*fcn)(snd_tplg_t *, snd_config_t *, void *), + void *private); +-- +2.24.1 + + +From 4a0efdc87355d5789876e20b9530dc85224ad281 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Sun, 15 Dec 2019 17:24:50 +0100 +Subject: [PATCH 42/69] topology: add parser to the tplg_table + +Signed-off-by: Jaroslav Kysela +--- + src/topology/elem.c | 35 +++++++++++++++ + src/topology/parser.c | 90 ++++----------------------------------- + src/topology/tplg_local.h | 3 ++ + 3 files changed, 47 insertions(+), 81 deletions(-) + +diff --git a/src/topology/elem.c b/src/topology/elem.c +index 92ca7da4..e79a68b7 100644 +--- a/src/topology/elem.c ++++ b/src/topology/elem.c +@@ -23,112 +23,139 @@ + struct tplg_table tplg_table[] = { + { + .name = "manifest", ++ .id = "SectionManifest", + .loff = offsetof(snd_tplg_t, manifest_list), + .type = SND_TPLG_TYPE_MANIFEST, + .tsoc = SND_SOC_TPLG_TYPE_MANIFEST, + .size = sizeof(struct snd_soc_tplg_manifest), + .enew = 1, ++ .parse = tplg_parse_manifest_data, + }, + { + .name = "control mixer", ++ .id = "SectionControlMixer", + .loff = offsetof(snd_tplg_t, mixer_list), + .type = SND_TPLG_TYPE_MIXER, + .tsoc = SND_SOC_TPLG_TYPE_MIXER, + .size = sizeof(struct snd_soc_tplg_mixer_control), + .build = 1, + .enew = 1, ++ .parse = tplg_parse_control_mixer, + }, + { + .name = "control enum", ++ .id = "SectionControlEnum", + .loff = offsetof(snd_tplg_t, enum_list), + .type = SND_TPLG_TYPE_ENUM, + .tsoc = SND_SOC_TPLG_TYPE_ENUM, + .size = sizeof(struct snd_soc_tplg_enum_control), + .build = 1, + .enew = 1, ++ .parse = tplg_parse_control_enum, + }, + { + .name = "control extended (bytes)", ++ .id = "SectionControlBytes", + .loff = offsetof(snd_tplg_t, bytes_ext_list), + .type = SND_TPLG_TYPE_BYTES, + .tsoc = SND_SOC_TPLG_TYPE_BYTES, + .size = sizeof(struct snd_soc_tplg_bytes_control), + .build = 1, + .enew = 1, ++ .parse = tplg_parse_control_bytes, + }, + { + .name = "dapm widget", ++ .id = "SectionWidget", + .loff = offsetof(snd_tplg_t, widget_list), + .type = SND_TPLG_TYPE_DAPM_WIDGET, + .tsoc = SND_SOC_TPLG_TYPE_DAPM_WIDGET, + .size = sizeof(struct snd_soc_tplg_dapm_widget), + .build = 1, + .enew = 1, ++ .parse = tplg_parse_dapm_widget, + }, + { + .name = "pcm", ++ .id = "SectionPCM", + .loff = offsetof(snd_tplg_t, pcm_list), + .type = SND_TPLG_TYPE_PCM, + .tsoc = SND_SOC_TPLG_TYPE_PCM, + .size = sizeof(struct snd_soc_tplg_pcm), + .build = 1, + .enew = 1, ++ .parse = tplg_parse_pcm, + }, + { + .name = "physical dai", ++ .id = "SectionDAI", + .loff = offsetof(snd_tplg_t, dai_list), + .type = SND_TPLG_TYPE_DAI, + .tsoc = SND_SOC_TPLG_TYPE_DAI, + .size = sizeof(struct snd_soc_tplg_dai), + .build = 1, + .enew = 1, ++ .parse = tplg_parse_dai, + }, + { + .name = "be", ++ .id = "SectionBE", ++ .id2 = "SectionLink", + .loff = offsetof(snd_tplg_t, be_list), + .type = SND_TPLG_TYPE_BE, + .tsoc = SND_SOC_TPLG_TYPE_BACKEND_LINK, + .size = sizeof(struct snd_soc_tplg_link_config), + .build = 1, + .enew = 1, ++ .parse = tplg_parse_link, + }, + { + .name = "cc", ++ .id = "SectionCC", + .loff = offsetof(snd_tplg_t, cc_list), + .type = SND_TPLG_TYPE_CC, + .tsoc = SND_SOC_TPLG_TYPE_CODEC_LINK, + .size = sizeof(struct snd_soc_tplg_link_config), + .build = 1, + .enew = 1, ++ .parse = tplg_parse_cc, + }, + { + .name = "route (dapm graph)", ++ .id = "SectionGraph", + .loff = offsetof(snd_tplg_t, route_list), + .type = SND_TPLG_TYPE_DAPM_GRAPH, + .tsoc = SND_SOC_TPLG_TYPE_DAPM_GRAPH, + .build = 1, ++ .parse = tplg_parse_dapm_graph, + }, + { + .name = "private data", ++ .id = "SectionData", + .loff = offsetof(snd_tplg_t, pdata_list), + .type = SND_TPLG_TYPE_DATA, + .tsoc = SND_SOC_TPLG_TYPE_PDATA, + .build = 1, + .enew = 1, ++ .parse = tplg_parse_data, + }, + { + .name = "text", ++ .id = "SectionText", + .loff = offsetof(snd_tplg_t, text_list), + .type = SND_TPLG_TYPE_TEXT, + .size = sizeof(struct tplg_texts), + .enew = 1, ++ .parse = tplg_parse_text, + }, + { + .name = "tlv", ++ .id = "SectionTLV", + .loff = offsetof(snd_tplg_t, tlv_list), + .type = SND_TPLG_TYPE_TLV, + .size = sizeof(struct snd_soc_tplg_ctl_tlv), + .enew = 1, ++ .parse = tplg_parse_tlv, + }, + { + .name = "stream config", +@@ -139,30 +166,38 @@ struct tplg_table tplg_table[] = { + }, + { + .name = "stream capabilities", ++ .id = "SectionPCMCapabilities", + .loff = offsetof(snd_tplg_t, pcm_caps_list), + .type = SND_TPLG_TYPE_STREAM_CAPS, + .size = sizeof(struct snd_soc_tplg_stream_caps), + .enew = 1, ++ .parse = tplg_parse_stream_caps, + }, + { + .name = "token", ++ .id = "SectionVendorTokens", + .loff = offsetof(snd_tplg_t, token_list), + .type = SND_TPLG_TYPE_TOKEN, + .enew = 1, ++ .parse = tplg_parse_tokens, + }, + { + .name = "tuple", ++ .id = "SectionVendorTuples", + .loff = offsetof(snd_tplg_t, tuple_list), + .type = SND_TPLG_TYPE_TUPLE, + .free = tplg_free_tuples, + .enew = 1, ++ .parse = tplg_parse_tuples, + }, + { + .name = "hw config", ++ .id = "SectionHWConfig", + .loff = offsetof(snd_tplg_t, hw_cfg_list), + .type = SND_TPLG_TYPE_HW_CONFIG, + .size = sizeof(struct snd_soc_tplg_hw_config), + .enew = 1, ++ .parse = tplg_parse_hw_config, + } + }; + +diff --git a/src/topology/parser.c b/src/topology/parser.c +index ed864d32..11202769 100644 +--- a/src/topology/parser.c ++++ b/src/topology/parser.c +@@ -142,87 +142,11 @@ int tplg_parse_compound(snd_tplg_t *tplg, snd_config_t *cfg, + + static int tplg_parse_config(snd_tplg_t *tplg, snd_config_t *cfg) + { +- static struct _parser { +- const char *id; +- int (*parser)(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); +- } *p, parsers[] = { +- { +- .id = "SectionTLV", +- .parser = tplg_parse_tlv +- }, +- { +- .id = "SectionControlMixer", +- .parser = tplg_parse_control_mixer +- }, +- { +- .id = "SectionControlEnum", +- .parser = tplg_parse_control_enum +- }, +- { +- .id = "SectionControlBytes", +- .parser = tplg_parse_control_bytes +- }, +- { +- .id = "SectionWidget", +- .parser = tplg_parse_dapm_widget +- }, +- { +- .id = "SectionPCMCapabilities", +- .parser = tplg_parse_stream_caps +- }, +- { +- .id = "SectionPCM", +- .parser = tplg_parse_pcm +- }, +- { +- .id = "SectionDAI", +- .parser = tplg_parse_dai +- }, +- { +- .id = "SectionHWConfig", +- .parser = tplg_parse_hw_config +- }, +- { +- .id = "SectionLink", +- .parser = tplg_parse_link +- }, +- { +- .id = "SectionBE", +- .parser = tplg_parse_link +- }, +- { +- .id = "SectionCC", +- .parser = tplg_parse_cc +- }, +- { +- .id = "SectionGraph", +- .parser = tplg_parse_dapm_graph +- }, +- { +- .id = "SectionText", +- .parser = tplg_parse_text +- }, +- { +- .id = "SectionData", +- .parser = tplg_parse_data +- }, +- { +- .id = "SectionVendorTokens", +- .parser = tplg_parse_tokens +- }, +- { +- .id = "SectionVendorTuples", +- .parser = tplg_parse_tuples +- }, +- { +- .id = "SectionManifest", +- .parser = tplg_parse_manifest_data +- }, +- }; + int (*parser)(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); + snd_config_iterator_t i, next; + snd_config_t *n; + const char *id; ++ struct tplg_table *p; + unsigned int idx; + int err; + +@@ -239,10 +163,14 @@ static int tplg_parse_config(snd_tplg_t *tplg, snd_config_t *cfg) + continue; + + parser = NULL; +- for (idx = 0; idx < ARRAY_SIZE(parsers); idx++) { +- p = &parsers[idx]; +- if (strcmp(id, p->id) == 0) { +- parser = p->parser; ++ for (idx = 0; idx < tplg_table_items; idx++) { ++ p = &tplg_table[idx]; ++ if (p->id && strcmp(id, p->id) == 0) { ++ parser = p->parse; ++ break; ++ } ++ if (p->id2 && strcmp(id, p->id2) == 0) { ++ parser = p->parse; + break; + } + } +diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h +index 0987898f..bea88ba3 100644 +--- a/src/topology/tplg_local.h ++++ b/src/topology/tplg_local.h +@@ -199,6 +199,8 @@ struct map_elem { + /* mapping table */ + struct tplg_table { + const char *name; ++ const char *id; ++ const char *id2; + off_t loff; + size_t size; + int type; +@@ -206,6 +208,7 @@ struct tplg_table { + unsigned build: 1; + unsigned enew: 1; + void (*free)(void *); ++ int (*parse)(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); + }; + + extern struct tplg_table tplg_table[]; +-- +2.24.1 + + +From aa1bac2d04bd1fb4ccae96a1136e60454298a710 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 16 Dec 2019 14:26:31 +0100 +Subject: [PATCH 43/69] topology: add snd_tplg_save() + +Signed-off-by: Jaroslav Kysela +--- + include/topology.h | 15 + + src/conf.c | 17 + + src/topology/Makefile.am | 3 +- + src/topology/channel.c | 45 +++ + src/topology/ctl.c | 201 +++++++++++- + src/topology/dapm.c | 209 +++++++++---- + src/topology/data.c | 601 +++++++++++++++++++++++++++++------- + src/topology/elem.c | 18 ++ + src/topology/ops.c | 92 ++++++ + src/topology/parser.c | 4 + + src/topology/pcm.c | 505 ++++++++++++++++++++++++++---- + src/topology/save.c | 632 ++++++++++++++++++++++++++++++++++++++ + src/topology/text.c | 19 ++ + src/topology/tplg_local.h | 58 +++- + 14 files changed, 2162 insertions(+), 257 deletions(-) + create mode 100644 src/topology/save.c + +diff --git a/include/topology.h b/include/topology.h +index c9f4ffea..69aa5ed7 100644 +--- a/include/topology.h ++++ b/include/topology.h +@@ -1124,6 +1124,21 @@ int snd_tplg_set_manifest_data(snd_tplg_t *tplg, const void *data, int len); + */ + int snd_tplg_set_version(snd_tplg_t *tplg, unsigned int version); + ++/* ++ * Flags for the snd_tplg_save() ++ */ ++#define SND_TPLG_SAVE_SORT (1<<0) /*!< sort identifiers */ ++#define SND_TPLG_SAVE_GROUPS (1<<1) /*!< create the structure by group index */ ++#define SND_TPLG_SAVE_NOCHECK (1<<16) /*!< unchecked output for debugging */ ++ ++/** ++ * \brief Save the topology to the text configuration string. ++ * \param tplg Topology instance. ++ * \param dst A pointer to string with result (malloc). ++ * \return Zero on success, otherwise a negative error code ++ */ ++int snd_tplg_save(snd_tplg_t *tplg, char **dst, int flags); ++ + /* \} */ + + #ifdef __cplusplus +diff --git a/src/conf.c b/src/conf.c +index 3e753b26..c4db9f21 100644 +--- a/src/conf.c ++++ b/src/conf.c +@@ -874,6 +874,21 @@ static int get_nonwhite(input_t *input) + } + } + ++static inline int get_hexachar(input_t *input) ++{ ++ int c, num = 0; ++ ++ c = get_char(input); ++ if (c >= '0' && c <= '9') num |= (c - '0') << 4; ++ else if (c >= 'a' && c <= 'f') num |= (c - 'a') << 4; ++ else if (c >= 'A' && c <= 'F') num |= (c - 'A') << 4; ++ c = get_char(input); ++ if (c >= '0' && c <= '9') num |= (c - '0') << 0; ++ else if (c >= 'a' && c <= 'f') num |= (c - 'a') << 0; ++ else if (c >= 'A' && c <= 'F') num |= (c - 'A') << 0; ++ return c; ++} ++ + static int get_quotedchar(input_t *input) + { + int c; +@@ -891,6 +906,8 @@ static int get_quotedchar(input_t *input) + return '\r'; + case 'f': + return '\f'; ++ case 'x': ++ return get_hexachar(input); + case '0': case '1': case '2': case '3': + case '4': case '5': case '6': case '7': + { +diff --git a/src/topology/Makefile.am b/src/topology/Makefile.am +index 9dc472d6..a850ec4c 100644 +--- a/src/topology/Makefile.am ++++ b/src/topology/Makefile.am +@@ -27,7 +27,8 @@ libatopology_la_SOURCES =\ + text.c \ + channel.c \ + ops.c \ +- elem.c ++ elem.c \ ++ save.c + + noinst_HEADERS = tplg_local.h + +diff --git a/src/topology/channel.c b/src/topology/channel.c +index 4569eb31..b54a10c8 100644 +--- a/src/topology/channel.c ++++ b/src/topology/channel.c +@@ -73,6 +73,18 @@ static int lookup_channel(const char *c) + return -EINVAL; + } + ++const char *tplg_channel_name(int type) ++{ ++ unsigned int i; ++ ++ for (i = 0; i < ARRAY_SIZE(channel_map); i++) { ++ if (channel_map[i].id == type) ++ return channel_map[i].name; ++ } ++ ++ return NULL; ++} ++ + /* Parse a channel mapping. */ + int tplg_parse_channel(snd_tplg_t *tplg, snd_config_t *cfg, + void *private) +@@ -123,3 +135,36 @@ int tplg_parse_channel(snd_tplg_t *tplg, snd_config_t *cfg, + tplg->channel_idx++; + return 0; + } ++ ++int tplg_save_channels(snd_tplg_t *tplg ATTRIBUTE_UNUSED, ++ struct snd_soc_tplg_channel *channel, ++ unsigned int count, char **dst, const char *pfx) ++{ ++ struct snd_soc_tplg_channel *c; ++ const char *s; ++ unsigned int index; ++ int err; ++ ++ if (count == 0) ++ return 0; ++ err = tplg_save_printf(dst, pfx, "channel {\n"); ++ for (index = 0; err >= 0 && index < count; index++) { ++ c = channel + index; ++ s = tplg_channel_name(c->id); ++ if (s == NULL) ++ err = tplg_save_printf(dst, pfx, "\t%u", c->id); ++ else ++ err = tplg_save_printf(dst, pfx, "\t%s", s); ++ if (err >= 0) ++ err = tplg_save_printf(dst, NULL, " {\n"); ++ if (err >= 0) ++ err = tplg_save_printf(dst, pfx, "\t\treg %d\n", c->reg); ++ if (err >= 0 && c->shift > 0) ++ err = tplg_save_printf(dst, pfx, "\t\tshift %u\n", c->shift); ++ if (err >= 0) ++ err = tplg_save_printf(dst, pfx, "\t}\n"); ++ } ++ if (err >= 0) ++ err = tplg_save_printf(dst, pfx, "}\n"); ++ return err; ++} +diff --git a/src/topology/ctl.c b/src/topology/ctl.c +index 539329cd..979cc1b0 100644 +--- a/src/topology/ctl.c ++++ b/src/topology/ctl.c +@@ -28,15 +28,16 @@ struct ctl_access_elem { + }; + + /* CTL access strings and codes */ ++/* place the multi-bit values on top - like read_write - for save */ + static const struct ctl_access_elem ctl_access[] = { ++ {"read_write", SNDRV_CTL_ELEM_ACCESS_READWRITE}, ++ {"tlv_read_write", SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE}, + {"read", SNDRV_CTL_ELEM_ACCESS_READ}, + {"write", SNDRV_CTL_ELEM_ACCESS_WRITE}, +- {"read_write", SNDRV_CTL_ELEM_ACCESS_READWRITE}, + {"volatile", SNDRV_CTL_ELEM_ACCESS_VOLATILE}, + {"timestamp", SNDRV_CTL_ELEM_ACCESS_TIMESTAMP}, + {"tlv_read", SNDRV_CTL_ELEM_ACCESS_TLV_READ}, + {"tlv_write", SNDRV_CTL_ELEM_ACCESS_TLV_WRITE}, +- {"tlv_read_write", SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE}, + {"tlv_command", SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND}, + {"inactive", SNDRV_CTL_ELEM_ACCESS_INACTIVE}, + {"lock", SNDRV_CTL_ELEM_ACCESS_LOCK}, +@@ -103,6 +104,46 @@ int parse_access(snd_config_t *cfg, + return err; + } + ++/* Save Access */ ++static int tplg_save_access(snd_tplg_t *tplg ATTRIBUTE_UNUSED, ++ struct snd_soc_tplg_ctl_hdr *hdr, char **dst, ++ const char *pfx) ++{ ++ const char *last; ++ unsigned int j, count, access, cval; ++ int err; ++ ++ if (hdr->access == 0) ++ return 0; ++ ++ access = hdr->access; ++ for (j = 0, count = 0, last = NULL; j < ARRAY_SIZE(ctl_access); j++) { ++ cval = ctl_access[j].value; ++ if ((access & cval) == cval) { ++ access &= ~cval; ++ last = ctl_access[j].name; ++ count++; ++ } ++ } ++ if (count == 1) ++ return tplg_save_printf(dst, pfx, "access.0 %s\n", last); ++ err = tplg_save_printf(dst, pfx, "access [\n"); ++ if (err < 0) ++ return err; ++ access = hdr->access; ++ for (j = 0; j < ARRAY_SIZE(ctl_access); j++) { ++ cval = ctl_access[j].value; ++ if ((access & cval) == cval) { ++ err = tplg_save_printf(dst, pfx, "\t%s\n", ++ ctl_access[j].name); ++ if (err < 0) ++ return err; ++ access &= ~cval; ++ } ++ } ++ return tplg_save_printf(dst, pfx, "]\n"); ++} ++ + /* copy referenced TLV to the mixer control */ + static int copy_tlv(struct tplg_elem *elem, struct tplg_elem *ref) + { +@@ -358,6 +399,37 @@ int tplg_parse_tlv(snd_tplg_t *tplg, snd_config_t *cfg, + return err; + } + ++/* save TLV data */ ++int tplg_save_tlv(snd_tplg_t *tplg ATTRIBUTE_UNUSED, ++ struct tplg_elem *elem, ++ char **dst, const char *pfx) ++{ ++ struct snd_soc_tplg_ctl_tlv *tlv = elem->tlv; ++ struct snd_soc_tplg_tlv_dbscale *scale; ++ int err; ++ ++ if (tlv->type != SNDRV_CTL_TLVT_DB_SCALE) { ++ SNDERR("unknown TLV type"); ++ return -EINVAL; ++ } ++ ++ scale = &tlv->scale; ++ err = tplg_save_printf(dst, NULL, "'%s' {\n", elem->id); ++ if (err >= 0) ++ err = tplg_save_printf(dst, pfx, "\tscale {\n"); ++ if (err >= 0 && scale->min) ++ err = tplg_save_printf(dst, pfx, "\t\tmin %i\n", scale->min); ++ if (err >= 0 && scale->step > 0) ++ err = tplg_save_printf(dst, pfx, "\t\tstep %i\n", scale->step); ++ if (err >= 0 && scale->mute > 0) ++ err = tplg_save_printf(dst, pfx, "\t\tmute %i\n", scale->mute); ++ if (err >= 0) ++ err = tplg_save_printf(dst, pfx, "\t}\n"); ++ if (err >= 0) ++ err = tplg_save_printf(dst, pfx, "}\n"); ++ return err; ++} ++ + /* Parse Control Bytes */ + int tplg_parse_control_bytes(snd_tplg_t *tplg, + snd_config_t *cfg, +@@ -430,7 +502,7 @@ int tplg_parse_control_bytes(snd_tplg_t *tplg, + } + + if (strcmp(id, "data") == 0) { +- err = tplg_parse_data_refs(n, elem); ++ err = tplg_parse_refs(n, elem, SND_TPLG_TYPE_DATA); + if (err < 0) + return err; + continue; +@@ -485,6 +557,49 @@ int tplg_parse_control_bytes(snd_tplg_t *tplg, + return 0; + } + ++/* save control bytes */ ++int tplg_save_control_bytes(snd_tplg_t *tplg ATTRIBUTE_UNUSED, ++ struct tplg_elem *elem, ++ char **dst, const char *pfx) ++{ ++ struct snd_soc_tplg_bytes_control *be = elem->bytes_ext; ++ char pfx2[16]; ++ int err; ++ ++ if (!be) ++ return 0; ++ ++ snprintf(pfx2, sizeof(pfx2), "%s\t", pfx ?: ""); ++ err = tplg_save_printf(dst, NULL, "'%s' {\n", elem->id); ++ if (err < 0) ++ return err; ++ if (err >= 0 && elem->index > 0) ++ err = tplg_save_printf(dst, pfx, "\tindex %u\n", elem->index); ++ if (err >= 0 && be->base > 0) ++ err = tplg_save_printf(dst, pfx, "\tbase %u\n", be->base); ++ if (err >= 0 && be->num_regs > 0) ++ err = tplg_save_printf(dst, pfx, "\tnum_regs %u\n", be->num_regs); ++ if (err >= 0 && be->max > 0) ++ err = tplg_save_printf(dst, pfx, "\tmax %u\n", be->max); ++ if (err >= 0 && be->mask > 0) ++ err = tplg_save_printf(dst, pfx, "\tmask %u\n", be->mask); ++ if (err >= 0) ++ err = tplg_save_ops(tplg, &be->hdr, dst, pfx2); ++ if (err >= 0) ++ err = tplg_save_ext_ops(tplg, be, dst, pfx2); ++ if (err >= 0) ++ err = tplg_save_access(tplg, &be->hdr, dst, pfx2); ++ if (err >= 0) ++ err = tplg_save_refs(tplg, elem, SND_TPLG_TYPE_TLV, ++ "tlv", dst, pfx2); ++ if (err >= 0) ++ err = tplg_save_refs(tplg, elem, SND_TPLG_TYPE_DATA, ++ "data", dst, pfx2); ++ if (err >= 0) ++ err = tplg_save_printf(dst, pfx, "}\n"); ++ return err; ++} ++ + /* Parse Control Enums. */ + int tplg_parse_control_enum(snd_tplg_t *tplg, snd_config_t *cfg, + void *private ATTRIBUTE_UNUSED) +@@ -559,7 +674,7 @@ int tplg_parse_control_enum(snd_tplg_t *tplg, snd_config_t *cfg, + } + + if (strcmp(id, "data") == 0) { +- err = tplg_parse_data_refs(n, elem); ++ err = tplg_parse_refs(n, elem, SND_TPLG_TYPE_DATA); + if (err < 0) + return err; + continue; +@@ -582,6 +697,42 @@ int tplg_parse_control_enum(snd_tplg_t *tplg, snd_config_t *cfg, + return 0; + } + ++/* save control eunm */ ++int tplg_save_control_enum(snd_tplg_t *tplg ATTRIBUTE_UNUSED, ++ struct tplg_elem *elem, ++ char **dst, const char *pfx) ++{ ++ struct snd_soc_tplg_enum_control *ec = elem->enum_ctrl; ++ char pfx2[16]; ++ int err; ++ ++ if (!ec) ++ return 0; ++ ++ snprintf(pfx2, sizeof(pfx2), "%s\t", pfx ?: ""); ++ err = tplg_save_printf(dst, NULL, "'%s' {\n", elem->id); ++ if (err < 0) ++ return err; ++ if (err >= 0 && elem->index > 0) ++ err = tplg_save_printf(dst, pfx, "\tindex %u\n", elem->index); ++ if (err >= 0) ++ err = tplg_save_refs(tplg, elem, SND_TPLG_TYPE_TEXT, ++ "texts", dst, pfx2); ++ if (err >= 0) ++ err = tplg_save_channels(tplg, ec->channel, ec->num_channels, ++ dst, pfx2); ++ if (err >= 0) ++ err = tplg_save_ops(tplg, &ec->hdr, dst, pfx2); ++ if (err >= 0) ++ err = tplg_save_access(tplg, &ec->hdr, dst, pfx2); ++ if (err >= 0) ++ err = tplg_save_refs(tplg, elem, SND_TPLG_TYPE_DATA, ++ "data", dst, pfx2); ++ if (err >= 0) ++ err = tplg_save_printf(dst, pfx, "}\n"); ++ return err; ++} ++ + /* Parse Controls. + * + * Mixer control. Supports multiple channels. +@@ -683,7 +834,7 @@ int tplg_parse_control_mixer(snd_tplg_t *tplg, + } + + if (strcmp(id, "data") == 0) { +- err = tplg_parse_data_refs(n, elem); ++ err = tplg_parse_refs(n, elem, SND_TPLG_TYPE_DATA); + if (err < 0) + return err; + continue; +@@ -709,6 +860,46 @@ int tplg_parse_control_mixer(snd_tplg_t *tplg, + return 0; + } + ++int tplg_save_control_mixer(snd_tplg_t *tplg ATTRIBUTE_UNUSED, ++ struct tplg_elem *elem, char **dst, ++ const char *pfx) ++{ ++ struct snd_soc_tplg_mixer_control *mc = elem->mixer_ctrl; ++ char pfx2[16]; ++ int err; ++ ++ if (!mc) ++ return 0; ++ err = tplg_save_printf(dst, NULL, "'%s' {\n", elem->id); ++ if (err < 0) ++ return err; ++ snprintf(pfx2, sizeof(pfx2), "%s\t", pfx ?: ""); ++ if (err >= 0 && elem->index > 0) ++ err = tplg_save_printf(dst, pfx, "\tindex %u\n", elem->index); ++ if (err >= 0) ++ err = tplg_save_channels(tplg, mc->channel, mc->num_channels, ++ dst, pfx2); ++ if (err >= 0 && mc->max > 0) ++ err = tplg_save_printf(dst, pfx, "\tmax %u\n", mc->max); ++ if (err >= 0 && mc->invert > 0) ++ err = tplg_save_printf(dst, pfx, "\tinvert 1\n", mc->max); ++ if (err >= 0 && mc->invert > 0) ++ err = tplg_save_printf(dst, pfx, "\tinvert 1\n", mc->max); ++ if (err >= 0) ++ err = tplg_save_ops(tplg, &mc->hdr, dst, pfx2); ++ if (err >= 0) ++ err = tplg_save_access(tplg, &mc->hdr, dst, pfx2); ++ if (err >= 0) ++ err = tplg_save_refs(tplg, elem, SND_TPLG_TYPE_TLV, ++ "tlv", dst, pfx2); ++ if (err >= 0) ++ err = tplg_save_refs(tplg, elem, SND_TPLG_TYPE_DATA, ++ "data", dst, pfx2); ++ if (err >= 0) ++ err = tplg_save_printf(dst, pfx, "}\n"); ++ return err; ++} ++ + static int init_ctl_hdr(struct snd_soc_tplg_ctl_hdr *hdr, + struct snd_tplg_ctl_template *t) + { +diff --git a/src/topology/dapm.c b/src/topology/dapm.c +index ad709210..2bdacedc 100644 +--- a/src/topology/dapm.c ++++ b/src/topology/dapm.c +@@ -43,7 +43,6 @@ static const struct map_elem widget_map[] = { + {"effect", SND_SOC_TPLG_DAPM_EFFECT}, + {"siggen", SND_SOC_TPLG_DAPM_SIGGEN}, + {"src", SND_SOC_TPLG_DAPM_SRC}, +- {"asrc", SND_SOC_TPLG_DAPM_ASRC}, + {"encoder", SND_SOC_TPLG_DAPM_ENCODER}, + {"decoder", SND_SOC_TPLG_DAPM_DECODER}, + }; +@@ -60,70 +59,16 @@ static int lookup_widget(const char *w) + return -EINVAL; + } + +-static int tplg_parse_dapm_mixers(snd_config_t *cfg, struct tplg_elem *elem) ++static const char *get_widget_name(unsigned int type) + { +- snd_config_iterator_t i, next; +- snd_config_t *n; +- const char *value = NULL; +- +- tplg_dbg(" DAPM Mixer Controls: %s\n", elem->id); +- +- snd_config_for_each(i, next, cfg) { +- n = snd_config_iterator_entry(i); +- +- /* get value */ +- if (snd_config_get_string(n, &value) < 0) +- continue; +- +- tplg_ref_add(elem, SND_TPLG_TYPE_MIXER, value); +- tplg_dbg("\t\t %s\n", value); +- } +- +- return 0; +-} +- +-static int tplg_parse_dapm_enums(snd_config_t *cfg, struct tplg_elem *elem) +-{ +- snd_config_iterator_t i, next; +- snd_config_t *n; +- const char *value = NULL; +- +- tplg_dbg(" DAPM Enum Controls: %s\n", elem->id); +- +- snd_config_for_each(i, next, cfg) { +- n = snd_config_iterator_entry(i); +- +- /* get value */ +- if (snd_config_get_string(n, &value) < 0) +- continue; +- +- tplg_ref_add(elem, SND_TPLG_TYPE_ENUM, value); +- tplg_dbg("\t\t %s\n", value); +- } +- +- return 0; +-} +- +-static int tplg_parse_dapm_bytes(snd_config_t *cfg, struct tplg_elem *elem) +-{ +- snd_config_iterator_t i, next; +- snd_config_t *n; +- const char *value = NULL; +- +- tplg_dbg(" DAPM Bytes Controls: %s\n", elem->id); +- +- snd_config_for_each(i, next, cfg) { +- n = snd_config_iterator_entry(i); +- +- /* get value */ +- if (snd_config_get_string(n, &value) < 0) +- continue; ++ unsigned int i; + +- tplg_ref_add(elem, SND_TPLG_TYPE_BYTES, value); +- tplg_dbg("\t\t %s\n", value); ++ for (i = 0; i < ARRAY_SIZE(widget_map); i++) { ++ if ((unsigned int)widget_map[i].id == type) ++ return widget_map[i].name; + } + +- return 0; ++ return NULL; + } + + /* move referenced controls to the widget */ +@@ -340,7 +285,7 @@ struct tplg_elem *tplg_elem_new_route(snd_tplg_t *tplg, int index) + + #define LINE_SIZE 1024 + +-/* line is defined as '"source, control, sink"' */ ++/* line is defined as '"sink, control, source"' */ + static int tplg_parse_line(const char *text, + struct snd_soc_tplg_dapm_graph_elem *line) + { +@@ -470,6 +415,77 @@ int tplg_parse_dapm_graph(snd_tplg_t *tplg, snd_config_t *cfg, + return 0; + } + ++/* save DAPM graph */ ++int tplg_save_dapm_graph(snd_tplg_t *tplg, int index, char **dst, const char *pfx) ++{ ++ struct snd_soc_tplg_dapm_graph_elem *route; ++ struct list_head *pos; ++ struct tplg_elem *elem; ++ int err, first = 1, old_index = -1; ++ unsigned block = -1, count = 0; ++ ++ list_for_each(pos, &tplg->route_list) { ++ elem = list_entry(pos, struct tplg_elem, list); ++ if (!elem->route || elem->type != SND_TPLG_TYPE_DAPM_GRAPH) ++ continue; ++ if (index >= 0 && elem->index != index) ++ continue; ++ count++; ++ } ++ if (count == 0) ++ return 0; ++ err = tplg_save_printf(dst, pfx, "SectionGraph {\n"); ++ list_for_each(pos, &tplg->route_list) { ++ elem = list_entry(pos, struct tplg_elem, list); ++ if (!elem->route || elem->type != SND_TPLG_TYPE_DAPM_GRAPH) ++ continue; ++ if (index >= 0 && elem->index != index) ++ continue; ++ if (old_index != elem->index) { ++ if (old_index >= 0) { ++ err = tplg_save_printf(dst, pfx, "\t\t]\n"); ++ if (err < 0) ++ return err; ++ err = tplg_save_printf(dst, pfx, "\t}\n"); ++ if (err < 0) ++ return err; ++ } ++ old_index = elem->index; ++ block++; ++ first = 1; ++ err = tplg_save_printf(dst, pfx, "\tset%u {\n", block); ++ if (err >= 0) ++ err = tplg_save_printf(dst, pfx, "\t\tindex %u\n", ++ elem->index); ++ if (err < 0) ++ return err; ++ } ++ if (first) { ++ first = 0; ++ err = tplg_save_printf(dst, pfx, "\t\tlines [\n", elem->index); ++ if (err < 0) ++ return err; ++ } ++ route = elem->route; ++ err = tplg_save_printf(dst, pfx, "\t\t\t'%s, %s, %s'\n", ++ route->sink, route->control, ++ route->source); ++ if (err < 0) ++ return err; ++ } ++ ++ if (!first) { ++ if (err >= 0) ++ err = tplg_save_printf(dst, pfx, "\t\t]\n"); ++ if (err >= 0) ++ err = tplg_save_printf(dst, pfx, "\t}\n"); ++ } ++ ++ if (err >= 0) ++ err = tplg_save_printf(dst, pfx, "}\n"); ++ return err; ++} ++ + /* DAPM Widget */ + int tplg_parse_dapm_widget(snd_tplg_t *tplg, + snd_config_t *cfg, void *private ATTRIBUTE_UNUSED) +@@ -595,7 +611,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, + } + + if (strcmp(id, "enum") == 0) { +- err = tplg_parse_dapm_enums(n, elem); ++ err = tplg_parse_refs(n, elem, SND_TPLG_TYPE_ENUM); + if (err < 0) + return err; + +@@ -603,7 +619,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, + } + + if (strcmp(id, "mixer") == 0) { +- err = tplg_parse_dapm_mixers(n, elem); ++ err = tplg_parse_refs(n, elem, SND_TPLG_TYPE_MIXER); + if (err < 0) + return err; + +@@ -611,7 +627,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, + } + + if (strcmp(id, "bytes") == 0) { +- err = tplg_parse_dapm_bytes(n, elem); ++ err = tplg_parse_refs(n, elem, SND_TPLG_TYPE_BYTES); + if (err < 0) + return err; + +@@ -619,7 +635,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, + } + + if (strcmp(id, "data") == 0) { +- err = tplg_parse_data_refs(n, elem); ++ err = tplg_parse_refs(n, elem, SND_TPLG_TYPE_DATA); + if (err < 0) + return err; + continue; +@@ -629,6 +645,66 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, + return 0; + } + ++/* save DAPM widget */ ++int tplg_save_dapm_widget(snd_tplg_t *tplg ATTRIBUTE_UNUSED, ++ struct tplg_elem *elem, ++ char **dst, const char *pfx) ++{ ++ struct snd_soc_tplg_dapm_widget *widget = elem->widget; ++ const char *s; ++ char pfx2[16]; ++ int err; ++ ++ err = tplg_save_printf(dst, NULL, "'%s' {\n", elem->id); ++ if (err >= 0 && elem->index) ++ err = tplg_save_printf(dst, pfx, "\tindex %u\n", ++ elem->index); ++ if (err >= 0) { ++ s = get_widget_name(widget->id); ++ if (s) ++ err = tplg_save_printf(dst, pfx, "\ttype %s\n", s); ++ else ++ err = tplg_save_printf(dst, pfx, "\ttype %u\n", ++ widget->id); ++ } ++ if (err >= 0 && widget->sname[0]) ++ err = tplg_save_printf(dst, pfx, "\tstream_name '%s'\n", ++ widget->sname); ++ if (err >= 0 && widget->reg) ++ err = tplg_save_printf(dst, pfx, "\tno_pm 1\n"); ++ if (err >= 0 && widget->shift) ++ err = tplg_save_printf(dst, pfx, "\tshift %u\n", ++ widget->shift); ++ if (err >= 0 && widget->invert) ++ err = tplg_save_printf(dst, pfx, "\tinvert %u\n", ++ widget->invert); ++ if (err >= 0 && widget->subseq) ++ err = tplg_save_printf(dst, pfx, "\tsubseq %u\n", ++ widget->subseq); ++ if (err >= 0 && widget->event_type) ++ err = tplg_save_printf(dst, pfx, "\tevent_type %u\n", ++ widget->event_type); ++ if (err >= 0 && widget->event_flags) ++ err = tplg_save_printf(dst, pfx, "\tevent_flags %u\n", ++ widget->event_flags); ++ snprintf(pfx2, sizeof(pfx2), "%s\t", pfx ?: ""); ++ if (err >= 0) ++ err = tplg_save_refs(tplg, elem, SND_TPLG_TYPE_ENUM, ++ "enum", dst, pfx2); ++ if (err >= 0) ++ err = tplg_save_refs(tplg, elem, SND_TPLG_TYPE_MIXER, ++ "mixer", dst, pfx2); ++ if (err >= 0) ++ err = tplg_save_refs(tplg, elem, SND_TPLG_TYPE_BYTES, ++ "bytes", dst, pfx2); ++ if (err >= 0) ++ err = tplg_save_refs(tplg, elem, SND_TPLG_TYPE_DATA, ++ "data", dst, pfx2); ++ if (err >= 0) ++ err = tplg_save_printf(dst, pfx, "}\n"); ++ return err; ++} ++ + int tplg_add_route(snd_tplg_t *tplg, struct snd_tplg_graph_elem *t, int index) + { + struct tplg_elem *elem; +@@ -744,7 +820,6 @@ int tplg_add_widget_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) + default: + SNDERR("error: widget %s: invalid type %d for ctl %d\n", + wt->name, ct->type, i); +- ret = -EINVAL; + break; + } + +diff --git a/src/topology/data.c b/src/topology/data.c +index 9807445e..11cd73f5 100644 +--- a/src/topology/data.c ++++ b/src/topology/data.c +@@ -21,6 +21,10 @@ + #include "tplg_local.h" + #include + ++#define UUID_FORMAT "\ ++0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, \ ++0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x" ++ + /* Get private data buffer of an element */ + struct snd_soc_tplg_private *get_priv_data(struct tplg_elem *elem) + { +@@ -64,6 +68,96 @@ struct snd_soc_tplg_private *get_priv_data(struct tplg_elem *elem) + return priv; + } + ++/* Parse references for the element, either a single data section ++ * or a list of data sections. ++ */ ++int tplg_parse_refs(snd_config_t *cfg, struct tplg_elem *elem, ++ unsigned int type) ++{ ++ snd_config_type_t cfg_type; ++ snd_config_iterator_t i, next; ++ snd_config_t *n; ++ const char *val = NULL; ++ int err, count; ++ ++ cfg_type = snd_config_get_type(cfg); ++ ++ /* refer to a single data section */ ++ if (cfg_type == SND_CONFIG_TYPE_STRING) { ++ if (snd_config_get_string(cfg, &val) < 0) ++ return -EINVAL; ++ ++ tplg_dbg("\tref data: %s\n", val); ++ err = tplg_ref_add(elem, type, val); ++ if (err < 0) ++ return err; ++ return 1; ++ } ++ ++ if (cfg_type != SND_CONFIG_TYPE_COMPOUND) { ++ SNDERR("error: compound type expected for %s", elem->id); ++ return -EINVAL; ++ } ++ ++ /* refer to a list of data sections */ ++ count = 0; ++ snd_config_for_each(i, next, cfg) { ++ const char *val; ++ ++ n = snd_config_iterator_entry(i); ++ if (snd_config_get_string(n, &val) < 0) ++ continue; ++ ++ tplg_dbg("\tref data: %s\n", val); ++ err = tplg_ref_add(elem, type, val); ++ if (err < 0) ++ return err; ++ count++; ++ } ++ ++ return count; ++} ++ ++/* save references */ ++int tplg_save_refs(snd_tplg_t *tplg ATTRIBUTE_UNUSED, ++ struct tplg_elem *elem, unsigned int type, ++ const char *id, char **dst, const char *pfx) ++{ ++ struct tplg_ref *ref, *last; ++ struct list_head *pos; ++ int err, count; ++ ++ count = 0; ++ last = NULL; ++ list_for_each(pos, &elem->ref_list) { ++ ref = list_entry(pos, struct tplg_ref, list); ++ if (ref->type == type) { ++ last = ref; ++ count++; ++ } ++ } ++ ++ if (count == 0) ++ return 0; ++ ++ if (count == 1) ++ return tplg_save_printf(dst, pfx, "%s '%s'\n", id, last->id); ++ ++ err = tplg_save_printf(dst, pfx, "%s [\n", id); ++ if (err < 0) ++ return err; ++ list_for_each(pos, &elem->ref_list) { ++ ref = list_entry(pos, struct tplg_ref, list); ++ if (ref->type == type) { ++ err = tplg_save_printf(dst, pfx, "\t'%s'\n", ref->id); ++ if (err < 0) ++ return err; ++ } ++ } ++ ++ return tplg_save_printf(dst, pfx, "]\n"); ++} ++ + /* Get Private data from a file. */ + static int tplg_parse_data_file(snd_config_t *cfg, struct tplg_elem *elem) + { +@@ -140,58 +234,98 @@ err: + static void dump_priv_data(struct tplg_elem *elem) + { + struct snd_soc_tplg_private *priv = elem->data; +- unsigned int i, j = 0; ++ unsigned int i; + + tplg_dbg(" elem size = %d, priv data size = %d\n", + elem->size, priv->size); + + for (i = 0; i < priv->size; i++) { +- if (j++ % 8 == 0) ++ if (i > 0 && (i % 16) == 0) + tplg_dbg("\n"); + +- tplg_dbg(" 0x%x", *p++); ++ tplg_dbg(" %02x:", *p++); + } + + tplg_dbg("\n\n"); + } + ++static inline int check_nibble(unsigned char c) ++{ ++ return (c >= '0' && c <= '9') || ++ (c >= 'a' && c <= 'f') || ++ (c >= 'A' && c <= 'F'); ++} ++ + /* get number of hex value elements in CSV list */ + static int get_hex_num(const char *str) + { +- int commas = 0, values = 0, len = strlen(str); +- const char *end = str + len; ++ int delims, values, len = strlen(str); ++ const char *s, *end = str + len; ++ ++ /* check "aa:bb:00" syntax */ ++ s = str; ++ delims = values = 0; ++ while (s < end) { ++ /* skip white space */ ++ if (isspace(*s)) { ++ s++; ++ continue; ++ } ++ /* find delimeters */ ++ if (*s == ':') { ++ delims++; ++ s++; ++ continue; ++ } ++ /* check 00 hexadecimal value */ ++ if (s + 1 <= end) { ++ if (check_nibble(s[0]) && check_nibble(s[1])) { ++ values++; ++ } else { ++ goto format2; ++ } ++ s++; ++ } ++ s++; ++ } ++ goto end; + ++format2: + /* we expect "0x0, 0x0, 0x0" */ +- while (str < end) { ++ s = str; ++ delims = values = 0; ++ while (s < end) { + + /* skip white space */ +- if (isspace(*str)) { +- str++; ++ if (isspace(*s)) { ++ s++; + continue; + } + + /* find delimeters */ +- if (*str == ',') { +- commas++; +- str++; ++ if (*s == ',') { ++ delims++; ++ s++; + continue; + } + + /* find 0x[0-9] values */ +- if (*str == '0' && str + 2 <= end) { +- if (str[1] == 'x' && str[2] >= '0' && str[2] <= 'f') { ++ if (*s == '0' && s + 2 <= end) { ++ if (s[1] == 'x' && check_nibble(s[2])) { ++ if (check_nibble(s[3])) ++ s++; + values++; +- str += 3; +- } else { +- str++; ++ s += 2; + } ++ s++; + } + +- str++; ++ s++; + } + ++end: + /* there should always be one less comma than value */ +- if (values -1 != commas) ++ if (values - 1 != delims) + return -EINVAL; + + return values; +@@ -547,6 +681,71 @@ static int build_tuples(snd_tplg_t *tplg, struct tplg_elem *elem) + return 0; + } + ++struct tuple_type { ++ unsigned int type; ++ const char *name; ++ unsigned int size; ++}; ++ ++static struct tuple_type tuple_types[] = { ++ { ++ .type = SND_SOC_TPLG_TUPLE_TYPE_UUID, ++ .name = "uuid", ++ .size = 4, ++ }, ++ { ++ .type = SND_SOC_TPLG_TUPLE_TYPE_STRING, ++ .name = "string", ++ .size = 6, ++ }, ++ { ++ .type = SND_SOC_TPLG_TUPLE_TYPE_BOOL, ++ .name = "bool", ++ .size = 4, ++ }, ++ { ++ .type = SND_SOC_TPLG_TUPLE_TYPE_BYTE, ++ .name = "byte", ++ .size = 4, ++ }, ++ { ++ .type = SND_SOC_TPLG_TUPLE_TYPE_SHORT, ++ .name = "short", ++ .size = 5, ++ }, ++ { ++ .type = SND_SOC_TPLG_TUPLE_TYPE_WORD, ++ .name = "word", ++ .size = 4 ++ }, ++}; ++ ++static int get_tuple_type(const char *name) ++{ ++ struct tuple_type *t; ++ unsigned int i; ++ ++ /* skip initial index for sorting */ ++ while ((*name >= '0' && *name <= '9') || *name == '_') ++ name++; ++ for (i = 0; i < ARRAY_SIZE(tuple_types); i++) { ++ t = &tuple_types[i]; ++ if (strncasecmp(t->name, name, t->size) == 0) ++ return t->type; ++ } ++ return -EINVAL; ++} ++ ++static const char *get_tuple_type_name(unsigned int type) ++{ ++ unsigned int i; ++ ++ for (i = 0; i < ARRAY_SIZE(tuple_types); i++) ++ if (tuple_types[i].type == type) ++ return tuple_types[i].name; ++ return NULL; ++} ++ + static int parse_tuple_set(snd_config_t *cfg, + struct tplg_tuple_set **s) + { +@@ -554,28 +753,17 @@ static int parse_tuple_set(snd_config_t *cfg, + snd_config_t *n; + const char *id, *value; + struct tplg_tuple_set *set; +- unsigned int type, num_tuples = 0; ++ unsigned int num_tuples = 0; + struct tplg_tuple *tuple; + unsigned int tuple_val; +- int ival; ++ int type, ival; + + snd_config_get_id(cfg, &id); + +- if (strncmp(id, "uuid", 4) == 0) +- type = SND_SOC_TPLG_TUPLE_TYPE_UUID; +- else if (strncmp(id, "string", 5) == 0) +- type = SND_SOC_TPLG_TUPLE_TYPE_STRING; +- else if (strncmp(id, "bool", 4) == 0) +- type = SND_SOC_TPLG_TUPLE_TYPE_BOOL; +- else if (strncmp(id, "byte", 4) == 0) +- type = SND_SOC_TPLG_TUPLE_TYPE_BYTE; +- else if (strncmp(id, "short", 5) == 0) +- type = SND_SOC_TPLG_TUPLE_TYPE_SHORT; +- else if (strncmp(id, "word", 4) == 0) +- type = SND_SOC_TPLG_TUPLE_TYPE_WORD; +- else { +- SNDERR("error: invalid tuple type '%s'\n", id); +- return -EINVAL; ++ type = get_tuple_type(id); ++ if (type < 0) { ++ SNDERR("error: invalid tuple type '%s'", id); ++ return type; + } + + snd_config_for_each(i, next, cfg) +@@ -664,6 +852,84 @@ err: + return -EINVAL; + } + ++/* save tuple set */ ++static int tplg_save_tuple_set(struct tplg_vendor_tuples *tuples, ++ unsigned int set_index, ++ char **dst, const char *pfx) ++{ ++ struct tplg_tuple_set *set; ++ struct tplg_tuple *tuple; ++ const char *s, *fmt; ++ char buf[32]; ++ unsigned int i; ++ int err; ++ ++ set = tuples->set[set_index]; ++ if (set->num_tuples == 0) ++ return 0; ++ s = get_tuple_type_name(set->type); ++ if (s == NULL) ++ return -EINVAL; ++ if (tuples->num_sets < 10) ++ fmt = "%u_"; ++ else if (tuples->num_sets < 100) ++ fmt = "%02u_"; ++ else if (tuples->num_sets < 1000) ++ fmt = "%03u_"; ++ else ++ return -EINVAL; ++ if (set->num_tuples > 1) { ++ snprintf(buf, sizeof(buf), "tuples.%s%%s {\n", fmt); ++ err = tplg_save_printf(dst, NULL, buf, set_index, s); ++ if (err < 0) ++ return err; ++ } ++ for (i = 0; i < set->num_tuples; i++) { ++ tuple = &set->tuple[i]; ++ if (set->num_tuples == 1) { ++ snprintf(buf, sizeof(buf), "tuples.%s%%s.'%%s' ", fmt); ++ err = tplg_save_printf(dst, NULL, buf, ++ set_index, s, tuple->token); ++ } else { ++ err = tplg_save_printf(dst, pfx, "\t'%s' ", ++ tuple->token); ++ } ++ switch (set->type) { ++ case SND_SOC_TPLG_TUPLE_TYPE_UUID: ++ err = tplg_save_printf(dst, NULL, "'" UUID_FORMAT "'\n", ++ tuple->uuid[0], tuple->uuid[1], ++ tuple->uuid[2], tuple->uuid[3], ++ tuple->uuid[4], tuple->uuid[5], ++ tuple->uuid[6], tuple->uuid[7], ++ tuple->uuid[8], tuple->uuid[9], ++ tuple->uuid[10], tuple->uuid[11], ++ tuple->uuid[12], tuple->uuid[13], ++ tuple->uuid[14], tuple->uuid[15]); ++ break; ++ case SND_SOC_TPLG_TUPLE_TYPE_STRING: ++ err = tplg_save_printf(dst, NULL, "'%s'\n", ++ tuple->string); ++ break; ++ case SND_SOC_TPLG_TUPLE_TYPE_BOOL: ++ case SND_SOC_TPLG_TUPLE_TYPE_BYTE: ++ case SND_SOC_TPLG_TUPLE_TYPE_SHORT: ++ err = tplg_save_printf(dst, NULL, "%u\n", tuple->value); ++ break; ++ case SND_SOC_TPLG_TUPLE_TYPE_WORD: ++ tplg_nice_value_format(buf, sizeof(buf), tuple->value); ++ err = tplg_save_printf(dst, NULL, "%s\n", buf); ++ break; ++ default: ++ return -EINVAL; ++ } ++ if (err < 0) ++ return err; ++ } ++ if (set->num_tuples > 1) ++ return tplg_save_printf(dst, pfx, "}\n"); ++ return 0; ++} ++ + static int parse_tuple_sets(snd_config_t *cfg, + struct tplg_vendor_tuples *tuples) + { +@@ -710,87 +976,24 @@ static int parse_tuple_sets(snd_config_t *cfg, + return 0; + } + +-/* Parse tuples references for a data element, either a single tuples section +- * or a list of tuples sections. +- */ +-static int parse_tuples_refs(snd_config_t *cfg, +- struct tplg_elem *elem) +-{ +- snd_config_type_t type; +- snd_config_iterator_t i, next; +- snd_config_t *n; +- const char *val = NULL; +- +- type = snd_config_get_type(cfg); +- +- /* refer to a single tuples section */ +- if (type == SND_CONFIG_TYPE_STRING) { +- if (snd_config_get_string(cfg, &val) < 0) +- return -EINVAL; +- tplg_dbg("\ttuples: %s\n", val); +- return tplg_ref_add(elem, SND_TPLG_TYPE_TUPLE, val); +- } +- +- if (type != SND_CONFIG_TYPE_COMPOUND) { +- SNDERR("error: compound type expected for %s", elem->id); +- return -EINVAL; +- } +- +- /* refer to a list of data sections */ +- snd_config_for_each(i, next, cfg) { +- const char *val; +- +- n = snd_config_iterator_entry(i); +- if (snd_config_get_string(n, &val) < 0) +- continue; +- +- tplg_dbg("\ttuples: %s\n", val); +- tplg_ref_add(elem, SND_TPLG_TYPE_TUPLE, val); +- } +- +- return 0; +-} +- +-/* Parse private data references for the element, either a single data section +- * or a list of data sections. +- */ +-int tplg_parse_data_refs(snd_config_t *cfg, +- struct tplg_elem *elem) ++/* save tuple sets */ ++int tplg_save_tuple_sets(snd_tplg_t *tplg ATTRIBUTE_UNUSED, ++ struct tplg_elem *elem, ++ char **dst, const char *pfx) + { +- snd_config_type_t type; +- snd_config_iterator_t i, next; +- snd_config_t *n; +- const char *val = NULL; +- +- type = snd_config_get_type(cfg); +- +- /* refer to a single data section */ +- if (type == SND_CONFIG_TYPE_STRING) { +- if (snd_config_get_string(cfg, &val) < 0) +- return -EINVAL; +- +- tplg_dbg("\tdata: %s\n", val); +- return tplg_ref_add(elem, SND_TPLG_TYPE_DATA, val); +- } +- +- if (type != SND_CONFIG_TYPE_COMPOUND) { +- SNDERR("error: compound type expected for %s", elem->id); +- return -EINVAL; +- } +- +- /* refer to a list of data sections */ +- snd_config_for_each(i, next, cfg) { +- const char *val; +- +- n = snd_config_iterator_entry(i); +- if (snd_config_get_string(n, &val) < 0) +- continue; ++ struct tplg_vendor_tuples *tuples = elem->tuples; ++ unsigned int i; ++ int err = 0; + +- tplg_dbg("\tdata: %s\n", val); +- tplg_ref_add(elem, SND_TPLG_TYPE_DATA, val); ++ for (i = 0; i < tuples->num_sets; i++) { ++ err = tplg_save_printf(dst, pfx, ""); ++ if (err < 0) ++ break; ++ err = tplg_save_tuple_set(tuples, i, dst, pfx); ++ if (err < 0) ++ break; + } +- +- return 0; ++ return err; + } + + /* Parse vendor tokens +@@ -844,6 +1047,31 @@ int tplg_parse_tokens(snd_tplg_t *tplg, snd_config_t *cfg, + return 0; + } + ++/* save vendor tokens */ ++int tplg_save_tokens(snd_tplg_t *tplg ATTRIBUTE_UNUSED, ++ struct tplg_elem *elem, ++ char **dst, const char *pfx) ++{ ++ struct tplg_vendor_tokens *tokens = elem->tokens; ++ unsigned int i; ++ int err; ++ ++ if (!tokens || tokens->num_tokens == 0) ++ return 0; ++ ++ err = tplg_save_printf(dst, NULL, "'%s' {\n", elem->id); ++ if (err < 0) ++ return err; ++ for (i = 0; err >= 0 && i < tokens->num_tokens; i++) ++ err = tplg_save_printf(dst, pfx, "\t'%s' %u\n", ++ tokens->token[i].id, ++ tokens->token[i].value); ++ err = tplg_save_printf(dst, pfx, "}\n"); ++ if (err < 0) ++ return err; ++ return 0; ++} ++ + /* Parse vendor tuples. + */ + int tplg_parse_tuples(snd_tplg_t *tplg, snd_config_t *cfg, +@@ -890,6 +1118,29 @@ int tplg_parse_tuples(snd_tplg_t *tplg, snd_config_t *cfg, + return 0; + } + ++/* save vendor tuples */ ++int tplg_save_tuples(snd_tplg_t *tplg ATTRIBUTE_UNUSED, ++ struct tplg_elem *elem, ++ char **dst, const char *pfx) ++{ ++ char pfx2[16]; ++ int err; ++ ++ if (!elem->tuples) ++ return 0; ++ ++ err = tplg_save_printf(dst, NULL, "'%s' {\n", elem->id); ++ snprintf(pfx2, sizeof(pfx2), "%s\t", pfx ?: ""); ++ if (err >= 0) ++ err = tplg_save_refs(tplg, elem, SND_TPLG_TYPE_TOKEN, ++ "tokens", dst, pfx2); ++ if (err >= 0) ++ err = tplg_save_tuple_sets(tplg, elem, dst, pfx2); ++ if (err >= 0) ++ err = tplg_save_printf(dst, pfx, "}\n"); ++ return 0; ++} ++ + /* Free handler of tuples */ + void tplg_free_tuples(void *obj) + { +@@ -944,7 +1195,7 @@ int tplg_parse_manifest_data(snd_tplg_t *tplg, snd_config_t *cfg, + + + if (strcmp(id, "data") == 0) { +- err = tplg_parse_data_refs(n, elem); ++ err = tplg_parse_refs(n, elem, SND_TPLG_TYPE_DATA); + if (err < 0) + return err; + continue; +@@ -954,6 +1205,51 @@ int tplg_parse_manifest_data(snd_tplg_t *tplg, snd_config_t *cfg, + return 0; + } + ++/* save manifest data */ ++int tplg_save_manifest_data(snd_tplg_t *tplg ATTRIBUTE_UNUSED, ++ struct tplg_elem *elem, char **dst, ++ const char *pfx) ++{ ++ struct list_head *pos; ++ struct tplg_ref *ref; ++ int err, index, count; ++ ++ /* for each ref in this manifest elem */ ++ count = 0; ++ list_for_each(pos, &elem->ref_list) { ++ ref = list_entry(pos, struct tplg_ref, list); ++ if (ref->type != SND_TPLG_TYPE_DATA) ++ continue; ++ count++; ++ } ++ if (count > 1) { ++ err = tplg_save_printf(dst, NULL, "'%s'.data [\n", elem->id); ++ if (err < 0) ++ return err; ++ } ++ index = 0; ++ list_for_each(pos, &elem->ref_list) { ++ ref = list_entry(pos, struct tplg_ref, list); ++ if (ref->type != SND_TPLG_TYPE_DATA) ++ continue; ++ if (count == 1) { ++ err = tplg_save_printf(dst, NULL, "'%s'.data.%u '%s'\n", ++ elem->id, index, ref->id); ++ } else { ++ err = tplg_save_printf(dst, pfx, "\t'%s'\n", ref->id); ++ if (err < 0) ++ return err; ++ } ++ index++; ++ } ++ if (count > 1) { ++ err = tplg_save_printf(dst, pfx, "]\n"); ++ if (err < 0) ++ return err; ++ } ++ return 0; ++} ++ + /* merge private data of manifest */ + int tplg_build_manifest_data(snd_tplg_t *tplg) + { +@@ -1064,7 +1360,7 @@ int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg, + } + + if (strcmp(id, "tuples") == 0) { +- err = parse_tuples_refs(n, elem); ++ err = tplg_parse_refs(n, elem, SND_TPLG_TYPE_TUPLE); + if (err < 0) + return err; + continue; +@@ -1083,6 +1379,81 @@ int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg, + return err; + } + ++/* save data element */ ++int tplg_save_data(snd_tplg_t *tplg ATTRIBUTE_UNUSED, ++ struct tplg_elem *elem, ++ char **dst, const char *pfx) ++{ ++ struct snd_soc_tplg_private *priv = elem->data; ++ struct list_head *pos; ++ struct tplg_ref *ref; ++ char pfx2[16]; ++ unsigned int i, count; ++ int err; ++ ++ count = 0; ++ if (priv && priv->size > 0) ++ count++; ++ list_for_each(pos, &elem->ref_list) { ++ ref = list_entry(pos, struct tplg_ref, list); ++ if (ref->type == SND_TPLG_TYPE_TUPLE) ++ count++; ++ } ++ if (elem->vendor_type > 0) ++ count++; ++ ++ if (count > 1) { ++ err = tplg_save_printf(dst, NULL, "'%s' {\n", elem->id); ++ if (err >= 0) ++ err = tplg_save_printf(dst, NULL, ""); ++ } else { ++ err = tplg_save_printf(dst, NULL, "'%s'.", elem->id); ++ } ++ if (err >= 0 && priv && priv->size > 0) { ++ if (count > 1) { ++ err = tplg_save_printf(dst, pfx, ""); ++ if (err < 0) ++ return err; ++ } ++ if (priv->size > 8) { ++ err = tplg_save_printf(dst, NULL, "bytes\n"); ++ if (err >= 0) ++ err = tplg_save_printf(dst, pfx, "\t'"); ++ } else { ++ err = tplg_save_printf(dst, NULL, "bytes '"); ++ } ++ if (err < 0) ++ return err; ++ for (i = 0; i < priv->size; i++) { ++ if (i > 0 && (i % 8) == 0) { ++ err = tplg_save_printf(dst, NULL, ":\n"); ++ if (err < 0) ++ return err; ++ err = tplg_save_printf(dst, pfx, "\t "); ++ if (err < 0) ++ return err; ++ } ++ err = tplg_save_printf(dst, NULL, "%s%02x", ++ (i % 8) == 0 ? "" : ":", ++ (unsigned char)priv->data[i]); ++ if (err < 0) ++ return err; ++ } ++ err = tplg_save_printf(dst, NULL, "'\n"); ++ } ++ snprintf(pfx2, sizeof(pfx2), "%s\t", pfx ?: ""); ++ if (err >= 0) ++ err = tplg_save_refs(tplg, elem, SND_TPLG_TYPE_TUPLE, ++ "tuples", dst, ++ count > 1 ? pfx2 : NULL); ++ if (err >= 0 && elem->vendor_type > 0) ++ err = tplg_save_printf(dst, pfx, "type %u", ++ elem->vendor_type); ++ if (err >= 0 && count > 1) ++ err = tplg_save_printf(dst, pfx, "}\n"); ++ return err; ++} ++ + /* Find a referenced data element and copy its data to the parent + * element's private data buffer. + * An element can refer to multiple data sections. Data of these sections +diff --git a/src/topology/elem.c b/src/topology/elem.c +index e79a68b7..89aed1fc 100644 +--- a/src/topology/elem.c ++++ b/src/topology/elem.c +@@ -30,6 +30,7 @@ struct tplg_table tplg_table[] = { + .size = sizeof(struct snd_soc_tplg_manifest), + .enew = 1, + .parse = tplg_parse_manifest_data, ++ .save = tplg_save_manifest_data, + }, + { + .name = "control mixer", +@@ -41,6 +42,7 @@ struct tplg_table tplg_table[] = { + .build = 1, + .enew = 1, + .parse = tplg_parse_control_mixer, ++ .save = tplg_save_control_mixer, + }, + { + .name = "control enum", +@@ -52,6 +54,7 @@ struct tplg_table tplg_table[] = { + .build = 1, + .enew = 1, + .parse = tplg_parse_control_enum, ++ .save = tplg_save_control_enum, + }, + { + .name = "control extended (bytes)", +@@ -63,6 +66,7 @@ struct tplg_table tplg_table[] = { + .build = 1, + .enew = 1, + .parse = tplg_parse_control_bytes, ++ .save = tplg_save_control_bytes, + }, + { + .name = "dapm widget", +@@ -74,6 +78,7 @@ struct tplg_table tplg_table[] = { + .build = 1, + .enew = 1, + .parse = tplg_parse_dapm_widget, ++ .save = tplg_save_dapm_widget, + }, + { + .name = "pcm", +@@ -85,6 +90,7 @@ struct tplg_table tplg_table[] = { + .build = 1, + .enew = 1, + .parse = tplg_parse_pcm, ++ .save = tplg_save_pcm, + }, + { + .name = "physical dai", +@@ -96,6 +102,7 @@ struct tplg_table tplg_table[] = { + .build = 1, + .enew = 1, + .parse = tplg_parse_dai, ++ .save = tplg_save_dai, + }, + { + .name = "be", +@@ -108,6 +115,7 @@ struct tplg_table tplg_table[] = { + .build = 1, + .enew = 1, + .parse = tplg_parse_link, ++ .save = tplg_save_link, + }, + { + .name = "cc", +@@ -119,6 +127,7 @@ struct tplg_table tplg_table[] = { + .build = 1, + .enew = 1, + .parse = tplg_parse_cc, ++ .save = tplg_save_cc, + }, + { + .name = "route (dapm graph)", +@@ -128,6 +137,7 @@ struct tplg_table tplg_table[] = { + .tsoc = SND_SOC_TPLG_TYPE_DAPM_GRAPH, + .build = 1, + .parse = tplg_parse_dapm_graph, ++ .gsave = tplg_save_dapm_graph, + }, + { + .name = "private data", +@@ -138,6 +148,7 @@ struct tplg_table tplg_table[] = { + .build = 1, + .enew = 1, + .parse = tplg_parse_data, ++ .save = tplg_save_data, + }, + { + .name = "text", +@@ -147,6 +158,7 @@ struct tplg_table tplg_table[] = { + .size = sizeof(struct tplg_texts), + .enew = 1, + .parse = tplg_parse_text, ++ .save = tplg_save_text, + }, + { + .name = "tlv", +@@ -156,6 +168,7 @@ struct tplg_table tplg_table[] = { + .size = sizeof(struct snd_soc_tplg_ctl_tlv), + .enew = 1, + .parse = tplg_parse_tlv, ++ .save = tplg_save_tlv, + }, + { + .name = "stream config", +@@ -172,6 +185,7 @@ struct tplg_table tplg_table[] = { + .size = sizeof(struct snd_soc_tplg_stream_caps), + .enew = 1, + .parse = tplg_parse_stream_caps, ++ .save = tplg_save_stream_caps, + }, + { + .name = "token", +@@ -180,6 +194,7 @@ struct tplg_table tplg_table[] = { + .type = SND_TPLG_TYPE_TOKEN, + .enew = 1, + .parse = tplg_parse_tokens, ++ .save = tplg_save_tokens, + }, + { + .name = "tuple", +@@ -189,6 +204,7 @@ struct tplg_table tplg_table[] = { + .free = tplg_free_tuples, + .enew = 1, + .parse = tplg_parse_tuples, ++ .save = tplg_save_tuples, + }, + { + .name = "hw config", +@@ -198,6 +214,7 @@ struct tplg_table tplg_table[] = { + .size = sizeof(struct snd_soc_tplg_hw_config), + .enew = 1, + .parse = tplg_parse_hw_config, ++ .save = tplg_save_hw_config, + } + }; + +@@ -394,6 +411,7 @@ struct tplg_elem* tplg_elem_new_common(snd_tplg_t *tplg, + tplg_elem_insert(elem, list); + obj_size = tptr->size; + elem->free = tptr->free; ++ elem->table = tptr; + + /* create new object too if required */ + if (obj_size > 0) { +diff --git a/src/topology/ops.c b/src/topology/ops.c +index 073acdcb..ad72ef1b 100644 +--- a/src/topology/ops.c ++++ b/src/topology/ops.c +@@ -45,6 +45,18 @@ static int lookup_ops(const char *c) + return strtol(c, NULL, 0); + } + ++const char *tplg_ops_name(int type) ++{ ++ unsigned int i; ++ ++ for (i = 0; i < ARRAY_SIZE(control_map); i++) { ++ if (control_map[i].id == type) ++ return control_map[i].name; ++ } ++ ++ return NULL; ++} ++ + /* Parse Control operations. Ops can come from standard names above or + * bespoke driver controls with numbers >= 256 + */ +@@ -84,6 +96,46 @@ int tplg_parse_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, snd_config_t *cfg, + return 0; + } + ++/* save control operations */ ++int tplg_save_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, ++ struct snd_soc_tplg_ctl_hdr *hdr, char **dst, ++ const char *pfx) ++{ ++ const char *s; ++ int err; ++ ++ if (hdr->ops.info + hdr->ops.get + hdr->ops.put == 0) ++ return 0; ++ err = tplg_save_printf(dst, pfx, "ops.0 {\n"); ++ if (err >= 0 && hdr->ops.info > 0) { ++ s = tplg_ops_name(hdr->ops.info); ++ if (s == NULL) ++ err = tplg_save_printf(dst, pfx, "\tinfo %u\n", ++ hdr->ops.info); ++ else ++ err = tplg_save_printf(dst, pfx, "\tinfo %s\n", s); ++ } ++ if (err >= 0 && hdr->ops.get > 0) { ++ s = tplg_ops_name(hdr->ops.get); ++ if (s == NULL) ++ err = tplg_save_printf(dst, pfx, "\tget %u\n", ++ hdr->ops.get); ++ else ++ err = tplg_save_printf(dst, pfx, "\tget %s\n", s); ++ } ++ if (err >= 0 && hdr->ops.put > 0) { ++ s = tplg_ops_name(hdr->ops.put); ++ if (s == NULL) ++ err = tplg_save_printf(dst, pfx, "\tput %u\n", ++ hdr->ops.put); ++ else ++ err = tplg_save_printf(dst, pfx, "\tput %s\n", s); ++ } ++ if (err >= 0) ++ err = tplg_save_printf(dst, pfx, "}\n"); ++ return err; ++} ++ + /* Parse External Control operations. Ops can come from standard names above or + * bespoke driver controls with numbers >= 256 + */ +@@ -121,3 +173,43 @@ int tplg_parse_ext_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, + + return 0; + } ++ ++/* save external control operations */ ++int tplg_save_ext_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, ++ struct snd_soc_tplg_bytes_control *be, ++ char **dst, const char *pfx) ++{ ++ const char *s; ++ int err; ++ ++ if (be->ext_ops.info + be->ext_ops.get + be->ext_ops.put == 0) ++ return 0; ++ err = tplg_save_printf(dst, pfx, "extops.0 {\n"); ++ if (err >= 0 && be->ext_ops.info > 0) { ++ s = tplg_ops_name(be->ext_ops.info); ++ if (s == NULL) ++ err = tplg_save_printf(dst, pfx, "\tinfo %u\n", ++ be->ext_ops.info); ++ else ++ err = tplg_save_printf(dst, pfx, "\tinfo %s\n", s); ++ } ++ if (err >= 0 && be->ext_ops.get > 0) { ++ s = tplg_ops_name(be->ext_ops.get); ++ if (s == NULL) ++ err = tplg_save_printf(dst, pfx, "\tget %u\n", ++ be->ext_ops.get); ++ else ++ err = tplg_save_printf(dst, pfx, "\tget %s\n", s); ++ } ++ if (err >= 0 && be->ext_ops.put > 0) { ++ s = tplg_ops_name(be->ext_ops.put); ++ if (s == NULL) ++ err = tplg_save_printf(dst, pfx, "\tput %u\n", ++ be->ext_ops.put); ++ else ++ err = tplg_save_printf(dst, pfx, "\tput %s\n", s); ++ } ++ if (err >= 0) ++ err = tplg_save_printf(dst, pfx, "}\n"); ++ return err; ++} +diff --git a/src/topology/parser.c b/src/topology/parser.c +index 11202769..de5edd1b 100644 +--- a/src/topology/parser.c ++++ b/src/topology/parser.c +@@ -71,6 +71,8 @@ int tplg_get_unsigned(snd_config_t *n, unsigned *val, int base) + err = snd_config_get_integer(n, &lval); + if (err < 0) + return err; ++ if (lval < 0 && lval >= INT_MIN) ++ lval = UINT_MAX + lval + 1; + if (lval < 0 || lval > UINT_MAX) + return -ERANGE; + *val = lval; +@@ -79,6 +81,8 @@ int tplg_get_unsigned(snd_config_t *n, unsigned *val, int base) + err = snd_config_get_integer64(n, &llval); + if (err < 0) + return err; ++ if (llval < 0 && llval >= INT_MIN) ++ llval = UINT_MAX + llval + 1; + if (llval < 0 || llval > UINT_MAX) + return -ERANGE; + *val = llval; +diff --git a/src/topology/pcm.c b/src/topology/pcm.c +index 9b87549c..d09fbe42 100644 +--- a/src/topology/pcm.c ++++ b/src/topology/pcm.c +@@ -345,6 +345,13 @@ static int get_rate_value(const char* name) + return SND_PCM_RATE_UNKNOWN; + } + ++static const char *get_rate_name(int rate) ++{ ++ if (rate >= 0 && rate <= SND_PCM_RATE_LAST) ++ return snd_pcm_rate_names[rate]; ++ return NULL; ++} ++ + static int split_rate(struct snd_soc_tplg_stream_caps *caps, char *str) + { + char *s = NULL; +@@ -527,6 +534,80 @@ int tplg_parse_stream_caps(snd_tplg_t *tplg, + return 0; + } + ++/* save stream caps */ ++int tplg_save_stream_caps(snd_tplg_t *tplg ATTRIBUTE_UNUSED, ++ struct tplg_elem *elem, ++ char **dst, const char *pfx) ++{ ++ struct snd_soc_tplg_stream_caps *sc = elem->stream_caps; ++ const char *s; ++ unsigned int i; ++ int err, first; ++ ++ err = tplg_save_printf(dst, NULL, "'%s' {\n", elem->id); ++ if (err >= 0 && sc->formats) { ++ err = tplg_save_printf(dst, pfx, "\tformats '"); ++ first = 1; ++ for (i = 0; err >= 0 && i < SND_PCM_FORMAT_LAST; i++) { ++ if (sc->formats & (1ULL << i)) { ++ s = snd_pcm_format_name(i); ++ err = tplg_save_printf(dst, NULL, "%s%s", ++ !first ? ", " : "", s); ++ first = 0; ++ } ++ } ++ if (err >= 0) ++ err = tplg_save_printf(dst, NULL, "'\n"); ++ } ++ if (err >= 0 && sc->rates) { ++ err = tplg_save_printf(dst, pfx, "\trates '"); ++ first = 1; ++ for (i = 0; err >= 0 && i < SND_PCM_RATE_LAST; i++) { ++ if (sc->rates & (1ULL << i)) { ++ s = get_rate_name(i); ++ err = tplg_save_printf(dst, NULL, "%s%s", ++ !first ? ", " : "", s); ++ first = 0; ++ } ++ } ++ if (err >= 0) ++ err = tplg_save_printf(dst, NULL, "'\n"); ++ } ++ if (err >= 0 && sc->rate_min) ++ err = tplg_save_printf(dst, pfx, "\trate_min %u\n", ++ sc->rate_min); ++ if (err >= 0 && sc->rate_max) ++ err = tplg_save_printf(dst, pfx, "\trate_max %u\n", ++ sc->rate_max); ++ if (err >= 0 && sc->channels_min) ++ err = tplg_save_printf(dst, pfx, "\tchannels_min %u\n", ++ sc->channels_min); ++ if (err >= 0 && sc->channels_max) ++ err = tplg_save_printf(dst, pfx, "\tchannels_max %u\n", ++ sc->channels_max); ++ if (err >= 0 && sc->periods_min) ++ err = tplg_save_printf(dst, pfx, "\tperiods_min %u\n", ++ sc->periods_min); ++ if (err >= 0 && sc->periods_max) ++ err = tplg_save_printf(dst, pfx, "\tperiods_max %u\n", ++ sc->periods_max); ++ if (err >= 0 && sc->period_size_min) ++ err = tplg_save_printf(dst, pfx, "\tperiod_size_min %u\n", ++ sc->period_size_min); ++ if (err >= 0 && sc->period_size_max) ++ err = tplg_save_printf(dst, pfx, "\tperiod_size_max %u\n", ++ sc->period_size_max); ++ if (err >= 0 && sc->buffer_size_min) ++ err = tplg_save_printf(dst, pfx, "\tbuffer_size_min %u\n", ++ sc->buffer_size_min); ++ if (err >= 0 && sc->buffer_size_max) ++ err = tplg_save_printf(dst, pfx, "\tbuffer_size_max %u\n", ++ sc->buffer_size_max); ++ if (err >= 0) ++ err = tplg_save_printf(dst, pfx, "}\n"); ++ return err; ++} ++ + /* Parse the caps and config of a pcm stream */ + static int tplg_parse_streams(snd_tplg_t *tplg ATTRIBUTE_UNUSED, + snd_config_t *cfg, void *private) +@@ -598,6 +679,61 @@ static int tplg_parse_streams(snd_tplg_t *tplg ATTRIBUTE_UNUSED, + return 0; + } + ++/* Save the caps and config of a pcm stream */ ++int tplg_save_streams(snd_tplg_t *tplg ATTRIBUTE_UNUSED, ++ struct tplg_elem *elem, ++ char **dst, const char *pfx) ++{ ++ static const char *stream_ids[2] = { ++ "playback", ++ "capture" ++ }; ++ static unsigned int stream_types[2] = { ++ SND_SOC_TPLG_STREAM_PLAYBACK, ++ SND_SOC_TPLG_STREAM_CAPTURE ++ }; ++ struct snd_soc_tplg_stream_caps *caps; ++ unsigned int streams[2], stream; ++ const char *s; ++ int err; ++ ++ switch (elem->type) { ++ case SND_TPLG_TYPE_PCM: ++ streams[0] = elem->pcm->playback; ++ streams[1] = elem->pcm->capture; ++ caps = elem->pcm->caps; ++ break; ++ case SND_TPLG_TYPE_DAI: ++ streams[0] = elem->dai->playback; ++ streams[1] = elem->dai->capture; ++ caps = elem->dai->caps; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ for (stream = 0; stream < 2; stream++) { ++ if (streams[stream] == 0) ++ continue; ++ if (!caps) ++ continue; ++ s = caps[stream_types[stream]].name; ++ if (s[0] == '\0') ++ continue; ++ err = tplg_save_printf(dst, pfx, "pcm.%s {\n", stream_ids[stream]); ++ if (err < 0) ++ return err; ++ err = tplg_save_printf(dst, pfx, "\tcapabilities '%s'\n", s); ++ if (err < 0) ++ return err; ++ err = tplg_save_printf(dst, pfx, "}\n"); ++ if (err < 0) ++ return err; ++ } ++ ++ return 0; ++} ++ + /* Parse name and id of a front-end DAI (ie. cpu dai of a FE DAI link) */ + static int tplg_parse_fe_dai(snd_tplg_t *tplg ATTRIBUTE_UNUSED, + snd_config_t *cfg, void *private) +@@ -633,6 +769,19 @@ static int tplg_parse_fe_dai(snd_tplg_t *tplg ATTRIBUTE_UNUSED, + return 0; + } + ++/* Save the caps and config of a pcm stream */ ++int tplg_save_fe_dai(snd_tplg_t *tplg ATTRIBUTE_UNUSED, ++ struct tplg_elem *elem, ++ char **dst, const char *pfx) ++{ ++ struct snd_soc_tplg_pcm *pcm = elem->pcm; ++ int err = 0; ++ ++ if (pcm->dai_id > 0) ++ err = tplg_save_printf(dst, pfx, "dai.0.id %u\n", pcm->dai_id); ++ return err; ++} ++ + /* parse a flag bit of the given mask */ + static int parse_flag(snd_config_t *n, unsigned int mask_in, + unsigned int *mask, unsigned int *flags) +@@ -652,6 +801,32 @@ static int parse_flag(snd_config_t *n, unsigned int mask_in, + return 0; + } + ++static int save_flags(unsigned int flags, unsigned int mask, ++ char **dst, const char *pfx) ++{ ++ static unsigned int flag_masks[3] = { ++ SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_RATES, ++ SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_CHANNELS, ++ SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS, ++ }; ++ static const char *flag_ids[3] = { ++ "symmetric_rates", ++ "symmetric_channels", ++ "symmetric_sample_bits", ++ }; ++ unsigned int i; ++ int err = 0; ++ ++ for (i = 0; err >= 0 && i < ARRAY_SIZE(flag_masks); i++) { ++ if (mask & flag_masks[i]) { ++ unsigned int v = (flags & flag_masks[i]) ? 1 : 0; ++ err = tplg_save_printf(dst, pfx, "%s %u\n", ++ flag_ids[i], v); ++ } ++ } ++ return err; ++} ++ + /* Parse PCM (for front end DAI & DAI link) in text conf file */ + int tplg_parse_pcm(snd_tplg_t *tplg, snd_config_t *cfg, + void *private ATTRIBUTE_UNUSED) +@@ -748,7 +923,7 @@ int tplg_parse_pcm(snd_tplg_t *tplg, snd_config_t *cfg, + + /* private data */ + if (strcmp(id, "data") == 0) { +- err = tplg_parse_data_refs(n, elem); ++ err = tplg_parse_refs(n, elem, SND_TPLG_TYPE_DATA); + if (err < 0) + return err; + continue; +@@ -758,6 +933,40 @@ int tplg_parse_pcm(snd_tplg_t *tplg, snd_config_t *cfg, + return 0; + } + ++/* save PCM */ ++int tplg_save_pcm(snd_tplg_t *tplg ATTRIBUTE_UNUSED, ++ struct tplg_elem *elem, ++ char **dst, const char *pfx) ++{ ++ struct snd_soc_tplg_pcm *pcm = elem->pcm; ++ char pfx2[16]; ++ int err; ++ ++ snprintf(pfx2, sizeof(pfx2), "%s\t", pfx ?: ""); ++ err = tplg_save_printf(dst, NULL, "'%s' {\n", elem->id); ++ if (err >= 0 && elem->index) ++ err = tplg_save_printf(dst, pfx, "\tindex %u\n", ++ elem->index); ++ if (err >= 0 && pcm->pcm_id) ++ err = tplg_save_printf(dst, pfx, "\tid %u\n", ++ pcm->pcm_id); ++ if (err >= 0 && pcm->compress) ++ err = tplg_save_printf(dst, pfx, "\tcompress 1\n"); ++ snprintf(pfx2, sizeof(pfx2), "%s\t", pfx ?: ""); ++ if (err >= 0) ++ err = tplg_save_fe_dai(tplg, elem, dst, pfx2); ++ if (err >= 0) ++ err = tplg_save_streams(tplg, elem, dst, pfx2); ++ if (err >= 0) ++ err = save_flags(pcm->flags, pcm->flag_mask, dst, pfx); ++ if (err >= 0) ++ err = tplg_save_refs(tplg, elem, SND_TPLG_TYPE_DATA, ++ "data", dst, pfx2); ++ if (err >= 0) ++ err = tplg_save_printf(dst, pfx, "}\n"); ++ return err; ++} ++ + /* Parse physical DAI */ + int tplg_parse_dai(snd_tplg_t *tplg, snd_config_t *cfg, + void *private ATTRIBUTE_UNUSED) +@@ -766,7 +975,7 @@ int tplg_parse_dai(snd_tplg_t *tplg, snd_config_t *cfg, + struct tplg_elem *elem; + snd_config_iterator_t i, next; + snd_config_t *n; +- const char *id, *val = NULL; ++ const char *id; + int err; + + elem = tplg_elem_new_common(tplg, cfg, NULL, SND_TPLG_TYPE_DAI); +@@ -851,11 +1060,9 @@ int tplg_parse_dai(snd_tplg_t *tplg, snd_config_t *cfg, + + /* private data */ + if (strcmp(id, "data") == 0) { +- if (snd_config_get_string(n, &val) < 0) +- return -EINVAL; +- +- tplg_ref_add(elem, SND_TPLG_TYPE_DATA, val); +- tplg_dbg("\t%s: %s\n", id, val); ++ err = tplg_parse_refs(n, elem, SND_TPLG_TYPE_DATA); ++ if (err < 0) ++ return err; + continue; + } + } +@@ -863,55 +1070,55 @@ int tplg_parse_dai(snd_tplg_t *tplg, snd_config_t *cfg, + return 0; + } + ++/* save DAI */ ++int tplg_save_dai(snd_tplg_t *tplg ATTRIBUTE_UNUSED, ++ struct tplg_elem *elem, ++ char **dst, const char *pfx) ++{ ++ struct snd_soc_tplg_dai *dai = elem->dai; ++ char pfx2[16]; ++ int err; ++ ++ if (!dai) ++ return 0; ++ snprintf(pfx2, sizeof(pfx2), "%s\t", pfx ?: ""); ++ err = tplg_save_printf(dst, NULL, "'%s' {\n", elem->id); ++ if (err >= 0 && elem->index) ++ err = tplg_save_printf(dst, pfx, "\tindex %u\n", ++ elem->index); ++ if (err >= 0 && dai->dai_id) ++ err = tplg_save_printf(dst, pfx, "\tid %u\n", ++ dai->dai_id); ++ if (err >= 0 && dai->playback) ++ err = tplg_save_printf(dst, pfx, "\tplayback %u\n", ++ dai->playback); ++ if (err >= 0 && dai->capture) ++ err = tplg_save_printf(dst, pfx, "\tcapture %u\n", ++ dai->capture); ++ if (err >= 0) ++ err = tplg_save_streams(tplg, elem, dst, pfx2); ++ if (err >= 0) ++ err = save_flags(dai->flags, dai->flag_mask, dst, pfx); ++ if (err >= 0) ++ err = tplg_save_refs(tplg, elem, SND_TPLG_TYPE_DATA, ++ "data", dst, pfx2); ++ if (err >= 0) ++ err = tplg_save_printf(dst, pfx, "}\n"); ++ return err; ++} ++ + /* parse physical link runtime supported HW configs in text conf file */ + static int parse_hw_config_refs(snd_tplg_t *tplg ATTRIBUTE_UNUSED, + snd_config_t *cfg, + struct tplg_elem *elem) + { + struct snd_soc_tplg_link_config *link = elem->link; +- snd_config_type_t type; +- snd_config_iterator_t i, next; +- snd_config_t *n; +- const char *id, *val = NULL; +- +- if (snd_config_get_id(cfg, &id) < 0) +- return -EINVAL; +- type = snd_config_get_type(cfg); +- +- /* refer to a single HW config */ +- if (type == SND_CONFIG_TYPE_STRING) { +- if (snd_config_get_string(cfg, &val) < 0) +- return -EINVAL; +- +- link->num_hw_configs = 1; +- return tplg_ref_add(elem, SND_TPLG_TYPE_HW_CONFIG, val); +- } +- +- if (type != SND_CONFIG_TYPE_COMPOUND) { +- SNDERR("error: compound type expected for %s", id); +- return -EINVAL; +- } +- +- /* refer to a list of HW configs */ +- snd_config_for_each(i, next, cfg) { +- const char *val; +- int err; +- +- n = snd_config_iterator_entry(i); +- if (snd_config_get_string(n, &val) < 0) +- continue; +- +- if (link->num_hw_configs >= SND_SOC_TPLG_HW_CONFIG_MAX) { +- SNDERR("error: exceed max hw configs for link %s", id); +- return -EINVAL; +- } +- +- link->num_hw_configs++; +- err = tplg_ref_add(elem, SND_TPLG_TYPE_HW_CONFIG, val); +- if (err < 0) +- return err; +- } ++ int err; + ++ err = tplg_parse_refs(cfg, elem, SND_TPLG_TYPE_HW_CONFIG); ++ if (err < 0) ++ return err; ++ link->num_hw_configs = err; + return 0; + } + +@@ -1007,7 +1214,7 @@ int tplg_parse_link(snd_tplg_t *tplg, + + /* private data */ + if (strcmp(id, "data") == 0) { +- err = tplg_parse_data_refs(n, elem); ++ err = tplg_parse_refs(n, elem, SND_TPLG_TYPE_DATA); + if (err < 0) + return err; + continue; +@@ -1017,6 +1224,44 @@ int tplg_parse_link(snd_tplg_t *tplg, + return 0; + } + ++/* save physical link */ ++int tplg_save_link(snd_tplg_t *tplg ATTRIBUTE_UNUSED, ++ struct tplg_elem *elem, ++ char **dst, const char *pfx) ++{ ++ struct snd_soc_tplg_link_config *link = elem->link; ++ char pfx2[16]; ++ int err; ++ ++ if (!link) ++ return 0; ++ snprintf(pfx2, sizeof(pfx2), "%s\t", pfx ?: ""); ++ err = tplg_save_printf(dst, NULL, "'%s' {\n", elem->id); ++ if (err >= 0 && elem->index) ++ err = tplg_save_printf(dst, pfx, "\tindex %u\n", ++ elem->index); ++ if (err >= 0 && link->id) ++ err = tplg_save_printf(dst, pfx, "\tid %u\n", ++ link->id); ++ if (err >= 0 && link->stream_name[0]) ++ err = tplg_save_printf(dst, pfx, "\tstream_name '%s'\n", ++ link->stream_name); ++ if (err >= 0 && link->default_hw_config_id) ++ err = tplg_save_printf(dst, pfx, "\tdefault_hw_conf_id %u\n", ++ link->default_hw_config_id); ++ if (err >= 0) ++ err = save_flags(link->flags, link->flag_mask, dst, pfx); ++ if (err >= 0) ++ err = tplg_save_refs(tplg, elem, SND_TPLG_TYPE_HW_CONFIG, ++ "hw_configs", dst, pfx2); ++ if (err >= 0) ++ err = tplg_save_refs(tplg, elem, SND_TPLG_TYPE_DATA, ++ "data", dst, pfx2); ++ if (err >= 0) ++ err = tplg_save_printf(dst, pfx, "}\n"); ++ return err; ++} ++ + /* Parse cc */ + int tplg_parse_cc(snd_tplg_t *tplg, + snd_config_t *cfg, void *private ATTRIBUTE_UNUSED) +@@ -1059,36 +1304,95 @@ int tplg_parse_cc(snd_tplg_t *tplg, + return 0; + } + +-static int get_audio_hw_format(const char *val) ++/* save CC */ ++int tplg_save_cc(snd_tplg_t *tplg ATTRIBUTE_UNUSED, ++ struct tplg_elem *elem, ++ char **dst, const char *pfx) + { +- if (!strlen(val)) +- return -EINVAL; +- +- if (!strcmp(val, "I2S")) +- return SND_SOC_DAI_FORMAT_I2S; ++ struct snd_soc_tplg_link_config *link = elem->link; ++ char pfx2[16]; ++ int err; + +- if (!strcmp(val, "RIGHT_J")) +- return SND_SOC_DAI_FORMAT_RIGHT_J; ++ if (!link) ++ return 0; ++ snprintf(pfx2, sizeof(pfx2), "%s\t", pfx ?: ""); ++ err = tplg_save_printf(dst, NULL, "'%s' {\n", elem->id); ++ if (err >= 0 && elem->index) ++ err = tplg_save_printf(dst, pfx, "\tindex %u\n", ++ elem->index); ++ if (err >= 0 && link->id) ++ err = tplg_save_printf(dst, pfx, "\tid %u\n", ++ link->id); ++ if (err >= 0) ++ err = tplg_save_printf(dst, pfx, "}\n"); ++ return err; ++} + +- if (!strcmp(val, "LEFT_J")) +- return SND_SOC_DAI_FORMAT_LEFT_J; ++struct audio_hw_format { ++ unsigned int type; ++ const char *name; ++}; + +- if (!strcmp(val, "DSP_A")) +- return SND_SOC_DAI_FORMAT_DSP_A; ++static struct audio_hw_format audio_hw_formats[] = { ++ { ++ .type = SND_SOC_DAI_FORMAT_I2S, ++ .name = "I2S", ++ }, ++ { ++ .type = SND_SOC_DAI_FORMAT_RIGHT_J, ++ .name = "RIGHT_J", ++ }, ++ { ++ .type = SND_SOC_DAI_FORMAT_LEFT_J, ++ .name = "LEFT_J", ++ }, ++ { ++ .type = SND_SOC_DAI_FORMAT_DSP_A, ++ .name = "DSP_A", ++ }, ++ { ++ .type = SND_SOC_DAI_FORMAT_DSP_B, ++ .name = "DSP_B", ++ }, ++ { ++ .type = SND_SOC_DAI_FORMAT_AC97, ++ .name = "AC97", ++ }, ++ { ++ .type = SND_SOC_DAI_FORMAT_AC97, ++ .name = "AC97", ++ }, ++ { ++ .type = SND_SOC_DAI_FORMAT_PDM, ++ .name = "PDM", ++ }, ++}; + +- if (!strcmp(val, "DSP_B")) +- return SND_SOC_DAI_FORMAT_DSP_B; ++static int get_audio_hw_format(const char *val) ++{ ++ unsigned int i; + +- if (!strcmp(val, "AC97")) +- return SND_SOC_DAI_FORMAT_AC97; ++ if (val[0] == '\0') ++ return -EINVAL; + +- if (!strcmp(val, "PDM")) +- return SND_SOC_DAI_FORMAT_PDM; ++ for (i = 0; i < ARRAY_SIZE(audio_hw_formats); i++) ++ if (strcasecmp(audio_hw_formats[i].name, val) == 0) ++ return audio_hw_formats[i].type; + + SNDERR("error: invalid audio HW format %s\n", val); + return -EINVAL; + } + ++static const char *get_audio_hw_format_name(unsigned int type) ++{ ++ unsigned int i; ++ ++ for (i = 0; i < ARRAY_SIZE(audio_hw_formats); i++) ++ if (audio_hw_formats[i].type == type) ++ return audio_hw_formats[i].name; ++ return NULL; ++} ++ + int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, + void *private ATTRIBUTE_UNUSED) + { +@@ -1299,6 +1603,71 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, + return 0; + } + ++/* save hw config */ ++int tplg_save_hw_config(snd_tplg_t *tplg ATTRIBUTE_UNUSED, ++ struct tplg_elem *elem, ++ char **dst, const char *pfx) ++{ ++ struct snd_soc_tplg_hw_config *hc = elem->hw_cfg; ++ int err; ++ ++ err = tplg_save_printf(dst, NULL, "'%s' {\n", elem->id); ++ if (err >= 0 && hc->id) ++ err = tplg_save_printf(dst, pfx, "\tid %u\n", ++ hc->id); ++ if (err >= 0 && hc->fmt) ++ err = tplg_save_printf(dst, pfx, "\tformat '%s'\n", ++ get_audio_hw_format_name(hc->fmt)); ++ if (err >= 0 && hc->bclk_master) ++ err = tplg_save_printf(dst, pfx, "\tbclk '%s'\n", ++ hc->bclk_master == SND_SOC_TPLG_BCLK_CS ? ++ "codec_slave" : "codec_master"); ++ if (err >= 0 && hc->bclk_rate) ++ err = tplg_save_printf(dst, pfx, "\tbclk_freq %u\n", ++ hc->bclk_rate); ++ if (err >= 0 && hc->invert_bclk) ++ err = tplg_save_printf(dst, pfx, "\tbclk_invert 1\n"); ++ if (err >= 0 && hc->fsync_master) ++ err = tplg_save_printf(dst, pfx, "\tfsync_master '%s'\n", ++ hc->fsync_master == SND_SOC_TPLG_FSYNC_CS ? ++ "codec_slave" : "codec_master"); ++ if (err >= 0 && hc->fsync_rate) ++ err = tplg_save_printf(dst, pfx, "\tfsync_freq %u\n", ++ hc->fsync_rate); ++ if (err >= 0 && hc->invert_fsync) ++ err = tplg_save_printf(dst, pfx, "\tfsync_invert 1\n"); ++ if (err >= 0 && hc->mclk_rate) ++ err = tplg_save_printf(dst, pfx, "\tmclk_freq %u\n", ++ hc->mclk_rate); ++ if (err >= 0 && hc->mclk_direction) ++ err = tplg_save_printf(dst, pfx, "\tmclk '%s'\n", ++ hc->mclk_direction == SND_SOC_TPLG_MCLK_CI ? ++ "codec_mclk_in" : "codec_mclk_out"); ++ if (err >= 0 && hc->clock_gated) ++ err = tplg_save_printf(dst, pfx, "\tpm_gate_clocks 1\n"); ++ if (err >= 0 && hc->tdm_slots) ++ err = tplg_save_printf(dst, pfx, "\ttdm_slots %u\n", ++ hc->tdm_slots); ++ if (err >= 0 && hc->tdm_slot_width) ++ err = tplg_save_printf(dst, pfx, "\ttdm_slot_width %u\n", ++ hc->tdm_slot_width); ++ if (err >= 0 && hc->tx_slots) ++ err = tplg_save_printf(dst, pfx, "\ttx_slots %u\n", ++ hc->tx_slots); ++ if (err >= 0 && hc->rx_slots) ++ err = tplg_save_printf(dst, pfx, "\trx_slots %u\n", ++ hc->rx_slots); ++ if (err >= 0 && hc->tx_channels) ++ err = tplg_save_printf(dst, pfx, "\ttx_channels %u\n", ++ hc->tx_channels); ++ if (err >= 0 && hc->rx_channels) ++ err = tplg_save_printf(dst, pfx, "\trx_channels %u\n", ++ hc->rx_channels); ++ if (err >= 0) ++ err = tplg_save_printf(dst, pfx, "}\n"); ++ return err; ++} ++ + /* copy stream object */ + static void tplg_add_stream_object(struct snd_soc_tplg_stream *strm, + struct snd_tplg_stream_template *strm_tpl) +diff --git a/src/topology/save.c b/src/topology/save.c +new file mode 100644 +index 00000000..0498911f +--- /dev/null ++++ b/src/topology/save.c +@@ -0,0 +1,632 @@ ++/* ++ Copyright(c) 2019 Red Hat Inc. ++ All rights reserved. ++ ++ This library is free software; you can redistribute it and/or modify ++ it under the terms of the GNU Lesser General Public License as ++ published by the Free Software Foundation; either version 2.1 of ++ the License, or (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU Lesser General Public License for more details. ++ ++ Authors: Jaroslav Kysela ++*/ ++ ++#include "list.h" ++#include "tplg_local.h" ++ ++#define SAVE_ALLOC_SHIFT (13) /* 8192 bytes */ ++ ++int tplg_save_printf(char **dst, const char *pfx, const char *fmt, ...) ++{ ++ va_list va; ++ char buf[1024], *s; ++ size_t n, l, t, pl; ++ ++ if (pfx == NULL) ++ pfx = ""; ++ ++ va_start(va, fmt); ++ n = vsnprintf(buf, sizeof(buf), fmt, va); ++ va_end(va); ++ ++ if (n >= sizeof(buf)) ++ return -EOVERFLOW; ++ ++ pl = strlen(pfx); ++ l = *dst ? strlen(*dst) : 0; ++ t = l + pl + n + 1; ++ /* allocate chunks */ ++ if (*dst == NULL || ++ (l >> SAVE_ALLOC_SHIFT) != (t >> SAVE_ALLOC_SHIFT)) { ++ s = realloc(*dst, ((t >> SAVE_ALLOC_SHIFT) + 1) << ++ SAVE_ALLOC_SHIFT); ++ if (s == NULL) { ++ free(*dst); ++ *dst = NULL; ++ return -ENOMEM; ++ } ++ } else { ++ s = *dst; ++ } ++ ++ if (pl > 0) ++ strcpy(s + l, pfx); ++ strcpy(s + l + pl, buf); ++ *dst = s; ++ return 0; ++} ++ ++int tplg_nice_value_format(char *dst, size_t dst_size, unsigned int value) ++{ ++ if ((value % 1000) != 0) { ++ if (value > 0xfffffff0) ++ return snprintf(dst, dst_size, "%d", (int)value); ++ if (value >= 0xffff0000) ++ return snprintf(dst, dst_size, "0x%x", value); ++ } ++ return snprintf(dst, dst_size, "%u", value); ++} ++ ++static int tplg_pprint_integer(snd_config_t *n, char **ret) ++{ ++ long lval; ++ int err, type; ++ char buf[16]; ++ ++ type = snd_config_get_type(n); ++ if (type == SND_CONFIG_TYPE_INTEGER) { ++ err = snd_config_get_integer(n, &lval); ++ if (err < 0) ++ return err; ++ if (lval < INT_MIN || lval > UINT_MAX) ++ return snd_config_get_ascii(n, ret); ++ } else if (type == SND_CONFIG_TYPE_INTEGER64) { ++ long long llval; ++ err = snd_config_get_integer64(n, &llval); ++ if (err < 0) ++ return err; ++ if (llval < INT_MIN || llval > UINT_MAX) ++ return snd_config_get_ascii(n, ret); ++ lval = llval; ++ } ++ err = tplg_nice_value_format(buf, sizeof(buf), (unsigned int)lval); ++ if (err < 0) ++ return err; ++ *ret = strdup(buf); ++ if (*ret == NULL) ++ return -ENOMEM; ++ return 0; ++} ++ ++static int tplg_check_array_item(const char *id, int index) ++{ ++ const char *p; ++ long int val; ++ ++ for (p = id; *p; p++) { ++ if (*p < '0' || *p > '9') ++ return 0; ++ } ++ ++ errno = 0; ++ val = strtol(id, NULL, 10); ++ return errno == 0 && val == index; ++} ++ ++static int _compar(const void *a, const void *b) ++{ ++ const snd_config_t *c1 = *(snd_config_t **)a; ++ const snd_config_t *c2 = *(snd_config_t **)b; ++ const char *id1, *id2; ++ if (snd_config_get_id(c1, &id1)) return 0; ++ if (snd_config_get_id(c2, &id2)) return 0; ++ return strcmp(id1, id2); ++} ++ ++static snd_config_t *sort_config(const char *id, snd_config_t *src) ++{ ++ snd_config_t *dst, **a; ++ snd_config_iterator_t i, next; ++ int index, array, count; ++ ++ if (snd_config_get_type(src) != SND_CONFIG_TYPE_COMPOUND) { ++ ++ if (snd_config_copy(&dst, src) >= 0) ++ return dst; ++ return NULL; ++ } ++ count = 0; ++ snd_config_for_each(i, next, src) ++ count++; ++ a = malloc(sizeof(dst) * count); ++ if (a == NULL) ++ return NULL; ++ index = array = 0; ++ snd_config_for_each(i, next, src) { ++ snd_config_t *s = snd_config_iterator_entry(i); ++ const char *id2; ++ a[index++] = s; ++ if (array < 0) ++ continue; ++ if (snd_config_get_id(s, &id2)) { ++ free(a); ++ return NULL; ++ } ++ if (array >= 0 && tplg_check_array_item(id2, array)) ++ array++; ++ else ++ array = -1; ++ } ++ if (array < 0) ++ qsort(a, count, sizeof(a[0]), _compar); ++ if (snd_config_make_compound(&dst, id, count == 1)) { ++ free(a); ++ return NULL; ++ } ++ for (index = 0; index < count; index++) { ++ snd_config_t *s = a[index]; ++ const char *id2; ++ if (snd_config_get_id(s, &id2)) { ++ snd_config_delete(dst); ++ free(a); ++ return NULL; ++ } ++ s = sort_config(id2, s); ++ if (s == NULL || snd_config_add(dst, s)) { ++ if (s) ++ snd_config_delete(s); ++ snd_config_delete(dst); ++ free(a); ++ return NULL; ++ } ++ } ++ free(a); ++ return dst; ++} ++ ++static int tplg_check_quoted(const unsigned char *p) ++{ ++ for ( ; *p != '\0'; p++) { ++ switch (*p) { ++ case ' ': ++ case '=': ++ case ';': ++ case ',': ++ case '.': ++ case '{': ++ case '}': ++ case '\'': ++ case '"': ++ return 1; ++ default: ++ if (*p <= 31 || *p >= 127) ++ return 1; ++ ++ } ++ } ++ return 0; ++} ++ ++static int tplg_save_quoted(char **dst, const char *str) ++{ ++ static const char nibble[16] = "0123456789abcdef"; ++ unsigned char *p, *d, *t; ++ int c; ++ ++ d = t = alloca(strlen(str) * 5 + 1 + 1); ++ for (p = (unsigned char *)str; *p != '\0'; p++) { ++ c = *p; ++ switch (c) { ++ case '\n': ++ *t++ = '\\'; ++ *t++ = 'n'; ++ break; ++ case '\t': ++ *t++ = '\\'; ++ *t++ = 't'; ++ break; ++ case '\v': ++ *t++ = '\\'; ++ *t++ = 'v'; ++ break; ++ case '\b': ++ *t++ = '\\'; ++ *t++ = 'b'; ++ break; ++ case '\r': ++ *t++ = '\\'; ++ *t++ = 'r'; ++ break; ++ case '\f': ++ *t++ = '\\'; ++ *t++ = 'f'; ++ break; ++ case '\'': ++ *t++ = '\\'; ++ *t++ = c; ++ break; ++ default: ++ if (c >= 32 && c <= 126) { ++ *t++ = c; ++ } else { ++ *t++ = '\\'; ++ *t++ = 'x'; ++ *t++ = nibble[(c >> 4) & 0x0f]; ++ *t++ = nibble[(c >> 0) & 0x0f]; ++ } ++ break; ++ } ++ } ++ *t = '\0'; ++ return tplg_save_printf(dst, NULL, "'%s'", d); ++} ++ ++static int tplg_save_string(char **dst, const char *str, int id) ++{ ++ const unsigned char *p = (const unsigned char *)str; ++ ++ if (!p || !*p) ++ return tplg_save_printf(dst, NULL, "''"); ++ ++ if (!id && ((*p >= '0' && *p <= '9') || *p == '-')) ++ return tplg_save_quoted(dst, str); ++ ++ if (tplg_check_quoted(p)) ++ return tplg_save_quoted(dst, str); ++ ++ return tplg_save_printf(dst, NULL, "%s", str); ++} ++ ++static int save_config(char **dst, int level, const char *delim, snd_config_t *src) ++{ ++ snd_config_iterator_t i, next; ++ snd_config_t *s; ++ const char *id; ++ char *pfx; ++ unsigned int count; ++ int type, err, quoted, array; ++ ++ if (delim == NULL) ++ delim = ""; ++ ++ type = snd_config_get_type(src); ++ if (type != SND_CONFIG_TYPE_COMPOUND) { ++ char *val; ++ if (type == SND_CONFIG_TYPE_INTEGER || ++ type == SND_CONFIG_TYPE_INTEGER64) { ++ err = tplg_pprint_integer(src, &val); ++ } else { ++ err = snd_config_get_ascii(src, &val); ++ } ++ if (err < 0) ++ return err; ++ if (type == SND_CONFIG_TYPE_STRING) { ++ /* hexa array pretty print */ ++ id = strchr(val, '\n'); ++ if (id) { ++ err = tplg_save_printf(dst, NULL, "\n"); ++ if (err < 0) ++ goto retval; ++ for (id++; *id == '\t'; id++) { ++ err = tplg_save_printf(dst, NULL, "\t"); ++ if (err < 0) ++ goto retval; ++ } ++ delim = ""; ++ } ++ err = tplg_save_printf(dst, NULL, "%s'%s'\n", delim, val); ++ } else { ++ err = tplg_save_printf(dst, NULL, "%s%s\n", delim, val); ++ } ++retval: ++ free(val); ++ return err; ++ } ++ ++ count = 0; ++ quoted = 0; ++ array = 0; ++ s = NULL; ++ snd_config_for_each(i, next, src) { ++ s = snd_config_iterator_entry(i); ++ err = snd_config_get_id(s, &id); ++ if (err < 0) ++ return err; ++ if (!quoted && tplg_check_quoted((unsigned char *)id)) ++ quoted = 1; ++ if (array >= 0 && tplg_check_array_item(id, array)) ++ array++; ++ else ++ array = -1; ++ count++; ++ } ++ if (count == 0) ++ return 0; ++ ++ if (count == 1) { ++ err = snd_config_get_id(s, &id); ++ if (err >= 0 && level > 0) ++ err = tplg_save_printf(dst, NULL, "."); ++ if (err >= 0) ++ err = tplg_save_string(dst, id, 1); ++ if (err >= 0) ++ err = save_config(dst, level, " ", s); ++ return err; ++ } ++ ++ pfx = alloca(level + 1); ++ memset(pfx, '\t', level); ++ pfx[level] = '\0'; ++ ++ if (level > 0) { ++ err = tplg_save_printf(dst, NULL, "%s%s\n", delim, ++ array >= 0 ? "[" : "{"); ++ if (err < 0) ++ return err; ++ } ++ ++ snd_config_for_each(i, next, src) { ++ s = snd_config_iterator_entry(i); ++ const char *id; ++ err = snd_config_get_id(s, &id); ++ if (err < 0) ++ return err; ++ err = tplg_save_printf(dst, pfx, ""); ++ if (err < 0) ++ return err; ++ if (array < 0) { ++ delim = " "; ++ if (quoted) { ++ err = tplg_save_quoted(dst, id); ++ } else { ++ err = tplg_save_string(dst, id, 1); ++ if (err < 0) ++ return err; ++ } ++ } else { ++ delim = ""; ++ } ++ err = save_config(dst, level + 1, delim, s); ++ if (err < 0) ++ return err; ++ } ++ ++ if (level > 0) { ++ pfx[level - 1] = '\0'; ++ err = tplg_save_printf(dst, pfx, "%s\n", ++ array >= 0 ? "]" : "}"); ++ if (err < 0) ++ return err; ++ } ++ ++ return 0; ++} ++ ++static int tplg_save(snd_tplg_t *tplg, char **dst, int gindex, const char *prefix) ++{ ++ struct tplg_table *tptr; ++ struct tplg_elem *elem; ++ struct list_head *list, *pos; ++ char pfx2[16]; ++ unsigned int index; ++ int err, count; ++ ++ snprintf(pfx2, sizeof(pfx2), "%s\t", prefix ?: ""); ++ ++ /* write all blocks */ ++ for (index = 0; index < tplg_table_items; index++) { ++ tptr = &tplg_table[index]; ++ list = (struct list_head *)((void *)tplg + tptr->loff); ++ ++ /* count elements */ ++ count = 0; ++ list_for_each(pos, list) { ++ elem = list_entry(pos, struct tplg_elem, list); ++ if (gindex >= 0 && elem->index != gindex) ++ continue; ++ if (tptr->save == NULL && tptr->gsave == NULL) { ++ SNDERR("unable to create %s block (no callback)", ++ tptr->id); ++ err = -ENXIO; ++ goto _err; ++ } ++ if (tptr->save) ++ count++; ++ } ++ ++ if (count == 0) ++ continue; ++ ++ if (count > 1) { ++ err = tplg_save_printf(dst, prefix, "%s {\n", ++ elem->table ? ++ elem->table->id : "_NOID_"); ++ } else { ++ err = tplg_save_printf(dst, prefix, "%s.", ++ elem->table ? ++ elem->table->id : "_NOID_"); ++ } ++ ++ if (err < 0) ++ goto _err; ++ ++ list_for_each(pos, list) { ++ elem = list_entry(pos, struct tplg_elem, list); ++ if (gindex >= 0 && elem->index != gindex) ++ continue; ++ if (count > 1) { ++ err = tplg_save_printf(dst, pfx2, ""); ++ if (err < 0) ++ goto _err; ++ } ++ err = tptr->save(tplg, elem, dst, count > 1 ? pfx2 : prefix); ++ if (err < 0) { ++ SNDERR("failed to save %s elements: %s", ++ tptr->id, snd_strerror(-err)); ++ goto _err; ++ } ++ } ++ if (count > 1) { ++ err = tplg_save_printf(dst, prefix, "}\n"); ++ if (err < 0) ++ goto _err; ++ } ++ } ++ ++ /* save globals */ ++ for (index = 0; index < tplg_table_items; index++) { ++ tptr = &tplg_table[index]; ++ if (tptr->gsave) { ++ err = tptr->gsave(tplg, gindex, dst, prefix); ++ if (err < 0) ++ goto _err; ++ } ++ } ++ ++ return 0; ++ ++_err: ++ free(*dst); ++ *dst = NULL; ++ return err; ++} ++ ++static int tplg_index_compar(const void *a, const void *b) ++{ ++ const int *a1 = a, *b1 = b; ++ return *a1 - *b1; ++} ++ ++static int tplg_index_groups(snd_tplg_t *tplg, int **indexes) ++{ ++ struct tplg_table *tptr; ++ struct tplg_elem *elem; ++ struct list_head *list, *pos; ++ unsigned int index, j, count, size; ++ int *a, *b; ++ ++ count = 0; ++ size = 16; ++ a = malloc(size * sizeof(a[0])); ++ ++ for (index = 0; index < tplg_table_items; index++) { ++ tptr = &tplg_table[index]; ++ list = (struct list_head *)((void *)tplg + tptr->loff); ++ list_for_each(pos, list) { ++ elem = list_entry(pos, struct tplg_elem, list); ++ for (j = 0; j < count; j++) { ++ if (a[j] == elem->index) ++ break; ++ } ++ if (j < count) ++ continue; ++ if (count + 1 >= size) { ++ size += 8; ++ b = realloc(a, size * sizeof(a[0])); ++ if (b == NULL) { ++ free(a); ++ return -ENOMEM; ++ } ++ a = b; ++ } ++ a[count++] = elem->index; ++ } ++ } ++ a[count] = -1; ++ ++ qsort(a, count, sizeof(a[0]), tplg_index_compar); ++ ++ *indexes = a; ++ return 0; ++} ++ ++int snd_tplg_save(snd_tplg_t *tplg, char **dst, int flags) ++{ ++ snd_input_t *in; ++ snd_config_t *top, *top2; ++ char *dst2; ++ int *indexes, *a; ++ int err; ++ ++ assert(tplg); ++ assert(dst); ++ *dst = NULL; ++ ++ if (flags & SND_TPLG_SAVE_GROUPS) { ++ err = tplg_index_groups(tplg, &indexes); ++ if (err < 0) ++ return err; ++ for (a = indexes; err >= 0 && *a >= 0; a++) { ++ err = tplg_save_printf(dst, NULL, ++ "IndexGroup.%d {\n", ++ *a); ++ if (err >= 0) ++ err = tplg_save(tplg, dst, *a, "\t"); ++ if (err >= 0) ++ err = tplg_save_printf(dst, NULL, "}\n"); ++ } ++ free(indexes); ++ } else { ++ err = tplg_save(tplg, dst, -1, NULL); ++ } ++ ++ if (err < 0) ++ goto _err; ++ ++ if (flags & SND_TPLG_SAVE_NOCHECK) ++ return 0; ++ ++ /* always load configuration - check */ ++ err = snd_input_buffer_open(&in, *dst, strlen(*dst)); ++ if (err < 0) { ++ SNDERR("could not create input buffer"); ++ goto _err; ++ } ++ ++ err = snd_config_top(&top); ++ if (err < 0) { ++ snd_input_close(in); ++ goto _err; ++ } ++ ++ err = snd_config_load(top, in); ++ snd_input_close(in); ++ if (err < 0) { ++ SNDERR("could not load configuration"); ++ snd_config_delete(top); ++ goto _err; ++ } ++ ++ if (flags & SND_TPLG_SAVE_SORT) { ++ top2 = sort_config(NULL, top); ++ if (top2 == NULL) { ++ SNDERR("could not sort configuration"); ++ snd_config_delete(top); ++ err = -EINVAL; ++ goto _err; ++ } ++ snd_config_delete(top); ++ top = top2; ++ } ++ ++ dst2 = NULL; ++ err = save_config(&dst2, 0, NULL, top); ++ snd_config_delete(top); ++ if (err < 0) { ++ SNDERR("could not save configuration"); ++ goto _err; ++ } ++ ++ free(*dst); ++ *dst = dst2; ++ return 0; ++ ++_err: ++ free(*dst); ++ *dst = NULL; ++ return err; ++} +diff --git a/src/topology/text.c b/src/topology/text.c +index f301a4de..e9386e7d 100644 +--- a/src/topology/text.c ++++ b/src/topology/text.c +@@ -89,3 +89,22 @@ int tplg_parse_text(snd_tplg_t *tplg, snd_config_t *cfg, + + return err; + } ++ ++/* save text data */ ++int tplg_save_text(snd_tplg_t *tplg ATTRIBUTE_UNUSED, ++ struct tplg_elem *elem, ++ char **dst, const char *pfx) ++{ ++ struct tplg_texts *texts = elem->texts; ++ unsigned int i; ++ int err; ++ ++ if (!texts || texts->num_items == 0) ++ return 0; ++ err = tplg_save_printf(dst, pfx, "'%s'.values [\n", elem->id); ++ for (i = 0; err >= 0 && i < texts->num_items; i++) ++ err = tplg_save_printf(dst, pfx, "\t'%s'\n", texts->items[i][0]); ++ if (err >= 0) ++ err = tplg_save_printf(dst, pfx, "]\n"); ++ return err; ++} +diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h +index bea88ba3..42a3aa96 100644 +--- a/src/topology/tplg_local.h ++++ b/src/topology/tplg_local.h +@@ -37,6 +37,7 @@ + + struct tplg_ref; + struct tplg_elem; ++struct tplg_table; + + typedef enum _snd_pcm_rates { + SND_PCM_RATE_UNKNOWN = -1, +@@ -147,6 +148,8 @@ struct tplg_vendor_tuples { + /* topology element */ + struct tplg_elem { + ++ struct tplg_table *table; ++ + char id[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; + + int index; +@@ -209,6 +212,10 @@ struct tplg_table { + unsigned enew: 1; + void (*free)(void *); + int (*parse)(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); ++ int (*save)(snd_tplg_t *tplg, struct tplg_elem *elem, ++ char **dst, const char *prefix); ++ int (*gsave)(snd_tplg_t *tplg, int index, ++ char **dst, const char *prefix); + }; + + extern struct tplg_table tplg_table[]; +@@ -250,7 +257,8 @@ int tplg_build_pcm_dai(snd_tplg_t *tplg, unsigned int type); + int tplg_copy_data(snd_tplg_t *tplg, struct tplg_elem *elem, + struct tplg_ref *ref); + +-int tplg_parse_data_refs(snd_config_t *cfg, struct tplg_elem *elem); ++int tplg_parse_refs(snd_config_t *cfg, struct tplg_elem *elem, ++ unsigned int type); + + int tplg_ref_add(struct tplg_elem *elem, int type, const char* id); + int tplg_ref_add_elem(struct tplg_elem *elem, struct tplg_elem *elem_ref); +@@ -269,9 +277,11 @@ struct tplg_elem* tplg_elem_new_common(snd_tplg_t *tplg, + int tplg_get_integer(snd_config_t *n, int *val, int base); + int tplg_get_unsigned(snd_config_t *n, unsigned *val, int base); + ++const char *tplg_channel_name(int type); + int tplg_parse_channel(snd_tplg_t *tplg ATTRIBUTE_UNUSED, + snd_config_t *cfg, void *private); + ++const char *tplg_ops_name(int type); + int tplg_parse_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, + snd_config_t *cfg, void *private); + int tplg_parse_ext_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, +@@ -299,3 +309,49 @@ int tplg_build_links(snd_tplg_t *tplg, unsigned int type); + int tplg_add_link_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t); + int tplg_add_pcm_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t); + int tplg_add_dai_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t); ++ ++int tplg_nice_value_format(char *dst, size_t dst_size, unsigned int value); ++ ++int tplg_save_printf(char **dst, const char *prefix, const char *fmt, ...); ++int tplg_save_refs(snd_tplg_t *tplg, struct tplg_elem *elem, unsigned int type, ++ const char *id, char **dst, const char *pfx); ++int tplg_save_channels(snd_tplg_t *tplg, struct snd_soc_tplg_channel *channel, ++ unsigned int channel_count, char **dst, const char *pfx); ++int tplg_save_ops(snd_tplg_t *tplg, struct snd_soc_tplg_ctl_hdr *hdr, ++ char **dst, const char *pfx); ++int tplg_save_ext_ops(snd_tplg_t *tplg, struct snd_soc_tplg_bytes_control *be, ++ char **dst, const char *pfx); ++int tplg_save_manifest_data(snd_tplg_t *tplg, struct tplg_elem *elem, ++ char **dst, const char *pfx); ++int tplg_save_control_mixer(snd_tplg_t *tplg, struct tplg_elem *elem, ++ char **dst, const char *pfx); ++int tplg_save_control_enum(snd_tplg_t *tplg, struct tplg_elem *elem, ++ char **dst, const char *pfx); ++int tplg_save_control_bytes(snd_tplg_t *tplg, struct tplg_elem *elem, ++ char **dst, const char *pfx); ++int tplg_save_tlv(snd_tplg_t *tplg, struct tplg_elem *elem, ++ char **dst, const char *pfx); ++int tplg_save_data(snd_tplg_t *tplg, struct tplg_elem *elem, ++ char **dst, const char *pfx); ++int tplg_save_text(snd_tplg_t *tplg, struct tplg_elem *elem, ++ char **dst, const char *pfx); ++int tplg_save_tokens(snd_tplg_t *tplg, struct tplg_elem *elem, ++ char **dst, const char *pfx); ++int tplg_save_tuples(snd_tplg_t *tplg, struct tplg_elem *elem, ++ char **dst, const char *pfx); ++int tplg_save_dapm_graph(snd_tplg_t *tplg, int index, ++ char **dst, const char *pfx); ++int tplg_save_dapm_widget(snd_tplg_t *tplg, struct tplg_elem *elem, ++ char **dst, const char *pfx); ++int tplg_save_link(snd_tplg_t *tplg, struct tplg_elem *elem, ++ char **dst, const char *pfx); ++int tplg_save_cc(snd_tplg_t *tplg, struct tplg_elem *elem, ++ char **dst, const char *pfx); ++int tplg_save_pcm(snd_tplg_t *tplg, struct tplg_elem *elem, ++ char **dst, const char *pfx); ++int tplg_save_hw_config(snd_tplg_t *tplg, struct tplg_elem *elem, ++ char **dst, const char *pfx); ++int tplg_save_stream_caps(snd_tplg_t *tplg, struct tplg_elem *elem, ++ char **dst, const char *pfx); ++int tplg_save_dai(snd_tplg_t *tplg, struct tplg_elem *elem, ++ char **dst, const char *pfx); +-- +2.24.1 + + +From b336aea507b80493cdae439f09f710eec4bcd4ae Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 20 Dec 2019 14:59:00 +0100 +Subject: [PATCH 44/69] topology: add snd_tplg_create() with flags + +Add SND_TPLG_CREATE_VERBOSE and SND_TPLG_CREATE_DAPM_NOSORT +flags for the special operations. + +Signed-off-by: Jaroslav Kysela +--- + include/topology.h | 10 ++++++++++ + src/topology/dapm.c | 5 ++++- + src/topology/parser.c | 10 +++++++++- + src/topology/tplg_local.h | 1 + + 4 files changed, 24 insertions(+), 2 deletions(-) + +diff --git a/include/topology.h b/include/topology.h +index 69aa5ed7..63c13a98 100644 +--- a/include/topology.h ++++ b/include/topology.h +@@ -771,12 +771,22 @@ enum snd_tplg_type { + /** Fit for all user cases */ + #define SND_TPLG_INDEX_ALL 0 + ++/** Flags for the snd_tplg_create */ ++#define SND_TPLG_CREATE_VERBOSE (1<<0) /*!< Verbose output */ ++#define SND_TPLG_CREATE_DAPM_NOSORT (1<<1) /*!< Do not sort DAPM objects by index */ ++ + /** + * \brief Create a new topology parser instance. + * \return New topology parser instance + */ + snd_tplg_t *snd_tplg_new(void); + ++/** ++ * \brief Create a new topology parser instance. ++ * \return New topology parser instance ++ */ ++snd_tplg_t *snd_tplg_create(int flags); ++ + /** + * \brief Free a topology parser instance. + * \param tplg Topology parser instance +diff --git a/src/topology/dapm.c b/src/topology/dapm.c +index 2bdacedc..d6c15fc1 100644 +--- a/src/topology/dapm.c ++++ b/src/topology/dapm.c +@@ -268,7 +268,10 @@ struct tplg_elem *tplg_elem_new_route(snd_tplg_t *tplg, int index) + return NULL; + + elem->index = index; +- tplg_elem_insert(elem, &tplg->route_list); ++ if (tplg->dapm_sort) ++ tplg_elem_insert(elem, &tplg->route_list); ++ else ++ list_add_tail(&elem->list, &tplg->route_list); + strcpy(elem->id, "line"); + elem->type = SND_TPLG_TYPE_DAPM_GRAPH; + elem->size = sizeof(*line); +diff --git a/src/topology/parser.c b/src/topology/parser.c +index de5edd1b..8f810f75 100644 +--- a/src/topology/parser.c ++++ b/src/topology/parser.c +@@ -432,7 +432,7 @@ static bool is_little_endian(void) + return false; + } + +-snd_tplg_t *snd_tplg_new(void) ++snd_tplg_t *snd_tplg_create(int flags) + { + snd_tplg_t *tplg; + +@@ -445,6 +445,9 @@ snd_tplg_t *snd_tplg_new(void) + if (!tplg) + return NULL; + ++ tplg->verbose = !!(flags & SND_TPLG_CREATE_VERBOSE); ++ tplg->dapm_sort = (flags & SND_TPLG_CREATE_DAPM_NOSORT) == 0; ++ + tplg->manifest.size = sizeof(struct snd_soc_tplg_manifest); + + INIT_LIST_HEAD(&tplg->tlv_list); +@@ -469,6 +472,11 @@ snd_tplg_t *snd_tplg_new(void) + return tplg; + } + ++snd_tplg_t *snd_tplg_new(void) ++{ ++ return snd_tplg_create(0); ++} ++ + void snd_tplg_free(snd_tplg_t *tplg) + { + free(tplg->bin); +diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h +index 42a3aa96..74b3a55c 100644 +--- a/src/topology/tplg_local.h ++++ b/src/topology/tplg_local.h +@@ -66,6 +66,7 @@ struct snd_tplg { + size_t bin_size; + + int verbose; ++ unsigned int dapm_sort: 1; + unsigned int version; + + /* runtime state */ +-- +2.24.1 + + +From 0793ef064a97afd0b1335af0d187ede227b90582 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 20 Dec 2019 21:28:30 +0100 +Subject: [PATCH 45/69] topology: add snd_tplg_version() function + +Signed-off-by: Jaroslav Kysela +--- + include/topology.h | 6 ++++++ + src/topology/parser.c | 5 +++++ + 2 files changed, 11 insertions(+) + +diff --git a/include/topology.h b/include/topology.h +index 63c13a98..37bced1a 100644 +--- a/include/topology.h ++++ b/include/topology.h +@@ -775,6 +775,12 @@ enum snd_tplg_type { + #define SND_TPLG_CREATE_VERBOSE (1<<0) /*!< Verbose output */ + #define SND_TPLG_CREATE_DAPM_NOSORT (1<<1) /*!< Do not sort DAPM objects by index */ + ++/** ++ * \brief Return the version of the topology library. ++ * \return A static string with the version number. ++ */ ++const char *snd_tplg_version(void); ++ + /** + * \brief Create a new topology parser instance. + * \return New topology parser instance +diff --git a/src/topology/parser.c b/src/topology/parser.c +index 8f810f75..1eaa24bd 100644 +--- a/src/topology/parser.c ++++ b/src/topology/parser.c +@@ -503,3 +503,8 @@ void snd_tplg_free(snd_tplg_t *tplg) + + free(tplg); + } ++ ++const char *snd_tplg_version(void) ++{ ++ return SND_LIB_VERSION_STR; ++} +-- +2.24.1 + + +From f42b2c088a23e1c6156c0d5710efd7689b8c15be Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 20 Dec 2019 23:48:40 +0100 +Subject: [PATCH 46/69] topology: cleanup the SNDERR() calls + +- remove the wrong new lines +- remove error/warning prefixes (error is error) + +Signed-off-by: Jaroslav Kysela +--- + src/topology/builder.c | 16 ++++++------- + src/topology/channel.c | 2 +- + src/topology/ctl.c | 36 +++++++++++++--------------- + src/topology/dapm.c | 40 ++++++++++++++----------------- + src/topology/data.c | 53 +++++++++++++++++++++--------------------- + src/topology/parser.c | 33 +++++++++++++------------- + src/topology/pcm.c | 29 +++++++++++------------ + src/topology/text.c | 2 +- + 8 files changed, 99 insertions(+), 112 deletions(-) + +diff --git a/src/topology/builder.c b/src/topology/builder.c +index cadb5583..74c44405 100644 +--- a/src/topology/builder.c ++++ b/src/topology/builder.c +@@ -65,8 +65,8 @@ static ssize_t write_block_header(snd_tplg_t *tplg, unsigned int type, + + /* make sure file offset is aligned with the calculated HDR offset */ + if (tplg->bin_pos != tplg->next_hdr_pos) { +- SNDERR("error: New header is at offset 0x%zx but file" +- " offset 0x%zx is %s by %ld bytes\n", ++ SNDERR("New header is at offset 0x%zx but file" ++ " offset 0x%zx is %s by %ld bytes", + tplg->next_hdr_pos, tplg->bin_pos, + tplg->bin_pos > tplg->next_hdr_pos ? "ahead" : "behind", + labs(tplg->bin_pos - tplg->next_hdr_pos)); +@@ -108,7 +108,7 @@ static int write_elem_block(snd_tplg_t *tplg, + ret = write_block_header(tplg, tplg_type, elem->vendor_type, + tplg->version, elem->index, block_size, count); + if (ret < 0) { +- SNDERR("error: failed to write %s block %d\n", ++ SNDERR("failed to write %s block %d", + obj_name, ret); + return ret; + } +@@ -148,7 +148,7 @@ static int write_elem_block(snd_tplg_t *tplg, + + /* make sure we have written the correct size */ + if (total_size != size) { +- SNDERR("error: size mismatch. Expected %zu wrote %zu\n", ++ SNDERR("size mismatch. Expected %zu wrote %zu", + size, total_size); + return -EIO; + } +@@ -221,7 +221,7 @@ static ssize_t write_manifest_data(snd_tplg_t *tplg) + tplg->version, 0, + sizeof(tplg->manifest) + tplg->manifest.priv.size, 1); + if (ret < 0) { +- SNDERR("error: failed to write manifest block\n"); ++ SNDERR("failed to write manifest block"); + return ret; + } + +@@ -266,7 +266,7 @@ int tplg_write_data(snd_tplg_t *tplg) + /* write manifest */ + ret = write_manifest_data(tplg); + if (ret < 0) { +- SNDERR("failed to write manifest %d\n", ret); ++ SNDERR("failed to write manifest %d", ret); + return ret; + } + +@@ -286,7 +286,7 @@ int tplg_write_data(snd_tplg_t *tplg) + ret = write_elem_block(tplg, list, size, + tptr->tsoc, tptr->name); + if (ret < 0) { +- SNDERR("failed to write %s elements: %s\n", ++ SNDERR("failed to write %s elements: %s", + tptr->name, snd_strerror(-ret)); + return ret; + } +@@ -295,7 +295,7 @@ int tplg_write_data(snd_tplg_t *tplg) + verbose(tplg, "total size is 0x%zx/%zd\n", tplg->bin_pos, tplg->bin_pos); + + if (total_size != tplg->bin_pos) { +- SNDERR("total size mismatch (%zd != %zd)\n", ++ SNDERR("total size mismatch (%zd != %zd)", + total_size, tplg->bin_pos); + return -EINVAL; + } +diff --git a/src/topology/channel.c b/src/topology/channel.c +index b54a10c8..110775a8 100644 +--- a/src/topology/channel.c ++++ b/src/topology/channel.c +@@ -104,7 +104,7 @@ int tplg_parse_channel(snd_tplg_t *tplg, snd_config_t *cfg, + + channel_id = lookup_channel(id); + if (channel_id < 0) { +- SNDERR("error: invalid channel %s\n", id); ++ SNDERR("invalid channel %s", id); + return -EINVAL; + } + +diff --git a/src/topology/ctl.c b/src/topology/ctl.c +index 979cc1b0..03874b27 100644 +--- a/src/topology/ctl.c ++++ b/src/topology/ctl.c +@@ -94,7 +94,7 @@ int parse_access(snd_config_t *cfg, + if (strcmp(id, "access") == 0) { + err = parse_access_values(n, hdr); + if (err < 0) { +- SNDERR("error: failed to parse access"); ++ SNDERR("failed to parse access"); + return err; + } + continue; +@@ -187,8 +187,8 @@ static int tplg_build_mixer_control(snd_tplg_t *tplg, + } + + if (!ref->elem) { +- SNDERR("error: cannot find '%s' referenced by" +- " control '%s'\n", ref->id, elem->id); ++ SNDERR("cannot find '%s' referenced by" ++ " control '%s'", ref->id, elem->id); + return -EINVAL; + } else if (err < 0) + return err; +@@ -236,8 +236,8 @@ static int tplg_build_enum_control(snd_tplg_t *tplg, + return err; + } + if (!ref->elem) { +- SNDERR("error: cannot find '%s' referenced by" +- " control '%s'\n", ref->id, elem->id); ++ SNDERR("cannot find '%s' referenced by" ++ " control '%s'", ref->id, elem->id); + return -EINVAL; + } + } +@@ -341,10 +341,8 @@ static int tplg_parse_tlv_dbscale(snd_config_t *cfg, struct tplg_elem *elem) + n = snd_config_iterator_entry(i); + + /* get ID */ +- if (snd_config_get_id(n, &id) < 0) { +- SNDERR("error: cant get ID\n"); ++ if (snd_config_get_id(n, &id) < 0) + return -EINVAL; +- } + + /* get value */ + if (tplg_get_integer(n, &val, 0)) +@@ -360,7 +358,7 @@ static int tplg_parse_tlv_dbscale(snd_config_t *cfg, struct tplg_elem *elem) + else if (strcmp(id, "mute") == 0) + scale->mute = val; + else +- SNDERR("error: unknown key %s\n", id); ++ SNDERR("unknown id '%s'", id); + } + + return 0; +@@ -389,7 +387,7 @@ int tplg_parse_tlv(snd_tplg_t *tplg, snd_config_t *cfg, + if (strcmp(id, "scale") == 0) { + err = tplg_parse_tlv_dbscale(n, elem); + if (err < 0) { +- SNDERR("error: failed to DBScale"); ++ SNDERR("failed to DBScale"); + return err; + } + continue; +@@ -651,8 +649,7 @@ int tplg_parse_control_enum(snd_tplg_t *tplg, snd_config_t *cfg, + + if (strcmp(id, "channel") == 0) { + if (ec->num_channels >= SND_SOC_TPLG_MAX_CHAN) { +- SNDERR("error: too many channels %s\n", +- elem->id); ++ SNDERR("too many channels %s", elem->id); + return -EINVAL; + } + +@@ -779,8 +776,7 @@ int tplg_parse_control_mixer(snd_tplg_t *tplg, + + if (strcmp(id, "channel") == 0) { + if (mc->num_channels >= SND_SOC_TPLG_MAX_CHAN) { +- SNDERR("error: too many channels %s\n", +- elem->id); ++ SNDERR("too many channels %s", elem->id); + return -EINVAL; + } + +@@ -933,7 +929,7 @@ static int init_ctl_hdr(struct snd_soc_tplg_ctl_hdr *hdr, + struct snd_soc_tplg_tlv_dbscale *scale; + + if (!tlvt) { +- SNDERR("error: missing TLV data\n"); ++ SNDERR("missing TLV data"); + return -EINVAL; + } + +@@ -952,7 +948,7 @@ static int init_ctl_hdr(struct snd_soc_tplg_ctl_hdr *hdr, + + /* TODO: add support for other TLV types */ + default: +- SNDERR("error: unsupported TLV type %d\n", tlv->type); ++ SNDERR("unsupported TLV type %d", tlv->type); + break; + } + } +@@ -971,7 +967,7 @@ int tplg_add_mixer(snd_tplg_t *tplg, struct snd_tplg_mixer_template *mixer, + tplg_dbg(" Control Mixer: %s\n", mixer->hdr.name); + + if (mixer->hdr.type != SND_SOC_TPLG_TYPE_MIXER) { +- SNDERR("error: invalid mixer type %d\n", mixer->hdr.type); ++ SNDERR("invalid mixer type %d", mixer->hdr.type); + return -EINVAL; + } + +@@ -1039,7 +1035,7 @@ int tplg_add_enum(snd_tplg_t *tplg, struct snd_tplg_enum_template *enum_ctl, + tplg_dbg(" Control Enum: %s\n", enum_ctl->hdr.name); + + if (enum_ctl->hdr.type != SND_SOC_TPLG_TYPE_ENUM) { +- SNDERR("error: invalid enum type %d\n", enum_ctl->hdr.type); ++ SNDERR("invalid enum type %d", enum_ctl->hdr.type); + return -EINVAL; + } + +@@ -1113,7 +1109,7 @@ int tplg_add_bytes(snd_tplg_t *tplg, struct snd_tplg_bytes_template *bytes_ctl, + tplg_dbg(" Control Bytes: %s\n", bytes_ctl->hdr.name); + + if (bytes_ctl->hdr.type != SND_SOC_TPLG_TYPE_BYTES) { +- SNDERR("error: invalid bytes type %d\n", bytes_ctl->hdr.type); ++ SNDERR("invalid bytes type %d", bytes_ctl->hdr.type); + return -EINVAL; + } + +@@ -1157,7 +1153,7 @@ int tplg_add_bytes(snd_tplg_t *tplg, struct snd_tplg_bytes_template *bytes_ctl, + if (be->hdr.access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK) { + if ((be->hdr.access & SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE) + != SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE) { +- SNDERR("error: Invalid TLV bytes control access 0x%x\n", ++ SNDERR("Invalid TLV bytes control access 0x%x", + be->hdr.access); + tplg_elem_free(elem); + return -EINVAL; +diff --git a/src/topology/dapm.c b/src/topology/dapm.c +index d6c15fc1..f61fe071 100644 +--- a/src/topology/dapm.c ++++ b/src/topology/dapm.c +@@ -154,8 +154,7 @@ static int tplg_build_widget(snd_tplg_t *tplg, struct tplg_elem *elem) + } + + if (!ref->elem) { +- SNDERR("error: cannot find '%s'" +- " referenced by widget '%s'\n", ++ SNDERR("cannot find '%s' referenced by widget '%s'", + ref->id, elem->id); + return -EINVAL; + } +@@ -179,8 +178,7 @@ int tplg_build_widgets(snd_tplg_t *tplg) + + elem = list_entry(pos, struct tplg_elem, list); + if (!elem->widget || elem->type != SND_TPLG_TYPE_DAPM_WIDGET) { +- SNDERR("error: invalid widget '%s'\n", +- elem->id); ++ SNDERR("invalid widget '%s'", elem->id); + return -EINVAL; + } + +@@ -207,8 +205,7 @@ int tplg_build_routes(snd_tplg_t *tplg) + elem = list_entry(pos, struct tplg_elem, list); + + if (!elem->route || elem->type != SND_TPLG_TYPE_DAPM_GRAPH) { +- SNDERR("error: invalid route '%s'\n", +- elem->id); ++ SNDERR("invalid route '%s'", elem->id); + return -EINVAL; + } + +@@ -218,14 +215,13 @@ int tplg_build_routes(snd_tplg_t *tplg) + + /* validate sink */ + if (strlen(route->sink) <= 0) { +- SNDERR("error: no sink\n"); ++ SNDERR("no sink"); + return -EINVAL; + + } + if (!tplg_elem_lookup(&tplg->widget_list, route->sink, + SND_TPLG_TYPE_DAPM_WIDGET, SND_TPLG_INDEX_ALL)) { +- SNDERR("warning: undefined sink widget/stream '%s'\n", +- route->sink); ++ SNDERR("undefined sink widget/stream '%s'", route->sink); + } + + /* validate control name */ +@@ -234,21 +230,21 @@ int tplg_build_routes(snd_tplg_t *tplg) + SND_TPLG_TYPE_MIXER, elem->index) && + !tplg_elem_lookup(&tplg->enum_list, route->control, + SND_TPLG_TYPE_ENUM, elem->index)) { +- SNDERR("warning: Undefined mixer/enum control '%s'\n", +- route->control); ++ SNDERR("Undefined mixer/enum control '%s'", ++ route->control); + } + } + + /* validate source */ + if (strlen(route->source) <= 0) { +- SNDERR("error: no source\n"); ++ SNDERR("no source"); + return -EINVAL; + + } + if (!tplg_elem_lookup(&tplg->widget_list, route->source, + SND_TPLG_TYPE_DAPM_WIDGET, SND_TPLG_INDEX_ALL)) { +- SNDERR("warning: Undefined source widget/stream '%s'\n", +- route->source); ++ SNDERR("Undefined source widget/stream '%s'", ++ route->source); + } + + /* add graph to manifest */ +@@ -300,7 +296,7 @@ static int tplg_parse_line(const char *text, + + len = strlen(buf); + if (len <= 2) { +- SNDERR("error: invalid route \"%s\"\n", buf); ++ SNDERR("invalid route \"%s\"", buf); + return -EINVAL; + } + +@@ -309,7 +305,7 @@ static int tplg_parse_line(const char *text, + if (buf[i] == ',') + goto second; + } +- SNDERR("error: invalid route \"%s\"\n", buf); ++ SNDERR("invalid route \"%s\"", buf); + return -EINVAL; + + second: +@@ -323,7 +319,7 @@ second: + goto done; + } + +- SNDERR("error: invalid route \"%s\"\n", buf); ++ SNDERR("invalid route \"%s\"", buf); + return -EINVAL; + + done: +@@ -378,7 +374,7 @@ int tplg_parse_dapm_graph(snd_tplg_t *tplg, snd_config_t *cfg, + int index = -1; + + if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) { +- SNDERR("error: compound is expected for dapm graph definition\n"); ++ SNDERR("compound is expected for dapm graph definition"); + return -EINVAL; + } + +@@ -401,13 +397,13 @@ int tplg_parse_dapm_graph(snd_tplg_t *tplg, snd_config_t *cfg, + + if (strcmp(id, "lines") == 0) { + if (index < 0) { +- SNDERR("error: failed to parse dapm graph %s, missing index\n", ++ SNDERR("failed to parse dapm graph %s, missing index", + graph_id); + return -EINVAL; + } + err = tplg_parse_routes(tplg, n, index); + if (err < 0) { +- SNDERR("error: failed to parse dapm graph %s\n", ++ SNDERR("failed to parse dapm graph %s", + graph_id); + return err; + } +@@ -528,7 +524,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, + + widget_type = lookup_widget(val); + if (widget_type < 0){ +- SNDERR("Widget '%s': Unsupported widget type %s\n", ++ SNDERR("widget '%s': Unsupported widget type %s", + elem->id, val); + return -EINVAL; + } +@@ -821,7 +817,7 @@ int tplg_add_widget_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) + break; + + default: +- SNDERR("error: widget %s: invalid type %d for ctl %d\n", ++ SNDERR("widget %s: invalid type %d for ctl %d", + wt->name, ct->type, i); + break; + } +diff --git a/src/topology/data.c b/src/topology/data.c +index 11cd73f5..f00ed301 100644 +--- a/src/topology/data.c ++++ b/src/topology/data.c +@@ -61,7 +61,7 @@ struct snd_soc_tplg_private *get_priv_data(struct tplg_elem *elem) + priv = &elem->pcm->priv; + break; + default: +- SNDERR("error: '%s': no support for private data for type %d\n", ++ SNDERR("'%s': no support for private data for type %d", + elem->id, elem->type); + } + +@@ -95,7 +95,7 @@ int tplg_parse_refs(snd_config_t *cfg, struct tplg_elem *elem, + } + + if (cfg_type != SND_CONFIG_TYPE_COMPOUND) { +- SNDERR("error: compound type expected for %s", elem->id); ++ SNDERR("compound type expected for %s", elem->id); + return -EINVAL; + } + +@@ -183,8 +183,7 @@ static int tplg_parse_data_file(snd_config_t *cfg, struct tplg_elem *elem) + + fp = fopen(filename, "r"); + if (fp == NULL) { +- SNDERR("error: invalid data file path '%s'\n", +- filename); ++ SNDERR("invalid data file path '%s'", filename); + return -errno; + } + +@@ -192,12 +191,12 @@ static int tplg_parse_data_file(snd_config_t *cfg, struct tplg_elem *elem) + size = ftell(fp); + fseek(fp, 0L, SEEK_SET); + if (size <= 0) { +- SNDERR("error: invalid data file size %zu\n", size); ++ SNDERR("invalid data file size %zu", size); + ret = -EINVAL; + goto err; + } + if (size > TPLG_MAX_PRIV_SIZE) { +- SNDERR("error: data file too big %zu\n", size); ++ SNDERR("data file too big %zu", size); + ret = -EINVAL; + goto err; + } +@@ -350,7 +349,7 @@ static int get_uuid(const char *str, unsigned char *uuid_le) + if ((errno == ERANGE && val == ULONG_MAX) + || (errno != 0 && val == 0) + || (val > UCHAR_MAX)) { +- SNDERR("error: invalid value for uuid\n"); ++ SNDERR("invalid value for uuid"); + ret = -EINVAL; + goto out; + } +@@ -365,7 +364,7 @@ static int get_uuid(const char *str, unsigned char *uuid_le) + } + + if (values < 16) { +- SNDERR("error: less than 16 integers for uuid\n"); ++ SNDERR("less than 16 integers for uuid"); + ret = -EINVAL; + } + +@@ -446,7 +445,7 @@ static int tplg_parse_data_hex(snd_config_t *cfg, struct tplg_elem *elem, + + num = get_hex_num(value); + if (num <= 0) { +- SNDERR("error: malformed hex variable list %s\n", value); ++ SNDERR("malformed hex variable list %s", value); + return -EINVAL; + } + +@@ -454,7 +453,7 @@ static int tplg_parse_data_hex(snd_config_t *cfg, struct tplg_elem *elem, + priv = elem->data; + + if (size > TPLG_MAX_PRIV_SIZE) { +- SNDERR("error: data too big %d\n", size); ++ SNDERR("data too big %d", size); + return -EINVAL; + } + +@@ -492,7 +491,7 @@ static int get_token_value(const char *token_id, + return tokens->token[i].value; + } + +- SNDERR("error: cannot find token id '%s'\n", token_id); ++ SNDERR("cannot find token id '%s'", token_id); + return -1; + } + +@@ -579,7 +578,7 @@ static int copy_tuples(struct tplg_elem *elem, + * tuple_set->num_tuples; + size += set_size; + if (size > TPLG_MAX_PRIV_SIZE) { +- SNDERR("error: data too big %d\n", size); ++ SNDERR("data too big %d", size); + return -EINVAL; + } + +@@ -662,13 +661,13 @@ static int build_tuples(snd_tplg_t *tplg, struct tplg_elem *elem) + ref->id, SND_TPLG_TYPE_TUPLE, elem->index); + tuples = ref->elem; + if (!tuples) { +- SNDERR("error: cannot find tuples %s\n", ref->id); ++ SNDERR("cannot find tuples %s", ref->id); + return -EINVAL; + } + + tokens = get_tokens(tplg, tuples); + if (!tokens) { +- SNDERR("error: cannot find token for %s\n", ref->id); ++ SNDERR("cannot find token for %s", ref->id); + return -EINVAL; + } + +@@ -762,7 +761,7 @@ static int parse_tuple_set(snd_config_t *cfg, + + type = get_tuple_type(id); + if (type < 0) { +- SNDERR("error: invalid tuple type '%s'", id); ++ SNDERR("invalid tuple type '%s'", id); + return type; + } + +@@ -819,7 +818,7 @@ static int parse_tuple_set(snd_config_t *cfg, + case SND_SOC_TPLG_TUPLE_TYPE_WORD: + ival = tplg_get_unsigned(n, &tuple_val, 0); + if (ival < 0) { +- SNDERR("error: tuple %s: %s\n", id, snd_strerror(ival)); ++ SNDERR("tuple %s: %s", id, snd_strerror(ival)); + goto err; + } + +@@ -829,7 +828,7 @@ static int parse_tuple_set(snd_config_t *cfg, + && tuple_val > USHRT_MAX) + || (type == SND_SOC_TPLG_TUPLE_TYPE_BYTE + && tuple_val > UCHAR_MAX)) { +- SNDERR("error: tuple %s: invalid value\n", id); ++ SNDERR("tuple %s: invalid value", id); + goto err; + } + +@@ -941,7 +940,7 @@ static int parse_tuple_sets(snd_config_t *cfg, + + if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) { + if (snd_config_get_id(cfg, &id) >= 0) +- SNDERR("error: compound type expected for %s", id); ++ SNDERR("compound type expected for %s", id); + return -EINVAL; + } + +@@ -959,8 +958,8 @@ static int parse_tuple_sets(snd_config_t *cfg, + snd_config_for_each(i, next, cfg) { + n = snd_config_iterator_entry(i); + if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) { +- SNDERR("error: compound type expected for %s, is %d", +- id, snd_config_get_type(n)); ++ SNDERR("compound type expected for %s, is %d", ++ id, snd_config_get_type(n)); + return -EINVAL; + } + +@@ -1169,7 +1168,7 @@ int tplg_parse_manifest_data(snd_tplg_t *tplg, snd_config_t *cfg, + int err; + + if (!list_empty(&tplg->manifest_list)) { +- SNDERR("error: already has manifest data\n"); ++ SNDERR("already has manifest data"); + return -EINVAL; + } + +@@ -1326,7 +1325,7 @@ int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg, + if (strcmp(id, "file") == 0) { + err = tplg_parse_data_file(n, elem); + if (err < 0) { +- SNDERR("error: failed to parse data file\n"); ++ SNDERR("failed to parse data file"); + return err; + } + continue; +@@ -1335,7 +1334,7 @@ int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg, + if (strcmp(id, "bytes") == 0) { + err = tplg_parse_data_hex(n, elem, 1); + if (err < 0) { +- SNDERR("error: failed to parse data bytes\n"); ++ SNDERR("failed to parse data bytes"); + return err; + } + continue; +@@ -1344,7 +1343,7 @@ int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg, + if (strcmp(id, "shorts") == 0) { + err = tplg_parse_data_hex(n, elem, 2); + if (err < 0) { +- SNDERR("error: failed to parse data shorts\n"); ++ SNDERR("failed to parse data shorts"); + return err; + } + continue; +@@ -1353,7 +1352,7 @@ int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg, + if (strcmp(id, "words") == 0) { + err = tplg_parse_data_hex(n, elem, 4); + if (err < 0) { +- SNDERR("error: failed to parse data words\n"); ++ SNDERR("failed to parse data words"); + return err; + } + continue; +@@ -1470,8 +1469,8 @@ int tplg_copy_data(snd_tplg_t *tplg, struct tplg_elem *elem, + ref_elem = tplg_elem_lookup(&tplg->pdata_list, + ref->id, SND_TPLG_TYPE_DATA, elem->index); + if (!ref_elem) { +- SNDERR("error: cannot find data '%s' referenced by" +- " element '%s'\n", ref->id, elem->id); ++ SNDERR("cannot find data '%s' referenced by" ++ " element '%s'", ref->id, elem->id); + return -EINVAL; + } + +diff --git a/src/topology/parser.c b/src/topology/parser.c +index 1eaa24bd..5a5dd14f 100644 +--- a/src/topology/parser.c ++++ b/src/topology/parser.c +@@ -122,7 +122,7 @@ int tplg_parse_compound(snd_tplg_t *tplg, snd_config_t *cfg, + return -EINVAL; + + if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) { +- SNDERR("error: compound type expected for %s", id); ++ SNDERR("compound type expected for %s", id); + return -EINVAL; + } + +@@ -131,7 +131,7 @@ int tplg_parse_compound(snd_tplg_t *tplg, snd_config_t *cfg, + n = snd_config_iterator_entry(i); + + if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) { +- SNDERR("error: compound type expected for %s, is %d", ++ SNDERR("compound type expected for %s, is %d", + id, snd_config_get_type(cfg)); + return -EINVAL; + } +@@ -155,7 +155,7 @@ static int tplg_parse_config(snd_tplg_t *tplg, snd_config_t *cfg) + int err; + + if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) { +- SNDERR("error: compound type expected at top level"); ++ SNDERR("compound type expected at top level"); + return -EINVAL; + } + +@@ -180,7 +180,7 @@ static int tplg_parse_config(snd_tplg_t *tplg, snd_config_t *cfg) + } + + if (parser == NULL) { +- SNDERR("error: unknown section %s\n", id); ++ SNDERR("unknown section %s", id); + continue; + } + +@@ -202,7 +202,7 @@ static int tplg_load_config(snd_tplg_t *tplg, snd_input_t *in) + + ret = snd_config_load(top, in); + if (ret < 0) { +- SNDERR("error: could not load configuration"); ++ SNDERR("could not load configuration"); + snd_config_delete(top); + return ret; + } +@@ -210,7 +210,7 @@ static int tplg_load_config(snd_tplg_t *tplg, snd_input_t *in) + ret = tplg_parse_config(tplg, top); + snd_config_delete(top); + if (ret < 0) { +- SNDERR("error: failed to parse topology"); ++ SNDERR("failed to parse topology"); + return ret; + } + +@@ -267,7 +267,7 @@ int snd_tplg_load(snd_tplg_t *tplg, const char *buf, size_t size) + + err = snd_input_buffer_open(&in, buf, size); + if (err < 0) { +- SNDERR("error: could not create input buffer"); ++ SNDERR("could not create input buffer"); + return err; + } + +@@ -282,13 +282,13 @@ static int tplg_build(snd_tplg_t *tplg) + + err = tplg_build_integ(tplg); + if (err < 0) { +- SNDERR("error: failed to check topology integrity\n"); ++ SNDERR("failed to check topology integrity"); + return err; + } + + err = tplg_write_data(tplg); + if (err < 0) { +- SNDERR("error: failed to write data %d\n", err); ++ SNDERR("failed to write data %d", err); + return err; + } + return 0; +@@ -304,15 +304,14 @@ int snd_tplg_build_file(snd_tplg_t *tplg, + + fp = fopen(infile, "r"); + if (fp == NULL) { +- SNDERR("error: could not open configuration file %s", +- infile); ++ SNDERR("could not open configuration file %s", infile); + return -errno; + } + + err = snd_input_stdio_attach(&in, fp, 1); + if (err < 0) { + fclose(fp); +- SNDERR("error: could not attach stdio %s", infile); ++ SNDERR("could not attach stdio %s", infile); + return err; + } + +@@ -346,7 +345,7 @@ int snd_tplg_add_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) + case SND_TPLG_TYPE_CC: + return tplg_add_link_object(tplg, t); + default: +- SNDERR("error: invalid object type %d\n", t->type); ++ SNDERR("invalid object type %d", t->type); + return -EINVAL; + }; + } +@@ -362,18 +361,18 @@ int snd_tplg_build(snd_tplg_t *tplg, const char *outfile) + + fd = open(outfile, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); + if (fd < 0) { +- SNDERR("error: failed to open %s err %d\n", outfile, -errno); ++ SNDERR("failed to open %s err %d", outfile, -errno); + return -errno; + } + r = write(fd, tplg->bin, tplg->bin_size); + close(fd); + if (r < 0) { + err = -errno; +- SNDERR("error: write error: %s\n", strerror(errno)); ++ SNDERR("write error: %s", strerror(errno)); + return err; + } + if ((size_t)r != tplg->bin_size) { +- SNDERR("error: partial write (%zd != %zd)\n", r, tplg->bin_size); ++ SNDERR("partial write (%zd != %zd)", r, tplg->bin_size); + return -EIO; + } + return 0; +@@ -437,7 +436,7 @@ snd_tplg_t *snd_tplg_create(int flags) + snd_tplg_t *tplg; + + if (!is_little_endian()) { +- SNDERR("error: cannot support big-endian machines\n"); ++ SNDERR("cannot support big-endian machines"); + return NULL; + } + +diff --git a/src/topology/pcm.c b/src/topology/pcm.c +index d09fbe42..bc307081 100644 +--- a/src/topology/pcm.c ++++ b/src/topology/pcm.c +@@ -116,8 +116,8 @@ static int build_pcm(snd_tplg_t *tplg, struct tplg_elem *elem) + return err; + } + if (!ref->elem) { +- SNDERR("error: cannot find '%s' referenced by" +- " PCM '%s'\n", ref->id, elem->id); ++ SNDERR("cannot find '%s' referenced by" ++ " PCM '%s'", ref->id, elem->id); + return -EINVAL; + } + } +@@ -137,7 +137,7 @@ int tplg_build_pcms(snd_tplg_t *tplg, unsigned int type) + + elem = list_entry(pos, struct tplg_elem, list); + if (elem->type != type) { +- SNDERR("error: invalid elem '%s'\n", elem->id); ++ SNDERR("invalid elem '%s'", elem->id); + return -EINVAL; + } + +@@ -196,7 +196,7 @@ int tplg_build_dais(snd_tplg_t *tplg, unsigned int type) + + elem = list_entry(pos, struct tplg_elem, list); + if (elem->type != type) { +- SNDERR("error: invalid elem '%s'\n", elem->id); ++ SNDERR("invalid elem '%s'", elem->id); + return -EINVAL; + } + +@@ -251,8 +251,8 @@ static int build_link(snd_tplg_t *tplg, struct tplg_elem *elem) + ref->elem = tplg_elem_lookup(&tplg->hw_cfg_list, + ref->id, SND_TPLG_TYPE_HW_CONFIG, elem->index); + if (!ref->elem) { +- SNDERR("error: cannot find HW config '%s'" +- " referenced by link '%s'\n", ++ SNDERR("cannot find HW config '%s'" ++ " referenced by link '%s'", + ref->id, elem->id); + return -EINVAL; + } +@@ -320,7 +320,7 @@ static int split_format(struct snd_soc_tplg_stream_caps *caps, char *str) + while ((s != NULL) && (i < SND_SOC_TPLG_MAX_FORMATS)) { + format = snd_pcm_format_value(s); + if (format == SND_PCM_FORMAT_UNKNOWN) { +- SNDERR("error: unsupported stream format %s\n", s); ++ SNDERR("unsupported stream format %s", s); + return -EINVAL; + } + +@@ -363,7 +363,7 @@ static int split_rate(struct snd_soc_tplg_stream_caps *caps, char *str) + rate = get_rate_value(s); + + if (rate == SND_PCM_RATE_UNKNOWN) { +- SNDERR("error: unsupported stream rate %s\n", s); ++ SNDERR("unsupported stream rate %s", s); + return -EINVAL; + } + +@@ -758,7 +758,7 @@ static int tplg_parse_fe_dai(snd_tplg_t *tplg ATTRIBUTE_UNUSED, + + if (strcmp(id, "id") == 0) { + if (tplg_get_unsigned(n, &pcm->dai_id, 0)) { +- SNDERR("error: invalid fe dai ID\n"); ++ SNDERR("invalid fe dai ID"); + return -EINVAL; + } + +@@ -1379,7 +1379,7 @@ static int get_audio_hw_format(const char *val) + if (strcasecmp(audio_hw_formats[i].name, val) == 0) + return audio_hw_formats[i].type; + +- SNDERR("error: invalid audio HW format %s\n", val); ++ SNDERR("invalid audio HW format %s", val); + return -EINVAL; + } + +@@ -1452,8 +1452,7 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, + /* For backwards capability, + * "master" == "codec is slave" + */ +- SNDERR("warning: deprecated bclk value '%s'\n", +- val); ++ SNDERR("deprecated bclk value '%s'", val); + + hw_cfg->bclk_master = SND_SOC_TPLG_BCLK_CS; + } else if (!strcmp(val, "codec_slave")) { +@@ -1490,8 +1489,7 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, + /* For backwards capability, + * "master" == "codec is slave" + */ +- SNDERR("warning: deprecated fsync value '%s'\n", +- val); ++ SNDERR("deprecated fsync value '%s'", val); + + hw_cfg->fsync_master = SND_SOC_TPLG_FSYNC_CS; + } else if (!strcmp(val, "codec_slave")) { +@@ -1535,8 +1533,7 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, + /* For backwards capability, + * "master" == "for codec, mclk is input" + */ +- SNDERR("warning: deprecated mclk value '%s'\n", +- val); ++ SNDERR("deprecated mclk value '%s'", val); + + hw_cfg->mclk_direction = SND_SOC_TPLG_MCLK_CI; + } else if (!strcmp(val, "codec_mclk_in")) { +diff --git a/src/topology/text.c b/src/topology/text.c +index e9386e7d..6dbf2230 100644 +--- a/src/topology/text.c ++++ b/src/topology/text.c +@@ -38,7 +38,7 @@ static int parse_text_values(snd_config_t *cfg, struct tplg_elem *elem) + n = snd_config_iterator_entry(i); + + if (j == SND_SOC_TPLG_NUM_TEXTS) { +- tplg_dbg("error: text string number exceeds %d\n", j); ++ tplg_dbg("text string number exceeds %d\n", j); + return -ENOMEM; + } + +-- +2.24.1 + + +From 712fbacf160f899582a9adc3f30f297211b063bb Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 27 Dec 2019 19:32:03 +0100 +Subject: [PATCH 47/69] topology: dapm - fix the SNDERR() - Undefined + +Signed-off-by: Jaroslav Kysela +--- + src/topology/dapm.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/topology/dapm.c b/src/topology/dapm.c +index f61fe071..88bddca3 100644 +--- a/src/topology/dapm.c ++++ b/src/topology/dapm.c +@@ -230,7 +230,7 @@ int tplg_build_routes(snd_tplg_t *tplg) + SND_TPLG_TYPE_MIXER, elem->index) && + !tplg_elem_lookup(&tplg->enum_list, route->control, + SND_TPLG_TYPE_ENUM, elem->index)) { +- SNDERR("Undefined mixer/enum control '%s'", ++ SNDERR("undefined mixer/enum control '%s'", + route->control); + } + } +@@ -243,7 +243,7 @@ int tplg_build_routes(snd_tplg_t *tplg) + } + if (!tplg_elem_lookup(&tplg->widget_list, route->source, + SND_TPLG_TYPE_DAPM_WIDGET, SND_TPLG_INDEX_ALL)) { +- SNDERR("Undefined source widget/stream '%s'", ++ SNDERR("undefined source widget/stream '%s'", + route->source); + } + +-- +2.24.1 + + +From 07d779143bfd24448034cd55945b46c46407247c Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Sat, 28 Dec 2019 10:18:34 +0100 +Subject: [PATCH 48/69] topology: fix the unitialized tuples + +Signed-off-by: Jaroslav Kysela +--- + src/topology/data.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/topology/data.c b/src/topology/data.c +index f00ed301..4e43fcc9 100644 +--- a/src/topology/data.c ++++ b/src/topology/data.c +@@ -601,6 +601,7 @@ static int copy_tuples(struct tplg_elem *elem, + elem->data = priv; + + array = (struct snd_soc_tplg_vendor_array *)(priv->data + off); ++ memset(array, 0, set_size); + array->size = set_size; + array->type = tuple_set->type; + array->num_elems = tuple_set->num_tuples; +-- +2.24.1 + + +From 2947d83c1322bcdb31c1da180acb0f779a63dcdd Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Sat, 28 Dec 2019 21:44:03 +0100 +Subject: [PATCH 49/69] topology: implement shorter hexa uuid 00:00 parser + +Signed-off-by: Jaroslav Kysela +--- + src/topology/data.c | 37 +++++++++++++++++++++++++++++++------ + 1 file changed, 31 insertions(+), 6 deletions(-) + +diff --git a/src/topology/data.c b/src/topology/data.c +index 4e43fcc9..1ddd3c50 100644 +--- a/src/topology/data.c ++++ b/src/topology/data.c +@@ -22,8 +22,8 @@ + #include + + #define UUID_FORMAT "\ +-0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, \ +-0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x" ++%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:\ ++%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x" + + /* Get private data buffer of an element */ + struct snd_soc_tplg_private *get_priv_data(struct tplg_elem *elem) +@@ -316,7 +316,6 @@ format2: + values++; + s += 2; + } +- s++; + } + + s++; +@@ -341,6 +340,32 @@ static int get_uuid(const char *str, unsigned char *uuid_le) + if (tmp == NULL) + return -ENOMEM; + ++ if (strchr(tmp, ':') == NULL) ++ goto data2; ++ ++ s = strtok(tmp, ":"); ++ while (s != NULL) { ++ errno = 0; ++ val = strtoul(s, NULL, 16); ++ if ((errno == ERANGE && val == ULONG_MAX) ++ || (errno != 0 && val == 0) ++ || (val > UCHAR_MAX)) { ++ SNDERR("invalid value for uuid"); ++ ret = -EINVAL; ++ goto out; ++ } ++ ++ *(uuid_le + values) = (unsigned char)val; ++ ++ values++; ++ if (values >= 16) ++ break; ++ ++ s = strtok(NULL, ":"); ++ } ++ goto out; ++ ++data2: + s = strtok(tmp, ","); + + while (s != NULL) { +@@ -354,7 +379,7 @@ static int get_uuid(const char *str, unsigned char *uuid_le) + goto out; + } + +- *(uuid_le + values) = (unsigned char)val; ++ *(uuid_le + values) = (unsigned char)val; + + values++; + if (values >= 16) +@@ -413,7 +438,7 @@ static int copy_data_hex(char *data, int off, const char *str, int width) + return -ENOMEM; + + p += off; +- s = strtok(tmp, ","); ++ s = strtok(tmp, ",:"); + + while (s != NULL) { + ret = write_hex(p, s, width); +@@ -422,7 +447,7 @@ static int copy_data_hex(char *data, int off, const char *str, int width) + return ret; + } + +- s = strtok(NULL, ","); ++ s = strtok(NULL, ",:"); + p += width; + } + +-- +2.24.1 + + +From 1482d1f254fe42d83d904e52c911df8693b62653 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Sun, 29 Dec 2019 20:05:14 +0100 +Subject: [PATCH 50/69] topology: fix the TPLG_DEBUG compilation + +Signed-off-by: Jaroslav Kysela +--- + src/topology/channel.c | 2 +- + src/topology/data.c | 5 ++++- + src/topology/pcm.c | 2 +- + 3 files changed, 6 insertions(+), 3 deletions(-) + +diff --git a/src/topology/channel.c b/src/topology/channel.c +index 110775a8..390c3f16 100644 +--- a/src/topology/channel.c ++++ b/src/topology/channel.c +@@ -129,7 +129,7 @@ int tplg_parse_channel(snd_tplg_t *tplg, snd_config_t *cfg, + else if (strcmp(id, "shift") == 0) + channel->shift = value; + +- tplg_dbg("\t\t%s = %s\n", id, value); ++ tplg_dbg("\t\t%s = %d\n", id, value); + } + + tplg->channel_idx++; +diff --git a/src/topology/data.c b/src/topology/data.c +index 1ddd3c50..7b4bdccd 100644 +--- a/src/topology/data.c ++++ b/src/topology/data.c +@@ -230,9 +230,11 @@ err: + return ret; + } + +-static void dump_priv_data(struct tplg_elem *elem) ++static void dump_priv_data(struct tplg_elem *elem ATTRIBUTE_UNUSED) + { ++#ifdef TPLG_DEBUG + struct snd_soc_tplg_private *priv = elem->data; ++ unsigned char *p = (unsigned char *)priv->data; + unsigned int i; + + tplg_dbg(" elem size = %d, priv data size = %d\n", +@@ -246,6 +248,7 @@ static void dump_priv_data(struct tplg_elem *elem) + } + + tplg_dbg("\n\n"); ++#endif + } + + static inline int check_nibble(unsigned char c) +diff --git a/src/topology/pcm.c b/src/topology/pcm.c +index bc307081..8e5afbe6 100644 +--- a/src/topology/pcm.c ++++ b/src/topology/pcm.c +@@ -881,7 +881,7 @@ int tplg_parse_pcm(snd_tplg_t *tplg, snd_config_t *cfg, + + pcm->compress = ival; + +- tplg_dbg("\t%s: %s\n", id, val); ++ tplg_dbg("\t%s: %d\n", id, ival); + continue; + } + +-- +2.24.1 + + +From c765615bce7903a0f3e3d5e7826483708398c184 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 31 Dec 2019 15:27:58 +0100 +Subject: [PATCH 51/69] topology: fix the ops parser (accept integer/hexa + values) + +Signed-off-by: Jaroslav Kysela +--- + src/topology/ops.c | 36 +++++++++++++++++++++++++----------- + 1 file changed, 25 insertions(+), 11 deletions(-) + +diff --git a/src/topology/ops.c b/src/topology/ops.c +index ad72ef1b..2885c781 100644 +--- a/src/topology/ops.c ++++ b/src/topology/ops.c +@@ -67,6 +67,7 @@ int tplg_parse_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, snd_config_t *cfg, + snd_config_t *n; + struct snd_soc_tplg_ctl_hdr *hdr = private; + const char *id, *value; ++ int ival; + + tplg_dbg("\tOps\n"); + hdr->size = sizeof(*hdr); +@@ -80,17 +81,23 @@ int tplg_parse_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, snd_config_t *cfg, + continue; + + /* get value - try strings then ints */ +- if (snd_config_get_string(n, &value) < 0) +- continue; ++ if (snd_config_get_type(n) == SND_CONFIG_TYPE_STRING) { ++ if (snd_config_get_string(n, &value) < 0) ++ continue; ++ ival = lookup_ops(value); ++ } else { ++ if (tplg_get_integer(n, &ival, 0)) ++ continue; ++ } + + if (strcmp(id, "info") == 0) +- hdr->ops.info = lookup_ops(value); ++ hdr->ops.info = ival; + else if (strcmp(id, "put") == 0) +- hdr->ops.put = lookup_ops(value); ++ hdr->ops.put = ival; + else if (strcmp(id, "get") == 0) +- hdr->ops.get = lookup_ops(value); ++ hdr->ops.get = ival; + +- tplg_dbg("\t\t%s = %s\n", id, value); ++ tplg_dbg("\t\t%s = %d\n", id, ival); + } + + return 0; +@@ -146,6 +153,7 @@ int tplg_parse_ext_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, + snd_config_t *n; + struct snd_soc_tplg_bytes_control *be = private; + const char *id, *value; ++ int ival; + + tplg_dbg("\tExt Ops\n"); + +@@ -158,15 +166,21 @@ int tplg_parse_ext_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, + continue; + + /* get value - try strings then ints */ +- if (snd_config_get_string(n, &value) < 0) +- continue; ++ if (snd_config_get_type(n) == SND_CONFIG_TYPE_STRING) { ++ if (snd_config_get_string(n, &value) < 0) ++ continue; ++ ival = lookup_ops(value); ++ } else { ++ if (tplg_get_integer(n, &ival, 0)) ++ continue; ++ } + + if (strcmp(id, "info") == 0) +- be->ext_ops.info = lookup_ops(value); ++ be->ext_ops.info = ival; + else if (strcmp(id, "put") == 0) +- be->ext_ops.put = lookup_ops(value); ++ be->ext_ops.put = ival; + else if (strcmp(id, "get") == 0) +- be->ext_ops.get = lookup_ops(value); ++ be->ext_ops.get = ival; + + tplg_dbg("\t\t%s = %s\n", id, value); + } +-- +2.24.1 + + +From 0ba4d6d9c0ae4576f35724d2a5735990f09ceeb0 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 1 Jan 2020 19:10:20 +0100 +Subject: [PATCH 52/69] topology: fix the wrong memory access (object realloc) + +Signed-off-by: Jaroslav Kysela +--- + src/topology/pcm.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/src/topology/pcm.c b/src/topology/pcm.c +index 8e5afbe6..bd728959 100644 +--- a/src/topology/pcm.c ++++ b/src/topology/pcm.c +@@ -252,8 +252,8 @@ static int build_link(snd_tplg_t *tplg, struct tplg_elem *elem) + ref->id, SND_TPLG_TYPE_HW_CONFIG, elem->index); + if (!ref->elem) { + SNDERR("cannot find HW config '%s'" +- " referenced by link '%s'", +- ref->id, elem->id); ++ " referenced by link '%s'", ++ ref->id, elem->id); + return -EINVAL; + } + +@@ -267,6 +267,7 @@ static int build_link(snd_tplg_t *tplg, struct tplg_elem *elem) + err = tplg_copy_data(tplg, elem, ref); + if (err < 0) + return err; ++ link = elem->link; /* realloc */ + break; + + default: +-- +2.24.1 + + +From b6c9afb4f59bb678dc834028680d579f47dc273b Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Sun, 15 Dec 2019 15:24:57 +0100 +Subject: [PATCH 53/69] topology: implement snd_tplg_decode + +Signed-off-by: Jaroslav Kysela +--- + include/topology.h | 14 +- + src/topology/Makefile.am | 3 +- + src/topology/ctl.c | 450 +++++++++++++++++++++++++++++++++----- + src/topology/dapm.c | 253 +++++++++++++++++++-- + src/topology/data.c | 440 ++++++++++++++++++++++++++++++++++++- + src/topology/decoder.c | 136 ++++++++++++ + src/topology/elem.c | 80 +++++++ + src/topology/parser.c | 20 +- + src/topology/pcm.c | 396 ++++++++++++++++++++++++++++----- + src/topology/save.c | 3 + + src/topology/tplg_local.h | 71 +++++- + 11 files changed, 1727 insertions(+), 139 deletions(-) + create mode 100644 src/topology/decoder.c + +diff --git a/include/topology.h b/include/topology.h +index 37bced1a..1f52e66e 100644 +--- a/include/topology.h ++++ b/include/topology.h +@@ -885,7 +885,10 @@ struct snd_tplg_ctl_template { + const char *name; /*!< Control name */ + int access; /*!< Control access */ + struct snd_tplg_io_ops_template ops; /*!< operations */ +- struct snd_tplg_tlv_template *tlv; /*!< non NULL means we have TLV data */ ++ union { ++ struct snd_tplg_tlv_template *tlv; /*!< non NULL means we have TLV data */ ++ struct snd_tplg_tlv_dbscale_template *tlv_scale; /*!< scale TLV data */ ++ }; + }; + + /** \struct snd_tplg_mixer_template +@@ -1155,6 +1158,15 @@ int snd_tplg_set_version(snd_tplg_t *tplg, unsigned int version); + */ + int snd_tplg_save(snd_tplg_t *tplg, char **dst, int flags); + ++/** ++ * \brief Decode the binary topology contents. ++ * \param tplg Topology instance. ++ * \param bin Binary topology input buffer. ++ * \param size Binary topology input buffer size. ++ * \return Zero on success, otherwise a negative error code ++ */ ++int snd_tplg_decode(snd_tplg_t *tplg, void *bin, size_t size, int dflags); ++ + /* \} */ + + #ifdef __cplusplus +diff --git a/src/topology/Makefile.am b/src/topology/Makefile.am +index a850ec4c..12d1d445 100644 +--- a/src/topology/Makefile.am ++++ b/src/topology/Makefile.am +@@ -28,7 +28,8 @@ libatopology_la_SOURCES =\ + channel.c \ + ops.c \ + elem.c \ +- save.c ++ save.c \ ++ decoder.c + + noinst_HEADERS = tplg_local.h + +diff --git a/src/topology/ctl.c b/src/topology/ctl.c +index 03874b27..24d437aa 100644 +--- a/src/topology/ctl.c ++++ b/src/topology/ctl.c +@@ -621,8 +621,9 @@ int tplg_parse_control_enum(snd_tplg_t *tplg, snd_config_t *cfg, + tplg->channel_idx = 0; + + /* set channel reg to default state */ +- for (j = 0; j < SND_SOC_TPLG_MAX_CHAN; j++) ++ for (j = 0; j < SND_SOC_TPLG_MAX_CHAN; j++) { + ec->channel[j].reg = -1; ++ } + + tplg_dbg(" Control Enum: %s\n", elem->id); + +@@ -896,9 +897,14 @@ int tplg_save_control_mixer(snd_tplg_t *tplg ATTRIBUTE_UNUSED, + return err; + } + +-static int init_ctl_hdr(struct snd_soc_tplg_ctl_hdr *hdr, +- struct snd_tplg_ctl_template *t) ++static int init_ctl_hdr(snd_tplg_t *tplg, ++ struct tplg_elem *parent, ++ struct snd_soc_tplg_ctl_hdr *hdr, ++ struct snd_tplg_ctl_template *t) + { ++ struct tplg_elem *elem; ++ int err; ++ + hdr->size = sizeof(struct snd_soc_tplg_ctl_hdr); + hdr->type = t->type; + +@@ -924,7 +930,7 @@ static int init_ctl_hdr(struct snd_soc_tplg_ctl_hdr *hdr, + && !(hdr->access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK)) { + + struct snd_tplg_tlv_template *tlvt = t->tlv; +- struct snd_soc_tplg_ctl_tlv *tlv = &hdr->tlv; ++ struct snd_soc_tplg_ctl_tlv *tlv; + struct snd_tplg_tlv_dbscale_template *scalet; + struct snd_soc_tplg_tlv_dbscale *scale; + +@@ -933,6 +939,17 @@ static int init_ctl_hdr(struct snd_soc_tplg_ctl_hdr *hdr, + return -EINVAL; + } + ++ elem = tplg_elem_new_common(tplg, NULL, parent->id, ++ SND_TPLG_TYPE_TLV); ++ if (!elem) ++ return -ENOMEM; ++ ++ tlv = elem->tlv; ++ ++ err = tplg_ref_add(parent, SND_TPLG_TYPE_TLV, parent->id); ++ if (err < 0) ++ return err; ++ + tlv->size = sizeof(struct snd_soc_tplg_ctl_tlv); + tlv->type = tlvt->type; + +@@ -957,10 +974,10 @@ static int init_ctl_hdr(struct snd_soc_tplg_ctl_hdr *hdr, + } + + int tplg_add_mixer(snd_tplg_t *tplg, struct snd_tplg_mixer_template *mixer, +- struct tplg_elem **e) ++ struct tplg_elem **e) + { +- struct snd_soc_tplg_private *priv = mixer->priv; + struct snd_soc_tplg_mixer_control *mc; ++ struct snd_soc_tplg_private *priv; + struct tplg_elem *elem; + int ret, i, num_channels; + +@@ -979,7 +996,7 @@ int tplg_add_mixer(snd_tplg_t *tplg, struct snd_tplg_mixer_template *mixer, + /* init new mixer */ + mc = elem->mixer_ctrl; + mc->size = elem->size; +- ret = init_ctl_hdr(&mc->hdr, &mixer->hdr); ++ ret = init_ctl_hdr(tplg, elem, &mc->hdr, &mixer->hdr); + if (ret < 0) { + tplg_elem_free(elem); + return ret; +@@ -1000,25 +1017,20 @@ int tplg_add_mixer(snd_tplg_t *tplg, struct snd_tplg_mixer_template *mixer, + for (i = 0; i < num_channels; i++) { + struct snd_tplg_channel_elem *channel = &mixer->map->channel[i]; + +- mc->channel[i].size = channel->size; ++ mc->channel[i].size = sizeof(mc->channel[0]); + mc->channel[i].reg = channel->reg; + mc->channel[i].shift = channel->shift; + mc->channel[i].id = channel->id; + } + + /* priv data */ +- if (priv) { +- mc = realloc(mc, elem->size + priv->size); +- if (!mc) { +- tplg_elem_free(elem); +- return -ENOMEM; +- } +- +- elem->mixer_ctrl = mc; +- elem->size += priv->size; +- mc->priv.size = priv->size; +- memcpy(mc->priv.data, priv->data, priv->size); +- } ++ priv = mixer->priv; ++ if (priv && priv->size > 0) { ++ ret = tplg_add_data(tplg, elem, priv, ++ sizeof(*priv) + priv->size); ++ if (ret < 0) ++ return ret; ++ } + + if (e) + *e = elem; +@@ -1026,11 +1038,12 @@ int tplg_add_mixer(snd_tplg_t *tplg, struct snd_tplg_mixer_template *mixer, + } + + int tplg_add_enum(snd_tplg_t *tplg, struct snd_tplg_enum_template *enum_ctl, +- struct tplg_elem **e) ++ struct tplg_elem **e) + { + struct snd_soc_tplg_enum_control *ec; ++ struct snd_soc_tplg_private *priv; + struct tplg_elem *elem; +- int ret, i, num_items; ++ int ret, i, num_items, num_channels; + + tplg_dbg(" Control Enum: %s\n", enum_ctl->hdr.name); + +@@ -1046,7 +1059,7 @@ int tplg_add_enum(snd_tplg_t *tplg, struct snd_tplg_enum_template *enum_ctl, + + ec = elem->enum_ctrl; + ec->size = elem->size; +- ret = init_ctl_hdr(&ec->hdr, &enum_ctl->hdr); ++ ret = init_ctl_hdr(tplg, elem, &ec->hdr, &enum_ctl->hdr); + if (ret < 0) { + tplg_elem_free(elem); + return ret; +@@ -1058,6 +1071,22 @@ int tplg_add_enum(snd_tplg_t *tplg, struct snd_tplg_enum_template *enum_ctl, + ec->mask = enum_ctl->mask; + ec->count = enum_ctl->items; + ++ /* set channel reg to default state */ ++ for (i = 0; i < SND_SOC_TPLG_MAX_CHAN; i++) ++ ec->channel[i].reg = -1; ++ ++ num_channels = enum_ctl->map ? enum_ctl->map->num_channels : 0; ++ ec->num_channels = num_channels; ++ ++ for (i = 0; i < num_channels; i++) { ++ struct snd_tplg_channel_elem *channel = &enum_ctl->map->channel[i]; ++ ++ ec->channel[i].size = sizeof(ec->channel[0]); ++ ec->channel[i].reg = channel->reg; ++ ec->channel[i].shift = channel->shift; ++ ec->channel[i].id = channel->id; ++ } ++ + if (enum_ctl->texts != NULL) { + for (i = 0; i < num_items; i++) { + if (enum_ctl->texts[i] != NULL) +@@ -1077,21 +1106,13 @@ int tplg_add_enum(snd_tplg_t *tplg, struct snd_tplg_enum_template *enum_ctl, + } + } + +- if (enum_ctl->priv != NULL) { +- ec = realloc(ec, +- elem->size + enum_ctl->priv->size); +- if (!ec) { +- tplg_elem_free(elem); +- return -ENOMEM; +- } +- +- elem->enum_ctrl = ec; +- elem->size += enum_ctl->priv->size; +- +- memcpy(ec->priv.data, enum_ctl->priv->data, +- enum_ctl->priv->size); +- +- ec->priv.size = enum_ctl->priv->size; ++ /* priv data */ ++ priv = enum_ctl->priv; ++ if (priv && priv->size > 0) { ++ ret = tplg_add_data(tplg, elem, priv, ++ sizeof(*priv) + priv->size); ++ if (ret < 0) ++ return ret; + } + + if (e) +@@ -1100,9 +1121,10 @@ int tplg_add_enum(snd_tplg_t *tplg, struct snd_tplg_enum_template *enum_ctl, + } + + int tplg_add_bytes(snd_tplg_t *tplg, struct snd_tplg_bytes_template *bytes_ctl, +- struct tplg_elem **e) ++ struct tplg_elem **e) + { + struct snd_soc_tplg_bytes_control *be; ++ struct snd_soc_tplg_private *priv; + struct tplg_elem *elem; + int ret; + +@@ -1120,7 +1142,7 @@ int tplg_add_bytes(snd_tplg_t *tplg, struct snd_tplg_bytes_template *bytes_ctl, + + be = elem->bytes_ext; + be->size = elem->size; +- ret = init_ctl_hdr(&be->hdr, &bytes_ctl->hdr); ++ ret = init_ctl_hdr(tplg, elem, &be->hdr, &bytes_ctl->hdr); + if (ret < 0) { + tplg_elem_free(elem); + return ret; +@@ -1133,20 +1155,13 @@ int tplg_add_bytes(snd_tplg_t *tplg, struct snd_tplg_bytes_template *bytes_ctl, + be->ext_ops.put = bytes_ctl->ext_ops.put; + be->ext_ops.get = bytes_ctl->ext_ops.get; + +- if (bytes_ctl->priv != NULL) { +- be = realloc(be, +- elem->size + bytes_ctl->priv->size); +- if (!be) { +- tplg_elem_free(elem); +- return -ENOMEM; +- } +- elem->bytes_ext = be; +- elem->size += bytes_ctl->priv->size; +- +- memcpy(be->priv.data, bytes_ctl->priv->data, +- bytes_ctl->priv->size); +- +- be->priv.size = bytes_ctl->priv->size; ++ /* priv data */ ++ priv = bytes_ctl->priv; ++ if (priv && priv->size > 0) { ++ ret = tplg_add_data(tplg, elem, priv, ++ sizeof(*priv) + priv->size); ++ if (ret < 0) ++ return ret; + } + + /* check on TLV bytes control */ +@@ -1184,3 +1199,330 @@ int tplg_add_bytes_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) + { + return tplg_add_bytes(tplg, t->bytes_ctl, NULL); + } ++ ++int tplg_decode_control_mixer1(snd_tplg_t *tplg, ++ struct list_head *heap, ++ struct snd_tplg_mixer_template *mt, ++ size_t pos, ++ void *bin, size_t size) ++{ ++ struct snd_soc_tplg_mixer_control *mc = bin; ++ struct snd_tplg_channel_map_template *map; ++ struct snd_tplg_tlv_dbscale_template *db; ++ int i; ++ ++ if (size < sizeof(*mc)) { ++ SNDERR("mixer: small size %d", size); ++ return -EINVAL; ++ } ++ ++ tplg_dv(tplg, pos, "mixer: size %d TLV size %d private size %d", ++ mc->size, mc->hdr.tlv.size, mc->priv.size); ++ if (size != mc->size + mc->priv.size) { ++ SNDERR("mixer: unexpected element size %d", size); ++ return -EINVAL; ++ } ++ ++ memset(mt, 0, sizeof(*mt)); ++ mt->hdr.type = mc->hdr.type; ++ mt->hdr.name = mc->hdr.name; ++ mt->hdr.access = mc->hdr.access; ++ mt->hdr.ops.get = mc->hdr.ops.get; ++ mt->hdr.ops.put = mc->hdr.ops.put; ++ mt->hdr.ops.info = mc->hdr.ops.info; ++ mt->min = mc->min; ++ mt->max = mc->max; ++ mt->platform_max = mc->platform_max; ++ tplg_dv(tplg, pos, "mixer: name '%s' access 0x%x", ++ mt->hdr.name, mt->hdr.access); ++ if (mc->num_channels > 0) { ++ map = tplg_calloc(heap, sizeof(*map)); ++ map->num_channels = mc->num_channels; ++ for (i = 0; i < map->num_channels; i++) { ++ map->channel[i].reg = mc->channel[i].reg; ++ map->channel[i].shift = mc->channel[i].shift; ++ map->channel[i].id = mc->channel[i].id; ++ } ++ mt->map = map; ++ } ++ if (mc->hdr.tlv.size == 0) { ++ /* nothing */ ++ } else if (mc->hdr.tlv.size == sizeof(struct snd_soc_tplg_ctl_tlv)) { ++ if (mc->hdr.tlv.type != SNDRV_CTL_TLVT_DB_SCALE) { ++ SNDERR("mixer: unknown TLV type %d", ++ mc->hdr.tlv.type); ++ return -EINVAL; ++ } ++ db = tplg_calloc(heap, sizeof(*db)); ++ if (db == NULL) ++ return -ENOMEM; ++ mt->hdr.tlv_scale = db; ++ db->hdr.type = mc->hdr.tlv.type; ++ db->min = mc->hdr.tlv.scale.min; ++ db->step = mc->hdr.tlv.scale.step; ++ db->mute = mc->hdr.tlv.scale.mute; ++ tplg_dv(tplg, pos, "mixer: dB scale TLV: min %d step %d mute %d", ++ db->min, db->step, db->mute); ++ } else { ++ SNDERR("mixer: wrong TLV size %d", mc->hdr.tlv.size); ++ return -EINVAL; ++ } ++ ++ mt->priv = &mc->priv; ++ tplg_dv(tplg, pos + offsetof(struct snd_soc_tplg_mixer_control, priv), ++ "mixer: private start"); ++ return 0; ++} ++ ++int tplg_decode_control_mixer(snd_tplg_t *tplg, ++ size_t pos, ++ struct snd_soc_tplg_hdr *hdr, ++ void *bin, size_t size) ++{ ++ struct list_head heap; ++ snd_tplg_obj_template_t t; ++ struct snd_tplg_mixer_template mt; ++ struct snd_soc_tplg_mixer_control *mc; ++ size_t size2; ++ int err; ++ ++ err = tplg_decode_template(tplg, pos, hdr, &t); ++ if (err < 0) ++ return err; ++ ++next: ++ if (size < sizeof(*mc)) { ++ SNDERR("mixer: small size %d", size); ++ return -EINVAL; ++ } ++ INIT_LIST_HEAD(&heap); ++ mc = bin; ++ size2 = mc->size + mc->priv.size; ++ if (size2 > size) { ++ SNDERR("mixer: wrong element size (%d, priv %d)", ++ mc->size, mc->priv.size); ++ return -EINVAL; ++ } ++ ++ err = tplg_decode_control_mixer1(tplg, &heap, &mt, pos, bin, size2); ++ if (err >= 0) { ++ t.mixer = &mt; ++ err = snd_tplg_add_object(tplg, &t); ++ } ++ tplg_free(&heap); ++ if (err < 0) ++ return err; ++ ++ bin += size2; ++ size -= size2; ++ pos += size2; ++ ++ if (size > 0) ++ goto next; ++ ++ return 0; ++} ++ ++int tplg_decode_control_enum1(snd_tplg_t *tplg, ++ struct list_head *heap, ++ struct snd_tplg_enum_template *et, ++ size_t pos, ++ void *bin, size_t size) ++{ ++ struct snd_soc_tplg_enum_control *ec = bin; ++ struct snd_tplg_channel_map_template cmt; ++ int i; ++ ++ if (size < sizeof(*ec)) { ++ SNDERR("enum: small size %d", size); ++ return -EINVAL; ++ } ++ ++ tplg_dv(tplg, pos, "enum: size %d private size %d", ++ ec->size, ec->priv.size); ++ if (size != ec->size + ec->priv.size) { ++ SNDERR("enum: unexpected element size %d", size); ++ return -EINVAL; ++ } ++ if (ec->num_channels > SND_TPLG_MAX_CHAN || ++ ec->num_channels > SND_SOC_TPLG_MAX_CHAN) { ++ SNDERR("enum: unexpected channel count %d", ec->num_channels); ++ return -EINVAL; ++ } ++ if (ec->items > SND_SOC_TPLG_NUM_TEXTS) { ++ SNDERR("enum: unexpected texts count %d", ec->items); ++ return -EINVAL; ++ } ++ ++ memset(et, 0, sizeof(*et)); ++ et->hdr.type = ec->hdr.type; ++ et->hdr.name = ec->hdr.name; ++ et->hdr.access = ec->hdr.access; ++ et->hdr.ops.get = ec->hdr.ops.get; ++ et->hdr.ops.put = ec->hdr.ops.put; ++ et->hdr.ops.info = ec->hdr.ops.info; ++ et->mask = ec->mask; ++ ++ if (ec->items > 0) { ++ et->items = ec->items; ++ et->texts = tplg_calloc(heap, sizeof(char *) * ec->items); ++ if (!et->texts) ++ return -ENOMEM; ++ for (i = 0; ec->items; i++) { ++ unsigned int j = i * sizeof(int) * ENUM_VAL_SIZE; ++ et->texts[i] = ec->texts[i]; ++ et->values[i] = (int *)&ec->values[j]; ++ } ++ } ++ ++ et->map = &cmt; ++ memset(&cmt, 0, sizeof(cmt)); ++ cmt.num_channels = ec->num_channels; ++ for (i = 0; i < cmt.num_channels; i++) { ++ struct snd_tplg_channel_elem *channel = &cmt.channel[i]; ++ tplg_dv(tplg, pos + ((void *)&ec->channel[i] - (void *)ec), ++ "enum: channel size %d", ec->channel[i].size); ++ channel->reg = ec->channel[i].reg; ++ channel->shift = ec->channel[i].shift; ++ channel->id = ec->channel[i].id; ++ } ++ ++ et->priv = &ec->priv; ++ return 0; ++} ++ ++int tplg_decode_control_enum(snd_tplg_t *tplg, ++ size_t pos, ++ struct snd_soc_tplg_hdr *hdr, ++ void *bin, size_t size) ++{ ++ struct list_head heap; ++ snd_tplg_obj_template_t t; ++ struct snd_tplg_enum_template et; ++ struct snd_soc_tplg_enum_control *ec; ++ size_t size2; ++ int err; ++ ++ err = tplg_decode_template(tplg, pos, hdr, &t); ++ if (err < 0) ++ return err; ++ ++next: ++ if (size < sizeof(*ec)) { ++ SNDERR("enum: small size %d", size); ++ return -EINVAL; ++ } ++ INIT_LIST_HEAD(&heap); ++ ec = bin; ++ size2 = ec->size + ec->priv.size; ++ if (size2 > size) { ++ SNDERR("enum: wrong element size (%d, priv %d)", ++ ec->size, ec->priv.size); ++ return -EINVAL; ++ } ++ ++ err = tplg_decode_control_enum1(tplg, &heap, &et, pos, bin, size); ++ if (err >= 0) { ++ t.enum_ctl = &et; ++ err = snd_tplg_add_object(tplg, &t); ++ } ++ tplg_free(&heap); ++ if (err < 0) ++ return err; ++ ++ bin += size2; ++ size -= size2; ++ pos += size2; ++ ++ if (size > 0) ++ goto next; ++ ++ return 0; ++} ++ ++int tplg_decode_control_bytes1(snd_tplg_t *tplg, ++ struct snd_tplg_bytes_template *bt, ++ size_t pos, ++ void *bin, size_t size) ++{ ++ struct snd_soc_tplg_bytes_control *bc = bin; ++ ++ if (size < sizeof(*bc)) { ++ SNDERR("bytes: small size %d", size); ++ return -EINVAL; ++ } ++ ++ tplg_dv(tplg, pos, "control bytes: size %d private size %d", ++ bc->size, bc->priv.size); ++ if (size != bc->size + bc->priv.size) { ++ SNDERR("bytes: unexpected element size %d", size); ++ return -EINVAL; ++ } ++ ++ memset(bt, 0, sizeof(*bt)); ++ bt->hdr.type = bc->hdr.type; ++ bt->hdr.name = bc->hdr.name; ++ bt->hdr.access = bc->hdr.access; ++ bt->hdr.ops.get = bc->hdr.ops.get; ++ bt->hdr.ops.put = bc->hdr.ops.put; ++ bt->hdr.ops.info = bc->hdr.ops.info; ++ bt->max = bc->max; ++ bt->mask = bc->mask; ++ bt->base = bc->base; ++ bt->num_regs = bc->num_regs; ++ bt->ext_ops.get = bc->ext_ops.get; ++ bt->ext_ops.put = bc->ext_ops.put; ++ bt->ext_ops.info = bc->ext_ops.info; ++ tplg_dv(tplg, pos, "control bytes: name '%s' access 0x%x", ++ bt->hdr.name, bt->hdr.access); ++ ++ bt->priv = &bc->priv; ++ return 0; ++} ++ ++int tplg_decode_control_bytes(snd_tplg_t *tplg, ++ size_t pos, ++ struct snd_soc_tplg_hdr *hdr, ++ void *bin, size_t size) ++{ ++ snd_tplg_obj_template_t t; ++ struct snd_tplg_bytes_template bt; ++ struct snd_soc_tplg_bytes_control *bc; ++ size_t size2; ++ int err; ++ ++ err = tplg_decode_template(tplg, pos, hdr, &t); ++ if (err < 0) ++ return err; ++ ++next: ++ if (size < sizeof(*bc)) { ++ SNDERR("bytes: small size %d", size); ++ return -EINVAL; ++ } ++ bc = bin; ++ size2 = bc->size + bc->priv.size; ++ if (size2 > size) { ++ SNDERR("bytes: wrong element size (%d, priv %d)", ++ bc->size, bc->priv.size); ++ return -EINVAL; ++ } ++ ++ err = tplg_decode_control_bytes1(tplg, &bt, pos, bin, size); ++ if (err < 0) ++ return err; ++ ++ t.bytes_ctl = &bt; ++ err = snd_tplg_add_object(tplg, &t); ++ if (err < 0) ++ return err; ++ ++ bin += size2; ++ size -= size2; ++ pos += size2; ++ ++ if (size > 0) ++ goto next; ++ ++ return 0; ++} +diff --git a/src/topology/dapm.c b/src/topology/dapm.c +index 88bddca3..9fab2d92 100644 +--- a/src/topology/dapm.c ++++ b/src/topology/dapm.c +@@ -420,19 +420,39 @@ int tplg_save_dapm_graph(snd_tplg_t *tplg, int index, char **dst, const char *pf + struct snd_soc_tplg_dapm_graph_elem *route; + struct list_head *pos; + struct tplg_elem *elem; +- int err, first = 1, old_index = -1; +- unsigned block = -1, count = 0; ++ int err, first, old_index; ++ unsigned block, count; ++ const char *fmt; + ++ old_index = -1; ++ block = 0; ++ count = 0; + list_for_each(pos, &tplg->route_list) { + elem = list_entry(pos, struct tplg_elem, list); + if (!elem->route || elem->type != SND_TPLG_TYPE_DAPM_GRAPH) + continue; + if (index >= 0 && elem->index != index) + continue; ++ if (old_index != elem->index) { ++ block++; ++ old_index = elem->index; ++ } + count++; + } + if (count == 0) + return 0; ++ if (block < 10) { ++ fmt = "\tset%u {\n"; ++ } else if (block < 100) { ++ fmt = "\tset%02u {\n"; ++ } else if (block < 1000) { ++ fmt = "\tset%03u {\n"; ++ } else { ++ return -EINVAL; ++ } ++ old_index = -1; ++ block = -1; ++ first = 1; + err = tplg_save_printf(dst, pfx, "SectionGraph {\n"); + list_for_each(pos, &tplg->route_list) { + elem = list_entry(pos, struct tplg_elem, list); +@@ -452,7 +472,7 @@ int tplg_save_dapm_graph(snd_tplg_t *tplg, int index, char **dst, const char *pf + old_index = elem->index; + block++; + first = 1; +- err = tplg_save_printf(dst, pfx, "\tset%u {\n", block); ++ err = tplg_save_printf(dst, pfx, fmt, block); + if (err >= 0) + err = tplg_save_printf(dst, pfx, "\t\tindex %u\n", + elem->index); +@@ -771,20 +791,14 @@ int tplg_add_widget_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) + w->event_flags = wt->event_flags; + w->event_type = wt->event_type; + +- if (wt->priv != NULL) { +- w = realloc(w, +- elem->size + wt->priv->size); +- if (!w) { ++ /* add private data */ ++ if (wt->priv != NULL && wt->priv->size > 0) { ++ ret = tplg_add_data(tplg, elem, wt->priv, ++ sizeof(*wt->priv) + wt->priv->size); ++ if (ret < 0) { + tplg_elem_free(elem); +- return -ENOMEM; ++ return ret; + } +- +- elem->widget = w; +- elem->size += wt->priv->size; +- +- memcpy(w->priv.data, wt->priv->data, +- wt->priv->size); +- w->priv.size = wt->priv->size; + } + + /* add controls to the widget's reference list */ +@@ -836,3 +850,212 @@ int tplg_add_widget_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) + + return 0; + } ++ ++/* decode dapm widget from the binary input */ ++int tplg_decode_dapm_widget(snd_tplg_t *tplg, ++ size_t pos, ++ struct snd_soc_tplg_hdr *hdr, ++ void *bin, size_t size) ++{ ++ struct list_head heap; ++ struct snd_soc_tplg_dapm_widget *w; ++ snd_tplg_obj_template_t t; ++ struct snd_tplg_widget_template *wt; ++ struct snd_tplg_mixer_template *mt; ++ struct snd_tplg_enum_template *et; ++ struct snd_tplg_bytes_template *bt; ++ struct snd_soc_tplg_ctl_hdr *chdr; ++ struct snd_soc_tplg_mixer_control *mc; ++ struct snd_soc_tplg_enum_control *ec; ++ struct snd_soc_tplg_bytes_control *bc; ++ size_t size2; ++ unsigned int index; ++ int err; ++ ++ err = tplg_decode_template(tplg, pos, hdr, &t); ++ if (err < 0) ++ return err; ++ ++next: ++ INIT_LIST_HEAD(&heap); ++ w = bin; ++ ++ if (size < sizeof(*w)) { ++ SNDERR("dapm widget: small size %d", size); ++ return -EINVAL; ++ } ++ if (sizeof(*w) != w->size) { ++ SNDERR("dapm widget: unknown element size %d (expected %zd)", ++ w->size, sizeof(*w)); ++ return -EINVAL; ++ } ++ if (w->num_kcontrols > 16) { ++ SNDERR("dapm widget: too many kcontrols %d", ++ w->num_kcontrols); ++ return -EINVAL; ++ } ++ ++ tplg_dv(tplg, pos, "dapm widget: size %d private size %d kcontrols %d", ++ w->size, w->priv.size, w->num_kcontrols); ++ ++ wt = tplg_calloc(&heap, sizeof(*wt) + sizeof(void *) * w->num_kcontrols); ++ if (wt == NULL) ++ return -ENOMEM; ++ wt->id = w->id; ++ wt->name = w->name; ++ wt->sname = w->sname; ++ wt->reg = w->reg; ++ wt->shift = w->shift; ++ wt->mask = w->mask; ++ wt->subseq = w->subseq; ++ wt->invert = w->invert; ++ wt->ignore_suspend = w->ignore_suspend; ++ wt->event_flags = w->event_flags; ++ wt->event_type = w->event_type; ++ ++ tplg_dv(tplg, pos, "dapm widget: name '%s' sname '%s'", wt->name, wt->sname); ++ ++ if (sizeof(*w) + w->priv.size > size) { ++ SNDERR("dapm widget: wrong private data size %d", ++ w->priv.size); ++ return -EINVAL; ++ } ++ ++ tplg_dv(tplg, pos + offsetof(struct snd_soc_tplg_dapm_widget, priv), ++ "dapm widget: private start"); ++ ++ wt->priv = &w->priv; ++ bin += sizeof(*w) + w->priv.size; ++ size -= sizeof(*w) + w->priv.size; ++ pos += sizeof(*w) + w->priv.size; ++ ++ for (index = 0; index < w->num_kcontrols; index++) { ++ chdr = bin; ++ switch (chdr->type) { ++ case SND_SOC_TPLG_TYPE_MIXER: ++ mt = tplg_calloc(&heap, sizeof(*mt)); ++ if (mt == NULL) { ++ err = -ENOMEM; ++ goto retval; ++ } ++ wt->ctl[index] = (void *)mt; ++ wt->num_ctls++; ++ mc = bin; ++ size2 = mc->size + mc->priv.size; ++ tplg_dv(tplg, pos, "kcontrol mixer size %zd", size2); ++ if (size2 > size) { ++ SNDERR("dapm widget: small mixer size %d", ++ size2); ++ err = -EINVAL; ++ goto retval; ++ } ++ err = tplg_decode_control_mixer1(tplg, &heap, mt, pos, ++ bin, size2); ++ break; ++ case SND_SOC_TPLG_TYPE_ENUM: ++ et = tplg_calloc(&heap, sizeof(*mt)); ++ if (et == NULL) { ++ err = -ENOMEM; ++ goto retval; ++ } ++ wt->ctl[index] = (void *)et; ++ wt->num_ctls++; ++ ec = bin; ++ size2 = ec->size + ec->priv.size; ++ tplg_dv(tplg, pos, "kcontrol enum size %zd", size2); ++ if (size2 > size) { ++ SNDERR("dapm widget: small enum size %d", ++ size2); ++ err = -EINVAL; ++ goto retval; ++ } ++ err = tplg_decode_control_enum1(tplg, &heap, et, pos, ++ bin, size2); ++ break; ++ case SND_SOC_TPLG_TYPE_BYTES: ++ bt = tplg_calloc(&heap, sizeof(*bt)); ++ if (bt == NULL) { ++ err = -ENOMEM; ++ goto retval; ++ } ++ wt->ctl[index] = (void *)bt; ++ wt->num_ctls++; ++ bc = bin; ++ size2 = bc->size + bc->priv.size; ++ tplg_dv(tplg, pos, "kcontrol bytes size %zd", size2); ++ if (size2 > size) { ++ SNDERR("dapm widget: small bytes size %d", ++ size2); ++ err = -EINVAL; ++ goto retval; ++ } ++ err = tplg_decode_control_bytes1(tplg, bt, pos, ++ bin, size2); ++ break; ++ default: ++ SNDERR("dapm widget: wrong control type %d", ++ chdr->type); ++ err = -EINVAL; ++ goto retval; ++ } ++ if (err < 0) ++ goto retval; ++ bin += size2; ++ size -= size2; ++ pos += size2; ++ } ++ ++ t.widget = wt; ++ err = snd_tplg_add_object(tplg, &t); ++ tplg_free(&heap); ++ if (err < 0) ++ return err; ++ if (size > 0) ++ goto next; ++ return 0; ++ ++retval: ++ tplg_free(&heap); ++ return err; ++} ++ ++/* decode dapm link from the binary input */ ++int tplg_decode_dapm_graph(snd_tplg_t *tplg, ++ size_t pos, ++ struct snd_soc_tplg_hdr *hdr, ++ void *bin, size_t size) ++{ ++ struct snd_soc_tplg_dapm_graph_elem *g; ++ snd_tplg_obj_template_t t; ++ struct snd_tplg_graph_template *gt; ++ struct snd_tplg_graph_elem *ge; ++ size_t asize; ++ int err; ++ ++ err = tplg_decode_template(tplg, pos, hdr, &t); ++ if (err < 0) ++ return err; ++ ++ asize = sizeof(*gt) + (size / sizeof(*g)) * sizeof(*ge); ++ gt = alloca(asize); ++ memset(gt, 0, asize); ++ for (ge = gt->elem; size > 0; ge++) { ++ g = bin; ++ if (size < sizeof(*g)) { ++ SNDERR("dapm graph: small size %d", size); ++ return -EINVAL; ++ } ++ ge->src = g->source; ++ ge->ctl = g->control; ++ ge->sink = g->sink; ++ gt->count++; ++ tplg_dv(tplg, pos, "dapm graph: src='%s' ctl='%s' sink='%s'", ++ ge->src, ge->ctl, ge->sink); ++ bin += sizeof(*g); ++ size -= sizeof(*g); ++ pos += sizeof(*g); ++ } ++ ++ t.graph = gt; ++ return snd_tplg_add_object(tplg, &t); ++} +diff --git a/src/topology/data.c b/src/topology/data.c +index 7b4bdccd..64563920 100644 +--- a/src/topology/data.c ++++ b/src/topology/data.c +@@ -566,7 +566,7 @@ static bool has_tuples(struct tplg_elem *elem) + } + + /* get size of a tuple element from its type */ +-static unsigned int get_tuple_size(int type) ++unsigned int tplg_get_tuple_size(int type) + { + switch (type) { + +@@ -602,7 +602,7 @@ static int copy_tuples(struct tplg_elem *elem, + for (i = 0; i < tuples->num_sets ; i++) { + tuple_set = tuples->set[i]; + set_size = sizeof(struct snd_soc_tplg_vendor_array) +- + get_tuple_size(tuple_set->type) ++ + tplg_get_tuple_size(tuple_set->type) + * tuple_set->num_tuples; + size += set_size; + if (size > TPLG_MAX_PRIV_SIZE) { +@@ -1250,6 +1250,9 @@ int tplg_save_manifest_data(snd_tplg_t *tplg ATTRIBUTE_UNUSED, + continue; + count++; + } ++ if (count == 0) ++ return tplg_save_printf(dst, NULL, ++ "'%s'.comment 'empty'\n", elem->id); + if (count > 1) { + err = tplg_save_printf(dst, NULL, "'%s'.data [\n", elem->id); + if (err < 0) +@@ -1557,3 +1560,436 @@ int tplg_build_data(snd_tplg_t *tplg) + + return 0; + } ++ ++/* decode manifest data */ ++int tplg_decode_manifest_data(snd_tplg_t *tplg, ++ size_t pos, ++ struct snd_soc_tplg_hdr *hdr, ++ void *bin, size_t size) ++{ ++ struct snd_soc_tplg_manifest *m = bin; ++ struct tplg_elem *elem; ++ size_t off; ++ ++ if (hdr->index != 0) { ++ SNDERR("manifest - wrong index %d", hdr->index); ++ return -EINVAL; ++ } ++ ++ if (sizeof(*m) > size) { ++ SNDERR("manifest - wrong size %zd (minimal %zd)", ++ size, sizeof(*m)); ++ return -EINVAL; ++ } ++ ++ if (m->size != sizeof(*m)) { ++ SNDERR("manifest - wrong sructure size %d", m->size); ++ return -EINVAL; ++ } ++ ++ off = offsetof(struct snd_soc_tplg_manifest, priv); ++ if (off + m->priv.size > size) { ++ SNDERR("manifest - wrong private size %d", m->priv.size); ++ return -EINVAL; ++ } ++ ++ tplg->manifest = *m; ++ ++ bin += off; ++ size -= off; ++ pos += off; ++ ++ elem = tplg_elem_new_common(tplg, NULL, "manifest", ++ SND_TPLG_TYPE_MANIFEST); ++ if (!elem) ++ return -ENOMEM; ++ ++ tplg_dv(tplg, pos, "manifest: private size %d", size); ++ return tplg_add_data(tplg, elem, bin, size); ++} ++ ++int tplg_add_token(snd_tplg_t *tplg, struct tplg_elem *parent, ++ unsigned int token, ++ char str_ref[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]) ++{ ++ struct tplg_elem *elem; ++ struct tplg_token *t; ++ struct tplg_vendor_tokens *tokens; ++ unsigned int i; ++ size_t size; ++ ++ elem = tplg_elem_lookup(&tplg->token_list, parent->id, ++ SND_TPLG_TYPE_TOKEN, parent->index); ++ if (elem == NULL) { ++ elem = tplg_elem_new_common(tplg, NULL, parent->id, ++ SND_TPLG_TYPE_TOKEN); ++ if (!elem) ++ return -ENOMEM; ++ } ++ ++ tokens = elem->tokens; ++ if (tokens) { ++ for (i = 0; i < tokens->num_tokens; i++) { ++ t = &tokens->token[i]; ++ if (t->value == token) ++ goto found; ++ } ++ size = sizeof(*tokens) + ++ (tokens->num_tokens + 1) * sizeof(struct tplg_token); ++ tokens = realloc(tokens, size); ++ } else { ++ size = sizeof(*tokens) + 1 * sizeof(struct tplg_token); ++ tokens = calloc(1, size); ++ } ++ ++ if (!tokens) ++ return -ENOMEM; ++ ++ memset(&tokens->token[tokens->num_tokens], 0, sizeof(struct tplg_token)); ++ elem->tokens = tokens; ++ t = &tokens->token[tokens->num_tokens]; ++ tokens->num_tokens++; ++ snprintf(t->id, sizeof(t->id), "token%u", token); ++ t->value = token; ++found: ++ snd_strlcpy(str_ref, t->id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN); ++ return 0; ++} ++ ++static int tplg_verify_tuple_set(snd_tplg_t *tplg, size_t pos, ++ const void *bin, size_t size) ++{ ++ const struct snd_soc_tplg_vendor_array *va; ++ unsigned int j; ++ ++ va = bin; ++ if (size < sizeof(*va) || size < va->size) { ++ tplg_dv(tplg, pos, "tuple set verify: wrong size %d", size); ++ return -EINVAL; ++ } ++ ++ switch (va->type) { ++ case SND_SOC_TPLG_TUPLE_TYPE_UUID: ++ case SND_SOC_TPLG_TUPLE_TYPE_STRING: ++ case SND_SOC_TPLG_TUPLE_TYPE_BOOL: ++ case SND_SOC_TPLG_TUPLE_TYPE_BYTE: ++ case SND_SOC_TPLG_TUPLE_TYPE_WORD: ++ case SND_SOC_TPLG_TUPLE_TYPE_SHORT: ++ break; ++ default: ++ tplg_dv(tplg, pos, "tuple set verify: unknown array type %d", va->type); ++ return -EINVAL; ++ } ++ ++ j = tplg_get_tuple_size(va->type) * va->num_elems; ++ if (j + sizeof(*va) != va->size) { ++ tplg_dv(tplg, pos, "tuple set verify: wrong vendor array size %d " ++ "(expected %d for %d count %d)", ++ va->size, j + sizeof(*va), va->type, va->num_elems); ++ return -EINVAL; ++ } ++ ++ if (va->num_elems > 4096) { ++ tplg_dv(tplg, pos, "tuple set verify: tuples overflow %d", va->num_elems); ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++static int tplg_decode_tuple_set(snd_tplg_t *tplg, ++ size_t pos, ++ struct tplg_elem *parent, ++ struct tplg_tuple_set **_set, ++ const void *bin, size_t size) ++{ ++ const struct snd_soc_tplg_vendor_array *va; ++ struct tplg_tuple_set *set; ++ struct tplg_tuple *tuple; ++ unsigned int j; ++ int err; ++ ++ va = bin; ++ if (size < sizeof(*va) || size < va->size) { ++ SNDERR("tuples: wrong size %d", size); ++ return -EINVAL; ++ } ++ ++ switch (va->type) { ++ case SND_SOC_TPLG_TUPLE_TYPE_UUID: ++ case SND_SOC_TPLG_TUPLE_TYPE_STRING: ++ case SND_SOC_TPLG_TUPLE_TYPE_BOOL: ++ case SND_SOC_TPLG_TUPLE_TYPE_BYTE: ++ case SND_SOC_TPLG_TUPLE_TYPE_WORD: ++ case SND_SOC_TPLG_TUPLE_TYPE_SHORT: ++ break; ++ default: ++ SNDERR("tuples: unknown array type %d", va->type); ++ return -EINVAL; ++ } ++ ++ j = tplg_get_tuple_size(va->type) * va->num_elems; ++ if (j + sizeof(*va) != va->size) { ++ SNDERR("tuples: wrong vendor array size %d " ++ "(expected %d for %d count %d)", ++ va->size, j + sizeof(*va), va->type, va->num_elems); ++ return -EINVAL; ++ } ++ ++ if (va->num_elems > 4096) { ++ SNDERR("tuples: tuples overflow %d", va->num_elems); ++ return -EINVAL; ++ } ++ ++ set = calloc(1, sizeof(*set) + va->num_elems * sizeof(struct tplg_tuple)); ++ if (!set) ++ return -ENOMEM; ++ ++ set->type = va->type; ++ set->num_tuples = va->num_elems; ++ ++ tplg_dv(tplg, pos, "tuple set: type %d (%s) tuples %d size %d", set->type, ++ get_tuple_type_name(set->type), set->num_tuples, va->size); ++ for (j = 0; j < set->num_tuples; j++) { ++ tuple = &set->tuple[j]; ++ switch (va->type) { ++ case SND_SOC_TPLG_TUPLE_TYPE_UUID: ++ err = tplg_add_token(tplg, parent, va->uuid[j].token, ++ tuple->token); ++ if (err < 0) ++ goto retval; ++ memcpy(tuple->uuid, va->uuid[j].uuid, ++ sizeof(va->uuid[j].uuid)); ++ break; ++ case SND_SOC_TPLG_TUPLE_TYPE_STRING: ++ err = tplg_add_token(tplg, parent, va->string[j].token, ++ tuple->token); ++ if (err < 0) ++ goto retval; ++ snd_strlcpy(tuple->string, va->string[j].string, ++ sizeof(tuple->string)); ++ break; ++ case SND_SOC_TPLG_TUPLE_TYPE_BOOL: ++ case SND_SOC_TPLG_TUPLE_TYPE_BYTE: ++ case SND_SOC_TPLG_TUPLE_TYPE_WORD: ++ case SND_SOC_TPLG_TUPLE_TYPE_SHORT: ++ err = tplg_add_token(tplg, parent, va->value[j].token, ++ tuple->token); ++ if (err < 0) ++ goto retval; ++ tuple->value = va->value[j].value; ++ break; ++ } ++ } ++ ++ *_set = set; ++ return 0; ++ ++retval: ++ free(set); ++ return err; ++} ++ ++/* verify tuples from the binary input */ ++static int tplg_verify_tuples(snd_tplg_t *tplg, size_t pos, ++ const void *bin, size_t size) ++{ ++ const struct snd_soc_tplg_vendor_array *va; ++ int err; ++ ++ if (size < sizeof(*va)) { ++ tplg_dv(tplg, pos, "tuples: small size %d", size); ++ return -EINVAL; ++ } ++ ++next: ++ va = bin; ++ if (size < sizeof(*va)) { ++ tplg_dv(tplg, pos, "tuples: unexpected vendor arry size %d", size); ++ return -EINVAL; ++ } ++ ++ err = tplg_verify_tuple_set(tplg, pos, va, va->size); ++ if (err < 0) ++ return err; ++ ++ bin += va->size; ++ size -= va->size; ++ pos += va->size; ++ if (size > 0) ++ goto next; ++ ++ return 0; ++} ++ ++/* add tuples from the binary input */ ++static int tplg_decode_tuples(snd_tplg_t *tplg, ++ size_t pos, ++ struct tplg_elem *parent, ++ struct tplg_vendor_tuples *tuples, ++ const void *bin, size_t size) ++{ ++ const struct snd_soc_tplg_vendor_array *va; ++ struct tplg_tuple_set *set; ++ int err; ++ ++ if (size < sizeof(*va)) { ++ SNDERR("tuples: small size %d", size); ++ return -EINVAL; ++ } ++ ++next: ++ va = bin; ++ if (size < sizeof(*va)) { ++ SNDERR("tuples: unexpected vendor arry size %d", size); ++ return -EINVAL; ++ } ++ ++ if (tuples->num_sets >= tuples->alloc_sets) { ++ SNDERR("tuples: index overflow (%d)", tuples->num_sets); ++ return -EINVAL; ++ } ++ ++ err = tplg_decode_tuple_set(tplg, pos, parent, &set, va, va->size); ++ if (err < 0) ++ return err; ++ tuples->set[tuples->num_sets++] = set; ++ ++ bin += va->size; ++ size -= va->size; ++ pos += va->size; ++ if (size > 0) ++ goto next; ++ ++ return 0; ++} ++ ++/* decode private data */ ++int tplg_add_data(snd_tplg_t *tplg, ++ struct tplg_elem *parent, ++ const void *bin, size_t size) ++{ ++ const struct snd_soc_tplg_private *tp; ++ const struct snd_soc_tplg_vendor_array *va; ++ struct tplg_elem *elem = NULL, *elem2 = NULL; ++ struct tplg_vendor_tuples *tuples = NULL; ++ char id[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; ++ char suffix[16]; ++ size_t pos = 0, off; ++ int err, num_tuples = 0, block = 0; ++ ++ if (size == 0) ++ return 0; ++ ++ off = offsetof(struct snd_soc_tplg_private, array); ++ ++next: ++ tp = bin; ++ if (off + size < tp->size) { ++ SNDERR("data: unexpected element size %d", size); ++ return -EINVAL; ++ } ++ ++ if (tplg_verify_tuples(tplg, pos, tp->array, tp->size) < 0) { ++ if (tuples) { ++ err = tplg_ref_add(elem, SND_TPLG_TYPE_TOKEN, parent->id); ++ if (err < 0) ++ return err; ++ err = tplg_ref_add(elem2, SND_TPLG_TYPE_TUPLE, id); ++ if (err < 0) ++ return err; ++ err = tplg_ref_add(parent, SND_TPLG_TYPE_DATA, id); ++ if (err < 0) ++ return err; ++ tuples = NULL; ++ } ++ tplg_dv(tplg, pos, "add bytes: size %d", tp->size); ++ snprintf(suffix, sizeof(suffix), "data%u", block++); ++ err = tplg_add_data_bytes(tplg, parent, suffix, tp->array, tp->size); ++ } else { ++ if (!tuples) { ++ snprintf(id, sizeof(id), "%.30s:tuple%d", parent->id, (block++) & 0xffff); ++ elem = tplg_elem_new_common(tplg, NULL, id, SND_TPLG_TYPE_TUPLE); ++ if (!elem) ++ return -ENOMEM; ++ ++ elem2 = tplg_elem_new_common(tplg, NULL, id, SND_TPLG_TYPE_DATA); ++ if (!elem2) ++ return -ENOMEM; ++ ++ tuples = calloc(1, sizeof(*tuples)); ++ if (!tuples) ++ return -ENOMEM; ++ elem->tuples = tuples; ++ ++ tuples->alloc_sets = (size / sizeof(*va)) + 1; ++ tuples->set = calloc(1, tuples->alloc_sets * sizeof(void *)); ++ if (!tuples->set) { ++ tuples->alloc_sets = 0; ++ return -ENOMEM; ++ } ++ } ++ tplg_dv(tplg, pos, "decode tuples: size %d", tp->size); ++ err = tplg_decode_tuples(tplg, pos, parent, tuples, tp->array, tp->size); ++ num_tuples++; ++ } ++ if (err < 0) ++ return err; ++ ++ bin += off + tp->size; ++ size -= off + tp->size; ++ pos += off + tp->size; ++ if (size > 0) ++ goto next; ++ ++ if (tuples && elem && elem2) { ++ err = tplg_ref_add(elem, SND_TPLG_TYPE_TOKEN, parent->id); ++ if (err < 0) ++ return err; ++ err = tplg_ref_add(elem2, SND_TPLG_TYPE_TUPLE, id); ++ if (err < 0) ++ return err; ++ err = tplg_ref_add(parent, SND_TPLG_TYPE_DATA, id); ++ if (err < 0) ++ return err; ++ } ++ ++ return 0; ++} ++ ++/* add private data - bytes */ ++int tplg_add_data_bytes(snd_tplg_t *tplg, struct tplg_elem *parent, ++ const char *suffix, const void *bin, size_t size) ++{ ++ struct snd_soc_tplg_private *priv; ++ struct tplg_elem *elem; ++ char id[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; ++ ++ if (suffix) ++ snprintf(id, sizeof(id), "%.30s:%.12s", parent->id, suffix); ++ else ++ snd_strlcpy(id, parent->id, sizeof(id)); ++ elem = tplg_elem_new_common(tplg, NULL, id, SND_TPLG_TYPE_DATA); ++ if (!elem) ++ return -ENOMEM; ++ ++ priv = malloc(sizeof(*priv) + size); ++ if (!priv) ++ return -ENOMEM; ++ memcpy(priv->data, bin, size); ++ priv->size = size; ++ elem->data = priv; ++ ++ return tplg_ref_add(parent, SND_TPLG_TYPE_DATA, id); ++} ++ ++/* decode data from the binary input */ ++int tplg_decode_data(snd_tplg_t *tplg ATTRIBUTE_UNUSED, ++ size_t pos ATTRIBUTE_UNUSED, ++ struct snd_soc_tplg_hdr *hdr ATTRIBUTE_UNUSED, ++ void *bin ATTRIBUTE_UNUSED, ++ size_t size ATTRIBUTE_UNUSED) ++{ ++ SNDERR("data type not expected"); ++ return -EINVAL; ++} +diff --git a/src/topology/decoder.c b/src/topology/decoder.c +new file mode 100644 +index 00000000..2d6a8969 +--- /dev/null ++++ b/src/topology/decoder.c +@@ -0,0 +1,136 @@ ++/* ++ Copyright (c) 2019 Red Hat Inc. ++ All rights reserved. ++ ++ This library is free software; you can redistribute it and/or modify ++ it under the terms of the GNU Lesser General Public License as ++ published by the Free Software Foundation; either version 2.1 of ++ the License, or (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU Lesser General Public License for more details. ++ ++ Authors: Jaroslav Kysela ++*/ ++ ++#include "list.h" ++#include "tplg_local.h" ++ ++/* verbose output detailing each object size and file position */ ++void tplg_dv(snd_tplg_t *tplg, size_t pos, const char *fmt, ...) ++{ ++ va_list va; ++ ++ if (!tplg->verbose) ++ return; ++ ++ va_start(va, fmt); ++ fprintf(stdout, "D0x%6.6zx/%6.6zd - ", pos, pos); ++ vfprintf(stdout, fmt, va); ++ va_end(va); ++ putc('\n', stdout); ++} ++ ++int tplg_decode_template(snd_tplg_t *tplg, ++ size_t pos, ++ struct snd_soc_tplg_hdr *hdr, ++ snd_tplg_obj_template_t *t) ++{ ++ int type; ++ ++ type = tplg_get_type(hdr->type); ++ tplg_dv(tplg, pos, "template: asoc type %d library type %d", hdr->type, type); ++ if (type < 0) ++ return type; ++ ++ memset(t, 0, sizeof(*t)); ++ t->type = type; ++ t->index = hdr->index; ++ t->version = hdr->version; ++ t->vendor_type = hdr->vendor_type; ++ tplg_dv(tplg, pos, "template: index %d version %d vendor_type %d", ++ hdr->index, hdr->version, hdr->vendor_type); ++ return 0; ++} ++ ++int snd_tplg_decode(snd_tplg_t *tplg, void *bin, size_t size, int dflags) ++{ ++ struct snd_soc_tplg_hdr *hdr; ++ struct tplg_table *tptr; ++ size_t pos; ++ void *b = bin; ++ unsigned int index; ++ int err; ++ ++ if (dflags != 0) ++ return -EINVAL; ++ if (tplg == NULL || bin == NULL) ++ return -EINVAL; ++ while (1) { ++ pos = b - bin; ++ if (size == pos) { ++ tplg_dv(tplg, pos, "block: success (total %zd)", size); ++ return 0; ++ } ++ if (size - pos < sizeof(*hdr)) { ++ tplg_dv(tplg, pos, "block: small size"); ++ SNDERR("incomplete header data to decode"); ++ return -EINVAL; ++ } ++ hdr = b; ++ if (hdr->magic != SND_SOC_TPLG_MAGIC) { ++ SNDERR("bad block magic %08x", hdr->magic); ++ return -EINVAL; ++ } ++ ++ tplg_dv(tplg, pos, "block: abi %d size %d payload size %d", ++ hdr->abi, hdr->size, hdr->payload_size); ++ if (hdr->abi != SND_SOC_TPLG_ABI_VERSION) { ++ SNDERR("unsupported ABI version %d", hdr->abi); ++ return -EINVAL; ++ } ++ if (hdr->size != sizeof(*hdr)) { ++ SNDERR("header size mismatch"); ++ return -EINVAL; ++ } ++ ++ if (size - pos < hdr->size + hdr->payload_size) { ++ SNDERR("incomplete payload data to decode"); ++ return -EINVAL; ++ } ++ ++ if (hdr->payload_size < 8) { ++ SNDERR("wrong payload size %d", hdr->payload_size); ++ return -EINVAL; ++ } ++ ++ /* first block must be manifest */ ++ if (b == bin) { ++ if (hdr->type != SND_SOC_TPLG_TYPE_MANIFEST) { ++ SNDERR("first block must be manifest (value %d)", hdr->type); ++ return -EINVAL; ++ } ++ err = snd_tplg_set_version(tplg, hdr->version); ++ if (err < 0) ++ return err; ++ } ++ ++ pos += hdr->size; ++ for (index = 0; index < tplg_table_items; index++) { ++ tptr = &tplg_table[index]; ++ if (tptr->tsoc == (int)hdr->type) ++ break; ++ } ++ if (index >= tplg_table_items || tptr->decod == NULL) { ++ SNDERR("unknown block type %d", hdr->type); ++ return -EINVAL; ++ } ++ tplg_dv(tplg, pos, "block: type %d - %s", hdr->type, tptr->name); ++ err = tptr->decod(tplg, pos, hdr, b + hdr->size, hdr->payload_size); ++ if (err < 0) ++ return err; ++ b += hdr->size + hdr->payload_size; ++ } ++} +diff --git a/src/topology/elem.c b/src/topology/elem.c +index 89aed1fc..ed5b5f13 100644 +--- a/src/topology/elem.c ++++ b/src/topology/elem.c +@@ -31,6 +31,7 @@ struct tplg_table tplg_table[] = { + .enew = 1, + .parse = tplg_parse_manifest_data, + .save = tplg_save_manifest_data, ++ .decod = tplg_decode_manifest_data, + }, + { + .name = "control mixer", +@@ -43,6 +44,7 @@ struct tplg_table tplg_table[] = { + .enew = 1, + .parse = tplg_parse_control_mixer, + .save = tplg_save_control_mixer, ++ .decod = tplg_decode_control_mixer, + }, + { + .name = "control enum", +@@ -55,6 +57,7 @@ struct tplg_table tplg_table[] = { + .enew = 1, + .parse = tplg_parse_control_enum, + .save = tplg_save_control_enum, ++ .decod = tplg_decode_control_enum, + }, + { + .name = "control extended (bytes)", +@@ -67,6 +70,7 @@ struct tplg_table tplg_table[] = { + .enew = 1, + .parse = tplg_parse_control_bytes, + .save = tplg_save_control_bytes, ++ .decod = tplg_decode_control_bytes, + }, + { + .name = "dapm widget", +@@ -79,6 +83,7 @@ struct tplg_table tplg_table[] = { + .enew = 1, + .parse = tplg_parse_dapm_widget, + .save = tplg_save_dapm_widget, ++ .decod = tplg_decode_dapm_widget, + }, + { + .name = "pcm", +@@ -91,6 +96,7 @@ struct tplg_table tplg_table[] = { + .enew = 1, + .parse = tplg_parse_pcm, + .save = tplg_save_pcm, ++ .decod = tplg_decode_pcm, + }, + { + .name = "physical dai", +@@ -103,6 +109,7 @@ struct tplg_table tplg_table[] = { + .enew = 1, + .parse = tplg_parse_dai, + .save = tplg_save_dai, ++ .decod = tplg_decode_dai, + }, + { + .name = "be", +@@ -116,6 +123,7 @@ struct tplg_table tplg_table[] = { + .enew = 1, + .parse = tplg_parse_link, + .save = tplg_save_link, ++ .decod = tplg_decode_link, + }, + { + .name = "cc", +@@ -128,6 +136,7 @@ struct tplg_table tplg_table[] = { + .enew = 1, + .parse = tplg_parse_cc, + .save = tplg_save_cc, ++ .decod = tplg_decode_cc, + }, + { + .name = "route (dapm graph)", +@@ -138,6 +147,7 @@ struct tplg_table tplg_table[] = { + .build = 1, + .parse = tplg_parse_dapm_graph, + .gsave = tplg_save_dapm_graph, ++ .decod = tplg_decode_dapm_graph, + }, + { + .name = "private data", +@@ -149,6 +159,7 @@ struct tplg_table tplg_table[] = { + .enew = 1, + .parse = tplg_parse_data, + .save = tplg_save_data, ++ .decod = tplg_decode_data, + }, + { + .name = "text", +@@ -220,6 +231,17 @@ struct tplg_table tplg_table[] = { + + unsigned int tplg_table_items = ARRAY_SIZE(tplg_table); + ++int tplg_get_type(int asoc_type) ++{ ++ unsigned int index; ++ ++ for (index = 0; index < tplg_table_items; index++) ++ if (tplg_table[index].tsoc == asoc_type) ++ return tplg_table[index].type; ++ SNDERR("uknown asoc type %d", asoc_type); ++ return -EINVAL; ++} ++ + int tplg_ref_add(struct tplg_elem *elem, int type, const char* id) + { + struct tplg_ref *ref; +@@ -331,6 +353,36 @@ struct tplg_elem *tplg_elem_lookup(struct list_head *base, const char* id, + return NULL; + } + ++/* find an element by type */ ++struct tplg_elem *tplg_elem_type_lookup(snd_tplg_t *tplg, ++ enum snd_tplg_type type) ++{ ++ struct tplg_table *tptr; ++ struct list_head *pos, *list; ++ struct tplg_elem *elem; ++ unsigned int index; ++ ++ for (index = 0; index < tplg_table_items; index++) { ++ tptr = &tplg_table[index]; ++ if (!tptr->enew) ++ continue; ++ if ((int)type != tptr->type) ++ continue; ++ break; ++ } ++ if (index >= tplg_table_items) ++ return NULL; ++ ++ list = (struct list_head *)((void *)tplg + tptr->loff); ++ ++ /* return only first element */ ++ list_for_each(pos, list) { ++ elem = list_entry(pos, struct tplg_elem, list); ++ return elem; ++ } ++ return NULL; ++} ++ + /* insert a new element into list in the ascending order of index value */ + void tplg_elem_insert(struct tplg_elem *elem_p, struct list_head *list) + { +@@ -428,3 +480,31 @@ struct tplg_elem* tplg_elem_new_common(snd_tplg_t *tplg, + elem->type = type; + return elem; + } ++ ++struct tplg_alloc { ++ struct list_head list; ++ void *data[0]; ++}; ++ ++void *tplg_calloc(struct list_head *heap, size_t size) ++{ ++ struct tplg_alloc *a; ++ ++ a = calloc(1, sizeof(*a) + size); ++ if (a == NULL) ++ return NULL; ++ list_add_tail(&a->list, heap); ++ return a->data; ++} ++ ++void tplg_free(struct list_head *heap) ++{ ++ struct list_head *pos, *npos; ++ struct tplg_alloc *a; ++ ++ list_for_each_safe(pos, npos, heap) { ++ a = list_entry(pos, struct tplg_alloc, list); ++ list_del(&a->list); ++ free(a); ++ } ++} +diff --git a/src/topology/parser.c b/src/topology/parser.c +index 5a5dd14f..d7783a93 100644 +--- a/src/topology/parser.c ++++ b/src/topology/parser.c +@@ -396,17 +396,21 @@ int snd_tplg_build_bin(snd_tplg_t *tplg, + + int snd_tplg_set_manifest_data(snd_tplg_t *tplg, const void *data, int len) + { ++ struct tplg_elem *elem; ++ ++ elem = tplg_elem_type_lookup(tplg, SND_TPLG_TYPE_MANIFEST); ++ if (elem == NULL) { ++ elem = tplg_elem_new_common(tplg, NULL, "manifest", ++ SND_TPLG_TYPE_MANIFEST); ++ if (!elem) ++ return -ENOMEM; ++ tplg->manifest.size = elem->size; ++ } ++ + if (len <= 0) + return 0; + +- tplg->manifest.priv.size = len; +- +- tplg->manifest_pdata = malloc(len); +- if (!tplg->manifest_pdata) +- return -ENOMEM; +- +- memcpy(tplg->manifest_pdata, data, len); +- return 0; ++ return tplg_add_data_bytes(tplg, elem, NULL, data, len); + } + + int snd_tplg_set_version(snd_tplg_t *tplg, unsigned int version) +diff --git a/src/topology/pcm.c b/src/topology/pcm.c +index bd728959..4e04a6bc 100644 +--- a/src/topology/pcm.c ++++ b/src/topology/pcm.c +@@ -1679,11 +1679,20 @@ static void tplg_add_stream_object(struct snd_soc_tplg_stream *strm, + strm->channels = strm_tpl->channels; + } + +-static void tplg_add_stream_caps(struct snd_soc_tplg_stream_caps *caps, +- struct snd_tplg_stream_caps_template *caps_tpl) ++static int tplg_add_stream_caps(snd_tplg_t *tplg, ++ struct snd_tplg_stream_caps_template *caps_tpl) + { +- snd_strlcpy(caps->name, caps_tpl->name, +- SNDRV_CTL_ELEM_ID_NAME_MAXLEN); ++ struct snd_soc_tplg_stream_caps *caps; ++ struct tplg_elem *elem; ++ ++ elem = tplg_elem_new_common(tplg, NULL, caps_tpl->name, ++ SND_TPLG_TYPE_STREAM_CAPS); ++ if (!elem) ++ return -ENOMEM; ++ ++ caps = elem->stream_caps; ++ ++ snd_strlcpy(caps->name, caps_tpl->name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN); + + caps->formats = caps_tpl->formats; + caps->rates = caps_tpl->rates; +@@ -1698,15 +1707,17 @@ static void tplg_add_stream_caps(struct snd_soc_tplg_stream_caps *caps, + caps->buffer_size_min = caps_tpl->buffer_size_min; + caps->buffer_size_max = caps_tpl->buffer_size_max; + caps->sig_bits = caps_tpl->sig_bits; ++ return 0; + } + + /* Add a PCM element (FE DAI & DAI link) from C API */ + int tplg_add_pcm_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) + { + struct snd_tplg_pcm_template *pcm_tpl = t->pcm; +- struct snd_soc_tplg_pcm *pcm, *_pcm; ++ struct snd_soc_tplg_private *priv; ++ struct snd_soc_tplg_pcm *pcm; + struct tplg_elem *elem; +- int i; ++ int ret, i; + + tplg_dbg("PCM: %s, DAI %s\n", pcm_tpl->pcm_name, pcm_tpl->dai_name); + +@@ -1732,8 +1743,13 @@ int tplg_add_pcm_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) + pcm->compress = pcm_tpl->compress; + + for (i = 0; i < 2; i++) { +- if (pcm_tpl->caps[i]) +- tplg_add_stream_caps(&pcm->caps[i], pcm_tpl->caps[i]); ++ if (!pcm_tpl->caps[i] || !pcm_tpl->caps[i]->name) ++ continue; ++ ret = tplg_add_stream_caps(tplg, pcm_tpl->caps[i]); ++ if (ret < 0) ++ return ret; ++ snd_strlcpy(pcm->caps[i].name, pcm_tpl->caps[i]->name, ++ sizeof(pcm->caps[i].name)); + } + + pcm->flag_mask = pcm_tpl->flag_mask; +@@ -1744,22 +1760,12 @@ int tplg_add_pcm_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) + tplg_add_stream_object(&pcm->stream[i], &pcm_tpl->stream[i]); + + /* private data */ +- if (pcm_tpl->priv != NULL && pcm_tpl->priv->size) { +- tplg_dbg("\t priv data size %d\n", pcm_tpl->priv->size); +- _pcm = realloc(pcm, +- elem->size + pcm_tpl->priv->size); +- if (!_pcm) { +- tplg_elem_free(elem); +- return -ENOMEM; +- } +- +- pcm = _pcm; +- elem->pcm = pcm; +- elem->size += pcm_tpl->priv->size; +- +- memcpy(pcm->priv.data, pcm_tpl->priv->data, +- pcm_tpl->priv->size); +- pcm->priv.size = pcm_tpl->priv->size; ++ priv = pcm_tpl->priv; ++ if (priv && priv->size > 0) { ++ ret = tplg_add_data(tplg, elem, priv, ++ sizeof(*priv) + priv->size); ++ if (ret < 0) ++ return ret; + } + + return 0; +@@ -1810,9 +1816,11 @@ static int set_link_hw_config(struct snd_soc_tplg_hw_config *cfg, + int tplg_add_link_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) + { + struct snd_tplg_link_template *link_tpl = t->link; +- struct snd_soc_tplg_link_config *link, *_link; ++ struct snd_soc_tplg_link_config *link; ++ struct snd_soc_tplg_private *priv; + struct tplg_elem *elem; + unsigned int i; ++ int ret; + + if (t->type != SND_TPLG_TYPE_LINK && t->type != SND_TPLG_TYPE_BE + && t->type != SND_TPLG_TYPE_CC) +@@ -1854,21 +1862,12 @@ int tplg_add_link_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) + link->flags = link_tpl->flags; + + /* private data */ +- if (link_tpl->priv != NULL && link_tpl->priv->size) { +- _link = realloc(link, +- elem->size + link_tpl->priv->size); +- if (!_link) { +- tplg_elem_free(elem); +- return -ENOMEM; +- } +- +- link = _link; +- elem->link = link; +- elem->size += link_tpl->priv->size; +- +- memcpy(link->priv.data, link_tpl->priv->data, +- link_tpl->priv->size); +- link->priv.size = link_tpl->priv->size; ++ priv = link_tpl->priv; ++ if (priv && priv->size > 0) { ++ ret = tplg_add_data(tplg, elem, priv, ++ sizeof(*priv) + priv->size); ++ if (ret < 0) ++ return ret; + } + + return 0; +@@ -1877,14 +1876,15 @@ int tplg_add_link_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) + int tplg_add_dai_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) + { + struct snd_tplg_dai_template *dai_tpl = t->dai; +- struct snd_soc_tplg_dai *dai, *_dai; ++ struct snd_soc_tplg_dai *dai; ++ struct snd_soc_tplg_private *priv; + struct tplg_elem *elem; +- int i; ++ int ret, i; + + tplg_dbg("DAI %s\n", dai_tpl->dai_name); + + elem = tplg_elem_new_common(tplg, NULL, dai_tpl->dai_name, +- SND_TPLG_TYPE_DAI); ++ SND_TPLG_TYPE_DAI); + if (!elem) + return -ENOMEM; + +@@ -1900,8 +1900,13 @@ int tplg_add_dai_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) + dai->capture = dai_tpl->capture; + + for (i = 0; i < 2; i++) { +- if (dai_tpl->caps[i]) +- tplg_add_stream_caps(&dai->caps[i], dai_tpl->caps[i]); ++ if (!dai_tpl->caps[i] || !dai_tpl->caps[i]->name) ++ continue; ++ ret = tplg_add_stream_caps(tplg, dai_tpl->caps[i]); ++ if (ret < 0) ++ return ret; ++ snd_strlcpy(dai->caps[i].name, dai_tpl->caps[i]->name, ++ sizeof(dai->caps[i].name)); + } + + /* flags */ +@@ -1909,22 +1914,299 @@ int tplg_add_dai_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) + dai->flags = dai_tpl->flags; + + /* private data */ +- if (dai_tpl->priv != NULL) { +- _dai = realloc(dai, +- elem->size + dai_tpl->priv->size); +- if (!_dai) { +- tplg_elem_free(elem); +- return -ENOMEM; ++ priv = dai_tpl->priv; ++ if (priv && priv->size > 0) { ++ ret = tplg_add_data(tplg, elem, priv, ++ sizeof(*priv) + priv->size); ++ if (ret < 0) ++ return ret; ++ } ++ ++ return 0; ++} ++ ++/* decode pcm from the binary input */ ++int tplg_decode_pcm(snd_tplg_t *tplg, ++ size_t pos, ++ struct snd_soc_tplg_hdr *hdr, ++ void *bin, size_t size) ++{ ++ struct snd_soc_tplg_pcm *pcm; ++ snd_tplg_obj_template_t t; ++ struct snd_tplg_pcm_template *pt; ++ struct snd_tplg_stream_caps_template caps[2], *cap; ++ struct snd_tplg_stream_template *stream; ++ unsigned int i; ++ size_t asize; ++ int err; ++ ++ err = tplg_decode_template(tplg, pos, hdr, &t); ++ if (err < 0) ++ return err; ++ ++ asize = sizeof(*pt) + SND_SOC_TPLG_STREAM_CONFIG_MAX * sizeof(*stream); ++ pt = alloca(asize); ++ ++next: ++ memset(pt, 0, asize); ++ pcm = bin; ++ ++ if (size < sizeof(*pcm)) { ++ SNDERR("pcm: small size %d", size); ++ return -EINVAL; ++ } ++ if (sizeof(*pcm) != pcm->size) { ++ SNDERR("pcm: unknown element size %d (expected %zd)", ++ pcm->size, sizeof(*pcm)); ++ return -EINVAL; ++ } ++ if (pcm->num_streams > SND_SOC_TPLG_STREAM_CONFIG_MAX) { ++ SNDERR("pcm: wrong number of streams %d", pcm->num_streams); ++ return -EINVAL; ++ } ++ if (sizeof(*pcm) + pcm->priv.size > size) { ++ SNDERR("pcm: wrong private data size %d", pcm->priv.size); ++ return -EINVAL; ++ } ++ ++ tplg_dv(tplg, pos, "pcm: size %d private size %d streams %d", ++ pcm->size, pcm->priv.size, pcm->num_streams); ++ ++ pt->pcm_name = pcm->pcm_name; ++ tplg_dv(tplg, pos, "pcm: pcm_name '%s'", pt->pcm_name); ++ pt->dai_name = pcm->dai_name; ++ tplg_dv(tplg, pos, "pcm: dai_name '%s'", pt->dai_name); ++ pt->pcm_id = pcm->pcm_id; ++ pt->dai_id = pcm->dai_id; ++ tplg_dv(tplg, pos, "pcm: pcm_id %d dai_id %d", pt->pcm_id, pt->dai_id); ++ pt->playback = pcm->playback; ++ pt->capture = pcm->capture; ++ pt->compress = pcm->compress; ++ tplg_dv(tplg, pos, "pcm: playback %d capture %d compress", ++ pt->playback, pt->capture, pt->compress); ++ pt->num_streams = pcm->num_streams; ++ pt->flag_mask = pcm->flag_mask; ++ pt->flags = pcm->flags; ++ for (i = 0; i < pcm->num_streams; i++) { ++ stream = &pt->stream[i]; ++ if (pcm->stream[i].size != sizeof(pcm->stream[0])) { ++ SNDERR("pcm: unknown stream structure size %d", ++ pcm->stream[i].size); ++ return -EINVAL; ++ } ++ stream->name = pcm->stream[i].name; ++ tplg_dv(tplg, pos + offsetof(struct snd_soc_tplg_pcm, stream[i]), ++ "stream %d: '%s'", i, stream->name); ++ stream->format = pcm->stream[i].format; ++ stream->rate = pcm->stream[i].rate; ++ stream->period_bytes = pcm->stream[i].period_bytes; ++ stream->buffer_bytes = pcm->stream[i].buffer_bytes; ++ stream->channels = pcm->stream[i].channels; ++ } ++ for (i = 0; i < 2; i++) { ++ if (i == 0 && !pcm->playback) ++ continue; ++ if (i == 1 && !pcm->capture) ++ continue; ++ cap = &caps[i]; ++ pt->caps[i] = cap; ++ if (pcm->caps[i].size != sizeof(pcm->caps[0])) { ++ SNDERR("pcm: unknown caps structure size %d", ++ pcm->caps[i].size); ++ return -EINVAL; + } ++ cap->name = pcm->caps[i].name; ++ tplg_dv(tplg, pos + offsetof(struct snd_soc_tplg_pcm, caps[i]), ++ "caps %d: '%s'", i, cap->name); ++ cap->formats = pcm->caps[i].formats; ++ cap->rates = pcm->caps[i].rates; ++ cap->rate_min = pcm->caps[i].rate_min; ++ cap->rate_max = pcm->caps[i].rate_max; ++ cap->channels_min = pcm->caps[i].channels_min; ++ cap->channels_max = pcm->caps[i].channels_max; ++ cap->periods_min = pcm->caps[i].periods_min; ++ cap->periods_max = pcm->caps[i].periods_max; ++ cap->period_size_min = pcm->caps[i].period_size_min; ++ cap->period_size_max = pcm->caps[i].period_size_max; ++ cap->buffer_size_min = pcm->caps[i].buffer_size_min; ++ cap->buffer_size_max = pcm->caps[i].buffer_size_max; ++ cap->sig_bits = pcm->caps[i].sig_bits; ++ } ++ ++ tplg_dv(tplg, pos + offsetof(struct snd_soc_tplg_pcm, priv), ++ "pcm: private start"); ++ pt->priv = &pcm->priv; ++ ++ bin += sizeof(*pcm) + pcm->priv.size; ++ size -= sizeof(*pcm) + pcm->priv.size; ++ pos += sizeof(*pcm) + pcm->priv.size; ++ ++ t.pcm = pt; ++ err = snd_tplg_add_object(tplg, &t); ++ if (err < 0) ++ return err; ++ ++ if (size > 0) ++ goto next; ++ ++ return 0; ++} ++ ++/* decode dai from the binary input */ ++int tplg_decode_dai(snd_tplg_t *tplg, ++ size_t pos, ++ struct snd_soc_tplg_hdr *hdr, ++ void *bin, size_t size) ++{ ++ SNDERR("not implemented"); ++ return -ENXIO; ++} ++ ++/* decode cc from the binary input */ ++int tplg_decode_cc(snd_tplg_t *tplg, ++ size_t pos, ++ struct snd_soc_tplg_hdr *hdr, ++ void *bin, size_t size) ++{ ++ SNDERR("not implemented"); ++ return -ENXIO; ++} ++ ++/* decode link from the binary input */ ++int tplg_decode_link(snd_tplg_t *tplg, ++ size_t pos, ++ struct snd_soc_tplg_hdr *hdr, ++ void *bin, size_t size) ++{ ++ struct snd_soc_tplg_link_config *link; ++ snd_tplg_obj_template_t t; ++ struct snd_tplg_link_template lt; ++ struct snd_tplg_stream_template streams[SND_SOC_TPLG_STREAM_CONFIG_MAX]; ++ struct snd_tplg_stream_template *stream; ++ struct snd_tplg_hw_config_template hws[SND_SOC_TPLG_HW_CONFIG_MAX]; ++ struct snd_tplg_hw_config_template *hw; ++ unsigned int i, j; ++ int err; ++ ++ err = tplg_decode_template(tplg, pos, hdr, &t); ++ if (err < 0) ++ return err; ++ ++next: ++ memset(<, 0, sizeof(lt)); ++ memset(streams, 0, sizeof(streams)); ++ memset(hws, 0, sizeof(hws)); ++ link = bin; + +- dai = _dai; +- dai->priv.size = dai_tpl->priv->size; ++ if (size < sizeof(*link)) { ++ SNDERR("link: small size %d", size); ++ return -EINVAL; ++ } ++ if (sizeof(*link) != link->size) { ++ SNDERR("link: unknown element size %d (expected %zd)", ++ link->size, sizeof(*link)); ++ return -EINVAL; ++ } ++ if (link->num_streams > SND_SOC_TPLG_STREAM_CONFIG_MAX) { ++ SNDERR("link: wrong number of streams %d", link->num_streams); ++ return -EINVAL; ++ } ++ if (link->num_hw_configs > SND_SOC_TPLG_HW_CONFIG_MAX) { ++ SNDERR("link: wrong number of streams %d", link->num_streams); ++ return -EINVAL; ++ } ++ if (sizeof(*link) + link->priv.size > size) { ++ SNDERR("link: wrong private data size %d", link->priv.size); ++ return -EINVAL; ++ } + +- elem->dai = dai; +- elem->size += dai->priv.size; +- memcpy(dai->priv.data, dai_tpl->priv->data, +- dai->priv.size); ++ tplg_dv(tplg, pos, "link: size %d private size %d streams %d " ++ "hw_configs %d", ++ link->size, link->priv.size, link->num_streams, ++ link->num_hw_configs); ++ ++ lt.id = link->id; ++ lt.name = link->name; ++ tplg_dv(tplg, pos, "link: name '%s'", lt.name); ++ lt.stream_name = link->stream_name; ++ tplg_dv(tplg, pos, "link: stream_name '%s'", lt.stream_name); ++ lt.num_streams = link->num_streams; ++ lt.num_hw_configs = link->num_hw_configs; ++ lt.default_hw_config_id = link->default_hw_config_id; ++ lt.flag_mask = link->flag_mask; ++ lt.flags = link->flags; ++ for (i = 0; i < link->num_streams; i++) { ++ stream = &streams[i]; ++ if (link->stream[i].size != sizeof(link->stream[0])) { ++ SNDERR("link: unknown stream structure size %d", ++ link->stream[i].size); ++ return -EINVAL; ++ } ++ stream->name = link->stream[i].name; ++ tplg_dv(tplg, ++ pos + offsetof(struct snd_soc_tplg_link_config, stream[i]), ++ "stream %d: '%s'", i, stream->name); ++ stream->format = link->stream[i].format; ++ stream->rate = link->stream[i].rate; ++ stream->period_bytes = link->stream[i].period_bytes; ++ stream->buffer_bytes = link->stream[i].buffer_bytes; ++ stream->channels = link->stream[i].channels; + } ++ lt.stream = streams; ++ for (i = 0; i < link->num_hw_configs; i++) { ++ hw = &hws[i]; ++ if (link->hw_config[i].size != sizeof(link->hw_config[0])) { ++ SNDERR("link: unknown hw_config structure size %d", ++ link->hw_config[i].size); ++ return -EINVAL; ++ } ++ hw->id = link->hw_config[i].id; ++ hw->fmt = link->hw_config[i].fmt; ++ hw->clock_gated = link->hw_config[i].clock_gated; ++ hw->invert_bclk = link->hw_config[i].invert_bclk; ++ hw->invert_fsync = link->hw_config[i].invert_fsync; ++ hw->bclk_master = link->hw_config[i].bclk_master; ++ hw->fsync_master = link->hw_config[i].fsync_master; ++ hw->mclk_direction = link->hw_config[i].mclk_direction; ++ hw->mclk_rate = link->hw_config[i].mclk_rate; ++ hw->bclk_rate = link->hw_config[i].bclk_rate; ++ hw->fsync_rate = link->hw_config[i].fsync_rate; ++ hw->tdm_slots = link->hw_config[i].tdm_slots; ++ hw->tdm_slot_width = link->hw_config[i].tdm_slot_width; ++ hw->tx_slots = link->hw_config[i].tx_slots; ++ hw->rx_slots = link->hw_config[i].rx_slots; ++ hw->tx_channels = link->hw_config[i].tx_channels; ++ if (hw->tx_channels > SND_SOC_TPLG_MAX_CHAN) { ++ SNDERR("link: wrong tx channels %d", hw->tx_channels); ++ return -EINVAL; ++ } ++ for (j = 0; j < hw->tx_channels; j++) ++ hw->tx_chanmap[j] = link->hw_config[i].tx_chanmap[j]; ++ hw->rx_channels = link->hw_config[i].rx_channels; ++ if (hw->rx_channels > SND_SOC_TPLG_MAX_CHAN) { ++ SNDERR("link: wrong rx channels %d", hw->tx_channels); ++ return -EINVAL; ++ } ++ for (j = 0; j < hw->rx_channels; j++) ++ hw->rx_chanmap[j] = link->hw_config[i].rx_chanmap[j]; ++ } ++ lt.hw_config = hws; ++ ++ tplg_dv(tplg, pos + offsetof(struct snd_soc_tplg_pcm, priv), ++ "link: private start"); ++ lt.priv = &link->priv; ++ ++ bin += sizeof(*link) + link->priv.size; ++ size -= sizeof(*link) + link->priv.size; ++ pos += sizeof(*link) + link->priv.size; ++ ++ t.link = < ++ err = snd_tplg_add_object(tplg, &t); ++ if (err < 0) ++ return err; ++ ++ if (size > 0) ++ goto next; + + return 0; + } +diff --git a/src/topology/save.c b/src/topology/save.c +index 0498911f..c6eabc49 100644 +--- a/src/topology/save.c ++++ b/src/topology/save.c +@@ -577,6 +577,9 @@ int snd_tplg_save(snd_tplg_t *tplg, char **dst, int flags) + if (err < 0) + goto _err; + ++ if (*dst == NULL) ++ return -EINVAL; ++ + if (flags & SND_TPLG_SAVE_NOCHECK) + return 0; + +diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h +index 74b3a55c..22fc5fba 100644 +--- a/src/topology/tplg_local.h ++++ b/src/topology/tplg_local.h +@@ -142,7 +142,8 @@ struct tplg_tuple_set { + }; + + struct tplg_vendor_tuples { +- unsigned int num_sets; ++ unsigned int num_sets; ++ unsigned int alloc_sets; + struct tplg_tuple_set **set; + }; + +@@ -217,11 +218,19 @@ struct tplg_table { + char **dst, const char *prefix); + int (*gsave)(snd_tplg_t *tplg, int index, + char **dst, const char *prefix); ++ int (*decod)(snd_tplg_t *tplg, size_t pos, ++ struct snd_soc_tplg_hdr *hdr, ++ void *bin, size_t size); + }; + + extern struct tplg_table tplg_table[]; + extern unsigned int tplg_table_items; + ++void *tplg_calloc(struct list_head *heap, size_t size); ++void tplg_free(struct list_head *heap); ++ ++int tplg_get_type(int asoc_type); ++ + int tplg_parse_compound(snd_tplg_t *tplg, snd_config_t *cfg, + int (*fcn)(snd_tplg_t *, snd_config_t *, void *), + void *private); +@@ -246,6 +255,7 @@ int tplg_parse_link(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); + int tplg_parse_cc(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); + int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); + ++unsigned int tplg_get_tuple_size(int type); + void tplg_free_tuples(void *obj); + + int tplg_build_data(snd_tplg_t *tplg); +@@ -272,6 +282,8 @@ struct tplg_elem *tplg_elem_lookup(struct list_head *base, + const char* id, + unsigned int type, + int index); ++struct tplg_elem *tplg_elem_type_lookup(snd_tplg_t *tplg, ++ enum snd_tplg_type type); + struct tplg_elem* tplg_elem_new_common(snd_tplg_t *tplg, + snd_config_t *cfg, const char *name, enum snd_tplg_type type); + +@@ -291,6 +303,10 @@ int tplg_parse_ext_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, + struct tplg_elem *lookup_pcm_dai_stream(struct list_head *base, + const char* id); + ++int tplg_add_data(snd_tplg_t *tplg, struct tplg_elem *parent, ++ const void *bin, size_t size); ++int tplg_add_data_bytes(snd_tplg_t *tplg, struct tplg_elem *parent, ++ const char *suffix, const void *bin, size_t size); + int tplg_add_mixer_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t); + int tplg_add_enum_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t); + int tplg_add_bytes_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t); +@@ -356,3 +372,56 @@ int tplg_save_stream_caps(snd_tplg_t *tplg, struct tplg_elem *elem, + char **dst, const char *pfx); + int tplg_save_dai(snd_tplg_t *tplg, struct tplg_elem *elem, + char **dst, const char *pfx); ++ ++void tplg_dv(snd_tplg_t *tplg, size_t pos, const char *fmt, ...); ++int tplg_decode_template(snd_tplg_t *tplg, ++ size_t pos, ++ struct snd_soc_tplg_hdr *hdr, ++ snd_tplg_obj_template_t *t); ++int tplg_decode_manifest_data(snd_tplg_t *tplg, size_t pos, ++ struct snd_soc_tplg_hdr *hdr, ++ void *bin, size_t size); ++int tplg_decode_control_mixer1(snd_tplg_t *tplg, ++ struct list_head *heap, ++ struct snd_tplg_mixer_template *mt, ++ size_t pos, ++ void *bin, size_t size); ++int tplg_decode_control_mixer(snd_tplg_t *tplg, size_t pos, ++ struct snd_soc_tplg_hdr *hdr, ++ void *bin, size_t size); ++int tplg_decode_control_enum1(snd_tplg_t *tplg, ++ struct list_head *heap, ++ struct snd_tplg_enum_template *et, ++ size_t pos, ++ void *bin, size_t size); ++int tplg_decode_control_enum(snd_tplg_t *tplg, size_t pos, ++ struct snd_soc_tplg_hdr *hdr, ++ void *bin, size_t size); ++int tplg_decode_control_bytes1(snd_tplg_t *tplg, ++ struct snd_tplg_bytes_template *bt, ++ size_t pos, ++ void *bin, size_t size); ++int tplg_decode_control_bytes(snd_tplg_t *tplg, size_t pos, ++ struct snd_soc_tplg_hdr *hdr, ++ void *bin, size_t size); ++int tplg_decode_data(snd_tplg_t *tplg, size_t pos, ++ struct snd_soc_tplg_hdr *hdr, ++ void *bin, size_t size); ++int tplg_decode_dapm_graph(snd_tplg_t *tplg, size_t pos, ++ struct snd_soc_tplg_hdr *hdr, ++ void *bin, size_t size); ++int tplg_decode_dapm_widget(snd_tplg_t *tplg, size_t pos, ++ struct snd_soc_tplg_hdr *hdr, ++ void *bin, size_t size); ++int tplg_decode_link(snd_tplg_t *tplg, size_t pos, ++ struct snd_soc_tplg_hdr *hdr, ++ void *bin, size_t size); ++int tplg_decode_cc(snd_tplg_t *tplg, size_t pos, ++ struct snd_soc_tplg_hdr *hdr, ++ void *bin, size_t size); ++int tplg_decode_pcm(snd_tplg_t *tplg, size_t pos, ++ struct snd_soc_tplg_hdr *hdr, ++ void *bin, size_t size); ++int tplg_decode_dai(snd_tplg_t *tplg, size_t pos, ++ struct snd_soc_tplg_hdr *hdr, ++ void *bin, size_t size); +-- +2.24.1 + + +From cb88813ff71226af5d16f8853d186ff7c572dbe0 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 3 Jan 2020 22:07:11 +0100 +Subject: [PATCH 54/69] topology: move the elem->list delete to + tplg_elem_free() + +The tplg_elem_free() is called in the error path from many places +and it is expected that the element object will be unregistered +from the tplg structure, too. + +Signed-off-by: Jaroslav Kysela +--- + src/topology/elem.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/topology/elem.c b/src/topology/elem.c +index ed5b5f13..cbd7f4b6 100644 +--- a/src/topology/elem.c ++++ b/src/topology/elem.c +@@ -301,6 +301,8 @@ struct tplg_elem *tplg_elem_new(void) + + void tplg_elem_free(struct tplg_elem *elem) + { ++ list_del(&elem->list); ++ + tplg_ref_free_list(&elem->ref_list); + + /* free struct snd_tplg_ object, +@@ -323,7 +325,6 @@ void tplg_elem_free_list(struct list_head *base) + + list_for_each_safe(pos, npos, base) { + elem = list_entry(pos, struct tplg_elem, list); +- list_del(&elem->list); + tplg_elem_free(elem); + } + } +-- +2.24.1 + + +From ae6522e10621839a15f5a439091af7542d84d3e5 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 3 Jan 2020 22:31:27 +0100 +Subject: [PATCH 55/69] topology: unify the log mechanism + +Signed-off-by: Jaroslav Kysela +--- + src/topology/Makefile.am | 3 ++- + src/topology/builder.c | 54 +++++++++++++++++---------------------- + src/topology/ctl.c | 30 +++++++++++----------- + src/topology/dapm.c | 19 +++++++------- + src/topology/data.c | 26 +++++++++---------- + src/topology/decoder.c | 32 +++++++---------------- + src/topology/log.c | 34 ++++++++++++++++++++++++ + src/topology/pcm.c | 48 +++++++++++++++++----------------- + src/topology/tplg_local.h | 8 +++++- + 9 files changed, 138 insertions(+), 116 deletions(-) + create mode 100644 src/topology/log.c + +diff --git a/src/topology/Makefile.am b/src/topology/Makefile.am +index 12d1d445..9f48891f 100644 +--- a/src/topology/Makefile.am ++++ b/src/topology/Makefile.am +@@ -29,7 +29,8 @@ libatopology_la_SOURCES =\ + ops.c \ + elem.c \ + save.c \ +- decoder.c ++ decoder.c \ ++ log.c + + noinst_HEADERS = tplg_local.h + +diff --git a/src/topology/builder.c b/src/topology/builder.c +index 74c44405..7af5de08 100644 +--- a/src/topology/builder.c ++++ b/src/topology/builder.c +@@ -20,20 +20,6 @@ + #include "list.h" + #include "tplg_local.h" + +-/* verbose output detailing each object size and file position */ +-static void verbose(snd_tplg_t *tplg, const char *fmt, ...) +-{ +- va_list va; +- +- if (!tplg->verbose) +- return; +- +- va_start(va, fmt); +- fprintf(stdout, "0x%6.6zx/%6.6zd - ", tplg->bin_pos, tplg->bin_pos); +- vfprintf(stdout, fmt, va); +- va_end(va); +-} +- + /* write a block, track the position */ + static ssize_t twrite(snd_tplg_t *tplg, void *data, size_t data_size) + { +@@ -73,10 +59,11 @@ static ssize_t write_block_header(snd_tplg_t *tplg, unsigned int type, + return -EINVAL; + } + +- verbose(tplg, "header index %d type %d count %d size 0x%lx/%ld vendor %d " +- "version %d\n", index, type, count, +- (long unsigned int)payload_size, (long int)payload_size, +- vendor_type, version); ++ tplg_log(tplg, 'B', tplg->bin_pos, ++ "header index %d type %d count %d size 0x%lx/%ld vendor %d " ++ "version %d", index, type, count, ++ (long unsigned int)payload_size, (long int)payload_size, ++ vendor_type, version); + + tplg->next_hdr_pos += hdr.payload_size + sizeof(hdr); + +@@ -121,13 +108,15 @@ static int write_elem_block(snd_tplg_t *tplg, + continue; + + if (elem->type != SND_TPLG_TYPE_DAPM_GRAPH) +- verbose(tplg, "%s '%s': write %d bytes\n", +- obj_name, elem->id, elem->size); ++ tplg_log(tplg, 'B', tplg->bin_pos, ++ "%s '%s': write %d bytes", ++ obj_name, elem->id, elem->size); + else +- verbose(tplg, "%s '%s -> %s -> %s': write %d bytes\n", +- obj_name, elem->route->source, +- elem->route->control, +- elem->route->sink, elem->size); ++ tplg_log(tplg, 'B', tplg->bin_pos, ++ "%s '%s -> %s -> %s': write %d bytes", ++ obj_name, elem->route->source, ++ elem->route->control, ++ elem->route->sink, elem->size); + + wsize = twrite(tplg, elem->obj, elem->size); + if (wsize < 0) +@@ -225,10 +214,13 @@ static ssize_t write_manifest_data(snd_tplg_t *tplg) + return ret; + } + +- verbose(tplg, "manifest: write %d bytes\n", sizeof(tplg->manifest)); ++ tplg_log(tplg, 'B', tplg->bin_pos, "manifest: write %d bytes", ++ sizeof(tplg->manifest)); + ret = twrite(tplg, &tplg->manifest, sizeof(tplg->manifest)); + if (ret >= 0) { +- verbose(tplg, "manifest: write %d priv bytes\n", tplg->manifest.priv.size); ++ tplg_log(tplg, 'B', tplg->bin_pos, ++ "manifest: write %d priv bytes", ++ tplg->manifest.priv.size); + ret = twrite(tplg, tplg->manifest_pdata, tplg->manifest.priv.size); + } + return ret; +@@ -280,9 +272,10 @@ int tplg_write_data(snd_tplg_t *tplg) + size = calc_block_size(list); + if (size == 0) + continue; +- verbose(tplg, "block size for type %s (%d:%d) is 0x%zx/%zd\n", +- tptr->name, tptr->type, +- tptr->tsoc, size, size); ++ tplg_log(tplg, 'B', tplg->bin_pos, ++ "block size for type %s (%d:%d) is 0x%zx/%zd", ++ tptr->name, tptr->type, ++ tptr->tsoc, size, size); + ret = write_elem_block(tplg, list, size, + tptr->tsoc, tptr->name); + if (ret < 0) { +@@ -292,7 +285,8 @@ int tplg_write_data(snd_tplg_t *tplg) + } + } + +- verbose(tplg, "total size is 0x%zx/%zd\n", tplg->bin_pos, tplg->bin_pos); ++ tplg_log(tplg, 'B', tplg->bin_pos, "total size is 0x%zx/%zd", ++ tplg->bin_pos, tplg->bin_pos); + + if (total_size != tplg->bin_pos) { + SNDERR("total size mismatch (%zd != %zd)", +diff --git a/src/topology/ctl.c b/src/topology/ctl.c +index 24d437aa..a5a81148 100644 +--- a/src/topology/ctl.c ++++ b/src/topology/ctl.c +@@ -1216,8 +1216,8 @@ int tplg_decode_control_mixer1(snd_tplg_t *tplg, + return -EINVAL; + } + +- tplg_dv(tplg, pos, "mixer: size %d TLV size %d private size %d", +- mc->size, mc->hdr.tlv.size, mc->priv.size); ++ tplg_log(tplg, 'D', pos, "mixer: size %d TLV size %d private size %d", ++ mc->size, mc->hdr.tlv.size, mc->priv.size); + if (size != mc->size + mc->priv.size) { + SNDERR("mixer: unexpected element size %d", size); + return -EINVAL; +@@ -1233,7 +1233,7 @@ int tplg_decode_control_mixer1(snd_tplg_t *tplg, + mt->min = mc->min; + mt->max = mc->max; + mt->platform_max = mc->platform_max; +- tplg_dv(tplg, pos, "mixer: name '%s' access 0x%x", ++ tplg_log(tplg, 'D', pos, "mixer: name '%s' access 0x%x", + mt->hdr.name, mt->hdr.access); + if (mc->num_channels > 0) { + map = tplg_calloc(heap, sizeof(*map)); +@@ -1261,16 +1261,16 @@ int tplg_decode_control_mixer1(snd_tplg_t *tplg, + db->min = mc->hdr.tlv.scale.min; + db->step = mc->hdr.tlv.scale.step; + db->mute = mc->hdr.tlv.scale.mute; +- tplg_dv(tplg, pos, "mixer: dB scale TLV: min %d step %d mute %d", +- db->min, db->step, db->mute); ++ tplg_log(tplg, 'D', pos, "mixer: dB scale TLV: min %d step %d mute %d", ++ db->min, db->step, db->mute); + } else { + SNDERR("mixer: wrong TLV size %d", mc->hdr.tlv.size); + return -EINVAL; + } + + mt->priv = &mc->priv; +- tplg_dv(tplg, pos + offsetof(struct snd_soc_tplg_mixer_control, priv), +- "mixer: private start"); ++ tplg_log(tplg, 'D', pos + offsetof(struct snd_soc_tplg_mixer_control, priv), ++ "mixer: private start"); + return 0; + } + +@@ -1338,8 +1338,8 @@ int tplg_decode_control_enum1(snd_tplg_t *tplg, + return -EINVAL; + } + +- tplg_dv(tplg, pos, "enum: size %d private size %d", +- ec->size, ec->priv.size); ++ tplg_log(tplg, 'D', pos, "enum: size %d private size %d", ++ ec->size, ec->priv.size); + if (size != ec->size + ec->priv.size) { + SNDERR("enum: unexpected element size %d", size); + return -EINVAL; +@@ -1380,8 +1380,8 @@ int tplg_decode_control_enum1(snd_tplg_t *tplg, + cmt.num_channels = ec->num_channels; + for (i = 0; i < cmt.num_channels; i++) { + struct snd_tplg_channel_elem *channel = &cmt.channel[i]; +- tplg_dv(tplg, pos + ((void *)&ec->channel[i] - (void *)ec), +- "enum: channel size %d", ec->channel[i].size); ++ tplg_log(tplg, 'D', pos + ((void *)&ec->channel[i] - (void *)ec), ++ "enum: channel size %d", ec->channel[i].size); + channel->reg = ec->channel[i].reg; + channel->shift = ec->channel[i].shift; + channel->id = ec->channel[i].id; +@@ -1452,8 +1452,8 @@ int tplg_decode_control_bytes1(snd_tplg_t *tplg, + return -EINVAL; + } + +- tplg_dv(tplg, pos, "control bytes: size %d private size %d", +- bc->size, bc->priv.size); ++ tplg_log(tplg, 'D', pos, "control bytes: size %d private size %d", ++ bc->size, bc->priv.size); + if (size != bc->size + bc->priv.size) { + SNDERR("bytes: unexpected element size %d", size); + return -EINVAL; +@@ -1473,8 +1473,8 @@ int tplg_decode_control_bytes1(snd_tplg_t *tplg, + bt->ext_ops.get = bc->ext_ops.get; + bt->ext_ops.put = bc->ext_ops.put; + bt->ext_ops.info = bc->ext_ops.info; +- tplg_dv(tplg, pos, "control bytes: name '%s' access 0x%x", +- bt->hdr.name, bt->hdr.access); ++ tplg_log(tplg, 'D', pos, "control bytes: name '%s' access 0x%x", ++ bt->hdr.name, bt->hdr.access); + + bt->priv = &bc->priv; + return 0; +diff --git a/src/topology/dapm.c b/src/topology/dapm.c +index 9fab2d92..0bf64833 100644 +--- a/src/topology/dapm.c ++++ b/src/topology/dapm.c +@@ -895,8 +895,8 @@ next: + return -EINVAL; + } + +- tplg_dv(tplg, pos, "dapm widget: size %d private size %d kcontrols %d", +- w->size, w->priv.size, w->num_kcontrols); ++ tplg_log(tplg, 'D', pos, "dapm widget: size %d private size %d kcontrols %d", ++ w->size, w->priv.size, w->num_kcontrols); + + wt = tplg_calloc(&heap, sizeof(*wt) + sizeof(void *) * w->num_kcontrols); + if (wt == NULL) +@@ -913,7 +913,8 @@ next: + wt->event_flags = w->event_flags; + wt->event_type = w->event_type; + +- tplg_dv(tplg, pos, "dapm widget: name '%s' sname '%s'", wt->name, wt->sname); ++ tplg_log(tplg, 'D', pos, "dapm widget: name '%s' sname '%s'", ++ wt->name, wt->sname); + + if (sizeof(*w) + w->priv.size > size) { + SNDERR("dapm widget: wrong private data size %d", +@@ -921,8 +922,8 @@ next: + return -EINVAL; + } + +- tplg_dv(tplg, pos + offsetof(struct snd_soc_tplg_dapm_widget, priv), +- "dapm widget: private start"); ++ tplg_log(tplg, 'D', pos + offsetof(struct snd_soc_tplg_dapm_widget, priv), ++ "dapm widget: private start"); + + wt->priv = &w->priv; + bin += sizeof(*w) + w->priv.size; +@@ -942,7 +943,7 @@ next: + wt->num_ctls++; + mc = bin; + size2 = mc->size + mc->priv.size; +- tplg_dv(tplg, pos, "kcontrol mixer size %zd", size2); ++ tplg_log(tplg, 'D', pos, "kcontrol mixer size %zd", size2); + if (size2 > size) { + SNDERR("dapm widget: small mixer size %d", + size2); +@@ -962,7 +963,7 @@ next: + wt->num_ctls++; + ec = bin; + size2 = ec->size + ec->priv.size; +- tplg_dv(tplg, pos, "kcontrol enum size %zd", size2); ++ tplg_log(tplg, 'D', pos, "kcontrol enum size %zd", size2); + if (size2 > size) { + SNDERR("dapm widget: small enum size %d", + size2); +@@ -982,7 +983,7 @@ next: + wt->num_ctls++; + bc = bin; + size2 = bc->size + bc->priv.size; +- tplg_dv(tplg, pos, "kcontrol bytes size %zd", size2); ++ tplg_log(tplg, 'D', pos, "kcontrol bytes size %zd", size2); + if (size2 > size) { + SNDERR("dapm widget: small bytes size %d", + size2); +@@ -1049,7 +1050,7 @@ int tplg_decode_dapm_graph(snd_tplg_t *tplg, + ge->ctl = g->control; + ge->sink = g->sink; + gt->count++; +- tplg_dv(tplg, pos, "dapm graph: src='%s' ctl='%s' sink='%s'", ++ tplg_log(tplg, 'D', pos, "dapm graph: src='%s' ctl='%s' sink='%s'", + ge->src, ge->ctl, ge->sink); + bin += sizeof(*g); + size -= sizeof(*g); +diff --git a/src/topology/data.c b/src/topology/data.c +index 64563920..0b513428 100644 +--- a/src/topology/data.c ++++ b/src/topology/data.c +@@ -1604,7 +1604,7 @@ int tplg_decode_manifest_data(snd_tplg_t *tplg, + if (!elem) + return -ENOMEM; + +- tplg_dv(tplg, pos, "manifest: private size %d", size); ++ tplg_log(tplg, 'D', pos, "manifest: private size %d", size); + return tplg_add_data(tplg, elem, bin, size); + } + +@@ -1664,7 +1664,7 @@ static int tplg_verify_tuple_set(snd_tplg_t *tplg, size_t pos, + + va = bin; + if (size < sizeof(*va) || size < va->size) { +- tplg_dv(tplg, pos, "tuple set verify: wrong size %d", size); ++ tplg_log(tplg, 'A', pos, "tuple set verify: wrong size %d", size); + return -EINVAL; + } + +@@ -1677,20 +1677,20 @@ static int tplg_verify_tuple_set(snd_tplg_t *tplg, size_t pos, + case SND_SOC_TPLG_TUPLE_TYPE_SHORT: + break; + default: +- tplg_dv(tplg, pos, "tuple set verify: unknown array type %d", va->type); ++ tplg_log(tplg, 'A', pos, "tuple set verify: unknown array type %d", va->type); + return -EINVAL; + } + + j = tplg_get_tuple_size(va->type) * va->num_elems; + if (j + sizeof(*va) != va->size) { +- tplg_dv(tplg, pos, "tuple set verify: wrong vendor array size %d " +- "(expected %d for %d count %d)", +- va->size, j + sizeof(*va), va->type, va->num_elems); ++ tplg_log(tplg, 'A', pos, "tuple set verify: wrong vendor array size %d " ++ "(expected %d for %d count %d)", ++ va->size, j + sizeof(*va), va->type, va->num_elems); + return -EINVAL; + } + + if (va->num_elems > 4096) { +- tplg_dv(tplg, pos, "tuple set verify: tuples overflow %d", va->num_elems); ++ tplg_log(tplg, 'A', pos, "tuple set verify: tuples overflow %d", va->num_elems); + return -EINVAL; + } + +@@ -1748,8 +1748,8 @@ static int tplg_decode_tuple_set(snd_tplg_t *tplg, + set->type = va->type; + set->num_tuples = va->num_elems; + +- tplg_dv(tplg, pos, "tuple set: type %d (%s) tuples %d size %d", set->type, +- get_tuple_type_name(set->type), set->num_tuples, va->size); ++ tplg_log(tplg, 'A', pos, "tuple set: type %d (%s) tuples %d size %d", set->type, ++ get_tuple_type_name(set->type), set->num_tuples, va->size); + for (j = 0; j < set->num_tuples; j++) { + tuple = &set->tuple[j]; + switch (va->type) { +@@ -1798,14 +1798,14 @@ static int tplg_verify_tuples(snd_tplg_t *tplg, size_t pos, + int err; + + if (size < sizeof(*va)) { +- tplg_dv(tplg, pos, "tuples: small size %d", size); ++ tplg_log(tplg, 'A', pos, "tuples: small size %d", size); + return -EINVAL; + } + + next: + va = bin; + if (size < sizeof(*va)) { +- tplg_dv(tplg, pos, "tuples: unexpected vendor arry size %d", size); ++ tplg_log(tplg, 'A', pos, "tuples: unexpected vendor arry size %d", size); + return -EINVAL; + } + +@@ -1903,7 +1903,7 @@ next: + return err; + tuples = NULL; + } +- tplg_dv(tplg, pos, "add bytes: size %d", tp->size); ++ tplg_log(tplg, 'A', pos, "add bytes: size %d", tp->size); + snprintf(suffix, sizeof(suffix), "data%u", block++); + err = tplg_add_data_bytes(tplg, parent, suffix, tp->array, tp->size); + } else { +@@ -1929,7 +1929,7 @@ next: + return -ENOMEM; + } + } +- tplg_dv(tplg, pos, "decode tuples: size %d", tp->size); ++ tplg_log(tplg, 'A', pos, "decode tuples: size %d", tp->size); + err = tplg_decode_tuples(tplg, pos, parent, tuples, tp->array, tp->size); + num_tuples++; + } +diff --git a/src/topology/decoder.c b/src/topology/decoder.c +index 2d6a8969..66ebe5d8 100644 +--- a/src/topology/decoder.c ++++ b/src/topology/decoder.c +@@ -18,21 +18,6 @@ + #include "list.h" + #include "tplg_local.h" + +-/* verbose output detailing each object size and file position */ +-void tplg_dv(snd_tplg_t *tplg, size_t pos, const char *fmt, ...) +-{ +- va_list va; +- +- if (!tplg->verbose) +- return; +- +- va_start(va, fmt); +- fprintf(stdout, "D0x%6.6zx/%6.6zd - ", pos, pos); +- vfprintf(stdout, fmt, va); +- va_end(va); +- putc('\n', stdout); +-} +- + int tplg_decode_template(snd_tplg_t *tplg, + size_t pos, + struct snd_soc_tplg_hdr *hdr, +@@ -41,7 +26,8 @@ int tplg_decode_template(snd_tplg_t *tplg, + int type; + + type = tplg_get_type(hdr->type); +- tplg_dv(tplg, pos, "template: asoc type %d library type %d", hdr->type, type); ++ tplg_log(tplg, 'D', pos, "template: asoc type %d library type %d", ++ hdr->type, type); + if (type < 0) + return type; + +@@ -50,8 +36,8 @@ int tplg_decode_template(snd_tplg_t *tplg, + t->index = hdr->index; + t->version = hdr->version; + t->vendor_type = hdr->vendor_type; +- tplg_dv(tplg, pos, "template: index %d version %d vendor_type %d", +- hdr->index, hdr->version, hdr->vendor_type); ++ tplg_log(tplg, 'D', pos, "template: index %d version %d vendor_type %d", ++ hdr->index, hdr->version, hdr->vendor_type); + return 0; + } + +@@ -71,11 +57,11 @@ int snd_tplg_decode(snd_tplg_t *tplg, void *bin, size_t size, int dflags) + while (1) { + pos = b - bin; + if (size == pos) { +- tplg_dv(tplg, pos, "block: success (total %zd)", size); ++ tplg_log(tplg, 'D', pos, "block: success (total %zd)", size); + return 0; + } + if (size - pos < sizeof(*hdr)) { +- tplg_dv(tplg, pos, "block: small size"); ++ tplg_log(tplg, 'D', pos, "block: small size"); + SNDERR("incomplete header data to decode"); + return -EINVAL; + } +@@ -85,8 +71,8 @@ int snd_tplg_decode(snd_tplg_t *tplg, void *bin, size_t size, int dflags) + return -EINVAL; + } + +- tplg_dv(tplg, pos, "block: abi %d size %d payload size %d", +- hdr->abi, hdr->size, hdr->payload_size); ++ tplg_log(tplg, 'D', pos, "block: abi %d size %d payload size %d", ++ hdr->abi, hdr->size, hdr->payload_size); + if (hdr->abi != SND_SOC_TPLG_ABI_VERSION) { + SNDERR("unsupported ABI version %d", hdr->abi); + return -EINVAL; +@@ -127,7 +113,7 @@ int snd_tplg_decode(snd_tplg_t *tplg, void *bin, size_t size, int dflags) + SNDERR("unknown block type %d", hdr->type); + return -EINVAL; + } +- tplg_dv(tplg, pos, "block: type %d - %s", hdr->type, tptr->name); ++ tplg_log(tplg, 'D', pos, "block: type %d - %s", hdr->type, tptr->name); + err = tptr->decod(tplg, pos, hdr, b + hdr->size, hdr->payload_size); + if (err < 0) + return err; +diff --git a/src/topology/log.c b/src/topology/log.c +new file mode 100644 +index 00000000..1ca36528 +--- /dev/null ++++ b/src/topology/log.c +@@ -0,0 +1,34 @@ ++/* ++ Copyright (c) 2019 Red Hat Inc. ++ All rights reserved. ++ ++ This library is free software; you can redistribute it and/or modify ++ it under the terms of the GNU Lesser General Public License as ++ published by the Free Software Foundation; either version 2.1 of ++ the License, or (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU Lesser General Public License for more details. ++ ++ Authors: Jaroslav Kysela ++*/ ++ ++#include "list.h" ++#include "tplg_local.h" ++ ++/* verbose output detailing each object size and file position */ ++void tplg_log_(snd_tplg_t *tplg, char type, size_t pos, const char *fmt, ...) ++{ ++ va_list va; ++ ++ if (!tplg->verbose) ++ return; ++ ++ va_start(va, fmt); ++ fprintf(stdout, "%c0x%6.6zx/%6.6zd - ", type, pos, pos); ++ vfprintf(stdout, fmt, va); ++ va_end(va); ++ putc('\n', stdout); ++} +diff --git a/src/topology/pcm.c b/src/topology/pcm.c +index 4e04a6bc..918e3e9a 100644 +--- a/src/topology/pcm.c ++++ b/src/topology/pcm.c +@@ -1969,21 +1969,21 @@ next: + return -EINVAL; + } + +- tplg_dv(tplg, pos, "pcm: size %d private size %d streams %d", +- pcm->size, pcm->priv.size, pcm->num_streams); ++ tplg_log(tplg, 'D', pos, "pcm: size %d private size %d streams %d", ++ pcm->size, pcm->priv.size, pcm->num_streams); + + pt->pcm_name = pcm->pcm_name; +- tplg_dv(tplg, pos, "pcm: pcm_name '%s'", pt->pcm_name); ++ tplg_log(tplg, 'D', pos, "pcm: pcm_name '%s'", pt->pcm_name); + pt->dai_name = pcm->dai_name; +- tplg_dv(tplg, pos, "pcm: dai_name '%s'", pt->dai_name); ++ tplg_log(tplg, 'D', pos, "pcm: dai_name '%s'", pt->dai_name); + pt->pcm_id = pcm->pcm_id; + pt->dai_id = pcm->dai_id; +- tplg_dv(tplg, pos, "pcm: pcm_id %d dai_id %d", pt->pcm_id, pt->dai_id); ++ tplg_log(tplg, 'D', pos, "pcm: pcm_id %d dai_id %d", pt->pcm_id, pt->dai_id); + pt->playback = pcm->playback; + pt->capture = pcm->capture; + pt->compress = pcm->compress; +- tplg_dv(tplg, pos, "pcm: playback %d capture %d compress", +- pt->playback, pt->capture, pt->compress); ++ tplg_log(tplg, 'D', pos, "pcm: playback %d capture %d compress", ++ pt->playback, pt->capture, pt->compress); + pt->num_streams = pcm->num_streams; + pt->flag_mask = pcm->flag_mask; + pt->flags = pcm->flags; +@@ -1995,8 +1995,8 @@ next: + return -EINVAL; + } + stream->name = pcm->stream[i].name; +- tplg_dv(tplg, pos + offsetof(struct snd_soc_tplg_pcm, stream[i]), +- "stream %d: '%s'", i, stream->name); ++ tplg_log(tplg, 'D', pos + offsetof(struct snd_soc_tplg_pcm, stream[i]), ++ "stream %d: '%s'", i, stream->name); + stream->format = pcm->stream[i].format; + stream->rate = pcm->stream[i].rate; + stream->period_bytes = pcm->stream[i].period_bytes; +@@ -2016,8 +2016,8 @@ next: + return -EINVAL; + } + cap->name = pcm->caps[i].name; +- tplg_dv(tplg, pos + offsetof(struct snd_soc_tplg_pcm, caps[i]), +- "caps %d: '%s'", i, cap->name); ++ tplg_log(tplg, 'D', pos + offsetof(struct snd_soc_tplg_pcm, caps[i]), ++ "caps %d: '%s'", i, cap->name); + cap->formats = pcm->caps[i].formats; + cap->rates = pcm->caps[i].rates; + cap->rate_min = pcm->caps[i].rate_min; +@@ -2033,8 +2033,8 @@ next: + cap->sig_bits = pcm->caps[i].sig_bits; + } + +- tplg_dv(tplg, pos + offsetof(struct snd_soc_tplg_pcm, priv), +- "pcm: private start"); ++ tplg_log(tplg, 'D', pos + offsetof(struct snd_soc_tplg_pcm, priv), ++ "pcm: private start"); + pt->priv = &pcm->priv; + + bin += sizeof(*pcm) + pcm->priv.size; +@@ -2120,16 +2120,16 @@ next: + return -EINVAL; + } + +- tplg_dv(tplg, pos, "link: size %d private size %d streams %d " +- "hw_configs %d", +- link->size, link->priv.size, link->num_streams, +- link->num_hw_configs); ++ tplg_log(tplg, 'D', pos, "link: size %d private size %d streams %d " ++ "hw_configs %d", ++ link->size, link->priv.size, link->num_streams, ++ link->num_hw_configs); + + lt.id = link->id; + lt.name = link->name; +- tplg_dv(tplg, pos, "link: name '%s'", lt.name); ++ tplg_log(tplg, 'D', pos, "link: name '%s'", lt.name); + lt.stream_name = link->stream_name; +- tplg_dv(tplg, pos, "link: stream_name '%s'", lt.stream_name); ++ tplg_log(tplg, 'D', pos, "link: stream_name '%s'", lt.stream_name); + lt.num_streams = link->num_streams; + lt.num_hw_configs = link->num_hw_configs; + lt.default_hw_config_id = link->default_hw_config_id; +@@ -2143,9 +2143,9 @@ next: + return -EINVAL; + } + stream->name = link->stream[i].name; +- tplg_dv(tplg, +- pos + offsetof(struct snd_soc_tplg_link_config, stream[i]), +- "stream %d: '%s'", i, stream->name); ++ tplg_log(tplg, 'D', ++ pos + offsetof(struct snd_soc_tplg_link_config, stream[i]), ++ "stream %d: '%s'", i, stream->name); + stream->format = link->stream[i].format; + stream->rate = link->stream[i].rate; + stream->period_bytes = link->stream[i].period_bytes; +@@ -2192,8 +2192,8 @@ next: + } + lt.hw_config = hws; + +- tplg_dv(tplg, pos + offsetof(struct snd_soc_tplg_pcm, priv), +- "link: private start"); ++ tplg_log(tplg, 'D', pos + offsetof(struct snd_soc_tplg_pcm, priv), ++ "link: private start"); + lt.priv = &link->priv; + + bin += sizeof(*link) + link->priv.size; +diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h +index 22fc5fba..e061db75 100644 +--- a/src/topology/tplg_local.h ++++ b/src/topology/tplg_local.h +@@ -226,6 +226,13 @@ struct tplg_table { + extern struct tplg_table tplg_table[]; + extern unsigned int tplg_table_items; + ++#define tplg_log(tplg, type, pos, fmt, args...) do { \ ++ if ((tplg)->verbose) \ ++ tplg_log_((tplg), (type), (pos), (fmt), ##args); \ ++} while (0) ++ ++void tplg_log_(snd_tplg_t *tplg, char type, size_t pos, const char *fmt, ...); ++ + void *tplg_calloc(struct list_head *heap, size_t size); + void tplg_free(struct list_head *heap); + +@@ -373,7 +380,6 @@ int tplg_save_stream_caps(snd_tplg_t *tplg, struct tplg_elem *elem, + int tplg_save_dai(snd_tplg_t *tplg, struct tplg_elem *elem, + char **dst, const char *pfx); + +-void tplg_dv(snd_tplg_t *tplg, size_t pos, const char *fmt, ...); + int tplg_decode_template(snd_tplg_t *tplg, + size_t pos, + struct snd_soc_tplg_hdr *hdr, +-- +2.24.1 + + +From d768da27e7f9f56328c61ed5d37c17ce075cbc6e Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 3 Jan 2020 22:44:15 +0100 +Subject: [PATCH 56/69] topology: tplg_dbg() cleanups + +- remove newline at the end + +Signed-off-by: Jaroslav Kysela +--- + src/topology/channel.c | 6 +++--- + src/topology/ctl.c | 40 +++++++++++++++++------------------ + src/topology/dapm.c | 32 ++++++++++++++-------------- + src/topology/data.c | 48 ++++++++++++++++++++++++------------------ + src/topology/ops.c | 8 +++---- + src/topology/pcm.c | 36 +++++++++++++++---------------- + src/topology/text.c | 6 +++--- + 7 files changed, 91 insertions(+), 85 deletions(-) + +diff --git a/src/topology/channel.c b/src/topology/channel.c +index 390c3f16..47d5ea4c 100644 +--- a/src/topology/channel.c ++++ b/src/topology/channel.c +@@ -100,7 +100,7 @@ int tplg_parse_channel(snd_tplg_t *tplg, snd_config_t *cfg, + + channel += tplg->channel_idx; + snd_config_get_id(cfg, &id); +- tplg_dbg("\tChannel %s at index %d\n", id, tplg->channel_idx); ++ tplg_dbg("\tChannel %s at index %d", id, tplg->channel_idx); + + channel_id = lookup_channel(id); + if (channel_id < 0) { +@@ -110,7 +110,7 @@ int tplg_parse_channel(snd_tplg_t *tplg, snd_config_t *cfg, + + channel->id = channel_id; + channel->size = sizeof(*channel); +- tplg_dbg("\tChan %s = %d\n", id, channel->id); ++ tplg_dbg("\tChan %s = %d", id, channel->id); + + snd_config_for_each(i, next, cfg) { + +@@ -129,7 +129,7 @@ int tplg_parse_channel(snd_tplg_t *tplg, snd_config_t *cfg, + else if (strcmp(id, "shift") == 0) + channel->shift = value; + +- tplg_dbg("\t\t%s = %d\n", id, value); ++ tplg_dbg("\t\t%s = %d", id, value); + } + + tplg->channel_idx++; +diff --git a/src/topology/ctl.c b/src/topology/ctl.c +index a5a81148..41dc2ddb 100644 +--- a/src/topology/ctl.c ++++ b/src/topology/ctl.c +@@ -54,7 +54,7 @@ static int parse_access_values(snd_config_t *cfg, + const char *value = NULL; + unsigned int j; + +- tplg_dbg(" Access:\n"); ++ tplg_dbg(" Access:"); + + snd_config_for_each(i, next, cfg) { + n = snd_config_iterator_entry(i); +@@ -67,7 +67,7 @@ static int parse_access_values(snd_config_t *cfg, + for (j = 0; j < ARRAY_SIZE(ctl_access); j++) { + if (strcmp(value, ctl_access[j].name) == 0) { + hdr->access |= ctl_access[j].value; +- tplg_dbg("\t%s\n", value); ++ tplg_dbg("\t%s", value); + break; + } + } +@@ -150,7 +150,7 @@ static int copy_tlv(struct tplg_elem *elem, struct tplg_elem *ref) + struct snd_soc_tplg_mixer_control *mixer_ctrl = elem->mixer_ctrl; + struct snd_soc_tplg_ctl_tlv *tlv = ref->tlv; + +- tplg_dbg("TLV '%s' used by '%s\n", ref->id, elem->id); ++ tplg_dbg("TLV '%s' used by '%s", ref->id, elem->id); + + /* TLV has a fixed size */ + mixer_ctrl->hdr.tlv = *tlv; +@@ -330,7 +330,7 @@ static int tplg_parse_tlv_dbscale(snd_config_t *cfg, struct tplg_elem *elem) + const char *id = NULL; + int val; + +- tplg_dbg(" scale: %s\n", elem->id); ++ tplg_dbg(" scale: %s", elem->id); + + tplg_tlv->size = sizeof(struct snd_soc_tplg_ctl_tlv); + tplg_tlv->type = SNDRV_CTL_TLVT_DB_SCALE; +@@ -348,7 +348,7 @@ static int tplg_parse_tlv_dbscale(snd_config_t *cfg, struct tplg_elem *elem) + if (tplg_get_integer(n, &val, 0)) + continue; + +- tplg_dbg("\t%s = %i\n", id, val); ++ tplg_dbg("\t%s = %i", id, val); + + /* get TLV data */ + if (strcmp(id, "min") == 0) +@@ -450,7 +450,7 @@ int tplg_parse_control_bytes(snd_tplg_t *tplg, + snd_strlcpy(be->hdr.name, elem->id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN); + be->hdr.type = SND_SOC_TPLG_TYPE_BYTES; + +- tplg_dbg(" Control Bytes: %s\n", elem->id); ++ tplg_dbg(" Control Bytes: %s", elem->id); + + snd_config_for_each(i, next, cfg) { + n = snd_config_iterator_entry(i); +@@ -468,7 +468,7 @@ int tplg_parse_control_bytes(snd_tplg_t *tplg, + return -EINVAL; + + be->base = ival; +- tplg_dbg("\t%s: %d\n", id, be->base); ++ tplg_dbg("\t%s: %d", id, be->base); + continue; + } + +@@ -477,7 +477,7 @@ int tplg_parse_control_bytes(snd_tplg_t *tplg, + return -EINVAL; + + be->num_regs = ival; +- tplg_dbg("\t%s: %d\n", id, be->num_regs); ++ tplg_dbg("\t%s: %d", id, be->num_regs); + continue; + } + +@@ -486,7 +486,7 @@ int tplg_parse_control_bytes(snd_tplg_t *tplg, + return -EINVAL; + + be->max = ival; +- tplg_dbg("\t%s: %d\n", id, be->max); ++ tplg_dbg("\t%s: %d", id, be->max); + continue; + } + +@@ -495,7 +495,7 @@ int tplg_parse_control_bytes(snd_tplg_t *tplg, + return -EINVAL; + + be->mask = ival; +- tplg_dbg("\t%s: %d\n", id, be->mask); ++ tplg_dbg("\t%s: %d", id, be->mask); + continue; + } + +@@ -515,7 +515,7 @@ int tplg_parse_control_bytes(snd_tplg_t *tplg, + return err; + + tlv_set = true; +- tplg_dbg("\t%s: %s\n", id, val); ++ tplg_dbg("\t%s: %s", id, val); + continue; + } + +@@ -625,7 +625,7 @@ int tplg_parse_control_enum(snd_tplg_t *tplg, snd_config_t *cfg, + ec->channel[j].reg = -1; + } + +- tplg_dbg(" Control Enum: %s\n", elem->id); ++ tplg_dbg(" Control Enum: %s", elem->id); + + snd_config_for_each(i, next, cfg) { + +@@ -644,7 +644,7 @@ int tplg_parse_control_enum(snd_tplg_t *tplg, snd_config_t *cfg, + return -EINVAL; + + tplg_ref_add(elem, SND_TPLG_TYPE_TEXT, val); +- tplg_dbg("\t%s: %s\n", id, val); ++ tplg_dbg("\t%s: %s", id, val); + continue; + } + +@@ -761,7 +761,7 @@ int tplg_parse_control_mixer(snd_tplg_t *tplg, + for (j = 0; j < SND_SOC_TPLG_MAX_CHAN; j++) + mc->channel[j].reg = -1; + +- tplg_dbg(" Control Mixer: %s\n", elem->id); ++ tplg_dbg(" Control Mixer: %s", elem->id); + + /* giterate trough each mixer elment */ + snd_config_for_each(i, next, cfg) { +@@ -795,7 +795,7 @@ int tplg_parse_control_mixer(snd_tplg_t *tplg, + return -EINVAL; + + mc->max = ival; +- tplg_dbg("\t%s: %d\n", id, mc->max); ++ tplg_dbg("\t%s: %d", id, mc->max); + continue; + } + +@@ -805,7 +805,7 @@ int tplg_parse_control_mixer(snd_tplg_t *tplg, + return -EINVAL; + mc->invert = ival; + +- tplg_dbg("\t%s: %d\n", id, mc->invert); ++ tplg_dbg("\t%s: %d", id, mc->invert); + continue; + } + +@@ -826,7 +826,7 @@ int tplg_parse_control_mixer(snd_tplg_t *tplg, + return err; + + tlv_set = true; +- tplg_dbg("\t%s: %s\n", id, val); ++ tplg_dbg("\t%s: %s", id, val); + continue; + } + +@@ -981,7 +981,7 @@ int tplg_add_mixer(snd_tplg_t *tplg, struct snd_tplg_mixer_template *mixer, + struct tplg_elem *elem; + int ret, i, num_channels; + +- tplg_dbg(" Control Mixer: %s\n", mixer->hdr.name); ++ tplg_dbg(" Control Mixer: %s", mixer->hdr.name); + + if (mixer->hdr.type != SND_SOC_TPLG_TYPE_MIXER) { + SNDERR("invalid mixer type %d", mixer->hdr.type); +@@ -1045,7 +1045,7 @@ int tplg_add_enum(snd_tplg_t *tplg, struct snd_tplg_enum_template *enum_ctl, + struct tplg_elem *elem; + int ret, i, num_items, num_channels; + +- tplg_dbg(" Control Enum: %s\n", enum_ctl->hdr.name); ++ tplg_dbg(" Control Enum: %s", enum_ctl->hdr.name); + + if (enum_ctl->hdr.type != SND_SOC_TPLG_TYPE_ENUM) { + SNDERR("invalid enum type %d", enum_ctl->hdr.type); +@@ -1128,7 +1128,7 @@ int tplg_add_bytes(snd_tplg_t *tplg, struct snd_tplg_bytes_template *bytes_ctl, + struct tplg_elem *elem; + int ret; + +- tplg_dbg(" Control Bytes: %s\n", bytes_ctl->hdr.name); ++ tplg_dbg(" Control Bytes: %s", bytes_ctl->hdr.name); + + if (bytes_ctl->hdr.type != SND_SOC_TPLG_TYPE_BYTES) { + SNDERR("invalid bytes type %d", bytes_ctl->hdr.type); +diff --git a/src/topology/dapm.c b/src/topology/dapm.c +index 0bf64833..cb85e667 100644 +--- a/src/topology/dapm.c ++++ b/src/topology/dapm.c +@@ -76,8 +76,8 @@ static int copy_dapm_control(struct tplg_elem *elem, struct tplg_elem *ref) + { + struct snd_soc_tplg_dapm_widget *widget = elem->widget; + +- tplg_dbg("Control '%s' used by '%s'\n", ref->id, elem->id); +- tplg_dbg("\tparent size: %d + %d -> %d, priv size -> %d\n", ++ tplg_dbg("Control '%s' used by '%s'", ref->id, elem->id); ++ tplg_dbg("\tparent size: %d + %d -> %d, priv size -> %d", + elem->size, ref->size, elem->size + ref->size, + widget->priv.size); + +@@ -210,8 +210,8 @@ int tplg_build_routes(snd_tplg_t *tplg) + } + + route = elem->route; +- tplg_dbg("\nCheck route: sink '%s', control '%s', source '%s'\n", +- route->sink, route->control, route->source); ++ tplg_dbg("Check route: sink '%s', control '%s', source '%s'", ++ route->sink, route->control, route->source); + + /* validate sink */ + if (strlen(route->sink) <= 0) { +@@ -357,7 +357,7 @@ static int tplg_parse_routes(snd_tplg_t *tplg, snd_config_t *cfg, int index) + if (err < 0) + return err; + +- tplg_dbg("route: sink '%s', control '%s', source '%s'\n", ++ tplg_dbg("route: sink '%s', control '%s', source '%s'", + line->sink, line->control, line->source); + } + +@@ -520,7 +520,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, + if (!elem) + return -ENOMEM; + +- tplg_dbg(" Widget: %s\n", elem->id); ++ tplg_dbg(" Widget: %s", elem->id); + + widget = elem->widget; + snd_strlcpy(widget->name, elem->id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN); +@@ -550,7 +550,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, + } + + widget->id = widget_type; +- tplg_dbg("\t%s: %s\n", id, val); ++ tplg_dbg("\t%s: %s", id, val); + continue; + } + +@@ -560,7 +560,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, + + snd_strlcpy(widget->sname, val, + SNDRV_CTL_ELEM_ID_NAME_MAXLEN); +- tplg_dbg("\t%s: %s\n", id, val); ++ tplg_dbg("\t%s: %s", id, val); + continue; + } + +@@ -571,7 +571,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, + + widget->reg = ival ? -1 : 0; + +- tplg_dbg("\t%s: %s\n", id, val); ++ tplg_dbg("\t%s: %s", id, val); + continue; + } + +@@ -580,7 +580,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, + return -EINVAL; + + widget->shift = ival; +- tplg_dbg("\t%s: %d\n", id, widget->shift); ++ tplg_dbg("\t%s: %d", id, widget->shift); + continue; + } + +@@ -589,7 +589,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, + return -EINVAL; + + widget->reg = ival; +- tplg_dbg("\t%s: %d\n", id, widget->reg); ++ tplg_dbg("\t%s: %d", id, widget->reg); + continue; + } + +@@ -598,7 +598,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, + return -EINVAL; + + widget->invert = ival; +- tplg_dbg("\t%s: %d\n", id, widget->invert); ++ tplg_dbg("\t%s: %d", id, widget->invert); + continue; + } + +@@ -607,7 +607,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, + return -EINVAL; + + widget->subseq = ival; +- tplg_dbg("\t%s: %d\n", id, widget->subseq); ++ tplg_dbg("\t%s: %d", id, widget->subseq); + continue; + } + +@@ -616,7 +616,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, + return -EINVAL; + + widget->event_type = ival; +- tplg_dbg("\t%s: %d\n", id, widget->event_type); ++ tplg_dbg("\t%s: %d", id, widget->event_type); + continue; + } + +@@ -625,7 +625,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, + return -EINVAL; + + widget->event_flags = ival; +- tplg_dbg("\t%s: %d\n", id, widget->event_flags); ++ tplg_dbg("\t%s: %d", id, widget->event_flags); + continue; + } + +@@ -767,7 +767,7 @@ int tplg_add_widget_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) + struct tplg_elem *elem; + int i, ret = 0; + +- tplg_dbg("Widget: %s\n", wt->name); ++ tplg_dbg("Widget: %s", wt->name); + + elem = tplg_elem_new_common(tplg, NULL, wt->name, + SND_TPLG_TYPE_DAPM_WIDGET); +diff --git a/src/topology/data.c b/src/topology/data.c +index 0b513428..37c45919 100644 +--- a/src/topology/data.c ++++ b/src/topology/data.c +@@ -87,7 +87,7 @@ int tplg_parse_refs(snd_config_t *cfg, struct tplg_elem *elem, + if (snd_config_get_string(cfg, &val) < 0) + return -EINVAL; + +- tplg_dbg("\tref data: %s\n", val); ++ tplg_dbg("\tref data: %s", val); + err = tplg_ref_add(elem, type, val); + if (err < 0) + return err; +@@ -108,7 +108,7 @@ int tplg_parse_refs(snd_config_t *cfg, struct tplg_elem *elem, + if (snd_config_get_string(n, &val) < 0) + continue; + +- tplg_dbg("\tref data: %s\n", val); ++ tplg_dbg("\tref data: %s", val); + err = tplg_ref_add(elem, type, val); + if (err < 0) + return err; +@@ -169,7 +169,7 @@ static int tplg_parse_data_file(snd_config_t *cfg, struct tplg_elem *elem) + size_t size, bytes_read; + int ret = 0; + +- tplg_dbg("data DataFile: %s\n", elem->id); ++ tplg_dbg("data DataFile: %s", elem->id); + + if (snd_config_get_string(cfg, &value) < 0) + return -EINVAL; +@@ -235,19 +235,25 @@ static void dump_priv_data(struct tplg_elem *elem ATTRIBUTE_UNUSED) + #ifdef TPLG_DEBUG + struct snd_soc_tplg_private *priv = elem->data; + unsigned char *p = (unsigned char *)priv->data; ++ char buf[128], buf2[8]; + unsigned int i; + +- tplg_dbg(" elem size = %d, priv data size = %d\n", ++ tplg_dbg(" elem size = %d, priv data size = %d", + elem->size, priv->size); + ++ buf[0] = '\0'; + for (i = 0; i < priv->size; i++) { +- if (i > 0 && (i % 16) == 0) +- tplg_dbg("\n"); ++ if (i > 0 && (i % 16) == 0) { ++ tplg_dbg("%s", buf); ++ buf[0] = '\0'; ++ } + +- tplg_dbg(" %02x:", *p++); ++ snprintf(buf2, sizeof(buf2), " %02x", *p++); ++ strcat(buf, buf2); + } + +- tplg_dbg("\n\n"); ++ if (buf[0]) ++ tplg_dbg("%s", buf); + #endif + } + +@@ -466,7 +472,7 @@ static int tplg_parse_data_hex(snd_config_t *cfg, struct tplg_elem *elem, + int size, esize, off, num; + int ret; + +- tplg_dbg(" data: %s\n", elem->id); ++ tplg_dbg(" data: %s", elem->id); + + if (snd_config_get_string(cfg, &value) < 0) + return -EINVAL; +@@ -683,7 +689,7 @@ static int build_tuples(snd_tplg_t *tplg, struct tplg_elem *elem) + if (ref->type != SND_TPLG_TYPE_TUPLE) + continue; + +- tplg_dbg("tuples '%s' used by data '%s'\n", ref->id, elem->id); ++ tplg_dbg("tuples '%s' used by data '%s'", ref->id, elem->id); + + if (!ref->elem) + ref->elem = tplg_elem_lookup(&tplg->tuple_list, +@@ -799,7 +805,7 @@ static int parse_tuple_set(snd_config_t *cfg, + if (!num_tuples) + return 0; + +- tplg_dbg("\t %d %s tuples:\n", num_tuples, id); ++ tplg_dbg("\t %d %s tuples:", num_tuples, id); + set = calloc(1, sizeof(*set) + num_tuples * sizeof(struct tplg_tuple)); + if (!set) + return -ENOMEM; +@@ -831,7 +837,7 @@ static int parse_tuple_set(snd_config_t *cfg, + continue; + snd_strlcpy(tuple->string, value, + SNDRV_CTL_ELEM_ID_NAME_MAXLEN); +- tplg_dbg("\t\t%s = %s\n", tuple->token, tuple->string); ++ tplg_dbg("\t\t%s = %s", tuple->token, tuple->string); + break; + + case SND_SOC_TPLG_TUPLE_TYPE_BOOL: +@@ -839,7 +845,7 @@ static int parse_tuple_set(snd_config_t *cfg, + if (ival < 0) + continue; + tuple->value = ival; +- tplg_dbg("\t\t%s = %d\n", tuple->token, tuple->value); ++ tplg_dbg("\t\t%s = %d", tuple->token, tuple->value); + break; + + case SND_SOC_TPLG_TUPLE_TYPE_BYTE: +@@ -862,7 +868,7 @@ static int parse_tuple_set(snd_config_t *cfg, + } + + tuple->value = tuple_val; +- tplg_dbg("\t\t%s = 0x%x\n", tuple->token, tuple->value); ++ tplg_dbg("\t\t%s = 0x%x", tuple->token, tuple->value); + break; + + default: +@@ -1047,7 +1053,7 @@ int tplg_parse_tokens(snd_tplg_t *tplg, snd_config_t *cfg, + if (!num_tokens) + return 0; + +- tplg_dbg(" Vendor tokens: %s, %d tokens\n", elem->id, num_tokens); ++ tplg_dbg(" Vendor tokens: %s, %d tokens", elem->id, num_tokens); + + tokens = calloc(1, sizeof(*tokens) + + num_tokens * sizeof(struct tplg_token)); +@@ -1067,7 +1073,7 @@ int tplg_parse_tokens(snd_tplg_t *tplg, snd_config_t *cfg, + snd_strlcpy(tokens->token[tokens->num_tokens].id, id, + SNDRV_CTL_ELEM_ID_NAME_MAXLEN); + tokens->token[tokens->num_tokens].value = value; +- tplg_dbg("\t\t %s : %d\n", tokens->token[tokens->num_tokens].id, ++ tplg_dbg("\t\t %s : %d", tokens->token[tokens->num_tokens].id, + tokens->token[tokens->num_tokens].value); + tokens->num_tokens++; + } +@@ -1116,7 +1122,7 @@ int tplg_parse_tuples(snd_tplg_t *tplg, snd_config_t *cfg, + if (!elem) + return -ENOMEM; + +- tplg_dbg(" Vendor Tuples: %s\n", elem->id); ++ tplg_dbg(" Vendor Tuples: %s", elem->id); + + tuples = calloc(1, sizeof(*tuples)); + if (!tuples) +@@ -1133,7 +1139,7 @@ int tplg_parse_tuples(snd_tplg_t *tplg, snd_config_t *cfg, + if (snd_config_get_string(n, &value) < 0) + return -EINVAL; + tplg_ref_add(elem, SND_TPLG_TYPE_TOKEN, value); +- tplg_dbg("\t refer to vendor tokens: %s\n", value); ++ tplg_dbg("\t refer to vendor tokens: %s", value); + } + + if (strcmp(id, "tuples") == 0) { +@@ -1208,7 +1214,7 @@ int tplg_parse_manifest_data(snd_tplg_t *tplg, snd_config_t *cfg, + manifest = elem->manifest; + manifest->size = elem->size; + +- tplg_dbg(" Manifest: %s\n", elem->id); ++ tplg_dbg(" Manifest: %s", elem->id); + + snd_config_for_each(i, next, cfg) { + n = snd_config_iterator_entry(i); +@@ -1402,7 +1408,7 @@ int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg, + return -EINVAL; + + elem->vendor_type = ival; +- tplg_dbg("\t%s: %d\n", id, elem->index); ++ tplg_dbg("\t%s: %d", id, elem->index); + continue; + } + } +@@ -1506,7 +1512,7 @@ int tplg_copy_data(snd_tplg_t *tplg, struct tplg_elem *elem, + return -EINVAL; + } + +- tplg_dbg("Data '%s' used by '%s'\n", ref->id, elem->id); ++ tplg_dbg("Data '%s' used by '%s'", ref->id, elem->id); + /* overlook empty private data */ + if (!ref_elem->data || !ref_elem->data->size) { + ref->elem = ref_elem; +diff --git a/src/topology/ops.c b/src/topology/ops.c +index 2885c781..110eef58 100644 +--- a/src/topology/ops.c ++++ b/src/topology/ops.c +@@ -69,7 +69,7 @@ int tplg_parse_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, snd_config_t *cfg, + const char *id, *value; + int ival; + +- tplg_dbg("\tOps\n"); ++ tplg_dbg("\tOps"); + hdr->size = sizeof(*hdr); + + snd_config_for_each(i, next, cfg) { +@@ -97,7 +97,7 @@ int tplg_parse_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, snd_config_t *cfg, + else if (strcmp(id, "get") == 0) + hdr->ops.get = ival; + +- tplg_dbg("\t\t%s = %d\n", id, ival); ++ tplg_dbg("\t\t%s = %d", id, ival); + } + + return 0; +@@ -155,7 +155,7 @@ int tplg_parse_ext_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, + const char *id, *value; + int ival; + +- tplg_dbg("\tExt Ops\n"); ++ tplg_dbg("\tExt Ops"); + + snd_config_for_each(i, next, cfg) { + +@@ -182,7 +182,7 @@ int tplg_parse_ext_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, + else if (strcmp(id, "get") == 0) + be->ext_ops.get = ival; + +- tplg_dbg("\t\t%s = %s\n", id, value); ++ tplg_dbg("\t\t%s = %s", id, value); + } + + return 0; +diff --git a/src/topology/pcm.c b/src/topology/pcm.c +index 918e3e9a..da88783f 100644 +--- a/src/topology/pcm.c ++++ b/src/topology/pcm.c +@@ -68,7 +68,7 @@ static void copy_stream_caps(const char *id ATTRIBUTE_UNUSED, + { + struct snd_soc_tplg_stream_caps *ref_caps = ref_elem->stream_caps; + +- tplg_dbg("Copy pcm caps (%ld bytes) from '%s' to '%s' \n", ++ tplg_dbg("Copy pcm caps (%ld bytes) from '%s' to '%s'", + sizeof(*caps), ref_elem->id, id); + + *caps = *ref_caps; +@@ -388,7 +388,7 @@ static int parse_unsigned(snd_config_t *n, unsigned int *dst) + { + const char *id; + if (snd_config_get_id(n, &id) >= 0) +- tplg_dbg("\t\t%s: %d\n", id, *dst); ++ tplg_dbg("\t\t%s: %d", id, *dst); + } + #endif + return 0; +@@ -415,7 +415,7 @@ int tplg_parse_stream_caps(snd_tplg_t *tplg, + sc->size = elem->size; + snd_strlcpy(sc->name, elem->id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN); + +- tplg_dbg(" PCM Capabilities: %s\n", elem->id); ++ tplg_dbg(" PCM Capabilities: %s", elem->id); + + snd_config_for_each(i, next, cfg) { + n = snd_config_iterator_entry(i); +@@ -442,7 +442,7 @@ int tplg_parse_stream_caps(snd_tplg_t *tplg, + if (err < 0) + return err; + +- tplg_dbg("\t\t%s: %s\n", id, val); ++ tplg_dbg("\t\t%s: %s", id, val); + continue; + } + +@@ -460,7 +460,7 @@ int tplg_parse_stream_caps(snd_tplg_t *tplg, + if (err < 0) + return err; + +- tplg_dbg("\t\t%s: %s\n", id, val); ++ tplg_dbg("\t\t%s: %s", id, val); + continue; + } + +@@ -625,7 +625,7 @@ static int tplg_parse_streams(snd_tplg_t *tplg ATTRIBUTE_UNUSED, + + snd_config_get_id(cfg, &id); + +- tplg_dbg("\t%s:\n", id); ++ tplg_dbg("\t%s:", id); + + switch (elem->type) { + case SND_TPLG_TYPE_PCM: +@@ -672,7 +672,7 @@ static int tplg_parse_streams(snd_tplg_t *tplg ATTRIBUTE_UNUSED, + snd_strlcpy(caps[stream].name, value, + SNDRV_CTL_ELEM_ID_NAME_MAXLEN); + +- tplg_dbg("\t\t%s\n\t\t\t%s\n", id, value); ++ tplg_dbg("\t\t%s\n\t\t\t%s", id, value); + continue; + } + } +@@ -746,7 +746,7 @@ static int tplg_parse_fe_dai(snd_tplg_t *tplg ATTRIBUTE_UNUSED, + const char *id; + + snd_config_get_id(cfg, &id); +- tplg_dbg("\t\tFE DAI %s:\n", id); ++ tplg_dbg("\t\tFE DAI %s:", id); + snd_strlcpy(pcm->dai_name, id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN); + + snd_config_for_each(i, next, cfg) { +@@ -763,7 +763,7 @@ static int tplg_parse_fe_dai(snd_tplg_t *tplg ATTRIBUTE_UNUSED, + return -EINVAL; + } + +- tplg_dbg("\t\t\tindex: %d\n", pcm->dai_id); ++ tplg_dbg("\t\t\tindex: %d", pcm->dai_id); + } + } + +@@ -847,7 +847,7 @@ int tplg_parse_pcm(snd_tplg_t *tplg, snd_config_t *cfg, + pcm->size = elem->size; + snd_strlcpy(pcm->pcm_name, elem->id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN); + +- tplg_dbg(" PCM: %s\n", elem->id); ++ tplg_dbg(" PCM: %s", elem->id); + + snd_config_for_each(i, next, cfg) { + +@@ -882,7 +882,7 @@ int tplg_parse_pcm(snd_tplg_t *tplg, snd_config_t *cfg, + + pcm->compress = ival; + +- tplg_dbg("\t%s: %d\n", id, ival); ++ tplg_dbg("\t%s: %d", id, ival); + continue; + } + +@@ -988,7 +988,7 @@ int tplg_parse_dai(snd_tplg_t *tplg, snd_config_t *cfg, + snd_strlcpy(dai->dai_name, elem->id, + SNDRV_CTL_ELEM_ID_NAME_MAXLEN); + +- tplg_dbg(" DAI: %s\n", elem->id); ++ tplg_dbg(" DAI: %s", elem->id); + + snd_config_for_each(i, next, cfg) { + +@@ -1142,7 +1142,7 @@ int tplg_parse_link(snd_tplg_t *tplg, + link->size = elem->size; + snd_strlcpy(link->name, elem->id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN); + +- tplg_dbg(" Link: %s\n", elem->id); ++ tplg_dbg(" Link: %s", elem->id); + + snd_config_for_each(i, next, cfg) { + +@@ -1168,7 +1168,7 @@ int tplg_parse_link(snd_tplg_t *tplg, + + snd_strlcpy(link->stream_name, val, + SNDRV_CTL_ELEM_ID_NAME_MAXLEN); +- tplg_dbg("\t%s: %s\n", id, val); ++ tplg_dbg("\t%s: %s", id, val); + continue; + } + +@@ -1280,7 +1280,7 @@ int tplg_parse_cc(snd_tplg_t *tplg, + link = elem->link; + link->size = elem->size; + +- tplg_dbg(" CC: %s\n", elem->id); ++ tplg_dbg(" CC: %s", elem->id); + + snd_config_for_each(i, next, cfg) { + +@@ -1412,7 +1412,7 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, + hw_cfg = elem->hw_cfg; + hw_cfg->size = elem->size; + +- tplg_dbg(" Link HW config: %s\n", elem->id); ++ tplg_dbg(" Link HW config: %s", elem->id); + + snd_config_for_each(i, next, cfg) { + +@@ -1719,7 +1719,7 @@ int tplg_add_pcm_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) + struct tplg_elem *elem; + int ret, i; + +- tplg_dbg("PCM: %s, DAI %s\n", pcm_tpl->pcm_name, pcm_tpl->dai_name); ++ tplg_dbg("PCM: %s, DAI %s", pcm_tpl->pcm_name, pcm_tpl->dai_name); + + if (pcm_tpl->num_streams > SND_SOC_TPLG_STREAM_CONFIG_MAX) + return -EINVAL; +@@ -1881,7 +1881,7 @@ int tplg_add_dai_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) + struct tplg_elem *elem; + int ret, i; + +- tplg_dbg("DAI %s\n", dai_tpl->dai_name); ++ tplg_dbg("DAI %s", dai_tpl->dai_name); + + elem = tplg_elem_new_common(tplg, NULL, dai_tpl->dai_name, + SND_TPLG_TYPE_DAI); +diff --git a/src/topology/text.c b/src/topology/text.c +index 6dbf2230..507c5450 100644 +--- a/src/topology/text.c ++++ b/src/topology/text.c +@@ -32,13 +32,13 @@ static int parse_text_values(snd_config_t *cfg, struct tplg_elem *elem) + const char *value = NULL; + int j = 0; + +- tplg_dbg(" Text Values: %s\n", elem->id); ++ tplg_dbg(" Text Values: %s", elem->id); + + snd_config_for_each(i, next, cfg) { + n = snd_config_iterator_entry(i); + + if (j == SND_SOC_TPLG_NUM_TEXTS) { +- tplg_dbg("text string number exceeds %d\n", j); ++ tplg_dbg("text string number exceeds %d", j); + return -ENOMEM; + } + +@@ -48,7 +48,7 @@ static int parse_text_values(snd_config_t *cfg, struct tplg_elem *elem) + + snd_strlcpy(&texts->items[j][0], value, + SNDRV_CTL_ELEM_ID_NAME_MAXLEN); +- tplg_dbg("\t%s\n", &texts->items[j][0]); ++ tplg_dbg("\t%s", &texts->items[j][0]); + + j++; + } +-- +2.24.1 + + +From b20b400e2f598c86abaf697d66396cecd49b3e14 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 3 Jan 2020 22:56:48 +0100 +Subject: [PATCH 57/69] topology: cosmetic changes (functions) + +Signed-off-by: Jaroslav Kysela +--- + src/topology/builder.c | 3 ++- + src/topology/ctl.c | 5 +++-- + src/topology/data.c | 17 +++++++++-------- + src/topology/parser.c | 4 ++-- + src/topology/pcm.c | 16 ++++++++-------- + 5 files changed, 24 insertions(+), 21 deletions(-) + +diff --git a/src/topology/builder.c b/src/topology/builder.c +index 7af5de08..15757668 100644 +--- a/src/topology/builder.c ++++ b/src/topology/builder.c +@@ -71,7 +71,8 @@ static ssize_t write_block_header(snd_tplg_t *tplg, unsigned int type, + } + + static int write_elem_block(snd_tplg_t *tplg, +- struct list_head *base, size_t size, int tplg_type, const char *obj_name) ++ struct list_head *base, size_t size, ++ int tplg_type, const char *obj_name) + { + struct list_head *pos, *sub_pos, *sub_base; + struct tplg_elem *elem, *elem_next; +diff --git a/src/topology/ctl.c b/src/topology/ctl.c +index 41dc2ddb..b78f1c54 100644 +--- a/src/topology/ctl.c ++++ b/src/topology/ctl.c +@@ -600,7 +600,7 @@ int tplg_save_control_bytes(snd_tplg_t *tplg ATTRIBUTE_UNUSED, + + /* Parse Control Enums. */ + int tplg_parse_control_enum(snd_tplg_t *tplg, snd_config_t *cfg, +- void *private ATTRIBUTE_UNUSED) ++ void *private ATTRIBUTE_UNUSED) + { + struct snd_soc_tplg_enum_control *ec; + struct tplg_elem *elem; +@@ -736,7 +736,8 @@ int tplg_save_control_enum(snd_tplg_t *tplg ATTRIBUTE_UNUSED, + * Mixer control. Supports multiple channels. + */ + int tplg_parse_control_mixer(snd_tplg_t *tplg, +- snd_config_t *cfg, void *private ATTRIBUTE_UNUSED) ++ snd_config_t *cfg, ++ void *private ATTRIBUTE_UNUSED) + { + struct snd_soc_tplg_mixer_control *mc; + struct tplg_elem *elem; +diff --git a/src/topology/data.c b/src/topology/data.c +index 37c45919..b63e98cd 100644 +--- a/src/topology/data.c ++++ b/src/topology/data.c +@@ -516,7 +516,7 @@ static int tplg_parse_data_hex(snd_config_t *cfg, struct tplg_elem *elem, + + /* get the token integer value from its id */ + static int get_token_value(const char *token_id, +- struct tplg_vendor_tokens *tokens) ++ struct tplg_vendor_tokens *tokens) + { + unsigned int i; + +@@ -589,7 +589,8 @@ unsigned int tplg_get_tuple_size(int type) + + /* Add a tuples object to the private buffer of its parent data element */ + static int copy_tuples(struct tplg_elem *elem, +- struct tplg_vendor_tuples *tuples, struct tplg_vendor_tokens *tokens) ++ struct tplg_vendor_tuples *tuples, ++ struct tplg_vendor_tokens *tokens) + { + struct snd_soc_tplg_private *priv = elem->data, *priv2; + struct tplg_tuple_set *tuple_set; +@@ -781,7 +782,7 @@ static const char *get_tuple_type_name(unsigned int type) + } + + static int parse_tuple_set(snd_config_t *cfg, +- struct tplg_tuple_set **s) ++ struct tplg_tuple_set **s) + { + snd_config_iterator_t i, next; + snd_config_t *n; +@@ -965,7 +966,7 @@ static int tplg_save_tuple_set(struct tplg_vendor_tuples *tuples, + } + + static int parse_tuple_sets(snd_config_t *cfg, +- struct tplg_vendor_tuples *tuples) ++ struct tplg_vendor_tuples *tuples) + { + snd_config_iterator_t i, next; + snd_config_t *n; +@@ -1033,7 +1034,7 @@ int tplg_save_tuple_sets(snd_tplg_t *tplg ATTRIBUTE_UNUSED, + /* Parse vendor tokens + */ + int tplg_parse_tokens(snd_tplg_t *tplg, snd_config_t *cfg, +- void *private ATTRIBUTE_UNUSED) ++ void *private ATTRIBUTE_UNUSED) + { + snd_config_iterator_t i, next; + snd_config_t *n; +@@ -1109,7 +1110,7 @@ int tplg_save_tokens(snd_tplg_t *tplg ATTRIBUTE_UNUSED, + /* Parse vendor tuples. + */ + int tplg_parse_tuples(snd_tplg_t *tplg, snd_config_t *cfg, +- void *private ATTRIBUTE_UNUSED) ++ void *private ATTRIBUTE_UNUSED) + { + snd_config_iterator_t i, next; + snd_config_t *n; +@@ -1193,7 +1194,7 @@ void tplg_free_tuples(void *obj) + /* Parse manifest's data references + */ + int tplg_parse_manifest_data(snd_tplg_t *tplg, snd_config_t *cfg, +- void *private ATTRIBUTE_UNUSED) ++ void *private ATTRIBUTE_UNUSED) + { + struct snd_soc_tplg_manifest *manifest; + struct tplg_elem *elem; +@@ -1341,7 +1342,7 @@ int tplg_build_manifest_data(snd_tplg_t *tplg) + * words, tuples. + */ + int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg, +- void *private ATTRIBUTE_UNUSED) ++ void *private ATTRIBUTE_UNUSED) + { + snd_config_iterator_t i, next; + snd_config_t *n; +diff --git a/src/topology/parser.c b/src/topology/parser.c +index d7783a93..436e4841 100644 +--- a/src/topology/parser.c ++++ b/src/topology/parser.c +@@ -110,8 +110,8 @@ int tplg_get_unsigned(snd_config_t *n, unsigned *val, int base) + * Parse compound + */ + int tplg_parse_compound(snd_tplg_t *tplg, snd_config_t *cfg, +- int (*fcn)(snd_tplg_t *, snd_config_t *, void *), +- void *private) ++ int (*fcn)(snd_tplg_t *, snd_config_t *, void *), ++ void *private) + { + const char *id; + snd_config_iterator_t i, next; +diff --git a/src/topology/pcm.c b/src/topology/pcm.c +index da88783f..61159d33 100644 +--- a/src/topology/pcm.c ++++ b/src/topology/pcm.c +@@ -1124,8 +1124,8 @@ static int parse_hw_config_refs(snd_tplg_t *tplg ATTRIBUTE_UNUSED, + } + + /* Parse a physical link element in text conf file */ +-int tplg_parse_link(snd_tplg_t *tplg, +- snd_config_t *cfg, void *private ATTRIBUTE_UNUSED) ++int tplg_parse_link(snd_tplg_t *tplg, snd_config_t *cfg, ++ void *private ATTRIBUTE_UNUSED) + { + struct snd_soc_tplg_link_config *link; + struct tplg_elem *elem; +@@ -1264,8 +1264,8 @@ int tplg_save_link(snd_tplg_t *tplg ATTRIBUTE_UNUSED, + } + + /* Parse cc */ +-int tplg_parse_cc(snd_tplg_t *tplg, +- snd_config_t *cfg, void *private ATTRIBUTE_UNUSED) ++int tplg_parse_cc(snd_tplg_t *tplg, snd_config_t *cfg, ++ void *private ATTRIBUTE_UNUSED) + { + struct snd_soc_tplg_link_config *link; + struct tplg_elem *elem; +@@ -1307,8 +1307,8 @@ int tplg_parse_cc(snd_tplg_t *tplg, + + /* save CC */ + int tplg_save_cc(snd_tplg_t *tplg ATTRIBUTE_UNUSED, +- struct tplg_elem *elem, +- char **dst, const char *pfx) ++ struct tplg_elem *elem, ++ char **dst, const char *pfx) + { + struct snd_soc_tplg_link_config *link = elem->link; + char pfx2[16]; +@@ -1668,7 +1668,7 @@ int tplg_save_hw_config(snd_tplg_t *tplg ATTRIBUTE_UNUSED, + + /* copy stream object */ + static void tplg_add_stream_object(struct snd_soc_tplg_stream *strm, +- struct snd_tplg_stream_template *strm_tpl) ++ struct snd_tplg_stream_template *strm_tpl) + { + snd_strlcpy(strm->name, strm_tpl->name, + SNDRV_CTL_ELEM_ID_NAME_MAXLEN); +@@ -1773,7 +1773,7 @@ int tplg_add_pcm_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) + + /* Set link HW config from C API template */ + static int set_link_hw_config(struct snd_soc_tplg_hw_config *cfg, +- struct snd_tplg_hw_config_template *tpl) ++ struct snd_tplg_hw_config_template *tpl) + { + unsigned int i; + +-- +2.24.1 + + +From 14ad963e192f101246e9b559d3b3fd41268330fb Mon Sep 17 00:00:00 2001 +From: David Fries +Date: Tue, 7 Jan 2020 09:18:10 -0600 +Subject: [PATCH 58/69] mixer: Fix memory leak for more than 16 file descriptor + case + +Signed-off-by: David Fries +Reviewed-by: Takashi Iwai +Signed-off-by: Takashi Iwai +--- + src/mixer/mixer.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/mixer/mixer.c b/src/mixer/mixer.c +index 82056474..b1af9945 100644 +--- a/src/mixer/mixer.c ++++ b/src/mixer/mixer.c +@@ -767,7 +767,7 @@ int snd_mixer_wait(snd_mixer_t *mixer, int timeout) + if (count < 0) + return count; + if ((unsigned int) count > sizeof(spfds) / sizeof(spfds[0])) { +- pfds = malloc(count * sizeof(*pfds)); ++ pfds = alloca(count * sizeof(*pfds)); + if (!pfds) + return -ENOMEM; + err = snd_mixer_poll_descriptors(mixer, pfds, +-- +2.24.1 + + +From a78dd1bd1e9b47c2aee9b1e066de515b6854695a Mon Sep 17 00:00:00 2001 +From: Bertware +Date: Mon, 13 Jan 2020 10:21:33 +0100 +Subject: [PATCH 59/69] Quote strings containing [ or ] when saving an alsa + config + +Signed-off-by: Bert Marcelis +Signed-off-by: Jaroslav Kysela +--- + src/conf.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/conf.c b/src/conf.c +index c4db9f21..50d04034 100644 +--- a/src/conf.c ++++ b/src/conf.c +@@ -1531,6 +1531,8 @@ static void string_print(char *str, int id, snd_output_t *out) + case '.': + case '{': + case '}': ++ case '[': ++ case ']': + case '\'': + case '"': + goto quoted; +-- +2.24.1 + + +From b34715004f4a1aabb85c5b9f03ba9f200638ee97 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 15 Jan 2020 09:41:05 +0100 +Subject: [PATCH 60/69] ucm: fix the configuration directory (longname) for + ucm2 + +The new ucm2 expects that the longname directory is shared with +the driver directory. Fix that for 'Syntax 2'. + +Signed-off-by: Jaroslav Kysela +--- + src/ucm/parser.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/ucm/parser.c b/src/ucm/parser.c +index d61124a3..b3970a13 100644 +--- a/src/ucm/parser.c ++++ b/src/ucm/parser.c +@@ -1649,7 +1649,9 @@ __longname: + + if (err == 0) { + /* got device-specific file that matches the card long name */ +- snd_strlcpy(uc_mgr->conf_file_name, longname, sizeof(uc_mgr->conf_file_name)); ++ if (uc_mgr->conf_format < 2) ++ snd_strlcpy(uc_mgr->conf_file_name, longname, ++ sizeof(uc_mgr->conf_file_name)); + goto __parse; + } + } +-- +2.24.1 + + +From fe6425af751a768a2ba6cf7d430a85553d3b84f6 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 15 Jan 2020 10:31:56 +0100 +Subject: [PATCH 61/69] ucm: split conf_file_name and conf_dir_name + +With ucm2, the file name might differ from the directory +name. Also, allocate those fields. + +Signed-off-by: Jaroslav Kysela +--- + src/ucm/main.c | 7 ++++--- + src/ucm/parser.c | 37 ++++++++++++++++++++++++++----------- + src/ucm/ucm_local.h | 4 ++-- + src/ucm/ucm_subs.c | 2 +- + src/ucm/utils.c | 4 ++++ + 5 files changed, 37 insertions(+), 17 deletions(-) + +diff --git a/src/ucm/main.c b/src/ucm/main.c +index 61922f10..23e15bd8 100644 +--- a/src/ucm/main.c ++++ b/src/ucm/main.c +@@ -1700,12 +1700,13 @@ int snd_use_case_get(snd_use_case_mgr_t *uc_mgr, + err = 0; + } else if (strcmp(identifier, "_file") == 0) { + /* get the conf file name of the opened card */ +- if ((uc_mgr->card_name == NULL) +- || (uc_mgr->conf_file_name[0] == '\0')) { ++ if ((uc_mgr->card_name == NULL) || ++ (uc_mgr->conf_file_name == NULL) || ++ (uc_mgr->conf_file_name[0] == '\0')) { + err = -ENOENT; + goto __end; + } +- *value = strndup(uc_mgr->conf_file_name, MAX_FILE); ++ *value = strdup(uc_mgr->conf_file_name); + if (*value == NULL) { + err = -ENOMEM; + goto __end; +diff --git a/src/ucm/parser.c b/src/ucm/parser.c +index b3970a13..1bfde0be 100644 +--- a/src/ucm/parser.c ++++ b/src/ucm/parser.c +@@ -124,6 +124,16 @@ static void configuration_filename(snd_use_case_mgr_t *uc_mgr, + configuration_filename2(fn, fn_len, 2, dir, file, suffix); + } + ++/* ++ * Replace mallocated string ++ */ ++static char *replace_string(char **dst, const char *value) ++{ ++ free(*dst); ++ *dst = strdup(value); ++ return *dst; ++} ++ + /* + * Parse string + */ +@@ -1186,7 +1196,7 @@ static int parse_verb_file(snd_use_case_mgr_t *uc_mgr, + + /* open Verb file for reading */ + configuration_filename(uc_mgr, filename, sizeof(filename), +- uc_mgr->conf_file_name, file, ""); ++ uc_mgr->conf_dir_name, file, ""); + err = uc_mgr_config_load(uc_mgr->conf_format, filename, &cfg); + if (err < 0) { + uc_error("error: failed to open verb file %s : %d", +@@ -1404,16 +1414,16 @@ static int parse_master_file(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg) + if (uc_mgr->conf_format >= 2) { + err = snd_config_search(cfg, "Syntax", &n); + if (err < 0) { +- uc_error("Syntax field not found in %s", uc_mgr->conf_file_name); ++ uc_error("Syntax field not found in %s", uc_mgr->conf_dir_name); + return -EINVAL; + } + err = snd_config_get_integer(n, &l); + if (err < 0) { +- uc_error("Syntax field is invalid in %s", uc_mgr->conf_file_name); ++ uc_error("Syntax field is invalid in %s", uc_mgr->conf_dir_name); + return err; + } + if (l < 2 || l > SYNTAX_VERSION_MAX) { +- uc_error("Incompatible syntax %d in %s", l, uc_mgr->conf_file_name); ++ uc_error("Incompatible syntax %d in %s", l, uc_mgr->conf_dir_name); + return -EINVAL; + } + /* delete this field to avoid strcmp() call in the loop */ +@@ -1561,8 +1571,9 @@ static int get_by_card(snd_use_case_mgr_t *mgr, const char *ctl_name, char *long + return err; + + _name = snd_ctl_card_info_get_name(info); ++ if (replace_string(&mgr->conf_dir_name, _name) == NULL) ++ return -ENOMEM; + _long_name = snd_ctl_card_info_get_longname(info); +- snd_strlcpy(mgr->conf_file_name, _name, sizeof(mgr->conf_file_name)); + snd_strlcpy(longname, _long_name, MAX_CARD_LONG_NAME); + + return 0; +@@ -1585,7 +1596,7 @@ static int load_master_config(snd_use_case_mgr_t *uc_mgr, + if (getenv(ALSA_CONFIG_UCM2_VAR) || !getenv(ALSA_CONFIG_UCM_VAR)) { + uc_mgr->conf_format = 2; + configuration_filename(uc_mgr, filename, sizeof(filename), +- uc_mgr->conf_file_name, card_name, ".conf"); ++ uc_mgr->conf_dir_name, card_name, ".conf"); + if (access(filename, R_OK) == 0) + goto __load; + } +@@ -1608,6 +1619,9 @@ __load: + return err; + } + ++ if (replace_string(&uc_mgr->conf_file_name, card_name) == NULL) ++ return -ENOMEM; ++ + return 0; + } + +@@ -1632,7 +1646,8 @@ int uc_mgr_import_master_config(snd_use_case_mgr_t *uc_mgr) + char longname[MAX_CARD_LONG_NAME]; + int err; + +- snd_strlcpy(uc_mgr->conf_file_name, uc_mgr->card_name, sizeof(uc_mgr->conf_file_name)); ++ if (replace_string(&uc_mgr->conf_dir_name, uc_mgr->card_name) == NULL) ++ return -ENOMEM; + + if (strncmp(name, "hw:", 3) == 0) { + err = get_by_card(uc_mgr, name, longname); +@@ -1650,14 +1665,14 @@ __longname: + if (err == 0) { + /* got device-specific file that matches the card long name */ + if (uc_mgr->conf_format < 2) +- snd_strlcpy(uc_mgr->conf_file_name, longname, +- sizeof(uc_mgr->conf_file_name)); ++ snd_strlcpy(uc_mgr->conf_dir_name, longname, ++ sizeof(uc_mgr->conf_dir_name)); + goto __parse; + } + } + + /* standard path */ +- err = load_master_config(uc_mgr, uc_mgr->conf_file_name, &cfg, 0); ++ err = load_master_config(uc_mgr, uc_mgr->conf_dir_name, &cfg, 0); + if (err < 0) + goto __error; + +@@ -1673,7 +1688,7 @@ __parse: + + __error: + uc_mgr_free_ctl_list(uc_mgr); +- uc_mgr->conf_file_name[0] = '\0'; ++ uc_mgr->conf_dir_name[0] = '\0'; + return err; + } + +diff --git a/src/ucm/ucm_local.h b/src/ucm/ucm_local.h +index ba961507..63e0f3bf 100644 +--- a/src/ucm/ucm_local.h ++++ b/src/ucm/ucm_local.h +@@ -187,7 +187,6 @@ struct use_case_verb { + /* verb transition list */ + struct list_head transition_list; + +- /* hardware devices that can be used with this use case */ + struct list_head device_list; + + /* component device list */ +@@ -205,7 +204,8 @@ struct use_case_verb { + */ + struct snd_use_case_mgr { + char *card_name; +- char conf_file_name[MAX_CARD_LONG_NAME]; ++ char *conf_file_name; ++ char *conf_dir_name; + char *comment; + int conf_format; + +diff --git a/src/ucm/ucm_subs.c b/src/ucm/ucm_subs.c +index 90e395f0..d931f603 100644 +--- a/src/ucm/ucm_subs.c ++++ b/src/ucm/ucm_subs.c +@@ -31,7 +31,7 @@ + + static char *rval_conf_name(snd_use_case_mgr_t *uc_mgr) + { +- if (uc_mgr->conf_file_name[0]) ++ if (uc_mgr->conf_file_name && uc_mgr->conf_file_name[0]) + return strdup(uc_mgr->conf_file_name); + return NULL; + } +diff --git a/src/ucm/utils.c b/src/ucm/utils.c +index cde1d672..daa568c1 100644 +--- a/src/ucm/utils.c ++++ b/src/ucm/utils.c +@@ -441,7 +441,11 @@ void uc_mgr_free_verb(snd_use_case_mgr_t *uc_mgr) + uc_mgr_free_sequence(&uc_mgr->default_list); + uc_mgr_free_value(&uc_mgr->value_list); + free(uc_mgr->comment); ++ free(uc_mgr->conf_dir_name); ++ free(uc_mgr->conf_file_name); + uc_mgr->comment = NULL; ++ uc_mgr->conf_dir_name = NULL; ++ uc_mgr->conf_file_name = NULL; + uc_mgr->active_verb = NULL; + INIT_LIST_HEAD(&uc_mgr->active_devices); + INIT_LIST_HEAD(&uc_mgr->active_modifiers); +-- +2.24.1 + + +From ebf5213cd61824b10bcaf67c570919e2a9ea0e1f Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 15 Jan 2020 10:40:01 +0100 +Subject: [PATCH 62/69] ucm: remove MAX_FILE definition and use correct + PATH_MAX + +Signed-off-by: Jaroslav Kysela +--- + src/ucm/parser.c | 6 +++--- + src/ucm/ucm_local.h | 1 - + 2 files changed, 3 insertions(+), 4 deletions(-) + +diff --git a/src/ucm/parser.c b/src/ucm/parser.c +index 1bfde0be..6c13fafd 100644 +--- a/src/ucm/parser.c ++++ b/src/ucm/parser.c +@@ -1167,7 +1167,7 @@ static int parse_verb_file(snd_use_case_mgr_t *uc_mgr, + snd_config_t *n; + struct use_case_verb *verb; + snd_config_t *cfg; +- char filename[MAX_FILE]; ++ char filename[PATH_MAX]; + int err; + + /* allocate verb */ +@@ -1582,7 +1582,7 @@ static int get_by_card(snd_use_case_mgr_t *mgr, const char *ctl_name, char *long + static int load_master_config(snd_use_case_mgr_t *uc_mgr, + const char *card_name, snd_config_t **cfg, int longname) + { +- char filename[MAX_FILE]; ++ char filename[PATH_MAX]; + int err; + + if (strnlen(card_name, MAX_CARD_LONG_NAME) == MAX_CARD_LONG_NAME) { +@@ -1733,7 +1733,7 @@ static int is_component_directory(const char *dir) + */ + int uc_mgr_scan_master_configs(const char **_list[]) + { +- char filename[MAX_FILE], dfl[MAX_FILE]; ++ char filename[PATH_MAX], dfl[PATH_MAX]; + char *env = getenv(ALSA_CONFIG_UCM2_VAR); + const char **list, *d_name; + snd_config_t *cfg, *c; +diff --git a/src/ucm/ucm_local.h b/src/ucm/ucm_local.h +index 63e0f3bf..fa9fc166 100644 +--- a/src/ucm/ucm_local.h ++++ b/src/ucm/ucm_local.h +@@ -42,7 +42,6 @@ + + #define SYNTAX_VERSION_MAX 2 + +-#define MAX_FILE 256 + #define MAX_CARD_SHORT_NAME 32 + #define MAX_CARD_LONG_NAME 80 + +-- +2.24.1 + + +From fbe1ac4a09933f527aff860aad035586367f21b4 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 15 Jan 2020 10:41:35 +0100 +Subject: [PATCH 63/69] topology: remove MAX_FILE definition and use correct + PATH_MAX + +Signed-off-by: Jaroslav Kysela +--- + src/topology/data.c | 2 +- + src/topology/tplg_local.h | 1 - + 2 files changed, 1 insertion(+), 2 deletions(-) + +diff --git a/src/topology/data.c b/src/topology/data.c +index b63e98cd..5742b357 100644 +--- a/src/topology/data.c ++++ b/src/topology/data.c +@@ -163,7 +163,7 @@ static int tplg_parse_data_file(snd_config_t *cfg, struct tplg_elem *elem) + { + struct snd_soc_tplg_private *priv = NULL; + const char *value = NULL; +- char filename[MAX_FILE]; ++ char filename[PATH_MAX]; + char *env = getenv(ALSA_CONFIG_TPLG_VAR); + FILE *fp; + size_t size, bytes_read; +diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h +index e061db75..5ace0d19 100644 +--- a/src/topology/tplg_local.h ++++ b/src/topology/tplg_local.h +@@ -29,7 +29,6 @@ + #define tplg_dbg(fmt, arg...) do { } while (0) + #endif + +-#define MAX_FILE 256 + #define TPLG_MAX_PRIV_SIZE (1024 * 128) + + /** The name of the environment variable containing the tplg directory */ +-- +2.24.1 + + +From 7d3fec6ac68de0244621ae0aca7474d159336639 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 17 Jan 2020 18:21:08 +0100 +Subject: [PATCH 64/69] ucm: parser - cosmetic fixes in the comments + +Signed-off-by: Jaroslav Kysela +--- + src/ucm/parser.c | 63 ++++++++++++++++++++++++------------------------ + 1 file changed, 31 insertions(+), 32 deletions(-) + +diff --git a/src/ucm/parser.c b/src/ucm/parser.c +index 6c13fafd..6c5d2902 100644 +--- a/src/ucm/parser.c ++++ b/src/ucm/parser.c +@@ -676,42 +676,41 @@ static int parse_value(snd_use_case_mgr_t *uc_mgr ATTRIBUTE_UNUSED, + /* + * Parse Modifier Use cases + * +- * # Each modifier is described in new section. N modifiers are allowed +- * SectionModifier."Capture Voice" { ++ * # Each modifier is described in new section. N modifiers are allowed ++ * SectionModifier."Capture Voice" { + * +- * Comment "Record voice call" ++ * Comment "Record voice call" + * +- * SupportedDevice [ +- * "x" +- * "y" +- * ] +- * +- * ConflictingDevice [ +- * "x" +- * "y" +- * ] ++ * SupportedDevice [ ++ * "x" ++ * "y" ++ * ] + * +- * EnableSequence [ +- * .... +- * ] ++ * ConflictingDevice [ ++ * "x" ++ * "y" ++ * ] + * +- * DisableSequence [ +- * ... +- * ] ++ * EnableSequence [ ++ * .... ++ * ] + * +- * TransitionSequence."ToModifierName" [ +- * ... +- * ] ++ * DisableSequence [ ++ * ... ++ * ] + * +- * # Optional TQ and ALSA PCMs +- * Value { +- * TQ Voice +- * CapturePCM "hw:1" +- * PlaybackVolume "name='Master Playback Volume',index=2" +- * PlaybackSwitch "name='Master Playback Switch',index=2" +- * } ++ * TransitionSequence."ToModifierName" [ ++ * ... ++ * ] + * +- * } ++ * # Optional TQ and ALSA PCMs ++ * Value { ++ * TQ Voice ++ * CapturePCM "hw:1" ++ * PlaybackVolume "name='Master Playback Volume',index=2" ++ * PlaybackSwitch "name='Master Playback Switch',index=2" ++ * } ++ * } + * + * SupportedDevice and ConflictingDevice cannot be specified together. + * Both are optional. +@@ -836,11 +835,11 @@ static int parse_modifier(snd_use_case_mgr_t *uc_mgr, + /* + * Parse Device Use Cases + * +- *# Each device is described in new section. N devices are allowed +- *SectionDevice."Headphones" { ++ * # Each device is described in new section. N devices are allowed ++ * SectionDevice."Headphones" { + * Comment "Headphones connected to 3.5mm jack" + * +- * upportedDevice [ ++ * SupportedDevice [ + * "x" + * "y" + * ] +-- +2.24.1 + + +From b2fe99277a73ec80eac0bd221672dd4aa02defa7 Mon Sep 17 00:00:00 2001 +From: Tanu Kaskinen +Date: Fri, 20 Dec 2019 09:26:12 +0200 +Subject: [PATCH 65/69] configure.ac: remove an unnecessary libtool fix + +This code was added in commit 75d393a563efb578c79364a277087c6326267f52 +without explaining why. I assume it was a mistake, since it looks like +the libtool problem should have gone away a long time ago. The referenced +wiki page https://wiki.debian.org/RpathIssue says: + + Since libtool 1.5.2 (released 2004-01-25), on Linux libtool no + longer sets RPATH for any directories in the dynamic linker search + path, so this should no longer be an issue unless upstream used a + really old version of libtool when creating their distribution + tarball. + +This code caused problems in OpenEmbedded, where the libtool script is +named "x86_64-oe-linux-libtool" or similar rather than just "libtool", +so the sed command failed with a file not found error. Rather than +adapting the code to OpenEmbedded's peculiarities, it seems best to just +remove the unnecessary code altogether. + +Note: The rpath is set (hardcoded) for 'make' but it is corrected +for 'make install' by libtool. + +Signed-off-by: Tanu Kaskinen +Signed-off-by: Jaroslav Kysela +--- + configure.ac | 11 ----------- + 1 file changed, 11 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 886f87bc..fb60c030 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -765,14 +765,3 @@ test "$build_seq" = "yes" && echo "#include " >> include/asoundlib.h + test "$build_seq" = "yes" && echo "#include " >> include/asoundlib.h + test "$build_seq" = "yes" && echo "#include " >> include/asoundlib.h + cat "$srcdir"/include/asoundlib-tail.h >> include/asoundlib.h +- +-dnl Taken from https://wiki.debian.org/RpathIssue +-case $host in +- *-*-linux-gnu) +- AC_MSG_RESULT([Fixing libtool for -rpath problems.]) +- sed < libtool > libtool-2 \ +- 's/^hardcode_libdir_flag_spec.*$'/'hardcode_libdir_flag_spec=" -D__LIBTOOL_IS_A_FOOL__ "/' +- mv libtool-2 libtool +- chmod 755 libtool +- ;; +-esac +-- +2.24.1 + + +From c5a09b0feaf759957dfac2c797b652781a0d41fe Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 3 Feb 2020 14:44:13 +0100 +Subject: [PATCH 66/69] ucm: parser - use correct filename in + parser_master_file() + +Signed-off-by: Jaroslav Kysela +--- + src/ucm/parser.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/ucm/parser.c b/src/ucm/parser.c +index 6c5d2902..dbbd3817 100644 +--- a/src/ucm/parser.c ++++ b/src/ucm/parser.c +@@ -1413,16 +1413,16 @@ static int parse_master_file(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg) + if (uc_mgr->conf_format >= 2) { + err = snd_config_search(cfg, "Syntax", &n); + if (err < 0) { +- uc_error("Syntax field not found in %s", uc_mgr->conf_dir_name); ++ uc_error("Syntax field not found in %s", uc_mgr->conf_file_name); + return -EINVAL; + } + err = snd_config_get_integer(n, &l); + if (err < 0) { +- uc_error("Syntax field is invalid in %s", uc_mgr->conf_dir_name); ++ uc_error("Syntax field is invalid in %s", uc_mgr->conf_file_name); + return err; + } + if (l < 2 || l > SYNTAX_VERSION_MAX) { +- uc_error("Incompatible syntax %d in %s", l, uc_mgr->conf_dir_name); ++ uc_error("Incompatible syntax %d in %s", l, uc_mgr->conf_file_name); + return -EINVAL; + } + /* delete this field to avoid strcmp() call in the loop */ +-- +2.24.1 + + +From 71a1367bcabc50f99302d8c76395f1cb84975775 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 3 Feb 2020 15:24:19 +0100 +Subject: [PATCH 67/69] ucm: the ucm2/ subdirectory is driver name based + +Signed-off-by: Jaroslav Kysela +--- + src/ucm/parser.c | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +diff --git a/src/ucm/parser.c b/src/ucm/parser.c +index dbbd3817..f576fde4 100644 +--- a/src/ucm/parser.c ++++ b/src/ucm/parser.c +@@ -1515,7 +1515,7 @@ static int get_card_long_name(snd_use_case_mgr_t *mgr, char *longname) + int card, err; + snd_ctl_t *ctl; + snd_ctl_card_info_t *info; +- const char *_name, *_long_name; ++ const char *_driver, *_name, *_long_name; + + snd_ctl_card_info_alloca(&info); + +@@ -1535,9 +1535,11 @@ static int get_card_long_name(snd_use_case_mgr_t *mgr, char *longname) + err = get_card_info(mgr, name, &ctl, info); + + if (err == 0) { ++ _driver = snd_ctl_card_info_get_driver(info); + _name = snd_ctl_card_info_get_name(info); + _long_name = snd_ctl_card_info_get_longname(info); +- if (!strcmp(card_name, _name) || ++ if (!strcmp(card_name, _driver) || ++ !strcmp(card_name, _name) || + !strcmp(card_name, _long_name)) { + snd_strlcpy(longname, _long_name, MAX_CARD_LONG_NAME); + return 0; +@@ -1560,7 +1562,7 @@ static int get_by_card(snd_use_case_mgr_t *mgr, const char *ctl_name, char *long + { + snd_ctl_t *ctl; + snd_ctl_card_info_t *info; +- const char *_name, *_long_name; ++ const char *_driver, *_long_name; + int err; + + snd_ctl_card_info_alloca(&info); +@@ -1569,8 +1571,8 @@ static int get_by_card(snd_use_case_mgr_t *mgr, const char *ctl_name, char *long + if (err) + return err; + +- _name = snd_ctl_card_info_get_name(info); +- if (replace_string(&mgr->conf_dir_name, _name) == NULL) ++ _driver = snd_ctl_card_info_get_driver(info); ++ if (replace_string(&mgr->conf_dir_name, _driver) == NULL) + return -ENOMEM; + _long_name = snd_ctl_card_info_get_longname(info); + snd_strlcpy(longname, _long_name, MAX_CARD_LONG_NAME); +-- +2.24.1 + + +From 251bc204a1e7f1bf1d12b452f2b62e15543bba94 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 7 Feb 2020 10:09:07 +0100 +Subject: [PATCH 68/69] ucm: implement RenameDevice and RemoveDevice verb + management + +With the conditionals, it may be useful to define the devices +in the included configuration files. To satisfy the specification +requirements (device naming) those device names might require +to be renamed or deleted wrong references from the conflicting +or supported lists. + +Signed-off-by: Jaroslav Kysela +--- + src/ucm/parser.c | 129 +++++++++++++++++++++++++++++++++++++++++++- + src/ucm/ucm_local.h | 15 ++++++ + src/ucm/utils.c | 123 +++++++++++++++++++++++++++++++++++++----- + 3 files changed, 254 insertions(+), 13 deletions(-) + +diff --git a/src/ucm/parser.c b/src/ucm/parser.c +index f576fde4..f9a8f628 100644 +--- a/src/ucm/parser.c ++++ b/src/ucm/parser.c +@@ -985,6 +985,71 @@ static int parse_device(snd_use_case_mgr_t *uc_mgr, + return 0; + } + ++/* ++ * Parse Device Rename/Delete Command ++ * ++ * # The devices might be renamed to allow the better conditional runtime ++ * # evaluation. Bellow example renames Speaker1 device to Speaker and ++ * # removes Speaker2 device. ++ * RenameDevice."Speaker1" "Speaker" ++ * RemoveDevice."Speaker2" "Speaker2" ++ */ ++static int parse_dev_name_list(snd_config_t *cfg, ++ struct list_head *list) ++{ ++ snd_config_t *n; ++ snd_config_iterator_t i, next; ++ const char *id, *name1; ++ char *name2; ++ struct ucm_dev_name *dev; ++ snd_config_iterator_t pos; ++ int err; ++ ++ if (snd_config_get_id(cfg, &id) < 0) ++ return -EINVAL; ++ ++ if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) { ++ uc_error("compound type expected for %s", id); ++ return -EINVAL; ++ } ++ ++ snd_config_for_each(i, next, cfg) { ++ n = snd_config_iterator_entry(i); ++ ++ if (snd_config_get_id(n, &name1) < 0) ++ return -EINVAL; ++ ++ err = parse_string(n, &name2); ++ if (err < 0) { ++ uc_error("error: failed to get target device name for '%s'", name1); ++ return err; ++ } ++ ++ /* skip duplicates */ ++ list_for_each(pos, list) { ++ dev = list_entry(pos, struct ucm_dev_name, list); ++ if (strcmp(dev->name1, name1) == 0) { ++ free(name2); ++ return 0; ++ } ++ } ++ ++ dev = calloc(1, sizeof(*dev)); ++ if (dev == NULL) ++ return -ENOMEM; ++ dev->name1 = strdup(name1); ++ if (dev->name1 == NULL) { ++ free(dev); ++ free(name2); ++ return -ENOMEM; ++ } ++ dev->name2 = name2; ++ list_add_tail(&dev->list, list); ++ } ++ ++ return 0; ++} ++ + static int parse_compound_check_legacy(snd_use_case_mgr_t *uc_mgr, + snd_config_t *cfg, + int (*fcn)(snd_use_case_mgr_t *, snd_config_t *, void *, void *), +@@ -1044,7 +1109,39 @@ static int parse_modifier_name(snd_use_case_mgr_t *uc_mgr, + void *data1, + void *data2 ATTRIBUTE_UNUSED) + { +- return parse_compound_check_legacy(uc_mgr, cfg, parse_modifier, data1); ++ return parse_compound(uc_mgr, cfg, parse_modifier, data1, data2); ++} ++ ++static int verb_device_management(struct use_case_verb *verb) ++{ ++ struct list_head *pos; ++ struct ucm_dev_name *dev; ++ int err; ++ ++ /* rename devices */ ++ list_for_each(pos, &verb->rename_list) { ++ dev = list_entry(pos, struct ucm_dev_name, list); ++ err = uc_mgr_rename_device(verb, dev->name1, dev->name2); ++ if (err < 0) { ++ uc_error("error: cannot rename device '%s' to '%s'", dev->name1, dev->name2); ++ return err; ++ } ++ } ++ ++ /* remove devices */ ++ list_for_each(pos, &verb->rename_list) { ++ dev = list_entry(pos, struct ucm_dev_name, list); ++ err = uc_mgr_remove_device(verb, dev->name2); ++ if (err < 0) { ++ uc_error("error: cannot remove device '%s'", dev->name2); ++ return err; ++ } ++ } ++ ++ /* those lists are no longer used */ ++ uc_mgr_free_dev_name_list(&verb->rename_list); ++ uc_mgr_free_dev_name_list(&verb->remove_list); ++ return 0; + } + + /* +@@ -1180,6 +1277,8 @@ static int parse_verb_file(snd_use_case_mgr_t *uc_mgr, + INIT_LIST_HEAD(&verb->cmpt_device_list); + INIT_LIST_HEAD(&verb->modifier_list); + INIT_LIST_HEAD(&verb->value_list); ++ INIT_LIST_HEAD(&verb->rename_list); ++ INIT_LIST_HEAD(&verb->remove_list); + list_add_tail(&verb->list, &uc_mgr->verb_list); + if (use_case_name == NULL) + return -EINVAL; +@@ -1249,6 +1348,26 @@ static int parse_verb_file(snd_use_case_mgr_t *uc_mgr, + } + continue; + } ++ ++ /* device renames */ ++ if (strcmp(id, "RenameDevice") == 0) { ++ err = parse_dev_name_list(n, &verb->rename_list); ++ if (err < 0) { ++ uc_error("error: %s failed to parse device rename", ++ file); ++ goto _err; ++ } ++ } ++ ++ /* device remove */ ++ if (strcmp(id, "RemoveDevice") == 0) { ++ err = parse_dev_name_list(n, &verb->remove_list); ++ if (err < 0) { ++ uc_error("error: %s failed to parse device remove", ++ file); ++ goto _err; ++ } ++ } + } + + snd_config_delete(cfg); +@@ -1258,6 +1377,14 @@ static int parse_verb_file(snd_use_case_mgr_t *uc_mgr, + uc_error("error: no use case device defined", file); + return -EINVAL; + } ++ ++ /* do device rename and delete */ ++ err = verb_device_management(verb); ++ if (err < 0) { ++ uc_error("error: device management error in verb '%s'", verb->name); ++ return err; ++ } ++ + return 0; + + _err: +diff --git a/src/ucm/ucm_local.h b/src/ucm/ucm_local.h +index fa9fc166..ba8d2acb 100644 +--- a/src/ucm/ucm_local.h ++++ b/src/ucm/ucm_local.h +@@ -117,6 +117,12 @@ struct ctl_list { + snd_ctl_card_info_t *ctl_info; + }; + ++struct ucm_dev_name { ++ struct list_head list; ++ char *name1; ++ char *name2; ++}; ++ + /* + * Describes a Use Case Modifier and it's enable and disable sequences. + * A use case verb can have N modifiers. +@@ -196,6 +202,10 @@ struct use_case_verb { + + /* value list */ + struct list_head value_list; ++ ++ /* temporary modifications lists */ ++ struct list_head rename_list; ++ struct list_head remove_list; + }; + + /* +@@ -252,6 +262,11 @@ int uc_mgr_config_load(int format, const char *file, snd_config_t **cfg); + int uc_mgr_import_master_config(snd_use_case_mgr_t *uc_mgr); + int uc_mgr_scan_master_configs(const char **_list[]); + ++int uc_mgr_remove_device(struct use_case_verb *verb, const char *name); ++int uc_mgr_rename_device(struct use_case_verb *verb, const char *src, ++ const char *dst); ++ ++void uc_mgr_free_dev_name_list(struct list_head *base); + void uc_mgr_free_sequence_element(struct sequence_element *seq); + void uc_mgr_free_transition_element(struct transition_sequence *seq); + void uc_mgr_free_verb(snd_use_case_mgr_t *uc_mgr); +diff --git a/src/ucm/utils.c b/src/ucm/utils.c +index daa568c1..60a59172 100644 +--- a/src/ucm/utils.c ++++ b/src/ucm/utils.c +@@ -328,6 +328,44 @@ void uc_mgr_free_dev_list(struct dev_list *dev_list) + } + } + ++int uc_mgr_rename_in_dev_list(struct dev_list *dev_list, const char *src, ++ const char *dst) ++{ ++ struct list_head *pos; ++ struct dev_list_node *dlist; ++ char *dst1; ++ ++ list_for_each(pos, &dev_list->list) { ++ dlist = list_entry(pos, struct dev_list_node, list); ++ if (strcmp(dlist->name, src) == 0) { ++ dst1 = strdup(dst); ++ if (dst1 == NULL) ++ return -ENOMEM; ++ free(dlist->name); ++ dlist->name = dst1; ++ return 0; ++ } ++ } ++ return -ENOENT; ++} ++ ++int uc_mgr_remove_from_dev_list(struct dev_list *dev_list, const char *name) ++{ ++ struct list_head *pos; ++ struct dev_list_node *dlist; ++ ++ list_for_each(pos, &dev_list->list) { ++ dlist = list_entry(pos, struct dev_list_node, list); ++ if (strcmp(dlist->name, name) == 0) { ++ free(dlist->name); ++ list_del(&dlist->list); ++ free(dlist); ++ return 0; ++ } ++ } ++ return -ENODEV; ++} ++ + void uc_mgr_free_sequence_element(struct sequence_element *seq) + { + if (seq == NULL) +@@ -381,6 +419,20 @@ void uc_mgr_free_transition(struct list_head *base) + } + } + ++void uc_mgr_free_dev_name_list(struct list_head *base) ++{ ++ struct list_head *pos, *npos; ++ struct ucm_dev_name *dev; ++ ++ list_for_each_safe(pos, npos, base) { ++ dev = list_entry(pos, struct ucm_dev_name, list); ++ list_del(&dev->list); ++ free(dev->name1); ++ free(dev->name2); ++ free(dev); ++ } ++} ++ + void uc_mgr_free_modifier(struct list_head *base) + { + struct list_head *pos, *npos; +@@ -400,23 +452,68 @@ void uc_mgr_free_modifier(struct list_head *base) + } + } + +-void uc_mgr_free_device(struct list_head *base) ++void uc_mgr_free_device(struct use_case_device *dev) ++{ ++ free(dev->name); ++ free(dev->comment); ++ uc_mgr_free_sequence(&dev->enable_list); ++ uc_mgr_free_sequence(&dev->disable_list); ++ uc_mgr_free_transition(&dev->transition_list); ++ uc_mgr_free_dev_list(&dev->dev_list); ++ uc_mgr_free_value(&dev->value_list); ++ list_del(&dev->list); ++ free(dev); ++} ++ ++void uc_mgr_free_device_list(struct list_head *base) + { + struct list_head *pos, *npos; + struct use_case_device *dev; + + list_for_each_safe(pos, npos, base) { + dev = list_entry(pos, struct use_case_device, list); +- free(dev->name); +- free(dev->comment); +- uc_mgr_free_sequence(&dev->enable_list); +- uc_mgr_free_sequence(&dev->disable_list); +- uc_mgr_free_transition(&dev->transition_list); +- uc_mgr_free_dev_list(&dev->dev_list); +- uc_mgr_free_value(&dev->value_list); +- list_del(&dev->list); +- free(dev); ++ uc_mgr_free_device(dev); ++ } ++} ++ ++int uc_mgr_rename_device(struct use_case_verb *verb, const char *src, ++ const char *dst) ++{ ++ struct use_case_device *device; ++ struct list_head *pos, *npos; ++ char *dst1; ++ ++ /* no errors when device is not found */ ++ list_for_each_safe(pos, npos, &verb->device_list) { ++ device = list_entry(pos, struct use_case_device, list); ++ if (strcmp(device->name, src) == 0) { ++ dst1 = strdup(dst); ++ if (dst1 == NULL) ++ return -ENOMEM; ++ free(device->name); ++ device->name = dst1; ++ continue; ++ } ++ uc_mgr_rename_in_dev_list(&device->dev_list, src, dst); ++ } ++ return 0; ++} ++ ++int uc_mgr_remove_device(struct use_case_verb *verb, const char *name) ++{ ++ struct use_case_device *device; ++ struct list_head *pos, *npos; ++ ++ list_for_each_safe(pos, npos, &verb->device_list) { ++ device = list_entry(pos, struct use_case_device, list); ++ if (strcmp(device->name, name) == 0) { ++ uc_mgr_free_device(device); ++ continue; ++ } ++ uc_mgr_remove_from_dev_list(&device->dev_list, name); ++ return 0; + } ++ return -ENOENT; + } + + void uc_mgr_free_verb(snd_use_case_mgr_t *uc_mgr) +@@ -432,9 +529,11 @@ void uc_mgr_free_verb(snd_use_case_mgr_t *uc_mgr) + uc_mgr_free_sequence(&verb->disable_list); + uc_mgr_free_transition(&verb->transition_list); + uc_mgr_free_value(&verb->value_list); +- uc_mgr_free_device(&verb->device_list); +- uc_mgr_free_device(&verb->cmpt_device_list); ++ uc_mgr_free_device_list(&verb->device_list); ++ uc_mgr_free_device_list(&verb->cmpt_device_list); + uc_mgr_free_modifier(&verb->modifier_list); ++ uc_mgr_free_dev_name_list(&verb->rename_list); ++ uc_mgr_free_dev_name_list(&verb->remove_list); + list_del(&verb->list); + free(verb); + } +-- +2.24.1 + + +From fdf96312fa3c9261db2954afcde8c6a15d2ebe44 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 7 Feb 2020 16:18:11 +0100 +Subject: [PATCH 69/69] ucm: fill missing device entries (conflicting / + supported) + +It is not necessary to maintain this information in sync in the configuration +files. Fill the missing entries to the complementary devices. + +Signed-off-by: Jaroslav Kysela +--- + src/ucm/parser.c | 50 ++++++++++++++++++++++++++++++++++++++++++++- + src/ucm/ucm_local.h | 1 + + src/ucm/utils.c | 25 +++++++++++++++++++++++ + 3 files changed, 75 insertions(+), 1 deletion(-) + +diff --git a/src/ucm/parser.c b/src/ucm/parser.c +index f9a8f628..23bf6a63 100644 +--- a/src/ucm/parser.c ++++ b/src/ucm/parser.c +@@ -1112,6 +1112,52 @@ static int parse_modifier_name(snd_use_case_mgr_t *uc_mgr, + return parse_compound(uc_mgr, cfg, parse_modifier, data1, data2); + } + ++static int verb_dev_list_add(struct use_case_verb *verb, ++ enum dev_list_type dst_type, ++ const char *dst, ++ const char *src) ++{ ++ struct use_case_device *device; ++ struct list_head *pos; ++ ++ list_for_each(pos, &verb->device_list) { ++ device = list_entry(pos, struct use_case_device, list); ++ if (strcmp(device->name, dst) != 0) ++ continue; ++ if (device->dev_list.type != dst_type) { ++ if (list_empty(&device->dev_list.list)) { ++ device->dev_list.type = dst_type; ++ } else { ++ uc_error("error: incompatible device list type ('%s', '%s')", ++ device->name, src); ++ return -EINVAL; ++ } ++ } ++ return uc_mgr_put_to_dev_list(&device->dev_list, src); ++ } ++ return -ENOENT; ++} ++ ++static int verb_dev_list_check(struct use_case_verb *verb) ++{ ++ struct list_head *pos, *pos2; ++ struct use_case_device *device; ++ struct dev_list_node *dlist; ++ int err; ++ ++ list_for_each(pos, &verb->device_list) { ++ device = list_entry(pos, struct use_case_device, list); ++ list_for_each(pos2, &device->dev_list.list) { ++ dlist = list_entry(pos2, struct dev_list_node, list); ++ err = verb_dev_list_add(verb, device->dev_list.type, ++ dlist->name, device->name); ++ if (err < 0) ++ return err; ++ } ++ } ++ return 0; ++} ++ + static int verb_device_management(struct use_case_verb *verb) + { + struct list_head *pos; +@@ -1141,7 +1187,9 @@ static int verb_device_management(struct use_case_verb *verb) + /* those lists are no longer used */ + uc_mgr_free_dev_name_list(&verb->rename_list); + uc_mgr_free_dev_name_list(&verb->remove_list); +- return 0; ++ ++ /* handle conflicting/supported lists */ ++ return verb_dev_list_check(verb); + } + + /* +diff --git a/src/ucm/ucm_local.h b/src/ucm/ucm_local.h +index ba8d2acb..acec4bf6 100644 +--- a/src/ucm/ucm_local.h ++++ b/src/ucm/ucm_local.h +@@ -262,6 +262,7 @@ int uc_mgr_config_load(int format, const char *file, snd_config_t **cfg); + int uc_mgr_import_master_config(snd_use_case_mgr_t *uc_mgr); + int uc_mgr_scan_master_configs(const char **_list[]); + ++int uc_mgr_put_to_dev_list(struct dev_list *dev_list, const char *name); + int uc_mgr_remove_device(struct use_case_verb *verb, const char *name); + int uc_mgr_rename_device(struct use_case_verb *verb, const char *src, + const char *dst); +diff --git a/src/ucm/utils.c b/src/ucm/utils.c +index 60a59172..50b2a1df 100644 +--- a/src/ucm/utils.c ++++ b/src/ucm/utils.c +@@ -328,6 +328,31 @@ void uc_mgr_free_dev_list(struct dev_list *dev_list) + } + } + ++int uc_mgr_put_to_dev_list(struct dev_list *dev_list, const char *name) ++{ ++ struct list_head *pos; ++ struct dev_list_node *dlist; ++ char *n; ++ ++ list_for_each(pos, &dev_list->list) { ++ dlist = list_entry(pos, struct dev_list_node, list); ++ if (strcmp(dlist->name, name) == 0) ++ return 0; ++ } ++ ++ dlist = calloc(1, sizeof(*dlist)); ++ if (dlist == NULL) ++ return -ENOMEM; ++ n = strdup(name); ++ if (n == NULL) { ++ free(dlist); ++ return -ENOMEM; ++ } ++ dlist->name = n; ++ list_add(&dlist->list, &dev_list->list); ++ return 0; ++} ++ + int uc_mgr_rename_in_dev_list(struct dev_list *dev_list, const char *src, + const char *dst) + { +-- +2.24.1 diff --git a/alsa-lib.spec b/alsa-lib.spec index bb82196..b7ab286 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -163,6 +163,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Sun Feb 9 2020 Jaroslav Kysela - 1.2.1.2-5 +- More UCM2 related fixes + * Tue Jan 28 2020 Fedora Release Engineering - 1.2.1.2-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild diff --git a/alsa-ucm-conf.patch b/alsa-ucm-conf.patch index 3bccad3..fc1a184 100644 --- a/alsa-ucm-conf.patch +++ b/alsa-ucm-conf.patch @@ -1,7 +1,7 @@ From 2882eb5085db58b60ff6dd0f61912d32ccbdf911 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 5 Dec 2019 17:46:53 +0100 -Subject: [PATCH 1/3] sof-hda-dsp: Fix the Dmic0 CaptureMixerElem for v1.4.1 +Subject: [PATCH 01/36] sof-hda-dsp: Fix the Dmic0 CaptureMixerElem for v1.4.1 firmware Signed-off-by: Jaroslav Kysela @@ -23,13 +23,13 @@ index f1c81a1..500cbae 100644 CaptureSwitch "Dmic0 Capture Switch" } -- -2.20.1 +2.24.1 From adeb572487081f4f88318583d6eefb0ea1b61361 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 6 Dec 2019 11:12:39 +0100 -Subject: [PATCH 2/3] sof-hda-dsp: Use more strict names according latest +Subject: [PATCH 02/36] sof-hda-dsp: Use more strict names according latest use-case.h Also remove ConflictinDevice section from the digital microphone. @@ -99,4 +99,5550 @@ index 500cbae..5c7236d 100644 CapturePriority 100 CapturePCM "hw:${CardId},6" -- -2.20.1 +2.24.1 + + +From e852e235102b6132e7c873c2ff00bf3e01237af0 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Mon, 6 Jan 2020 14:11:59 +0100 +Subject: [PATCH 04/36] bytcht-es8316: Fix missing including of HeadPhones.conf + after ucm2 conversion + +The conversion to ucm2 format missed adding an include for: + +codecs/es8316/HeadPhones.conf + +Leading to no sound on the headphones output, this commit adds the missing +include fixing this. + +Cc: youling 257 +Reported-by: youling 257 +Signed-off-by: Hans de Goede +Signed-off-by: Jaroslav Kysela +--- + ucm2/bytcht-es8316/HiFi-Components.conf | 2 ++ + ucm2/bytcht-es8316/HiFi-LongName.conf | 2 ++ + 2 files changed, 4 insertions(+) + +diff --git a/ucm2/bytcht-es8316/HiFi-Components.conf b/ucm2/bytcht-es8316/HiFi-Components.conf +index 314d355..c40bd49 100644 +--- a/ucm2/bytcht-es8316/HiFi-Components.conf ++++ b/ucm2/bytcht-es8316/HiFi-Components.conf +@@ -20,6 +20,8 @@ If.mono { + } + } + ++ ++ + If.in1 { + Condition { + Type String +diff --git a/ucm2/bytcht-es8316/HiFi-LongName.conf b/ucm2/bytcht-es8316/HiFi-LongName.conf +index ea7d1c3..03cf17b 100644 +--- a/ucm2/bytcht-es8316/HiFi-LongName.conf ++++ b/ucm2/bytcht-es8316/HiFi-LongName.conf +@@ -20,6 +20,8 @@ If.mono { + } + } + ++ ++ + If.in1 { + Condition { + Type String +-- +2.24.1 + + +From 74f2a0f0884df7b9f2d08d07456a3bc37d1a512e Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 13 Jan 2020 13:36:55 +0100 +Subject: [PATCH 05/36] ucm2: fix the verb path in + chtrt5645/chtrt5645-dmic2.conf + +Signed-off-by: Jaroslav Kysela +--- + ucm2/chtrt5645/chtrt5645-dmic2.conf | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ucm2/chtrt5645/chtrt5645-dmic2.conf b/ucm2/chtrt5645/chtrt5645-dmic2.conf +index 9bbebfa..2ea095c 100644 +--- a/ucm2/chtrt5645/chtrt5645-dmic2.conf ++++ b/ucm2/chtrt5645/chtrt5645-dmic2.conf +@@ -1,6 +1,6 @@ + Syntax 2 + Comment "Intel SoC Audio Device" + SectionUseCase."HiFi" { +- File "../LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216/HiFi.conf" ++ File "HiFi-dmic2.conf" + Comment "Default" + } +-- +2.24.1 + + +From be86627a9f4179979d208943bb497b10dfc679cb Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 10 Dec 2019 17:08:37 +0100 +Subject: [PATCH 06/36] broadwell-rt286: add support for hardware volume, + conformance fixes + +Signed-off-by: Jaroslav Kysela +--- + ucm2/broadwell-rt286/HiFi.conf | 90 ++++++++++++++++------------------ + 1 file changed, 43 insertions(+), 47 deletions(-) + +diff --git a/ucm2/broadwell-rt286/HiFi.conf b/ucm2/broadwell-rt286/HiFi.conf +index 6cf31e7..e766250 100644 +--- a/ucm2/broadwell-rt286/HiFi.conf ++++ b/ucm2/broadwell-rt286/HiFi.conf +@@ -1,13 +1,31 @@ + # Use case Configuration for Nexus 7 + # Adapted to Ubuntu Touch by David Henningsson + +-SectionVerb { ++SectionDevice."Speaker" { ++ Comment "Speaker playback" ++ ++ ConflictingDevice [ ++ "Headphones" ++ ] ++ ++ EnableSequence [ ++ cset "name='SPO Switch' on" ++ cset "name='Speaker Playback Switch' on" ++ cset "name='Speaker Switch' on" ++ ] ++ ++ DisableSequence [ ++ cset "name='Speaker Switch' off" ++ cset "name='Speaker Playback Switch' off" ++ cset "name='SPO Switch' 0" ++ ] + +- # ALSA PCM + Value { +- # ALSA PCM device for HiFi ++ Priority 100 + PlaybackPCM "hw:${CardId}" +- CapturePCM "hw:${CardId}" ++ PlaybackChannels 2 ++ PlaybackMixerElem "DAC0" ++ PlaybackMasterElem "Master" + } + } + +@@ -19,11 +37,9 @@ SectionDevice."Headphones" { + ] + + EnableSequence [ +- cset "name='Master Playback Volume' 30" + cset "name='HPO L Switch' on" + cset "name='HPO R Switch' on" + cset "name='Headphone Jack Switch' on" +- cset "name='DAC0 Playback Volume' 100" + ] + + DisableSequence [ +@@ -33,36 +49,38 @@ SectionDevice."Headphones" { + ] + + Value { +- PlaybackChannels "2" ++ Priority 200 ++ PlaybackPCM "hw:${CardId}" ++ PlaybackChannels 2 ++ PlaybackMixerElem "DAC0" ++ PlaybackMasterElem "Master" + JackDev "rt286-jack" + JackControl "Headphone Jack" + JackHWMute "Speaker" + } + } + +-SectionDevice."Speaker" { +- Comment "Speaker playback" ++SectionDevice."Mic" { ++ Comment "Microphone" + + ConflictingDevice [ +- "Headphones" ++ "Handset" + ] + + EnableSequence [ +- cset "name='Master Playback Volume' 30" +- cset "name='DAC0 Playback Volume' 127" +- cset "name='SPO Switch' on" +- cset "name='Speaker Playback Switch' on" +- cset "name='Speaker Switch' on" ++ cset "name='ADC 0 Mux' 2" + ] + + DisableSequence [ +- cset "name='Speaker Switch' off" +- cset "name='Speaker Playback Switch' off" +- cset "name='SPO Switch' 0" ++ cset "name='ADC0 Capture Switch' off" + ] + + Value { +- PlaybackChannels "2" ++ Priority 100 ++ CapturePCM "hw:${CardId}" ++ CaptureChannels "2" ++ CaptureMixerElem "Mic" ++ CaptureMasterElem "ADC0" + } + } + +@@ -70,14 +88,11 @@ SectionDevice."Handset" { + Comment "Handset Microphone" + + ConflictingDevice [ +- "Mainmic" ++ "Mic" + ] + + EnableSequence [ +- cset "name='Mic Capture Volume' 28" + cset "name='ADC 0 Mux' 0" +- cset "name='ADC0 Capture Switch' on" +- cset "name='ADC0 Capture Volume' 127" + cset "name='AMIC Volume' 1" + ] + +@@ -86,32 +101,13 @@ SectionDevice."Handset" { + ] + + Value { ++ Priority 200 ++ CapturePCM "hw:${CardId}" + CaptureChannels "2" ++ CaptureMixerElem "Mic" ++ CaptureMasterElem "ADC0" + JackDev "rt286-jack" + JackControl "Mic Jack" +- JackHWMute "Mainmic" +- } +-} +- +-SectionDevice."Mainmic" { +- Comment "Main Microphone" +- +- ConflictingDevice [ +- "Handset" +- ] +- +- EnableSequence [ +- cset "name='Mic Capture Volume' 30" +- cset "name='ADC 0 Mux' 2" +- cset "name='ADC0 Capture Switch' on" +- cset "name='ADC0 Capture Volume' 127" +- ] +- +- DisableSequence [ +- cset "name='ADC0 Capture Switch' off" +- ] +- +- Value { +- CaptureChannels "2" ++ JackHWMute "Mic" + } + } +-- +2.24.1 + + +From b70e91923bfa61989acb32801bee259a4c04674d Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 23 Jan 2020 14:13:10 +0100 +Subject: [PATCH 07/36] broxton-rt298: corrections, cleanups + +Signed-off-by: Jaroslav Kysela +--- + ucm2/broxton-rt298/Hdmi.conf | 43 ++++++++++++++++++ + ucm2/broxton-rt298/Hdmi1.conf | 23 ---------- + ucm2/broxton-rt298/Hdmi2.conf | 23 ---------- + ucm2/broxton-rt298/HiFi.conf | 63 ++++++++++++++++----------- + ucm2/broxton-rt298/broxton-rt298.conf | 18 ++------ + 5 files changed, 84 insertions(+), 86 deletions(-) + create mode 100644 ucm2/broxton-rt298/Hdmi.conf + delete mode 100644 ucm2/broxton-rt298/Hdmi1.conf + delete mode 100644 ucm2/broxton-rt298/Hdmi2.conf + +diff --git a/ucm2/broxton-rt298/Hdmi.conf b/ucm2/broxton-rt298/Hdmi.conf +new file mode 100644 +index 0000000..fc64fe7 +--- /dev/null ++++ b/ucm2/broxton-rt298/Hdmi.conf +@@ -0,0 +1,43 @@ ++# Usecase for device HDMI1/Display Port stereo playback on Intel SKYLAKE/KABYLAKE platforms ++ ++SectionDevice."HDMI1" { ++ Comment "HDMI/Display Port 1 Stereo" ++ ++ Value { ++ PlaybackPCM "hw:${CardId},4" ++ PlaybackPriority 500 ++ If.1 { ++ Condition { ++ Type ControlExists ++ Control "iface=CARD,name='HDMI/DP,pcm=4 Jack'" ++ } ++ True { ++ JackControl "HDMI/DP,pcm=4 Jack" ++ } ++ False { ++ JackControl "HDMI/DP, pcm=4 Jack" ++ } ++ } ++ } ++} ++ ++SectionDevice."HDMI2" { ++ Comment "HDMI/Display Port 2 Stereo" ++ ++ Value { ++ PlaybackPCM "hw:${CardId},5" ++ PlaybackPriority 600 ++ If.1 { ++ Condition { ++ Type ControlExists ++ Control "iface=CARD,name='HDMI/DP,pcm=5 Jack'" ++ } ++ True { ++ JackControl "HDMI/DP,pcm=5 Jack" ++ } ++ False { ++ JackControl "HDMI/DP, pcm=5 Jack" ++ } ++ } ++ } ++} +diff --git a/ucm2/broxton-rt298/Hdmi1.conf b/ucm2/broxton-rt298/Hdmi1.conf +deleted file mode 100644 +index ede176b..0000000 +--- a/ucm2/broxton-rt298/Hdmi1.conf ++++ /dev/null +@@ -1,23 +0,0 @@ +-# Usecase for device HDMI1/Display Port stereo playback on Intel SKYLAKE/KABYLAKE platforms +-# For Audio in I2S mode +- +-SectionDevice."Hdmi1" { +- Comment "HDMI/Display Port 1 Stereo" +- +- Value { +- PlaybackPCM "hw:${CardId},4" +- PlaybackPriority "3" +- If.1 { +- Condition { +- Type ControlExists +- Control "iface=CARD,name='HDMI/DP,pcm=4 Jack'" +- } +- True { +- JackControl "HDMI/DP,pcm=4 Jack" +- } +- False { +- JackControl "HDMI/DP, pcm=4 Jack" +- } +- } +- } +-} +diff --git a/ucm2/broxton-rt298/Hdmi2.conf b/ucm2/broxton-rt298/Hdmi2.conf +deleted file mode 100644 +index 9718bae..0000000 +--- a/ucm2/broxton-rt298/Hdmi2.conf ++++ /dev/null +@@ -1,23 +0,0 @@ +-# Usecase for device HDMI1/Display Port stereo playback on Intel SKYLAKE/KABYLAKE platforms +-# For Audio in I2S mode +- +-SectionDevice."Hdmi2" { +- Comment "HDMI/Display Port 2 Stereo" +- +- Value { +- PlaybackPCM "hw:${CardId},5" +- PlaybackPriority "4" +- If.1 { +- Condition { +- Type ControlExists +- Control "iface=CARD,name='HDMI/DP,pcm=5 Jack'" +- } +- True { +- JackControl "HDMI/DP,pcm=5 Jack" +- } +- False { +- JackControl "HDMI/DP, pcm=5 Jack" +- } +- } +- } +-} +diff --git a/ucm2/broxton-rt298/HiFi.conf b/ucm2/broxton-rt298/HiFi.conf +index 630d5e1..6f5b9a5 100644 +--- a/ucm2/broxton-rt298/HiFi.conf ++++ b/ucm2/broxton-rt298/HiFi.conf +@@ -9,31 +9,29 @@ SectionVerb { + + Value { + TQ "HiFi" +- CapturePCM "hw:${CardId},1" +- PlaybackPCM "hw:${CardId},0" + } + } + +-SectionDevice."DigitalMic" { +- Comment "DMIC Stereo" ++SectionDevice."Speaker" { ++ Comment "Speaker" + + ConflictingDevice [ +- "Headset" ++ "Headphones" + ] + + EnableSequence [ +- cset "name='media0_out mo dmic01_hifi_in mi Switch' 1" +- cset "name='media0_out mo codec0_in mi Switch' 0" +- cset "name='Mic Jack Switch' 0" +- ++ cset "name='SPO Switch' 1" ++ cset "name='Speaker Playback Switch' 1,1" ++ cset "name='Speaker Switch' 1" ++ cset "name='HPO L Switch' 0" ++ cset "name='HPO R Switch' 0" + ] + +- DisableSequence [ +- cset "name='media0_out mo codec0_in mi Switch' 1" +- cset "name='media0_out mo dmic01_hifi_in mi Switch' 0" +- cset "name='Mic Jack Switch' 1" +- cset "name='ADC 0 Mux' 0" +- ] ++ Value { ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId}" ++ JackHWMute "Headphones" ++ } + } + + SectionDevice."Headphones" { +@@ -51,36 +49,45 @@ SectionDevice."Headphones" { + ] + + Value { ++ PlaybackPriority 200 ++ PlaybackPCM "hw:${CardId}" + JackControl "Headphone Jack" + JackHWMute "Speaker" + } + } + +-SectionDevice."Speaker" { +- Comment "Speaker" ++SectionDevice."Mic" { ++ Comment "Digital Microphone" + + ConflictingDevice [ +- "Headphones" ++ "Headset" + ] + + EnableSequence [ +- cset "name='SPO Switch' 1" +- cset "name='Speaker Playback Switch' 1,1" +- cset "name='Speaker Switch' 1" +- cset "name='HPO L Switch' 0" +- cset "name='HPO R Switch' 0" ++ cset "name='media0_out mo dmic01_hifi_in mi Switch' 1" ++ cset "name='media0_out mo codec0_in mi Switch' 0" ++ cset "name='Mic Jack Switch' 0" ++ ++ ] ++ ++ DisableSequence [ ++ cset "name='media0_out mo codec0_in mi Switch' 1" ++ cset "name='media0_out mo dmic01_hifi_in mi Switch' 0" ++ cset "name='Mic Jack Switch' 1" ++ cset "name='ADC 0 Mux' 0" + ] + + Value { +- JackHWMute "Headphones" ++ CapturePriority 100 ++ CapturePCM "hw:${CardId},1" + } + } + + SectionDevice."Headset" { +- Comment "Headset Mic" ++ Comment "Headset Microphone" + + ConflictingDevice [ +- "DigitalMic" ++ "Mic" + ] + + EnableSequence [ +@@ -97,6 +104,10 @@ SectionDevice."Headset" { + ] + + Value { ++ CapturePriority 200 ++ CapturePCM "hw:${CardId},1" + JackControl "Mic Jack" + } + } ++ ++ +diff --git a/ucm2/broxton-rt298/broxton-rt298.conf b/ucm2/broxton-rt298/broxton-rt298.conf +index 8752e91..1332dc5 100644 +--- a/ucm2/broxton-rt298/broxton-rt298.conf ++++ b/ucm2/broxton-rt298/broxton-rt298.conf +@@ -8,21 +8,11 @@ SectionUseCase."HiFi" { + Comment "Play and record HiFi quality Music" + } + +-SectionUseCase."Hdmi1" { +- File "Hdmi1.conf" +- Comment "Play on Hdmi/DP 1" +-} +- +-SectionUseCase."Hdmi2" { +- File "Hdmi2.conf" +- Comment "Play on Hdmi/DP 2" +-} +- + ValueDefaults { +- PlaybackChannels "2" +- PlaybackPriority "1" +- CaptureChannels "2" +- CapturePriority "2" ++ PlaybackChannels 2 ++ PlaybackPriority 1 ++ CaptureChannels 2 ++ CapturePriority 2 + } + + SectionDefaults [ +-- +2.24.1 + + +From e1f9bdb95e1cf90c17a44fa5734b41b6656d648d Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 23 Jan 2020 19:03:53 +0100 +Subject: [PATCH 08/36] bytcr-rt5640: cleanups and corrections + +Signed-off-by: Jaroslav Kysela +--- + ucm2/codecs/rt5640/DigitalMics.conf | 8 ++++---- + ucm2/codecs/rt5640/HeadPhones.conf | 4 +++- + ucm2/codecs/rt5640/HeadsetMic.conf | 8 ++++---- + ucm2/codecs/rt5640/IN1-InternalMic.conf | 6 +++--- + ucm2/codecs/rt5640/IN3-InternalMic.conf | 8 ++++---- + ucm2/codecs/rt5640/MonoSpeaker.conf | 6 ++++-- + ucm2/codecs/rt5640/Speaker.conf | 4 +++- + 7 files changed, 25 insertions(+), 19 deletions(-) + +diff --git a/ucm2/codecs/rt5640/DigitalMics.conf b/ucm2/codecs/rt5640/DigitalMics.conf +index 36982c4..17cae19 100644 +--- a/ucm2/codecs/rt5640/DigitalMics.conf ++++ b/ucm2/codecs/rt5640/DigitalMics.conf +@@ -1,10 +1,8 @@ +-SectionDevice."DigitalMics" { ++SectionDevice."Mic" { + Comment "Internal Digital Microphones" + + ConflictingDevice [ +- "IN1-InternalMics" +- "IN3-InternalMics" +- "HeadsetMic" ++ "Headset" + ] + + EnableSequence [ +@@ -22,6 +20,8 @@ SectionDevice."DigitalMics" { + ] + + Value { ++ CapturePriority 100 ++ CapturePCM "hw:${CardId},0" + CaptureChannels 2 + } + } +diff --git a/ucm2/codecs/rt5640/HeadPhones.conf b/ucm2/codecs/rt5640/HeadPhones.conf +index e37442d..dccc943 100644 +--- a/ucm2/codecs/rt5640/HeadPhones.conf ++++ b/ucm2/codecs/rt5640/HeadPhones.conf +@@ -32,7 +32,9 @@ SectionDevice."Headphones" { + ] + + Value { +- PlaybackChannels "2" ++ PlaybackPriority 300 ++ PlaybackPCM "hw:${CardId},0" ++ PlaybackChannels 2 + JackControl "Headphone Jack" + } + } +diff --git a/ucm2/codecs/rt5640/HeadsetMic.conf b/ucm2/codecs/rt5640/HeadsetMic.conf +index a99b295..f6d9423 100644 +--- a/ucm2/codecs/rt5640/HeadsetMic.conf ++++ b/ucm2/codecs/rt5640/HeadsetMic.conf +@@ -1,10 +1,8 @@ +-SectionDevice."HeadsetMic" { ++SectionDevice."Headset" { + Comment "Headset Microphone" + + ConflictingDevice [ +- "IN1-InternalMics" +- "IN3-InternalMics" +- "DigitalMics" ++ "Mic" + ] + + EnableSequence [ +@@ -38,6 +36,8 @@ SectionDevice."HeadsetMic" { + ] + + Value { ++ CapturePriority 200 ++ CapturePCM "hw:${CardId},0" + CaptureChannels 2 + JackControl "Headset Mic Jack" + } +diff --git a/ucm2/codecs/rt5640/IN1-InternalMic.conf b/ucm2/codecs/rt5640/IN1-InternalMic.conf +index 95fc89e..435cce8 100644 +--- a/ucm2/codecs/rt5640/IN1-InternalMic.conf ++++ b/ucm2/codecs/rt5640/IN1-InternalMic.conf +@@ -1,10 +1,8 @@ +-SectionDevice."IN1-InternalMics" { ++SectionDevice."Mic" { + Comment "Internal Microphone on IN1" + + ConflictingDevice [ +- "DigitalMics" + "HeadsetMic" +- "IN3-InternalMics" + ] + + EnableSequence [ +@@ -41,6 +39,8 @@ SectionDevice."IN1-InternalMics" { + ] + + Value { ++ CapturePriority 100 ++ CapturePCM "hw:${CardId},0" + CaptureChannels 2 + } + } +diff --git a/ucm2/codecs/rt5640/IN3-InternalMic.conf b/ucm2/codecs/rt5640/IN3-InternalMic.conf +index b8270e9..4d4060e 100644 +--- a/ucm2/codecs/rt5640/IN3-InternalMic.conf ++++ b/ucm2/codecs/rt5640/IN3-InternalMic.conf +@@ -1,10 +1,8 @@ +-SectionDevice."IN3-InternalMics" { ++SectionDevice."Mic" { + Comment "Internal Microphone on IN3" + + ConflictingDevice [ +- "DigitalMics" +- "HeadsetMic" +- "IN1-InternalMics" ++ "Headset" + ] + + EnableSequence [ +@@ -41,6 +39,8 @@ SectionDevice."IN3-InternalMics" { + ] + + Value { ++ CapturePriority 100 ++ CapturePCM "hw:${CardId},0" + CaptureChannels 2 + } + } +diff --git a/ucm2/codecs/rt5640/MonoSpeaker.conf b/ucm2/codecs/rt5640/MonoSpeaker.conf +index ee4eff3..6ca51e2 100644 +--- a/ucm2/codecs/rt5640/MonoSpeaker.conf ++++ b/ucm2/codecs/rt5640/MonoSpeaker.conf +@@ -1,4 +1,4 @@ +-SectionDevice."MonoSpeaker" { ++SectionDevice."Speaker" { + Comment "Mono Speaker" + + ConflictingDevice [ +@@ -37,6 +37,8 @@ SectionDevice."MonoSpeaker" { + ] + + Value { +- PlaybackChannels "2" ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId},0" ++ PlaybackChannels 2 + } + } +diff --git a/ucm2/codecs/rt5640/Speaker.conf b/ucm2/codecs/rt5640/Speaker.conf +index 564a6b3..09b99cf 100644 +--- a/ucm2/codecs/rt5640/Speaker.conf ++++ b/ucm2/codecs/rt5640/Speaker.conf +@@ -37,6 +37,8 @@ SectionDevice."Speaker" { + ] + + Value { +- PlaybackChannels "2" ++ PlaybackPCM "hw:${CardId},0" ++ PlaybackPriority 100 ++ PlaybackChannels 2 + } + } +-- +2.24.1 + + +From 38989bd8f548a5b79d53c8278a5f25a5b3904d5f Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 23 Jan 2020 19:39:08 +0100 +Subject: [PATCH 09/36] bytcr-rt5651: cleanups and corrections + +Signed-off-by: Jaroslav Kysela +--- + ucm2/bytcr-rt5651/HiFi-Components.conf | 7 +++++-- + ucm2/bytcr-rt5651/HiFi-LongName.conf | 6 ++++-- + ucm2/bytcr-rt5651/HiFi.conf | 5 ----- + ucm2/codecs/rt5651/DigitalMic.conf | 12 +++--------- + ucm2/codecs/rt5651/HeadPhones-swapped.conf | 5 +++-- + ucm2/codecs/rt5651/HeadPhones.conf | 5 +++-- + ucm2/codecs/rt5651/IN1-InternalMic.conf | 14 ++++---------- + ucm2/codecs/rt5651/IN12-InternalMic.conf | 14 ++++---------- + ucm2/codecs/rt5651/IN2-HeadsetMic.conf | 12 +++++------- + ucm2/codecs/rt5651/IN2-InternalMic.conf | 14 ++++---------- + ucm2/codecs/rt5651/IN3-HeadsetMic.conf | 12 +++++------- + ucm2/codecs/rt5651/MonoSpeaker.conf | 7 ++++--- + ucm2/codecs/rt5651/Speaker.conf | 5 +++-- + 13 files changed, 47 insertions(+), 71 deletions(-) + +diff --git a/ucm2/bytcr-rt5651/HiFi-Components.conf b/ucm2/bytcr-rt5651/HiFi-Components.conf +index 235838e..53ebcbe 100644 +--- a/ucm2/bytcr-rt5651/HiFi-Components.conf ++++ b/ucm2/bytcr-rt5651/HiFi-Components.conf +@@ -42,6 +42,11 @@ If.dmic1 { + } + True { + ++ ++ SectionDevice."Mic".ConflictingDevice.0 "Headset" ++ } ++ False { ++ + } + } + +@@ -77,5 +82,3 @@ If.in12 { + + } + } +- +- +diff --git a/ucm2/bytcr-rt5651/HiFi-LongName.conf b/ucm2/bytcr-rt5651/HiFi-LongName.conf +index 58eb722..e6dd908 100644 +--- a/ucm2/bytcr-rt5651/HiFi-LongName.conf ++++ b/ucm2/bytcr-rt5651/HiFi-LongName.conf +@@ -42,6 +42,10 @@ If.dmic1 { + } + True { + ++ ++ } ++ False { ++ + } + } + +@@ -77,5 +81,3 @@ If.in12 { + + } + } +- +- +diff --git a/ucm2/bytcr-rt5651/HiFi.conf b/ucm2/bytcr-rt5651/HiFi.conf +index 1f031f2..8a9a402 100644 +--- a/ucm2/bytcr-rt5651/HiFi.conf ++++ b/ucm2/bytcr-rt5651/HiFi.conf +@@ -10,11 +10,6 @@ SectionVerb { + DisableSequence [ + + ] +- +- Value { +- PlaybackPCM "hw:${CardId}" +- CapturePCM "hw:${CardId}" +- } + } + + If.0 { +diff --git a/ucm2/codecs/rt5651/DigitalMic.conf b/ucm2/codecs/rt5651/DigitalMic.conf +index 7a0c4d4..fa1de4c 100644 +--- a/ucm2/codecs/rt5651/DigitalMic.conf ++++ b/ucm2/codecs/rt5651/DigitalMic.conf +@@ -1,14 +1,6 @@ +-SectionDevice."DigitalMic" { ++SectionDevice."Mic" { + Comment "Internal Digital Microphone" + +- ConflictingDevice [ +- "InternalMic-IN1" +- "InternalMic-IN2" +- "InternalMic-IN12" +- "HeadsetMic-IN2" +- "HeadsetMic-IN3" +- ] +- + EnableSequence [ + cset "name='Stereo1 ADC MIXL ADC2 Switch' on" + cset "name='Stereo1 ADC MIXR ADC2 Switch' on" +@@ -22,6 +14,8 @@ SectionDevice."DigitalMic" { + ] + + Value { ++ CapturePriority 100 ++ CapturePCM "hw:${CardId}" + CaptureChannels 2 + } + } +diff --git a/ucm2/codecs/rt5651/HeadPhones-swapped.conf b/ucm2/codecs/rt5651/HeadPhones-swapped.conf +index f5260a3..7e91aa2 100644 +--- a/ucm2/codecs/rt5651/HeadPhones-swapped.conf ++++ b/ucm2/codecs/rt5651/HeadPhones-swapped.conf +@@ -3,7 +3,6 @@ SectionDevice."Headphones" { + + ConflictingDevice [ + "Speaker" +- "MonoSpeaker" + ] + + EnableSequence [ +@@ -33,7 +32,9 @@ SectionDevice."Headphones" { + ] + + Value { +- PlaybackChannels "2" ++ PlaybackPriority 200 ++ PlaybackChannels 2 ++ PlaybackPCM "hw:${CardId}" + JackControl "Headphone Jack" + } + } +diff --git a/ucm2/codecs/rt5651/HeadPhones.conf b/ucm2/codecs/rt5651/HeadPhones.conf +index 0a87b32..18a4108 100644 +--- a/ucm2/codecs/rt5651/HeadPhones.conf ++++ b/ucm2/codecs/rt5651/HeadPhones.conf +@@ -3,7 +3,6 @@ SectionDevice."Headphones" { + + ConflictingDevice [ + "Speaker" +- "MonoSpeaker" + ] + + EnableSequence [ +@@ -24,7 +23,9 @@ SectionDevice."Headphones" { + ] + + Value { +- PlaybackChannels "2" ++ PlaybackPriority 200 ++ PlaybackPCM "hw:${CardId}" ++ PlaybackChannels 2 + JackControl "Headphone Jack" + } + } +diff --git a/ucm2/codecs/rt5651/IN1-InternalMic.conf b/ucm2/codecs/rt5651/IN1-InternalMic.conf +index 01b786e..13c7cb6 100644 +--- a/ucm2/codecs/rt5651/IN1-InternalMic.conf ++++ b/ucm2/codecs/rt5651/IN1-InternalMic.conf +@@ -1,14 +1,6 @@ +-SectionDevice."InternalMic-IN1" { ++SectionDevice."Mic" { + Comment "Internal Microphone on IN1" + +- ConflictingDevice [ +- "DigitalMic" +- "InternalMic-IN2" +- "InternalMic-IN12" +- "HeadsetMic-IN2" +- "HeadsetMic-IN3" +- ] +- + EnableSequence [ + cset "name='Internal Mic Switch' on" + cset "name='RECMIXL BST1 Switch' on" +@@ -26,6 +18,8 @@ SectionDevice."InternalMic-IN1" { + ] + + Value { +- CaptureChannels "2" ++ CapturePriority 100 ++ CapturePCM "hw:${CardId}" ++ CaptureChannels 2 + } + } +diff --git a/ucm2/codecs/rt5651/IN12-InternalMic.conf b/ucm2/codecs/rt5651/IN12-InternalMic.conf +index 44cc53a..e017541 100644 +--- a/ucm2/codecs/rt5651/IN12-InternalMic.conf ++++ b/ucm2/codecs/rt5651/IN12-InternalMic.conf +@@ -1,14 +1,6 @@ +-SectionDevice."InternalMic-IN12" { ++SectionDevice."Mic" { + Comment "Internal Microphones on IN1 and IN2" + +- ConflictingDevice [ +- "DigitalMic" +- "InternalMic-IN1" +- "InternalMic-IN2" +- "HeadsetMic-IN2" +- "HeadsetMic-IN3" +- ] +- + EnableSequence [ + cset "name='Internal Mic Switch' on" + cset "name='RECMIXL BST1 Switch' on" +@@ -30,6 +22,8 @@ SectionDevice."InternalMic-IN12" { + ] + + Value { +- CaptureChannels "2" ++ CapturePriority 100 ++ CapturePCM "hw:${CardId}" ++ CaptureChannels 2 + } + } +diff --git a/ucm2/codecs/rt5651/IN2-HeadsetMic.conf b/ucm2/codecs/rt5651/IN2-HeadsetMic.conf +index 177f70b..5b51439 100644 +--- a/ucm2/codecs/rt5651/IN2-HeadsetMic.conf ++++ b/ucm2/codecs/rt5651/IN2-HeadsetMic.conf +@@ -1,12 +1,8 @@ +-SectionDevice."HeadsetMic-IN2" { ++SectionDevice."Headset" { + Comment "Headset Microphone on IN2" + + ConflictingDevice [ +- "DigitalMic" +- "InternalMic-IN1" +- "InternalMic-IN2" +- "InternalMic-IN12" +- "HeadsetMic-IN3" ++ "Mic" + ] + + EnableSequence [ +@@ -26,7 +22,9 @@ SectionDevice."HeadsetMic-IN2" { + ] + + Value { +- CaptureChannels "2" ++ CapturePriority 200 ++ CapturePCM "hw:${CardId}" ++ CaptureChannels 2 + JackControl "Headset Mic Jack" + } + } +diff --git a/ucm2/codecs/rt5651/IN2-InternalMic.conf b/ucm2/codecs/rt5651/IN2-InternalMic.conf +index 611ca6c..9eeef4d 100644 +--- a/ucm2/codecs/rt5651/IN2-InternalMic.conf ++++ b/ucm2/codecs/rt5651/IN2-InternalMic.conf +@@ -1,14 +1,6 @@ +-SectionDevice."InternalMic-IN2" { ++SectionDevice."Mic" { + Comment "Internal Microphone on IN2" + +- ConflictingDevice [ +- "DigitalMic" +- "InternalMic-IN1" +- "InternalMic-IN12" +- "HeadsetMic-IN2" +- "HeadsetMic-IN3" +- ] +- + EnableSequence [ + cset "name='Internal Mic Switch' on" + cset "name='RECMIXL BST2 Switch' on" +@@ -26,6 +18,8 @@ SectionDevice."InternalMic-IN2" { + ] + + Value { +- CaptureChannels "2" ++ CapturePriority 100 ++ CapturePCM "hw:${CardId}" ++ CaptureChannels 2 + } + } +diff --git a/ucm2/codecs/rt5651/IN3-HeadsetMic.conf b/ucm2/codecs/rt5651/IN3-HeadsetMic.conf +index 3231e78..d579dcd 100644 +--- a/ucm2/codecs/rt5651/IN3-HeadsetMic.conf ++++ b/ucm2/codecs/rt5651/IN3-HeadsetMic.conf +@@ -1,12 +1,8 @@ +-SectionDevice."HeadsetMic-IN3" { ++SectionDevice."Headset" { + Comment "Headset Microphone on IN3" + + ConflictingDevice [ +- "DigitalMic" +- "InternalMic-IN1" +- "InternalMic-IN2" +- "InternalMic-IN12" +- "HeadsetMic-IN2" ++ "Mic" + ] + + EnableSequence [ +@@ -26,7 +22,9 @@ SectionDevice."HeadsetMic-IN3" { + ] + + Value { +- CaptureChannels "2" ++ CapturePriority 200 ++ CapturePCM "hw:${CardId}" ++ CaptureChannels 2 + JackControl "Headset Mic Jack" + } + } +diff --git a/ucm2/codecs/rt5651/MonoSpeaker.conf b/ucm2/codecs/rt5651/MonoSpeaker.conf +index c2276c6..9c780a0 100644 +--- a/ucm2/codecs/rt5651/MonoSpeaker.conf ++++ b/ucm2/codecs/rt5651/MonoSpeaker.conf +@@ -1,8 +1,7 @@ +-SectionDevice."MonoSpeaker" { ++SectionDevice."Speaker" { + Comment "Mono Speaker" + + ConflictingDevice [ +- "Speaker" + "Headphones" + ] + +@@ -42,6 +41,8 @@ SectionDevice."MonoSpeaker" { + ] + + Value { +- PlaybackChannels "2" ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId}" ++ PlaybackChannels 2 + } + } +diff --git a/ucm2/codecs/rt5651/Speaker.conf b/ucm2/codecs/rt5651/Speaker.conf +index 463d13b..efc12e5 100644 +--- a/ucm2/codecs/rt5651/Speaker.conf ++++ b/ucm2/codecs/rt5651/Speaker.conf +@@ -2,7 +2,6 @@ SectionDevice."Speaker" { + Comment "Speakers" + + ConflictingDevice [ +- "MonoSpeaker" + "Headphones" + ] + +@@ -24,6 +23,8 @@ SectionDevice."Speaker" { + ] + + Value { +- PlaybackChannels "2" ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId}" ++ PlaybackChannels 2 + } + } +-- +2.24.1 + + +From 9b0f31cc65b558c0eee98be583b8a8108341e53d Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 23 Jan 2020 19:45:00 +0100 +Subject: [PATCH 10/36] bytcht-cx2072x: cleanups and corrections + +Signed-off-by: Jaroslav Kysela +--- + ucm2/bytcht-cx2072x/HiFi.conf | 5 ----- + ucm2/codecs/cx2072x/HeadPhones.conf | 4 +++- + ucm2/codecs/cx2072x/HeadsetMic.conf | 8 +++++--- + ucm2/codecs/cx2072x/InternalMic.conf | 8 +++++--- + ucm2/codecs/cx2072x/Speaker.conf | 4 +++- + 5 files changed, 16 insertions(+), 13 deletions(-) + +diff --git a/ucm2/bytcht-cx2072x/HiFi.conf b/ucm2/bytcht-cx2072x/HiFi.conf +index 60e0229..b329ea4 100644 +--- a/ucm2/bytcht-cx2072x/HiFi.conf ++++ b/ucm2/bytcht-cx2072x/HiFi.conf +@@ -8,11 +8,6 @@ SectionVerb { + + + ] +- +- Value { +- PlaybackPCM "hw:${CardId}" +- CapturePCM "hw:${CardId}" +- } + } + + +diff --git a/ucm2/codecs/cx2072x/HeadPhones.conf b/ucm2/codecs/cx2072x/HeadPhones.conf +index b5d3d3a..484d020 100644 +--- a/ucm2/codecs/cx2072x/HeadPhones.conf ++++ b/ucm2/codecs/cx2072x/HeadPhones.conf +@@ -16,7 +16,9 @@ SectionDevice."Headphones" { + ] + + Value { +- PlaybackChannels "2" ++ PlaybackPriority 200 ++ PlaybackPCM "hw:${CardId}" ++ PlaybackChannels 2 + JackControl "Headphone Jack" + } + } +diff --git a/ucm2/codecs/cx2072x/HeadsetMic.conf b/ucm2/codecs/cx2072x/HeadsetMic.conf +index 0a59750..b1a7771 100644 +--- a/ucm2/codecs/cx2072x/HeadsetMic.conf ++++ b/ucm2/codecs/cx2072x/HeadsetMic.conf +@@ -1,8 +1,8 @@ +-SectionDevice."HeadsetMic" { ++SectionDevice."Headset" { + Comment "Headset Microphone" + + ConflictingDevice [ +- "InternalMic" ++ "Mic" + ] + + EnableSequence [ +@@ -17,7 +17,9 @@ SectionDevice."HeadsetMic" { + ] + + Value { +- CaptureChannels "2" ++ CapturePriority 200 ++ CapturePCM "hw:${CardId}" ++ CaptureChannels 2 + JackControl "Headset Mic Jack" + } + } +diff --git a/ucm2/codecs/cx2072x/InternalMic.conf b/ucm2/codecs/cx2072x/InternalMic.conf +index e358c35..831c3cc 100644 +--- a/ucm2/codecs/cx2072x/InternalMic.conf ++++ b/ucm2/codecs/cx2072x/InternalMic.conf +@@ -1,8 +1,8 @@ +-SectionDevice."InternalMic" { ++SectionDevice."Mic" { + Comment "Internal Microphone" + + ConflictingDevice [ +- "HeadsetMic" ++ "Headset" + ] + + EnableSequence [ +@@ -17,6 +17,8 @@ SectionDevice."InternalMic" { + ] + + Value { +- CaptureChannels "2" ++ CapturePriority 100 ++ CapturePCM "hw:${CardId}" ++ CaptureChannels 2 + } + } +diff --git a/ucm2/codecs/cx2072x/Speaker.conf b/ucm2/codecs/cx2072x/Speaker.conf +index a83aeae..f60e355 100644 +--- a/ucm2/codecs/cx2072x/Speaker.conf ++++ b/ucm2/codecs/cx2072x/Speaker.conf +@@ -16,6 +16,8 @@ SectionDevice."Speaker" { + ] + + Value { +- PlaybackChannels "2" ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId}" ++ PlaybackChannels 2 + } + } +-- +2.24.1 + + +From 7248ff84f18dc56d289937a81adfdc3852ee8a8f Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 23 Jan 2020 19:53:52 +0100 +Subject: [PATCH 11/36] bytcht-es8316: cleanups and corrections + +Signed-off-by: Jaroslav Kysela +--- + ucm2/codecs/es8316/HeadPhones.conf | 7 ++++--- + ucm2/codecs/es8316/IN1-HeadsetMic.conf | 10 +++++----- + ucm2/codecs/es8316/IN1-InternalMic.conf | 10 +++++----- + ucm2/codecs/es8316/IN2-HeadsetMic.conf | 10 +++++----- + ucm2/codecs/es8316/IN2-InternalMic.conf | 6 ++++-- + ucm2/codecs/es8316/MonoSpeaker.conf | 7 ++++--- + ucm2/codecs/es8316/Speaker.conf | 4 +++- + 7 files changed, 30 insertions(+), 24 deletions(-) + +diff --git a/ucm2/codecs/es8316/HeadPhones.conf b/ucm2/codecs/es8316/HeadPhones.conf +index 3f3e591..603b40c 100644 +--- a/ucm2/codecs/es8316/HeadPhones.conf ++++ b/ucm2/codecs/es8316/HeadPhones.conf +@@ -3,7 +3,6 @@ SectionDevice."Headphones" { + + ConflictingDevice [ + "Speaker" +- "MonoSpeaker" + ] + + EnableSequence [ +@@ -15,8 +14,10 @@ SectionDevice."Headphones" { + ] + + Value { +- PlaybackChannels "2" ++ PlaybackPriority 200 ++ PlaybackPCM "hw:${CardId},0" ++ PlaybackChannels 2 + JackControl "Headphone Jack" +- JackHWMute "Speaker MonoSpeaker" ++ JackHWMute "Speaker" + } + } +diff --git a/ucm2/codecs/es8316/IN1-HeadsetMic.conf b/ucm2/codecs/es8316/IN1-HeadsetMic.conf +index 997a50b..d798270 100644 +--- a/ucm2/codecs/es8316/IN1-HeadsetMic.conf ++++ b/ucm2/codecs/es8316/IN1-HeadsetMic.conf +@@ -1,10 +1,8 @@ +-SectionDevice."HeadsetMic-IN1" { ++SectionDevice."Headset" { + Comment "Headset Microphone on IN1" + + ConflictingDevice [ +- "InternalMic-IN1" +- "InternalMic-IN2" +- "HeadsetMic-IN2" ++ "Mic" + ] + + EnableSequence [ +@@ -17,7 +15,9 @@ SectionDevice."HeadsetMic-IN1" { + ] + + Value { +- CaptureChannels "2" ++ CapturePriority 200 ++ CapturePCM "hw:${CardId},0" ++ CaptureChannels 2 + JackControl "Headset Mic Jack" + } + } +diff --git a/ucm2/codecs/es8316/IN1-InternalMic.conf b/ucm2/codecs/es8316/IN1-InternalMic.conf +index 70a77b9..31c5cda 100644 +--- a/ucm2/codecs/es8316/IN1-InternalMic.conf ++++ b/ucm2/codecs/es8316/IN1-InternalMic.conf +@@ -1,10 +1,8 @@ +-SectionDevice."InternalMic-IN1" { ++SectionDevice."Mic" { + Comment "Internal Microphone on IN1" + + ConflictingDevice [ +- "InternalMic-IN2" +- "HeadsetMic-IN1" +- "HeadsetMic-IN2" ++ "Headset" + ] + + EnableSequence [ +@@ -17,6 +15,8 @@ SectionDevice."InternalMic-IN1" { + ] + + Value { +- CaptureChannels "2" ++ CapturePriority 100 ++ CapturePCM "hw:${CardId}" ++ CaptureChannels 2 + } + } +diff --git a/ucm2/codecs/es8316/IN2-HeadsetMic.conf b/ucm2/codecs/es8316/IN2-HeadsetMic.conf +index 1ab1221..28f26f8 100644 +--- a/ucm2/codecs/es8316/IN2-HeadsetMic.conf ++++ b/ucm2/codecs/es8316/IN2-HeadsetMic.conf +@@ -1,10 +1,8 @@ +-SectionDevice."HeadsetMic-IN2" { ++SectionDevice."Headset" { + Comment "Headset Microphone on IN2" + + ConflictingDevice [ +- "InternalMic-IN1" +- "InternalMic-IN2" +- "HeadsetMic-IN1" ++ "Mic" + ] + + EnableSequence [ +@@ -17,7 +15,9 @@ SectionDevice."HeadsetMic-IN2" { + ] + + Value { +- CaptureChannels "2" ++ CapturePriority 200 ++ CapturePCM "hw:${CardId},0" ++ CaptureChannels 2 + JackControl "Headset Mic Jack" + } + } +diff --git a/ucm2/codecs/es8316/IN2-InternalMic.conf b/ucm2/codecs/es8316/IN2-InternalMic.conf +index 7809f8a..8c0418f 100644 +--- a/ucm2/codecs/es8316/IN2-InternalMic.conf ++++ b/ucm2/codecs/es8316/IN2-InternalMic.conf +@@ -1,4 +1,4 @@ +-SectionDevice."InternalMic-IN2" { ++SectionDevice."Mic" { + Comment "Internal Microphone on IN2" + + ConflictingDevice [ +@@ -17,6 +17,8 @@ SectionDevice."InternalMic-IN2" { + ] + + Value { +- CaptureChannels "2" ++ CapturePriority 100 ++ CapturePCM "hw:${CardId},0" ++ CaptureChannels 2 + } + } +diff --git a/ucm2/codecs/es8316/MonoSpeaker.conf b/ucm2/codecs/es8316/MonoSpeaker.conf +index 704556a..f11f2b7 100644 +--- a/ucm2/codecs/es8316/MonoSpeaker.conf ++++ b/ucm2/codecs/es8316/MonoSpeaker.conf +@@ -1,8 +1,7 @@ +-SectionDevice."MonoSpeaker" { ++SectionDevice."Speaker" { + Comment "Mono Speaker" + + ConflictingDevice [ +- "Speaker" + "Headphones" + ] + +@@ -32,6 +31,8 @@ SectionDevice."MonoSpeaker" { + ] + + Value { +- PlaybackChannels "2" ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId},0" ++ PlaybackChannels 2 + } + } +diff --git a/ucm2/codecs/es8316/Speaker.conf b/ucm2/codecs/es8316/Speaker.conf +index 0e77746..a1e4491 100644 +--- a/ucm2/codecs/es8316/Speaker.conf ++++ b/ucm2/codecs/es8316/Speaker.conf +@@ -15,6 +15,8 @@ SectionDevice."Speaker" { + ] + + Value { +- PlaybackChannels "2" ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId},0" ++ PlaybackChannels 2 + } + } +-- +2.24.1 + + +From 2ccb7969e0be03c1a47260dbb34d0c7865c5593f Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 23 Jan 2020 19:56:19 +0100 +Subject: [PATCH 12/36] DAISY-I2S: added back PCM devices + +Signed-off-by: Jaroslav Kysela +--- + ucm2/DAISY-I2S/HiFi.conf | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/ucm2/DAISY-I2S/HiFi.conf b/ucm2/DAISY-I2S/HiFi.conf +index 02292f2..877f6ff 100644 +--- a/ucm2/DAISY-I2S/HiFi.conf ++++ b/ucm2/DAISY-I2S/HiFi.conf +@@ -27,6 +27,11 @@ SectionDevice."Headphones" { + cset "name='Left Speaker Mixer Left DAC1 Switch' on" + cset "name='Right Speaker Mixer Right DAC1 Switch' on" + ] ++ ++ Value { ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId}" ++ } + } + + SectionDevice."Mic" { +@@ -43,4 +48,9 @@ SectionDevice."Mic" { + cset "name='DMIC1 Left Capture Switch' on" + cset "name='DMIC1 Right Capture Switch' on" + ] ++ ++ Value { ++ CapturePriority 100 ++ CapturePCM "hw:${CardId}" ++ } + } +-- +2.24.1 + + +From 1a824b16b8fc26122deec2a6307b8294dc1bc497 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 24 Jan 2020 10:07:14 +0100 +Subject: [PATCH 13/36] DB410c: cleanups and corrections + +--- + ucm2/DB410c/HDMI.conf | 9 +++++--- + ucm2/DB410c/HiFi.conf | 50 ++++++++++++++++++++++++++++++++++--------- + 2 files changed, 46 insertions(+), 13 deletions(-) + +diff --git a/ucm2/DB410c/HDMI.conf b/ucm2/DB410c/HDMI.conf +index d08a50b..fa44132 100644 +--- a/ucm2/DB410c/HDMI.conf ++++ b/ucm2/DB410c/HDMI.conf +@@ -4,12 +4,15 @@ + SectionVerb { + Value { + TQ "HiFi" +- PlaybackPCM "plughw:${CardId},0" +- PlaybackChannels "2" ++ PlaybackChannels 2 + } + } + +-SectionDevice."HDMI-stereo" { ++SectionDevice."HDMI" { + # Name "HDMI-stereo" + Comment "HDMI Digital Stereo Output" ++ Value { ++ PlaybackPriority 200 ++ PlaybackPCM "plughw:${CardId}" ++ } + } +diff --git a/ucm2/DB410c/HiFi.conf b/ucm2/DB410c/HiFi.conf +index 848d02f..1b2716a 100644 +--- a/ucm2/DB410c/HiFi.conf ++++ b/ucm2/DB410c/HiFi.conf +@@ -2,14 +2,9 @@ + # Author: Srinivas Kandagatla + + SectionVerb { +- +- # ALSA PCM + Value { +- # ALSA PCM device for HiFi +- PlaybackPCM "plughw:${CardId},1" +- CapturePCM "plughw:${CardId},2" +- PlaybackChannels "2" +- CaptureChannels "2" ++ PlaybackChannels 2 ++ CaptureChannels 2 + } + } + +@@ -33,6 +28,11 @@ SectionDevice."Speaker" { + cset "name='SPK DAC Switch' 0" + cset "name='RX3 MIX1 INP1' ZERO" + ] ++ ++ Value { ++ PlaybackPriority 200 ++ PlaybackPCM "plughw:${CardId},1" ++ } + } + + +@@ -64,6 +64,11 @@ SectionDevice."Headphones" { + cset "name='RX1 MIX1 INP1' ZERO" + cset "name='RX2 MIX1 INP1' ZERO" + ] ++ ++ Value { ++ PlaybackPriority 300 ++ PlaybackPCM "plughw:${CardId},1" ++ } + } + + SectionDevice."Earpiece" { +@@ -73,6 +78,11 @@ SectionDevice."Earpiece" { + "Speaker" + "Headphones" + ] ++ ++ Value { ++ PlaybackPriority 100 ++ PlaybackPCM "plughw:${CardId},1" ++ } + } + + SectionDevice."Handset" { +@@ -90,9 +100,14 @@ SectionDevice."Handset" { + cset "name='ADC2 Volume' 0" + cset "name='DEC1 MUX' ZERO" + ] ++ ++ Value { ++ CapturePriority 400 ++ CapturePCM "plughw:${CardId},2" ++ } + } + +-SectionDevice."PrimaryMic" { ++SectionDevice."Mic1" { + Comment "Primary Microphone" + + EnableSequence [ +@@ -105,9 +120,14 @@ SectionDevice."PrimaryMic" { + cset "name='DEC1 MUX' ZERO" + cset "name='ADC1 Volume' 0" + ] ++ ++ Value { ++ CapturePriority 300 ++ CapturePCM "plughw:${CardId},2" ++ } + } + +-SectionDevice."SecondaryMic" { ++SectionDevice."Mic2" { + Comment "Secondary Microphone" + + EnableSequence [ +@@ -122,9 +142,14 @@ SectionDevice."SecondaryMic" { + cset "name='ADC2 Volume' 0" + cset "name='ADC2 MUX' ZERO" + ] ++ ++ Value { ++ CapturePriority 200 ++ CapturePCM "plughw:${CardId},2" ++ } + } + +-SectionDevice."DigitalMic" { ++SectionDevice."Mic3" { + Comment "Digital Microphone" + + EnableSequence [ +@@ -135,4 +160,9 @@ SectionDevice."DigitalMic" { + DisableSequence [ + cset "name='DEC1 MUX' ZERO" + ] ++ ++ Value { ++ CapturePriority 100 ++ CapturePCM "plughw:${CardId},2" ++ } + } +-- +2.24.1 + + +From 86a9fad7760fa40282821a3d7818ac881dd2f92d Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 24 Jan 2020 10:14:41 +0100 +Subject: [PATCH 14/36] DB820c: cleanups and corrections + +Signed-off-by: Jaroslav Kysela +--- + ucm2/DB820c/HDMI.conf | 10 ++++++---- + ucm2/DB820c/HiFi.conf | 8 +++++--- + 2 files changed, 11 insertions(+), 7 deletions(-) + +diff --git a/ucm2/DB820c/HDMI.conf b/ucm2/DB820c/HDMI.conf +index 76c0e92..c0d40f6 100644 +--- a/ucm2/DB820c/HDMI.conf ++++ b/ucm2/DB820c/HDMI.conf +@@ -8,14 +8,14 @@ SectionVerb { + + DisableSequence [ + cset "name='HDMI Mixer MultiMedia1' 0" ++ ] ++ + Value { + TQ "HiFi" +- PlaybackPCM "plughw:${CardId},0" + } + } + +-SectionDevice."HDMI-stereo" { +- #Name "HDMI-stereo" ++SectionDevice."HDMI" { + Comment "HDMI Digital Stereo Output" + + EnableSequence [ +@@ -27,6 +27,8 @@ SectionDevice."HDMI-stereo" { + ] + + Value { +- PlaybackChannels "2" ++ PlaybackPriority 200 ++ PlaybackPCM "plughw:${CardId}" ++ PlaybackChannels 2 + } + } +diff --git a/ucm2/DB820c/HiFi.conf b/ucm2/DB820c/HiFi.conf +index fa7770e..501c263 100644 +--- a/ucm2/DB820c/HiFi.conf ++++ b/ucm2/DB820c/HiFi.conf +@@ -67,12 +67,13 @@ SectionDevice."Headphones" { + ] + + Value { ++ PlaybackPriority 100 + PlaybackPCM "plughw:${CardId},1" +- PlaybackChannels "2" ++ PlaybackChannels 2 + } + } + +-SectionDevice."HandsetMic" { ++SectionDevice."Headset" { + Comment "Headset Microphone" + + EnableSequence [ +@@ -93,7 +94,8 @@ SectionDevice."HandsetMic" { + ] + + Value { ++ CapturePriority 100 + CapturePCM "plughw:${CardId},2" +- CaptureChannels "1" ++ CaptureChannels 1 + } + } +-- +2.24.1 + + +From 42d0227c417e732ac76328e4168d885b07211f92 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 24 Jan 2020 10:15:58 +0100 +Subject: [PATCH 15/36] Dell-WD15-Dock: cleaups and corrections + +Signed-off-by: Jaroslav Kysela +--- + ucm2/Dell-WD15-Dock/Dell-WD15-Dock.conf | 6 ----- + ucm2/Dell-WD15-Dock/HiFi.conf | 26 ---------------------- + ucm2/USB-Audio/Dell-WD15-Dock-HiFi.conf | 29 +++++++++++++++++++++++++ + ucm2/USB-Audio/Dell-WD15-Dock.conf | 6 +++++ + 4 files changed, 35 insertions(+), 32 deletions(-) + delete mode 100644 ucm2/Dell-WD15-Dock/Dell-WD15-Dock.conf + delete mode 100644 ucm2/Dell-WD15-Dock/HiFi.conf + create mode 100644 ucm2/USB-Audio/Dell-WD15-Dock-HiFi.conf + create mode 100644 ucm2/USB-Audio/Dell-WD15-Dock.conf + +diff --git a/ucm2/Dell-WD15-Dock/Dell-WD15-Dock.conf b/ucm2/Dell-WD15-Dock/Dell-WD15-Dock.conf +deleted file mode 100644 +index 7b96a54..0000000 +--- a/ucm2/Dell-WD15-Dock/Dell-WD15-Dock.conf ++++ /dev/null +@@ -1,6 +0,0 @@ +-Syntax 2 +-Comment "USB-audio on Dell WD15 docking station" +-SectionUseCase."HiFi" { +- File "HiFi.conf" +- Comment "Default" +-} +diff --git a/ucm2/Dell-WD15-Dock/HiFi.conf b/ucm2/Dell-WD15-Dock/HiFi.conf +deleted file mode 100644 +index 3b02f81..0000000 +--- a/ucm2/Dell-WD15-Dock/HiFi.conf ++++ /dev/null +@@ -1,26 +0,0 @@ +-SectionDevice."Headphones" { +- Comment "Headphones" +- +- Value { +- PlaybackChannels "2" +- PlaybackPCM "hw:${CardId},0" +- } +-} +- +-SectionDevice."LineOut" { +- Comment "Line Out" +- +- Value { +- PlaybackChannels "2" +- PlaybackPCM "hw:${CardId},1" +- } +-} +- +-SectionDevice."Mic" { +- Comment "Microphone" +- +- Value { +- CaptureChannels "2" +- CapturePCM "hw:${CardId},0" +- } +-} +diff --git a/ucm2/USB-Audio/Dell-WD15-Dock-HiFi.conf b/ucm2/USB-Audio/Dell-WD15-Dock-HiFi.conf +new file mode 100644 +index 0000000..37b7e0d +--- /dev/null ++++ b/ucm2/USB-Audio/Dell-WD15-Dock-HiFi.conf +@@ -0,0 +1,29 @@ ++SectionDevice."Headphones" { ++ Comment "Headphones" ++ ++ Value { ++ PlaybackPriority 100 ++ PlaybackChannels 2 ++ PlaybackPCM "hw:${CardId}" ++ } ++} ++ ++SectionDevice."Line" { ++ Comment "Line Out" ++ ++ Value { ++ PlaybackPriority 200 ++ PlaybackChannels 2 ++ PlaybackPCM "hw:${CardId},1" ++ } ++} ++ ++SectionDevice."Mic" { ++ Comment "Microphone" ++ ++ Value { ++ CapturePriority 100 ++ CaptureChannels 2 ++ CapturePCM "hw:${CardId}" ++ } ++} +diff --git a/ucm2/USB-Audio/Dell-WD15-Dock.conf b/ucm2/USB-Audio/Dell-WD15-Dock.conf +new file mode 100644 +index 0000000..1fbac9e +--- /dev/null ++++ b/ucm2/USB-Audio/Dell-WD15-Dock.conf +@@ -0,0 +1,6 @@ ++Syntax 2 ++Comment "USB-audio on Dell WD15 docking station" ++SectionUseCase."HiFi" { ++ File "Dell-WD15-Dock-HiFi.conf" ++ Comment "Default" ++} +-- +2.24.1 + + +From dfad18452427460bf50c55a2c06f9460b2db2123 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 24 Jan 2020 11:06:29 +0100 +Subject: [PATCH 16/36] HDA-Intel/HiFi-dual: fixes and corrections + +Signed-off-by: Jaroslav Kysela +--- + ucm2/HDA Intel PCH/HDAudio-DualCodecs.conf | 6 - + .../HDAudio-Gigabyte-ALC1220DualCodecs.conf | 1 - + .../HDAudio-Lenovo-DualCodecs.conf | 1 - + ucm2/HDA Intel PCH/HiFi-dual.conf | 144 ------------------ + ucm2/HDA-Intel/HDAudio-DualCodecs.conf | 6 + + .../HDAudio-Gigabyte-ALC1220DualCodecs.conf | 1 + + ucm2/HDA-Intel/HDAudio-Lenovo-DualCodecs.conf | 1 + + ucm2/HDA-Intel/HiFi-dual.conf | 118 ++++++++++++++ + 8 files changed, 126 insertions(+), 152 deletions(-) + delete mode 100644 ucm2/HDA Intel PCH/HDAudio-DualCodecs.conf + delete mode 120000 ucm2/HDA Intel PCH/HDAudio-Gigabyte-ALC1220DualCodecs.conf + delete mode 120000 ucm2/HDA Intel PCH/HDAudio-Lenovo-DualCodecs.conf + delete mode 100644 ucm2/HDA Intel PCH/HiFi-dual.conf + create mode 100644 ucm2/HDA-Intel/HDAudio-DualCodecs.conf + create mode 120000 ucm2/HDA-Intel/HDAudio-Gigabyte-ALC1220DualCodecs.conf + create mode 120000 ucm2/HDA-Intel/HDAudio-Lenovo-DualCodecs.conf + create mode 100644 ucm2/HDA-Intel/HiFi-dual.conf + +diff --git a/ucm2/HDA Intel PCH/HDAudio-DualCodecs.conf b/ucm2/HDA Intel PCH/HDAudio-DualCodecs.conf +deleted file mode 100644 +index 8aaabd0..0000000 +--- a/ucm2/HDA Intel PCH/HDAudio-DualCodecs.conf ++++ /dev/null +@@ -1,6 +0,0 @@ +-Syntax 2 +-Comment "HDAudio with dual HD-audio codecs" +-SectionUseCase."HiFi" { +- File "HiFi-dual.conf" +- Comment "Default" +-} +diff --git a/ucm2/HDA Intel PCH/HDAudio-Gigabyte-ALC1220DualCodecs.conf b/ucm2/HDA Intel PCH/HDAudio-Gigabyte-ALC1220DualCodecs.conf +deleted file mode 120000 +index 89801aa..0000000 +--- a/ucm2/HDA Intel PCH/HDAudio-Gigabyte-ALC1220DualCodecs.conf ++++ /dev/null +@@ -1 +0,0 @@ +-HDAudio-DualCodecs.conf +\ No newline at end of file +diff --git a/ucm2/HDA Intel PCH/HDAudio-Lenovo-DualCodecs.conf b/ucm2/HDA Intel PCH/HDAudio-Lenovo-DualCodecs.conf +deleted file mode 120000 +index 89801aa..0000000 +--- a/ucm2/HDA Intel PCH/HDAudio-Lenovo-DualCodecs.conf ++++ /dev/null +@@ -1 +0,0 @@ +-HDAudio-DualCodecs.conf +\ No newline at end of file +diff --git a/ucm2/HDA Intel PCH/HiFi-dual.conf b/ucm2/HDA Intel PCH/HiFi-dual.conf +deleted file mode 100644 +index 63b3fe6..0000000 +--- a/ucm2/HDA Intel PCH/HiFi-dual.conf ++++ /dev/null +@@ -1,144 +0,0 @@ +-SectionVerb { +- Value { +- TQ "HiFi" +- } +- +- EnableSequence [ +- cset "name='Front Playback Volume' 100%" +- cset "name='Front Playback Switch' on" +- cset "name='Rear-Panel Capture Volume' 100%" +- cset "name='Rear-Panel Capture Switch' on" +- ] +- +- DisableSequence [ +- cset "name='Front Playback Volume' 0" +- cset "name='Front Playback Switch' off" +- cset "name='Rear-Panel Capture Volume' 0" +- cset "name='Rear-Panel Capture Switch' off" +- ] +-} +- +-SectionDevice."Speaker" { +- Comment "Speaker" +- +- Value { +- PlaybackChannels "2" +- PlaybackPCM "hw:${CardId},4" +- } +- +- ConflictingDevice [ +- "Headphone" +- ] +- +- EnableSequence [ +- cset "name='Speaker Playback Switch' on" +- cset "name='Speaker Playback Volume' 100%" +- ] +- +- DisableSequence [ +- cset "name='Speaker Playback Volume' 0" +- cset "name='Speaker Playback Switch' off" +- ] +-} +- +-SectionDevice."LineOut" { +- Comment "Line Out" +- +- Value { +- PlaybackChannels "2" +- PlaybackPCM "hw:${CardId},0" +- JackControl "Line Out Jack" +- JackHWMute "Speaker" +- } +-} +- +-SectionDevice."Headphones" { +- Comment "Headphones" +- +- Value { +- PlaybackChannels "2" +- PlaybackPCM "hw:${CardId},4" +- JackControl "Front Headphone Jack" +- JackHWMute "Speaker" +- } +- +- ConflictingDevice [ +- "Speaker" +- ] +- +- EnableSequence [ +- cset "name='Headphone Playback Switch' on" +- cset "name='Headphone Playback Volume' 100%" +- ] +- +- DisableSequence [ +- cset "name='Headphone Playback Volume' 0" +- cset "name='Headphone Playback Switch' off" +- ] +-} +- +-SectionDevice."LineIn" { +- Comment "Rear Line In" +- +- Value { +- CaptureChannels "2" +- CapturePCM "hw:${CardId},0" +- JackControl "Line Jack" +- } +- +- ConflictingDevice [ +- "RearMic" +- ] +- +- EnableSequence [ +- cset "name='Input Source' Line" +- If.0 { +- Condition { +- Type ControlExists +- Control "name='Line Boost Volume'" +- } +- True { +- cset "name='Line Boost Volume' 3" +- } +- } +- ] +-} +- +-SectionDevice."RearMic" { +- Comment "Rear Microphone" +- +- Value { +- CaptureChannels "2" +- CapturePCM "hw:${CardId},0" +- # CapturePriority "150" +- JackHWMute "LineIn" +- } +- +- ConflictingDevice [ +- "LineIn" +- ] +- +- EnableSequence [ +- cset "name='Input Source' Rear Mic" +- ] +-} +- +-SectionDevice."FrontMic" { +- Comment "Front Microphone" +- +- Value { +- CaptureChannels "2" +- CapturePCM "hw:${CardId},4" +- JackControl "Front Mic Jack" +- } +- +- EnableSequence [ +- cset "name='Front-Panel Capture Volume' 100%" +- cset "name='Front-Panel Capture Switch' on" +- ] +- +- DisableSequence [ +- cset "name='Front-Panel Capture Volume' 0" +- cset "name='Front-Panel Capture Switch' off" +- ] +-} +diff --git a/ucm2/HDA-Intel/HDAudio-DualCodecs.conf b/ucm2/HDA-Intel/HDAudio-DualCodecs.conf +new file mode 100644 +index 0000000..8aaabd0 +--- /dev/null ++++ b/ucm2/HDA-Intel/HDAudio-DualCodecs.conf +@@ -0,0 +1,6 @@ ++Syntax 2 ++Comment "HDAudio with dual HD-audio codecs" ++SectionUseCase."HiFi" { ++ File "HiFi-dual.conf" ++ Comment "Default" ++} +diff --git a/ucm2/HDA-Intel/HDAudio-Gigabyte-ALC1220DualCodecs.conf b/ucm2/HDA-Intel/HDAudio-Gigabyte-ALC1220DualCodecs.conf +new file mode 120000 +index 0000000..89801aa +--- /dev/null ++++ b/ucm2/HDA-Intel/HDAudio-Gigabyte-ALC1220DualCodecs.conf +@@ -0,0 +1 @@ ++HDAudio-DualCodecs.conf +\ No newline at end of file +diff --git a/ucm2/HDA-Intel/HDAudio-Lenovo-DualCodecs.conf b/ucm2/HDA-Intel/HDAudio-Lenovo-DualCodecs.conf +new file mode 120000 +index 0000000..89801aa +--- /dev/null ++++ b/ucm2/HDA-Intel/HDAudio-Lenovo-DualCodecs.conf +@@ -0,0 +1 @@ ++HDAudio-DualCodecs.conf +\ No newline at end of file +diff --git a/ucm2/HDA-Intel/HiFi-dual.conf b/ucm2/HDA-Intel/HiFi-dual.conf +new file mode 100644 +index 0000000..846c6db +--- /dev/null ++++ b/ucm2/HDA-Intel/HiFi-dual.conf +@@ -0,0 +1,118 @@ ++SectionVerb { ++ Value { ++ TQ "HiFi" ++ PlaybackChannels 2 ++ CaptureChannels 2 ++ } ++ ++ EnableSequence [ ++ cset "name='Front Playback Volume' 100%" ++ cset "name='Front Playback Switch' on" ++ cset "name='Rear-Panel Capture Volume' 100%" ++ cset "name='Rear-Panel Capture Switch' on" ++ ] ++ ++ DisableSequence [ ++ cset "name='Front Playback Volume' 0" ++ cset "name='Front Playback Switch' off" ++ cset "name='Rear-Panel Capture Volume' 0" ++ cset "name='Rear-Panel Capture Switch' off" ++ ] ++} ++ ++SectionDevice."Speaker" { ++ Comment "Speaker" ++ ++ Value { ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId},4" ++ PlaybackMixerElem "Speaker" ++ } ++ ++ ConflictingDevice [ ++ "Headphones" ++ ] ++} ++ ++SectionDevice."Line1" { ++ Comment "Line Out" ++ ++ Value { ++ PlaybackPriority 200 ++ PlaybackPCM "hw:${CardId}" ++ JackControl "Line Out Jack" ++ JackHWMute "Speaker" ++ } ++} ++ ++SectionDevice."Headphones" { ++ Comment "Headphones" ++ ++ Value { ++ PlaybackPriority 300 ++ PlaybackPCM "hw:${CardId},4" ++ PlaybackMixerElem "Headphone" ++ JackControl "Front Headphone Jack" ++ JackHWMute "Speaker" ++ } ++ ++ ConflictingDevice [ ++ "Speaker" ++ ] ++} ++ ++SectionDevice."Line2" { ++ Comment "Rear Line In" ++ ++ Value { ++ CapturePriority 200 ++ CapturePCM "hw:${CardId}" ++ JackControl "Line Jack" ++ } ++ ++ ConflictingDevice [ ++ "Mic2" ++ ] ++ ++ EnableSequence [ ++ cset "name='Input Source' Line" ++ If.0 { ++ Condition { ++ Type ControlExists ++ Control "name='Line Boost Volume'" ++ } ++ True { ++ cset "name='Line Boost Volume' 3" ++ } ++ } ++ ] ++} ++ ++SectionDevice."Mic2" { ++ Comment "Rear Microphone" ++ ++ Value { ++ CapturePriority 300 ++ CapturePCM "hw:${CardId}" ++ JackHWMute "Line2" ++ } ++ ++ ConflictingDevice [ ++ "Line2" ++ ] ++ ++ EnableSequence [ ++ cset "name='Input Source' Rear Mic" ++ ] ++} ++ ++SectionDevice."Mic1" { ++ Comment "Front Microphone" ++ ++ Value { ++ CapturePriority 100 ++ CapturePCM "hw:${CardId},4" ++ CaptureMixerElem "Front-Panel" ++ JackControl "Front Mic Jack" ++ } ++} +-- +2.24.1 + + +From ffae896c7e958198b795c9680e4e4fb64b88c8ea Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 24 Jan 2020 14:35:10 +0100 +Subject: [PATCH 17/36] cht-bsw-rt5672: fixes and corrections + +Signed-off-by: Jaroslav Kysela +--- + ucm2/cht-bsw-rt5672/HiFi-stereo-dmic2.conf | 9 ++++----- + ucm2/cht-bsw-rt5672/HiFi.conf | 5 ----- + ucm2/codecs/rt5672/DMIC1.conf | 8 +++++--- + ucm2/codecs/rt5672/DMIC2.conf | 8 +++++--- + ucm2/codecs/rt5672/HeadPhones.conf | 8 +++++--- + ucm2/codecs/rt5672/HeadsetMic.conf | 10 ++++++---- + ucm2/codecs/rt5672/MonoSpeaker.conf | 8 +++++--- + ucm2/codecs/rt5672/Speaker.conf | 10 ++++++---- + 8 files changed, 36 insertions(+), 30 deletions(-) + +diff --git a/ucm2/cht-bsw-rt5672/HiFi-stereo-dmic2.conf b/ucm2/cht-bsw-rt5672/HiFi-stereo-dmic2.conf +index 2916490..82c976b 100644 +--- a/ucm2/cht-bsw-rt5672/HiFi-stereo-dmic2.conf ++++ b/ucm2/cht-bsw-rt5672/HiFi-stereo-dmic2.conf +@@ -9,15 +9,14 @@ SectionVerb { + DisableSequence [ + + ] +- +- Value { +- PlaybackPCM "hw:${CardId}" +- CapturePCM "hw:${CardId}" +- } + } + + ++RenameDevice."Speaker1" "Speaker" ++RemoveDevice."Speaker2" "Speaker2" + + + ++RenameDevice."Mic2" "Mic" ++RemoveDevice."Mic1" "Mic1" + +diff --git a/ucm2/cht-bsw-rt5672/HiFi.conf b/ucm2/cht-bsw-rt5672/HiFi.conf +index 18c6932..9a64cc3 100644 +--- a/ucm2/cht-bsw-rt5672/HiFi.conf ++++ b/ucm2/cht-bsw-rt5672/HiFi.conf +@@ -9,11 +9,6 @@ SectionVerb { + DisableSequence [ + + ] +- +- Value { +- PlaybackPCM "hw:${CardId}" +- CapturePCM "hw:${CardId}" +- } + } + + +diff --git a/ucm2/codecs/rt5672/DMIC1.conf b/ucm2/codecs/rt5672/DMIC1.conf +index b3da627..73983af 100644 +--- a/ucm2/codecs/rt5672/DMIC1.conf ++++ b/ucm2/codecs/rt5672/DMIC1.conf +@@ -1,9 +1,9 @@ +-SectionDevice."DigitalMic-DMIC1" { ++SectionDevice."Mic1" { + Comment "Internal Digital Microphone on DMIC1" + + ConflictingDevice [ +- "DigitalMic-DMIC2" +- "HeadsetMic" ++ "Mic2" ++ "Headset" + ] + + EnableSequence [ +@@ -21,6 +21,8 @@ SectionDevice."DigitalMic-DMIC1" { + ] + + Value { ++ CapturePriority 100 ++ CapturePCM "hw:${CardId}" + CaptureChannels 2 + } + } +diff --git a/ucm2/codecs/rt5672/DMIC2.conf b/ucm2/codecs/rt5672/DMIC2.conf +index 38fe015..751c95c 100644 +--- a/ucm2/codecs/rt5672/DMIC2.conf ++++ b/ucm2/codecs/rt5672/DMIC2.conf +@@ -1,9 +1,9 @@ +-SectionDevice."DigitalMic-DMIC2" { ++SectionDevice."Mic2" { + Comment "Internal Digital Microphone on DMIC2" + + ConflictingDevice [ +- "DigitalMic-DMIC1" +- "HeadsetMic" ++ "Mic1" ++ "Headset" + ] + + EnableSequence [ +@@ -21,6 +21,8 @@ SectionDevice."DigitalMic-DMIC2" { + ] + + Value { ++ CapturePriority 200 ++ CapturePCM "hw:${CardId}" + CaptureChannels 2 + } + } +diff --git a/ucm2/codecs/rt5672/HeadPhones.conf b/ucm2/codecs/rt5672/HeadPhones.conf +index 350fb2b..0542f77 100644 +--- a/ucm2/codecs/rt5672/HeadPhones.conf ++++ b/ucm2/codecs/rt5672/HeadPhones.conf +@@ -2,8 +2,8 @@ SectionDevice."Headphones" { + Comment "Headphones" + + ConflictingDevice [ +- "Speaker" +- "MonoSpeaker" ++ "Speaker1" ++ "Speaker2" + ] + + EnableSequence [ +@@ -15,7 +15,9 @@ SectionDevice."Headphones" { + ] + + Value { +- PlaybackChannels "2" ++ PlaybackPriority 300 ++ PlaybackPCM "hw:${CardId}" ++ PlaybackChannels 2 + JackControl "Headphone Jack" + } + } +diff --git a/ucm2/codecs/rt5672/HeadsetMic.conf b/ucm2/codecs/rt5672/HeadsetMic.conf +index fd02cb3..f407579 100644 +--- a/ucm2/codecs/rt5672/HeadsetMic.conf ++++ b/ucm2/codecs/rt5672/HeadsetMic.conf +@@ -1,9 +1,9 @@ +-SectionDevice."HeadsetMic" { ++SectionDevice."Headset" { + Comment "Headset Microphone" + + ConflictingDevice [ +- "DigitalMic-DMIC1" +- "DigitalMic-DMIC2" ++ "Mic1" ++ "Mic2" + ] + + EnableSequence [ +@@ -30,7 +30,9 @@ SectionDevice."HeadsetMic" { + ] + + Value { +- CaptureChannels "2" ++ CapturePriority 300 ++ CapturePCM "hw:${CardId}" ++ CaptureChannels 2 + JackControl "Headset Mic Jack" + } + } +diff --git a/ucm2/codecs/rt5672/MonoSpeaker.conf b/ucm2/codecs/rt5672/MonoSpeaker.conf +index 6308ad9..0849c67 100644 +--- a/ucm2/codecs/rt5672/MonoSpeaker.conf ++++ b/ucm2/codecs/rt5672/MonoSpeaker.conf +@@ -1,8 +1,8 @@ +-SectionDevice."MonoSpeaker" { ++SectionDevice."Speaker2" { + Comment "Mono Speaker" + + ConflictingDevice [ +- "Speaker" ++ "Speaker1" + "Headphones" + ] + +@@ -19,6 +19,8 @@ SectionDevice."MonoSpeaker" { + ] + + Value { +- PlaybackChannels "2" ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId}" ++ PlaybackChannels 2 + } + } +diff --git a/ucm2/codecs/rt5672/Speaker.conf b/ucm2/codecs/rt5672/Speaker.conf +index e4391cc..44e73aa 100644 +--- a/ucm2/codecs/rt5672/Speaker.conf ++++ b/ucm2/codecs/rt5672/Speaker.conf +@@ -1,8 +1,8 @@ +-SectionDevice."Speaker" { +- Comment "Speakers" ++SectionDevice."Speaker1" { ++ Comment "Stereo Speakers" + + ConflictingDevice [ +- "MonoSpeaker" ++ "Speaker2" + "Headphones" + ] + +@@ -15,6 +15,8 @@ SectionDevice."Speaker" { + ] + + Value { +- PlaybackChannels "2" ++ PlaybackPriority 200 ++ PlaybackPCM "hw:${CardId}" ++ PlaybackChannels 2 + } + } +-- +2.24.1 + + +From 54f0ed010f7353b37a7b0eee109537675323b9d8 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 24 Jan 2020 14:39:26 +0100 +Subject: [PATCH 18/36] chtnau8824: fixes and corrections + +Signed-off-by: Jaroslav Kysela +--- + ucm2/chtnau8824/HiFi-mono.conf | 3 --- + ucm2/chtnau8824/HiFi.conf | 8 -------- + ucm2/codecs/nau8824/HeadPhones.conf | 5 +++-- + ucm2/codecs/nau8824/HeadsetMic.conf | 8 +++++--- + ucm2/codecs/nau8824/InternalMic.conf | 9 +++++---- + ucm2/codecs/nau8824/MonoSpeaker.conf | 7 ++++--- + ucm2/codecs/nau8824/Speaker.conf | 5 +++-- + 7 files changed, 20 insertions(+), 25 deletions(-) + +diff --git a/ucm2/chtnau8824/HiFi-mono.conf b/ucm2/chtnau8824/HiFi-mono.conf +index 3433d03..26d6a56 100644 +--- a/ucm2/chtnau8824/HiFi-mono.conf ++++ b/ucm2/chtnau8824/HiFi-mono.conf +@@ -3,9 +3,6 @@ SectionVerb { + + Value { + TQ "HiFi" +- # ALSA PCM device for HiFi +- PlaybackPCM "hw:${CardId}" +- CapturePCM "hw:${CardId}" + } + + EnableSequence [ +diff --git a/ucm2/chtnau8824/HiFi.conf b/ucm2/chtnau8824/HiFi.conf +index 9f7ac74..fd8b741 100644 +--- a/ucm2/chtnau8824/HiFi.conf ++++ b/ucm2/chtnau8824/HiFi.conf +@@ -1,13 +1,5 @@ + + SectionVerb { +- +- Value { +- TQ "HiFi" +- # ALSA PCM device for HiFi +- PlaybackPCM "hw:${CardId}" +- CapturePCM "hw:${CardId}" +- } +- + EnableSequence [ + + +diff --git a/ucm2/codecs/nau8824/HeadPhones.conf b/ucm2/codecs/nau8824/HeadPhones.conf +index f35f4e2..6623365 100644 +--- a/ucm2/codecs/nau8824/HeadPhones.conf ++++ b/ucm2/codecs/nau8824/HeadPhones.conf +@@ -2,12 +2,13 @@ SectionDevice."Headphones" { + Comment "Headphones" + + Value { +- PlaybackChannels "2" ++ PlaybackPriority 200 ++ PlaybackPCM "hw:${CardId}" ++ PlaybackChannels 2 + JackControl "Headphone Jack" + } + + ConflictingDevice [ +- "MonoSpeaker" + "Speaker" + ] + +diff --git a/ucm2/codecs/nau8824/HeadsetMic.conf b/ucm2/codecs/nau8824/HeadsetMic.conf +index bc17f9f..7381638 100644 +--- a/ucm2/codecs/nau8824/HeadsetMic.conf ++++ b/ucm2/codecs/nau8824/HeadsetMic.conf +@@ -1,13 +1,15 @@ +-SectionDevice."HeadsetMic" { ++SectionDevice."Headset" { + Comment "Headset Microphone" + + Value { +- CaptureChannels "2" ++ CapturePriority 300 ++ CapturePCM "hw:${CardId}" ++ CaptureChannels 2 + JackControl "Headset Mic Jack" + } + + ConflictingDevice [ +- "InternalMic" ++ "Mic" + ] + + EnableSequence [ +diff --git a/ucm2/codecs/nau8824/InternalMic.conf b/ucm2/codecs/nau8824/InternalMic.conf +index 3793d64..731a261 100644 +--- a/ucm2/codecs/nau8824/InternalMic.conf ++++ b/ucm2/codecs/nau8824/InternalMic.conf +@@ -1,13 +1,14 @@ +-SectionDevice."InternalMic" { ++SectionDevice."Mic" { + Comment "Internal Microphone" + + Value { +- CaptureChannels "2" +- CapturePriority "150" ++ CapturePriority 200 ++ CapturePCM "hw:${CardId}" ++ CaptureChannels 2 + } + + ConflictingDevice [ +- "HeadsetMic" ++ "Headset" + ] + + EnableSequence [ +diff --git a/ucm2/codecs/nau8824/MonoSpeaker.conf b/ucm2/codecs/nau8824/MonoSpeaker.conf +index 5321c8a..b02a22c 100644 +--- a/ucm2/codecs/nau8824/MonoSpeaker.conf ++++ b/ucm2/codecs/nau8824/MonoSpeaker.conf +@@ -1,12 +1,13 @@ +-SectionDevice."MonoSpeaker" { ++SectionDevice."Speaker" { + Comment "Mono Speaker" + + Value { +- PlaybackChannels "2" ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId}" ++ PlaybackChannels 2 + } + + ConflictingDevice [ +- "Speaker" + "Headphones" + ] + +diff --git a/ucm2/codecs/nau8824/Speaker.conf b/ucm2/codecs/nau8824/Speaker.conf +index 474c373..3658795 100644 +--- a/ucm2/codecs/nau8824/Speaker.conf ++++ b/ucm2/codecs/nau8824/Speaker.conf +@@ -2,11 +2,12 @@ SectionDevice."Speaker" { + Comment "Speaker" + + Value { +- PlaybackChannels "2" ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId}" ++ PlaybackChannels 2 + } + + ConflictingDevice [ +- "MonoSpeaker" + "Headphones" + ] + +-- +2.24.1 + + +From ed9918179e37e091a861cea57022d45ff50b2bca Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 27 Jan 2020 16:01:21 +0100 +Subject: [PATCH 19/36] skylake-rt286: fixes and corrections + +Signed-off-by: Jaroslav Kysela +--- + ucm2/skylake-rt286/Hdmi1.conf | 7 +++--- + ucm2/skylake-rt286/Hdmi2.conf | 7 +++--- + ucm2/skylake-rt286/HiFi.conf | 36 ++++++++++++--------------- + ucm2/skylake-rt286/skylake-rt286.conf | 14 ++--------- + 4 files changed, 24 insertions(+), 40 deletions(-) + +diff --git a/ucm2/skylake-rt286/Hdmi1.conf b/ucm2/skylake-rt286/Hdmi1.conf +index 975fd39..5a56943 100644 +--- a/ucm2/skylake-rt286/Hdmi1.conf ++++ b/ucm2/skylake-rt286/Hdmi1.conf +@@ -1,16 +1,15 @@ + # Usecase for device HDMI1/Display Port stereo playback on Intel SKYLAKE/KABYLAKE platforms + # For Audio in I2S mode + +-SectionDevice."Hdmi1" { ++SectionDevice."HDMI1" { + Comment "HDMI/Display Port 1 Stereo" + + Value { ++ PlaybackPriority 300 + PlaybackPCM "hw:${CardId},4" +- PlaybackChannels "2" +- PlaybackPriority "3" + If.1 { + Condition { +- ControlExists ++ Type ControlExists + Control "iface=CARD,name='HDMI/DP,pcm=4 Jack'" + } + True { +diff --git a/ucm2/skylake-rt286/Hdmi2.conf b/ucm2/skylake-rt286/Hdmi2.conf +index d6ca62f..d2780b6 100644 +--- a/ucm2/skylake-rt286/Hdmi2.conf ++++ b/ucm2/skylake-rt286/Hdmi2.conf +@@ -1,16 +1,15 @@ + # Usecase for device HDMI2/Display Port stereo playback on Intel SKYLAKE/KABYLAKE platforms + # For Audio in I2S mode + +-SectionDevice."Hdmi2" { ++SectionDevice."HDMI2" { + Comment "HDMI/Display Port 2 Stereo" + + Value { ++ PlaybackPriority 400 + PlaybackPCM "hw:${CardId},5" +- PlaybackChannels "2" +- PlaybackPriority "4" + If.1 { + Condition { +- ControlExists ++ Type ControlExists + Control "iface=CARD,name='HDMI/DP,pcm=5 Jack'" + } + True { +diff --git a/ucm2/skylake-rt286/HiFi.conf b/ucm2/skylake-rt286/HiFi.conf +index 489170f..9e94a1b 100644 +--- a/ucm2/skylake-rt286/HiFi.conf ++++ b/ucm2/skylake-rt286/HiFi.conf +@@ -2,15 +2,12 @@ + # For Audio in I2S mode on Intel SKYLAKE/KABYLAKE platforms + + SectionVerb { +- + EnableSequence [ + cset "name='media0_out mo dmic01_hifi_in mi Switch' 1" + ] + + Value { + TQ "HiFi" +- CapturePCM "hw:${CardId},1" +- PlaybackPCM "hw:${CardId},0" + } + } + +@@ -20,6 +17,7 @@ SectionDevice."Headphones" { + ConflictingDevice [ + "Speaker" + ] ++ + EnableSequence [ + cset "name='HPO L Switch' 1" + cset "name='HPO R Switch' 1" +@@ -27,11 +25,9 @@ SectionDevice."Headphones" { + cset "name='Speaker Playback Switch' 0,0" + ] + +- DisableSequence [ +- ] + Value { +- PlaybackChannels "2" +- PlaybackPriority "1" ++ PlaybackPriority 200 ++ PlaybackPCM "hw:${CardId}" + JackControl "Headphone Jack" + JackHWMute "Speaker" + } +@@ -43,6 +39,7 @@ SectionDevice."Speaker" { + ConflictingDevice [ + "Headphones" + ] ++ + EnableSequence [ + cset "name='SPO Switch' 1" + cset "name='Speaker Playback Switch' 1,1" +@@ -51,20 +48,18 @@ SectionDevice."Speaker" { + cset "name='HPO R Switch' 0" + ] + +- DisableSequence [ +- ] + Value { +- PlaybackChannels "2" +- PlaybackPriority "1" ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId}" + JackHWMute "Headphones" + } + } + + SectionDevice."Headset" { +- Comment "Headset Mic" ++ Comment "Headset Microphone" + + ConflictingDevice [ +- "dmiccap" ++ "Mic" + ] + EnableSequence [ + cset "name='media0_out mo codec0_in mi Switch' 1" +@@ -79,15 +74,14 @@ SectionDevice."Headset" { + cset "name='media0_out mo codec0_in mi Switch' 0" + ] + Value { +- CaptureChannels "2" +- CapturePriority "2" ++ CapturePriority 200 ++ CapturePCM "hw:${CardId},1" + JackControl "Mic Jack" + } + } + +- +-SectionDevice."dmiccap" { +- Comment "DMIC Stereo" ++SectionDevice."Mic" { ++ Comment "Digital Stereo Microphone" + + ConflictingDevice [ + "Headset" +@@ -110,8 +104,10 @@ SectionDevice."dmiccap" { + cset "name='ADC 0 Mux' 2" + ] + Value { +- CaptureChannels "2" +- CapturePriority "2" ++ CapturePriority 100 ++ CapturePCM "hw:${CardId},1" + } + } + ++ ++ +diff --git a/ucm2/skylake-rt286/skylake-rt286.conf b/ucm2/skylake-rt286/skylake-rt286.conf +index efb8a20..4ea5777 100644 +--- a/ucm2/skylake-rt286/skylake-rt286.conf ++++ b/ucm2/skylake-rt286/skylake-rt286.conf +@@ -8,19 +8,9 @@ SectionUseCase."HiFi" { + Comment "Play and record HiFi quality Music" + } + +-SectionUseCase."Hdmi1" { +- File "Hdmi1.conf" +- Comment "Play on Hdmi/DP 1" +-} +- +-SectionUseCase."Hdmi2" { +- File "Hdmi2.conf" +- Comment "Play on Hdmi/DP 2" +-} +- + ValueDefaults { +- CaptureChannels "2" +- CapturePriority "2" ++ PlaybackChannels 2 ++ CaptureChannels 2 + } + + SectionDefaults [ +-- +2.24.1 + + +From 35c2bba4906a278d876503855c55c2e7f9247616 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 27 Jan 2020 16:06:25 +0100 +Subject: [PATCH 20/36] SDP4430: corrections and fixes + +Signed-off-by: Jaroslav Kysela +--- + ucm2/SDP4430/FMAnalog.conf | 11 +++---- + ucm2/SDP4430/HiFiLP.conf | 7 ++-- + ucm2/SDP4430/Record.conf | 5 ++- + ucm2/SDP4430/SDP4430.conf | 2 +- + ucm2/SDP4430/Voice.conf | 6 ++-- + ucm2/SDP4430/VoiceAll.conf | 63 ------------------------------------ + ucm2/SDP4430/VoiceCall.conf | 64 +++++++++++++++++++++++++++++++++++++ + 7 files changed, 82 insertions(+), 76 deletions(-) + delete mode 100644 ucm2/SDP4430/VoiceAll.conf + create mode 100644 ucm2/SDP4430/VoiceCall.conf + +diff --git a/ucm2/SDP4430/FMAnalog.conf b/ucm2/SDP4430/FMAnalog.conf +index 9681465..2cfabf9 100644 +--- a/ucm2/SDP4430/FMAnalog.conf ++++ b/ucm2/SDP4430/FMAnalog.conf +@@ -9,19 +9,12 @@ SectionVerb { + cset "name='Capture Volume' 4" + ] + +- + DisableSequence [ + cset "name='AMIC_UL PDM Switch' 0" + cset "name='MUX_UL00' 0" + cset "name='MUX_UL01' 0" + cset "name='Capture Volume' 0" + ] +- +- # Optional TQ and ALSA PCMs +- Value { +- TQ "Music" +- CapturePCM "hw:${CardId},0" +- } + } + + SectionDevice."Headset" { +@@ -38,5 +31,9 @@ SectionDevice."Headset" { + cset "name='Analog Right Capture Route' 3" + cset "name='Capture Preamplifier Volume' 0" + ] ++ ++ Value { ++ CapturePCM "hw:${CardId},0" ++ } + } + +diff --git a/ucm2/SDP4430/HiFiLP.conf b/ucm2/SDP4430/HiFiLP.conf +index 51380d9..731ac21 100644 +--- a/ucm2/SDP4430/HiFiLP.conf ++++ b/ucm2/SDP4430/HiFiLP.conf +@@ -18,10 +18,8 @@ SectionVerb { + cset "name='SDT DL Volume' 0" + ] + +- # Optional TQ and ALSA PCMs + Value { + TQ "Music" +- PlaybackPCM "hw:${CardId},6" + } + } + +@@ -39,4 +37,9 @@ SectionDevice."Headset" { + cset "name='HS Left Playback' 0" + cset "name='Headset Playback Volume' 0" + ] ++ ++ Value { ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId},6" ++ } + } +diff --git a/ucm2/SDP4430/Record.conf b/ucm2/SDP4430/Record.conf +index 9f62fd1..d3c4955 100644 +--- a/ucm2/SDP4430/Record.conf ++++ b/ucm2/SDP4430/Record.conf +@@ -19,7 +19,6 @@ SectionVerb { + # Optional TQ and ALSA PCMs + Value { + TQ "Music" +- CapturePCM "hw:${CardId},0" + } + + } +@@ -38,4 +37,8 @@ SectionDevice."Headset" { + cset "name='Analog Right Capture Route' 3" + cset "name='Capture Preamplifier Volume' 0" + ] ++ ++ Value { ++ CapturePCM "hw:${CardId},0" ++ } + } +diff --git a/ucm2/SDP4430/SDP4430.conf b/ucm2/SDP4430/SDP4430.conf +index df5b5b9..fd95890 100644 +--- a/ucm2/SDP4430/SDP4430.conf ++++ b/ucm2/SDP4430/SDP4430.conf +@@ -13,7 +13,7 @@ SectionUseCase."HiFi" { + } + + SectionUseCase."HiFi_Low_Power" { +- File "HiHiLP.conf" ++ File "HiFiLP.conf" + Comment "Play HiFi quality Music in Low Power Mode" + } + +diff --git a/ucm2/SDP4430/Voice.conf b/ucm2/SDP4430/Voice.conf +index 7d10a17..15cd4f0 100644 +--- a/ucm2/SDP4430/Voice.conf ++++ b/ucm2/SDP4430/Voice.conf +@@ -18,10 +18,8 @@ SectionVerb { + cset "name='SDT DL Volume' 0" + ] + +- # Optional TQ and ALSA PCMs + Value { + TQ "Voice" +- PlaybackPCM "hw:${CardId},2" + } + } + +@@ -39,4 +37,8 @@ SectionDevice."Headset" { + cset "name='HS Left Playback' 0" + cset "name='Headset Playback Volume' 0" + ] ++ ++ Value { ++ PlaybackPCM "hw:${CardId},2" ++ } + } +diff --git a/ucm2/SDP4430/VoiceAll.conf b/ucm2/SDP4430/VoiceAll.conf +deleted file mode 100644 +index 07843c5..0000000 +--- a/ucm2/SDP4430/VoiceAll.conf ++++ /dev/null +@@ -1,63 +0,0 @@ +-# Use case Configuration for TI SDP4430 HiFi Music +-# By Liam Girdwood +- +-SectionVerb { +- EnableSequence [ +- cset "name='AMIC_UL PDM Switch' 1" +- cset "name='Sidetone Mixer Capture' 1" +- cset "name='MUX_VX0' 9" +- cset "name='MUX_VX1' 10" +- cset "name='DL1 Mixer Voice' 1" +- cset "name='Sidetone Mixer Playback' 1" +- cset "name='DL1 PDM Switch' 1" +- cset "name='DL1 Voice Playback Volume' 90,90" +- cset "name='Capture Volume' 4" +- cset "name='Capture Mixer Voice Capture' 90,90" +- cset "name='SDT DL Volume' 120" +- ] +- +- +- DisableSequence [ +- cset "name='AMIC_UL PDM Switch' 0" +- cset "name='Sidetone Mixer Capture' 0" +- cset "name='MUX_VX0' 0" +- cset "name='MUX_VX1' 0" +- cset "name='DL1 Mixer Voice' 0" +- cset "name='Sidetone Mixer Playback' 0" +- cset "name='DL1 PDM Switch' 0" +- cset "name='DL1 Voice Playback Volume' 0,0" +- cset "name='Capture Volume' 0" +- cset "name='DL1 Voice Playback Volume' 0,0" +- cset "name='SDT DL Volume' 0" +- ] +- +- # Optional TQ and ALSA PCMs +- Value { +- TQ "Voice" +- CapturePCM "hw:${CardId},2" +- PlaybackPCM "hw:${CardId},2" +- } +-} +- +-SectionDevice."Headset" { +- Comment "SDP4430 3.5mm Headset" +- +- EnableSequence [ +- cset "name='Analog Left Capture Route' 0" +- cset "name='Analog Right Capture Route' 0" +- cset "name='Capture Preamplifier Volume' 2" +- cset "name='HS Left Playback' 1" +- cset "name='HS Right Playback' 1" +- cset "name='Headset Playback Volume' 13" +- ] +- +- DisableSequence [ +- cset "name='Analog Left Capture Route' 3" +- cset "name='Analog Right Capture Route' 3" +- cset "name='Capture Preamplifier Volume' 0" +- cset "name='HS Right Playback' 0" +- cset "name='HS Left Playback' 0" +- cset "name='Headset Playback Volume' 0" +- ] +-} +- +diff --git a/ucm2/SDP4430/VoiceCall.conf b/ucm2/SDP4430/VoiceCall.conf +new file mode 100644 +index 0000000..2f02a2b +--- /dev/null ++++ b/ucm2/SDP4430/VoiceCall.conf +@@ -0,0 +1,64 @@ ++# Use case Configuration for TI SDP4430 HiFi Music ++# By Liam Girdwood ++ ++SectionVerb { ++ EnableSequence [ ++ cset "name='AMIC_UL PDM Switch' 1" ++ cset "name='Sidetone Mixer Capture' 1" ++ cset "name='MUX_VX0' 9" ++ cset "name='MUX_VX1' 10" ++ cset "name='DL1 Mixer Voice' 1" ++ cset "name='Sidetone Mixer Playback' 1" ++ cset "name='DL1 PDM Switch' 1" ++ cset "name='DL1 Voice Playback Volume' 90,90" ++ cset "name='Capture Volume' 4" ++ cset "name='Capture Mixer Voice Capture' 90,90" ++ cset "name='SDT DL Volume' 120" ++ ] ++ ++ ++ DisableSequence [ ++ cset "name='AMIC_UL PDM Switch' 0" ++ cset "name='Sidetone Mixer Capture' 0" ++ cset "name='MUX_VX0' 0" ++ cset "name='MUX_VX1' 0" ++ cset "name='DL1 Mixer Voice' 0" ++ cset "name='Sidetone Mixer Playback' 0" ++ cset "name='DL1 PDM Switch' 0" ++ cset "name='DL1 Voice Playback Volume' 0,0" ++ cset "name='Capture Volume' 0" ++ cset "name='DL1 Voice Playback Volume' 0,0" ++ cset "name='SDT DL Volume' 0" ++ ] ++ ++ Value { ++ TQ "Voice" ++ } ++} ++ ++SectionDevice."Headset" { ++ Comment "SDP4430 3.5mm Headset" ++ ++ EnableSequence [ ++ cset "name='Analog Left Capture Route' 0" ++ cset "name='Analog Right Capture Route' 0" ++ cset "name='Capture Preamplifier Volume' 2" ++ cset "name='HS Left Playback' 1" ++ cset "name='HS Right Playback' 1" ++ cset "name='Headset Playback Volume' 13" ++ ] ++ ++ DisableSequence [ ++ cset "name='Analog Left Capture Route' 3" ++ cset "name='Analog Right Capture Route' 3" ++ cset "name='Capture Preamplifier Volume' 0" ++ cset "name='HS Right Playback' 0" ++ cset "name='HS Left Playback' 0" ++ cset "name='Headset Playback Volume' 0" ++ ] ++ ++ Value { ++ CapturePCM "hw:${CardId},2" ++ PlaybackPCM "hw:${CardId},2" ++ } ++} +-- +2.24.1 + + +From 9de65f1f733d178be0e61e3c9f37df1031ab6a81 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 28 Jan 2020 17:57:43 +0100 +Subject: [PATCH 21/36] sof-hda-dsp: fix typo (PlaybackMixerMaster -> + PlaybackMasterElem) + +Signed-off-by: Jaroslav Kysela +--- + ucm2/sof-hda-dsp/HiFi.conf | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ucm2/sof-hda-dsp/HiFi.conf b/ucm2/sof-hda-dsp/HiFi.conf +index 5c7236d..71cef49 100644 +--- a/ucm2/sof-hda-dsp/HiFi.conf ++++ b/ucm2/sof-hda-dsp/HiFi.conf +@@ -21,7 +21,7 @@ SectionDevice."Headphones1" { + PlaybackPriority 200 + PlaybackPCM "hw:${CardId},0" + PlaybackMixerElem "Headphone" +- PlaybackMixerMaster "Master" ++ PlaybackMasterElem "Master" + PlaybackVolume "Headphone Playback Volume" + PlaybackSwitch "Headphone Playback Switch" + PlaybackChannels "2" +-- +2.24.1 + + +From 4fd064eb56bec3a47f8380fd1498bbc190cca703 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 28 Jan 2020 18:15:22 +0100 +Subject: [PATCH 22/36] broadwell-rt286: add correct prefix to Priority field + names + +Signed-off-by: Jaroslav Kysela +--- + ucm2/broadwell-rt286/HiFi.conf | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/ucm2/broadwell-rt286/HiFi.conf b/ucm2/broadwell-rt286/HiFi.conf +index e766250..96b89a0 100644 +--- a/ucm2/broadwell-rt286/HiFi.conf ++++ b/ucm2/broadwell-rt286/HiFi.conf +@@ -21,7 +21,7 @@ SectionDevice."Speaker" { + ] + + Value { +- Priority 100 ++ PlaybackPriority 100 + PlaybackPCM "hw:${CardId}" + PlaybackChannels 2 + PlaybackMixerElem "DAC0" +@@ -49,7 +49,7 @@ SectionDevice."Headphones" { + ] + + Value { +- Priority 200 ++ PlaybackPriority 200 + PlaybackPCM "hw:${CardId}" + PlaybackChannels 2 + PlaybackMixerElem "DAC0" +@@ -76,9 +76,9 @@ SectionDevice."Mic" { + ] + + Value { +- Priority 100 ++ CapturePriority 100 + CapturePCM "hw:${CardId}" +- CaptureChannels "2" ++ CaptureChannels 2 + CaptureMixerElem "Mic" + CaptureMasterElem "ADC0" + } +@@ -101,9 +101,9 @@ SectionDevice."Handset" { + ] + + Value { +- Priority 200 ++ CapturePriority 200 + CapturePCM "hw:${CardId}" +- CaptureChannels "2" ++ CaptureChannels 2 + CaptureMixerElem "Mic" + CaptureMasterElem "ADC0" + JackDev "rt286-jack" +-- +2.24.1 + + +From dbf9201ef6cc0008e3d1d10d28490c47689aed0e Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 28 Jan 2020 18:16:54 +0100 +Subject: [PATCH 23/36] GoogleNyan: comment CaptureControl, what is this? + +Signed-off-by: Jaroslav Kysela +--- + ucm2/GoogleNyan/HiFi.conf | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ucm2/GoogleNyan/HiFi.conf b/ucm2/GoogleNyan/HiFi.conf +index 1f7e93c..0bcd8e8 100644 +--- a/ucm2/GoogleNyan/HiFi.conf ++++ b/ucm2/GoogleNyan/HiFi.conf +@@ -50,7 +50,7 @@ SectionDevice."Headphones" { + + SectionDevice."Mic" { + Value { +- CaptureControl "MIC2" ++ #CaptureControl "MIC2" + } + EnableSequence [ + cset "name='Int Mic Switch' off" +-- +2.24.1 + + +From eed10701463b605ba5b6587d897deff742cbb5a0 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 4 Feb 2020 17:48:10 +0100 +Subject: [PATCH 24/36] VEYRON-I2S: corrections and fixes + +Signed-off-by: Jaroslav Kysela +--- + ucm2/VEYRON-I2S/HiFi.conf | 24 ++++++++++++++++-------- + 1 file changed, 16 insertions(+), 8 deletions(-) + +diff --git a/ucm2/VEYRON-I2S/HiFi.conf b/ucm2/VEYRON-I2S/HiFi.conf +index 8d07c73..bed87c5 100644 +--- a/ucm2/VEYRON-I2S/HiFi.conf ++++ b/ucm2/VEYRON-I2S/HiFi.conf +@@ -45,25 +45,31 @@ SectionDevice."Speaker" { + Comment "Speaker" + + Value { +- PlaybackPCM "hw:${CardId},0" ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId}" + } ++ + EnableSequence [ + cset "name='Speaker Switch' on" + ] ++ + DisableSequence [ + cset "name='Speaker Switch' off" + ] + } + +-SectionDevice."Internal Mic" { +- Comment "Int Mic" ++SectionDevice."Mic" { ++ Comment "Internal Microphone" + + Value { +- CapturePCM "hw:${CardId},0" ++ CapturePriority 100 ++ CapturePCM "hw:${CardId}" + } ++ + EnableSequence [ + cset "name='Int Mic Switch' on" + ] ++ + DisableSequence [ + cset "name='Int Mic Switch' off" + ] +@@ -73,7 +79,8 @@ SectionDevice."Headphones" { + Comment "Headphones" + + Value { +- PlaybackPCM "hw:${CardId},0" ++ PlaybackPriority 200 ++ PlaybackPCM "hw:${CardId}" + } + + EnableSequence [ +@@ -88,11 +95,12 @@ SectionDevice."Headphones" { + ] + } + +-SectionDevice."Mic" { +- Comment "Headset Mic" ++SectionDevice."Headset" { ++ Comment "Headset Microphone" + + Value { +- CapturePCM "hw:${CardId},0" ++ CapturePriority 200 ++ CapturePCM "hw:${CardId}" + } + + EnableSequence [ +-- +2.24.1 + + +From c44072f1e12f29de45484d9de946b505c1f4789b Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 4 Feb 2020 17:52:37 +0100 +Subject: [PATCH 25/36] SDP4430: corrections and fixes + +Signed-off-by: Jaroslav Kysela +--- + ucm2/SDP4430/FMAnalog.conf | 1 + + ucm2/SDP4430/Record.conf | 1 + + ucm2/SDP4430/Voice.conf | 1 + + ucm2/SDP4430/VoiceCall.conf | 2 ++ + 4 files changed, 5 insertions(+) + +diff --git a/ucm2/SDP4430/FMAnalog.conf b/ucm2/SDP4430/FMAnalog.conf +index 2cfabf9..da21ab1 100644 +--- a/ucm2/SDP4430/FMAnalog.conf ++++ b/ucm2/SDP4430/FMAnalog.conf +@@ -33,6 +33,7 @@ SectionDevice."Headset" { + ] + + Value { ++ CapturePriority 100 + CapturePCM "hw:${CardId},0" + } + } +diff --git a/ucm2/SDP4430/Record.conf b/ucm2/SDP4430/Record.conf +index d3c4955..44e722b 100644 +--- a/ucm2/SDP4430/Record.conf ++++ b/ucm2/SDP4430/Record.conf +@@ -39,6 +39,7 @@ SectionDevice."Headset" { + ] + + Value { ++ CapturePriority 100 + CapturePCM "hw:${CardId},0" + } + } +diff --git a/ucm2/SDP4430/Voice.conf b/ucm2/SDP4430/Voice.conf +index 15cd4f0..2110332 100644 +--- a/ucm2/SDP4430/Voice.conf ++++ b/ucm2/SDP4430/Voice.conf +@@ -39,6 +39,7 @@ SectionDevice."Headset" { + ] + + Value { ++ PlaybackPriority 100 + PlaybackPCM "hw:${CardId},2" + } + } +diff --git a/ucm2/SDP4430/VoiceCall.conf b/ucm2/SDP4430/VoiceCall.conf +index 2f02a2b..d7d5c90 100644 +--- a/ucm2/SDP4430/VoiceCall.conf ++++ b/ucm2/SDP4430/VoiceCall.conf +@@ -58,7 +58,9 @@ SectionDevice."Headset" { + ] + + Value { ++ CapturePriority 100 + CapturePCM "hw:${CardId},2" ++ PlaybackPriority 100 + PlaybackPCM "hw:${CardId},2" + } + } +-- +2.24.1 + + +From 4b7f489f6d2fa1e89592fbd1a01f87b725bc7c9c Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 4 Feb 2020 18:44:49 +0100 +Subject: [PATCH 26/36] chtrt5645: corrections and fixes + +Signed-off-by: Jaroslav Kysela +--- + ucm2/chtrt5645/HiFi-dmic1.conf | 32 +++++++++---------- + ucm2/chtrt5645/HiFi-dmic2.conf | 30 ++++++++--------- + .../HiFi-mono-speaker-analog-mic.conf | 21 ++++++------ + ucm2/chtrt5645/HiFi.conf | 21 ++++++------ + ucm2/codecs/rt5645/AnalogMic.conf | 5 +-- + 5 files changed, 54 insertions(+), 55 deletions(-) + +diff --git a/ucm2/chtrt5645/HiFi-dmic1.conf b/ucm2/chtrt5645/HiFi-dmic1.conf +index 86164c9..4748bd9 100644 +--- a/ucm2/chtrt5645/HiFi-dmic1.conf ++++ b/ucm2/chtrt5645/HiFi-dmic1.conf +@@ -2,10 +2,6 @@ SectionVerb { + # ALSA PCM + Value { + TQ "HiFi" +- +- # ALSA PCM device for HiFi +- PlaybackPCM "hw:${CardId}" +- CapturePCM "hw:${CardId}" + } + + EnableSequence [ +@@ -29,7 +25,9 @@ SectionDevice."Speaker" { + Comment "Speaker" + + Value { +- PlaybackChannels "2" ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId}" ++ PlaybackChannels 2 + } + + ConflictingDevice [ +@@ -50,7 +48,9 @@ SectionDevice."Headphones" { + Comment "Headphones" + + Value { +- PlaybackChannels "2" ++ PlaybackPriority 200 ++ PlaybackPCM "hw:${CardId}" ++ PlaybackChannels 2 + JackControl "Headphone Jack" + JackHWMute "Speaker" + } +@@ -69,12 +69,13 @@ SectionDevice."Headphones" { + ] + } + +-SectionDevice."DMic" { ++SectionDevice."Mic" { + Comment "Internal Microphone" + + Value { +- CaptureChannels "2" +- CapturePriority "150" ++ CapturePriority 100 ++ CapturePCM "hw:${CardId}" ++ CaptureChannels 2 + } + + EnableSequence [ +@@ -91,13 +92,15 @@ SectionDevice."DMic" { + ] + } + +-SectionDevice."HSMic" { ++SectionDevice."Headset" { + Comment "Headset Microphone" + + Value { +- CaptureChannels "2" ++ CapturePriority 200 ++ CapturePCM "hw:${CardId}" ++ CaptureChannels 2 + JackControl "Headset Mic Jack" +- JackHWMute "DMic" ++ JackHWMute "Mic" + } + + EnableSequence [ +@@ -113,9 +116,6 @@ SectionDevice."HSMic" { + ] + + DisableSequence [ +- +- +- cset "name='Mono ADC MIXL ADC1 Switch' on" +- cset "name='Mono ADC MIXR ADC1 Switch' on" ++ + ] + } +diff --git a/ucm2/chtrt5645/HiFi-dmic2.conf b/ucm2/chtrt5645/HiFi-dmic2.conf +index 5c947ae..459b9f5 100644 +--- a/ucm2/chtrt5645/HiFi-dmic2.conf ++++ b/ucm2/chtrt5645/HiFi-dmic2.conf +@@ -2,10 +2,6 @@ SectionVerb { + # ALSA PCM + Value { + TQ "HiFi" +- +- # ALSA PCM device for HiFi +- PlaybackPCM "hw:${CardId}" +- CapturePCM "hw:${CardId}" + } + + EnableSequence [ +@@ -29,7 +25,9 @@ SectionDevice."Speaker" { + Comment "Speaker" + + Value { +- PlaybackChannels "2" ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId}" ++ PlaybackChannels 2 + } + + ConflictingDevice [ +@@ -50,7 +48,9 @@ SectionDevice."Headphones" { + Comment "Headphones" + + Value { +- PlaybackChannels "2" ++ PlaybackPriority 200 ++ PlaybackPCM "hw:${CardId}" ++ PlaybackChannels 2 + JackControl "Headphone Jack" + JackHWMute "Speaker" + } +@@ -69,12 +69,13 @@ SectionDevice."Headphones" { + ] + } + +-SectionDevice."DMic" { ++SectionDevice."Mic" { + Comment "Internal Microphone" + + Value { +- CaptureChannels "2" +- CapturePriority "150" ++ CapturePriority 100 ++ CapturePCM "hw:${CardId}" ++ CaptureChannels 2 + } + + EnableSequence [ +@@ -93,11 +94,13 @@ SectionDevice."DMic" { + ] + } + +-SectionDevice."HSMic" { ++SectionDevice."Headset" { + Comment "Headset Microphone" + + Value { +- CaptureChannels "2" ++ CapturePriority 200 ++ CapturePCM "hw:${CardId}" ++ CaptureChannels 2 + JackControl "Headset Mic Jack" + JackHWMute "DMic" + } +@@ -115,9 +118,6 @@ SectionDevice."HSMic" { + ] + + DisableSequence [ +- +- +- cset "name='Mono ADC MIXL ADC1 Switch' on" +- cset "name='Mono ADC MIXR ADC1 Switch' on" ++ + ] + } +diff --git a/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf b/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf +index a1bca67..fe410f3 100644 +--- a/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf ++++ b/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf +@@ -2,10 +2,6 @@ SectionVerb { + # ALSA PCM + Value { + TQ "HiFi" +- +- # ALSA PCM device for HiFi +- PlaybackPCM "hw:${CardId}" +- CapturePCM "hw:${CardId}" + } + + EnableSequence [ +@@ -29,7 +25,9 @@ SectionDevice."Speaker" { + Comment "Speaker" + + Value { +- PlaybackChannels "2" ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId}" ++ PlaybackChannels 2 + } + + ConflictingDevice [ +@@ -54,7 +52,9 @@ SectionDevice."Headphones" { + Comment "Headphones" + + Value { +- PlaybackChannels "2" ++ PlaybackPriority 200 ++ PlaybackPCM "hw:${CardId}" ++ PlaybackChannels 2 + JackControl "Headphone Jack" + JackHWMute "Speaker" + } +@@ -79,11 +79,13 @@ SectionDevice."Headphones" { + + + +-SectionDevice."HSMic" { ++SectionDevice."Headset" { + Comment "Headset Microphone" + + Value { +- CaptureChannels "2" ++ CapturePriority 200 ++ CapturePCM "hw:${CardId}" ++ CaptureChannels 2 + JackControl "Headset Mic Jack" + JackHWMute "Mic" + } +@@ -102,8 +104,5 @@ SectionDevice."HSMic" { + + DisableSequence [ + +- +- cset "name='Mono ADC MIXL ADC1 Switch' on" +- cset "name='Mono ADC MIXR ADC1 Switch' on" + ] + } +diff --git a/ucm2/chtrt5645/HiFi.conf b/ucm2/chtrt5645/HiFi.conf +index 7b2a663..954bf68 100644 +--- a/ucm2/chtrt5645/HiFi.conf ++++ b/ucm2/chtrt5645/HiFi.conf +@@ -2,10 +2,6 @@ SectionVerb { + # ALSA PCM + Value { + TQ "HiFi" +- +- # ALSA PCM device for HiFi +- PlaybackPCM "hw:${CardId}" +- CapturePCM "hw:${CardId}" + } + + EnableSequence [ +@@ -29,7 +25,9 @@ SectionDevice."Speaker" { + Comment "Speaker" + + Value { +- PlaybackChannels "2" ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId}" ++ PlaybackChannels 2 + } + + ConflictingDevice [ +@@ -50,7 +48,9 @@ SectionDevice."Headphones" { + Comment "Headphones" + + Value { +- PlaybackChannels "2" ++ PlaybackPriority 200 ++ PlaybackPCM "hw:${CardId}" ++ PlaybackChannels 2 + JackControl "Headphone Jack" + JackHWMute "Speaker" + } +@@ -71,11 +71,13 @@ SectionDevice."Headphones" { + + + +-SectionDevice."HSMic" { ++SectionDevice."Headset" { + Comment "Headset Microphone" + + Value { +- CaptureChannels "2" ++ CapturePriority 200 ++ CapturePCM "hw:${CardId}" ++ CaptureChannels 2 + JackControl "Headset Mic Jack" + JackHWMute "Mic" + } +@@ -94,8 +96,5 @@ SectionDevice."HSMic" { + + DisableSequence [ + +- +- cset "name='Mono ADC MIXL ADC1 Switch' on" +- cset "name='Mono ADC MIXR ADC1 Switch' on" + ] + } +diff --git a/ucm2/codecs/rt5645/AnalogMic.conf b/ucm2/codecs/rt5645/AnalogMic.conf +index d52fe61..5583cdb 100644 +--- a/ucm2/codecs/rt5645/AnalogMic.conf ++++ b/ucm2/codecs/rt5645/AnalogMic.conf +@@ -2,8 +2,9 @@ SectionDevice."Mic" { + Comment "Internal Analog Microphone" + + Value { +- CaptureChannels "2" +- CapturePriority "150" ++ CapturePriority 100 ++ CapturePCM "hw:${CardId}" ++ CaptureChannels 2 + } + + EnableSequence [ +-- +2.24.1 + + +From 3a92d95926e9289daf7b82335866b1561ccefc0d Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 4 Feb 2020 18:48:05 +0100 +Subject: [PATCH 27/36] GoogleNyan: corrections and fixes + +Signed-off-by: Jaroslav Kysela +--- + ucm2/GoogleNyan/HiFi.conf | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/ucm2/GoogleNyan/HiFi.conf b/ucm2/GoogleNyan/HiFi.conf +index 0bcd8e8..5428591 100644 +--- a/ucm2/GoogleNyan/HiFi.conf ++++ b/ucm2/GoogleNyan/HiFi.conf +@@ -38,6 +38,10 @@ SectionVerb { + } + + SectionDevice."Headphones" { ++ Value { ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId}" ++ } + EnableSequence [ + cset "name='Speakers Switch' off" + cset "name='Headphones Switch' on" +@@ -50,6 +54,8 @@ SectionDevice."Headphones" { + + SectionDevice."Mic" { + Value { ++ CapturePriority 100 ++ CapturePCM "hw:${CardId}" + #CaptureControl "MIC2" + } + EnableSequence [ +-- +2.24.1 + + +From c546a3466d0d801b3d5a8fb6c2cd840a068e72f2 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 4 Feb 2020 18:52:18 +0100 +Subject: [PATCH 28/36] PAZ00: corrections and fixes + +Signed-off-by: Jaroslav Kysela +--- + ucm2/PAZ00/HiFi.conf | 4 ++++ + ucm2/PAZ00/Record.conf | 4 ++++ + 2 files changed, 8 insertions(+) + +diff --git a/ucm2/PAZ00/HiFi.conf b/ucm2/PAZ00/HiFi.conf +index 6e30cbe..7f5de05 100644 +--- a/ucm2/PAZ00/HiFi.conf ++++ b/ucm2/PAZ00/HiFi.conf +@@ -32,4 +32,8 @@ SectionDevice."Headset" { + # Internal speaker + cset "name='Int Spk Switch' on" + ] ++ Value { ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId}" ++ } + } +diff --git a/ucm2/PAZ00/Record.conf b/ucm2/PAZ00/Record.conf +index 3cb57b2..20dbac4 100644 +--- a/ucm2/PAZ00/Record.conf ++++ b/ucm2/PAZ00/Record.conf +@@ -52,4 +52,8 @@ SectionDevice."Headset" { + # Internal mic + cset "name='DMIC En Capture Switch' on" + ] ++ Value { ++ CapturePriority 100 ++ CapturePCM "hw:${CardId}" ++ } + } +-- +2.24.1 + + +From 3b6bfaa6b5c08b78ee0cbb9b1b1137fc20f92a63 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 4 Feb 2020 18:58:27 +0100 +Subject: [PATCH 29/36] SDP4430: corrections and fixes + +Signed-off-by: Jaroslav Kysela +--- + ucm2/SDP4430/FMAnalog.conf | 2 +- + ucm2/SDP4430/HiFi.conf | 5 +++++ + ucm2/SDP4430/Record.conf | 2 +- + 3 files changed, 7 insertions(+), 2 deletions(-) + +diff --git a/ucm2/SDP4430/FMAnalog.conf b/ucm2/SDP4430/FMAnalog.conf +index da21ab1..e2132d2 100644 +--- a/ucm2/SDP4430/FMAnalog.conf ++++ b/ucm2/SDP4430/FMAnalog.conf +@@ -34,7 +34,7 @@ SectionDevice."Headset" { + + Value { + CapturePriority 100 +- CapturePCM "hw:${CardId},0" ++ CapturePCM "hw:${CardId}" + } + } + +diff --git a/ucm2/SDP4430/HiFi.conf b/ucm2/SDP4430/HiFi.conf +index af5b8fb..8e44a95 100644 +--- a/ucm2/SDP4430/HiFi.conf ++++ b/ucm2/SDP4430/HiFi.conf +@@ -49,4 +49,9 @@ SectionDevice."Headset" { + cset "name='HS Left Playback' 0" + cset "name='Headset Playback Volume' 0" + ] ++ ++ Value { ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId}" ++ } + } +diff --git a/ucm2/SDP4430/Record.conf b/ucm2/SDP4430/Record.conf +index 44e722b..49837e2 100644 +--- a/ucm2/SDP4430/Record.conf ++++ b/ucm2/SDP4430/Record.conf +@@ -40,6 +40,6 @@ SectionDevice."Headset" { + + Value { + CapturePriority 100 +- CapturePCM "hw:${CardId},0" ++ CapturePCM "hw:${CardId}" + } + } +-- +2.24.1 + + +From 1e7ea2a0d7afe51447e7efb71f8f03c39b6fcb64 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 4 Feb 2020 19:11:10 +0100 +Subject: [PATCH 30/36] PandaBoard: corrections and fixes + +Signed-off-by: Jaroslav Kysela +--- + ucm2/PandaBoard/FMAnalog.conf | 9 ++++++--- + ucm2/PandaBoard/HiFi.conf | 18 +++++++++++------- + ucm2/PandaBoard/HiFiLP.conf | 8 ++++++-- + ucm2/PandaBoard/Record.conf | 8 ++++++-- + ucm2/PandaBoard/Voice.conf | 8 ++++++-- + ucm2/PandaBoard/VoiceCall.conf | 12 ++++++++---- + 6 files changed, 43 insertions(+), 20 deletions(-) + +diff --git a/ucm2/PandaBoard/FMAnalog.conf b/ucm2/PandaBoard/FMAnalog.conf +index 11a2288..29cbbe8 100644 +--- a/ucm2/PandaBoard/FMAnalog.conf ++++ b/ucm2/PandaBoard/FMAnalog.conf +@@ -17,10 +17,9 @@ SectionVerb { + cset "name='Capture Volume' 0" + ] + +- # Optional TQ and ALSA PCMs ++ # Optional TQ + Value { + TQ "Music" +- CapturePCM "hw:${CardId},0" + } + } + +@@ -38,5 +37,9 @@ SectionDevice."Headset" { + cset "name='Analog Right Capture Route' 3" + cset "name='Capture Preamplifier Volume' 0" + ] +-} + ++ Value { ++ CapturePriority 100 ++ CapturePCM "hw:${CardId}" ++ } ++} +diff --git a/ucm2/PandaBoard/HiFi.conf b/ucm2/PandaBoard/HiFi.conf +index 1b16125..5de0c8f 100644 +--- a/ucm2/PandaBoard/HiFi.conf ++++ b/ucm2/PandaBoard/HiFi.conf +@@ -26,13 +26,10 @@ SectionVerb { + cset "name='Headset Playback Volume' 0" + ] + +- # Optional TQ and ALSA PCMs +-# Value { +-# TQ "Music" +-# PlaybackPCM "hw:${CardId},0" +-# PlaybackVolume "name='DL1 Media Playback Volume' 90,90" +-# PlaybackSwitch "name='DL1 PDM Switch' 1" +-# } ++ # Optional TQ ++ Value { ++ TQ "Music" ++ } + } + + SectionDevice."Headset" { +@@ -49,4 +46,11 @@ SectionDevice."Headset" { + cset "name='Headset Left Playback' 0" + cset "name='Headset Playback Volume' 0" + ] ++ ++ Value { ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId}" ++ # PlaybackVolume "name='DL1 Media Playback Volume' 90,90" ++ # PlaybackSwitch "name='DL1 PDM Switch' 1" ++ } + } +diff --git a/ucm2/PandaBoard/HiFiLP.conf b/ucm2/PandaBoard/HiFiLP.conf +index 92de382..c735248 100644 +--- a/ucm2/PandaBoard/HiFiLP.conf ++++ b/ucm2/PandaBoard/HiFiLP.conf +@@ -18,10 +18,9 @@ SectionVerb { + cset "name='SDT DL Volume' 0" + ] + +- # Optional TQ and ALSA PCMs ++ # Optional TQ + Value { + TQ "Music" +- PlaybackPCM "hw:${CardId},6" + } + } + +@@ -39,4 +38,9 @@ SectionDevice."Headset" { + cset "name='Headset Left Playback' 0" + cset "name='Headset Playback Volume' 0" + ] ++ ++ Value { ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId},6" ++ } + } +diff --git a/ucm2/PandaBoard/Record.conf b/ucm2/PandaBoard/Record.conf +index 1fbe74c..e88d6c3 100644 +--- a/ucm2/PandaBoard/Record.conf ++++ b/ucm2/PandaBoard/Record.conf +@@ -18,10 +18,9 @@ SectionVerb { + cset "name='Capture Volume' 0" + ] + +- # Optional TQ and ALSA PCMs ++ # Optional TQ + Value { + TQ "Music" +- CapturePCM "hw:${CardId},0" + } + + } +@@ -40,4 +39,9 @@ SectionDevice."Headset" { + cset "name='Analog Right Capture Route' 3" + cset "name='Capture Preamplifier Volume' 0" + ] ++ ++ Value { ++ CapturePriority 100 ++ CapturePCM "hw:${CardId}" ++ } + } +diff --git a/ucm2/PandaBoard/Voice.conf b/ucm2/PandaBoard/Voice.conf +index 42af48a..6843cc8 100644 +--- a/ucm2/PandaBoard/Voice.conf ++++ b/ucm2/PandaBoard/Voice.conf +@@ -18,10 +18,9 @@ SectionVerb { + cset "name='SDT DL Volume' 0" + ] + +- # Optional TQ and ALSA PCMs ++ # Optional TQ + Value { + TQ "Voice" +- PlaybackPCM "hw:${CardId},2" + } + } + +@@ -39,4 +38,9 @@ SectionDevice."Headset" { + cset "name='Headset Left Playback' 0" + cset "name='Headset Playback Volume' 0" + ] ++ ++ Value { ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId},2" ++ } + } +diff --git a/ucm2/PandaBoard/VoiceCall.conf b/ucm2/PandaBoard/VoiceCall.conf +index c20bf5c..9a8099e 100644 +--- a/ucm2/PandaBoard/VoiceCall.conf ++++ b/ucm2/PandaBoard/VoiceCall.conf +@@ -31,11 +31,9 @@ SectionVerb { + cset "name='SDT DL Volume' 0" + ] + +- # Optional TQ and ALSA PCMs ++ # Optional TQ + Value { + TQ "Voice" +- CapturePCM "hw:${CardId},2" +- PlaybackPCM "hw:${CardId},2" + } + } + +@@ -59,5 +57,11 @@ SectionDevice."Headset" { + cset "name='Headset Left Playback' 0" + cset "name='Headset Playback Volume' 0" + ] +-} + ++ Value { ++ CapturePriority 100 ++ CapturePCM "hw:${CardId},2" ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId},2" ++ } ++} +-- +2.24.1 + + +From 95f4da477fdb6a06ed321e6f2c0f7fc7d170b2e0 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 4 Feb 2020 19:21:47 +0100 +Subject: [PATCH 31/36] PandaBoardES: corrections and fixes + +Signed-off-by: Jaroslav Kysela +--- + ucm2/PandaBoardES/FMAnalog.conf | 9 ++++++--- + ucm2/PandaBoardES/HiFi.conf | 18 +++++++++++------- + ucm2/PandaBoardES/HiFiLP.conf | 8 ++++++-- + ucm2/PandaBoardES/Record.conf | 8 ++++++-- + ucm2/PandaBoardES/Voice.conf | 8 ++++++-- + ucm2/PandaBoardES/VoiceCall.conf | 10 +++++++--- + 6 files changed, 42 insertions(+), 19 deletions(-) + +diff --git a/ucm2/PandaBoardES/FMAnalog.conf b/ucm2/PandaBoardES/FMAnalog.conf +index a4d5a23..9920bcc 100644 +--- a/ucm2/PandaBoardES/FMAnalog.conf ++++ b/ucm2/PandaBoardES/FMAnalog.conf +@@ -17,10 +17,9 @@ SectionVerb { + cset "name='Capture Volume' 0" + ] + +- # Optional TQ and ALSA PCMs ++ # Optional TQ + Value { + TQ "Music" +- CapturePCM "hw:${CardId},0" + } + } + +@@ -38,5 +37,9 @@ SectionDevice."Headset" { + cset "name='Analog Right Capture Route' 3" + cset "name='Capture Preamplifier Volume' 0" + ] +-} + ++ Value { ++ CapturePriority 100 ++ CapturePCM "hw:${CardId}" ++ } ++} +diff --git a/ucm2/PandaBoardES/HiFi.conf b/ucm2/PandaBoardES/HiFi.conf +index 856dd9f..aa78e47 100644 +--- a/ucm2/PandaBoardES/HiFi.conf ++++ b/ucm2/PandaBoardES/HiFi.conf +@@ -26,13 +26,10 @@ SectionVerb { + cset "name='Headset Playback Volume' 0" + ] + +- # Optional TQ and ALSA PCMs +-# Value { +-# TQ "Music" +-# PlaybackPCM "hw:${CardId},0" +-# PlaybackVolume "name='DL1 Media Playback Volume' 90,90" +-# PlaybackSwitch "name='DL1 PDM Switch' 1" +-# } ++ # Optional TQ ++ Value { ++ TQ "Music" ++ } + } + + SectionDevice."Headset" { +@@ -49,4 +46,11 @@ SectionDevice."Headset" { + cset "name='Headset Left Playback' 0" + cset "name='Headset Playback Volume' 0" + ] ++ ++ Value { ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId}" ++ # PlaybackVolume "name='DL1 Media Playback Volume' 90,90" ++ # PlaybackSwitch "name='DL1 PDM Switch' 1" ++ } + } +diff --git a/ucm2/PandaBoardES/HiFiLP.conf b/ucm2/PandaBoardES/HiFiLP.conf +index a6a258d..23164ed 100644 +--- a/ucm2/PandaBoardES/HiFiLP.conf ++++ b/ucm2/PandaBoardES/HiFiLP.conf +@@ -18,10 +18,9 @@ SectionVerb { + cset "name='SDT DL Volume' 0" + ] + +- # Optional TQ and ALSA PCMs ++ # Optional TQ + Value { + TQ "Music" +- PlaybackPCM "hw:${CardId},6" + } + } + +@@ -39,4 +38,9 @@ SectionDevice."Headset" { + cset "name='Headset Left Playback' 0" + cset "name='Headset Playback Volume' 0" + ] ++ ++ Value { ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId},6" ++ } + } +diff --git a/ucm2/PandaBoardES/Record.conf b/ucm2/PandaBoardES/Record.conf +index 57ad612..8cc6fdf 100644 +--- a/ucm2/PandaBoardES/Record.conf ++++ b/ucm2/PandaBoardES/Record.conf +@@ -17,10 +17,9 @@ SectionVerb { + cset "name='Capture Volume' 0" + ] + +- # Optional TQ and ALSA PCMs ++ # Optional TQ + Value { + TQ "Music" +- CapturePCM "hw:${CardId},0" + } + + } +@@ -39,4 +38,9 @@ SectionDevice."Headset" { + cset "name='Analog Right Capture Route' 3" + cset "name='Capture Preamplifier Volume' 0" + ] ++ ++ Value { ++ CapturePriority 100 ++ CapturePCM "hw:${CardId}" ++ } + } +diff --git a/ucm2/PandaBoardES/Voice.conf b/ucm2/PandaBoardES/Voice.conf +index a198c23..e37e7ec 100644 +--- a/ucm2/PandaBoardES/Voice.conf ++++ b/ucm2/PandaBoardES/Voice.conf +@@ -18,10 +18,9 @@ SectionVerb { + cset "name='SDT DL Volume' 0" + ] + +- # Optional TQ and ALSA PCMs ++ # Optional TQ + Value { + TQ "Voice" +- PlaybackPCM "hw:${CardId},2" + } + } + +@@ -39,4 +38,9 @@ SectionDevice."Headset" { + cset "name='Headset Left Playback' 0" + cset "name='Headset Playback Volume' 0" + ] ++ ++ Value { ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId},2" ++ } + } +diff --git a/ucm2/PandaBoardES/VoiceCall.conf b/ucm2/PandaBoardES/VoiceCall.conf +index 4aed020..3e6e092 100644 +--- a/ucm2/PandaBoardES/VoiceCall.conf ++++ b/ucm2/PandaBoardES/VoiceCall.conf +@@ -34,8 +34,6 @@ SectionVerb { + # Optional TQ and ALSA PCMs + Value { + TQ "Voice" +- CapturePCM "hw:${CardId},2" +- PlaybackPCM "hw:${CardId},2" + } + } + +@@ -59,5 +57,11 @@ SectionDevice."Headset" { + cset "name='Headset Left Playback' 0" + cset "name='Headset Playback Volume' 0" + ] +-} + ++ Value { ++ CapturePriority 100 ++ CapturePCM "hw:${CardId},2" ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId},2" ++ } ++} +-- +2.24.1 + + +From d2f2b3649b2ea4caa2fc93cdabe9ed813efbae68 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 5 Feb 2020 02:54:11 +0100 +Subject: [PATCH 32/36] kblrt5660: corrections and fixes + +Signed-off-by: Jaroslav Kysela +--- + ucm2/kblrt5660/Hdmi1.conf | 28 +++++++++++++++++++--------- + ucm2/kblrt5660/Hdmi2.conf | 30 ++++++++++++++++++++---------- + ucm2/kblrt5660/HiFi.conf | 26 ++++++++++---------------- + 3 files changed, 49 insertions(+), 35 deletions(-) + +diff --git a/ucm2/kblrt5660/Hdmi1.conf b/ucm2/kblrt5660/Hdmi1.conf +index b6adbaa..ccf5118 100755 +--- a/ucm2/kblrt5660/Hdmi1.conf ++++ b/ucm2/kblrt5660/Hdmi1.conf +@@ -1,14 +1,24 @@ + # Usecase for device HDMI1/Display Port stereo playback on Intel KABYLAKE platforms + # For Audio in I2S mode + +-SectionDevice."Hdmi1" { +- Comment "HDMI/Display Port 1 Stereo" ++SectionDevice."HDMI1" { ++ Comment "HDMI/Display Port 1 Stereo" + +- Value { +- PlaybackPCM "hw:${CardId},2" +- PlaybackChannels "2" +- PlaybackPriority "2" +- JackControl "HDMI/DP, pcm=4 Jack" +- } ++ Value { ++ PlaybackPriority 200 ++ PlaybackPCM "hw:${CardId},2" ++ PlaybackChannels 2 ++ If.1 { ++ Condition { ++ Type ControlExists ++ Control "iface=CARD,name='HDMI/DP,pcm=4 Jack'" ++ } ++ True { ++ JackControl "HDMI/DP,pcm=4 Jack" ++ } ++ False { ++ JackControl "HDMI/DP, pcm=4 Jack" ++ } ++ } ++ } + } +- +diff --git a/ucm2/kblrt5660/Hdmi2.conf b/ucm2/kblrt5660/Hdmi2.conf +index 19e9bd0..c5e4001 100755 +--- a/ucm2/kblrt5660/Hdmi2.conf ++++ b/ucm2/kblrt5660/Hdmi2.conf +@@ -1,14 +1,24 @@ +-# Usecase for device HDMI2/Display Port stereo playback on Intel KABYLAKE platforms ++# Usecase for device HDMI1/Display Port stereo playback on Intel KABYLAKE platforms + # For Audio in I2S mode + +-SectionDevice."Hdmi2" { +- Comment "HDMI/Display Port 2 Stereo" ++SectionDevice."HDMI2" { ++ Comment "HDMI/Display Port 2 Stereo" + +- Value { +- PlaybackPCM "hw:${CardId},3" +- PlaybackChannels "2" +- PlaybackPriority "3" +- JackControl "HDMI/DP, pcm=5 Jack" +- } ++ Value { ++ PlaybackPriority 300 ++ PlaybackPCM "hw:${CardId},3" ++ PlaybackChannels 2 ++ If.1 { ++ Condition { ++ Type ControlExists ++ Control "iface=CARD,name='HDMI/DP,pcm=5 Jack'" ++ } ++ True { ++ JackControl "HDMI/DP,pcm=5 Jack" ++ } ++ False { ++ JackControl "HDMI/DP, pcm=5 Jack" ++ } ++ } ++ } + } +- +diff --git a/ucm2/kblrt5660/HiFi.conf b/ucm2/kblrt5660/HiFi.conf +index af0d805..0f5d46d 100755 +--- a/ucm2/kblrt5660/HiFi.conf ++++ b/ucm2/kblrt5660/HiFi.conf +@@ -1,18 +1,8 @@ + # UCM for Intel Kabylake platforms with RT5660 + # For Audio in I2S mode + +-SectionVerb { +- +- # ALSA PCM +- Value { +- # ALSA PCM device for HiFi +- PlaybackPCM "hw:${CardId},0" +- CapturePCM "hw:${CardId},1" +- } +-} +- +-SectionDevice."LineOut" { +- Comment "LineOut playback" ++SectionDevice."Line1" { ++ Comment "Line playback" + + EnableSequence [ + cset "name='DAC1 Playback Volume' 30" +@@ -36,14 +26,16 @@ SectionDevice."LineOut" { + ] + + Value { +- PlaybackChannels "2" ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId}" ++ PlaybackChannels 2 + JackDev "rt5660-jack" + JackControl "Line Out Jack" + } + } + +-SectionDevice."LineIn" { +- Comment "LineIn capture" ++SectionDevice."Line2" { ++ Comment "Line capture" + + EnableSequence [ + cset "name='ADC Capture Volume' 30" +@@ -67,7 +59,9 @@ SectionDevice."LineIn" { + ] + + Value { +- CaptureChannels "2" ++ CapturePriority 100 ++ CapturePCM "hw:${CardId},1" ++ CaptureChannels 2 + JackDev "rt5660-jack" + JackControl "Line In Jack" + } +-- +2.24.1 + + +From 1e2eddb7e38474f239f9c8f9387c7a04a1bff7e3 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 5 Feb 2020 03:13:06 +0100 +Subject: [PATCH 33/36] bytcr-rt5640: corrections and fixes + +Signed-off-by: Jaroslav Kysela +--- + ucm2/bytcr-rt5640/HiFi.conf | 5 ----- + ucm2/codecs/rt5640/DigitalMics.conf | 2 +- + ucm2/codecs/rt5640/HeadPhones.conf | 3 +-- + ucm2/codecs/rt5640/HeadsetMic.conf | 2 +- + ucm2/codecs/rt5640/IN1-InternalMic.conf | 4 ++-- + ucm2/codecs/rt5640/IN3-InternalMic.conf | 2 +- + ucm2/codecs/rt5640/MonoSpeaker.conf | 3 +-- + ucm2/codecs/rt5640/Speaker.conf | 3 +-- + 8 files changed, 8 insertions(+), 16 deletions(-) + +diff --git a/ucm2/bytcr-rt5640/HiFi.conf b/ucm2/bytcr-rt5640/HiFi.conf +index a616106..e71eb22 100644 +--- a/ucm2/bytcr-rt5640/HiFi.conf ++++ b/ucm2/bytcr-rt5640/HiFi.conf +@@ -10,11 +10,6 @@ SectionVerb { + DisableSequence [ + + ] +- +- Value { +- PlaybackPCM "hw:${CardId}" +- CapturePCM "hw:${CardId}" +- } + } + + If.0 { +diff --git a/ucm2/codecs/rt5640/DigitalMics.conf b/ucm2/codecs/rt5640/DigitalMics.conf +index 17cae19..9cd8a8c 100644 +--- a/ucm2/codecs/rt5640/DigitalMics.conf ++++ b/ucm2/codecs/rt5640/DigitalMics.conf +@@ -21,7 +21,7 @@ SectionDevice."Mic" { + + Value { + CapturePriority 100 +- CapturePCM "hw:${CardId},0" ++ CapturePCM "hw:${CardId}" + CaptureChannels 2 + } + } +diff --git a/ucm2/codecs/rt5640/HeadPhones.conf b/ucm2/codecs/rt5640/HeadPhones.conf +index dccc943..7859b7a 100644 +--- a/ucm2/codecs/rt5640/HeadPhones.conf ++++ b/ucm2/codecs/rt5640/HeadPhones.conf +@@ -3,7 +3,6 @@ SectionDevice."Headphones" { + + ConflictingDevice [ + "Speaker" +- "MonoSpeaker" + ] + + EnableSequence [ +@@ -33,7 +32,7 @@ SectionDevice."Headphones" { + + Value { + PlaybackPriority 300 +- PlaybackPCM "hw:${CardId},0" ++ PlaybackPCM "hw:${CardId}" + PlaybackChannels 2 + JackControl "Headphone Jack" + } +diff --git a/ucm2/codecs/rt5640/HeadsetMic.conf b/ucm2/codecs/rt5640/HeadsetMic.conf +index f6d9423..40e0abe 100644 +--- a/ucm2/codecs/rt5640/HeadsetMic.conf ++++ b/ucm2/codecs/rt5640/HeadsetMic.conf +@@ -37,7 +37,7 @@ SectionDevice."Headset" { + + Value { + CapturePriority 200 +- CapturePCM "hw:${CardId},0" ++ CapturePCM "hw:${CardId}" + CaptureChannels 2 + JackControl "Headset Mic Jack" + } +diff --git a/ucm2/codecs/rt5640/IN1-InternalMic.conf b/ucm2/codecs/rt5640/IN1-InternalMic.conf +index 435cce8..7d76c4f 100644 +--- a/ucm2/codecs/rt5640/IN1-InternalMic.conf ++++ b/ucm2/codecs/rt5640/IN1-InternalMic.conf +@@ -2,7 +2,7 @@ SectionDevice."Mic" { + Comment "Internal Microphone on IN1" + + ConflictingDevice [ +- "HeadsetMic" ++ "Headset" + ] + + EnableSequence [ +@@ -40,7 +40,7 @@ SectionDevice."Mic" { + + Value { + CapturePriority 100 +- CapturePCM "hw:${CardId},0" ++ CapturePCM "hw:${CardId}" + CaptureChannels 2 + } + } +diff --git a/ucm2/codecs/rt5640/IN3-InternalMic.conf b/ucm2/codecs/rt5640/IN3-InternalMic.conf +index 4d4060e..2df2938 100644 +--- a/ucm2/codecs/rt5640/IN3-InternalMic.conf ++++ b/ucm2/codecs/rt5640/IN3-InternalMic.conf +@@ -40,7 +40,7 @@ SectionDevice."Mic" { + + Value { + CapturePriority 100 +- CapturePCM "hw:${CardId},0" ++ CapturePCM "hw:${CardId}" + CaptureChannels 2 + } + } +diff --git a/ucm2/codecs/rt5640/MonoSpeaker.conf b/ucm2/codecs/rt5640/MonoSpeaker.conf +index 6ca51e2..70ab809 100644 +--- a/ucm2/codecs/rt5640/MonoSpeaker.conf ++++ b/ucm2/codecs/rt5640/MonoSpeaker.conf +@@ -3,7 +3,6 @@ SectionDevice."Speaker" { + + ConflictingDevice [ + "Headphones" +- "Speaker" + ] + + EnableSequence [ +@@ -38,7 +37,7 @@ SectionDevice."Speaker" { + + Value { + PlaybackPriority 100 +- PlaybackPCM "hw:${CardId},0" ++ PlaybackPCM "hw:${CardId}" + PlaybackChannels 2 + } + } +diff --git a/ucm2/codecs/rt5640/Speaker.conf b/ucm2/codecs/rt5640/Speaker.conf +index 09b99cf..3b4b296 100644 +--- a/ucm2/codecs/rt5640/Speaker.conf ++++ b/ucm2/codecs/rt5640/Speaker.conf +@@ -3,7 +3,6 @@ SectionDevice."Speaker" { + + ConflictingDevice [ + "Headphones" +- "MonoSpeaker" + ] + + EnableSequence [ +@@ -37,8 +36,8 @@ SectionDevice."Speaker" { + ] + + Value { +- PlaybackPCM "hw:${CardId},0" + PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId}" + PlaybackChannels 2 + } + } +-- +2.24.1 + + +From 6a1044da7b104251502421c56c9be42407bd9281 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 5 Feb 2020 03:19:33 +0100 +Subject: [PATCH 34/36] bytcht-es8316: corrections and fixes + +Signed-off-by: Jaroslav Kysela +--- + ucm2/bytcht-es8316/HiFi.conf | 5 ----- + ucm2/codecs/es8316/HeadPhones.conf | 2 +- + ucm2/codecs/es8316/IN1-HeadsetMic.conf | 2 +- + ucm2/codecs/es8316/IN2-HeadsetMic.conf | 2 +- + ucm2/codecs/es8316/IN2-InternalMic.conf | 6 ++---- + ucm2/codecs/es8316/MonoSpeaker.conf | 2 +- + ucm2/codecs/es8316/Speaker.conf | 3 +-- + 7 files changed, 7 insertions(+), 15 deletions(-) + +diff --git a/ucm2/bytcht-es8316/HiFi.conf b/ucm2/bytcht-es8316/HiFi.conf +index 768f010..af053d0 100644 +--- a/ucm2/bytcht-es8316/HiFi.conf ++++ b/ucm2/bytcht-es8316/HiFi.conf +@@ -7,11 +7,6 @@ SectionVerb { + DisableSequence [ + + ] +- +- Value { +- PlaybackPCM "hw:${CardId}" +- CapturePCM "hw:${CardId}" +- } + } + + If.0 { +diff --git a/ucm2/codecs/es8316/HeadPhones.conf b/ucm2/codecs/es8316/HeadPhones.conf +index 603b40c..6a05e54 100644 +--- a/ucm2/codecs/es8316/HeadPhones.conf ++++ b/ucm2/codecs/es8316/HeadPhones.conf +@@ -15,7 +15,7 @@ SectionDevice."Headphones" { + + Value { + PlaybackPriority 200 +- PlaybackPCM "hw:${CardId},0" ++ PlaybackPCM "hw:${CardId}" + PlaybackChannels 2 + JackControl "Headphone Jack" + JackHWMute "Speaker" +diff --git a/ucm2/codecs/es8316/IN1-HeadsetMic.conf b/ucm2/codecs/es8316/IN1-HeadsetMic.conf +index d798270..e9f9061 100644 +--- a/ucm2/codecs/es8316/IN1-HeadsetMic.conf ++++ b/ucm2/codecs/es8316/IN1-HeadsetMic.conf +@@ -16,7 +16,7 @@ SectionDevice."Headset" { + + Value { + CapturePriority 200 +- CapturePCM "hw:${CardId},0" ++ CapturePCM "hw:${CardId}" + CaptureChannels 2 + JackControl "Headset Mic Jack" + } +diff --git a/ucm2/codecs/es8316/IN2-HeadsetMic.conf b/ucm2/codecs/es8316/IN2-HeadsetMic.conf +index 28f26f8..377d84d 100644 +--- a/ucm2/codecs/es8316/IN2-HeadsetMic.conf ++++ b/ucm2/codecs/es8316/IN2-HeadsetMic.conf +@@ -16,7 +16,7 @@ SectionDevice."Headset" { + + Value { + CapturePriority 200 +- CapturePCM "hw:${CardId},0" ++ CapturePCM "hw:${CardId}" + CaptureChannels 2 + JackControl "Headset Mic Jack" + } +diff --git a/ucm2/codecs/es8316/IN2-InternalMic.conf b/ucm2/codecs/es8316/IN2-InternalMic.conf +index 8c0418f..f0ff6f1 100644 +--- a/ucm2/codecs/es8316/IN2-InternalMic.conf ++++ b/ucm2/codecs/es8316/IN2-InternalMic.conf +@@ -2,9 +2,7 @@ SectionDevice."Mic" { + Comment "Internal Microphone on IN2" + + ConflictingDevice [ +- "InternalMic-IN1" +- "HeadsetMic-IN1" +- "HeadsetMic-IN2" ++ "Headset" + ] + + EnableSequence [ +@@ -18,7 +16,7 @@ SectionDevice."Mic" { + + Value { + CapturePriority 100 +- CapturePCM "hw:${CardId},0" ++ CapturePCM "hw:${CardId}" + CaptureChannels 2 + } + } +diff --git a/ucm2/codecs/es8316/MonoSpeaker.conf b/ucm2/codecs/es8316/MonoSpeaker.conf +index f11f2b7..64a7e76 100644 +--- a/ucm2/codecs/es8316/MonoSpeaker.conf ++++ b/ucm2/codecs/es8316/MonoSpeaker.conf +@@ -32,7 +32,7 @@ SectionDevice."Speaker" { + + Value { + PlaybackPriority 100 +- PlaybackPCM "hw:${CardId},0" ++ PlaybackPCM "hw:${CardId}" + PlaybackChannels 2 + } + } +diff --git a/ucm2/codecs/es8316/Speaker.conf b/ucm2/codecs/es8316/Speaker.conf +index a1e4491..58fe078 100644 +--- a/ucm2/codecs/es8316/Speaker.conf ++++ b/ucm2/codecs/es8316/Speaker.conf +@@ -2,7 +2,6 @@ SectionDevice."Speaker" { + Comment "Speakers" + + ConflictingDevice [ +- "MonoSpeaker" + "Headphones" + ] + +@@ -16,7 +15,7 @@ SectionDevice."Speaker" { + + Value { + PlaybackPriority 100 +- PlaybackPCM "hw:${CardId},0" ++ PlaybackPCM "hw:${CardId}" + PlaybackChannels 2 + } + } +-- +2.24.1 + + +From acf80f98692ab6f409e77cddb1bb55b387da4b17 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 5 Feb 2020 03:24:00 +0100 +Subject: [PATCH 35/36] sof-hda-dsp: corrections and fixes + +Signed-off-by: Jaroslav Kysela +--- + ucm2/sof-hda-dsp/HDA-Capture-value.conf | 4 ++-- + ucm2/sof-hda-dsp/Hdmi.conf | 6 +++--- + ucm2/sof-hda-dsp/HiFi.conf | 14 +++++++------- + 3 files changed, 12 insertions(+), 12 deletions(-) + +diff --git a/ucm2/sof-hda-dsp/HDA-Capture-value.conf b/ucm2/sof-hda-dsp/HDA-Capture-value.conf +index b3e90aa..5f3c2a3 100644 +--- a/ucm2/sof-hda-dsp/HDA-Capture-value.conf ++++ b/ucm2/sof-hda-dsp/HDA-Capture-value.conf +@@ -1,5 +1,5 @@ +-CapturePCM "hw:${CardId},0" ++CapturePCM "hw:${CardId}" + CaptureMixerElem "Capture" + CaptureVolume "Capture Volume" + CaptureSwitch "Capture Switch" +-CaptureChannels "2" ++CaptureChannels 2 +diff --git a/ucm2/sof-hda-dsp/Hdmi.conf b/ucm2/sof-hda-dsp/Hdmi.conf +index 7418fa7..1982c72 100644 +--- a/ucm2/sof-hda-dsp/Hdmi.conf ++++ b/ucm2/sof-hda-dsp/Hdmi.conf +@@ -14,7 +14,7 @@ SectionDevice."HDMI1" { + Value { + PlaybackPriority 500 + PlaybackPCM "hw:${CardId},3" +- PlaybackChannels "2" ++ PlaybackChannels 2 + JackControl "HDMI/DP,pcm=3 Jack" + } + } +@@ -33,7 +33,7 @@ SectionDevice."HDMI2" { + Value { + PlaybackPriority 600 + PlaybackPCM "hw:${CardId},4" +- PlaybackChannels "2" ++ PlaybackChannels 2 + JackControl "HDMI/DP,pcm=4 Jack" + } + } +@@ -52,7 +52,7 @@ SectionDevice."HDMI3" { + Value { + PlaybackPriority 700 + PlaybackPCM "hw:${CardId},5" +- PlaybackChannels "2" ++ PlaybackChannels 2 + JackControl "HDMI/DP,pcm=5 Jack" + } + } +diff --git a/ucm2/sof-hda-dsp/HiFi.conf b/ucm2/sof-hda-dsp/HiFi.conf +index 71cef49..6dfdabe 100644 +--- a/ucm2/sof-hda-dsp/HiFi.conf ++++ b/ucm2/sof-hda-dsp/HiFi.conf +@@ -19,12 +19,12 @@ SectionDevice."Headphones1" { + + Value { + PlaybackPriority 200 +- PlaybackPCM "hw:${CardId},0" ++ PlaybackPCM "hw:${CardId}" + PlaybackMixerElem "Headphone" + PlaybackMasterElem "Master" + PlaybackVolume "Headphone Playback Volume" + PlaybackSwitch "Headphone Playback Switch" +- PlaybackChannels "2" ++ PlaybackChannels 2 + If.jack { + Condition { + Type ControlExists +@@ -72,12 +72,12 @@ SectionDevice."Speaker" { + + Value { + PlaybackPriority 100 +- PlaybackPCM "hw:${CardId},0" ++ PlaybackPCM "hw:${CardId}" + PlaybackMixerElem "Speaker" + PlaybackMasterElem "Master" + PlaybackVolume "Speaker Playback Volume" + PlaybackSwitch "Speaker Playback Switch" +- PlaybackChannels "2" ++ PlaybackChannels 2 + } + } + +@@ -93,7 +93,7 @@ If.monomic { + Comment "Headphones Stereo Microphone" + + ConflictingDevice [ +- "HeadsetMic" ++ "Headset" + ] + + EnableSequence [ +@@ -147,10 +147,10 @@ SectionDevice."Mic" { + Needle "cfg-dmics:4" + } + True { +- CaptureChannels "4" ++ CaptureChannels 4 + } + False { +- CaptureChannels "2" ++ CaptureChannels 2 + } + } + If.vol { +-- +2.24.1 + + +From 14c768eacd923c3b8bfe3dd027464a5d423e3773 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 6 Feb 2020 19:44:07 +0100 +Subject: [PATCH 36/36] ucm2: treewide - remove Playback and Capture channels=2 + assignments + +The value 2 is the default. + +Signed-off-by: Jaroslav Kysela +--- + ucm2/DB410c/HDMI.conf | 1 - + ucm2/DB410c/HiFi.conf | 9 --------- + ucm2/DB820c/HDMI.conf | 1 - + ucm2/DB820c/HiFi.conf | 1 - + ucm2/HDA-Intel/HiFi-dual.conf | 2 -- + ucm2/USB-Audio/Dell-WD15-Dock-HiFi.conf | 3 --- + ucm2/broadwell-rt286/HiFi.conf | 4 ---- + ucm2/broxton-rt298/broxton-rt298.conf | 7 ------- + ucm2/chtrt5645/HiFi-dmic1.conf | 4 ---- + ucm2/chtrt5645/HiFi-dmic2.conf | 4 ---- + ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf | 3 --- + ucm2/chtrt5645/HiFi.conf | 3 --- + ucm2/codecs/cx2072x/HeadPhones.conf | 1 - + ucm2/codecs/cx2072x/HeadsetMic.conf | 1 - + ucm2/codecs/cx2072x/InternalMic.conf | 1 - + ucm2/codecs/cx2072x/Speaker.conf | 1 - + ucm2/codecs/es8316/HeadPhones.conf | 1 - + ucm2/codecs/es8316/IN1-HeadsetMic.conf | 1 - + ucm2/codecs/es8316/IN1-InternalMic.conf | 1 - + ucm2/codecs/es8316/IN2-HeadsetMic.conf | 1 - + ucm2/codecs/es8316/IN2-InternalMic.conf | 1 - + ucm2/codecs/es8316/MonoSpeaker.conf | 1 - + ucm2/codecs/es8316/Speaker.conf | 1 - + ucm2/codecs/nau8824/HeadPhones.conf | 1 - + ucm2/codecs/nau8824/HeadsetMic.conf | 1 - + ucm2/codecs/nau8824/InternalMic.conf | 1 - + ucm2/codecs/nau8824/MonoSpeaker.conf | 1 - + ucm2/codecs/nau8824/Speaker.conf | 1 - + ucm2/codecs/rt5640/DigitalMics.conf | 1 - + ucm2/codecs/rt5640/HeadPhones.conf | 1 - + ucm2/codecs/rt5640/HeadsetMic.conf | 1 - + ucm2/codecs/rt5640/IN1-InternalMic.conf | 1 - + ucm2/codecs/rt5640/IN3-InternalMic.conf | 1 - + ucm2/codecs/rt5640/MonoSpeaker.conf | 1 - + ucm2/codecs/rt5640/Speaker.conf | 1 - + ucm2/codecs/rt5645/AnalogMic.conf | 1 - + ucm2/codecs/rt5651/DigitalMic.conf | 1 - + ucm2/codecs/rt5651/HeadPhones-swapped.conf | 1 - + ucm2/codecs/rt5651/HeadPhones.conf | 1 - + ucm2/codecs/rt5651/IN1-InternalMic.conf | 1 - + ucm2/codecs/rt5651/IN12-InternalMic.conf | 1 - + ucm2/codecs/rt5651/IN2-HeadsetMic.conf | 1 - + ucm2/codecs/rt5651/IN2-InternalMic.conf | 1 - + ucm2/codecs/rt5651/IN3-HeadsetMic.conf | 1 - + ucm2/codecs/rt5651/MonoSpeaker.conf | 1 - + ucm2/codecs/rt5651/Speaker.conf | 1 - + ucm2/codecs/rt5672/DMIC1.conf | 1 - + ucm2/codecs/rt5672/DMIC2.conf | 1 - + ucm2/codecs/rt5672/HeadPhones.conf | 1 - + ucm2/codecs/rt5672/HeadsetMic.conf | 1 - + ucm2/codecs/rt5672/MonoSpeaker.conf | 1 - + ucm2/codecs/rt5672/Speaker.conf | 1 - + ucm2/kblrt5660/Hdmi1.conf | 1 - + ucm2/kblrt5660/Hdmi2.conf | 1 - + ucm2/kblrt5660/HiFi.conf | 2 -- + ucm2/skylake-rt286/skylake-rt286.conf | 5 ----- + ucm2/sof-hda-dsp/HDA-Capture-value.conf | 1 - + ucm2/sof-hda-dsp/Hdmi.conf | 3 --- + ucm2/sof-hda-dsp/HiFi.conf | 5 ----- + 59 files changed, 100 deletions(-) + +diff --git a/ucm2/DB410c/HDMI.conf b/ucm2/DB410c/HDMI.conf +index fa44132..3335422 100644 +--- a/ucm2/DB410c/HDMI.conf ++++ b/ucm2/DB410c/HDMI.conf +@@ -4,7 +4,6 @@ + SectionVerb { + Value { + TQ "HiFi" +- PlaybackChannels 2 + } + } + +diff --git a/ucm2/DB410c/HiFi.conf b/ucm2/DB410c/HiFi.conf +index 1b2716a..62ddc8e 100644 +--- a/ucm2/DB410c/HiFi.conf ++++ b/ucm2/DB410c/HiFi.conf +@@ -1,14 +1,6 @@ + # Use case configuration for DB410c board. + # Author: Srinivas Kandagatla + +-SectionVerb { +- Value { +- PlaybackChannels 2 +- CaptureChannels 2 +- } +-} +- +- + SectionDevice."Speaker" { + Comment "Speaker playback" + +@@ -35,7 +27,6 @@ SectionDevice."Speaker" { + } + } + +- + SectionDevice."Headphones" { + Comment "Headphones playback" + +diff --git a/ucm2/DB820c/HDMI.conf b/ucm2/DB820c/HDMI.conf +index c0d40f6..f0ca015 100644 +--- a/ucm2/DB820c/HDMI.conf ++++ b/ucm2/DB820c/HDMI.conf +@@ -29,6 +29,5 @@ SectionDevice."HDMI" { + Value { + PlaybackPriority 200 + PlaybackPCM "plughw:${CardId}" +- PlaybackChannels 2 + } + } +diff --git a/ucm2/DB820c/HiFi.conf b/ucm2/DB820c/HiFi.conf +index 501c263..89280d7 100644 +--- a/ucm2/DB820c/HiFi.conf ++++ b/ucm2/DB820c/HiFi.conf +@@ -69,7 +69,6 @@ SectionDevice."Headphones" { + Value { + PlaybackPriority 100 + PlaybackPCM "plughw:${CardId},1" +- PlaybackChannels 2 + } + } + +diff --git a/ucm2/HDA-Intel/HiFi-dual.conf b/ucm2/HDA-Intel/HiFi-dual.conf +index 846c6db..174fef4 100644 +--- a/ucm2/HDA-Intel/HiFi-dual.conf ++++ b/ucm2/HDA-Intel/HiFi-dual.conf +@@ -1,8 +1,6 @@ + SectionVerb { + Value { + TQ "HiFi" +- PlaybackChannels 2 +- CaptureChannels 2 + } + + EnableSequence [ +diff --git a/ucm2/USB-Audio/Dell-WD15-Dock-HiFi.conf b/ucm2/USB-Audio/Dell-WD15-Dock-HiFi.conf +index 37b7e0d..2f625e4 100644 +--- a/ucm2/USB-Audio/Dell-WD15-Dock-HiFi.conf ++++ b/ucm2/USB-Audio/Dell-WD15-Dock-HiFi.conf +@@ -3,7 +3,6 @@ SectionDevice."Headphones" { + + Value { + PlaybackPriority 100 +- PlaybackChannels 2 + PlaybackPCM "hw:${CardId}" + } + } +@@ -13,7 +12,6 @@ SectionDevice."Line" { + + Value { + PlaybackPriority 200 +- PlaybackChannels 2 + PlaybackPCM "hw:${CardId},1" + } + } +@@ -23,7 +21,6 @@ SectionDevice."Mic" { + + Value { + CapturePriority 100 +- CaptureChannels 2 + CapturePCM "hw:${CardId}" + } + } +diff --git a/ucm2/broadwell-rt286/HiFi.conf b/ucm2/broadwell-rt286/HiFi.conf +index 96b89a0..611a03e 100644 +--- a/ucm2/broadwell-rt286/HiFi.conf ++++ b/ucm2/broadwell-rt286/HiFi.conf +@@ -23,7 +23,6 @@ SectionDevice."Speaker" { + Value { + PlaybackPriority 100 + PlaybackPCM "hw:${CardId}" +- PlaybackChannels 2 + PlaybackMixerElem "DAC0" + PlaybackMasterElem "Master" + } +@@ -51,7 +50,6 @@ SectionDevice."Headphones" { + Value { + PlaybackPriority 200 + PlaybackPCM "hw:${CardId}" +- PlaybackChannels 2 + PlaybackMixerElem "DAC0" + PlaybackMasterElem "Master" + JackDev "rt286-jack" +@@ -78,7 +76,6 @@ SectionDevice."Mic" { + Value { + CapturePriority 100 + CapturePCM "hw:${CardId}" +- CaptureChannels 2 + CaptureMixerElem "Mic" + CaptureMasterElem "ADC0" + } +@@ -103,7 +100,6 @@ SectionDevice."Handset" { + Value { + CapturePriority 200 + CapturePCM "hw:${CardId}" +- CaptureChannels 2 + CaptureMixerElem "Mic" + CaptureMasterElem "ADC0" + JackDev "rt286-jack" +diff --git a/ucm2/broxton-rt298/broxton-rt298.conf b/ucm2/broxton-rt298/broxton-rt298.conf +index 1332dc5..95f9ac5 100644 +--- a/ucm2/broxton-rt298/broxton-rt298.conf ++++ b/ucm2/broxton-rt298/broxton-rt298.conf +@@ -8,13 +8,6 @@ SectionUseCase."HiFi" { + Comment "Play and record HiFi quality Music" + } + +-ValueDefaults { +- PlaybackChannels 2 +- PlaybackPriority 1 +- CaptureChannels 2 +- CapturePriority 2 +-} +- + SectionDefaults [ + cset "name='Headphone Jack Switch' 1" + cset "name='Speaker Switch' 1" +diff --git a/ucm2/chtrt5645/HiFi-dmic1.conf b/ucm2/chtrt5645/HiFi-dmic1.conf +index 4748bd9..1a8ee0a 100644 +--- a/ucm2/chtrt5645/HiFi-dmic1.conf ++++ b/ucm2/chtrt5645/HiFi-dmic1.conf +@@ -27,7 +27,6 @@ SectionDevice."Speaker" { + Value { + PlaybackPriority 100 + PlaybackPCM "hw:${CardId}" +- PlaybackChannels 2 + } + + ConflictingDevice [ +@@ -50,7 +49,6 @@ SectionDevice."Headphones" { + Value { + PlaybackPriority 200 + PlaybackPCM "hw:${CardId}" +- PlaybackChannels 2 + JackControl "Headphone Jack" + JackHWMute "Speaker" + } +@@ -75,7 +73,6 @@ SectionDevice."Mic" { + Value { + CapturePriority 100 + CapturePCM "hw:${CardId}" +- CaptureChannels 2 + } + + EnableSequence [ +@@ -98,7 +95,6 @@ SectionDevice."Headset" { + Value { + CapturePriority 200 + CapturePCM "hw:${CardId}" +- CaptureChannels 2 + JackControl "Headset Mic Jack" + JackHWMute "Mic" + } +diff --git a/ucm2/chtrt5645/HiFi-dmic2.conf b/ucm2/chtrt5645/HiFi-dmic2.conf +index 459b9f5..c9fdd79 100644 +--- a/ucm2/chtrt5645/HiFi-dmic2.conf ++++ b/ucm2/chtrt5645/HiFi-dmic2.conf +@@ -27,7 +27,6 @@ SectionDevice."Speaker" { + Value { + PlaybackPriority 100 + PlaybackPCM "hw:${CardId}" +- PlaybackChannels 2 + } + + ConflictingDevice [ +@@ -50,7 +49,6 @@ SectionDevice."Headphones" { + Value { + PlaybackPriority 200 + PlaybackPCM "hw:${CardId}" +- PlaybackChannels 2 + JackControl "Headphone Jack" + JackHWMute "Speaker" + } +@@ -75,7 +73,6 @@ SectionDevice."Mic" { + Value { + CapturePriority 100 + CapturePCM "hw:${CardId}" +- CaptureChannels 2 + } + + EnableSequence [ +@@ -100,7 +97,6 @@ SectionDevice."Headset" { + Value { + CapturePriority 200 + CapturePCM "hw:${CardId}" +- CaptureChannels 2 + JackControl "Headset Mic Jack" + JackHWMute "DMic" + } +diff --git a/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf b/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf +index fe410f3..db866cd 100644 +--- a/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf ++++ b/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf +@@ -27,7 +27,6 @@ SectionDevice."Speaker" { + Value { + PlaybackPriority 100 + PlaybackPCM "hw:${CardId}" +- PlaybackChannels 2 + } + + ConflictingDevice [ +@@ -54,7 +53,6 @@ SectionDevice."Headphones" { + Value { + PlaybackPriority 200 + PlaybackPCM "hw:${CardId}" +- PlaybackChannels 2 + JackControl "Headphone Jack" + JackHWMute "Speaker" + } +@@ -85,7 +83,6 @@ SectionDevice."Headset" { + Value { + CapturePriority 200 + CapturePCM "hw:${CardId}" +- CaptureChannels 2 + JackControl "Headset Mic Jack" + JackHWMute "Mic" + } +diff --git a/ucm2/chtrt5645/HiFi.conf b/ucm2/chtrt5645/HiFi.conf +index 954bf68..58468a8 100644 +--- a/ucm2/chtrt5645/HiFi.conf ++++ b/ucm2/chtrt5645/HiFi.conf +@@ -27,7 +27,6 @@ SectionDevice."Speaker" { + Value { + PlaybackPriority 100 + PlaybackPCM "hw:${CardId}" +- PlaybackChannels 2 + } + + ConflictingDevice [ +@@ -50,7 +49,6 @@ SectionDevice."Headphones" { + Value { + PlaybackPriority 200 + PlaybackPCM "hw:${CardId}" +- PlaybackChannels 2 + JackControl "Headphone Jack" + JackHWMute "Speaker" + } +@@ -77,7 +75,6 @@ SectionDevice."Headset" { + Value { + CapturePriority 200 + CapturePCM "hw:${CardId}" +- CaptureChannels 2 + JackControl "Headset Mic Jack" + JackHWMute "Mic" + } +diff --git a/ucm2/codecs/cx2072x/HeadPhones.conf b/ucm2/codecs/cx2072x/HeadPhones.conf +index 484d020..adb70db 100644 +--- a/ucm2/codecs/cx2072x/HeadPhones.conf ++++ b/ucm2/codecs/cx2072x/HeadPhones.conf +@@ -18,7 +18,6 @@ SectionDevice."Headphones" { + Value { + PlaybackPriority 200 + PlaybackPCM "hw:${CardId}" +- PlaybackChannels 2 + JackControl "Headphone Jack" + } + } +diff --git a/ucm2/codecs/cx2072x/HeadsetMic.conf b/ucm2/codecs/cx2072x/HeadsetMic.conf +index b1a7771..5a6643e 100644 +--- a/ucm2/codecs/cx2072x/HeadsetMic.conf ++++ b/ucm2/codecs/cx2072x/HeadsetMic.conf +@@ -19,7 +19,6 @@ SectionDevice."Headset" { + Value { + CapturePriority 200 + CapturePCM "hw:${CardId}" +- CaptureChannels 2 + JackControl "Headset Mic Jack" + } + } +diff --git a/ucm2/codecs/cx2072x/InternalMic.conf b/ucm2/codecs/cx2072x/InternalMic.conf +index 831c3cc..9c083be 100644 +--- a/ucm2/codecs/cx2072x/InternalMic.conf ++++ b/ucm2/codecs/cx2072x/InternalMic.conf +@@ -19,6 +19,5 @@ SectionDevice."Mic" { + Value { + CapturePriority 100 + CapturePCM "hw:${CardId}" +- CaptureChannels 2 + } + } +diff --git a/ucm2/codecs/cx2072x/Speaker.conf b/ucm2/codecs/cx2072x/Speaker.conf +index f60e355..a641ba2 100644 +--- a/ucm2/codecs/cx2072x/Speaker.conf ++++ b/ucm2/codecs/cx2072x/Speaker.conf +@@ -18,6 +18,5 @@ SectionDevice."Speaker" { + Value { + PlaybackPriority 100 + PlaybackPCM "hw:${CardId}" +- PlaybackChannels 2 + } + } +diff --git a/ucm2/codecs/es8316/HeadPhones.conf b/ucm2/codecs/es8316/HeadPhones.conf +index 6a05e54..b68569a 100644 +--- a/ucm2/codecs/es8316/HeadPhones.conf ++++ b/ucm2/codecs/es8316/HeadPhones.conf +@@ -16,7 +16,6 @@ SectionDevice."Headphones" { + Value { + PlaybackPriority 200 + PlaybackPCM "hw:${CardId}" +- PlaybackChannels 2 + JackControl "Headphone Jack" + JackHWMute "Speaker" + } +diff --git a/ucm2/codecs/es8316/IN1-HeadsetMic.conf b/ucm2/codecs/es8316/IN1-HeadsetMic.conf +index e9f9061..a76b275 100644 +--- a/ucm2/codecs/es8316/IN1-HeadsetMic.conf ++++ b/ucm2/codecs/es8316/IN1-HeadsetMic.conf +@@ -17,7 +17,6 @@ SectionDevice."Headset" { + Value { + CapturePriority 200 + CapturePCM "hw:${CardId}" +- CaptureChannels 2 + JackControl "Headset Mic Jack" + } + } +diff --git a/ucm2/codecs/es8316/IN1-InternalMic.conf b/ucm2/codecs/es8316/IN1-InternalMic.conf +index 31c5cda..ede0a8c 100644 +--- a/ucm2/codecs/es8316/IN1-InternalMic.conf ++++ b/ucm2/codecs/es8316/IN1-InternalMic.conf +@@ -17,6 +17,5 @@ SectionDevice."Mic" { + Value { + CapturePriority 100 + CapturePCM "hw:${CardId}" +- CaptureChannels 2 + } + } +diff --git a/ucm2/codecs/es8316/IN2-HeadsetMic.conf b/ucm2/codecs/es8316/IN2-HeadsetMic.conf +index 377d84d..b114c86 100644 +--- a/ucm2/codecs/es8316/IN2-HeadsetMic.conf ++++ b/ucm2/codecs/es8316/IN2-HeadsetMic.conf +@@ -17,7 +17,6 @@ SectionDevice."Headset" { + Value { + CapturePriority 200 + CapturePCM "hw:${CardId}" +- CaptureChannels 2 + JackControl "Headset Mic Jack" + } + } +diff --git a/ucm2/codecs/es8316/IN2-InternalMic.conf b/ucm2/codecs/es8316/IN2-InternalMic.conf +index f0ff6f1..c8fce62 100644 +--- a/ucm2/codecs/es8316/IN2-InternalMic.conf ++++ b/ucm2/codecs/es8316/IN2-InternalMic.conf +@@ -17,6 +17,5 @@ SectionDevice."Mic" { + Value { + CapturePriority 100 + CapturePCM "hw:${CardId}" +- CaptureChannels 2 + } + } +diff --git a/ucm2/codecs/es8316/MonoSpeaker.conf b/ucm2/codecs/es8316/MonoSpeaker.conf +index 64a7e76..f5f4273 100644 +--- a/ucm2/codecs/es8316/MonoSpeaker.conf ++++ b/ucm2/codecs/es8316/MonoSpeaker.conf +@@ -33,6 +33,5 @@ SectionDevice."Speaker" { + Value { + PlaybackPriority 100 + PlaybackPCM "hw:${CardId}" +- PlaybackChannels 2 + } + } +diff --git a/ucm2/codecs/es8316/Speaker.conf b/ucm2/codecs/es8316/Speaker.conf +index 58fe078..03c21b3 100644 +--- a/ucm2/codecs/es8316/Speaker.conf ++++ b/ucm2/codecs/es8316/Speaker.conf +@@ -16,6 +16,5 @@ SectionDevice."Speaker" { + Value { + PlaybackPriority 100 + PlaybackPCM "hw:${CardId}" +- PlaybackChannels 2 + } + } +diff --git a/ucm2/codecs/nau8824/HeadPhones.conf b/ucm2/codecs/nau8824/HeadPhones.conf +index 6623365..a807f84 100644 +--- a/ucm2/codecs/nau8824/HeadPhones.conf ++++ b/ucm2/codecs/nau8824/HeadPhones.conf +@@ -4,7 +4,6 @@ SectionDevice."Headphones" { + Value { + PlaybackPriority 200 + PlaybackPCM "hw:${CardId}" +- PlaybackChannels 2 + JackControl "Headphone Jack" + } + +diff --git a/ucm2/codecs/nau8824/HeadsetMic.conf b/ucm2/codecs/nau8824/HeadsetMic.conf +index 7381638..1129a6b 100644 +--- a/ucm2/codecs/nau8824/HeadsetMic.conf ++++ b/ucm2/codecs/nau8824/HeadsetMic.conf +@@ -4,7 +4,6 @@ SectionDevice."Headset" { + Value { + CapturePriority 300 + CapturePCM "hw:${CardId}" +- CaptureChannels 2 + JackControl "Headset Mic Jack" + } + +diff --git a/ucm2/codecs/nau8824/InternalMic.conf b/ucm2/codecs/nau8824/InternalMic.conf +index 731a261..409f01b 100644 +--- a/ucm2/codecs/nau8824/InternalMic.conf ++++ b/ucm2/codecs/nau8824/InternalMic.conf +@@ -4,7 +4,6 @@ SectionDevice."Mic" { + Value { + CapturePriority 200 + CapturePCM "hw:${CardId}" +- CaptureChannels 2 + } + + ConflictingDevice [ +diff --git a/ucm2/codecs/nau8824/MonoSpeaker.conf b/ucm2/codecs/nau8824/MonoSpeaker.conf +index b02a22c..6b4ef8a 100644 +--- a/ucm2/codecs/nau8824/MonoSpeaker.conf ++++ b/ucm2/codecs/nau8824/MonoSpeaker.conf +@@ -4,7 +4,6 @@ SectionDevice."Speaker" { + Value { + PlaybackPriority 100 + PlaybackPCM "hw:${CardId}" +- PlaybackChannels 2 + } + + ConflictingDevice [ +diff --git a/ucm2/codecs/nau8824/Speaker.conf b/ucm2/codecs/nau8824/Speaker.conf +index 3658795..a995873 100644 +--- a/ucm2/codecs/nau8824/Speaker.conf ++++ b/ucm2/codecs/nau8824/Speaker.conf +@@ -4,7 +4,6 @@ SectionDevice."Speaker" { + Value { + PlaybackPriority 100 + PlaybackPCM "hw:${CardId}" +- PlaybackChannels 2 + } + + ConflictingDevice [ +diff --git a/ucm2/codecs/rt5640/DigitalMics.conf b/ucm2/codecs/rt5640/DigitalMics.conf +index 9cd8a8c..503c4a9 100644 +--- a/ucm2/codecs/rt5640/DigitalMics.conf ++++ b/ucm2/codecs/rt5640/DigitalMics.conf +@@ -22,6 +22,5 @@ SectionDevice."Mic" { + Value { + CapturePriority 100 + CapturePCM "hw:${CardId}" +- CaptureChannels 2 + } + } +diff --git a/ucm2/codecs/rt5640/HeadPhones.conf b/ucm2/codecs/rt5640/HeadPhones.conf +index 7859b7a..42151d6 100644 +--- a/ucm2/codecs/rt5640/HeadPhones.conf ++++ b/ucm2/codecs/rt5640/HeadPhones.conf +@@ -33,7 +33,6 @@ SectionDevice."Headphones" { + Value { + PlaybackPriority 300 + PlaybackPCM "hw:${CardId}" +- PlaybackChannels 2 + JackControl "Headphone Jack" + } + } +diff --git a/ucm2/codecs/rt5640/HeadsetMic.conf b/ucm2/codecs/rt5640/HeadsetMic.conf +index 40e0abe..7a8dfb8 100644 +--- a/ucm2/codecs/rt5640/HeadsetMic.conf ++++ b/ucm2/codecs/rt5640/HeadsetMic.conf +@@ -38,7 +38,6 @@ SectionDevice."Headset" { + Value { + CapturePriority 200 + CapturePCM "hw:${CardId}" +- CaptureChannels 2 + JackControl "Headset Mic Jack" + } + } +diff --git a/ucm2/codecs/rt5640/IN1-InternalMic.conf b/ucm2/codecs/rt5640/IN1-InternalMic.conf +index 7d76c4f..ebb5b6d 100644 +--- a/ucm2/codecs/rt5640/IN1-InternalMic.conf ++++ b/ucm2/codecs/rt5640/IN1-InternalMic.conf +@@ -41,6 +41,5 @@ SectionDevice."Mic" { + Value { + CapturePriority 100 + CapturePCM "hw:${CardId}" +- CaptureChannels 2 + } + } +diff --git a/ucm2/codecs/rt5640/IN3-InternalMic.conf b/ucm2/codecs/rt5640/IN3-InternalMic.conf +index 2df2938..172d909 100644 +--- a/ucm2/codecs/rt5640/IN3-InternalMic.conf ++++ b/ucm2/codecs/rt5640/IN3-InternalMic.conf +@@ -41,6 +41,5 @@ SectionDevice."Mic" { + Value { + CapturePriority 100 + CapturePCM "hw:${CardId}" +- CaptureChannels 2 + } + } +diff --git a/ucm2/codecs/rt5640/MonoSpeaker.conf b/ucm2/codecs/rt5640/MonoSpeaker.conf +index 70ab809..ddc7ba8 100644 +--- a/ucm2/codecs/rt5640/MonoSpeaker.conf ++++ b/ucm2/codecs/rt5640/MonoSpeaker.conf +@@ -38,6 +38,5 @@ SectionDevice."Speaker" { + Value { + PlaybackPriority 100 + PlaybackPCM "hw:${CardId}" +- PlaybackChannels 2 + } + } +diff --git a/ucm2/codecs/rt5640/Speaker.conf b/ucm2/codecs/rt5640/Speaker.conf +index 3b4b296..411cd13 100644 +--- a/ucm2/codecs/rt5640/Speaker.conf ++++ b/ucm2/codecs/rt5640/Speaker.conf +@@ -38,6 +38,5 @@ SectionDevice."Speaker" { + Value { + PlaybackPriority 100 + PlaybackPCM "hw:${CardId}" +- PlaybackChannels 2 + } + } +diff --git a/ucm2/codecs/rt5645/AnalogMic.conf b/ucm2/codecs/rt5645/AnalogMic.conf +index 5583cdb..1793880 100644 +--- a/ucm2/codecs/rt5645/AnalogMic.conf ++++ b/ucm2/codecs/rt5645/AnalogMic.conf +@@ -4,7 +4,6 @@ SectionDevice."Mic" { + Value { + CapturePriority 100 + CapturePCM "hw:${CardId}" +- CaptureChannels 2 + } + + EnableSequence [ +diff --git a/ucm2/codecs/rt5651/DigitalMic.conf b/ucm2/codecs/rt5651/DigitalMic.conf +index fa1de4c..aa40c1c 100644 +--- a/ucm2/codecs/rt5651/DigitalMic.conf ++++ b/ucm2/codecs/rt5651/DigitalMic.conf +@@ -16,6 +16,5 @@ SectionDevice."Mic" { + Value { + CapturePriority 100 + CapturePCM "hw:${CardId}" +- CaptureChannels 2 + } + } +diff --git a/ucm2/codecs/rt5651/HeadPhones-swapped.conf b/ucm2/codecs/rt5651/HeadPhones-swapped.conf +index 7e91aa2..595f29c 100644 +--- a/ucm2/codecs/rt5651/HeadPhones-swapped.conf ++++ b/ucm2/codecs/rt5651/HeadPhones-swapped.conf +@@ -33,7 +33,6 @@ SectionDevice."Headphones" { + + Value { + PlaybackPriority 200 +- PlaybackChannels 2 + PlaybackPCM "hw:${CardId}" + JackControl "Headphone Jack" + } +diff --git a/ucm2/codecs/rt5651/HeadPhones.conf b/ucm2/codecs/rt5651/HeadPhones.conf +index 18a4108..266c851 100644 +--- a/ucm2/codecs/rt5651/HeadPhones.conf ++++ b/ucm2/codecs/rt5651/HeadPhones.conf +@@ -25,7 +25,6 @@ SectionDevice."Headphones" { + Value { + PlaybackPriority 200 + PlaybackPCM "hw:${CardId}" +- PlaybackChannels 2 + JackControl "Headphone Jack" + } + } +diff --git a/ucm2/codecs/rt5651/IN1-InternalMic.conf b/ucm2/codecs/rt5651/IN1-InternalMic.conf +index 13c7cb6..faa0bfa 100644 +--- a/ucm2/codecs/rt5651/IN1-InternalMic.conf ++++ b/ucm2/codecs/rt5651/IN1-InternalMic.conf +@@ -20,6 +20,5 @@ SectionDevice."Mic" { + Value { + CapturePriority 100 + CapturePCM "hw:${CardId}" +- CaptureChannels 2 + } + } +diff --git a/ucm2/codecs/rt5651/IN12-InternalMic.conf b/ucm2/codecs/rt5651/IN12-InternalMic.conf +index e017541..79c72a3 100644 +--- a/ucm2/codecs/rt5651/IN12-InternalMic.conf ++++ b/ucm2/codecs/rt5651/IN12-InternalMic.conf +@@ -24,6 +24,5 @@ SectionDevice."Mic" { + Value { + CapturePriority 100 + CapturePCM "hw:${CardId}" +- CaptureChannels 2 + } + } +diff --git a/ucm2/codecs/rt5651/IN2-HeadsetMic.conf b/ucm2/codecs/rt5651/IN2-HeadsetMic.conf +index 5b51439..86bbacb 100644 +--- a/ucm2/codecs/rt5651/IN2-HeadsetMic.conf ++++ b/ucm2/codecs/rt5651/IN2-HeadsetMic.conf +@@ -24,7 +24,6 @@ SectionDevice."Headset" { + Value { + CapturePriority 200 + CapturePCM "hw:${CardId}" +- CaptureChannels 2 + JackControl "Headset Mic Jack" + } + } +diff --git a/ucm2/codecs/rt5651/IN2-InternalMic.conf b/ucm2/codecs/rt5651/IN2-InternalMic.conf +index 9eeef4d..da15a6d 100644 +--- a/ucm2/codecs/rt5651/IN2-InternalMic.conf ++++ b/ucm2/codecs/rt5651/IN2-InternalMic.conf +@@ -20,6 +20,5 @@ SectionDevice."Mic" { + Value { + CapturePriority 100 + CapturePCM "hw:${CardId}" +- CaptureChannels 2 + } + } +diff --git a/ucm2/codecs/rt5651/IN3-HeadsetMic.conf b/ucm2/codecs/rt5651/IN3-HeadsetMic.conf +index d579dcd..a40fefc 100644 +--- a/ucm2/codecs/rt5651/IN3-HeadsetMic.conf ++++ b/ucm2/codecs/rt5651/IN3-HeadsetMic.conf +@@ -24,7 +24,6 @@ SectionDevice."Headset" { + Value { + CapturePriority 200 + CapturePCM "hw:${CardId}" +- CaptureChannels 2 + JackControl "Headset Mic Jack" + } + } +diff --git a/ucm2/codecs/rt5651/MonoSpeaker.conf b/ucm2/codecs/rt5651/MonoSpeaker.conf +index 9c780a0..a83b481 100644 +--- a/ucm2/codecs/rt5651/MonoSpeaker.conf ++++ b/ucm2/codecs/rt5651/MonoSpeaker.conf +@@ -43,6 +43,5 @@ SectionDevice."Speaker" { + Value { + PlaybackPriority 100 + PlaybackPCM "hw:${CardId}" +- PlaybackChannels 2 + } + } +diff --git a/ucm2/codecs/rt5651/Speaker.conf b/ucm2/codecs/rt5651/Speaker.conf +index efc12e5..18308b4 100644 +--- a/ucm2/codecs/rt5651/Speaker.conf ++++ b/ucm2/codecs/rt5651/Speaker.conf +@@ -25,6 +25,5 @@ SectionDevice."Speaker" { + Value { + PlaybackPriority 100 + PlaybackPCM "hw:${CardId}" +- PlaybackChannels 2 + } + } +diff --git a/ucm2/codecs/rt5672/DMIC1.conf b/ucm2/codecs/rt5672/DMIC1.conf +index 73983af..2018283 100644 +--- a/ucm2/codecs/rt5672/DMIC1.conf ++++ b/ucm2/codecs/rt5672/DMIC1.conf +@@ -23,6 +23,5 @@ SectionDevice."Mic1" { + Value { + CapturePriority 100 + CapturePCM "hw:${CardId}" +- CaptureChannels 2 + } + } +diff --git a/ucm2/codecs/rt5672/DMIC2.conf b/ucm2/codecs/rt5672/DMIC2.conf +index 751c95c..48e6170 100644 +--- a/ucm2/codecs/rt5672/DMIC2.conf ++++ b/ucm2/codecs/rt5672/DMIC2.conf +@@ -23,6 +23,5 @@ SectionDevice."Mic2" { + Value { + CapturePriority 200 + CapturePCM "hw:${CardId}" +- CaptureChannels 2 + } + } +diff --git a/ucm2/codecs/rt5672/HeadPhones.conf b/ucm2/codecs/rt5672/HeadPhones.conf +index 0542f77..2c8d6e8 100644 +--- a/ucm2/codecs/rt5672/HeadPhones.conf ++++ b/ucm2/codecs/rt5672/HeadPhones.conf +@@ -17,7 +17,6 @@ SectionDevice."Headphones" { + Value { + PlaybackPriority 300 + PlaybackPCM "hw:${CardId}" +- PlaybackChannels 2 + JackControl "Headphone Jack" + } + } +diff --git a/ucm2/codecs/rt5672/HeadsetMic.conf b/ucm2/codecs/rt5672/HeadsetMic.conf +index f407579..a764d82 100644 +--- a/ucm2/codecs/rt5672/HeadsetMic.conf ++++ b/ucm2/codecs/rt5672/HeadsetMic.conf +@@ -32,7 +32,6 @@ SectionDevice."Headset" { + Value { + CapturePriority 300 + CapturePCM "hw:${CardId}" +- CaptureChannels 2 + JackControl "Headset Mic Jack" + } + } +diff --git a/ucm2/codecs/rt5672/MonoSpeaker.conf b/ucm2/codecs/rt5672/MonoSpeaker.conf +index 0849c67..f08c9c6 100644 +--- a/ucm2/codecs/rt5672/MonoSpeaker.conf ++++ b/ucm2/codecs/rt5672/MonoSpeaker.conf +@@ -21,6 +21,5 @@ SectionDevice."Speaker2" { + Value { + PlaybackPriority 100 + PlaybackPCM "hw:${CardId}" +- PlaybackChannels 2 + } + } +diff --git a/ucm2/codecs/rt5672/Speaker.conf b/ucm2/codecs/rt5672/Speaker.conf +index 44e73aa..8b7bcf8 100644 +--- a/ucm2/codecs/rt5672/Speaker.conf ++++ b/ucm2/codecs/rt5672/Speaker.conf +@@ -17,6 +17,5 @@ SectionDevice."Speaker1" { + Value { + PlaybackPriority 200 + PlaybackPCM "hw:${CardId}" +- PlaybackChannels 2 + } + } +diff --git a/ucm2/kblrt5660/Hdmi1.conf b/ucm2/kblrt5660/Hdmi1.conf +index ccf5118..561946f 100755 +--- a/ucm2/kblrt5660/Hdmi1.conf ++++ b/ucm2/kblrt5660/Hdmi1.conf +@@ -7,7 +7,6 @@ SectionDevice."HDMI1" { + Value { + PlaybackPriority 200 + PlaybackPCM "hw:${CardId},2" +- PlaybackChannels 2 + If.1 { + Condition { + Type ControlExists +diff --git a/ucm2/kblrt5660/Hdmi2.conf b/ucm2/kblrt5660/Hdmi2.conf +index c5e4001..756a346 100755 +--- a/ucm2/kblrt5660/Hdmi2.conf ++++ b/ucm2/kblrt5660/Hdmi2.conf +@@ -7,7 +7,6 @@ SectionDevice."HDMI2" { + Value { + PlaybackPriority 300 + PlaybackPCM "hw:${CardId},3" +- PlaybackChannels 2 + If.1 { + Condition { + Type ControlExists +diff --git a/ucm2/kblrt5660/HiFi.conf b/ucm2/kblrt5660/HiFi.conf +index 0f5d46d..c1e8a0f 100755 +--- a/ucm2/kblrt5660/HiFi.conf ++++ b/ucm2/kblrt5660/HiFi.conf +@@ -28,7 +28,6 @@ SectionDevice."Line1" { + Value { + PlaybackPriority 100 + PlaybackPCM "hw:${CardId}" +- PlaybackChannels 2 + JackDev "rt5660-jack" + JackControl "Line Out Jack" + } +@@ -61,7 +60,6 @@ SectionDevice."Line2" { + Value { + CapturePriority 100 + CapturePCM "hw:${CardId},1" +- CaptureChannels 2 + JackDev "rt5660-jack" + JackControl "Line In Jack" + } +diff --git a/ucm2/skylake-rt286/skylake-rt286.conf b/ucm2/skylake-rt286/skylake-rt286.conf +index 4ea5777..97f2a7c 100644 +--- a/ucm2/skylake-rt286/skylake-rt286.conf ++++ b/ucm2/skylake-rt286/skylake-rt286.conf +@@ -8,11 +8,6 @@ SectionUseCase."HiFi" { + Comment "Play and record HiFi quality Music" + } + +-ValueDefaults { +- PlaybackChannels 2 +- CaptureChannels 2 +-} +- + SectionDefaults [ + cset "name='Headphone Jack Switch' 1" + cset "name='Speaker Switch' 1" +diff --git a/ucm2/sof-hda-dsp/HDA-Capture-value.conf b/ucm2/sof-hda-dsp/HDA-Capture-value.conf +index 5f3c2a3..2f1316a 100644 +--- a/ucm2/sof-hda-dsp/HDA-Capture-value.conf ++++ b/ucm2/sof-hda-dsp/HDA-Capture-value.conf +@@ -2,4 +2,3 @@ CapturePCM "hw:${CardId}" + CaptureMixerElem "Capture" + CaptureVolume "Capture Volume" + CaptureSwitch "Capture Switch" +-CaptureChannels 2 +diff --git a/ucm2/sof-hda-dsp/Hdmi.conf b/ucm2/sof-hda-dsp/Hdmi.conf +index 1982c72..be6cb39 100644 +--- a/ucm2/sof-hda-dsp/Hdmi.conf ++++ b/ucm2/sof-hda-dsp/Hdmi.conf +@@ -14,7 +14,6 @@ SectionDevice."HDMI1" { + Value { + PlaybackPriority 500 + PlaybackPCM "hw:${CardId},3" +- PlaybackChannels 2 + JackControl "HDMI/DP,pcm=3 Jack" + } + } +@@ -33,7 +32,6 @@ SectionDevice."HDMI2" { + Value { + PlaybackPriority 600 + PlaybackPCM "hw:${CardId},4" +- PlaybackChannels 2 + JackControl "HDMI/DP,pcm=4 Jack" + } + } +@@ -52,7 +50,6 @@ SectionDevice."HDMI3" { + Value { + PlaybackPriority 700 + PlaybackPCM "hw:${CardId},5" +- PlaybackChannels 2 + JackControl "HDMI/DP,pcm=5 Jack" + } + } +diff --git a/ucm2/sof-hda-dsp/HiFi.conf b/ucm2/sof-hda-dsp/HiFi.conf +index 6dfdabe..60a8693 100644 +--- a/ucm2/sof-hda-dsp/HiFi.conf ++++ b/ucm2/sof-hda-dsp/HiFi.conf +@@ -24,7 +24,6 @@ SectionDevice."Headphones1" { + PlaybackMasterElem "Master" + PlaybackVolume "Headphone Playback Volume" + PlaybackSwitch "Headphone Playback Switch" +- PlaybackChannels 2 + If.jack { + Condition { + Type ControlExists +@@ -77,7 +76,6 @@ SectionDevice."Speaker" { + PlaybackMasterElem "Master" + PlaybackVolume "Speaker Playback Volume" + PlaybackSwitch "Speaker Playback Switch" +- PlaybackChannels 2 + } + } + +@@ -149,9 +147,6 @@ SectionDevice."Mic" { + True { + CaptureChannels 4 + } +- False { +- CaptureChannels 2 +- } + } + If.vol { + Condition { +-- +2.24.1 + From 6935b9807075d795fd84fcedaf7b802e1dcd5174 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Sun, 9 Feb 2020 20:58:39 +0100 Subject: [PATCH 031/120] bumb the package version --- alsa-lib.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index b7ab286..6768960 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 5%{?prever_dot}%{?dist} +Release: 6%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -163,7 +163,7 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog -* Sun Feb 9 2020 Jaroslav Kysela - 1.2.1.2-5 +* Sun Feb 9 2020 Jaroslav Kysela - 1.2.1.2-6 - More UCM2 related fixes * Tue Jan 28 2020 Fedora Release Engineering - 1.2.1.2-5 From 16fe60a5cefd09ed8f8671761740f97e4244b354 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 19 Feb 2020 12:08:29 +0100 Subject: [PATCH 032/120] updated to 1.2.2 --- alsa-git.patch | 22620 ------------------------------------------ alsa-lib.spec | 15 +- alsa-ucm-conf.patch | 5648 ----------- sources | 8 +- 4 files changed, 12 insertions(+), 28279 deletions(-) delete mode 100644 alsa-ucm-conf.patch diff --git a/alsa-git.patch b/alsa-git.patch index cc848a7..e69de29 100644 --- a/alsa-git.patch +++ b/alsa-git.patch @@ -1,22620 +0,0 @@ -From c79f09e1f5e8b559b58dacdb00708d995b2e3aa5 Mon Sep 17 00:00:00 2001 -From: paulhsia -Date: Sat, 30 Nov 2019 03:35:30 +0800 -Subject: [PATCH 01/69] ucm: Use strncmp to avoid access-out-of-boundary - -If the length of the identifier is less than the length of the prefix, -access-out-of-boundary will occur in memcmp(). - -Signed-off-by: paulhsia -Signed-off-by: Jaroslav Kysela ---- - src/ucm/main.c | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/src/ucm/main.c b/src/ucm/main.c -index b0b6ffb3..252e50d9 100644 ---- a/src/ucm/main.c -+++ b/src/ucm/main.c -@@ -61,11 +61,13 @@ static int check_identifier(const char *identifier, const char *prefix) - { - int len; - -- if (strcmp(identifier, prefix) == 0) -- return 1; - len = strlen(prefix); -- if (memcmp(identifier, prefix, len) == 0 && identifier[len] == '/') -+ if (strncmp(identifier, prefix, len) != 0) -+ return 0; -+ -+ if (identifier[len] == 0 || identifier[len] == '/') - return 1; -+ - return 0; - } - --- -2.24.1 - - -From 9baf64da2f26844434ecea4825052937a3abe06c Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 29 Nov 2019 22:28:26 +0100 -Subject: [PATCH 02/69] ucm: return always at least NULL if no list is - available in snd_use_case_get_list() - -Signed-off-by: Jaroslav Kysela ---- - src/ucm/main.c | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/src/ucm/main.c b/src/ucm/main.c -index 252e50d9..b80db65f 100644 ---- a/src/ucm/main.c -+++ b/src/ucm/main.c -@@ -1160,8 +1160,10 @@ static int get_supcon_device_list(snd_use_case_mgr_t *uc_mgr, - - modifier = find_modifier(uc_mgr, verb, name, 0); - if (modifier) { -- if (modifier->dev_list.type != type) -+ if (modifier->dev_list.type != type) { -+ *list = NULL; - return 0; -+ } - return get_list(&modifier->dev_list.list, list, - struct dev_list_node, list, - name); -@@ -1169,8 +1171,10 @@ static int get_supcon_device_list(snd_use_case_mgr_t *uc_mgr, - - device = find_device(uc_mgr, verb, name, 0); - if (device) { -- if (device->dev_list.type != type) -+ if (device->dev_list.type != type) { -+ *list = NULL; - return 0; -+ } - return get_list(&device->dev_list.list, list, - struct dev_list_node, list, - name); --- -2.24.1 - - -From ebdd2b6cdb8119cf75f0dd0a3b283d271b3a547e Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Sat, 30 Nov 2019 20:31:55 +0100 -Subject: [PATCH 03/69] ucm: add _identifiers list - -Signed-off-by: Jaroslav Kysela ---- - include/use-case.h | 1 + - src/ucm/main.c | 268 ++++++++++++++++++++++++++++++++++----------- - 2 files changed, 208 insertions(+), 61 deletions(-) - -diff --git a/include/use-case.h b/include/use-case.h -index 8e7e838c..85c58ac0 100644 ---- a/include/use-case.h -+++ b/include/use-case.h -@@ -206,6 +206,7 @@ int snd_use_case_free_list(const char *list[], int items); - * - _enadevs - get list of enabled devices - * - _enamods - get list of enabled modifiers - * -+ * - _identifiers/{modifier}|{device}[/{verb}] - list of value identifiers - * - _supporteddevs/{modifier}|{device}[/{verb}] - list of supported devices - * - _conflictingdevs/{modifier}|{device}[/{verb}] - list of conflicting devices - * -diff --git a/src/ucm/main.c b/src/ucm/main.c -index b80db65f..d2078a23 100644 ---- a/src/ucm/main.c -+++ b/src/ucm/main.c -@@ -1072,7 +1072,6 @@ int snd_use_case_mgr_reset(snd_use_case_mgr_t *uc_mgr) - /** - * \brief Get list of verbs in pair verbname+comment - * \param list Returned list -- * \param verbname For verb (NULL = current) - * \return Number of list entries if success, otherwise a negative error code - */ - static int get_verb_list(snd_use_case_mgr_t *uc_mgr, const char **list[]) -@@ -1181,7 +1180,6 @@ static int get_supcon_device_list(snd_use_case_mgr_t *uc_mgr, - } - - return -ENOENT; -- - } - - /** -@@ -1210,41 +1208,201 @@ static int get_conflicting_device_list(snd_use_case_mgr_t *uc_mgr, - - #ifndef DOC_HIDDEN - struct myvalue { -- struct list_head list; -- char *value; -+ struct list_head list; -+ const char *text; - }; - #endif - -+/** -+ * \brief Convert myvalue list string list -+ * \param list myvalue list -+ * \param res string list -+ * \retval Number of list entries if success, otherwise a negativer error code -+ */ -+static int myvalue_to_str_list(struct list_head *list, char ***res) -+{ -+ struct list_head *pos; -+ struct myvalue *value; -+ char **p; -+ int cnt; -+ -+ cnt = alloc_str_list(list, 1, res); -+ if (cnt < 0) -+ return cnt; -+ p = *res; -+ list_for_each(pos, list) { -+ value = list_entry(pos, struct myvalue, list); -+ *p = strdup(value->text); -+ if (*p == NULL) { -+ snd_use_case_free_list((const char **)p, cnt); -+ return -ENOMEM; -+ } -+ p++; -+ } -+ return cnt; -+} -+ -+/** -+ * \brief Free myvalue list -+ * \param list myvalue list -+ */ -+static void myvalue_list_free(struct list_head *list) -+{ -+ struct list_head *pos, *npos; -+ struct myvalue *value; -+ -+ list_for_each_safe(pos, npos, list) { -+ value = list_entry(pos, struct myvalue, list); -+ list_del(&value->list); -+ free(value); -+ } -+} -+ -+/** -+ * \brief Merge one value to the myvalue list -+ * \param list The list with values -+ * \param value The value to be merged (without duplicates) -+ * \return 1 if dup, 0 if success, otherwise a negative error code -+ */ -+static int merge_value(struct list_head *list, const char *text) -+{ -+ struct list_head *pos; -+ struct myvalue *value; -+ -+ list_for_each(pos, list) { -+ value = list_entry(pos, struct myvalue, list); -+ if (strcmp(value->text, text) == 0) -+ return 1; -+ } -+ value = malloc(sizeof(*value)); -+ if (value == NULL) -+ return -ENOMEM; -+ value->text = text; -+ list_add_tail(&value->list, list); -+ return 0; -+} -+ -+/** -+ * \brief Find all values for given identifier -+ * \param list Returned list -+ * \param source Source list with ucm_value structures -+ * \return Zero if success, otherwise a negative error code -+ */ -+static int add_identifiers(struct list_head *list, -+ struct list_head *source) -+{ -+ struct ucm_value *v; -+ struct list_head *pos; -+ int err; -+ -+ list_for_each(pos, source) { -+ v = list_entry(pos, struct ucm_value, list); -+ err = merge_value(list, v->name); -+ if (err < 0) -+ return err; -+ } -+ return 0; -+} -+ -+/** -+ * \brief Find all values for given identifier -+ * \param list Returned list -+ * \param identifier Identifier -+ * \param source Source list with ucm_value structures -+ */ - static int add_values(struct list_head *list, - const char *identifier, - struct list_head *source) - { -- struct ucm_value *v; -- struct myvalue *val; -- struct list_head *pos, *pos1; -- int match; -+ struct ucm_value *v; -+ struct list_head *pos; -+ int err; - -- list_for_each(pos, source) { -- v = list_entry(pos, struct ucm_value, list); -- if (check_identifier(identifier, v->name)) { -- match = 0; -- list_for_each(pos1, list) { -- val = list_entry(pos1, struct myvalue, list); -- if (strcmp(val->value, v->data) == 0) { -- match = 1; -- break; -- } -- } -- if (!match) { -- val = malloc(sizeof(struct myvalue)); -- if (val == NULL) -- return -ENOMEM; -- val->value = v->data; -- list_add_tail(&val->list, list); -- } -- } -- } -- return 0; -+ list_for_each(pos, source) { -+ v = list_entry(pos, struct ucm_value, list); -+ if (check_identifier(identifier, v->name)) { -+ err = merge_value(list, v->data); -+ if (err < 0) -+ return err; -+ } -+ } -+ return 0; -+} -+ -+/** -+ * \brief compare two identifiers -+ */ -+static int identifier_cmp(const void *_a, const void *_b) -+{ -+ const char * const *a = _a; -+ const char * const *b = _b; -+ return strcmp(*a, *b); -+} -+ -+/** -+ * \brief Get list of available identifiers -+ * \param list Returned list -+ * \param name Name of verb or modifier to query -+ * \return Number of list entries if success, otherwise a negative error code -+ */ -+static int get_identifiers_list(snd_use_case_mgr_t *uc_mgr, -+ const char **list[], char *name) -+{ -+ struct use_case_verb *verb; -+ struct use_case_modifier *modifier; -+ struct use_case_device *device; -+ struct list_head mylist; -+ struct list_head *value_list; -+ char *str, **res; -+ int err; -+ -+ if (!name) -+ return -ENOENT; -+ -+ str = strchr(name, '/'); -+ if (str) { -+ *str = '\0'; -+ verb = find_verb(uc_mgr, str + 1); -+ } -+ else { -+ verb = uc_mgr->active_verb; -+ } -+ if (!verb) -+ return -ENOENT; -+ -+ value_list = NULL; -+ modifier = find_modifier(uc_mgr, verb, name, 0); -+ if (modifier) { -+ value_list = &modifier->value_list; -+ } else { -+ device = find_device(uc_mgr, verb, name, 0); -+ if (device) -+ value_list = &device->value_list; -+ } -+ if (value_list == NULL) -+ return -ENOENT; -+ -+ INIT_LIST_HEAD(&mylist); -+ err = add_identifiers(&mylist, &uc_mgr->value_list); -+ if (err < 0) -+ goto __fail; -+ err = add_identifiers(&mylist, &verb->value_list); -+ if (err < 0) -+ goto __fail; -+ err = add_identifiers(&mylist, value_list); -+ if (err < 0) -+ goto __fail; -+ err = myvalue_to_str_list(&mylist, &res); -+ if (err > 0) -+ *list = (const char **)res; -+ else if (err == 0) -+ *list = NULL; -+__fail: -+ myvalue_list_free(&mylist); -+ if (err <= 0) -+ return err; -+ qsort(*list, err, sizeof(char *), identifier_cmp); -+ return err; - } - - /** -@@ -1258,8 +1416,7 @@ static int get_value_list(snd_use_case_mgr_t *uc_mgr, - const char **list[], - char *verbname) - { -- struct list_head mylist, *pos, *npos; -- struct myvalue *val; -+ struct list_head mylist, *pos; - struct use_case_verb *verb; - struct use_case_device *dev; - struct use_case_modifier *mod; -@@ -1292,26 +1449,13 @@ static int get_value_list(snd_use_case_mgr_t *uc_mgr, - if (err < 0) - goto __fail; - } -- err = alloc_str_list(&mylist, 1, &res); -- if (err >= 0) { -+ err = myvalue_to_str_list(&mylist, &res); -+ if (err > 0) - *list = (const char **)res; -- list_for_each(pos, &mylist) { -- val = list_entry(pos, struct myvalue, list); -- *res = strdup(val->value); -- if (*res == NULL) { -- snd_use_case_free_list((const char **)res, err); -- err = -ENOMEM; -- goto __fail; -- } -- res++; -- } -- } -+ else if (err == 0) -+ *list = NULL; - __fail: -- list_for_each_safe(pos, npos, &mylist) { -- val = list_entry(pos, struct myvalue, list); -- list_del(&val->list); -- free(val); -- } -+ myvalue_list_free(&mylist); - return err; - } - -@@ -1381,21 +1525,23 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, - } else { - str = NULL; - } -- if (check_identifier(identifier, "_devices")) -- err = get_device_list(uc_mgr, list, str); -+ if (check_identifier(identifier, "_devices")) -+ err = get_device_list(uc_mgr, list, str); - else if (check_identifier(identifier, "_modifiers")) -- err = get_modifier_list(uc_mgr, list, str); -- else if (check_identifier(identifier, "_supporteddevs")) -- err = get_supported_device_list(uc_mgr, list, str); -- else if (check_identifier(identifier, "_conflictingdevs")) -- err = get_conflicting_device_list(uc_mgr, list, str); -+ err = get_modifier_list(uc_mgr, list, str); -+ else if (check_identifier(identifier, "_identifiers")) -+ err = get_identifiers_list(uc_mgr, list, str); -+ else if (check_identifier(identifier, "_supporteddevs")) -+ err = get_supported_device_list(uc_mgr, list, str); -+ else if (check_identifier(identifier, "_conflictingdevs")) -+ err = get_conflicting_device_list(uc_mgr, list, str); - else if (identifier[0] == '_') - err = -ENOENT; -- else -- err = get_value_list(uc_mgr, identifier, list, str); -- if (str) -- free(str); -- } -+ else -+ err = get_value_list(uc_mgr, identifier, list, str); -+ if (str) -+ free(str); -+ } - __end: - pthread_mutex_unlock(&uc_mgr->mutex); - return err; --- -2.24.1 - - -From 5ee5ef31b5ff3fb7c904054cb9cac7478a727f7c Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Sun, 1 Dec 2019 14:26:40 +0100 -Subject: [PATCH 04/69] namehint: correct the @args check - -BugLink: https://github.com/alsa-project/alsa-plugins/issues/3 -Signed-off-by: Jaroslav Kysela ---- - src/control/namehint.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/src/control/namehint.c b/src/control/namehint.c -index 808df6b5..4927ef97 100644 ---- a/src/control/namehint.c -+++ b/src/control/namehint.c -@@ -348,6 +348,12 @@ static int try_config(snd_config_t *config, - goto __cleanup; - if (snd_config_search(res, "@args", &cfg) >= 0) { - snd_config_for_each(i, next, cfg) { -+ /* skip the argument list */ -+ snd_config_get_id(snd_config_iterator_entry(i), &str); -+ while (*str && *str >= '0' && *str <= '9') str++; -+ if (*str == '\0') -+ continue; -+ /* the argument definition must have the default */ - if (snd_config_search(snd_config_iterator_entry(i), - "default", NULL) < 0) { - err = -EINVAL; --- -2.24.1 - - -From 6055f8a584296abfc0cec0439ceb708f0eddcc9d Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Sun, 1 Dec 2019 14:30:54 +0100 -Subject: [PATCH 05/69] namehint: improve the previous patch (check the - returned value) - -Signed-off-by: Jaroslav Kysela ---- - src/control/namehint.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/src/control/namehint.c b/src/control/namehint.c -index 4927ef97..60c48ae3 100644 ---- a/src/control/namehint.c -+++ b/src/control/namehint.c -@@ -349,7 +349,8 @@ static int try_config(snd_config_t *config, - if (snd_config_search(res, "@args", &cfg) >= 0) { - snd_config_for_each(i, next, cfg) { - /* skip the argument list */ -- snd_config_get_id(snd_config_iterator_entry(i), &str); -+ if (snd_config_get_id(snd_config_iterator_entry(i), &str) < 0) -+ continue; - while (*str && *str >= '0' && *str <= '9') str++; - if (*str == '\0') - continue; --- -2.24.1 - - -From 4dddcf733d56a13f4d042fefa1fb6230c09f1f65 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Mon, 2 Dec 2019 11:56:30 +0100 -Subject: [PATCH 06/69] ucm: docs - allow spaces in device names for JackHWMute - -Signed-off-by: Jaroslav Kysela ---- - include/use-case.h | 25 +++++++++++++------------ - 1 file changed, 13 insertions(+), 12 deletions(-) - -diff --git a/include/use-case.h b/include/use-case.h -index 85c58ac0..e1f58027 100644 ---- a/include/use-case.h -+++ b/include/use-case.h -@@ -326,7 +326,7 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, - * - Valid values: "soft" (software attenuation) - * - EDIDFile - * - Path to EDID file for HDMI devices -- * - JackControl, JackDev, JackHWMute -+ * - JackControl, JackDev - * - Jack information for a device. The jack status can be reported via - * a kcontrol and/or via an input device. **JackControl** is the - * kcontrol name of the jack, and **JackDev** is the input device id of -@@ -334,17 +334,18 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, - * JackDev value should be "foo"). UCM configuration files should - * contain both JackControl and JackDev when possible, because - * applications are likely to support only one or the other. -- * -- * If **JackHWMute** is set, it indicates that when the jack is plugged -- * in, the hardware automatically mutes some other device(s). The -- * JackHWMute value is a space-separated list of device names (this -- * isn't compatible with device names with spaces in them, so don't use -- * such device names!). Note that JackHWMute should be used only when -- * the hardware enforces the automatic muting. If the hardware doesn't -- * enforce any muting, it may still be tempting to set JackHWMute to -- * trick upper software layers to e.g. automatically mute speakers when -- * headphones are plugged in, but that's application policy -- * configuration that doesn't belong to UCM configuration files. -+ * - JackHWMute -+ * If this value is set, it indicates that when the jack is plugged -+ * in, the hardware automatically mutes some other device(s). The -+ * value is a space-separated list of device names. If the device -+ * name contains space, it must be enclosed to ' or ", e.g.: -+ * JackHWMute "'Dock Headphone' Headphone" -+ * Note that JackHWMute should be used only when the hardware enforces -+ * the automatic muting. If the hardware doesn't enforce any muting, it -+ * may still be tempting to set JackHWMute to trick upper software layers -+ * to e.g. automatically mute speakers when headphones are plugged in, -+ * but that's application policy configuration that doesn't belong -+ * to UCM configuration files. - * - MinBufferLevel - * - This is used on platform where reported buffer level is not accurate. - * E.g. "512", which holds 512 samples in device buffer. Note: this will --- -2.24.1 - - -From 2a286ca9a8415571181ce58027686ec332a834e9 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Mon, 2 Dec 2019 11:57:18 +0100 -Subject: [PATCH 07/69] use-case: docs - add PlaybackMixerCopy and - CaptureMixerCopy - -Signed-off-by: Jaroslav Kysela ---- - include/use-case.h | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/include/use-case.h b/include/use-case.h -index e1f58027..71fcc949 100644 ---- a/include/use-case.h -+++ b/include/use-case.h -@@ -309,8 +309,14 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, - * - PlaybackMixerElem - * - mixer element playback identifier - * - can be parsed using snd_use_case_parse_selem_id() -+ * - PlaybackMixerCopy -+ * - additional mixer element playback identifier -+ * - can be parsed using snd_use_case_parse_selem_id() -+ * - those elements should copy the volume and switch settings -+ * - element identifiers are separated using the | character - * - PlaybackMasterElem - * - mixer element playback identifier for the master control -+ * - can be parsed using snd_use_case_parse_selem_id() - * - PlaybackMasterType - * - type of the master volume control - * - Valid values: "soft" (software attenuation) -@@ -319,8 +325,14 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, - * - CaptureMixerElem - * - mixer element capture identifier - * - can be parsed using snd_use_case_parse_selem_id() -+ * - CaptureMixerCopy -+ * - additional mixer element capture identifier -+ * - can be parsed using snd_use_case_parse_selem_id() -+ * - those elements should copy the volume and switch settings -+ * - element identifiers are separated using the | character - * - CaptureMasterElem - * - mixer element playback identifier for the master control -+ * - can be parsed using snd_use_case_parse_selem_id() - * - CaptureMasterType - * - type of the master volume control - * - Valid values: "soft" (software attenuation) --- -2.24.1 - - -From a0fc4447bb7c7f9a850a0a85f3a5a32c1509caf4 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 3 Dec 2019 15:01:04 +0100 -Subject: [PATCH 08/69] ucm: docs - add JackCTL, rearrange JackControl and - JackDev - -Signed-off-by: Jaroslav Kysela ---- - include/use-case.h | 22 ++++++++++++++-------- - 1 file changed, 14 insertions(+), 8 deletions(-) - -diff --git a/include/use-case.h b/include/use-case.h -index 71fcc949..25998cb9 100644 ---- a/include/use-case.h -+++ b/include/use-case.h -@@ -338,14 +338,20 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, - * - Valid values: "soft" (software attenuation) - * - EDIDFile - * - Path to EDID file for HDMI devices -- * - JackControl, JackDev -- * - Jack information for a device. The jack status can be reported via -- * a kcontrol and/or via an input device. **JackControl** is the -- * kcontrol name of the jack, and **JackDev** is the input device id of -- * the jack (if the full input device path is /dev/input/by-id/foo, the -- * JackDev value should be "foo"). UCM configuration files should -- * contain both JackControl and JackDev when possible, because -- * applications are likely to support only one or the other. -+ * - JackCTL -+ * - jack control device name -+ * - JackControl -+ * - jack control identificator -+ * - can be parsed using snd_use_case_parse_ctl_elem_id() -+ * - UCM configuration files should contain both JackControl and JackDev -+ * when possible, because applications are likely to support only one -+ * or the other -+ * - JackDev -+ * - the input device id of the jack (if the full input device path is -+ * /dev/input/by-id/foo, the JackDev value should be "foo") -+ * - UCM configuration files should contain both JackControl and JackDev -+ * when possible, because applications are likely to support only one -+ * or the other - * - JackHWMute - * If this value is set, it indicates that when the jack is plugged - * in, the hardware automatically mutes some other device(s). The --- -2.24.1 - - -From e59034a0bec257cc7422a1e9436d936be8696a6f Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Tue, 3 Dec 2019 18:27:39 +0100 -Subject: [PATCH 09/69] ucm: Do not fail to parse configs on cards with an - empty CardComponents lists - -Since the UCM profiles for all Bay- and Cherry-Trail SST cards have been -moved over to UCM2, parsing them fails with: - -ALSA lib ucm_subs.c:220:(uc_mgr_get_substituted_value) variable '${CardComponents}' is not defined in this context! - -This completely breaks audio support on all Bay- and Cherry-Trail devices. - -This is caused by these non-SOF ASoC using cards having an empty -CardComponents list. Which in itself is fine, but is rejected by -the ucm_subs.c code. This commit changes the ucm_subs code to accept -an empty string as a valid value for CardComponents restoring audio -functionality on these boards. - -Signed-off-by: Hans de Goede -Signed-off-by: Jaroslav Kysela ---- - src/ucm/ucm_subs.c | 20 ++++++++++++-------- - 1 file changed, 12 insertions(+), 8 deletions(-) - -diff --git a/src/ucm/ucm_subs.c b/src/ucm/ucm_subs.c -index 00afa9e3..90e395f0 100644 ---- a/src/ucm/ucm_subs.c -+++ b/src/ucm/ucm_subs.c -@@ -25,6 +25,7 @@ - */ - - #include "ucm_local.h" -+#include - #include - #include - -@@ -145,10 +146,11 @@ static char *rval_sysfs(snd_use_case_mgr_t *uc_mgr ATTRIBUTE_UNUSED, const char - return strdup(path); - } - --#define MATCH_VARIABLE(name, id, fcn) \ -+#define MATCH_VARIABLE(name, id, fcn, empty_ok) \ - if (strncmp((name), (id), sizeof(id) - 1) == 0) { \ - rval = fcn(uc_mgr); \ - idsize = sizeof(id) - 1; \ -+ allow_empty = (empty_ok); \ - goto __rval; \ - } - -@@ -189,12 +191,14 @@ int uc_mgr_get_substituted_value(snd_use_case_mgr_t *uc_mgr, - - while (*value) { - if (*value == '$' && *(value+1) == '{') { -- MATCH_VARIABLE(value, "${ConfName}", rval_conf_name); -- MATCH_VARIABLE(value, "${CardId}", rval_card_id); -- MATCH_VARIABLE(value, "${CardDriver}", rval_card_driver); -- MATCH_VARIABLE(value, "${CardName}", rval_card_name); -- MATCH_VARIABLE(value, "${CardLongName}", rval_card_longname); -- MATCH_VARIABLE(value, "${CardComponents}", rval_card_components); -+ bool allow_empty = false; -+ -+ MATCH_VARIABLE(value, "${ConfName}", rval_conf_name, false); -+ MATCH_VARIABLE(value, "${CardId}", rval_card_id, false); -+ MATCH_VARIABLE(value, "${CardDriver}", rval_card_driver, false); -+ MATCH_VARIABLE(value, "${CardName}", rval_card_name, false); -+ MATCH_VARIABLE(value, "${CardLongName}", rval_card_longname, false); -+ MATCH_VARIABLE(value, "${CardComponents}", rval_card_components, true); - MATCH_VARIABLE2(value, "${env:", rval_env); - MATCH_VARIABLE2(value, "${sys:", rval_sysfs); - err = -EINVAL; -@@ -208,7 +212,7 @@ int uc_mgr_get_substituted_value(snd_use_case_mgr_t *uc_mgr, - } - goto __error; - __rval: -- if (rval == NULL || rval[0] == '\0') { -+ if (rval == NULL || (!allow_empty && rval[0] == '\0')) { - free(rval); - strncpy(r, value, idsize); - r[idsize] = '\0'; --- -2.24.1 - - -From 8e2c70add782f997f7c269ed3f722888e56ff024 Mon Sep 17 00:00:00 2001 -From: Fabrice Fontaine -Date: Tue, 3 Dec 2019 18:56:40 +0100 -Subject: [PATCH 10/69] src/ucm/main.c: fix build without mixer - -Commit 4ce38a5ff466d18039b2606938f866ea3a6c9f3c breaks the build without -mixer on: - - CCLD libasound.la -/home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/8.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: ucm/.libs/libucm.a(main.o): in function `snd_use_case_set': -main.c:(.text+0x185c): undefined reference to `snd_mixer_selem_id_parse' - -Fixes: http://autobuild.buildroot.org/results/4d91c9f82a2a61c50c457a851073b85cc09ea345 - -Signed-off-by: Fabrice Fontaine -Signed-off-by: Jaroslav Kysela ---- - src/ucm/main.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/ucm/main.c b/src/ucm/main.c -index d2078a23..61922f10 100644 ---- a/src/ucm/main.c -+++ b/src/ucm/main.c -@@ -2115,8 +2115,10 @@ int snd_use_case_parse_selem_id(snd_mixer_selem_id_t *dst, - const char *ucm_id, - const char *value) - { -+#ifdef BUILD_MIXER - if (strcmp(ucm_id, "PlaybackMixerId") == 0 || - strcmp(ucm_id, "CaptureMixerId") == 0) - return snd_mixer_selem_id_parse(dst, value); -+#endif - return -EINVAL; - } --- -2.24.1 - - -From ad8527d81b09c4d0edd054b5b1468ce1c50b23cb Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 4 Dec 2019 09:49:40 +0100 -Subject: [PATCH 11/69] alsa.m4: another try to fix the libatopology detection - -Signed-off-by: Jaroslav Kysela ---- - utils/alsa.m4 | 11 +++++++++-- - 1 file changed, 9 insertions(+), 2 deletions(-) - -diff --git a/utils/alsa.m4 b/utils/alsa.m4 -index 4c457f0d..320e4336 100644 ---- a/utils/alsa.m4 -+++ b/utils/alsa.m4 -@@ -22,6 +22,7 @@ alsa_save_CFLAGS="$CFLAGS" - alsa_save_LDFLAGS="$LDFLAGS" - alsa_save_LIBS="$LIBS" - alsa_found=yes -+alsa_topology_found=no - - dnl - dnl Get the cflags and libraries for alsa -@@ -158,11 +159,17 @@ AC_CHECK_LIB([asound], [snd_ctl_open],, - alsa_found=no] - ) - if test "x$enable_atopology" = "xyes"; then -+alsa_topology_found=yes - AC_CHECK_LIB([atopology], [snd_tplg_new],, - [ifelse([$3], , [AC_MSG_ERROR(No linkable libatopology was found.)]) -- alsa_found=no] -+ alsa_topology_found=no, -+] - ) - fi -+else -+if test "x$enable_atopology" = "xyes"; then -+ alsa_topology_found=yes -+fi - fi - - if test "x$alsa_found" = "xyes" ; then -@@ -183,7 +190,7 @@ fi - - dnl add the alsa topology library; must be at the end - AC_MSG_CHECKING(for ALSA topology LDFLAGS) --if test "x$enable_atopology" = "xyes"; then -+if test "x$alsa_topology_found" = "xyes"; then - ALSA_TOPOLOGY_LIBS="$ALSA_TOPOLOGY_LIBS -latopology" - fi - AC_MSG_RESULT($ALSA_TOPOLOGY_LIBS) --- -2.24.1 - - -From 555a5dbdabc5ed3be1ca81865abdb997bc3a6082 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Thu, 5 Dec 2019 16:59:05 +0100 -Subject: [PATCH 12/69] ucm: docs - add Mic/DigitalMic and multiple devices - comments - -Signed-off-by: Jaroslav Kysela ---- - include/use-case.h | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/include/use-case.h b/include/use-case.h -index 25998cb9..1736da25 100644 ---- a/include/use-case.h -+++ b/include/use-case.h -@@ -114,10 +114,18 @@ extern "C" { - * - * Physical system devices the render and capture audio. Devices can be OR'ed - * together to support audio on simultaneous devices. -+ * -+ * If multiple devices with the same name exists, the number suffixes should -+ * be added to these names like HDMI1,HDMI2,HDMI3 etc. No number gaps are -+ * allowed. The names with numbers must be continuous. -+ * -+ * The preference of the devices is determined by the priority value. - */ - #define SND_USE_CASE_DEV_NONE "None" /**< None Device */ - #define SND_USE_CASE_DEV_SPEAKER "Speaker" /**< Speaker Device */ - #define SND_USE_CASE_DEV_LINE "Line" /**< Line Device */ -+#define SND_USE_CASE_DEV_MIC "Mic" /**< Integrated Analog Microphone */ -+#define SND_USE_CASE_DEV_DIGITAL_MIC "DigitalMic" /**< Integrated Digital Microphone */ - #define SND_USE_CASE_DEV_HEADPHONES "Headphones" /**< Headphones Device */ - #define SND_USE_CASE_DEV_HEADSET "Headset" /**< Headset Device */ - #define SND_USE_CASE_DEV_HANDSET "Handset" /**< Handset Device */ --- -2.24.1 - - -From 1ad660ddeecb2a364f1ca62aa60f256f7029cfdc Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Thu, 5 Dec 2019 17:01:31 +0100 -Subject: [PATCH 13/69] ucm: docs - remove DigitalMic, it does not have sense - -Signed-off-by: Jaroslav Kysela ---- - include/use-case.h | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/include/use-case.h b/include/use-case.h -index 1736da25..214a2a4c 100644 ---- a/include/use-case.h -+++ b/include/use-case.h -@@ -124,8 +124,7 @@ extern "C" { - #define SND_USE_CASE_DEV_NONE "None" /**< None Device */ - #define SND_USE_CASE_DEV_SPEAKER "Speaker" /**< Speaker Device */ - #define SND_USE_CASE_DEV_LINE "Line" /**< Line Device */ --#define SND_USE_CASE_DEV_MIC "Mic" /**< Integrated Analog Microphone */ --#define SND_USE_CASE_DEV_DIGITAL_MIC "DigitalMic" /**< Integrated Digital Microphone */ -+#define SND_USE_CASE_DEV_MIC "Mic" /**< Integrated Microphone */ - #define SND_USE_CASE_DEV_HEADPHONES "Headphones" /**< Headphones Device */ - #define SND_USE_CASE_DEV_HEADSET "Headset" /**< Headset Device */ - #define SND_USE_CASE_DEV_HANDSET "Handset" /**< Handset Device */ --- -2.24.1 - - -From 5473c5d677915b88d5c93d5bcc6cd16bb6a40342 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Thu, 5 Dec 2019 17:19:06 +0100 -Subject: [PATCH 14/69] ucm: docs - change the Mic description to simple - Microphone Device - -Signed-off-by: Jaroslav Kysela ---- - include/use-case.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/include/use-case.h b/include/use-case.h -index 214a2a4c..b04f7b9d 100644 ---- a/include/use-case.h -+++ b/include/use-case.h -@@ -124,7 +124,7 @@ extern "C" { - #define SND_USE_CASE_DEV_NONE "None" /**< None Device */ - #define SND_USE_CASE_DEV_SPEAKER "Speaker" /**< Speaker Device */ - #define SND_USE_CASE_DEV_LINE "Line" /**< Line Device */ --#define SND_USE_CASE_DEV_MIC "Mic" /**< Integrated Microphone */ -+#define SND_USE_CASE_DEV_MIC "Mic" /**< Microphone Device */ - #define SND_USE_CASE_DEV_HEADPHONES "Headphones" /**< Headphones Device */ - #define SND_USE_CASE_DEV_HEADSET "Headset" /**< Headset Device */ - #define SND_USE_CASE_DEV_HANDSET "Handset" /**< Handset Device */ --- -2.24.1 - - -From ca67e823833213e140a09ce43b6399b7676616df Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 6 Dec 2019 11:11:54 +0100 -Subject: [PATCH 15/69] ucm: docs - add note about the sequences and device - split - -Signed-off-by: Jaroslav Kysela ---- - include/use-case.h | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/include/use-case.h b/include/use-case.h -index b04f7b9d..2efcb4d8 100644 ---- a/include/use-case.h -+++ b/include/use-case.h -@@ -119,6 +119,11 @@ extern "C" { - * be added to these names like HDMI1,HDMI2,HDMI3 etc. No number gaps are - * allowed. The names with numbers must be continuous. - * -+ * If EnableSequence/DisableSequence controls independent paths in the hardware -+ * it is also recommended to split playback and capture UCM devices and use -+ * the number suffixes. Example use case: Use the integrated microphone -+ * in the laptop instead the microphone in headphones. -+ * - * The preference of the devices is determined by the priority value. - */ - #define SND_USE_CASE_DEV_NONE "None" /**< None Device */ --- -2.24.1 - - -From f828dfe549fbab0a920768c63ebd3478272954eb Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 10 Dec 2019 11:48:06 +0100 -Subject: [PATCH 16/69] ucm: docs - remove MixerCopy values, add Priority for - verb, improve priority docs - -Signed-off-by: Jaroslav Kysela ---- - include/use-case.h | 18 ++++++------------ - 1 file changed, 6 insertions(+), 12 deletions(-) - -diff --git a/include/use-case.h b/include/use-case.h -index 2efcb4d8..134303af 100644 ---- a/include/use-case.h -+++ b/include/use-case.h -@@ -274,6 +274,10 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, - * Recommended names for values: - * - TQ - * - Tone Quality -+ * - Priority -+ * - priority value (1-10000), higher value means higher priority -+ * - valid only for verbs -+ * - for devices - PlaybackPriority and CapturePriority - * - PlaybackPCM - * - full PCM playback device name - * - PlaybackPCMIsDummy -@@ -301,7 +305,7 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, - * - playback control switch identifier string - * - can be parsed using snd_use_case_parse_ctl_elem_id() - * - PlaybackPriority -- * - priority value (1-10000), default value is 100, higher value means lower priority -+ * - priority value (1-10000), higher value means higher priority - * - CaptureRate - * - capture device sample rate - * - CaptureChannels -@@ -315,17 +319,12 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, - * - capture control switch identifier string - * - can be parsed using snd_use_case_parse_ctl_elem_id() - * - CapturePriority -- * - priority value (1-10000), default value is 100, higher value means lower priority -+ * - priority value (1-10000), higher value means higher priority - * - PlaybackMixer - * - name of playback mixer - * - PlaybackMixerElem - * - mixer element playback identifier - * - can be parsed using snd_use_case_parse_selem_id() -- * - PlaybackMixerCopy -- * - additional mixer element playback identifier -- * - can be parsed using snd_use_case_parse_selem_id() -- * - those elements should copy the volume and switch settings -- * - element identifiers are separated using the | character - * - PlaybackMasterElem - * - mixer element playback identifier for the master control - * - can be parsed using snd_use_case_parse_selem_id() -@@ -337,11 +336,6 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, - * - CaptureMixerElem - * - mixer element capture identifier - * - can be parsed using snd_use_case_parse_selem_id() -- * - CaptureMixerCopy -- * - additional mixer element capture identifier -- * - can be parsed using snd_use_case_parse_selem_id() -- * - those elements should copy the volume and switch settings -- * - element identifiers are separated using the | character - * - CaptureMasterElem - * - mixer element playback identifier for the master control - * - can be parsed using snd_use_case_parse_selem_id() --- -2.24.1 - - -From 1744159180ac94a72036d7232e674c58cedee70a Mon Sep 17 00:00:00 2001 -From: Libin Yang -Date: Wed, 11 Dec 2019 14:07:19 +0800 -Subject: [PATCH 17/69] ucm: setup conf_format after getting - ALSA_CONFIG_UCM_VAR successfully - -Set the conf_format to 1 after getting ALSA_CONFIG_UCM_VAR successfully. -Otherwise, the conf_format is not set in this scenario. - -Signed-off-by: Libin Yang -Signed-off-by: Jaroslav Kysela ---- - src/ucm/parser.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/ucm/parser.c b/src/ucm/parser.c -index ba500277..d61124a3 100644 ---- a/src/ucm/parser.c -+++ b/src/ucm/parser.c -@@ -89,6 +89,8 @@ static void configuration_filename(snd_use_case_mgr_t *uc_mgr, - env = getenv(ALSA_CONFIG_UCM2_VAR); - if (env == NULL) { - env = getenv(ALSA_CONFIG_UCM_VAR); -+ if (env) -+ uc_mgr->conf_format = 1; - } else { - uc_mgr->conf_format = 2; - } --- -2.24.1 - - -From 9980e18c3c99da42a90a98b140a0ffe7d0f92cd3 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Thu, 12 Dec 2019 18:42:33 +0100 -Subject: [PATCH 18/69] alsa-lib: fix the array parser (unique compound keys) - -The code from the old import may merge arrays wrongly and -the result is a compound with same keys like: - -Input: - - lines [ - "SSP0.OUT, , BUF1.3" - ] - lines [ - "BUF2.0, , SSP0.IN" - ] - -Parsed contents: - - lines { - 0 'SSP0.OUT, , BUF1.3' - 0 'BUF2.0, , SSP0.IN' - } - -Proper parsed contents (create+merge mode): - - lines { - 0 'SSP0.OUT, , BUF1.3' - 1 'BUF2.0, , SSP0.IN' - } - -Signed-off-by: Jaroslav Kysela ---- - src/conf.c | 20 +++++++++++++++++--- - 1 file changed, 17 insertions(+), 3 deletions(-) - -diff --git a/src/conf.c b/src/conf.c -index e4306504..3e753b26 100644 ---- a/src/conf.c -+++ b/src/conf.c -@@ -1226,7 +1226,7 @@ static int parse_value(snd_config_t **_n, snd_config_t *parent, input_t *input, - static int parse_defs(snd_config_t *parent, input_t *input, int skip, int override); - static int parse_array_defs(snd_config_t *farther, input_t *input, int skip, int override); - --static int parse_array_def(snd_config_t *parent, input_t *input, int idx, int skip, int override) -+static int parse_array_def(snd_config_t *parent, input_t *input, int *idx, int skip, int override) - { - char *id = NULL; - int c; -@@ -1234,8 +1234,21 @@ static int parse_array_def(snd_config_t *parent, input_t *input, int idx, int sk - snd_config_t *n = NULL; - - if (!skip) { -+ snd_config_t *g; - char static_id[12]; -- snprintf(static_id, sizeof(static_id), "%i", idx); -+ while (1) { -+ snprintf(static_id, sizeof(static_id), "%i", *idx); -+ if (_snd_config_search(parent, static_id, -1, &g) == 0) { -+ if (override) { -+ snd_config_delete(n); -+ } else { -+ /* merge */ -+ (*idx)++; -+ continue; -+ } -+ } -+ break; -+ } - id = strdup(static_id); - if (id == NULL) - return -ENOMEM; -@@ -1306,9 +1319,10 @@ static int parse_array_defs(snd_config_t *parent, input_t *input, int skip, int - unget_char(c, input); - if (c == ']') - return 0; -- err = parse_array_def(parent, input, idx++, skip, override); -+ err = parse_array_def(parent, input, &idx, skip, override); - if (err < 0) - return err; -+ idx++; - } - return 0; - } --- -2.24.1 - - -From 075ee165e647a6b434f63ca578f2f8faff2a55f6 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 13 Dec 2019 16:09:35 +0100 -Subject: [PATCH 19/69] topology: remove vendor_fd/name from snd_tplg structure - - not used - -Signed-off-by: Jaroslav Kysela ---- - src/topology/tplg_local.h | 5 ----- - 1 file changed, 5 deletions(-) - -diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h -index c32267d2..22648fa5 100644 ---- a/src/topology/tplg_local.h -+++ b/src/topology/tplg_local.h -@@ -60,11 +60,6 @@ typedef enum _snd_pcm_rates { - } snd_pcm_rates_t; - - struct snd_tplg { -- -- /* opaque vendor data */ -- int vendor_fd; -- char *vendor_name; -- - /* out file */ - int out_fd; - --- -2.24.1 - - -From ce74829db630a49569c79aea4aeb288fdd458dd8 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 13 Dec 2019 17:01:03 +0100 -Subject: [PATCH 20/69] topology: file position and size cleanups - -- try to use size_t/ssize_t -- track the position in own variable, do not use lseek - -Signed-off-by: Jaroslav Kysela ---- - src/topology/builder.c | 121 ++++++++++++++++++-------------------- - src/topology/tplg_local.h | 3 +- - 2 files changed, 60 insertions(+), 64 deletions(-) - -diff --git a/src/topology/builder.c b/src/topology/builder.c -index 5ae3ae89..4e6cbbb0 100644 ---- a/src/topology/builder.c -+++ b/src/topology/builder.c -@@ -23,28 +23,41 @@ - /* verbose output detailing each object size and file position */ - static void verbose(snd_tplg_t *tplg, const char *fmt, ...) - { -- int offset; - va_list va; - - if (!tplg->verbose) - return; - -- offset = lseek(tplg->out_fd, 0, SEEK_CUR); -- - va_start(va, fmt); -- fprintf(stdout, "0x%6.6x/%6.6d -", offset, offset); -+ fprintf(stdout, "0x%6.6zx/%6.6zd -", tplg->out_pos, tplg->out_pos); - vfprintf(stdout, fmt, va); - va_end(va); - } - -+/* write a block, track the position */ -+static ssize_t twrite(snd_tplg_t *tplg, void *data, size_t data_size) -+{ -+ ssize_t r = write(tplg->out_fd, data, data_size); -+ if (r != (ssize_t)data_size) { -+ if (r < 0) { -+ SNDERR("error: unable to write: %s", strerror(errno)); -+ return -errno; -+ } -+ tplg->out_pos += r; -+ SNDERR("error: unable to write (partial)"); -+ return -EIO; -+ } -+ tplg->out_pos += r; -+ return r; -+} -+ - /* write out block header to output file */ --static int write_block_header(snd_tplg_t *tplg, unsigned int type, -- unsigned int vendor_type, unsigned int version, unsigned int index, -- size_t payload_size, int count) -+static ssize_t write_block_header(snd_tplg_t *tplg, unsigned int type, -+ unsigned int vendor_type, -+ unsigned int version, unsigned int index, -+ size_t payload_size, int count) - { - struct snd_soc_tplg_hdr hdr; -- size_t bytes; -- int offset = lseek(tplg->out_fd, 0, SEEK_CUR); - - memset(&hdr, 0, sizeof(hdr)); - hdr.magic = SND_SOC_TPLG_MAGIC; -@@ -58,13 +71,13 @@ static int write_block_header(snd_tplg_t *tplg, unsigned int type, - hdr.count = count; - - /* make sure file offset is aligned with the calculated HDR offset */ -- if ((unsigned int)offset != tplg->next_hdr_pos) { -- SNDERR("error: New header is at offset 0x%x but file" -- " offset 0x%x is %s by %d bytes\n", -- tplg->next_hdr_pos, offset, -- (unsigned int)offset > tplg->next_hdr_pos ? "ahead" : "behind", -- abs(offset - tplg->next_hdr_pos)); -- exit(-EINVAL); -+ if (tplg->out_pos != tplg->next_hdr_pos) { -+ SNDERR("error: New header is at offset 0x%zx but file" -+ " offset 0x%zx is %s by %ld bytes\n", -+ tplg->next_hdr_pos, tplg->out_pos, -+ tplg->out_pos > tplg->next_hdr_pos ? "ahead" : "behind", -+ labs(tplg->out_pos - tplg->next_hdr_pos)); -+ return -EINVAL; - } - - verbose(tplg, " header index %d type %d count %d size 0x%lx/%ld vendor %d " -@@ -74,22 +87,16 @@ static int write_block_header(snd_tplg_t *tplg, unsigned int type, - - tplg->next_hdr_pos += hdr.payload_size + sizeof(hdr); - -- bytes = write(tplg->out_fd, &hdr, sizeof(hdr)); -- if (bytes != sizeof(hdr)) { -- SNDERR("error: can't write section header %lu\n", -- (long unsigned int)bytes); -- return bytes; -- } -- -- return bytes; -+ return twrite(tplg, &hdr, sizeof(hdr)); - } - - static int write_elem_block(snd_tplg_t *tplg, -- struct list_head *base, int size, int tplg_type, const char *obj_name) -+ struct list_head *base, size_t size, int tplg_type, const char *obj_name) - { - struct list_head *pos, *sub_pos, *sub_base; - struct tplg_elem *elem, *elem_next; -- int ret, wsize = 0, total_size = 0, count = 0, block_size = 0; -+ size_t total_size = 0, count = 0, block_size = 0; -+ ssize_t ret, wsize; - - sub_base = base; - list_for_each(pos, base) { -@@ -129,12 +136,9 @@ static int write_elem_block(snd_tplg_t *tplg, - elem->route->control, - elem->route->sink, elem->size); - -- wsize = write(tplg->out_fd, elem->obj, elem->size); -- if (wsize < 0) { -- SNDERR("error: failed to write %s %d\n", -- obj_name, ret); -- return ret; -- } -+ wsize = twrite(tplg, elem->obj, elem->size); -+ if (wsize < 0) -+ return size; - - total_size += wsize; - /* get to the end of sub list */ -@@ -151,7 +155,7 @@ static int write_elem_block(snd_tplg_t *tplg, - - /* make sure we have written the correct size */ - if (total_size != size) { -- SNDERR("error: size mismatch. Expected %d wrote %d\n", -+ SNDERR("error: size mismatch. Expected %zu wrote %zu\n", - size, total_size); - return -EIO; - } -@@ -179,8 +183,7 @@ static int calc_block_size(struct list_head *base) - return size; - } - --static int write_block(snd_tplg_t *tplg, struct list_head *base, -- int type) -+static int write_block(snd_tplg_t *tplg, struct list_head *base, int type) - { - int size; - -@@ -231,44 +234,36 @@ static int write_block(snd_tplg_t *tplg, struct list_head *base, - } - - /* write the manifest including its private data */ --static int write_manifest_data(snd_tplg_t *tplg) -+static ssize_t write_manifest_data(snd_tplg_t *tplg) - { -- int ret; -+ ssize_t ret; - - /* write the header for this block */ - ret = write_block_header(tplg, SND_SOC_TPLG_TYPE_MANIFEST, 0, - tplg->version, 0, - sizeof(tplg->manifest) + tplg->manifest.priv.size, 1); - if (ret < 0) { -- SNDERR("error: failed to write manifest block %d\n", ret); -+ SNDERR("error: failed to write manifest block\n"); - return ret; - } - - verbose(tplg, "manifest : write %d bytes\n", sizeof(tplg->manifest)); -- ret = write(tplg->out_fd, &tplg->manifest, sizeof(tplg->manifest)); -- if (ret < 0) { -- SNDERR("error: failed to write manifest %d\n", ret); -- return ret; -+ ret = twrite(tplg, &tplg->manifest, sizeof(tplg->manifest)); -+ if (ret >= 0) { -+ verbose(tplg, "manifest : write %d priv bytes\n", tplg->manifest.priv.size); -+ ret = twrite(tplg, tplg->manifest_pdata, tplg->manifest.priv.size); - } -- -- verbose(tplg, "manifest : write %d priv bytes\n", tplg->manifest.priv.size); -- ret = write(tplg->out_fd, tplg->manifest_pdata, tplg->manifest.priv.size); -- if (ret < 0) { -- SNDERR("error: failed to write manifest priv data %d\n", ret); -- return ret; -- } -- -- return 0; -+ return ret; - } - - int tplg_write_data(snd_tplg_t *tplg) - { -- int ret; -+ ssize_t ret; - - /* write manifest */ - ret = write_manifest_data(tplg); - if (ret < 0) { -- SNDERR("failed to write manifest %d\n", ret); -+ SNDERR("failed to write manifest %zd\n", ret); - return ret; - } - -@@ -276,7 +271,7 @@ int tplg_write_data(snd_tplg_t *tplg) - ret = write_block(tplg, &tplg->mixer_list, - SND_TPLG_TYPE_MIXER); - if (ret < 0) { -- SNDERR("failed to write control elems %d\n", ret); -+ SNDERR("failed to write control elems %zd\n", ret); - return ret; - } - -@@ -284,7 +279,7 @@ int tplg_write_data(snd_tplg_t *tplg) - ret = write_block(tplg, &tplg->enum_list, - SND_TPLG_TYPE_ENUM); - if (ret < 0) { -- SNDERR("failed to write control elems %d\n", ret); -+ SNDERR("failed to write control elems %zd\n", ret); - return ret; - } - -@@ -292,7 +287,7 @@ int tplg_write_data(snd_tplg_t *tplg) - ret = write_block(tplg, &tplg->bytes_ext_list, - SND_TPLG_TYPE_BYTES); - if (ret < 0) { -- SNDERR("failed to write control elems %d\n", ret); -+ SNDERR("failed to write control elems %zd\n", ret); - return ret; - } - -@@ -300,7 +295,7 @@ int tplg_write_data(snd_tplg_t *tplg) - ret = write_block(tplg, &tplg->widget_list, - SND_TPLG_TYPE_DAPM_WIDGET); - if (ret < 0) { -- SNDERR("failed to write widget elems %d\n", ret); -+ SNDERR("failed to write widget elems %zd\n", ret); - return ret; - } - -@@ -308,7 +303,7 @@ int tplg_write_data(snd_tplg_t *tplg) - ret = write_block(tplg, &tplg->pcm_list, - SND_TPLG_TYPE_PCM); - if (ret < 0) { -- SNDERR("failed to write pcm elems %d\n", ret); -+ SNDERR("failed to write pcm elems %zd\n", ret); - return ret; - } - -@@ -316,7 +311,7 @@ int tplg_write_data(snd_tplg_t *tplg) - ret = write_block(tplg, &tplg->dai_list, - SND_TPLG_TYPE_DAI); - if (ret < 0) { -- SNDERR("failed to write physical dai elems %d\n", ret); -+ SNDERR("failed to write physical dai elems %zd\n", ret); - return ret; - } - -@@ -324,7 +319,7 @@ int tplg_write_data(snd_tplg_t *tplg) - ret = write_block(tplg, &tplg->be_list, - SND_TPLG_TYPE_BE); - if (ret < 0) { -- SNDERR("failed to write be elems %d\n", ret); -+ SNDERR("failed to write be elems %zd\n", ret); - return ret; - } - -@@ -332,7 +327,7 @@ int tplg_write_data(snd_tplg_t *tplg) - ret = write_block(tplg, &tplg->cc_list, - SND_TPLG_TYPE_CC); - if (ret < 0) { -- SNDERR("failed to write cc elems %d\n", ret); -+ SNDERR("failed to write cc elems %zd\n", ret); - return ret; - } - -@@ -340,7 +335,7 @@ int tplg_write_data(snd_tplg_t *tplg) - ret = write_block(tplg, &tplg->route_list, - SND_TPLG_TYPE_DAPM_GRAPH); - if (ret < 0) { -- SNDERR("failed to write graph elems %d\n", ret); -+ SNDERR("failed to write graph elems %zd\n", ret); - return ret; - } - -@@ -348,7 +343,7 @@ int tplg_write_data(snd_tplg_t *tplg) - ret = write_block(tplg, &tplg->pdata_list, - SND_TPLG_TYPE_DATA); - if (ret < 0) { -- SNDERR("failed to write private data %d\n", ret); -+ SNDERR("failed to write private data %zd\n", ret); - return ret; - } - -diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h -index 22648fa5..7b8abcde 100644 ---- a/src/topology/tplg_local.h -+++ b/src/topology/tplg_local.h -@@ -62,12 +62,13 @@ typedef enum _snd_pcm_rates { - struct snd_tplg { - /* out file */ - int out_fd; -+ size_t out_pos; - - int verbose; - unsigned int version; - - /* runtime state */ -- unsigned int next_hdr_pos; -+ size_t next_hdr_pos; - int index; - int channel_idx; - --- -2.24.1 - - -From 012bd3b28c0d2744db482caca630d5b0a19e4dab Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 13 Dec 2019 18:24:55 +0100 -Subject: [PATCH 21/69] topology: use an array describing blocks for the main - build loop - -Signed-off-by: Jaroslav Kysela ---- - src/topology/builder.c | 146 +++++++++++++++++++---------------------- - 1 file changed, 67 insertions(+), 79 deletions(-) - -diff --git a/src/topology/builder.c b/src/topology/builder.c -index 4e6cbbb0..ec1af42d 100644 ---- a/src/topology/builder.c -+++ b/src/topology/builder.c -@@ -258,93 +258,81 @@ static ssize_t write_manifest_data(snd_tplg_t *tplg) - - int tplg_write_data(snd_tplg_t *tplg) - { -+ struct wtable { -+ const char *name; -+ struct list_head *list; -+ int type; -+ } *wptr, wtable[] = { -+ { -+ .name = "control mixer elements", -+ .list = &tplg->mixer_list, -+ .type = SND_TPLG_TYPE_MIXER, -+ }, -+ { -+ .name = "control enum elements", -+ .list = &tplg->enum_list, -+ .type = SND_TPLG_TYPE_ENUM, -+ }, -+ { -+ .name = "control extended (bytes) elements", -+ .list = &tplg->bytes_ext_list, -+ .type = SND_TPLG_TYPE_BYTES, -+ }, -+ { -+ .name = "dapm widget elements", -+ .list = &tplg->widget_list, -+ .type = SND_TPLG_TYPE_DAPM_WIDGET, -+ }, -+ { -+ .name = "pcm elements", -+ .list = &tplg->pcm_list, -+ .type = SND_TPLG_TYPE_PCM, -+ }, -+ { -+ .name = "physical dai elements", -+ .list = &tplg->dai_list, -+ .type = SND_TPLG_TYPE_DAI, -+ }, -+ { -+ .name = "be elements", -+ .list = &tplg->be_list, -+ .type = SND_TPLG_TYPE_BE, -+ }, -+ { -+ .name = "cc elements", -+ .list = &tplg->cc_list, -+ .type = SND_TPLG_TYPE_CC, -+ }, -+ { -+ .name = "route (dapm graph) elements", -+ .list = &tplg->route_list, -+ .type = SND_TPLG_TYPE_DAPM_GRAPH, -+ }, -+ { -+ .name = "private data elements", -+ .list = &tplg->pdata_list, -+ .type = SND_TPLG_TYPE_DATA, -+ }, -+ }; -+ - ssize_t ret; -+ unsigned int index; - - /* write manifest */ - ret = write_manifest_data(tplg); - if (ret < 0) { -- SNDERR("failed to write manifest %zd\n", ret); -- return ret; -- } -- -- /* write mixer elems. */ -- ret = write_block(tplg, &tplg->mixer_list, -- SND_TPLG_TYPE_MIXER); -- if (ret < 0) { -- SNDERR("failed to write control elems %zd\n", ret); -- return ret; -- } -- -- /* write enum control elems. */ -- ret = write_block(tplg, &tplg->enum_list, -- SND_TPLG_TYPE_ENUM); -- if (ret < 0) { -- SNDERR("failed to write control elems %zd\n", ret); -- return ret; -- } -- -- /* write bytes extended control elems. */ -- ret = write_block(tplg, &tplg->bytes_ext_list, -- SND_TPLG_TYPE_BYTES); -- if (ret < 0) { -- SNDERR("failed to write control elems %zd\n", ret); -- return ret; -- } -- -- /* write widget elems */ -- ret = write_block(tplg, &tplg->widget_list, -- SND_TPLG_TYPE_DAPM_WIDGET); -- if (ret < 0) { -- SNDERR("failed to write widget elems %zd\n", ret); -- return ret; -- } -- -- /* write pcm elems */ -- ret = write_block(tplg, &tplg->pcm_list, -- SND_TPLG_TYPE_PCM); -- if (ret < 0) { -- SNDERR("failed to write pcm elems %zd\n", ret); -- return ret; -- } -- -- /* write physical dai elems */ -- ret = write_block(tplg, &tplg->dai_list, -- SND_TPLG_TYPE_DAI); -- if (ret < 0) { -- SNDERR("failed to write physical dai elems %zd\n", ret); -- return ret; -- } -- -- /* write be elems */ -- ret = write_block(tplg, &tplg->be_list, -- SND_TPLG_TYPE_BE); -- if (ret < 0) { -- SNDERR("failed to write be elems %zd\n", ret); -- return ret; -- } -- -- /* write cc elems */ -- ret = write_block(tplg, &tplg->cc_list, -- SND_TPLG_TYPE_CC); -- if (ret < 0) { -- SNDERR("failed to write cc elems %zd\n", ret); -- return ret; -- } -- -- /* write route elems */ -- ret = write_block(tplg, &tplg->route_list, -- SND_TPLG_TYPE_DAPM_GRAPH); -- if (ret < 0) { -- SNDERR("failed to write graph elems %zd\n", ret); -+ SNDERR("failed to write manifest %d\n", ret); - return ret; - } - -- /* write private data */ -- ret = write_block(tplg, &tplg->pdata_list, -- SND_TPLG_TYPE_DATA); -- if (ret < 0) { -- SNDERR("failed to write private data %zd\n", ret); -- return ret; -+ /* write all blocks */ -+ for (index = 0; index < ARRAY_SIZE(wtable); index++) { -+ wptr = &wtable[index]; -+ ret = write_block(tplg, wptr->list, wptr->type); -+ if (ret < 0) { -+ SNDERR("failed to write %s: %s\n", wptr->name, snd_strerror(-ret)); -+ return ret; -+ } - } - - return 0; --- -2.24.1 - - -From f1f5b48d0cfbce0cc6400daba0020d9385d6645e Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 13 Dec 2019 18:26:20 +0100 -Subject: [PATCH 22/69] topology: use size_t for calc_block_size() - -Signed-off-by: Jaroslav Kysela ---- - src/topology/builder.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/src/topology/builder.c b/src/topology/builder.c -index ec1af42d..bbee71d6 100644 ---- a/src/topology/builder.c -+++ b/src/topology/builder.c -@@ -163,11 +163,11 @@ static int write_elem_block(snd_tplg_t *tplg, - return 0; - } - --static int calc_block_size(struct list_head *base) -+static size_t calc_block_size(struct list_head *base) - { - struct list_head *pos; - struct tplg_elem *elem; -- int size = 0; -+ size_t size = 0; - - list_for_each(pos, base) { - -@@ -185,14 +185,14 @@ static int calc_block_size(struct list_head *base) - - static int write_block(snd_tplg_t *tplg, struct list_head *base, int type) - { -- int size; -+ size_t size; - - /* calculate the block size in bytes for all elems in this list */ - size = calc_block_size(base); -- if (size <= 0) -+ if (size == 0) - return size; - -- verbose(tplg, " block size for type %d is %d\n", type, size); -+ verbose(tplg, " block size for type %d is %zd\n", type, size); - - /* write each elem for this block */ - switch (type) { --- -2.24.1 - - -From 4dcceb5f866deda09e971b1c31d46403c3bd8e9e Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 13 Dec 2019 18:49:29 +0100 -Subject: [PATCH 23/69] topology: merge write_block to tplg_write_data - -Signed-off-by: Jaroslav Kysela ---- - src/topology/builder.c | 95 +++++++++++++++--------------------------- - 1 file changed, 33 insertions(+), 62 deletions(-) - -diff --git a/src/topology/builder.c b/src/topology/builder.c -index bbee71d6..f530fcd8 100644 ---- a/src/topology/builder.c -+++ b/src/topology/builder.c -@@ -183,56 +183,6 @@ static size_t calc_block_size(struct list_head *base) - return size; - } - --static int write_block(snd_tplg_t *tplg, struct list_head *base, int type) --{ -- size_t size; -- -- /* calculate the block size in bytes for all elems in this list */ -- size = calc_block_size(base); -- if (size == 0) -- return size; -- -- verbose(tplg, " block size for type %d is %zd\n", type, size); -- -- /* write each elem for this block */ -- switch (type) { -- case SND_TPLG_TYPE_MIXER: -- return write_elem_block(tplg, base, size, -- SND_SOC_TPLG_TYPE_MIXER, "mixer"); -- case SND_TPLG_TYPE_BYTES: -- return write_elem_block(tplg, base, size, -- SND_SOC_TPLG_TYPE_BYTES, "bytes"); -- case SND_TPLG_TYPE_ENUM: -- return write_elem_block(tplg, base, size, -- SND_SOC_TPLG_TYPE_ENUM, "enum"); -- case SND_TPLG_TYPE_DAPM_GRAPH: -- return write_elem_block(tplg, base, size, -- SND_SOC_TPLG_TYPE_DAPM_GRAPH, "route"); -- case SND_TPLG_TYPE_DAPM_WIDGET: -- return write_elem_block(tplg, base, size, -- SND_SOC_TPLG_TYPE_DAPM_WIDGET, "widget"); -- case SND_TPLG_TYPE_PCM: -- return write_elem_block(tplg, base, size, -- SND_SOC_TPLG_TYPE_PCM, "pcm"); -- case SND_TPLG_TYPE_BE: -- return write_elem_block(tplg, base, size, -- SND_SOC_TPLG_TYPE_BACKEND_LINK, "be"); -- case SND_TPLG_TYPE_CC: -- return write_elem_block(tplg, base, size, -- SND_SOC_TPLG_TYPE_CODEC_LINK, "cc"); -- case SND_TPLG_TYPE_DATA: -- return write_elem_block(tplg, base, size, -- SND_SOC_TPLG_TYPE_PDATA, "data"); -- case SND_TPLG_TYPE_DAI: -- return write_elem_block(tplg, base, size, -- SND_SOC_TPLG_TYPE_DAI, "dai"); -- default: -- return -EINVAL; -- } -- -- return 0; --} -- - /* write the manifest including its private data */ - static ssize_t write_manifest_data(snd_tplg_t *tplg) - { -@@ -262,60 +212,72 @@ int tplg_write_data(snd_tplg_t *tplg) - const char *name; - struct list_head *list; - int type; -+ int tsoc; - } *wptr, wtable[] = { - { -- .name = "control mixer elements", -+ .name = "control mixer", - .list = &tplg->mixer_list, - .type = SND_TPLG_TYPE_MIXER, -+ .tsoc = SND_SOC_TPLG_TYPE_MIXER, - }, - { -- .name = "control enum elements", -+ .name = "control enum", - .list = &tplg->enum_list, - .type = SND_TPLG_TYPE_ENUM, -+ .tsoc = SND_SOC_TPLG_TYPE_ENUM, - }, - { -- .name = "control extended (bytes) elements", -+ .name = "control extended (bytes)", - .list = &tplg->bytes_ext_list, - .type = SND_TPLG_TYPE_BYTES, -+ .tsoc = SND_SOC_TPLG_TYPE_BYTES, - }, - { -- .name = "dapm widget elements", -+ .name = "dapm widget", - .list = &tplg->widget_list, - .type = SND_TPLG_TYPE_DAPM_WIDGET, -+ .tsoc = SND_SOC_TPLG_TYPE_DAPM_WIDGET, - }, - { -- .name = "pcm elements", -+ .name = "pcm", - .list = &tplg->pcm_list, - .type = SND_TPLG_TYPE_PCM, -+ .tsoc = SND_SOC_TPLG_TYPE_PCM, - }, - { -- .name = "physical dai elements", -+ .name = "physical dai", - .list = &tplg->dai_list, - .type = SND_TPLG_TYPE_DAI, -+ .tsoc = SND_SOC_TPLG_TYPE_DAI, - }, - { -- .name = "be elements", -+ .name = "be", - .list = &tplg->be_list, - .type = SND_TPLG_TYPE_BE, -+ .tsoc = SND_SOC_TPLG_TYPE_BACKEND_LINK, - }, - { -- .name = "cc elements", -+ .name = "cc", - .list = &tplg->cc_list, - .type = SND_TPLG_TYPE_CC, -+ .tsoc = SND_SOC_TPLG_TYPE_CODEC_LINK, - }, - { -- .name = "route (dapm graph) elements", -+ .name = "route (dapm graph)", - .list = &tplg->route_list, - .type = SND_TPLG_TYPE_DAPM_GRAPH, -+ .tsoc = SND_SOC_TPLG_TYPE_DAPM_GRAPH, - }, - { -- .name = "private data elements", -+ .name = "private data", - .list = &tplg->pdata_list, - .type = SND_TPLG_TYPE_DATA, -+ .tsoc = SND_SOC_TPLG_TYPE_PDATA, - }, - }; - - ssize_t ret; -+ size_t size; - unsigned int index; - - /* write manifest */ -@@ -328,9 +290,18 @@ int tplg_write_data(snd_tplg_t *tplg) - /* write all blocks */ - for (index = 0; index < ARRAY_SIZE(wtable); index++) { - wptr = &wtable[index]; -- ret = write_block(tplg, wptr->list, wptr->type); -+ /* calculate the block size in bytes for all elems in this list */ -+ size = calc_block_size(wptr->list); -+ if (size == 0) -+ continue; -+ verbose(tplg, " block size for type %s (%d:%d) is %zd\n", -+ wptr->name, wptr->type, -+ wptr->tsoc, size); -+ ret = write_elem_block(tplg, wptr->list, size, -+ wptr->tsoc, wptr->name); - if (ret < 0) { -- SNDERR("failed to write %s: %s\n", wptr->name, snd_strerror(-ret)); -+ SNDERR("failed to write %s elements: %s\n", -+ wptr->name, snd_strerror(-ret)); - return ret; - } - } --- -2.24.1 - - -From c9e9ee3c40e9f50889f2bb4065c4556184998e8f Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 13 Dec 2019 18:53:41 +0100 -Subject: [PATCH 24/69] topology: make vebose output more nice - -Signed-off-by: Jaroslav Kysela ---- - src/topology/builder.c | 18 ++++++++++-------- - 1 file changed, 10 insertions(+), 8 deletions(-) - -diff --git a/src/topology/builder.c b/src/topology/builder.c -index f530fcd8..1a22a453 100644 ---- a/src/topology/builder.c -+++ b/src/topology/builder.c -@@ -29,7 +29,7 @@ static void verbose(snd_tplg_t *tplg, const char *fmt, ...) - return; - - va_start(va, fmt); -- fprintf(stdout, "0x%6.6zx/%6.6zd -", tplg->out_pos, tplg->out_pos); -+ fprintf(stdout, "0x%6.6zx/%6.6zd - ", tplg->out_pos, tplg->out_pos); - vfprintf(stdout, fmt, va); - va_end(va); - } -@@ -80,7 +80,7 @@ static ssize_t write_block_header(snd_tplg_t *tplg, unsigned int type, - return -EINVAL; - } - -- verbose(tplg, " header index %d type %d count %d size 0x%lx/%ld vendor %d " -+ verbose(tplg, "header index %d type %d count %d size 0x%lx/%ld vendor %d " - "version %d\n", index, type, count, - (long unsigned int)payload_size, (long int)payload_size, - vendor_type, version); -@@ -128,10 +128,10 @@ static int write_elem_block(snd_tplg_t *tplg, - continue; - - if (elem->type != SND_TPLG_TYPE_DAPM_GRAPH) -- verbose(tplg, " %s '%s': write %d bytes\n", -+ verbose(tplg, "%s '%s': write %d bytes\n", - obj_name, elem->id, elem->size); - else -- verbose(tplg, " %s '%s -> %s -> %s': write %d bytes\n", -+ verbose(tplg, "%s '%s -> %s -> %s': write %d bytes\n", - obj_name, elem->route->source, - elem->route->control, - elem->route->sink, elem->size); -@@ -197,10 +197,10 @@ static ssize_t write_manifest_data(snd_tplg_t *tplg) - return ret; - } - -- verbose(tplg, "manifest : write %d bytes\n", sizeof(tplg->manifest)); -+ verbose(tplg, "manifest: write %d bytes\n", sizeof(tplg->manifest)); - ret = twrite(tplg, &tplg->manifest, sizeof(tplg->manifest)); - if (ret >= 0) { -- verbose(tplg, "manifest : write %d priv bytes\n", tplg->manifest.priv.size); -+ verbose(tplg, "manifest: write %d priv bytes\n", tplg->manifest.priv.size); - ret = twrite(tplg, tplg->manifest_pdata, tplg->manifest.priv.size); - } - return ret; -@@ -294,9 +294,9 @@ int tplg_write_data(snd_tplg_t *tplg) - size = calc_block_size(wptr->list); - if (size == 0) - continue; -- verbose(tplg, " block size for type %s (%d:%d) is %zd\n", -+ verbose(tplg, "block size for type %s (%d:%d) is 0x%zx/%zd\n", - wptr->name, wptr->type, -- wptr->tsoc, size); -+ wptr->tsoc, size, size); - ret = write_elem_block(tplg, wptr->list, size, - wptr->tsoc, wptr->name); - if (ret < 0) { -@@ -306,5 +306,7 @@ int tplg_write_data(snd_tplg_t *tplg) - } - } - -+ verbose(tplg, "total size is 0x%zx/%zd\n", tplg->out_pos, tplg->out_pos); -+ - return 0; - } --- -2.24.1 - - -From 3b9e39dab5ebfb525b4437a644fe54569e419874 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 13 Dec 2019 21:23:52 +0100 -Subject: [PATCH 25/69] topology: use list_insert() macro in tplg_elem_insert() - -Signed-off-by: Jaroslav Kysela ---- - src/topology/elem.c | 8 +++----- - 1 file changed, 3 insertions(+), 5 deletions(-) - -diff --git a/src/topology/elem.c b/src/topology/elem.c -index a9d1d854..2066fad8 100644 ---- a/src/topology/elem.c -+++ b/src/topology/elem.c -@@ -131,7 +131,7 @@ struct tplg_elem *tplg_elem_lookup(struct list_head *base, const char* id, - return NULL; - } - --/* insert a new element into list in the ascending order of index value*/ -+/* insert a new element into list in the ascending order of index value */ - static void tplg_elem_insert(struct tplg_elem *elem_p, struct list_head *list) - { - struct list_head *pos, *p = &(elem_p->list); -@@ -142,10 +142,8 @@ static void tplg_elem_insert(struct tplg_elem *elem_p, struct list_head *list) - if (elem_p->index < elem->index) - break; - } -- p->prev = pos->prev; -- pos->prev->next = p; -- pos->prev = p; -- p->next = pos; -+ /* insert item before pos */ -+ list_insert(p, pos->prev, pos); - } - - /* create a new common element and object */ --- -2.24.1 - - -From 0d6949b7f1f99bf3fcd5cce78483c10f9ca35264 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 13 Dec 2019 21:52:13 +0100 -Subject: [PATCH 26/69] topology: dapm - coding fixes - -Signed-off-by: Jaroslav Kysela ---- - src/topology/dapm.c | 15 +++++++-------- - 1 file changed, 7 insertions(+), 8 deletions(-) - -diff --git a/src/topology/dapm.c b/src/topology/dapm.c -index 97c9695b..cd80a4c0 100644 ---- a/src/topology/dapm.c -+++ b/src/topology/dapm.c -@@ -152,8 +152,7 @@ static int copy_dapm_control(struct tplg_elem *elem, struct tplg_elem *ref) - } - - /* check referenced controls for a widget */ --static int tplg_build_widget(snd_tplg_t *tplg, -- struct tplg_elem *elem) -+static int tplg_build_widget(snd_tplg_t *tplg, struct tplg_elem *elem) - { - struct tplg_ref *ref; - struct list_head *base, *pos; -@@ -164,7 +163,7 @@ static int tplg_build_widget(snd_tplg_t *tplg, - /* A widget's private data sits before the embedded controls. - * So merge the private data blocks at first - */ -- list_for_each(pos, base) { -+ list_for_each(pos, base) { - ref = list_entry(pos, struct tplg_ref, list); - - if (ref->type != SND_TPLG_TYPE_DATA) -@@ -314,7 +313,7 @@ int tplg_build_routes(snd_tplg_t *tplg) - return 0; - } - --struct tplg_elem* tplg_elem_new_route(snd_tplg_t *tplg) -+struct tplg_elem *tplg_elem_new_route(snd_tplg_t *tplg) - { - struct tplg_elem *elem; - struct snd_soc_tplg_dapm_graph_elem *line; -@@ -342,7 +341,7 @@ struct tplg_elem* tplg_elem_new_route(snd_tplg_t *tplg) - - /* line is defined as '"source, control, sink"' */ - static int tplg_parse_line(const char *text, -- struct snd_soc_tplg_dapm_graph_elem *line) -+ struct snd_soc_tplg_dapm_graph_elem *line) - { - char buf[LINE_SIZE]; - unsigned int len, i; -@@ -422,7 +421,7 @@ static int tplg_parse_routes(snd_tplg_t *tplg, snd_config_t *cfg, int index) - } - - int tplg_parse_dapm_graph(snd_tplg_t *tplg, snd_config_t *cfg, -- void *private ATTRIBUTE_UNUSED) -+ void *private ATTRIBUTE_UNUSED) - { - snd_config_iterator_t i, next; - snd_config_t *n; -@@ -472,7 +471,7 @@ int tplg_parse_dapm_graph(snd_tplg_t *tplg, snd_config_t *cfg, - - /* DAPM Widget */ - int tplg_parse_dapm_widget(snd_tplg_t *tplg, -- snd_config_t *cfg, void *private ATTRIBUTE_UNUSED) -+ snd_config_t *cfg, void *private ATTRIBUTE_UNUSED) - { - struct snd_soc_tplg_dapm_widget *widget; - struct tplg_elem *elem; -@@ -645,7 +644,7 @@ int tplg_add_route(snd_tplg_t *tplg, struct snd_tplg_graph_elem *t) - snd_strlcpy(line->source, t->src, SNDRV_CTL_ELEM_ID_NAME_MAXLEN); - if (t->ctl) - snd_strlcpy(line->control, t->ctl, -- SNDRV_CTL_ELEM_ID_NAME_MAXLEN); -+ SNDRV_CTL_ELEM_ID_NAME_MAXLEN); - snd_strlcpy(line->sink, t->sink, SNDRV_CTL_ELEM_ID_NAME_MAXLEN); - - return 0; --- -2.24.1 - - -From 2b50b594dcbf69f8dcc6e8cf673748f7063c3c17 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 13 Dec 2019 21:56:58 +0100 -Subject: [PATCH 27/69] topology: dapm - merge identical index blocks like for - other elems - -Signed-off-by: Jaroslav Kysela ---- - src/topology/dapm.c | 14 +++++++------- - src/topology/elem.c | 2 +- - src/topology/tplg_local.h | 1 + - 3 files changed, 9 insertions(+), 8 deletions(-) - -diff --git a/src/topology/dapm.c b/src/topology/dapm.c -index cd80a4c0..ce469131 100644 ---- a/src/topology/dapm.c -+++ b/src/topology/dapm.c -@@ -313,7 +313,7 @@ int tplg_build_routes(snd_tplg_t *tplg) - return 0; - } - --struct tplg_elem *tplg_elem_new_route(snd_tplg_t *tplg) -+struct tplg_elem *tplg_elem_new_route(snd_tplg_t *tplg, int index) - { - struct tplg_elem *elem; - struct snd_soc_tplg_dapm_graph_elem *line; -@@ -322,7 +322,8 @@ struct tplg_elem *tplg_elem_new_route(snd_tplg_t *tplg) - if (!elem) - return NULL; - -- list_add_tail(&elem->list, &tplg->route_list); -+ elem->index = index; -+ tplg_elem_insert(elem, &tplg->route_list); - strcpy(elem->id, "line"); - elem->type = SND_TPLG_TYPE_DAPM_GRAPH; - elem->size = sizeof(*line); -@@ -403,10 +404,9 @@ static int tplg_parse_routes(snd_tplg_t *tplg, snd_config_t *cfg, int index) - if (snd_config_get_string(n, &val) < 0) - continue; - -- elem = tplg_elem_new_route(tplg); -+ elem = tplg_elem_new_route(tplg, index); - if (!elem) - return -ENOMEM; -- elem->index = index; - line = elem->route; - - err = tplg_parse_line(val, line); -@@ -628,7 +628,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, - return 0; - } - --int tplg_add_route(snd_tplg_t *tplg, struct snd_tplg_graph_elem *t) -+int tplg_add_route(snd_tplg_t *tplg, struct snd_tplg_graph_elem *t, int index) - { - struct tplg_elem *elem; - struct snd_soc_tplg_dapm_graph_elem *line; -@@ -636,7 +636,7 @@ int tplg_add_route(snd_tplg_t *tplg, struct snd_tplg_graph_elem *t) - if (!t->src || !t->sink) - return -EINVAL; - -- elem = tplg_elem_new_route(tplg); -+ elem = tplg_elem_new_route(tplg, index); - if (!elem) - return -ENOMEM; - -@@ -656,7 +656,7 @@ int tplg_add_graph_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) - int i, ret; - - for (i = 0; i < gt->count; i++) { -- ret = tplg_add_route(tplg, gt->elem + i); -+ ret = tplg_add_route(tplg, gt->elem + i, t->index); - if (ret < 0) - return ret; - } -diff --git a/src/topology/elem.c b/src/topology/elem.c -index 2066fad8..140cdd32 100644 ---- a/src/topology/elem.c -+++ b/src/topology/elem.c -@@ -132,7 +132,7 @@ struct tplg_elem *tplg_elem_lookup(struct list_head *base, const char* id, - } - - /* insert a new element into list in the ascending order of index value */ --static void tplg_elem_insert(struct tplg_elem *elem_p, struct list_head *list) -+void tplg_elem_insert(struct tplg_elem *elem_p, struct list_head *list) - { - struct list_head *pos, *p = &(elem_p->list); - struct tplg_elem *elem; -diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h -index 7b8abcde..11efce6d 100644 ---- a/src/topology/tplg_local.h -+++ b/src/topology/tplg_local.h -@@ -273,6 +273,7 @@ int tplg_ref_add_elem(struct tplg_elem *elem, struct tplg_elem *elem_ref); - struct tplg_elem *tplg_elem_new(void); - void tplg_elem_free(struct tplg_elem *elem); - void tplg_elem_free_list(struct list_head *base); -+void tplg_elem_insert(struct tplg_elem *elem_p, struct list_head *list); - struct tplg_elem *tplg_elem_lookup(struct list_head *base, - const char* id, - unsigned int type, --- -2.24.1 - - -From 780f17126aa8d54fc09694cbf652d4135eb731c0 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 13 Dec 2019 22:07:46 +0100 -Subject: [PATCH 28/69] topology: more coding fixes - -Signed-off-by: Jaroslav Kysela ---- - src/topology/channel.c | 4 ++-- - src/topology/ctl.c | 15 ++++++++------- - src/topology/elem.c | 6 ++++-- - src/topology/ops.c | 6 +++--- - src/topology/pcm.c | 20 ++++++++++++-------- - src/topology/text.c | 2 +- - 6 files changed, 30 insertions(+), 23 deletions(-) - -diff --git a/src/topology/channel.c b/src/topology/channel.c -index 8516b23f..60f7e219 100644 ---- a/src/topology/channel.c -+++ b/src/topology/channel.c -@@ -74,8 +74,8 @@ static int lookup_channel(const char *c) - } - - /* Parse a channel mapping. */ --int tplg_parse_channel(snd_tplg_t *tplg, -- snd_config_t *cfg, void *private) -+int tplg_parse_channel(snd_tplg_t *tplg, snd_config_t *cfg, -+ void *private) - { - snd_config_iterator_t i, next; - snd_config_t *n; -diff --git a/src/topology/ctl.c b/src/topology/ctl.c -index a0962522..1db0b16e 100644 ---- a/src/topology/ctl.c -+++ b/src/topology/ctl.c -@@ -46,7 +46,7 @@ static const struct ctl_access_elem ctl_access[] = { - - /* find CTL access strings and conver to values */ - static int parse_access_values(snd_config_t *cfg, -- struct snd_soc_tplg_ctl_hdr *hdr) -+ struct snd_soc_tplg_ctl_hdr *hdr) - { - snd_config_iterator_t i, next; - snd_config_t *n; -@@ -77,7 +77,7 @@ static int parse_access_values(snd_config_t *cfg, - - /* Parse Access */ - int parse_access(snd_config_t *cfg, -- struct snd_soc_tplg_ctl_hdr *hdr) -+ struct snd_soc_tplg_ctl_hdr *hdr) - { - snd_config_iterator_t i, next; - snd_config_t *n; -@@ -118,7 +118,7 @@ static int copy_tlv(struct tplg_elem *elem, struct tplg_elem *ref) - - /* check referenced TLV for a mixer control */ - static int tplg_build_mixer_control(snd_tplg_t *tplg, -- struct tplg_elem *elem) -+ struct tplg_elem *elem) - { - struct tplg_ref *ref; - struct list_head *base, *pos; -@@ -157,7 +157,7 @@ static int tplg_build_mixer_control(snd_tplg_t *tplg, - } - - static void copy_enum_texts(struct tplg_elem *enum_elem, -- struct tplg_elem *ref_elem) -+ struct tplg_elem *ref_elem) - { - struct snd_soc_tplg_enum_control *ec = enum_elem->enum_ctrl; - struct tplg_texts *texts = ref_elem->texts; -@@ -169,7 +169,7 @@ static void copy_enum_texts(struct tplg_elem *enum_elem, - - /* check referenced text for a enum control */ - static int tplg_build_enum_control(snd_tplg_t *tplg, -- struct tplg_elem *elem) -+ struct tplg_elem *elem) - { - struct tplg_ref *ref; - struct list_head *base, *pos; -@@ -331,7 +331,7 @@ static int tplg_parse_tlv_dbscale(snd_config_t *cfg, struct tplg_elem *elem) - - /* Parse TLV */ - int tplg_parse_tlv(snd_tplg_t *tplg, snd_config_t *cfg, -- void *private ATTRIBUTE_UNUSED) -+ void *private ATTRIBUTE_UNUSED) - { - snd_config_iterator_t i, next; - snd_config_t *n; -@@ -364,7 +364,8 @@ int tplg_parse_tlv(snd_tplg_t *tplg, snd_config_t *cfg, - - /* Parse Control Bytes */ - int tplg_parse_control_bytes(snd_tplg_t *tplg, -- snd_config_t *cfg, void *private ATTRIBUTE_UNUSED) -+ snd_config_t *cfg, -+ void *private ATTRIBUTE_UNUSED) - { - struct snd_soc_tplg_bytes_control *be; - struct tplg_elem *elem; -diff --git a/src/topology/elem.c b/src/topology/elem.c -index 140cdd32..d8618cc9 100644 ---- a/src/topology/elem.c -+++ b/src/topology/elem.c -@@ -107,7 +107,7 @@ void tplg_elem_free_list(struct list_head *base) - } - - struct tplg_elem *tplg_elem_lookup(struct list_head *base, const char* id, -- unsigned int type, int index) -+ unsigned int type, int index) - { - struct list_head *pos; - struct tplg_elem *elem; -@@ -148,7 +148,9 @@ void tplg_elem_insert(struct tplg_elem *elem_p, struct list_head *list) - - /* create a new common element and object */ - struct tplg_elem* tplg_elem_new_common(snd_tplg_t *tplg, -- snd_config_t *cfg, const char *name, enum snd_tplg_type type) -+ snd_config_t *cfg, -+ const char *name, -+ enum snd_tplg_type type) - { - struct tplg_elem *elem; - const char *id, *val = NULL; -diff --git a/src/topology/ops.c b/src/topology/ops.c -index 6f8dc1ff..0f4295a2 100644 ---- a/src/topology/ops.c -+++ b/src/topology/ops.c -@@ -48,8 +48,8 @@ static int lookup_ops(const char *c) - /* Parse Control operations. Ops can come from standard names above or - * bespoke driver controls with numbers >= 256 - */ --int tplg_parse_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, -- snd_config_t *cfg, void *private) -+int tplg_parse_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, snd_config_t *cfg, -+ void *private) - { - snd_config_iterator_t i, next; - snd_config_t *n; -@@ -88,7 +88,7 @@ int tplg_parse_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, - * bespoke driver controls with numbers >= 256 - */ - int tplg_parse_ext_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, -- snd_config_t *cfg, void *private) -+ snd_config_t *cfg, void *private) - { - snd_config_iterator_t i, next; - snd_config_t *n; -diff --git a/src/topology/pcm.c b/src/topology/pcm.c -index 553fd822..98a8df97 100644 ---- a/src/topology/pcm.c -+++ b/src/topology/pcm.c -@@ -63,7 +63,8 @@ struct tplg_elem *lookup_pcm_dai_stream(struct list_head *base, const char* id) - - /* copy referenced caps to the parent (pcm or be dai) */ - static void copy_stream_caps(const char *id ATTRIBUTE_UNUSED, -- struct snd_soc_tplg_stream_caps *caps, struct tplg_elem *ref_elem) -+ struct snd_soc_tplg_stream_caps *caps, -+ struct tplg_elem *ref_elem) - { - struct snd_soc_tplg_stream_caps *ref_caps = ref_elem->stream_caps; - -@@ -75,7 +76,8 @@ static void copy_stream_caps(const char *id ATTRIBUTE_UNUSED, - - /* find and copy the referenced stream caps */ - static int tplg_build_stream_caps(snd_tplg_t *tplg, -- const char *id, int index, struct snd_soc_tplg_stream_caps *caps) -+ const char *id, int index, -+ struct snd_soc_tplg_stream_caps *caps) - { - struct tplg_elem *ref_elem = NULL; - unsigned int i; -@@ -207,7 +209,8 @@ int tplg_build_dais(snd_tplg_t *tplg, unsigned int type) - } - - static int tplg_build_stream_cfg(snd_tplg_t *tplg, -- struct snd_soc_tplg_stream *stream, int num_streams, int index) -+ struct snd_soc_tplg_stream *stream, -+ int num_streams, int index) - { - struct snd_soc_tplg_stream *strm; - struct tplg_elem *ref_elem; -@@ -367,7 +370,8 @@ static int split_rate(struct snd_soc_tplg_stream_caps *caps, char *str) - - /* Parse pcm stream capabilities */ - int tplg_parse_stream_caps(snd_tplg_t *tplg, -- snd_config_t *cfg, void *private ATTRIBUTE_UNUSED) -+ snd_config_t *cfg, -+ void *private ATTRIBUTE_UNUSED) - { - struct snd_soc_tplg_stream_caps *sc; - struct tplg_elem *elem; -@@ -637,8 +641,8 @@ static int parse_flag(snd_config_t *n, unsigned int mask_in, - } - - /* Parse PCM (for front end DAI & DAI link) in text conf file */ --int tplg_parse_pcm(snd_tplg_t *tplg, -- snd_config_t *cfg, void *private ATTRIBUTE_UNUSED) -+int tplg_parse_pcm(snd_tplg_t *tplg, snd_config_t *cfg, -+ void *private ATTRIBUTE_UNUSED) - { - struct snd_soc_tplg_pcm *pcm; - struct tplg_elem *elem; -@@ -746,8 +750,8 @@ int tplg_parse_pcm(snd_tplg_t *tplg, - } - - /* Parse physical DAI */ --int tplg_parse_dai(snd_tplg_t *tplg, -- snd_config_t *cfg, void *private ATTRIBUTE_UNUSED) -+int tplg_parse_dai(snd_tplg_t *tplg, snd_config_t *cfg, -+ void *private ATTRIBUTE_UNUSED) - { - struct snd_soc_tplg_dai *dai; - struct tplg_elem *elem; -diff --git a/src/topology/text.c b/src/topology/text.c -index 72647fe0..f301a4de 100644 ---- a/src/topology/text.c -+++ b/src/topology/text.c -@@ -59,7 +59,7 @@ static int parse_text_values(snd_config_t *cfg, struct tplg_elem *elem) - - /* Parse Text data */ - int tplg_parse_text(snd_tplg_t *tplg, snd_config_t *cfg, -- void *private ATTRIBUTE_UNUSED) -+ void *private ATTRIBUTE_UNUSED) - { - snd_config_iterator_t i, next; - snd_config_t *n; --- -2.24.1 - - -From ae564665ec261cf104de499b1cdda3564070fc65 Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Fri, 20 Dec 2019 15:46:48 +0100 -Subject: [PATCH 29/69] Fix alsa/sound/*.h for external programs - -The recent update of sound/*.h to sync with the latest Linus uapi -files broke the build of alsa-tools programs. These files used to be -a modified version of Linux sound/* header files, so that they could -be built without Linux headers. The special prefix like __user and -other things were worked around there. - -We may do that again, but a better approach is to fix those things in -Linux kernel uapi side, while we keep the minimal workaround in -alsa-lib such as the __u16 and co type definitions. - -This patch is such an attempt, namely: -- Keep the original $LINUX/uapi/sound/*.h in include/sound/uapi - directory -- The "fixes" are applied to some uapi headers, so that they don't - contain Linux-specific prefix and use of opaque struct like - snd_ctl_elem_id -- The uapi headers are included indirectly from include/sound/*.h -- Some headers have inclusion of type_compat.h for the Linux variable - types and prefixes -- type_compat.h tries to use when __linux__ is - defined, instead of the own conflicting definitions - -The last type might need a bit more adjustment depending on the -compiler, but it can be fixed locally without disturbing else. - -Signed-off-by: Takashi Iwai ---- - configure.ac | 3 +- - include/sound/Makefile.am | 6 +- - include/sound/asequencer.h | 613 +---------------- - include/sound/asoc.h | 634 +----------------- - include/sound/asound.h | 1039 +---------------------------- - include/sound/asound_fm.h | 136 +--- - include/sound/emu10k1.h | 383 +---------- - include/sound/hdsp.h | 113 +--- - include/sound/hdspm.h | 234 +------ - include/sound/sb16_csp.h | 124 +--- - include/sound/sscape_ioctl.h | 22 +- - include/sound/tlv.h | 118 +--- - include/sound/type_compat.h | 13 + - include/sound/uapi/Makefile.am | 6 + - include/sound/uapi/asequencer.h | 612 +++++++++++++++++ - include/sound/uapi/asoc.h | 633 ++++++++++++++++++ - include/sound/uapi/asound.h | 1038 ++++++++++++++++++++++++++++ - include/sound/uapi/asound_fm.h | 135 ++++ - include/sound/uapi/emu10k1.h | 395 +++++++++++ - include/sound/uapi/hdsp.h | 109 +++ - include/sound/uapi/hdspm.h | 230 +++++++ - include/sound/uapi/sb16_csp.h | 123 ++++ - include/sound/uapi/sscape_ioctl.h | 21 + - include/sound/uapi/tlv.h | 117 ++++ - src/topology/tplg_local.h | 3 +- - 25 files changed, 3452 insertions(+), 3408 deletions(-) - create mode 100644 include/sound/uapi/Makefile.am - create mode 100644 include/sound/uapi/asequencer.h - create mode 100644 include/sound/uapi/asoc.h - create mode 100644 include/sound/uapi/asound.h - create mode 100644 include/sound/uapi/asound_fm.h - create mode 100644 include/sound/uapi/emu10k1.h - create mode 100644 include/sound/uapi/hdsp.h - create mode 100644 include/sound/uapi/hdspm.h - create mode 100644 include/sound/uapi/sb16_csp.h - create mode 100644 include/sound/uapi/sscape_ioctl.h - create mode 100644 include/sound/uapi/tlv.h - -diff --git a/configure.ac b/configure.ac -index 119ef600..886f87bc 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -707,7 +707,8 @@ if test ! -L "$srcdir"/include/alsa ; then - fi - - AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \ -- include/Makefile include/sound/Makefile src/Versions src/Makefile \ -+ include/Makefile include/sound/Makefile include/sound/uapi/Makefile \ -+ src/Versions src/Makefile \ - src/control/Makefile src/mixer/Makefile \ - src/pcm/Makefile src/pcm/scopes/Makefile \ - src/rawmidi/Makefile src/timer/Makefile \ -diff --git a/include/sound/Makefile.am b/include/sound/Makefile.am -index 99c42211..ccc7d273 100644 ---- a/include/sound/Makefile.am -+++ b/include/sound/Makefile.am -@@ -1,7 +1,9 @@ -+SUBDIRS = uapi -+ - alsasoundincludedir = ${includedir}/alsa/sound - - alsasoundinclude_HEADERS = asound_fm.h hdsp.h hdspm.h sb16_csp.h \ -- sscape_ioctl.h emu10k1.h type_compat.h \ -- asoc.h tlv.h -+ sscape_ioctl.h emu10k1.h asoc.h tlv.h \ -+ type_compat.h - - noinst_HEADERS = asound.h asequencer.h -diff --git a/include/sound/asequencer.h b/include/sound/asequencer.h -index a75e14ed..e539a77e 100644 ---- a/include/sound/asequencer.h -+++ b/include/sound/asequencer.h -@@ -1,612 +1 @@ --/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ --/* -- * Main header file for the ALSA sequencer -- * Copyright (c) 1998-1999 by Frank van de Pol -- * (c) 1998-1999 by Jaroslav Kysela -- * -- * -- * This program is free software; you can redistribute it and/or modify -- * it under the terms of the GNU General Public License as published by -- * the Free Software Foundation; either version 2 of the License, or -- * (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU General Public License for more details. -- * -- * You should have received a copy of the GNU General Public License -- * along with this program; if not, write to the Free Software -- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- * -- */ --#ifndef _UAPI__SOUND_ASEQUENCER_H --#define _UAPI__SOUND_ASEQUENCER_H -- --#include -- --/** version of the sequencer */ --#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 2) -- --/** -- * definition of sequencer event types -- */ -- --/** system messages -- * event data type = #snd_seq_result -- */ --#define SNDRV_SEQ_EVENT_SYSTEM 0 --#define SNDRV_SEQ_EVENT_RESULT 1 -- --/** note messages (channel specific) -- * event data type = #snd_seq_ev_note -- */ --#define SNDRV_SEQ_EVENT_NOTE 5 --#define SNDRV_SEQ_EVENT_NOTEON 6 --#define SNDRV_SEQ_EVENT_NOTEOFF 7 --#define SNDRV_SEQ_EVENT_KEYPRESS 8 -- --/** control messages (channel specific) -- * event data type = #snd_seq_ev_ctrl -- */ --#define SNDRV_SEQ_EVENT_CONTROLLER 10 --#define SNDRV_SEQ_EVENT_PGMCHANGE 11 --#define SNDRV_SEQ_EVENT_CHANPRESS 12 --#define SNDRV_SEQ_EVENT_PITCHBEND 13 /**< from -8192 to 8191 */ --#define SNDRV_SEQ_EVENT_CONTROL14 14 /**< 14 bit controller value */ --#define SNDRV_SEQ_EVENT_NONREGPARAM 15 /**< 14 bit NRPN address + 14 bit unsigned value */ --#define SNDRV_SEQ_EVENT_REGPARAM 16 /**< 14 bit RPN address + 14 bit unsigned value */ -- --/** synchronisation messages -- * event data type = #snd_seq_ev_ctrl -- */ --#define SNDRV_SEQ_EVENT_SONGPOS 20 /* Song Position Pointer with LSB and MSB values */ --#define SNDRV_SEQ_EVENT_SONGSEL 21 /* Song Select with song ID number */ --#define SNDRV_SEQ_EVENT_QFRAME 22 /* midi time code quarter frame */ --#define SNDRV_SEQ_EVENT_TIMESIGN 23 /* SMF Time Signature event */ --#define SNDRV_SEQ_EVENT_KEYSIGN 24 /* SMF Key Signature event */ -- --/** timer messages -- * event data type = snd_seq_ev_queue_control -- */ --#define SNDRV_SEQ_EVENT_START 30 /* midi Real Time Start message */ --#define SNDRV_SEQ_EVENT_CONTINUE 31 /* midi Real Time Continue message */ --#define SNDRV_SEQ_EVENT_STOP 32 /* midi Real Time Stop message */ --#define SNDRV_SEQ_EVENT_SETPOS_TICK 33 /* set tick queue position */ --#define SNDRV_SEQ_EVENT_SETPOS_TIME 34 /* set realtime queue position */ --#define SNDRV_SEQ_EVENT_TEMPO 35 /* (SMF) Tempo event */ --#define SNDRV_SEQ_EVENT_CLOCK 36 /* midi Real Time Clock message */ --#define SNDRV_SEQ_EVENT_TICK 37 /* midi Real Time Tick message */ --#define SNDRV_SEQ_EVENT_QUEUE_SKEW 38 /* skew queue tempo */ -- --/** others -- * event data type = none -- */ --#define SNDRV_SEQ_EVENT_TUNE_REQUEST 40 /* tune request */ --#define SNDRV_SEQ_EVENT_RESET 41 /* reset to power-on state */ --#define SNDRV_SEQ_EVENT_SENSING 42 /* "active sensing" event */ -- --/** echo back, kernel private messages -- * event data type = any type -- */ --#define SNDRV_SEQ_EVENT_ECHO 50 /* echo event */ --#define SNDRV_SEQ_EVENT_OSS 51 /* OSS raw event */ -- --/** system status messages (broadcast for subscribers) -- * event data type = snd_seq_addr -- */ --#define SNDRV_SEQ_EVENT_CLIENT_START 60 /* new client has connected */ --#define SNDRV_SEQ_EVENT_CLIENT_EXIT 61 /* client has left the system */ --#define SNDRV_SEQ_EVENT_CLIENT_CHANGE 62 /* client status/info has changed */ --#define SNDRV_SEQ_EVENT_PORT_START 63 /* new port was created */ --#define SNDRV_SEQ_EVENT_PORT_EXIT 64 /* port was deleted from system */ --#define SNDRV_SEQ_EVENT_PORT_CHANGE 65 /* port status/info has changed */ -- --/** port connection changes -- * event data type = snd_seq_connect -- */ --#define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */ --#define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */ -- --/* 70-89: synthesizer events - obsoleted */ -- --/** user-defined events with fixed length -- * event data type = any -- */ --#define SNDRV_SEQ_EVENT_USR0 90 --#define SNDRV_SEQ_EVENT_USR1 91 --#define SNDRV_SEQ_EVENT_USR2 92 --#define SNDRV_SEQ_EVENT_USR3 93 --#define SNDRV_SEQ_EVENT_USR4 94 --#define SNDRV_SEQ_EVENT_USR5 95 --#define SNDRV_SEQ_EVENT_USR6 96 --#define SNDRV_SEQ_EVENT_USR7 97 --#define SNDRV_SEQ_EVENT_USR8 98 --#define SNDRV_SEQ_EVENT_USR9 99 -- --/* 100-118: instrument layer - obsoleted */ --/* 119-129: reserved */ -- --/* 130-139: variable length events -- * event data type = snd_seq_ev_ext -- * (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set) -- */ --#define SNDRV_SEQ_EVENT_SYSEX 130 /* system exclusive data (variable length) */ --#define SNDRV_SEQ_EVENT_BOUNCE 131 /* error event */ --/* 132-134: reserved */ --#define SNDRV_SEQ_EVENT_USR_VAR0 135 --#define SNDRV_SEQ_EVENT_USR_VAR1 136 --#define SNDRV_SEQ_EVENT_USR_VAR2 137 --#define SNDRV_SEQ_EVENT_USR_VAR3 138 --#define SNDRV_SEQ_EVENT_USR_VAR4 139 -- --/* 150-151: kernel events with quote - DO NOT use in user clients */ --#define SNDRV_SEQ_EVENT_KERNEL_ERROR 150 --#define SNDRV_SEQ_EVENT_KERNEL_QUOTE 151 /* obsolete */ -- --/* 152-191: reserved */ -- --/* 192-254: hardware specific events */ -- --/* 255: special event */ --#define SNDRV_SEQ_EVENT_NONE 255 -- -- --typedef unsigned char snd_seq_event_type_t; -- --/** event address */ --struct snd_seq_addr { -- unsigned char client; /**< Client number: 0..255, 255 = broadcast to all clients */ -- unsigned char port; /**< Port within client: 0..255, 255 = broadcast to all ports */ --}; -- --/** port connection */ --struct snd_seq_connect { -- struct snd_seq_addr sender; -- struct snd_seq_addr dest; --}; -- -- --#define SNDRV_SEQ_ADDRESS_UNKNOWN 253 /* unknown source */ --#define SNDRV_SEQ_ADDRESS_SUBSCRIBERS 254 /* send event to all subscribed ports */ --#define SNDRV_SEQ_ADDRESS_BROADCAST 255 /* send event to all queues/clients/ports/channels */ --#define SNDRV_SEQ_QUEUE_DIRECT 253 /* direct dispatch */ -- -- /* event mode flag - NOTE: only 8 bits available! */ --#define SNDRV_SEQ_TIME_STAMP_TICK (0<<0) /* timestamp in clock ticks */ --#define SNDRV_SEQ_TIME_STAMP_REAL (1<<0) /* timestamp in real time */ --#define SNDRV_SEQ_TIME_STAMP_MASK (1<<0) -- --#define SNDRV_SEQ_TIME_MODE_ABS (0<<1) /* absolute timestamp */ --#define SNDRV_SEQ_TIME_MODE_REL (1<<1) /* relative to current time */ --#define SNDRV_SEQ_TIME_MODE_MASK (1<<1) -- --#define SNDRV_SEQ_EVENT_LENGTH_FIXED (0<<2) /* fixed event size */ --#define SNDRV_SEQ_EVENT_LENGTH_VARIABLE (1<<2) /* variable event size */ --#define SNDRV_SEQ_EVENT_LENGTH_VARUSR (2<<2) /* variable event size - user memory space */ --#define SNDRV_SEQ_EVENT_LENGTH_MASK (3<<2) -- --#define SNDRV_SEQ_PRIORITY_NORMAL (0<<4) /* normal priority */ --#define SNDRV_SEQ_PRIORITY_HIGH (1<<4) /* event should be processed before others */ --#define SNDRV_SEQ_PRIORITY_MASK (1<<4) -- -- -- /* note event */ --struct snd_seq_ev_note { -- unsigned char channel; -- unsigned char note; -- unsigned char velocity; -- unsigned char off_velocity; /* only for SNDRV_SEQ_EVENT_NOTE */ -- unsigned int duration; /* only for SNDRV_SEQ_EVENT_NOTE */ --}; -- -- /* controller event */ --struct snd_seq_ev_ctrl { -- unsigned char channel; -- unsigned char unused1, unused2, unused3; /* pad */ -- unsigned int param; -- signed int value; --}; -- -- /* generic set of bytes (12x8 bit) */ --struct snd_seq_ev_raw8 { -- unsigned char d[12]; /* 8 bit value */ --}; -- -- /* generic set of integers (3x32 bit) */ --struct snd_seq_ev_raw32 { -- unsigned int d[3]; /* 32 bit value */ --}; -- -- /* external stored data */ --struct snd_seq_ev_ext { -- unsigned int len; /* length of data */ -- void *ptr; /* pointer to data (note: maybe 64-bit) */ --} __attribute__((packed)); -- --struct snd_seq_result { -- int event; /* processed event type */ -- int result; --}; -- -- --struct snd_seq_real_time { -- unsigned int tv_sec; /* seconds */ -- unsigned int tv_nsec; /* nanoseconds */ --}; -- --typedef unsigned int snd_seq_tick_time_t; /* midi ticks */ -- --union snd_seq_timestamp { -- snd_seq_tick_time_t tick; -- struct snd_seq_real_time time; --}; -- --struct snd_seq_queue_skew { -- unsigned int value; -- unsigned int base; --}; -- -- /* queue timer control */ --struct snd_seq_ev_queue_control { -- unsigned char queue; /* affected queue */ -- unsigned char pad[3]; /* reserved */ -- union { -- signed int value; /* affected value (e.g. tempo) */ -- union snd_seq_timestamp time; /* time */ -- unsigned int position; /* sync position */ -- struct snd_seq_queue_skew skew; -- unsigned int d32[2]; -- unsigned char d8[8]; -- } param; --}; -- -- /* quoted event - inside the kernel only */ --struct snd_seq_ev_quote { -- struct snd_seq_addr origin; /* original sender */ -- unsigned short value; /* optional data */ -- struct snd_seq_event *event; /* quoted event */ --} __attribute__((packed)); -- -- -- /* sequencer event */ --struct snd_seq_event { -- snd_seq_event_type_t type; /* event type */ -- unsigned char flags; /* event flags */ -- char tag; -- -- unsigned char queue; /* schedule queue */ -- union snd_seq_timestamp time; /* schedule time */ -- -- -- struct snd_seq_addr source; /* source address */ -- struct snd_seq_addr dest; /* destination address */ -- -- union { /* event data... */ -- struct snd_seq_ev_note note; -- struct snd_seq_ev_ctrl control; -- struct snd_seq_ev_raw8 raw8; -- struct snd_seq_ev_raw32 raw32; -- struct snd_seq_ev_ext ext; -- struct snd_seq_ev_queue_control queue; -- union snd_seq_timestamp time; -- struct snd_seq_addr addr; -- struct snd_seq_connect connect; -- struct snd_seq_result result; -- struct snd_seq_ev_quote quote; -- } data; --}; -- -- --/* -- * bounce event - stored as variable size data -- */ --struct snd_seq_event_bounce { -- int err; -- struct snd_seq_event event; -- /* external data follows here. */ --}; -- -- -- /* system information */ --struct snd_seq_system_info { -- int queues; /* maximum queues count */ -- int clients; /* maximum clients count */ -- int ports; /* maximum ports per client */ -- int channels; /* maximum channels per port */ -- int cur_clients; /* current clients */ -- int cur_queues; /* current queues */ -- char reserved[24]; --}; -- -- -- /* system running information */ --struct snd_seq_running_info { -- unsigned char client; /* client id */ -- unsigned char big_endian; /* 1 = big-endian */ -- unsigned char cpu_mode; /* 4 = 32bit, 8 = 64bit */ -- unsigned char pad; /* reserved */ -- unsigned char reserved[12]; --}; -- -- -- /* known client numbers */ --#define SNDRV_SEQ_CLIENT_SYSTEM 0 -- /* internal client numbers */ --#define SNDRV_SEQ_CLIENT_DUMMY 14 /* midi through */ --#define SNDRV_SEQ_CLIENT_OSS 15 /* oss sequencer emulator */ -- -- -- /* client types */ --typedef int __bitwise snd_seq_client_type_t; --#define NO_CLIENT ((__force snd_seq_client_type_t) 0) --#define USER_CLIENT ((__force snd_seq_client_type_t) 1) --#define KERNEL_CLIENT ((__force snd_seq_client_type_t) 2) -- -- /* event filter flags */ --#define SNDRV_SEQ_FILTER_BROADCAST (1<<0) /* accept broadcast messages */ --#define SNDRV_SEQ_FILTER_MULTICAST (1<<1) /* accept multicast messages */ --#define SNDRV_SEQ_FILTER_BOUNCE (1<<2) /* accept bounce event in error */ --#define SNDRV_SEQ_FILTER_USE_EVENT (1<<31) /* use event filter */ -- --struct snd_seq_client_info { -- int client; /* client number to inquire */ -- snd_seq_client_type_t type; /* client type */ -- char name[64]; /* client name */ -- unsigned int filter; /* filter flags */ -- unsigned char multicast_filter[8]; /* multicast filter bitmap */ -- unsigned char event_filter[32]; /* event filter bitmap */ -- int num_ports; /* RO: number of ports */ -- int event_lost; /* number of lost events */ -- int card; /* RO: card number[kernel] */ -- int pid; /* RO: pid[user] */ -- char reserved[56]; /* for future use */ --}; -- -- --/* client pool size */ --struct snd_seq_client_pool { -- int client; /* client number to inquire */ -- int output_pool; /* outgoing (write) pool size */ -- int input_pool; /* incoming (read) pool size */ -- int output_room; /* minimum free pool size for select/blocking mode */ -- int output_free; /* unused size */ -- int input_free; /* unused size */ -- char reserved[64]; --}; -- -- --/* Remove events by specified criteria */ -- --#define SNDRV_SEQ_REMOVE_INPUT (1<<0) /* Flush input queues */ --#define SNDRV_SEQ_REMOVE_OUTPUT (1<<1) /* Flush output queues */ --#define SNDRV_SEQ_REMOVE_DEST (1<<2) /* Restrict by destination q:client:port */ --#define SNDRV_SEQ_REMOVE_DEST_CHANNEL (1<<3) /* Restrict by channel */ --#define SNDRV_SEQ_REMOVE_TIME_BEFORE (1<<4) /* Restrict to before time */ --#define SNDRV_SEQ_REMOVE_TIME_AFTER (1<<5) /* Restrict to time or after */ --#define SNDRV_SEQ_REMOVE_TIME_TICK (1<<6) /* Time is in ticks */ --#define SNDRV_SEQ_REMOVE_EVENT_TYPE (1<<7) /* Restrict to event type */ --#define SNDRV_SEQ_REMOVE_IGNORE_OFF (1<<8) /* Do not flush off events */ --#define SNDRV_SEQ_REMOVE_TAG_MATCH (1<<9) /* Restrict to events with given tag */ -- --struct snd_seq_remove_events { -- unsigned int remove_mode; /* Flags that determine what gets removed */ -- -- union snd_seq_timestamp time; -- -- unsigned char queue; /* Queue for REMOVE_DEST */ -- struct snd_seq_addr dest; /* Address for REMOVE_DEST */ -- unsigned char channel; /* Channel for REMOVE_DEST */ -- -- int type; /* For REMOVE_EVENT_TYPE */ -- char tag; /* Tag for REMOVE_TAG */ -- -- int reserved[10]; /* To allow for future binary compatibility */ -- --}; -- -- -- /* known port numbers */ --#define SNDRV_SEQ_PORT_SYSTEM_TIMER 0 --#define SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE 1 -- -- /* port capabilities (32 bits) */ --#define SNDRV_SEQ_PORT_CAP_READ (1<<0) /* readable from this port */ --#define SNDRV_SEQ_PORT_CAP_WRITE (1<<1) /* writable to this port */ -- --#define SNDRV_SEQ_PORT_CAP_SYNC_READ (1<<2) --#define SNDRV_SEQ_PORT_CAP_SYNC_WRITE (1<<3) -- --#define SNDRV_SEQ_PORT_CAP_DUPLEX (1<<4) -- --#define SNDRV_SEQ_PORT_CAP_SUBS_READ (1<<5) /* allow read subscription */ --#define SNDRV_SEQ_PORT_CAP_SUBS_WRITE (1<<6) /* allow write subscription */ --#define SNDRV_SEQ_PORT_CAP_NO_EXPORT (1<<7) /* routing not allowed */ -- -- /* port type */ --#define SNDRV_SEQ_PORT_TYPE_SPECIFIC (1<<0) /* hardware specific */ --#define SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC (1<<1) /* generic MIDI device */ --#define SNDRV_SEQ_PORT_TYPE_MIDI_GM (1<<2) /* General MIDI compatible device */ --#define SNDRV_SEQ_PORT_TYPE_MIDI_GS (1<<3) /* GS compatible device */ --#define SNDRV_SEQ_PORT_TYPE_MIDI_XG (1<<4) /* XG compatible device */ --#define SNDRV_SEQ_PORT_TYPE_MIDI_MT32 (1<<5) /* MT-32 compatible device */ --#define SNDRV_SEQ_PORT_TYPE_MIDI_GM2 (1<<6) /* General MIDI 2 compatible device */ -- --/* other standards...*/ --#define SNDRV_SEQ_PORT_TYPE_SYNTH (1<<10) /* Synth device (no MIDI compatible - direct wavetable) */ --#define SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11) /* Sampling device (support sample download) */ --#define SNDRV_SEQ_PORT_TYPE_SAMPLE (1<<12) /* Sampling device (sample can be downloaded at any time) */ --/*...*/ --#define SNDRV_SEQ_PORT_TYPE_HARDWARE (1<<16) /* driver for a hardware device */ --#define SNDRV_SEQ_PORT_TYPE_SOFTWARE (1<<17) /* implemented in software */ --#define SNDRV_SEQ_PORT_TYPE_SYNTHESIZER (1<<18) /* generates sound */ --#define SNDRV_SEQ_PORT_TYPE_PORT (1<<19) /* connects to other device(s) */ --#define SNDRV_SEQ_PORT_TYPE_APPLICATION (1<<20) /* application (sequencer/editor) */ -- --/* misc. conditioning flags */ --#define SNDRV_SEQ_PORT_FLG_GIVEN_PORT (1<<0) --#define SNDRV_SEQ_PORT_FLG_TIMESTAMP (1<<1) --#define SNDRV_SEQ_PORT_FLG_TIME_REAL (1<<2) -- --struct snd_seq_port_info { -- struct snd_seq_addr addr; /* client/port numbers */ -- char name[64]; /* port name */ -- -- unsigned int capability; /* port capability bits */ -- unsigned int type; /* port type bits */ -- int midi_channels; /* channels per MIDI port */ -- int midi_voices; /* voices per MIDI port */ -- int synth_voices; /* voices per SYNTH port */ -- -- int read_use; /* R/O: subscribers for output (from this port) */ -- int write_use; /* R/O: subscribers for input (to this port) */ -- -- void *kernel; /* reserved for kernel use (must be NULL) */ -- unsigned int flags; /* misc. conditioning */ -- unsigned char time_queue; /* queue # for timestamping */ -- char reserved[59]; /* for future use */ --}; -- -- --/* queue flags */ --#define SNDRV_SEQ_QUEUE_FLG_SYNC (1<<0) /* sync enabled */ -- --/* queue information */ --struct snd_seq_queue_info { -- int queue; /* queue id */ -- -- /* -- * security settings, only owner of this queue can start/stop timer -- * etc. if the queue is locked for other clients -- */ -- int owner; /* client id for owner of the queue */ -- unsigned locked:1; /* timing queue locked for other queues */ -- char name[64]; /* name of this queue */ -- unsigned int flags; /* flags */ -- char reserved[60]; /* for future use */ -- --}; -- --/* queue info/status */ --struct snd_seq_queue_status { -- int queue; /* queue id */ -- int events; /* read-only - queue size */ -- snd_seq_tick_time_t tick; /* current tick */ -- struct snd_seq_real_time time; /* current time */ -- int running; /* running state of queue */ -- int flags; /* various flags */ -- char reserved[64]; /* for the future */ --}; -- -- --/* queue tempo */ --struct snd_seq_queue_tempo { -- int queue; /* sequencer queue */ -- unsigned int tempo; /* current tempo, us/tick */ -- int ppq; /* time resolution, ticks/quarter */ -- unsigned int skew_value; /* queue skew */ -- unsigned int skew_base; /* queue skew base */ -- char reserved[24]; /* for the future */ --}; -- -- --/* sequencer timer sources */ --#define SNDRV_SEQ_TIMER_ALSA 0 /* ALSA timer */ --#define SNDRV_SEQ_TIMER_MIDI_CLOCK 1 /* Midi Clock (CLOCK event) */ --#define SNDRV_SEQ_TIMER_MIDI_TICK 2 /* Midi Timer Tick (TICK event) */ -- --/* queue timer info */ --struct snd_seq_queue_timer { -- int queue; /* sequencer queue */ -- int type; /* source timer type */ -- union { -- struct { -- struct snd_timer_id id; /* ALSA's timer ID */ -- unsigned int resolution; /* resolution in Hz */ -- } alsa; -- } u; -- char reserved[64]; /* for the future use */ --}; -- -- --struct snd_seq_queue_client { -- int queue; /* sequencer queue */ -- int client; /* sequencer client */ -- int used; /* queue is used with this client -- (must be set for accepting events) */ -- /* per client watermarks */ -- char reserved[64]; /* for future use */ --}; -- -- --#define SNDRV_SEQ_PORT_SUBS_EXCLUSIVE (1<<0) /* exclusive connection */ --#define SNDRV_SEQ_PORT_SUBS_TIMESTAMP (1<<1) --#define SNDRV_SEQ_PORT_SUBS_TIME_REAL (1<<2) -- --struct snd_seq_port_subscribe { -- struct snd_seq_addr sender; /* sender address */ -- struct snd_seq_addr dest; /* destination address */ -- unsigned int voices; /* number of voices to be allocated (0 = don't care) */ -- unsigned int flags; /* modes */ -- unsigned char queue; /* input time-stamp queue (optional) */ -- unsigned char pad[3]; /* reserved */ -- char reserved[64]; --}; -- --/* type of query subscription */ --#define SNDRV_SEQ_QUERY_SUBS_READ 0 --#define SNDRV_SEQ_QUERY_SUBS_WRITE 1 -- --struct snd_seq_query_subs { -- struct snd_seq_addr root; /* client/port id to be searched */ -- int type; /* READ or WRITE */ -- int index; /* 0..N-1 */ -- int num_subs; /* R/O: number of subscriptions on this port */ -- struct snd_seq_addr addr; /* R/O: result */ -- unsigned char queue; /* R/O: result */ -- unsigned int flags; /* R/O: result */ -- char reserved[64]; /* for future use */ --}; -- -- --/* -- * IOCTL commands -- */ -- --#define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int) --#define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int) --#define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct snd_seq_system_info) --#define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct snd_seq_running_info) -- --#define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct snd_seq_client_info) --#define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct snd_seq_client_info) -- --#define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct snd_seq_port_info) --#define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct snd_seq_port_info) --#define SNDRV_SEQ_IOCTL_GET_PORT_INFO _IOWR('S', 0x22, struct snd_seq_port_info) --#define SNDRV_SEQ_IOCTL_SET_PORT_INFO _IOW ('S', 0x23, struct snd_seq_port_info) -- --#define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct snd_seq_port_subscribe) --#define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct snd_seq_port_subscribe) -- --#define SNDRV_SEQ_IOCTL_CREATE_QUEUE _IOWR('S', 0x32, struct snd_seq_queue_info) --#define SNDRV_SEQ_IOCTL_DELETE_QUEUE _IOW ('S', 0x33, struct snd_seq_queue_info) --#define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct snd_seq_queue_info) --#define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct snd_seq_queue_info) --#define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct snd_seq_queue_info) --#define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct snd_seq_queue_status) --#define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct snd_seq_queue_tempo) --#define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct snd_seq_queue_tempo) --#define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct snd_seq_queue_timer) --#define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct snd_seq_queue_timer) --#define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT _IOWR('S', 0x49, struct snd_seq_queue_client) --#define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT _IOW ('S', 0x4a, struct snd_seq_queue_client) --#define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct snd_seq_client_pool) --#define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct snd_seq_client_pool) --#define SNDRV_SEQ_IOCTL_REMOVE_EVENTS _IOW ('S', 0x4e, struct snd_seq_remove_events) --#define SNDRV_SEQ_IOCTL_QUERY_SUBS _IOWR('S', 0x4f, struct snd_seq_query_subs) --#define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION _IOWR('S', 0x50, struct snd_seq_port_subscribe) --#define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT _IOWR('S', 0x51, struct snd_seq_client_info) --#define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct snd_seq_port_info) -- --#endif /* _UAPI__SOUND_ASEQUENCER_H */ -+#include -diff --git a/include/sound/asoc.h b/include/sound/asoc.h -index a74ca232..185bba81 100644 ---- a/include/sound/asoc.h -+++ b/include/sound/asoc.h -@@ -1,633 +1 @@ --/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ --/* -- * uapi/sound/asoc.h -- ALSA SoC Firmware Controls and DAPM -- * -- * Copyright (C) 2012 Texas Instruments Inc. -- * Copyright (C) 2015 Intel Corporation. -- * -- * This program is free software; you can redistribute it and/or modify -- * it under the terms of the GNU General Public License version 2 as -- * published by the Free Software Foundation. -- * -- * Simple file API to load FW that includes mixers, coefficients, DAPM graphs, -- * algorithms, equalisers, DAIs, widgets etc. --*/ -- --#ifndef __LINUX_UAPI_SND_ASOC_H --#define __LINUX_UAPI_SND_ASOC_H -- --#include --#include -- --/* -- * Maximum number of channels topology kcontrol can represent. -- */ --#define SND_SOC_TPLG_MAX_CHAN 8 -- --/* -- * Maximum number of PCM formats capability -- */ --#define SND_SOC_TPLG_MAX_FORMATS 16 -- --/* -- * Maximum number of PCM stream configs -- */ --#define SND_SOC_TPLG_STREAM_CONFIG_MAX 8 -- --/* -- * Maximum number of physical link's hardware configs -- */ --#define SND_SOC_TPLG_HW_CONFIG_MAX 8 -- --/* individual kcontrol info types - can be mixed with other types */ --#define SND_SOC_TPLG_CTL_VOLSW 1 --#define SND_SOC_TPLG_CTL_VOLSW_SX 2 --#define SND_SOC_TPLG_CTL_VOLSW_XR_SX 3 --#define SND_SOC_TPLG_CTL_ENUM 4 --#define SND_SOC_TPLG_CTL_BYTES 5 --#define SND_SOC_TPLG_CTL_ENUM_VALUE 6 --#define SND_SOC_TPLG_CTL_RANGE 7 --#define SND_SOC_TPLG_CTL_STROBE 8 -- -- --/* individual widget kcontrol info types - can be mixed with other types */ --#define SND_SOC_TPLG_DAPM_CTL_VOLSW 64 --#define SND_SOC_TPLG_DAPM_CTL_ENUM_DOUBLE 65 --#define SND_SOC_TPLG_DAPM_CTL_ENUM_VIRT 66 --#define SND_SOC_TPLG_DAPM_CTL_ENUM_VALUE 67 --#define SND_SOC_TPLG_DAPM_CTL_PIN 68 -- --/* DAPM widget types - add new items to the end */ --#define SND_SOC_TPLG_DAPM_INPUT 0 --#define SND_SOC_TPLG_DAPM_OUTPUT 1 --#define SND_SOC_TPLG_DAPM_MUX 2 --#define SND_SOC_TPLG_DAPM_MIXER 3 --#define SND_SOC_TPLG_DAPM_PGA 4 --#define SND_SOC_TPLG_DAPM_OUT_DRV 5 --#define SND_SOC_TPLG_DAPM_ADC 6 --#define SND_SOC_TPLG_DAPM_DAC 7 --#define SND_SOC_TPLG_DAPM_SWITCH 8 --#define SND_SOC_TPLG_DAPM_PRE 9 --#define SND_SOC_TPLG_DAPM_POST 10 --#define SND_SOC_TPLG_DAPM_AIF_IN 11 --#define SND_SOC_TPLG_DAPM_AIF_OUT 12 --#define SND_SOC_TPLG_DAPM_DAI_IN 13 --#define SND_SOC_TPLG_DAPM_DAI_OUT 14 --#define SND_SOC_TPLG_DAPM_DAI_LINK 15 --#define SND_SOC_TPLG_DAPM_BUFFER 16 --#define SND_SOC_TPLG_DAPM_SCHEDULER 17 --#define SND_SOC_TPLG_DAPM_EFFECT 18 --#define SND_SOC_TPLG_DAPM_SIGGEN 19 --#define SND_SOC_TPLG_DAPM_SRC 20 --#define SND_SOC_TPLG_DAPM_ASRC 21 --#define SND_SOC_TPLG_DAPM_ENCODER 22 --#define SND_SOC_TPLG_DAPM_DECODER 23 --#define SND_SOC_TPLG_DAPM_LAST SND_SOC_TPLG_DAPM_DECODER -- --/* Header magic number and string sizes */ --#define SND_SOC_TPLG_MAGIC 0x41536F43 /* ASoC */ -- --/* string sizes */ --#define SND_SOC_TPLG_NUM_TEXTS 16 -- --/* ABI version */ --#define SND_SOC_TPLG_ABI_VERSION 0x5 /* current version */ --#define SND_SOC_TPLG_ABI_VERSION_MIN 0x4 /* oldest version supported */ -- --/* Max size of TLV data */ --#define SND_SOC_TPLG_TLV_SIZE 32 -- --/* -- * File and Block header data types. -- * Add new generic and vendor types to end of list. -- * Generic types are handled by the core whilst vendors types are passed -- * to the component drivers for handling. -- */ --#define SND_SOC_TPLG_TYPE_MIXER 1 --#define SND_SOC_TPLG_TYPE_BYTES 2 --#define SND_SOC_TPLG_TYPE_ENUM 3 --#define SND_SOC_TPLG_TYPE_DAPM_GRAPH 4 --#define SND_SOC_TPLG_TYPE_DAPM_WIDGET 5 --#define SND_SOC_TPLG_TYPE_DAI_LINK 6 --#define SND_SOC_TPLG_TYPE_PCM 7 --#define SND_SOC_TPLG_TYPE_MANIFEST 8 --#define SND_SOC_TPLG_TYPE_CODEC_LINK 9 --#define SND_SOC_TPLG_TYPE_BACKEND_LINK 10 --#define SND_SOC_TPLG_TYPE_PDATA 11 --#define SND_SOC_TPLG_TYPE_DAI 12 --#define SND_SOC_TPLG_TYPE_MAX SND_SOC_TPLG_TYPE_DAI -- --/* vendor block IDs - please add new vendor types to end */ --#define SND_SOC_TPLG_TYPE_VENDOR_FW 1000 --#define SND_SOC_TPLG_TYPE_VENDOR_CONFIG 1001 --#define SND_SOC_TPLG_TYPE_VENDOR_COEFF 1002 --#define SND_SOC_TPLG_TYPEVENDOR_CODEC 1003 -- --#define SND_SOC_TPLG_STREAM_PLAYBACK 0 --#define SND_SOC_TPLG_STREAM_CAPTURE 1 -- --/* vendor tuple types */ --#define SND_SOC_TPLG_TUPLE_TYPE_UUID 0 --#define SND_SOC_TPLG_TUPLE_TYPE_STRING 1 --#define SND_SOC_TPLG_TUPLE_TYPE_BOOL 2 --#define SND_SOC_TPLG_TUPLE_TYPE_BYTE 3 --#define SND_SOC_TPLG_TUPLE_TYPE_WORD 4 --#define SND_SOC_TPLG_TUPLE_TYPE_SHORT 5 -- --/* DAI flags */ --#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_RATES (1 << 0) --#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_CHANNELS (1 << 1) --#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2) -- --/* DAI clock gating */ --#define SND_SOC_TPLG_DAI_CLK_GATE_UNDEFINED 0 --#define SND_SOC_TPLG_DAI_CLK_GATE_GATED 1 --#define SND_SOC_TPLG_DAI_CLK_GATE_CONT 2 -- --/* DAI mclk_direction */ --#define SND_SOC_TPLG_MCLK_CO 0 /* for codec, mclk is output */ --#define SND_SOC_TPLG_MCLK_CI 1 /* for codec, mclk is input */ -- --/* DAI physical PCM data formats. -- * Add new formats to the end of the list. -- */ --#define SND_SOC_DAI_FORMAT_I2S 1 /* I2S mode */ --#define SND_SOC_DAI_FORMAT_RIGHT_J 2 /* Right Justified mode */ --#define SND_SOC_DAI_FORMAT_LEFT_J 3 /* Left Justified mode */ --#define SND_SOC_DAI_FORMAT_DSP_A 4 /* L data MSB after FRM LRC */ --#define SND_SOC_DAI_FORMAT_DSP_B 5 /* L data MSB during FRM LRC */ --#define SND_SOC_DAI_FORMAT_AC97 6 /* AC97 */ --#define SND_SOC_DAI_FORMAT_PDM 7 /* Pulse density modulation */ -- --/* left and right justified also known as MSB and LSB respectively */ --#define SND_SOC_DAI_FORMAT_MSB SND_SOC_DAI_FORMAT_LEFT_J --#define SND_SOC_DAI_FORMAT_LSB SND_SOC_DAI_FORMAT_RIGHT_J -- --/* DAI link flags */ --#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_RATES (1 << 0) --#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_CHANNELS (1 << 1) --#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2) --#define SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP (1 << 3) -- --/* DAI topology BCLK parameter -- * For the backwards capability, by default codec is bclk master -- */ --#define SND_SOC_TPLG_BCLK_CM 0 /* codec is bclk master */ --#define SND_SOC_TPLG_BCLK_CS 1 /* codec is bclk slave */ -- --/* DAI topology FSYNC parameter -- * For the backwards capability, by default codec is fsync master -- */ --#define SND_SOC_TPLG_FSYNC_CM 0 /* codec is fsync master */ --#define SND_SOC_TPLG_FSYNC_CS 1 /* codec is fsync slave */ -- --/* -- * Block Header. -- * This header precedes all object and object arrays below. -- */ --struct snd_soc_tplg_hdr { -- __le32 magic; /* magic number */ -- __le32 abi; /* ABI version */ -- __le32 version; /* optional vendor specific version details */ -- __le32 type; /* SND_SOC_TPLG_TYPE_ */ -- __le32 size; /* size of this structure */ -- __le32 vendor_type; /* optional vendor specific type info */ -- __le32 payload_size; /* data bytes, excluding this header */ -- __le32 index; /* identifier for block */ -- __le32 count; /* number of elements in block */ --} __attribute__((packed)); -- --/* vendor tuple for uuid */ --struct snd_soc_tplg_vendor_uuid_elem { -- __le32 token; -- char uuid[16]; --} __attribute__((packed)); -- --/* vendor tuple for a bool/byte/short/word value */ --struct snd_soc_tplg_vendor_value_elem { -- __le32 token; -- __le32 value; --} __attribute__((packed)); -- --/* vendor tuple for string */ --struct snd_soc_tplg_vendor_string_elem { -- __le32 token; -- char string[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; --} __attribute__((packed)); -- --struct snd_soc_tplg_vendor_array { -- __le32 size; /* size in bytes of the array, including all elements */ -- __le32 type; /* SND_SOC_TPLG_TUPLE_TYPE_ */ -- __le32 num_elems; /* number of elements in array */ -- union { -- struct snd_soc_tplg_vendor_uuid_elem uuid[0]; -- struct snd_soc_tplg_vendor_value_elem value[0]; -- struct snd_soc_tplg_vendor_string_elem string[0]; -- }; --} __attribute__((packed)); -- --/* -- * Private data. -- * All topology objects may have private data that can be used by the driver or -- * firmware. Core will ignore this data. -- */ --struct snd_soc_tplg_private { -- __le32 size; /* in bytes of private data */ -- union { -- char data[0]; -- struct snd_soc_tplg_vendor_array array[0]; -- }; --} __attribute__((packed)); -- --/* -- * Kcontrol TLV data. -- */ --struct snd_soc_tplg_tlv_dbscale { -- __le32 min; -- __le32 step; -- __le32 mute; --} __attribute__((packed)); -- --struct snd_soc_tplg_ctl_tlv { -- __le32 size; /* in bytes of this structure */ -- __le32 type; /* SNDRV_CTL_TLVT_*, type of TLV */ -- union { -- __le32 data[SND_SOC_TPLG_TLV_SIZE]; -- struct snd_soc_tplg_tlv_dbscale scale; -- }; --} __attribute__((packed)); -- --/* -- * Kcontrol channel data -- */ --struct snd_soc_tplg_channel { -- __le32 size; /* in bytes of this structure */ -- __le32 reg; -- __le32 shift; -- __le32 id; /* ID maps to Left, Right, LFE etc */ --} __attribute__((packed)); -- --/* -- * Genericl Operations IDs, for binding Kcontrol or Bytes ext ops -- * Kcontrol ops need get/put/info. -- * Bytes ext ops need get/put. -- */ --struct snd_soc_tplg_io_ops { -- __le32 get; -- __le32 put; -- __le32 info; --} __attribute__((packed)); -- --/* -- * kcontrol header -- */ --struct snd_soc_tplg_ctl_hdr { -- __le32 size; /* in bytes of this structure */ -- __le32 type; -- char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; -- __le32 access; -- struct snd_soc_tplg_io_ops ops; -- struct snd_soc_tplg_ctl_tlv tlv; --} __attribute__((packed)); -- --/* -- * Stream Capabilities -- */ --struct snd_soc_tplg_stream_caps { -- __le32 size; /* in bytes of this structure */ -- char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; -- __le64 formats; /* supported formats SNDRV_PCM_FMTBIT_* */ -- __le32 rates; /* supported rates SNDRV_PCM_RATE_* */ -- __le32 rate_min; /* min rate */ -- __le32 rate_max; /* max rate */ -- __le32 channels_min; /* min channels */ -- __le32 channels_max; /* max channels */ -- __le32 periods_min; /* min number of periods */ -- __le32 periods_max; /* max number of periods */ -- __le32 period_size_min; /* min period size bytes */ -- __le32 period_size_max; /* max period size bytes */ -- __le32 buffer_size_min; /* min buffer size bytes */ -- __le32 buffer_size_max; /* max buffer size bytes */ -- __le32 sig_bits; /* number of bits of content */ --} __attribute__((packed)); -- --/* -- * FE or BE Stream configuration supported by SW/FW -- */ --struct snd_soc_tplg_stream { -- __le32 size; /* in bytes of this structure */ -- char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* Name of the stream */ -- __le64 format; /* SNDRV_PCM_FMTBIT_* */ -- __le32 rate; /* SNDRV_PCM_RATE_* */ -- __le32 period_bytes; /* size of period in bytes */ -- __le32 buffer_bytes; /* size of buffer in bytes */ -- __le32 channels; /* channels */ --} __attribute__((packed)); -- -- --/* -- * Describes a physical link's runtime supported hardware config, -- * i.e. hardware audio formats. -- */ --struct snd_soc_tplg_hw_config { -- __le32 size; /* in bytes of this structure */ -- __le32 id; /* unique ID - - used to match */ -- __le32 fmt; /* SND_SOC_DAI_FORMAT_ format value */ -- __u8 clock_gated; /* SND_SOC_TPLG_DAI_CLK_GATE_ value */ -- __u8 invert_bclk; /* 1 for inverted BCLK, 0 for normal */ -- __u8 invert_fsync; /* 1 for inverted frame clock, 0 for normal */ -- __u8 bclk_master; /* SND_SOC_TPLG_BCLK_ value */ -- __u8 fsync_master; /* SND_SOC_TPLG_FSYNC_ value */ -- __u8 mclk_direction; /* SND_SOC_TPLG_MCLK_ value */ -- __le16 reserved; /* for 32bit alignment */ -- __le32 mclk_rate; /* MCLK or SYSCLK freqency in Hz */ -- __le32 bclk_rate; /* BCLK freqency in Hz */ -- __le32 fsync_rate; /* frame clock in Hz */ -- __le32 tdm_slots; /* number of TDM slots in use */ -- __le32 tdm_slot_width; /* width in bits for each slot */ -- __le32 tx_slots; /* bit mask for active Tx slots */ -- __le32 rx_slots; /* bit mask for active Rx slots */ -- __le32 tx_channels; /* number of Tx channels */ -- __le32 tx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */ -- __le32 rx_channels; /* number of Rx channels */ -- __le32 rx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */ --} __attribute__((packed)); -- --/* -- * Manifest. List totals for each payload type. Not used in parsing, but will -- * be passed to the component driver before any other objects in order for any -- * global component resource allocations. -- * -- * File block representation for manifest :- -- * +-----------------------------------+----+ -- * | struct snd_soc_tplg_hdr | 1 | -- * +-----------------------------------+----+ -- * | struct snd_soc_tplg_manifest | 1 | -- * +-----------------------------------+----+ -- */ --struct snd_soc_tplg_manifest { -- __le32 size; /* in bytes of this structure */ -- __le32 control_elems; /* number of control elements */ -- __le32 widget_elems; /* number of widget elements */ -- __le32 graph_elems; /* number of graph elements */ -- __le32 pcm_elems; /* number of PCM elements */ -- __le32 dai_link_elems; /* number of DAI link elements */ -- __le32 dai_elems; /* number of physical DAI elements */ -- __le32 reserved[20]; /* reserved for new ABI element types */ -- struct snd_soc_tplg_private priv; --} __attribute__((packed)); -- --/* -- * Mixer kcontrol. -- * -- * File block representation for mixer kcontrol :- -- * +-----------------------------------+----+ -- * | struct snd_soc_tplg_hdr | 1 | -- * +-----------------------------------+----+ -- * | struct snd_soc_tplg_mixer_control | N | -- * +-----------------------------------+----+ -- */ --struct snd_soc_tplg_mixer_control { -- struct snd_soc_tplg_ctl_hdr hdr; -- __le32 size; /* in bytes of this structure */ -- __le32 min; -- __le32 max; -- __le32 platform_max; -- __le32 invert; -- __le32 num_channels; -- struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN]; -- struct snd_soc_tplg_private priv; --} __attribute__((packed)); -- --/* -- * Enumerated kcontrol -- * -- * File block representation for enum kcontrol :- -- * +-----------------------------------+----+ -- * | struct snd_soc_tplg_hdr | 1 | -- * +-----------------------------------+----+ -- * | struct snd_soc_tplg_enum_control | N | -- * +-----------------------------------+----+ -- */ --struct snd_soc_tplg_enum_control { -- struct snd_soc_tplg_ctl_hdr hdr; -- __le32 size; /* in bytes of this structure */ -- __le32 num_channels; -- struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN]; -- __le32 items; -- __le32 mask; -- __le32 count; -- char texts[SND_SOC_TPLG_NUM_TEXTS][SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; -- __le32 values[SND_SOC_TPLG_NUM_TEXTS * SNDRV_CTL_ELEM_ID_NAME_MAXLEN / 4]; -- struct snd_soc_tplg_private priv; --} __attribute__((packed)); -- --/* -- * Bytes kcontrol -- * -- * File block representation for bytes kcontrol :- -- * +-----------------------------------+----+ -- * | struct snd_soc_tplg_hdr | 1 | -- * +-----------------------------------+----+ -- * | struct snd_soc_tplg_bytes_control | N | -- * +-----------------------------------+----+ -- */ --struct snd_soc_tplg_bytes_control { -- struct snd_soc_tplg_ctl_hdr hdr; -- __le32 size; /* in bytes of this structure */ -- __le32 max; -- __le32 mask; -- __le32 base; -- __le32 num_regs; -- struct snd_soc_tplg_io_ops ext_ops; -- struct snd_soc_tplg_private priv; --} __attribute__((packed)); -- --/* -- * DAPM Graph Element -- * -- * File block representation for DAPM graph elements :- -- * +-------------------------------------+----+ -- * | struct snd_soc_tplg_hdr | 1 | -- * +-------------------------------------+----+ -- * | struct snd_soc_tplg_dapm_graph_elem | N | -- * +-------------------------------------+----+ -- */ --struct snd_soc_tplg_dapm_graph_elem { -- char sink[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; -- char control[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; -- char source[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; --} __attribute__((packed)); -- --/* -- * DAPM Widget. -- * -- * File block representation for DAPM widget :- -- * +-------------------------------------+-----+ -- * | struct snd_soc_tplg_hdr | 1 | -- * +-------------------------------------+-----+ -- * | struct snd_soc_tplg_dapm_widget | N | -- * +-------------------------------------+-----+ -- * | struct snd_soc_tplg_enum_control | 0|1 | -- * | struct snd_soc_tplg_mixer_control | 0|N | -- * +-------------------------------------+-----+ -- * -- * Optional enum or mixer control can be appended to the end of each widget -- * in the block. -- */ --struct snd_soc_tplg_dapm_widget { -- __le32 size; /* in bytes of this structure */ -- __le32 id; /* SND_SOC_DAPM_CTL */ -- char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; -- char sname[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; -- -- __le32 reg; /* negative reg = no direct dapm */ -- __le32 shift; /* bits to shift */ -- __le32 mask; /* non-shifted mask */ -- __le32 subseq; /* sort within widget type */ -- __le32 invert; /* invert the power bit */ -- __le32 ignore_suspend; /* kept enabled over suspend */ -- __le16 event_flags; -- __le16 event_type; -- __le32 num_kcontrols; -- struct snd_soc_tplg_private priv; -- /* -- * kcontrols that relate to this widget -- * follow here after widget private data -- */ --} __attribute__((packed)); -- -- --/* -- * Describes SW/FW specific features of PCM (FE DAI & DAI link). -- * -- * File block representation for PCM :- -- * +-----------------------------------+-----+ -- * | struct snd_soc_tplg_hdr | 1 | -- * +-----------------------------------+-----+ -- * | struct snd_soc_tplg_pcm | N | -- * +-----------------------------------+-----+ -- */ --struct snd_soc_tplg_pcm { -- __le32 size; /* in bytes of this structure */ -- char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; -- char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; -- __le32 pcm_id; /* unique ID - used to match with DAI link */ -- __le32 dai_id; /* unique ID - used to match */ -- __le32 playback; /* supports playback mode */ -- __le32 capture; /* supports capture mode */ -- __le32 compress; /* 1 = compressed; 0 = PCM */ -- struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */ -- __le32 num_streams; /* number of streams */ -- struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */ -- __le32 flag_mask; /* bitmask of flags to configure */ -- __le32 flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */ -- struct snd_soc_tplg_private priv; --} __attribute__((packed)); -- -- --/* -- * Describes the physical link runtime supported configs or params -- * -- * File block representation for physical link config :- -- * +-----------------------------------+-----+ -- * | struct snd_soc_tplg_hdr | 1 | -- * +-----------------------------------+-----+ -- * | struct snd_soc_tplg_link_config | N | -- * +-----------------------------------+-----+ -- */ --struct snd_soc_tplg_link_config { -- __le32 size; /* in bytes of this structure */ -- __le32 id; /* unique ID - used to match */ -- char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */ -- char stream_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* stream name - used to match */ -- struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */ -- __le32 num_streams; /* number of streams */ -- struct snd_soc_tplg_hw_config hw_config[SND_SOC_TPLG_HW_CONFIG_MAX]; /* hw configs */ -- __le32 num_hw_configs; /* number of hw configs */ -- __le32 default_hw_config_id; /* default hw config ID for init */ -- __le32 flag_mask; /* bitmask of flags to configure */ -- __le32 flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */ -- struct snd_soc_tplg_private priv; --} __attribute__((packed)); -- --/* -- * Describes SW/FW specific features of physical DAI. -- * It can be used to configure backend DAIs for DPCM. -- * -- * File block representation for physical DAI :- -- * +-----------------------------------+-----+ -- * | struct snd_soc_tplg_hdr | 1 | -- * +-----------------------------------+-----+ -- * | struct snd_soc_tplg_dai | N | -- * +-----------------------------------+-----+ -- */ --struct snd_soc_tplg_dai { -- __le32 size; /* in bytes of this structure */ -- char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */ -- __le32 dai_id; /* unique ID - used to match */ -- __le32 playback; /* supports playback mode */ -- __le32 capture; /* supports capture mode */ -- struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */ -- __le32 flag_mask; /* bitmask of flags to configure */ -- __le32 flags; /* SND_SOC_TPLG_DAI_FLGBIT_* */ -- struct snd_soc_tplg_private priv; --} __attribute__((packed)); -- --/* -- * Old version of ABI structs, supported for backward compatibility. -- */ -- --/* Manifest v4 */ --struct snd_soc_tplg_manifest_v4 { -- __le32 size; /* in bytes of this structure */ -- __le32 control_elems; /* number of control elements */ -- __le32 widget_elems; /* number of widget elements */ -- __le32 graph_elems; /* number of graph elements */ -- __le32 pcm_elems; /* number of PCM elements */ -- __le32 dai_link_elems; /* number of DAI link elements */ -- struct snd_soc_tplg_private priv; --} __packed; -- --/* Stream Capabilities v4 */ --struct snd_soc_tplg_stream_caps_v4 { -- __le32 size; /* in bytes of this structure */ -- char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; -- __le64 formats; /* supported formats SNDRV_PCM_FMTBIT_* */ -- __le32 rates; /* supported rates SNDRV_PCM_RATE_* */ -- __le32 rate_min; /* min rate */ -- __le32 rate_max; /* max rate */ -- __le32 channels_min; /* min channels */ -- __le32 channels_max; /* max channels */ -- __le32 periods_min; /* min number of periods */ -- __le32 periods_max; /* max number of periods */ -- __le32 period_size_min; /* min period size bytes */ -- __le32 period_size_max; /* max period size bytes */ -- __le32 buffer_size_min; /* min buffer size bytes */ -- __le32 buffer_size_max; /* max buffer size bytes */ --} __packed; -- --/* PCM v4 */ --struct snd_soc_tplg_pcm_v4 { -- __le32 size; /* in bytes of this structure */ -- char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; -- char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; -- __le32 pcm_id; /* unique ID - used to match with DAI link */ -- __le32 dai_id; /* unique ID - used to match */ -- __le32 playback; /* supports playback mode */ -- __le32 capture; /* supports capture mode */ -- __le32 compress; /* 1 = compressed; 0 = PCM */ -- struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */ -- __le32 num_streams; /* number of streams */ -- struct snd_soc_tplg_stream_caps_v4 caps[2]; /* playback and capture for DAI */ --} __packed; -- --/* Physical link config v4 */ --struct snd_soc_tplg_link_config_v4 { -- __le32 size; /* in bytes of this structure */ -- __le32 id; /* unique ID - used to match */ -- struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */ -- __le32 num_streams; /* number of streams */ --} __packed; -- --#endif -+#include -diff --git a/include/sound/asound.h b/include/sound/asound.h -index df1153ce..3be4d850 100644 ---- a/include/sound/asound.h -+++ b/include/sound/asound.h -@@ -1,1038 +1 @@ --/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ --/* -- * Advanced Linux Sound Architecture - ALSA - Driver -- * Copyright (c) 1994-2003 by Jaroslav Kysela , -- * Abramo Bagnara -- * -- * -- * This program is free software; you can redistribute it and/or modify -- * it under the terms of the GNU General Public License as published by -- * the Free Software Foundation; either version 2 of the License, or -- * (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU General Public License for more details. -- * -- * You should have received a copy of the GNU General Public License -- * along with this program; if not, write to the Free Software -- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- * -- */ -- --#ifndef _UAPI__SOUND_ASOUND_H --#define _UAPI__SOUND_ASOUND_H -- --#if defined(__KERNEL__) || defined(__linux__) --#include --#else --#include --#endif -- --#ifndef __KERNEL__ --#include --#include --#endif -- --/* -- * protocol version -- */ -- --#define SNDRV_PROTOCOL_VERSION(major, minor, subminor) (((major)<<16)|((minor)<<8)|(subminor)) --#define SNDRV_PROTOCOL_MAJOR(version) (((version)>>16)&0xffff) --#define SNDRV_PROTOCOL_MINOR(version) (((version)>>8)&0xff) --#define SNDRV_PROTOCOL_MICRO(version) ((version)&0xff) --#define SNDRV_PROTOCOL_INCOMPATIBLE(kversion, uversion) \ -- (SNDRV_PROTOCOL_MAJOR(kversion) != SNDRV_PROTOCOL_MAJOR(uversion) || \ -- (SNDRV_PROTOCOL_MAJOR(kversion) == SNDRV_PROTOCOL_MAJOR(uversion) && \ -- SNDRV_PROTOCOL_MINOR(kversion) != SNDRV_PROTOCOL_MINOR(uversion))) -- --/**************************************************************************** -- * * -- * Digital audio interface * -- * * -- ****************************************************************************/ -- --struct snd_aes_iec958 { -- unsigned char status[24]; /* AES/IEC958 channel status bits */ -- unsigned char subcode[147]; /* AES/IEC958 subcode bits */ -- unsigned char pad; /* nothing */ -- unsigned char dig_subframe[4]; /* AES/IEC958 subframe bits */ --}; -- --/**************************************************************************** -- * * -- * CEA-861 Audio InfoFrame. Used in HDMI and DisplayPort * -- * * -- ****************************************************************************/ -- --struct snd_cea_861_aud_if { -- unsigned char db1_ct_cc; /* coding type and channel count */ -- unsigned char db2_sf_ss; /* sample frequency and size */ -- unsigned char db3; /* not used, all zeros */ -- unsigned char db4_ca; /* channel allocation code */ -- unsigned char db5_dminh_lsv; /* downmix inhibit & level-shit values */ --}; -- --/**************************************************************************** -- * * -- * Section for driver hardware dependent interface - /dev/snd/hw? * -- * * -- ****************************************************************************/ -- --#define SNDRV_HWDEP_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1) -- --enum { -- SNDRV_HWDEP_IFACE_OPL2 = 0, -- SNDRV_HWDEP_IFACE_OPL3, -- SNDRV_HWDEP_IFACE_OPL4, -- SNDRV_HWDEP_IFACE_SB16CSP, /* Creative Signal Processor */ -- SNDRV_HWDEP_IFACE_EMU10K1, /* FX8010 processor in EMU10K1 chip */ -- SNDRV_HWDEP_IFACE_YSS225, /* Yamaha FX processor */ -- SNDRV_HWDEP_IFACE_ICS2115, /* Wavetable synth */ -- SNDRV_HWDEP_IFACE_SSCAPE, /* Ensoniq SoundScape ISA card (MC68EC000) */ -- SNDRV_HWDEP_IFACE_VX, /* Digigram VX cards */ -- SNDRV_HWDEP_IFACE_MIXART, /* Digigram miXart cards */ -- SNDRV_HWDEP_IFACE_USX2Y, /* Tascam US122, US224 & US428 usb */ -- SNDRV_HWDEP_IFACE_EMUX_WAVETABLE, /* EmuX wavetable */ -- SNDRV_HWDEP_IFACE_BLUETOOTH, /* Bluetooth audio */ -- SNDRV_HWDEP_IFACE_USX2Y_PCM, /* Tascam US122, US224 & US428 rawusb pcm */ -- SNDRV_HWDEP_IFACE_PCXHR, /* Digigram PCXHR */ -- SNDRV_HWDEP_IFACE_SB_RC, /* SB Extigy/Audigy2NX remote control */ -- SNDRV_HWDEP_IFACE_HDA, /* HD-audio */ -- SNDRV_HWDEP_IFACE_USB_STREAM, /* direct access to usb stream */ -- SNDRV_HWDEP_IFACE_FW_DICE, /* TC DICE FireWire device */ -- SNDRV_HWDEP_IFACE_FW_FIREWORKS, /* Echo Audio Fireworks based device */ -- SNDRV_HWDEP_IFACE_FW_BEBOB, /* BridgeCo BeBoB based device */ -- SNDRV_HWDEP_IFACE_FW_OXFW, /* Oxford OXFW970/971 based device */ -- SNDRV_HWDEP_IFACE_FW_DIGI00X, /* Digidesign Digi 002/003 family */ -- SNDRV_HWDEP_IFACE_FW_TASCAM, /* TASCAM FireWire series */ -- SNDRV_HWDEP_IFACE_LINE6, /* Line6 USB processors */ -- SNDRV_HWDEP_IFACE_FW_MOTU, /* MOTU FireWire series */ -- SNDRV_HWDEP_IFACE_FW_FIREFACE, /* RME Fireface series */ -- -- /* Don't forget to change the following: */ -- SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_FW_FIREFACE --}; -- --struct snd_hwdep_info { -- unsigned int device; /* WR: device number */ -- int card; /* R: card number */ -- unsigned char id[64]; /* ID (user selectable) */ -- unsigned char name[80]; /* hwdep name */ -- int iface; /* hwdep interface */ -- unsigned char reserved[64]; /* reserved for future */ --}; -- --/* generic DSP loader */ --struct snd_hwdep_dsp_status { -- unsigned int version; /* R: driver-specific version */ -- unsigned char id[32]; /* R: driver-specific ID string */ -- unsigned int num_dsps; /* R: number of DSP images to transfer */ -- unsigned int dsp_loaded; /* R: bit flags indicating the loaded DSPs */ -- unsigned int chip_ready; /* R: 1 = initialization finished */ -- unsigned char reserved[16]; /* reserved for future use */ --}; -- --struct snd_hwdep_dsp_image { -- unsigned int index; /* W: DSP index */ -- unsigned char name[64]; /* W: ID (e.g. file name) */ -- unsigned char __user *image; /* W: binary image */ -- size_t length; /* W: size of image in bytes */ -- unsigned long driver_data; /* W: driver-specific data */ --}; -- --#define SNDRV_HWDEP_IOCTL_PVERSION _IOR ('H', 0x00, int) --#define SNDRV_HWDEP_IOCTL_INFO _IOR ('H', 0x01, struct snd_hwdep_info) --#define SNDRV_HWDEP_IOCTL_DSP_STATUS _IOR('H', 0x02, struct snd_hwdep_dsp_status) --#define SNDRV_HWDEP_IOCTL_DSP_LOAD _IOW('H', 0x03, struct snd_hwdep_dsp_image) -- --/***************************************************************************** -- * * -- * Digital Audio (PCM) interface - /dev/snd/pcm?? * -- * * -- *****************************************************************************/ -- --#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 14) -- --typedef unsigned long snd_pcm_uframes_t; --typedef signed long snd_pcm_sframes_t; -- --enum { -- SNDRV_PCM_CLASS_GENERIC = 0, /* standard mono or stereo device */ -- SNDRV_PCM_CLASS_MULTI, /* multichannel device */ -- SNDRV_PCM_CLASS_MODEM, /* software modem class */ -- SNDRV_PCM_CLASS_DIGITIZER, /* digitizer class */ -- /* Don't forget to change the following: */ -- SNDRV_PCM_CLASS_LAST = SNDRV_PCM_CLASS_DIGITIZER, --}; -- --enum { -- SNDRV_PCM_SUBCLASS_GENERIC_MIX = 0, /* mono or stereo subdevices are mixed together */ -- SNDRV_PCM_SUBCLASS_MULTI_MIX, /* multichannel subdevices are mixed together */ -- /* Don't forget to change the following: */ -- SNDRV_PCM_SUBCLASS_LAST = SNDRV_PCM_SUBCLASS_MULTI_MIX, --}; -- --enum { -- SNDRV_PCM_STREAM_PLAYBACK = 0, -- SNDRV_PCM_STREAM_CAPTURE, -- SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE, --}; -- --typedef int __bitwise snd_pcm_access_t; --#define SNDRV_PCM_ACCESS_MMAP_INTERLEAVED ((__force snd_pcm_access_t) 0) /* interleaved mmap */ --#define SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED ((__force snd_pcm_access_t) 1) /* noninterleaved mmap */ --#define SNDRV_PCM_ACCESS_MMAP_COMPLEX ((__force snd_pcm_access_t) 2) /* complex mmap */ --#define SNDRV_PCM_ACCESS_RW_INTERLEAVED ((__force snd_pcm_access_t) 3) /* readi/writei */ --#define SNDRV_PCM_ACCESS_RW_NONINTERLEAVED ((__force snd_pcm_access_t) 4) /* readn/writen */ --#define SNDRV_PCM_ACCESS_LAST SNDRV_PCM_ACCESS_RW_NONINTERLEAVED -- --typedef int __bitwise snd_pcm_format_t; --#define SNDRV_PCM_FORMAT_S8 ((__force snd_pcm_format_t) 0) --#define SNDRV_PCM_FORMAT_U8 ((__force snd_pcm_format_t) 1) --#define SNDRV_PCM_FORMAT_S16_LE ((__force snd_pcm_format_t) 2) --#define SNDRV_PCM_FORMAT_S16_BE ((__force snd_pcm_format_t) 3) --#define SNDRV_PCM_FORMAT_U16_LE ((__force snd_pcm_format_t) 4) --#define SNDRV_PCM_FORMAT_U16_BE ((__force snd_pcm_format_t) 5) --#define SNDRV_PCM_FORMAT_S24_LE ((__force snd_pcm_format_t) 6) /* low three bytes */ --#define SNDRV_PCM_FORMAT_S24_BE ((__force snd_pcm_format_t) 7) /* low three bytes */ --#define SNDRV_PCM_FORMAT_U24_LE ((__force snd_pcm_format_t) 8) /* low three bytes */ --#define SNDRV_PCM_FORMAT_U24_BE ((__force snd_pcm_format_t) 9) /* low three bytes */ --#define SNDRV_PCM_FORMAT_S32_LE ((__force snd_pcm_format_t) 10) --#define SNDRV_PCM_FORMAT_S32_BE ((__force snd_pcm_format_t) 11) --#define SNDRV_PCM_FORMAT_U32_LE ((__force snd_pcm_format_t) 12) --#define SNDRV_PCM_FORMAT_U32_BE ((__force snd_pcm_format_t) 13) --#define SNDRV_PCM_FORMAT_FLOAT_LE ((__force snd_pcm_format_t) 14) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */ --#define SNDRV_PCM_FORMAT_FLOAT_BE ((__force snd_pcm_format_t) 15) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */ --#define SNDRV_PCM_FORMAT_FLOAT64_LE ((__force snd_pcm_format_t) 16) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */ --#define SNDRV_PCM_FORMAT_FLOAT64_BE ((__force snd_pcm_format_t) 17) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */ --#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE ((__force snd_pcm_format_t) 18) /* IEC-958 subframe, Little Endian */ --#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE ((__force snd_pcm_format_t) 19) /* IEC-958 subframe, Big Endian */ --#define SNDRV_PCM_FORMAT_MU_LAW ((__force snd_pcm_format_t) 20) --#define SNDRV_PCM_FORMAT_A_LAW ((__force snd_pcm_format_t) 21) --#define SNDRV_PCM_FORMAT_IMA_ADPCM ((__force snd_pcm_format_t) 22) --#define SNDRV_PCM_FORMAT_MPEG ((__force snd_pcm_format_t) 23) --#define SNDRV_PCM_FORMAT_GSM ((__force snd_pcm_format_t) 24) --#define SNDRV_PCM_FORMAT_S20_LE ((__force snd_pcm_format_t) 25) /* in four bytes, LSB justified */ --#define SNDRV_PCM_FORMAT_S20_BE ((__force snd_pcm_format_t) 26) /* in four bytes, LSB justified */ --#define SNDRV_PCM_FORMAT_U20_LE ((__force snd_pcm_format_t) 27) /* in four bytes, LSB justified */ --#define SNDRV_PCM_FORMAT_U20_BE ((__force snd_pcm_format_t) 28) /* in four bytes, LSB justified */ --/* gap in the numbering for a future standard linear format */ --#define SNDRV_PCM_FORMAT_SPECIAL ((__force snd_pcm_format_t) 31) --#define SNDRV_PCM_FORMAT_S24_3LE ((__force snd_pcm_format_t) 32) /* in three bytes */ --#define SNDRV_PCM_FORMAT_S24_3BE ((__force snd_pcm_format_t) 33) /* in three bytes */ --#define SNDRV_PCM_FORMAT_U24_3LE ((__force snd_pcm_format_t) 34) /* in three bytes */ --#define SNDRV_PCM_FORMAT_U24_3BE ((__force snd_pcm_format_t) 35) /* in three bytes */ --#define SNDRV_PCM_FORMAT_S20_3LE ((__force snd_pcm_format_t) 36) /* in three bytes */ --#define SNDRV_PCM_FORMAT_S20_3BE ((__force snd_pcm_format_t) 37) /* in three bytes */ --#define SNDRV_PCM_FORMAT_U20_3LE ((__force snd_pcm_format_t) 38) /* in three bytes */ --#define SNDRV_PCM_FORMAT_U20_3BE ((__force snd_pcm_format_t) 39) /* in three bytes */ --#define SNDRV_PCM_FORMAT_S18_3LE ((__force snd_pcm_format_t) 40) /* in three bytes */ --#define SNDRV_PCM_FORMAT_S18_3BE ((__force snd_pcm_format_t) 41) /* in three bytes */ --#define SNDRV_PCM_FORMAT_U18_3LE ((__force snd_pcm_format_t) 42) /* in three bytes */ --#define SNDRV_PCM_FORMAT_U18_3BE ((__force snd_pcm_format_t) 43) /* in three bytes */ --#define SNDRV_PCM_FORMAT_G723_24 ((__force snd_pcm_format_t) 44) /* 8 samples in 3 bytes */ --#define SNDRV_PCM_FORMAT_G723_24_1B ((__force snd_pcm_format_t) 45) /* 1 sample in 1 byte */ --#define SNDRV_PCM_FORMAT_G723_40 ((__force snd_pcm_format_t) 46) /* 8 Samples in 5 bytes */ --#define SNDRV_PCM_FORMAT_G723_40_1B ((__force snd_pcm_format_t) 47) /* 1 sample in 1 byte */ --#define SNDRV_PCM_FORMAT_DSD_U8 ((__force snd_pcm_format_t) 48) /* DSD, 1-byte samples DSD (x8) */ --#define SNDRV_PCM_FORMAT_DSD_U16_LE ((__force snd_pcm_format_t) 49) /* DSD, 2-byte samples DSD (x16), little endian */ --#define SNDRV_PCM_FORMAT_DSD_U32_LE ((__force snd_pcm_format_t) 50) /* DSD, 4-byte samples DSD (x32), little endian */ --#define SNDRV_PCM_FORMAT_DSD_U16_BE ((__force snd_pcm_format_t) 51) /* DSD, 2-byte samples DSD (x16), big endian */ --#define SNDRV_PCM_FORMAT_DSD_U32_BE ((__force snd_pcm_format_t) 52) /* DSD, 4-byte samples DSD (x32), big endian */ --#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U32_BE --#define SNDRV_PCM_FORMAT_FIRST SNDRV_PCM_FORMAT_S8 -- --#ifdef SNDRV_LITTLE_ENDIAN --#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE --#define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_LE --#define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_LE --#define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_LE --#define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_LE --#define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_LE --#define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_LE --#define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_LE --#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE --#define SNDRV_PCM_FORMAT_S20 SNDRV_PCM_FORMAT_S20_LE --#define SNDRV_PCM_FORMAT_U20 SNDRV_PCM_FORMAT_U20_LE --#endif --#ifdef SNDRV_BIG_ENDIAN --#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_BE --#define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_BE --#define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_BE --#define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_BE --#define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_BE --#define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_BE --#define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_BE --#define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_BE --#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE --#define SNDRV_PCM_FORMAT_S20 SNDRV_PCM_FORMAT_S20_BE --#define SNDRV_PCM_FORMAT_U20 SNDRV_PCM_FORMAT_U20_BE --#endif -- --typedef int __bitwise snd_pcm_subformat_t; --#define SNDRV_PCM_SUBFORMAT_STD ((__force snd_pcm_subformat_t) 0) --#define SNDRV_PCM_SUBFORMAT_LAST SNDRV_PCM_SUBFORMAT_STD -- --#define SNDRV_PCM_INFO_MMAP 0x00000001 /* hardware supports mmap */ --#define SNDRV_PCM_INFO_MMAP_VALID 0x00000002 /* period data are valid during transfer */ --#define SNDRV_PCM_INFO_DOUBLE 0x00000004 /* Double buffering needed for PCM start/stop */ --#define SNDRV_PCM_INFO_BATCH 0x00000010 /* double buffering */ --#define SNDRV_PCM_INFO_SYNC_APPLPTR 0x00000020 /* need the explicit sync of appl_ptr update */ --#define SNDRV_PCM_INFO_INTERLEAVED 0x00000100 /* channels are interleaved */ --#define SNDRV_PCM_INFO_NONINTERLEAVED 0x00000200 /* channels are not interleaved */ --#define SNDRV_PCM_INFO_COMPLEX 0x00000400 /* complex frame organization (mmap only) */ --#define SNDRV_PCM_INFO_BLOCK_TRANSFER 0x00010000 /* hardware transfer block of samples */ --#define SNDRV_PCM_INFO_OVERRANGE 0x00020000 /* hardware supports ADC (capture) overrange detection */ --#define SNDRV_PCM_INFO_RESUME 0x00040000 /* hardware supports stream resume after suspend */ --#define SNDRV_PCM_INFO_PAUSE 0x00080000 /* pause ioctl is supported */ --#define SNDRV_PCM_INFO_HALF_DUPLEX 0x00100000 /* only half duplex */ --#define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000 /* playback and capture stream are somewhat correlated */ --#define SNDRV_PCM_INFO_SYNC_START 0x00400000 /* pcm support some kind of sync go */ --#define SNDRV_PCM_INFO_NO_PERIOD_WAKEUP 0x00800000 /* period wakeup can be disabled */ --#define SNDRV_PCM_INFO_HAS_WALL_CLOCK 0x01000000 /* (Deprecated)has audio wall clock for audio/system time sync */ --#define SNDRV_PCM_INFO_HAS_LINK_ATIME 0x01000000 /* report hardware link audio time, reset on startup */ --#define SNDRV_PCM_INFO_HAS_LINK_ABSOLUTE_ATIME 0x02000000 /* report absolute hardware link audio time, not reset on startup */ --#define SNDRV_PCM_INFO_HAS_LINK_ESTIMATED_ATIME 0x04000000 /* report estimated link audio time */ --#define SNDRV_PCM_INFO_HAS_LINK_SYNCHRONIZED_ATIME 0x08000000 /* report synchronized audio/system time */ -- --#define SNDRV_PCM_INFO_DRAIN_TRIGGER 0x40000000 /* internal kernel flag - trigger in drain */ --#define SNDRV_PCM_INFO_FIFO_IN_FRAMES 0x80000000 /* internal kernel flag - FIFO size is in frames */ -- -- -- --typedef int __bitwise snd_pcm_state_t; --#define SNDRV_PCM_STATE_OPEN ((__force snd_pcm_state_t) 0) /* stream is open */ --#define SNDRV_PCM_STATE_SETUP ((__force snd_pcm_state_t) 1) /* stream has a setup */ --#define SNDRV_PCM_STATE_PREPARED ((__force snd_pcm_state_t) 2) /* stream is ready to start */ --#define SNDRV_PCM_STATE_RUNNING ((__force snd_pcm_state_t) 3) /* stream is running */ --#define SNDRV_PCM_STATE_XRUN ((__force snd_pcm_state_t) 4) /* stream reached an xrun */ --#define SNDRV_PCM_STATE_DRAINING ((__force snd_pcm_state_t) 5) /* stream is draining */ --#define SNDRV_PCM_STATE_PAUSED ((__force snd_pcm_state_t) 6) /* stream is paused */ --#define SNDRV_PCM_STATE_SUSPENDED ((__force snd_pcm_state_t) 7) /* hardware is suspended */ --#define SNDRV_PCM_STATE_DISCONNECTED ((__force snd_pcm_state_t) 8) /* hardware is disconnected */ --#define SNDRV_PCM_STATE_LAST SNDRV_PCM_STATE_DISCONNECTED -- --enum { -- SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000, -- SNDRV_PCM_MMAP_OFFSET_STATUS = 0x80000000, -- SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000, --}; -- --union snd_pcm_sync_id { -- unsigned char id[16]; -- unsigned short id16[8]; -- unsigned int id32[4]; --}; -- --struct snd_pcm_info { -- unsigned int device; /* RO/WR (control): device number */ -- unsigned int subdevice; /* RO/WR (control): subdevice number */ -- int stream; /* RO/WR (control): stream direction */ -- int card; /* R: card number */ -- unsigned char id[64]; /* ID (user selectable) */ -- unsigned char name[80]; /* name of this device */ -- unsigned char subname[32]; /* subdevice name */ -- int dev_class; /* SNDRV_PCM_CLASS_* */ -- int dev_subclass; /* SNDRV_PCM_SUBCLASS_* */ -- unsigned int subdevices_count; -- unsigned int subdevices_avail; -- union snd_pcm_sync_id sync; /* hardware synchronization ID */ -- unsigned char reserved[64]; /* reserved for future... */ --}; -- --typedef int snd_pcm_hw_param_t; --#define SNDRV_PCM_HW_PARAM_ACCESS 0 /* Access type */ --#define SNDRV_PCM_HW_PARAM_FORMAT 1 /* Format */ --#define SNDRV_PCM_HW_PARAM_SUBFORMAT 2 /* Subformat */ --#define SNDRV_PCM_HW_PARAM_FIRST_MASK SNDRV_PCM_HW_PARAM_ACCESS --#define SNDRV_PCM_HW_PARAM_LAST_MASK SNDRV_PCM_HW_PARAM_SUBFORMAT -- --#define SNDRV_PCM_HW_PARAM_SAMPLE_BITS 8 /* Bits per sample */ --#define SNDRV_PCM_HW_PARAM_FRAME_BITS 9 /* Bits per frame */ --#define SNDRV_PCM_HW_PARAM_CHANNELS 10 /* Channels */ --#define SNDRV_PCM_HW_PARAM_RATE 11 /* Approx rate */ --#define SNDRV_PCM_HW_PARAM_PERIOD_TIME 12 /* Approx distance between -- * interrupts in us -- */ --#define SNDRV_PCM_HW_PARAM_PERIOD_SIZE 13 /* Approx frames between -- * interrupts -- */ --#define SNDRV_PCM_HW_PARAM_PERIOD_BYTES 14 /* Approx bytes between -- * interrupts -- */ --#define SNDRV_PCM_HW_PARAM_PERIODS 15 /* Approx interrupts per -- * buffer -- */ --#define SNDRV_PCM_HW_PARAM_BUFFER_TIME 16 /* Approx duration of buffer -- * in us -- */ --#define SNDRV_PCM_HW_PARAM_BUFFER_SIZE 17 /* Size of buffer in frames */ --#define SNDRV_PCM_HW_PARAM_BUFFER_BYTES 18 /* Size of buffer in bytes */ --#define SNDRV_PCM_HW_PARAM_TICK_TIME 19 /* Approx tick duration in us */ --#define SNDRV_PCM_HW_PARAM_FIRST_INTERVAL SNDRV_PCM_HW_PARAM_SAMPLE_BITS --#define SNDRV_PCM_HW_PARAM_LAST_INTERVAL SNDRV_PCM_HW_PARAM_TICK_TIME -- --#define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */ --#define SNDRV_PCM_HW_PARAMS_EXPORT_BUFFER (1<<1) /* export buffer */ --#define SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP (1<<2) /* disable period wakeups */ -- --struct snd_interval { -- unsigned int min, max; -- unsigned int openmin:1, -- openmax:1, -- integer:1, -- empty:1; --}; -- --#define SNDRV_MASK_MAX 256 -- --struct snd_mask { -- __u32 bits[(SNDRV_MASK_MAX+31)/32]; --}; -- --struct snd_pcm_hw_params { -- unsigned int flags; -- struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK - -- SNDRV_PCM_HW_PARAM_FIRST_MASK + 1]; -- struct snd_mask mres[5]; /* reserved masks */ -- struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL - -- SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1]; -- struct snd_interval ires[9]; /* reserved intervals */ -- unsigned int rmask; /* W: requested masks */ -- unsigned int cmask; /* R: changed masks */ -- unsigned int info; /* R: Info flags for returned setup */ -- unsigned int msbits; /* R: used most significant bits */ -- unsigned int rate_num; /* R: rate numerator */ -- unsigned int rate_den; /* R: rate denominator */ -- snd_pcm_uframes_t fifo_size; /* R: chip FIFO size in frames */ -- unsigned char reserved[64]; /* reserved for future */ --}; -- --enum { -- SNDRV_PCM_TSTAMP_NONE = 0, -- SNDRV_PCM_TSTAMP_ENABLE, -- SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_ENABLE, --}; -- --struct snd_pcm_sw_params { -- int tstamp_mode; /* timestamp mode */ -- unsigned int period_step; -- unsigned int sleep_min; /* min ticks to sleep */ -- snd_pcm_uframes_t avail_min; /* min avail frames for wakeup */ -- snd_pcm_uframes_t xfer_align; /* obsolete: xfer size need to be a multiple */ -- snd_pcm_uframes_t start_threshold; /* min hw_avail frames for automatic start */ -- snd_pcm_uframes_t stop_threshold; /* min avail frames for automatic stop */ -- snd_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */ -- snd_pcm_uframes_t silence_size; /* silence block size */ -- snd_pcm_uframes_t boundary; /* pointers wrap point */ -- unsigned int proto; /* protocol version */ -- unsigned int tstamp_type; /* timestamp type (req. proto >= 2.0.12) */ -- unsigned char reserved[56]; /* reserved for future */ --}; -- --struct snd_pcm_channel_info { -- unsigned int channel; -- __kernel_off_t offset; /* mmap offset */ -- unsigned int first; /* offset to first sample in bits */ -- unsigned int step; /* samples distance in bits */ --}; -- --enum { -- /* -- * first definition for backwards compatibility only, -- * maps to wallclock/link time for HDAudio playback and DEFAULT/DMA time for everything else -- */ -- SNDRV_PCM_AUDIO_TSTAMP_TYPE_COMPAT = 0, -- -- /* timestamp definitions */ -- SNDRV_PCM_AUDIO_TSTAMP_TYPE_DEFAULT = 1, /* DMA time, reported as per hw_ptr */ -- SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK = 2, /* link time reported by sample or wallclock counter, reset on startup */ -- SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_ABSOLUTE = 3, /* link time reported by sample or wallclock counter, not reset on startup */ -- SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_ESTIMATED = 4, /* link time estimated indirectly */ -- SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED = 5, /* link time synchronized with system time */ -- SNDRV_PCM_AUDIO_TSTAMP_TYPE_LAST = SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED --}; -- --struct snd_pcm_status { -- snd_pcm_state_t state; /* stream state */ -- struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */ -- struct timespec tstamp; /* reference timestamp */ -- snd_pcm_uframes_t appl_ptr; /* appl ptr */ -- snd_pcm_uframes_t hw_ptr; /* hw ptr */ -- snd_pcm_sframes_t delay; /* current delay in frames */ -- snd_pcm_uframes_t avail; /* number of frames available */ -- snd_pcm_uframes_t avail_max; /* max frames available on hw since last status */ -- snd_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */ -- snd_pcm_state_t suspended_state; /* suspended stream state */ -- __u32 audio_tstamp_data; /* needed for 64-bit alignment, used for configs/report to/from userspace */ -- struct timespec audio_tstamp; /* sample counter, wall clock, PHC or on-demand sync'ed */ -- struct timespec driver_tstamp; /* useful in case reference system tstamp is reported with delay */ -- __u32 audio_tstamp_accuracy; /* in ns units, only valid if indicated in audio_tstamp_data */ -- unsigned char reserved[52-2*sizeof(struct timespec)]; /* must be filled with zero */ --}; -- --struct snd_pcm_mmap_status { -- snd_pcm_state_t state; /* RO: state - SNDRV_PCM_STATE_XXXX */ -- int pad1; /* Needed for 64 bit alignment */ -- snd_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */ -- struct timespec tstamp; /* Timestamp */ -- snd_pcm_state_t suspended_state; /* RO: suspended stream state */ -- struct timespec audio_tstamp; /* from sample counter or wall clock */ --}; -- --struct snd_pcm_mmap_control { -- snd_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */ -- snd_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */ --}; -- --#define SNDRV_PCM_SYNC_PTR_HWSYNC (1<<0) /* execute hwsync */ --#define SNDRV_PCM_SYNC_PTR_APPL (1<<1) /* get appl_ptr from driver (r/w op) */ --#define SNDRV_PCM_SYNC_PTR_AVAIL_MIN (1<<2) /* get avail_min from driver */ -- --struct snd_pcm_sync_ptr { -- unsigned int flags; -- union { -- struct snd_pcm_mmap_status status; -- unsigned char reserved[64]; -- } s; -- union { -- struct snd_pcm_mmap_control control; -- unsigned char reserved[64]; -- } c; --}; -- --struct snd_xferi { -- snd_pcm_sframes_t result; -- void __user *buf; -- snd_pcm_uframes_t frames; --}; -- --struct snd_xfern { -- snd_pcm_sframes_t result; -- void __user * __user *bufs; -- snd_pcm_uframes_t frames; --}; -- --enum { -- SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, /* gettimeofday equivalent */ -- SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, /* posix_clock_monotonic equivalent */ -- SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW, /* monotonic_raw (no NTP) */ -- SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW, --}; -- --/* channel positions */ --enum { -- SNDRV_CHMAP_UNKNOWN = 0, -- SNDRV_CHMAP_NA, /* N/A, silent */ -- SNDRV_CHMAP_MONO, /* mono stream */ -- /* this follows the alsa-lib mixer channel value + 3 */ -- SNDRV_CHMAP_FL, /* front left */ -- SNDRV_CHMAP_FR, /* front right */ -- SNDRV_CHMAP_RL, /* rear left */ -- SNDRV_CHMAP_RR, /* rear right */ -- SNDRV_CHMAP_FC, /* front center */ -- SNDRV_CHMAP_LFE, /* LFE */ -- SNDRV_CHMAP_SL, /* side left */ -- SNDRV_CHMAP_SR, /* side right */ -- SNDRV_CHMAP_RC, /* rear center */ -- /* new definitions */ -- SNDRV_CHMAP_FLC, /* front left center */ -- SNDRV_CHMAP_FRC, /* front right center */ -- SNDRV_CHMAP_RLC, /* rear left center */ -- SNDRV_CHMAP_RRC, /* rear right center */ -- SNDRV_CHMAP_FLW, /* front left wide */ -- SNDRV_CHMAP_FRW, /* front right wide */ -- SNDRV_CHMAP_FLH, /* front left high */ -- SNDRV_CHMAP_FCH, /* front center high */ -- SNDRV_CHMAP_FRH, /* front right high */ -- SNDRV_CHMAP_TC, /* top center */ -- SNDRV_CHMAP_TFL, /* top front left */ -- SNDRV_CHMAP_TFR, /* top front right */ -- SNDRV_CHMAP_TFC, /* top front center */ -- SNDRV_CHMAP_TRL, /* top rear left */ -- SNDRV_CHMAP_TRR, /* top rear right */ -- SNDRV_CHMAP_TRC, /* top rear center */ -- /* new definitions for UAC2 */ -- SNDRV_CHMAP_TFLC, /* top front left center */ -- SNDRV_CHMAP_TFRC, /* top front right center */ -- SNDRV_CHMAP_TSL, /* top side left */ -- SNDRV_CHMAP_TSR, /* top side right */ -- SNDRV_CHMAP_LLFE, /* left LFE */ -- SNDRV_CHMAP_RLFE, /* right LFE */ -- SNDRV_CHMAP_BC, /* bottom center */ -- SNDRV_CHMAP_BLC, /* bottom left center */ -- SNDRV_CHMAP_BRC, /* bottom right center */ -- SNDRV_CHMAP_LAST = SNDRV_CHMAP_BRC, --}; -- --#define SNDRV_CHMAP_POSITION_MASK 0xffff --#define SNDRV_CHMAP_PHASE_INVERSE (0x01 << 16) --#define SNDRV_CHMAP_DRIVER_SPEC (0x02 << 16) -- --#define SNDRV_PCM_IOCTL_PVERSION _IOR('A', 0x00, int) --#define SNDRV_PCM_IOCTL_INFO _IOR('A', 0x01, struct snd_pcm_info) --#define SNDRV_PCM_IOCTL_TSTAMP _IOW('A', 0x02, int) --#define SNDRV_PCM_IOCTL_TTSTAMP _IOW('A', 0x03, int) --#define SNDRV_PCM_IOCTL_USER_PVERSION _IOW('A', 0x04, int) --#define SNDRV_PCM_IOCTL_HW_REFINE _IOWR('A', 0x10, struct snd_pcm_hw_params) --#define SNDRV_PCM_IOCTL_HW_PARAMS _IOWR('A', 0x11, struct snd_pcm_hw_params) --#define SNDRV_PCM_IOCTL_HW_FREE _IO('A', 0x12) --#define SNDRV_PCM_IOCTL_SW_PARAMS _IOWR('A', 0x13, struct snd_pcm_sw_params) --#define SNDRV_PCM_IOCTL_STATUS _IOR('A', 0x20, struct snd_pcm_status) --#define SNDRV_PCM_IOCTL_DELAY _IOR('A', 0x21, snd_pcm_sframes_t) --#define SNDRV_PCM_IOCTL_HWSYNC _IO('A', 0x22) --#define SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct snd_pcm_sync_ptr) --#define SNDRV_PCM_IOCTL_STATUS_EXT _IOWR('A', 0x24, struct snd_pcm_status) --#define SNDRV_PCM_IOCTL_CHANNEL_INFO _IOR('A', 0x32, struct snd_pcm_channel_info) --#define SNDRV_PCM_IOCTL_PREPARE _IO('A', 0x40) --#define SNDRV_PCM_IOCTL_RESET _IO('A', 0x41) --#define SNDRV_PCM_IOCTL_START _IO('A', 0x42) --#define SNDRV_PCM_IOCTL_DROP _IO('A', 0x43) --#define SNDRV_PCM_IOCTL_DRAIN _IO('A', 0x44) --#define SNDRV_PCM_IOCTL_PAUSE _IOW('A', 0x45, int) --#define SNDRV_PCM_IOCTL_REWIND _IOW('A', 0x46, snd_pcm_uframes_t) --#define SNDRV_PCM_IOCTL_RESUME _IO('A', 0x47) --#define SNDRV_PCM_IOCTL_XRUN _IO('A', 0x48) --#define SNDRV_PCM_IOCTL_FORWARD _IOW('A', 0x49, snd_pcm_uframes_t) --#define SNDRV_PCM_IOCTL_WRITEI_FRAMES _IOW('A', 0x50, struct snd_xferi) --#define SNDRV_PCM_IOCTL_READI_FRAMES _IOR('A', 0x51, struct snd_xferi) --#define SNDRV_PCM_IOCTL_WRITEN_FRAMES _IOW('A', 0x52, struct snd_xfern) --#define SNDRV_PCM_IOCTL_READN_FRAMES _IOR('A', 0x53, struct snd_xfern) --#define SNDRV_PCM_IOCTL_LINK _IOW('A', 0x60, int) --#define SNDRV_PCM_IOCTL_UNLINK _IO('A', 0x61) -- --/***************************************************************************** -- * * -- * MIDI v1.0 interface * -- * * -- *****************************************************************************/ -- --/* -- * Raw MIDI section - /dev/snd/midi?? -- */ -- --#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0) -- --enum { -- SNDRV_RAWMIDI_STREAM_OUTPUT = 0, -- SNDRV_RAWMIDI_STREAM_INPUT, -- SNDRV_RAWMIDI_STREAM_LAST = SNDRV_RAWMIDI_STREAM_INPUT, --}; -- --#define SNDRV_RAWMIDI_INFO_OUTPUT 0x00000001 --#define SNDRV_RAWMIDI_INFO_INPUT 0x00000002 --#define SNDRV_RAWMIDI_INFO_DUPLEX 0x00000004 -- --struct snd_rawmidi_info { -- unsigned int device; /* RO/WR (control): device number */ -- unsigned int subdevice; /* RO/WR (control): subdevice number */ -- int stream; /* WR: stream */ -- int card; /* R: card number */ -- unsigned int flags; /* SNDRV_RAWMIDI_INFO_XXXX */ -- unsigned char id[64]; /* ID (user selectable) */ -- unsigned char name[80]; /* name of device */ -- unsigned char subname[32]; /* name of active or selected subdevice */ -- unsigned int subdevices_count; -- unsigned int subdevices_avail; -- unsigned char reserved[64]; /* reserved for future use */ --}; -- --struct snd_rawmidi_params { -- int stream; -- size_t buffer_size; /* queue size in bytes */ -- size_t avail_min; /* minimum avail bytes for wakeup */ -- unsigned int no_active_sensing: 1; /* do not send active sensing byte in close() */ -- unsigned char reserved[16]; /* reserved for future use */ --}; -- --struct snd_rawmidi_status { -- int stream; -- struct timespec tstamp; /* Timestamp */ -- size_t avail; /* available bytes */ -- size_t xruns; /* count of overruns since last status (in bytes) */ -- unsigned char reserved[16]; /* reserved for future use */ --}; -- --#define SNDRV_RAWMIDI_IOCTL_PVERSION _IOR('W', 0x00, int) --#define SNDRV_RAWMIDI_IOCTL_INFO _IOR('W', 0x01, struct snd_rawmidi_info) --#define SNDRV_RAWMIDI_IOCTL_PARAMS _IOWR('W', 0x10, struct snd_rawmidi_params) --#define SNDRV_RAWMIDI_IOCTL_STATUS _IOWR('W', 0x20, struct snd_rawmidi_status) --#define SNDRV_RAWMIDI_IOCTL_DROP _IOW('W', 0x30, int) --#define SNDRV_RAWMIDI_IOCTL_DRAIN _IOW('W', 0x31, int) -- --/* -- * Timer section - /dev/snd/timer -- */ -- --#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 6) -- --enum { -- SNDRV_TIMER_CLASS_NONE = -1, -- SNDRV_TIMER_CLASS_SLAVE = 0, -- SNDRV_TIMER_CLASS_GLOBAL, -- SNDRV_TIMER_CLASS_CARD, -- SNDRV_TIMER_CLASS_PCM, -- SNDRV_TIMER_CLASS_LAST = SNDRV_TIMER_CLASS_PCM, --}; -- --/* slave timer classes */ --enum { -- SNDRV_TIMER_SCLASS_NONE = 0, -- SNDRV_TIMER_SCLASS_APPLICATION, -- SNDRV_TIMER_SCLASS_SEQUENCER, /* alias */ -- SNDRV_TIMER_SCLASS_OSS_SEQUENCER, /* alias */ -- SNDRV_TIMER_SCLASS_LAST = SNDRV_TIMER_SCLASS_OSS_SEQUENCER, --}; -- --/* global timers (device member) */ --#define SNDRV_TIMER_GLOBAL_SYSTEM 0 --#define SNDRV_TIMER_GLOBAL_RTC 1 /* unused */ --#define SNDRV_TIMER_GLOBAL_HPET 2 --#define SNDRV_TIMER_GLOBAL_HRTIMER 3 -- --/* info flags */ --#define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */ -- --struct snd_timer_id { -- int dev_class; -- int dev_sclass; -- int card; -- int device; -- int subdevice; --}; -- --struct snd_timer_ginfo { -- struct snd_timer_id tid; /* requested timer ID */ -- unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */ -- int card; /* card number */ -- unsigned char id[64]; /* timer identification */ -- unsigned char name[80]; /* timer name */ -- unsigned long reserved0; /* reserved for future use */ -- unsigned long resolution; /* average period resolution in ns */ -- unsigned long resolution_min; /* minimal period resolution in ns */ -- unsigned long resolution_max; /* maximal period resolution in ns */ -- unsigned int clients; /* active timer clients */ -- unsigned char reserved[32]; --}; -- --struct snd_timer_gparams { -- struct snd_timer_id tid; /* requested timer ID */ -- unsigned long period_num; /* requested precise period duration (in seconds) - numerator */ -- unsigned long period_den; /* requested precise period duration (in seconds) - denominator */ -- unsigned char reserved[32]; --}; -- --struct snd_timer_gstatus { -- struct snd_timer_id tid; /* requested timer ID */ -- unsigned long resolution; /* current period resolution in ns */ -- unsigned long resolution_num; /* precise current period resolution (in seconds) - numerator */ -- unsigned long resolution_den; /* precise current period resolution (in seconds) - denominator */ -- unsigned char reserved[32]; --}; -- --struct snd_timer_select { -- struct snd_timer_id id; /* bind to timer ID */ -- unsigned char reserved[32]; /* reserved */ --}; -- --struct snd_timer_info { -- unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */ -- int card; /* card number */ -- unsigned char id[64]; /* timer identificator */ -- unsigned char name[80]; /* timer name */ -- unsigned long reserved0; /* reserved for future use */ -- unsigned long resolution; /* average period resolution in ns */ -- unsigned char reserved[64]; /* reserved */ --}; -- --#define SNDRV_TIMER_PSFLG_AUTO (1<<0) /* auto start, otherwise one-shot */ --#define SNDRV_TIMER_PSFLG_EXCLUSIVE (1<<1) /* exclusive use, precise start/stop/pause/continue */ --#define SNDRV_TIMER_PSFLG_EARLY_EVENT (1<<2) /* write early event to the poll queue */ -- --struct snd_timer_params { -- unsigned int flags; /* flags - SNDRV_TIMER_PSFLG_* */ -- unsigned int ticks; /* requested resolution in ticks */ -- unsigned int queue_size; /* total size of queue (32-1024) */ -- unsigned int reserved0; /* reserved, was: failure locations */ -- unsigned int filter; /* event filter (bitmask of SNDRV_TIMER_EVENT_*) */ -- unsigned char reserved[60]; /* reserved */ --}; -- --struct snd_timer_status { -- struct timespec tstamp; /* Timestamp - last update */ -- unsigned int resolution; /* current period resolution in ns */ -- unsigned int lost; /* counter of master tick lost */ -- unsigned int overrun; /* count of read queue overruns */ -- unsigned int queue; /* used queue size */ -- unsigned char reserved[64]; /* reserved */ --}; -- --#define SNDRV_TIMER_IOCTL_PVERSION _IOR('T', 0x00, int) --#define SNDRV_TIMER_IOCTL_NEXT_DEVICE _IOWR('T', 0x01, struct snd_timer_id) --#define SNDRV_TIMER_IOCTL_TREAD _IOW('T', 0x02, int) --#define SNDRV_TIMER_IOCTL_GINFO _IOWR('T', 0x03, struct snd_timer_ginfo) --#define SNDRV_TIMER_IOCTL_GPARAMS _IOW('T', 0x04, struct snd_timer_gparams) --#define SNDRV_TIMER_IOCTL_GSTATUS _IOWR('T', 0x05, struct snd_timer_gstatus) --#define SNDRV_TIMER_IOCTL_SELECT _IOW('T', 0x10, struct snd_timer_select) --#define SNDRV_TIMER_IOCTL_INFO _IOR('T', 0x11, struct snd_timer_info) --#define SNDRV_TIMER_IOCTL_PARAMS _IOW('T', 0x12, struct snd_timer_params) --#define SNDRV_TIMER_IOCTL_STATUS _IOR('T', 0x14, struct snd_timer_status) --/* The following four ioctls are changed since 1.0.9 due to confliction */ --#define SNDRV_TIMER_IOCTL_START _IO('T', 0xa0) --#define SNDRV_TIMER_IOCTL_STOP _IO('T', 0xa1) --#define SNDRV_TIMER_IOCTL_CONTINUE _IO('T', 0xa2) --#define SNDRV_TIMER_IOCTL_PAUSE _IO('T', 0xa3) -- --struct snd_timer_read { -- unsigned int resolution; -- unsigned int ticks; --}; -- --enum { -- SNDRV_TIMER_EVENT_RESOLUTION = 0, /* val = resolution in ns */ -- SNDRV_TIMER_EVENT_TICK, /* val = ticks */ -- SNDRV_TIMER_EVENT_START, /* val = resolution in ns */ -- SNDRV_TIMER_EVENT_STOP, /* val = 0 */ -- SNDRV_TIMER_EVENT_CONTINUE, /* val = resolution in ns */ -- SNDRV_TIMER_EVENT_PAUSE, /* val = 0 */ -- SNDRV_TIMER_EVENT_EARLY, /* val = 0, early event */ -- SNDRV_TIMER_EVENT_SUSPEND, /* val = 0 */ -- SNDRV_TIMER_EVENT_RESUME, /* val = resolution in ns */ -- /* master timer events for slave timer instances */ -- SNDRV_TIMER_EVENT_MSTART = SNDRV_TIMER_EVENT_START + 10, -- SNDRV_TIMER_EVENT_MSTOP = SNDRV_TIMER_EVENT_STOP + 10, -- SNDRV_TIMER_EVENT_MCONTINUE = SNDRV_TIMER_EVENT_CONTINUE + 10, -- SNDRV_TIMER_EVENT_MPAUSE = SNDRV_TIMER_EVENT_PAUSE + 10, -- SNDRV_TIMER_EVENT_MSUSPEND = SNDRV_TIMER_EVENT_SUSPEND + 10, -- SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10, --}; -- --struct snd_timer_tread { -- int event; -- struct timespec tstamp; -- unsigned int val; --}; -- --/**************************************************************************** -- * * -- * Section for driver control interface - /dev/snd/control? * -- * * -- ****************************************************************************/ -- --#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7) -- --struct snd_ctl_card_info { -- int card; /* card number */ -- int pad; /* reserved for future (was type) */ -- unsigned char id[16]; /* ID of card (user selectable) */ -- unsigned char driver[16]; /* Driver name */ -- unsigned char name[32]; /* Short name of soundcard */ -- unsigned char longname[80]; /* name + info text about soundcard */ -- unsigned char reserved_[16]; /* reserved for future (was ID of mixer) */ -- unsigned char mixername[80]; /* visual mixer identification */ -- unsigned char components[128]; /* card components / fine identification, delimited with one space (AC97 etc..) */ --}; -- --typedef int __bitwise snd_ctl_elem_type_t; --#define SNDRV_CTL_ELEM_TYPE_NONE ((__force snd_ctl_elem_type_t) 0) /* invalid */ --#define SNDRV_CTL_ELEM_TYPE_BOOLEAN ((__force snd_ctl_elem_type_t) 1) /* boolean type */ --#define SNDRV_CTL_ELEM_TYPE_INTEGER ((__force snd_ctl_elem_type_t) 2) /* integer type */ --#define SNDRV_CTL_ELEM_TYPE_ENUMERATED ((__force snd_ctl_elem_type_t) 3) /* enumerated type */ --#define SNDRV_CTL_ELEM_TYPE_BYTES ((__force snd_ctl_elem_type_t) 4) /* byte array */ --#define SNDRV_CTL_ELEM_TYPE_IEC958 ((__force snd_ctl_elem_type_t) 5) /* IEC958 (S/PDIF) setup */ --#define SNDRV_CTL_ELEM_TYPE_INTEGER64 ((__force snd_ctl_elem_type_t) 6) /* 64-bit integer type */ --#define SNDRV_CTL_ELEM_TYPE_LAST SNDRV_CTL_ELEM_TYPE_INTEGER64 -- --typedef int __bitwise snd_ctl_elem_iface_t; --#define SNDRV_CTL_ELEM_IFACE_CARD ((__force snd_ctl_elem_iface_t) 0) /* global control */ --#define SNDRV_CTL_ELEM_IFACE_HWDEP ((__force snd_ctl_elem_iface_t) 1) /* hardware dependent device */ --#define SNDRV_CTL_ELEM_IFACE_MIXER ((__force snd_ctl_elem_iface_t) 2) /* virtual mixer device */ --#define SNDRV_CTL_ELEM_IFACE_PCM ((__force snd_ctl_elem_iface_t) 3) /* PCM device */ --#define SNDRV_CTL_ELEM_IFACE_RAWMIDI ((__force snd_ctl_elem_iface_t) 4) /* RawMidi device */ --#define SNDRV_CTL_ELEM_IFACE_TIMER ((__force snd_ctl_elem_iface_t) 5) /* timer device */ --#define SNDRV_CTL_ELEM_IFACE_SEQUENCER ((__force snd_ctl_elem_iface_t) 6) /* sequencer client */ --#define SNDRV_CTL_ELEM_IFACE_LAST SNDRV_CTL_ELEM_IFACE_SEQUENCER -- --#define SNDRV_CTL_ELEM_ACCESS_READ (1<<0) --#define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1) --#define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE) --#define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */ --#define SNDRV_CTL_ELEM_ACCESS_TIMESTAMP (1<<3) /* when was control changed */ --#define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1<<4) /* TLV read is possible */ --#define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1<<5) /* TLV write is possible */ --#define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE) --#define SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND (1<<6) /* TLV command is possible */ --#define SNDRV_CTL_ELEM_ACCESS_INACTIVE (1<<8) /* control does actually nothing, but may be updated */ --#define SNDRV_CTL_ELEM_ACCESS_LOCK (1<<9) /* write lock */ --#define SNDRV_CTL_ELEM_ACCESS_OWNER (1<<10) /* write lock owner */ --#define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK (1<<28) /* kernel use a TLV callback */ --#define SNDRV_CTL_ELEM_ACCESS_USER (1<<29) /* user space element */ --/* bits 30 and 31 are obsoleted (for indirect access) */ -- --/* for further details see the ACPI and PCI power management specification */ --#define SNDRV_CTL_POWER_D0 0x0000 /* full On */ --#define SNDRV_CTL_POWER_D1 0x0100 /* partial On */ --#define SNDRV_CTL_POWER_D2 0x0200 /* partial On */ --#define SNDRV_CTL_POWER_D3 0x0300 /* Off */ --#define SNDRV_CTL_POWER_D3hot (SNDRV_CTL_POWER_D3|0x0000) /* Off, with power */ --#define SNDRV_CTL_POWER_D3cold (SNDRV_CTL_POWER_D3|0x0001) /* Off, without power */ -- --#define SNDRV_CTL_ELEM_ID_NAME_MAXLEN 44 -- --struct snd_ctl_elem_id { -- unsigned int numid; /* numeric identifier, zero = invalid */ -- snd_ctl_elem_iface_t iface; /* interface identifier */ -- unsigned int device; /* device/client number */ -- unsigned int subdevice; /* subdevice (substream) number */ -- unsigned char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* ASCII name of item */ -- unsigned int index; /* index of item */ --}; -- --struct snd_ctl_elem_list { -- unsigned int offset; /* W: first element ID to get */ -- unsigned int space; /* W: count of element IDs to get */ -- unsigned int used; /* R: count of element IDs set */ -- unsigned int count; /* R: count of all elements */ -- struct snd_ctl_elem_id __user *pids; /* R: IDs */ -- unsigned char reserved[50]; --}; -- --struct snd_ctl_elem_info { -- struct snd_ctl_elem_id id; /* W: element ID */ -- snd_ctl_elem_type_t type; /* R: value type - SNDRV_CTL_ELEM_TYPE_* */ -- unsigned int access; /* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */ -- unsigned int count; /* count of values */ -- __kernel_pid_t owner; /* owner's PID of this control */ -- union { -- struct { -- long min; /* R: minimum value */ -- long max; /* R: maximum value */ -- long step; /* R: step (0 variable) */ -- } integer; -- struct { -- long long min; /* R: minimum value */ -- long long max; /* R: maximum value */ -- long long step; /* R: step (0 variable) */ -- } integer64; -- struct { -- unsigned int items; /* R: number of items */ -- unsigned int item; /* W: item number */ -- char name[64]; /* R: value name */ -- __u64 names_ptr; /* W: names list (ELEM_ADD only) */ -- unsigned int names_length; -- } enumerated; -- unsigned char reserved[128]; -- } value; -- union { -- unsigned short d[4]; /* dimensions */ -- unsigned short *d_ptr; /* indirect - obsoleted */ -- } dimen; -- unsigned char reserved[64-4*sizeof(unsigned short)]; --}; -- --struct snd_ctl_elem_value { -- struct snd_ctl_elem_id id; /* W: element ID */ -- unsigned int indirect: 1; /* W: indirect access - obsoleted */ -- union { -- union { -- long value[128]; -- long *value_ptr; /* obsoleted */ -- } integer; -- union { -- long long value[64]; -- long long *value_ptr; /* obsoleted */ -- } integer64; -- union { -- unsigned int item[128]; -- unsigned int *item_ptr; /* obsoleted */ -- } enumerated; -- union { -- unsigned char data[512]; -- unsigned char *data_ptr; /* obsoleted */ -- } bytes; -- struct snd_aes_iec958 iec958; -- } value; /* RO */ -- struct timespec tstamp; -- unsigned char reserved[128-sizeof(struct timespec)]; --}; -- --struct snd_ctl_tlv { -- unsigned int numid; /* control element numeric identification */ -- unsigned int length; /* in bytes aligned to 4 */ -- unsigned int tlv[0]; /* first TLV */ --}; -- --#define SNDRV_CTL_IOCTL_PVERSION _IOR('U', 0x00, int) --#define SNDRV_CTL_IOCTL_CARD_INFO _IOR('U', 0x01, struct snd_ctl_card_info) --#define SNDRV_CTL_IOCTL_ELEM_LIST _IOWR('U', 0x10, struct snd_ctl_elem_list) --#define SNDRV_CTL_IOCTL_ELEM_INFO _IOWR('U', 0x11, struct snd_ctl_elem_info) --#define SNDRV_CTL_IOCTL_ELEM_READ _IOWR('U', 0x12, struct snd_ctl_elem_value) --#define SNDRV_CTL_IOCTL_ELEM_WRITE _IOWR('U', 0x13, struct snd_ctl_elem_value) --#define SNDRV_CTL_IOCTL_ELEM_LOCK _IOW('U', 0x14, struct snd_ctl_elem_id) --#define SNDRV_CTL_IOCTL_ELEM_UNLOCK _IOW('U', 0x15, struct snd_ctl_elem_id) --#define SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS _IOWR('U', 0x16, int) --#define SNDRV_CTL_IOCTL_ELEM_ADD _IOWR('U', 0x17, struct snd_ctl_elem_info) --#define SNDRV_CTL_IOCTL_ELEM_REPLACE _IOWR('U', 0x18, struct snd_ctl_elem_info) --#define SNDRV_CTL_IOCTL_ELEM_REMOVE _IOWR('U', 0x19, struct snd_ctl_elem_id) --#define SNDRV_CTL_IOCTL_TLV_READ _IOWR('U', 0x1a, struct snd_ctl_tlv) --#define SNDRV_CTL_IOCTL_TLV_WRITE _IOWR('U', 0x1b, struct snd_ctl_tlv) --#define SNDRV_CTL_IOCTL_TLV_COMMAND _IOWR('U', 0x1c, struct snd_ctl_tlv) --#define SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE _IOWR('U', 0x20, int) --#define SNDRV_CTL_IOCTL_HWDEP_INFO _IOR('U', 0x21, struct snd_hwdep_info) --#define SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE _IOR('U', 0x30, int) --#define SNDRV_CTL_IOCTL_PCM_INFO _IOWR('U', 0x31, struct snd_pcm_info) --#define SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE _IOW('U', 0x32, int) --#define SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE _IOWR('U', 0x40, int) --#define SNDRV_CTL_IOCTL_RAWMIDI_INFO _IOWR('U', 0x41, struct snd_rawmidi_info) --#define SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE _IOW('U', 0x42, int) --#define SNDRV_CTL_IOCTL_POWER _IOWR('U', 0xd0, int) --#define SNDRV_CTL_IOCTL_POWER_STATE _IOR('U', 0xd1, int) -- --/* -- * Read interface. -- */ -- --enum sndrv_ctl_event_type { -- SNDRV_CTL_EVENT_ELEM = 0, -- SNDRV_CTL_EVENT_LAST = SNDRV_CTL_EVENT_ELEM, --}; -- --#define SNDRV_CTL_EVENT_MASK_VALUE (1<<0) /* element value was changed */ --#define SNDRV_CTL_EVENT_MASK_INFO (1<<1) /* element info was changed */ --#define SNDRV_CTL_EVENT_MASK_ADD (1<<2) /* element was added */ --#define SNDRV_CTL_EVENT_MASK_TLV (1<<3) /* element TLV tree was changed */ --#define SNDRV_CTL_EVENT_MASK_REMOVE (~0U) /* element was removed */ -- --struct snd_ctl_event { -- int type; /* event type - SNDRV_CTL_EVENT_* */ -- union { -- struct { -- unsigned int mask; -- struct snd_ctl_elem_id id; -- } elem; -- unsigned char data8[60]; -- } data; --}; -- --/* -- * Control names -- */ -- --#define SNDRV_CTL_NAME_NONE "" --#define SNDRV_CTL_NAME_PLAYBACK "Playback " --#define SNDRV_CTL_NAME_CAPTURE "Capture " -- --#define SNDRV_CTL_NAME_IEC958_NONE "" --#define SNDRV_CTL_NAME_IEC958_SWITCH "Switch" --#define SNDRV_CTL_NAME_IEC958_VOLUME "Volume" --#define SNDRV_CTL_NAME_IEC958_DEFAULT "Default" --#define SNDRV_CTL_NAME_IEC958_MASK "Mask" --#define SNDRV_CTL_NAME_IEC958_CON_MASK "Con Mask" --#define SNDRV_CTL_NAME_IEC958_PRO_MASK "Pro Mask" --#define SNDRV_CTL_NAME_IEC958_PCM_STREAM "PCM Stream" --#define SNDRV_CTL_NAME_IEC958(expl,direction,what) "IEC958 " expl SNDRV_CTL_NAME_##direction SNDRV_CTL_NAME_IEC958_##what -- --#endif /* _UAPI__SOUND_ASOUND_H */ -+#include -diff --git a/include/sound/asound_fm.h b/include/sound/asound_fm.h -index 8471f404..3e5da4d0 100644 ---- a/include/sound/asound_fm.h -+++ b/include/sound/asound_fm.h -@@ -1,135 +1 @@ --/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ --#ifndef __SOUND_ASOUND_FM_H --#define __SOUND_ASOUND_FM_H -- --/* -- * Advanced Linux Sound Architecture - ALSA -- * -- * Interface file between ALSA driver & user space -- * Copyright (c) 1994-98 by Jaroslav Kysela , -- * 4Front Technologies -- * -- * Direct FM control -- * -- * This program is free software; you can redistribute it and/or modify -- * it under the terms of the GNU General Public License as published by -- * the Free Software Foundation; either version 2 of the License, or -- * (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU General Public License for more details. -- * -- * You should have received a copy of the GNU General Public License -- * along with this program; if not, write to the Free Software -- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- * -- */ -- --#define SNDRV_DM_FM_MODE_OPL2 0x00 --#define SNDRV_DM_FM_MODE_OPL3 0x01 -- --struct snd_dm_fm_info { -- unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */ -- unsigned char rhythm; /* percussion mode flag */ --}; -- --/* -- * Data structure composing an FM "note" or sound event. -- */ -- --struct snd_dm_fm_voice { -- unsigned char op; /* operator cell (0 or 1) */ -- unsigned char voice; /* FM voice (0 to 17) */ -- -- unsigned char am; /* amplitude modulation */ -- unsigned char vibrato; /* vibrato effect */ -- unsigned char do_sustain; /* sustain phase */ -- unsigned char kbd_scale; /* keyboard scaling */ -- unsigned char harmonic; /* 4 bits: harmonic and multiplier */ -- unsigned char scale_level; /* 2 bits: decrease output freq rises */ -- unsigned char volume; /* 6 bits: volume */ -- -- unsigned char attack; /* 4 bits: attack rate */ -- unsigned char decay; /* 4 bits: decay rate */ -- unsigned char sustain; /* 4 bits: sustain level */ -- unsigned char release; /* 4 bits: release rate */ -- -- unsigned char feedback; /* 3 bits: feedback for op0 */ -- unsigned char connection; /* 0 for serial, 1 for parallel */ -- unsigned char left; /* stereo left */ -- unsigned char right; /* stereo right */ -- unsigned char waveform; /* 3 bits: waveform shape */ --}; -- --/* -- * This describes an FM note by its voice, octave, frequency number (10bit) -- * and key on/off. -- */ -- --struct snd_dm_fm_note { -- unsigned char voice; /* 0-17 voice channel */ -- unsigned char octave; /* 3 bits: what octave to play */ -- unsigned int fnum; /* 10 bits: frequency number */ -- unsigned char key_on; /* set for active, clear for silent */ --}; -- --/* -- * FM parameters that apply globally to all voices, and thus are not "notes" -- */ -- --struct snd_dm_fm_params { -- unsigned char am_depth; /* amplitude modulation depth (1=hi) */ -- unsigned char vib_depth; /* vibrato depth (1=hi) */ -- unsigned char kbd_split; /* keyboard split */ -- unsigned char rhythm; /* percussion mode select */ -- -- /* This block is the percussion instrument data */ -- unsigned char bass; -- unsigned char snare; -- unsigned char tomtom; -- unsigned char cymbal; -- unsigned char hihat; --}; -- --/* -- * FM mode ioctl settings -- */ -- --#define SNDRV_DM_FM_IOCTL_INFO _IOR('H', 0x20, struct snd_dm_fm_info) --#define SNDRV_DM_FM_IOCTL_RESET _IO ('H', 0x21) --#define SNDRV_DM_FM_IOCTL_PLAY_NOTE _IOW('H', 0x22, struct snd_dm_fm_note) --#define SNDRV_DM_FM_IOCTL_SET_VOICE _IOW('H', 0x23, struct snd_dm_fm_voice) --#define SNDRV_DM_FM_IOCTL_SET_PARAMS _IOW('H', 0x24, struct snd_dm_fm_params) --#define SNDRV_DM_FM_IOCTL_SET_MODE _IOW('H', 0x25, int) --/* for OPL3 only */ --#define SNDRV_DM_FM_IOCTL_SET_CONNECTION _IOW('H', 0x26, int) --/* SBI patch management */ --#define SNDRV_DM_FM_IOCTL_CLEAR_PATCHES _IO ('H', 0x40) -- --#define SNDRV_DM_FM_OSS_IOCTL_RESET 0x20 --#define SNDRV_DM_FM_OSS_IOCTL_PLAY_NOTE 0x21 --#define SNDRV_DM_FM_OSS_IOCTL_SET_VOICE 0x22 --#define SNDRV_DM_FM_OSS_IOCTL_SET_PARAMS 0x23 --#define SNDRV_DM_FM_OSS_IOCTL_SET_MODE 0x24 --#define SNDRV_DM_FM_OSS_IOCTL_SET_OPL 0x25 -- --/* -- * Patch Record - fixed size for write -- */ -- --#define FM_KEY_SBI "SBI\032" --#define FM_KEY_2OP "2OP\032" --#define FM_KEY_4OP "4OP\032" -- --struct sbi_patch { -- unsigned char prog; -- unsigned char bank; -- char key[4]; -- char name[25]; -- char extension[7]; -- unsigned char data[32]; --}; -- --#endif /* __SOUND_ASOUND_FM_H */ -+#include -diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h -index 042c5a6f..f06ecee5 100644 ---- a/include/sound/emu10k1.h -+++ b/include/sound/emu10k1.h -@@ -1,381 +1,2 @@ --/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ --/* -- * Copyright (c) by Jaroslav Kysela , -- * Creative Labs, Inc. -- * Definitions for EMU10K1 (SB Live!) chips -- * -- * -- * This program is free software; you can redistribute it and/or modify -- * it under the terms of the GNU General Public License as published by -- * the Free Software Foundation; either version 2 of the License, or -- * (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU General Public License for more details. -- * -- * You should have received a copy of the GNU General Public License -- * along with this program; if not, write to the Free Software -- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- * -- */ --#ifndef _UAPI__SOUND_EMU10K1_H --#define _UAPI__SOUND_EMU10K1_H -- --#include --#include -- --/* -- * ---- FX8010 ---- -- */ -- --#define EMU10K1_CARD_CREATIVE 0x00000000 --#define EMU10K1_CARD_EMUAPS 0x00000001 -- --#define EMU10K1_FX8010_PCM_COUNT 8 -- --/* -- * Following definition is copied from linux/types.h to support compiling -- * this header file in userspace since they are not generally available for -- * uapi headers. -- */ --#define __EMU10K1_DECLARE_BITMAP(name,bits) \ -- unsigned long name[(bits) / (sizeof(unsigned long) * 8)] -- --/* instruction set */ --#define iMAC0 0x00 /* R = A + (X * Y >> 31) ; saturation */ --#define iMAC1 0x01 /* R = A + (-X * Y >> 31) ; saturation */ --#define iMAC2 0x02 /* R = A + (X * Y >> 31) ; wraparound */ --#define iMAC3 0x03 /* R = A + (-X * Y >> 31) ; wraparound */ --#define iMACINT0 0x04 /* R = A + X * Y ; saturation */ --#define iMACINT1 0x05 /* R = A + X * Y ; wraparound (31-bit) */ --#define iACC3 0x06 /* R = A + X + Y ; saturation */ --#define iMACMV 0x07 /* R = A, acc += X * Y >> 31 */ --#define iANDXOR 0x08 /* R = (A & X) ^ Y */ --#define iTSTNEG 0x09 /* R = (A >= Y) ? X : ~X */ --#define iLIMITGE 0x0a /* R = (A >= Y) ? X : Y */ --#define iLIMITLT 0x0b /* R = (A < Y) ? X : Y */ --#define iLOG 0x0c /* R = linear_data, A (log_data), X (max_exp), Y (format_word) */ --#define iEXP 0x0d /* R = log_data, A (linear_data), X (max_exp), Y (format_word) */ --#define iINTERP 0x0e /* R = A + (X * (Y - A) >> 31) ; saturation */ --#define iSKIP 0x0f /* R = A (cc_reg), X (count), Y (cc_test) */ -- --/* GPRs */ --#define FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x0f */ --#define EXTIN(x) (0x10 + (x)) /* x = 0x00 - 0x0f */ --#define EXTOUT(x) (0x20 + (x)) /* x = 0x00 - 0x0f physical outs -> FXWC low 16 bits */ --#define FXBUS2(x) (0x30 + (x)) /* x = 0x00 - 0x0f copies of fx buses for capture -> FXWC high 16 bits */ -- /* NB: 0x31 and 0x32 are shared with Center/LFE on SB live 5.1 */ -- --#define C_00000000 0x40 --#define C_00000001 0x41 --#define C_00000002 0x42 --#define C_00000003 0x43 --#define C_00000004 0x44 --#define C_00000008 0x45 --#define C_00000010 0x46 --#define C_00000020 0x47 --#define C_00000100 0x48 --#define C_00010000 0x49 --#define C_00080000 0x4a --#define C_10000000 0x4b --#define C_20000000 0x4c --#define C_40000000 0x4d --#define C_80000000 0x4e --#define C_7fffffff 0x4f --#define C_ffffffff 0x50 --#define C_fffffffe 0x51 --#define C_c0000000 0x52 --#define C_4f1bbcdc 0x53 --#define C_5a7ef9db 0x54 --#define C_00100000 0x55 /* ?? */ --#define GPR_ACCU 0x56 /* ACCUM, accumulator */ --#define GPR_COND 0x57 /* CCR, condition register */ --#define GPR_NOISE0 0x58 /* noise source */ --#define GPR_NOISE1 0x59 /* noise source */ --#define GPR_IRQ 0x5a /* IRQ register */ --#define GPR_DBAC 0x5b /* TRAM Delay Base Address Counter */ --#define GPR(x) (FXGPREGBASE + (x)) /* free GPRs: x = 0x00 - 0xff */ --#define ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */ --#define ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */ --#define ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */ --#define ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */ -- --#define A_ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */ --#define A_ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */ --#define A_ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */ --#define A_ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */ --#define A_ITRAM_CTL(x) (A_TANKMEMCTLREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */ --#define A_ETRAM_CTL(x) (A_TANKMEMCTLREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */ -- --#define A_FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x3f FX buses */ --#define A_EXTIN(x) (0x40 + (x)) /* x = 0x00 - 0x0f physical ins */ --#define A_P16VIN(x) (0x50 + (x)) /* x = 0x00 - 0x0f p16v ins (A2 only) "EMU32 inputs" */ --#define A_EXTOUT(x) (0x60 + (x)) /* x = 0x00 - 0x1f physical outs -> A_FXWC1 0x79-7f unknown */ --#define A_FXBUS2(x) (0x80 + (x)) /* x = 0x00 - 0x1f extra outs used for EFX capture -> A_FXWC2 */ --#define A_EMU32OUTH(x) (0xa0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_10 - _1F" - ??? */ --#define A_EMU32OUTL(x) (0xb0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_1 - _F" - ??? */ --#define A3_EMU32IN(x) (0x160 + (x)) /* x = 0x00 - 0x3f "EMU32_IN_00 - _3F" - Only when .device = 0x0008 */ --#define A3_EMU32OUT(x) (0x1E0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_00 - _3F" - Only when .device = 0x0008 */ --#define A_GPR(x) (A_FXGPREGBASE + (x)) -- --/* cc_reg constants */ --#define CC_REG_NORMALIZED C_00000001 --#define CC_REG_BORROW C_00000002 --#define CC_REG_MINUS C_00000004 --#define CC_REG_ZERO C_00000008 --#define CC_REG_SATURATE C_00000010 --#define CC_REG_NONZERO C_00000100 -- --/* FX buses */ --#define FXBUS_PCM_LEFT 0x00 --#define FXBUS_PCM_RIGHT 0x01 --#define FXBUS_PCM_LEFT_REAR 0x02 --#define FXBUS_PCM_RIGHT_REAR 0x03 --#define FXBUS_MIDI_LEFT 0x04 --#define FXBUS_MIDI_RIGHT 0x05 --#define FXBUS_PCM_CENTER 0x06 --#define FXBUS_PCM_LFE 0x07 --#define FXBUS_PCM_LEFT_FRONT 0x08 --#define FXBUS_PCM_RIGHT_FRONT 0x09 --#define FXBUS_MIDI_REVERB 0x0c --#define FXBUS_MIDI_CHORUS 0x0d --#define FXBUS_PCM_LEFT_SIDE 0x0e --#define FXBUS_PCM_RIGHT_SIDE 0x0f --#define FXBUS_PT_LEFT 0x14 --#define FXBUS_PT_RIGHT 0x15 -- --/* Inputs */ --#define EXTIN_AC97_L 0x00 /* AC'97 capture channel - left */ --#define EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */ --#define EXTIN_SPDIF_CD_L 0x02 /* internal S/PDIF CD - onboard - left */ --#define EXTIN_SPDIF_CD_R 0x03 /* internal S/PDIF CD - onboard - right */ --#define EXTIN_ZOOM_L 0x04 /* Zoom Video I2S - left */ --#define EXTIN_ZOOM_R 0x05 /* Zoom Video I2S - right */ --#define EXTIN_TOSLINK_L 0x06 /* LiveDrive - TOSLink Optical - left */ --#define EXTIN_TOSLINK_R 0x07 /* LiveDrive - TOSLink Optical - right */ --#define EXTIN_LINE1_L 0x08 /* LiveDrive - Line/Mic 1 - left */ --#define EXTIN_LINE1_R 0x09 /* LiveDrive - Line/Mic 1 - right */ --#define EXTIN_COAX_SPDIF_L 0x0a /* LiveDrive - Coaxial S/PDIF - left */ --#define EXTIN_COAX_SPDIF_R 0x0b /* LiveDrive - Coaxial S/PDIF - right */ --#define EXTIN_LINE2_L 0x0c /* LiveDrive - Line/Mic 2 - left */ --#define EXTIN_LINE2_R 0x0d /* LiveDrive - Line/Mic 2 - right */ -- --/* Outputs */ --#define EXTOUT_AC97_L 0x00 /* AC'97 playback channel - left */ --#define EXTOUT_AC97_R 0x01 /* AC'97 playback channel - right */ --#define EXTOUT_TOSLINK_L 0x02 /* LiveDrive - TOSLink Optical - left */ --#define EXTOUT_TOSLINK_R 0x03 /* LiveDrive - TOSLink Optical - right */ --#define EXTOUT_AC97_CENTER 0x04 /* SB Live 5.1 - center */ --#define EXTOUT_AC97_LFE 0x05 /* SB Live 5.1 - LFE */ --#define EXTOUT_HEADPHONE_L 0x06 /* LiveDrive - Headphone - left */ --#define EXTOUT_HEADPHONE_R 0x07 /* LiveDrive - Headphone - right */ --#define EXTOUT_REAR_L 0x08 /* Rear channel - left */ --#define EXTOUT_REAR_R 0x09 /* Rear channel - right */ --#define EXTOUT_ADC_CAP_L 0x0a /* ADC Capture buffer - left */ --#define EXTOUT_ADC_CAP_R 0x0b /* ADC Capture buffer - right */ --#define EXTOUT_MIC_CAP 0x0c /* MIC Capture buffer */ --#define EXTOUT_AC97_REAR_L 0x0d /* SB Live 5.1 (c) 2003 - Rear Left */ --#define EXTOUT_AC97_REAR_R 0x0e /* SB Live 5.1 (c) 2003 - Rear Right */ --#define EXTOUT_ACENTER 0x11 /* Analog Center */ --#define EXTOUT_ALFE 0x12 /* Analog LFE */ -- --/* Audigy Inputs */ --#define A_EXTIN_AC97_L 0x00 /* AC'97 capture channel - left */ --#define A_EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */ --#define A_EXTIN_SPDIF_CD_L 0x02 /* digital CD left */ --#define A_EXTIN_SPDIF_CD_R 0x03 /* digital CD left */ --#define A_EXTIN_OPT_SPDIF_L 0x04 /* audigy drive Optical SPDIF - left */ --#define A_EXTIN_OPT_SPDIF_R 0x05 /* right */ --#define A_EXTIN_LINE2_L 0x08 /* audigy drive line2/mic2 - left */ --#define A_EXTIN_LINE2_R 0x09 /* right */ --#define A_EXTIN_ADC_L 0x0a /* Philips ADC - left */ --#define A_EXTIN_ADC_R 0x0b /* right */ --#define A_EXTIN_AUX2_L 0x0c /* audigy drive aux2 - left */ --#define A_EXTIN_AUX2_R 0x0d /* - right */ -- --/* Audigiy Outputs */ --#define A_EXTOUT_FRONT_L 0x00 /* digital front left */ --#define A_EXTOUT_FRONT_R 0x01 /* right */ --#define A_EXTOUT_CENTER 0x02 /* digital front center */ --#define A_EXTOUT_LFE 0x03 /* digital front lfe */ --#define A_EXTOUT_HEADPHONE_L 0x04 /* headphone audigy drive left */ --#define A_EXTOUT_HEADPHONE_R 0x05 /* right */ --#define A_EXTOUT_REAR_L 0x06 /* digital rear left */ --#define A_EXTOUT_REAR_R 0x07 /* right */ --#define A_EXTOUT_AFRONT_L 0x08 /* analog front left */ --#define A_EXTOUT_AFRONT_R 0x09 /* right */ --#define A_EXTOUT_ACENTER 0x0a /* analog center */ --#define A_EXTOUT_ALFE 0x0b /* analog LFE */ --#define A_EXTOUT_ASIDE_L 0x0c /* analog side left - Audigy 2 ZS */ --#define A_EXTOUT_ASIDE_R 0x0d /* right - Audigy 2 ZS */ --#define A_EXTOUT_AREAR_L 0x0e /* analog rear left */ --#define A_EXTOUT_AREAR_R 0x0f /* right */ --#define A_EXTOUT_AC97_L 0x10 /* AC97 left (front) */ --#define A_EXTOUT_AC97_R 0x11 /* right */ --#define A_EXTOUT_ADC_CAP_L 0x16 /* ADC capture buffer left */ --#define A_EXTOUT_ADC_CAP_R 0x17 /* right */ --#define A_EXTOUT_MIC_CAP 0x18 /* Mic capture buffer */ -- --/* Audigy constants */ --#define A_C_00000000 0xc0 --#define A_C_00000001 0xc1 --#define A_C_00000002 0xc2 --#define A_C_00000003 0xc3 --#define A_C_00000004 0xc4 --#define A_C_00000008 0xc5 --#define A_C_00000010 0xc6 --#define A_C_00000020 0xc7 --#define A_C_00000100 0xc8 --#define A_C_00010000 0xc9 --#define A_C_00000800 0xca --#define A_C_10000000 0xcb --#define A_C_20000000 0xcc --#define A_C_40000000 0xcd --#define A_C_80000000 0xce --#define A_C_7fffffff 0xcf --#define A_C_ffffffff 0xd0 --#define A_C_fffffffe 0xd1 --#define A_C_c0000000 0xd2 --#define A_C_4f1bbcdc 0xd3 --#define A_C_5a7ef9db 0xd4 --#define A_C_00100000 0xd5 --#define A_GPR_ACCU 0xd6 /* ACCUM, accumulator */ --#define A_GPR_COND 0xd7 /* CCR, condition register */ --#define A_GPR_NOISE0 0xd8 /* noise source */ --#define A_GPR_NOISE1 0xd9 /* noise source */ --#define A_GPR_IRQ 0xda /* IRQ register */ --#define A_GPR_DBAC 0xdb /* TRAM Delay Base Address Counter - internal */ --#define A_GPR_DBACE 0xde /* TRAM Delay Base Address Counter - external */ -- --/* definitions for debug register */ --#define EMU10K1_DBG_ZC 0x80000000 /* zero tram counter */ --#define EMU10K1_DBG_SATURATION_OCCURED 0x02000000 /* saturation control */ --#define EMU10K1_DBG_SATURATION_ADDR 0x01ff0000 /* saturation address */ --#define EMU10K1_DBG_SINGLE_STEP 0x00008000 /* single step mode */ --#define EMU10K1_DBG_STEP 0x00004000 /* start single step */ --#define EMU10K1_DBG_CONDITION_CODE 0x00003e00 /* condition code */ --#define EMU10K1_DBG_SINGLE_STEP_ADDR 0x000001ff /* single step address */ -- --/* tank memory address line */ --#ifndef __KERNEL__ --#define TANKMEMADDRREG_ADDR_MASK 0x000fffff /* 20 bit tank address field */ --#define TANKMEMADDRREG_CLEAR 0x00800000 /* Clear tank memory */ --#define TANKMEMADDRREG_ALIGN 0x00400000 /* Align read or write relative to tank access */ --#define TANKMEMADDRREG_WRITE 0x00200000 /* Write to tank memory */ --#define TANKMEMADDRREG_READ 0x00100000 /* Read from tank memory */ --#endif -- --struct snd_emu10k1_fx8010_info { -- unsigned int internal_tram_size; /* in samples */ -- unsigned int external_tram_size; /* in samples */ -- char fxbus_names[16][32]; /* names of FXBUSes */ -- char extin_names[16][32]; /* names of external inputs */ -- char extout_names[32][32]; /* names of external outputs */ -- unsigned int gpr_controls; /* count of GPR controls */ --}; -- --#define EMU10K1_GPR_TRANSLATION_NONE 0 --#define EMU10K1_GPR_TRANSLATION_TABLE100 1 --#define EMU10K1_GPR_TRANSLATION_BASS 2 --#define EMU10K1_GPR_TRANSLATION_TREBLE 3 --#define EMU10K1_GPR_TRANSLATION_ONOFF 4 -- --struct snd_emu10k1_fx8010_control_gpr { -- struct snd_ctl_elem_id id; /* full control ID definition */ -- unsigned int vcount; /* visible count */ -- unsigned int count; /* count of GPR (1..16) */ -- unsigned short gpr[32]; /* GPR number(s) */ -- unsigned int value[32]; /* initial values */ -- unsigned int min; /* minimum range */ -- unsigned int max; /* maximum range */ -- unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */ -- const unsigned int *tlv; --}; -- --/* old ABI without TLV support */ --struct snd_emu10k1_fx8010_control_old_gpr { -- struct snd_ctl_elem_id id; -- unsigned int vcount; -- unsigned int count; -- unsigned short gpr[32]; -- unsigned int value[32]; -- unsigned int min; -- unsigned int max; -- unsigned int translation; --}; -- --struct snd_emu10k1_fx8010_code { -- char name[128]; -- -- __EMU10K1_DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */ -- __u32 __user *gpr_map; /* initializers */ -- -- unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */ -- struct snd_emu10k1_fx8010_control_gpr __user *gpr_add_controls; /* GPR controls to add/replace */ -- -- unsigned int gpr_del_control_count; /* count of GPR controls to remove */ -- struct snd_ctl_elem_id __user *gpr_del_controls; /* IDs of GPR controls to remove */ -- -- unsigned int gpr_list_control_count; /* count of GPR controls to list */ -- unsigned int gpr_list_control_total; /* total count of GPR controls */ -- struct snd_emu10k1_fx8010_control_gpr __user *gpr_list_controls; /* listed GPR controls */ -- -- __EMU10K1_DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */ -- __u32 __user *tram_data_map; /* data initializers */ -- __u32 __user *tram_addr_map; /* map initializers */ -- -- __EMU10K1_DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */ -- __u32 __user *code; /* one instruction - 64 bits */ --}; -- --struct snd_emu10k1_fx8010_tram { -- unsigned int address; /* 31.bit == 1 -> external TRAM */ -- unsigned int size; /* size in samples (4 bytes) */ -- unsigned int *samples; /* pointer to samples (20-bit) */ -- /* NULL->clear memory */ --}; -- --struct snd_emu10k1_fx8010_pcm_rec { -- unsigned int substream; /* substream number */ -- unsigned int res1; /* reserved */ -- unsigned int channels; /* 16-bit channels count, zero = remove this substream */ -- unsigned int tram_start; /* ring buffer position in TRAM (in samples) */ -- unsigned int buffer_size; /* count of buffered samples */ -- unsigned short gpr_size; /* GPR containing size of ringbuffer in samples (host) */ -- unsigned short gpr_ptr; /* GPR containing current pointer in the ring buffer (host = reset, FX8010) */ -- unsigned short gpr_count; /* GPR containing count of samples between two interrupts (host) */ -- unsigned short gpr_tmpcount; /* GPR containing current count of samples to interrupt (host = set, FX8010) */ -- unsigned short gpr_trigger; /* GPR containing trigger (activate) information (host) */ -- unsigned short gpr_running; /* GPR containing info if PCM is running (FX8010) */ -- unsigned char pad; /* reserved */ -- unsigned char etram[32]; /* external TRAM address & data (one per channel) */ -- unsigned int res2; /* reserved */ --}; -- --#define SNDRV_EMU10K1_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1) -- --#define SNDRV_EMU10K1_IOCTL_INFO _IOR ('H', 0x10, struct snd_emu10k1_fx8010_info) --#define SNDRV_EMU10K1_IOCTL_CODE_POKE _IOW ('H', 0x11, struct snd_emu10k1_fx8010_code) --#define SNDRV_EMU10K1_IOCTL_CODE_PEEK _IOWR('H', 0x12, struct snd_emu10k1_fx8010_code) --#define SNDRV_EMU10K1_IOCTL_TRAM_SETUP _IOW ('H', 0x20, int) --#define SNDRV_EMU10K1_IOCTL_TRAM_POKE _IOW ('H', 0x21, struct snd_emu10k1_fx8010_tram) --#define SNDRV_EMU10K1_IOCTL_TRAM_PEEK _IOWR('H', 0x22, struct snd_emu10k1_fx8010_tram) --#define SNDRV_EMU10K1_IOCTL_PCM_POKE _IOW ('H', 0x30, struct snd_emu10k1_fx8010_pcm_rec) --#define SNDRV_EMU10K1_IOCTL_PCM_PEEK _IOWR('H', 0x31, struct snd_emu10k1_fx8010_pcm_rec) --#define SNDRV_EMU10K1_IOCTL_PVERSION _IOR ('H', 0x40, int) --#define SNDRV_EMU10K1_IOCTL_STOP _IO ('H', 0x80) --#define SNDRV_EMU10K1_IOCTL_CONTINUE _IO ('H', 0x81) --#define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO ('H', 0x82) --#define SNDRV_EMU10K1_IOCTL_SINGLE_STEP _IOW ('H', 0x83, int) --#define SNDRV_EMU10K1_IOCTL_DBG_READ _IOR ('H', 0x84, int) -- --/* typedefs for compatibility to user-space */ --typedef struct snd_emu10k1_fx8010_info emu10k1_fx8010_info_t; --typedef struct snd_emu10k1_fx8010_control_gpr emu10k1_fx8010_control_gpr_t; --typedef struct snd_emu10k1_fx8010_code emu10k1_fx8010_code_t; --typedef struct snd_emu10k1_fx8010_tram emu10k1_fx8010_tram_t; --typedef struct snd_emu10k1_fx8010_pcm_rec emu10k1_fx8010_pcm_t; -- --#endif /* _UAPI__SOUND_EMU10K1_H */ -+#include -+#include -diff --git a/include/sound/hdsp.h b/include/sound/hdsp.h -index 5dc0c3db..78fb745b 100644 ---- a/include/sound/hdsp.h -+++ b/include/sound/hdsp.h -@@ -1,111 +1,2 @@ --/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ --#ifndef __SOUND_HDSP_H --#define __SOUND_HDSP_H -- --/* -- * Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org) -- * -- * This program is free software; you can redistribute it and/or modify -- * it under the terms of the GNU General Public License as published by -- * the Free Software Foundation; either version 2 of the License, or -- * (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU General Public License for more details. -- * -- * You should have received a copy of the GNU General Public License -- * along with this program; if not, write to the Free Software -- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -- */ -- --#include -- --#define HDSP_MATRIX_MIXER_SIZE 2048 -- --enum HDSP_IO_Type { -- Digiface, -- Multiface, -- H9652, -- H9632, -- RPM, -- Undefined, --}; -- --struct hdsp_peak_rms { -- __u32 input_peaks[26]; -- __u32 playback_peaks[26]; -- __u32 output_peaks[28]; -- __u64 input_rms[26]; -- __u64 playback_rms[26]; -- /* These are only used for H96xx cards */ -- __u64 output_rms[26]; --}; -- --#define SNDRV_HDSP_IOCTL_GET_PEAK_RMS _IOR('H', 0x40, struct hdsp_peak_rms) -- --struct hdsp_config_info { -- unsigned char pref_sync_ref; -- unsigned char wordclock_sync_check; -- unsigned char spdif_sync_check; -- unsigned char adatsync_sync_check; -- unsigned char adat_sync_check[3]; -- unsigned char spdif_in; -- unsigned char spdif_out; -- unsigned char spdif_professional; -- unsigned char spdif_emphasis; -- unsigned char spdif_nonaudio; -- unsigned int spdif_sample_rate; -- unsigned int system_sample_rate; -- unsigned int autosync_sample_rate; -- unsigned char system_clock_mode; -- unsigned char clock_source; -- unsigned char autosync_ref; -- unsigned char line_out; -- unsigned char passthru; -- unsigned char da_gain; -- unsigned char ad_gain; -- unsigned char phone_gain; -- unsigned char xlr_breakout_cable; -- unsigned char analog_extension_board; --}; -- --#define SNDRV_HDSP_IOCTL_GET_CONFIG_INFO _IOR('H', 0x41, struct hdsp_config_info) -- --struct hdsp_firmware { -- void __user *firmware_data; /* 24413 x 4 bytes */ --}; -- --#define SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE _IOW('H', 0x42, struct hdsp_firmware) -- --struct hdsp_version { -- enum HDSP_IO_Type io_type; -- unsigned short firmware_rev; --}; -- --#define SNDRV_HDSP_IOCTL_GET_VERSION _IOR('H', 0x43, struct hdsp_version) -- --struct hdsp_mixer { -- unsigned short matrix[HDSP_MATRIX_MIXER_SIZE]; --}; -- --#define SNDRV_HDSP_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdsp_mixer) -- --struct hdsp_9632_aeb { -- int aebi; -- int aebo; --}; -- --#define SNDRV_HDSP_IOCTL_GET_9632_AEB _IOR('H', 0x45, struct hdsp_9632_aeb) -- --/* typedefs for compatibility to user-space */ --typedef enum HDSP_IO_Type HDSP_IO_Type; --typedef struct hdsp_peak_rms hdsp_peak_rms_t; --typedef struct hdsp_config_info hdsp_config_info_t; --typedef struct hdsp_firmware hdsp_firmware_t; --typedef struct hdsp_version hdsp_version_t; --typedef struct hdsp_mixer hdsp_mixer_t; --typedef struct hdsp_9632_aeb hdsp_9632_aeb_t; -- --#endif /* __SOUND_HDSP_H */ -+#include -+#include -diff --git a/include/sound/hdspm.h b/include/sound/hdspm.h -index a38f3f79..af6d19ed 100644 ---- a/include/sound/hdspm.h -+++ b/include/sound/hdspm.h -@@ -1,232 +1,2 @@ --/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ --#ifndef __SOUND_HDSPM_H --#define __SOUND_HDSPM_H --/* -- * Copyright (C) 2003 Winfried Ritsch (IEM) -- * based on hdsp.h from Thomas Charbonnel (thomas@undata.org) -- * -- * -- * This program is free software; you can redistribute it and/or modify -- * it under the terms of the GNU General Public License as published by -- * the Free Software Foundation; either version 2 of the License, or -- * (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU General Public License for more details. -- * -- * You should have received a copy of the GNU General Public License -- * along with this program; if not, write to the Free Software -- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -- */ -- --#include -- --/* Maximum channels is 64 even on 56Mode you have 64playbacks to matrix */ --#define HDSPM_MAX_CHANNELS 64 -- --enum hdspm_io_type { -- MADI, -- MADIface, -- AIO, -- AES32, -- RayDAT --}; -- --enum hdspm_speed { -- ss, -- ds, -- qs --}; -- --/* -------------------- IOCTL Peak/RMS Meters -------------------- */ -- --struct hdspm_peak_rms { -- __u32 input_peaks[64]; -- __u32 playback_peaks[64]; -- __u32 output_peaks[64]; -- -- __u64 input_rms[64]; -- __u64 playback_rms[64]; -- __u64 output_rms[64]; -- -- __u8 speed; /* enum {ss, ds, qs} */ -- int status2; --}; -- --#define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS \ -- _IOR('H', 0x42, struct hdspm_peak_rms) -- --/* ------------ CONFIG block IOCTL ---------------------- */ -- --struct hdspm_config { -- unsigned char pref_sync_ref; -- unsigned char wordclock_sync_check; -- unsigned char madi_sync_check; -- unsigned int system_sample_rate; -- unsigned int autosync_sample_rate; -- unsigned char system_clock_mode; -- unsigned char clock_source; -- unsigned char autosync_ref; -- unsigned char line_out; -- unsigned int passthru; -- unsigned int analog_out; --}; -- --#define SNDRV_HDSPM_IOCTL_GET_CONFIG \ -- _IOR('H', 0x41, struct hdspm_config) -- --/* -- * If there's a TCO (TimeCode Option) board installed, -- * there are further options and status data available. -- * The hdspm_ltc structure contains the current SMPTE -- * timecode and some status information and can be -- * obtained via SNDRV_HDSPM_IOCTL_GET_LTC or in the -- * hdspm_status struct. -- */ -- --enum hdspm_ltc_format { -- format_invalid, -- fps_24, -- fps_25, -- fps_2997, -- fps_30 --}; -- --enum hdspm_ltc_frame { -- frame_invalid, -- drop_frame, -- full_frame --}; -- --enum hdspm_ltc_input_format { -- ntsc, -- pal, -- no_video --}; -- --struct hdspm_ltc { -- unsigned int ltc; -- -- enum hdspm_ltc_format format; -- enum hdspm_ltc_frame frame; -- enum hdspm_ltc_input_format input_format; --}; -- --#define SNDRV_HDSPM_IOCTL_GET_LTC _IOR('H', 0x46, struct hdspm_ltc) -- --/* -- * The status data reflects the device's current state -- * as determined by the card's configuration and -- * connection status. -- */ -- --enum hdspm_sync { -- hdspm_sync_no_lock = 0, -- hdspm_sync_lock = 1, -- hdspm_sync_sync = 2 --}; -- --enum hdspm_madi_input { -- hdspm_input_optical = 0, -- hdspm_input_coax = 1 --}; -- --enum hdspm_madi_channel_format { -- hdspm_format_ch_64 = 0, -- hdspm_format_ch_56 = 1 --}; -- --enum hdspm_madi_frame_format { -- hdspm_frame_48 = 0, -- hdspm_frame_96 = 1 --}; -- --enum hdspm_syncsource { -- syncsource_wc = 0, -- syncsource_madi = 1, -- syncsource_tco = 2, -- syncsource_sync = 3, -- syncsource_none = 4 --}; -- --struct hdspm_status { -- __u8 card_type; /* enum hdspm_io_type */ -- enum hdspm_syncsource autosync_source; -- -- __u64 card_clock; -- __u32 master_period; -- -- union { -- struct { -- __u8 sync_wc; /* enum hdspm_sync */ -- __u8 sync_madi; /* enum hdspm_sync */ -- __u8 sync_tco; /* enum hdspm_sync */ -- __u8 sync_in; /* enum hdspm_sync */ -- __u8 madi_input; /* enum hdspm_madi_input */ -- __u8 channel_format; /* enum hdspm_madi_channel_format */ -- __u8 frame_format; /* enum hdspm_madi_frame_format */ -- } madi; -- } card_specific; --}; -- --#define SNDRV_HDSPM_IOCTL_GET_STATUS \ -- _IOR('H', 0x47, struct hdspm_status) -- --/* -- * Get information about the card and its add-ons. -- */ -- --#define HDSPM_ADDON_TCO 1 -- --struct hdspm_version { -- __u8 card_type; /* enum hdspm_io_type */ -- char cardname[20]; -- unsigned int serial; -- unsigned short firmware_rev; -- int addons; --}; -- --#define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x48, struct hdspm_version) -- --/* ------------- get Matrix Mixer IOCTL --------------- */ -- --/* MADI mixer: 64inputs+64playback in 64outputs = 8192 => *4Byte = -- * 32768 Bytes -- */ -- --/* organisation is 64 channelfader in a continuous memory block */ --/* equivalent to hardware definition, maybe for future feature of mmap of -- * them -- */ --/* each of 64 outputs has 64 infader and 64 outfader: -- Ins to Outs mixer[out].in[in], Outstreams to Outs mixer[out].pb[pb] */ -- --#define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS -- --struct hdspm_channelfader { -- unsigned int in[HDSPM_MIXER_CHANNELS]; -- unsigned int pb[HDSPM_MIXER_CHANNELS]; --}; -- --struct hdspm_mixer { -- struct hdspm_channelfader ch[HDSPM_MIXER_CHANNELS]; --}; -- --struct hdspm_mixer_ioctl { -- struct hdspm_mixer *mixer; --}; -- --/* use indirect access due to the limit of ioctl bit size */ --#define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdspm_mixer_ioctl) -- --/* typedefs for compatibility to user-space */ --typedef struct hdspm_peak_rms hdspm_peak_rms_t; --typedef struct hdspm_config_info hdspm_config_info_t; --typedef struct hdspm_version hdspm_version_t; --typedef struct hdspm_channelfader snd_hdspm_channelfader_t; --typedef struct hdspm_mixer hdspm_mixer_t; -- -- --#endif -+#include -+#include -diff --git a/include/sound/sb16_csp.h b/include/sound/sb16_csp.h -index e6485148..24121fcb 100644 ---- a/include/sound/sb16_csp.h -+++ b/include/sound/sb16_csp.h -@@ -1,123 +1 @@ --/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ --/* -- * Copyright (c) 1999 by Uros Bizjak -- * Takashi Iwai -- * -- * SB16ASP/AWE32 CSP control -- * -- * This program is free software; you can redistribute it and/or modify -- * it under the terms of the GNU General Public License as published by -- * the Free Software Foundation; either version 2 of the License, or -- * (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU General Public License for more details. -- * -- * You should have received a copy of the GNU General Public License -- * along with this program; if not, write to the Free Software -- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- * -- */ --#ifndef _UAPI__SOUND_SB16_CSP_H --#define _UAPI__SOUND_SB16_CSP_H -- -- --/* CSP modes */ --#define SNDRV_SB_CSP_MODE_NONE 0x00 --#define SNDRV_SB_CSP_MODE_DSP_READ 0x01 /* Record from DSP */ --#define SNDRV_SB_CSP_MODE_DSP_WRITE 0x02 /* Play to DSP */ --#define SNDRV_SB_CSP_MODE_QSOUND 0x04 /* QSound */ -- --/* CSP load flags */ --#define SNDRV_SB_CSP_LOAD_FROMUSER 0x01 --#define SNDRV_SB_CSP_LOAD_INITBLOCK 0x02 -- --/* CSP sample width */ --#define SNDRV_SB_CSP_SAMPLE_8BIT 0x01 --#define SNDRV_SB_CSP_SAMPLE_16BIT 0x02 -- --/* CSP channels */ --#define SNDRV_SB_CSP_MONO 0x01 --#define SNDRV_SB_CSP_STEREO 0x02 -- --/* CSP rates */ --#define SNDRV_SB_CSP_RATE_8000 0x01 --#define SNDRV_SB_CSP_RATE_11025 0x02 --#define SNDRV_SB_CSP_RATE_22050 0x04 --#define SNDRV_SB_CSP_RATE_44100 0x08 --#define SNDRV_SB_CSP_RATE_ALL 0x0f -- --/* CSP running state */ --#define SNDRV_SB_CSP_ST_IDLE 0x00 --#define SNDRV_SB_CSP_ST_LOADED 0x01 --#define SNDRV_SB_CSP_ST_RUNNING 0x02 --#define SNDRV_SB_CSP_ST_PAUSED 0x04 --#define SNDRV_SB_CSP_ST_AUTO 0x08 --#define SNDRV_SB_CSP_ST_QSOUND 0x10 -- --/* maximum QSound value (180 degrees right) */ --#define SNDRV_SB_CSP_QSOUND_MAX_RIGHT 0x20 -- --/* maximum microcode RIFF file size */ --#define SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE 0x3000 -- --/* microcode header */ --struct snd_sb_csp_mc_header { -- char codec_name[16]; /* id name of codec */ -- unsigned short func_req; /* requested function */ --}; -- --/* microcode to be loaded */ --struct snd_sb_csp_microcode { -- struct snd_sb_csp_mc_header info; -- unsigned char data[SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE]; --}; -- --/* start CSP with sample_width in mono/stereo */ --struct snd_sb_csp_start { -- int sample_width; /* sample width, look above */ -- int channels; /* channels, look above */ --}; -- --/* CSP information */ --struct snd_sb_csp_info { -- char codec_name[16]; /* id name of codec */ -- unsigned short func_nr; /* function number */ -- unsigned int acc_format; /* accepted PCM formats */ -- unsigned short acc_channels; /* accepted channels */ -- unsigned short acc_width; /* accepted sample width */ -- unsigned short acc_rates; /* accepted sample rates */ -- unsigned short csp_mode; /* CSP mode, see above */ -- unsigned short run_channels; /* current channels */ -- unsigned short run_width; /* current sample width */ -- unsigned short version; /* version id: 0x10 - 0x1f */ -- unsigned short state; /* state bits */ --}; -- --/* HWDEP controls */ --/* get CSP information */ --#define SNDRV_SB_CSP_IOCTL_INFO _IOR('H', 0x10, struct snd_sb_csp_info) --/* load microcode to CSP */ --/* NOTE: struct snd_sb_csp_microcode overflows the max size (13 bits) -- * defined for some architectures like MIPS, and it leads to build errors. -- * (x86 and co have 14-bit size, thus it's valid, though.) -- * As a workaround for skipping the size-limit check, here we don't use the -- * normal _IOW() macro but _IOC() with the manual argument. -- */ --#define SNDRV_SB_CSP_IOCTL_LOAD_CODE \ -- _IOC(_IOC_WRITE, 'H', 0x11, sizeof(struct snd_sb_csp_microcode)) --/* unload microcode from CSP */ --#define SNDRV_SB_CSP_IOCTL_UNLOAD_CODE _IO('H', 0x12) --/* start CSP */ --#define SNDRV_SB_CSP_IOCTL_START _IOW('H', 0x13, struct snd_sb_csp_start) --/* stop CSP */ --#define SNDRV_SB_CSP_IOCTL_STOP _IO('H', 0x14) --/* pause CSP and DMA transfer */ --#define SNDRV_SB_CSP_IOCTL_PAUSE _IO('H', 0x15) --/* restart CSP and DMA transfer */ --#define SNDRV_SB_CSP_IOCTL_RESTART _IO('H', 0x16) -- -- --#endif /* _UAPI__SOUND_SB16_CSP_H */ -+#include -diff --git a/include/sound/sscape_ioctl.h b/include/sound/sscape_ioctl.h -index c6653ebf..23b48d33 100644 ---- a/include/sound/sscape_ioctl.h -+++ b/include/sound/sscape_ioctl.h -@@ -1,21 +1 @@ --#ifndef SSCAPE_IOCTL_H --#define SSCAPE_IOCTL_H -- -- --struct sscape_bootblock --{ -- unsigned char code[256]; -- unsigned version; --}; -- --#define SSCAPE_MICROCODE_SIZE 65536 -- --struct sscape_microcode --{ -- unsigned char *code; --}; -- --#define SND_SSCAPE_LOAD_BOOTB _IOWR('P', 100, struct sscape_bootblock) --#define SND_SSCAPE_LOAD_MCODE _IOW ('P', 101, struct sscape_microcode) -- --#endif -+#include -diff --git a/include/sound/tlv.h b/include/sound/tlv.h -index 7d6d65f6..e435a5fc 100644 ---- a/include/sound/tlv.h -+++ b/include/sound/tlv.h -@@ -1,117 +1 @@ --/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ --/* -- * This program is free software; you can redistribute it and/or modify -- * it under the terms of the GNU General Public License as published by -- * the Free Software Foundation; either version 2 of the License, or -- * (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU General Public License for more details. -- */ -- --#ifndef __UAPI_SOUND_TLV_H --#define __UAPI_SOUND_TLV_H -- --#define SNDRV_CTL_TLVT_CONTAINER 0 /* one level down - group of TLVs */ --#define SNDRV_CTL_TLVT_DB_SCALE 1 /* dB scale */ --#define SNDRV_CTL_TLVT_DB_LINEAR 2 /* linear volume */ --#define SNDRV_CTL_TLVT_DB_RANGE 3 /* dB range container */ --#define SNDRV_CTL_TLVT_DB_MINMAX 4 /* dB scale with min/max */ --#define SNDRV_CTL_TLVT_DB_MINMAX_MUTE 5 /* dB scale with min/max with mute */ -- --/* -- * channel-mapping TLV items -- * TLV length must match with num_channels -- */ --#define SNDRV_CTL_TLVT_CHMAP_FIXED 0x101 /* fixed channel position */ --#define SNDRV_CTL_TLVT_CHMAP_VAR 0x102 /* channels freely swappable */ --#define SNDRV_CTL_TLVT_CHMAP_PAIRED 0x103 /* pair-wise swappable */ -- --/* -- * TLV structure is right behind the struct snd_ctl_tlv: -- * unsigned int type - see SNDRV_CTL_TLVT_* -- * unsigned int length -- * .... data aligned to sizeof(unsigned int), use -- * block_length = (length + (sizeof(unsigned int) - 1)) & -- * ~(sizeof(unsigned int) - 1)) .... -- */ --#define SNDRV_CTL_TLVD_ITEM(type, ...) \ -- (type), SNDRV_CTL_TLVD_LENGTH(__VA_ARGS__), __VA_ARGS__ --#define SNDRV_CTL_TLVD_LENGTH(...) \ -- ((unsigned int)sizeof((const unsigned int[]) { __VA_ARGS__ })) -- --/* Accessor offsets for TLV data items */ --#define SNDRV_CTL_TLVO_TYPE 0 --#define SNDRV_CTL_TLVO_LEN 1 -- --#define SNDRV_CTL_TLVD_CONTAINER_ITEM(...) \ -- SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_CONTAINER, __VA_ARGS__) --#define SNDRV_CTL_TLVD_DECLARE_CONTAINER(name, ...) \ -- unsigned int name[] = { \ -- SNDRV_CTL_TLVD_CONTAINER_ITEM(__VA_ARGS__) \ -- } -- --#define SNDRV_CTL_TLVD_DB_SCALE_MASK 0xffff --#define SNDRV_CTL_TLVD_DB_SCALE_MUTE 0x10000 --#define SNDRV_CTL_TLVD_DB_SCALE_ITEM(min, step, mute) \ -- SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_SCALE, \ -- (min), \ -- ((step) & SNDRV_CTL_TLVD_DB_SCALE_MASK) | \ -- ((mute) ? SNDRV_CTL_TLVD_DB_SCALE_MUTE : 0)) --#define SNDRV_CTL_TLVD_DECLARE_DB_SCALE(name, min, step, mute) \ -- unsigned int name[] = { \ -- SNDRV_CTL_TLVD_DB_SCALE_ITEM(min, step, mute) \ -- } -- --/* Accessor offsets for min, mute and step items in dB scale type TLV */ --#define SNDRV_CTL_TLVO_DB_SCALE_MIN 2 --#define SNDRV_CTL_TLVO_DB_SCALE_MUTE_AND_STEP 3 -- --/* dB scale specified with min/max values instead of step */ --#define SNDRV_CTL_TLVD_DB_MINMAX_ITEM(min_dB, max_dB) \ -- SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_MINMAX, (min_dB), (max_dB)) --#define SNDRV_CTL_TLVD_DB_MINMAX_MUTE_ITEM(min_dB, max_dB) \ -- SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_MINMAX_MUTE, (min_dB), (max_dB)) --#define SNDRV_CTL_TLVD_DECLARE_DB_MINMAX(name, min_dB, max_dB) \ -- unsigned int name[] = { \ -- SNDRV_CTL_TLVD_DB_MINMAX_ITEM(min_dB, max_dB) \ -- } --#define SNDRV_CTL_TLVD_DECLARE_DB_MINMAX_MUTE(name, min_dB, max_dB) \ -- unsigned int name[] = { \ -- SNDRV_CTL_TLVD_DB_MINMAX_MUTE_ITEM(min_dB, max_dB) \ -- } -- --/* Accessor offsets for min, max items in db-minmax types of TLV. */ --#define SNDRV_CTL_TLVO_DB_MINMAX_MIN 2 --#define SNDRV_CTL_TLVO_DB_MINMAX_MAX 3 -- --/* linear volume between min_dB and max_dB (.01dB unit) */ --#define SNDRV_CTL_TLVD_DB_LINEAR_ITEM(min_dB, max_dB) \ -- SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_LINEAR, (min_dB), (max_dB)) --#define SNDRV_CTL_TLVD_DECLARE_DB_LINEAR(name, min_dB, max_dB) \ -- unsigned int name[] = { \ -- SNDRV_CTL_TLVD_DB_LINEAR_ITEM(min_dB, max_dB) \ -- } -- --/* Accessor offsets for min, max items in db-linear type of TLV. */ --#define SNDRV_CTL_TLVO_DB_LINEAR_MIN 2 --#define SNDRV_CTL_TLVO_DB_LINEAR_MAX 3 -- --/* dB range container: -- * Items in dB range container must be ordered by their values and by their -- * dB values. This implies that larger values must correspond with larger -- * dB values (which is also required for all other mixer controls). -- */ --/* Each item is: */ --#define SNDRV_CTL_TLVD_DB_RANGE_ITEM(...) \ -- SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_RANGE, __VA_ARGS__) --#define SNDRV_CTL_TLVD_DECLARE_DB_RANGE(name, ...) \ -- unsigned int name[] = { \ -- SNDRV_CTL_TLVD_DB_RANGE_ITEM(__VA_ARGS__) \ -- } -- --#define SNDRV_CTL_TLVD_DB_GAIN_MUTE -9999999 -- --#endif -+#include -diff --git a/include/sound/type_compat.h b/include/sound/type_compat.h -index e973ff31..d4790c1f 100644 ---- a/include/sound/type_compat.h -+++ b/include/sound/type_compat.h -@@ -3,6 +3,9 @@ - - #ifndef DOC_HIDDEN - #include -+#ifdef __linux__ -+#include -+#else - typedef uint8_t __u8; - typedef uint16_t __u16; - typedef uint32_t __u32; -@@ -37,6 +40,16 @@ typedef int32_t __s32; - #define __be32 __u32 - #define __be16 __u16 - #define __be8 __u8 -+#endif -+ -+#ifndef __user -+#define __user -+#endif -+ -+#ifndef __packed -+#define __packed __attribute__((__packed__)) -+#endif -+ - #endif /* DOC_HIDDEN */ - - #endif /* __TYPE_COMPAT_H */ -diff --git a/include/sound/uapi/Makefile.am b/include/sound/uapi/Makefile.am -new file mode 100644 -index 00000000..99197108 ---- /dev/null -+++ b/include/sound/uapi/Makefile.am -@@ -0,0 +1,6 @@ -+alsasounduapiincludedir = ${includedir}/alsa/sound/uapi -+ -+alsasounduapiinclude_HEADERS = asound_fm.h hdsp.h hdspm.h sb16_csp.h \ -+ sscape_ioctl.h emu10k1.h asoc.h tlv.h -+ -+noinst_HEADERS = asound.h asequencer.h -diff --git a/include/sound/uapi/asequencer.h b/include/sound/uapi/asequencer.h -new file mode 100644 -index 00000000..a75e14ed ---- /dev/null -+++ b/include/sound/uapi/asequencer.h -@@ -0,0 +1,612 @@ -+/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ -+/* -+ * Main header file for the ALSA sequencer -+ * Copyright (c) 1998-1999 by Frank van de Pol -+ * (c) 1998-1999 by Jaroslav Kysela -+ * -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ * -+ */ -+#ifndef _UAPI__SOUND_ASEQUENCER_H -+#define _UAPI__SOUND_ASEQUENCER_H -+ -+#include -+ -+/** version of the sequencer */ -+#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 2) -+ -+/** -+ * definition of sequencer event types -+ */ -+ -+/** system messages -+ * event data type = #snd_seq_result -+ */ -+#define SNDRV_SEQ_EVENT_SYSTEM 0 -+#define SNDRV_SEQ_EVENT_RESULT 1 -+ -+/** note messages (channel specific) -+ * event data type = #snd_seq_ev_note -+ */ -+#define SNDRV_SEQ_EVENT_NOTE 5 -+#define SNDRV_SEQ_EVENT_NOTEON 6 -+#define SNDRV_SEQ_EVENT_NOTEOFF 7 -+#define SNDRV_SEQ_EVENT_KEYPRESS 8 -+ -+/** control messages (channel specific) -+ * event data type = #snd_seq_ev_ctrl -+ */ -+#define SNDRV_SEQ_EVENT_CONTROLLER 10 -+#define SNDRV_SEQ_EVENT_PGMCHANGE 11 -+#define SNDRV_SEQ_EVENT_CHANPRESS 12 -+#define SNDRV_SEQ_EVENT_PITCHBEND 13 /**< from -8192 to 8191 */ -+#define SNDRV_SEQ_EVENT_CONTROL14 14 /**< 14 bit controller value */ -+#define SNDRV_SEQ_EVENT_NONREGPARAM 15 /**< 14 bit NRPN address + 14 bit unsigned value */ -+#define SNDRV_SEQ_EVENT_REGPARAM 16 /**< 14 bit RPN address + 14 bit unsigned value */ -+ -+/** synchronisation messages -+ * event data type = #snd_seq_ev_ctrl -+ */ -+#define SNDRV_SEQ_EVENT_SONGPOS 20 /* Song Position Pointer with LSB and MSB values */ -+#define SNDRV_SEQ_EVENT_SONGSEL 21 /* Song Select with song ID number */ -+#define SNDRV_SEQ_EVENT_QFRAME 22 /* midi time code quarter frame */ -+#define SNDRV_SEQ_EVENT_TIMESIGN 23 /* SMF Time Signature event */ -+#define SNDRV_SEQ_EVENT_KEYSIGN 24 /* SMF Key Signature event */ -+ -+/** timer messages -+ * event data type = snd_seq_ev_queue_control -+ */ -+#define SNDRV_SEQ_EVENT_START 30 /* midi Real Time Start message */ -+#define SNDRV_SEQ_EVENT_CONTINUE 31 /* midi Real Time Continue message */ -+#define SNDRV_SEQ_EVENT_STOP 32 /* midi Real Time Stop message */ -+#define SNDRV_SEQ_EVENT_SETPOS_TICK 33 /* set tick queue position */ -+#define SNDRV_SEQ_EVENT_SETPOS_TIME 34 /* set realtime queue position */ -+#define SNDRV_SEQ_EVENT_TEMPO 35 /* (SMF) Tempo event */ -+#define SNDRV_SEQ_EVENT_CLOCK 36 /* midi Real Time Clock message */ -+#define SNDRV_SEQ_EVENT_TICK 37 /* midi Real Time Tick message */ -+#define SNDRV_SEQ_EVENT_QUEUE_SKEW 38 /* skew queue tempo */ -+ -+/** others -+ * event data type = none -+ */ -+#define SNDRV_SEQ_EVENT_TUNE_REQUEST 40 /* tune request */ -+#define SNDRV_SEQ_EVENT_RESET 41 /* reset to power-on state */ -+#define SNDRV_SEQ_EVENT_SENSING 42 /* "active sensing" event */ -+ -+/** echo back, kernel private messages -+ * event data type = any type -+ */ -+#define SNDRV_SEQ_EVENT_ECHO 50 /* echo event */ -+#define SNDRV_SEQ_EVENT_OSS 51 /* OSS raw event */ -+ -+/** system status messages (broadcast for subscribers) -+ * event data type = snd_seq_addr -+ */ -+#define SNDRV_SEQ_EVENT_CLIENT_START 60 /* new client has connected */ -+#define SNDRV_SEQ_EVENT_CLIENT_EXIT 61 /* client has left the system */ -+#define SNDRV_SEQ_EVENT_CLIENT_CHANGE 62 /* client status/info has changed */ -+#define SNDRV_SEQ_EVENT_PORT_START 63 /* new port was created */ -+#define SNDRV_SEQ_EVENT_PORT_EXIT 64 /* port was deleted from system */ -+#define SNDRV_SEQ_EVENT_PORT_CHANGE 65 /* port status/info has changed */ -+ -+/** port connection changes -+ * event data type = snd_seq_connect -+ */ -+#define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */ -+#define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */ -+ -+/* 70-89: synthesizer events - obsoleted */ -+ -+/** user-defined events with fixed length -+ * event data type = any -+ */ -+#define SNDRV_SEQ_EVENT_USR0 90 -+#define SNDRV_SEQ_EVENT_USR1 91 -+#define SNDRV_SEQ_EVENT_USR2 92 -+#define SNDRV_SEQ_EVENT_USR3 93 -+#define SNDRV_SEQ_EVENT_USR4 94 -+#define SNDRV_SEQ_EVENT_USR5 95 -+#define SNDRV_SEQ_EVENT_USR6 96 -+#define SNDRV_SEQ_EVENT_USR7 97 -+#define SNDRV_SEQ_EVENT_USR8 98 -+#define SNDRV_SEQ_EVENT_USR9 99 -+ -+/* 100-118: instrument layer - obsoleted */ -+/* 119-129: reserved */ -+ -+/* 130-139: variable length events -+ * event data type = snd_seq_ev_ext -+ * (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set) -+ */ -+#define SNDRV_SEQ_EVENT_SYSEX 130 /* system exclusive data (variable length) */ -+#define SNDRV_SEQ_EVENT_BOUNCE 131 /* error event */ -+/* 132-134: reserved */ -+#define SNDRV_SEQ_EVENT_USR_VAR0 135 -+#define SNDRV_SEQ_EVENT_USR_VAR1 136 -+#define SNDRV_SEQ_EVENT_USR_VAR2 137 -+#define SNDRV_SEQ_EVENT_USR_VAR3 138 -+#define SNDRV_SEQ_EVENT_USR_VAR4 139 -+ -+/* 150-151: kernel events with quote - DO NOT use in user clients */ -+#define SNDRV_SEQ_EVENT_KERNEL_ERROR 150 -+#define SNDRV_SEQ_EVENT_KERNEL_QUOTE 151 /* obsolete */ -+ -+/* 152-191: reserved */ -+ -+/* 192-254: hardware specific events */ -+ -+/* 255: special event */ -+#define SNDRV_SEQ_EVENT_NONE 255 -+ -+ -+typedef unsigned char snd_seq_event_type_t; -+ -+/** event address */ -+struct snd_seq_addr { -+ unsigned char client; /**< Client number: 0..255, 255 = broadcast to all clients */ -+ unsigned char port; /**< Port within client: 0..255, 255 = broadcast to all ports */ -+}; -+ -+/** port connection */ -+struct snd_seq_connect { -+ struct snd_seq_addr sender; -+ struct snd_seq_addr dest; -+}; -+ -+ -+#define SNDRV_SEQ_ADDRESS_UNKNOWN 253 /* unknown source */ -+#define SNDRV_SEQ_ADDRESS_SUBSCRIBERS 254 /* send event to all subscribed ports */ -+#define SNDRV_SEQ_ADDRESS_BROADCAST 255 /* send event to all queues/clients/ports/channels */ -+#define SNDRV_SEQ_QUEUE_DIRECT 253 /* direct dispatch */ -+ -+ /* event mode flag - NOTE: only 8 bits available! */ -+#define SNDRV_SEQ_TIME_STAMP_TICK (0<<0) /* timestamp in clock ticks */ -+#define SNDRV_SEQ_TIME_STAMP_REAL (1<<0) /* timestamp in real time */ -+#define SNDRV_SEQ_TIME_STAMP_MASK (1<<0) -+ -+#define SNDRV_SEQ_TIME_MODE_ABS (0<<1) /* absolute timestamp */ -+#define SNDRV_SEQ_TIME_MODE_REL (1<<1) /* relative to current time */ -+#define SNDRV_SEQ_TIME_MODE_MASK (1<<1) -+ -+#define SNDRV_SEQ_EVENT_LENGTH_FIXED (0<<2) /* fixed event size */ -+#define SNDRV_SEQ_EVENT_LENGTH_VARIABLE (1<<2) /* variable event size */ -+#define SNDRV_SEQ_EVENT_LENGTH_VARUSR (2<<2) /* variable event size - user memory space */ -+#define SNDRV_SEQ_EVENT_LENGTH_MASK (3<<2) -+ -+#define SNDRV_SEQ_PRIORITY_NORMAL (0<<4) /* normal priority */ -+#define SNDRV_SEQ_PRIORITY_HIGH (1<<4) /* event should be processed before others */ -+#define SNDRV_SEQ_PRIORITY_MASK (1<<4) -+ -+ -+ /* note event */ -+struct snd_seq_ev_note { -+ unsigned char channel; -+ unsigned char note; -+ unsigned char velocity; -+ unsigned char off_velocity; /* only for SNDRV_SEQ_EVENT_NOTE */ -+ unsigned int duration; /* only for SNDRV_SEQ_EVENT_NOTE */ -+}; -+ -+ /* controller event */ -+struct snd_seq_ev_ctrl { -+ unsigned char channel; -+ unsigned char unused1, unused2, unused3; /* pad */ -+ unsigned int param; -+ signed int value; -+}; -+ -+ /* generic set of bytes (12x8 bit) */ -+struct snd_seq_ev_raw8 { -+ unsigned char d[12]; /* 8 bit value */ -+}; -+ -+ /* generic set of integers (3x32 bit) */ -+struct snd_seq_ev_raw32 { -+ unsigned int d[3]; /* 32 bit value */ -+}; -+ -+ /* external stored data */ -+struct snd_seq_ev_ext { -+ unsigned int len; /* length of data */ -+ void *ptr; /* pointer to data (note: maybe 64-bit) */ -+} __attribute__((packed)); -+ -+struct snd_seq_result { -+ int event; /* processed event type */ -+ int result; -+}; -+ -+ -+struct snd_seq_real_time { -+ unsigned int tv_sec; /* seconds */ -+ unsigned int tv_nsec; /* nanoseconds */ -+}; -+ -+typedef unsigned int snd_seq_tick_time_t; /* midi ticks */ -+ -+union snd_seq_timestamp { -+ snd_seq_tick_time_t tick; -+ struct snd_seq_real_time time; -+}; -+ -+struct snd_seq_queue_skew { -+ unsigned int value; -+ unsigned int base; -+}; -+ -+ /* queue timer control */ -+struct snd_seq_ev_queue_control { -+ unsigned char queue; /* affected queue */ -+ unsigned char pad[3]; /* reserved */ -+ union { -+ signed int value; /* affected value (e.g. tempo) */ -+ union snd_seq_timestamp time; /* time */ -+ unsigned int position; /* sync position */ -+ struct snd_seq_queue_skew skew; -+ unsigned int d32[2]; -+ unsigned char d8[8]; -+ } param; -+}; -+ -+ /* quoted event - inside the kernel only */ -+struct snd_seq_ev_quote { -+ struct snd_seq_addr origin; /* original sender */ -+ unsigned short value; /* optional data */ -+ struct snd_seq_event *event; /* quoted event */ -+} __attribute__((packed)); -+ -+ -+ /* sequencer event */ -+struct snd_seq_event { -+ snd_seq_event_type_t type; /* event type */ -+ unsigned char flags; /* event flags */ -+ char tag; -+ -+ unsigned char queue; /* schedule queue */ -+ union snd_seq_timestamp time; /* schedule time */ -+ -+ -+ struct snd_seq_addr source; /* source address */ -+ struct snd_seq_addr dest; /* destination address */ -+ -+ union { /* event data... */ -+ struct snd_seq_ev_note note; -+ struct snd_seq_ev_ctrl control; -+ struct snd_seq_ev_raw8 raw8; -+ struct snd_seq_ev_raw32 raw32; -+ struct snd_seq_ev_ext ext; -+ struct snd_seq_ev_queue_control queue; -+ union snd_seq_timestamp time; -+ struct snd_seq_addr addr; -+ struct snd_seq_connect connect; -+ struct snd_seq_result result; -+ struct snd_seq_ev_quote quote; -+ } data; -+}; -+ -+ -+/* -+ * bounce event - stored as variable size data -+ */ -+struct snd_seq_event_bounce { -+ int err; -+ struct snd_seq_event event; -+ /* external data follows here. */ -+}; -+ -+ -+ /* system information */ -+struct snd_seq_system_info { -+ int queues; /* maximum queues count */ -+ int clients; /* maximum clients count */ -+ int ports; /* maximum ports per client */ -+ int channels; /* maximum channels per port */ -+ int cur_clients; /* current clients */ -+ int cur_queues; /* current queues */ -+ char reserved[24]; -+}; -+ -+ -+ /* system running information */ -+struct snd_seq_running_info { -+ unsigned char client; /* client id */ -+ unsigned char big_endian; /* 1 = big-endian */ -+ unsigned char cpu_mode; /* 4 = 32bit, 8 = 64bit */ -+ unsigned char pad; /* reserved */ -+ unsigned char reserved[12]; -+}; -+ -+ -+ /* known client numbers */ -+#define SNDRV_SEQ_CLIENT_SYSTEM 0 -+ /* internal client numbers */ -+#define SNDRV_SEQ_CLIENT_DUMMY 14 /* midi through */ -+#define SNDRV_SEQ_CLIENT_OSS 15 /* oss sequencer emulator */ -+ -+ -+ /* client types */ -+typedef int __bitwise snd_seq_client_type_t; -+#define NO_CLIENT ((__force snd_seq_client_type_t) 0) -+#define USER_CLIENT ((__force snd_seq_client_type_t) 1) -+#define KERNEL_CLIENT ((__force snd_seq_client_type_t) 2) -+ -+ /* event filter flags */ -+#define SNDRV_SEQ_FILTER_BROADCAST (1<<0) /* accept broadcast messages */ -+#define SNDRV_SEQ_FILTER_MULTICAST (1<<1) /* accept multicast messages */ -+#define SNDRV_SEQ_FILTER_BOUNCE (1<<2) /* accept bounce event in error */ -+#define SNDRV_SEQ_FILTER_USE_EVENT (1<<31) /* use event filter */ -+ -+struct snd_seq_client_info { -+ int client; /* client number to inquire */ -+ snd_seq_client_type_t type; /* client type */ -+ char name[64]; /* client name */ -+ unsigned int filter; /* filter flags */ -+ unsigned char multicast_filter[8]; /* multicast filter bitmap */ -+ unsigned char event_filter[32]; /* event filter bitmap */ -+ int num_ports; /* RO: number of ports */ -+ int event_lost; /* number of lost events */ -+ int card; /* RO: card number[kernel] */ -+ int pid; /* RO: pid[user] */ -+ char reserved[56]; /* for future use */ -+}; -+ -+ -+/* client pool size */ -+struct snd_seq_client_pool { -+ int client; /* client number to inquire */ -+ int output_pool; /* outgoing (write) pool size */ -+ int input_pool; /* incoming (read) pool size */ -+ int output_room; /* minimum free pool size for select/blocking mode */ -+ int output_free; /* unused size */ -+ int input_free; /* unused size */ -+ char reserved[64]; -+}; -+ -+ -+/* Remove events by specified criteria */ -+ -+#define SNDRV_SEQ_REMOVE_INPUT (1<<0) /* Flush input queues */ -+#define SNDRV_SEQ_REMOVE_OUTPUT (1<<1) /* Flush output queues */ -+#define SNDRV_SEQ_REMOVE_DEST (1<<2) /* Restrict by destination q:client:port */ -+#define SNDRV_SEQ_REMOVE_DEST_CHANNEL (1<<3) /* Restrict by channel */ -+#define SNDRV_SEQ_REMOVE_TIME_BEFORE (1<<4) /* Restrict to before time */ -+#define SNDRV_SEQ_REMOVE_TIME_AFTER (1<<5) /* Restrict to time or after */ -+#define SNDRV_SEQ_REMOVE_TIME_TICK (1<<6) /* Time is in ticks */ -+#define SNDRV_SEQ_REMOVE_EVENT_TYPE (1<<7) /* Restrict to event type */ -+#define SNDRV_SEQ_REMOVE_IGNORE_OFF (1<<8) /* Do not flush off events */ -+#define SNDRV_SEQ_REMOVE_TAG_MATCH (1<<9) /* Restrict to events with given tag */ -+ -+struct snd_seq_remove_events { -+ unsigned int remove_mode; /* Flags that determine what gets removed */ -+ -+ union snd_seq_timestamp time; -+ -+ unsigned char queue; /* Queue for REMOVE_DEST */ -+ struct snd_seq_addr dest; /* Address for REMOVE_DEST */ -+ unsigned char channel; /* Channel for REMOVE_DEST */ -+ -+ int type; /* For REMOVE_EVENT_TYPE */ -+ char tag; /* Tag for REMOVE_TAG */ -+ -+ int reserved[10]; /* To allow for future binary compatibility */ -+ -+}; -+ -+ -+ /* known port numbers */ -+#define SNDRV_SEQ_PORT_SYSTEM_TIMER 0 -+#define SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE 1 -+ -+ /* port capabilities (32 bits) */ -+#define SNDRV_SEQ_PORT_CAP_READ (1<<0) /* readable from this port */ -+#define SNDRV_SEQ_PORT_CAP_WRITE (1<<1) /* writable to this port */ -+ -+#define SNDRV_SEQ_PORT_CAP_SYNC_READ (1<<2) -+#define SNDRV_SEQ_PORT_CAP_SYNC_WRITE (1<<3) -+ -+#define SNDRV_SEQ_PORT_CAP_DUPLEX (1<<4) -+ -+#define SNDRV_SEQ_PORT_CAP_SUBS_READ (1<<5) /* allow read subscription */ -+#define SNDRV_SEQ_PORT_CAP_SUBS_WRITE (1<<6) /* allow write subscription */ -+#define SNDRV_SEQ_PORT_CAP_NO_EXPORT (1<<7) /* routing not allowed */ -+ -+ /* port type */ -+#define SNDRV_SEQ_PORT_TYPE_SPECIFIC (1<<0) /* hardware specific */ -+#define SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC (1<<1) /* generic MIDI device */ -+#define SNDRV_SEQ_PORT_TYPE_MIDI_GM (1<<2) /* General MIDI compatible device */ -+#define SNDRV_SEQ_PORT_TYPE_MIDI_GS (1<<3) /* GS compatible device */ -+#define SNDRV_SEQ_PORT_TYPE_MIDI_XG (1<<4) /* XG compatible device */ -+#define SNDRV_SEQ_PORT_TYPE_MIDI_MT32 (1<<5) /* MT-32 compatible device */ -+#define SNDRV_SEQ_PORT_TYPE_MIDI_GM2 (1<<6) /* General MIDI 2 compatible device */ -+ -+/* other standards...*/ -+#define SNDRV_SEQ_PORT_TYPE_SYNTH (1<<10) /* Synth device (no MIDI compatible - direct wavetable) */ -+#define SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11) /* Sampling device (support sample download) */ -+#define SNDRV_SEQ_PORT_TYPE_SAMPLE (1<<12) /* Sampling device (sample can be downloaded at any time) */ -+/*...*/ -+#define SNDRV_SEQ_PORT_TYPE_HARDWARE (1<<16) /* driver for a hardware device */ -+#define SNDRV_SEQ_PORT_TYPE_SOFTWARE (1<<17) /* implemented in software */ -+#define SNDRV_SEQ_PORT_TYPE_SYNTHESIZER (1<<18) /* generates sound */ -+#define SNDRV_SEQ_PORT_TYPE_PORT (1<<19) /* connects to other device(s) */ -+#define SNDRV_SEQ_PORT_TYPE_APPLICATION (1<<20) /* application (sequencer/editor) */ -+ -+/* misc. conditioning flags */ -+#define SNDRV_SEQ_PORT_FLG_GIVEN_PORT (1<<0) -+#define SNDRV_SEQ_PORT_FLG_TIMESTAMP (1<<1) -+#define SNDRV_SEQ_PORT_FLG_TIME_REAL (1<<2) -+ -+struct snd_seq_port_info { -+ struct snd_seq_addr addr; /* client/port numbers */ -+ char name[64]; /* port name */ -+ -+ unsigned int capability; /* port capability bits */ -+ unsigned int type; /* port type bits */ -+ int midi_channels; /* channels per MIDI port */ -+ int midi_voices; /* voices per MIDI port */ -+ int synth_voices; /* voices per SYNTH port */ -+ -+ int read_use; /* R/O: subscribers for output (from this port) */ -+ int write_use; /* R/O: subscribers for input (to this port) */ -+ -+ void *kernel; /* reserved for kernel use (must be NULL) */ -+ unsigned int flags; /* misc. conditioning */ -+ unsigned char time_queue; /* queue # for timestamping */ -+ char reserved[59]; /* for future use */ -+}; -+ -+ -+/* queue flags */ -+#define SNDRV_SEQ_QUEUE_FLG_SYNC (1<<0) /* sync enabled */ -+ -+/* queue information */ -+struct snd_seq_queue_info { -+ int queue; /* queue id */ -+ -+ /* -+ * security settings, only owner of this queue can start/stop timer -+ * etc. if the queue is locked for other clients -+ */ -+ int owner; /* client id for owner of the queue */ -+ unsigned locked:1; /* timing queue locked for other queues */ -+ char name[64]; /* name of this queue */ -+ unsigned int flags; /* flags */ -+ char reserved[60]; /* for future use */ -+ -+}; -+ -+/* queue info/status */ -+struct snd_seq_queue_status { -+ int queue; /* queue id */ -+ int events; /* read-only - queue size */ -+ snd_seq_tick_time_t tick; /* current tick */ -+ struct snd_seq_real_time time; /* current time */ -+ int running; /* running state of queue */ -+ int flags; /* various flags */ -+ char reserved[64]; /* for the future */ -+}; -+ -+ -+/* queue tempo */ -+struct snd_seq_queue_tempo { -+ int queue; /* sequencer queue */ -+ unsigned int tempo; /* current tempo, us/tick */ -+ int ppq; /* time resolution, ticks/quarter */ -+ unsigned int skew_value; /* queue skew */ -+ unsigned int skew_base; /* queue skew base */ -+ char reserved[24]; /* for the future */ -+}; -+ -+ -+/* sequencer timer sources */ -+#define SNDRV_SEQ_TIMER_ALSA 0 /* ALSA timer */ -+#define SNDRV_SEQ_TIMER_MIDI_CLOCK 1 /* Midi Clock (CLOCK event) */ -+#define SNDRV_SEQ_TIMER_MIDI_TICK 2 /* Midi Timer Tick (TICK event) */ -+ -+/* queue timer info */ -+struct snd_seq_queue_timer { -+ int queue; /* sequencer queue */ -+ int type; /* source timer type */ -+ union { -+ struct { -+ struct snd_timer_id id; /* ALSA's timer ID */ -+ unsigned int resolution; /* resolution in Hz */ -+ } alsa; -+ } u; -+ char reserved[64]; /* for the future use */ -+}; -+ -+ -+struct snd_seq_queue_client { -+ int queue; /* sequencer queue */ -+ int client; /* sequencer client */ -+ int used; /* queue is used with this client -+ (must be set for accepting events) */ -+ /* per client watermarks */ -+ char reserved[64]; /* for future use */ -+}; -+ -+ -+#define SNDRV_SEQ_PORT_SUBS_EXCLUSIVE (1<<0) /* exclusive connection */ -+#define SNDRV_SEQ_PORT_SUBS_TIMESTAMP (1<<1) -+#define SNDRV_SEQ_PORT_SUBS_TIME_REAL (1<<2) -+ -+struct snd_seq_port_subscribe { -+ struct snd_seq_addr sender; /* sender address */ -+ struct snd_seq_addr dest; /* destination address */ -+ unsigned int voices; /* number of voices to be allocated (0 = don't care) */ -+ unsigned int flags; /* modes */ -+ unsigned char queue; /* input time-stamp queue (optional) */ -+ unsigned char pad[3]; /* reserved */ -+ char reserved[64]; -+}; -+ -+/* type of query subscription */ -+#define SNDRV_SEQ_QUERY_SUBS_READ 0 -+#define SNDRV_SEQ_QUERY_SUBS_WRITE 1 -+ -+struct snd_seq_query_subs { -+ struct snd_seq_addr root; /* client/port id to be searched */ -+ int type; /* READ or WRITE */ -+ int index; /* 0..N-1 */ -+ int num_subs; /* R/O: number of subscriptions on this port */ -+ struct snd_seq_addr addr; /* R/O: result */ -+ unsigned char queue; /* R/O: result */ -+ unsigned int flags; /* R/O: result */ -+ char reserved[64]; /* for future use */ -+}; -+ -+ -+/* -+ * IOCTL commands -+ */ -+ -+#define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int) -+#define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int) -+#define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct snd_seq_system_info) -+#define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct snd_seq_running_info) -+ -+#define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct snd_seq_client_info) -+#define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct snd_seq_client_info) -+ -+#define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct snd_seq_port_info) -+#define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct snd_seq_port_info) -+#define SNDRV_SEQ_IOCTL_GET_PORT_INFO _IOWR('S', 0x22, struct snd_seq_port_info) -+#define SNDRV_SEQ_IOCTL_SET_PORT_INFO _IOW ('S', 0x23, struct snd_seq_port_info) -+ -+#define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct snd_seq_port_subscribe) -+#define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct snd_seq_port_subscribe) -+ -+#define SNDRV_SEQ_IOCTL_CREATE_QUEUE _IOWR('S', 0x32, struct snd_seq_queue_info) -+#define SNDRV_SEQ_IOCTL_DELETE_QUEUE _IOW ('S', 0x33, struct snd_seq_queue_info) -+#define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct snd_seq_queue_info) -+#define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct snd_seq_queue_info) -+#define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct snd_seq_queue_info) -+#define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct snd_seq_queue_status) -+#define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct snd_seq_queue_tempo) -+#define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct snd_seq_queue_tempo) -+#define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct snd_seq_queue_timer) -+#define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct snd_seq_queue_timer) -+#define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT _IOWR('S', 0x49, struct snd_seq_queue_client) -+#define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT _IOW ('S', 0x4a, struct snd_seq_queue_client) -+#define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct snd_seq_client_pool) -+#define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct snd_seq_client_pool) -+#define SNDRV_SEQ_IOCTL_REMOVE_EVENTS _IOW ('S', 0x4e, struct snd_seq_remove_events) -+#define SNDRV_SEQ_IOCTL_QUERY_SUBS _IOWR('S', 0x4f, struct snd_seq_query_subs) -+#define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION _IOWR('S', 0x50, struct snd_seq_port_subscribe) -+#define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT _IOWR('S', 0x51, struct snd_seq_client_info) -+#define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct snd_seq_port_info) -+ -+#endif /* _UAPI__SOUND_ASEQUENCER_H */ -diff --git a/include/sound/uapi/asoc.h b/include/sound/uapi/asoc.h -new file mode 100644 -index 00000000..a74ca232 ---- /dev/null -+++ b/include/sound/uapi/asoc.h -@@ -0,0 +1,633 @@ -+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -+/* -+ * uapi/sound/asoc.h -- ALSA SoC Firmware Controls and DAPM -+ * -+ * Copyright (C) 2012 Texas Instruments Inc. -+ * Copyright (C) 2015 Intel Corporation. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ * Simple file API to load FW that includes mixers, coefficients, DAPM graphs, -+ * algorithms, equalisers, DAIs, widgets etc. -+*/ -+ -+#ifndef __LINUX_UAPI_SND_ASOC_H -+#define __LINUX_UAPI_SND_ASOC_H -+ -+#include -+#include -+ -+/* -+ * Maximum number of channels topology kcontrol can represent. -+ */ -+#define SND_SOC_TPLG_MAX_CHAN 8 -+ -+/* -+ * Maximum number of PCM formats capability -+ */ -+#define SND_SOC_TPLG_MAX_FORMATS 16 -+ -+/* -+ * Maximum number of PCM stream configs -+ */ -+#define SND_SOC_TPLG_STREAM_CONFIG_MAX 8 -+ -+/* -+ * Maximum number of physical link's hardware configs -+ */ -+#define SND_SOC_TPLG_HW_CONFIG_MAX 8 -+ -+/* individual kcontrol info types - can be mixed with other types */ -+#define SND_SOC_TPLG_CTL_VOLSW 1 -+#define SND_SOC_TPLG_CTL_VOLSW_SX 2 -+#define SND_SOC_TPLG_CTL_VOLSW_XR_SX 3 -+#define SND_SOC_TPLG_CTL_ENUM 4 -+#define SND_SOC_TPLG_CTL_BYTES 5 -+#define SND_SOC_TPLG_CTL_ENUM_VALUE 6 -+#define SND_SOC_TPLG_CTL_RANGE 7 -+#define SND_SOC_TPLG_CTL_STROBE 8 -+ -+ -+/* individual widget kcontrol info types - can be mixed with other types */ -+#define SND_SOC_TPLG_DAPM_CTL_VOLSW 64 -+#define SND_SOC_TPLG_DAPM_CTL_ENUM_DOUBLE 65 -+#define SND_SOC_TPLG_DAPM_CTL_ENUM_VIRT 66 -+#define SND_SOC_TPLG_DAPM_CTL_ENUM_VALUE 67 -+#define SND_SOC_TPLG_DAPM_CTL_PIN 68 -+ -+/* DAPM widget types - add new items to the end */ -+#define SND_SOC_TPLG_DAPM_INPUT 0 -+#define SND_SOC_TPLG_DAPM_OUTPUT 1 -+#define SND_SOC_TPLG_DAPM_MUX 2 -+#define SND_SOC_TPLG_DAPM_MIXER 3 -+#define SND_SOC_TPLG_DAPM_PGA 4 -+#define SND_SOC_TPLG_DAPM_OUT_DRV 5 -+#define SND_SOC_TPLG_DAPM_ADC 6 -+#define SND_SOC_TPLG_DAPM_DAC 7 -+#define SND_SOC_TPLG_DAPM_SWITCH 8 -+#define SND_SOC_TPLG_DAPM_PRE 9 -+#define SND_SOC_TPLG_DAPM_POST 10 -+#define SND_SOC_TPLG_DAPM_AIF_IN 11 -+#define SND_SOC_TPLG_DAPM_AIF_OUT 12 -+#define SND_SOC_TPLG_DAPM_DAI_IN 13 -+#define SND_SOC_TPLG_DAPM_DAI_OUT 14 -+#define SND_SOC_TPLG_DAPM_DAI_LINK 15 -+#define SND_SOC_TPLG_DAPM_BUFFER 16 -+#define SND_SOC_TPLG_DAPM_SCHEDULER 17 -+#define SND_SOC_TPLG_DAPM_EFFECT 18 -+#define SND_SOC_TPLG_DAPM_SIGGEN 19 -+#define SND_SOC_TPLG_DAPM_SRC 20 -+#define SND_SOC_TPLG_DAPM_ASRC 21 -+#define SND_SOC_TPLG_DAPM_ENCODER 22 -+#define SND_SOC_TPLG_DAPM_DECODER 23 -+#define SND_SOC_TPLG_DAPM_LAST SND_SOC_TPLG_DAPM_DECODER -+ -+/* Header magic number and string sizes */ -+#define SND_SOC_TPLG_MAGIC 0x41536F43 /* ASoC */ -+ -+/* string sizes */ -+#define SND_SOC_TPLG_NUM_TEXTS 16 -+ -+/* ABI version */ -+#define SND_SOC_TPLG_ABI_VERSION 0x5 /* current version */ -+#define SND_SOC_TPLG_ABI_VERSION_MIN 0x4 /* oldest version supported */ -+ -+/* Max size of TLV data */ -+#define SND_SOC_TPLG_TLV_SIZE 32 -+ -+/* -+ * File and Block header data types. -+ * Add new generic and vendor types to end of list. -+ * Generic types are handled by the core whilst vendors types are passed -+ * to the component drivers for handling. -+ */ -+#define SND_SOC_TPLG_TYPE_MIXER 1 -+#define SND_SOC_TPLG_TYPE_BYTES 2 -+#define SND_SOC_TPLG_TYPE_ENUM 3 -+#define SND_SOC_TPLG_TYPE_DAPM_GRAPH 4 -+#define SND_SOC_TPLG_TYPE_DAPM_WIDGET 5 -+#define SND_SOC_TPLG_TYPE_DAI_LINK 6 -+#define SND_SOC_TPLG_TYPE_PCM 7 -+#define SND_SOC_TPLG_TYPE_MANIFEST 8 -+#define SND_SOC_TPLG_TYPE_CODEC_LINK 9 -+#define SND_SOC_TPLG_TYPE_BACKEND_LINK 10 -+#define SND_SOC_TPLG_TYPE_PDATA 11 -+#define SND_SOC_TPLG_TYPE_DAI 12 -+#define SND_SOC_TPLG_TYPE_MAX SND_SOC_TPLG_TYPE_DAI -+ -+/* vendor block IDs - please add new vendor types to end */ -+#define SND_SOC_TPLG_TYPE_VENDOR_FW 1000 -+#define SND_SOC_TPLG_TYPE_VENDOR_CONFIG 1001 -+#define SND_SOC_TPLG_TYPE_VENDOR_COEFF 1002 -+#define SND_SOC_TPLG_TYPEVENDOR_CODEC 1003 -+ -+#define SND_SOC_TPLG_STREAM_PLAYBACK 0 -+#define SND_SOC_TPLG_STREAM_CAPTURE 1 -+ -+/* vendor tuple types */ -+#define SND_SOC_TPLG_TUPLE_TYPE_UUID 0 -+#define SND_SOC_TPLG_TUPLE_TYPE_STRING 1 -+#define SND_SOC_TPLG_TUPLE_TYPE_BOOL 2 -+#define SND_SOC_TPLG_TUPLE_TYPE_BYTE 3 -+#define SND_SOC_TPLG_TUPLE_TYPE_WORD 4 -+#define SND_SOC_TPLG_TUPLE_TYPE_SHORT 5 -+ -+/* DAI flags */ -+#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_RATES (1 << 0) -+#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_CHANNELS (1 << 1) -+#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2) -+ -+/* DAI clock gating */ -+#define SND_SOC_TPLG_DAI_CLK_GATE_UNDEFINED 0 -+#define SND_SOC_TPLG_DAI_CLK_GATE_GATED 1 -+#define SND_SOC_TPLG_DAI_CLK_GATE_CONT 2 -+ -+/* DAI mclk_direction */ -+#define SND_SOC_TPLG_MCLK_CO 0 /* for codec, mclk is output */ -+#define SND_SOC_TPLG_MCLK_CI 1 /* for codec, mclk is input */ -+ -+/* DAI physical PCM data formats. -+ * Add new formats to the end of the list. -+ */ -+#define SND_SOC_DAI_FORMAT_I2S 1 /* I2S mode */ -+#define SND_SOC_DAI_FORMAT_RIGHT_J 2 /* Right Justified mode */ -+#define SND_SOC_DAI_FORMAT_LEFT_J 3 /* Left Justified mode */ -+#define SND_SOC_DAI_FORMAT_DSP_A 4 /* L data MSB after FRM LRC */ -+#define SND_SOC_DAI_FORMAT_DSP_B 5 /* L data MSB during FRM LRC */ -+#define SND_SOC_DAI_FORMAT_AC97 6 /* AC97 */ -+#define SND_SOC_DAI_FORMAT_PDM 7 /* Pulse density modulation */ -+ -+/* left and right justified also known as MSB and LSB respectively */ -+#define SND_SOC_DAI_FORMAT_MSB SND_SOC_DAI_FORMAT_LEFT_J -+#define SND_SOC_DAI_FORMAT_LSB SND_SOC_DAI_FORMAT_RIGHT_J -+ -+/* DAI link flags */ -+#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_RATES (1 << 0) -+#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_CHANNELS (1 << 1) -+#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2) -+#define SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP (1 << 3) -+ -+/* DAI topology BCLK parameter -+ * For the backwards capability, by default codec is bclk master -+ */ -+#define SND_SOC_TPLG_BCLK_CM 0 /* codec is bclk master */ -+#define SND_SOC_TPLG_BCLK_CS 1 /* codec is bclk slave */ -+ -+/* DAI topology FSYNC parameter -+ * For the backwards capability, by default codec is fsync master -+ */ -+#define SND_SOC_TPLG_FSYNC_CM 0 /* codec is fsync master */ -+#define SND_SOC_TPLG_FSYNC_CS 1 /* codec is fsync slave */ -+ -+/* -+ * Block Header. -+ * This header precedes all object and object arrays below. -+ */ -+struct snd_soc_tplg_hdr { -+ __le32 magic; /* magic number */ -+ __le32 abi; /* ABI version */ -+ __le32 version; /* optional vendor specific version details */ -+ __le32 type; /* SND_SOC_TPLG_TYPE_ */ -+ __le32 size; /* size of this structure */ -+ __le32 vendor_type; /* optional vendor specific type info */ -+ __le32 payload_size; /* data bytes, excluding this header */ -+ __le32 index; /* identifier for block */ -+ __le32 count; /* number of elements in block */ -+} __attribute__((packed)); -+ -+/* vendor tuple for uuid */ -+struct snd_soc_tplg_vendor_uuid_elem { -+ __le32 token; -+ char uuid[16]; -+} __attribute__((packed)); -+ -+/* vendor tuple for a bool/byte/short/word value */ -+struct snd_soc_tplg_vendor_value_elem { -+ __le32 token; -+ __le32 value; -+} __attribute__((packed)); -+ -+/* vendor tuple for string */ -+struct snd_soc_tplg_vendor_string_elem { -+ __le32 token; -+ char string[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; -+} __attribute__((packed)); -+ -+struct snd_soc_tplg_vendor_array { -+ __le32 size; /* size in bytes of the array, including all elements */ -+ __le32 type; /* SND_SOC_TPLG_TUPLE_TYPE_ */ -+ __le32 num_elems; /* number of elements in array */ -+ union { -+ struct snd_soc_tplg_vendor_uuid_elem uuid[0]; -+ struct snd_soc_tplg_vendor_value_elem value[0]; -+ struct snd_soc_tplg_vendor_string_elem string[0]; -+ }; -+} __attribute__((packed)); -+ -+/* -+ * Private data. -+ * All topology objects may have private data that can be used by the driver or -+ * firmware. Core will ignore this data. -+ */ -+struct snd_soc_tplg_private { -+ __le32 size; /* in bytes of private data */ -+ union { -+ char data[0]; -+ struct snd_soc_tplg_vendor_array array[0]; -+ }; -+} __attribute__((packed)); -+ -+/* -+ * Kcontrol TLV data. -+ */ -+struct snd_soc_tplg_tlv_dbscale { -+ __le32 min; -+ __le32 step; -+ __le32 mute; -+} __attribute__((packed)); -+ -+struct snd_soc_tplg_ctl_tlv { -+ __le32 size; /* in bytes of this structure */ -+ __le32 type; /* SNDRV_CTL_TLVT_*, type of TLV */ -+ union { -+ __le32 data[SND_SOC_TPLG_TLV_SIZE]; -+ struct snd_soc_tplg_tlv_dbscale scale; -+ }; -+} __attribute__((packed)); -+ -+/* -+ * Kcontrol channel data -+ */ -+struct snd_soc_tplg_channel { -+ __le32 size; /* in bytes of this structure */ -+ __le32 reg; -+ __le32 shift; -+ __le32 id; /* ID maps to Left, Right, LFE etc */ -+} __attribute__((packed)); -+ -+/* -+ * Genericl Operations IDs, for binding Kcontrol or Bytes ext ops -+ * Kcontrol ops need get/put/info. -+ * Bytes ext ops need get/put. -+ */ -+struct snd_soc_tplg_io_ops { -+ __le32 get; -+ __le32 put; -+ __le32 info; -+} __attribute__((packed)); -+ -+/* -+ * kcontrol header -+ */ -+struct snd_soc_tplg_ctl_hdr { -+ __le32 size; /* in bytes of this structure */ -+ __le32 type; -+ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; -+ __le32 access; -+ struct snd_soc_tplg_io_ops ops; -+ struct snd_soc_tplg_ctl_tlv tlv; -+} __attribute__((packed)); -+ -+/* -+ * Stream Capabilities -+ */ -+struct snd_soc_tplg_stream_caps { -+ __le32 size; /* in bytes of this structure */ -+ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; -+ __le64 formats; /* supported formats SNDRV_PCM_FMTBIT_* */ -+ __le32 rates; /* supported rates SNDRV_PCM_RATE_* */ -+ __le32 rate_min; /* min rate */ -+ __le32 rate_max; /* max rate */ -+ __le32 channels_min; /* min channels */ -+ __le32 channels_max; /* max channels */ -+ __le32 periods_min; /* min number of periods */ -+ __le32 periods_max; /* max number of periods */ -+ __le32 period_size_min; /* min period size bytes */ -+ __le32 period_size_max; /* max period size bytes */ -+ __le32 buffer_size_min; /* min buffer size bytes */ -+ __le32 buffer_size_max; /* max buffer size bytes */ -+ __le32 sig_bits; /* number of bits of content */ -+} __attribute__((packed)); -+ -+/* -+ * FE or BE Stream configuration supported by SW/FW -+ */ -+struct snd_soc_tplg_stream { -+ __le32 size; /* in bytes of this structure */ -+ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* Name of the stream */ -+ __le64 format; /* SNDRV_PCM_FMTBIT_* */ -+ __le32 rate; /* SNDRV_PCM_RATE_* */ -+ __le32 period_bytes; /* size of period in bytes */ -+ __le32 buffer_bytes; /* size of buffer in bytes */ -+ __le32 channels; /* channels */ -+} __attribute__((packed)); -+ -+ -+/* -+ * Describes a physical link's runtime supported hardware config, -+ * i.e. hardware audio formats. -+ */ -+struct snd_soc_tplg_hw_config { -+ __le32 size; /* in bytes of this structure */ -+ __le32 id; /* unique ID - - used to match */ -+ __le32 fmt; /* SND_SOC_DAI_FORMAT_ format value */ -+ __u8 clock_gated; /* SND_SOC_TPLG_DAI_CLK_GATE_ value */ -+ __u8 invert_bclk; /* 1 for inverted BCLK, 0 for normal */ -+ __u8 invert_fsync; /* 1 for inverted frame clock, 0 for normal */ -+ __u8 bclk_master; /* SND_SOC_TPLG_BCLK_ value */ -+ __u8 fsync_master; /* SND_SOC_TPLG_FSYNC_ value */ -+ __u8 mclk_direction; /* SND_SOC_TPLG_MCLK_ value */ -+ __le16 reserved; /* for 32bit alignment */ -+ __le32 mclk_rate; /* MCLK or SYSCLK freqency in Hz */ -+ __le32 bclk_rate; /* BCLK freqency in Hz */ -+ __le32 fsync_rate; /* frame clock in Hz */ -+ __le32 tdm_slots; /* number of TDM slots in use */ -+ __le32 tdm_slot_width; /* width in bits for each slot */ -+ __le32 tx_slots; /* bit mask for active Tx slots */ -+ __le32 rx_slots; /* bit mask for active Rx slots */ -+ __le32 tx_channels; /* number of Tx channels */ -+ __le32 tx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */ -+ __le32 rx_channels; /* number of Rx channels */ -+ __le32 rx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */ -+} __attribute__((packed)); -+ -+/* -+ * Manifest. List totals for each payload type. Not used in parsing, but will -+ * be passed to the component driver before any other objects in order for any -+ * global component resource allocations. -+ * -+ * File block representation for manifest :- -+ * +-----------------------------------+----+ -+ * | struct snd_soc_tplg_hdr | 1 | -+ * +-----------------------------------+----+ -+ * | struct snd_soc_tplg_manifest | 1 | -+ * +-----------------------------------+----+ -+ */ -+struct snd_soc_tplg_manifest { -+ __le32 size; /* in bytes of this structure */ -+ __le32 control_elems; /* number of control elements */ -+ __le32 widget_elems; /* number of widget elements */ -+ __le32 graph_elems; /* number of graph elements */ -+ __le32 pcm_elems; /* number of PCM elements */ -+ __le32 dai_link_elems; /* number of DAI link elements */ -+ __le32 dai_elems; /* number of physical DAI elements */ -+ __le32 reserved[20]; /* reserved for new ABI element types */ -+ struct snd_soc_tplg_private priv; -+} __attribute__((packed)); -+ -+/* -+ * Mixer kcontrol. -+ * -+ * File block representation for mixer kcontrol :- -+ * +-----------------------------------+----+ -+ * | struct snd_soc_tplg_hdr | 1 | -+ * +-----------------------------------+----+ -+ * | struct snd_soc_tplg_mixer_control | N | -+ * +-----------------------------------+----+ -+ */ -+struct snd_soc_tplg_mixer_control { -+ struct snd_soc_tplg_ctl_hdr hdr; -+ __le32 size; /* in bytes of this structure */ -+ __le32 min; -+ __le32 max; -+ __le32 platform_max; -+ __le32 invert; -+ __le32 num_channels; -+ struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN]; -+ struct snd_soc_tplg_private priv; -+} __attribute__((packed)); -+ -+/* -+ * Enumerated kcontrol -+ * -+ * File block representation for enum kcontrol :- -+ * +-----------------------------------+----+ -+ * | struct snd_soc_tplg_hdr | 1 | -+ * +-----------------------------------+----+ -+ * | struct snd_soc_tplg_enum_control | N | -+ * +-----------------------------------+----+ -+ */ -+struct snd_soc_tplg_enum_control { -+ struct snd_soc_tplg_ctl_hdr hdr; -+ __le32 size; /* in bytes of this structure */ -+ __le32 num_channels; -+ struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN]; -+ __le32 items; -+ __le32 mask; -+ __le32 count; -+ char texts[SND_SOC_TPLG_NUM_TEXTS][SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; -+ __le32 values[SND_SOC_TPLG_NUM_TEXTS * SNDRV_CTL_ELEM_ID_NAME_MAXLEN / 4]; -+ struct snd_soc_tplg_private priv; -+} __attribute__((packed)); -+ -+/* -+ * Bytes kcontrol -+ * -+ * File block representation for bytes kcontrol :- -+ * +-----------------------------------+----+ -+ * | struct snd_soc_tplg_hdr | 1 | -+ * +-----------------------------------+----+ -+ * | struct snd_soc_tplg_bytes_control | N | -+ * +-----------------------------------+----+ -+ */ -+struct snd_soc_tplg_bytes_control { -+ struct snd_soc_tplg_ctl_hdr hdr; -+ __le32 size; /* in bytes of this structure */ -+ __le32 max; -+ __le32 mask; -+ __le32 base; -+ __le32 num_regs; -+ struct snd_soc_tplg_io_ops ext_ops; -+ struct snd_soc_tplg_private priv; -+} __attribute__((packed)); -+ -+/* -+ * DAPM Graph Element -+ * -+ * File block representation for DAPM graph elements :- -+ * +-------------------------------------+----+ -+ * | struct snd_soc_tplg_hdr | 1 | -+ * +-------------------------------------+----+ -+ * | struct snd_soc_tplg_dapm_graph_elem | N | -+ * +-------------------------------------+----+ -+ */ -+struct snd_soc_tplg_dapm_graph_elem { -+ char sink[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; -+ char control[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; -+ char source[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; -+} __attribute__((packed)); -+ -+/* -+ * DAPM Widget. -+ * -+ * File block representation for DAPM widget :- -+ * +-------------------------------------+-----+ -+ * | struct snd_soc_tplg_hdr | 1 | -+ * +-------------------------------------+-----+ -+ * | struct snd_soc_tplg_dapm_widget | N | -+ * +-------------------------------------+-----+ -+ * | struct snd_soc_tplg_enum_control | 0|1 | -+ * | struct snd_soc_tplg_mixer_control | 0|N | -+ * +-------------------------------------+-----+ -+ * -+ * Optional enum or mixer control can be appended to the end of each widget -+ * in the block. -+ */ -+struct snd_soc_tplg_dapm_widget { -+ __le32 size; /* in bytes of this structure */ -+ __le32 id; /* SND_SOC_DAPM_CTL */ -+ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; -+ char sname[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; -+ -+ __le32 reg; /* negative reg = no direct dapm */ -+ __le32 shift; /* bits to shift */ -+ __le32 mask; /* non-shifted mask */ -+ __le32 subseq; /* sort within widget type */ -+ __le32 invert; /* invert the power bit */ -+ __le32 ignore_suspend; /* kept enabled over suspend */ -+ __le16 event_flags; -+ __le16 event_type; -+ __le32 num_kcontrols; -+ struct snd_soc_tplg_private priv; -+ /* -+ * kcontrols that relate to this widget -+ * follow here after widget private data -+ */ -+} __attribute__((packed)); -+ -+ -+/* -+ * Describes SW/FW specific features of PCM (FE DAI & DAI link). -+ * -+ * File block representation for PCM :- -+ * +-----------------------------------+-----+ -+ * | struct snd_soc_tplg_hdr | 1 | -+ * +-----------------------------------+-----+ -+ * | struct snd_soc_tplg_pcm | N | -+ * +-----------------------------------+-----+ -+ */ -+struct snd_soc_tplg_pcm { -+ __le32 size; /* in bytes of this structure */ -+ char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; -+ char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; -+ __le32 pcm_id; /* unique ID - used to match with DAI link */ -+ __le32 dai_id; /* unique ID - used to match */ -+ __le32 playback; /* supports playback mode */ -+ __le32 capture; /* supports capture mode */ -+ __le32 compress; /* 1 = compressed; 0 = PCM */ -+ struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */ -+ __le32 num_streams; /* number of streams */ -+ struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */ -+ __le32 flag_mask; /* bitmask of flags to configure */ -+ __le32 flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */ -+ struct snd_soc_tplg_private priv; -+} __attribute__((packed)); -+ -+ -+/* -+ * Describes the physical link runtime supported configs or params -+ * -+ * File block representation for physical link config :- -+ * +-----------------------------------+-----+ -+ * | struct snd_soc_tplg_hdr | 1 | -+ * +-----------------------------------+-----+ -+ * | struct snd_soc_tplg_link_config | N | -+ * +-----------------------------------+-----+ -+ */ -+struct snd_soc_tplg_link_config { -+ __le32 size; /* in bytes of this structure */ -+ __le32 id; /* unique ID - used to match */ -+ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */ -+ char stream_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* stream name - used to match */ -+ struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */ -+ __le32 num_streams; /* number of streams */ -+ struct snd_soc_tplg_hw_config hw_config[SND_SOC_TPLG_HW_CONFIG_MAX]; /* hw configs */ -+ __le32 num_hw_configs; /* number of hw configs */ -+ __le32 default_hw_config_id; /* default hw config ID for init */ -+ __le32 flag_mask; /* bitmask of flags to configure */ -+ __le32 flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */ -+ struct snd_soc_tplg_private priv; -+} __attribute__((packed)); -+ -+/* -+ * Describes SW/FW specific features of physical DAI. -+ * It can be used to configure backend DAIs for DPCM. -+ * -+ * File block representation for physical DAI :- -+ * +-----------------------------------+-----+ -+ * | struct snd_soc_tplg_hdr | 1 | -+ * +-----------------------------------+-----+ -+ * | struct snd_soc_tplg_dai | N | -+ * +-----------------------------------+-----+ -+ */ -+struct snd_soc_tplg_dai { -+ __le32 size; /* in bytes of this structure */ -+ char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */ -+ __le32 dai_id; /* unique ID - used to match */ -+ __le32 playback; /* supports playback mode */ -+ __le32 capture; /* supports capture mode */ -+ struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */ -+ __le32 flag_mask; /* bitmask of flags to configure */ -+ __le32 flags; /* SND_SOC_TPLG_DAI_FLGBIT_* */ -+ struct snd_soc_tplg_private priv; -+} __attribute__((packed)); -+ -+/* -+ * Old version of ABI structs, supported for backward compatibility. -+ */ -+ -+/* Manifest v4 */ -+struct snd_soc_tplg_manifest_v4 { -+ __le32 size; /* in bytes of this structure */ -+ __le32 control_elems; /* number of control elements */ -+ __le32 widget_elems; /* number of widget elements */ -+ __le32 graph_elems; /* number of graph elements */ -+ __le32 pcm_elems; /* number of PCM elements */ -+ __le32 dai_link_elems; /* number of DAI link elements */ -+ struct snd_soc_tplg_private priv; -+} __packed; -+ -+/* Stream Capabilities v4 */ -+struct snd_soc_tplg_stream_caps_v4 { -+ __le32 size; /* in bytes of this structure */ -+ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; -+ __le64 formats; /* supported formats SNDRV_PCM_FMTBIT_* */ -+ __le32 rates; /* supported rates SNDRV_PCM_RATE_* */ -+ __le32 rate_min; /* min rate */ -+ __le32 rate_max; /* max rate */ -+ __le32 channels_min; /* min channels */ -+ __le32 channels_max; /* max channels */ -+ __le32 periods_min; /* min number of periods */ -+ __le32 periods_max; /* max number of periods */ -+ __le32 period_size_min; /* min period size bytes */ -+ __le32 period_size_max; /* max period size bytes */ -+ __le32 buffer_size_min; /* min buffer size bytes */ -+ __le32 buffer_size_max; /* max buffer size bytes */ -+} __packed; -+ -+/* PCM v4 */ -+struct snd_soc_tplg_pcm_v4 { -+ __le32 size; /* in bytes of this structure */ -+ char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; -+ char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; -+ __le32 pcm_id; /* unique ID - used to match with DAI link */ -+ __le32 dai_id; /* unique ID - used to match */ -+ __le32 playback; /* supports playback mode */ -+ __le32 capture; /* supports capture mode */ -+ __le32 compress; /* 1 = compressed; 0 = PCM */ -+ struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */ -+ __le32 num_streams; /* number of streams */ -+ struct snd_soc_tplg_stream_caps_v4 caps[2]; /* playback and capture for DAI */ -+} __packed; -+ -+/* Physical link config v4 */ -+struct snd_soc_tplg_link_config_v4 { -+ __le32 size; /* in bytes of this structure */ -+ __le32 id; /* unique ID - used to match */ -+ struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */ -+ __le32 num_streams; /* number of streams */ -+} __packed; -+ -+#endif -diff --git a/include/sound/uapi/asound.h b/include/sound/uapi/asound.h -new file mode 100644 -index 00000000..df1153ce ---- /dev/null -+++ b/include/sound/uapi/asound.h -@@ -0,0 +1,1038 @@ -+/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ -+/* -+ * Advanced Linux Sound Architecture - ALSA - Driver -+ * Copyright (c) 1994-2003 by Jaroslav Kysela , -+ * Abramo Bagnara -+ * -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ * -+ */ -+ -+#ifndef _UAPI__SOUND_ASOUND_H -+#define _UAPI__SOUND_ASOUND_H -+ -+#if defined(__KERNEL__) || defined(__linux__) -+#include -+#else -+#include -+#endif -+ -+#ifndef __KERNEL__ -+#include -+#include -+#endif -+ -+/* -+ * protocol version -+ */ -+ -+#define SNDRV_PROTOCOL_VERSION(major, minor, subminor) (((major)<<16)|((minor)<<8)|(subminor)) -+#define SNDRV_PROTOCOL_MAJOR(version) (((version)>>16)&0xffff) -+#define SNDRV_PROTOCOL_MINOR(version) (((version)>>8)&0xff) -+#define SNDRV_PROTOCOL_MICRO(version) ((version)&0xff) -+#define SNDRV_PROTOCOL_INCOMPATIBLE(kversion, uversion) \ -+ (SNDRV_PROTOCOL_MAJOR(kversion) != SNDRV_PROTOCOL_MAJOR(uversion) || \ -+ (SNDRV_PROTOCOL_MAJOR(kversion) == SNDRV_PROTOCOL_MAJOR(uversion) && \ -+ SNDRV_PROTOCOL_MINOR(kversion) != SNDRV_PROTOCOL_MINOR(uversion))) -+ -+/**************************************************************************** -+ * * -+ * Digital audio interface * -+ * * -+ ****************************************************************************/ -+ -+struct snd_aes_iec958 { -+ unsigned char status[24]; /* AES/IEC958 channel status bits */ -+ unsigned char subcode[147]; /* AES/IEC958 subcode bits */ -+ unsigned char pad; /* nothing */ -+ unsigned char dig_subframe[4]; /* AES/IEC958 subframe bits */ -+}; -+ -+/**************************************************************************** -+ * * -+ * CEA-861 Audio InfoFrame. Used in HDMI and DisplayPort * -+ * * -+ ****************************************************************************/ -+ -+struct snd_cea_861_aud_if { -+ unsigned char db1_ct_cc; /* coding type and channel count */ -+ unsigned char db2_sf_ss; /* sample frequency and size */ -+ unsigned char db3; /* not used, all zeros */ -+ unsigned char db4_ca; /* channel allocation code */ -+ unsigned char db5_dminh_lsv; /* downmix inhibit & level-shit values */ -+}; -+ -+/**************************************************************************** -+ * * -+ * Section for driver hardware dependent interface - /dev/snd/hw? * -+ * * -+ ****************************************************************************/ -+ -+#define SNDRV_HWDEP_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1) -+ -+enum { -+ SNDRV_HWDEP_IFACE_OPL2 = 0, -+ SNDRV_HWDEP_IFACE_OPL3, -+ SNDRV_HWDEP_IFACE_OPL4, -+ SNDRV_HWDEP_IFACE_SB16CSP, /* Creative Signal Processor */ -+ SNDRV_HWDEP_IFACE_EMU10K1, /* FX8010 processor in EMU10K1 chip */ -+ SNDRV_HWDEP_IFACE_YSS225, /* Yamaha FX processor */ -+ SNDRV_HWDEP_IFACE_ICS2115, /* Wavetable synth */ -+ SNDRV_HWDEP_IFACE_SSCAPE, /* Ensoniq SoundScape ISA card (MC68EC000) */ -+ SNDRV_HWDEP_IFACE_VX, /* Digigram VX cards */ -+ SNDRV_HWDEP_IFACE_MIXART, /* Digigram miXart cards */ -+ SNDRV_HWDEP_IFACE_USX2Y, /* Tascam US122, US224 & US428 usb */ -+ SNDRV_HWDEP_IFACE_EMUX_WAVETABLE, /* EmuX wavetable */ -+ SNDRV_HWDEP_IFACE_BLUETOOTH, /* Bluetooth audio */ -+ SNDRV_HWDEP_IFACE_USX2Y_PCM, /* Tascam US122, US224 & US428 rawusb pcm */ -+ SNDRV_HWDEP_IFACE_PCXHR, /* Digigram PCXHR */ -+ SNDRV_HWDEP_IFACE_SB_RC, /* SB Extigy/Audigy2NX remote control */ -+ SNDRV_HWDEP_IFACE_HDA, /* HD-audio */ -+ SNDRV_HWDEP_IFACE_USB_STREAM, /* direct access to usb stream */ -+ SNDRV_HWDEP_IFACE_FW_DICE, /* TC DICE FireWire device */ -+ SNDRV_HWDEP_IFACE_FW_FIREWORKS, /* Echo Audio Fireworks based device */ -+ SNDRV_HWDEP_IFACE_FW_BEBOB, /* BridgeCo BeBoB based device */ -+ SNDRV_HWDEP_IFACE_FW_OXFW, /* Oxford OXFW970/971 based device */ -+ SNDRV_HWDEP_IFACE_FW_DIGI00X, /* Digidesign Digi 002/003 family */ -+ SNDRV_HWDEP_IFACE_FW_TASCAM, /* TASCAM FireWire series */ -+ SNDRV_HWDEP_IFACE_LINE6, /* Line6 USB processors */ -+ SNDRV_HWDEP_IFACE_FW_MOTU, /* MOTU FireWire series */ -+ SNDRV_HWDEP_IFACE_FW_FIREFACE, /* RME Fireface series */ -+ -+ /* Don't forget to change the following: */ -+ SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_FW_FIREFACE -+}; -+ -+struct snd_hwdep_info { -+ unsigned int device; /* WR: device number */ -+ int card; /* R: card number */ -+ unsigned char id[64]; /* ID (user selectable) */ -+ unsigned char name[80]; /* hwdep name */ -+ int iface; /* hwdep interface */ -+ unsigned char reserved[64]; /* reserved for future */ -+}; -+ -+/* generic DSP loader */ -+struct snd_hwdep_dsp_status { -+ unsigned int version; /* R: driver-specific version */ -+ unsigned char id[32]; /* R: driver-specific ID string */ -+ unsigned int num_dsps; /* R: number of DSP images to transfer */ -+ unsigned int dsp_loaded; /* R: bit flags indicating the loaded DSPs */ -+ unsigned int chip_ready; /* R: 1 = initialization finished */ -+ unsigned char reserved[16]; /* reserved for future use */ -+}; -+ -+struct snd_hwdep_dsp_image { -+ unsigned int index; /* W: DSP index */ -+ unsigned char name[64]; /* W: ID (e.g. file name) */ -+ unsigned char __user *image; /* W: binary image */ -+ size_t length; /* W: size of image in bytes */ -+ unsigned long driver_data; /* W: driver-specific data */ -+}; -+ -+#define SNDRV_HWDEP_IOCTL_PVERSION _IOR ('H', 0x00, int) -+#define SNDRV_HWDEP_IOCTL_INFO _IOR ('H', 0x01, struct snd_hwdep_info) -+#define SNDRV_HWDEP_IOCTL_DSP_STATUS _IOR('H', 0x02, struct snd_hwdep_dsp_status) -+#define SNDRV_HWDEP_IOCTL_DSP_LOAD _IOW('H', 0x03, struct snd_hwdep_dsp_image) -+ -+/***************************************************************************** -+ * * -+ * Digital Audio (PCM) interface - /dev/snd/pcm?? * -+ * * -+ *****************************************************************************/ -+ -+#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 14) -+ -+typedef unsigned long snd_pcm_uframes_t; -+typedef signed long snd_pcm_sframes_t; -+ -+enum { -+ SNDRV_PCM_CLASS_GENERIC = 0, /* standard mono or stereo device */ -+ SNDRV_PCM_CLASS_MULTI, /* multichannel device */ -+ SNDRV_PCM_CLASS_MODEM, /* software modem class */ -+ SNDRV_PCM_CLASS_DIGITIZER, /* digitizer class */ -+ /* Don't forget to change the following: */ -+ SNDRV_PCM_CLASS_LAST = SNDRV_PCM_CLASS_DIGITIZER, -+}; -+ -+enum { -+ SNDRV_PCM_SUBCLASS_GENERIC_MIX = 0, /* mono or stereo subdevices are mixed together */ -+ SNDRV_PCM_SUBCLASS_MULTI_MIX, /* multichannel subdevices are mixed together */ -+ /* Don't forget to change the following: */ -+ SNDRV_PCM_SUBCLASS_LAST = SNDRV_PCM_SUBCLASS_MULTI_MIX, -+}; -+ -+enum { -+ SNDRV_PCM_STREAM_PLAYBACK = 0, -+ SNDRV_PCM_STREAM_CAPTURE, -+ SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE, -+}; -+ -+typedef int __bitwise snd_pcm_access_t; -+#define SNDRV_PCM_ACCESS_MMAP_INTERLEAVED ((__force snd_pcm_access_t) 0) /* interleaved mmap */ -+#define SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED ((__force snd_pcm_access_t) 1) /* noninterleaved mmap */ -+#define SNDRV_PCM_ACCESS_MMAP_COMPLEX ((__force snd_pcm_access_t) 2) /* complex mmap */ -+#define SNDRV_PCM_ACCESS_RW_INTERLEAVED ((__force snd_pcm_access_t) 3) /* readi/writei */ -+#define SNDRV_PCM_ACCESS_RW_NONINTERLEAVED ((__force snd_pcm_access_t) 4) /* readn/writen */ -+#define SNDRV_PCM_ACCESS_LAST SNDRV_PCM_ACCESS_RW_NONINTERLEAVED -+ -+typedef int __bitwise snd_pcm_format_t; -+#define SNDRV_PCM_FORMAT_S8 ((__force snd_pcm_format_t) 0) -+#define SNDRV_PCM_FORMAT_U8 ((__force snd_pcm_format_t) 1) -+#define SNDRV_PCM_FORMAT_S16_LE ((__force snd_pcm_format_t) 2) -+#define SNDRV_PCM_FORMAT_S16_BE ((__force snd_pcm_format_t) 3) -+#define SNDRV_PCM_FORMAT_U16_LE ((__force snd_pcm_format_t) 4) -+#define SNDRV_PCM_FORMAT_U16_BE ((__force snd_pcm_format_t) 5) -+#define SNDRV_PCM_FORMAT_S24_LE ((__force snd_pcm_format_t) 6) /* low three bytes */ -+#define SNDRV_PCM_FORMAT_S24_BE ((__force snd_pcm_format_t) 7) /* low three bytes */ -+#define SNDRV_PCM_FORMAT_U24_LE ((__force snd_pcm_format_t) 8) /* low three bytes */ -+#define SNDRV_PCM_FORMAT_U24_BE ((__force snd_pcm_format_t) 9) /* low three bytes */ -+#define SNDRV_PCM_FORMAT_S32_LE ((__force snd_pcm_format_t) 10) -+#define SNDRV_PCM_FORMAT_S32_BE ((__force snd_pcm_format_t) 11) -+#define SNDRV_PCM_FORMAT_U32_LE ((__force snd_pcm_format_t) 12) -+#define SNDRV_PCM_FORMAT_U32_BE ((__force snd_pcm_format_t) 13) -+#define SNDRV_PCM_FORMAT_FLOAT_LE ((__force snd_pcm_format_t) 14) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */ -+#define SNDRV_PCM_FORMAT_FLOAT_BE ((__force snd_pcm_format_t) 15) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */ -+#define SNDRV_PCM_FORMAT_FLOAT64_LE ((__force snd_pcm_format_t) 16) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */ -+#define SNDRV_PCM_FORMAT_FLOAT64_BE ((__force snd_pcm_format_t) 17) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */ -+#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE ((__force snd_pcm_format_t) 18) /* IEC-958 subframe, Little Endian */ -+#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE ((__force snd_pcm_format_t) 19) /* IEC-958 subframe, Big Endian */ -+#define SNDRV_PCM_FORMAT_MU_LAW ((__force snd_pcm_format_t) 20) -+#define SNDRV_PCM_FORMAT_A_LAW ((__force snd_pcm_format_t) 21) -+#define SNDRV_PCM_FORMAT_IMA_ADPCM ((__force snd_pcm_format_t) 22) -+#define SNDRV_PCM_FORMAT_MPEG ((__force snd_pcm_format_t) 23) -+#define SNDRV_PCM_FORMAT_GSM ((__force snd_pcm_format_t) 24) -+#define SNDRV_PCM_FORMAT_S20_LE ((__force snd_pcm_format_t) 25) /* in four bytes, LSB justified */ -+#define SNDRV_PCM_FORMAT_S20_BE ((__force snd_pcm_format_t) 26) /* in four bytes, LSB justified */ -+#define SNDRV_PCM_FORMAT_U20_LE ((__force snd_pcm_format_t) 27) /* in four bytes, LSB justified */ -+#define SNDRV_PCM_FORMAT_U20_BE ((__force snd_pcm_format_t) 28) /* in four bytes, LSB justified */ -+/* gap in the numbering for a future standard linear format */ -+#define SNDRV_PCM_FORMAT_SPECIAL ((__force snd_pcm_format_t) 31) -+#define SNDRV_PCM_FORMAT_S24_3LE ((__force snd_pcm_format_t) 32) /* in three bytes */ -+#define SNDRV_PCM_FORMAT_S24_3BE ((__force snd_pcm_format_t) 33) /* in three bytes */ -+#define SNDRV_PCM_FORMAT_U24_3LE ((__force snd_pcm_format_t) 34) /* in three bytes */ -+#define SNDRV_PCM_FORMAT_U24_3BE ((__force snd_pcm_format_t) 35) /* in three bytes */ -+#define SNDRV_PCM_FORMAT_S20_3LE ((__force snd_pcm_format_t) 36) /* in three bytes */ -+#define SNDRV_PCM_FORMAT_S20_3BE ((__force snd_pcm_format_t) 37) /* in three bytes */ -+#define SNDRV_PCM_FORMAT_U20_3LE ((__force snd_pcm_format_t) 38) /* in three bytes */ -+#define SNDRV_PCM_FORMAT_U20_3BE ((__force snd_pcm_format_t) 39) /* in three bytes */ -+#define SNDRV_PCM_FORMAT_S18_3LE ((__force snd_pcm_format_t) 40) /* in three bytes */ -+#define SNDRV_PCM_FORMAT_S18_3BE ((__force snd_pcm_format_t) 41) /* in three bytes */ -+#define SNDRV_PCM_FORMAT_U18_3LE ((__force snd_pcm_format_t) 42) /* in three bytes */ -+#define SNDRV_PCM_FORMAT_U18_3BE ((__force snd_pcm_format_t) 43) /* in three bytes */ -+#define SNDRV_PCM_FORMAT_G723_24 ((__force snd_pcm_format_t) 44) /* 8 samples in 3 bytes */ -+#define SNDRV_PCM_FORMAT_G723_24_1B ((__force snd_pcm_format_t) 45) /* 1 sample in 1 byte */ -+#define SNDRV_PCM_FORMAT_G723_40 ((__force snd_pcm_format_t) 46) /* 8 Samples in 5 bytes */ -+#define SNDRV_PCM_FORMAT_G723_40_1B ((__force snd_pcm_format_t) 47) /* 1 sample in 1 byte */ -+#define SNDRV_PCM_FORMAT_DSD_U8 ((__force snd_pcm_format_t) 48) /* DSD, 1-byte samples DSD (x8) */ -+#define SNDRV_PCM_FORMAT_DSD_U16_LE ((__force snd_pcm_format_t) 49) /* DSD, 2-byte samples DSD (x16), little endian */ -+#define SNDRV_PCM_FORMAT_DSD_U32_LE ((__force snd_pcm_format_t) 50) /* DSD, 4-byte samples DSD (x32), little endian */ -+#define SNDRV_PCM_FORMAT_DSD_U16_BE ((__force snd_pcm_format_t) 51) /* DSD, 2-byte samples DSD (x16), big endian */ -+#define SNDRV_PCM_FORMAT_DSD_U32_BE ((__force snd_pcm_format_t) 52) /* DSD, 4-byte samples DSD (x32), big endian */ -+#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U32_BE -+#define SNDRV_PCM_FORMAT_FIRST SNDRV_PCM_FORMAT_S8 -+ -+#ifdef SNDRV_LITTLE_ENDIAN -+#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE -+#define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_LE -+#define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_LE -+#define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_LE -+#define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_LE -+#define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_LE -+#define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_LE -+#define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_LE -+#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE -+#define SNDRV_PCM_FORMAT_S20 SNDRV_PCM_FORMAT_S20_LE -+#define SNDRV_PCM_FORMAT_U20 SNDRV_PCM_FORMAT_U20_LE -+#endif -+#ifdef SNDRV_BIG_ENDIAN -+#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_BE -+#define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_BE -+#define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_BE -+#define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_BE -+#define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_BE -+#define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_BE -+#define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_BE -+#define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_BE -+#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE -+#define SNDRV_PCM_FORMAT_S20 SNDRV_PCM_FORMAT_S20_BE -+#define SNDRV_PCM_FORMAT_U20 SNDRV_PCM_FORMAT_U20_BE -+#endif -+ -+typedef int __bitwise snd_pcm_subformat_t; -+#define SNDRV_PCM_SUBFORMAT_STD ((__force snd_pcm_subformat_t) 0) -+#define SNDRV_PCM_SUBFORMAT_LAST SNDRV_PCM_SUBFORMAT_STD -+ -+#define SNDRV_PCM_INFO_MMAP 0x00000001 /* hardware supports mmap */ -+#define SNDRV_PCM_INFO_MMAP_VALID 0x00000002 /* period data are valid during transfer */ -+#define SNDRV_PCM_INFO_DOUBLE 0x00000004 /* Double buffering needed for PCM start/stop */ -+#define SNDRV_PCM_INFO_BATCH 0x00000010 /* double buffering */ -+#define SNDRV_PCM_INFO_SYNC_APPLPTR 0x00000020 /* need the explicit sync of appl_ptr update */ -+#define SNDRV_PCM_INFO_INTERLEAVED 0x00000100 /* channels are interleaved */ -+#define SNDRV_PCM_INFO_NONINTERLEAVED 0x00000200 /* channels are not interleaved */ -+#define SNDRV_PCM_INFO_COMPLEX 0x00000400 /* complex frame organization (mmap only) */ -+#define SNDRV_PCM_INFO_BLOCK_TRANSFER 0x00010000 /* hardware transfer block of samples */ -+#define SNDRV_PCM_INFO_OVERRANGE 0x00020000 /* hardware supports ADC (capture) overrange detection */ -+#define SNDRV_PCM_INFO_RESUME 0x00040000 /* hardware supports stream resume after suspend */ -+#define SNDRV_PCM_INFO_PAUSE 0x00080000 /* pause ioctl is supported */ -+#define SNDRV_PCM_INFO_HALF_DUPLEX 0x00100000 /* only half duplex */ -+#define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000 /* playback and capture stream are somewhat correlated */ -+#define SNDRV_PCM_INFO_SYNC_START 0x00400000 /* pcm support some kind of sync go */ -+#define SNDRV_PCM_INFO_NO_PERIOD_WAKEUP 0x00800000 /* period wakeup can be disabled */ -+#define SNDRV_PCM_INFO_HAS_WALL_CLOCK 0x01000000 /* (Deprecated)has audio wall clock for audio/system time sync */ -+#define SNDRV_PCM_INFO_HAS_LINK_ATIME 0x01000000 /* report hardware link audio time, reset on startup */ -+#define SNDRV_PCM_INFO_HAS_LINK_ABSOLUTE_ATIME 0x02000000 /* report absolute hardware link audio time, not reset on startup */ -+#define SNDRV_PCM_INFO_HAS_LINK_ESTIMATED_ATIME 0x04000000 /* report estimated link audio time */ -+#define SNDRV_PCM_INFO_HAS_LINK_SYNCHRONIZED_ATIME 0x08000000 /* report synchronized audio/system time */ -+ -+#define SNDRV_PCM_INFO_DRAIN_TRIGGER 0x40000000 /* internal kernel flag - trigger in drain */ -+#define SNDRV_PCM_INFO_FIFO_IN_FRAMES 0x80000000 /* internal kernel flag - FIFO size is in frames */ -+ -+ -+ -+typedef int __bitwise snd_pcm_state_t; -+#define SNDRV_PCM_STATE_OPEN ((__force snd_pcm_state_t) 0) /* stream is open */ -+#define SNDRV_PCM_STATE_SETUP ((__force snd_pcm_state_t) 1) /* stream has a setup */ -+#define SNDRV_PCM_STATE_PREPARED ((__force snd_pcm_state_t) 2) /* stream is ready to start */ -+#define SNDRV_PCM_STATE_RUNNING ((__force snd_pcm_state_t) 3) /* stream is running */ -+#define SNDRV_PCM_STATE_XRUN ((__force snd_pcm_state_t) 4) /* stream reached an xrun */ -+#define SNDRV_PCM_STATE_DRAINING ((__force snd_pcm_state_t) 5) /* stream is draining */ -+#define SNDRV_PCM_STATE_PAUSED ((__force snd_pcm_state_t) 6) /* stream is paused */ -+#define SNDRV_PCM_STATE_SUSPENDED ((__force snd_pcm_state_t) 7) /* hardware is suspended */ -+#define SNDRV_PCM_STATE_DISCONNECTED ((__force snd_pcm_state_t) 8) /* hardware is disconnected */ -+#define SNDRV_PCM_STATE_LAST SNDRV_PCM_STATE_DISCONNECTED -+ -+enum { -+ SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000, -+ SNDRV_PCM_MMAP_OFFSET_STATUS = 0x80000000, -+ SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000, -+}; -+ -+union snd_pcm_sync_id { -+ unsigned char id[16]; -+ unsigned short id16[8]; -+ unsigned int id32[4]; -+}; -+ -+struct snd_pcm_info { -+ unsigned int device; /* RO/WR (control): device number */ -+ unsigned int subdevice; /* RO/WR (control): subdevice number */ -+ int stream; /* RO/WR (control): stream direction */ -+ int card; /* R: card number */ -+ unsigned char id[64]; /* ID (user selectable) */ -+ unsigned char name[80]; /* name of this device */ -+ unsigned char subname[32]; /* subdevice name */ -+ int dev_class; /* SNDRV_PCM_CLASS_* */ -+ int dev_subclass; /* SNDRV_PCM_SUBCLASS_* */ -+ unsigned int subdevices_count; -+ unsigned int subdevices_avail; -+ union snd_pcm_sync_id sync; /* hardware synchronization ID */ -+ unsigned char reserved[64]; /* reserved for future... */ -+}; -+ -+typedef int snd_pcm_hw_param_t; -+#define SNDRV_PCM_HW_PARAM_ACCESS 0 /* Access type */ -+#define SNDRV_PCM_HW_PARAM_FORMAT 1 /* Format */ -+#define SNDRV_PCM_HW_PARAM_SUBFORMAT 2 /* Subformat */ -+#define SNDRV_PCM_HW_PARAM_FIRST_MASK SNDRV_PCM_HW_PARAM_ACCESS -+#define SNDRV_PCM_HW_PARAM_LAST_MASK SNDRV_PCM_HW_PARAM_SUBFORMAT -+ -+#define SNDRV_PCM_HW_PARAM_SAMPLE_BITS 8 /* Bits per sample */ -+#define SNDRV_PCM_HW_PARAM_FRAME_BITS 9 /* Bits per frame */ -+#define SNDRV_PCM_HW_PARAM_CHANNELS 10 /* Channels */ -+#define SNDRV_PCM_HW_PARAM_RATE 11 /* Approx rate */ -+#define SNDRV_PCM_HW_PARAM_PERIOD_TIME 12 /* Approx distance between -+ * interrupts in us -+ */ -+#define SNDRV_PCM_HW_PARAM_PERIOD_SIZE 13 /* Approx frames between -+ * interrupts -+ */ -+#define SNDRV_PCM_HW_PARAM_PERIOD_BYTES 14 /* Approx bytes between -+ * interrupts -+ */ -+#define SNDRV_PCM_HW_PARAM_PERIODS 15 /* Approx interrupts per -+ * buffer -+ */ -+#define SNDRV_PCM_HW_PARAM_BUFFER_TIME 16 /* Approx duration of buffer -+ * in us -+ */ -+#define SNDRV_PCM_HW_PARAM_BUFFER_SIZE 17 /* Size of buffer in frames */ -+#define SNDRV_PCM_HW_PARAM_BUFFER_BYTES 18 /* Size of buffer in bytes */ -+#define SNDRV_PCM_HW_PARAM_TICK_TIME 19 /* Approx tick duration in us */ -+#define SNDRV_PCM_HW_PARAM_FIRST_INTERVAL SNDRV_PCM_HW_PARAM_SAMPLE_BITS -+#define SNDRV_PCM_HW_PARAM_LAST_INTERVAL SNDRV_PCM_HW_PARAM_TICK_TIME -+ -+#define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */ -+#define SNDRV_PCM_HW_PARAMS_EXPORT_BUFFER (1<<1) /* export buffer */ -+#define SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP (1<<2) /* disable period wakeups */ -+ -+struct snd_interval { -+ unsigned int min, max; -+ unsigned int openmin:1, -+ openmax:1, -+ integer:1, -+ empty:1; -+}; -+ -+#define SNDRV_MASK_MAX 256 -+ -+struct snd_mask { -+ __u32 bits[(SNDRV_MASK_MAX+31)/32]; -+}; -+ -+struct snd_pcm_hw_params { -+ unsigned int flags; -+ struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK - -+ SNDRV_PCM_HW_PARAM_FIRST_MASK + 1]; -+ struct snd_mask mres[5]; /* reserved masks */ -+ struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL - -+ SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1]; -+ struct snd_interval ires[9]; /* reserved intervals */ -+ unsigned int rmask; /* W: requested masks */ -+ unsigned int cmask; /* R: changed masks */ -+ unsigned int info; /* R: Info flags for returned setup */ -+ unsigned int msbits; /* R: used most significant bits */ -+ unsigned int rate_num; /* R: rate numerator */ -+ unsigned int rate_den; /* R: rate denominator */ -+ snd_pcm_uframes_t fifo_size; /* R: chip FIFO size in frames */ -+ unsigned char reserved[64]; /* reserved for future */ -+}; -+ -+enum { -+ SNDRV_PCM_TSTAMP_NONE = 0, -+ SNDRV_PCM_TSTAMP_ENABLE, -+ SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_ENABLE, -+}; -+ -+struct snd_pcm_sw_params { -+ int tstamp_mode; /* timestamp mode */ -+ unsigned int period_step; -+ unsigned int sleep_min; /* min ticks to sleep */ -+ snd_pcm_uframes_t avail_min; /* min avail frames for wakeup */ -+ snd_pcm_uframes_t xfer_align; /* obsolete: xfer size need to be a multiple */ -+ snd_pcm_uframes_t start_threshold; /* min hw_avail frames for automatic start */ -+ snd_pcm_uframes_t stop_threshold; /* min avail frames for automatic stop */ -+ snd_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */ -+ snd_pcm_uframes_t silence_size; /* silence block size */ -+ snd_pcm_uframes_t boundary; /* pointers wrap point */ -+ unsigned int proto; /* protocol version */ -+ unsigned int tstamp_type; /* timestamp type (req. proto >= 2.0.12) */ -+ unsigned char reserved[56]; /* reserved for future */ -+}; -+ -+struct snd_pcm_channel_info { -+ unsigned int channel; -+ __kernel_off_t offset; /* mmap offset */ -+ unsigned int first; /* offset to first sample in bits */ -+ unsigned int step; /* samples distance in bits */ -+}; -+ -+enum { -+ /* -+ * first definition for backwards compatibility only, -+ * maps to wallclock/link time for HDAudio playback and DEFAULT/DMA time for everything else -+ */ -+ SNDRV_PCM_AUDIO_TSTAMP_TYPE_COMPAT = 0, -+ -+ /* timestamp definitions */ -+ SNDRV_PCM_AUDIO_TSTAMP_TYPE_DEFAULT = 1, /* DMA time, reported as per hw_ptr */ -+ SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK = 2, /* link time reported by sample or wallclock counter, reset on startup */ -+ SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_ABSOLUTE = 3, /* link time reported by sample or wallclock counter, not reset on startup */ -+ SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_ESTIMATED = 4, /* link time estimated indirectly */ -+ SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED = 5, /* link time synchronized with system time */ -+ SNDRV_PCM_AUDIO_TSTAMP_TYPE_LAST = SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED -+}; -+ -+struct snd_pcm_status { -+ snd_pcm_state_t state; /* stream state */ -+ struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */ -+ struct timespec tstamp; /* reference timestamp */ -+ snd_pcm_uframes_t appl_ptr; /* appl ptr */ -+ snd_pcm_uframes_t hw_ptr; /* hw ptr */ -+ snd_pcm_sframes_t delay; /* current delay in frames */ -+ snd_pcm_uframes_t avail; /* number of frames available */ -+ snd_pcm_uframes_t avail_max; /* max frames available on hw since last status */ -+ snd_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */ -+ snd_pcm_state_t suspended_state; /* suspended stream state */ -+ __u32 audio_tstamp_data; /* needed for 64-bit alignment, used for configs/report to/from userspace */ -+ struct timespec audio_tstamp; /* sample counter, wall clock, PHC or on-demand sync'ed */ -+ struct timespec driver_tstamp; /* useful in case reference system tstamp is reported with delay */ -+ __u32 audio_tstamp_accuracy; /* in ns units, only valid if indicated in audio_tstamp_data */ -+ unsigned char reserved[52-2*sizeof(struct timespec)]; /* must be filled with zero */ -+}; -+ -+struct snd_pcm_mmap_status { -+ snd_pcm_state_t state; /* RO: state - SNDRV_PCM_STATE_XXXX */ -+ int pad1; /* Needed for 64 bit alignment */ -+ snd_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */ -+ struct timespec tstamp; /* Timestamp */ -+ snd_pcm_state_t suspended_state; /* RO: suspended stream state */ -+ struct timespec audio_tstamp; /* from sample counter or wall clock */ -+}; -+ -+struct snd_pcm_mmap_control { -+ snd_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */ -+ snd_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */ -+}; -+ -+#define SNDRV_PCM_SYNC_PTR_HWSYNC (1<<0) /* execute hwsync */ -+#define SNDRV_PCM_SYNC_PTR_APPL (1<<1) /* get appl_ptr from driver (r/w op) */ -+#define SNDRV_PCM_SYNC_PTR_AVAIL_MIN (1<<2) /* get avail_min from driver */ -+ -+struct snd_pcm_sync_ptr { -+ unsigned int flags; -+ union { -+ struct snd_pcm_mmap_status status; -+ unsigned char reserved[64]; -+ } s; -+ union { -+ struct snd_pcm_mmap_control control; -+ unsigned char reserved[64]; -+ } c; -+}; -+ -+struct snd_xferi { -+ snd_pcm_sframes_t result; -+ void __user *buf; -+ snd_pcm_uframes_t frames; -+}; -+ -+struct snd_xfern { -+ snd_pcm_sframes_t result; -+ void __user * __user *bufs; -+ snd_pcm_uframes_t frames; -+}; -+ -+enum { -+ SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, /* gettimeofday equivalent */ -+ SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, /* posix_clock_monotonic equivalent */ -+ SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW, /* monotonic_raw (no NTP) */ -+ SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW, -+}; -+ -+/* channel positions */ -+enum { -+ SNDRV_CHMAP_UNKNOWN = 0, -+ SNDRV_CHMAP_NA, /* N/A, silent */ -+ SNDRV_CHMAP_MONO, /* mono stream */ -+ /* this follows the alsa-lib mixer channel value + 3 */ -+ SNDRV_CHMAP_FL, /* front left */ -+ SNDRV_CHMAP_FR, /* front right */ -+ SNDRV_CHMAP_RL, /* rear left */ -+ SNDRV_CHMAP_RR, /* rear right */ -+ SNDRV_CHMAP_FC, /* front center */ -+ SNDRV_CHMAP_LFE, /* LFE */ -+ SNDRV_CHMAP_SL, /* side left */ -+ SNDRV_CHMAP_SR, /* side right */ -+ SNDRV_CHMAP_RC, /* rear center */ -+ /* new definitions */ -+ SNDRV_CHMAP_FLC, /* front left center */ -+ SNDRV_CHMAP_FRC, /* front right center */ -+ SNDRV_CHMAP_RLC, /* rear left center */ -+ SNDRV_CHMAP_RRC, /* rear right center */ -+ SNDRV_CHMAP_FLW, /* front left wide */ -+ SNDRV_CHMAP_FRW, /* front right wide */ -+ SNDRV_CHMAP_FLH, /* front left high */ -+ SNDRV_CHMAP_FCH, /* front center high */ -+ SNDRV_CHMAP_FRH, /* front right high */ -+ SNDRV_CHMAP_TC, /* top center */ -+ SNDRV_CHMAP_TFL, /* top front left */ -+ SNDRV_CHMAP_TFR, /* top front right */ -+ SNDRV_CHMAP_TFC, /* top front center */ -+ SNDRV_CHMAP_TRL, /* top rear left */ -+ SNDRV_CHMAP_TRR, /* top rear right */ -+ SNDRV_CHMAP_TRC, /* top rear center */ -+ /* new definitions for UAC2 */ -+ SNDRV_CHMAP_TFLC, /* top front left center */ -+ SNDRV_CHMAP_TFRC, /* top front right center */ -+ SNDRV_CHMAP_TSL, /* top side left */ -+ SNDRV_CHMAP_TSR, /* top side right */ -+ SNDRV_CHMAP_LLFE, /* left LFE */ -+ SNDRV_CHMAP_RLFE, /* right LFE */ -+ SNDRV_CHMAP_BC, /* bottom center */ -+ SNDRV_CHMAP_BLC, /* bottom left center */ -+ SNDRV_CHMAP_BRC, /* bottom right center */ -+ SNDRV_CHMAP_LAST = SNDRV_CHMAP_BRC, -+}; -+ -+#define SNDRV_CHMAP_POSITION_MASK 0xffff -+#define SNDRV_CHMAP_PHASE_INVERSE (0x01 << 16) -+#define SNDRV_CHMAP_DRIVER_SPEC (0x02 << 16) -+ -+#define SNDRV_PCM_IOCTL_PVERSION _IOR('A', 0x00, int) -+#define SNDRV_PCM_IOCTL_INFO _IOR('A', 0x01, struct snd_pcm_info) -+#define SNDRV_PCM_IOCTL_TSTAMP _IOW('A', 0x02, int) -+#define SNDRV_PCM_IOCTL_TTSTAMP _IOW('A', 0x03, int) -+#define SNDRV_PCM_IOCTL_USER_PVERSION _IOW('A', 0x04, int) -+#define SNDRV_PCM_IOCTL_HW_REFINE _IOWR('A', 0x10, struct snd_pcm_hw_params) -+#define SNDRV_PCM_IOCTL_HW_PARAMS _IOWR('A', 0x11, struct snd_pcm_hw_params) -+#define SNDRV_PCM_IOCTL_HW_FREE _IO('A', 0x12) -+#define SNDRV_PCM_IOCTL_SW_PARAMS _IOWR('A', 0x13, struct snd_pcm_sw_params) -+#define SNDRV_PCM_IOCTL_STATUS _IOR('A', 0x20, struct snd_pcm_status) -+#define SNDRV_PCM_IOCTL_DELAY _IOR('A', 0x21, snd_pcm_sframes_t) -+#define SNDRV_PCM_IOCTL_HWSYNC _IO('A', 0x22) -+#define SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct snd_pcm_sync_ptr) -+#define SNDRV_PCM_IOCTL_STATUS_EXT _IOWR('A', 0x24, struct snd_pcm_status) -+#define SNDRV_PCM_IOCTL_CHANNEL_INFO _IOR('A', 0x32, struct snd_pcm_channel_info) -+#define SNDRV_PCM_IOCTL_PREPARE _IO('A', 0x40) -+#define SNDRV_PCM_IOCTL_RESET _IO('A', 0x41) -+#define SNDRV_PCM_IOCTL_START _IO('A', 0x42) -+#define SNDRV_PCM_IOCTL_DROP _IO('A', 0x43) -+#define SNDRV_PCM_IOCTL_DRAIN _IO('A', 0x44) -+#define SNDRV_PCM_IOCTL_PAUSE _IOW('A', 0x45, int) -+#define SNDRV_PCM_IOCTL_REWIND _IOW('A', 0x46, snd_pcm_uframes_t) -+#define SNDRV_PCM_IOCTL_RESUME _IO('A', 0x47) -+#define SNDRV_PCM_IOCTL_XRUN _IO('A', 0x48) -+#define SNDRV_PCM_IOCTL_FORWARD _IOW('A', 0x49, snd_pcm_uframes_t) -+#define SNDRV_PCM_IOCTL_WRITEI_FRAMES _IOW('A', 0x50, struct snd_xferi) -+#define SNDRV_PCM_IOCTL_READI_FRAMES _IOR('A', 0x51, struct snd_xferi) -+#define SNDRV_PCM_IOCTL_WRITEN_FRAMES _IOW('A', 0x52, struct snd_xfern) -+#define SNDRV_PCM_IOCTL_READN_FRAMES _IOR('A', 0x53, struct snd_xfern) -+#define SNDRV_PCM_IOCTL_LINK _IOW('A', 0x60, int) -+#define SNDRV_PCM_IOCTL_UNLINK _IO('A', 0x61) -+ -+/***************************************************************************** -+ * * -+ * MIDI v1.0 interface * -+ * * -+ *****************************************************************************/ -+ -+/* -+ * Raw MIDI section - /dev/snd/midi?? -+ */ -+ -+#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0) -+ -+enum { -+ SNDRV_RAWMIDI_STREAM_OUTPUT = 0, -+ SNDRV_RAWMIDI_STREAM_INPUT, -+ SNDRV_RAWMIDI_STREAM_LAST = SNDRV_RAWMIDI_STREAM_INPUT, -+}; -+ -+#define SNDRV_RAWMIDI_INFO_OUTPUT 0x00000001 -+#define SNDRV_RAWMIDI_INFO_INPUT 0x00000002 -+#define SNDRV_RAWMIDI_INFO_DUPLEX 0x00000004 -+ -+struct snd_rawmidi_info { -+ unsigned int device; /* RO/WR (control): device number */ -+ unsigned int subdevice; /* RO/WR (control): subdevice number */ -+ int stream; /* WR: stream */ -+ int card; /* R: card number */ -+ unsigned int flags; /* SNDRV_RAWMIDI_INFO_XXXX */ -+ unsigned char id[64]; /* ID (user selectable) */ -+ unsigned char name[80]; /* name of device */ -+ unsigned char subname[32]; /* name of active or selected subdevice */ -+ unsigned int subdevices_count; -+ unsigned int subdevices_avail; -+ unsigned char reserved[64]; /* reserved for future use */ -+}; -+ -+struct snd_rawmidi_params { -+ int stream; -+ size_t buffer_size; /* queue size in bytes */ -+ size_t avail_min; /* minimum avail bytes for wakeup */ -+ unsigned int no_active_sensing: 1; /* do not send active sensing byte in close() */ -+ unsigned char reserved[16]; /* reserved for future use */ -+}; -+ -+struct snd_rawmidi_status { -+ int stream; -+ struct timespec tstamp; /* Timestamp */ -+ size_t avail; /* available bytes */ -+ size_t xruns; /* count of overruns since last status (in bytes) */ -+ unsigned char reserved[16]; /* reserved for future use */ -+}; -+ -+#define SNDRV_RAWMIDI_IOCTL_PVERSION _IOR('W', 0x00, int) -+#define SNDRV_RAWMIDI_IOCTL_INFO _IOR('W', 0x01, struct snd_rawmidi_info) -+#define SNDRV_RAWMIDI_IOCTL_PARAMS _IOWR('W', 0x10, struct snd_rawmidi_params) -+#define SNDRV_RAWMIDI_IOCTL_STATUS _IOWR('W', 0x20, struct snd_rawmidi_status) -+#define SNDRV_RAWMIDI_IOCTL_DROP _IOW('W', 0x30, int) -+#define SNDRV_RAWMIDI_IOCTL_DRAIN _IOW('W', 0x31, int) -+ -+/* -+ * Timer section - /dev/snd/timer -+ */ -+ -+#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 6) -+ -+enum { -+ SNDRV_TIMER_CLASS_NONE = -1, -+ SNDRV_TIMER_CLASS_SLAVE = 0, -+ SNDRV_TIMER_CLASS_GLOBAL, -+ SNDRV_TIMER_CLASS_CARD, -+ SNDRV_TIMER_CLASS_PCM, -+ SNDRV_TIMER_CLASS_LAST = SNDRV_TIMER_CLASS_PCM, -+}; -+ -+/* slave timer classes */ -+enum { -+ SNDRV_TIMER_SCLASS_NONE = 0, -+ SNDRV_TIMER_SCLASS_APPLICATION, -+ SNDRV_TIMER_SCLASS_SEQUENCER, /* alias */ -+ SNDRV_TIMER_SCLASS_OSS_SEQUENCER, /* alias */ -+ SNDRV_TIMER_SCLASS_LAST = SNDRV_TIMER_SCLASS_OSS_SEQUENCER, -+}; -+ -+/* global timers (device member) */ -+#define SNDRV_TIMER_GLOBAL_SYSTEM 0 -+#define SNDRV_TIMER_GLOBAL_RTC 1 /* unused */ -+#define SNDRV_TIMER_GLOBAL_HPET 2 -+#define SNDRV_TIMER_GLOBAL_HRTIMER 3 -+ -+/* info flags */ -+#define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */ -+ -+struct snd_timer_id { -+ int dev_class; -+ int dev_sclass; -+ int card; -+ int device; -+ int subdevice; -+}; -+ -+struct snd_timer_ginfo { -+ struct snd_timer_id tid; /* requested timer ID */ -+ unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */ -+ int card; /* card number */ -+ unsigned char id[64]; /* timer identification */ -+ unsigned char name[80]; /* timer name */ -+ unsigned long reserved0; /* reserved for future use */ -+ unsigned long resolution; /* average period resolution in ns */ -+ unsigned long resolution_min; /* minimal period resolution in ns */ -+ unsigned long resolution_max; /* maximal period resolution in ns */ -+ unsigned int clients; /* active timer clients */ -+ unsigned char reserved[32]; -+}; -+ -+struct snd_timer_gparams { -+ struct snd_timer_id tid; /* requested timer ID */ -+ unsigned long period_num; /* requested precise period duration (in seconds) - numerator */ -+ unsigned long period_den; /* requested precise period duration (in seconds) - denominator */ -+ unsigned char reserved[32]; -+}; -+ -+struct snd_timer_gstatus { -+ struct snd_timer_id tid; /* requested timer ID */ -+ unsigned long resolution; /* current period resolution in ns */ -+ unsigned long resolution_num; /* precise current period resolution (in seconds) - numerator */ -+ unsigned long resolution_den; /* precise current period resolution (in seconds) - denominator */ -+ unsigned char reserved[32]; -+}; -+ -+struct snd_timer_select { -+ struct snd_timer_id id; /* bind to timer ID */ -+ unsigned char reserved[32]; /* reserved */ -+}; -+ -+struct snd_timer_info { -+ unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */ -+ int card; /* card number */ -+ unsigned char id[64]; /* timer identificator */ -+ unsigned char name[80]; /* timer name */ -+ unsigned long reserved0; /* reserved for future use */ -+ unsigned long resolution; /* average period resolution in ns */ -+ unsigned char reserved[64]; /* reserved */ -+}; -+ -+#define SNDRV_TIMER_PSFLG_AUTO (1<<0) /* auto start, otherwise one-shot */ -+#define SNDRV_TIMER_PSFLG_EXCLUSIVE (1<<1) /* exclusive use, precise start/stop/pause/continue */ -+#define SNDRV_TIMER_PSFLG_EARLY_EVENT (1<<2) /* write early event to the poll queue */ -+ -+struct snd_timer_params { -+ unsigned int flags; /* flags - SNDRV_TIMER_PSFLG_* */ -+ unsigned int ticks; /* requested resolution in ticks */ -+ unsigned int queue_size; /* total size of queue (32-1024) */ -+ unsigned int reserved0; /* reserved, was: failure locations */ -+ unsigned int filter; /* event filter (bitmask of SNDRV_TIMER_EVENT_*) */ -+ unsigned char reserved[60]; /* reserved */ -+}; -+ -+struct snd_timer_status { -+ struct timespec tstamp; /* Timestamp - last update */ -+ unsigned int resolution; /* current period resolution in ns */ -+ unsigned int lost; /* counter of master tick lost */ -+ unsigned int overrun; /* count of read queue overruns */ -+ unsigned int queue; /* used queue size */ -+ unsigned char reserved[64]; /* reserved */ -+}; -+ -+#define SNDRV_TIMER_IOCTL_PVERSION _IOR('T', 0x00, int) -+#define SNDRV_TIMER_IOCTL_NEXT_DEVICE _IOWR('T', 0x01, struct snd_timer_id) -+#define SNDRV_TIMER_IOCTL_TREAD _IOW('T', 0x02, int) -+#define SNDRV_TIMER_IOCTL_GINFO _IOWR('T', 0x03, struct snd_timer_ginfo) -+#define SNDRV_TIMER_IOCTL_GPARAMS _IOW('T', 0x04, struct snd_timer_gparams) -+#define SNDRV_TIMER_IOCTL_GSTATUS _IOWR('T', 0x05, struct snd_timer_gstatus) -+#define SNDRV_TIMER_IOCTL_SELECT _IOW('T', 0x10, struct snd_timer_select) -+#define SNDRV_TIMER_IOCTL_INFO _IOR('T', 0x11, struct snd_timer_info) -+#define SNDRV_TIMER_IOCTL_PARAMS _IOW('T', 0x12, struct snd_timer_params) -+#define SNDRV_TIMER_IOCTL_STATUS _IOR('T', 0x14, struct snd_timer_status) -+/* The following four ioctls are changed since 1.0.9 due to confliction */ -+#define SNDRV_TIMER_IOCTL_START _IO('T', 0xa0) -+#define SNDRV_TIMER_IOCTL_STOP _IO('T', 0xa1) -+#define SNDRV_TIMER_IOCTL_CONTINUE _IO('T', 0xa2) -+#define SNDRV_TIMER_IOCTL_PAUSE _IO('T', 0xa3) -+ -+struct snd_timer_read { -+ unsigned int resolution; -+ unsigned int ticks; -+}; -+ -+enum { -+ SNDRV_TIMER_EVENT_RESOLUTION = 0, /* val = resolution in ns */ -+ SNDRV_TIMER_EVENT_TICK, /* val = ticks */ -+ SNDRV_TIMER_EVENT_START, /* val = resolution in ns */ -+ SNDRV_TIMER_EVENT_STOP, /* val = 0 */ -+ SNDRV_TIMER_EVENT_CONTINUE, /* val = resolution in ns */ -+ SNDRV_TIMER_EVENT_PAUSE, /* val = 0 */ -+ SNDRV_TIMER_EVENT_EARLY, /* val = 0, early event */ -+ SNDRV_TIMER_EVENT_SUSPEND, /* val = 0 */ -+ SNDRV_TIMER_EVENT_RESUME, /* val = resolution in ns */ -+ /* master timer events for slave timer instances */ -+ SNDRV_TIMER_EVENT_MSTART = SNDRV_TIMER_EVENT_START + 10, -+ SNDRV_TIMER_EVENT_MSTOP = SNDRV_TIMER_EVENT_STOP + 10, -+ SNDRV_TIMER_EVENT_MCONTINUE = SNDRV_TIMER_EVENT_CONTINUE + 10, -+ SNDRV_TIMER_EVENT_MPAUSE = SNDRV_TIMER_EVENT_PAUSE + 10, -+ SNDRV_TIMER_EVENT_MSUSPEND = SNDRV_TIMER_EVENT_SUSPEND + 10, -+ SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10, -+}; -+ -+struct snd_timer_tread { -+ int event; -+ struct timespec tstamp; -+ unsigned int val; -+}; -+ -+/**************************************************************************** -+ * * -+ * Section for driver control interface - /dev/snd/control? * -+ * * -+ ****************************************************************************/ -+ -+#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7) -+ -+struct snd_ctl_card_info { -+ int card; /* card number */ -+ int pad; /* reserved for future (was type) */ -+ unsigned char id[16]; /* ID of card (user selectable) */ -+ unsigned char driver[16]; /* Driver name */ -+ unsigned char name[32]; /* Short name of soundcard */ -+ unsigned char longname[80]; /* name + info text about soundcard */ -+ unsigned char reserved_[16]; /* reserved for future (was ID of mixer) */ -+ unsigned char mixername[80]; /* visual mixer identification */ -+ unsigned char components[128]; /* card components / fine identification, delimited with one space (AC97 etc..) */ -+}; -+ -+typedef int __bitwise snd_ctl_elem_type_t; -+#define SNDRV_CTL_ELEM_TYPE_NONE ((__force snd_ctl_elem_type_t) 0) /* invalid */ -+#define SNDRV_CTL_ELEM_TYPE_BOOLEAN ((__force snd_ctl_elem_type_t) 1) /* boolean type */ -+#define SNDRV_CTL_ELEM_TYPE_INTEGER ((__force snd_ctl_elem_type_t) 2) /* integer type */ -+#define SNDRV_CTL_ELEM_TYPE_ENUMERATED ((__force snd_ctl_elem_type_t) 3) /* enumerated type */ -+#define SNDRV_CTL_ELEM_TYPE_BYTES ((__force snd_ctl_elem_type_t) 4) /* byte array */ -+#define SNDRV_CTL_ELEM_TYPE_IEC958 ((__force snd_ctl_elem_type_t) 5) /* IEC958 (S/PDIF) setup */ -+#define SNDRV_CTL_ELEM_TYPE_INTEGER64 ((__force snd_ctl_elem_type_t) 6) /* 64-bit integer type */ -+#define SNDRV_CTL_ELEM_TYPE_LAST SNDRV_CTL_ELEM_TYPE_INTEGER64 -+ -+typedef int __bitwise snd_ctl_elem_iface_t; -+#define SNDRV_CTL_ELEM_IFACE_CARD ((__force snd_ctl_elem_iface_t) 0) /* global control */ -+#define SNDRV_CTL_ELEM_IFACE_HWDEP ((__force snd_ctl_elem_iface_t) 1) /* hardware dependent device */ -+#define SNDRV_CTL_ELEM_IFACE_MIXER ((__force snd_ctl_elem_iface_t) 2) /* virtual mixer device */ -+#define SNDRV_CTL_ELEM_IFACE_PCM ((__force snd_ctl_elem_iface_t) 3) /* PCM device */ -+#define SNDRV_CTL_ELEM_IFACE_RAWMIDI ((__force snd_ctl_elem_iface_t) 4) /* RawMidi device */ -+#define SNDRV_CTL_ELEM_IFACE_TIMER ((__force snd_ctl_elem_iface_t) 5) /* timer device */ -+#define SNDRV_CTL_ELEM_IFACE_SEQUENCER ((__force snd_ctl_elem_iface_t) 6) /* sequencer client */ -+#define SNDRV_CTL_ELEM_IFACE_LAST SNDRV_CTL_ELEM_IFACE_SEQUENCER -+ -+#define SNDRV_CTL_ELEM_ACCESS_READ (1<<0) -+#define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1) -+#define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE) -+#define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */ -+#define SNDRV_CTL_ELEM_ACCESS_TIMESTAMP (1<<3) /* when was control changed */ -+#define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1<<4) /* TLV read is possible */ -+#define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1<<5) /* TLV write is possible */ -+#define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE) -+#define SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND (1<<6) /* TLV command is possible */ -+#define SNDRV_CTL_ELEM_ACCESS_INACTIVE (1<<8) /* control does actually nothing, but may be updated */ -+#define SNDRV_CTL_ELEM_ACCESS_LOCK (1<<9) /* write lock */ -+#define SNDRV_CTL_ELEM_ACCESS_OWNER (1<<10) /* write lock owner */ -+#define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK (1<<28) /* kernel use a TLV callback */ -+#define SNDRV_CTL_ELEM_ACCESS_USER (1<<29) /* user space element */ -+/* bits 30 and 31 are obsoleted (for indirect access) */ -+ -+/* for further details see the ACPI and PCI power management specification */ -+#define SNDRV_CTL_POWER_D0 0x0000 /* full On */ -+#define SNDRV_CTL_POWER_D1 0x0100 /* partial On */ -+#define SNDRV_CTL_POWER_D2 0x0200 /* partial On */ -+#define SNDRV_CTL_POWER_D3 0x0300 /* Off */ -+#define SNDRV_CTL_POWER_D3hot (SNDRV_CTL_POWER_D3|0x0000) /* Off, with power */ -+#define SNDRV_CTL_POWER_D3cold (SNDRV_CTL_POWER_D3|0x0001) /* Off, without power */ -+ -+#define SNDRV_CTL_ELEM_ID_NAME_MAXLEN 44 -+ -+struct snd_ctl_elem_id { -+ unsigned int numid; /* numeric identifier, zero = invalid */ -+ snd_ctl_elem_iface_t iface; /* interface identifier */ -+ unsigned int device; /* device/client number */ -+ unsigned int subdevice; /* subdevice (substream) number */ -+ unsigned char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* ASCII name of item */ -+ unsigned int index; /* index of item */ -+}; -+ -+struct snd_ctl_elem_list { -+ unsigned int offset; /* W: first element ID to get */ -+ unsigned int space; /* W: count of element IDs to get */ -+ unsigned int used; /* R: count of element IDs set */ -+ unsigned int count; /* R: count of all elements */ -+ struct snd_ctl_elem_id __user *pids; /* R: IDs */ -+ unsigned char reserved[50]; -+}; -+ -+struct snd_ctl_elem_info { -+ struct snd_ctl_elem_id id; /* W: element ID */ -+ snd_ctl_elem_type_t type; /* R: value type - SNDRV_CTL_ELEM_TYPE_* */ -+ unsigned int access; /* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */ -+ unsigned int count; /* count of values */ -+ __kernel_pid_t owner; /* owner's PID of this control */ -+ union { -+ struct { -+ long min; /* R: minimum value */ -+ long max; /* R: maximum value */ -+ long step; /* R: step (0 variable) */ -+ } integer; -+ struct { -+ long long min; /* R: minimum value */ -+ long long max; /* R: maximum value */ -+ long long step; /* R: step (0 variable) */ -+ } integer64; -+ struct { -+ unsigned int items; /* R: number of items */ -+ unsigned int item; /* W: item number */ -+ char name[64]; /* R: value name */ -+ __u64 names_ptr; /* W: names list (ELEM_ADD only) */ -+ unsigned int names_length; -+ } enumerated; -+ unsigned char reserved[128]; -+ } value; -+ union { -+ unsigned short d[4]; /* dimensions */ -+ unsigned short *d_ptr; /* indirect - obsoleted */ -+ } dimen; -+ unsigned char reserved[64-4*sizeof(unsigned short)]; -+}; -+ -+struct snd_ctl_elem_value { -+ struct snd_ctl_elem_id id; /* W: element ID */ -+ unsigned int indirect: 1; /* W: indirect access - obsoleted */ -+ union { -+ union { -+ long value[128]; -+ long *value_ptr; /* obsoleted */ -+ } integer; -+ union { -+ long long value[64]; -+ long long *value_ptr; /* obsoleted */ -+ } integer64; -+ union { -+ unsigned int item[128]; -+ unsigned int *item_ptr; /* obsoleted */ -+ } enumerated; -+ union { -+ unsigned char data[512]; -+ unsigned char *data_ptr; /* obsoleted */ -+ } bytes; -+ struct snd_aes_iec958 iec958; -+ } value; /* RO */ -+ struct timespec tstamp; -+ unsigned char reserved[128-sizeof(struct timespec)]; -+}; -+ -+struct snd_ctl_tlv { -+ unsigned int numid; /* control element numeric identification */ -+ unsigned int length; /* in bytes aligned to 4 */ -+ unsigned int tlv[0]; /* first TLV */ -+}; -+ -+#define SNDRV_CTL_IOCTL_PVERSION _IOR('U', 0x00, int) -+#define SNDRV_CTL_IOCTL_CARD_INFO _IOR('U', 0x01, struct snd_ctl_card_info) -+#define SNDRV_CTL_IOCTL_ELEM_LIST _IOWR('U', 0x10, struct snd_ctl_elem_list) -+#define SNDRV_CTL_IOCTL_ELEM_INFO _IOWR('U', 0x11, struct snd_ctl_elem_info) -+#define SNDRV_CTL_IOCTL_ELEM_READ _IOWR('U', 0x12, struct snd_ctl_elem_value) -+#define SNDRV_CTL_IOCTL_ELEM_WRITE _IOWR('U', 0x13, struct snd_ctl_elem_value) -+#define SNDRV_CTL_IOCTL_ELEM_LOCK _IOW('U', 0x14, struct snd_ctl_elem_id) -+#define SNDRV_CTL_IOCTL_ELEM_UNLOCK _IOW('U', 0x15, struct snd_ctl_elem_id) -+#define SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS _IOWR('U', 0x16, int) -+#define SNDRV_CTL_IOCTL_ELEM_ADD _IOWR('U', 0x17, struct snd_ctl_elem_info) -+#define SNDRV_CTL_IOCTL_ELEM_REPLACE _IOWR('U', 0x18, struct snd_ctl_elem_info) -+#define SNDRV_CTL_IOCTL_ELEM_REMOVE _IOWR('U', 0x19, struct snd_ctl_elem_id) -+#define SNDRV_CTL_IOCTL_TLV_READ _IOWR('U', 0x1a, struct snd_ctl_tlv) -+#define SNDRV_CTL_IOCTL_TLV_WRITE _IOWR('U', 0x1b, struct snd_ctl_tlv) -+#define SNDRV_CTL_IOCTL_TLV_COMMAND _IOWR('U', 0x1c, struct snd_ctl_tlv) -+#define SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE _IOWR('U', 0x20, int) -+#define SNDRV_CTL_IOCTL_HWDEP_INFO _IOR('U', 0x21, struct snd_hwdep_info) -+#define SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE _IOR('U', 0x30, int) -+#define SNDRV_CTL_IOCTL_PCM_INFO _IOWR('U', 0x31, struct snd_pcm_info) -+#define SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE _IOW('U', 0x32, int) -+#define SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE _IOWR('U', 0x40, int) -+#define SNDRV_CTL_IOCTL_RAWMIDI_INFO _IOWR('U', 0x41, struct snd_rawmidi_info) -+#define SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE _IOW('U', 0x42, int) -+#define SNDRV_CTL_IOCTL_POWER _IOWR('U', 0xd0, int) -+#define SNDRV_CTL_IOCTL_POWER_STATE _IOR('U', 0xd1, int) -+ -+/* -+ * Read interface. -+ */ -+ -+enum sndrv_ctl_event_type { -+ SNDRV_CTL_EVENT_ELEM = 0, -+ SNDRV_CTL_EVENT_LAST = SNDRV_CTL_EVENT_ELEM, -+}; -+ -+#define SNDRV_CTL_EVENT_MASK_VALUE (1<<0) /* element value was changed */ -+#define SNDRV_CTL_EVENT_MASK_INFO (1<<1) /* element info was changed */ -+#define SNDRV_CTL_EVENT_MASK_ADD (1<<2) /* element was added */ -+#define SNDRV_CTL_EVENT_MASK_TLV (1<<3) /* element TLV tree was changed */ -+#define SNDRV_CTL_EVENT_MASK_REMOVE (~0U) /* element was removed */ -+ -+struct snd_ctl_event { -+ int type; /* event type - SNDRV_CTL_EVENT_* */ -+ union { -+ struct { -+ unsigned int mask; -+ struct snd_ctl_elem_id id; -+ } elem; -+ unsigned char data8[60]; -+ } data; -+}; -+ -+/* -+ * Control names -+ */ -+ -+#define SNDRV_CTL_NAME_NONE "" -+#define SNDRV_CTL_NAME_PLAYBACK "Playback " -+#define SNDRV_CTL_NAME_CAPTURE "Capture " -+ -+#define SNDRV_CTL_NAME_IEC958_NONE "" -+#define SNDRV_CTL_NAME_IEC958_SWITCH "Switch" -+#define SNDRV_CTL_NAME_IEC958_VOLUME "Volume" -+#define SNDRV_CTL_NAME_IEC958_DEFAULT "Default" -+#define SNDRV_CTL_NAME_IEC958_MASK "Mask" -+#define SNDRV_CTL_NAME_IEC958_CON_MASK "Con Mask" -+#define SNDRV_CTL_NAME_IEC958_PRO_MASK "Pro Mask" -+#define SNDRV_CTL_NAME_IEC958_PCM_STREAM "PCM Stream" -+#define SNDRV_CTL_NAME_IEC958(expl,direction,what) "IEC958 " expl SNDRV_CTL_NAME_##direction SNDRV_CTL_NAME_IEC958_##what -+ -+#endif /* _UAPI__SOUND_ASOUND_H */ -diff --git a/include/sound/uapi/asound_fm.h b/include/sound/uapi/asound_fm.h -new file mode 100644 -index 00000000..8471f404 ---- /dev/null -+++ b/include/sound/uapi/asound_fm.h -@@ -0,0 +1,135 @@ -+/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ -+#ifndef __SOUND_ASOUND_FM_H -+#define __SOUND_ASOUND_FM_H -+ -+/* -+ * Advanced Linux Sound Architecture - ALSA -+ * -+ * Interface file between ALSA driver & user space -+ * Copyright (c) 1994-98 by Jaroslav Kysela , -+ * 4Front Technologies -+ * -+ * Direct FM control -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ * -+ */ -+ -+#define SNDRV_DM_FM_MODE_OPL2 0x00 -+#define SNDRV_DM_FM_MODE_OPL3 0x01 -+ -+struct snd_dm_fm_info { -+ unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */ -+ unsigned char rhythm; /* percussion mode flag */ -+}; -+ -+/* -+ * Data structure composing an FM "note" or sound event. -+ */ -+ -+struct snd_dm_fm_voice { -+ unsigned char op; /* operator cell (0 or 1) */ -+ unsigned char voice; /* FM voice (0 to 17) */ -+ -+ unsigned char am; /* amplitude modulation */ -+ unsigned char vibrato; /* vibrato effect */ -+ unsigned char do_sustain; /* sustain phase */ -+ unsigned char kbd_scale; /* keyboard scaling */ -+ unsigned char harmonic; /* 4 bits: harmonic and multiplier */ -+ unsigned char scale_level; /* 2 bits: decrease output freq rises */ -+ unsigned char volume; /* 6 bits: volume */ -+ -+ unsigned char attack; /* 4 bits: attack rate */ -+ unsigned char decay; /* 4 bits: decay rate */ -+ unsigned char sustain; /* 4 bits: sustain level */ -+ unsigned char release; /* 4 bits: release rate */ -+ -+ unsigned char feedback; /* 3 bits: feedback for op0 */ -+ unsigned char connection; /* 0 for serial, 1 for parallel */ -+ unsigned char left; /* stereo left */ -+ unsigned char right; /* stereo right */ -+ unsigned char waveform; /* 3 bits: waveform shape */ -+}; -+ -+/* -+ * This describes an FM note by its voice, octave, frequency number (10bit) -+ * and key on/off. -+ */ -+ -+struct snd_dm_fm_note { -+ unsigned char voice; /* 0-17 voice channel */ -+ unsigned char octave; /* 3 bits: what octave to play */ -+ unsigned int fnum; /* 10 bits: frequency number */ -+ unsigned char key_on; /* set for active, clear for silent */ -+}; -+ -+/* -+ * FM parameters that apply globally to all voices, and thus are not "notes" -+ */ -+ -+struct snd_dm_fm_params { -+ unsigned char am_depth; /* amplitude modulation depth (1=hi) */ -+ unsigned char vib_depth; /* vibrato depth (1=hi) */ -+ unsigned char kbd_split; /* keyboard split */ -+ unsigned char rhythm; /* percussion mode select */ -+ -+ /* This block is the percussion instrument data */ -+ unsigned char bass; -+ unsigned char snare; -+ unsigned char tomtom; -+ unsigned char cymbal; -+ unsigned char hihat; -+}; -+ -+/* -+ * FM mode ioctl settings -+ */ -+ -+#define SNDRV_DM_FM_IOCTL_INFO _IOR('H', 0x20, struct snd_dm_fm_info) -+#define SNDRV_DM_FM_IOCTL_RESET _IO ('H', 0x21) -+#define SNDRV_DM_FM_IOCTL_PLAY_NOTE _IOW('H', 0x22, struct snd_dm_fm_note) -+#define SNDRV_DM_FM_IOCTL_SET_VOICE _IOW('H', 0x23, struct snd_dm_fm_voice) -+#define SNDRV_DM_FM_IOCTL_SET_PARAMS _IOW('H', 0x24, struct snd_dm_fm_params) -+#define SNDRV_DM_FM_IOCTL_SET_MODE _IOW('H', 0x25, int) -+/* for OPL3 only */ -+#define SNDRV_DM_FM_IOCTL_SET_CONNECTION _IOW('H', 0x26, int) -+/* SBI patch management */ -+#define SNDRV_DM_FM_IOCTL_CLEAR_PATCHES _IO ('H', 0x40) -+ -+#define SNDRV_DM_FM_OSS_IOCTL_RESET 0x20 -+#define SNDRV_DM_FM_OSS_IOCTL_PLAY_NOTE 0x21 -+#define SNDRV_DM_FM_OSS_IOCTL_SET_VOICE 0x22 -+#define SNDRV_DM_FM_OSS_IOCTL_SET_PARAMS 0x23 -+#define SNDRV_DM_FM_OSS_IOCTL_SET_MODE 0x24 -+#define SNDRV_DM_FM_OSS_IOCTL_SET_OPL 0x25 -+ -+/* -+ * Patch Record - fixed size for write -+ */ -+ -+#define FM_KEY_SBI "SBI\032" -+#define FM_KEY_2OP "2OP\032" -+#define FM_KEY_4OP "4OP\032" -+ -+struct sbi_patch { -+ unsigned char prog; -+ unsigned char bank; -+ char key[4]; -+ char name[25]; -+ char extension[7]; -+ unsigned char data[32]; -+}; -+ -+#endif /* __SOUND_ASOUND_FM_H */ -diff --git a/include/sound/uapi/emu10k1.h b/include/sound/uapi/emu10k1.h -new file mode 100644 -index 00000000..c1150e4d ---- /dev/null -+++ b/include/sound/uapi/emu10k1.h -@@ -0,0 +1,395 @@ -+/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ -+/* -+ * Copyright (c) by Jaroslav Kysela , -+ * Creative Labs, Inc. -+ * Definitions for EMU10K1 (SB Live!) chips -+ * -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ * -+ */ -+#ifndef _UAPI__SOUND_EMU10K1_H -+#define _UAPI__SOUND_EMU10K1_H -+ -+/* -+ * ---- FX8010 ---- -+ */ -+ -+#define EMU10K1_CARD_CREATIVE 0x00000000 -+#define EMU10K1_CARD_EMUAPS 0x00000001 -+ -+#define EMU10K1_FX8010_PCM_COUNT 8 -+ -+/* -+ * Following definition is copied from linux/types.h to support compiling -+ * this header file in userspace since they are not generally available for -+ * uapi headers. -+ */ -+#define __EMU10K1_DECLARE_BITMAP(name,bits) \ -+ unsigned long name[(bits) / (sizeof(unsigned long) * 8)] -+ -+/* instruction set */ -+#define iMAC0 0x00 /* R = A + (X * Y >> 31) ; saturation */ -+#define iMAC1 0x01 /* R = A + (-X * Y >> 31) ; saturation */ -+#define iMAC2 0x02 /* R = A + (X * Y >> 31) ; wraparound */ -+#define iMAC3 0x03 /* R = A + (-X * Y >> 31) ; wraparound */ -+#define iMACINT0 0x04 /* R = A + X * Y ; saturation */ -+#define iMACINT1 0x05 /* R = A + X * Y ; wraparound (31-bit) */ -+#define iACC3 0x06 /* R = A + X + Y ; saturation */ -+#define iMACMV 0x07 /* R = A, acc += X * Y >> 31 */ -+#define iANDXOR 0x08 /* R = (A & X) ^ Y */ -+#define iTSTNEG 0x09 /* R = (A >= Y) ? X : ~X */ -+#define iLIMITGE 0x0a /* R = (A >= Y) ? X : Y */ -+#define iLIMITLT 0x0b /* R = (A < Y) ? X : Y */ -+#define iLOG 0x0c /* R = linear_data, A (log_data), X (max_exp), Y (format_word) */ -+#define iEXP 0x0d /* R = log_data, A (linear_data), X (max_exp), Y (format_word) */ -+#define iINTERP 0x0e /* R = A + (X * (Y - A) >> 31) ; saturation */ -+#define iSKIP 0x0f /* R = A (cc_reg), X (count), Y (cc_test) */ -+ -+/* GPRs */ -+#define FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x0f */ -+#define EXTIN(x) (0x10 + (x)) /* x = 0x00 - 0x0f */ -+#define EXTOUT(x) (0x20 + (x)) /* x = 0x00 - 0x0f physical outs -> FXWC low 16 bits */ -+#define FXBUS2(x) (0x30 + (x)) /* x = 0x00 - 0x0f copies of fx buses for capture -> FXWC high 16 bits */ -+ /* NB: 0x31 and 0x32 are shared with Center/LFE on SB live 5.1 */ -+ -+#define C_00000000 0x40 -+#define C_00000001 0x41 -+#define C_00000002 0x42 -+#define C_00000003 0x43 -+#define C_00000004 0x44 -+#define C_00000008 0x45 -+#define C_00000010 0x46 -+#define C_00000020 0x47 -+#define C_00000100 0x48 -+#define C_00010000 0x49 -+#define C_00080000 0x4a -+#define C_10000000 0x4b -+#define C_20000000 0x4c -+#define C_40000000 0x4d -+#define C_80000000 0x4e -+#define C_7fffffff 0x4f -+#define C_ffffffff 0x50 -+#define C_fffffffe 0x51 -+#define C_c0000000 0x52 -+#define C_4f1bbcdc 0x53 -+#define C_5a7ef9db 0x54 -+#define C_00100000 0x55 /* ?? */ -+#define GPR_ACCU 0x56 /* ACCUM, accumulator */ -+#define GPR_COND 0x57 /* CCR, condition register */ -+#define GPR_NOISE0 0x58 /* noise source */ -+#define GPR_NOISE1 0x59 /* noise source */ -+#define GPR_IRQ 0x5a /* IRQ register */ -+#define GPR_DBAC 0x5b /* TRAM Delay Base Address Counter */ -+#define GPR(x) (FXGPREGBASE + (x)) /* free GPRs: x = 0x00 - 0xff */ -+#define ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */ -+#define ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */ -+#define ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */ -+#define ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */ -+ -+#define A_ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */ -+#define A_ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */ -+#define A_ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */ -+#define A_ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */ -+#define A_ITRAM_CTL(x) (A_TANKMEMCTLREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */ -+#define A_ETRAM_CTL(x) (A_TANKMEMCTLREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */ -+ -+#define A_FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x3f FX buses */ -+#define A_EXTIN(x) (0x40 + (x)) /* x = 0x00 - 0x0f physical ins */ -+#define A_P16VIN(x) (0x50 + (x)) /* x = 0x00 - 0x0f p16v ins (A2 only) "EMU32 inputs" */ -+#define A_EXTOUT(x) (0x60 + (x)) /* x = 0x00 - 0x1f physical outs -> A_FXWC1 0x79-7f unknown */ -+#define A_FXBUS2(x) (0x80 + (x)) /* x = 0x00 - 0x1f extra outs used for EFX capture -> A_FXWC2 */ -+#define A_EMU32OUTH(x) (0xa0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_10 - _1F" - ??? */ -+#define A_EMU32OUTL(x) (0xb0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_1 - _F" - ??? */ -+#define A3_EMU32IN(x) (0x160 + (x)) /* x = 0x00 - 0x3f "EMU32_IN_00 - _3F" - Only when .device = 0x0008 */ -+#define A3_EMU32OUT(x) (0x1E0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_00 - _3F" - Only when .device = 0x0008 */ -+#define A_GPR(x) (A_FXGPREGBASE + (x)) -+ -+/* cc_reg constants */ -+#define CC_REG_NORMALIZED C_00000001 -+#define CC_REG_BORROW C_00000002 -+#define CC_REG_MINUS C_00000004 -+#define CC_REG_ZERO C_00000008 -+#define CC_REG_SATURATE C_00000010 -+#define CC_REG_NONZERO C_00000100 -+ -+/* FX buses */ -+#define FXBUS_PCM_LEFT 0x00 -+#define FXBUS_PCM_RIGHT 0x01 -+#define FXBUS_PCM_LEFT_REAR 0x02 -+#define FXBUS_PCM_RIGHT_REAR 0x03 -+#define FXBUS_MIDI_LEFT 0x04 -+#define FXBUS_MIDI_RIGHT 0x05 -+#define FXBUS_PCM_CENTER 0x06 -+#define FXBUS_PCM_LFE 0x07 -+#define FXBUS_PCM_LEFT_FRONT 0x08 -+#define FXBUS_PCM_RIGHT_FRONT 0x09 -+#define FXBUS_MIDI_REVERB 0x0c -+#define FXBUS_MIDI_CHORUS 0x0d -+#define FXBUS_PCM_LEFT_SIDE 0x0e -+#define FXBUS_PCM_RIGHT_SIDE 0x0f -+#define FXBUS_PT_LEFT 0x14 -+#define FXBUS_PT_RIGHT 0x15 -+ -+/* Inputs */ -+#define EXTIN_AC97_L 0x00 /* AC'97 capture channel - left */ -+#define EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */ -+#define EXTIN_SPDIF_CD_L 0x02 /* internal S/PDIF CD - onboard - left */ -+#define EXTIN_SPDIF_CD_R 0x03 /* internal S/PDIF CD - onboard - right */ -+#define EXTIN_ZOOM_L 0x04 /* Zoom Video I2S - left */ -+#define EXTIN_ZOOM_R 0x05 /* Zoom Video I2S - right */ -+#define EXTIN_TOSLINK_L 0x06 /* LiveDrive - TOSLink Optical - left */ -+#define EXTIN_TOSLINK_R 0x07 /* LiveDrive - TOSLink Optical - right */ -+#define EXTIN_LINE1_L 0x08 /* LiveDrive - Line/Mic 1 - left */ -+#define EXTIN_LINE1_R 0x09 /* LiveDrive - Line/Mic 1 - right */ -+#define EXTIN_COAX_SPDIF_L 0x0a /* LiveDrive - Coaxial S/PDIF - left */ -+#define EXTIN_COAX_SPDIF_R 0x0b /* LiveDrive - Coaxial S/PDIF - right */ -+#define EXTIN_LINE2_L 0x0c /* LiveDrive - Line/Mic 2 - left */ -+#define EXTIN_LINE2_R 0x0d /* LiveDrive - Line/Mic 2 - right */ -+ -+/* Outputs */ -+#define EXTOUT_AC97_L 0x00 /* AC'97 playback channel - left */ -+#define EXTOUT_AC97_R 0x01 /* AC'97 playback channel - right */ -+#define EXTOUT_TOSLINK_L 0x02 /* LiveDrive - TOSLink Optical - left */ -+#define EXTOUT_TOSLINK_R 0x03 /* LiveDrive - TOSLink Optical - right */ -+#define EXTOUT_AC97_CENTER 0x04 /* SB Live 5.1 - center */ -+#define EXTOUT_AC97_LFE 0x05 /* SB Live 5.1 - LFE */ -+#define EXTOUT_HEADPHONE_L 0x06 /* LiveDrive - Headphone - left */ -+#define EXTOUT_HEADPHONE_R 0x07 /* LiveDrive - Headphone - right */ -+#define EXTOUT_REAR_L 0x08 /* Rear channel - left */ -+#define EXTOUT_REAR_R 0x09 /* Rear channel - right */ -+#define EXTOUT_ADC_CAP_L 0x0a /* ADC Capture buffer - left */ -+#define EXTOUT_ADC_CAP_R 0x0b /* ADC Capture buffer - right */ -+#define EXTOUT_MIC_CAP 0x0c /* MIC Capture buffer */ -+#define EXTOUT_AC97_REAR_L 0x0d /* SB Live 5.1 (c) 2003 - Rear Left */ -+#define EXTOUT_AC97_REAR_R 0x0e /* SB Live 5.1 (c) 2003 - Rear Right */ -+#define EXTOUT_ACENTER 0x11 /* Analog Center */ -+#define EXTOUT_ALFE 0x12 /* Analog LFE */ -+ -+/* Audigy Inputs */ -+#define A_EXTIN_AC97_L 0x00 /* AC'97 capture channel - left */ -+#define A_EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */ -+#define A_EXTIN_SPDIF_CD_L 0x02 /* digital CD left */ -+#define A_EXTIN_SPDIF_CD_R 0x03 /* digital CD left */ -+#define A_EXTIN_OPT_SPDIF_L 0x04 /* audigy drive Optical SPDIF - left */ -+#define A_EXTIN_OPT_SPDIF_R 0x05 /* right */ -+#define A_EXTIN_LINE2_L 0x08 /* audigy drive line2/mic2 - left */ -+#define A_EXTIN_LINE2_R 0x09 /* right */ -+#define A_EXTIN_ADC_L 0x0a /* Philips ADC - left */ -+#define A_EXTIN_ADC_R 0x0b /* right */ -+#define A_EXTIN_AUX2_L 0x0c /* audigy drive aux2 - left */ -+#define A_EXTIN_AUX2_R 0x0d /* - right */ -+ -+/* Audigiy Outputs */ -+#define A_EXTOUT_FRONT_L 0x00 /* digital front left */ -+#define A_EXTOUT_FRONT_R 0x01 /* right */ -+#define A_EXTOUT_CENTER 0x02 /* digital front center */ -+#define A_EXTOUT_LFE 0x03 /* digital front lfe */ -+#define A_EXTOUT_HEADPHONE_L 0x04 /* headphone audigy drive left */ -+#define A_EXTOUT_HEADPHONE_R 0x05 /* right */ -+#define A_EXTOUT_REAR_L 0x06 /* digital rear left */ -+#define A_EXTOUT_REAR_R 0x07 /* right */ -+#define A_EXTOUT_AFRONT_L 0x08 /* analog front left */ -+#define A_EXTOUT_AFRONT_R 0x09 /* right */ -+#define A_EXTOUT_ACENTER 0x0a /* analog center */ -+#define A_EXTOUT_ALFE 0x0b /* analog LFE */ -+#define A_EXTOUT_ASIDE_L 0x0c /* analog side left - Audigy 2 ZS */ -+#define A_EXTOUT_ASIDE_R 0x0d /* right - Audigy 2 ZS */ -+#define A_EXTOUT_AREAR_L 0x0e /* analog rear left */ -+#define A_EXTOUT_AREAR_R 0x0f /* right */ -+#define A_EXTOUT_AC97_L 0x10 /* AC97 left (front) */ -+#define A_EXTOUT_AC97_R 0x11 /* right */ -+#define A_EXTOUT_ADC_CAP_L 0x16 /* ADC capture buffer left */ -+#define A_EXTOUT_ADC_CAP_R 0x17 /* right */ -+#define A_EXTOUT_MIC_CAP 0x18 /* Mic capture buffer */ -+ -+/* Audigy constants */ -+#define A_C_00000000 0xc0 -+#define A_C_00000001 0xc1 -+#define A_C_00000002 0xc2 -+#define A_C_00000003 0xc3 -+#define A_C_00000004 0xc4 -+#define A_C_00000008 0xc5 -+#define A_C_00000010 0xc6 -+#define A_C_00000020 0xc7 -+#define A_C_00000100 0xc8 -+#define A_C_00010000 0xc9 -+#define A_C_00000800 0xca -+#define A_C_10000000 0xcb -+#define A_C_20000000 0xcc -+#define A_C_40000000 0xcd -+#define A_C_80000000 0xce -+#define A_C_7fffffff 0xcf -+#define A_C_ffffffff 0xd0 -+#define A_C_fffffffe 0xd1 -+#define A_C_c0000000 0xd2 -+#define A_C_4f1bbcdc 0xd3 -+#define A_C_5a7ef9db 0xd4 -+#define A_C_00100000 0xd5 -+#define A_GPR_ACCU 0xd6 /* ACCUM, accumulator */ -+#define A_GPR_COND 0xd7 /* CCR, condition register */ -+#define A_GPR_NOISE0 0xd8 /* noise source */ -+#define A_GPR_NOISE1 0xd9 /* noise source */ -+#define A_GPR_IRQ 0xda /* IRQ register */ -+#define A_GPR_DBAC 0xdb /* TRAM Delay Base Address Counter - internal */ -+#define A_GPR_DBACE 0xde /* TRAM Delay Base Address Counter - external */ -+ -+/* definitions for debug register */ -+#define EMU10K1_DBG_ZC 0x80000000 /* zero tram counter */ -+#define EMU10K1_DBG_SATURATION_OCCURED 0x02000000 /* saturation control */ -+#define EMU10K1_DBG_SATURATION_ADDR 0x01ff0000 /* saturation address */ -+#define EMU10K1_DBG_SINGLE_STEP 0x00008000 /* single step mode */ -+#define EMU10K1_DBG_STEP 0x00004000 /* start single step */ -+#define EMU10K1_DBG_CONDITION_CODE 0x00003e00 /* condition code */ -+#define EMU10K1_DBG_SINGLE_STEP_ADDR 0x000001ff /* single step address */ -+ -+/* tank memory address line */ -+#ifndef __KERNEL__ -+#define TANKMEMADDRREG_ADDR_MASK 0x000fffff /* 20 bit tank address field */ -+#define TANKMEMADDRREG_CLEAR 0x00800000 /* Clear tank memory */ -+#define TANKMEMADDRREG_ALIGN 0x00400000 /* Align read or write relative to tank access */ -+#define TANKMEMADDRREG_WRITE 0x00200000 /* Write to tank memory */ -+#define TANKMEMADDRREG_READ 0x00100000 /* Read from tank memory */ -+#endif -+ -+struct snd_emu10k1_fx8010_info { -+ unsigned int internal_tram_size; /* in samples */ -+ unsigned int external_tram_size; /* in samples */ -+ char fxbus_names[16][32]; /* names of FXBUSes */ -+ char extin_names[16][32]; /* names of external inputs */ -+ char extout_names[32][32]; /* names of external outputs */ -+ unsigned int gpr_controls; /* count of GPR controls */ -+}; -+ -+#define EMU10K1_GPR_TRANSLATION_NONE 0 -+#define EMU10K1_GPR_TRANSLATION_TABLE100 1 -+#define EMU10K1_GPR_TRANSLATION_BASS 2 -+#define EMU10K1_GPR_TRANSLATION_TREBLE 3 -+#define EMU10K1_GPR_TRANSLATION_ONOFF 4 -+ -+enum emu10k1_ctl_elem_iface { -+ EMU10K1_CTL_ELEM_IFACE_MIXER = 2, /* virtual mixer device */ -+ EMU10K1_CTL_ELEM_IFACE_PCM = 3, /* PCM device */ -+}; -+ -+struct emu10k1_ctl_elem_id { -+ unsigned int pad; /* don't use */ -+ int iface; /* interface identifier */ -+ unsigned int device; /* device/client number */ -+ unsigned int subdevice; /* subdevice (substream) number */ -+ unsigned char name[44]; /* ASCII name of item */ -+ unsigned int index; /* index of item */ -+}; -+ -+struct snd_emu10k1_fx8010_control_gpr { -+ struct emu10k1_ctl_elem_id id; /* full control ID definition */ -+ unsigned int vcount; /* visible count */ -+ unsigned int count; /* count of GPR (1..16) */ -+ unsigned short gpr[32]; /* GPR number(s) */ -+ unsigned int value[32]; /* initial values */ -+ unsigned int min; /* minimum range */ -+ unsigned int max; /* maximum range */ -+ unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */ -+ const unsigned int *tlv; -+}; -+ -+/* old ABI without TLV support */ -+struct snd_emu10k1_fx8010_control_old_gpr { -+ struct emu10k1_ctl_elem_id id; -+ unsigned int vcount; -+ unsigned int count; -+ unsigned short gpr[32]; -+ unsigned int value[32]; -+ unsigned int min; -+ unsigned int max; -+ unsigned int translation; -+}; -+ -+struct snd_emu10k1_fx8010_code { -+ char name[128]; -+ -+ __EMU10K1_DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */ -+ __u32 *gpr_map; /* initializers */ -+ -+ unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */ -+ struct snd_emu10k1_fx8010_control_gpr *gpr_add_controls; /* GPR controls to add/replace */ -+ -+ unsigned int gpr_del_control_count; /* count of GPR controls to remove */ -+ struct emu10k1_ctl_elem_id *gpr_del_controls; /* IDs of GPR controls to remove */ -+ -+ unsigned int gpr_list_control_count; /* count of GPR controls to list */ -+ unsigned int gpr_list_control_total; /* total count of GPR controls */ -+ struct snd_emu10k1_fx8010_control_gpr *gpr_list_controls; /* listed GPR controls */ -+ -+ __EMU10K1_DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */ -+ __u32 *tram_data_map; /* data initializers */ -+ __u32 *tram_addr_map; /* map initializers */ -+ -+ __EMU10K1_DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */ -+ __u32 *code; /* one instruction - 64 bits */ -+}; -+ -+struct snd_emu10k1_fx8010_tram { -+ unsigned int address; /* 31.bit == 1 -> external TRAM */ -+ unsigned int size; /* size in samples (4 bytes) */ -+ unsigned int *samples; /* pointer to samples (20-bit) */ -+ /* NULL->clear memory */ -+}; -+ -+struct snd_emu10k1_fx8010_pcm_rec { -+ unsigned int substream; /* substream number */ -+ unsigned int res1; /* reserved */ -+ unsigned int channels; /* 16-bit channels count, zero = remove this substream */ -+ unsigned int tram_start; /* ring buffer position in TRAM (in samples) */ -+ unsigned int buffer_size; /* count of buffered samples */ -+ unsigned short gpr_size; /* GPR containing size of ringbuffer in samples (host) */ -+ unsigned short gpr_ptr; /* GPR containing current pointer in the ring buffer (host = reset, FX8010) */ -+ unsigned short gpr_count; /* GPR containing count of samples between two interrupts (host) */ -+ unsigned short gpr_tmpcount; /* GPR containing current count of samples to interrupt (host = set, FX8010) */ -+ unsigned short gpr_trigger; /* GPR containing trigger (activate) information (host) */ -+ unsigned short gpr_running; /* GPR containing info if PCM is running (FX8010) */ -+ unsigned char pad; /* reserved */ -+ unsigned char etram[32]; /* external TRAM address & data (one per channel) */ -+ unsigned int res2; /* reserved */ -+}; -+ -+#define SNDRV_EMU10K1_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1) -+ -+#define SNDRV_EMU10K1_IOCTL_INFO _IOR ('H', 0x10, struct snd_emu10k1_fx8010_info) -+#define SNDRV_EMU10K1_IOCTL_CODE_POKE _IOW ('H', 0x11, struct snd_emu10k1_fx8010_code) -+#define SNDRV_EMU10K1_IOCTL_CODE_PEEK _IOWR('H', 0x12, struct snd_emu10k1_fx8010_code) -+#define SNDRV_EMU10K1_IOCTL_TRAM_SETUP _IOW ('H', 0x20, int) -+#define SNDRV_EMU10K1_IOCTL_TRAM_POKE _IOW ('H', 0x21, struct snd_emu10k1_fx8010_tram) -+#define SNDRV_EMU10K1_IOCTL_TRAM_PEEK _IOWR('H', 0x22, struct snd_emu10k1_fx8010_tram) -+#define SNDRV_EMU10K1_IOCTL_PCM_POKE _IOW ('H', 0x30, struct snd_emu10k1_fx8010_pcm_rec) -+#define SNDRV_EMU10K1_IOCTL_PCM_PEEK _IOWR('H', 0x31, struct snd_emu10k1_fx8010_pcm_rec) -+#define SNDRV_EMU10K1_IOCTL_PVERSION _IOR ('H', 0x40, int) -+#define SNDRV_EMU10K1_IOCTL_STOP _IO ('H', 0x80) -+#define SNDRV_EMU10K1_IOCTL_CONTINUE _IO ('H', 0x81) -+#define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO ('H', 0x82) -+#define SNDRV_EMU10K1_IOCTL_SINGLE_STEP _IOW ('H', 0x83, int) -+#define SNDRV_EMU10K1_IOCTL_DBG_READ _IOR ('H', 0x84, int) -+ -+#ifndef __KERNEL__ -+/* typedefs for compatibility to user-space */ -+typedef struct snd_emu10k1_fx8010_info emu10k1_fx8010_info_t; -+typedef struct snd_emu10k1_fx8010_control_gpr emu10k1_fx8010_control_gpr_t; -+typedef struct snd_emu10k1_fx8010_code emu10k1_fx8010_code_t; -+typedef struct snd_emu10k1_fx8010_tram emu10k1_fx8010_tram_t; -+typedef struct snd_emu10k1_fx8010_pcm_rec emu10k1_fx8010_pcm_t; -+typedef struct emu10k1_ctl_elem_id emu10k1_ctl_elem_id_t; -+#endif -+ -+#endif /* _UAPI__SOUND_EMU10K1_H */ -diff --git a/include/sound/uapi/hdsp.h b/include/sound/uapi/hdsp.h -new file mode 100644 -index 00000000..88c92a3f ---- /dev/null -+++ b/include/sound/uapi/hdsp.h -@@ -0,0 +1,109 @@ -+/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ -+#ifndef __SOUND_HDSP_H -+#define __SOUND_HDSP_H -+ -+/* -+ * Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org) -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#define HDSP_MATRIX_MIXER_SIZE 2048 -+ -+enum HDSP_IO_Type { -+ Digiface, -+ Multiface, -+ H9652, -+ H9632, -+ RPM, -+ Undefined, -+}; -+ -+struct hdsp_peak_rms { -+ __u32 input_peaks[26]; -+ __u32 playback_peaks[26]; -+ __u32 output_peaks[28]; -+ __u64 input_rms[26]; -+ __u64 playback_rms[26]; -+ /* These are only used for H96xx cards */ -+ __u64 output_rms[26]; -+}; -+ -+#define SNDRV_HDSP_IOCTL_GET_PEAK_RMS _IOR('H', 0x40, struct hdsp_peak_rms) -+ -+struct hdsp_config_info { -+ unsigned char pref_sync_ref; -+ unsigned char wordclock_sync_check; -+ unsigned char spdif_sync_check; -+ unsigned char adatsync_sync_check; -+ unsigned char adat_sync_check[3]; -+ unsigned char spdif_in; -+ unsigned char spdif_out; -+ unsigned char spdif_professional; -+ unsigned char spdif_emphasis; -+ unsigned char spdif_nonaudio; -+ unsigned int spdif_sample_rate; -+ unsigned int system_sample_rate; -+ unsigned int autosync_sample_rate; -+ unsigned char system_clock_mode; -+ unsigned char clock_source; -+ unsigned char autosync_ref; -+ unsigned char line_out; -+ unsigned char passthru; -+ unsigned char da_gain; -+ unsigned char ad_gain; -+ unsigned char phone_gain; -+ unsigned char xlr_breakout_cable; -+ unsigned char analog_extension_board; -+}; -+ -+#define SNDRV_HDSP_IOCTL_GET_CONFIG_INFO _IOR('H', 0x41, struct hdsp_config_info) -+ -+struct hdsp_firmware { -+ void *firmware_data; /* 24413 x 4 bytes */ -+}; -+ -+#define SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE _IOW('H', 0x42, struct hdsp_firmware) -+ -+struct hdsp_version { -+ enum HDSP_IO_Type io_type; -+ unsigned short firmware_rev; -+}; -+ -+#define SNDRV_HDSP_IOCTL_GET_VERSION _IOR('H', 0x43, struct hdsp_version) -+ -+struct hdsp_mixer { -+ unsigned short matrix[HDSP_MATRIX_MIXER_SIZE]; -+}; -+ -+#define SNDRV_HDSP_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdsp_mixer) -+ -+struct hdsp_9632_aeb { -+ int aebi; -+ int aebo; -+}; -+ -+#define SNDRV_HDSP_IOCTL_GET_9632_AEB _IOR('H', 0x45, struct hdsp_9632_aeb) -+ -+/* typedefs for compatibility to user-space */ -+typedef enum HDSP_IO_Type HDSP_IO_Type; -+typedef struct hdsp_peak_rms hdsp_peak_rms_t; -+typedef struct hdsp_config_info hdsp_config_info_t; -+typedef struct hdsp_firmware hdsp_firmware_t; -+typedef struct hdsp_version hdsp_version_t; -+typedef struct hdsp_mixer hdsp_mixer_t; -+typedef struct hdsp_9632_aeb hdsp_9632_aeb_t; -+ -+#endif /* __SOUND_HDSP_H */ -diff --git a/include/sound/uapi/hdspm.h b/include/sound/uapi/hdspm.h -new file mode 100644 -index 00000000..2d91f90e ---- /dev/null -+++ b/include/sound/uapi/hdspm.h -@@ -0,0 +1,230 @@ -+/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ -+#ifndef __SOUND_HDSPM_H -+#define __SOUND_HDSPM_H -+/* -+ * Copyright (C) 2003 Winfried Ritsch (IEM) -+ * based on hdsp.h from Thomas Charbonnel (thomas@undata.org) -+ * -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+/* Maximum channels is 64 even on 56Mode you have 64playbacks to matrix */ -+#define HDSPM_MAX_CHANNELS 64 -+ -+enum hdspm_io_type { -+ MADI, -+ MADIface, -+ AIO, -+ AES32, -+ RayDAT -+}; -+ -+enum hdspm_speed { -+ ss, -+ ds, -+ qs -+}; -+ -+/* -------------------- IOCTL Peak/RMS Meters -------------------- */ -+ -+struct hdspm_peak_rms { -+ __u32 input_peaks[64]; -+ __u32 playback_peaks[64]; -+ __u32 output_peaks[64]; -+ -+ __u64 input_rms[64]; -+ __u64 playback_rms[64]; -+ __u64 output_rms[64]; -+ -+ __u8 speed; /* enum {ss, ds, qs} */ -+ int status2; -+}; -+ -+#define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS \ -+ _IOR('H', 0x42, struct hdspm_peak_rms) -+ -+/* ------------ CONFIG block IOCTL ---------------------- */ -+ -+struct hdspm_config { -+ unsigned char pref_sync_ref; -+ unsigned char wordclock_sync_check; -+ unsigned char madi_sync_check; -+ unsigned int system_sample_rate; -+ unsigned int autosync_sample_rate; -+ unsigned char system_clock_mode; -+ unsigned char clock_source; -+ unsigned char autosync_ref; -+ unsigned char line_out; -+ unsigned int passthru; -+ unsigned int analog_out; -+}; -+ -+#define SNDRV_HDSPM_IOCTL_GET_CONFIG \ -+ _IOR('H', 0x41, struct hdspm_config) -+ -+/* -+ * If there's a TCO (TimeCode Option) board installed, -+ * there are further options and status data available. -+ * The hdspm_ltc structure contains the current SMPTE -+ * timecode and some status information and can be -+ * obtained via SNDRV_HDSPM_IOCTL_GET_LTC or in the -+ * hdspm_status struct. -+ */ -+ -+enum hdspm_ltc_format { -+ format_invalid, -+ fps_24, -+ fps_25, -+ fps_2997, -+ fps_30 -+}; -+ -+enum hdspm_ltc_frame { -+ frame_invalid, -+ drop_frame, -+ full_frame -+}; -+ -+enum hdspm_ltc_input_format { -+ ntsc, -+ pal, -+ no_video -+}; -+ -+struct hdspm_ltc { -+ unsigned int ltc; -+ -+ enum hdspm_ltc_format format; -+ enum hdspm_ltc_frame frame; -+ enum hdspm_ltc_input_format input_format; -+}; -+ -+#define SNDRV_HDSPM_IOCTL_GET_LTC _IOR('H', 0x46, struct hdspm_ltc) -+ -+/* -+ * The status data reflects the device's current state -+ * as determined by the card's configuration and -+ * connection status. -+ */ -+ -+enum hdspm_sync { -+ hdspm_sync_no_lock = 0, -+ hdspm_sync_lock = 1, -+ hdspm_sync_sync = 2 -+}; -+ -+enum hdspm_madi_input { -+ hdspm_input_optical = 0, -+ hdspm_input_coax = 1 -+}; -+ -+enum hdspm_madi_channel_format { -+ hdspm_format_ch_64 = 0, -+ hdspm_format_ch_56 = 1 -+}; -+ -+enum hdspm_madi_frame_format { -+ hdspm_frame_48 = 0, -+ hdspm_frame_96 = 1 -+}; -+ -+enum hdspm_syncsource { -+ syncsource_wc = 0, -+ syncsource_madi = 1, -+ syncsource_tco = 2, -+ syncsource_sync = 3, -+ syncsource_none = 4 -+}; -+ -+struct hdspm_status { -+ __u8 card_type; /* enum hdspm_io_type */ -+ enum hdspm_syncsource autosync_source; -+ -+ __u64 card_clock; -+ __u32 master_period; -+ -+ union { -+ struct { -+ __u8 sync_wc; /* enum hdspm_sync */ -+ __u8 sync_madi; /* enum hdspm_sync */ -+ __u8 sync_tco; /* enum hdspm_sync */ -+ __u8 sync_in; /* enum hdspm_sync */ -+ __u8 madi_input; /* enum hdspm_madi_input */ -+ __u8 channel_format; /* enum hdspm_madi_channel_format */ -+ __u8 frame_format; /* enum hdspm_madi_frame_format */ -+ } madi; -+ } card_specific; -+}; -+ -+#define SNDRV_HDSPM_IOCTL_GET_STATUS \ -+ _IOR('H', 0x47, struct hdspm_status) -+ -+/* -+ * Get information about the card and its add-ons. -+ */ -+ -+#define HDSPM_ADDON_TCO 1 -+ -+struct hdspm_version { -+ __u8 card_type; /* enum hdspm_io_type */ -+ char cardname[20]; -+ unsigned int serial; -+ unsigned short firmware_rev; -+ int addons; -+}; -+ -+#define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x48, struct hdspm_version) -+ -+/* ------------- get Matrix Mixer IOCTL --------------- */ -+ -+/* MADI mixer: 64inputs+64playback in 64outputs = 8192 => *4Byte = -+ * 32768 Bytes -+ */ -+ -+/* organisation is 64 channelfader in a continuous memory block */ -+/* equivalent to hardware definition, maybe for future feature of mmap of -+ * them -+ */ -+/* each of 64 outputs has 64 infader and 64 outfader: -+ Ins to Outs mixer[out].in[in], Outstreams to Outs mixer[out].pb[pb] */ -+ -+#define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS -+ -+struct hdspm_channelfader { -+ unsigned int in[HDSPM_MIXER_CHANNELS]; -+ unsigned int pb[HDSPM_MIXER_CHANNELS]; -+}; -+ -+struct hdspm_mixer { -+ struct hdspm_channelfader ch[HDSPM_MIXER_CHANNELS]; -+}; -+ -+struct hdspm_mixer_ioctl { -+ struct hdspm_mixer *mixer; -+}; -+ -+/* use indirect access due to the limit of ioctl bit size */ -+#define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdspm_mixer_ioctl) -+ -+/* typedefs for compatibility to user-space */ -+typedef struct hdspm_peak_rms hdspm_peak_rms_t; -+typedef struct hdspm_config_info hdspm_config_info_t; -+typedef struct hdspm_version hdspm_version_t; -+typedef struct hdspm_channelfader snd_hdspm_channelfader_t; -+typedef struct hdspm_mixer hdspm_mixer_t; -+ -+ -+#endif -diff --git a/include/sound/uapi/sb16_csp.h b/include/sound/uapi/sb16_csp.h -new file mode 100644 -index 00000000..e6485148 ---- /dev/null -+++ b/include/sound/uapi/sb16_csp.h -@@ -0,0 +1,123 @@ -+/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ -+/* -+ * Copyright (c) 1999 by Uros Bizjak -+ * Takashi Iwai -+ * -+ * SB16ASP/AWE32 CSP control -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ * -+ */ -+#ifndef _UAPI__SOUND_SB16_CSP_H -+#define _UAPI__SOUND_SB16_CSP_H -+ -+ -+/* CSP modes */ -+#define SNDRV_SB_CSP_MODE_NONE 0x00 -+#define SNDRV_SB_CSP_MODE_DSP_READ 0x01 /* Record from DSP */ -+#define SNDRV_SB_CSP_MODE_DSP_WRITE 0x02 /* Play to DSP */ -+#define SNDRV_SB_CSP_MODE_QSOUND 0x04 /* QSound */ -+ -+/* CSP load flags */ -+#define SNDRV_SB_CSP_LOAD_FROMUSER 0x01 -+#define SNDRV_SB_CSP_LOAD_INITBLOCK 0x02 -+ -+/* CSP sample width */ -+#define SNDRV_SB_CSP_SAMPLE_8BIT 0x01 -+#define SNDRV_SB_CSP_SAMPLE_16BIT 0x02 -+ -+/* CSP channels */ -+#define SNDRV_SB_CSP_MONO 0x01 -+#define SNDRV_SB_CSP_STEREO 0x02 -+ -+/* CSP rates */ -+#define SNDRV_SB_CSP_RATE_8000 0x01 -+#define SNDRV_SB_CSP_RATE_11025 0x02 -+#define SNDRV_SB_CSP_RATE_22050 0x04 -+#define SNDRV_SB_CSP_RATE_44100 0x08 -+#define SNDRV_SB_CSP_RATE_ALL 0x0f -+ -+/* CSP running state */ -+#define SNDRV_SB_CSP_ST_IDLE 0x00 -+#define SNDRV_SB_CSP_ST_LOADED 0x01 -+#define SNDRV_SB_CSP_ST_RUNNING 0x02 -+#define SNDRV_SB_CSP_ST_PAUSED 0x04 -+#define SNDRV_SB_CSP_ST_AUTO 0x08 -+#define SNDRV_SB_CSP_ST_QSOUND 0x10 -+ -+/* maximum QSound value (180 degrees right) */ -+#define SNDRV_SB_CSP_QSOUND_MAX_RIGHT 0x20 -+ -+/* maximum microcode RIFF file size */ -+#define SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE 0x3000 -+ -+/* microcode header */ -+struct snd_sb_csp_mc_header { -+ char codec_name[16]; /* id name of codec */ -+ unsigned short func_req; /* requested function */ -+}; -+ -+/* microcode to be loaded */ -+struct snd_sb_csp_microcode { -+ struct snd_sb_csp_mc_header info; -+ unsigned char data[SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE]; -+}; -+ -+/* start CSP with sample_width in mono/stereo */ -+struct snd_sb_csp_start { -+ int sample_width; /* sample width, look above */ -+ int channels; /* channels, look above */ -+}; -+ -+/* CSP information */ -+struct snd_sb_csp_info { -+ char codec_name[16]; /* id name of codec */ -+ unsigned short func_nr; /* function number */ -+ unsigned int acc_format; /* accepted PCM formats */ -+ unsigned short acc_channels; /* accepted channels */ -+ unsigned short acc_width; /* accepted sample width */ -+ unsigned short acc_rates; /* accepted sample rates */ -+ unsigned short csp_mode; /* CSP mode, see above */ -+ unsigned short run_channels; /* current channels */ -+ unsigned short run_width; /* current sample width */ -+ unsigned short version; /* version id: 0x10 - 0x1f */ -+ unsigned short state; /* state bits */ -+}; -+ -+/* HWDEP controls */ -+/* get CSP information */ -+#define SNDRV_SB_CSP_IOCTL_INFO _IOR('H', 0x10, struct snd_sb_csp_info) -+/* load microcode to CSP */ -+/* NOTE: struct snd_sb_csp_microcode overflows the max size (13 bits) -+ * defined for some architectures like MIPS, and it leads to build errors. -+ * (x86 and co have 14-bit size, thus it's valid, though.) -+ * As a workaround for skipping the size-limit check, here we don't use the -+ * normal _IOW() macro but _IOC() with the manual argument. -+ */ -+#define SNDRV_SB_CSP_IOCTL_LOAD_CODE \ -+ _IOC(_IOC_WRITE, 'H', 0x11, sizeof(struct snd_sb_csp_microcode)) -+/* unload microcode from CSP */ -+#define SNDRV_SB_CSP_IOCTL_UNLOAD_CODE _IO('H', 0x12) -+/* start CSP */ -+#define SNDRV_SB_CSP_IOCTL_START _IOW('H', 0x13, struct snd_sb_csp_start) -+/* stop CSP */ -+#define SNDRV_SB_CSP_IOCTL_STOP _IO('H', 0x14) -+/* pause CSP and DMA transfer */ -+#define SNDRV_SB_CSP_IOCTL_PAUSE _IO('H', 0x15) -+/* restart CSP and DMA transfer */ -+#define SNDRV_SB_CSP_IOCTL_RESTART _IO('H', 0x16) -+ -+ -+#endif /* _UAPI__SOUND_SB16_CSP_H */ -diff --git a/include/sound/uapi/sscape_ioctl.h b/include/sound/uapi/sscape_ioctl.h -new file mode 100644 -index 00000000..c6653ebf ---- /dev/null -+++ b/include/sound/uapi/sscape_ioctl.h -@@ -0,0 +1,21 @@ -+#ifndef SSCAPE_IOCTL_H -+#define SSCAPE_IOCTL_H -+ -+ -+struct sscape_bootblock -+{ -+ unsigned char code[256]; -+ unsigned version; -+}; -+ -+#define SSCAPE_MICROCODE_SIZE 65536 -+ -+struct sscape_microcode -+{ -+ unsigned char *code; -+}; -+ -+#define SND_SSCAPE_LOAD_BOOTB _IOWR('P', 100, struct sscape_bootblock) -+#define SND_SSCAPE_LOAD_MCODE _IOW ('P', 101, struct sscape_microcode) -+ -+#endif -diff --git a/include/sound/uapi/tlv.h b/include/sound/uapi/tlv.h -new file mode 100644 -index 00000000..7d6d65f6 ---- /dev/null -+++ b/include/sound/uapi/tlv.h -@@ -0,0 +1,117 @@ -+/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ -+/* -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ */ -+ -+#ifndef __UAPI_SOUND_TLV_H -+#define __UAPI_SOUND_TLV_H -+ -+#define SNDRV_CTL_TLVT_CONTAINER 0 /* one level down - group of TLVs */ -+#define SNDRV_CTL_TLVT_DB_SCALE 1 /* dB scale */ -+#define SNDRV_CTL_TLVT_DB_LINEAR 2 /* linear volume */ -+#define SNDRV_CTL_TLVT_DB_RANGE 3 /* dB range container */ -+#define SNDRV_CTL_TLVT_DB_MINMAX 4 /* dB scale with min/max */ -+#define SNDRV_CTL_TLVT_DB_MINMAX_MUTE 5 /* dB scale with min/max with mute */ -+ -+/* -+ * channel-mapping TLV items -+ * TLV length must match with num_channels -+ */ -+#define SNDRV_CTL_TLVT_CHMAP_FIXED 0x101 /* fixed channel position */ -+#define SNDRV_CTL_TLVT_CHMAP_VAR 0x102 /* channels freely swappable */ -+#define SNDRV_CTL_TLVT_CHMAP_PAIRED 0x103 /* pair-wise swappable */ -+ -+/* -+ * TLV structure is right behind the struct snd_ctl_tlv: -+ * unsigned int type - see SNDRV_CTL_TLVT_* -+ * unsigned int length -+ * .... data aligned to sizeof(unsigned int), use -+ * block_length = (length + (sizeof(unsigned int) - 1)) & -+ * ~(sizeof(unsigned int) - 1)) .... -+ */ -+#define SNDRV_CTL_TLVD_ITEM(type, ...) \ -+ (type), SNDRV_CTL_TLVD_LENGTH(__VA_ARGS__), __VA_ARGS__ -+#define SNDRV_CTL_TLVD_LENGTH(...) \ -+ ((unsigned int)sizeof((const unsigned int[]) { __VA_ARGS__ })) -+ -+/* Accessor offsets for TLV data items */ -+#define SNDRV_CTL_TLVO_TYPE 0 -+#define SNDRV_CTL_TLVO_LEN 1 -+ -+#define SNDRV_CTL_TLVD_CONTAINER_ITEM(...) \ -+ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_CONTAINER, __VA_ARGS__) -+#define SNDRV_CTL_TLVD_DECLARE_CONTAINER(name, ...) \ -+ unsigned int name[] = { \ -+ SNDRV_CTL_TLVD_CONTAINER_ITEM(__VA_ARGS__) \ -+ } -+ -+#define SNDRV_CTL_TLVD_DB_SCALE_MASK 0xffff -+#define SNDRV_CTL_TLVD_DB_SCALE_MUTE 0x10000 -+#define SNDRV_CTL_TLVD_DB_SCALE_ITEM(min, step, mute) \ -+ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_SCALE, \ -+ (min), \ -+ ((step) & SNDRV_CTL_TLVD_DB_SCALE_MASK) | \ -+ ((mute) ? SNDRV_CTL_TLVD_DB_SCALE_MUTE : 0)) -+#define SNDRV_CTL_TLVD_DECLARE_DB_SCALE(name, min, step, mute) \ -+ unsigned int name[] = { \ -+ SNDRV_CTL_TLVD_DB_SCALE_ITEM(min, step, mute) \ -+ } -+ -+/* Accessor offsets for min, mute and step items in dB scale type TLV */ -+#define SNDRV_CTL_TLVO_DB_SCALE_MIN 2 -+#define SNDRV_CTL_TLVO_DB_SCALE_MUTE_AND_STEP 3 -+ -+/* dB scale specified with min/max values instead of step */ -+#define SNDRV_CTL_TLVD_DB_MINMAX_ITEM(min_dB, max_dB) \ -+ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_MINMAX, (min_dB), (max_dB)) -+#define SNDRV_CTL_TLVD_DB_MINMAX_MUTE_ITEM(min_dB, max_dB) \ -+ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_MINMAX_MUTE, (min_dB), (max_dB)) -+#define SNDRV_CTL_TLVD_DECLARE_DB_MINMAX(name, min_dB, max_dB) \ -+ unsigned int name[] = { \ -+ SNDRV_CTL_TLVD_DB_MINMAX_ITEM(min_dB, max_dB) \ -+ } -+#define SNDRV_CTL_TLVD_DECLARE_DB_MINMAX_MUTE(name, min_dB, max_dB) \ -+ unsigned int name[] = { \ -+ SNDRV_CTL_TLVD_DB_MINMAX_MUTE_ITEM(min_dB, max_dB) \ -+ } -+ -+/* Accessor offsets for min, max items in db-minmax types of TLV. */ -+#define SNDRV_CTL_TLVO_DB_MINMAX_MIN 2 -+#define SNDRV_CTL_TLVO_DB_MINMAX_MAX 3 -+ -+/* linear volume between min_dB and max_dB (.01dB unit) */ -+#define SNDRV_CTL_TLVD_DB_LINEAR_ITEM(min_dB, max_dB) \ -+ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_LINEAR, (min_dB), (max_dB)) -+#define SNDRV_CTL_TLVD_DECLARE_DB_LINEAR(name, min_dB, max_dB) \ -+ unsigned int name[] = { \ -+ SNDRV_CTL_TLVD_DB_LINEAR_ITEM(min_dB, max_dB) \ -+ } -+ -+/* Accessor offsets for min, max items in db-linear type of TLV. */ -+#define SNDRV_CTL_TLVO_DB_LINEAR_MIN 2 -+#define SNDRV_CTL_TLVO_DB_LINEAR_MAX 3 -+ -+/* dB range container: -+ * Items in dB range container must be ordered by their values and by their -+ * dB values. This implies that larger values must correspond with larger -+ * dB values (which is also required for all other mixer controls). -+ */ -+/* Each item is: */ -+#define SNDRV_CTL_TLVD_DB_RANGE_ITEM(...) \ -+ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_RANGE, __VA_ARGS__) -+#define SNDRV_CTL_TLVD_DECLARE_DB_RANGE(name, ...) \ -+ unsigned int name[] = { \ -+ SNDRV_CTL_TLVD_DB_RANGE_ITEM(__VA_ARGS__) \ -+ } -+ -+#define SNDRV_CTL_TLVD_DB_GAIN_MUTE -9999999 -+ -+#endif -diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h -index 11efce6d..101491a4 100644 ---- a/src/topology/tplg_local.h -+++ b/src/topology/tplg_local.h -@@ -18,8 +18,7 @@ - #include "list.h" - #include "topology.h" - --#define __packed __attribute__((__packed__)) -- -+#include - #include - #include - #include --- -2.24.1 - - -From 75584fe660880b332fbf60dd7968e2ed8b49a38b Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Fri, 20 Dec 2019 16:12:50 +0100 -Subject: [PATCH 30/69] type_compat: Add missing __s64 and __u64 definitions - for non-Linux - -Just for the case without Linux-compatible definitions. - -Signed-off-by: Takashi Iwai ---- - include/sound/type_compat.h | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/include/sound/type_compat.h b/include/sound/type_compat.h -index d4790c1f..5b765f44 100644 ---- a/include/sound/type_compat.h -+++ b/include/sound/type_compat.h -@@ -9,9 +9,11 @@ - typedef uint8_t __u8; - typedef uint16_t __u16; - typedef uint32_t __u32; -+typedef uint64_t __u64; - typedef int8_t __s8; - typedef int16_t __s16; - typedef int32_t __s32; -+typedef int64_t __s64; - - #include - #include --- -2.24.1 - - -From 59792f467b38d6a4c4dffdb30528f7fb03d23d96 Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Fri, 20 Dec 2019 17:12:37 +0100 -Subject: [PATCH 31/69] uapi: Move typedefs from uapi to sound/* - -For keeping uapi/*.h cleaner. - -Signed-off-by: Takashi Iwai ---- - include/sound/emu10k1.h | 9 +++++++++ - include/sound/hdsp.h | 10 ++++++++++ - include/sound/hdspm.h | 8 ++++++++ - include/sound/sb16_csp.h | 4 ++++ - include/sound/uapi/emu10k1.h | 10 ---------- - include/sound/uapi/hdsp.h | 9 --------- - include/sound/uapi/hdspm.h | 8 -------- - 7 files changed, 31 insertions(+), 27 deletions(-) - -diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h -index f06ecee5..0832f95b 100644 ---- a/include/sound/emu10k1.h -+++ b/include/sound/emu10k1.h -@@ -1,2 +1,11 @@ - #include - #include -+#ifndef __emu10k1_type_defined -+#define __emu10k1_type_defined -+typedef struct snd_emu10k1_fx8010_info emu10k1_fx8010_info_t; -+typedef struct snd_emu10k1_fx8010_control_gpr emu10k1_fx8010_control_gpr_t; -+typedef struct snd_emu10k1_fx8010_code emu10k1_fx8010_code_t; -+typedef struct snd_emu10k1_fx8010_tram emu10k1_fx8010_tram_t; -+typedef struct snd_emu10k1_fx8010_pcm_rec emu10k1_fx8010_pcm_t; -+typedef struct emu10k1_ctl_elem_id emu10k1_ctl_elem_id_t; -+#endif -diff --git a/include/sound/hdsp.h b/include/sound/hdsp.h -index 78fb745b..e8f93156 100644 ---- a/include/sound/hdsp.h -+++ b/include/sound/hdsp.h -@@ -1,2 +1,12 @@ - #include - #include -+#ifndef __hdsp_type_defined -+#define __hdsp_type_defined -+typedef enum HDSP_IO_Type HDSP_IO_Type; -+typedef struct hdsp_peak_rms hdsp_peak_rms_t; -+typedef struct hdsp_config_info hdsp_config_info_t; -+typedef struct hdsp_firmware hdsp_firmware_t; -+typedef struct hdsp_version hdsp_version_t; -+typedef struct hdsp_mixer hdsp_mixer_t; -+typedef struct hdsp_9632_aeb hdsp_9632_aeb_t; -+#endif -diff --git a/include/sound/hdspm.h b/include/sound/hdspm.h -index af6d19ed..d9095d9f 100644 ---- a/include/sound/hdspm.h -+++ b/include/sound/hdspm.h -@@ -1,2 +1,10 @@ - #include - #include -+#ifndef __hdspm_type_defined -+#define __hdspm_type_defined -+typedef struct hdspm_peak_rms hdspm_peak_rms_t; -+typedef struct hdspm_config_info hdspm_config_info_t; -+typedef struct hdspm_version hdspm_version_t; -+typedef struct hdspm_channelfader snd_hdspm_channelfader_t; -+typedef struct hdspm_mixer hdspm_mixer_t; -+#endif -diff --git a/include/sound/sb16_csp.h b/include/sound/sb16_csp.h -index 24121fcb..fd02bc56 100644 ---- a/include/sound/sb16_csp.h -+++ b/include/sound/sb16_csp.h -@@ -1 +1,5 @@ - #include -+#ifndef __sb16_csp_type_defined -+#define __sb16_csp_type_defined -+typedef struct snd_sb_csp_microcode snd_sb_csp_microcode_t; -+#endif -diff --git a/include/sound/uapi/emu10k1.h b/include/sound/uapi/emu10k1.h -index c1150e4d..6bcd76f6 100644 ---- a/include/sound/uapi/emu10k1.h -+++ b/include/sound/uapi/emu10k1.h -@@ -382,14 +382,4 @@ struct snd_emu10k1_fx8010_pcm_rec { - #define SNDRV_EMU10K1_IOCTL_SINGLE_STEP _IOW ('H', 0x83, int) - #define SNDRV_EMU10K1_IOCTL_DBG_READ _IOR ('H', 0x84, int) - --#ifndef __KERNEL__ --/* typedefs for compatibility to user-space */ --typedef struct snd_emu10k1_fx8010_info emu10k1_fx8010_info_t; --typedef struct snd_emu10k1_fx8010_control_gpr emu10k1_fx8010_control_gpr_t; --typedef struct snd_emu10k1_fx8010_code emu10k1_fx8010_code_t; --typedef struct snd_emu10k1_fx8010_tram emu10k1_fx8010_tram_t; --typedef struct snd_emu10k1_fx8010_pcm_rec emu10k1_fx8010_pcm_t; --typedef struct emu10k1_ctl_elem_id emu10k1_ctl_elem_id_t; --#endif -- - #endif /* _UAPI__SOUND_EMU10K1_H */ -diff --git a/include/sound/uapi/hdsp.h b/include/sound/uapi/hdsp.h -index 88c92a3f..7ac2d3f2 100644 ---- a/include/sound/uapi/hdsp.h -+++ b/include/sound/uapi/hdsp.h -@@ -97,13 +97,4 @@ struct hdsp_9632_aeb { - - #define SNDRV_HDSP_IOCTL_GET_9632_AEB _IOR('H', 0x45, struct hdsp_9632_aeb) - --/* typedefs for compatibility to user-space */ --typedef enum HDSP_IO_Type HDSP_IO_Type; --typedef struct hdsp_peak_rms hdsp_peak_rms_t; --typedef struct hdsp_config_info hdsp_config_info_t; --typedef struct hdsp_firmware hdsp_firmware_t; --typedef struct hdsp_version hdsp_version_t; --typedef struct hdsp_mixer hdsp_mixer_t; --typedef struct hdsp_9632_aeb hdsp_9632_aeb_t; -- - #endif /* __SOUND_HDSP_H */ -diff --git a/include/sound/uapi/hdspm.h b/include/sound/uapi/hdspm.h -index 2d91f90e..3fbfd9dc 100644 ---- a/include/sound/uapi/hdspm.h -+++ b/include/sound/uapi/hdspm.h -@@ -219,12 +219,4 @@ struct hdspm_mixer_ioctl { - /* use indirect access due to the limit of ioctl bit size */ - #define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdspm_mixer_ioctl) - --/* typedefs for compatibility to user-space */ --typedef struct hdspm_peak_rms hdspm_peak_rms_t; --typedef struct hdspm_config_info hdspm_config_info_t; --typedef struct hdspm_version hdspm_version_t; --typedef struct hdspm_channelfader snd_hdspm_channelfader_t; --typedef struct hdspm_mixer hdspm_mixer_t; -- -- - #endif --- -2.24.1 - - -From 9e2bbccfcc8069a676519149a280f20c1e05f0ac Mon Sep 17 00:00:00 2001 -From: David Ward -Date: Fri, 3 Jan 2020 13:05:51 -0500 -Subject: [PATCH 32/69] Update the attributes.m4 macro file from xine -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This file was imported from the xine project. Update it to the current -revision, which resolves the "no AC_LANG_SOURCE call detected in body" -warnings with Autoconf 2.68 or later. - -Cc: Diego Pettenò -Signed-off-by: David Ward -Signed-off-by: Jaroslav Kysela ---- - m4/attributes.m4 | 33 ++++++++++++++++++++------------- - 1 file changed, 20 insertions(+), 13 deletions(-) - -diff --git a/m4/attributes.m4 b/m4/attributes.m4 -index e86456a4..3d9c256a 100644 ---- a/m4/attributes.m4 -+++ b/m4/attributes.m4 -@@ -1,6 +1,6 @@ - dnl Macros to check the presence of generic (non-typed) symbols. --dnl Copyright (c) 2006-2007 Diego Pettenò --dnl Copyright (c) 2006-2007 xine project -+dnl Copyright (c) 2006-2008 Diego Pettenò -+dnl Copyright (c) 2006-2008 xine project - dnl - dnl This program is free software; you can redistribute it and/or modify - dnl it under the terms of the GNU General Public License as published by -@@ -25,7 +25,7 @@ dnl License when using or distributing such scripts, even though portions - dnl of the text of the Macro appear in them. The GNU General Public - dnl License (GPL) does govern all other use of the material that - dnl constitutes the Autoconf Macro. --dnl -+dnl - dnl This special exception to the GPL applies to versions of the - dnl Autoconf Macro released by this project. When you make and - dnl distribute a modified version of the Autoconf Macro, you may extend -@@ -39,7 +39,7 @@ AC_DEFUN([CC_CHECK_CFLAGS_SILENT], [ - AC_CACHE_VAL(AS_TR_SH([cc_cv_cflags_$1]), - [ac_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $1" -- AC_COMPILE_IFELSE([int a;], -+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([int a;])], - [eval "AS_TR_SH([cc_cv_cflags_$1])='yes'"], - [eval "AS_TR_SH([cc_cv_cflags_$1])='no'"]) - CFLAGS="$ac_save_CFLAGS" -@@ -71,7 +71,7 @@ AC_DEFUN([CC_CHECK_CFLAG_APPEND], [ - ) - - AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes], -- [CFLAGS="$CFLAGS $1"; $2], [$3]) -+ [CFLAGS="$CFLAGS $1"; DEBUG_CFLAGS="$DEBUG_CFLAGS $1"; $2], [$3]) - ]) - - dnl CC_CHECK_CFLAGS_APPEND([FLAG1 FLAG2], [action-if-found], [action-if-not]) -@@ -89,7 +89,7 @@ AC_DEFUN([CC_CHECK_LDFLAGS], [ - AS_TR_SH([cc_cv_ldflags_$1]), - [ac_save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $1" -- AC_LINK_IFELSE([int main() { return 1; }], -+ AC_LINK_IFELSE([AC_LANG_SOURCE([int main() { return 1; }])], - [eval "AS_TR_SH([cc_cv_ldflags_$1])='yes'"], - [eval "AS_TR_SH([cc_cv_ldflags_$1])="]) - LDFLAGS="$ac_save_LDFLAGS" -@@ -109,14 +109,21 @@ AC_DEFUN([CC_NOUNDEFINED], [ - dnl FreeBSD (et al.) does not complete linking for shared objects when pthreads - dnl are requested, as different implementations are present; to avoid problems - dnl use -Wl,-z,defs only for those platform not behaving this way. -- *-freebsd*) ;; -+ dnl -+ dnl MinGW platforms: for libraries required -no-undefined, -+ dnl use it only for libraries in mingw32-w64 -+ -+ *-freebsd* | *-openbsd*) ;; -+ *-mingw*) -+ LDFLAGS_NOUNDEFINED="-no-undefined" -+ ;; - *) - dnl First of all check for the --no-undefined variant of GNU ld. This allows - dnl for a much more readable commandline, so that people can understand what - dnl it does without going to look for what the heck -z defs does. -- for possible_flags in "-Wl,--no-undefined" "-Wl,-z,defs"; do -+ for possible_flags in "-Wl,--no-undefined" "-Wl,-z,defs"; do - CC_CHECK_LDFLAGS([$possible_flags], [LDFLAGS_NOUNDEFINED="$possible_flags"]) -- break -+ if test "x$LDFLAGS_NOUNDEFINED" = "x"; then break; fi - done - ;; - esac -@@ -147,7 +154,7 @@ AC_DEFUN([CC_CHECK_ATTRIBUTE], [ - AS_TR_SH([cc_cv_attribute_$1]), - [ac_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $cc_cv_werror" -- AC_COMPILE_IFELSE([$3], -+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([$3])], - [eval "AS_TR_SH([cc_cv_attribute_$1])='yes'"], - [eval "AS_TR_SH([cc_cv_attribute_$1])='no'"]) - CFLAGS="$ac_save_CFLAGS" -@@ -257,7 +264,7 @@ AC_DEFUN([CC_FLAG_VISIBILITY], [ - cc_cv_flag_visibility='yes', - cc_cv_flag_visibility='no') - CFLAGS="$cc_flag_visibility_save_CFLAGS"]) -- -+ - AS_IF([test "x$cc_cv_flag_visibility" = "xyes"], - [AC_DEFINE([SUPPORT_FLAG_VISIBILITY], 1, - [Define this if the compiler supports the -fvisibility flag]) -@@ -295,11 +302,11 @@ AC_DEFUN([CC_ATTRIBUTE_ALIGNED], [ - [ac_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $cc_cv_werror" - for cc_attribute_align_try in 64 32 16 8 4 2; do -- AC_COMPILE_IFELSE([ -+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([ - int main() { - static char c __attribute__ ((aligned($cc_attribute_align_try))) = 0; - return c; -- }], [cc_cv_attribute_aligned=$cc_attribute_align_try; break]) -+ }])], [cc_cv_attribute_aligned=$cc_attribute_align_try; break]) - done - CFLAGS="$ac_save_CFLAGS" - ]) --- -2.24.1 - - -From f373bf1f6eea0f2037a7714e9b55aa65fa00b889 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Sat, 14 Dec 2019 13:36:09 +0100 -Subject: [PATCH 33/69] topology: avoid to use the atoi() directly when - expected - -Signed-off-by: Jaroslav Kysela ---- - src/topology/channel.c | 10 +-- - src/topology/ctl.c | 37 +++++----- - src/topology/dapm.c | 32 +++++---- - src/topology/data.c | 14 ++-- - src/topology/elem.c | 9 ++- - src/topology/ops.c | 2 +- - src/topology/parser.c | 29 ++++++++ - src/topology/pcm.c | 148 +++++++++++++++++--------------------- - src/topology/tplg_local.h | 2 + - 9 files changed, 150 insertions(+), 133 deletions(-) - -diff --git a/src/topology/channel.c b/src/topology/channel.c -index 60f7e219..4569eb31 100644 ---- a/src/topology/channel.c -+++ b/src/topology/channel.c -@@ -80,8 +80,8 @@ int tplg_parse_channel(snd_tplg_t *tplg, snd_config_t *cfg, - snd_config_iterator_t i, next; - snd_config_t *n; - struct snd_soc_tplg_channel *channel = private; -- const char *id, *value; -- int channel_id; -+ const char *id; -+ int channel_id, value; - - if (tplg->channel_idx >= SND_SOC_TPLG_MAX_CHAN) - return -EINVAL; -@@ -109,13 +109,13 @@ int tplg_parse_channel(snd_tplg_t *tplg, snd_config_t *cfg, - continue; - - /* get value */ -- if (snd_config_get_string(n, &value) < 0) -+ if (tplg_get_integer(n, &value, 0) < 0) - continue; - - if (strcmp(id, "reg") == 0) -- channel->reg = atoi(value); -+ channel->reg = value; - else if (strcmp(id, "shift") == 0) -- channel->shift = atoi(value); -+ channel->shift = value; - - tplg_dbg("\t\t%s = %s\n", id, value); - } -diff --git a/src/topology/ctl.c b/src/topology/ctl.c -index 1db0b16e..e1896f46 100644 ---- a/src/topology/ctl.c -+++ b/src/topology/ctl.c -@@ -286,7 +286,8 @@ static int tplg_parse_tlv_dbscale(snd_config_t *cfg, struct tplg_elem *elem) - snd_config_t *n; - struct snd_soc_tplg_ctl_tlv *tplg_tlv; - struct snd_soc_tplg_tlv_dbscale *scale; -- const char *id = NULL, *value = NULL; -+ const char *id = NULL; -+ int val; - - tplg_dbg(" scale: %s\n", elem->id); - -@@ -310,18 +311,18 @@ static int tplg_parse_tlv_dbscale(snd_config_t *cfg, struct tplg_elem *elem) - } - - /* get value */ -- if (snd_config_get_string(n, &value) < 0) -+ if (tplg_get_integer(n, &val, 0)) - continue; - -- tplg_dbg("\t%s = %s\n", id, value); -+ tplg_dbg("\t%s = %i\n", id, val); - - /* get TLV data */ - if (strcmp(id, "min") == 0) -- scale->min = atoi(value); -+ scale->min = val; - else if (strcmp(id, "step") == 0) -- scale->step = atoi(value); -+ scale->step = val; - else if (strcmp(id, "mute") == 0) -- scale->mute = atoi(value); -+ scale->mute = val; - else - SNDERR("error: unknown key %s\n", id); - } -@@ -372,7 +373,7 @@ int tplg_parse_control_bytes(snd_tplg_t *tplg, - snd_config_iterator_t i, next; - snd_config_t *n; - const char *id, *val = NULL; -- int err; -+ int err, ival; - bool access_set = false, tlv_set = false; - - elem = tplg_elem_new_common(tplg, cfg, NULL, SND_TPLG_TYPE_BYTES); -@@ -398,37 +399,37 @@ int tplg_parse_control_bytes(snd_tplg_t *tplg, - continue; - - if (strcmp(id, "base") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ if (tplg_get_integer(n, &ival, 0)) - return -EINVAL; - -- be->base = atoi(val); -+ be->base = ival; - tplg_dbg("\t%s: %d\n", id, be->base); - continue; - } - - if (strcmp(id, "num_regs") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ if (tplg_get_integer(n, &ival, 0)) - return -EINVAL; - -- be->num_regs = atoi(val); -+ be->num_regs = ival; - tplg_dbg("\t%s: %d\n", id, be->num_regs); - continue; - } - - if (strcmp(id, "max") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ if (tplg_get_integer(n, &ival, 0)) - return -EINVAL; - -- be->max = atoi(val); -+ be->max = ival; - tplg_dbg("\t%s: %d\n", id, be->max); - continue; - } - - if (strcmp(id, "mask") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ if (tplg_get_integer(n, &ival, 16)) - return -EINVAL; - -- be->mask = strtol(val, NULL, 16); -+ be->mask = ival; - tplg_dbg("\t%s: %d\n", id, be->mask); - continue; - } -@@ -598,7 +599,7 @@ int tplg_parse_control_mixer(snd_tplg_t *tplg, - snd_config_iterator_t i, next; - snd_config_t *n; - const char *id, *val = NULL; -- int err, j; -+ int err, j, ival; - bool access_set = false, tlv_set = false; - - elem = tplg_elem_new_common(tplg, cfg, NULL, SND_TPLG_TYPE_MIXER); -@@ -647,10 +648,10 @@ int tplg_parse_control_mixer(snd_tplg_t *tplg, - } - - if (strcmp(id, "max") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ if (tplg_get_integer(n, &ival, 0)) - return -EINVAL; - -- mc->max = atoi(val); -+ mc->max = ival; - tplg_dbg("\t%s: %d\n", id, mc->max); - continue; - } -diff --git a/src/topology/dapm.c b/src/topology/dapm.c -index ce469131..c6fd793d 100644 ---- a/src/topology/dapm.c -+++ b/src/topology/dapm.c -@@ -426,7 +426,7 @@ int tplg_parse_dapm_graph(snd_tplg_t *tplg, snd_config_t *cfg, - snd_config_iterator_t i, next; - snd_config_t *n; - int err; -- const char *graph_id, *val = NULL; -+ const char *graph_id; - int index = -1; - - if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) { -@@ -445,9 +445,10 @@ int tplg_parse_dapm_graph(snd_tplg_t *tplg, snd_config_t *cfg, - } - - if (strcmp(id, "index") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ if (tplg_get_integer(n, &index, 0)) -+ return -EINVAL; -+ if (index < 0) - return -EINVAL; -- index = atoi(val); - } - - if (strcmp(id, "lines") == 0) { -@@ -479,6 +480,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, - snd_config_t *n; - const char *id, *val = NULL; - int widget_type, err; -+ int ival; - - elem = tplg_elem_new_common(tplg, cfg, NULL, SND_TPLG_TYPE_DAPM_WIDGET); - if (!elem) -@@ -540,55 +542,55 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, - } - - if (strcmp(id, "shift") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ if (tplg_get_integer(n, &ival, 0)) - return -EINVAL; - -- widget->shift = atoi(val); -+ widget->shift = ival; - tplg_dbg("\t%s: %d\n", id, widget->shift); - continue; - } - - if (strcmp(id, "reg") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ if (tplg_get_integer(n, &ival, 0)) - return -EINVAL; - -- widget->reg = atoi(val); -+ widget->reg = ival; - tplg_dbg("\t%s: %d\n", id, widget->reg); - continue; - } - - if (strcmp(id, "invert") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ if (tplg_get_integer(n, &ival, 0)) - return -EINVAL; - -- widget->invert = atoi(val); -+ widget->invert = ival; - tplg_dbg("\t%s: %d\n", id, widget->invert); - continue; - } - - if (strcmp(id, "subseq") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ if (tplg_get_integer(n, &ival, 0)) - return -EINVAL; - -- widget->subseq= atoi(val); -+ widget->subseq = ival; - tplg_dbg("\t%s: %d\n", id, widget->subseq); - continue; - } - - if (strcmp(id, "event_type") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ if (tplg_get_integer(n, &ival, 0)) - return -EINVAL; - -- widget->event_type = atoi(val); -+ widget->event_type = ival; - tplg_dbg("\t%s: %d\n", id, widget->event_type); - continue; - } - - if (strcmp(id, "event_flags") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ if (tplg_get_integer(n, &ival, 0)) - return -EINVAL; - -- widget->event_flags = atoi(val); -+ widget->event_flags = ival; - tplg_dbg("\t%s: %d\n", id, widget->event_flags); - continue; - } -diff --git a/src/topology/data.c b/src/topology/data.c -index 729ce1f4..0edfe54f 100644 ---- a/src/topology/data.c -+++ b/src/topology/data.c -@@ -800,10 +800,10 @@ int tplg_parse_tokens(snd_tplg_t *tplg, snd_config_t *cfg, - { - snd_config_iterator_t i, next; - snd_config_t *n; -- const char *id, *value; -+ const char *id; - struct tplg_elem *elem; - struct tplg_vendor_tokens *tokens; -- int num_tokens = 0; -+ int num_tokens = 0, value; - - elem = tplg_elem_new_common(tplg, cfg, NULL, SND_TPLG_TYPE_TOKEN); - if (!elem) -@@ -830,12 +830,12 @@ int tplg_parse_tokens(snd_tplg_t *tplg, snd_config_t *cfg, - if (snd_config_get_id(n, &id) < 0) - continue; - -- if (snd_config_get_string(n, &value) < 0) -+ if (tplg_get_integer(n, &value, 0)) - continue; - - snd_strlcpy(tokens->token[tokens->num_tokens].id, id, - SNDRV_CTL_ELEM_ID_NAME_MAXLEN); -- tokens->token[tokens->num_tokens].value = atoi(value); -+ tokens->token[tokens->num_tokens].value = value; - tplg_dbg("\t\t %s : %d\n", tokens->token[tokens->num_tokens].id, - tokens->token[tokens->num_tokens].value); - tokens->num_tokens++; -@@ -1013,7 +1013,7 @@ int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg, - snd_config_iterator_t i, next; - snd_config_t *n; - const char *id, *val = NULL; -- int err = 0; -+ int err = 0, ival; - struct tplg_elem *elem; - - elem = tplg_elem_new_common(tplg, cfg, NULL, SND_TPLG_TYPE_DATA); -@@ -1071,10 +1071,10 @@ int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg, - } - - if (strcmp(id, "type") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ if (tplg_get_integer(n, &ival, 0)) - return -EINVAL; - -- elem->vendor_type = atoi(val); -+ elem->vendor_type = ival; - tplg_dbg("\t%s: %d\n", id, elem->index); - continue; - } -diff --git a/src/topology/elem.c b/src/topology/elem.c -index d8618cc9..f2076f79 100644 ---- a/src/topology/elem.c -+++ b/src/topology/elem.c -@@ -153,7 +153,7 @@ struct tplg_elem* tplg_elem_new_common(snd_tplg_t *tplg, - enum snd_tplg_type type) - { - struct tplg_elem *elem; -- const char *id, *val = NULL; -+ const char *id; - int obj_size = 0; - void *obj; - snd_config_iterator_t i, next; -@@ -178,11 +178,14 @@ struct tplg_elem* tplg_elem_new_common(snd_tplg_t *tplg, - if (snd_config_get_id(n, &id)) - continue; - if (strcmp(id, "index") == 0) { -- if (snd_config_get_string(n, &val) < 0) { -+ if (tplg_get_integer(n, &elem->index, 0)) { -+ free(elem); -+ return NULL; -+ } -+ if (elem->index < 0) { - free(elem); - return NULL; - } -- elem->index = atoi(val); - } - } - } else if (name != NULL) -diff --git a/src/topology/ops.c b/src/topology/ops.c -index 0f4295a2..073acdcb 100644 ---- a/src/topology/ops.c -+++ b/src/topology/ops.c -@@ -42,7 +42,7 @@ static int lookup_ops(const char *c) - } - - /* cant find string name in our table so we use its ID number */ -- return atoi(c); -+ return strtol(c, NULL, 0); - } - - /* Parse Control operations. Ops can come from standard names above or -diff --git a/src/topology/parser.c b/src/topology/parser.c -index 5940692d..7e657809 100644 ---- a/src/topology/parser.c -+++ b/src/topology/parser.c -@@ -21,6 +21,35 @@ - #include "list.h" - #include "tplg_local.h" - -+/* -+ * Get integer value -+ */ -+int tplg_get_integer(snd_config_t *n, int *val, int base) -+{ -+ const char *str; -+ long lval; -+ int err; -+ -+ switch (snd_config_get_type(n)) { -+ case SND_CONFIG_TYPE_INTEGER: -+ err = snd_config_get_integer(n, &lval); -+ if (err < 0) -+ return err; -+ if (lval < INT_MIN || lval > INT_MAX) -+ return -EINVAL; -+ *val = lval; -+ return err; -+ case SND_CONFIG_TYPE_STRING: -+ err = snd_config_get_string(n, &str); -+ if (err < 0) -+ return err; -+ *val = strtol(str, NULL, base); -+ return 0; -+ default: -+ return -EINVAL; -+ } -+} -+ - /* - * Parse compound - */ -diff --git a/src/topology/pcm.c b/src/topology/pcm.c -index 98a8df97..d6c52b47 100644 ---- a/src/topology/pcm.c -+++ b/src/topology/pcm.c -@@ -368,6 +368,24 @@ static int split_rate(struct snd_soc_tplg_stream_caps *caps, char *str) - return 0; - } - -+static int parse_unsigned(snd_config_t *n, unsigned int *dst) -+{ -+ int ival; -+ -+ if (tplg_get_integer(n, &ival, 0) < 0) -+ return -EINVAL; -+ -+ *dst = ival; -+#if TPLG_DEBUG -+ { -+ const char *id; -+ if (snd_config_get_id(n, &id) >= 0) -+ tplg_dbg("\t\t%s: %d\n", id, *dst); -+ } -+#endif -+ return 0; -+} -+ - /* Parse pcm stream capabilities */ - int tplg_parse_stream_caps(snd_tplg_t *tplg, - snd_config_t *cfg, -@@ -402,10 +420,10 @@ int tplg_parse_stream_caps(snd_tplg_t *tplg, - if (id[0] == '#') - continue; - -- if (snd_config_get_string(n, &val) < 0) -- return -EINVAL; -- - if (strcmp(id, "formats") == 0) { -+ if (snd_config_get_string(n, &val) < 0) -+ return -EINVAL; -+ - s = strdup(val); - if (s == NULL) - return -ENOMEM; -@@ -421,6 +439,9 @@ int tplg_parse_stream_caps(snd_tplg_t *tplg, - } - - if (strcmp(id, "rates") == 0) { -+ if (snd_config_get_string(n, &val) < 0) -+ return -EINVAL; -+ - s = strdup(val); - if (!s) - return -ENOMEM; -@@ -436,68 +457,68 @@ int tplg_parse_stream_caps(snd_tplg_t *tplg, - } - - if (strcmp(id, "rate_min") == 0) { -- sc->rate_min = atoi(val); -- tplg_dbg("\t\t%s: %d\n", id, sc->rate_min); -+ if (parse_unsigned(n, &sc->rate_min)) -+ return -EINVAL; - continue; - } - - if (strcmp(id, "rate_max") == 0) { -- sc->rate_max = atoi(val); -- tplg_dbg("\t\t%s: %d\n", id, sc->rate_max); -+ if (parse_unsigned(n, &sc->rate_max)) -+ return -EINVAL; - continue; - } - - if (strcmp(id, "channels_min") == 0) { -- sc->channels_min = atoi(val); -- tplg_dbg("\t\t%s: %d\n", id, sc->channels_min); -+ if (parse_unsigned(n, &sc->channels_min)) -+ return -EINVAL; - continue; - } - - if (strcmp(id, "channels_max") == 0) { -- sc->channels_max = atoi(val); -- tplg_dbg("\t\t%s: %d\n", id, sc->channels_max); -+ if (parse_unsigned(n, &sc->channels_max)) -+ return -EINVAL; - continue; - } - - if (strcmp(id, "periods_min") == 0) { -- sc->periods_min = atoi(val); -- tplg_dbg("\t\t%s: %d\n", id, sc->periods_min); -+ if (parse_unsigned(n, &sc->periods_min)) -+ return -EINVAL; - continue; - } - - if (strcmp(id, "periods_max") == 0) { -- sc->periods_max = atoi(val); -- tplg_dbg("\t\t%s: %d\n", id, sc->periods_max); -+ if (parse_unsigned(n, &sc->periods_max)) -+ return -EINVAL; - continue; - } - - if (strcmp(id, "period_size_min") == 0) { -- sc->period_size_min = atoi(val); -- tplg_dbg("\t\t%s: %d\n", id, sc->period_size_min); -+ if (parse_unsigned(n, &sc->period_size_min)) -+ return -EINVAL; - continue; - } - - if (strcmp(id, "period_size_max") == 0) { -- sc->period_size_max = atoi(val); -- tplg_dbg("\t\t%s: %d\n", id, sc->period_size_max); -+ if (parse_unsigned(n, &sc->period_size_max)) -+ return -EINVAL; - continue; - } - - if (strcmp(id, "buffer_size_min") == 0) { -- sc->buffer_size_min = atoi(val); -- tplg_dbg("\t\t%s: %d\n", id, sc->buffer_size_min); -+ if (parse_unsigned(n, &sc->buffer_size_min)) -+ return -EINVAL; - continue; - } - - if (strcmp(id, "buffer_size_max") == 0) { -- sc->buffer_size_max = atoi(val); -- tplg_dbg("\t\t%s: %d\n", id, sc->buffer_size_max); -+ if (parse_unsigned(n, &sc->buffer_size_max)) -+ return -EINVAL; - continue; - } - - if (strcmp(id, "sig_bits") == 0) { -- sc->sig_bits = atoi(val); -- tplg_dbg("\t\t%s: %d\n", id, sc->sig_bits); -+ if (parse_unsigned(n, &sc->sig_bits)) -+ return -EINVAL; - continue; - } - -@@ -674,11 +695,8 @@ int tplg_parse_pcm(snd_tplg_t *tplg, snd_config_t *cfg, - continue; - - if (strcmp(id, "id") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ if (parse_unsigned(n, &pcm->pcm_id)) - return -EINVAL; -- -- pcm->pcm_id = atoi(val); -- tplg_dbg("\t%s: %d\n", id, pcm->pcm_id); - continue; - } - -@@ -784,30 +802,21 @@ int tplg_parse_dai(snd_tplg_t *tplg, snd_config_t *cfg, - continue; - - if (strcmp(id, "id") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ if (parse_unsigned(n, &dai->dai_id)) - return -EINVAL; -- -- dai->dai_id = atoi(val); -- tplg_dbg("\t%s: %d\n", id, dai->dai_id); - continue; - } - - if (strcmp(id, "playback") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ if (parse_unsigned(n, &dai->playback)) - return -EINVAL; -- -- dai->playback = atoi(val); -- tplg_dbg("\t%s: %d\n", id, dai->playback); - continue; - } - - - if (strcmp(id, "capture") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ if (parse_unsigned(n, &dai->capture)) - return -EINVAL; -- -- dai->capture = atoi(val); -- tplg_dbg("\t%s: %d\n", id, dai->capture); - continue; - } - -@@ -949,11 +958,8 @@ int tplg_parse_link(snd_tplg_t *tplg, - continue; - - if (strcmp(id, "id") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ if (parse_unsigned(n, &link->id)) - return -EINVAL; -- -- link->id = atoi(val); -- tplg_dbg("\t%s: %d\n", id, link->id); - continue; - } - -@@ -975,10 +981,8 @@ int tplg_parse_link(snd_tplg_t *tplg, - } - - if (strcmp(id, "default_hw_conf_id") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ if (parse_unsigned(n, &link->default_hw_config_id)) - return -EINVAL; -- -- link->default_hw_config_id = atoi(val); - continue; - } - -@@ -1030,7 +1034,7 @@ int tplg_parse_cc(snd_tplg_t *tplg, - struct tplg_elem *elem; - snd_config_iterator_t i, next; - snd_config_t *n; -- const char *id, *val = NULL; -+ const char *id; - - elem = tplg_elem_new_common(tplg, cfg, NULL, SND_TPLG_TYPE_CC); - if (!elem) -@@ -1054,11 +1058,8 @@ int tplg_parse_cc(snd_tplg_t *tplg, - continue; - - if (strcmp(id, "id") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ if (parse_unsigned(n, &link->id)) - return -EINVAL; -- -- link->id = atoi(val); -- tplg_dbg("\t%s: %d\n", id, link->id); - continue; - } - -@@ -1130,11 +1131,8 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, - continue; - - if (strcmp(id, "id") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ if (parse_unsigned(n, &hw_cfg->id)) - return -EINVAL; -- -- hw_cfg->id = atoi(val); -- tplg_dbg("\t%s: %d\n", id, hw_cfg->id); - continue; - } - -@@ -1173,10 +1171,8 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, - - if (strcmp(id, "bclk_freq") == 0 || - strcmp(id, "bclk_rate") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ if (parse_unsigned(n, &hw_cfg->bclk_rate)) - return -EINVAL; -- -- hw_cfg->bclk_rate = atoi(val); - continue; - } - -@@ -1223,19 +1219,15 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, - - if (strcmp(id, "fsync_freq") == 0 || - strcmp(id, "fsync_rate") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ if (parse_unsigned(n, &hw_cfg->fsync_rate)) - return -EINVAL; -- -- hw_cfg->fsync_rate = atoi(val); - continue; - } - - if (strcmp(id, "mclk_freq") == 0 || - strcmp(id, "mclk_rate") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ if (parse_unsigned(n, &hw_cfg->mclk_rate)) - return -EINVAL; -- -- hw_cfg->mclk_rate = atoi(val); - continue; - } - -@@ -1275,50 +1267,38 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, - } - - if (strcmp(id, "tdm_slots") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ if (parse_unsigned(n, &hw_cfg->tdm_slots)) - return -EINVAL; -- -- hw_cfg->tdm_slots = atoi(val); - continue; - } - - if (strcmp(id, "tdm_slot_width") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ if (parse_unsigned(n, &hw_cfg->tdm_slot_width)) - return -EINVAL; -- -- hw_cfg->tdm_slot_width = atoi(val); - continue; - } - - if (strcmp(id, "tx_slots") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ if (parse_unsigned(n, &hw_cfg->tx_slots)) - return -EINVAL; -- -- hw_cfg->tx_slots = atoi(val); - continue; - } - - if (strcmp(id, "rx_slots") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ if (parse_unsigned(n, &hw_cfg->rx_slots)) - return -EINVAL; -- -- hw_cfg->rx_slots = atoi(val); - continue; - } - - if (strcmp(id, "tx_channels") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ if (parse_unsigned(n, &hw_cfg->tx_channels)) - return -EINVAL; -- -- hw_cfg->tx_channels = atoi(val); - continue; - } - - if (strcmp(id, "rx_channels") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ if (parse_unsigned(n, &hw_cfg->rx_channels)) - return -EINVAL; -- -- hw_cfg->rx_channels = atoi(val); - continue; - } - -diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h -index 101491a4..991e0b41 100644 ---- a/src/topology/tplg_local.h -+++ b/src/topology/tplg_local.h -@@ -280,6 +280,8 @@ struct tplg_elem *tplg_elem_lookup(struct list_head *base, - struct tplg_elem* tplg_elem_new_common(snd_tplg_t *tplg, - snd_config_t *cfg, const char *name, enum snd_tplg_type type); - -+int tplg_get_integer(snd_config_t *n, int *val, int base); -+ - int tplg_parse_channel(snd_tplg_t *tplg ATTRIBUTE_UNUSED, - snd_config_t *cfg, void *private); - --- -2.24.1 - - -From 5925a6d870331c631f85ed4e18a8c5e6459b3c36 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Sat, 14 Dec 2019 13:50:04 +0100 -Subject: [PATCH 34/69] topology: use snd_config_get_bool() instead own - implementation - -Signed-off-by: Jaroslav Kysela ---- - src/topology/ctl.c | 9 +++------ - src/topology/dapm.c | 9 ++++----- - src/topology/data.c | 15 ++++++++++++--- - src/topology/pcm.c | 29 +++++++++++++++-------------- - 4 files changed, 34 insertions(+), 28 deletions(-) - -diff --git a/src/topology/ctl.c b/src/topology/ctl.c -index e1896f46..9190efef 100644 ---- a/src/topology/ctl.c -+++ b/src/topology/ctl.c -@@ -657,13 +657,10 @@ int tplg_parse_control_mixer(snd_tplg_t *tplg, - } - - if (strcmp(id, "invert") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ ival = snd_config_get_bool(n); -+ if (ival < 0) - return -EINVAL; -- -- if (strcmp(val, "true") == 0) -- mc->invert = 1; -- else if (strcmp(val, "false") == 0) -- mc->invert = 0; -+ mc->invert = ival; - - tplg_dbg("\t%s: %d\n", id, mc->invert); - continue; -diff --git a/src/topology/dapm.c b/src/topology/dapm.c -index c6fd793d..ad709210 100644 ---- a/src/topology/dapm.c -+++ b/src/topology/dapm.c -@@ -479,8 +479,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, - snd_config_iterator_t i, next; - snd_config_t *n; - const char *id, *val = NULL; -- int widget_type, err; -- int ival; -+ int widget_type, err, ival; - - elem = tplg_elem_new_common(tplg, cfg, NULL, SND_TPLG_TYPE_DAPM_WIDGET); - if (!elem) -@@ -531,11 +530,11 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, - } - - if (strcmp(id, "no_pm") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ ival = snd_config_get_bool(n); -+ if (ival < 0) - return -EINVAL; - -- if (strcmp(val, "true") == 0) -- widget->reg = -1; -+ widget->reg = ival ? -1 : 0; - - tplg_dbg("\t%s: %s\n", id, val); - continue; -diff --git a/src/topology/data.c b/src/topology/data.c -index 0edfe54f..6b1337b3 100644 ---- a/src/topology/data.c -+++ b/src/topology/data.c -@@ -557,6 +557,7 @@ static int parse_tuple_set(snd_config_t *cfg, - unsigned int type, num_tuples = 0; - struct tplg_tuple *tuple; - unsigned long int tuple_val; -+ int ival; - - snd_config_get_id(cfg, &id); - -@@ -607,25 +608,33 @@ static int parse_tuple_set(snd_config_t *cfg, - - switch (type) { - case SND_SOC_TPLG_TUPLE_TYPE_UUID: -+ if (snd_config_get_string(n, &value) < 0) -+ continue; - if (get_uuid(value, tuple->uuid) < 0) - goto err; - break; - - case SND_SOC_TPLG_TUPLE_TYPE_STRING: -+ if (snd_config_get_string(n, &value) < 0) -+ continue; - snd_strlcpy(tuple->string, value, - SNDRV_CTL_ELEM_ID_NAME_MAXLEN); - tplg_dbg("\t\t%s = %s\n", tuple->token, tuple->string); - break; - - case SND_SOC_TPLG_TUPLE_TYPE_BOOL: -- if (strcmp(value, "true") == 0) -- tuple->value = 1; -+ ival = snd_config_get_bool(n); -+ if (ival < 0) -+ continue; -+ tuple->value = ival; - tplg_dbg("\t\t%s = %d\n", tuple->token, tuple->value); - break; - - case SND_SOC_TPLG_TUPLE_TYPE_BYTE: - case SND_SOC_TPLG_TUPLE_TYPE_SHORT: - case SND_SOC_TPLG_TUPLE_TYPE_WORD: -+ if (snd_config_get_string(n, &value) < 0) -+ continue; - errno = 0; - /* no support for negative value */ - tuple_val = strtoul(value, NULL, 0); -@@ -1012,7 +1021,7 @@ int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg, - { - snd_config_iterator_t i, next; - snd_config_t *n; -- const char *id, *val = NULL; -+ const char *id; - int err = 0, ival; - struct tplg_elem *elem; - -diff --git a/src/topology/pcm.c b/src/topology/pcm.c -index d6c52b47..6364e24f 100644 ---- a/src/topology/pcm.c -+++ b/src/topology/pcm.c -@@ -669,8 +669,8 @@ int tplg_parse_pcm(snd_tplg_t *tplg, snd_config_t *cfg, - struct tplg_elem *elem; - snd_config_iterator_t i, next; - snd_config_t *n; -- const char *id, *val = NULL; -- int err; -+ const char *id; -+ int err, ival; - - elem = tplg_elem_new_common(tplg, cfg, NULL, SND_TPLG_TYPE_PCM); - if (!elem) -@@ -709,11 +709,11 @@ int tplg_parse_pcm(snd_tplg_t *tplg, snd_config_t *cfg, - } - - if (strcmp(id, "compress") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ ival = snd_config_get_bool(n); -+ if (ival < 0) - return -EINVAL; - -- if (strcmp(val, "true") == 0) -- pcm->compress = 1; -+ pcm->compress = ival; - - tplg_dbg("\t%s: %s\n", id, val); - continue; -@@ -1107,7 +1107,7 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, - snd_config_iterator_t i, next; - snd_config_t *n; - const char *id, *val = NULL; -- int ret; -+ int ret, ival; - - elem = tplg_elem_new_common(tplg, cfg, NULL, SND_TPLG_TYPE_HW_CONFIG); - if (!elem) -@@ -1178,11 +1178,11 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, - - if (strcmp(id, "bclk_invert") == 0 || - strcmp(id, "invert_bclk") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ ival = snd_config_get_bool(n); -+ if (ival < 0) - return -EINVAL; - -- if (!strcmp(val, "true")) -- hw_cfg->invert_bclk = true; -+ hw_cfg->invert_bclk = ival; - continue; - } - -@@ -1209,11 +1209,11 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, - - if (strcmp(id, "fsync_invert") == 0 || - strcmp(id, "invert_fsync") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ ival = snd_config_get_bool(n); -+ if (ival < 0) - return -EINVAL; - -- if (!strcmp(val, "true")) -- hw_cfg->invert_fsync = true; -+ hw_cfg->invert_fsync = ival; - continue; - } - -@@ -1254,10 +1254,11 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, - - if (strcmp(id, "pm_gate_clocks") == 0 || - strcmp(id, "clock_gated") == 0) { -- if (snd_config_get_string(n, &val) < 0) -+ ival = snd_config_get_bool(n); -+ if (ival < 0) - return -EINVAL; - -- if (!strcmp(val, "true")) -+ if (ival) - hw_cfg->clock_gated = - SND_SOC_TPLG_DAI_CLK_GATE_GATED; - else --- -2.24.1 - - -From 1047a5f3c0d39a3b0579db027f52d7facdf44077 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Sat, 14 Dec 2019 13:52:18 +0100 -Subject: [PATCH 35/69] topology: fix tplg_get_integer() - handle errno == - ERANGE - -Signed-off-by: Jaroslav Kysela ---- - src/topology/parser.c | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/src/topology/parser.c b/src/topology/parser.c -index 7e657809..667c8d45 100644 ---- a/src/topology/parser.c -+++ b/src/topology/parser.c -@@ -36,14 +36,19 @@ int tplg_get_integer(snd_config_t *n, int *val, int base) - if (err < 0) - return err; - if (lval < INT_MIN || lval > INT_MAX) -- return -EINVAL; -+ return -ERANGE; - *val = lval; - return err; - case SND_CONFIG_TYPE_STRING: - err = snd_config_get_string(n, &str); - if (err < 0) - return err; -+ errno = 0; - *val = strtol(str, NULL, base); -+ if (errno == ERANGE) -+ return -ERANGE; -+ if (errno && *val == 0) -+ return -EINVAL; - return 0; - default: - return -EINVAL; --- -2.24.1 - - -From 14e43a11873d14ec6f16967c83629237ef44ac38 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Sat, 14 Dec 2019 14:05:49 +0100 -Subject: [PATCH 36/69] topology: add tplg_get_unsigned() function - -Signed-off-by: Jaroslav Kysela ---- - src/topology/data.c | 19 +++++----------- - src/topology/parser.c | 47 +++++++++++++++++++++++++++++++++++++++ - src/topology/pcm.c | 13 ++--------- - src/topology/tplg_local.h | 1 + - 4 files changed, 55 insertions(+), 25 deletions(-) - -diff --git a/src/topology/data.c b/src/topology/data.c -index 6b1337b3..9807445e 100644 ---- a/src/topology/data.c -+++ b/src/topology/data.c -@@ -556,7 +556,7 @@ static int parse_tuple_set(snd_config_t *cfg, - struct tplg_tuple_set *set; - unsigned int type, num_tuples = 0; - struct tplg_tuple *tuple; -- unsigned long int tuple_val; -+ unsigned int tuple_val; - int ival; - - snd_config_get_id(cfg, &id); -@@ -598,10 +598,6 @@ static int parse_tuple_set(snd_config_t *cfg, - if (snd_config_get_id(n, &id) < 0) - continue; - -- /* get value */ -- if (snd_config_get_string(n, &value) < 0) -- continue; -- - tuple = &set->tuple[set->num_tuples]; - snd_strlcpy(tuple->token, id, - SNDRV_CTL_ELEM_ID_NAME_MAXLEN); -@@ -633,14 +629,9 @@ static int parse_tuple_set(snd_config_t *cfg, - case SND_SOC_TPLG_TUPLE_TYPE_BYTE: - case SND_SOC_TPLG_TUPLE_TYPE_SHORT: - case SND_SOC_TPLG_TUPLE_TYPE_WORD: -- if (snd_config_get_string(n, &value) < 0) -- continue; -- errno = 0; -- /* no support for negative value */ -- tuple_val = strtoul(value, NULL, 0); -- if ((errno == ERANGE && tuple_val == ULONG_MAX) -- || (errno != 0 && tuple_val == 0)) { -- SNDERR("error: tuple %s:strtoul fail\n", id); -+ ival = tplg_get_unsigned(n, &tuple_val, 0); -+ if (ival < 0) { -+ SNDERR("error: tuple %s: %s\n", id, snd_strerror(ival)); - goto err; - } - -@@ -654,7 +645,7 @@ static int parse_tuple_set(snd_config_t *cfg, - goto err; - } - -- tuple->value = (unsigned int) tuple_val; -+ tuple->value = tuple_val; - tplg_dbg("\t\t%s = 0x%x\n", tuple->token, tuple->value); - break; - -diff --git a/src/topology/parser.c b/src/topology/parser.c -index 667c8d45..f56ad97e 100644 ---- a/src/topology/parser.c -+++ b/src/topology/parser.c -@@ -55,6 +55,53 @@ int tplg_get_integer(snd_config_t *n, int *val, int base) - } - } - -+/* -+ * Get unsigned integer value -+ */ -+int tplg_get_unsigned(snd_config_t *n, unsigned *val, int base) -+{ -+ const char *str; -+ long lval; -+ long long llval; -+ unsigned long uval; -+ int err; -+ -+ switch (snd_config_get_type(n)) { -+ case SND_CONFIG_TYPE_INTEGER: -+ err = snd_config_get_integer(n, &lval); -+ if (err < 0) -+ return err; -+ if (lval < 0 || lval > UINT_MAX) -+ return -ERANGE; -+ *val = lval; -+ return err; -+ case SND_CONFIG_TYPE_INTEGER64: -+ err = snd_config_get_integer64(n, &llval); -+ if (err < 0) -+ return err; -+ if (llval < 0 || llval > UINT_MAX) -+ return -ERANGE; -+ *val = llval; -+ return err; -+ case SND_CONFIG_TYPE_STRING: -+ err = snd_config_get_string(n, &str); -+ if (err < 0) -+ return err; -+ errno = 0; -+ uval = strtoul(str, NULL, base); -+ if (errno == ERANGE && uval == ULONG_MAX) -+ return -ERANGE; -+ if (errno && uval == 0) -+ return -EINVAL; -+ if (uval > UINT_MAX) -+ return -ERANGE; -+ *val = uval; -+ return 0; -+ default: -+ return -EINVAL; -+ } -+} -+ - /* - * Parse compound - */ -diff --git a/src/topology/pcm.c b/src/topology/pcm.c -index 6364e24f..9b87549c 100644 ---- a/src/topology/pcm.c -+++ b/src/topology/pcm.c -@@ -606,8 +606,7 @@ static int tplg_parse_fe_dai(snd_tplg_t *tplg ATTRIBUTE_UNUSED, - struct snd_soc_tplg_pcm *pcm = elem->pcm; - snd_config_iterator_t i, next; - snd_config_t *n; -- const char *id, *value = NULL; -- unsigned long int id_val; -+ const char *id; - - snd_config_get_id(cfg, &id); - tplg_dbg("\t\tFE DAI %s:\n", id); -@@ -622,19 +621,11 @@ static int tplg_parse_fe_dai(snd_tplg_t *tplg ATTRIBUTE_UNUSED, - continue; - - if (strcmp(id, "id") == 0) { -- if (snd_config_get_string(n, &value) < 0) -- continue; -- errno = 0; -- /* no support for negative value */ -- id_val = strtoul(value, NULL, 0); -- if ((errno == ERANGE && id_val == ULONG_MAX) -- || (errno != 0 && id_val == 0) -- || id_val > UINT_MAX) { -+ if (tplg_get_unsigned(n, &pcm->dai_id, 0)) { - SNDERR("error: invalid fe dai ID\n"); - return -EINVAL; - } - -- pcm->dai_id = (int) id_val; - tplg_dbg("\t\t\tindex: %d\n", pcm->dai_id); - } - } -diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h -index 991e0b41..e16c78d4 100644 ---- a/src/topology/tplg_local.h -+++ b/src/topology/tplg_local.h -@@ -281,6 +281,7 @@ struct tplg_elem* tplg_elem_new_common(snd_tplg_t *tplg, - snd_config_t *cfg, const char *name, enum snd_tplg_type type); - - int tplg_get_integer(snd_config_t *n, int *val, int base); -+int tplg_get_unsigned(snd_config_t *n, unsigned *val, int base); - - int tplg_parse_channel(snd_tplg_t *tplg ATTRIBUTE_UNUSED, - snd_config_t *cfg, void *private); --- -2.24.1 - - -From 39fb37fef5bd3b3fa7a63e06a5f0a147197fddb9 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Sat, 14 Dec 2019 19:13:53 +0100 -Subject: [PATCH 37/69] topology: convert builder to use the mallocated memory - -Signed-off-by: Jaroslav Kysela ---- - src/topology/builder.c | 88 +++++++++++++++++++++++++++++++-------- - src/topology/parser.c | 74 +++++++++++++------------------- - src/topology/tplg_local.h | 5 ++- - 3 files changed, 103 insertions(+), 64 deletions(-) - -diff --git a/src/topology/builder.c b/src/topology/builder.c -index 1a22a453..40943b56 100644 ---- a/src/topology/builder.c -+++ b/src/topology/builder.c -@@ -29,7 +29,7 @@ static void verbose(snd_tplg_t *tplg, const char *fmt, ...) - return; - - va_start(va, fmt); -- fprintf(stdout, "0x%6.6zx/%6.6zd - ", tplg->out_pos, tplg->out_pos); -+ fprintf(stdout, "0x%6.6zx/%6.6zd - ", tplg->bin_pos, tplg->bin_pos); - vfprintf(stdout, fmt, va); - va_end(va); - } -@@ -37,18 +37,11 @@ static void verbose(snd_tplg_t *tplg, const char *fmt, ...) - /* write a block, track the position */ - static ssize_t twrite(snd_tplg_t *tplg, void *data, size_t data_size) - { -- ssize_t r = write(tplg->out_fd, data, data_size); -- if (r != (ssize_t)data_size) { -- if (r < 0) { -- SNDERR("error: unable to write: %s", strerror(errno)); -- return -errno; -- } -- tplg->out_pos += r; -- SNDERR("error: unable to write (partial)"); -+ if (tplg->bin_pos + data_size > tplg->bin_size) - return -EIO; -- } -- tplg->out_pos += r; -- return r; -+ memcpy(tplg->bin + tplg->bin_pos, data, data_size); -+ tplg->bin_pos += data_size; -+ return data_size; - } - - /* write out block header to output file */ -@@ -71,12 +64,12 @@ static ssize_t write_block_header(snd_tplg_t *tplg, unsigned int type, - hdr.count = count; - - /* make sure file offset is aligned with the calculated HDR offset */ -- if (tplg->out_pos != tplg->next_hdr_pos) { -+ if (tplg->bin_pos != tplg->next_hdr_pos) { - SNDERR("error: New header is at offset 0x%zx but file" - " offset 0x%zx is %s by %ld bytes\n", -- tplg->next_hdr_pos, tplg->out_pos, -- tplg->out_pos > tplg->next_hdr_pos ? "ahead" : "behind", -- labs(tplg->out_pos - tplg->next_hdr_pos)); -+ tplg->next_hdr_pos, tplg->bin_pos, -+ tplg->bin_pos > tplg->next_hdr_pos ? "ahead" : "behind", -+ labs(tplg->bin_pos - tplg->next_hdr_pos)); - return -EINVAL; - } - -@@ -163,6 +156,41 @@ static int write_elem_block(snd_tplg_t *tplg, - return 0; - } - -+static size_t calc_manifest_size(snd_tplg_t *tplg) -+{ -+ return sizeof(struct snd_soc_tplg_hdr) + -+ sizeof(tplg->manifest) + -+ tplg->manifest.priv.size; -+} -+ -+static size_t calc_real_size(struct list_head *base) -+{ -+ struct list_head *pos; -+ struct tplg_elem *elem, *elem_next; -+ size_t size = 0; -+ -+ list_for_each(pos, base) { -+ -+ elem = list_entry(pos, struct tplg_elem, list); -+ -+ /* compound elems have already been copied to other elems */ -+ if (elem->compound_elem) -+ continue; -+ -+ if (elem->size <= 0) -+ continue; -+ -+ size += elem->size; -+ -+ elem_next = list_entry(pos->next, struct tplg_elem, list); -+ -+ if ((pos->next == base) || (elem_next->index != elem->index)) -+ size += sizeof(struct snd_soc_tplg_hdr); -+ } -+ -+ return size; -+} -+ - static size_t calc_block_size(struct list_head *base) - { - struct list_head *pos; -@@ -277,9 +305,27 @@ int tplg_write_data(snd_tplg_t *tplg) - }; - - ssize_t ret; -- size_t size; -+ size_t total_size, size; - unsigned int index; - -+ /* calculate total size */ -+ total_size = calc_manifest_size(tplg); -+ for (index = 0; index < ARRAY_SIZE(wtable); index++) { -+ wptr = &wtable[index]; -+ size = calc_real_size(wptr->list); -+ total_size += size; -+ } -+ -+ /* allocate new binary output */ -+ free(tplg->bin); -+ tplg->bin = malloc(total_size); -+ tplg->bin_pos = 0; -+ tplg->bin_size = total_size; -+ if (tplg->bin == NULL) { -+ tplg->bin_size = 0; -+ return -ENOMEM; -+ } -+ - /* write manifest */ - ret = write_manifest_data(tplg); - if (ret < 0) { -@@ -306,7 +352,13 @@ int tplg_write_data(snd_tplg_t *tplg) - } - } - -- verbose(tplg, "total size is 0x%zx/%zd\n", tplg->out_pos, tplg->out_pos); -+ verbose(tplg, "total size is 0x%zx/%zd\n", tplg->bin_pos, tplg->bin_pos); -+ -+ if (total_size != tplg->bin_pos) { -+ SNDERR("total size mismatch (%zd != %zd)\n", -+ total_size, tplg->bin_pos); -+ return -EINVAL; -+ } - - return 0; - } -diff --git a/src/topology/parser.c b/src/topology/parser.c -index f56ad97e..98a9f9e9 100644 ---- a/src/topology/parser.c -+++ b/src/topology/parser.c -@@ -393,50 +393,29 @@ static int tplg_build_integ(snd_tplg_t *tplg) - return err; - } - --int snd_tplg_build_file(snd_tplg_t *tplg, const char *infile, -- const char *outfile) -+int snd_tplg_build_file(snd_tplg_t *tplg, -+ const char *infile, -+ const char *outfile) - { - snd_config_t *cfg = NULL; - int err = 0; - -- tplg->out_fd = -- open(outfile, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); -- if (tplg->out_fd < 0) { -- SNDERR("error: failed to open %s err %d\n", -- outfile, -errno); -- return -errno; -- } -- - err = tplg_load_config(infile, &cfg); - if (err < 0) { - SNDERR("error: failed to load topology file %s\n", - infile); -- goto out_close; -+ return err; - } - - err = tplg_parse_config(tplg, cfg); - if (err < 0) { - SNDERR("error: failed to parse topology\n"); -- goto out; -- } -- -- err = tplg_build_integ(tplg); -- if (err < 0) { -- SNDERR("error: failed to check topology integrity\n"); -- goto out; -- } -- -- err = tplg_write_data(tplg); -- if (err < 0) { -- SNDERR("error: failed to write data %d\n", err); -- goto out; -+ return err; - } - --out: - snd_config_delete(cfg); --out_close: -- close(tplg->out_fd); -- return err; -+ -+ return snd_tplg_build(tplg, outfile); - } - - int snd_tplg_add_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) -@@ -468,31 +447,38 @@ int snd_tplg_add_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) - - int snd_tplg_build(snd_tplg_t *tplg, const char *outfile) - { -- int err; -- -- tplg->out_fd = -- open(outfile, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); -- if (tplg->out_fd < 0) { -- SNDERR("error: failed to open %s err %d\n", -- outfile, -errno); -- return -errno; -- } -+ int fd, err; -+ ssize_t r; - - err = tplg_build_integ(tplg); - if (err < 0) { - SNDERR("error: failed to check topology integrity\n"); -- goto out; -+ return err; - } - - err = tplg_write_data(tplg); - if (err < 0) { - SNDERR("error: failed to write data %d\n", err); -- goto out; -+ return err; - } - --out: -- close(tplg->out_fd); -- return err; -+ fd = open(outfile, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); -+ if (fd < 0) { -+ SNDERR("error: failed to open %s err %d\n", outfile, -errno); -+ return -errno; -+ } -+ r = write(fd, tplg->bin, tplg->bin_size); -+ close(fd); -+ if (r < 0) { -+ err = -errno; -+ SNDERR("error: write error: %s\n", strerror(errno)); -+ return err; -+ } -+ if ((size_t)r != tplg->bin_size) { -+ SNDERR("error: partial write (%zd != %zd)\n", r, tplg->bin_size); -+ return -EIO; -+ } -+ return 0; - } - - int snd_tplg_set_manifest_data(snd_tplg_t *tplg, const void *data, int len) -@@ -571,8 +557,8 @@ snd_tplg_t *snd_tplg_new(void) - - void snd_tplg_free(snd_tplg_t *tplg) - { -- if (tplg->manifest_pdata) -- free(tplg->manifest_pdata); -+ free(tplg->bin); -+ free(tplg->manifest_pdata); - - tplg_elem_free_list(&tplg->tlv_list); - tplg_elem_free_list(&tplg->widget_list); -diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h -index e16c78d4..87e6c9a5 100644 ---- a/src/topology/tplg_local.h -+++ b/src/topology/tplg_local.h -@@ -60,8 +60,9 @@ typedef enum _snd_pcm_rates { - - struct snd_tplg { - /* out file */ -- int out_fd; -- size_t out_pos; -+ unsigned char *bin; -+ size_t bin_pos; -+ size_t bin_size; - - int verbose; - unsigned int version; --- -2.24.1 - - -From bee8d4fcaa52d00950d035ec561513c2b9e7cac7 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Sat, 14 Dec 2019 19:20:02 +0100 -Subject: [PATCH 38/69] topology: add binary output from the builder - -- snd_tplg_build_bin() -- snd_tplg_build_bin_file() - -Signed-off-by: Jaroslav Kysela ---- - include/topology.h | 22 +++++++++++- - src/topology/parser.c | 79 ++++++++++++++++++++++++++++++++++++------- - 2 files changed, 87 insertions(+), 14 deletions(-) - -diff --git a/include/topology.h b/include/topology.h -index 27da7308..c9ef554a 100644 ---- a/include/topology.h -+++ b/include/topology.h -@@ -791,7 +791,18 @@ void snd_tplg_free(snd_tplg_t *tplg); - * \return Zero on success, otherwise a negative error code - */ - int snd_tplg_build_file(snd_tplg_t *tplg, const char *infile, -- const char *outfile); -+ const char *outfile); -+ -+/** -+ * \brief Parse and build topology text file into binary file. -+ * \param tplg Topology instance. -+ * \param infile Topology text input file to be parsed -+ * \param bin Binary topology output buffer (malloc). -+ * \param size Binary topology output buffer size in bytes. -+ * \return Zero on success, otherwise a negative error code -+ */ -+int snd_tplg_build_bin_file(snd_tplg_t *tplg, const char *infile, -+ void **bin, size_t *size); - - /** - * \brief Enable verbose reporting of binary file output -@@ -1089,6 +1100,15 @@ int snd_tplg_add_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t); - */ - int snd_tplg_build(snd_tplg_t *tplg, const char *outfile); - -+/** -+ * \brief Build all registered topology data into memory. -+ * \param tplg Topology instance. -+ * \param bin Binary topology output buffer (malloc). -+ * \param size Binary topology output buffer size in bytes. -+ * \return Zero on success, otherwise a negative error code -+ */ -+int snd_tplg_build_bin(snd_tplg_t *tplg, void **bin, size_t *size); -+ - /** - * \brief Attach private data to topology manifest. - * \param tplg Topology instance. -diff --git a/src/topology/parser.c b/src/topology/parser.c -index 98a9f9e9..861565b7 100644 ---- a/src/topology/parser.c -+++ b/src/topology/parser.c -@@ -393,9 +393,7 @@ static int tplg_build_integ(snd_tplg_t *tplg) - return err; - } - --int snd_tplg_build_file(snd_tplg_t *tplg, -- const char *infile, -- const char *outfile) -+static int tplg_load(snd_tplg_t *tplg, const char *infile) - { - snd_config_t *cfg = NULL; - int err = 0; -@@ -414,10 +412,53 @@ int snd_tplg_build_file(snd_tplg_t *tplg, - } - - snd_config_delete(cfg); -+ return 0; -+} -+ -+static int tplg_build(snd_tplg_t *tplg) -+{ -+ int err; -+ -+ err = tplg_build_integ(tplg); -+ if (err < 0) { -+ SNDERR("error: failed to check topology integrity\n"); -+ return err; -+ } -+ -+ err = tplg_write_data(tplg); -+ if (err < 0) { -+ SNDERR("error: failed to write data %d\n", err); -+ return err; -+ } -+ return 0; -+} -+ -+int snd_tplg_build_file(snd_tplg_t *tplg, -+ const char *infile, -+ const char *outfile) -+{ -+ int err; -+ -+ err = tplg_load(tplg, infile); -+ if (err < 0) -+ return err; - - return snd_tplg_build(tplg, outfile); - } - -+int snd_tplg_build_bin_file(snd_tplg_t *tplg, -+ const char *infile, -+ void **bin, size_t *size) -+{ -+ int err; -+ -+ err = tplg_load(tplg, infile); -+ if (err < 0) -+ return err; -+ -+ return snd_tplg_build_bin(tplg, bin, size); -+} -+ - int snd_tplg_add_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) - { - switch (t->type) { -@@ -450,17 +491,9 @@ int snd_tplg_build(snd_tplg_t *tplg, const char *outfile) - int fd, err; - ssize_t r; - -- err = tplg_build_integ(tplg); -- if (err < 0) { -- SNDERR("error: failed to check topology integrity\n"); -- return err; -- } -- -- err = tplg_write_data(tplg); -- if (err < 0) { -- SNDERR("error: failed to write data %d\n", err); -+ err = tplg_build(tplg); -+ if (err < 0) - return err; -- } - - fd = open(outfile, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); - if (fd < 0) { -@@ -481,6 +514,26 @@ int snd_tplg_build(snd_tplg_t *tplg, const char *outfile) - return 0; - } - -+int snd_tplg_build_bin(snd_tplg_t *tplg, -+ void **bin, size_t *size) -+{ -+ int err; -+ -+ err = tplg_build(tplg); -+ if (err < 0) -+ return err; -+ -+ err = tplg_build(tplg); -+ if (err < 0) -+ return err; -+ -+ *bin = tplg->bin; -+ *size = tplg->bin_size; -+ tplg->bin = NULL; -+ tplg->bin_size = tplg->bin_pos = 0; -+ return 0; -+} -+ - int snd_tplg_set_manifest_data(snd_tplg_t *tplg, const void *data, int len) - { - if (len <= 0) --- -2.24.1 - - -From 22b66731f3dc0eb5149a99ff547eeb84eaf8d54b Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Sat, 14 Dec 2019 20:32:24 +0100 -Subject: [PATCH 39/69] topology: parser - recode tplg_parse_config() - -Signed-off-by: Jaroslav Kysela ---- - src/topology/parser.c | 225 +++++++++++++++----------------------- - src/topology/tplg_local.h | 67 +++--------- - 2 files changed, 108 insertions(+), 184 deletions(-) - -diff --git a/src/topology/parser.c b/src/topology/parser.c -index 861565b7..82af7cc5 100644 ---- a/src/topology/parser.c -+++ b/src/topology/parser.c -@@ -142,9 +142,88 @@ int tplg_parse_compound(snd_tplg_t *tplg, snd_config_t *cfg, - - static int tplg_parse_config(snd_tplg_t *tplg, snd_config_t *cfg) - { -+ static struct _parser { -+ const char *id; -+ int (*parser)(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); -+ } *p, parsers[] = { -+ { -+ .id = "SectionTLV", -+ .parser = tplg_parse_tlv -+ }, -+ { -+ .id = "SectionControlMixer", -+ .parser = tplg_parse_control_mixer -+ }, -+ { -+ .id = "SectionControlEnum", -+ .parser = tplg_parse_control_enum -+ }, -+ { -+ .id = "SectionControlBytes", -+ .parser = tplg_parse_control_bytes -+ }, -+ { -+ .id = "SectionWidget", -+ .parser = tplg_parse_dapm_widget -+ }, -+ { -+ .id = "SectionPCMCapabilities", -+ .parser = tplg_parse_stream_caps -+ }, -+ { -+ .id = "SectionPCM", -+ .parser = tplg_parse_pcm -+ }, -+ { -+ .id = "SectionDAI", -+ .parser = tplg_parse_dai -+ }, -+ { -+ .id = "SectionHWConfig", -+ .parser = tplg_parse_hw_config -+ }, -+ { -+ .id = "SectionLink", -+ .parser = tplg_parse_link -+ }, -+ { -+ .id = "SectionBE", -+ .parser = tplg_parse_link -+ }, -+ { -+ .id = "SectionCC", -+ .parser = tplg_parse_cc -+ }, -+ { -+ .id = "SectionGraph", -+ .parser = tplg_parse_dapm_graph -+ }, -+ { -+ .id = "SectionText", -+ .parser = tplg_parse_text -+ }, -+ { -+ .id = "SectionData", -+ .parser = tplg_parse_data -+ }, -+ { -+ .id = "SectionVendorTokens", -+ .parser = tplg_parse_tokens -+ }, -+ { -+ .id = "SectionVendorTuples", -+ .parser = tplg_parse_tuples -+ }, -+ { -+ .id = "SectionManifest", -+ .parser = tplg_parse_manifest_data -+ }, -+ }; -+ int (*parser)(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); - snd_config_iterator_t i, next; - snd_config_t *n; - const char *id; -+ unsigned int idx; - int err; - - if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) { -@@ -159,145 +238,23 @@ static int tplg_parse_config(snd_tplg_t *tplg, snd_config_t *cfg) - if (snd_config_get_id(n, &id) < 0) - continue; - -- if (strcmp(id, "SectionTLV") == 0) { -- err = tplg_parse_compound(tplg, n, tplg_parse_tlv, -- NULL); -- if (err < 0) -- return err; -- continue; -+ parser = NULL; -+ for (idx = 0; idx < ARRAY_SIZE(parsers); idx++) { -+ p = &parsers[idx]; -+ if (strcmp(id, p->id) == 0) { -+ parser = p->parser; -+ break; -+ } - } - -- if (strcmp(id, "SectionControlMixer") == 0) { -- err = tplg_parse_compound(tplg, n, -- tplg_parse_control_mixer, NULL); -- if (err < 0) -- return err; -+ if (parser == NULL) { -+ SNDERR("error: unknown section %s\n", id); - continue; - } - -- if (strcmp(id, "SectionControlEnum") == 0) { -- err = tplg_parse_compound(tplg, n, -- tplg_parse_control_enum, NULL); -- if (err < 0) -- return err; -- continue; -- } -- -- if (strcmp(id, "SectionControlBytes") == 0) { -- err = tplg_parse_compound(tplg, n, -- tplg_parse_control_bytes, NULL); -- if (err < 0) -- return err; -- continue; -- } -- -- if (strcmp(id, "SectionWidget") == 0) { -- err = tplg_parse_compound(tplg, n, -- tplg_parse_dapm_widget, NULL); -- if (err < 0) -- return err; -- continue; -- } -- -- if (strcmp(id, "SectionPCMCapabilities") == 0) { -- err = tplg_parse_compound(tplg, n, -- tplg_parse_stream_caps, NULL); -- if (err < 0) -- return err; -- continue; -- } -- -- if (strcmp(id, "SectionPCM") == 0) { -- err = tplg_parse_compound(tplg, n, -- tplg_parse_pcm, NULL); -- if (err < 0) -- return err; -- continue; -- } -- -- if (strcmp(id, "SectionDAI") == 0) { -- err = tplg_parse_compound(tplg, n, -- tplg_parse_dai, NULL); -- if (err < 0) -- return err; -- continue; -- } -- -- if (strcmp(id, "SectionHWConfig") == 0) { -- err = tplg_parse_compound(tplg, n, tplg_parse_hw_config, -- NULL); -- if (err < 0) -- return err; -- continue; -- } -- -- if (strcmp(id, "SectionLink") == 0 -- || strcmp(id, "SectionBE") == 0) { -- err = tplg_parse_compound(tplg, n, tplg_parse_link, -- NULL); -- if (err < 0) -- return err; -- continue; -- } -- -- if (strcmp(id, "SectionCC") == 0) { -- err = tplg_parse_compound(tplg, n, tplg_parse_cc, -- NULL); -- if (err < 0) -- return err; -- continue; -- } -- -- if (strcmp(id, "SectionGraph") == 0) { -- err = tplg_parse_compound(tplg, n, -- tplg_parse_dapm_graph, NULL); -- if (err < 0) -- return err; -- continue; -- } -- -- if (strcmp(id, "SectionText") == 0) { -- err = tplg_parse_compound(tplg, n, tplg_parse_text, -- NULL); -- if (err < 0) -- return err; -- continue; -- } -- -- if (strcmp(id, "SectionData") == 0) { -- err = tplg_parse_compound(tplg, n, tplg_parse_data, -- NULL); -- if (err < 0) -- return err; -- continue; -- } -- -- if (strcmp(id, "SectionVendorTokens") == 0) { -- err = tplg_parse_compound(tplg, n, tplg_parse_tokens, -- NULL); -- if (err < 0) -- return err; -- continue; -- } -- -- if (strcmp(id, "SectionVendorTuples") == 0) { -- err = tplg_parse_compound(tplg, n, tplg_parse_tuples, -- NULL); -- if (err < 0) -- return err; -- continue; -- } -- -- if (strcmp(id, "SectionManifest") == 0) { -- err = tplg_parse_compound(tplg, n, -- tplg_parse_manifest_data, -- NULL); -- if (err < 0) -- return err; -- continue; -- } -- -- SNDERR("error: unknown section %s\n", id); -+ err = tplg_parse_compound(tplg, n, parser, NULL); -+ if (err < 0) -+ return err; - } - return 0; - } -diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h -index 87e6c9a5..77a68189 100644 ---- a/src/topology/tplg_local.h -+++ b/src/topology/tplg_local.h -@@ -202,59 +202,26 @@ int tplg_parse_compound(snd_tplg_t *tplg, snd_config_t *cfg, - - int tplg_write_data(snd_tplg_t *tplg); - --int tplg_parse_tlv(snd_tplg_t *tplg, snd_config_t *cfg, -- void *private ATTRIBUTE_UNUSED); -- --int tplg_parse_text(snd_tplg_t *tplg, snd_config_t *cfg, -- void *private ATTRIBUTE_UNUSED); -- --int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg, -- void *private ATTRIBUTE_UNUSED); -- --int tplg_parse_tokens(snd_tplg_t *tplg, snd_config_t *cfg, -- void *private ATTRIBUTE_UNUSED); -- --int tplg_parse_tuples(snd_tplg_t *tplg, snd_config_t *cfg, -- void *private ATTRIBUTE_UNUSED); -+int tplg_parse_tlv(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); -+int tplg_parse_text(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); -+int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); -+int tplg_parse_tokens(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); -+int tplg_parse_tuples(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); -+int tplg_parse_manifest_data(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); -+int tplg_parse_control_bytes(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); -+int tplg_parse_control_enum(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); -+int tplg_parse_control_mixer(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); -+int tplg_parse_dapm_graph(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); -+int tplg_parse_dapm_widget(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); -+int tplg_parse_stream_caps(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); -+int tplg_parse_pcm(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); -+int tplg_parse_dai(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); -+int tplg_parse_link(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); -+int tplg_parse_cc(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); -+int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); - - void tplg_free_tuples(void *obj); - --int tplg_parse_manifest_data(snd_tplg_t *tplg, snd_config_t *cfg, -- void *private ATTRIBUTE_UNUSED); -- --int tplg_parse_control_bytes(snd_tplg_t *tplg, -- snd_config_t *cfg, void *private ATTRIBUTE_UNUSED); -- --int tplg_parse_control_enum(snd_tplg_t *tplg, snd_config_t *cfg, -- void *private ATTRIBUTE_UNUSED); -- --int tplg_parse_control_mixer(snd_tplg_t *tplg, -- snd_config_t *cfg, void *private ATTRIBUTE_UNUSED); -- --int tplg_parse_dapm_graph(snd_tplg_t *tplg, snd_config_t *cfg, -- void *private ATTRIBUTE_UNUSED); -- --int tplg_parse_dapm_widget(snd_tplg_t *tplg, -- snd_config_t *cfg, void *private ATTRIBUTE_UNUSED); -- --int tplg_parse_stream_caps(snd_tplg_t *tplg, -- snd_config_t *cfg, void *private ATTRIBUTE_UNUSED); -- --int tplg_parse_pcm(snd_tplg_t *tplg, -- snd_config_t *cfg, void *private ATTRIBUTE_UNUSED); -- --int tplg_parse_dai(snd_tplg_t *tplg, snd_config_t *cfg, -- void *private ATTRIBUTE_UNUSED); -- --int tplg_parse_link(snd_tplg_t *tplg, -- snd_config_t *cfg, void *private ATTRIBUTE_UNUSED); -- --int tplg_parse_cc(snd_tplg_t *tplg, -- snd_config_t *cfg, void *private ATTRIBUTE_UNUSED); -- --int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, -- void *private ATTRIBUTE_UNUSED); -- - int tplg_build_data(snd_tplg_t *tplg); - int tplg_build_manifest_data(snd_tplg_t *tplg); - int tplg_build_controls(snd_tplg_t *tplg); --- -2.24.1 - - -From d52eaba63dfe1d845663a4cd1bf676fafc43874a Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Sun, 15 Dec 2019 16:03:29 +0100 -Subject: [PATCH 40/69] topology: add snd_tplg_load() remove - snd_tplg_build_bin_file() - -Signed-off-by: Jaroslav Kysela ---- - include/topology.h | 16 ++++---- - src/topology/parser.c | 96 +++++++++++++++---------------------------- - 2 files changed, 41 insertions(+), 71 deletions(-) - -diff --git a/include/topology.h b/include/topology.h -index c9ef554a..c9f4ffea 100644 ---- a/include/topology.h -+++ b/include/topology.h -@@ -784,25 +784,23 @@ snd_tplg_t *snd_tplg_new(void); - void snd_tplg_free(snd_tplg_t *tplg); - - /** -- * \brief Parse and build topology text file into binary file. -+ * \brief Load topology from the text buffer. - * \param tplg Topology instance. -- * \param infile Topology text input file to be parsed -- * \param outfile Binary topology output file. -+ * \param buf Text buffer. -+ * \param size Text buffer size in bytes. - * \return Zero on success, otherwise a negative error code - */ --int snd_tplg_build_file(snd_tplg_t *tplg, const char *infile, -- const char *outfile); -+int snd_tplg_load(snd_tplg_t *tplg, const char *buf, size_t size); - - /** - * \brief Parse and build topology text file into binary file. - * \param tplg Topology instance. - * \param infile Topology text input file to be parsed -- * \param bin Binary topology output buffer (malloc). -- * \param size Binary topology output buffer size in bytes. -+ * \param outfile Binary topology output file. - * \return Zero on success, otherwise a negative error code - */ --int snd_tplg_build_bin_file(snd_tplg_t *tplg, const char *infile, -- void **bin, size_t *size); -+int snd_tplg_build_file(snd_tplg_t *tplg, const char *infile, -+ const char *outfile); - - /** - * \brief Enable verbose reporting of binary file output -diff --git a/src/topology/parser.c b/src/topology/parser.c -index 82af7cc5..ed864d32 100644 ---- a/src/topology/parser.c -+++ b/src/topology/parser.c -@@ -259,52 +259,30 @@ static int tplg_parse_config(snd_tplg_t *tplg, snd_config_t *cfg) - return 0; - } - --static int tplg_load_config(const char *file, snd_config_t **cfg) -+static int tplg_load_config(snd_tplg_t *tplg, snd_input_t *in) - { -- FILE *fp; -- snd_input_t *in; - snd_config_t *top; - int ret; - -- fp = fopen(file, "r"); -- if (fp == NULL) { -- SNDERR("error: could not open configuration file %s", -- file); -- return -errno; -- } -- -- ret = snd_input_stdio_attach(&in, fp, 1); -- if (ret < 0) { -- fclose(fp); -- SNDERR("error: could not attach stdio %s", file); -- return ret; -- } - ret = snd_config_top(&top); - if (ret < 0) -- goto err; -+ return ret; - - ret = snd_config_load(top, in); - if (ret < 0) { -- SNDERR("error: could not load configuration file %s", -- file); -- goto err_load; -+ SNDERR("error: could not load configuration"); -+ snd_config_delete(top); -+ return ret; - } - -- ret = snd_input_close(in); -+ ret = tplg_parse_config(tplg, top); -+ snd_config_delete(top); - if (ret < 0) { -- in = NULL; -- goto err_load; -+ SNDERR("error: failed to parse topology"); -+ return ret; - } - -- *cfg = top; - return 0; -- --err_load: -- snd_config_delete(top); --err: -- if (in) -- snd_input_close(in); -- return ret; - } - - static int tplg_build_integ(snd_tplg_t *tplg) -@@ -350,26 +328,20 @@ static int tplg_build_integ(snd_tplg_t *tplg) - return err; - } - --static int tplg_load(snd_tplg_t *tplg, const char *infile) -+int snd_tplg_load(snd_tplg_t *tplg, const char *buf, size_t size) - { -- snd_config_t *cfg = NULL; -- int err = 0; -- -- err = tplg_load_config(infile, &cfg); -- if (err < 0) { -- SNDERR("error: failed to load topology file %s\n", -- infile); -- return err; -- } -+ snd_input_t *in; -+ int err; - -- err = tplg_parse_config(tplg, cfg); -+ err = snd_input_buffer_open(&in, buf, size); - if (err < 0) { -- SNDERR("error: failed to parse topology\n"); -+ SNDERR("error: could not create input buffer"); - return err; - } - -- snd_config_delete(cfg); -- return 0; -+ err = tplg_load_config(tplg, in); -+ snd_input_close(in); -+ return err; - } - - static int tplg_build(snd_tplg_t *tplg) -@@ -394,26 +366,30 @@ int snd_tplg_build_file(snd_tplg_t *tplg, - const char *infile, - const char *outfile) - { -+ FILE *fp; -+ snd_input_t *in; - int err; - -- err = tplg_load(tplg, infile); -- if (err < 0) -- return err; -- -- return snd_tplg_build(tplg, outfile); --} -+ fp = fopen(infile, "r"); -+ if (fp == NULL) { -+ SNDERR("error: could not open configuration file %s", -+ infile); -+ return -errno; -+ } - --int snd_tplg_build_bin_file(snd_tplg_t *tplg, -- const char *infile, -- void **bin, size_t *size) --{ -- int err; -+ err = snd_input_stdio_attach(&in, fp, 1); -+ if (err < 0) { -+ fclose(fp); -+ SNDERR("error: could not attach stdio %s", infile); -+ return err; -+ } - -- err = tplg_load(tplg, infile); -+ err = tplg_load_config(tplg, in); -+ snd_input_close(in); - if (err < 0) - return err; - -- return snd_tplg_build_bin(tplg, bin, size); -+ return snd_tplg_build(tplg, outfile); - } - - int snd_tplg_add_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) -@@ -476,10 +452,6 @@ int snd_tplg_build_bin(snd_tplg_t *tplg, - { - int err; - -- err = tplg_build(tplg); -- if (err < 0) -- return err; -- - err = tplg_build(tplg); - if (err < 0) - return err; --- -2.24.1 - - -From 4f076f5b69a873418ecb826a4198e4d95a3a2a6f Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Sun, 15 Dec 2019 16:15:29 +0100 -Subject: [PATCH 41/69] topology: move the topology element table from builder - to elem - -- use offsetof() for the lists -- add other info to describe the elements -- use the table in the element constructor - -Signed-off-by: Jaroslav Kysela ---- - src/topology/builder.c | 98 ++++------------ - src/topology/ctl.c | 7 +- - src/topology/elem.c | 232 +++++++++++++++++++++++++++----------- - src/topology/tplg_local.h | 15 +++ - 4 files changed, 199 insertions(+), 153 deletions(-) - -diff --git a/src/topology/builder.c b/src/topology/builder.c -index 40943b56..cadb5583 100644 ---- a/src/topology/builder.c -+++ b/src/topology/builder.c -@@ -236,83 +236,20 @@ static ssize_t write_manifest_data(snd_tplg_t *tplg) - - int tplg_write_data(snd_tplg_t *tplg) - { -- struct wtable { -- const char *name; -- struct list_head *list; -- int type; -- int tsoc; -- } *wptr, wtable[] = { -- { -- .name = "control mixer", -- .list = &tplg->mixer_list, -- .type = SND_TPLG_TYPE_MIXER, -- .tsoc = SND_SOC_TPLG_TYPE_MIXER, -- }, -- { -- .name = "control enum", -- .list = &tplg->enum_list, -- .type = SND_TPLG_TYPE_ENUM, -- .tsoc = SND_SOC_TPLG_TYPE_ENUM, -- }, -- { -- .name = "control extended (bytes)", -- .list = &tplg->bytes_ext_list, -- .type = SND_TPLG_TYPE_BYTES, -- .tsoc = SND_SOC_TPLG_TYPE_BYTES, -- }, -- { -- .name = "dapm widget", -- .list = &tplg->widget_list, -- .type = SND_TPLG_TYPE_DAPM_WIDGET, -- .tsoc = SND_SOC_TPLG_TYPE_DAPM_WIDGET, -- }, -- { -- .name = "pcm", -- .list = &tplg->pcm_list, -- .type = SND_TPLG_TYPE_PCM, -- .tsoc = SND_SOC_TPLG_TYPE_PCM, -- }, -- { -- .name = "physical dai", -- .list = &tplg->dai_list, -- .type = SND_TPLG_TYPE_DAI, -- .tsoc = SND_SOC_TPLG_TYPE_DAI, -- }, -- { -- .name = "be", -- .list = &tplg->be_list, -- .type = SND_TPLG_TYPE_BE, -- .tsoc = SND_SOC_TPLG_TYPE_BACKEND_LINK, -- }, -- { -- .name = "cc", -- .list = &tplg->cc_list, -- .type = SND_TPLG_TYPE_CC, -- .tsoc = SND_SOC_TPLG_TYPE_CODEC_LINK, -- }, -- { -- .name = "route (dapm graph)", -- .list = &tplg->route_list, -- .type = SND_TPLG_TYPE_DAPM_GRAPH, -- .tsoc = SND_SOC_TPLG_TYPE_DAPM_GRAPH, -- }, -- { -- .name = "private data", -- .list = &tplg->pdata_list, -- .type = SND_TPLG_TYPE_DATA, -- .tsoc = SND_SOC_TPLG_TYPE_PDATA, -- }, -- }; -- -+ struct tplg_table *tptr; -+ struct list_head *list; - ssize_t ret; - size_t total_size, size; - unsigned int index; - - /* calculate total size */ - total_size = calc_manifest_size(tplg); -- for (index = 0; index < ARRAY_SIZE(wtable); index++) { -- wptr = &wtable[index]; -- size = calc_real_size(wptr->list); -+ for (index = 0; index < tplg_table_items; index++) { -+ tptr = &tplg_table[index]; -+ if (!tptr->build) -+ continue; -+ list = (struct list_head *)((void *)tplg + tptr->loff); -+ size = calc_real_size(list); - total_size += size; - } - -@@ -334,20 +271,23 @@ int tplg_write_data(snd_tplg_t *tplg) - } - - /* write all blocks */ -- for (index = 0; index < ARRAY_SIZE(wtable); index++) { -- wptr = &wtable[index]; -+ for (index = 0; index < tplg_table_items; index++) { -+ tptr = &tplg_table[index]; -+ if (!tptr->build) -+ continue; -+ list = (struct list_head *)((void *)tplg + tptr->loff); - /* calculate the block size in bytes for all elems in this list */ -- size = calc_block_size(wptr->list); -+ size = calc_block_size(list); - if (size == 0) - continue; - verbose(tplg, "block size for type %s (%d:%d) is 0x%zx/%zd\n", -- wptr->name, wptr->type, -- wptr->tsoc, size, size); -- ret = write_elem_block(tplg, wptr->list, size, -- wptr->tsoc, wptr->name); -+ tptr->name, tptr->type, -+ tptr->tsoc, size, size); -+ ret = write_elem_block(tplg, list, size, -+ tptr->tsoc, tptr->name); - if (ret < 0) { - SNDERR("failed to write %s elements: %s\n", -- wptr->name, snd_strerror(-ret)); -+ tptr->name, snd_strerror(-ret)); - return ret; - } - } -diff --git a/src/topology/ctl.c b/src/topology/ctl.c -index 9190efef..539329cd 100644 ---- a/src/topology/ctl.c -+++ b/src/topology/ctl.c -@@ -284,18 +284,13 @@ static int tplg_parse_tlv_dbscale(snd_config_t *cfg, struct tplg_elem *elem) - { - snd_config_iterator_t i, next; - snd_config_t *n; -- struct snd_soc_tplg_ctl_tlv *tplg_tlv; -+ struct snd_soc_tplg_ctl_tlv *tplg_tlv = elem->tlv; - struct snd_soc_tplg_tlv_dbscale *scale; - const char *id = NULL; - int val; - - tplg_dbg(" scale: %s\n", elem->id); - -- tplg_tlv = calloc(1, sizeof(*tplg_tlv)); -- if (!tplg_tlv) -- return -ENOMEM; -- -- elem->tlv = tplg_tlv; - tplg_tlv->size = sizeof(struct snd_soc_tplg_ctl_tlv); - tplg_tlv->type = SNDRV_CTL_TLVT_DB_SCALE; - scale = &tplg_tlv->scale; -diff --git a/src/topology/elem.c b/src/topology/elem.c -index f2076f79..92ca7da4 100644 ---- a/src/topology/elem.c -+++ b/src/topology/elem.c -@@ -20,6 +20,154 @@ - #include "list.h" - #include "tplg_local.h" - -+struct tplg_table tplg_table[] = { -+ { -+ .name = "manifest", -+ .loff = offsetof(snd_tplg_t, manifest_list), -+ .type = SND_TPLG_TYPE_MANIFEST, -+ .tsoc = SND_SOC_TPLG_TYPE_MANIFEST, -+ .size = sizeof(struct snd_soc_tplg_manifest), -+ .enew = 1, -+ }, -+ { -+ .name = "control mixer", -+ .loff = offsetof(snd_tplg_t, mixer_list), -+ .type = SND_TPLG_TYPE_MIXER, -+ .tsoc = SND_SOC_TPLG_TYPE_MIXER, -+ .size = sizeof(struct snd_soc_tplg_mixer_control), -+ .build = 1, -+ .enew = 1, -+ }, -+ { -+ .name = "control enum", -+ .loff = offsetof(snd_tplg_t, enum_list), -+ .type = SND_TPLG_TYPE_ENUM, -+ .tsoc = SND_SOC_TPLG_TYPE_ENUM, -+ .size = sizeof(struct snd_soc_tplg_enum_control), -+ .build = 1, -+ .enew = 1, -+ }, -+ { -+ .name = "control extended (bytes)", -+ .loff = offsetof(snd_tplg_t, bytes_ext_list), -+ .type = SND_TPLG_TYPE_BYTES, -+ .tsoc = SND_SOC_TPLG_TYPE_BYTES, -+ .size = sizeof(struct snd_soc_tplg_bytes_control), -+ .build = 1, -+ .enew = 1, -+ }, -+ { -+ .name = "dapm widget", -+ .loff = offsetof(snd_tplg_t, widget_list), -+ .type = SND_TPLG_TYPE_DAPM_WIDGET, -+ .tsoc = SND_SOC_TPLG_TYPE_DAPM_WIDGET, -+ .size = sizeof(struct snd_soc_tplg_dapm_widget), -+ .build = 1, -+ .enew = 1, -+ }, -+ { -+ .name = "pcm", -+ .loff = offsetof(snd_tplg_t, pcm_list), -+ .type = SND_TPLG_TYPE_PCM, -+ .tsoc = SND_SOC_TPLG_TYPE_PCM, -+ .size = sizeof(struct snd_soc_tplg_pcm), -+ .build = 1, -+ .enew = 1, -+ }, -+ { -+ .name = "physical dai", -+ .loff = offsetof(snd_tplg_t, dai_list), -+ .type = SND_TPLG_TYPE_DAI, -+ .tsoc = SND_SOC_TPLG_TYPE_DAI, -+ .size = sizeof(struct snd_soc_tplg_dai), -+ .build = 1, -+ .enew = 1, -+ }, -+ { -+ .name = "be", -+ .loff = offsetof(snd_tplg_t, be_list), -+ .type = SND_TPLG_TYPE_BE, -+ .tsoc = SND_SOC_TPLG_TYPE_BACKEND_LINK, -+ .size = sizeof(struct snd_soc_tplg_link_config), -+ .build = 1, -+ .enew = 1, -+ }, -+ { -+ .name = "cc", -+ .loff = offsetof(snd_tplg_t, cc_list), -+ .type = SND_TPLG_TYPE_CC, -+ .tsoc = SND_SOC_TPLG_TYPE_CODEC_LINK, -+ .size = sizeof(struct snd_soc_tplg_link_config), -+ .build = 1, -+ .enew = 1, -+ }, -+ { -+ .name = "route (dapm graph)", -+ .loff = offsetof(snd_tplg_t, route_list), -+ .type = SND_TPLG_TYPE_DAPM_GRAPH, -+ .tsoc = SND_SOC_TPLG_TYPE_DAPM_GRAPH, -+ .build = 1, -+ }, -+ { -+ .name = "private data", -+ .loff = offsetof(snd_tplg_t, pdata_list), -+ .type = SND_TPLG_TYPE_DATA, -+ .tsoc = SND_SOC_TPLG_TYPE_PDATA, -+ .build = 1, -+ .enew = 1, -+ }, -+ { -+ .name = "text", -+ .loff = offsetof(snd_tplg_t, text_list), -+ .type = SND_TPLG_TYPE_TEXT, -+ .size = sizeof(struct tplg_texts), -+ .enew = 1, -+ }, -+ { -+ .name = "tlv", -+ .loff = offsetof(snd_tplg_t, tlv_list), -+ .type = SND_TPLG_TYPE_TLV, -+ .size = sizeof(struct snd_soc_tplg_ctl_tlv), -+ .enew = 1, -+ }, -+ { -+ .name = "stream config", -+ .loff = offsetof(snd_tplg_t, pcm_config_list), -+ .type = SND_TPLG_TYPE_STREAM_CONFIG, -+ .size = sizeof(struct snd_soc_tplg_stream), -+ .enew = 1, -+ }, -+ { -+ .name = "stream capabilities", -+ .loff = offsetof(snd_tplg_t, pcm_caps_list), -+ .type = SND_TPLG_TYPE_STREAM_CAPS, -+ .size = sizeof(struct snd_soc_tplg_stream_caps), -+ .enew = 1, -+ }, -+ { -+ .name = "token", -+ .loff = offsetof(snd_tplg_t, token_list), -+ .type = SND_TPLG_TYPE_TOKEN, -+ .enew = 1, -+ }, -+ { -+ .name = "tuple", -+ .loff = offsetof(snd_tplg_t, tuple_list), -+ .type = SND_TPLG_TYPE_TUPLE, -+ .free = tplg_free_tuples, -+ .enew = 1, -+ }, -+ { -+ .name = "hw config", -+ .loff = offsetof(snd_tplg_t, hw_cfg_list), -+ .type = SND_TPLG_TYPE_HW_CONFIG, -+ .size = sizeof(struct snd_soc_tplg_hw_config), -+ .enew = 1, -+ } -+}; -+ -+unsigned int tplg_table_items = ARRAY_SIZE(tplg_table); -+ - int tplg_ref_add(struct tplg_elem *elem, int type, const char* id) - { - struct tplg_ref *ref; -@@ -152,9 +300,12 @@ struct tplg_elem* tplg_elem_new_common(snd_tplg_t *tplg, - const char *name, - enum snd_tplg_type type) - { -+ struct tplg_table *tptr; - struct tplg_elem *elem; -+ struct list_head *list; - const char *id; - int obj_size = 0; -+ unsigned index; - void *obj; - snd_config_iterator_t i, next; - snd_config_t *n; -@@ -191,79 +342,24 @@ struct tplg_elem* tplg_elem_new_common(snd_tplg_t *tplg, - } else if (name != NULL) - snd_strlcpy(elem->id, name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN); - -- switch (type) { -- case SND_TPLG_TYPE_DATA: -- tplg_elem_insert(elem, &tplg->pdata_list); -- break; -- case SND_TPLG_TYPE_MANIFEST: -- tplg_elem_insert(elem, &tplg->manifest_list); -- obj_size = sizeof(struct snd_soc_tplg_manifest); -- break; -- case SND_TPLG_TYPE_TEXT: -- tplg_elem_insert(elem, &tplg->text_list); -- obj_size = sizeof(struct tplg_texts); -- break; -- case SND_TPLG_TYPE_TLV: -- tplg_elem_insert(elem, &tplg->tlv_list); -- elem->size = sizeof(struct snd_soc_tplg_ctl_tlv); -- break; -- case SND_TPLG_TYPE_BYTES: -- tplg_elem_insert(elem, &tplg->bytes_ext_list); -- obj_size = sizeof(struct snd_soc_tplg_bytes_control); -- break; -- case SND_TPLG_TYPE_ENUM: -- tplg_elem_insert(elem, &tplg->enum_list); -- obj_size = sizeof(struct snd_soc_tplg_enum_control); -- break; -- case SND_TPLG_TYPE_MIXER: -- tplg_elem_insert(elem, &tplg->mixer_list); -- obj_size = sizeof(struct snd_soc_tplg_mixer_control); -- break; -- case SND_TPLG_TYPE_DAPM_WIDGET: -- tplg_elem_insert(elem, &tplg->widget_list); -- obj_size = sizeof(struct snd_soc_tplg_dapm_widget); -- break; -- case SND_TPLG_TYPE_STREAM_CONFIG: -- tplg_elem_insert(elem, &tplg->pcm_config_list); -- obj_size = sizeof(struct snd_soc_tplg_stream); -+ for (index = 0; index < tplg_table_items; index++) { -+ tptr = &tplg_table[index]; -+ if (!tptr->enew) -+ continue; -+ if ((int)type != tptr->type) -+ continue; - break; -- case SND_TPLG_TYPE_STREAM_CAPS: -- tplg_elem_insert(elem, &tplg->pcm_caps_list); -- obj_size = sizeof(struct snd_soc_tplg_stream_caps); -- break; -- case SND_TPLG_TYPE_PCM: -- tplg_elem_insert(elem, &tplg->pcm_list); -- obj_size = sizeof(struct snd_soc_tplg_pcm); -- break; -- case SND_TPLG_TYPE_DAI: -- tplg_elem_insert(elem, &tplg->dai_list); -- obj_size = sizeof(struct snd_soc_tplg_dai); -- break; -- case SND_TPLG_TYPE_BE: -- case SND_TPLG_TYPE_LINK: -- tplg_elem_insert(elem, &tplg->be_list); -- obj_size = sizeof(struct snd_soc_tplg_link_config); -- break; -- case SND_TPLG_TYPE_CC: -- tplg_elem_insert(elem, &tplg->cc_list); -- obj_size = sizeof(struct snd_soc_tplg_link_config); -- break; -- case SND_TPLG_TYPE_TOKEN: -- tplg_elem_insert(elem, &tplg->token_list); -- break; -- case SND_TPLG_TYPE_TUPLE: -- tplg_elem_insert(elem, &tplg->tuple_list); -- elem->free = tplg_free_tuples; -- break; -- case SND_TPLG_TYPE_HW_CONFIG: -- tplg_elem_insert(elem, &tplg->hw_cfg_list); -- obj_size = sizeof(struct snd_soc_tplg_hw_config); -- break; -- default: -+ } -+ if (index >= tplg_table_items) { - free(elem); - return NULL; - } - -+ list = (struct list_head *)((void *)tplg + tptr->loff); -+ tplg_elem_insert(elem, list); -+ obj_size = tptr->size; -+ elem->free = tptr->free; -+ - /* create new object too if required */ - if (obj_size > 0) { - obj = calloc(1, obj_size); -diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h -index 77a68189..0987898f 100644 ---- a/src/topology/tplg_local.h -+++ b/src/topology/tplg_local.h -@@ -196,6 +196,21 @@ struct map_elem { - int id; - }; - -+/* mapping table */ -+struct tplg_table { -+ const char *name; -+ off_t loff; -+ size_t size; -+ int type; -+ int tsoc; -+ unsigned build: 1; -+ unsigned enew: 1; -+ void (*free)(void *); -+}; -+ -+extern struct tplg_table tplg_table[]; -+extern unsigned int tplg_table_items; -+ - int tplg_parse_compound(snd_tplg_t *tplg, snd_config_t *cfg, - int (*fcn)(snd_tplg_t *, snd_config_t *, void *), - void *private); --- -2.24.1 - - -From 4a0efdc87355d5789876e20b9530dc85224ad281 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Sun, 15 Dec 2019 17:24:50 +0100 -Subject: [PATCH 42/69] topology: add parser to the tplg_table - -Signed-off-by: Jaroslav Kysela ---- - src/topology/elem.c | 35 +++++++++++++++ - src/topology/parser.c | 90 ++++----------------------------------- - src/topology/tplg_local.h | 3 ++ - 3 files changed, 47 insertions(+), 81 deletions(-) - -diff --git a/src/topology/elem.c b/src/topology/elem.c -index 92ca7da4..e79a68b7 100644 ---- a/src/topology/elem.c -+++ b/src/topology/elem.c -@@ -23,112 +23,139 @@ - struct tplg_table tplg_table[] = { - { - .name = "manifest", -+ .id = "SectionManifest", - .loff = offsetof(snd_tplg_t, manifest_list), - .type = SND_TPLG_TYPE_MANIFEST, - .tsoc = SND_SOC_TPLG_TYPE_MANIFEST, - .size = sizeof(struct snd_soc_tplg_manifest), - .enew = 1, -+ .parse = tplg_parse_manifest_data, - }, - { - .name = "control mixer", -+ .id = "SectionControlMixer", - .loff = offsetof(snd_tplg_t, mixer_list), - .type = SND_TPLG_TYPE_MIXER, - .tsoc = SND_SOC_TPLG_TYPE_MIXER, - .size = sizeof(struct snd_soc_tplg_mixer_control), - .build = 1, - .enew = 1, -+ .parse = tplg_parse_control_mixer, - }, - { - .name = "control enum", -+ .id = "SectionControlEnum", - .loff = offsetof(snd_tplg_t, enum_list), - .type = SND_TPLG_TYPE_ENUM, - .tsoc = SND_SOC_TPLG_TYPE_ENUM, - .size = sizeof(struct snd_soc_tplg_enum_control), - .build = 1, - .enew = 1, -+ .parse = tplg_parse_control_enum, - }, - { - .name = "control extended (bytes)", -+ .id = "SectionControlBytes", - .loff = offsetof(snd_tplg_t, bytes_ext_list), - .type = SND_TPLG_TYPE_BYTES, - .tsoc = SND_SOC_TPLG_TYPE_BYTES, - .size = sizeof(struct snd_soc_tplg_bytes_control), - .build = 1, - .enew = 1, -+ .parse = tplg_parse_control_bytes, - }, - { - .name = "dapm widget", -+ .id = "SectionWidget", - .loff = offsetof(snd_tplg_t, widget_list), - .type = SND_TPLG_TYPE_DAPM_WIDGET, - .tsoc = SND_SOC_TPLG_TYPE_DAPM_WIDGET, - .size = sizeof(struct snd_soc_tplg_dapm_widget), - .build = 1, - .enew = 1, -+ .parse = tplg_parse_dapm_widget, - }, - { - .name = "pcm", -+ .id = "SectionPCM", - .loff = offsetof(snd_tplg_t, pcm_list), - .type = SND_TPLG_TYPE_PCM, - .tsoc = SND_SOC_TPLG_TYPE_PCM, - .size = sizeof(struct snd_soc_tplg_pcm), - .build = 1, - .enew = 1, -+ .parse = tplg_parse_pcm, - }, - { - .name = "physical dai", -+ .id = "SectionDAI", - .loff = offsetof(snd_tplg_t, dai_list), - .type = SND_TPLG_TYPE_DAI, - .tsoc = SND_SOC_TPLG_TYPE_DAI, - .size = sizeof(struct snd_soc_tplg_dai), - .build = 1, - .enew = 1, -+ .parse = tplg_parse_dai, - }, - { - .name = "be", -+ .id = "SectionBE", -+ .id2 = "SectionLink", - .loff = offsetof(snd_tplg_t, be_list), - .type = SND_TPLG_TYPE_BE, - .tsoc = SND_SOC_TPLG_TYPE_BACKEND_LINK, - .size = sizeof(struct snd_soc_tplg_link_config), - .build = 1, - .enew = 1, -+ .parse = tplg_parse_link, - }, - { - .name = "cc", -+ .id = "SectionCC", - .loff = offsetof(snd_tplg_t, cc_list), - .type = SND_TPLG_TYPE_CC, - .tsoc = SND_SOC_TPLG_TYPE_CODEC_LINK, - .size = sizeof(struct snd_soc_tplg_link_config), - .build = 1, - .enew = 1, -+ .parse = tplg_parse_cc, - }, - { - .name = "route (dapm graph)", -+ .id = "SectionGraph", - .loff = offsetof(snd_tplg_t, route_list), - .type = SND_TPLG_TYPE_DAPM_GRAPH, - .tsoc = SND_SOC_TPLG_TYPE_DAPM_GRAPH, - .build = 1, -+ .parse = tplg_parse_dapm_graph, - }, - { - .name = "private data", -+ .id = "SectionData", - .loff = offsetof(snd_tplg_t, pdata_list), - .type = SND_TPLG_TYPE_DATA, - .tsoc = SND_SOC_TPLG_TYPE_PDATA, - .build = 1, - .enew = 1, -+ .parse = tplg_parse_data, - }, - { - .name = "text", -+ .id = "SectionText", - .loff = offsetof(snd_tplg_t, text_list), - .type = SND_TPLG_TYPE_TEXT, - .size = sizeof(struct tplg_texts), - .enew = 1, -+ .parse = tplg_parse_text, - }, - { - .name = "tlv", -+ .id = "SectionTLV", - .loff = offsetof(snd_tplg_t, tlv_list), - .type = SND_TPLG_TYPE_TLV, - .size = sizeof(struct snd_soc_tplg_ctl_tlv), - .enew = 1, -+ .parse = tplg_parse_tlv, - }, - { - .name = "stream config", -@@ -139,30 +166,38 @@ struct tplg_table tplg_table[] = { - }, - { - .name = "stream capabilities", -+ .id = "SectionPCMCapabilities", - .loff = offsetof(snd_tplg_t, pcm_caps_list), - .type = SND_TPLG_TYPE_STREAM_CAPS, - .size = sizeof(struct snd_soc_tplg_stream_caps), - .enew = 1, -+ .parse = tplg_parse_stream_caps, - }, - { - .name = "token", -+ .id = "SectionVendorTokens", - .loff = offsetof(snd_tplg_t, token_list), - .type = SND_TPLG_TYPE_TOKEN, - .enew = 1, -+ .parse = tplg_parse_tokens, - }, - { - .name = "tuple", -+ .id = "SectionVendorTuples", - .loff = offsetof(snd_tplg_t, tuple_list), - .type = SND_TPLG_TYPE_TUPLE, - .free = tplg_free_tuples, - .enew = 1, -+ .parse = tplg_parse_tuples, - }, - { - .name = "hw config", -+ .id = "SectionHWConfig", - .loff = offsetof(snd_tplg_t, hw_cfg_list), - .type = SND_TPLG_TYPE_HW_CONFIG, - .size = sizeof(struct snd_soc_tplg_hw_config), - .enew = 1, -+ .parse = tplg_parse_hw_config, - } - }; - -diff --git a/src/topology/parser.c b/src/topology/parser.c -index ed864d32..11202769 100644 ---- a/src/topology/parser.c -+++ b/src/topology/parser.c -@@ -142,87 +142,11 @@ int tplg_parse_compound(snd_tplg_t *tplg, snd_config_t *cfg, - - static int tplg_parse_config(snd_tplg_t *tplg, snd_config_t *cfg) - { -- static struct _parser { -- const char *id; -- int (*parser)(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); -- } *p, parsers[] = { -- { -- .id = "SectionTLV", -- .parser = tplg_parse_tlv -- }, -- { -- .id = "SectionControlMixer", -- .parser = tplg_parse_control_mixer -- }, -- { -- .id = "SectionControlEnum", -- .parser = tplg_parse_control_enum -- }, -- { -- .id = "SectionControlBytes", -- .parser = tplg_parse_control_bytes -- }, -- { -- .id = "SectionWidget", -- .parser = tplg_parse_dapm_widget -- }, -- { -- .id = "SectionPCMCapabilities", -- .parser = tplg_parse_stream_caps -- }, -- { -- .id = "SectionPCM", -- .parser = tplg_parse_pcm -- }, -- { -- .id = "SectionDAI", -- .parser = tplg_parse_dai -- }, -- { -- .id = "SectionHWConfig", -- .parser = tplg_parse_hw_config -- }, -- { -- .id = "SectionLink", -- .parser = tplg_parse_link -- }, -- { -- .id = "SectionBE", -- .parser = tplg_parse_link -- }, -- { -- .id = "SectionCC", -- .parser = tplg_parse_cc -- }, -- { -- .id = "SectionGraph", -- .parser = tplg_parse_dapm_graph -- }, -- { -- .id = "SectionText", -- .parser = tplg_parse_text -- }, -- { -- .id = "SectionData", -- .parser = tplg_parse_data -- }, -- { -- .id = "SectionVendorTokens", -- .parser = tplg_parse_tokens -- }, -- { -- .id = "SectionVendorTuples", -- .parser = tplg_parse_tuples -- }, -- { -- .id = "SectionManifest", -- .parser = tplg_parse_manifest_data -- }, -- }; - int (*parser)(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); - snd_config_iterator_t i, next; - snd_config_t *n; - const char *id; -+ struct tplg_table *p; - unsigned int idx; - int err; - -@@ -239,10 +163,14 @@ static int tplg_parse_config(snd_tplg_t *tplg, snd_config_t *cfg) - continue; - - parser = NULL; -- for (idx = 0; idx < ARRAY_SIZE(parsers); idx++) { -- p = &parsers[idx]; -- if (strcmp(id, p->id) == 0) { -- parser = p->parser; -+ for (idx = 0; idx < tplg_table_items; idx++) { -+ p = &tplg_table[idx]; -+ if (p->id && strcmp(id, p->id) == 0) { -+ parser = p->parse; -+ break; -+ } -+ if (p->id2 && strcmp(id, p->id2) == 0) { -+ parser = p->parse; - break; - } - } -diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h -index 0987898f..bea88ba3 100644 ---- a/src/topology/tplg_local.h -+++ b/src/topology/tplg_local.h -@@ -199,6 +199,8 @@ struct map_elem { - /* mapping table */ - struct tplg_table { - const char *name; -+ const char *id; -+ const char *id2; - off_t loff; - size_t size; - int type; -@@ -206,6 +208,7 @@ struct tplg_table { - unsigned build: 1; - unsigned enew: 1; - void (*free)(void *); -+ int (*parse)(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); - }; - - extern struct tplg_table tplg_table[]; --- -2.24.1 - - -From aa1bac2d04bd1fb4ccae96a1136e60454298a710 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Mon, 16 Dec 2019 14:26:31 +0100 -Subject: [PATCH 43/69] topology: add snd_tplg_save() - -Signed-off-by: Jaroslav Kysela ---- - include/topology.h | 15 + - src/conf.c | 17 + - src/topology/Makefile.am | 3 +- - src/topology/channel.c | 45 +++ - src/topology/ctl.c | 201 +++++++++++- - src/topology/dapm.c | 209 +++++++++---- - src/topology/data.c | 601 +++++++++++++++++++++++++++++------- - src/topology/elem.c | 18 ++ - src/topology/ops.c | 92 ++++++ - src/topology/parser.c | 4 + - src/topology/pcm.c | 505 ++++++++++++++++++++++++++---- - src/topology/save.c | 632 ++++++++++++++++++++++++++++++++++++++ - src/topology/text.c | 19 ++ - src/topology/tplg_local.h | 58 +++- - 14 files changed, 2162 insertions(+), 257 deletions(-) - create mode 100644 src/topology/save.c - -diff --git a/include/topology.h b/include/topology.h -index c9f4ffea..69aa5ed7 100644 ---- a/include/topology.h -+++ b/include/topology.h -@@ -1124,6 +1124,21 @@ int snd_tplg_set_manifest_data(snd_tplg_t *tplg, const void *data, int len); - */ - int snd_tplg_set_version(snd_tplg_t *tplg, unsigned int version); - -+/* -+ * Flags for the snd_tplg_save() -+ */ -+#define SND_TPLG_SAVE_SORT (1<<0) /*!< sort identifiers */ -+#define SND_TPLG_SAVE_GROUPS (1<<1) /*!< create the structure by group index */ -+#define SND_TPLG_SAVE_NOCHECK (1<<16) /*!< unchecked output for debugging */ -+ -+/** -+ * \brief Save the topology to the text configuration string. -+ * \param tplg Topology instance. -+ * \param dst A pointer to string with result (malloc). -+ * \return Zero on success, otherwise a negative error code -+ */ -+int snd_tplg_save(snd_tplg_t *tplg, char **dst, int flags); -+ - /* \} */ - - #ifdef __cplusplus -diff --git a/src/conf.c b/src/conf.c -index 3e753b26..c4db9f21 100644 ---- a/src/conf.c -+++ b/src/conf.c -@@ -874,6 +874,21 @@ static int get_nonwhite(input_t *input) - } - } - -+static inline int get_hexachar(input_t *input) -+{ -+ int c, num = 0; -+ -+ c = get_char(input); -+ if (c >= '0' && c <= '9') num |= (c - '0') << 4; -+ else if (c >= 'a' && c <= 'f') num |= (c - 'a') << 4; -+ else if (c >= 'A' && c <= 'F') num |= (c - 'A') << 4; -+ c = get_char(input); -+ if (c >= '0' && c <= '9') num |= (c - '0') << 0; -+ else if (c >= 'a' && c <= 'f') num |= (c - 'a') << 0; -+ else if (c >= 'A' && c <= 'F') num |= (c - 'A') << 0; -+ return c; -+} -+ - static int get_quotedchar(input_t *input) - { - int c; -@@ -891,6 +906,8 @@ static int get_quotedchar(input_t *input) - return '\r'; - case 'f': - return '\f'; -+ case 'x': -+ return get_hexachar(input); - case '0': case '1': case '2': case '3': - case '4': case '5': case '6': case '7': - { -diff --git a/src/topology/Makefile.am b/src/topology/Makefile.am -index 9dc472d6..a850ec4c 100644 ---- a/src/topology/Makefile.am -+++ b/src/topology/Makefile.am -@@ -27,7 +27,8 @@ libatopology_la_SOURCES =\ - text.c \ - channel.c \ - ops.c \ -- elem.c -+ elem.c \ -+ save.c - - noinst_HEADERS = tplg_local.h - -diff --git a/src/topology/channel.c b/src/topology/channel.c -index 4569eb31..b54a10c8 100644 ---- a/src/topology/channel.c -+++ b/src/topology/channel.c -@@ -73,6 +73,18 @@ static int lookup_channel(const char *c) - return -EINVAL; - } - -+const char *tplg_channel_name(int type) -+{ -+ unsigned int i; -+ -+ for (i = 0; i < ARRAY_SIZE(channel_map); i++) { -+ if (channel_map[i].id == type) -+ return channel_map[i].name; -+ } -+ -+ return NULL; -+} -+ - /* Parse a channel mapping. */ - int tplg_parse_channel(snd_tplg_t *tplg, snd_config_t *cfg, - void *private) -@@ -123,3 +135,36 @@ int tplg_parse_channel(snd_tplg_t *tplg, snd_config_t *cfg, - tplg->channel_idx++; - return 0; - } -+ -+int tplg_save_channels(snd_tplg_t *tplg ATTRIBUTE_UNUSED, -+ struct snd_soc_tplg_channel *channel, -+ unsigned int count, char **dst, const char *pfx) -+{ -+ struct snd_soc_tplg_channel *c; -+ const char *s; -+ unsigned int index; -+ int err; -+ -+ if (count == 0) -+ return 0; -+ err = tplg_save_printf(dst, pfx, "channel {\n"); -+ for (index = 0; err >= 0 && index < count; index++) { -+ c = channel + index; -+ s = tplg_channel_name(c->id); -+ if (s == NULL) -+ err = tplg_save_printf(dst, pfx, "\t%u", c->id); -+ else -+ err = tplg_save_printf(dst, pfx, "\t%s", s); -+ if (err >= 0) -+ err = tplg_save_printf(dst, NULL, " {\n"); -+ if (err >= 0) -+ err = tplg_save_printf(dst, pfx, "\t\treg %d\n", c->reg); -+ if (err >= 0 && c->shift > 0) -+ err = tplg_save_printf(dst, pfx, "\t\tshift %u\n", c->shift); -+ if (err >= 0) -+ err = tplg_save_printf(dst, pfx, "\t}\n"); -+ } -+ if (err >= 0) -+ err = tplg_save_printf(dst, pfx, "}\n"); -+ return err; -+} -diff --git a/src/topology/ctl.c b/src/topology/ctl.c -index 539329cd..979cc1b0 100644 ---- a/src/topology/ctl.c -+++ b/src/topology/ctl.c -@@ -28,15 +28,16 @@ struct ctl_access_elem { - }; - - /* CTL access strings and codes */ -+/* place the multi-bit values on top - like read_write - for save */ - static const struct ctl_access_elem ctl_access[] = { -+ {"read_write", SNDRV_CTL_ELEM_ACCESS_READWRITE}, -+ {"tlv_read_write", SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE}, - {"read", SNDRV_CTL_ELEM_ACCESS_READ}, - {"write", SNDRV_CTL_ELEM_ACCESS_WRITE}, -- {"read_write", SNDRV_CTL_ELEM_ACCESS_READWRITE}, - {"volatile", SNDRV_CTL_ELEM_ACCESS_VOLATILE}, - {"timestamp", SNDRV_CTL_ELEM_ACCESS_TIMESTAMP}, - {"tlv_read", SNDRV_CTL_ELEM_ACCESS_TLV_READ}, - {"tlv_write", SNDRV_CTL_ELEM_ACCESS_TLV_WRITE}, -- {"tlv_read_write", SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE}, - {"tlv_command", SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND}, - {"inactive", SNDRV_CTL_ELEM_ACCESS_INACTIVE}, - {"lock", SNDRV_CTL_ELEM_ACCESS_LOCK}, -@@ -103,6 +104,46 @@ int parse_access(snd_config_t *cfg, - return err; - } - -+/* Save Access */ -+static int tplg_save_access(snd_tplg_t *tplg ATTRIBUTE_UNUSED, -+ struct snd_soc_tplg_ctl_hdr *hdr, char **dst, -+ const char *pfx) -+{ -+ const char *last; -+ unsigned int j, count, access, cval; -+ int err; -+ -+ if (hdr->access == 0) -+ return 0; -+ -+ access = hdr->access; -+ for (j = 0, count = 0, last = NULL; j < ARRAY_SIZE(ctl_access); j++) { -+ cval = ctl_access[j].value; -+ if ((access & cval) == cval) { -+ access &= ~cval; -+ last = ctl_access[j].name; -+ count++; -+ } -+ } -+ if (count == 1) -+ return tplg_save_printf(dst, pfx, "access.0 %s\n", last); -+ err = tplg_save_printf(dst, pfx, "access [\n"); -+ if (err < 0) -+ return err; -+ access = hdr->access; -+ for (j = 0; j < ARRAY_SIZE(ctl_access); j++) { -+ cval = ctl_access[j].value; -+ if ((access & cval) == cval) { -+ err = tplg_save_printf(dst, pfx, "\t%s\n", -+ ctl_access[j].name); -+ if (err < 0) -+ return err; -+ access &= ~cval; -+ } -+ } -+ return tplg_save_printf(dst, pfx, "]\n"); -+} -+ - /* copy referenced TLV to the mixer control */ - static int copy_tlv(struct tplg_elem *elem, struct tplg_elem *ref) - { -@@ -358,6 +399,37 @@ int tplg_parse_tlv(snd_tplg_t *tplg, snd_config_t *cfg, - return err; - } - -+/* save TLV data */ -+int tplg_save_tlv(snd_tplg_t *tplg ATTRIBUTE_UNUSED, -+ struct tplg_elem *elem, -+ char **dst, const char *pfx) -+{ -+ struct snd_soc_tplg_ctl_tlv *tlv = elem->tlv; -+ struct snd_soc_tplg_tlv_dbscale *scale; -+ int err; -+ -+ if (tlv->type != SNDRV_CTL_TLVT_DB_SCALE) { -+ SNDERR("unknown TLV type"); -+ return -EINVAL; -+ } -+ -+ scale = &tlv->scale; -+ err = tplg_save_printf(dst, NULL, "'%s' {\n", elem->id); -+ if (err >= 0) -+ err = tplg_save_printf(dst, pfx, "\tscale {\n"); -+ if (err >= 0 && scale->min) -+ err = tplg_save_printf(dst, pfx, "\t\tmin %i\n", scale->min); -+ if (err >= 0 && scale->step > 0) -+ err = tplg_save_printf(dst, pfx, "\t\tstep %i\n", scale->step); -+ if (err >= 0 && scale->mute > 0) -+ err = tplg_save_printf(dst, pfx, "\t\tmute %i\n", scale->mute); -+ if (err >= 0) -+ err = tplg_save_printf(dst, pfx, "\t}\n"); -+ if (err >= 0) -+ err = tplg_save_printf(dst, pfx, "}\n"); -+ return err; -+} -+ - /* Parse Control Bytes */ - int tplg_parse_control_bytes(snd_tplg_t *tplg, - snd_config_t *cfg, -@@ -430,7 +502,7 @@ int tplg_parse_control_bytes(snd_tplg_t *tplg, - } - - if (strcmp(id, "data") == 0) { -- err = tplg_parse_data_refs(n, elem); -+ err = tplg_parse_refs(n, elem, SND_TPLG_TYPE_DATA); - if (err < 0) - return err; - continue; -@@ -485,6 +557,49 @@ int tplg_parse_control_bytes(snd_tplg_t *tplg, - return 0; - } - -+/* save control bytes */ -+int tplg_save_control_bytes(snd_tplg_t *tplg ATTRIBUTE_UNUSED, -+ struct tplg_elem *elem, -+ char **dst, const char *pfx) -+{ -+ struct snd_soc_tplg_bytes_control *be = elem->bytes_ext; -+ char pfx2[16]; -+ int err; -+ -+ if (!be) -+ return 0; -+ -+ snprintf(pfx2, sizeof(pfx2), "%s\t", pfx ?: ""); -+ err = tplg_save_printf(dst, NULL, "'%s' {\n", elem->id); -+ if (err < 0) -+ return err; -+ if (err >= 0 && elem->index > 0) -+ err = tplg_save_printf(dst, pfx, "\tindex %u\n", elem->index); -+ if (err >= 0 && be->base > 0) -+ err = tplg_save_printf(dst, pfx, "\tbase %u\n", be->base); -+ if (err >= 0 && be->num_regs > 0) -+ err = tplg_save_printf(dst, pfx, "\tnum_regs %u\n", be->num_regs); -+ if (err >= 0 && be->max > 0) -+ err = tplg_save_printf(dst, pfx, "\tmax %u\n", be->max); -+ if (err >= 0 && be->mask > 0) -+ err = tplg_save_printf(dst, pfx, "\tmask %u\n", be->mask); -+ if (err >= 0) -+ err = tplg_save_ops(tplg, &be->hdr, dst, pfx2); -+ if (err >= 0) -+ err = tplg_save_ext_ops(tplg, be, dst, pfx2); -+ if (err >= 0) -+ err = tplg_save_access(tplg, &be->hdr, dst, pfx2); -+ if (err >= 0) -+ err = tplg_save_refs(tplg, elem, SND_TPLG_TYPE_TLV, -+ "tlv", dst, pfx2); -+ if (err >= 0) -+ err = tplg_save_refs(tplg, elem, SND_TPLG_TYPE_DATA, -+ "data", dst, pfx2); -+ if (err >= 0) -+ err = tplg_save_printf(dst, pfx, "}\n"); -+ return err; -+} -+ - /* Parse Control Enums. */ - int tplg_parse_control_enum(snd_tplg_t *tplg, snd_config_t *cfg, - void *private ATTRIBUTE_UNUSED) -@@ -559,7 +674,7 @@ int tplg_parse_control_enum(snd_tplg_t *tplg, snd_config_t *cfg, - } - - if (strcmp(id, "data") == 0) { -- err = tplg_parse_data_refs(n, elem); -+ err = tplg_parse_refs(n, elem, SND_TPLG_TYPE_DATA); - if (err < 0) - return err; - continue; -@@ -582,6 +697,42 @@ int tplg_parse_control_enum(snd_tplg_t *tplg, snd_config_t *cfg, - return 0; - } - -+/* save control eunm */ -+int tplg_save_control_enum(snd_tplg_t *tplg ATTRIBUTE_UNUSED, -+ struct tplg_elem *elem, -+ char **dst, const char *pfx) -+{ -+ struct snd_soc_tplg_enum_control *ec = elem->enum_ctrl; -+ char pfx2[16]; -+ int err; -+ -+ if (!ec) -+ return 0; -+ -+ snprintf(pfx2, sizeof(pfx2), "%s\t", pfx ?: ""); -+ err = tplg_save_printf(dst, NULL, "'%s' {\n", elem->id); -+ if (err < 0) -+ return err; -+ if (err >= 0 && elem->index > 0) -+ err = tplg_save_printf(dst, pfx, "\tindex %u\n", elem->index); -+ if (err >= 0) -+ err = tplg_save_refs(tplg, elem, SND_TPLG_TYPE_TEXT, -+ "texts", dst, pfx2); -+ if (err >= 0) -+ err = tplg_save_channels(tplg, ec->channel, ec->num_channels, -+ dst, pfx2); -+ if (err >= 0) -+ err = tplg_save_ops(tplg, &ec->hdr, dst, pfx2); -+ if (err >= 0) -+ err = tplg_save_access(tplg, &ec->hdr, dst, pfx2); -+ if (err >= 0) -+ err = tplg_save_refs(tplg, elem, SND_TPLG_TYPE_DATA, -+ "data", dst, pfx2); -+ if (err >= 0) -+ err = tplg_save_printf(dst, pfx, "}\n"); -+ return err; -+} -+ - /* Parse Controls. - * - * Mixer control. Supports multiple channels. -@@ -683,7 +834,7 @@ int tplg_parse_control_mixer(snd_tplg_t *tplg, - } - - if (strcmp(id, "data") == 0) { -- err = tplg_parse_data_refs(n, elem); -+ err = tplg_parse_refs(n, elem, SND_TPLG_TYPE_DATA); - if (err < 0) - return err; - continue; -@@ -709,6 +860,46 @@ int tplg_parse_control_mixer(snd_tplg_t *tplg, - return 0; - } - -+int tplg_save_control_mixer(snd_tplg_t *tplg ATTRIBUTE_UNUSED, -+ struct tplg_elem *elem, char **dst, -+ const char *pfx) -+{ -+ struct snd_soc_tplg_mixer_control *mc = elem->mixer_ctrl; -+ char pfx2[16]; -+ int err; -+ -+ if (!mc) -+ return 0; -+ err = tplg_save_printf(dst, NULL, "'%s' {\n", elem->id); -+ if (err < 0) -+ return err; -+ snprintf(pfx2, sizeof(pfx2), "%s\t", pfx ?: ""); -+ if (err >= 0 && elem->index > 0) -+ err = tplg_save_printf(dst, pfx, "\tindex %u\n", elem->index); -+ if (err >= 0) -+ err = tplg_save_channels(tplg, mc->channel, mc->num_channels, -+ dst, pfx2); -+ if (err >= 0 && mc->max > 0) -+ err = tplg_save_printf(dst, pfx, "\tmax %u\n", mc->max); -+ if (err >= 0 && mc->invert > 0) -+ err = tplg_save_printf(dst, pfx, "\tinvert 1\n", mc->max); -+ if (err >= 0 && mc->invert > 0) -+ err = tplg_save_printf(dst, pfx, "\tinvert 1\n", mc->max); -+ if (err >= 0) -+ err = tplg_save_ops(tplg, &mc->hdr, dst, pfx2); -+ if (err >= 0) -+ err = tplg_save_access(tplg, &mc->hdr, dst, pfx2); -+ if (err >= 0) -+ err = tplg_save_refs(tplg, elem, SND_TPLG_TYPE_TLV, -+ "tlv", dst, pfx2); -+ if (err >= 0) -+ err = tplg_save_refs(tplg, elem, SND_TPLG_TYPE_DATA, -+ "data", dst, pfx2); -+ if (err >= 0) -+ err = tplg_save_printf(dst, pfx, "}\n"); -+ return err; -+} -+ - static int init_ctl_hdr(struct snd_soc_tplg_ctl_hdr *hdr, - struct snd_tplg_ctl_template *t) - { -diff --git a/src/topology/dapm.c b/src/topology/dapm.c -index ad709210..2bdacedc 100644 ---- a/src/topology/dapm.c -+++ b/src/topology/dapm.c -@@ -43,7 +43,6 @@ static const struct map_elem widget_map[] = { - {"effect", SND_SOC_TPLG_DAPM_EFFECT}, - {"siggen", SND_SOC_TPLG_DAPM_SIGGEN}, - {"src", SND_SOC_TPLG_DAPM_SRC}, -- {"asrc", SND_SOC_TPLG_DAPM_ASRC}, - {"encoder", SND_SOC_TPLG_DAPM_ENCODER}, - {"decoder", SND_SOC_TPLG_DAPM_DECODER}, - }; -@@ -60,70 +59,16 @@ static int lookup_widget(const char *w) - return -EINVAL; - } - --static int tplg_parse_dapm_mixers(snd_config_t *cfg, struct tplg_elem *elem) -+static const char *get_widget_name(unsigned int type) - { -- snd_config_iterator_t i, next; -- snd_config_t *n; -- const char *value = NULL; -- -- tplg_dbg(" DAPM Mixer Controls: %s\n", elem->id); -- -- snd_config_for_each(i, next, cfg) { -- n = snd_config_iterator_entry(i); -- -- /* get value */ -- if (snd_config_get_string(n, &value) < 0) -- continue; -- -- tplg_ref_add(elem, SND_TPLG_TYPE_MIXER, value); -- tplg_dbg("\t\t %s\n", value); -- } -- -- return 0; --} -- --static int tplg_parse_dapm_enums(snd_config_t *cfg, struct tplg_elem *elem) --{ -- snd_config_iterator_t i, next; -- snd_config_t *n; -- const char *value = NULL; -- -- tplg_dbg(" DAPM Enum Controls: %s\n", elem->id); -- -- snd_config_for_each(i, next, cfg) { -- n = snd_config_iterator_entry(i); -- -- /* get value */ -- if (snd_config_get_string(n, &value) < 0) -- continue; -- -- tplg_ref_add(elem, SND_TPLG_TYPE_ENUM, value); -- tplg_dbg("\t\t %s\n", value); -- } -- -- return 0; --} -- --static int tplg_parse_dapm_bytes(snd_config_t *cfg, struct tplg_elem *elem) --{ -- snd_config_iterator_t i, next; -- snd_config_t *n; -- const char *value = NULL; -- -- tplg_dbg(" DAPM Bytes Controls: %s\n", elem->id); -- -- snd_config_for_each(i, next, cfg) { -- n = snd_config_iterator_entry(i); -- -- /* get value */ -- if (snd_config_get_string(n, &value) < 0) -- continue; -+ unsigned int i; - -- tplg_ref_add(elem, SND_TPLG_TYPE_BYTES, value); -- tplg_dbg("\t\t %s\n", value); -+ for (i = 0; i < ARRAY_SIZE(widget_map); i++) { -+ if ((unsigned int)widget_map[i].id == type) -+ return widget_map[i].name; - } - -- return 0; -+ return NULL; - } - - /* move referenced controls to the widget */ -@@ -340,7 +285,7 @@ struct tplg_elem *tplg_elem_new_route(snd_tplg_t *tplg, int index) - - #define LINE_SIZE 1024 - --/* line is defined as '"source, control, sink"' */ -+/* line is defined as '"sink, control, source"' */ - static int tplg_parse_line(const char *text, - struct snd_soc_tplg_dapm_graph_elem *line) - { -@@ -470,6 +415,77 @@ int tplg_parse_dapm_graph(snd_tplg_t *tplg, snd_config_t *cfg, - return 0; - } - -+/* save DAPM graph */ -+int tplg_save_dapm_graph(snd_tplg_t *tplg, int index, char **dst, const char *pfx) -+{ -+ struct snd_soc_tplg_dapm_graph_elem *route; -+ struct list_head *pos; -+ struct tplg_elem *elem; -+ int err, first = 1, old_index = -1; -+ unsigned block = -1, count = 0; -+ -+ list_for_each(pos, &tplg->route_list) { -+ elem = list_entry(pos, struct tplg_elem, list); -+ if (!elem->route || elem->type != SND_TPLG_TYPE_DAPM_GRAPH) -+ continue; -+ if (index >= 0 && elem->index != index) -+ continue; -+ count++; -+ } -+ if (count == 0) -+ return 0; -+ err = tplg_save_printf(dst, pfx, "SectionGraph {\n"); -+ list_for_each(pos, &tplg->route_list) { -+ elem = list_entry(pos, struct tplg_elem, list); -+ if (!elem->route || elem->type != SND_TPLG_TYPE_DAPM_GRAPH) -+ continue; -+ if (index >= 0 && elem->index != index) -+ continue; -+ if (old_index != elem->index) { -+ if (old_index >= 0) { -+ err = tplg_save_printf(dst, pfx, "\t\t]\n"); -+ if (err < 0) -+ return err; -+ err = tplg_save_printf(dst, pfx, "\t}\n"); -+ if (err < 0) -+ return err; -+ } -+ old_index = elem->index; -+ block++; -+ first = 1; -+ err = tplg_save_printf(dst, pfx, "\tset%u {\n", block); -+ if (err >= 0) -+ err = tplg_save_printf(dst, pfx, "\t\tindex %u\n", -+ elem->index); -+ if (err < 0) -+ return err; -+ } -+ if (first) { -+ first = 0; -+ err = tplg_save_printf(dst, pfx, "\t\tlines [\n", elem->index); -+ if (err < 0) -+ return err; -+ } -+ route = elem->route; -+ err = tplg_save_printf(dst, pfx, "\t\t\t'%s, %s, %s'\n", -+ route->sink, route->control, -+ route->source); -+ if (err < 0) -+ return err; -+ } -+ -+ if (!first) { -+ if (err >= 0) -+ err = tplg_save_printf(dst, pfx, "\t\t]\n"); -+ if (err >= 0) -+ err = tplg_save_printf(dst, pfx, "\t}\n"); -+ } -+ -+ if (err >= 0) -+ err = tplg_save_printf(dst, pfx, "}\n"); -+ return err; -+} -+ - /* DAPM Widget */ - int tplg_parse_dapm_widget(snd_tplg_t *tplg, - snd_config_t *cfg, void *private ATTRIBUTE_UNUSED) -@@ -595,7 +611,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, - } - - if (strcmp(id, "enum") == 0) { -- err = tplg_parse_dapm_enums(n, elem); -+ err = tplg_parse_refs(n, elem, SND_TPLG_TYPE_ENUM); - if (err < 0) - return err; - -@@ -603,7 +619,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, - } - - if (strcmp(id, "mixer") == 0) { -- err = tplg_parse_dapm_mixers(n, elem); -+ err = tplg_parse_refs(n, elem, SND_TPLG_TYPE_MIXER); - if (err < 0) - return err; - -@@ -611,7 +627,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, - } - - if (strcmp(id, "bytes") == 0) { -- err = tplg_parse_dapm_bytes(n, elem); -+ err = tplg_parse_refs(n, elem, SND_TPLG_TYPE_BYTES); - if (err < 0) - return err; - -@@ -619,7 +635,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, - } - - if (strcmp(id, "data") == 0) { -- err = tplg_parse_data_refs(n, elem); -+ err = tplg_parse_refs(n, elem, SND_TPLG_TYPE_DATA); - if (err < 0) - return err; - continue; -@@ -629,6 +645,66 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, - return 0; - } - -+/* save DAPM widget */ -+int tplg_save_dapm_widget(snd_tplg_t *tplg ATTRIBUTE_UNUSED, -+ struct tplg_elem *elem, -+ char **dst, const char *pfx) -+{ -+ struct snd_soc_tplg_dapm_widget *widget = elem->widget; -+ const char *s; -+ char pfx2[16]; -+ int err; -+ -+ err = tplg_save_printf(dst, NULL, "'%s' {\n", elem->id); -+ if (err >= 0 && elem->index) -+ err = tplg_save_printf(dst, pfx, "\tindex %u\n", -+ elem->index); -+ if (err >= 0) { -+ s = get_widget_name(widget->id); -+ if (s) -+ err = tplg_save_printf(dst, pfx, "\ttype %s\n", s); -+ else -+ err = tplg_save_printf(dst, pfx, "\ttype %u\n", -+ widget->id); -+ } -+ if (err >= 0 && widget->sname[0]) -+ err = tplg_save_printf(dst, pfx, "\tstream_name '%s'\n", -+ widget->sname); -+ if (err >= 0 && widget->reg) -+ err = tplg_save_printf(dst, pfx, "\tno_pm 1\n"); -+ if (err >= 0 && widget->shift) -+ err = tplg_save_printf(dst, pfx, "\tshift %u\n", -+ widget->shift); -+ if (err >= 0 && widget->invert) -+ err = tplg_save_printf(dst, pfx, "\tinvert %u\n", -+ widget->invert); -+ if (err >= 0 && widget->subseq) -+ err = tplg_save_printf(dst, pfx, "\tsubseq %u\n", -+ widget->subseq); -+ if (err >= 0 && widget->event_type) -+ err = tplg_save_printf(dst, pfx, "\tevent_type %u\n", -+ widget->event_type); -+ if (err >= 0 && widget->event_flags) -+ err = tplg_save_printf(dst, pfx, "\tevent_flags %u\n", -+ widget->event_flags); -+ snprintf(pfx2, sizeof(pfx2), "%s\t", pfx ?: ""); -+ if (err >= 0) -+ err = tplg_save_refs(tplg, elem, SND_TPLG_TYPE_ENUM, -+ "enum", dst, pfx2); -+ if (err >= 0) -+ err = tplg_save_refs(tplg, elem, SND_TPLG_TYPE_MIXER, -+ "mixer", dst, pfx2); -+ if (err >= 0) -+ err = tplg_save_refs(tplg, elem, SND_TPLG_TYPE_BYTES, -+ "bytes", dst, pfx2); -+ if (err >= 0) -+ err = tplg_save_refs(tplg, elem, SND_TPLG_TYPE_DATA, -+ "data", dst, pfx2); -+ if (err >= 0) -+ err = tplg_save_printf(dst, pfx, "}\n"); -+ return err; -+} -+ - int tplg_add_route(snd_tplg_t *tplg, struct snd_tplg_graph_elem *t, int index) - { - struct tplg_elem *elem; -@@ -744,7 +820,6 @@ int tplg_add_widget_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) - default: - SNDERR("error: widget %s: invalid type %d for ctl %d\n", - wt->name, ct->type, i); -- ret = -EINVAL; - break; - } - -diff --git a/src/topology/data.c b/src/topology/data.c -index 9807445e..11cd73f5 100644 ---- a/src/topology/data.c -+++ b/src/topology/data.c -@@ -21,6 +21,10 @@ - #include "tplg_local.h" - #include - -+#define UUID_FORMAT "\ -+0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, \ -+0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x" -+ - /* Get private data buffer of an element */ - struct snd_soc_tplg_private *get_priv_data(struct tplg_elem *elem) - { -@@ -64,6 +68,96 @@ struct snd_soc_tplg_private *get_priv_data(struct tplg_elem *elem) - return priv; - } - -+/* Parse references for the element, either a single data section -+ * or a list of data sections. -+ */ -+int tplg_parse_refs(snd_config_t *cfg, struct tplg_elem *elem, -+ unsigned int type) -+{ -+ snd_config_type_t cfg_type; -+ snd_config_iterator_t i, next; -+ snd_config_t *n; -+ const char *val = NULL; -+ int err, count; -+ -+ cfg_type = snd_config_get_type(cfg); -+ -+ /* refer to a single data section */ -+ if (cfg_type == SND_CONFIG_TYPE_STRING) { -+ if (snd_config_get_string(cfg, &val) < 0) -+ return -EINVAL; -+ -+ tplg_dbg("\tref data: %s\n", val); -+ err = tplg_ref_add(elem, type, val); -+ if (err < 0) -+ return err; -+ return 1; -+ } -+ -+ if (cfg_type != SND_CONFIG_TYPE_COMPOUND) { -+ SNDERR("error: compound type expected for %s", elem->id); -+ return -EINVAL; -+ } -+ -+ /* refer to a list of data sections */ -+ count = 0; -+ snd_config_for_each(i, next, cfg) { -+ const char *val; -+ -+ n = snd_config_iterator_entry(i); -+ if (snd_config_get_string(n, &val) < 0) -+ continue; -+ -+ tplg_dbg("\tref data: %s\n", val); -+ err = tplg_ref_add(elem, type, val); -+ if (err < 0) -+ return err; -+ count++; -+ } -+ -+ return count; -+} -+ -+/* save references */ -+int tplg_save_refs(snd_tplg_t *tplg ATTRIBUTE_UNUSED, -+ struct tplg_elem *elem, unsigned int type, -+ const char *id, char **dst, const char *pfx) -+{ -+ struct tplg_ref *ref, *last; -+ struct list_head *pos; -+ int err, count; -+ -+ count = 0; -+ last = NULL; -+ list_for_each(pos, &elem->ref_list) { -+ ref = list_entry(pos, struct tplg_ref, list); -+ if (ref->type == type) { -+ last = ref; -+ count++; -+ } -+ } -+ -+ if (count == 0) -+ return 0; -+ -+ if (count == 1) -+ return tplg_save_printf(dst, pfx, "%s '%s'\n", id, last->id); -+ -+ err = tplg_save_printf(dst, pfx, "%s [\n", id); -+ if (err < 0) -+ return err; -+ list_for_each(pos, &elem->ref_list) { -+ ref = list_entry(pos, struct tplg_ref, list); -+ if (ref->type == type) { -+ err = tplg_save_printf(dst, pfx, "\t'%s'\n", ref->id); -+ if (err < 0) -+ return err; -+ } -+ } -+ -+ return tplg_save_printf(dst, pfx, "]\n"); -+} -+ - /* Get Private data from a file. */ - static int tplg_parse_data_file(snd_config_t *cfg, struct tplg_elem *elem) - { -@@ -140,58 +234,98 @@ err: - static void dump_priv_data(struct tplg_elem *elem) - { - struct snd_soc_tplg_private *priv = elem->data; -- unsigned int i, j = 0; -+ unsigned int i; - - tplg_dbg(" elem size = %d, priv data size = %d\n", - elem->size, priv->size); - - for (i = 0; i < priv->size; i++) { -- if (j++ % 8 == 0) -+ if (i > 0 && (i % 16) == 0) - tplg_dbg("\n"); - -- tplg_dbg(" 0x%x", *p++); -+ tplg_dbg(" %02x:", *p++); - } - - tplg_dbg("\n\n"); - } - -+static inline int check_nibble(unsigned char c) -+{ -+ return (c >= '0' && c <= '9') || -+ (c >= 'a' && c <= 'f') || -+ (c >= 'A' && c <= 'F'); -+} -+ - /* get number of hex value elements in CSV list */ - static int get_hex_num(const char *str) - { -- int commas = 0, values = 0, len = strlen(str); -- const char *end = str + len; -+ int delims, values, len = strlen(str); -+ const char *s, *end = str + len; -+ -+ /* check "aa:bb:00" syntax */ -+ s = str; -+ delims = values = 0; -+ while (s < end) { -+ /* skip white space */ -+ if (isspace(*s)) { -+ s++; -+ continue; -+ } -+ /* find delimeters */ -+ if (*s == ':') { -+ delims++; -+ s++; -+ continue; -+ } -+ /* check 00 hexadecimal value */ -+ if (s + 1 <= end) { -+ if (check_nibble(s[0]) && check_nibble(s[1])) { -+ values++; -+ } else { -+ goto format2; -+ } -+ s++; -+ } -+ s++; -+ } -+ goto end; - -+format2: - /* we expect "0x0, 0x0, 0x0" */ -- while (str < end) { -+ s = str; -+ delims = values = 0; -+ while (s < end) { - - /* skip white space */ -- if (isspace(*str)) { -- str++; -+ if (isspace(*s)) { -+ s++; - continue; - } - - /* find delimeters */ -- if (*str == ',') { -- commas++; -- str++; -+ if (*s == ',') { -+ delims++; -+ s++; - continue; - } - - /* find 0x[0-9] values */ -- if (*str == '0' && str + 2 <= end) { -- if (str[1] == 'x' && str[2] >= '0' && str[2] <= 'f') { -+ if (*s == '0' && s + 2 <= end) { -+ if (s[1] == 'x' && check_nibble(s[2])) { -+ if (check_nibble(s[3])) -+ s++; - values++; -- str += 3; -- } else { -- str++; -+ s += 2; - } -+ s++; - } - -- str++; -+ s++; - } - -+end: - /* there should always be one less comma than value */ -- if (values -1 != commas) -+ if (values - 1 != delims) - return -EINVAL; - - return values; -@@ -547,6 +681,71 @@ static int build_tuples(snd_tplg_t *tplg, struct tplg_elem *elem) - return 0; - } - -+struct tuple_type { -+ unsigned int type; -+ const char *name; -+ unsigned int size; -+}; -+ -+static struct tuple_type tuple_types[] = { -+ { -+ .type = SND_SOC_TPLG_TUPLE_TYPE_UUID, -+ .name = "uuid", -+ .size = 4, -+ }, -+ { -+ .type = SND_SOC_TPLG_TUPLE_TYPE_STRING, -+ .name = "string", -+ .size = 6, -+ }, -+ { -+ .type = SND_SOC_TPLG_TUPLE_TYPE_BOOL, -+ .name = "bool", -+ .size = 4, -+ }, -+ { -+ .type = SND_SOC_TPLG_TUPLE_TYPE_BYTE, -+ .name = "byte", -+ .size = 4, -+ }, -+ { -+ .type = SND_SOC_TPLG_TUPLE_TYPE_SHORT, -+ .name = "short", -+ .size = 5, -+ }, -+ { -+ .type = SND_SOC_TPLG_TUPLE_TYPE_WORD, -+ .name = "word", -+ .size = 4 -+ }, -+}; -+ -+static int get_tuple_type(const char *name) -+{ -+ struct tuple_type *t; -+ unsigned int i; -+ -+ /* skip initial index for sorting */ -+ while ((*name >= '0' && *name <= '9') || *name == '_') -+ name++; -+ for (i = 0; i < ARRAY_SIZE(tuple_types); i++) { -+ t = &tuple_types[i]; -+ if (strncasecmp(t->name, name, t->size) == 0) -+ return t->type; -+ } -+ return -EINVAL; -+} -+ -+static const char *get_tuple_type_name(unsigned int type) -+{ -+ unsigned int i; -+ -+ for (i = 0; i < ARRAY_SIZE(tuple_types); i++) -+ if (tuple_types[i].type == type) -+ return tuple_types[i].name; -+ return NULL; -+} -+ - static int parse_tuple_set(snd_config_t *cfg, - struct tplg_tuple_set **s) - { -@@ -554,28 +753,17 @@ static int parse_tuple_set(snd_config_t *cfg, - snd_config_t *n; - const char *id, *value; - struct tplg_tuple_set *set; -- unsigned int type, num_tuples = 0; -+ unsigned int num_tuples = 0; - struct tplg_tuple *tuple; - unsigned int tuple_val; -- int ival; -+ int type, ival; - - snd_config_get_id(cfg, &id); - -- if (strncmp(id, "uuid", 4) == 0) -- type = SND_SOC_TPLG_TUPLE_TYPE_UUID; -- else if (strncmp(id, "string", 5) == 0) -- type = SND_SOC_TPLG_TUPLE_TYPE_STRING; -- else if (strncmp(id, "bool", 4) == 0) -- type = SND_SOC_TPLG_TUPLE_TYPE_BOOL; -- else if (strncmp(id, "byte", 4) == 0) -- type = SND_SOC_TPLG_TUPLE_TYPE_BYTE; -- else if (strncmp(id, "short", 5) == 0) -- type = SND_SOC_TPLG_TUPLE_TYPE_SHORT; -- else if (strncmp(id, "word", 4) == 0) -- type = SND_SOC_TPLG_TUPLE_TYPE_WORD; -- else { -- SNDERR("error: invalid tuple type '%s'\n", id); -- return -EINVAL; -+ type = get_tuple_type(id); -+ if (type < 0) { -+ SNDERR("error: invalid tuple type '%s'", id); -+ return type; - } - - snd_config_for_each(i, next, cfg) -@@ -664,6 +852,84 @@ err: - return -EINVAL; - } - -+/* save tuple set */ -+static int tplg_save_tuple_set(struct tplg_vendor_tuples *tuples, -+ unsigned int set_index, -+ char **dst, const char *pfx) -+{ -+ struct tplg_tuple_set *set; -+ struct tplg_tuple *tuple; -+ const char *s, *fmt; -+ char buf[32]; -+ unsigned int i; -+ int err; -+ -+ set = tuples->set[set_index]; -+ if (set->num_tuples == 0) -+ return 0; -+ s = get_tuple_type_name(set->type); -+ if (s == NULL) -+ return -EINVAL; -+ if (tuples->num_sets < 10) -+ fmt = "%u_"; -+ else if (tuples->num_sets < 100) -+ fmt = "%02u_"; -+ else if (tuples->num_sets < 1000) -+ fmt = "%03u_"; -+ else -+ return -EINVAL; -+ if (set->num_tuples > 1) { -+ snprintf(buf, sizeof(buf), "tuples.%s%%s {\n", fmt); -+ err = tplg_save_printf(dst, NULL, buf, set_index, s); -+ if (err < 0) -+ return err; -+ } -+ for (i = 0; i < set->num_tuples; i++) { -+ tuple = &set->tuple[i]; -+ if (set->num_tuples == 1) { -+ snprintf(buf, sizeof(buf), "tuples.%s%%s.'%%s' ", fmt); -+ err = tplg_save_printf(dst, NULL, buf, -+ set_index, s, tuple->token); -+ } else { -+ err = tplg_save_printf(dst, pfx, "\t'%s' ", -+ tuple->token); -+ } -+ switch (set->type) { -+ case SND_SOC_TPLG_TUPLE_TYPE_UUID: -+ err = tplg_save_printf(dst, NULL, "'" UUID_FORMAT "'\n", -+ tuple->uuid[0], tuple->uuid[1], -+ tuple->uuid[2], tuple->uuid[3], -+ tuple->uuid[4], tuple->uuid[5], -+ tuple->uuid[6], tuple->uuid[7], -+ tuple->uuid[8], tuple->uuid[9], -+ tuple->uuid[10], tuple->uuid[11], -+ tuple->uuid[12], tuple->uuid[13], -+ tuple->uuid[14], tuple->uuid[15]); -+ break; -+ case SND_SOC_TPLG_TUPLE_TYPE_STRING: -+ err = tplg_save_printf(dst, NULL, "'%s'\n", -+ tuple->string); -+ break; -+ case SND_SOC_TPLG_TUPLE_TYPE_BOOL: -+ case SND_SOC_TPLG_TUPLE_TYPE_BYTE: -+ case SND_SOC_TPLG_TUPLE_TYPE_SHORT: -+ err = tplg_save_printf(dst, NULL, "%u\n", tuple->value); -+ break; -+ case SND_SOC_TPLG_TUPLE_TYPE_WORD: -+ tplg_nice_value_format(buf, sizeof(buf), tuple->value); -+ err = tplg_save_printf(dst, NULL, "%s\n", buf); -+ break; -+ default: -+ return -EINVAL; -+ } -+ if (err < 0) -+ return err; -+ } -+ if (set->num_tuples > 1) -+ return tplg_save_printf(dst, pfx, "}\n"); -+ return 0; -+} -+ - static int parse_tuple_sets(snd_config_t *cfg, - struct tplg_vendor_tuples *tuples) - { -@@ -710,87 +976,24 @@ static int parse_tuple_sets(snd_config_t *cfg, - return 0; - } - --/* Parse tuples references for a data element, either a single tuples section -- * or a list of tuples sections. -- */ --static int parse_tuples_refs(snd_config_t *cfg, -- struct tplg_elem *elem) --{ -- snd_config_type_t type; -- snd_config_iterator_t i, next; -- snd_config_t *n; -- const char *val = NULL; -- -- type = snd_config_get_type(cfg); -- -- /* refer to a single tuples section */ -- if (type == SND_CONFIG_TYPE_STRING) { -- if (snd_config_get_string(cfg, &val) < 0) -- return -EINVAL; -- tplg_dbg("\ttuples: %s\n", val); -- return tplg_ref_add(elem, SND_TPLG_TYPE_TUPLE, val); -- } -- -- if (type != SND_CONFIG_TYPE_COMPOUND) { -- SNDERR("error: compound type expected for %s", elem->id); -- return -EINVAL; -- } -- -- /* refer to a list of data sections */ -- snd_config_for_each(i, next, cfg) { -- const char *val; -- -- n = snd_config_iterator_entry(i); -- if (snd_config_get_string(n, &val) < 0) -- continue; -- -- tplg_dbg("\ttuples: %s\n", val); -- tplg_ref_add(elem, SND_TPLG_TYPE_TUPLE, val); -- } -- -- return 0; --} -- --/* Parse private data references for the element, either a single data section -- * or a list of data sections. -- */ --int tplg_parse_data_refs(snd_config_t *cfg, -- struct tplg_elem *elem) -+/* save tuple sets */ -+int tplg_save_tuple_sets(snd_tplg_t *tplg ATTRIBUTE_UNUSED, -+ struct tplg_elem *elem, -+ char **dst, const char *pfx) - { -- snd_config_type_t type; -- snd_config_iterator_t i, next; -- snd_config_t *n; -- const char *val = NULL; -- -- type = snd_config_get_type(cfg); -- -- /* refer to a single data section */ -- if (type == SND_CONFIG_TYPE_STRING) { -- if (snd_config_get_string(cfg, &val) < 0) -- return -EINVAL; -- -- tplg_dbg("\tdata: %s\n", val); -- return tplg_ref_add(elem, SND_TPLG_TYPE_DATA, val); -- } -- -- if (type != SND_CONFIG_TYPE_COMPOUND) { -- SNDERR("error: compound type expected for %s", elem->id); -- return -EINVAL; -- } -- -- /* refer to a list of data sections */ -- snd_config_for_each(i, next, cfg) { -- const char *val; -- -- n = snd_config_iterator_entry(i); -- if (snd_config_get_string(n, &val) < 0) -- continue; -+ struct tplg_vendor_tuples *tuples = elem->tuples; -+ unsigned int i; -+ int err = 0; - -- tplg_dbg("\tdata: %s\n", val); -- tplg_ref_add(elem, SND_TPLG_TYPE_DATA, val); -+ for (i = 0; i < tuples->num_sets; i++) { -+ err = tplg_save_printf(dst, pfx, ""); -+ if (err < 0) -+ break; -+ err = tplg_save_tuple_set(tuples, i, dst, pfx); -+ if (err < 0) -+ break; - } -- -- return 0; -+ return err; - } - - /* Parse vendor tokens -@@ -844,6 +1047,31 @@ int tplg_parse_tokens(snd_tplg_t *tplg, snd_config_t *cfg, - return 0; - } - -+/* save vendor tokens */ -+int tplg_save_tokens(snd_tplg_t *tplg ATTRIBUTE_UNUSED, -+ struct tplg_elem *elem, -+ char **dst, const char *pfx) -+{ -+ struct tplg_vendor_tokens *tokens = elem->tokens; -+ unsigned int i; -+ int err; -+ -+ if (!tokens || tokens->num_tokens == 0) -+ return 0; -+ -+ err = tplg_save_printf(dst, NULL, "'%s' {\n", elem->id); -+ if (err < 0) -+ return err; -+ for (i = 0; err >= 0 && i < tokens->num_tokens; i++) -+ err = tplg_save_printf(dst, pfx, "\t'%s' %u\n", -+ tokens->token[i].id, -+ tokens->token[i].value); -+ err = tplg_save_printf(dst, pfx, "}\n"); -+ if (err < 0) -+ return err; -+ return 0; -+} -+ - /* Parse vendor tuples. - */ - int tplg_parse_tuples(snd_tplg_t *tplg, snd_config_t *cfg, -@@ -890,6 +1118,29 @@ int tplg_parse_tuples(snd_tplg_t *tplg, snd_config_t *cfg, - return 0; - } - -+/* save vendor tuples */ -+int tplg_save_tuples(snd_tplg_t *tplg ATTRIBUTE_UNUSED, -+ struct tplg_elem *elem, -+ char **dst, const char *pfx) -+{ -+ char pfx2[16]; -+ int err; -+ -+ if (!elem->tuples) -+ return 0; -+ -+ err = tplg_save_printf(dst, NULL, "'%s' {\n", elem->id); -+ snprintf(pfx2, sizeof(pfx2), "%s\t", pfx ?: ""); -+ if (err >= 0) -+ err = tplg_save_refs(tplg, elem, SND_TPLG_TYPE_TOKEN, -+ "tokens", dst, pfx2); -+ if (err >= 0) -+ err = tplg_save_tuple_sets(tplg, elem, dst, pfx2); -+ if (err >= 0) -+ err = tplg_save_printf(dst, pfx, "}\n"); -+ return 0; -+} -+ - /* Free handler of tuples */ - void tplg_free_tuples(void *obj) - { -@@ -944,7 +1195,7 @@ int tplg_parse_manifest_data(snd_tplg_t *tplg, snd_config_t *cfg, - - - if (strcmp(id, "data") == 0) { -- err = tplg_parse_data_refs(n, elem); -+ err = tplg_parse_refs(n, elem, SND_TPLG_TYPE_DATA); - if (err < 0) - return err; - continue; -@@ -954,6 +1205,51 @@ int tplg_parse_manifest_data(snd_tplg_t *tplg, snd_config_t *cfg, - return 0; - } - -+/* save manifest data */ -+int tplg_save_manifest_data(snd_tplg_t *tplg ATTRIBUTE_UNUSED, -+ struct tplg_elem *elem, char **dst, -+ const char *pfx) -+{ -+ struct list_head *pos; -+ struct tplg_ref *ref; -+ int err, index, count; -+ -+ /* for each ref in this manifest elem */ -+ count = 0; -+ list_for_each(pos, &elem->ref_list) { -+ ref = list_entry(pos, struct tplg_ref, list); -+ if (ref->type != SND_TPLG_TYPE_DATA) -+ continue; -+ count++; -+ } -+ if (count > 1) { -+ err = tplg_save_printf(dst, NULL, "'%s'.data [\n", elem->id); -+ if (err < 0) -+ return err; -+ } -+ index = 0; -+ list_for_each(pos, &elem->ref_list) { -+ ref = list_entry(pos, struct tplg_ref, list); -+ if (ref->type != SND_TPLG_TYPE_DATA) -+ continue; -+ if (count == 1) { -+ err = tplg_save_printf(dst, NULL, "'%s'.data.%u '%s'\n", -+ elem->id, index, ref->id); -+ } else { -+ err = tplg_save_printf(dst, pfx, "\t'%s'\n", ref->id); -+ if (err < 0) -+ return err; -+ } -+ index++; -+ } -+ if (count > 1) { -+ err = tplg_save_printf(dst, pfx, "]\n"); -+ if (err < 0) -+ return err; -+ } -+ return 0; -+} -+ - /* merge private data of manifest */ - int tplg_build_manifest_data(snd_tplg_t *tplg) - { -@@ -1064,7 +1360,7 @@ int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg, - } - - if (strcmp(id, "tuples") == 0) { -- err = parse_tuples_refs(n, elem); -+ err = tplg_parse_refs(n, elem, SND_TPLG_TYPE_TUPLE); - if (err < 0) - return err; - continue; -@@ -1083,6 +1379,81 @@ int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg, - return err; - } - -+/* save data element */ -+int tplg_save_data(snd_tplg_t *tplg ATTRIBUTE_UNUSED, -+ struct tplg_elem *elem, -+ char **dst, const char *pfx) -+{ -+ struct snd_soc_tplg_private *priv = elem->data; -+ struct list_head *pos; -+ struct tplg_ref *ref; -+ char pfx2[16]; -+ unsigned int i, count; -+ int err; -+ -+ count = 0; -+ if (priv && priv->size > 0) -+ count++; -+ list_for_each(pos, &elem->ref_list) { -+ ref = list_entry(pos, struct tplg_ref, list); -+ if (ref->type == SND_TPLG_TYPE_TUPLE) -+ count++; -+ } -+ if (elem->vendor_type > 0) -+ count++; -+ -+ if (count > 1) { -+ err = tplg_save_printf(dst, NULL, "'%s' {\n", elem->id); -+ if (err >= 0) -+ err = tplg_save_printf(dst, NULL, ""); -+ } else { -+ err = tplg_save_printf(dst, NULL, "'%s'.", elem->id); -+ } -+ if (err >= 0 && priv && priv->size > 0) { -+ if (count > 1) { -+ err = tplg_save_printf(dst, pfx, ""); -+ if (err < 0) -+ return err; -+ } -+ if (priv->size > 8) { -+ err = tplg_save_printf(dst, NULL, "bytes\n"); -+ if (err >= 0) -+ err = tplg_save_printf(dst, pfx, "\t'"); -+ } else { -+ err = tplg_save_printf(dst, NULL, "bytes '"); -+ } -+ if (err < 0) -+ return err; -+ for (i = 0; i < priv->size; i++) { -+ if (i > 0 && (i % 8) == 0) { -+ err = tplg_save_printf(dst, NULL, ":\n"); -+ if (err < 0) -+ return err; -+ err = tplg_save_printf(dst, pfx, "\t "); -+ if (err < 0) -+ return err; -+ } -+ err = tplg_save_printf(dst, NULL, "%s%02x", -+ (i % 8) == 0 ? "" : ":", -+ (unsigned char)priv->data[i]); -+ if (err < 0) -+ return err; -+ } -+ err = tplg_save_printf(dst, NULL, "'\n"); -+ } -+ snprintf(pfx2, sizeof(pfx2), "%s\t", pfx ?: ""); -+ if (err >= 0) -+ err = tplg_save_refs(tplg, elem, SND_TPLG_TYPE_TUPLE, -+ "tuples", dst, -+ count > 1 ? pfx2 : NULL); -+ if (err >= 0 && elem->vendor_type > 0) -+ err = tplg_save_printf(dst, pfx, "type %u", -+ elem->vendor_type); -+ if (err >= 0 && count > 1) -+ err = tplg_save_printf(dst, pfx, "}\n"); -+ return err; -+} -+ - /* Find a referenced data element and copy its data to the parent - * element's private data buffer. - * An element can refer to multiple data sections. Data of these sections -diff --git a/src/topology/elem.c b/src/topology/elem.c -index e79a68b7..89aed1fc 100644 ---- a/src/topology/elem.c -+++ b/src/topology/elem.c -@@ -30,6 +30,7 @@ struct tplg_table tplg_table[] = { - .size = sizeof(struct snd_soc_tplg_manifest), - .enew = 1, - .parse = tplg_parse_manifest_data, -+ .save = tplg_save_manifest_data, - }, - { - .name = "control mixer", -@@ -41,6 +42,7 @@ struct tplg_table tplg_table[] = { - .build = 1, - .enew = 1, - .parse = tplg_parse_control_mixer, -+ .save = tplg_save_control_mixer, - }, - { - .name = "control enum", -@@ -52,6 +54,7 @@ struct tplg_table tplg_table[] = { - .build = 1, - .enew = 1, - .parse = tplg_parse_control_enum, -+ .save = tplg_save_control_enum, - }, - { - .name = "control extended (bytes)", -@@ -63,6 +66,7 @@ struct tplg_table tplg_table[] = { - .build = 1, - .enew = 1, - .parse = tplg_parse_control_bytes, -+ .save = tplg_save_control_bytes, - }, - { - .name = "dapm widget", -@@ -74,6 +78,7 @@ struct tplg_table tplg_table[] = { - .build = 1, - .enew = 1, - .parse = tplg_parse_dapm_widget, -+ .save = tplg_save_dapm_widget, - }, - { - .name = "pcm", -@@ -85,6 +90,7 @@ struct tplg_table tplg_table[] = { - .build = 1, - .enew = 1, - .parse = tplg_parse_pcm, -+ .save = tplg_save_pcm, - }, - { - .name = "physical dai", -@@ -96,6 +102,7 @@ struct tplg_table tplg_table[] = { - .build = 1, - .enew = 1, - .parse = tplg_parse_dai, -+ .save = tplg_save_dai, - }, - { - .name = "be", -@@ -108,6 +115,7 @@ struct tplg_table tplg_table[] = { - .build = 1, - .enew = 1, - .parse = tplg_parse_link, -+ .save = tplg_save_link, - }, - { - .name = "cc", -@@ -119,6 +127,7 @@ struct tplg_table tplg_table[] = { - .build = 1, - .enew = 1, - .parse = tplg_parse_cc, -+ .save = tplg_save_cc, - }, - { - .name = "route (dapm graph)", -@@ -128,6 +137,7 @@ struct tplg_table tplg_table[] = { - .tsoc = SND_SOC_TPLG_TYPE_DAPM_GRAPH, - .build = 1, - .parse = tplg_parse_dapm_graph, -+ .gsave = tplg_save_dapm_graph, - }, - { - .name = "private data", -@@ -138,6 +148,7 @@ struct tplg_table tplg_table[] = { - .build = 1, - .enew = 1, - .parse = tplg_parse_data, -+ .save = tplg_save_data, - }, - { - .name = "text", -@@ -147,6 +158,7 @@ struct tplg_table tplg_table[] = { - .size = sizeof(struct tplg_texts), - .enew = 1, - .parse = tplg_parse_text, -+ .save = tplg_save_text, - }, - { - .name = "tlv", -@@ -156,6 +168,7 @@ struct tplg_table tplg_table[] = { - .size = sizeof(struct snd_soc_tplg_ctl_tlv), - .enew = 1, - .parse = tplg_parse_tlv, -+ .save = tplg_save_tlv, - }, - { - .name = "stream config", -@@ -172,6 +185,7 @@ struct tplg_table tplg_table[] = { - .size = sizeof(struct snd_soc_tplg_stream_caps), - .enew = 1, - .parse = tplg_parse_stream_caps, -+ .save = tplg_save_stream_caps, - }, - { - .name = "token", -@@ -180,6 +194,7 @@ struct tplg_table tplg_table[] = { - .type = SND_TPLG_TYPE_TOKEN, - .enew = 1, - .parse = tplg_parse_tokens, -+ .save = tplg_save_tokens, - }, - { - .name = "tuple", -@@ -189,6 +204,7 @@ struct tplg_table tplg_table[] = { - .free = tplg_free_tuples, - .enew = 1, - .parse = tplg_parse_tuples, -+ .save = tplg_save_tuples, - }, - { - .name = "hw config", -@@ -198,6 +214,7 @@ struct tplg_table tplg_table[] = { - .size = sizeof(struct snd_soc_tplg_hw_config), - .enew = 1, - .parse = tplg_parse_hw_config, -+ .save = tplg_save_hw_config, - } - }; - -@@ -394,6 +411,7 @@ struct tplg_elem* tplg_elem_new_common(snd_tplg_t *tplg, - tplg_elem_insert(elem, list); - obj_size = tptr->size; - elem->free = tptr->free; -+ elem->table = tptr; - - /* create new object too if required */ - if (obj_size > 0) { -diff --git a/src/topology/ops.c b/src/topology/ops.c -index 073acdcb..ad72ef1b 100644 ---- a/src/topology/ops.c -+++ b/src/topology/ops.c -@@ -45,6 +45,18 @@ static int lookup_ops(const char *c) - return strtol(c, NULL, 0); - } - -+const char *tplg_ops_name(int type) -+{ -+ unsigned int i; -+ -+ for (i = 0; i < ARRAY_SIZE(control_map); i++) { -+ if (control_map[i].id == type) -+ return control_map[i].name; -+ } -+ -+ return NULL; -+} -+ - /* Parse Control operations. Ops can come from standard names above or - * bespoke driver controls with numbers >= 256 - */ -@@ -84,6 +96,46 @@ int tplg_parse_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, snd_config_t *cfg, - return 0; - } - -+/* save control operations */ -+int tplg_save_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, -+ struct snd_soc_tplg_ctl_hdr *hdr, char **dst, -+ const char *pfx) -+{ -+ const char *s; -+ int err; -+ -+ if (hdr->ops.info + hdr->ops.get + hdr->ops.put == 0) -+ return 0; -+ err = tplg_save_printf(dst, pfx, "ops.0 {\n"); -+ if (err >= 0 && hdr->ops.info > 0) { -+ s = tplg_ops_name(hdr->ops.info); -+ if (s == NULL) -+ err = tplg_save_printf(dst, pfx, "\tinfo %u\n", -+ hdr->ops.info); -+ else -+ err = tplg_save_printf(dst, pfx, "\tinfo %s\n", s); -+ } -+ if (err >= 0 && hdr->ops.get > 0) { -+ s = tplg_ops_name(hdr->ops.get); -+ if (s == NULL) -+ err = tplg_save_printf(dst, pfx, "\tget %u\n", -+ hdr->ops.get); -+ else -+ err = tplg_save_printf(dst, pfx, "\tget %s\n", s); -+ } -+ if (err >= 0 && hdr->ops.put > 0) { -+ s = tplg_ops_name(hdr->ops.put); -+ if (s == NULL) -+ err = tplg_save_printf(dst, pfx, "\tput %u\n", -+ hdr->ops.put); -+ else -+ err = tplg_save_printf(dst, pfx, "\tput %s\n", s); -+ } -+ if (err >= 0) -+ err = tplg_save_printf(dst, pfx, "}\n"); -+ return err; -+} -+ - /* Parse External Control operations. Ops can come from standard names above or - * bespoke driver controls with numbers >= 256 - */ -@@ -121,3 +173,43 @@ int tplg_parse_ext_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, - - return 0; - } -+ -+/* save external control operations */ -+int tplg_save_ext_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, -+ struct snd_soc_tplg_bytes_control *be, -+ char **dst, const char *pfx) -+{ -+ const char *s; -+ int err; -+ -+ if (be->ext_ops.info + be->ext_ops.get + be->ext_ops.put == 0) -+ return 0; -+ err = tplg_save_printf(dst, pfx, "extops.0 {\n"); -+ if (err >= 0 && be->ext_ops.info > 0) { -+ s = tplg_ops_name(be->ext_ops.info); -+ if (s == NULL) -+ err = tplg_save_printf(dst, pfx, "\tinfo %u\n", -+ be->ext_ops.info); -+ else -+ err = tplg_save_printf(dst, pfx, "\tinfo %s\n", s); -+ } -+ if (err >= 0 && be->ext_ops.get > 0) { -+ s = tplg_ops_name(be->ext_ops.get); -+ if (s == NULL) -+ err = tplg_save_printf(dst, pfx, "\tget %u\n", -+ be->ext_ops.get); -+ else -+ err = tplg_save_printf(dst, pfx, "\tget %s\n", s); -+ } -+ if (err >= 0 && be->ext_ops.put > 0) { -+ s = tplg_ops_name(be->ext_ops.put); -+ if (s == NULL) -+ err = tplg_save_printf(dst, pfx, "\tput %u\n", -+ be->ext_ops.put); -+ else -+ err = tplg_save_printf(dst, pfx, "\tput %s\n", s); -+ } -+ if (err >= 0) -+ err = tplg_save_printf(dst, pfx, "}\n"); -+ return err; -+} -diff --git a/src/topology/parser.c b/src/topology/parser.c -index 11202769..de5edd1b 100644 ---- a/src/topology/parser.c -+++ b/src/topology/parser.c -@@ -71,6 +71,8 @@ int tplg_get_unsigned(snd_config_t *n, unsigned *val, int base) - err = snd_config_get_integer(n, &lval); - if (err < 0) - return err; -+ if (lval < 0 && lval >= INT_MIN) -+ lval = UINT_MAX + lval + 1; - if (lval < 0 || lval > UINT_MAX) - return -ERANGE; - *val = lval; -@@ -79,6 +81,8 @@ int tplg_get_unsigned(snd_config_t *n, unsigned *val, int base) - err = snd_config_get_integer64(n, &llval); - if (err < 0) - return err; -+ if (llval < 0 && llval >= INT_MIN) -+ llval = UINT_MAX + llval + 1; - if (llval < 0 || llval > UINT_MAX) - return -ERANGE; - *val = llval; -diff --git a/src/topology/pcm.c b/src/topology/pcm.c -index 9b87549c..d09fbe42 100644 ---- a/src/topology/pcm.c -+++ b/src/topology/pcm.c -@@ -345,6 +345,13 @@ static int get_rate_value(const char* name) - return SND_PCM_RATE_UNKNOWN; - } - -+static const char *get_rate_name(int rate) -+{ -+ if (rate >= 0 && rate <= SND_PCM_RATE_LAST) -+ return snd_pcm_rate_names[rate]; -+ return NULL; -+} -+ - static int split_rate(struct snd_soc_tplg_stream_caps *caps, char *str) - { - char *s = NULL; -@@ -527,6 +534,80 @@ int tplg_parse_stream_caps(snd_tplg_t *tplg, - return 0; - } - -+/* save stream caps */ -+int tplg_save_stream_caps(snd_tplg_t *tplg ATTRIBUTE_UNUSED, -+ struct tplg_elem *elem, -+ char **dst, const char *pfx) -+{ -+ struct snd_soc_tplg_stream_caps *sc = elem->stream_caps; -+ const char *s; -+ unsigned int i; -+ int err, first; -+ -+ err = tplg_save_printf(dst, NULL, "'%s' {\n", elem->id); -+ if (err >= 0 && sc->formats) { -+ err = tplg_save_printf(dst, pfx, "\tformats '"); -+ first = 1; -+ for (i = 0; err >= 0 && i < SND_PCM_FORMAT_LAST; i++) { -+ if (sc->formats & (1ULL << i)) { -+ s = snd_pcm_format_name(i); -+ err = tplg_save_printf(dst, NULL, "%s%s", -+ !first ? ", " : "", s); -+ first = 0; -+ } -+ } -+ if (err >= 0) -+ err = tplg_save_printf(dst, NULL, "'\n"); -+ } -+ if (err >= 0 && sc->rates) { -+ err = tplg_save_printf(dst, pfx, "\trates '"); -+ first = 1; -+ for (i = 0; err >= 0 && i < SND_PCM_RATE_LAST; i++) { -+ if (sc->rates & (1ULL << i)) { -+ s = get_rate_name(i); -+ err = tplg_save_printf(dst, NULL, "%s%s", -+ !first ? ", " : "", s); -+ first = 0; -+ } -+ } -+ if (err >= 0) -+ err = tplg_save_printf(dst, NULL, "'\n"); -+ } -+ if (err >= 0 && sc->rate_min) -+ err = tplg_save_printf(dst, pfx, "\trate_min %u\n", -+ sc->rate_min); -+ if (err >= 0 && sc->rate_max) -+ err = tplg_save_printf(dst, pfx, "\trate_max %u\n", -+ sc->rate_max); -+ if (err >= 0 && sc->channels_min) -+ err = tplg_save_printf(dst, pfx, "\tchannels_min %u\n", -+ sc->channels_min); -+ if (err >= 0 && sc->channels_max) -+ err = tplg_save_printf(dst, pfx, "\tchannels_max %u\n", -+ sc->channels_max); -+ if (err >= 0 && sc->periods_min) -+ err = tplg_save_printf(dst, pfx, "\tperiods_min %u\n", -+ sc->periods_min); -+ if (err >= 0 && sc->periods_max) -+ err = tplg_save_printf(dst, pfx, "\tperiods_max %u\n", -+ sc->periods_max); -+ if (err >= 0 && sc->period_size_min) -+ err = tplg_save_printf(dst, pfx, "\tperiod_size_min %u\n", -+ sc->period_size_min); -+ if (err >= 0 && sc->period_size_max) -+ err = tplg_save_printf(dst, pfx, "\tperiod_size_max %u\n", -+ sc->period_size_max); -+ if (err >= 0 && sc->buffer_size_min) -+ err = tplg_save_printf(dst, pfx, "\tbuffer_size_min %u\n", -+ sc->buffer_size_min); -+ if (err >= 0 && sc->buffer_size_max) -+ err = tplg_save_printf(dst, pfx, "\tbuffer_size_max %u\n", -+ sc->buffer_size_max); -+ if (err >= 0) -+ err = tplg_save_printf(dst, pfx, "}\n"); -+ return err; -+} -+ - /* Parse the caps and config of a pcm stream */ - static int tplg_parse_streams(snd_tplg_t *tplg ATTRIBUTE_UNUSED, - snd_config_t *cfg, void *private) -@@ -598,6 +679,61 @@ static int tplg_parse_streams(snd_tplg_t *tplg ATTRIBUTE_UNUSED, - return 0; - } - -+/* Save the caps and config of a pcm stream */ -+int tplg_save_streams(snd_tplg_t *tplg ATTRIBUTE_UNUSED, -+ struct tplg_elem *elem, -+ char **dst, const char *pfx) -+{ -+ static const char *stream_ids[2] = { -+ "playback", -+ "capture" -+ }; -+ static unsigned int stream_types[2] = { -+ SND_SOC_TPLG_STREAM_PLAYBACK, -+ SND_SOC_TPLG_STREAM_CAPTURE -+ }; -+ struct snd_soc_tplg_stream_caps *caps; -+ unsigned int streams[2], stream; -+ const char *s; -+ int err; -+ -+ switch (elem->type) { -+ case SND_TPLG_TYPE_PCM: -+ streams[0] = elem->pcm->playback; -+ streams[1] = elem->pcm->capture; -+ caps = elem->pcm->caps; -+ break; -+ case SND_TPLG_TYPE_DAI: -+ streams[0] = elem->dai->playback; -+ streams[1] = elem->dai->capture; -+ caps = elem->dai->caps; -+ break; -+ default: -+ return -EINVAL; -+ } -+ -+ for (stream = 0; stream < 2; stream++) { -+ if (streams[stream] == 0) -+ continue; -+ if (!caps) -+ continue; -+ s = caps[stream_types[stream]].name; -+ if (s[0] == '\0') -+ continue; -+ err = tplg_save_printf(dst, pfx, "pcm.%s {\n", stream_ids[stream]); -+ if (err < 0) -+ return err; -+ err = tplg_save_printf(dst, pfx, "\tcapabilities '%s'\n", s); -+ if (err < 0) -+ return err; -+ err = tplg_save_printf(dst, pfx, "}\n"); -+ if (err < 0) -+ return err; -+ } -+ -+ return 0; -+} -+ - /* Parse name and id of a front-end DAI (ie. cpu dai of a FE DAI link) */ - static int tplg_parse_fe_dai(snd_tplg_t *tplg ATTRIBUTE_UNUSED, - snd_config_t *cfg, void *private) -@@ -633,6 +769,19 @@ static int tplg_parse_fe_dai(snd_tplg_t *tplg ATTRIBUTE_UNUSED, - return 0; - } - -+/* Save the caps and config of a pcm stream */ -+int tplg_save_fe_dai(snd_tplg_t *tplg ATTRIBUTE_UNUSED, -+ struct tplg_elem *elem, -+ char **dst, const char *pfx) -+{ -+ struct snd_soc_tplg_pcm *pcm = elem->pcm; -+ int err = 0; -+ -+ if (pcm->dai_id > 0) -+ err = tplg_save_printf(dst, pfx, "dai.0.id %u\n", pcm->dai_id); -+ return err; -+} -+ - /* parse a flag bit of the given mask */ - static int parse_flag(snd_config_t *n, unsigned int mask_in, - unsigned int *mask, unsigned int *flags) -@@ -652,6 +801,32 @@ static int parse_flag(snd_config_t *n, unsigned int mask_in, - return 0; - } - -+static int save_flags(unsigned int flags, unsigned int mask, -+ char **dst, const char *pfx) -+{ -+ static unsigned int flag_masks[3] = { -+ SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_RATES, -+ SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_CHANNELS, -+ SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS, -+ }; -+ static const char *flag_ids[3] = { -+ "symmetric_rates", -+ "symmetric_channels", -+ "symmetric_sample_bits", -+ }; -+ unsigned int i; -+ int err = 0; -+ -+ for (i = 0; err >= 0 && i < ARRAY_SIZE(flag_masks); i++) { -+ if (mask & flag_masks[i]) { -+ unsigned int v = (flags & flag_masks[i]) ? 1 : 0; -+ err = tplg_save_printf(dst, pfx, "%s %u\n", -+ flag_ids[i], v); -+ } -+ } -+ return err; -+} -+ - /* Parse PCM (for front end DAI & DAI link) in text conf file */ - int tplg_parse_pcm(snd_tplg_t *tplg, snd_config_t *cfg, - void *private ATTRIBUTE_UNUSED) -@@ -748,7 +923,7 @@ int tplg_parse_pcm(snd_tplg_t *tplg, snd_config_t *cfg, - - /* private data */ - if (strcmp(id, "data") == 0) { -- err = tplg_parse_data_refs(n, elem); -+ err = tplg_parse_refs(n, elem, SND_TPLG_TYPE_DATA); - if (err < 0) - return err; - continue; -@@ -758,6 +933,40 @@ int tplg_parse_pcm(snd_tplg_t *tplg, snd_config_t *cfg, - return 0; - } - -+/* save PCM */ -+int tplg_save_pcm(snd_tplg_t *tplg ATTRIBUTE_UNUSED, -+ struct tplg_elem *elem, -+ char **dst, const char *pfx) -+{ -+ struct snd_soc_tplg_pcm *pcm = elem->pcm; -+ char pfx2[16]; -+ int err; -+ -+ snprintf(pfx2, sizeof(pfx2), "%s\t", pfx ?: ""); -+ err = tplg_save_printf(dst, NULL, "'%s' {\n", elem->id); -+ if (err >= 0 && elem->index) -+ err = tplg_save_printf(dst, pfx, "\tindex %u\n", -+ elem->index); -+ if (err >= 0 && pcm->pcm_id) -+ err = tplg_save_printf(dst, pfx, "\tid %u\n", -+ pcm->pcm_id); -+ if (err >= 0 && pcm->compress) -+ err = tplg_save_printf(dst, pfx, "\tcompress 1\n"); -+ snprintf(pfx2, sizeof(pfx2), "%s\t", pfx ?: ""); -+ if (err >= 0) -+ err = tplg_save_fe_dai(tplg, elem, dst, pfx2); -+ if (err >= 0) -+ err = tplg_save_streams(tplg, elem, dst, pfx2); -+ if (err >= 0) -+ err = save_flags(pcm->flags, pcm->flag_mask, dst, pfx); -+ if (err >= 0) -+ err = tplg_save_refs(tplg, elem, SND_TPLG_TYPE_DATA, -+ "data", dst, pfx2); -+ if (err >= 0) -+ err = tplg_save_printf(dst, pfx, "}\n"); -+ return err; -+} -+ - /* Parse physical DAI */ - int tplg_parse_dai(snd_tplg_t *tplg, snd_config_t *cfg, - void *private ATTRIBUTE_UNUSED) -@@ -766,7 +975,7 @@ int tplg_parse_dai(snd_tplg_t *tplg, snd_config_t *cfg, - struct tplg_elem *elem; - snd_config_iterator_t i, next; - snd_config_t *n; -- const char *id, *val = NULL; -+ const char *id; - int err; - - elem = tplg_elem_new_common(tplg, cfg, NULL, SND_TPLG_TYPE_DAI); -@@ -851,11 +1060,9 @@ int tplg_parse_dai(snd_tplg_t *tplg, snd_config_t *cfg, - - /* private data */ - if (strcmp(id, "data") == 0) { -- if (snd_config_get_string(n, &val) < 0) -- return -EINVAL; -- -- tplg_ref_add(elem, SND_TPLG_TYPE_DATA, val); -- tplg_dbg("\t%s: %s\n", id, val); -+ err = tplg_parse_refs(n, elem, SND_TPLG_TYPE_DATA); -+ if (err < 0) -+ return err; - continue; - } - } -@@ -863,55 +1070,55 @@ int tplg_parse_dai(snd_tplg_t *tplg, snd_config_t *cfg, - return 0; - } - -+/* save DAI */ -+int tplg_save_dai(snd_tplg_t *tplg ATTRIBUTE_UNUSED, -+ struct tplg_elem *elem, -+ char **dst, const char *pfx) -+{ -+ struct snd_soc_tplg_dai *dai = elem->dai; -+ char pfx2[16]; -+ int err; -+ -+ if (!dai) -+ return 0; -+ snprintf(pfx2, sizeof(pfx2), "%s\t", pfx ?: ""); -+ err = tplg_save_printf(dst, NULL, "'%s' {\n", elem->id); -+ if (err >= 0 && elem->index) -+ err = tplg_save_printf(dst, pfx, "\tindex %u\n", -+ elem->index); -+ if (err >= 0 && dai->dai_id) -+ err = tplg_save_printf(dst, pfx, "\tid %u\n", -+ dai->dai_id); -+ if (err >= 0 && dai->playback) -+ err = tplg_save_printf(dst, pfx, "\tplayback %u\n", -+ dai->playback); -+ if (err >= 0 && dai->capture) -+ err = tplg_save_printf(dst, pfx, "\tcapture %u\n", -+ dai->capture); -+ if (err >= 0) -+ err = tplg_save_streams(tplg, elem, dst, pfx2); -+ if (err >= 0) -+ err = save_flags(dai->flags, dai->flag_mask, dst, pfx); -+ if (err >= 0) -+ err = tplg_save_refs(tplg, elem, SND_TPLG_TYPE_DATA, -+ "data", dst, pfx2); -+ if (err >= 0) -+ err = tplg_save_printf(dst, pfx, "}\n"); -+ return err; -+} -+ - /* parse physical link runtime supported HW configs in text conf file */ - static int parse_hw_config_refs(snd_tplg_t *tplg ATTRIBUTE_UNUSED, - snd_config_t *cfg, - struct tplg_elem *elem) - { - struct snd_soc_tplg_link_config *link = elem->link; -- snd_config_type_t type; -- snd_config_iterator_t i, next; -- snd_config_t *n; -- const char *id, *val = NULL; -- -- if (snd_config_get_id(cfg, &id) < 0) -- return -EINVAL; -- type = snd_config_get_type(cfg); -- -- /* refer to a single HW config */ -- if (type == SND_CONFIG_TYPE_STRING) { -- if (snd_config_get_string(cfg, &val) < 0) -- return -EINVAL; -- -- link->num_hw_configs = 1; -- return tplg_ref_add(elem, SND_TPLG_TYPE_HW_CONFIG, val); -- } -- -- if (type != SND_CONFIG_TYPE_COMPOUND) { -- SNDERR("error: compound type expected for %s", id); -- return -EINVAL; -- } -- -- /* refer to a list of HW configs */ -- snd_config_for_each(i, next, cfg) { -- const char *val; -- int err; -- -- n = snd_config_iterator_entry(i); -- if (snd_config_get_string(n, &val) < 0) -- continue; -- -- if (link->num_hw_configs >= SND_SOC_TPLG_HW_CONFIG_MAX) { -- SNDERR("error: exceed max hw configs for link %s", id); -- return -EINVAL; -- } -- -- link->num_hw_configs++; -- err = tplg_ref_add(elem, SND_TPLG_TYPE_HW_CONFIG, val); -- if (err < 0) -- return err; -- } -+ int err; - -+ err = tplg_parse_refs(cfg, elem, SND_TPLG_TYPE_HW_CONFIG); -+ if (err < 0) -+ return err; -+ link->num_hw_configs = err; - return 0; - } - -@@ -1007,7 +1214,7 @@ int tplg_parse_link(snd_tplg_t *tplg, - - /* private data */ - if (strcmp(id, "data") == 0) { -- err = tplg_parse_data_refs(n, elem); -+ err = tplg_parse_refs(n, elem, SND_TPLG_TYPE_DATA); - if (err < 0) - return err; - continue; -@@ -1017,6 +1224,44 @@ int tplg_parse_link(snd_tplg_t *tplg, - return 0; - } - -+/* save physical link */ -+int tplg_save_link(snd_tplg_t *tplg ATTRIBUTE_UNUSED, -+ struct tplg_elem *elem, -+ char **dst, const char *pfx) -+{ -+ struct snd_soc_tplg_link_config *link = elem->link; -+ char pfx2[16]; -+ int err; -+ -+ if (!link) -+ return 0; -+ snprintf(pfx2, sizeof(pfx2), "%s\t", pfx ?: ""); -+ err = tplg_save_printf(dst, NULL, "'%s' {\n", elem->id); -+ if (err >= 0 && elem->index) -+ err = tplg_save_printf(dst, pfx, "\tindex %u\n", -+ elem->index); -+ if (err >= 0 && link->id) -+ err = tplg_save_printf(dst, pfx, "\tid %u\n", -+ link->id); -+ if (err >= 0 && link->stream_name[0]) -+ err = tplg_save_printf(dst, pfx, "\tstream_name '%s'\n", -+ link->stream_name); -+ if (err >= 0 && link->default_hw_config_id) -+ err = tplg_save_printf(dst, pfx, "\tdefault_hw_conf_id %u\n", -+ link->default_hw_config_id); -+ if (err >= 0) -+ err = save_flags(link->flags, link->flag_mask, dst, pfx); -+ if (err >= 0) -+ err = tplg_save_refs(tplg, elem, SND_TPLG_TYPE_HW_CONFIG, -+ "hw_configs", dst, pfx2); -+ if (err >= 0) -+ err = tplg_save_refs(tplg, elem, SND_TPLG_TYPE_DATA, -+ "data", dst, pfx2); -+ if (err >= 0) -+ err = tplg_save_printf(dst, pfx, "}\n"); -+ return err; -+} -+ - /* Parse cc */ - int tplg_parse_cc(snd_tplg_t *tplg, - snd_config_t *cfg, void *private ATTRIBUTE_UNUSED) -@@ -1059,36 +1304,95 @@ int tplg_parse_cc(snd_tplg_t *tplg, - return 0; - } - --static int get_audio_hw_format(const char *val) -+/* save CC */ -+int tplg_save_cc(snd_tplg_t *tplg ATTRIBUTE_UNUSED, -+ struct tplg_elem *elem, -+ char **dst, const char *pfx) - { -- if (!strlen(val)) -- return -EINVAL; -- -- if (!strcmp(val, "I2S")) -- return SND_SOC_DAI_FORMAT_I2S; -+ struct snd_soc_tplg_link_config *link = elem->link; -+ char pfx2[16]; -+ int err; - -- if (!strcmp(val, "RIGHT_J")) -- return SND_SOC_DAI_FORMAT_RIGHT_J; -+ if (!link) -+ return 0; -+ snprintf(pfx2, sizeof(pfx2), "%s\t", pfx ?: ""); -+ err = tplg_save_printf(dst, NULL, "'%s' {\n", elem->id); -+ if (err >= 0 && elem->index) -+ err = tplg_save_printf(dst, pfx, "\tindex %u\n", -+ elem->index); -+ if (err >= 0 && link->id) -+ err = tplg_save_printf(dst, pfx, "\tid %u\n", -+ link->id); -+ if (err >= 0) -+ err = tplg_save_printf(dst, pfx, "}\n"); -+ return err; -+} - -- if (!strcmp(val, "LEFT_J")) -- return SND_SOC_DAI_FORMAT_LEFT_J; -+struct audio_hw_format { -+ unsigned int type; -+ const char *name; -+}; - -- if (!strcmp(val, "DSP_A")) -- return SND_SOC_DAI_FORMAT_DSP_A; -+static struct audio_hw_format audio_hw_formats[] = { -+ { -+ .type = SND_SOC_DAI_FORMAT_I2S, -+ .name = "I2S", -+ }, -+ { -+ .type = SND_SOC_DAI_FORMAT_RIGHT_J, -+ .name = "RIGHT_J", -+ }, -+ { -+ .type = SND_SOC_DAI_FORMAT_LEFT_J, -+ .name = "LEFT_J", -+ }, -+ { -+ .type = SND_SOC_DAI_FORMAT_DSP_A, -+ .name = "DSP_A", -+ }, -+ { -+ .type = SND_SOC_DAI_FORMAT_DSP_B, -+ .name = "DSP_B", -+ }, -+ { -+ .type = SND_SOC_DAI_FORMAT_AC97, -+ .name = "AC97", -+ }, -+ { -+ .type = SND_SOC_DAI_FORMAT_AC97, -+ .name = "AC97", -+ }, -+ { -+ .type = SND_SOC_DAI_FORMAT_PDM, -+ .name = "PDM", -+ }, -+}; - -- if (!strcmp(val, "DSP_B")) -- return SND_SOC_DAI_FORMAT_DSP_B; -+static int get_audio_hw_format(const char *val) -+{ -+ unsigned int i; - -- if (!strcmp(val, "AC97")) -- return SND_SOC_DAI_FORMAT_AC97; -+ if (val[0] == '\0') -+ return -EINVAL; - -- if (!strcmp(val, "PDM")) -- return SND_SOC_DAI_FORMAT_PDM; -+ for (i = 0; i < ARRAY_SIZE(audio_hw_formats); i++) -+ if (strcasecmp(audio_hw_formats[i].name, val) == 0) -+ return audio_hw_formats[i].type; - - SNDERR("error: invalid audio HW format %s\n", val); - return -EINVAL; - } - -+static const char *get_audio_hw_format_name(unsigned int type) -+{ -+ unsigned int i; -+ -+ for (i = 0; i < ARRAY_SIZE(audio_hw_formats); i++) -+ if (audio_hw_formats[i].type == type) -+ return audio_hw_formats[i].name; -+ return NULL; -+} -+ - int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, - void *private ATTRIBUTE_UNUSED) - { -@@ -1299,6 +1603,71 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, - return 0; - } - -+/* save hw config */ -+int tplg_save_hw_config(snd_tplg_t *tplg ATTRIBUTE_UNUSED, -+ struct tplg_elem *elem, -+ char **dst, const char *pfx) -+{ -+ struct snd_soc_tplg_hw_config *hc = elem->hw_cfg; -+ int err; -+ -+ err = tplg_save_printf(dst, NULL, "'%s' {\n", elem->id); -+ if (err >= 0 && hc->id) -+ err = tplg_save_printf(dst, pfx, "\tid %u\n", -+ hc->id); -+ if (err >= 0 && hc->fmt) -+ err = tplg_save_printf(dst, pfx, "\tformat '%s'\n", -+ get_audio_hw_format_name(hc->fmt)); -+ if (err >= 0 && hc->bclk_master) -+ err = tplg_save_printf(dst, pfx, "\tbclk '%s'\n", -+ hc->bclk_master == SND_SOC_TPLG_BCLK_CS ? -+ "codec_slave" : "codec_master"); -+ if (err >= 0 && hc->bclk_rate) -+ err = tplg_save_printf(dst, pfx, "\tbclk_freq %u\n", -+ hc->bclk_rate); -+ if (err >= 0 && hc->invert_bclk) -+ err = tplg_save_printf(dst, pfx, "\tbclk_invert 1\n"); -+ if (err >= 0 && hc->fsync_master) -+ err = tplg_save_printf(dst, pfx, "\tfsync_master '%s'\n", -+ hc->fsync_master == SND_SOC_TPLG_FSYNC_CS ? -+ "codec_slave" : "codec_master"); -+ if (err >= 0 && hc->fsync_rate) -+ err = tplg_save_printf(dst, pfx, "\tfsync_freq %u\n", -+ hc->fsync_rate); -+ if (err >= 0 && hc->invert_fsync) -+ err = tplg_save_printf(dst, pfx, "\tfsync_invert 1\n"); -+ if (err >= 0 && hc->mclk_rate) -+ err = tplg_save_printf(dst, pfx, "\tmclk_freq %u\n", -+ hc->mclk_rate); -+ if (err >= 0 && hc->mclk_direction) -+ err = tplg_save_printf(dst, pfx, "\tmclk '%s'\n", -+ hc->mclk_direction == SND_SOC_TPLG_MCLK_CI ? -+ "codec_mclk_in" : "codec_mclk_out"); -+ if (err >= 0 && hc->clock_gated) -+ err = tplg_save_printf(dst, pfx, "\tpm_gate_clocks 1\n"); -+ if (err >= 0 && hc->tdm_slots) -+ err = tplg_save_printf(dst, pfx, "\ttdm_slots %u\n", -+ hc->tdm_slots); -+ if (err >= 0 && hc->tdm_slot_width) -+ err = tplg_save_printf(dst, pfx, "\ttdm_slot_width %u\n", -+ hc->tdm_slot_width); -+ if (err >= 0 && hc->tx_slots) -+ err = tplg_save_printf(dst, pfx, "\ttx_slots %u\n", -+ hc->tx_slots); -+ if (err >= 0 && hc->rx_slots) -+ err = tplg_save_printf(dst, pfx, "\trx_slots %u\n", -+ hc->rx_slots); -+ if (err >= 0 && hc->tx_channels) -+ err = tplg_save_printf(dst, pfx, "\ttx_channels %u\n", -+ hc->tx_channels); -+ if (err >= 0 && hc->rx_channels) -+ err = tplg_save_printf(dst, pfx, "\trx_channels %u\n", -+ hc->rx_channels); -+ if (err >= 0) -+ err = tplg_save_printf(dst, pfx, "}\n"); -+ return err; -+} -+ - /* copy stream object */ - static void tplg_add_stream_object(struct snd_soc_tplg_stream *strm, - struct snd_tplg_stream_template *strm_tpl) -diff --git a/src/topology/save.c b/src/topology/save.c -new file mode 100644 -index 00000000..0498911f ---- /dev/null -+++ b/src/topology/save.c -@@ -0,0 +1,632 @@ -+/* -+ Copyright(c) 2019 Red Hat Inc. -+ All rights reserved. -+ -+ This library is free software; you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of -+ the License, or (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU Lesser General Public License for more details. -+ -+ Authors: Jaroslav Kysela -+*/ -+ -+#include "list.h" -+#include "tplg_local.h" -+ -+#define SAVE_ALLOC_SHIFT (13) /* 8192 bytes */ -+ -+int tplg_save_printf(char **dst, const char *pfx, const char *fmt, ...) -+{ -+ va_list va; -+ char buf[1024], *s; -+ size_t n, l, t, pl; -+ -+ if (pfx == NULL) -+ pfx = ""; -+ -+ va_start(va, fmt); -+ n = vsnprintf(buf, sizeof(buf), fmt, va); -+ va_end(va); -+ -+ if (n >= sizeof(buf)) -+ return -EOVERFLOW; -+ -+ pl = strlen(pfx); -+ l = *dst ? strlen(*dst) : 0; -+ t = l + pl + n + 1; -+ /* allocate chunks */ -+ if (*dst == NULL || -+ (l >> SAVE_ALLOC_SHIFT) != (t >> SAVE_ALLOC_SHIFT)) { -+ s = realloc(*dst, ((t >> SAVE_ALLOC_SHIFT) + 1) << -+ SAVE_ALLOC_SHIFT); -+ if (s == NULL) { -+ free(*dst); -+ *dst = NULL; -+ return -ENOMEM; -+ } -+ } else { -+ s = *dst; -+ } -+ -+ if (pl > 0) -+ strcpy(s + l, pfx); -+ strcpy(s + l + pl, buf); -+ *dst = s; -+ return 0; -+} -+ -+int tplg_nice_value_format(char *dst, size_t dst_size, unsigned int value) -+{ -+ if ((value % 1000) != 0) { -+ if (value > 0xfffffff0) -+ return snprintf(dst, dst_size, "%d", (int)value); -+ if (value >= 0xffff0000) -+ return snprintf(dst, dst_size, "0x%x", value); -+ } -+ return snprintf(dst, dst_size, "%u", value); -+} -+ -+static int tplg_pprint_integer(snd_config_t *n, char **ret) -+{ -+ long lval; -+ int err, type; -+ char buf[16]; -+ -+ type = snd_config_get_type(n); -+ if (type == SND_CONFIG_TYPE_INTEGER) { -+ err = snd_config_get_integer(n, &lval); -+ if (err < 0) -+ return err; -+ if (lval < INT_MIN || lval > UINT_MAX) -+ return snd_config_get_ascii(n, ret); -+ } else if (type == SND_CONFIG_TYPE_INTEGER64) { -+ long long llval; -+ err = snd_config_get_integer64(n, &llval); -+ if (err < 0) -+ return err; -+ if (llval < INT_MIN || llval > UINT_MAX) -+ return snd_config_get_ascii(n, ret); -+ lval = llval; -+ } -+ err = tplg_nice_value_format(buf, sizeof(buf), (unsigned int)lval); -+ if (err < 0) -+ return err; -+ *ret = strdup(buf); -+ if (*ret == NULL) -+ return -ENOMEM; -+ return 0; -+} -+ -+static int tplg_check_array_item(const char *id, int index) -+{ -+ const char *p; -+ long int val; -+ -+ for (p = id; *p; p++) { -+ if (*p < '0' || *p > '9') -+ return 0; -+ } -+ -+ errno = 0; -+ val = strtol(id, NULL, 10); -+ return errno == 0 && val == index; -+} -+ -+static int _compar(const void *a, const void *b) -+{ -+ const snd_config_t *c1 = *(snd_config_t **)a; -+ const snd_config_t *c2 = *(snd_config_t **)b; -+ const char *id1, *id2; -+ if (snd_config_get_id(c1, &id1)) return 0; -+ if (snd_config_get_id(c2, &id2)) return 0; -+ return strcmp(id1, id2); -+} -+ -+static snd_config_t *sort_config(const char *id, snd_config_t *src) -+{ -+ snd_config_t *dst, **a; -+ snd_config_iterator_t i, next; -+ int index, array, count; -+ -+ if (snd_config_get_type(src) != SND_CONFIG_TYPE_COMPOUND) { -+ -+ if (snd_config_copy(&dst, src) >= 0) -+ return dst; -+ return NULL; -+ } -+ count = 0; -+ snd_config_for_each(i, next, src) -+ count++; -+ a = malloc(sizeof(dst) * count); -+ if (a == NULL) -+ return NULL; -+ index = array = 0; -+ snd_config_for_each(i, next, src) { -+ snd_config_t *s = snd_config_iterator_entry(i); -+ const char *id2; -+ a[index++] = s; -+ if (array < 0) -+ continue; -+ if (snd_config_get_id(s, &id2)) { -+ free(a); -+ return NULL; -+ } -+ if (array >= 0 && tplg_check_array_item(id2, array)) -+ array++; -+ else -+ array = -1; -+ } -+ if (array < 0) -+ qsort(a, count, sizeof(a[0]), _compar); -+ if (snd_config_make_compound(&dst, id, count == 1)) { -+ free(a); -+ return NULL; -+ } -+ for (index = 0; index < count; index++) { -+ snd_config_t *s = a[index]; -+ const char *id2; -+ if (snd_config_get_id(s, &id2)) { -+ snd_config_delete(dst); -+ free(a); -+ return NULL; -+ } -+ s = sort_config(id2, s); -+ if (s == NULL || snd_config_add(dst, s)) { -+ if (s) -+ snd_config_delete(s); -+ snd_config_delete(dst); -+ free(a); -+ return NULL; -+ } -+ } -+ free(a); -+ return dst; -+} -+ -+static int tplg_check_quoted(const unsigned char *p) -+{ -+ for ( ; *p != '\0'; p++) { -+ switch (*p) { -+ case ' ': -+ case '=': -+ case ';': -+ case ',': -+ case '.': -+ case '{': -+ case '}': -+ case '\'': -+ case '"': -+ return 1; -+ default: -+ if (*p <= 31 || *p >= 127) -+ return 1; -+ -+ } -+ } -+ return 0; -+} -+ -+static int tplg_save_quoted(char **dst, const char *str) -+{ -+ static const char nibble[16] = "0123456789abcdef"; -+ unsigned char *p, *d, *t; -+ int c; -+ -+ d = t = alloca(strlen(str) * 5 + 1 + 1); -+ for (p = (unsigned char *)str; *p != '\0'; p++) { -+ c = *p; -+ switch (c) { -+ case '\n': -+ *t++ = '\\'; -+ *t++ = 'n'; -+ break; -+ case '\t': -+ *t++ = '\\'; -+ *t++ = 't'; -+ break; -+ case '\v': -+ *t++ = '\\'; -+ *t++ = 'v'; -+ break; -+ case '\b': -+ *t++ = '\\'; -+ *t++ = 'b'; -+ break; -+ case '\r': -+ *t++ = '\\'; -+ *t++ = 'r'; -+ break; -+ case '\f': -+ *t++ = '\\'; -+ *t++ = 'f'; -+ break; -+ case '\'': -+ *t++ = '\\'; -+ *t++ = c; -+ break; -+ default: -+ if (c >= 32 && c <= 126) { -+ *t++ = c; -+ } else { -+ *t++ = '\\'; -+ *t++ = 'x'; -+ *t++ = nibble[(c >> 4) & 0x0f]; -+ *t++ = nibble[(c >> 0) & 0x0f]; -+ } -+ break; -+ } -+ } -+ *t = '\0'; -+ return tplg_save_printf(dst, NULL, "'%s'", d); -+} -+ -+static int tplg_save_string(char **dst, const char *str, int id) -+{ -+ const unsigned char *p = (const unsigned char *)str; -+ -+ if (!p || !*p) -+ return tplg_save_printf(dst, NULL, "''"); -+ -+ if (!id && ((*p >= '0' && *p <= '9') || *p == '-')) -+ return tplg_save_quoted(dst, str); -+ -+ if (tplg_check_quoted(p)) -+ return tplg_save_quoted(dst, str); -+ -+ return tplg_save_printf(dst, NULL, "%s", str); -+} -+ -+static int save_config(char **dst, int level, const char *delim, snd_config_t *src) -+{ -+ snd_config_iterator_t i, next; -+ snd_config_t *s; -+ const char *id; -+ char *pfx; -+ unsigned int count; -+ int type, err, quoted, array; -+ -+ if (delim == NULL) -+ delim = ""; -+ -+ type = snd_config_get_type(src); -+ if (type != SND_CONFIG_TYPE_COMPOUND) { -+ char *val; -+ if (type == SND_CONFIG_TYPE_INTEGER || -+ type == SND_CONFIG_TYPE_INTEGER64) { -+ err = tplg_pprint_integer(src, &val); -+ } else { -+ err = snd_config_get_ascii(src, &val); -+ } -+ if (err < 0) -+ return err; -+ if (type == SND_CONFIG_TYPE_STRING) { -+ /* hexa array pretty print */ -+ id = strchr(val, '\n'); -+ if (id) { -+ err = tplg_save_printf(dst, NULL, "\n"); -+ if (err < 0) -+ goto retval; -+ for (id++; *id == '\t'; id++) { -+ err = tplg_save_printf(dst, NULL, "\t"); -+ if (err < 0) -+ goto retval; -+ } -+ delim = ""; -+ } -+ err = tplg_save_printf(dst, NULL, "%s'%s'\n", delim, val); -+ } else { -+ err = tplg_save_printf(dst, NULL, "%s%s\n", delim, val); -+ } -+retval: -+ free(val); -+ return err; -+ } -+ -+ count = 0; -+ quoted = 0; -+ array = 0; -+ s = NULL; -+ snd_config_for_each(i, next, src) { -+ s = snd_config_iterator_entry(i); -+ err = snd_config_get_id(s, &id); -+ if (err < 0) -+ return err; -+ if (!quoted && tplg_check_quoted((unsigned char *)id)) -+ quoted = 1; -+ if (array >= 0 && tplg_check_array_item(id, array)) -+ array++; -+ else -+ array = -1; -+ count++; -+ } -+ if (count == 0) -+ return 0; -+ -+ if (count == 1) { -+ err = snd_config_get_id(s, &id); -+ if (err >= 0 && level > 0) -+ err = tplg_save_printf(dst, NULL, "."); -+ if (err >= 0) -+ err = tplg_save_string(dst, id, 1); -+ if (err >= 0) -+ err = save_config(dst, level, " ", s); -+ return err; -+ } -+ -+ pfx = alloca(level + 1); -+ memset(pfx, '\t', level); -+ pfx[level] = '\0'; -+ -+ if (level > 0) { -+ err = tplg_save_printf(dst, NULL, "%s%s\n", delim, -+ array >= 0 ? "[" : "{"); -+ if (err < 0) -+ return err; -+ } -+ -+ snd_config_for_each(i, next, src) { -+ s = snd_config_iterator_entry(i); -+ const char *id; -+ err = snd_config_get_id(s, &id); -+ if (err < 0) -+ return err; -+ err = tplg_save_printf(dst, pfx, ""); -+ if (err < 0) -+ return err; -+ if (array < 0) { -+ delim = " "; -+ if (quoted) { -+ err = tplg_save_quoted(dst, id); -+ } else { -+ err = tplg_save_string(dst, id, 1); -+ if (err < 0) -+ return err; -+ } -+ } else { -+ delim = ""; -+ } -+ err = save_config(dst, level + 1, delim, s); -+ if (err < 0) -+ return err; -+ } -+ -+ if (level > 0) { -+ pfx[level - 1] = '\0'; -+ err = tplg_save_printf(dst, pfx, "%s\n", -+ array >= 0 ? "]" : "}"); -+ if (err < 0) -+ return err; -+ } -+ -+ return 0; -+} -+ -+static int tplg_save(snd_tplg_t *tplg, char **dst, int gindex, const char *prefix) -+{ -+ struct tplg_table *tptr; -+ struct tplg_elem *elem; -+ struct list_head *list, *pos; -+ char pfx2[16]; -+ unsigned int index; -+ int err, count; -+ -+ snprintf(pfx2, sizeof(pfx2), "%s\t", prefix ?: ""); -+ -+ /* write all blocks */ -+ for (index = 0; index < tplg_table_items; index++) { -+ tptr = &tplg_table[index]; -+ list = (struct list_head *)((void *)tplg + tptr->loff); -+ -+ /* count elements */ -+ count = 0; -+ list_for_each(pos, list) { -+ elem = list_entry(pos, struct tplg_elem, list); -+ if (gindex >= 0 && elem->index != gindex) -+ continue; -+ if (tptr->save == NULL && tptr->gsave == NULL) { -+ SNDERR("unable to create %s block (no callback)", -+ tptr->id); -+ err = -ENXIO; -+ goto _err; -+ } -+ if (tptr->save) -+ count++; -+ } -+ -+ if (count == 0) -+ continue; -+ -+ if (count > 1) { -+ err = tplg_save_printf(dst, prefix, "%s {\n", -+ elem->table ? -+ elem->table->id : "_NOID_"); -+ } else { -+ err = tplg_save_printf(dst, prefix, "%s.", -+ elem->table ? -+ elem->table->id : "_NOID_"); -+ } -+ -+ if (err < 0) -+ goto _err; -+ -+ list_for_each(pos, list) { -+ elem = list_entry(pos, struct tplg_elem, list); -+ if (gindex >= 0 && elem->index != gindex) -+ continue; -+ if (count > 1) { -+ err = tplg_save_printf(dst, pfx2, ""); -+ if (err < 0) -+ goto _err; -+ } -+ err = tptr->save(tplg, elem, dst, count > 1 ? pfx2 : prefix); -+ if (err < 0) { -+ SNDERR("failed to save %s elements: %s", -+ tptr->id, snd_strerror(-err)); -+ goto _err; -+ } -+ } -+ if (count > 1) { -+ err = tplg_save_printf(dst, prefix, "}\n"); -+ if (err < 0) -+ goto _err; -+ } -+ } -+ -+ /* save globals */ -+ for (index = 0; index < tplg_table_items; index++) { -+ tptr = &tplg_table[index]; -+ if (tptr->gsave) { -+ err = tptr->gsave(tplg, gindex, dst, prefix); -+ if (err < 0) -+ goto _err; -+ } -+ } -+ -+ return 0; -+ -+_err: -+ free(*dst); -+ *dst = NULL; -+ return err; -+} -+ -+static int tplg_index_compar(const void *a, const void *b) -+{ -+ const int *a1 = a, *b1 = b; -+ return *a1 - *b1; -+} -+ -+static int tplg_index_groups(snd_tplg_t *tplg, int **indexes) -+{ -+ struct tplg_table *tptr; -+ struct tplg_elem *elem; -+ struct list_head *list, *pos; -+ unsigned int index, j, count, size; -+ int *a, *b; -+ -+ count = 0; -+ size = 16; -+ a = malloc(size * sizeof(a[0])); -+ -+ for (index = 0; index < tplg_table_items; index++) { -+ tptr = &tplg_table[index]; -+ list = (struct list_head *)((void *)tplg + tptr->loff); -+ list_for_each(pos, list) { -+ elem = list_entry(pos, struct tplg_elem, list); -+ for (j = 0; j < count; j++) { -+ if (a[j] == elem->index) -+ break; -+ } -+ if (j < count) -+ continue; -+ if (count + 1 >= size) { -+ size += 8; -+ b = realloc(a, size * sizeof(a[0])); -+ if (b == NULL) { -+ free(a); -+ return -ENOMEM; -+ } -+ a = b; -+ } -+ a[count++] = elem->index; -+ } -+ } -+ a[count] = -1; -+ -+ qsort(a, count, sizeof(a[0]), tplg_index_compar); -+ -+ *indexes = a; -+ return 0; -+} -+ -+int snd_tplg_save(snd_tplg_t *tplg, char **dst, int flags) -+{ -+ snd_input_t *in; -+ snd_config_t *top, *top2; -+ char *dst2; -+ int *indexes, *a; -+ int err; -+ -+ assert(tplg); -+ assert(dst); -+ *dst = NULL; -+ -+ if (flags & SND_TPLG_SAVE_GROUPS) { -+ err = tplg_index_groups(tplg, &indexes); -+ if (err < 0) -+ return err; -+ for (a = indexes; err >= 0 && *a >= 0; a++) { -+ err = tplg_save_printf(dst, NULL, -+ "IndexGroup.%d {\n", -+ *a); -+ if (err >= 0) -+ err = tplg_save(tplg, dst, *a, "\t"); -+ if (err >= 0) -+ err = tplg_save_printf(dst, NULL, "}\n"); -+ } -+ free(indexes); -+ } else { -+ err = tplg_save(tplg, dst, -1, NULL); -+ } -+ -+ if (err < 0) -+ goto _err; -+ -+ if (flags & SND_TPLG_SAVE_NOCHECK) -+ return 0; -+ -+ /* always load configuration - check */ -+ err = snd_input_buffer_open(&in, *dst, strlen(*dst)); -+ if (err < 0) { -+ SNDERR("could not create input buffer"); -+ goto _err; -+ } -+ -+ err = snd_config_top(&top); -+ if (err < 0) { -+ snd_input_close(in); -+ goto _err; -+ } -+ -+ err = snd_config_load(top, in); -+ snd_input_close(in); -+ if (err < 0) { -+ SNDERR("could not load configuration"); -+ snd_config_delete(top); -+ goto _err; -+ } -+ -+ if (flags & SND_TPLG_SAVE_SORT) { -+ top2 = sort_config(NULL, top); -+ if (top2 == NULL) { -+ SNDERR("could not sort configuration"); -+ snd_config_delete(top); -+ err = -EINVAL; -+ goto _err; -+ } -+ snd_config_delete(top); -+ top = top2; -+ } -+ -+ dst2 = NULL; -+ err = save_config(&dst2, 0, NULL, top); -+ snd_config_delete(top); -+ if (err < 0) { -+ SNDERR("could not save configuration"); -+ goto _err; -+ } -+ -+ free(*dst); -+ *dst = dst2; -+ return 0; -+ -+_err: -+ free(*dst); -+ *dst = NULL; -+ return err; -+} -diff --git a/src/topology/text.c b/src/topology/text.c -index f301a4de..e9386e7d 100644 ---- a/src/topology/text.c -+++ b/src/topology/text.c -@@ -89,3 +89,22 @@ int tplg_parse_text(snd_tplg_t *tplg, snd_config_t *cfg, - - return err; - } -+ -+/* save text data */ -+int tplg_save_text(snd_tplg_t *tplg ATTRIBUTE_UNUSED, -+ struct tplg_elem *elem, -+ char **dst, const char *pfx) -+{ -+ struct tplg_texts *texts = elem->texts; -+ unsigned int i; -+ int err; -+ -+ if (!texts || texts->num_items == 0) -+ return 0; -+ err = tplg_save_printf(dst, pfx, "'%s'.values [\n", elem->id); -+ for (i = 0; err >= 0 && i < texts->num_items; i++) -+ err = tplg_save_printf(dst, pfx, "\t'%s'\n", texts->items[i][0]); -+ if (err >= 0) -+ err = tplg_save_printf(dst, pfx, "]\n"); -+ return err; -+} -diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h -index bea88ba3..42a3aa96 100644 ---- a/src/topology/tplg_local.h -+++ b/src/topology/tplg_local.h -@@ -37,6 +37,7 @@ - - struct tplg_ref; - struct tplg_elem; -+struct tplg_table; - - typedef enum _snd_pcm_rates { - SND_PCM_RATE_UNKNOWN = -1, -@@ -147,6 +148,8 @@ struct tplg_vendor_tuples { - /* topology element */ - struct tplg_elem { - -+ struct tplg_table *table; -+ - char id[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; - - int index; -@@ -209,6 +212,10 @@ struct tplg_table { - unsigned enew: 1; - void (*free)(void *); - int (*parse)(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); -+ int (*save)(snd_tplg_t *tplg, struct tplg_elem *elem, -+ char **dst, const char *prefix); -+ int (*gsave)(snd_tplg_t *tplg, int index, -+ char **dst, const char *prefix); - }; - - extern struct tplg_table tplg_table[]; -@@ -250,7 +257,8 @@ int tplg_build_pcm_dai(snd_tplg_t *tplg, unsigned int type); - int tplg_copy_data(snd_tplg_t *tplg, struct tplg_elem *elem, - struct tplg_ref *ref); - --int tplg_parse_data_refs(snd_config_t *cfg, struct tplg_elem *elem); -+int tplg_parse_refs(snd_config_t *cfg, struct tplg_elem *elem, -+ unsigned int type); - - int tplg_ref_add(struct tplg_elem *elem, int type, const char* id); - int tplg_ref_add_elem(struct tplg_elem *elem, struct tplg_elem *elem_ref); -@@ -269,9 +277,11 @@ struct tplg_elem* tplg_elem_new_common(snd_tplg_t *tplg, - int tplg_get_integer(snd_config_t *n, int *val, int base); - int tplg_get_unsigned(snd_config_t *n, unsigned *val, int base); - -+const char *tplg_channel_name(int type); - int tplg_parse_channel(snd_tplg_t *tplg ATTRIBUTE_UNUSED, - snd_config_t *cfg, void *private); - -+const char *tplg_ops_name(int type); - int tplg_parse_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, - snd_config_t *cfg, void *private); - int tplg_parse_ext_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, -@@ -299,3 +309,49 @@ int tplg_build_links(snd_tplg_t *tplg, unsigned int type); - int tplg_add_link_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t); - int tplg_add_pcm_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t); - int tplg_add_dai_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t); -+ -+int tplg_nice_value_format(char *dst, size_t dst_size, unsigned int value); -+ -+int tplg_save_printf(char **dst, const char *prefix, const char *fmt, ...); -+int tplg_save_refs(snd_tplg_t *tplg, struct tplg_elem *elem, unsigned int type, -+ const char *id, char **dst, const char *pfx); -+int tplg_save_channels(snd_tplg_t *tplg, struct snd_soc_tplg_channel *channel, -+ unsigned int channel_count, char **dst, const char *pfx); -+int tplg_save_ops(snd_tplg_t *tplg, struct snd_soc_tplg_ctl_hdr *hdr, -+ char **dst, const char *pfx); -+int tplg_save_ext_ops(snd_tplg_t *tplg, struct snd_soc_tplg_bytes_control *be, -+ char **dst, const char *pfx); -+int tplg_save_manifest_data(snd_tplg_t *tplg, struct tplg_elem *elem, -+ char **dst, const char *pfx); -+int tplg_save_control_mixer(snd_tplg_t *tplg, struct tplg_elem *elem, -+ char **dst, const char *pfx); -+int tplg_save_control_enum(snd_tplg_t *tplg, struct tplg_elem *elem, -+ char **dst, const char *pfx); -+int tplg_save_control_bytes(snd_tplg_t *tplg, struct tplg_elem *elem, -+ char **dst, const char *pfx); -+int tplg_save_tlv(snd_tplg_t *tplg, struct tplg_elem *elem, -+ char **dst, const char *pfx); -+int tplg_save_data(snd_tplg_t *tplg, struct tplg_elem *elem, -+ char **dst, const char *pfx); -+int tplg_save_text(snd_tplg_t *tplg, struct tplg_elem *elem, -+ char **dst, const char *pfx); -+int tplg_save_tokens(snd_tplg_t *tplg, struct tplg_elem *elem, -+ char **dst, const char *pfx); -+int tplg_save_tuples(snd_tplg_t *tplg, struct tplg_elem *elem, -+ char **dst, const char *pfx); -+int tplg_save_dapm_graph(snd_tplg_t *tplg, int index, -+ char **dst, const char *pfx); -+int tplg_save_dapm_widget(snd_tplg_t *tplg, struct tplg_elem *elem, -+ char **dst, const char *pfx); -+int tplg_save_link(snd_tplg_t *tplg, struct tplg_elem *elem, -+ char **dst, const char *pfx); -+int tplg_save_cc(snd_tplg_t *tplg, struct tplg_elem *elem, -+ char **dst, const char *pfx); -+int tplg_save_pcm(snd_tplg_t *tplg, struct tplg_elem *elem, -+ char **dst, const char *pfx); -+int tplg_save_hw_config(snd_tplg_t *tplg, struct tplg_elem *elem, -+ char **dst, const char *pfx); -+int tplg_save_stream_caps(snd_tplg_t *tplg, struct tplg_elem *elem, -+ char **dst, const char *pfx); -+int tplg_save_dai(snd_tplg_t *tplg, struct tplg_elem *elem, -+ char **dst, const char *pfx); --- -2.24.1 - - -From b336aea507b80493cdae439f09f710eec4bcd4ae Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 20 Dec 2019 14:59:00 +0100 -Subject: [PATCH 44/69] topology: add snd_tplg_create() with flags - -Add SND_TPLG_CREATE_VERBOSE and SND_TPLG_CREATE_DAPM_NOSORT -flags for the special operations. - -Signed-off-by: Jaroslav Kysela ---- - include/topology.h | 10 ++++++++++ - src/topology/dapm.c | 5 ++++- - src/topology/parser.c | 10 +++++++++- - src/topology/tplg_local.h | 1 + - 4 files changed, 24 insertions(+), 2 deletions(-) - -diff --git a/include/topology.h b/include/topology.h -index 69aa5ed7..63c13a98 100644 ---- a/include/topology.h -+++ b/include/topology.h -@@ -771,12 +771,22 @@ enum snd_tplg_type { - /** Fit for all user cases */ - #define SND_TPLG_INDEX_ALL 0 - -+/** Flags for the snd_tplg_create */ -+#define SND_TPLG_CREATE_VERBOSE (1<<0) /*!< Verbose output */ -+#define SND_TPLG_CREATE_DAPM_NOSORT (1<<1) /*!< Do not sort DAPM objects by index */ -+ - /** - * \brief Create a new topology parser instance. - * \return New topology parser instance - */ - snd_tplg_t *snd_tplg_new(void); - -+/** -+ * \brief Create a new topology parser instance. -+ * \return New topology parser instance -+ */ -+snd_tplg_t *snd_tplg_create(int flags); -+ - /** - * \brief Free a topology parser instance. - * \param tplg Topology parser instance -diff --git a/src/topology/dapm.c b/src/topology/dapm.c -index 2bdacedc..d6c15fc1 100644 ---- a/src/topology/dapm.c -+++ b/src/topology/dapm.c -@@ -268,7 +268,10 @@ struct tplg_elem *tplg_elem_new_route(snd_tplg_t *tplg, int index) - return NULL; - - elem->index = index; -- tplg_elem_insert(elem, &tplg->route_list); -+ if (tplg->dapm_sort) -+ tplg_elem_insert(elem, &tplg->route_list); -+ else -+ list_add_tail(&elem->list, &tplg->route_list); - strcpy(elem->id, "line"); - elem->type = SND_TPLG_TYPE_DAPM_GRAPH; - elem->size = sizeof(*line); -diff --git a/src/topology/parser.c b/src/topology/parser.c -index de5edd1b..8f810f75 100644 ---- a/src/topology/parser.c -+++ b/src/topology/parser.c -@@ -432,7 +432,7 @@ static bool is_little_endian(void) - return false; - } - --snd_tplg_t *snd_tplg_new(void) -+snd_tplg_t *snd_tplg_create(int flags) - { - snd_tplg_t *tplg; - -@@ -445,6 +445,9 @@ snd_tplg_t *snd_tplg_new(void) - if (!tplg) - return NULL; - -+ tplg->verbose = !!(flags & SND_TPLG_CREATE_VERBOSE); -+ tplg->dapm_sort = (flags & SND_TPLG_CREATE_DAPM_NOSORT) == 0; -+ - tplg->manifest.size = sizeof(struct snd_soc_tplg_manifest); - - INIT_LIST_HEAD(&tplg->tlv_list); -@@ -469,6 +472,11 @@ snd_tplg_t *snd_tplg_new(void) - return tplg; - } - -+snd_tplg_t *snd_tplg_new(void) -+{ -+ return snd_tplg_create(0); -+} -+ - void snd_tplg_free(snd_tplg_t *tplg) - { - free(tplg->bin); -diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h -index 42a3aa96..74b3a55c 100644 ---- a/src/topology/tplg_local.h -+++ b/src/topology/tplg_local.h -@@ -66,6 +66,7 @@ struct snd_tplg { - size_t bin_size; - - int verbose; -+ unsigned int dapm_sort: 1; - unsigned int version; - - /* runtime state */ --- -2.24.1 - - -From 0793ef064a97afd0b1335af0d187ede227b90582 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 20 Dec 2019 21:28:30 +0100 -Subject: [PATCH 45/69] topology: add snd_tplg_version() function - -Signed-off-by: Jaroslav Kysela ---- - include/topology.h | 6 ++++++ - src/topology/parser.c | 5 +++++ - 2 files changed, 11 insertions(+) - -diff --git a/include/topology.h b/include/topology.h -index 63c13a98..37bced1a 100644 ---- a/include/topology.h -+++ b/include/topology.h -@@ -775,6 +775,12 @@ enum snd_tplg_type { - #define SND_TPLG_CREATE_VERBOSE (1<<0) /*!< Verbose output */ - #define SND_TPLG_CREATE_DAPM_NOSORT (1<<1) /*!< Do not sort DAPM objects by index */ - -+/** -+ * \brief Return the version of the topology library. -+ * \return A static string with the version number. -+ */ -+const char *snd_tplg_version(void); -+ - /** - * \brief Create a new topology parser instance. - * \return New topology parser instance -diff --git a/src/topology/parser.c b/src/topology/parser.c -index 8f810f75..1eaa24bd 100644 ---- a/src/topology/parser.c -+++ b/src/topology/parser.c -@@ -503,3 +503,8 @@ void snd_tplg_free(snd_tplg_t *tplg) - - free(tplg); - } -+ -+const char *snd_tplg_version(void) -+{ -+ return SND_LIB_VERSION_STR; -+} --- -2.24.1 - - -From f42b2c088a23e1c6156c0d5710efd7689b8c15be Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 20 Dec 2019 23:48:40 +0100 -Subject: [PATCH 46/69] topology: cleanup the SNDERR() calls - -- remove the wrong new lines -- remove error/warning prefixes (error is error) - -Signed-off-by: Jaroslav Kysela ---- - src/topology/builder.c | 16 ++++++------- - src/topology/channel.c | 2 +- - src/topology/ctl.c | 36 +++++++++++++--------------- - src/topology/dapm.c | 40 ++++++++++++++----------------- - src/topology/data.c | 53 +++++++++++++++++++++--------------------- - src/topology/parser.c | 33 +++++++++++++------------- - src/topology/pcm.c | 29 +++++++++++------------ - src/topology/text.c | 2 +- - 8 files changed, 99 insertions(+), 112 deletions(-) - -diff --git a/src/topology/builder.c b/src/topology/builder.c -index cadb5583..74c44405 100644 ---- a/src/topology/builder.c -+++ b/src/topology/builder.c -@@ -65,8 +65,8 @@ static ssize_t write_block_header(snd_tplg_t *tplg, unsigned int type, - - /* make sure file offset is aligned with the calculated HDR offset */ - if (tplg->bin_pos != tplg->next_hdr_pos) { -- SNDERR("error: New header is at offset 0x%zx but file" -- " offset 0x%zx is %s by %ld bytes\n", -+ SNDERR("New header is at offset 0x%zx but file" -+ " offset 0x%zx is %s by %ld bytes", - tplg->next_hdr_pos, tplg->bin_pos, - tplg->bin_pos > tplg->next_hdr_pos ? "ahead" : "behind", - labs(tplg->bin_pos - tplg->next_hdr_pos)); -@@ -108,7 +108,7 @@ static int write_elem_block(snd_tplg_t *tplg, - ret = write_block_header(tplg, tplg_type, elem->vendor_type, - tplg->version, elem->index, block_size, count); - if (ret < 0) { -- SNDERR("error: failed to write %s block %d\n", -+ SNDERR("failed to write %s block %d", - obj_name, ret); - return ret; - } -@@ -148,7 +148,7 @@ static int write_elem_block(snd_tplg_t *tplg, - - /* make sure we have written the correct size */ - if (total_size != size) { -- SNDERR("error: size mismatch. Expected %zu wrote %zu\n", -+ SNDERR("size mismatch. Expected %zu wrote %zu", - size, total_size); - return -EIO; - } -@@ -221,7 +221,7 @@ static ssize_t write_manifest_data(snd_tplg_t *tplg) - tplg->version, 0, - sizeof(tplg->manifest) + tplg->manifest.priv.size, 1); - if (ret < 0) { -- SNDERR("error: failed to write manifest block\n"); -+ SNDERR("failed to write manifest block"); - return ret; - } - -@@ -266,7 +266,7 @@ int tplg_write_data(snd_tplg_t *tplg) - /* write manifest */ - ret = write_manifest_data(tplg); - if (ret < 0) { -- SNDERR("failed to write manifest %d\n", ret); -+ SNDERR("failed to write manifest %d", ret); - return ret; - } - -@@ -286,7 +286,7 @@ int tplg_write_data(snd_tplg_t *tplg) - ret = write_elem_block(tplg, list, size, - tptr->tsoc, tptr->name); - if (ret < 0) { -- SNDERR("failed to write %s elements: %s\n", -+ SNDERR("failed to write %s elements: %s", - tptr->name, snd_strerror(-ret)); - return ret; - } -@@ -295,7 +295,7 @@ int tplg_write_data(snd_tplg_t *tplg) - verbose(tplg, "total size is 0x%zx/%zd\n", tplg->bin_pos, tplg->bin_pos); - - if (total_size != tplg->bin_pos) { -- SNDERR("total size mismatch (%zd != %zd)\n", -+ SNDERR("total size mismatch (%zd != %zd)", - total_size, tplg->bin_pos); - return -EINVAL; - } -diff --git a/src/topology/channel.c b/src/topology/channel.c -index b54a10c8..110775a8 100644 ---- a/src/topology/channel.c -+++ b/src/topology/channel.c -@@ -104,7 +104,7 @@ int tplg_parse_channel(snd_tplg_t *tplg, snd_config_t *cfg, - - channel_id = lookup_channel(id); - if (channel_id < 0) { -- SNDERR("error: invalid channel %s\n", id); -+ SNDERR("invalid channel %s", id); - return -EINVAL; - } - -diff --git a/src/topology/ctl.c b/src/topology/ctl.c -index 979cc1b0..03874b27 100644 ---- a/src/topology/ctl.c -+++ b/src/topology/ctl.c -@@ -94,7 +94,7 @@ int parse_access(snd_config_t *cfg, - if (strcmp(id, "access") == 0) { - err = parse_access_values(n, hdr); - if (err < 0) { -- SNDERR("error: failed to parse access"); -+ SNDERR("failed to parse access"); - return err; - } - continue; -@@ -187,8 +187,8 @@ static int tplg_build_mixer_control(snd_tplg_t *tplg, - } - - if (!ref->elem) { -- SNDERR("error: cannot find '%s' referenced by" -- " control '%s'\n", ref->id, elem->id); -+ SNDERR("cannot find '%s' referenced by" -+ " control '%s'", ref->id, elem->id); - return -EINVAL; - } else if (err < 0) - return err; -@@ -236,8 +236,8 @@ static int tplg_build_enum_control(snd_tplg_t *tplg, - return err; - } - if (!ref->elem) { -- SNDERR("error: cannot find '%s' referenced by" -- " control '%s'\n", ref->id, elem->id); -+ SNDERR("cannot find '%s' referenced by" -+ " control '%s'", ref->id, elem->id); - return -EINVAL; - } - } -@@ -341,10 +341,8 @@ static int tplg_parse_tlv_dbscale(snd_config_t *cfg, struct tplg_elem *elem) - n = snd_config_iterator_entry(i); - - /* get ID */ -- if (snd_config_get_id(n, &id) < 0) { -- SNDERR("error: cant get ID\n"); -+ if (snd_config_get_id(n, &id) < 0) - return -EINVAL; -- } - - /* get value */ - if (tplg_get_integer(n, &val, 0)) -@@ -360,7 +358,7 @@ static int tplg_parse_tlv_dbscale(snd_config_t *cfg, struct tplg_elem *elem) - else if (strcmp(id, "mute") == 0) - scale->mute = val; - else -- SNDERR("error: unknown key %s\n", id); -+ SNDERR("unknown id '%s'", id); - } - - return 0; -@@ -389,7 +387,7 @@ int tplg_parse_tlv(snd_tplg_t *tplg, snd_config_t *cfg, - if (strcmp(id, "scale") == 0) { - err = tplg_parse_tlv_dbscale(n, elem); - if (err < 0) { -- SNDERR("error: failed to DBScale"); -+ SNDERR("failed to DBScale"); - return err; - } - continue; -@@ -651,8 +649,7 @@ int tplg_parse_control_enum(snd_tplg_t *tplg, snd_config_t *cfg, - - if (strcmp(id, "channel") == 0) { - if (ec->num_channels >= SND_SOC_TPLG_MAX_CHAN) { -- SNDERR("error: too many channels %s\n", -- elem->id); -+ SNDERR("too many channels %s", elem->id); - return -EINVAL; - } - -@@ -779,8 +776,7 @@ int tplg_parse_control_mixer(snd_tplg_t *tplg, - - if (strcmp(id, "channel") == 0) { - if (mc->num_channels >= SND_SOC_TPLG_MAX_CHAN) { -- SNDERR("error: too many channels %s\n", -- elem->id); -+ SNDERR("too many channels %s", elem->id); - return -EINVAL; - } - -@@ -933,7 +929,7 @@ static int init_ctl_hdr(struct snd_soc_tplg_ctl_hdr *hdr, - struct snd_soc_tplg_tlv_dbscale *scale; - - if (!tlvt) { -- SNDERR("error: missing TLV data\n"); -+ SNDERR("missing TLV data"); - return -EINVAL; - } - -@@ -952,7 +948,7 @@ static int init_ctl_hdr(struct snd_soc_tplg_ctl_hdr *hdr, - - /* TODO: add support for other TLV types */ - default: -- SNDERR("error: unsupported TLV type %d\n", tlv->type); -+ SNDERR("unsupported TLV type %d", tlv->type); - break; - } - } -@@ -971,7 +967,7 @@ int tplg_add_mixer(snd_tplg_t *tplg, struct snd_tplg_mixer_template *mixer, - tplg_dbg(" Control Mixer: %s\n", mixer->hdr.name); - - if (mixer->hdr.type != SND_SOC_TPLG_TYPE_MIXER) { -- SNDERR("error: invalid mixer type %d\n", mixer->hdr.type); -+ SNDERR("invalid mixer type %d", mixer->hdr.type); - return -EINVAL; - } - -@@ -1039,7 +1035,7 @@ int tplg_add_enum(snd_tplg_t *tplg, struct snd_tplg_enum_template *enum_ctl, - tplg_dbg(" Control Enum: %s\n", enum_ctl->hdr.name); - - if (enum_ctl->hdr.type != SND_SOC_TPLG_TYPE_ENUM) { -- SNDERR("error: invalid enum type %d\n", enum_ctl->hdr.type); -+ SNDERR("invalid enum type %d", enum_ctl->hdr.type); - return -EINVAL; - } - -@@ -1113,7 +1109,7 @@ int tplg_add_bytes(snd_tplg_t *tplg, struct snd_tplg_bytes_template *bytes_ctl, - tplg_dbg(" Control Bytes: %s\n", bytes_ctl->hdr.name); - - if (bytes_ctl->hdr.type != SND_SOC_TPLG_TYPE_BYTES) { -- SNDERR("error: invalid bytes type %d\n", bytes_ctl->hdr.type); -+ SNDERR("invalid bytes type %d", bytes_ctl->hdr.type); - return -EINVAL; - } - -@@ -1157,7 +1153,7 @@ int tplg_add_bytes(snd_tplg_t *tplg, struct snd_tplg_bytes_template *bytes_ctl, - if (be->hdr.access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK) { - if ((be->hdr.access & SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE) - != SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE) { -- SNDERR("error: Invalid TLV bytes control access 0x%x\n", -+ SNDERR("Invalid TLV bytes control access 0x%x", - be->hdr.access); - tplg_elem_free(elem); - return -EINVAL; -diff --git a/src/topology/dapm.c b/src/topology/dapm.c -index d6c15fc1..f61fe071 100644 ---- a/src/topology/dapm.c -+++ b/src/topology/dapm.c -@@ -154,8 +154,7 @@ static int tplg_build_widget(snd_tplg_t *tplg, struct tplg_elem *elem) - } - - if (!ref->elem) { -- SNDERR("error: cannot find '%s'" -- " referenced by widget '%s'\n", -+ SNDERR("cannot find '%s' referenced by widget '%s'", - ref->id, elem->id); - return -EINVAL; - } -@@ -179,8 +178,7 @@ int tplg_build_widgets(snd_tplg_t *tplg) - - elem = list_entry(pos, struct tplg_elem, list); - if (!elem->widget || elem->type != SND_TPLG_TYPE_DAPM_WIDGET) { -- SNDERR("error: invalid widget '%s'\n", -- elem->id); -+ SNDERR("invalid widget '%s'", elem->id); - return -EINVAL; - } - -@@ -207,8 +205,7 @@ int tplg_build_routes(snd_tplg_t *tplg) - elem = list_entry(pos, struct tplg_elem, list); - - if (!elem->route || elem->type != SND_TPLG_TYPE_DAPM_GRAPH) { -- SNDERR("error: invalid route '%s'\n", -- elem->id); -+ SNDERR("invalid route '%s'", elem->id); - return -EINVAL; - } - -@@ -218,14 +215,13 @@ int tplg_build_routes(snd_tplg_t *tplg) - - /* validate sink */ - if (strlen(route->sink) <= 0) { -- SNDERR("error: no sink\n"); -+ SNDERR("no sink"); - return -EINVAL; - - } - if (!tplg_elem_lookup(&tplg->widget_list, route->sink, - SND_TPLG_TYPE_DAPM_WIDGET, SND_TPLG_INDEX_ALL)) { -- SNDERR("warning: undefined sink widget/stream '%s'\n", -- route->sink); -+ SNDERR("undefined sink widget/stream '%s'", route->sink); - } - - /* validate control name */ -@@ -234,21 +230,21 @@ int tplg_build_routes(snd_tplg_t *tplg) - SND_TPLG_TYPE_MIXER, elem->index) && - !tplg_elem_lookup(&tplg->enum_list, route->control, - SND_TPLG_TYPE_ENUM, elem->index)) { -- SNDERR("warning: Undefined mixer/enum control '%s'\n", -- route->control); -+ SNDERR("Undefined mixer/enum control '%s'", -+ route->control); - } - } - - /* validate source */ - if (strlen(route->source) <= 0) { -- SNDERR("error: no source\n"); -+ SNDERR("no source"); - return -EINVAL; - - } - if (!tplg_elem_lookup(&tplg->widget_list, route->source, - SND_TPLG_TYPE_DAPM_WIDGET, SND_TPLG_INDEX_ALL)) { -- SNDERR("warning: Undefined source widget/stream '%s'\n", -- route->source); -+ SNDERR("Undefined source widget/stream '%s'", -+ route->source); - } - - /* add graph to manifest */ -@@ -300,7 +296,7 @@ static int tplg_parse_line(const char *text, - - len = strlen(buf); - if (len <= 2) { -- SNDERR("error: invalid route \"%s\"\n", buf); -+ SNDERR("invalid route \"%s\"", buf); - return -EINVAL; - } - -@@ -309,7 +305,7 @@ static int tplg_parse_line(const char *text, - if (buf[i] == ',') - goto second; - } -- SNDERR("error: invalid route \"%s\"\n", buf); -+ SNDERR("invalid route \"%s\"", buf); - return -EINVAL; - - second: -@@ -323,7 +319,7 @@ second: - goto done; - } - -- SNDERR("error: invalid route \"%s\"\n", buf); -+ SNDERR("invalid route \"%s\"", buf); - return -EINVAL; - - done: -@@ -378,7 +374,7 @@ int tplg_parse_dapm_graph(snd_tplg_t *tplg, snd_config_t *cfg, - int index = -1; - - if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) { -- SNDERR("error: compound is expected for dapm graph definition\n"); -+ SNDERR("compound is expected for dapm graph definition"); - return -EINVAL; - } - -@@ -401,13 +397,13 @@ int tplg_parse_dapm_graph(snd_tplg_t *tplg, snd_config_t *cfg, - - if (strcmp(id, "lines") == 0) { - if (index < 0) { -- SNDERR("error: failed to parse dapm graph %s, missing index\n", -+ SNDERR("failed to parse dapm graph %s, missing index", - graph_id); - return -EINVAL; - } - err = tplg_parse_routes(tplg, n, index); - if (err < 0) { -- SNDERR("error: failed to parse dapm graph %s\n", -+ SNDERR("failed to parse dapm graph %s", - graph_id); - return err; - } -@@ -528,7 +524,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, - - widget_type = lookup_widget(val); - if (widget_type < 0){ -- SNDERR("Widget '%s': Unsupported widget type %s\n", -+ SNDERR("widget '%s': Unsupported widget type %s", - elem->id, val); - return -EINVAL; - } -@@ -821,7 +817,7 @@ int tplg_add_widget_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) - break; - - default: -- SNDERR("error: widget %s: invalid type %d for ctl %d\n", -+ SNDERR("widget %s: invalid type %d for ctl %d", - wt->name, ct->type, i); - break; - } -diff --git a/src/topology/data.c b/src/topology/data.c -index 11cd73f5..f00ed301 100644 ---- a/src/topology/data.c -+++ b/src/topology/data.c -@@ -61,7 +61,7 @@ struct snd_soc_tplg_private *get_priv_data(struct tplg_elem *elem) - priv = &elem->pcm->priv; - break; - default: -- SNDERR("error: '%s': no support for private data for type %d\n", -+ SNDERR("'%s': no support for private data for type %d", - elem->id, elem->type); - } - -@@ -95,7 +95,7 @@ int tplg_parse_refs(snd_config_t *cfg, struct tplg_elem *elem, - } - - if (cfg_type != SND_CONFIG_TYPE_COMPOUND) { -- SNDERR("error: compound type expected for %s", elem->id); -+ SNDERR("compound type expected for %s", elem->id); - return -EINVAL; - } - -@@ -183,8 +183,7 @@ static int tplg_parse_data_file(snd_config_t *cfg, struct tplg_elem *elem) - - fp = fopen(filename, "r"); - if (fp == NULL) { -- SNDERR("error: invalid data file path '%s'\n", -- filename); -+ SNDERR("invalid data file path '%s'", filename); - return -errno; - } - -@@ -192,12 +191,12 @@ static int tplg_parse_data_file(snd_config_t *cfg, struct tplg_elem *elem) - size = ftell(fp); - fseek(fp, 0L, SEEK_SET); - if (size <= 0) { -- SNDERR("error: invalid data file size %zu\n", size); -+ SNDERR("invalid data file size %zu", size); - ret = -EINVAL; - goto err; - } - if (size > TPLG_MAX_PRIV_SIZE) { -- SNDERR("error: data file too big %zu\n", size); -+ SNDERR("data file too big %zu", size); - ret = -EINVAL; - goto err; - } -@@ -350,7 +349,7 @@ static int get_uuid(const char *str, unsigned char *uuid_le) - if ((errno == ERANGE && val == ULONG_MAX) - || (errno != 0 && val == 0) - || (val > UCHAR_MAX)) { -- SNDERR("error: invalid value for uuid\n"); -+ SNDERR("invalid value for uuid"); - ret = -EINVAL; - goto out; - } -@@ -365,7 +364,7 @@ static int get_uuid(const char *str, unsigned char *uuid_le) - } - - if (values < 16) { -- SNDERR("error: less than 16 integers for uuid\n"); -+ SNDERR("less than 16 integers for uuid"); - ret = -EINVAL; - } - -@@ -446,7 +445,7 @@ static int tplg_parse_data_hex(snd_config_t *cfg, struct tplg_elem *elem, - - num = get_hex_num(value); - if (num <= 0) { -- SNDERR("error: malformed hex variable list %s\n", value); -+ SNDERR("malformed hex variable list %s", value); - return -EINVAL; - } - -@@ -454,7 +453,7 @@ static int tplg_parse_data_hex(snd_config_t *cfg, struct tplg_elem *elem, - priv = elem->data; - - if (size > TPLG_MAX_PRIV_SIZE) { -- SNDERR("error: data too big %d\n", size); -+ SNDERR("data too big %d", size); - return -EINVAL; - } - -@@ -492,7 +491,7 @@ static int get_token_value(const char *token_id, - return tokens->token[i].value; - } - -- SNDERR("error: cannot find token id '%s'\n", token_id); -+ SNDERR("cannot find token id '%s'", token_id); - return -1; - } - -@@ -579,7 +578,7 @@ static int copy_tuples(struct tplg_elem *elem, - * tuple_set->num_tuples; - size += set_size; - if (size > TPLG_MAX_PRIV_SIZE) { -- SNDERR("error: data too big %d\n", size); -+ SNDERR("data too big %d", size); - return -EINVAL; - } - -@@ -662,13 +661,13 @@ static int build_tuples(snd_tplg_t *tplg, struct tplg_elem *elem) - ref->id, SND_TPLG_TYPE_TUPLE, elem->index); - tuples = ref->elem; - if (!tuples) { -- SNDERR("error: cannot find tuples %s\n", ref->id); -+ SNDERR("cannot find tuples %s", ref->id); - return -EINVAL; - } - - tokens = get_tokens(tplg, tuples); - if (!tokens) { -- SNDERR("error: cannot find token for %s\n", ref->id); -+ SNDERR("cannot find token for %s", ref->id); - return -EINVAL; - } - -@@ -762,7 +761,7 @@ static int parse_tuple_set(snd_config_t *cfg, - - type = get_tuple_type(id); - if (type < 0) { -- SNDERR("error: invalid tuple type '%s'", id); -+ SNDERR("invalid tuple type '%s'", id); - return type; - } - -@@ -819,7 +818,7 @@ static int parse_tuple_set(snd_config_t *cfg, - case SND_SOC_TPLG_TUPLE_TYPE_WORD: - ival = tplg_get_unsigned(n, &tuple_val, 0); - if (ival < 0) { -- SNDERR("error: tuple %s: %s\n", id, snd_strerror(ival)); -+ SNDERR("tuple %s: %s", id, snd_strerror(ival)); - goto err; - } - -@@ -829,7 +828,7 @@ static int parse_tuple_set(snd_config_t *cfg, - && tuple_val > USHRT_MAX) - || (type == SND_SOC_TPLG_TUPLE_TYPE_BYTE - && tuple_val > UCHAR_MAX)) { -- SNDERR("error: tuple %s: invalid value\n", id); -+ SNDERR("tuple %s: invalid value", id); - goto err; - } - -@@ -941,7 +940,7 @@ static int parse_tuple_sets(snd_config_t *cfg, - - if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) { - if (snd_config_get_id(cfg, &id) >= 0) -- SNDERR("error: compound type expected for %s", id); -+ SNDERR("compound type expected for %s", id); - return -EINVAL; - } - -@@ -959,8 +958,8 @@ static int parse_tuple_sets(snd_config_t *cfg, - snd_config_for_each(i, next, cfg) { - n = snd_config_iterator_entry(i); - if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) { -- SNDERR("error: compound type expected for %s, is %d", -- id, snd_config_get_type(n)); -+ SNDERR("compound type expected for %s, is %d", -+ id, snd_config_get_type(n)); - return -EINVAL; - } - -@@ -1169,7 +1168,7 @@ int tplg_parse_manifest_data(snd_tplg_t *tplg, snd_config_t *cfg, - int err; - - if (!list_empty(&tplg->manifest_list)) { -- SNDERR("error: already has manifest data\n"); -+ SNDERR("already has manifest data"); - return -EINVAL; - } - -@@ -1326,7 +1325,7 @@ int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg, - if (strcmp(id, "file") == 0) { - err = tplg_parse_data_file(n, elem); - if (err < 0) { -- SNDERR("error: failed to parse data file\n"); -+ SNDERR("failed to parse data file"); - return err; - } - continue; -@@ -1335,7 +1334,7 @@ int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg, - if (strcmp(id, "bytes") == 0) { - err = tplg_parse_data_hex(n, elem, 1); - if (err < 0) { -- SNDERR("error: failed to parse data bytes\n"); -+ SNDERR("failed to parse data bytes"); - return err; - } - continue; -@@ -1344,7 +1343,7 @@ int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg, - if (strcmp(id, "shorts") == 0) { - err = tplg_parse_data_hex(n, elem, 2); - if (err < 0) { -- SNDERR("error: failed to parse data shorts\n"); -+ SNDERR("failed to parse data shorts"); - return err; - } - continue; -@@ -1353,7 +1352,7 @@ int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg, - if (strcmp(id, "words") == 0) { - err = tplg_parse_data_hex(n, elem, 4); - if (err < 0) { -- SNDERR("error: failed to parse data words\n"); -+ SNDERR("failed to parse data words"); - return err; - } - continue; -@@ -1470,8 +1469,8 @@ int tplg_copy_data(snd_tplg_t *tplg, struct tplg_elem *elem, - ref_elem = tplg_elem_lookup(&tplg->pdata_list, - ref->id, SND_TPLG_TYPE_DATA, elem->index); - if (!ref_elem) { -- SNDERR("error: cannot find data '%s' referenced by" -- " element '%s'\n", ref->id, elem->id); -+ SNDERR("cannot find data '%s' referenced by" -+ " element '%s'", ref->id, elem->id); - return -EINVAL; - } - -diff --git a/src/topology/parser.c b/src/topology/parser.c -index 1eaa24bd..5a5dd14f 100644 ---- a/src/topology/parser.c -+++ b/src/topology/parser.c -@@ -122,7 +122,7 @@ int tplg_parse_compound(snd_tplg_t *tplg, snd_config_t *cfg, - return -EINVAL; - - if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) { -- SNDERR("error: compound type expected for %s", id); -+ SNDERR("compound type expected for %s", id); - return -EINVAL; - } - -@@ -131,7 +131,7 @@ int tplg_parse_compound(snd_tplg_t *tplg, snd_config_t *cfg, - n = snd_config_iterator_entry(i); - - if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) { -- SNDERR("error: compound type expected for %s, is %d", -+ SNDERR("compound type expected for %s, is %d", - id, snd_config_get_type(cfg)); - return -EINVAL; - } -@@ -155,7 +155,7 @@ static int tplg_parse_config(snd_tplg_t *tplg, snd_config_t *cfg) - int err; - - if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) { -- SNDERR("error: compound type expected at top level"); -+ SNDERR("compound type expected at top level"); - return -EINVAL; - } - -@@ -180,7 +180,7 @@ static int tplg_parse_config(snd_tplg_t *tplg, snd_config_t *cfg) - } - - if (parser == NULL) { -- SNDERR("error: unknown section %s\n", id); -+ SNDERR("unknown section %s", id); - continue; - } - -@@ -202,7 +202,7 @@ static int tplg_load_config(snd_tplg_t *tplg, snd_input_t *in) - - ret = snd_config_load(top, in); - if (ret < 0) { -- SNDERR("error: could not load configuration"); -+ SNDERR("could not load configuration"); - snd_config_delete(top); - return ret; - } -@@ -210,7 +210,7 @@ static int tplg_load_config(snd_tplg_t *tplg, snd_input_t *in) - ret = tplg_parse_config(tplg, top); - snd_config_delete(top); - if (ret < 0) { -- SNDERR("error: failed to parse topology"); -+ SNDERR("failed to parse topology"); - return ret; - } - -@@ -267,7 +267,7 @@ int snd_tplg_load(snd_tplg_t *tplg, const char *buf, size_t size) - - err = snd_input_buffer_open(&in, buf, size); - if (err < 0) { -- SNDERR("error: could not create input buffer"); -+ SNDERR("could not create input buffer"); - return err; - } - -@@ -282,13 +282,13 @@ static int tplg_build(snd_tplg_t *tplg) - - err = tplg_build_integ(tplg); - if (err < 0) { -- SNDERR("error: failed to check topology integrity\n"); -+ SNDERR("failed to check topology integrity"); - return err; - } - - err = tplg_write_data(tplg); - if (err < 0) { -- SNDERR("error: failed to write data %d\n", err); -+ SNDERR("failed to write data %d", err); - return err; - } - return 0; -@@ -304,15 +304,14 @@ int snd_tplg_build_file(snd_tplg_t *tplg, - - fp = fopen(infile, "r"); - if (fp == NULL) { -- SNDERR("error: could not open configuration file %s", -- infile); -+ SNDERR("could not open configuration file %s", infile); - return -errno; - } - - err = snd_input_stdio_attach(&in, fp, 1); - if (err < 0) { - fclose(fp); -- SNDERR("error: could not attach stdio %s", infile); -+ SNDERR("could not attach stdio %s", infile); - return err; - } - -@@ -346,7 +345,7 @@ int snd_tplg_add_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) - case SND_TPLG_TYPE_CC: - return tplg_add_link_object(tplg, t); - default: -- SNDERR("error: invalid object type %d\n", t->type); -+ SNDERR("invalid object type %d", t->type); - return -EINVAL; - }; - } -@@ -362,18 +361,18 @@ int snd_tplg_build(snd_tplg_t *tplg, const char *outfile) - - fd = open(outfile, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); - if (fd < 0) { -- SNDERR("error: failed to open %s err %d\n", outfile, -errno); -+ SNDERR("failed to open %s err %d", outfile, -errno); - return -errno; - } - r = write(fd, tplg->bin, tplg->bin_size); - close(fd); - if (r < 0) { - err = -errno; -- SNDERR("error: write error: %s\n", strerror(errno)); -+ SNDERR("write error: %s", strerror(errno)); - return err; - } - if ((size_t)r != tplg->bin_size) { -- SNDERR("error: partial write (%zd != %zd)\n", r, tplg->bin_size); -+ SNDERR("partial write (%zd != %zd)", r, tplg->bin_size); - return -EIO; - } - return 0; -@@ -437,7 +436,7 @@ snd_tplg_t *snd_tplg_create(int flags) - snd_tplg_t *tplg; - - if (!is_little_endian()) { -- SNDERR("error: cannot support big-endian machines\n"); -+ SNDERR("cannot support big-endian machines"); - return NULL; - } - -diff --git a/src/topology/pcm.c b/src/topology/pcm.c -index d09fbe42..bc307081 100644 ---- a/src/topology/pcm.c -+++ b/src/topology/pcm.c -@@ -116,8 +116,8 @@ static int build_pcm(snd_tplg_t *tplg, struct tplg_elem *elem) - return err; - } - if (!ref->elem) { -- SNDERR("error: cannot find '%s' referenced by" -- " PCM '%s'\n", ref->id, elem->id); -+ SNDERR("cannot find '%s' referenced by" -+ " PCM '%s'", ref->id, elem->id); - return -EINVAL; - } - } -@@ -137,7 +137,7 @@ int tplg_build_pcms(snd_tplg_t *tplg, unsigned int type) - - elem = list_entry(pos, struct tplg_elem, list); - if (elem->type != type) { -- SNDERR("error: invalid elem '%s'\n", elem->id); -+ SNDERR("invalid elem '%s'", elem->id); - return -EINVAL; - } - -@@ -196,7 +196,7 @@ int tplg_build_dais(snd_tplg_t *tplg, unsigned int type) - - elem = list_entry(pos, struct tplg_elem, list); - if (elem->type != type) { -- SNDERR("error: invalid elem '%s'\n", elem->id); -+ SNDERR("invalid elem '%s'", elem->id); - return -EINVAL; - } - -@@ -251,8 +251,8 @@ static int build_link(snd_tplg_t *tplg, struct tplg_elem *elem) - ref->elem = tplg_elem_lookup(&tplg->hw_cfg_list, - ref->id, SND_TPLG_TYPE_HW_CONFIG, elem->index); - if (!ref->elem) { -- SNDERR("error: cannot find HW config '%s'" -- " referenced by link '%s'\n", -+ SNDERR("cannot find HW config '%s'" -+ " referenced by link '%s'", - ref->id, elem->id); - return -EINVAL; - } -@@ -320,7 +320,7 @@ static int split_format(struct snd_soc_tplg_stream_caps *caps, char *str) - while ((s != NULL) && (i < SND_SOC_TPLG_MAX_FORMATS)) { - format = snd_pcm_format_value(s); - if (format == SND_PCM_FORMAT_UNKNOWN) { -- SNDERR("error: unsupported stream format %s\n", s); -+ SNDERR("unsupported stream format %s", s); - return -EINVAL; - } - -@@ -363,7 +363,7 @@ static int split_rate(struct snd_soc_tplg_stream_caps *caps, char *str) - rate = get_rate_value(s); - - if (rate == SND_PCM_RATE_UNKNOWN) { -- SNDERR("error: unsupported stream rate %s\n", s); -+ SNDERR("unsupported stream rate %s", s); - return -EINVAL; - } - -@@ -758,7 +758,7 @@ static int tplg_parse_fe_dai(snd_tplg_t *tplg ATTRIBUTE_UNUSED, - - if (strcmp(id, "id") == 0) { - if (tplg_get_unsigned(n, &pcm->dai_id, 0)) { -- SNDERR("error: invalid fe dai ID\n"); -+ SNDERR("invalid fe dai ID"); - return -EINVAL; - } - -@@ -1379,7 +1379,7 @@ static int get_audio_hw_format(const char *val) - if (strcasecmp(audio_hw_formats[i].name, val) == 0) - return audio_hw_formats[i].type; - -- SNDERR("error: invalid audio HW format %s\n", val); -+ SNDERR("invalid audio HW format %s", val); - return -EINVAL; - } - -@@ -1452,8 +1452,7 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, - /* For backwards capability, - * "master" == "codec is slave" - */ -- SNDERR("warning: deprecated bclk value '%s'\n", -- val); -+ SNDERR("deprecated bclk value '%s'", val); - - hw_cfg->bclk_master = SND_SOC_TPLG_BCLK_CS; - } else if (!strcmp(val, "codec_slave")) { -@@ -1490,8 +1489,7 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, - /* For backwards capability, - * "master" == "codec is slave" - */ -- SNDERR("warning: deprecated fsync value '%s'\n", -- val); -+ SNDERR("deprecated fsync value '%s'", val); - - hw_cfg->fsync_master = SND_SOC_TPLG_FSYNC_CS; - } else if (!strcmp(val, "codec_slave")) { -@@ -1535,8 +1533,7 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, - /* For backwards capability, - * "master" == "for codec, mclk is input" - */ -- SNDERR("warning: deprecated mclk value '%s'\n", -- val); -+ SNDERR("deprecated mclk value '%s'", val); - - hw_cfg->mclk_direction = SND_SOC_TPLG_MCLK_CI; - } else if (!strcmp(val, "codec_mclk_in")) { -diff --git a/src/topology/text.c b/src/topology/text.c -index e9386e7d..6dbf2230 100644 ---- a/src/topology/text.c -+++ b/src/topology/text.c -@@ -38,7 +38,7 @@ static int parse_text_values(snd_config_t *cfg, struct tplg_elem *elem) - n = snd_config_iterator_entry(i); - - if (j == SND_SOC_TPLG_NUM_TEXTS) { -- tplg_dbg("error: text string number exceeds %d\n", j); -+ tplg_dbg("text string number exceeds %d\n", j); - return -ENOMEM; - } - --- -2.24.1 - - -From 712fbacf160f899582a9adc3f30f297211b063bb Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 27 Dec 2019 19:32:03 +0100 -Subject: [PATCH 47/69] topology: dapm - fix the SNDERR() - Undefined - -Signed-off-by: Jaroslav Kysela ---- - src/topology/dapm.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/topology/dapm.c b/src/topology/dapm.c -index f61fe071..88bddca3 100644 ---- a/src/topology/dapm.c -+++ b/src/topology/dapm.c -@@ -230,7 +230,7 @@ int tplg_build_routes(snd_tplg_t *tplg) - SND_TPLG_TYPE_MIXER, elem->index) && - !tplg_elem_lookup(&tplg->enum_list, route->control, - SND_TPLG_TYPE_ENUM, elem->index)) { -- SNDERR("Undefined mixer/enum control '%s'", -+ SNDERR("undefined mixer/enum control '%s'", - route->control); - } - } -@@ -243,7 +243,7 @@ int tplg_build_routes(snd_tplg_t *tplg) - } - if (!tplg_elem_lookup(&tplg->widget_list, route->source, - SND_TPLG_TYPE_DAPM_WIDGET, SND_TPLG_INDEX_ALL)) { -- SNDERR("Undefined source widget/stream '%s'", -+ SNDERR("undefined source widget/stream '%s'", - route->source); - } - --- -2.24.1 - - -From 07d779143bfd24448034cd55945b46c46407247c Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Sat, 28 Dec 2019 10:18:34 +0100 -Subject: [PATCH 48/69] topology: fix the unitialized tuples - -Signed-off-by: Jaroslav Kysela ---- - src/topology/data.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/topology/data.c b/src/topology/data.c -index f00ed301..4e43fcc9 100644 ---- a/src/topology/data.c -+++ b/src/topology/data.c -@@ -601,6 +601,7 @@ static int copy_tuples(struct tplg_elem *elem, - elem->data = priv; - - array = (struct snd_soc_tplg_vendor_array *)(priv->data + off); -+ memset(array, 0, set_size); - array->size = set_size; - array->type = tuple_set->type; - array->num_elems = tuple_set->num_tuples; --- -2.24.1 - - -From 2947d83c1322bcdb31c1da180acb0f779a63dcdd Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Sat, 28 Dec 2019 21:44:03 +0100 -Subject: [PATCH 49/69] topology: implement shorter hexa uuid 00:00 parser - -Signed-off-by: Jaroslav Kysela ---- - src/topology/data.c | 37 +++++++++++++++++++++++++++++++------ - 1 file changed, 31 insertions(+), 6 deletions(-) - -diff --git a/src/topology/data.c b/src/topology/data.c -index 4e43fcc9..1ddd3c50 100644 ---- a/src/topology/data.c -+++ b/src/topology/data.c -@@ -22,8 +22,8 @@ - #include - - #define UUID_FORMAT "\ --0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, \ --0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x" -+%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:\ -+%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x" - - /* Get private data buffer of an element */ - struct snd_soc_tplg_private *get_priv_data(struct tplg_elem *elem) -@@ -316,7 +316,6 @@ format2: - values++; - s += 2; - } -- s++; - } - - s++; -@@ -341,6 +340,32 @@ static int get_uuid(const char *str, unsigned char *uuid_le) - if (tmp == NULL) - return -ENOMEM; - -+ if (strchr(tmp, ':') == NULL) -+ goto data2; -+ -+ s = strtok(tmp, ":"); -+ while (s != NULL) { -+ errno = 0; -+ val = strtoul(s, NULL, 16); -+ if ((errno == ERANGE && val == ULONG_MAX) -+ || (errno != 0 && val == 0) -+ || (val > UCHAR_MAX)) { -+ SNDERR("invalid value for uuid"); -+ ret = -EINVAL; -+ goto out; -+ } -+ -+ *(uuid_le + values) = (unsigned char)val; -+ -+ values++; -+ if (values >= 16) -+ break; -+ -+ s = strtok(NULL, ":"); -+ } -+ goto out; -+ -+data2: - s = strtok(tmp, ","); - - while (s != NULL) { -@@ -354,7 +379,7 @@ static int get_uuid(const char *str, unsigned char *uuid_le) - goto out; - } - -- *(uuid_le + values) = (unsigned char)val; -+ *(uuid_le + values) = (unsigned char)val; - - values++; - if (values >= 16) -@@ -413,7 +438,7 @@ static int copy_data_hex(char *data, int off, const char *str, int width) - return -ENOMEM; - - p += off; -- s = strtok(tmp, ","); -+ s = strtok(tmp, ",:"); - - while (s != NULL) { - ret = write_hex(p, s, width); -@@ -422,7 +447,7 @@ static int copy_data_hex(char *data, int off, const char *str, int width) - return ret; - } - -- s = strtok(NULL, ","); -+ s = strtok(NULL, ",:"); - p += width; - } - --- -2.24.1 - - -From 1482d1f254fe42d83d904e52c911df8693b62653 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Sun, 29 Dec 2019 20:05:14 +0100 -Subject: [PATCH 50/69] topology: fix the TPLG_DEBUG compilation - -Signed-off-by: Jaroslav Kysela ---- - src/topology/channel.c | 2 +- - src/topology/data.c | 5 ++++- - src/topology/pcm.c | 2 +- - 3 files changed, 6 insertions(+), 3 deletions(-) - -diff --git a/src/topology/channel.c b/src/topology/channel.c -index 110775a8..390c3f16 100644 ---- a/src/topology/channel.c -+++ b/src/topology/channel.c -@@ -129,7 +129,7 @@ int tplg_parse_channel(snd_tplg_t *tplg, snd_config_t *cfg, - else if (strcmp(id, "shift") == 0) - channel->shift = value; - -- tplg_dbg("\t\t%s = %s\n", id, value); -+ tplg_dbg("\t\t%s = %d\n", id, value); - } - - tplg->channel_idx++; -diff --git a/src/topology/data.c b/src/topology/data.c -index 1ddd3c50..7b4bdccd 100644 ---- a/src/topology/data.c -+++ b/src/topology/data.c -@@ -230,9 +230,11 @@ err: - return ret; - } - --static void dump_priv_data(struct tplg_elem *elem) -+static void dump_priv_data(struct tplg_elem *elem ATTRIBUTE_UNUSED) - { -+#ifdef TPLG_DEBUG - struct snd_soc_tplg_private *priv = elem->data; -+ unsigned char *p = (unsigned char *)priv->data; - unsigned int i; - - tplg_dbg(" elem size = %d, priv data size = %d\n", -@@ -246,6 +248,7 @@ static void dump_priv_data(struct tplg_elem *elem) - } - - tplg_dbg("\n\n"); -+#endif - } - - static inline int check_nibble(unsigned char c) -diff --git a/src/topology/pcm.c b/src/topology/pcm.c -index bc307081..8e5afbe6 100644 ---- a/src/topology/pcm.c -+++ b/src/topology/pcm.c -@@ -881,7 +881,7 @@ int tplg_parse_pcm(snd_tplg_t *tplg, snd_config_t *cfg, - - pcm->compress = ival; - -- tplg_dbg("\t%s: %s\n", id, val); -+ tplg_dbg("\t%s: %d\n", id, ival); - continue; - } - --- -2.24.1 - - -From c765615bce7903a0f3e3d5e7826483708398c184 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 31 Dec 2019 15:27:58 +0100 -Subject: [PATCH 51/69] topology: fix the ops parser (accept integer/hexa - values) - -Signed-off-by: Jaroslav Kysela ---- - src/topology/ops.c | 36 +++++++++++++++++++++++++----------- - 1 file changed, 25 insertions(+), 11 deletions(-) - -diff --git a/src/topology/ops.c b/src/topology/ops.c -index ad72ef1b..2885c781 100644 ---- a/src/topology/ops.c -+++ b/src/topology/ops.c -@@ -67,6 +67,7 @@ int tplg_parse_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, snd_config_t *cfg, - snd_config_t *n; - struct snd_soc_tplg_ctl_hdr *hdr = private; - const char *id, *value; -+ int ival; - - tplg_dbg("\tOps\n"); - hdr->size = sizeof(*hdr); -@@ -80,17 +81,23 @@ int tplg_parse_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, snd_config_t *cfg, - continue; - - /* get value - try strings then ints */ -- if (snd_config_get_string(n, &value) < 0) -- continue; -+ if (snd_config_get_type(n) == SND_CONFIG_TYPE_STRING) { -+ if (snd_config_get_string(n, &value) < 0) -+ continue; -+ ival = lookup_ops(value); -+ } else { -+ if (tplg_get_integer(n, &ival, 0)) -+ continue; -+ } - - if (strcmp(id, "info") == 0) -- hdr->ops.info = lookup_ops(value); -+ hdr->ops.info = ival; - else if (strcmp(id, "put") == 0) -- hdr->ops.put = lookup_ops(value); -+ hdr->ops.put = ival; - else if (strcmp(id, "get") == 0) -- hdr->ops.get = lookup_ops(value); -+ hdr->ops.get = ival; - -- tplg_dbg("\t\t%s = %s\n", id, value); -+ tplg_dbg("\t\t%s = %d\n", id, ival); - } - - return 0; -@@ -146,6 +153,7 @@ int tplg_parse_ext_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, - snd_config_t *n; - struct snd_soc_tplg_bytes_control *be = private; - const char *id, *value; -+ int ival; - - tplg_dbg("\tExt Ops\n"); - -@@ -158,15 +166,21 @@ int tplg_parse_ext_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, - continue; - - /* get value - try strings then ints */ -- if (snd_config_get_string(n, &value) < 0) -- continue; -+ if (snd_config_get_type(n) == SND_CONFIG_TYPE_STRING) { -+ if (snd_config_get_string(n, &value) < 0) -+ continue; -+ ival = lookup_ops(value); -+ } else { -+ if (tplg_get_integer(n, &ival, 0)) -+ continue; -+ } - - if (strcmp(id, "info") == 0) -- be->ext_ops.info = lookup_ops(value); -+ be->ext_ops.info = ival; - else if (strcmp(id, "put") == 0) -- be->ext_ops.put = lookup_ops(value); -+ be->ext_ops.put = ival; - else if (strcmp(id, "get") == 0) -- be->ext_ops.get = lookup_ops(value); -+ be->ext_ops.get = ival; - - tplg_dbg("\t\t%s = %s\n", id, value); - } --- -2.24.1 - - -From 0ba4d6d9c0ae4576f35724d2a5735990f09ceeb0 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 1 Jan 2020 19:10:20 +0100 -Subject: [PATCH 52/69] topology: fix the wrong memory access (object realloc) - -Signed-off-by: Jaroslav Kysela ---- - src/topology/pcm.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/src/topology/pcm.c b/src/topology/pcm.c -index 8e5afbe6..bd728959 100644 ---- a/src/topology/pcm.c -+++ b/src/topology/pcm.c -@@ -252,8 +252,8 @@ static int build_link(snd_tplg_t *tplg, struct tplg_elem *elem) - ref->id, SND_TPLG_TYPE_HW_CONFIG, elem->index); - if (!ref->elem) { - SNDERR("cannot find HW config '%s'" -- " referenced by link '%s'", -- ref->id, elem->id); -+ " referenced by link '%s'", -+ ref->id, elem->id); - return -EINVAL; - } - -@@ -267,6 +267,7 @@ static int build_link(snd_tplg_t *tplg, struct tplg_elem *elem) - err = tplg_copy_data(tplg, elem, ref); - if (err < 0) - return err; -+ link = elem->link; /* realloc */ - break; - - default: --- -2.24.1 - - -From b6c9afb4f59bb678dc834028680d579f47dc273b Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Sun, 15 Dec 2019 15:24:57 +0100 -Subject: [PATCH 53/69] topology: implement snd_tplg_decode - -Signed-off-by: Jaroslav Kysela ---- - include/topology.h | 14 +- - src/topology/Makefile.am | 3 +- - src/topology/ctl.c | 450 +++++++++++++++++++++++++++++++++----- - src/topology/dapm.c | 253 +++++++++++++++++++-- - src/topology/data.c | 440 ++++++++++++++++++++++++++++++++++++- - src/topology/decoder.c | 136 ++++++++++++ - src/topology/elem.c | 80 +++++++ - src/topology/parser.c | 20 +- - src/topology/pcm.c | 396 ++++++++++++++++++++++++++++----- - src/topology/save.c | 3 + - src/topology/tplg_local.h | 71 +++++- - 11 files changed, 1727 insertions(+), 139 deletions(-) - create mode 100644 src/topology/decoder.c - -diff --git a/include/topology.h b/include/topology.h -index 37bced1a..1f52e66e 100644 ---- a/include/topology.h -+++ b/include/topology.h -@@ -885,7 +885,10 @@ struct snd_tplg_ctl_template { - const char *name; /*!< Control name */ - int access; /*!< Control access */ - struct snd_tplg_io_ops_template ops; /*!< operations */ -- struct snd_tplg_tlv_template *tlv; /*!< non NULL means we have TLV data */ -+ union { -+ struct snd_tplg_tlv_template *tlv; /*!< non NULL means we have TLV data */ -+ struct snd_tplg_tlv_dbscale_template *tlv_scale; /*!< scale TLV data */ -+ }; - }; - - /** \struct snd_tplg_mixer_template -@@ -1155,6 +1158,15 @@ int snd_tplg_set_version(snd_tplg_t *tplg, unsigned int version); - */ - int snd_tplg_save(snd_tplg_t *tplg, char **dst, int flags); - -+/** -+ * \brief Decode the binary topology contents. -+ * \param tplg Topology instance. -+ * \param bin Binary topology input buffer. -+ * \param size Binary topology input buffer size. -+ * \return Zero on success, otherwise a negative error code -+ */ -+int snd_tplg_decode(snd_tplg_t *tplg, void *bin, size_t size, int dflags); -+ - /* \} */ - - #ifdef __cplusplus -diff --git a/src/topology/Makefile.am b/src/topology/Makefile.am -index a850ec4c..12d1d445 100644 ---- a/src/topology/Makefile.am -+++ b/src/topology/Makefile.am -@@ -28,7 +28,8 @@ libatopology_la_SOURCES =\ - channel.c \ - ops.c \ - elem.c \ -- save.c -+ save.c \ -+ decoder.c - - noinst_HEADERS = tplg_local.h - -diff --git a/src/topology/ctl.c b/src/topology/ctl.c -index 03874b27..24d437aa 100644 ---- a/src/topology/ctl.c -+++ b/src/topology/ctl.c -@@ -621,8 +621,9 @@ int tplg_parse_control_enum(snd_tplg_t *tplg, snd_config_t *cfg, - tplg->channel_idx = 0; - - /* set channel reg to default state */ -- for (j = 0; j < SND_SOC_TPLG_MAX_CHAN; j++) -+ for (j = 0; j < SND_SOC_TPLG_MAX_CHAN; j++) { - ec->channel[j].reg = -1; -+ } - - tplg_dbg(" Control Enum: %s\n", elem->id); - -@@ -896,9 +897,14 @@ int tplg_save_control_mixer(snd_tplg_t *tplg ATTRIBUTE_UNUSED, - return err; - } - --static int init_ctl_hdr(struct snd_soc_tplg_ctl_hdr *hdr, -- struct snd_tplg_ctl_template *t) -+static int init_ctl_hdr(snd_tplg_t *tplg, -+ struct tplg_elem *parent, -+ struct snd_soc_tplg_ctl_hdr *hdr, -+ struct snd_tplg_ctl_template *t) - { -+ struct tplg_elem *elem; -+ int err; -+ - hdr->size = sizeof(struct snd_soc_tplg_ctl_hdr); - hdr->type = t->type; - -@@ -924,7 +930,7 @@ static int init_ctl_hdr(struct snd_soc_tplg_ctl_hdr *hdr, - && !(hdr->access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK)) { - - struct snd_tplg_tlv_template *tlvt = t->tlv; -- struct snd_soc_tplg_ctl_tlv *tlv = &hdr->tlv; -+ struct snd_soc_tplg_ctl_tlv *tlv; - struct snd_tplg_tlv_dbscale_template *scalet; - struct snd_soc_tplg_tlv_dbscale *scale; - -@@ -933,6 +939,17 @@ static int init_ctl_hdr(struct snd_soc_tplg_ctl_hdr *hdr, - return -EINVAL; - } - -+ elem = tplg_elem_new_common(tplg, NULL, parent->id, -+ SND_TPLG_TYPE_TLV); -+ if (!elem) -+ return -ENOMEM; -+ -+ tlv = elem->tlv; -+ -+ err = tplg_ref_add(parent, SND_TPLG_TYPE_TLV, parent->id); -+ if (err < 0) -+ return err; -+ - tlv->size = sizeof(struct snd_soc_tplg_ctl_tlv); - tlv->type = tlvt->type; - -@@ -957,10 +974,10 @@ static int init_ctl_hdr(struct snd_soc_tplg_ctl_hdr *hdr, - } - - int tplg_add_mixer(snd_tplg_t *tplg, struct snd_tplg_mixer_template *mixer, -- struct tplg_elem **e) -+ struct tplg_elem **e) - { -- struct snd_soc_tplg_private *priv = mixer->priv; - struct snd_soc_tplg_mixer_control *mc; -+ struct snd_soc_tplg_private *priv; - struct tplg_elem *elem; - int ret, i, num_channels; - -@@ -979,7 +996,7 @@ int tplg_add_mixer(snd_tplg_t *tplg, struct snd_tplg_mixer_template *mixer, - /* init new mixer */ - mc = elem->mixer_ctrl; - mc->size = elem->size; -- ret = init_ctl_hdr(&mc->hdr, &mixer->hdr); -+ ret = init_ctl_hdr(tplg, elem, &mc->hdr, &mixer->hdr); - if (ret < 0) { - tplg_elem_free(elem); - return ret; -@@ -1000,25 +1017,20 @@ int tplg_add_mixer(snd_tplg_t *tplg, struct snd_tplg_mixer_template *mixer, - for (i = 0; i < num_channels; i++) { - struct snd_tplg_channel_elem *channel = &mixer->map->channel[i]; - -- mc->channel[i].size = channel->size; -+ mc->channel[i].size = sizeof(mc->channel[0]); - mc->channel[i].reg = channel->reg; - mc->channel[i].shift = channel->shift; - mc->channel[i].id = channel->id; - } - - /* priv data */ -- if (priv) { -- mc = realloc(mc, elem->size + priv->size); -- if (!mc) { -- tplg_elem_free(elem); -- return -ENOMEM; -- } -- -- elem->mixer_ctrl = mc; -- elem->size += priv->size; -- mc->priv.size = priv->size; -- memcpy(mc->priv.data, priv->data, priv->size); -- } -+ priv = mixer->priv; -+ if (priv && priv->size > 0) { -+ ret = tplg_add_data(tplg, elem, priv, -+ sizeof(*priv) + priv->size); -+ if (ret < 0) -+ return ret; -+ } - - if (e) - *e = elem; -@@ -1026,11 +1038,12 @@ int tplg_add_mixer(snd_tplg_t *tplg, struct snd_tplg_mixer_template *mixer, - } - - int tplg_add_enum(snd_tplg_t *tplg, struct snd_tplg_enum_template *enum_ctl, -- struct tplg_elem **e) -+ struct tplg_elem **e) - { - struct snd_soc_tplg_enum_control *ec; -+ struct snd_soc_tplg_private *priv; - struct tplg_elem *elem; -- int ret, i, num_items; -+ int ret, i, num_items, num_channels; - - tplg_dbg(" Control Enum: %s\n", enum_ctl->hdr.name); - -@@ -1046,7 +1059,7 @@ int tplg_add_enum(snd_tplg_t *tplg, struct snd_tplg_enum_template *enum_ctl, - - ec = elem->enum_ctrl; - ec->size = elem->size; -- ret = init_ctl_hdr(&ec->hdr, &enum_ctl->hdr); -+ ret = init_ctl_hdr(tplg, elem, &ec->hdr, &enum_ctl->hdr); - if (ret < 0) { - tplg_elem_free(elem); - return ret; -@@ -1058,6 +1071,22 @@ int tplg_add_enum(snd_tplg_t *tplg, struct snd_tplg_enum_template *enum_ctl, - ec->mask = enum_ctl->mask; - ec->count = enum_ctl->items; - -+ /* set channel reg to default state */ -+ for (i = 0; i < SND_SOC_TPLG_MAX_CHAN; i++) -+ ec->channel[i].reg = -1; -+ -+ num_channels = enum_ctl->map ? enum_ctl->map->num_channels : 0; -+ ec->num_channels = num_channels; -+ -+ for (i = 0; i < num_channels; i++) { -+ struct snd_tplg_channel_elem *channel = &enum_ctl->map->channel[i]; -+ -+ ec->channel[i].size = sizeof(ec->channel[0]); -+ ec->channel[i].reg = channel->reg; -+ ec->channel[i].shift = channel->shift; -+ ec->channel[i].id = channel->id; -+ } -+ - if (enum_ctl->texts != NULL) { - for (i = 0; i < num_items; i++) { - if (enum_ctl->texts[i] != NULL) -@@ -1077,21 +1106,13 @@ int tplg_add_enum(snd_tplg_t *tplg, struct snd_tplg_enum_template *enum_ctl, - } - } - -- if (enum_ctl->priv != NULL) { -- ec = realloc(ec, -- elem->size + enum_ctl->priv->size); -- if (!ec) { -- tplg_elem_free(elem); -- return -ENOMEM; -- } -- -- elem->enum_ctrl = ec; -- elem->size += enum_ctl->priv->size; -- -- memcpy(ec->priv.data, enum_ctl->priv->data, -- enum_ctl->priv->size); -- -- ec->priv.size = enum_ctl->priv->size; -+ /* priv data */ -+ priv = enum_ctl->priv; -+ if (priv && priv->size > 0) { -+ ret = tplg_add_data(tplg, elem, priv, -+ sizeof(*priv) + priv->size); -+ if (ret < 0) -+ return ret; - } - - if (e) -@@ -1100,9 +1121,10 @@ int tplg_add_enum(snd_tplg_t *tplg, struct snd_tplg_enum_template *enum_ctl, - } - - int tplg_add_bytes(snd_tplg_t *tplg, struct snd_tplg_bytes_template *bytes_ctl, -- struct tplg_elem **e) -+ struct tplg_elem **e) - { - struct snd_soc_tplg_bytes_control *be; -+ struct snd_soc_tplg_private *priv; - struct tplg_elem *elem; - int ret; - -@@ -1120,7 +1142,7 @@ int tplg_add_bytes(snd_tplg_t *tplg, struct snd_tplg_bytes_template *bytes_ctl, - - be = elem->bytes_ext; - be->size = elem->size; -- ret = init_ctl_hdr(&be->hdr, &bytes_ctl->hdr); -+ ret = init_ctl_hdr(tplg, elem, &be->hdr, &bytes_ctl->hdr); - if (ret < 0) { - tplg_elem_free(elem); - return ret; -@@ -1133,20 +1155,13 @@ int tplg_add_bytes(snd_tplg_t *tplg, struct snd_tplg_bytes_template *bytes_ctl, - be->ext_ops.put = bytes_ctl->ext_ops.put; - be->ext_ops.get = bytes_ctl->ext_ops.get; - -- if (bytes_ctl->priv != NULL) { -- be = realloc(be, -- elem->size + bytes_ctl->priv->size); -- if (!be) { -- tplg_elem_free(elem); -- return -ENOMEM; -- } -- elem->bytes_ext = be; -- elem->size += bytes_ctl->priv->size; -- -- memcpy(be->priv.data, bytes_ctl->priv->data, -- bytes_ctl->priv->size); -- -- be->priv.size = bytes_ctl->priv->size; -+ /* priv data */ -+ priv = bytes_ctl->priv; -+ if (priv && priv->size > 0) { -+ ret = tplg_add_data(tplg, elem, priv, -+ sizeof(*priv) + priv->size); -+ if (ret < 0) -+ return ret; - } - - /* check on TLV bytes control */ -@@ -1184,3 +1199,330 @@ int tplg_add_bytes_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) - { - return tplg_add_bytes(tplg, t->bytes_ctl, NULL); - } -+ -+int tplg_decode_control_mixer1(snd_tplg_t *tplg, -+ struct list_head *heap, -+ struct snd_tplg_mixer_template *mt, -+ size_t pos, -+ void *bin, size_t size) -+{ -+ struct snd_soc_tplg_mixer_control *mc = bin; -+ struct snd_tplg_channel_map_template *map; -+ struct snd_tplg_tlv_dbscale_template *db; -+ int i; -+ -+ if (size < sizeof(*mc)) { -+ SNDERR("mixer: small size %d", size); -+ return -EINVAL; -+ } -+ -+ tplg_dv(tplg, pos, "mixer: size %d TLV size %d private size %d", -+ mc->size, mc->hdr.tlv.size, mc->priv.size); -+ if (size != mc->size + mc->priv.size) { -+ SNDERR("mixer: unexpected element size %d", size); -+ return -EINVAL; -+ } -+ -+ memset(mt, 0, sizeof(*mt)); -+ mt->hdr.type = mc->hdr.type; -+ mt->hdr.name = mc->hdr.name; -+ mt->hdr.access = mc->hdr.access; -+ mt->hdr.ops.get = mc->hdr.ops.get; -+ mt->hdr.ops.put = mc->hdr.ops.put; -+ mt->hdr.ops.info = mc->hdr.ops.info; -+ mt->min = mc->min; -+ mt->max = mc->max; -+ mt->platform_max = mc->platform_max; -+ tplg_dv(tplg, pos, "mixer: name '%s' access 0x%x", -+ mt->hdr.name, mt->hdr.access); -+ if (mc->num_channels > 0) { -+ map = tplg_calloc(heap, sizeof(*map)); -+ map->num_channels = mc->num_channels; -+ for (i = 0; i < map->num_channels; i++) { -+ map->channel[i].reg = mc->channel[i].reg; -+ map->channel[i].shift = mc->channel[i].shift; -+ map->channel[i].id = mc->channel[i].id; -+ } -+ mt->map = map; -+ } -+ if (mc->hdr.tlv.size == 0) { -+ /* nothing */ -+ } else if (mc->hdr.tlv.size == sizeof(struct snd_soc_tplg_ctl_tlv)) { -+ if (mc->hdr.tlv.type != SNDRV_CTL_TLVT_DB_SCALE) { -+ SNDERR("mixer: unknown TLV type %d", -+ mc->hdr.tlv.type); -+ return -EINVAL; -+ } -+ db = tplg_calloc(heap, sizeof(*db)); -+ if (db == NULL) -+ return -ENOMEM; -+ mt->hdr.tlv_scale = db; -+ db->hdr.type = mc->hdr.tlv.type; -+ db->min = mc->hdr.tlv.scale.min; -+ db->step = mc->hdr.tlv.scale.step; -+ db->mute = mc->hdr.tlv.scale.mute; -+ tplg_dv(tplg, pos, "mixer: dB scale TLV: min %d step %d mute %d", -+ db->min, db->step, db->mute); -+ } else { -+ SNDERR("mixer: wrong TLV size %d", mc->hdr.tlv.size); -+ return -EINVAL; -+ } -+ -+ mt->priv = &mc->priv; -+ tplg_dv(tplg, pos + offsetof(struct snd_soc_tplg_mixer_control, priv), -+ "mixer: private start"); -+ return 0; -+} -+ -+int tplg_decode_control_mixer(snd_tplg_t *tplg, -+ size_t pos, -+ struct snd_soc_tplg_hdr *hdr, -+ void *bin, size_t size) -+{ -+ struct list_head heap; -+ snd_tplg_obj_template_t t; -+ struct snd_tplg_mixer_template mt; -+ struct snd_soc_tplg_mixer_control *mc; -+ size_t size2; -+ int err; -+ -+ err = tplg_decode_template(tplg, pos, hdr, &t); -+ if (err < 0) -+ return err; -+ -+next: -+ if (size < sizeof(*mc)) { -+ SNDERR("mixer: small size %d", size); -+ return -EINVAL; -+ } -+ INIT_LIST_HEAD(&heap); -+ mc = bin; -+ size2 = mc->size + mc->priv.size; -+ if (size2 > size) { -+ SNDERR("mixer: wrong element size (%d, priv %d)", -+ mc->size, mc->priv.size); -+ return -EINVAL; -+ } -+ -+ err = tplg_decode_control_mixer1(tplg, &heap, &mt, pos, bin, size2); -+ if (err >= 0) { -+ t.mixer = &mt; -+ err = snd_tplg_add_object(tplg, &t); -+ } -+ tplg_free(&heap); -+ if (err < 0) -+ return err; -+ -+ bin += size2; -+ size -= size2; -+ pos += size2; -+ -+ if (size > 0) -+ goto next; -+ -+ return 0; -+} -+ -+int tplg_decode_control_enum1(snd_tplg_t *tplg, -+ struct list_head *heap, -+ struct snd_tplg_enum_template *et, -+ size_t pos, -+ void *bin, size_t size) -+{ -+ struct snd_soc_tplg_enum_control *ec = bin; -+ struct snd_tplg_channel_map_template cmt; -+ int i; -+ -+ if (size < sizeof(*ec)) { -+ SNDERR("enum: small size %d", size); -+ return -EINVAL; -+ } -+ -+ tplg_dv(tplg, pos, "enum: size %d private size %d", -+ ec->size, ec->priv.size); -+ if (size != ec->size + ec->priv.size) { -+ SNDERR("enum: unexpected element size %d", size); -+ return -EINVAL; -+ } -+ if (ec->num_channels > SND_TPLG_MAX_CHAN || -+ ec->num_channels > SND_SOC_TPLG_MAX_CHAN) { -+ SNDERR("enum: unexpected channel count %d", ec->num_channels); -+ return -EINVAL; -+ } -+ if (ec->items > SND_SOC_TPLG_NUM_TEXTS) { -+ SNDERR("enum: unexpected texts count %d", ec->items); -+ return -EINVAL; -+ } -+ -+ memset(et, 0, sizeof(*et)); -+ et->hdr.type = ec->hdr.type; -+ et->hdr.name = ec->hdr.name; -+ et->hdr.access = ec->hdr.access; -+ et->hdr.ops.get = ec->hdr.ops.get; -+ et->hdr.ops.put = ec->hdr.ops.put; -+ et->hdr.ops.info = ec->hdr.ops.info; -+ et->mask = ec->mask; -+ -+ if (ec->items > 0) { -+ et->items = ec->items; -+ et->texts = tplg_calloc(heap, sizeof(char *) * ec->items); -+ if (!et->texts) -+ return -ENOMEM; -+ for (i = 0; ec->items; i++) { -+ unsigned int j = i * sizeof(int) * ENUM_VAL_SIZE; -+ et->texts[i] = ec->texts[i]; -+ et->values[i] = (int *)&ec->values[j]; -+ } -+ } -+ -+ et->map = &cmt; -+ memset(&cmt, 0, sizeof(cmt)); -+ cmt.num_channels = ec->num_channels; -+ for (i = 0; i < cmt.num_channels; i++) { -+ struct snd_tplg_channel_elem *channel = &cmt.channel[i]; -+ tplg_dv(tplg, pos + ((void *)&ec->channel[i] - (void *)ec), -+ "enum: channel size %d", ec->channel[i].size); -+ channel->reg = ec->channel[i].reg; -+ channel->shift = ec->channel[i].shift; -+ channel->id = ec->channel[i].id; -+ } -+ -+ et->priv = &ec->priv; -+ return 0; -+} -+ -+int tplg_decode_control_enum(snd_tplg_t *tplg, -+ size_t pos, -+ struct snd_soc_tplg_hdr *hdr, -+ void *bin, size_t size) -+{ -+ struct list_head heap; -+ snd_tplg_obj_template_t t; -+ struct snd_tplg_enum_template et; -+ struct snd_soc_tplg_enum_control *ec; -+ size_t size2; -+ int err; -+ -+ err = tplg_decode_template(tplg, pos, hdr, &t); -+ if (err < 0) -+ return err; -+ -+next: -+ if (size < sizeof(*ec)) { -+ SNDERR("enum: small size %d", size); -+ return -EINVAL; -+ } -+ INIT_LIST_HEAD(&heap); -+ ec = bin; -+ size2 = ec->size + ec->priv.size; -+ if (size2 > size) { -+ SNDERR("enum: wrong element size (%d, priv %d)", -+ ec->size, ec->priv.size); -+ return -EINVAL; -+ } -+ -+ err = tplg_decode_control_enum1(tplg, &heap, &et, pos, bin, size); -+ if (err >= 0) { -+ t.enum_ctl = &et; -+ err = snd_tplg_add_object(tplg, &t); -+ } -+ tplg_free(&heap); -+ if (err < 0) -+ return err; -+ -+ bin += size2; -+ size -= size2; -+ pos += size2; -+ -+ if (size > 0) -+ goto next; -+ -+ return 0; -+} -+ -+int tplg_decode_control_bytes1(snd_tplg_t *tplg, -+ struct snd_tplg_bytes_template *bt, -+ size_t pos, -+ void *bin, size_t size) -+{ -+ struct snd_soc_tplg_bytes_control *bc = bin; -+ -+ if (size < sizeof(*bc)) { -+ SNDERR("bytes: small size %d", size); -+ return -EINVAL; -+ } -+ -+ tplg_dv(tplg, pos, "control bytes: size %d private size %d", -+ bc->size, bc->priv.size); -+ if (size != bc->size + bc->priv.size) { -+ SNDERR("bytes: unexpected element size %d", size); -+ return -EINVAL; -+ } -+ -+ memset(bt, 0, sizeof(*bt)); -+ bt->hdr.type = bc->hdr.type; -+ bt->hdr.name = bc->hdr.name; -+ bt->hdr.access = bc->hdr.access; -+ bt->hdr.ops.get = bc->hdr.ops.get; -+ bt->hdr.ops.put = bc->hdr.ops.put; -+ bt->hdr.ops.info = bc->hdr.ops.info; -+ bt->max = bc->max; -+ bt->mask = bc->mask; -+ bt->base = bc->base; -+ bt->num_regs = bc->num_regs; -+ bt->ext_ops.get = bc->ext_ops.get; -+ bt->ext_ops.put = bc->ext_ops.put; -+ bt->ext_ops.info = bc->ext_ops.info; -+ tplg_dv(tplg, pos, "control bytes: name '%s' access 0x%x", -+ bt->hdr.name, bt->hdr.access); -+ -+ bt->priv = &bc->priv; -+ return 0; -+} -+ -+int tplg_decode_control_bytes(snd_tplg_t *tplg, -+ size_t pos, -+ struct snd_soc_tplg_hdr *hdr, -+ void *bin, size_t size) -+{ -+ snd_tplg_obj_template_t t; -+ struct snd_tplg_bytes_template bt; -+ struct snd_soc_tplg_bytes_control *bc; -+ size_t size2; -+ int err; -+ -+ err = tplg_decode_template(tplg, pos, hdr, &t); -+ if (err < 0) -+ return err; -+ -+next: -+ if (size < sizeof(*bc)) { -+ SNDERR("bytes: small size %d", size); -+ return -EINVAL; -+ } -+ bc = bin; -+ size2 = bc->size + bc->priv.size; -+ if (size2 > size) { -+ SNDERR("bytes: wrong element size (%d, priv %d)", -+ bc->size, bc->priv.size); -+ return -EINVAL; -+ } -+ -+ err = tplg_decode_control_bytes1(tplg, &bt, pos, bin, size); -+ if (err < 0) -+ return err; -+ -+ t.bytes_ctl = &bt; -+ err = snd_tplg_add_object(tplg, &t); -+ if (err < 0) -+ return err; -+ -+ bin += size2; -+ size -= size2; -+ pos += size2; -+ -+ if (size > 0) -+ goto next; -+ -+ return 0; -+} -diff --git a/src/topology/dapm.c b/src/topology/dapm.c -index 88bddca3..9fab2d92 100644 ---- a/src/topology/dapm.c -+++ b/src/topology/dapm.c -@@ -420,19 +420,39 @@ int tplg_save_dapm_graph(snd_tplg_t *tplg, int index, char **dst, const char *pf - struct snd_soc_tplg_dapm_graph_elem *route; - struct list_head *pos; - struct tplg_elem *elem; -- int err, first = 1, old_index = -1; -- unsigned block = -1, count = 0; -+ int err, first, old_index; -+ unsigned block, count; -+ const char *fmt; - -+ old_index = -1; -+ block = 0; -+ count = 0; - list_for_each(pos, &tplg->route_list) { - elem = list_entry(pos, struct tplg_elem, list); - if (!elem->route || elem->type != SND_TPLG_TYPE_DAPM_GRAPH) - continue; - if (index >= 0 && elem->index != index) - continue; -+ if (old_index != elem->index) { -+ block++; -+ old_index = elem->index; -+ } - count++; - } - if (count == 0) - return 0; -+ if (block < 10) { -+ fmt = "\tset%u {\n"; -+ } else if (block < 100) { -+ fmt = "\tset%02u {\n"; -+ } else if (block < 1000) { -+ fmt = "\tset%03u {\n"; -+ } else { -+ return -EINVAL; -+ } -+ old_index = -1; -+ block = -1; -+ first = 1; - err = tplg_save_printf(dst, pfx, "SectionGraph {\n"); - list_for_each(pos, &tplg->route_list) { - elem = list_entry(pos, struct tplg_elem, list); -@@ -452,7 +472,7 @@ int tplg_save_dapm_graph(snd_tplg_t *tplg, int index, char **dst, const char *pf - old_index = elem->index; - block++; - first = 1; -- err = tplg_save_printf(dst, pfx, "\tset%u {\n", block); -+ err = tplg_save_printf(dst, pfx, fmt, block); - if (err >= 0) - err = tplg_save_printf(dst, pfx, "\t\tindex %u\n", - elem->index); -@@ -771,20 +791,14 @@ int tplg_add_widget_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) - w->event_flags = wt->event_flags; - w->event_type = wt->event_type; - -- if (wt->priv != NULL) { -- w = realloc(w, -- elem->size + wt->priv->size); -- if (!w) { -+ /* add private data */ -+ if (wt->priv != NULL && wt->priv->size > 0) { -+ ret = tplg_add_data(tplg, elem, wt->priv, -+ sizeof(*wt->priv) + wt->priv->size); -+ if (ret < 0) { - tplg_elem_free(elem); -- return -ENOMEM; -+ return ret; - } -- -- elem->widget = w; -- elem->size += wt->priv->size; -- -- memcpy(w->priv.data, wt->priv->data, -- wt->priv->size); -- w->priv.size = wt->priv->size; - } - - /* add controls to the widget's reference list */ -@@ -836,3 +850,212 @@ int tplg_add_widget_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) - - return 0; - } -+ -+/* decode dapm widget from the binary input */ -+int tplg_decode_dapm_widget(snd_tplg_t *tplg, -+ size_t pos, -+ struct snd_soc_tplg_hdr *hdr, -+ void *bin, size_t size) -+{ -+ struct list_head heap; -+ struct snd_soc_tplg_dapm_widget *w; -+ snd_tplg_obj_template_t t; -+ struct snd_tplg_widget_template *wt; -+ struct snd_tplg_mixer_template *mt; -+ struct snd_tplg_enum_template *et; -+ struct snd_tplg_bytes_template *bt; -+ struct snd_soc_tplg_ctl_hdr *chdr; -+ struct snd_soc_tplg_mixer_control *mc; -+ struct snd_soc_tplg_enum_control *ec; -+ struct snd_soc_tplg_bytes_control *bc; -+ size_t size2; -+ unsigned int index; -+ int err; -+ -+ err = tplg_decode_template(tplg, pos, hdr, &t); -+ if (err < 0) -+ return err; -+ -+next: -+ INIT_LIST_HEAD(&heap); -+ w = bin; -+ -+ if (size < sizeof(*w)) { -+ SNDERR("dapm widget: small size %d", size); -+ return -EINVAL; -+ } -+ if (sizeof(*w) != w->size) { -+ SNDERR("dapm widget: unknown element size %d (expected %zd)", -+ w->size, sizeof(*w)); -+ return -EINVAL; -+ } -+ if (w->num_kcontrols > 16) { -+ SNDERR("dapm widget: too many kcontrols %d", -+ w->num_kcontrols); -+ return -EINVAL; -+ } -+ -+ tplg_dv(tplg, pos, "dapm widget: size %d private size %d kcontrols %d", -+ w->size, w->priv.size, w->num_kcontrols); -+ -+ wt = tplg_calloc(&heap, sizeof(*wt) + sizeof(void *) * w->num_kcontrols); -+ if (wt == NULL) -+ return -ENOMEM; -+ wt->id = w->id; -+ wt->name = w->name; -+ wt->sname = w->sname; -+ wt->reg = w->reg; -+ wt->shift = w->shift; -+ wt->mask = w->mask; -+ wt->subseq = w->subseq; -+ wt->invert = w->invert; -+ wt->ignore_suspend = w->ignore_suspend; -+ wt->event_flags = w->event_flags; -+ wt->event_type = w->event_type; -+ -+ tplg_dv(tplg, pos, "dapm widget: name '%s' sname '%s'", wt->name, wt->sname); -+ -+ if (sizeof(*w) + w->priv.size > size) { -+ SNDERR("dapm widget: wrong private data size %d", -+ w->priv.size); -+ return -EINVAL; -+ } -+ -+ tplg_dv(tplg, pos + offsetof(struct snd_soc_tplg_dapm_widget, priv), -+ "dapm widget: private start"); -+ -+ wt->priv = &w->priv; -+ bin += sizeof(*w) + w->priv.size; -+ size -= sizeof(*w) + w->priv.size; -+ pos += sizeof(*w) + w->priv.size; -+ -+ for (index = 0; index < w->num_kcontrols; index++) { -+ chdr = bin; -+ switch (chdr->type) { -+ case SND_SOC_TPLG_TYPE_MIXER: -+ mt = tplg_calloc(&heap, sizeof(*mt)); -+ if (mt == NULL) { -+ err = -ENOMEM; -+ goto retval; -+ } -+ wt->ctl[index] = (void *)mt; -+ wt->num_ctls++; -+ mc = bin; -+ size2 = mc->size + mc->priv.size; -+ tplg_dv(tplg, pos, "kcontrol mixer size %zd", size2); -+ if (size2 > size) { -+ SNDERR("dapm widget: small mixer size %d", -+ size2); -+ err = -EINVAL; -+ goto retval; -+ } -+ err = tplg_decode_control_mixer1(tplg, &heap, mt, pos, -+ bin, size2); -+ break; -+ case SND_SOC_TPLG_TYPE_ENUM: -+ et = tplg_calloc(&heap, sizeof(*mt)); -+ if (et == NULL) { -+ err = -ENOMEM; -+ goto retval; -+ } -+ wt->ctl[index] = (void *)et; -+ wt->num_ctls++; -+ ec = bin; -+ size2 = ec->size + ec->priv.size; -+ tplg_dv(tplg, pos, "kcontrol enum size %zd", size2); -+ if (size2 > size) { -+ SNDERR("dapm widget: small enum size %d", -+ size2); -+ err = -EINVAL; -+ goto retval; -+ } -+ err = tplg_decode_control_enum1(tplg, &heap, et, pos, -+ bin, size2); -+ break; -+ case SND_SOC_TPLG_TYPE_BYTES: -+ bt = tplg_calloc(&heap, sizeof(*bt)); -+ if (bt == NULL) { -+ err = -ENOMEM; -+ goto retval; -+ } -+ wt->ctl[index] = (void *)bt; -+ wt->num_ctls++; -+ bc = bin; -+ size2 = bc->size + bc->priv.size; -+ tplg_dv(tplg, pos, "kcontrol bytes size %zd", size2); -+ if (size2 > size) { -+ SNDERR("dapm widget: small bytes size %d", -+ size2); -+ err = -EINVAL; -+ goto retval; -+ } -+ err = tplg_decode_control_bytes1(tplg, bt, pos, -+ bin, size2); -+ break; -+ default: -+ SNDERR("dapm widget: wrong control type %d", -+ chdr->type); -+ err = -EINVAL; -+ goto retval; -+ } -+ if (err < 0) -+ goto retval; -+ bin += size2; -+ size -= size2; -+ pos += size2; -+ } -+ -+ t.widget = wt; -+ err = snd_tplg_add_object(tplg, &t); -+ tplg_free(&heap); -+ if (err < 0) -+ return err; -+ if (size > 0) -+ goto next; -+ return 0; -+ -+retval: -+ tplg_free(&heap); -+ return err; -+} -+ -+/* decode dapm link from the binary input */ -+int tplg_decode_dapm_graph(snd_tplg_t *tplg, -+ size_t pos, -+ struct snd_soc_tplg_hdr *hdr, -+ void *bin, size_t size) -+{ -+ struct snd_soc_tplg_dapm_graph_elem *g; -+ snd_tplg_obj_template_t t; -+ struct snd_tplg_graph_template *gt; -+ struct snd_tplg_graph_elem *ge; -+ size_t asize; -+ int err; -+ -+ err = tplg_decode_template(tplg, pos, hdr, &t); -+ if (err < 0) -+ return err; -+ -+ asize = sizeof(*gt) + (size / sizeof(*g)) * sizeof(*ge); -+ gt = alloca(asize); -+ memset(gt, 0, asize); -+ for (ge = gt->elem; size > 0; ge++) { -+ g = bin; -+ if (size < sizeof(*g)) { -+ SNDERR("dapm graph: small size %d", size); -+ return -EINVAL; -+ } -+ ge->src = g->source; -+ ge->ctl = g->control; -+ ge->sink = g->sink; -+ gt->count++; -+ tplg_dv(tplg, pos, "dapm graph: src='%s' ctl='%s' sink='%s'", -+ ge->src, ge->ctl, ge->sink); -+ bin += sizeof(*g); -+ size -= sizeof(*g); -+ pos += sizeof(*g); -+ } -+ -+ t.graph = gt; -+ return snd_tplg_add_object(tplg, &t); -+} -diff --git a/src/topology/data.c b/src/topology/data.c -index 7b4bdccd..64563920 100644 ---- a/src/topology/data.c -+++ b/src/topology/data.c -@@ -566,7 +566,7 @@ static bool has_tuples(struct tplg_elem *elem) - } - - /* get size of a tuple element from its type */ --static unsigned int get_tuple_size(int type) -+unsigned int tplg_get_tuple_size(int type) - { - switch (type) { - -@@ -602,7 +602,7 @@ static int copy_tuples(struct tplg_elem *elem, - for (i = 0; i < tuples->num_sets ; i++) { - tuple_set = tuples->set[i]; - set_size = sizeof(struct snd_soc_tplg_vendor_array) -- + get_tuple_size(tuple_set->type) -+ + tplg_get_tuple_size(tuple_set->type) - * tuple_set->num_tuples; - size += set_size; - if (size > TPLG_MAX_PRIV_SIZE) { -@@ -1250,6 +1250,9 @@ int tplg_save_manifest_data(snd_tplg_t *tplg ATTRIBUTE_UNUSED, - continue; - count++; - } -+ if (count == 0) -+ return tplg_save_printf(dst, NULL, -+ "'%s'.comment 'empty'\n", elem->id); - if (count > 1) { - err = tplg_save_printf(dst, NULL, "'%s'.data [\n", elem->id); - if (err < 0) -@@ -1557,3 +1560,436 @@ int tplg_build_data(snd_tplg_t *tplg) - - return 0; - } -+ -+/* decode manifest data */ -+int tplg_decode_manifest_data(snd_tplg_t *tplg, -+ size_t pos, -+ struct snd_soc_tplg_hdr *hdr, -+ void *bin, size_t size) -+{ -+ struct snd_soc_tplg_manifest *m = bin; -+ struct tplg_elem *elem; -+ size_t off; -+ -+ if (hdr->index != 0) { -+ SNDERR("manifest - wrong index %d", hdr->index); -+ return -EINVAL; -+ } -+ -+ if (sizeof(*m) > size) { -+ SNDERR("manifest - wrong size %zd (minimal %zd)", -+ size, sizeof(*m)); -+ return -EINVAL; -+ } -+ -+ if (m->size != sizeof(*m)) { -+ SNDERR("manifest - wrong sructure size %d", m->size); -+ return -EINVAL; -+ } -+ -+ off = offsetof(struct snd_soc_tplg_manifest, priv); -+ if (off + m->priv.size > size) { -+ SNDERR("manifest - wrong private size %d", m->priv.size); -+ return -EINVAL; -+ } -+ -+ tplg->manifest = *m; -+ -+ bin += off; -+ size -= off; -+ pos += off; -+ -+ elem = tplg_elem_new_common(tplg, NULL, "manifest", -+ SND_TPLG_TYPE_MANIFEST); -+ if (!elem) -+ return -ENOMEM; -+ -+ tplg_dv(tplg, pos, "manifest: private size %d", size); -+ return tplg_add_data(tplg, elem, bin, size); -+} -+ -+int tplg_add_token(snd_tplg_t *tplg, struct tplg_elem *parent, -+ unsigned int token, -+ char str_ref[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]) -+{ -+ struct tplg_elem *elem; -+ struct tplg_token *t; -+ struct tplg_vendor_tokens *tokens; -+ unsigned int i; -+ size_t size; -+ -+ elem = tplg_elem_lookup(&tplg->token_list, parent->id, -+ SND_TPLG_TYPE_TOKEN, parent->index); -+ if (elem == NULL) { -+ elem = tplg_elem_new_common(tplg, NULL, parent->id, -+ SND_TPLG_TYPE_TOKEN); -+ if (!elem) -+ return -ENOMEM; -+ } -+ -+ tokens = elem->tokens; -+ if (tokens) { -+ for (i = 0; i < tokens->num_tokens; i++) { -+ t = &tokens->token[i]; -+ if (t->value == token) -+ goto found; -+ } -+ size = sizeof(*tokens) + -+ (tokens->num_tokens + 1) * sizeof(struct tplg_token); -+ tokens = realloc(tokens, size); -+ } else { -+ size = sizeof(*tokens) + 1 * sizeof(struct tplg_token); -+ tokens = calloc(1, size); -+ } -+ -+ if (!tokens) -+ return -ENOMEM; -+ -+ memset(&tokens->token[tokens->num_tokens], 0, sizeof(struct tplg_token)); -+ elem->tokens = tokens; -+ t = &tokens->token[tokens->num_tokens]; -+ tokens->num_tokens++; -+ snprintf(t->id, sizeof(t->id), "token%u", token); -+ t->value = token; -+found: -+ snd_strlcpy(str_ref, t->id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN); -+ return 0; -+} -+ -+static int tplg_verify_tuple_set(snd_tplg_t *tplg, size_t pos, -+ const void *bin, size_t size) -+{ -+ const struct snd_soc_tplg_vendor_array *va; -+ unsigned int j; -+ -+ va = bin; -+ if (size < sizeof(*va) || size < va->size) { -+ tplg_dv(tplg, pos, "tuple set verify: wrong size %d", size); -+ return -EINVAL; -+ } -+ -+ switch (va->type) { -+ case SND_SOC_TPLG_TUPLE_TYPE_UUID: -+ case SND_SOC_TPLG_TUPLE_TYPE_STRING: -+ case SND_SOC_TPLG_TUPLE_TYPE_BOOL: -+ case SND_SOC_TPLG_TUPLE_TYPE_BYTE: -+ case SND_SOC_TPLG_TUPLE_TYPE_WORD: -+ case SND_SOC_TPLG_TUPLE_TYPE_SHORT: -+ break; -+ default: -+ tplg_dv(tplg, pos, "tuple set verify: unknown array type %d", va->type); -+ return -EINVAL; -+ } -+ -+ j = tplg_get_tuple_size(va->type) * va->num_elems; -+ if (j + sizeof(*va) != va->size) { -+ tplg_dv(tplg, pos, "tuple set verify: wrong vendor array size %d " -+ "(expected %d for %d count %d)", -+ va->size, j + sizeof(*va), va->type, va->num_elems); -+ return -EINVAL; -+ } -+ -+ if (va->num_elems > 4096) { -+ tplg_dv(tplg, pos, "tuple set verify: tuples overflow %d", va->num_elems); -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+static int tplg_decode_tuple_set(snd_tplg_t *tplg, -+ size_t pos, -+ struct tplg_elem *parent, -+ struct tplg_tuple_set **_set, -+ const void *bin, size_t size) -+{ -+ const struct snd_soc_tplg_vendor_array *va; -+ struct tplg_tuple_set *set; -+ struct tplg_tuple *tuple; -+ unsigned int j; -+ int err; -+ -+ va = bin; -+ if (size < sizeof(*va) || size < va->size) { -+ SNDERR("tuples: wrong size %d", size); -+ return -EINVAL; -+ } -+ -+ switch (va->type) { -+ case SND_SOC_TPLG_TUPLE_TYPE_UUID: -+ case SND_SOC_TPLG_TUPLE_TYPE_STRING: -+ case SND_SOC_TPLG_TUPLE_TYPE_BOOL: -+ case SND_SOC_TPLG_TUPLE_TYPE_BYTE: -+ case SND_SOC_TPLG_TUPLE_TYPE_WORD: -+ case SND_SOC_TPLG_TUPLE_TYPE_SHORT: -+ break; -+ default: -+ SNDERR("tuples: unknown array type %d", va->type); -+ return -EINVAL; -+ } -+ -+ j = tplg_get_tuple_size(va->type) * va->num_elems; -+ if (j + sizeof(*va) != va->size) { -+ SNDERR("tuples: wrong vendor array size %d " -+ "(expected %d for %d count %d)", -+ va->size, j + sizeof(*va), va->type, va->num_elems); -+ return -EINVAL; -+ } -+ -+ if (va->num_elems > 4096) { -+ SNDERR("tuples: tuples overflow %d", va->num_elems); -+ return -EINVAL; -+ } -+ -+ set = calloc(1, sizeof(*set) + va->num_elems * sizeof(struct tplg_tuple)); -+ if (!set) -+ return -ENOMEM; -+ -+ set->type = va->type; -+ set->num_tuples = va->num_elems; -+ -+ tplg_dv(tplg, pos, "tuple set: type %d (%s) tuples %d size %d", set->type, -+ get_tuple_type_name(set->type), set->num_tuples, va->size); -+ for (j = 0; j < set->num_tuples; j++) { -+ tuple = &set->tuple[j]; -+ switch (va->type) { -+ case SND_SOC_TPLG_TUPLE_TYPE_UUID: -+ err = tplg_add_token(tplg, parent, va->uuid[j].token, -+ tuple->token); -+ if (err < 0) -+ goto retval; -+ memcpy(tuple->uuid, va->uuid[j].uuid, -+ sizeof(va->uuid[j].uuid)); -+ break; -+ case SND_SOC_TPLG_TUPLE_TYPE_STRING: -+ err = tplg_add_token(tplg, parent, va->string[j].token, -+ tuple->token); -+ if (err < 0) -+ goto retval; -+ snd_strlcpy(tuple->string, va->string[j].string, -+ sizeof(tuple->string)); -+ break; -+ case SND_SOC_TPLG_TUPLE_TYPE_BOOL: -+ case SND_SOC_TPLG_TUPLE_TYPE_BYTE: -+ case SND_SOC_TPLG_TUPLE_TYPE_WORD: -+ case SND_SOC_TPLG_TUPLE_TYPE_SHORT: -+ err = tplg_add_token(tplg, parent, va->value[j].token, -+ tuple->token); -+ if (err < 0) -+ goto retval; -+ tuple->value = va->value[j].value; -+ break; -+ } -+ } -+ -+ *_set = set; -+ return 0; -+ -+retval: -+ free(set); -+ return err; -+} -+ -+/* verify tuples from the binary input */ -+static int tplg_verify_tuples(snd_tplg_t *tplg, size_t pos, -+ const void *bin, size_t size) -+{ -+ const struct snd_soc_tplg_vendor_array *va; -+ int err; -+ -+ if (size < sizeof(*va)) { -+ tplg_dv(tplg, pos, "tuples: small size %d", size); -+ return -EINVAL; -+ } -+ -+next: -+ va = bin; -+ if (size < sizeof(*va)) { -+ tplg_dv(tplg, pos, "tuples: unexpected vendor arry size %d", size); -+ return -EINVAL; -+ } -+ -+ err = tplg_verify_tuple_set(tplg, pos, va, va->size); -+ if (err < 0) -+ return err; -+ -+ bin += va->size; -+ size -= va->size; -+ pos += va->size; -+ if (size > 0) -+ goto next; -+ -+ return 0; -+} -+ -+/* add tuples from the binary input */ -+static int tplg_decode_tuples(snd_tplg_t *tplg, -+ size_t pos, -+ struct tplg_elem *parent, -+ struct tplg_vendor_tuples *tuples, -+ const void *bin, size_t size) -+{ -+ const struct snd_soc_tplg_vendor_array *va; -+ struct tplg_tuple_set *set; -+ int err; -+ -+ if (size < sizeof(*va)) { -+ SNDERR("tuples: small size %d", size); -+ return -EINVAL; -+ } -+ -+next: -+ va = bin; -+ if (size < sizeof(*va)) { -+ SNDERR("tuples: unexpected vendor arry size %d", size); -+ return -EINVAL; -+ } -+ -+ if (tuples->num_sets >= tuples->alloc_sets) { -+ SNDERR("tuples: index overflow (%d)", tuples->num_sets); -+ return -EINVAL; -+ } -+ -+ err = tplg_decode_tuple_set(tplg, pos, parent, &set, va, va->size); -+ if (err < 0) -+ return err; -+ tuples->set[tuples->num_sets++] = set; -+ -+ bin += va->size; -+ size -= va->size; -+ pos += va->size; -+ if (size > 0) -+ goto next; -+ -+ return 0; -+} -+ -+/* decode private data */ -+int tplg_add_data(snd_tplg_t *tplg, -+ struct tplg_elem *parent, -+ const void *bin, size_t size) -+{ -+ const struct snd_soc_tplg_private *tp; -+ const struct snd_soc_tplg_vendor_array *va; -+ struct tplg_elem *elem = NULL, *elem2 = NULL; -+ struct tplg_vendor_tuples *tuples = NULL; -+ char id[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; -+ char suffix[16]; -+ size_t pos = 0, off; -+ int err, num_tuples = 0, block = 0; -+ -+ if (size == 0) -+ return 0; -+ -+ off = offsetof(struct snd_soc_tplg_private, array); -+ -+next: -+ tp = bin; -+ if (off + size < tp->size) { -+ SNDERR("data: unexpected element size %d", size); -+ return -EINVAL; -+ } -+ -+ if (tplg_verify_tuples(tplg, pos, tp->array, tp->size) < 0) { -+ if (tuples) { -+ err = tplg_ref_add(elem, SND_TPLG_TYPE_TOKEN, parent->id); -+ if (err < 0) -+ return err; -+ err = tplg_ref_add(elem2, SND_TPLG_TYPE_TUPLE, id); -+ if (err < 0) -+ return err; -+ err = tplg_ref_add(parent, SND_TPLG_TYPE_DATA, id); -+ if (err < 0) -+ return err; -+ tuples = NULL; -+ } -+ tplg_dv(tplg, pos, "add bytes: size %d", tp->size); -+ snprintf(suffix, sizeof(suffix), "data%u", block++); -+ err = tplg_add_data_bytes(tplg, parent, suffix, tp->array, tp->size); -+ } else { -+ if (!tuples) { -+ snprintf(id, sizeof(id), "%.30s:tuple%d", parent->id, (block++) & 0xffff); -+ elem = tplg_elem_new_common(tplg, NULL, id, SND_TPLG_TYPE_TUPLE); -+ if (!elem) -+ return -ENOMEM; -+ -+ elem2 = tplg_elem_new_common(tplg, NULL, id, SND_TPLG_TYPE_DATA); -+ if (!elem2) -+ return -ENOMEM; -+ -+ tuples = calloc(1, sizeof(*tuples)); -+ if (!tuples) -+ return -ENOMEM; -+ elem->tuples = tuples; -+ -+ tuples->alloc_sets = (size / sizeof(*va)) + 1; -+ tuples->set = calloc(1, tuples->alloc_sets * sizeof(void *)); -+ if (!tuples->set) { -+ tuples->alloc_sets = 0; -+ return -ENOMEM; -+ } -+ } -+ tplg_dv(tplg, pos, "decode tuples: size %d", tp->size); -+ err = tplg_decode_tuples(tplg, pos, parent, tuples, tp->array, tp->size); -+ num_tuples++; -+ } -+ if (err < 0) -+ return err; -+ -+ bin += off + tp->size; -+ size -= off + tp->size; -+ pos += off + tp->size; -+ if (size > 0) -+ goto next; -+ -+ if (tuples && elem && elem2) { -+ err = tplg_ref_add(elem, SND_TPLG_TYPE_TOKEN, parent->id); -+ if (err < 0) -+ return err; -+ err = tplg_ref_add(elem2, SND_TPLG_TYPE_TUPLE, id); -+ if (err < 0) -+ return err; -+ err = tplg_ref_add(parent, SND_TPLG_TYPE_DATA, id); -+ if (err < 0) -+ return err; -+ } -+ -+ return 0; -+} -+ -+/* add private data - bytes */ -+int tplg_add_data_bytes(snd_tplg_t *tplg, struct tplg_elem *parent, -+ const char *suffix, const void *bin, size_t size) -+{ -+ struct snd_soc_tplg_private *priv; -+ struct tplg_elem *elem; -+ char id[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; -+ -+ if (suffix) -+ snprintf(id, sizeof(id), "%.30s:%.12s", parent->id, suffix); -+ else -+ snd_strlcpy(id, parent->id, sizeof(id)); -+ elem = tplg_elem_new_common(tplg, NULL, id, SND_TPLG_TYPE_DATA); -+ if (!elem) -+ return -ENOMEM; -+ -+ priv = malloc(sizeof(*priv) + size); -+ if (!priv) -+ return -ENOMEM; -+ memcpy(priv->data, bin, size); -+ priv->size = size; -+ elem->data = priv; -+ -+ return tplg_ref_add(parent, SND_TPLG_TYPE_DATA, id); -+} -+ -+/* decode data from the binary input */ -+int tplg_decode_data(snd_tplg_t *tplg ATTRIBUTE_UNUSED, -+ size_t pos ATTRIBUTE_UNUSED, -+ struct snd_soc_tplg_hdr *hdr ATTRIBUTE_UNUSED, -+ void *bin ATTRIBUTE_UNUSED, -+ size_t size ATTRIBUTE_UNUSED) -+{ -+ SNDERR("data type not expected"); -+ return -EINVAL; -+} -diff --git a/src/topology/decoder.c b/src/topology/decoder.c -new file mode 100644 -index 00000000..2d6a8969 ---- /dev/null -+++ b/src/topology/decoder.c -@@ -0,0 +1,136 @@ -+/* -+ Copyright (c) 2019 Red Hat Inc. -+ All rights reserved. -+ -+ This library is free software; you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of -+ the License, or (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU Lesser General Public License for more details. -+ -+ Authors: Jaroslav Kysela -+*/ -+ -+#include "list.h" -+#include "tplg_local.h" -+ -+/* verbose output detailing each object size and file position */ -+void tplg_dv(snd_tplg_t *tplg, size_t pos, const char *fmt, ...) -+{ -+ va_list va; -+ -+ if (!tplg->verbose) -+ return; -+ -+ va_start(va, fmt); -+ fprintf(stdout, "D0x%6.6zx/%6.6zd - ", pos, pos); -+ vfprintf(stdout, fmt, va); -+ va_end(va); -+ putc('\n', stdout); -+} -+ -+int tplg_decode_template(snd_tplg_t *tplg, -+ size_t pos, -+ struct snd_soc_tplg_hdr *hdr, -+ snd_tplg_obj_template_t *t) -+{ -+ int type; -+ -+ type = tplg_get_type(hdr->type); -+ tplg_dv(tplg, pos, "template: asoc type %d library type %d", hdr->type, type); -+ if (type < 0) -+ return type; -+ -+ memset(t, 0, sizeof(*t)); -+ t->type = type; -+ t->index = hdr->index; -+ t->version = hdr->version; -+ t->vendor_type = hdr->vendor_type; -+ tplg_dv(tplg, pos, "template: index %d version %d vendor_type %d", -+ hdr->index, hdr->version, hdr->vendor_type); -+ return 0; -+} -+ -+int snd_tplg_decode(snd_tplg_t *tplg, void *bin, size_t size, int dflags) -+{ -+ struct snd_soc_tplg_hdr *hdr; -+ struct tplg_table *tptr; -+ size_t pos; -+ void *b = bin; -+ unsigned int index; -+ int err; -+ -+ if (dflags != 0) -+ return -EINVAL; -+ if (tplg == NULL || bin == NULL) -+ return -EINVAL; -+ while (1) { -+ pos = b - bin; -+ if (size == pos) { -+ tplg_dv(tplg, pos, "block: success (total %zd)", size); -+ return 0; -+ } -+ if (size - pos < sizeof(*hdr)) { -+ tplg_dv(tplg, pos, "block: small size"); -+ SNDERR("incomplete header data to decode"); -+ return -EINVAL; -+ } -+ hdr = b; -+ if (hdr->magic != SND_SOC_TPLG_MAGIC) { -+ SNDERR("bad block magic %08x", hdr->magic); -+ return -EINVAL; -+ } -+ -+ tplg_dv(tplg, pos, "block: abi %d size %d payload size %d", -+ hdr->abi, hdr->size, hdr->payload_size); -+ if (hdr->abi != SND_SOC_TPLG_ABI_VERSION) { -+ SNDERR("unsupported ABI version %d", hdr->abi); -+ return -EINVAL; -+ } -+ if (hdr->size != sizeof(*hdr)) { -+ SNDERR("header size mismatch"); -+ return -EINVAL; -+ } -+ -+ if (size - pos < hdr->size + hdr->payload_size) { -+ SNDERR("incomplete payload data to decode"); -+ return -EINVAL; -+ } -+ -+ if (hdr->payload_size < 8) { -+ SNDERR("wrong payload size %d", hdr->payload_size); -+ return -EINVAL; -+ } -+ -+ /* first block must be manifest */ -+ if (b == bin) { -+ if (hdr->type != SND_SOC_TPLG_TYPE_MANIFEST) { -+ SNDERR("first block must be manifest (value %d)", hdr->type); -+ return -EINVAL; -+ } -+ err = snd_tplg_set_version(tplg, hdr->version); -+ if (err < 0) -+ return err; -+ } -+ -+ pos += hdr->size; -+ for (index = 0; index < tplg_table_items; index++) { -+ tptr = &tplg_table[index]; -+ if (tptr->tsoc == (int)hdr->type) -+ break; -+ } -+ if (index >= tplg_table_items || tptr->decod == NULL) { -+ SNDERR("unknown block type %d", hdr->type); -+ return -EINVAL; -+ } -+ tplg_dv(tplg, pos, "block: type %d - %s", hdr->type, tptr->name); -+ err = tptr->decod(tplg, pos, hdr, b + hdr->size, hdr->payload_size); -+ if (err < 0) -+ return err; -+ b += hdr->size + hdr->payload_size; -+ } -+} -diff --git a/src/topology/elem.c b/src/topology/elem.c -index 89aed1fc..ed5b5f13 100644 ---- a/src/topology/elem.c -+++ b/src/topology/elem.c -@@ -31,6 +31,7 @@ struct tplg_table tplg_table[] = { - .enew = 1, - .parse = tplg_parse_manifest_data, - .save = tplg_save_manifest_data, -+ .decod = tplg_decode_manifest_data, - }, - { - .name = "control mixer", -@@ -43,6 +44,7 @@ struct tplg_table tplg_table[] = { - .enew = 1, - .parse = tplg_parse_control_mixer, - .save = tplg_save_control_mixer, -+ .decod = tplg_decode_control_mixer, - }, - { - .name = "control enum", -@@ -55,6 +57,7 @@ struct tplg_table tplg_table[] = { - .enew = 1, - .parse = tplg_parse_control_enum, - .save = tplg_save_control_enum, -+ .decod = tplg_decode_control_enum, - }, - { - .name = "control extended (bytes)", -@@ -67,6 +70,7 @@ struct tplg_table tplg_table[] = { - .enew = 1, - .parse = tplg_parse_control_bytes, - .save = tplg_save_control_bytes, -+ .decod = tplg_decode_control_bytes, - }, - { - .name = "dapm widget", -@@ -79,6 +83,7 @@ struct tplg_table tplg_table[] = { - .enew = 1, - .parse = tplg_parse_dapm_widget, - .save = tplg_save_dapm_widget, -+ .decod = tplg_decode_dapm_widget, - }, - { - .name = "pcm", -@@ -91,6 +96,7 @@ struct tplg_table tplg_table[] = { - .enew = 1, - .parse = tplg_parse_pcm, - .save = tplg_save_pcm, -+ .decod = tplg_decode_pcm, - }, - { - .name = "physical dai", -@@ -103,6 +109,7 @@ struct tplg_table tplg_table[] = { - .enew = 1, - .parse = tplg_parse_dai, - .save = tplg_save_dai, -+ .decod = tplg_decode_dai, - }, - { - .name = "be", -@@ -116,6 +123,7 @@ struct tplg_table tplg_table[] = { - .enew = 1, - .parse = tplg_parse_link, - .save = tplg_save_link, -+ .decod = tplg_decode_link, - }, - { - .name = "cc", -@@ -128,6 +136,7 @@ struct tplg_table tplg_table[] = { - .enew = 1, - .parse = tplg_parse_cc, - .save = tplg_save_cc, -+ .decod = tplg_decode_cc, - }, - { - .name = "route (dapm graph)", -@@ -138,6 +147,7 @@ struct tplg_table tplg_table[] = { - .build = 1, - .parse = tplg_parse_dapm_graph, - .gsave = tplg_save_dapm_graph, -+ .decod = tplg_decode_dapm_graph, - }, - { - .name = "private data", -@@ -149,6 +159,7 @@ struct tplg_table tplg_table[] = { - .enew = 1, - .parse = tplg_parse_data, - .save = tplg_save_data, -+ .decod = tplg_decode_data, - }, - { - .name = "text", -@@ -220,6 +231,17 @@ struct tplg_table tplg_table[] = { - - unsigned int tplg_table_items = ARRAY_SIZE(tplg_table); - -+int tplg_get_type(int asoc_type) -+{ -+ unsigned int index; -+ -+ for (index = 0; index < tplg_table_items; index++) -+ if (tplg_table[index].tsoc == asoc_type) -+ return tplg_table[index].type; -+ SNDERR("uknown asoc type %d", asoc_type); -+ return -EINVAL; -+} -+ - int tplg_ref_add(struct tplg_elem *elem, int type, const char* id) - { - struct tplg_ref *ref; -@@ -331,6 +353,36 @@ struct tplg_elem *tplg_elem_lookup(struct list_head *base, const char* id, - return NULL; - } - -+/* find an element by type */ -+struct tplg_elem *tplg_elem_type_lookup(snd_tplg_t *tplg, -+ enum snd_tplg_type type) -+{ -+ struct tplg_table *tptr; -+ struct list_head *pos, *list; -+ struct tplg_elem *elem; -+ unsigned int index; -+ -+ for (index = 0; index < tplg_table_items; index++) { -+ tptr = &tplg_table[index]; -+ if (!tptr->enew) -+ continue; -+ if ((int)type != tptr->type) -+ continue; -+ break; -+ } -+ if (index >= tplg_table_items) -+ return NULL; -+ -+ list = (struct list_head *)((void *)tplg + tptr->loff); -+ -+ /* return only first element */ -+ list_for_each(pos, list) { -+ elem = list_entry(pos, struct tplg_elem, list); -+ return elem; -+ } -+ return NULL; -+} -+ - /* insert a new element into list in the ascending order of index value */ - void tplg_elem_insert(struct tplg_elem *elem_p, struct list_head *list) - { -@@ -428,3 +480,31 @@ struct tplg_elem* tplg_elem_new_common(snd_tplg_t *tplg, - elem->type = type; - return elem; - } -+ -+struct tplg_alloc { -+ struct list_head list; -+ void *data[0]; -+}; -+ -+void *tplg_calloc(struct list_head *heap, size_t size) -+{ -+ struct tplg_alloc *a; -+ -+ a = calloc(1, sizeof(*a) + size); -+ if (a == NULL) -+ return NULL; -+ list_add_tail(&a->list, heap); -+ return a->data; -+} -+ -+void tplg_free(struct list_head *heap) -+{ -+ struct list_head *pos, *npos; -+ struct tplg_alloc *a; -+ -+ list_for_each_safe(pos, npos, heap) { -+ a = list_entry(pos, struct tplg_alloc, list); -+ list_del(&a->list); -+ free(a); -+ } -+} -diff --git a/src/topology/parser.c b/src/topology/parser.c -index 5a5dd14f..d7783a93 100644 ---- a/src/topology/parser.c -+++ b/src/topology/parser.c -@@ -396,17 +396,21 @@ int snd_tplg_build_bin(snd_tplg_t *tplg, - - int snd_tplg_set_manifest_data(snd_tplg_t *tplg, const void *data, int len) - { -+ struct tplg_elem *elem; -+ -+ elem = tplg_elem_type_lookup(tplg, SND_TPLG_TYPE_MANIFEST); -+ if (elem == NULL) { -+ elem = tplg_elem_new_common(tplg, NULL, "manifest", -+ SND_TPLG_TYPE_MANIFEST); -+ if (!elem) -+ return -ENOMEM; -+ tplg->manifest.size = elem->size; -+ } -+ - if (len <= 0) - return 0; - -- tplg->manifest.priv.size = len; -- -- tplg->manifest_pdata = malloc(len); -- if (!tplg->manifest_pdata) -- return -ENOMEM; -- -- memcpy(tplg->manifest_pdata, data, len); -- return 0; -+ return tplg_add_data_bytes(tplg, elem, NULL, data, len); - } - - int snd_tplg_set_version(snd_tplg_t *tplg, unsigned int version) -diff --git a/src/topology/pcm.c b/src/topology/pcm.c -index bd728959..4e04a6bc 100644 ---- a/src/topology/pcm.c -+++ b/src/topology/pcm.c -@@ -1679,11 +1679,20 @@ static void tplg_add_stream_object(struct snd_soc_tplg_stream *strm, - strm->channels = strm_tpl->channels; - } - --static void tplg_add_stream_caps(struct snd_soc_tplg_stream_caps *caps, -- struct snd_tplg_stream_caps_template *caps_tpl) -+static int tplg_add_stream_caps(snd_tplg_t *tplg, -+ struct snd_tplg_stream_caps_template *caps_tpl) - { -- snd_strlcpy(caps->name, caps_tpl->name, -- SNDRV_CTL_ELEM_ID_NAME_MAXLEN); -+ struct snd_soc_tplg_stream_caps *caps; -+ struct tplg_elem *elem; -+ -+ elem = tplg_elem_new_common(tplg, NULL, caps_tpl->name, -+ SND_TPLG_TYPE_STREAM_CAPS); -+ if (!elem) -+ return -ENOMEM; -+ -+ caps = elem->stream_caps; -+ -+ snd_strlcpy(caps->name, caps_tpl->name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN); - - caps->formats = caps_tpl->formats; - caps->rates = caps_tpl->rates; -@@ -1698,15 +1707,17 @@ static void tplg_add_stream_caps(struct snd_soc_tplg_stream_caps *caps, - caps->buffer_size_min = caps_tpl->buffer_size_min; - caps->buffer_size_max = caps_tpl->buffer_size_max; - caps->sig_bits = caps_tpl->sig_bits; -+ return 0; - } - - /* Add a PCM element (FE DAI & DAI link) from C API */ - int tplg_add_pcm_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) - { - struct snd_tplg_pcm_template *pcm_tpl = t->pcm; -- struct snd_soc_tplg_pcm *pcm, *_pcm; -+ struct snd_soc_tplg_private *priv; -+ struct snd_soc_tplg_pcm *pcm; - struct tplg_elem *elem; -- int i; -+ int ret, i; - - tplg_dbg("PCM: %s, DAI %s\n", pcm_tpl->pcm_name, pcm_tpl->dai_name); - -@@ -1732,8 +1743,13 @@ int tplg_add_pcm_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) - pcm->compress = pcm_tpl->compress; - - for (i = 0; i < 2; i++) { -- if (pcm_tpl->caps[i]) -- tplg_add_stream_caps(&pcm->caps[i], pcm_tpl->caps[i]); -+ if (!pcm_tpl->caps[i] || !pcm_tpl->caps[i]->name) -+ continue; -+ ret = tplg_add_stream_caps(tplg, pcm_tpl->caps[i]); -+ if (ret < 0) -+ return ret; -+ snd_strlcpy(pcm->caps[i].name, pcm_tpl->caps[i]->name, -+ sizeof(pcm->caps[i].name)); - } - - pcm->flag_mask = pcm_tpl->flag_mask; -@@ -1744,22 +1760,12 @@ int tplg_add_pcm_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) - tplg_add_stream_object(&pcm->stream[i], &pcm_tpl->stream[i]); - - /* private data */ -- if (pcm_tpl->priv != NULL && pcm_tpl->priv->size) { -- tplg_dbg("\t priv data size %d\n", pcm_tpl->priv->size); -- _pcm = realloc(pcm, -- elem->size + pcm_tpl->priv->size); -- if (!_pcm) { -- tplg_elem_free(elem); -- return -ENOMEM; -- } -- -- pcm = _pcm; -- elem->pcm = pcm; -- elem->size += pcm_tpl->priv->size; -- -- memcpy(pcm->priv.data, pcm_tpl->priv->data, -- pcm_tpl->priv->size); -- pcm->priv.size = pcm_tpl->priv->size; -+ priv = pcm_tpl->priv; -+ if (priv && priv->size > 0) { -+ ret = tplg_add_data(tplg, elem, priv, -+ sizeof(*priv) + priv->size); -+ if (ret < 0) -+ return ret; - } - - return 0; -@@ -1810,9 +1816,11 @@ static int set_link_hw_config(struct snd_soc_tplg_hw_config *cfg, - int tplg_add_link_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) - { - struct snd_tplg_link_template *link_tpl = t->link; -- struct snd_soc_tplg_link_config *link, *_link; -+ struct snd_soc_tplg_link_config *link; -+ struct snd_soc_tplg_private *priv; - struct tplg_elem *elem; - unsigned int i; -+ int ret; - - if (t->type != SND_TPLG_TYPE_LINK && t->type != SND_TPLG_TYPE_BE - && t->type != SND_TPLG_TYPE_CC) -@@ -1854,21 +1862,12 @@ int tplg_add_link_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) - link->flags = link_tpl->flags; - - /* private data */ -- if (link_tpl->priv != NULL && link_tpl->priv->size) { -- _link = realloc(link, -- elem->size + link_tpl->priv->size); -- if (!_link) { -- tplg_elem_free(elem); -- return -ENOMEM; -- } -- -- link = _link; -- elem->link = link; -- elem->size += link_tpl->priv->size; -- -- memcpy(link->priv.data, link_tpl->priv->data, -- link_tpl->priv->size); -- link->priv.size = link_tpl->priv->size; -+ priv = link_tpl->priv; -+ if (priv && priv->size > 0) { -+ ret = tplg_add_data(tplg, elem, priv, -+ sizeof(*priv) + priv->size); -+ if (ret < 0) -+ return ret; - } - - return 0; -@@ -1877,14 +1876,15 @@ int tplg_add_link_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) - int tplg_add_dai_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) - { - struct snd_tplg_dai_template *dai_tpl = t->dai; -- struct snd_soc_tplg_dai *dai, *_dai; -+ struct snd_soc_tplg_dai *dai; -+ struct snd_soc_tplg_private *priv; - struct tplg_elem *elem; -- int i; -+ int ret, i; - - tplg_dbg("DAI %s\n", dai_tpl->dai_name); - - elem = tplg_elem_new_common(tplg, NULL, dai_tpl->dai_name, -- SND_TPLG_TYPE_DAI); -+ SND_TPLG_TYPE_DAI); - if (!elem) - return -ENOMEM; - -@@ -1900,8 +1900,13 @@ int tplg_add_dai_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) - dai->capture = dai_tpl->capture; - - for (i = 0; i < 2; i++) { -- if (dai_tpl->caps[i]) -- tplg_add_stream_caps(&dai->caps[i], dai_tpl->caps[i]); -+ if (!dai_tpl->caps[i] || !dai_tpl->caps[i]->name) -+ continue; -+ ret = tplg_add_stream_caps(tplg, dai_tpl->caps[i]); -+ if (ret < 0) -+ return ret; -+ snd_strlcpy(dai->caps[i].name, dai_tpl->caps[i]->name, -+ sizeof(dai->caps[i].name)); - } - - /* flags */ -@@ -1909,22 +1914,299 @@ int tplg_add_dai_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) - dai->flags = dai_tpl->flags; - - /* private data */ -- if (dai_tpl->priv != NULL) { -- _dai = realloc(dai, -- elem->size + dai_tpl->priv->size); -- if (!_dai) { -- tplg_elem_free(elem); -- return -ENOMEM; -+ priv = dai_tpl->priv; -+ if (priv && priv->size > 0) { -+ ret = tplg_add_data(tplg, elem, priv, -+ sizeof(*priv) + priv->size); -+ if (ret < 0) -+ return ret; -+ } -+ -+ return 0; -+} -+ -+/* decode pcm from the binary input */ -+int tplg_decode_pcm(snd_tplg_t *tplg, -+ size_t pos, -+ struct snd_soc_tplg_hdr *hdr, -+ void *bin, size_t size) -+{ -+ struct snd_soc_tplg_pcm *pcm; -+ snd_tplg_obj_template_t t; -+ struct snd_tplg_pcm_template *pt; -+ struct snd_tplg_stream_caps_template caps[2], *cap; -+ struct snd_tplg_stream_template *stream; -+ unsigned int i; -+ size_t asize; -+ int err; -+ -+ err = tplg_decode_template(tplg, pos, hdr, &t); -+ if (err < 0) -+ return err; -+ -+ asize = sizeof(*pt) + SND_SOC_TPLG_STREAM_CONFIG_MAX * sizeof(*stream); -+ pt = alloca(asize); -+ -+next: -+ memset(pt, 0, asize); -+ pcm = bin; -+ -+ if (size < sizeof(*pcm)) { -+ SNDERR("pcm: small size %d", size); -+ return -EINVAL; -+ } -+ if (sizeof(*pcm) != pcm->size) { -+ SNDERR("pcm: unknown element size %d (expected %zd)", -+ pcm->size, sizeof(*pcm)); -+ return -EINVAL; -+ } -+ if (pcm->num_streams > SND_SOC_TPLG_STREAM_CONFIG_MAX) { -+ SNDERR("pcm: wrong number of streams %d", pcm->num_streams); -+ return -EINVAL; -+ } -+ if (sizeof(*pcm) + pcm->priv.size > size) { -+ SNDERR("pcm: wrong private data size %d", pcm->priv.size); -+ return -EINVAL; -+ } -+ -+ tplg_dv(tplg, pos, "pcm: size %d private size %d streams %d", -+ pcm->size, pcm->priv.size, pcm->num_streams); -+ -+ pt->pcm_name = pcm->pcm_name; -+ tplg_dv(tplg, pos, "pcm: pcm_name '%s'", pt->pcm_name); -+ pt->dai_name = pcm->dai_name; -+ tplg_dv(tplg, pos, "pcm: dai_name '%s'", pt->dai_name); -+ pt->pcm_id = pcm->pcm_id; -+ pt->dai_id = pcm->dai_id; -+ tplg_dv(tplg, pos, "pcm: pcm_id %d dai_id %d", pt->pcm_id, pt->dai_id); -+ pt->playback = pcm->playback; -+ pt->capture = pcm->capture; -+ pt->compress = pcm->compress; -+ tplg_dv(tplg, pos, "pcm: playback %d capture %d compress", -+ pt->playback, pt->capture, pt->compress); -+ pt->num_streams = pcm->num_streams; -+ pt->flag_mask = pcm->flag_mask; -+ pt->flags = pcm->flags; -+ for (i = 0; i < pcm->num_streams; i++) { -+ stream = &pt->stream[i]; -+ if (pcm->stream[i].size != sizeof(pcm->stream[0])) { -+ SNDERR("pcm: unknown stream structure size %d", -+ pcm->stream[i].size); -+ return -EINVAL; -+ } -+ stream->name = pcm->stream[i].name; -+ tplg_dv(tplg, pos + offsetof(struct snd_soc_tplg_pcm, stream[i]), -+ "stream %d: '%s'", i, stream->name); -+ stream->format = pcm->stream[i].format; -+ stream->rate = pcm->stream[i].rate; -+ stream->period_bytes = pcm->stream[i].period_bytes; -+ stream->buffer_bytes = pcm->stream[i].buffer_bytes; -+ stream->channels = pcm->stream[i].channels; -+ } -+ for (i = 0; i < 2; i++) { -+ if (i == 0 && !pcm->playback) -+ continue; -+ if (i == 1 && !pcm->capture) -+ continue; -+ cap = &caps[i]; -+ pt->caps[i] = cap; -+ if (pcm->caps[i].size != sizeof(pcm->caps[0])) { -+ SNDERR("pcm: unknown caps structure size %d", -+ pcm->caps[i].size); -+ return -EINVAL; - } -+ cap->name = pcm->caps[i].name; -+ tplg_dv(tplg, pos + offsetof(struct snd_soc_tplg_pcm, caps[i]), -+ "caps %d: '%s'", i, cap->name); -+ cap->formats = pcm->caps[i].formats; -+ cap->rates = pcm->caps[i].rates; -+ cap->rate_min = pcm->caps[i].rate_min; -+ cap->rate_max = pcm->caps[i].rate_max; -+ cap->channels_min = pcm->caps[i].channels_min; -+ cap->channels_max = pcm->caps[i].channels_max; -+ cap->periods_min = pcm->caps[i].periods_min; -+ cap->periods_max = pcm->caps[i].periods_max; -+ cap->period_size_min = pcm->caps[i].period_size_min; -+ cap->period_size_max = pcm->caps[i].period_size_max; -+ cap->buffer_size_min = pcm->caps[i].buffer_size_min; -+ cap->buffer_size_max = pcm->caps[i].buffer_size_max; -+ cap->sig_bits = pcm->caps[i].sig_bits; -+ } -+ -+ tplg_dv(tplg, pos + offsetof(struct snd_soc_tplg_pcm, priv), -+ "pcm: private start"); -+ pt->priv = &pcm->priv; -+ -+ bin += sizeof(*pcm) + pcm->priv.size; -+ size -= sizeof(*pcm) + pcm->priv.size; -+ pos += sizeof(*pcm) + pcm->priv.size; -+ -+ t.pcm = pt; -+ err = snd_tplg_add_object(tplg, &t); -+ if (err < 0) -+ return err; -+ -+ if (size > 0) -+ goto next; -+ -+ return 0; -+} -+ -+/* decode dai from the binary input */ -+int tplg_decode_dai(snd_tplg_t *tplg, -+ size_t pos, -+ struct snd_soc_tplg_hdr *hdr, -+ void *bin, size_t size) -+{ -+ SNDERR("not implemented"); -+ return -ENXIO; -+} -+ -+/* decode cc from the binary input */ -+int tplg_decode_cc(snd_tplg_t *tplg, -+ size_t pos, -+ struct snd_soc_tplg_hdr *hdr, -+ void *bin, size_t size) -+{ -+ SNDERR("not implemented"); -+ return -ENXIO; -+} -+ -+/* decode link from the binary input */ -+int tplg_decode_link(snd_tplg_t *tplg, -+ size_t pos, -+ struct snd_soc_tplg_hdr *hdr, -+ void *bin, size_t size) -+{ -+ struct snd_soc_tplg_link_config *link; -+ snd_tplg_obj_template_t t; -+ struct snd_tplg_link_template lt; -+ struct snd_tplg_stream_template streams[SND_SOC_TPLG_STREAM_CONFIG_MAX]; -+ struct snd_tplg_stream_template *stream; -+ struct snd_tplg_hw_config_template hws[SND_SOC_TPLG_HW_CONFIG_MAX]; -+ struct snd_tplg_hw_config_template *hw; -+ unsigned int i, j; -+ int err; -+ -+ err = tplg_decode_template(tplg, pos, hdr, &t); -+ if (err < 0) -+ return err; -+ -+next: -+ memset(<, 0, sizeof(lt)); -+ memset(streams, 0, sizeof(streams)); -+ memset(hws, 0, sizeof(hws)); -+ link = bin; - -- dai = _dai; -- dai->priv.size = dai_tpl->priv->size; -+ if (size < sizeof(*link)) { -+ SNDERR("link: small size %d", size); -+ return -EINVAL; -+ } -+ if (sizeof(*link) != link->size) { -+ SNDERR("link: unknown element size %d (expected %zd)", -+ link->size, sizeof(*link)); -+ return -EINVAL; -+ } -+ if (link->num_streams > SND_SOC_TPLG_STREAM_CONFIG_MAX) { -+ SNDERR("link: wrong number of streams %d", link->num_streams); -+ return -EINVAL; -+ } -+ if (link->num_hw_configs > SND_SOC_TPLG_HW_CONFIG_MAX) { -+ SNDERR("link: wrong number of streams %d", link->num_streams); -+ return -EINVAL; -+ } -+ if (sizeof(*link) + link->priv.size > size) { -+ SNDERR("link: wrong private data size %d", link->priv.size); -+ return -EINVAL; -+ } - -- elem->dai = dai; -- elem->size += dai->priv.size; -- memcpy(dai->priv.data, dai_tpl->priv->data, -- dai->priv.size); -+ tplg_dv(tplg, pos, "link: size %d private size %d streams %d " -+ "hw_configs %d", -+ link->size, link->priv.size, link->num_streams, -+ link->num_hw_configs); -+ -+ lt.id = link->id; -+ lt.name = link->name; -+ tplg_dv(tplg, pos, "link: name '%s'", lt.name); -+ lt.stream_name = link->stream_name; -+ tplg_dv(tplg, pos, "link: stream_name '%s'", lt.stream_name); -+ lt.num_streams = link->num_streams; -+ lt.num_hw_configs = link->num_hw_configs; -+ lt.default_hw_config_id = link->default_hw_config_id; -+ lt.flag_mask = link->flag_mask; -+ lt.flags = link->flags; -+ for (i = 0; i < link->num_streams; i++) { -+ stream = &streams[i]; -+ if (link->stream[i].size != sizeof(link->stream[0])) { -+ SNDERR("link: unknown stream structure size %d", -+ link->stream[i].size); -+ return -EINVAL; -+ } -+ stream->name = link->stream[i].name; -+ tplg_dv(tplg, -+ pos + offsetof(struct snd_soc_tplg_link_config, stream[i]), -+ "stream %d: '%s'", i, stream->name); -+ stream->format = link->stream[i].format; -+ stream->rate = link->stream[i].rate; -+ stream->period_bytes = link->stream[i].period_bytes; -+ stream->buffer_bytes = link->stream[i].buffer_bytes; -+ stream->channels = link->stream[i].channels; - } -+ lt.stream = streams; -+ for (i = 0; i < link->num_hw_configs; i++) { -+ hw = &hws[i]; -+ if (link->hw_config[i].size != sizeof(link->hw_config[0])) { -+ SNDERR("link: unknown hw_config structure size %d", -+ link->hw_config[i].size); -+ return -EINVAL; -+ } -+ hw->id = link->hw_config[i].id; -+ hw->fmt = link->hw_config[i].fmt; -+ hw->clock_gated = link->hw_config[i].clock_gated; -+ hw->invert_bclk = link->hw_config[i].invert_bclk; -+ hw->invert_fsync = link->hw_config[i].invert_fsync; -+ hw->bclk_master = link->hw_config[i].bclk_master; -+ hw->fsync_master = link->hw_config[i].fsync_master; -+ hw->mclk_direction = link->hw_config[i].mclk_direction; -+ hw->mclk_rate = link->hw_config[i].mclk_rate; -+ hw->bclk_rate = link->hw_config[i].bclk_rate; -+ hw->fsync_rate = link->hw_config[i].fsync_rate; -+ hw->tdm_slots = link->hw_config[i].tdm_slots; -+ hw->tdm_slot_width = link->hw_config[i].tdm_slot_width; -+ hw->tx_slots = link->hw_config[i].tx_slots; -+ hw->rx_slots = link->hw_config[i].rx_slots; -+ hw->tx_channels = link->hw_config[i].tx_channels; -+ if (hw->tx_channels > SND_SOC_TPLG_MAX_CHAN) { -+ SNDERR("link: wrong tx channels %d", hw->tx_channels); -+ return -EINVAL; -+ } -+ for (j = 0; j < hw->tx_channels; j++) -+ hw->tx_chanmap[j] = link->hw_config[i].tx_chanmap[j]; -+ hw->rx_channels = link->hw_config[i].rx_channels; -+ if (hw->rx_channels > SND_SOC_TPLG_MAX_CHAN) { -+ SNDERR("link: wrong rx channels %d", hw->tx_channels); -+ return -EINVAL; -+ } -+ for (j = 0; j < hw->rx_channels; j++) -+ hw->rx_chanmap[j] = link->hw_config[i].rx_chanmap[j]; -+ } -+ lt.hw_config = hws; -+ -+ tplg_dv(tplg, pos + offsetof(struct snd_soc_tplg_pcm, priv), -+ "link: private start"); -+ lt.priv = &link->priv; -+ -+ bin += sizeof(*link) + link->priv.size; -+ size -= sizeof(*link) + link->priv.size; -+ pos += sizeof(*link) + link->priv.size; -+ -+ t.link = < -+ err = snd_tplg_add_object(tplg, &t); -+ if (err < 0) -+ return err; -+ -+ if (size > 0) -+ goto next; - - return 0; - } -diff --git a/src/topology/save.c b/src/topology/save.c -index 0498911f..c6eabc49 100644 ---- a/src/topology/save.c -+++ b/src/topology/save.c -@@ -577,6 +577,9 @@ int snd_tplg_save(snd_tplg_t *tplg, char **dst, int flags) - if (err < 0) - goto _err; - -+ if (*dst == NULL) -+ return -EINVAL; -+ - if (flags & SND_TPLG_SAVE_NOCHECK) - return 0; - -diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h -index 74b3a55c..22fc5fba 100644 ---- a/src/topology/tplg_local.h -+++ b/src/topology/tplg_local.h -@@ -142,7 +142,8 @@ struct tplg_tuple_set { - }; - - struct tplg_vendor_tuples { -- unsigned int num_sets; -+ unsigned int num_sets; -+ unsigned int alloc_sets; - struct tplg_tuple_set **set; - }; - -@@ -217,11 +218,19 @@ struct tplg_table { - char **dst, const char *prefix); - int (*gsave)(snd_tplg_t *tplg, int index, - char **dst, const char *prefix); -+ int (*decod)(snd_tplg_t *tplg, size_t pos, -+ struct snd_soc_tplg_hdr *hdr, -+ void *bin, size_t size); - }; - - extern struct tplg_table tplg_table[]; - extern unsigned int tplg_table_items; - -+void *tplg_calloc(struct list_head *heap, size_t size); -+void tplg_free(struct list_head *heap); -+ -+int tplg_get_type(int asoc_type); -+ - int tplg_parse_compound(snd_tplg_t *tplg, snd_config_t *cfg, - int (*fcn)(snd_tplg_t *, snd_config_t *, void *), - void *private); -@@ -246,6 +255,7 @@ int tplg_parse_link(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); - int tplg_parse_cc(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); - int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, void *priv); - -+unsigned int tplg_get_tuple_size(int type); - void tplg_free_tuples(void *obj); - - int tplg_build_data(snd_tplg_t *tplg); -@@ -272,6 +282,8 @@ struct tplg_elem *tplg_elem_lookup(struct list_head *base, - const char* id, - unsigned int type, - int index); -+struct tplg_elem *tplg_elem_type_lookup(snd_tplg_t *tplg, -+ enum snd_tplg_type type); - struct tplg_elem* tplg_elem_new_common(snd_tplg_t *tplg, - snd_config_t *cfg, const char *name, enum snd_tplg_type type); - -@@ -291,6 +303,10 @@ int tplg_parse_ext_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, - struct tplg_elem *lookup_pcm_dai_stream(struct list_head *base, - const char* id); - -+int tplg_add_data(snd_tplg_t *tplg, struct tplg_elem *parent, -+ const void *bin, size_t size); -+int tplg_add_data_bytes(snd_tplg_t *tplg, struct tplg_elem *parent, -+ const char *suffix, const void *bin, size_t size); - int tplg_add_mixer_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t); - int tplg_add_enum_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t); - int tplg_add_bytes_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t); -@@ -356,3 +372,56 @@ int tplg_save_stream_caps(snd_tplg_t *tplg, struct tplg_elem *elem, - char **dst, const char *pfx); - int tplg_save_dai(snd_tplg_t *tplg, struct tplg_elem *elem, - char **dst, const char *pfx); -+ -+void tplg_dv(snd_tplg_t *tplg, size_t pos, const char *fmt, ...); -+int tplg_decode_template(snd_tplg_t *tplg, -+ size_t pos, -+ struct snd_soc_tplg_hdr *hdr, -+ snd_tplg_obj_template_t *t); -+int tplg_decode_manifest_data(snd_tplg_t *tplg, size_t pos, -+ struct snd_soc_tplg_hdr *hdr, -+ void *bin, size_t size); -+int tplg_decode_control_mixer1(snd_tplg_t *tplg, -+ struct list_head *heap, -+ struct snd_tplg_mixer_template *mt, -+ size_t pos, -+ void *bin, size_t size); -+int tplg_decode_control_mixer(snd_tplg_t *tplg, size_t pos, -+ struct snd_soc_tplg_hdr *hdr, -+ void *bin, size_t size); -+int tplg_decode_control_enum1(snd_tplg_t *tplg, -+ struct list_head *heap, -+ struct snd_tplg_enum_template *et, -+ size_t pos, -+ void *bin, size_t size); -+int tplg_decode_control_enum(snd_tplg_t *tplg, size_t pos, -+ struct snd_soc_tplg_hdr *hdr, -+ void *bin, size_t size); -+int tplg_decode_control_bytes1(snd_tplg_t *tplg, -+ struct snd_tplg_bytes_template *bt, -+ size_t pos, -+ void *bin, size_t size); -+int tplg_decode_control_bytes(snd_tplg_t *tplg, size_t pos, -+ struct snd_soc_tplg_hdr *hdr, -+ void *bin, size_t size); -+int tplg_decode_data(snd_tplg_t *tplg, size_t pos, -+ struct snd_soc_tplg_hdr *hdr, -+ void *bin, size_t size); -+int tplg_decode_dapm_graph(snd_tplg_t *tplg, size_t pos, -+ struct snd_soc_tplg_hdr *hdr, -+ void *bin, size_t size); -+int tplg_decode_dapm_widget(snd_tplg_t *tplg, size_t pos, -+ struct snd_soc_tplg_hdr *hdr, -+ void *bin, size_t size); -+int tplg_decode_link(snd_tplg_t *tplg, size_t pos, -+ struct snd_soc_tplg_hdr *hdr, -+ void *bin, size_t size); -+int tplg_decode_cc(snd_tplg_t *tplg, size_t pos, -+ struct snd_soc_tplg_hdr *hdr, -+ void *bin, size_t size); -+int tplg_decode_pcm(snd_tplg_t *tplg, size_t pos, -+ struct snd_soc_tplg_hdr *hdr, -+ void *bin, size_t size); -+int tplg_decode_dai(snd_tplg_t *tplg, size_t pos, -+ struct snd_soc_tplg_hdr *hdr, -+ void *bin, size_t size); --- -2.24.1 - - -From cb88813ff71226af5d16f8853d186ff7c572dbe0 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 3 Jan 2020 22:07:11 +0100 -Subject: [PATCH 54/69] topology: move the elem->list delete to - tplg_elem_free() - -The tplg_elem_free() is called in the error path from many places -and it is expected that the element object will be unregistered -from the tplg structure, too. - -Signed-off-by: Jaroslav Kysela ---- - src/topology/elem.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/src/topology/elem.c b/src/topology/elem.c -index ed5b5f13..cbd7f4b6 100644 ---- a/src/topology/elem.c -+++ b/src/topology/elem.c -@@ -301,6 +301,8 @@ struct tplg_elem *tplg_elem_new(void) - - void tplg_elem_free(struct tplg_elem *elem) - { -+ list_del(&elem->list); -+ - tplg_ref_free_list(&elem->ref_list); - - /* free struct snd_tplg_ object, -@@ -323,7 +325,6 @@ void tplg_elem_free_list(struct list_head *base) - - list_for_each_safe(pos, npos, base) { - elem = list_entry(pos, struct tplg_elem, list); -- list_del(&elem->list); - tplg_elem_free(elem); - } - } --- -2.24.1 - - -From ae6522e10621839a15f5a439091af7542d84d3e5 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 3 Jan 2020 22:31:27 +0100 -Subject: [PATCH 55/69] topology: unify the log mechanism - -Signed-off-by: Jaroslav Kysela ---- - src/topology/Makefile.am | 3 ++- - src/topology/builder.c | 54 +++++++++++++++++---------------------- - src/topology/ctl.c | 30 +++++++++++----------- - src/topology/dapm.c | 19 +++++++------- - src/topology/data.c | 26 +++++++++---------- - src/topology/decoder.c | 32 +++++++---------------- - src/topology/log.c | 34 ++++++++++++++++++++++++ - src/topology/pcm.c | 48 +++++++++++++++++----------------- - src/topology/tplg_local.h | 8 +++++- - 9 files changed, 138 insertions(+), 116 deletions(-) - create mode 100644 src/topology/log.c - -diff --git a/src/topology/Makefile.am b/src/topology/Makefile.am -index 12d1d445..9f48891f 100644 ---- a/src/topology/Makefile.am -+++ b/src/topology/Makefile.am -@@ -29,7 +29,8 @@ libatopology_la_SOURCES =\ - ops.c \ - elem.c \ - save.c \ -- decoder.c -+ decoder.c \ -+ log.c - - noinst_HEADERS = tplg_local.h - -diff --git a/src/topology/builder.c b/src/topology/builder.c -index 74c44405..7af5de08 100644 ---- a/src/topology/builder.c -+++ b/src/topology/builder.c -@@ -20,20 +20,6 @@ - #include "list.h" - #include "tplg_local.h" - --/* verbose output detailing each object size and file position */ --static void verbose(snd_tplg_t *tplg, const char *fmt, ...) --{ -- va_list va; -- -- if (!tplg->verbose) -- return; -- -- va_start(va, fmt); -- fprintf(stdout, "0x%6.6zx/%6.6zd - ", tplg->bin_pos, tplg->bin_pos); -- vfprintf(stdout, fmt, va); -- va_end(va); --} -- - /* write a block, track the position */ - static ssize_t twrite(snd_tplg_t *tplg, void *data, size_t data_size) - { -@@ -73,10 +59,11 @@ static ssize_t write_block_header(snd_tplg_t *tplg, unsigned int type, - return -EINVAL; - } - -- verbose(tplg, "header index %d type %d count %d size 0x%lx/%ld vendor %d " -- "version %d\n", index, type, count, -- (long unsigned int)payload_size, (long int)payload_size, -- vendor_type, version); -+ tplg_log(tplg, 'B', tplg->bin_pos, -+ "header index %d type %d count %d size 0x%lx/%ld vendor %d " -+ "version %d", index, type, count, -+ (long unsigned int)payload_size, (long int)payload_size, -+ vendor_type, version); - - tplg->next_hdr_pos += hdr.payload_size + sizeof(hdr); - -@@ -121,13 +108,15 @@ static int write_elem_block(snd_tplg_t *tplg, - continue; - - if (elem->type != SND_TPLG_TYPE_DAPM_GRAPH) -- verbose(tplg, "%s '%s': write %d bytes\n", -- obj_name, elem->id, elem->size); -+ tplg_log(tplg, 'B', tplg->bin_pos, -+ "%s '%s': write %d bytes", -+ obj_name, elem->id, elem->size); - else -- verbose(tplg, "%s '%s -> %s -> %s': write %d bytes\n", -- obj_name, elem->route->source, -- elem->route->control, -- elem->route->sink, elem->size); -+ tplg_log(tplg, 'B', tplg->bin_pos, -+ "%s '%s -> %s -> %s': write %d bytes", -+ obj_name, elem->route->source, -+ elem->route->control, -+ elem->route->sink, elem->size); - - wsize = twrite(tplg, elem->obj, elem->size); - if (wsize < 0) -@@ -225,10 +214,13 @@ static ssize_t write_manifest_data(snd_tplg_t *tplg) - return ret; - } - -- verbose(tplg, "manifest: write %d bytes\n", sizeof(tplg->manifest)); -+ tplg_log(tplg, 'B', tplg->bin_pos, "manifest: write %d bytes", -+ sizeof(tplg->manifest)); - ret = twrite(tplg, &tplg->manifest, sizeof(tplg->manifest)); - if (ret >= 0) { -- verbose(tplg, "manifest: write %d priv bytes\n", tplg->manifest.priv.size); -+ tplg_log(tplg, 'B', tplg->bin_pos, -+ "manifest: write %d priv bytes", -+ tplg->manifest.priv.size); - ret = twrite(tplg, tplg->manifest_pdata, tplg->manifest.priv.size); - } - return ret; -@@ -280,9 +272,10 @@ int tplg_write_data(snd_tplg_t *tplg) - size = calc_block_size(list); - if (size == 0) - continue; -- verbose(tplg, "block size for type %s (%d:%d) is 0x%zx/%zd\n", -- tptr->name, tptr->type, -- tptr->tsoc, size, size); -+ tplg_log(tplg, 'B', tplg->bin_pos, -+ "block size for type %s (%d:%d) is 0x%zx/%zd", -+ tptr->name, tptr->type, -+ tptr->tsoc, size, size); - ret = write_elem_block(tplg, list, size, - tptr->tsoc, tptr->name); - if (ret < 0) { -@@ -292,7 +285,8 @@ int tplg_write_data(snd_tplg_t *tplg) - } - } - -- verbose(tplg, "total size is 0x%zx/%zd\n", tplg->bin_pos, tplg->bin_pos); -+ tplg_log(tplg, 'B', tplg->bin_pos, "total size is 0x%zx/%zd", -+ tplg->bin_pos, tplg->bin_pos); - - if (total_size != tplg->bin_pos) { - SNDERR("total size mismatch (%zd != %zd)", -diff --git a/src/topology/ctl.c b/src/topology/ctl.c -index 24d437aa..a5a81148 100644 ---- a/src/topology/ctl.c -+++ b/src/topology/ctl.c -@@ -1216,8 +1216,8 @@ int tplg_decode_control_mixer1(snd_tplg_t *tplg, - return -EINVAL; - } - -- tplg_dv(tplg, pos, "mixer: size %d TLV size %d private size %d", -- mc->size, mc->hdr.tlv.size, mc->priv.size); -+ tplg_log(tplg, 'D', pos, "mixer: size %d TLV size %d private size %d", -+ mc->size, mc->hdr.tlv.size, mc->priv.size); - if (size != mc->size + mc->priv.size) { - SNDERR("mixer: unexpected element size %d", size); - return -EINVAL; -@@ -1233,7 +1233,7 @@ int tplg_decode_control_mixer1(snd_tplg_t *tplg, - mt->min = mc->min; - mt->max = mc->max; - mt->platform_max = mc->platform_max; -- tplg_dv(tplg, pos, "mixer: name '%s' access 0x%x", -+ tplg_log(tplg, 'D', pos, "mixer: name '%s' access 0x%x", - mt->hdr.name, mt->hdr.access); - if (mc->num_channels > 0) { - map = tplg_calloc(heap, sizeof(*map)); -@@ -1261,16 +1261,16 @@ int tplg_decode_control_mixer1(snd_tplg_t *tplg, - db->min = mc->hdr.tlv.scale.min; - db->step = mc->hdr.tlv.scale.step; - db->mute = mc->hdr.tlv.scale.mute; -- tplg_dv(tplg, pos, "mixer: dB scale TLV: min %d step %d mute %d", -- db->min, db->step, db->mute); -+ tplg_log(tplg, 'D', pos, "mixer: dB scale TLV: min %d step %d mute %d", -+ db->min, db->step, db->mute); - } else { - SNDERR("mixer: wrong TLV size %d", mc->hdr.tlv.size); - return -EINVAL; - } - - mt->priv = &mc->priv; -- tplg_dv(tplg, pos + offsetof(struct snd_soc_tplg_mixer_control, priv), -- "mixer: private start"); -+ tplg_log(tplg, 'D', pos + offsetof(struct snd_soc_tplg_mixer_control, priv), -+ "mixer: private start"); - return 0; - } - -@@ -1338,8 +1338,8 @@ int tplg_decode_control_enum1(snd_tplg_t *tplg, - return -EINVAL; - } - -- tplg_dv(tplg, pos, "enum: size %d private size %d", -- ec->size, ec->priv.size); -+ tplg_log(tplg, 'D', pos, "enum: size %d private size %d", -+ ec->size, ec->priv.size); - if (size != ec->size + ec->priv.size) { - SNDERR("enum: unexpected element size %d", size); - return -EINVAL; -@@ -1380,8 +1380,8 @@ int tplg_decode_control_enum1(snd_tplg_t *tplg, - cmt.num_channels = ec->num_channels; - for (i = 0; i < cmt.num_channels; i++) { - struct snd_tplg_channel_elem *channel = &cmt.channel[i]; -- tplg_dv(tplg, pos + ((void *)&ec->channel[i] - (void *)ec), -- "enum: channel size %d", ec->channel[i].size); -+ tplg_log(tplg, 'D', pos + ((void *)&ec->channel[i] - (void *)ec), -+ "enum: channel size %d", ec->channel[i].size); - channel->reg = ec->channel[i].reg; - channel->shift = ec->channel[i].shift; - channel->id = ec->channel[i].id; -@@ -1452,8 +1452,8 @@ int tplg_decode_control_bytes1(snd_tplg_t *tplg, - return -EINVAL; - } - -- tplg_dv(tplg, pos, "control bytes: size %d private size %d", -- bc->size, bc->priv.size); -+ tplg_log(tplg, 'D', pos, "control bytes: size %d private size %d", -+ bc->size, bc->priv.size); - if (size != bc->size + bc->priv.size) { - SNDERR("bytes: unexpected element size %d", size); - return -EINVAL; -@@ -1473,8 +1473,8 @@ int tplg_decode_control_bytes1(snd_tplg_t *tplg, - bt->ext_ops.get = bc->ext_ops.get; - bt->ext_ops.put = bc->ext_ops.put; - bt->ext_ops.info = bc->ext_ops.info; -- tplg_dv(tplg, pos, "control bytes: name '%s' access 0x%x", -- bt->hdr.name, bt->hdr.access); -+ tplg_log(tplg, 'D', pos, "control bytes: name '%s' access 0x%x", -+ bt->hdr.name, bt->hdr.access); - - bt->priv = &bc->priv; - return 0; -diff --git a/src/topology/dapm.c b/src/topology/dapm.c -index 9fab2d92..0bf64833 100644 ---- a/src/topology/dapm.c -+++ b/src/topology/dapm.c -@@ -895,8 +895,8 @@ next: - return -EINVAL; - } - -- tplg_dv(tplg, pos, "dapm widget: size %d private size %d kcontrols %d", -- w->size, w->priv.size, w->num_kcontrols); -+ tplg_log(tplg, 'D', pos, "dapm widget: size %d private size %d kcontrols %d", -+ w->size, w->priv.size, w->num_kcontrols); - - wt = tplg_calloc(&heap, sizeof(*wt) + sizeof(void *) * w->num_kcontrols); - if (wt == NULL) -@@ -913,7 +913,8 @@ next: - wt->event_flags = w->event_flags; - wt->event_type = w->event_type; - -- tplg_dv(tplg, pos, "dapm widget: name '%s' sname '%s'", wt->name, wt->sname); -+ tplg_log(tplg, 'D', pos, "dapm widget: name '%s' sname '%s'", -+ wt->name, wt->sname); - - if (sizeof(*w) + w->priv.size > size) { - SNDERR("dapm widget: wrong private data size %d", -@@ -921,8 +922,8 @@ next: - return -EINVAL; - } - -- tplg_dv(tplg, pos + offsetof(struct snd_soc_tplg_dapm_widget, priv), -- "dapm widget: private start"); -+ tplg_log(tplg, 'D', pos + offsetof(struct snd_soc_tplg_dapm_widget, priv), -+ "dapm widget: private start"); - - wt->priv = &w->priv; - bin += sizeof(*w) + w->priv.size; -@@ -942,7 +943,7 @@ next: - wt->num_ctls++; - mc = bin; - size2 = mc->size + mc->priv.size; -- tplg_dv(tplg, pos, "kcontrol mixer size %zd", size2); -+ tplg_log(tplg, 'D', pos, "kcontrol mixer size %zd", size2); - if (size2 > size) { - SNDERR("dapm widget: small mixer size %d", - size2); -@@ -962,7 +963,7 @@ next: - wt->num_ctls++; - ec = bin; - size2 = ec->size + ec->priv.size; -- tplg_dv(tplg, pos, "kcontrol enum size %zd", size2); -+ tplg_log(tplg, 'D', pos, "kcontrol enum size %zd", size2); - if (size2 > size) { - SNDERR("dapm widget: small enum size %d", - size2); -@@ -982,7 +983,7 @@ next: - wt->num_ctls++; - bc = bin; - size2 = bc->size + bc->priv.size; -- tplg_dv(tplg, pos, "kcontrol bytes size %zd", size2); -+ tplg_log(tplg, 'D', pos, "kcontrol bytes size %zd", size2); - if (size2 > size) { - SNDERR("dapm widget: small bytes size %d", - size2); -@@ -1049,7 +1050,7 @@ int tplg_decode_dapm_graph(snd_tplg_t *tplg, - ge->ctl = g->control; - ge->sink = g->sink; - gt->count++; -- tplg_dv(tplg, pos, "dapm graph: src='%s' ctl='%s' sink='%s'", -+ tplg_log(tplg, 'D', pos, "dapm graph: src='%s' ctl='%s' sink='%s'", - ge->src, ge->ctl, ge->sink); - bin += sizeof(*g); - size -= sizeof(*g); -diff --git a/src/topology/data.c b/src/topology/data.c -index 64563920..0b513428 100644 ---- a/src/topology/data.c -+++ b/src/topology/data.c -@@ -1604,7 +1604,7 @@ int tplg_decode_manifest_data(snd_tplg_t *tplg, - if (!elem) - return -ENOMEM; - -- tplg_dv(tplg, pos, "manifest: private size %d", size); -+ tplg_log(tplg, 'D', pos, "manifest: private size %d", size); - return tplg_add_data(tplg, elem, bin, size); - } - -@@ -1664,7 +1664,7 @@ static int tplg_verify_tuple_set(snd_tplg_t *tplg, size_t pos, - - va = bin; - if (size < sizeof(*va) || size < va->size) { -- tplg_dv(tplg, pos, "tuple set verify: wrong size %d", size); -+ tplg_log(tplg, 'A', pos, "tuple set verify: wrong size %d", size); - return -EINVAL; - } - -@@ -1677,20 +1677,20 @@ static int tplg_verify_tuple_set(snd_tplg_t *tplg, size_t pos, - case SND_SOC_TPLG_TUPLE_TYPE_SHORT: - break; - default: -- tplg_dv(tplg, pos, "tuple set verify: unknown array type %d", va->type); -+ tplg_log(tplg, 'A', pos, "tuple set verify: unknown array type %d", va->type); - return -EINVAL; - } - - j = tplg_get_tuple_size(va->type) * va->num_elems; - if (j + sizeof(*va) != va->size) { -- tplg_dv(tplg, pos, "tuple set verify: wrong vendor array size %d " -- "(expected %d for %d count %d)", -- va->size, j + sizeof(*va), va->type, va->num_elems); -+ tplg_log(tplg, 'A', pos, "tuple set verify: wrong vendor array size %d " -+ "(expected %d for %d count %d)", -+ va->size, j + sizeof(*va), va->type, va->num_elems); - return -EINVAL; - } - - if (va->num_elems > 4096) { -- tplg_dv(tplg, pos, "tuple set verify: tuples overflow %d", va->num_elems); -+ tplg_log(tplg, 'A', pos, "tuple set verify: tuples overflow %d", va->num_elems); - return -EINVAL; - } - -@@ -1748,8 +1748,8 @@ static int tplg_decode_tuple_set(snd_tplg_t *tplg, - set->type = va->type; - set->num_tuples = va->num_elems; - -- tplg_dv(tplg, pos, "tuple set: type %d (%s) tuples %d size %d", set->type, -- get_tuple_type_name(set->type), set->num_tuples, va->size); -+ tplg_log(tplg, 'A', pos, "tuple set: type %d (%s) tuples %d size %d", set->type, -+ get_tuple_type_name(set->type), set->num_tuples, va->size); - for (j = 0; j < set->num_tuples; j++) { - tuple = &set->tuple[j]; - switch (va->type) { -@@ -1798,14 +1798,14 @@ static int tplg_verify_tuples(snd_tplg_t *tplg, size_t pos, - int err; - - if (size < sizeof(*va)) { -- tplg_dv(tplg, pos, "tuples: small size %d", size); -+ tplg_log(tplg, 'A', pos, "tuples: small size %d", size); - return -EINVAL; - } - - next: - va = bin; - if (size < sizeof(*va)) { -- tplg_dv(tplg, pos, "tuples: unexpected vendor arry size %d", size); -+ tplg_log(tplg, 'A', pos, "tuples: unexpected vendor arry size %d", size); - return -EINVAL; - } - -@@ -1903,7 +1903,7 @@ next: - return err; - tuples = NULL; - } -- tplg_dv(tplg, pos, "add bytes: size %d", tp->size); -+ tplg_log(tplg, 'A', pos, "add bytes: size %d", tp->size); - snprintf(suffix, sizeof(suffix), "data%u", block++); - err = tplg_add_data_bytes(tplg, parent, suffix, tp->array, tp->size); - } else { -@@ -1929,7 +1929,7 @@ next: - return -ENOMEM; - } - } -- tplg_dv(tplg, pos, "decode tuples: size %d", tp->size); -+ tplg_log(tplg, 'A', pos, "decode tuples: size %d", tp->size); - err = tplg_decode_tuples(tplg, pos, parent, tuples, tp->array, tp->size); - num_tuples++; - } -diff --git a/src/topology/decoder.c b/src/topology/decoder.c -index 2d6a8969..66ebe5d8 100644 ---- a/src/topology/decoder.c -+++ b/src/topology/decoder.c -@@ -18,21 +18,6 @@ - #include "list.h" - #include "tplg_local.h" - --/* verbose output detailing each object size and file position */ --void tplg_dv(snd_tplg_t *tplg, size_t pos, const char *fmt, ...) --{ -- va_list va; -- -- if (!tplg->verbose) -- return; -- -- va_start(va, fmt); -- fprintf(stdout, "D0x%6.6zx/%6.6zd - ", pos, pos); -- vfprintf(stdout, fmt, va); -- va_end(va); -- putc('\n', stdout); --} -- - int tplg_decode_template(snd_tplg_t *tplg, - size_t pos, - struct snd_soc_tplg_hdr *hdr, -@@ -41,7 +26,8 @@ int tplg_decode_template(snd_tplg_t *tplg, - int type; - - type = tplg_get_type(hdr->type); -- tplg_dv(tplg, pos, "template: asoc type %d library type %d", hdr->type, type); -+ tplg_log(tplg, 'D', pos, "template: asoc type %d library type %d", -+ hdr->type, type); - if (type < 0) - return type; - -@@ -50,8 +36,8 @@ int tplg_decode_template(snd_tplg_t *tplg, - t->index = hdr->index; - t->version = hdr->version; - t->vendor_type = hdr->vendor_type; -- tplg_dv(tplg, pos, "template: index %d version %d vendor_type %d", -- hdr->index, hdr->version, hdr->vendor_type); -+ tplg_log(tplg, 'D', pos, "template: index %d version %d vendor_type %d", -+ hdr->index, hdr->version, hdr->vendor_type); - return 0; - } - -@@ -71,11 +57,11 @@ int snd_tplg_decode(snd_tplg_t *tplg, void *bin, size_t size, int dflags) - while (1) { - pos = b - bin; - if (size == pos) { -- tplg_dv(tplg, pos, "block: success (total %zd)", size); -+ tplg_log(tplg, 'D', pos, "block: success (total %zd)", size); - return 0; - } - if (size - pos < sizeof(*hdr)) { -- tplg_dv(tplg, pos, "block: small size"); -+ tplg_log(tplg, 'D', pos, "block: small size"); - SNDERR("incomplete header data to decode"); - return -EINVAL; - } -@@ -85,8 +71,8 @@ int snd_tplg_decode(snd_tplg_t *tplg, void *bin, size_t size, int dflags) - return -EINVAL; - } - -- tplg_dv(tplg, pos, "block: abi %d size %d payload size %d", -- hdr->abi, hdr->size, hdr->payload_size); -+ tplg_log(tplg, 'D', pos, "block: abi %d size %d payload size %d", -+ hdr->abi, hdr->size, hdr->payload_size); - if (hdr->abi != SND_SOC_TPLG_ABI_VERSION) { - SNDERR("unsupported ABI version %d", hdr->abi); - return -EINVAL; -@@ -127,7 +113,7 @@ int snd_tplg_decode(snd_tplg_t *tplg, void *bin, size_t size, int dflags) - SNDERR("unknown block type %d", hdr->type); - return -EINVAL; - } -- tplg_dv(tplg, pos, "block: type %d - %s", hdr->type, tptr->name); -+ tplg_log(tplg, 'D', pos, "block: type %d - %s", hdr->type, tptr->name); - err = tptr->decod(tplg, pos, hdr, b + hdr->size, hdr->payload_size); - if (err < 0) - return err; -diff --git a/src/topology/log.c b/src/topology/log.c -new file mode 100644 -index 00000000..1ca36528 ---- /dev/null -+++ b/src/topology/log.c -@@ -0,0 +1,34 @@ -+/* -+ Copyright (c) 2019 Red Hat Inc. -+ All rights reserved. -+ -+ This library is free software; you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of -+ the License, or (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU Lesser General Public License for more details. -+ -+ Authors: Jaroslav Kysela -+*/ -+ -+#include "list.h" -+#include "tplg_local.h" -+ -+/* verbose output detailing each object size and file position */ -+void tplg_log_(snd_tplg_t *tplg, char type, size_t pos, const char *fmt, ...) -+{ -+ va_list va; -+ -+ if (!tplg->verbose) -+ return; -+ -+ va_start(va, fmt); -+ fprintf(stdout, "%c0x%6.6zx/%6.6zd - ", type, pos, pos); -+ vfprintf(stdout, fmt, va); -+ va_end(va); -+ putc('\n', stdout); -+} -diff --git a/src/topology/pcm.c b/src/topology/pcm.c -index 4e04a6bc..918e3e9a 100644 ---- a/src/topology/pcm.c -+++ b/src/topology/pcm.c -@@ -1969,21 +1969,21 @@ next: - return -EINVAL; - } - -- tplg_dv(tplg, pos, "pcm: size %d private size %d streams %d", -- pcm->size, pcm->priv.size, pcm->num_streams); -+ tplg_log(tplg, 'D', pos, "pcm: size %d private size %d streams %d", -+ pcm->size, pcm->priv.size, pcm->num_streams); - - pt->pcm_name = pcm->pcm_name; -- tplg_dv(tplg, pos, "pcm: pcm_name '%s'", pt->pcm_name); -+ tplg_log(tplg, 'D', pos, "pcm: pcm_name '%s'", pt->pcm_name); - pt->dai_name = pcm->dai_name; -- tplg_dv(tplg, pos, "pcm: dai_name '%s'", pt->dai_name); -+ tplg_log(tplg, 'D', pos, "pcm: dai_name '%s'", pt->dai_name); - pt->pcm_id = pcm->pcm_id; - pt->dai_id = pcm->dai_id; -- tplg_dv(tplg, pos, "pcm: pcm_id %d dai_id %d", pt->pcm_id, pt->dai_id); -+ tplg_log(tplg, 'D', pos, "pcm: pcm_id %d dai_id %d", pt->pcm_id, pt->dai_id); - pt->playback = pcm->playback; - pt->capture = pcm->capture; - pt->compress = pcm->compress; -- tplg_dv(tplg, pos, "pcm: playback %d capture %d compress", -- pt->playback, pt->capture, pt->compress); -+ tplg_log(tplg, 'D', pos, "pcm: playback %d capture %d compress", -+ pt->playback, pt->capture, pt->compress); - pt->num_streams = pcm->num_streams; - pt->flag_mask = pcm->flag_mask; - pt->flags = pcm->flags; -@@ -1995,8 +1995,8 @@ next: - return -EINVAL; - } - stream->name = pcm->stream[i].name; -- tplg_dv(tplg, pos + offsetof(struct snd_soc_tplg_pcm, stream[i]), -- "stream %d: '%s'", i, stream->name); -+ tplg_log(tplg, 'D', pos + offsetof(struct snd_soc_tplg_pcm, stream[i]), -+ "stream %d: '%s'", i, stream->name); - stream->format = pcm->stream[i].format; - stream->rate = pcm->stream[i].rate; - stream->period_bytes = pcm->stream[i].period_bytes; -@@ -2016,8 +2016,8 @@ next: - return -EINVAL; - } - cap->name = pcm->caps[i].name; -- tplg_dv(tplg, pos + offsetof(struct snd_soc_tplg_pcm, caps[i]), -- "caps %d: '%s'", i, cap->name); -+ tplg_log(tplg, 'D', pos + offsetof(struct snd_soc_tplg_pcm, caps[i]), -+ "caps %d: '%s'", i, cap->name); - cap->formats = pcm->caps[i].formats; - cap->rates = pcm->caps[i].rates; - cap->rate_min = pcm->caps[i].rate_min; -@@ -2033,8 +2033,8 @@ next: - cap->sig_bits = pcm->caps[i].sig_bits; - } - -- tplg_dv(tplg, pos + offsetof(struct snd_soc_tplg_pcm, priv), -- "pcm: private start"); -+ tplg_log(tplg, 'D', pos + offsetof(struct snd_soc_tplg_pcm, priv), -+ "pcm: private start"); - pt->priv = &pcm->priv; - - bin += sizeof(*pcm) + pcm->priv.size; -@@ -2120,16 +2120,16 @@ next: - return -EINVAL; - } - -- tplg_dv(tplg, pos, "link: size %d private size %d streams %d " -- "hw_configs %d", -- link->size, link->priv.size, link->num_streams, -- link->num_hw_configs); -+ tplg_log(tplg, 'D', pos, "link: size %d private size %d streams %d " -+ "hw_configs %d", -+ link->size, link->priv.size, link->num_streams, -+ link->num_hw_configs); - - lt.id = link->id; - lt.name = link->name; -- tplg_dv(tplg, pos, "link: name '%s'", lt.name); -+ tplg_log(tplg, 'D', pos, "link: name '%s'", lt.name); - lt.stream_name = link->stream_name; -- tplg_dv(tplg, pos, "link: stream_name '%s'", lt.stream_name); -+ tplg_log(tplg, 'D', pos, "link: stream_name '%s'", lt.stream_name); - lt.num_streams = link->num_streams; - lt.num_hw_configs = link->num_hw_configs; - lt.default_hw_config_id = link->default_hw_config_id; -@@ -2143,9 +2143,9 @@ next: - return -EINVAL; - } - stream->name = link->stream[i].name; -- tplg_dv(tplg, -- pos + offsetof(struct snd_soc_tplg_link_config, stream[i]), -- "stream %d: '%s'", i, stream->name); -+ tplg_log(tplg, 'D', -+ pos + offsetof(struct snd_soc_tplg_link_config, stream[i]), -+ "stream %d: '%s'", i, stream->name); - stream->format = link->stream[i].format; - stream->rate = link->stream[i].rate; - stream->period_bytes = link->stream[i].period_bytes; -@@ -2192,8 +2192,8 @@ next: - } - lt.hw_config = hws; - -- tplg_dv(tplg, pos + offsetof(struct snd_soc_tplg_pcm, priv), -- "link: private start"); -+ tplg_log(tplg, 'D', pos + offsetof(struct snd_soc_tplg_pcm, priv), -+ "link: private start"); - lt.priv = &link->priv; - - bin += sizeof(*link) + link->priv.size; -diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h -index 22fc5fba..e061db75 100644 ---- a/src/topology/tplg_local.h -+++ b/src/topology/tplg_local.h -@@ -226,6 +226,13 @@ struct tplg_table { - extern struct tplg_table tplg_table[]; - extern unsigned int tplg_table_items; - -+#define tplg_log(tplg, type, pos, fmt, args...) do { \ -+ if ((tplg)->verbose) \ -+ tplg_log_((tplg), (type), (pos), (fmt), ##args); \ -+} while (0) -+ -+void tplg_log_(snd_tplg_t *tplg, char type, size_t pos, const char *fmt, ...); -+ - void *tplg_calloc(struct list_head *heap, size_t size); - void tplg_free(struct list_head *heap); - -@@ -373,7 +380,6 @@ int tplg_save_stream_caps(snd_tplg_t *tplg, struct tplg_elem *elem, - int tplg_save_dai(snd_tplg_t *tplg, struct tplg_elem *elem, - char **dst, const char *pfx); - --void tplg_dv(snd_tplg_t *tplg, size_t pos, const char *fmt, ...); - int tplg_decode_template(snd_tplg_t *tplg, - size_t pos, - struct snd_soc_tplg_hdr *hdr, --- -2.24.1 - - -From d768da27e7f9f56328c61ed5d37c17ce075cbc6e Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 3 Jan 2020 22:44:15 +0100 -Subject: [PATCH 56/69] topology: tplg_dbg() cleanups - -- remove newline at the end - -Signed-off-by: Jaroslav Kysela ---- - src/topology/channel.c | 6 +++--- - src/topology/ctl.c | 40 +++++++++++++++++------------------ - src/topology/dapm.c | 32 ++++++++++++++-------------- - src/topology/data.c | 48 ++++++++++++++++++++++++------------------ - src/topology/ops.c | 8 +++---- - src/topology/pcm.c | 36 +++++++++++++++---------------- - src/topology/text.c | 6 +++--- - 7 files changed, 91 insertions(+), 85 deletions(-) - -diff --git a/src/topology/channel.c b/src/topology/channel.c -index 390c3f16..47d5ea4c 100644 ---- a/src/topology/channel.c -+++ b/src/topology/channel.c -@@ -100,7 +100,7 @@ int tplg_parse_channel(snd_tplg_t *tplg, snd_config_t *cfg, - - channel += tplg->channel_idx; - snd_config_get_id(cfg, &id); -- tplg_dbg("\tChannel %s at index %d\n", id, tplg->channel_idx); -+ tplg_dbg("\tChannel %s at index %d", id, tplg->channel_idx); - - channel_id = lookup_channel(id); - if (channel_id < 0) { -@@ -110,7 +110,7 @@ int tplg_parse_channel(snd_tplg_t *tplg, snd_config_t *cfg, - - channel->id = channel_id; - channel->size = sizeof(*channel); -- tplg_dbg("\tChan %s = %d\n", id, channel->id); -+ tplg_dbg("\tChan %s = %d", id, channel->id); - - snd_config_for_each(i, next, cfg) { - -@@ -129,7 +129,7 @@ int tplg_parse_channel(snd_tplg_t *tplg, snd_config_t *cfg, - else if (strcmp(id, "shift") == 0) - channel->shift = value; - -- tplg_dbg("\t\t%s = %d\n", id, value); -+ tplg_dbg("\t\t%s = %d", id, value); - } - - tplg->channel_idx++; -diff --git a/src/topology/ctl.c b/src/topology/ctl.c -index a5a81148..41dc2ddb 100644 ---- a/src/topology/ctl.c -+++ b/src/topology/ctl.c -@@ -54,7 +54,7 @@ static int parse_access_values(snd_config_t *cfg, - const char *value = NULL; - unsigned int j; - -- tplg_dbg(" Access:\n"); -+ tplg_dbg(" Access:"); - - snd_config_for_each(i, next, cfg) { - n = snd_config_iterator_entry(i); -@@ -67,7 +67,7 @@ static int parse_access_values(snd_config_t *cfg, - for (j = 0; j < ARRAY_SIZE(ctl_access); j++) { - if (strcmp(value, ctl_access[j].name) == 0) { - hdr->access |= ctl_access[j].value; -- tplg_dbg("\t%s\n", value); -+ tplg_dbg("\t%s", value); - break; - } - } -@@ -150,7 +150,7 @@ static int copy_tlv(struct tplg_elem *elem, struct tplg_elem *ref) - struct snd_soc_tplg_mixer_control *mixer_ctrl = elem->mixer_ctrl; - struct snd_soc_tplg_ctl_tlv *tlv = ref->tlv; - -- tplg_dbg("TLV '%s' used by '%s\n", ref->id, elem->id); -+ tplg_dbg("TLV '%s' used by '%s", ref->id, elem->id); - - /* TLV has a fixed size */ - mixer_ctrl->hdr.tlv = *tlv; -@@ -330,7 +330,7 @@ static int tplg_parse_tlv_dbscale(snd_config_t *cfg, struct tplg_elem *elem) - const char *id = NULL; - int val; - -- tplg_dbg(" scale: %s\n", elem->id); -+ tplg_dbg(" scale: %s", elem->id); - - tplg_tlv->size = sizeof(struct snd_soc_tplg_ctl_tlv); - tplg_tlv->type = SNDRV_CTL_TLVT_DB_SCALE; -@@ -348,7 +348,7 @@ static int tplg_parse_tlv_dbscale(snd_config_t *cfg, struct tplg_elem *elem) - if (tplg_get_integer(n, &val, 0)) - continue; - -- tplg_dbg("\t%s = %i\n", id, val); -+ tplg_dbg("\t%s = %i", id, val); - - /* get TLV data */ - if (strcmp(id, "min") == 0) -@@ -450,7 +450,7 @@ int tplg_parse_control_bytes(snd_tplg_t *tplg, - snd_strlcpy(be->hdr.name, elem->id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN); - be->hdr.type = SND_SOC_TPLG_TYPE_BYTES; - -- tplg_dbg(" Control Bytes: %s\n", elem->id); -+ tplg_dbg(" Control Bytes: %s", elem->id); - - snd_config_for_each(i, next, cfg) { - n = snd_config_iterator_entry(i); -@@ -468,7 +468,7 @@ int tplg_parse_control_bytes(snd_tplg_t *tplg, - return -EINVAL; - - be->base = ival; -- tplg_dbg("\t%s: %d\n", id, be->base); -+ tplg_dbg("\t%s: %d", id, be->base); - continue; - } - -@@ -477,7 +477,7 @@ int tplg_parse_control_bytes(snd_tplg_t *tplg, - return -EINVAL; - - be->num_regs = ival; -- tplg_dbg("\t%s: %d\n", id, be->num_regs); -+ tplg_dbg("\t%s: %d", id, be->num_regs); - continue; - } - -@@ -486,7 +486,7 @@ int tplg_parse_control_bytes(snd_tplg_t *tplg, - return -EINVAL; - - be->max = ival; -- tplg_dbg("\t%s: %d\n", id, be->max); -+ tplg_dbg("\t%s: %d", id, be->max); - continue; - } - -@@ -495,7 +495,7 @@ int tplg_parse_control_bytes(snd_tplg_t *tplg, - return -EINVAL; - - be->mask = ival; -- tplg_dbg("\t%s: %d\n", id, be->mask); -+ tplg_dbg("\t%s: %d", id, be->mask); - continue; - } - -@@ -515,7 +515,7 @@ int tplg_parse_control_bytes(snd_tplg_t *tplg, - return err; - - tlv_set = true; -- tplg_dbg("\t%s: %s\n", id, val); -+ tplg_dbg("\t%s: %s", id, val); - continue; - } - -@@ -625,7 +625,7 @@ int tplg_parse_control_enum(snd_tplg_t *tplg, snd_config_t *cfg, - ec->channel[j].reg = -1; - } - -- tplg_dbg(" Control Enum: %s\n", elem->id); -+ tplg_dbg(" Control Enum: %s", elem->id); - - snd_config_for_each(i, next, cfg) { - -@@ -644,7 +644,7 @@ int tplg_parse_control_enum(snd_tplg_t *tplg, snd_config_t *cfg, - return -EINVAL; - - tplg_ref_add(elem, SND_TPLG_TYPE_TEXT, val); -- tplg_dbg("\t%s: %s\n", id, val); -+ tplg_dbg("\t%s: %s", id, val); - continue; - } - -@@ -761,7 +761,7 @@ int tplg_parse_control_mixer(snd_tplg_t *tplg, - for (j = 0; j < SND_SOC_TPLG_MAX_CHAN; j++) - mc->channel[j].reg = -1; - -- tplg_dbg(" Control Mixer: %s\n", elem->id); -+ tplg_dbg(" Control Mixer: %s", elem->id); - - /* giterate trough each mixer elment */ - snd_config_for_each(i, next, cfg) { -@@ -795,7 +795,7 @@ int tplg_parse_control_mixer(snd_tplg_t *tplg, - return -EINVAL; - - mc->max = ival; -- tplg_dbg("\t%s: %d\n", id, mc->max); -+ tplg_dbg("\t%s: %d", id, mc->max); - continue; - } - -@@ -805,7 +805,7 @@ int tplg_parse_control_mixer(snd_tplg_t *tplg, - return -EINVAL; - mc->invert = ival; - -- tplg_dbg("\t%s: %d\n", id, mc->invert); -+ tplg_dbg("\t%s: %d", id, mc->invert); - continue; - } - -@@ -826,7 +826,7 @@ int tplg_parse_control_mixer(snd_tplg_t *tplg, - return err; - - tlv_set = true; -- tplg_dbg("\t%s: %s\n", id, val); -+ tplg_dbg("\t%s: %s", id, val); - continue; - } - -@@ -981,7 +981,7 @@ int tplg_add_mixer(snd_tplg_t *tplg, struct snd_tplg_mixer_template *mixer, - struct tplg_elem *elem; - int ret, i, num_channels; - -- tplg_dbg(" Control Mixer: %s\n", mixer->hdr.name); -+ tplg_dbg(" Control Mixer: %s", mixer->hdr.name); - - if (mixer->hdr.type != SND_SOC_TPLG_TYPE_MIXER) { - SNDERR("invalid mixer type %d", mixer->hdr.type); -@@ -1045,7 +1045,7 @@ int tplg_add_enum(snd_tplg_t *tplg, struct snd_tplg_enum_template *enum_ctl, - struct tplg_elem *elem; - int ret, i, num_items, num_channels; - -- tplg_dbg(" Control Enum: %s\n", enum_ctl->hdr.name); -+ tplg_dbg(" Control Enum: %s", enum_ctl->hdr.name); - - if (enum_ctl->hdr.type != SND_SOC_TPLG_TYPE_ENUM) { - SNDERR("invalid enum type %d", enum_ctl->hdr.type); -@@ -1128,7 +1128,7 @@ int tplg_add_bytes(snd_tplg_t *tplg, struct snd_tplg_bytes_template *bytes_ctl, - struct tplg_elem *elem; - int ret; - -- tplg_dbg(" Control Bytes: %s\n", bytes_ctl->hdr.name); -+ tplg_dbg(" Control Bytes: %s", bytes_ctl->hdr.name); - - if (bytes_ctl->hdr.type != SND_SOC_TPLG_TYPE_BYTES) { - SNDERR("invalid bytes type %d", bytes_ctl->hdr.type); -diff --git a/src/topology/dapm.c b/src/topology/dapm.c -index 0bf64833..cb85e667 100644 ---- a/src/topology/dapm.c -+++ b/src/topology/dapm.c -@@ -76,8 +76,8 @@ static int copy_dapm_control(struct tplg_elem *elem, struct tplg_elem *ref) - { - struct snd_soc_tplg_dapm_widget *widget = elem->widget; - -- tplg_dbg("Control '%s' used by '%s'\n", ref->id, elem->id); -- tplg_dbg("\tparent size: %d + %d -> %d, priv size -> %d\n", -+ tplg_dbg("Control '%s' used by '%s'", ref->id, elem->id); -+ tplg_dbg("\tparent size: %d + %d -> %d, priv size -> %d", - elem->size, ref->size, elem->size + ref->size, - widget->priv.size); - -@@ -210,8 +210,8 @@ int tplg_build_routes(snd_tplg_t *tplg) - } - - route = elem->route; -- tplg_dbg("\nCheck route: sink '%s', control '%s', source '%s'\n", -- route->sink, route->control, route->source); -+ tplg_dbg("Check route: sink '%s', control '%s', source '%s'", -+ route->sink, route->control, route->source); - - /* validate sink */ - if (strlen(route->sink) <= 0) { -@@ -357,7 +357,7 @@ static int tplg_parse_routes(snd_tplg_t *tplg, snd_config_t *cfg, int index) - if (err < 0) - return err; - -- tplg_dbg("route: sink '%s', control '%s', source '%s'\n", -+ tplg_dbg("route: sink '%s', control '%s', source '%s'", - line->sink, line->control, line->source); - } - -@@ -520,7 +520,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, - if (!elem) - return -ENOMEM; - -- tplg_dbg(" Widget: %s\n", elem->id); -+ tplg_dbg(" Widget: %s", elem->id); - - widget = elem->widget; - snd_strlcpy(widget->name, elem->id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN); -@@ -550,7 +550,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, - } - - widget->id = widget_type; -- tplg_dbg("\t%s: %s\n", id, val); -+ tplg_dbg("\t%s: %s", id, val); - continue; - } - -@@ -560,7 +560,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, - - snd_strlcpy(widget->sname, val, - SNDRV_CTL_ELEM_ID_NAME_MAXLEN); -- tplg_dbg("\t%s: %s\n", id, val); -+ tplg_dbg("\t%s: %s", id, val); - continue; - } - -@@ -571,7 +571,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, - - widget->reg = ival ? -1 : 0; - -- tplg_dbg("\t%s: %s\n", id, val); -+ tplg_dbg("\t%s: %s", id, val); - continue; - } - -@@ -580,7 +580,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, - return -EINVAL; - - widget->shift = ival; -- tplg_dbg("\t%s: %d\n", id, widget->shift); -+ tplg_dbg("\t%s: %d", id, widget->shift); - continue; - } - -@@ -589,7 +589,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, - return -EINVAL; - - widget->reg = ival; -- tplg_dbg("\t%s: %d\n", id, widget->reg); -+ tplg_dbg("\t%s: %d", id, widget->reg); - continue; - } - -@@ -598,7 +598,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, - return -EINVAL; - - widget->invert = ival; -- tplg_dbg("\t%s: %d\n", id, widget->invert); -+ tplg_dbg("\t%s: %d", id, widget->invert); - continue; - } - -@@ -607,7 +607,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, - return -EINVAL; - - widget->subseq = ival; -- tplg_dbg("\t%s: %d\n", id, widget->subseq); -+ tplg_dbg("\t%s: %d", id, widget->subseq); - continue; - } - -@@ -616,7 +616,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, - return -EINVAL; - - widget->event_type = ival; -- tplg_dbg("\t%s: %d\n", id, widget->event_type); -+ tplg_dbg("\t%s: %d", id, widget->event_type); - continue; - } - -@@ -625,7 +625,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, - return -EINVAL; - - widget->event_flags = ival; -- tplg_dbg("\t%s: %d\n", id, widget->event_flags); -+ tplg_dbg("\t%s: %d", id, widget->event_flags); - continue; - } - -@@ -767,7 +767,7 @@ int tplg_add_widget_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) - struct tplg_elem *elem; - int i, ret = 0; - -- tplg_dbg("Widget: %s\n", wt->name); -+ tplg_dbg("Widget: %s", wt->name); - - elem = tplg_elem_new_common(tplg, NULL, wt->name, - SND_TPLG_TYPE_DAPM_WIDGET); -diff --git a/src/topology/data.c b/src/topology/data.c -index 0b513428..37c45919 100644 ---- a/src/topology/data.c -+++ b/src/topology/data.c -@@ -87,7 +87,7 @@ int tplg_parse_refs(snd_config_t *cfg, struct tplg_elem *elem, - if (snd_config_get_string(cfg, &val) < 0) - return -EINVAL; - -- tplg_dbg("\tref data: %s\n", val); -+ tplg_dbg("\tref data: %s", val); - err = tplg_ref_add(elem, type, val); - if (err < 0) - return err; -@@ -108,7 +108,7 @@ int tplg_parse_refs(snd_config_t *cfg, struct tplg_elem *elem, - if (snd_config_get_string(n, &val) < 0) - continue; - -- tplg_dbg("\tref data: %s\n", val); -+ tplg_dbg("\tref data: %s", val); - err = tplg_ref_add(elem, type, val); - if (err < 0) - return err; -@@ -169,7 +169,7 @@ static int tplg_parse_data_file(snd_config_t *cfg, struct tplg_elem *elem) - size_t size, bytes_read; - int ret = 0; - -- tplg_dbg("data DataFile: %s\n", elem->id); -+ tplg_dbg("data DataFile: %s", elem->id); - - if (snd_config_get_string(cfg, &value) < 0) - return -EINVAL; -@@ -235,19 +235,25 @@ static void dump_priv_data(struct tplg_elem *elem ATTRIBUTE_UNUSED) - #ifdef TPLG_DEBUG - struct snd_soc_tplg_private *priv = elem->data; - unsigned char *p = (unsigned char *)priv->data; -+ char buf[128], buf2[8]; - unsigned int i; - -- tplg_dbg(" elem size = %d, priv data size = %d\n", -+ tplg_dbg(" elem size = %d, priv data size = %d", - elem->size, priv->size); - -+ buf[0] = '\0'; - for (i = 0; i < priv->size; i++) { -- if (i > 0 && (i % 16) == 0) -- tplg_dbg("\n"); -+ if (i > 0 && (i % 16) == 0) { -+ tplg_dbg("%s", buf); -+ buf[0] = '\0'; -+ } - -- tplg_dbg(" %02x:", *p++); -+ snprintf(buf2, sizeof(buf2), " %02x", *p++); -+ strcat(buf, buf2); - } - -- tplg_dbg("\n\n"); -+ if (buf[0]) -+ tplg_dbg("%s", buf); - #endif - } - -@@ -466,7 +472,7 @@ static int tplg_parse_data_hex(snd_config_t *cfg, struct tplg_elem *elem, - int size, esize, off, num; - int ret; - -- tplg_dbg(" data: %s\n", elem->id); -+ tplg_dbg(" data: %s", elem->id); - - if (snd_config_get_string(cfg, &value) < 0) - return -EINVAL; -@@ -683,7 +689,7 @@ static int build_tuples(snd_tplg_t *tplg, struct tplg_elem *elem) - if (ref->type != SND_TPLG_TYPE_TUPLE) - continue; - -- tplg_dbg("tuples '%s' used by data '%s'\n", ref->id, elem->id); -+ tplg_dbg("tuples '%s' used by data '%s'", ref->id, elem->id); - - if (!ref->elem) - ref->elem = tplg_elem_lookup(&tplg->tuple_list, -@@ -799,7 +805,7 @@ static int parse_tuple_set(snd_config_t *cfg, - if (!num_tuples) - return 0; - -- tplg_dbg("\t %d %s tuples:\n", num_tuples, id); -+ tplg_dbg("\t %d %s tuples:", num_tuples, id); - set = calloc(1, sizeof(*set) + num_tuples * sizeof(struct tplg_tuple)); - if (!set) - return -ENOMEM; -@@ -831,7 +837,7 @@ static int parse_tuple_set(snd_config_t *cfg, - continue; - snd_strlcpy(tuple->string, value, - SNDRV_CTL_ELEM_ID_NAME_MAXLEN); -- tplg_dbg("\t\t%s = %s\n", tuple->token, tuple->string); -+ tplg_dbg("\t\t%s = %s", tuple->token, tuple->string); - break; - - case SND_SOC_TPLG_TUPLE_TYPE_BOOL: -@@ -839,7 +845,7 @@ static int parse_tuple_set(snd_config_t *cfg, - if (ival < 0) - continue; - tuple->value = ival; -- tplg_dbg("\t\t%s = %d\n", tuple->token, tuple->value); -+ tplg_dbg("\t\t%s = %d", tuple->token, tuple->value); - break; - - case SND_SOC_TPLG_TUPLE_TYPE_BYTE: -@@ -862,7 +868,7 @@ static int parse_tuple_set(snd_config_t *cfg, - } - - tuple->value = tuple_val; -- tplg_dbg("\t\t%s = 0x%x\n", tuple->token, tuple->value); -+ tplg_dbg("\t\t%s = 0x%x", tuple->token, tuple->value); - break; - - default: -@@ -1047,7 +1053,7 @@ int tplg_parse_tokens(snd_tplg_t *tplg, snd_config_t *cfg, - if (!num_tokens) - return 0; - -- tplg_dbg(" Vendor tokens: %s, %d tokens\n", elem->id, num_tokens); -+ tplg_dbg(" Vendor tokens: %s, %d tokens", elem->id, num_tokens); - - tokens = calloc(1, sizeof(*tokens) - + num_tokens * sizeof(struct tplg_token)); -@@ -1067,7 +1073,7 @@ int tplg_parse_tokens(snd_tplg_t *tplg, snd_config_t *cfg, - snd_strlcpy(tokens->token[tokens->num_tokens].id, id, - SNDRV_CTL_ELEM_ID_NAME_MAXLEN); - tokens->token[tokens->num_tokens].value = value; -- tplg_dbg("\t\t %s : %d\n", tokens->token[tokens->num_tokens].id, -+ tplg_dbg("\t\t %s : %d", tokens->token[tokens->num_tokens].id, - tokens->token[tokens->num_tokens].value); - tokens->num_tokens++; - } -@@ -1116,7 +1122,7 @@ int tplg_parse_tuples(snd_tplg_t *tplg, snd_config_t *cfg, - if (!elem) - return -ENOMEM; - -- tplg_dbg(" Vendor Tuples: %s\n", elem->id); -+ tplg_dbg(" Vendor Tuples: %s", elem->id); - - tuples = calloc(1, sizeof(*tuples)); - if (!tuples) -@@ -1133,7 +1139,7 @@ int tplg_parse_tuples(snd_tplg_t *tplg, snd_config_t *cfg, - if (snd_config_get_string(n, &value) < 0) - return -EINVAL; - tplg_ref_add(elem, SND_TPLG_TYPE_TOKEN, value); -- tplg_dbg("\t refer to vendor tokens: %s\n", value); -+ tplg_dbg("\t refer to vendor tokens: %s", value); - } - - if (strcmp(id, "tuples") == 0) { -@@ -1208,7 +1214,7 @@ int tplg_parse_manifest_data(snd_tplg_t *tplg, snd_config_t *cfg, - manifest = elem->manifest; - manifest->size = elem->size; - -- tplg_dbg(" Manifest: %s\n", elem->id); -+ tplg_dbg(" Manifest: %s", elem->id); - - snd_config_for_each(i, next, cfg) { - n = snd_config_iterator_entry(i); -@@ -1402,7 +1408,7 @@ int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg, - return -EINVAL; - - elem->vendor_type = ival; -- tplg_dbg("\t%s: %d\n", id, elem->index); -+ tplg_dbg("\t%s: %d", id, elem->index); - continue; - } - } -@@ -1506,7 +1512,7 @@ int tplg_copy_data(snd_tplg_t *tplg, struct tplg_elem *elem, - return -EINVAL; - } - -- tplg_dbg("Data '%s' used by '%s'\n", ref->id, elem->id); -+ tplg_dbg("Data '%s' used by '%s'", ref->id, elem->id); - /* overlook empty private data */ - if (!ref_elem->data || !ref_elem->data->size) { - ref->elem = ref_elem; -diff --git a/src/topology/ops.c b/src/topology/ops.c -index 2885c781..110eef58 100644 ---- a/src/topology/ops.c -+++ b/src/topology/ops.c -@@ -69,7 +69,7 @@ int tplg_parse_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, snd_config_t *cfg, - const char *id, *value; - int ival; - -- tplg_dbg("\tOps\n"); -+ tplg_dbg("\tOps"); - hdr->size = sizeof(*hdr); - - snd_config_for_each(i, next, cfg) { -@@ -97,7 +97,7 @@ int tplg_parse_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, snd_config_t *cfg, - else if (strcmp(id, "get") == 0) - hdr->ops.get = ival; - -- tplg_dbg("\t\t%s = %d\n", id, ival); -+ tplg_dbg("\t\t%s = %d", id, ival); - } - - return 0; -@@ -155,7 +155,7 @@ int tplg_parse_ext_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, - const char *id, *value; - int ival; - -- tplg_dbg("\tExt Ops\n"); -+ tplg_dbg("\tExt Ops"); - - snd_config_for_each(i, next, cfg) { - -@@ -182,7 +182,7 @@ int tplg_parse_ext_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, - else if (strcmp(id, "get") == 0) - be->ext_ops.get = ival; - -- tplg_dbg("\t\t%s = %s\n", id, value); -+ tplg_dbg("\t\t%s = %s", id, value); - } - - return 0; -diff --git a/src/topology/pcm.c b/src/topology/pcm.c -index 918e3e9a..da88783f 100644 ---- a/src/topology/pcm.c -+++ b/src/topology/pcm.c -@@ -68,7 +68,7 @@ static void copy_stream_caps(const char *id ATTRIBUTE_UNUSED, - { - struct snd_soc_tplg_stream_caps *ref_caps = ref_elem->stream_caps; - -- tplg_dbg("Copy pcm caps (%ld bytes) from '%s' to '%s' \n", -+ tplg_dbg("Copy pcm caps (%ld bytes) from '%s' to '%s'", - sizeof(*caps), ref_elem->id, id); - - *caps = *ref_caps; -@@ -388,7 +388,7 @@ static int parse_unsigned(snd_config_t *n, unsigned int *dst) - { - const char *id; - if (snd_config_get_id(n, &id) >= 0) -- tplg_dbg("\t\t%s: %d\n", id, *dst); -+ tplg_dbg("\t\t%s: %d", id, *dst); - } - #endif - return 0; -@@ -415,7 +415,7 @@ int tplg_parse_stream_caps(snd_tplg_t *tplg, - sc->size = elem->size; - snd_strlcpy(sc->name, elem->id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN); - -- tplg_dbg(" PCM Capabilities: %s\n", elem->id); -+ tplg_dbg(" PCM Capabilities: %s", elem->id); - - snd_config_for_each(i, next, cfg) { - n = snd_config_iterator_entry(i); -@@ -442,7 +442,7 @@ int tplg_parse_stream_caps(snd_tplg_t *tplg, - if (err < 0) - return err; - -- tplg_dbg("\t\t%s: %s\n", id, val); -+ tplg_dbg("\t\t%s: %s", id, val); - continue; - } - -@@ -460,7 +460,7 @@ int tplg_parse_stream_caps(snd_tplg_t *tplg, - if (err < 0) - return err; - -- tplg_dbg("\t\t%s: %s\n", id, val); -+ tplg_dbg("\t\t%s: %s", id, val); - continue; - } - -@@ -625,7 +625,7 @@ static int tplg_parse_streams(snd_tplg_t *tplg ATTRIBUTE_UNUSED, - - snd_config_get_id(cfg, &id); - -- tplg_dbg("\t%s:\n", id); -+ tplg_dbg("\t%s:", id); - - switch (elem->type) { - case SND_TPLG_TYPE_PCM: -@@ -672,7 +672,7 @@ static int tplg_parse_streams(snd_tplg_t *tplg ATTRIBUTE_UNUSED, - snd_strlcpy(caps[stream].name, value, - SNDRV_CTL_ELEM_ID_NAME_MAXLEN); - -- tplg_dbg("\t\t%s\n\t\t\t%s\n", id, value); -+ tplg_dbg("\t\t%s\n\t\t\t%s", id, value); - continue; - } - } -@@ -746,7 +746,7 @@ static int tplg_parse_fe_dai(snd_tplg_t *tplg ATTRIBUTE_UNUSED, - const char *id; - - snd_config_get_id(cfg, &id); -- tplg_dbg("\t\tFE DAI %s:\n", id); -+ tplg_dbg("\t\tFE DAI %s:", id); - snd_strlcpy(pcm->dai_name, id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN); - - snd_config_for_each(i, next, cfg) { -@@ -763,7 +763,7 @@ static int tplg_parse_fe_dai(snd_tplg_t *tplg ATTRIBUTE_UNUSED, - return -EINVAL; - } - -- tplg_dbg("\t\t\tindex: %d\n", pcm->dai_id); -+ tplg_dbg("\t\t\tindex: %d", pcm->dai_id); - } - } - -@@ -847,7 +847,7 @@ int tplg_parse_pcm(snd_tplg_t *tplg, snd_config_t *cfg, - pcm->size = elem->size; - snd_strlcpy(pcm->pcm_name, elem->id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN); - -- tplg_dbg(" PCM: %s\n", elem->id); -+ tplg_dbg(" PCM: %s", elem->id); - - snd_config_for_each(i, next, cfg) { - -@@ -882,7 +882,7 @@ int tplg_parse_pcm(snd_tplg_t *tplg, snd_config_t *cfg, - - pcm->compress = ival; - -- tplg_dbg("\t%s: %d\n", id, ival); -+ tplg_dbg("\t%s: %d", id, ival); - continue; - } - -@@ -988,7 +988,7 @@ int tplg_parse_dai(snd_tplg_t *tplg, snd_config_t *cfg, - snd_strlcpy(dai->dai_name, elem->id, - SNDRV_CTL_ELEM_ID_NAME_MAXLEN); - -- tplg_dbg(" DAI: %s\n", elem->id); -+ tplg_dbg(" DAI: %s", elem->id); - - snd_config_for_each(i, next, cfg) { - -@@ -1142,7 +1142,7 @@ int tplg_parse_link(snd_tplg_t *tplg, - link->size = elem->size; - snd_strlcpy(link->name, elem->id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN); - -- tplg_dbg(" Link: %s\n", elem->id); -+ tplg_dbg(" Link: %s", elem->id); - - snd_config_for_each(i, next, cfg) { - -@@ -1168,7 +1168,7 @@ int tplg_parse_link(snd_tplg_t *tplg, - - snd_strlcpy(link->stream_name, val, - SNDRV_CTL_ELEM_ID_NAME_MAXLEN); -- tplg_dbg("\t%s: %s\n", id, val); -+ tplg_dbg("\t%s: %s", id, val); - continue; - } - -@@ -1280,7 +1280,7 @@ int tplg_parse_cc(snd_tplg_t *tplg, - link = elem->link; - link->size = elem->size; - -- tplg_dbg(" CC: %s\n", elem->id); -+ tplg_dbg(" CC: %s", elem->id); - - snd_config_for_each(i, next, cfg) { - -@@ -1412,7 +1412,7 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, - hw_cfg = elem->hw_cfg; - hw_cfg->size = elem->size; - -- tplg_dbg(" Link HW config: %s\n", elem->id); -+ tplg_dbg(" Link HW config: %s", elem->id); - - snd_config_for_each(i, next, cfg) { - -@@ -1719,7 +1719,7 @@ int tplg_add_pcm_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) - struct tplg_elem *elem; - int ret, i; - -- tplg_dbg("PCM: %s, DAI %s\n", pcm_tpl->pcm_name, pcm_tpl->dai_name); -+ tplg_dbg("PCM: %s, DAI %s", pcm_tpl->pcm_name, pcm_tpl->dai_name); - - if (pcm_tpl->num_streams > SND_SOC_TPLG_STREAM_CONFIG_MAX) - return -EINVAL; -@@ -1881,7 +1881,7 @@ int tplg_add_dai_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) - struct tplg_elem *elem; - int ret, i; - -- tplg_dbg("DAI %s\n", dai_tpl->dai_name); -+ tplg_dbg("DAI %s", dai_tpl->dai_name); - - elem = tplg_elem_new_common(tplg, NULL, dai_tpl->dai_name, - SND_TPLG_TYPE_DAI); -diff --git a/src/topology/text.c b/src/topology/text.c -index 6dbf2230..507c5450 100644 ---- a/src/topology/text.c -+++ b/src/topology/text.c -@@ -32,13 +32,13 @@ static int parse_text_values(snd_config_t *cfg, struct tplg_elem *elem) - const char *value = NULL; - int j = 0; - -- tplg_dbg(" Text Values: %s\n", elem->id); -+ tplg_dbg(" Text Values: %s", elem->id); - - snd_config_for_each(i, next, cfg) { - n = snd_config_iterator_entry(i); - - if (j == SND_SOC_TPLG_NUM_TEXTS) { -- tplg_dbg("text string number exceeds %d\n", j); -+ tplg_dbg("text string number exceeds %d", j); - return -ENOMEM; - } - -@@ -48,7 +48,7 @@ static int parse_text_values(snd_config_t *cfg, struct tplg_elem *elem) - - snd_strlcpy(&texts->items[j][0], value, - SNDRV_CTL_ELEM_ID_NAME_MAXLEN); -- tplg_dbg("\t%s\n", &texts->items[j][0]); -+ tplg_dbg("\t%s", &texts->items[j][0]); - - j++; - } --- -2.24.1 - - -From b20b400e2f598c86abaf697d66396cecd49b3e14 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 3 Jan 2020 22:56:48 +0100 -Subject: [PATCH 57/69] topology: cosmetic changes (functions) - -Signed-off-by: Jaroslav Kysela ---- - src/topology/builder.c | 3 ++- - src/topology/ctl.c | 5 +++-- - src/topology/data.c | 17 +++++++++-------- - src/topology/parser.c | 4 ++-- - src/topology/pcm.c | 16 ++++++++-------- - 5 files changed, 24 insertions(+), 21 deletions(-) - -diff --git a/src/topology/builder.c b/src/topology/builder.c -index 7af5de08..15757668 100644 ---- a/src/topology/builder.c -+++ b/src/topology/builder.c -@@ -71,7 +71,8 @@ static ssize_t write_block_header(snd_tplg_t *tplg, unsigned int type, - } - - static int write_elem_block(snd_tplg_t *tplg, -- struct list_head *base, size_t size, int tplg_type, const char *obj_name) -+ struct list_head *base, size_t size, -+ int tplg_type, const char *obj_name) - { - struct list_head *pos, *sub_pos, *sub_base; - struct tplg_elem *elem, *elem_next; -diff --git a/src/topology/ctl.c b/src/topology/ctl.c -index 41dc2ddb..b78f1c54 100644 ---- a/src/topology/ctl.c -+++ b/src/topology/ctl.c -@@ -600,7 +600,7 @@ int tplg_save_control_bytes(snd_tplg_t *tplg ATTRIBUTE_UNUSED, - - /* Parse Control Enums. */ - int tplg_parse_control_enum(snd_tplg_t *tplg, snd_config_t *cfg, -- void *private ATTRIBUTE_UNUSED) -+ void *private ATTRIBUTE_UNUSED) - { - struct snd_soc_tplg_enum_control *ec; - struct tplg_elem *elem; -@@ -736,7 +736,8 @@ int tplg_save_control_enum(snd_tplg_t *tplg ATTRIBUTE_UNUSED, - * Mixer control. Supports multiple channels. - */ - int tplg_parse_control_mixer(snd_tplg_t *tplg, -- snd_config_t *cfg, void *private ATTRIBUTE_UNUSED) -+ snd_config_t *cfg, -+ void *private ATTRIBUTE_UNUSED) - { - struct snd_soc_tplg_mixer_control *mc; - struct tplg_elem *elem; -diff --git a/src/topology/data.c b/src/topology/data.c -index 37c45919..b63e98cd 100644 ---- a/src/topology/data.c -+++ b/src/topology/data.c -@@ -516,7 +516,7 @@ static int tplg_parse_data_hex(snd_config_t *cfg, struct tplg_elem *elem, - - /* get the token integer value from its id */ - static int get_token_value(const char *token_id, -- struct tplg_vendor_tokens *tokens) -+ struct tplg_vendor_tokens *tokens) - { - unsigned int i; - -@@ -589,7 +589,8 @@ unsigned int tplg_get_tuple_size(int type) - - /* Add a tuples object to the private buffer of its parent data element */ - static int copy_tuples(struct tplg_elem *elem, -- struct tplg_vendor_tuples *tuples, struct tplg_vendor_tokens *tokens) -+ struct tplg_vendor_tuples *tuples, -+ struct tplg_vendor_tokens *tokens) - { - struct snd_soc_tplg_private *priv = elem->data, *priv2; - struct tplg_tuple_set *tuple_set; -@@ -781,7 +782,7 @@ static const char *get_tuple_type_name(unsigned int type) - } - - static int parse_tuple_set(snd_config_t *cfg, -- struct tplg_tuple_set **s) -+ struct tplg_tuple_set **s) - { - snd_config_iterator_t i, next; - snd_config_t *n; -@@ -965,7 +966,7 @@ static int tplg_save_tuple_set(struct tplg_vendor_tuples *tuples, - } - - static int parse_tuple_sets(snd_config_t *cfg, -- struct tplg_vendor_tuples *tuples) -+ struct tplg_vendor_tuples *tuples) - { - snd_config_iterator_t i, next; - snd_config_t *n; -@@ -1033,7 +1034,7 @@ int tplg_save_tuple_sets(snd_tplg_t *tplg ATTRIBUTE_UNUSED, - /* Parse vendor tokens - */ - int tplg_parse_tokens(snd_tplg_t *tplg, snd_config_t *cfg, -- void *private ATTRIBUTE_UNUSED) -+ void *private ATTRIBUTE_UNUSED) - { - snd_config_iterator_t i, next; - snd_config_t *n; -@@ -1109,7 +1110,7 @@ int tplg_save_tokens(snd_tplg_t *tplg ATTRIBUTE_UNUSED, - /* Parse vendor tuples. - */ - int tplg_parse_tuples(snd_tplg_t *tplg, snd_config_t *cfg, -- void *private ATTRIBUTE_UNUSED) -+ void *private ATTRIBUTE_UNUSED) - { - snd_config_iterator_t i, next; - snd_config_t *n; -@@ -1193,7 +1194,7 @@ void tplg_free_tuples(void *obj) - /* Parse manifest's data references - */ - int tplg_parse_manifest_data(snd_tplg_t *tplg, snd_config_t *cfg, -- void *private ATTRIBUTE_UNUSED) -+ void *private ATTRIBUTE_UNUSED) - { - struct snd_soc_tplg_manifest *manifest; - struct tplg_elem *elem; -@@ -1341,7 +1342,7 @@ int tplg_build_manifest_data(snd_tplg_t *tplg) - * words, tuples. - */ - int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg, -- void *private ATTRIBUTE_UNUSED) -+ void *private ATTRIBUTE_UNUSED) - { - snd_config_iterator_t i, next; - snd_config_t *n; -diff --git a/src/topology/parser.c b/src/topology/parser.c -index d7783a93..436e4841 100644 ---- a/src/topology/parser.c -+++ b/src/topology/parser.c -@@ -110,8 +110,8 @@ int tplg_get_unsigned(snd_config_t *n, unsigned *val, int base) - * Parse compound - */ - int tplg_parse_compound(snd_tplg_t *tplg, snd_config_t *cfg, -- int (*fcn)(snd_tplg_t *, snd_config_t *, void *), -- void *private) -+ int (*fcn)(snd_tplg_t *, snd_config_t *, void *), -+ void *private) - { - const char *id; - snd_config_iterator_t i, next; -diff --git a/src/topology/pcm.c b/src/topology/pcm.c -index da88783f..61159d33 100644 ---- a/src/topology/pcm.c -+++ b/src/topology/pcm.c -@@ -1124,8 +1124,8 @@ static int parse_hw_config_refs(snd_tplg_t *tplg ATTRIBUTE_UNUSED, - } - - /* Parse a physical link element in text conf file */ --int tplg_parse_link(snd_tplg_t *tplg, -- snd_config_t *cfg, void *private ATTRIBUTE_UNUSED) -+int tplg_parse_link(snd_tplg_t *tplg, snd_config_t *cfg, -+ void *private ATTRIBUTE_UNUSED) - { - struct snd_soc_tplg_link_config *link; - struct tplg_elem *elem; -@@ -1264,8 +1264,8 @@ int tplg_save_link(snd_tplg_t *tplg ATTRIBUTE_UNUSED, - } - - /* Parse cc */ --int tplg_parse_cc(snd_tplg_t *tplg, -- snd_config_t *cfg, void *private ATTRIBUTE_UNUSED) -+int tplg_parse_cc(snd_tplg_t *tplg, snd_config_t *cfg, -+ void *private ATTRIBUTE_UNUSED) - { - struct snd_soc_tplg_link_config *link; - struct tplg_elem *elem; -@@ -1307,8 +1307,8 @@ int tplg_parse_cc(snd_tplg_t *tplg, - - /* save CC */ - int tplg_save_cc(snd_tplg_t *tplg ATTRIBUTE_UNUSED, -- struct tplg_elem *elem, -- char **dst, const char *pfx) -+ struct tplg_elem *elem, -+ char **dst, const char *pfx) - { - struct snd_soc_tplg_link_config *link = elem->link; - char pfx2[16]; -@@ -1668,7 +1668,7 @@ int tplg_save_hw_config(snd_tplg_t *tplg ATTRIBUTE_UNUSED, - - /* copy stream object */ - static void tplg_add_stream_object(struct snd_soc_tplg_stream *strm, -- struct snd_tplg_stream_template *strm_tpl) -+ struct snd_tplg_stream_template *strm_tpl) - { - snd_strlcpy(strm->name, strm_tpl->name, - SNDRV_CTL_ELEM_ID_NAME_MAXLEN); -@@ -1773,7 +1773,7 @@ int tplg_add_pcm_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) - - /* Set link HW config from C API template */ - static int set_link_hw_config(struct snd_soc_tplg_hw_config *cfg, -- struct snd_tplg_hw_config_template *tpl) -+ struct snd_tplg_hw_config_template *tpl) - { - unsigned int i; - --- -2.24.1 - - -From 14ad963e192f101246e9b559d3b3fd41268330fb Mon Sep 17 00:00:00 2001 -From: David Fries -Date: Tue, 7 Jan 2020 09:18:10 -0600 -Subject: [PATCH 58/69] mixer: Fix memory leak for more than 16 file descriptor - case - -Signed-off-by: David Fries -Reviewed-by: Takashi Iwai -Signed-off-by: Takashi Iwai ---- - src/mixer/mixer.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/mixer/mixer.c b/src/mixer/mixer.c -index 82056474..b1af9945 100644 ---- a/src/mixer/mixer.c -+++ b/src/mixer/mixer.c -@@ -767,7 +767,7 @@ int snd_mixer_wait(snd_mixer_t *mixer, int timeout) - if (count < 0) - return count; - if ((unsigned int) count > sizeof(spfds) / sizeof(spfds[0])) { -- pfds = malloc(count * sizeof(*pfds)); -+ pfds = alloca(count * sizeof(*pfds)); - if (!pfds) - return -ENOMEM; - err = snd_mixer_poll_descriptors(mixer, pfds, --- -2.24.1 - - -From a78dd1bd1e9b47c2aee9b1e066de515b6854695a Mon Sep 17 00:00:00 2001 -From: Bertware -Date: Mon, 13 Jan 2020 10:21:33 +0100 -Subject: [PATCH 59/69] Quote strings containing [ or ] when saving an alsa - config - -Signed-off-by: Bert Marcelis -Signed-off-by: Jaroslav Kysela ---- - src/conf.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/conf.c b/src/conf.c -index c4db9f21..50d04034 100644 ---- a/src/conf.c -+++ b/src/conf.c -@@ -1531,6 +1531,8 @@ static void string_print(char *str, int id, snd_output_t *out) - case '.': - case '{': - case '}': -+ case '[': -+ case ']': - case '\'': - case '"': - goto quoted; --- -2.24.1 - - -From b34715004f4a1aabb85c5b9f03ba9f200638ee97 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 15 Jan 2020 09:41:05 +0100 -Subject: [PATCH 60/69] ucm: fix the configuration directory (longname) for - ucm2 - -The new ucm2 expects that the longname directory is shared with -the driver directory. Fix that for 'Syntax 2'. - -Signed-off-by: Jaroslav Kysela ---- - src/ucm/parser.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/src/ucm/parser.c b/src/ucm/parser.c -index d61124a3..b3970a13 100644 ---- a/src/ucm/parser.c -+++ b/src/ucm/parser.c -@@ -1649,7 +1649,9 @@ __longname: - - if (err == 0) { - /* got device-specific file that matches the card long name */ -- snd_strlcpy(uc_mgr->conf_file_name, longname, sizeof(uc_mgr->conf_file_name)); -+ if (uc_mgr->conf_format < 2) -+ snd_strlcpy(uc_mgr->conf_file_name, longname, -+ sizeof(uc_mgr->conf_file_name)); - goto __parse; - } - } --- -2.24.1 - - -From fe6425af751a768a2ba6cf7d430a85553d3b84f6 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 15 Jan 2020 10:31:56 +0100 -Subject: [PATCH 61/69] ucm: split conf_file_name and conf_dir_name - -With ucm2, the file name might differ from the directory -name. Also, allocate those fields. - -Signed-off-by: Jaroslav Kysela ---- - src/ucm/main.c | 7 ++++--- - src/ucm/parser.c | 37 ++++++++++++++++++++++++++----------- - src/ucm/ucm_local.h | 4 ++-- - src/ucm/ucm_subs.c | 2 +- - src/ucm/utils.c | 4 ++++ - 5 files changed, 37 insertions(+), 17 deletions(-) - -diff --git a/src/ucm/main.c b/src/ucm/main.c -index 61922f10..23e15bd8 100644 ---- a/src/ucm/main.c -+++ b/src/ucm/main.c -@@ -1700,12 +1700,13 @@ int snd_use_case_get(snd_use_case_mgr_t *uc_mgr, - err = 0; - } else if (strcmp(identifier, "_file") == 0) { - /* get the conf file name of the opened card */ -- if ((uc_mgr->card_name == NULL) -- || (uc_mgr->conf_file_name[0] == '\0')) { -+ if ((uc_mgr->card_name == NULL) || -+ (uc_mgr->conf_file_name == NULL) || -+ (uc_mgr->conf_file_name[0] == '\0')) { - err = -ENOENT; - goto __end; - } -- *value = strndup(uc_mgr->conf_file_name, MAX_FILE); -+ *value = strdup(uc_mgr->conf_file_name); - if (*value == NULL) { - err = -ENOMEM; - goto __end; -diff --git a/src/ucm/parser.c b/src/ucm/parser.c -index b3970a13..1bfde0be 100644 ---- a/src/ucm/parser.c -+++ b/src/ucm/parser.c -@@ -124,6 +124,16 @@ static void configuration_filename(snd_use_case_mgr_t *uc_mgr, - configuration_filename2(fn, fn_len, 2, dir, file, suffix); - } - -+/* -+ * Replace mallocated string -+ */ -+static char *replace_string(char **dst, const char *value) -+{ -+ free(*dst); -+ *dst = strdup(value); -+ return *dst; -+} -+ - /* - * Parse string - */ -@@ -1186,7 +1196,7 @@ static int parse_verb_file(snd_use_case_mgr_t *uc_mgr, - - /* open Verb file for reading */ - configuration_filename(uc_mgr, filename, sizeof(filename), -- uc_mgr->conf_file_name, file, ""); -+ uc_mgr->conf_dir_name, file, ""); - err = uc_mgr_config_load(uc_mgr->conf_format, filename, &cfg); - if (err < 0) { - uc_error("error: failed to open verb file %s : %d", -@@ -1404,16 +1414,16 @@ static int parse_master_file(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg) - if (uc_mgr->conf_format >= 2) { - err = snd_config_search(cfg, "Syntax", &n); - if (err < 0) { -- uc_error("Syntax field not found in %s", uc_mgr->conf_file_name); -+ uc_error("Syntax field not found in %s", uc_mgr->conf_dir_name); - return -EINVAL; - } - err = snd_config_get_integer(n, &l); - if (err < 0) { -- uc_error("Syntax field is invalid in %s", uc_mgr->conf_file_name); -+ uc_error("Syntax field is invalid in %s", uc_mgr->conf_dir_name); - return err; - } - if (l < 2 || l > SYNTAX_VERSION_MAX) { -- uc_error("Incompatible syntax %d in %s", l, uc_mgr->conf_file_name); -+ uc_error("Incompatible syntax %d in %s", l, uc_mgr->conf_dir_name); - return -EINVAL; - } - /* delete this field to avoid strcmp() call in the loop */ -@@ -1561,8 +1571,9 @@ static int get_by_card(snd_use_case_mgr_t *mgr, const char *ctl_name, char *long - return err; - - _name = snd_ctl_card_info_get_name(info); -+ if (replace_string(&mgr->conf_dir_name, _name) == NULL) -+ return -ENOMEM; - _long_name = snd_ctl_card_info_get_longname(info); -- snd_strlcpy(mgr->conf_file_name, _name, sizeof(mgr->conf_file_name)); - snd_strlcpy(longname, _long_name, MAX_CARD_LONG_NAME); - - return 0; -@@ -1585,7 +1596,7 @@ static int load_master_config(snd_use_case_mgr_t *uc_mgr, - if (getenv(ALSA_CONFIG_UCM2_VAR) || !getenv(ALSA_CONFIG_UCM_VAR)) { - uc_mgr->conf_format = 2; - configuration_filename(uc_mgr, filename, sizeof(filename), -- uc_mgr->conf_file_name, card_name, ".conf"); -+ uc_mgr->conf_dir_name, card_name, ".conf"); - if (access(filename, R_OK) == 0) - goto __load; - } -@@ -1608,6 +1619,9 @@ __load: - return err; - } - -+ if (replace_string(&uc_mgr->conf_file_name, card_name) == NULL) -+ return -ENOMEM; -+ - return 0; - } - -@@ -1632,7 +1646,8 @@ int uc_mgr_import_master_config(snd_use_case_mgr_t *uc_mgr) - char longname[MAX_CARD_LONG_NAME]; - int err; - -- snd_strlcpy(uc_mgr->conf_file_name, uc_mgr->card_name, sizeof(uc_mgr->conf_file_name)); -+ if (replace_string(&uc_mgr->conf_dir_name, uc_mgr->card_name) == NULL) -+ return -ENOMEM; - - if (strncmp(name, "hw:", 3) == 0) { - err = get_by_card(uc_mgr, name, longname); -@@ -1650,14 +1665,14 @@ __longname: - if (err == 0) { - /* got device-specific file that matches the card long name */ - if (uc_mgr->conf_format < 2) -- snd_strlcpy(uc_mgr->conf_file_name, longname, -- sizeof(uc_mgr->conf_file_name)); -+ snd_strlcpy(uc_mgr->conf_dir_name, longname, -+ sizeof(uc_mgr->conf_dir_name)); - goto __parse; - } - } - - /* standard path */ -- err = load_master_config(uc_mgr, uc_mgr->conf_file_name, &cfg, 0); -+ err = load_master_config(uc_mgr, uc_mgr->conf_dir_name, &cfg, 0); - if (err < 0) - goto __error; - -@@ -1673,7 +1688,7 @@ __parse: - - __error: - uc_mgr_free_ctl_list(uc_mgr); -- uc_mgr->conf_file_name[0] = '\0'; -+ uc_mgr->conf_dir_name[0] = '\0'; - return err; - } - -diff --git a/src/ucm/ucm_local.h b/src/ucm/ucm_local.h -index ba961507..63e0f3bf 100644 ---- a/src/ucm/ucm_local.h -+++ b/src/ucm/ucm_local.h -@@ -187,7 +187,6 @@ struct use_case_verb { - /* verb transition list */ - struct list_head transition_list; - -- /* hardware devices that can be used with this use case */ - struct list_head device_list; - - /* component device list */ -@@ -205,7 +204,8 @@ struct use_case_verb { - */ - struct snd_use_case_mgr { - char *card_name; -- char conf_file_name[MAX_CARD_LONG_NAME]; -+ char *conf_file_name; -+ char *conf_dir_name; - char *comment; - int conf_format; - -diff --git a/src/ucm/ucm_subs.c b/src/ucm/ucm_subs.c -index 90e395f0..d931f603 100644 ---- a/src/ucm/ucm_subs.c -+++ b/src/ucm/ucm_subs.c -@@ -31,7 +31,7 @@ - - static char *rval_conf_name(snd_use_case_mgr_t *uc_mgr) - { -- if (uc_mgr->conf_file_name[0]) -+ if (uc_mgr->conf_file_name && uc_mgr->conf_file_name[0]) - return strdup(uc_mgr->conf_file_name); - return NULL; - } -diff --git a/src/ucm/utils.c b/src/ucm/utils.c -index cde1d672..daa568c1 100644 ---- a/src/ucm/utils.c -+++ b/src/ucm/utils.c -@@ -441,7 +441,11 @@ void uc_mgr_free_verb(snd_use_case_mgr_t *uc_mgr) - uc_mgr_free_sequence(&uc_mgr->default_list); - uc_mgr_free_value(&uc_mgr->value_list); - free(uc_mgr->comment); -+ free(uc_mgr->conf_dir_name); -+ free(uc_mgr->conf_file_name); - uc_mgr->comment = NULL; -+ uc_mgr->conf_dir_name = NULL; -+ uc_mgr->conf_file_name = NULL; - uc_mgr->active_verb = NULL; - INIT_LIST_HEAD(&uc_mgr->active_devices); - INIT_LIST_HEAD(&uc_mgr->active_modifiers); --- -2.24.1 - - -From ebf5213cd61824b10bcaf67c570919e2a9ea0e1f Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 15 Jan 2020 10:40:01 +0100 -Subject: [PATCH 62/69] ucm: remove MAX_FILE definition and use correct - PATH_MAX - -Signed-off-by: Jaroslav Kysela ---- - src/ucm/parser.c | 6 +++--- - src/ucm/ucm_local.h | 1 - - 2 files changed, 3 insertions(+), 4 deletions(-) - -diff --git a/src/ucm/parser.c b/src/ucm/parser.c -index 1bfde0be..6c13fafd 100644 ---- a/src/ucm/parser.c -+++ b/src/ucm/parser.c -@@ -1167,7 +1167,7 @@ static int parse_verb_file(snd_use_case_mgr_t *uc_mgr, - snd_config_t *n; - struct use_case_verb *verb; - snd_config_t *cfg; -- char filename[MAX_FILE]; -+ char filename[PATH_MAX]; - int err; - - /* allocate verb */ -@@ -1582,7 +1582,7 @@ static int get_by_card(snd_use_case_mgr_t *mgr, const char *ctl_name, char *long - static int load_master_config(snd_use_case_mgr_t *uc_mgr, - const char *card_name, snd_config_t **cfg, int longname) - { -- char filename[MAX_FILE]; -+ char filename[PATH_MAX]; - int err; - - if (strnlen(card_name, MAX_CARD_LONG_NAME) == MAX_CARD_LONG_NAME) { -@@ -1733,7 +1733,7 @@ static int is_component_directory(const char *dir) - */ - int uc_mgr_scan_master_configs(const char **_list[]) - { -- char filename[MAX_FILE], dfl[MAX_FILE]; -+ char filename[PATH_MAX], dfl[PATH_MAX]; - char *env = getenv(ALSA_CONFIG_UCM2_VAR); - const char **list, *d_name; - snd_config_t *cfg, *c; -diff --git a/src/ucm/ucm_local.h b/src/ucm/ucm_local.h -index 63e0f3bf..fa9fc166 100644 ---- a/src/ucm/ucm_local.h -+++ b/src/ucm/ucm_local.h -@@ -42,7 +42,6 @@ - - #define SYNTAX_VERSION_MAX 2 - --#define MAX_FILE 256 - #define MAX_CARD_SHORT_NAME 32 - #define MAX_CARD_LONG_NAME 80 - --- -2.24.1 - - -From fbe1ac4a09933f527aff860aad035586367f21b4 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 15 Jan 2020 10:41:35 +0100 -Subject: [PATCH 63/69] topology: remove MAX_FILE definition and use correct - PATH_MAX - -Signed-off-by: Jaroslav Kysela ---- - src/topology/data.c | 2 +- - src/topology/tplg_local.h | 1 - - 2 files changed, 1 insertion(+), 2 deletions(-) - -diff --git a/src/topology/data.c b/src/topology/data.c -index b63e98cd..5742b357 100644 ---- a/src/topology/data.c -+++ b/src/topology/data.c -@@ -163,7 +163,7 @@ static int tplg_parse_data_file(snd_config_t *cfg, struct tplg_elem *elem) - { - struct snd_soc_tplg_private *priv = NULL; - const char *value = NULL; -- char filename[MAX_FILE]; -+ char filename[PATH_MAX]; - char *env = getenv(ALSA_CONFIG_TPLG_VAR); - FILE *fp; - size_t size, bytes_read; -diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h -index e061db75..5ace0d19 100644 ---- a/src/topology/tplg_local.h -+++ b/src/topology/tplg_local.h -@@ -29,7 +29,6 @@ - #define tplg_dbg(fmt, arg...) do { } while (0) - #endif - --#define MAX_FILE 256 - #define TPLG_MAX_PRIV_SIZE (1024 * 128) - - /** The name of the environment variable containing the tplg directory */ --- -2.24.1 - - -From 7d3fec6ac68de0244621ae0aca7474d159336639 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 17 Jan 2020 18:21:08 +0100 -Subject: [PATCH 64/69] ucm: parser - cosmetic fixes in the comments - -Signed-off-by: Jaroslav Kysela ---- - src/ucm/parser.c | 63 ++++++++++++++++++++++++------------------------ - 1 file changed, 31 insertions(+), 32 deletions(-) - -diff --git a/src/ucm/parser.c b/src/ucm/parser.c -index 6c13fafd..6c5d2902 100644 ---- a/src/ucm/parser.c -+++ b/src/ucm/parser.c -@@ -676,42 +676,41 @@ static int parse_value(snd_use_case_mgr_t *uc_mgr ATTRIBUTE_UNUSED, - /* - * Parse Modifier Use cases - * -- * # Each modifier is described in new section. N modifiers are allowed -- * SectionModifier."Capture Voice" { -+ * # Each modifier is described in new section. N modifiers are allowed -+ * SectionModifier."Capture Voice" { - * -- * Comment "Record voice call" -+ * Comment "Record voice call" - * -- * SupportedDevice [ -- * "x" -- * "y" -- * ] -- * -- * ConflictingDevice [ -- * "x" -- * "y" -- * ] -+ * SupportedDevice [ -+ * "x" -+ * "y" -+ * ] - * -- * EnableSequence [ -- * .... -- * ] -+ * ConflictingDevice [ -+ * "x" -+ * "y" -+ * ] - * -- * DisableSequence [ -- * ... -- * ] -+ * EnableSequence [ -+ * .... -+ * ] - * -- * TransitionSequence."ToModifierName" [ -- * ... -- * ] -+ * DisableSequence [ -+ * ... -+ * ] - * -- * # Optional TQ and ALSA PCMs -- * Value { -- * TQ Voice -- * CapturePCM "hw:1" -- * PlaybackVolume "name='Master Playback Volume',index=2" -- * PlaybackSwitch "name='Master Playback Switch',index=2" -- * } -+ * TransitionSequence."ToModifierName" [ -+ * ... -+ * ] - * -- * } -+ * # Optional TQ and ALSA PCMs -+ * Value { -+ * TQ Voice -+ * CapturePCM "hw:1" -+ * PlaybackVolume "name='Master Playback Volume',index=2" -+ * PlaybackSwitch "name='Master Playback Switch',index=2" -+ * } -+ * } - * - * SupportedDevice and ConflictingDevice cannot be specified together. - * Both are optional. -@@ -836,11 +835,11 @@ static int parse_modifier(snd_use_case_mgr_t *uc_mgr, - /* - * Parse Device Use Cases - * -- *# Each device is described in new section. N devices are allowed -- *SectionDevice."Headphones" { -+ * # Each device is described in new section. N devices are allowed -+ * SectionDevice."Headphones" { - * Comment "Headphones connected to 3.5mm jack" - * -- * upportedDevice [ -+ * SupportedDevice [ - * "x" - * "y" - * ] --- -2.24.1 - - -From b2fe99277a73ec80eac0bd221672dd4aa02defa7 Mon Sep 17 00:00:00 2001 -From: Tanu Kaskinen -Date: Fri, 20 Dec 2019 09:26:12 +0200 -Subject: [PATCH 65/69] configure.ac: remove an unnecessary libtool fix - -This code was added in commit 75d393a563efb578c79364a277087c6326267f52 -without explaining why. I assume it was a mistake, since it looks like -the libtool problem should have gone away a long time ago. The referenced -wiki page https://wiki.debian.org/RpathIssue says: - - Since libtool 1.5.2 (released 2004-01-25), on Linux libtool no - longer sets RPATH for any directories in the dynamic linker search - path, so this should no longer be an issue unless upstream used a - really old version of libtool when creating their distribution - tarball. - -This code caused problems in OpenEmbedded, where the libtool script is -named "x86_64-oe-linux-libtool" or similar rather than just "libtool", -so the sed command failed with a file not found error. Rather than -adapting the code to OpenEmbedded's peculiarities, it seems best to just -remove the unnecessary code altogether. - -Note: The rpath is set (hardcoded) for 'make' but it is corrected -for 'make install' by libtool. - -Signed-off-by: Tanu Kaskinen -Signed-off-by: Jaroslav Kysela ---- - configure.ac | 11 ----------- - 1 file changed, 11 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 886f87bc..fb60c030 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -765,14 +765,3 @@ test "$build_seq" = "yes" && echo "#include " >> include/asoundlib.h - test "$build_seq" = "yes" && echo "#include " >> include/asoundlib.h - test "$build_seq" = "yes" && echo "#include " >> include/asoundlib.h - cat "$srcdir"/include/asoundlib-tail.h >> include/asoundlib.h -- --dnl Taken from https://wiki.debian.org/RpathIssue --case $host in -- *-*-linux-gnu) -- AC_MSG_RESULT([Fixing libtool for -rpath problems.]) -- sed < libtool > libtool-2 \ -- 's/^hardcode_libdir_flag_spec.*$'/'hardcode_libdir_flag_spec=" -D__LIBTOOL_IS_A_FOOL__ "/' -- mv libtool-2 libtool -- chmod 755 libtool -- ;; --esac --- -2.24.1 - - -From c5a09b0feaf759957dfac2c797b652781a0d41fe Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Mon, 3 Feb 2020 14:44:13 +0100 -Subject: [PATCH 66/69] ucm: parser - use correct filename in - parser_master_file() - -Signed-off-by: Jaroslav Kysela ---- - src/ucm/parser.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/src/ucm/parser.c b/src/ucm/parser.c -index 6c5d2902..dbbd3817 100644 ---- a/src/ucm/parser.c -+++ b/src/ucm/parser.c -@@ -1413,16 +1413,16 @@ static int parse_master_file(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg) - if (uc_mgr->conf_format >= 2) { - err = snd_config_search(cfg, "Syntax", &n); - if (err < 0) { -- uc_error("Syntax field not found in %s", uc_mgr->conf_dir_name); -+ uc_error("Syntax field not found in %s", uc_mgr->conf_file_name); - return -EINVAL; - } - err = snd_config_get_integer(n, &l); - if (err < 0) { -- uc_error("Syntax field is invalid in %s", uc_mgr->conf_dir_name); -+ uc_error("Syntax field is invalid in %s", uc_mgr->conf_file_name); - return err; - } - if (l < 2 || l > SYNTAX_VERSION_MAX) { -- uc_error("Incompatible syntax %d in %s", l, uc_mgr->conf_dir_name); -+ uc_error("Incompatible syntax %d in %s", l, uc_mgr->conf_file_name); - return -EINVAL; - } - /* delete this field to avoid strcmp() call in the loop */ --- -2.24.1 - - -From 71a1367bcabc50f99302d8c76395f1cb84975775 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Mon, 3 Feb 2020 15:24:19 +0100 -Subject: [PATCH 67/69] ucm: the ucm2/ subdirectory is driver name based - -Signed-off-by: Jaroslav Kysela ---- - src/ucm/parser.c | 12 +++++++----- - 1 file changed, 7 insertions(+), 5 deletions(-) - -diff --git a/src/ucm/parser.c b/src/ucm/parser.c -index dbbd3817..f576fde4 100644 ---- a/src/ucm/parser.c -+++ b/src/ucm/parser.c -@@ -1515,7 +1515,7 @@ static int get_card_long_name(snd_use_case_mgr_t *mgr, char *longname) - int card, err; - snd_ctl_t *ctl; - snd_ctl_card_info_t *info; -- const char *_name, *_long_name; -+ const char *_driver, *_name, *_long_name; - - snd_ctl_card_info_alloca(&info); - -@@ -1535,9 +1535,11 @@ static int get_card_long_name(snd_use_case_mgr_t *mgr, char *longname) - err = get_card_info(mgr, name, &ctl, info); - - if (err == 0) { -+ _driver = snd_ctl_card_info_get_driver(info); - _name = snd_ctl_card_info_get_name(info); - _long_name = snd_ctl_card_info_get_longname(info); -- if (!strcmp(card_name, _name) || -+ if (!strcmp(card_name, _driver) || -+ !strcmp(card_name, _name) || - !strcmp(card_name, _long_name)) { - snd_strlcpy(longname, _long_name, MAX_CARD_LONG_NAME); - return 0; -@@ -1560,7 +1562,7 @@ static int get_by_card(snd_use_case_mgr_t *mgr, const char *ctl_name, char *long - { - snd_ctl_t *ctl; - snd_ctl_card_info_t *info; -- const char *_name, *_long_name; -+ const char *_driver, *_long_name; - int err; - - snd_ctl_card_info_alloca(&info); -@@ -1569,8 +1571,8 @@ static int get_by_card(snd_use_case_mgr_t *mgr, const char *ctl_name, char *long - if (err) - return err; - -- _name = snd_ctl_card_info_get_name(info); -- if (replace_string(&mgr->conf_dir_name, _name) == NULL) -+ _driver = snd_ctl_card_info_get_driver(info); -+ if (replace_string(&mgr->conf_dir_name, _driver) == NULL) - return -ENOMEM; - _long_name = snd_ctl_card_info_get_longname(info); - snd_strlcpy(longname, _long_name, MAX_CARD_LONG_NAME); --- -2.24.1 - - -From 251bc204a1e7f1bf1d12b452f2b62e15543bba94 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 7 Feb 2020 10:09:07 +0100 -Subject: [PATCH 68/69] ucm: implement RenameDevice and RemoveDevice verb - management - -With the conditionals, it may be useful to define the devices -in the included configuration files. To satisfy the specification -requirements (device naming) those device names might require -to be renamed or deleted wrong references from the conflicting -or supported lists. - -Signed-off-by: Jaroslav Kysela ---- - src/ucm/parser.c | 129 +++++++++++++++++++++++++++++++++++++++++++- - src/ucm/ucm_local.h | 15 ++++++ - src/ucm/utils.c | 123 +++++++++++++++++++++++++++++++++++++----- - 3 files changed, 254 insertions(+), 13 deletions(-) - -diff --git a/src/ucm/parser.c b/src/ucm/parser.c -index f576fde4..f9a8f628 100644 ---- a/src/ucm/parser.c -+++ b/src/ucm/parser.c -@@ -985,6 +985,71 @@ static int parse_device(snd_use_case_mgr_t *uc_mgr, - return 0; - } - -+/* -+ * Parse Device Rename/Delete Command -+ * -+ * # The devices might be renamed to allow the better conditional runtime -+ * # evaluation. Bellow example renames Speaker1 device to Speaker and -+ * # removes Speaker2 device. -+ * RenameDevice."Speaker1" "Speaker" -+ * RemoveDevice."Speaker2" "Speaker2" -+ */ -+static int parse_dev_name_list(snd_config_t *cfg, -+ struct list_head *list) -+{ -+ snd_config_t *n; -+ snd_config_iterator_t i, next; -+ const char *id, *name1; -+ char *name2; -+ struct ucm_dev_name *dev; -+ snd_config_iterator_t pos; -+ int err; -+ -+ if (snd_config_get_id(cfg, &id) < 0) -+ return -EINVAL; -+ -+ if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) { -+ uc_error("compound type expected for %s", id); -+ return -EINVAL; -+ } -+ -+ snd_config_for_each(i, next, cfg) { -+ n = snd_config_iterator_entry(i); -+ -+ if (snd_config_get_id(n, &name1) < 0) -+ return -EINVAL; -+ -+ err = parse_string(n, &name2); -+ if (err < 0) { -+ uc_error("error: failed to get target device name for '%s'", name1); -+ return err; -+ } -+ -+ /* skip duplicates */ -+ list_for_each(pos, list) { -+ dev = list_entry(pos, struct ucm_dev_name, list); -+ if (strcmp(dev->name1, name1) == 0) { -+ free(name2); -+ return 0; -+ } -+ } -+ -+ dev = calloc(1, sizeof(*dev)); -+ if (dev == NULL) -+ return -ENOMEM; -+ dev->name1 = strdup(name1); -+ if (dev->name1 == NULL) { -+ free(dev); -+ free(name2); -+ return -ENOMEM; -+ } -+ dev->name2 = name2; -+ list_add_tail(&dev->list, list); -+ } -+ -+ return 0; -+} -+ - static int parse_compound_check_legacy(snd_use_case_mgr_t *uc_mgr, - snd_config_t *cfg, - int (*fcn)(snd_use_case_mgr_t *, snd_config_t *, void *, void *), -@@ -1044,7 +1109,39 @@ static int parse_modifier_name(snd_use_case_mgr_t *uc_mgr, - void *data1, - void *data2 ATTRIBUTE_UNUSED) - { -- return parse_compound_check_legacy(uc_mgr, cfg, parse_modifier, data1); -+ return parse_compound(uc_mgr, cfg, parse_modifier, data1, data2); -+} -+ -+static int verb_device_management(struct use_case_verb *verb) -+{ -+ struct list_head *pos; -+ struct ucm_dev_name *dev; -+ int err; -+ -+ /* rename devices */ -+ list_for_each(pos, &verb->rename_list) { -+ dev = list_entry(pos, struct ucm_dev_name, list); -+ err = uc_mgr_rename_device(verb, dev->name1, dev->name2); -+ if (err < 0) { -+ uc_error("error: cannot rename device '%s' to '%s'", dev->name1, dev->name2); -+ return err; -+ } -+ } -+ -+ /* remove devices */ -+ list_for_each(pos, &verb->rename_list) { -+ dev = list_entry(pos, struct ucm_dev_name, list); -+ err = uc_mgr_remove_device(verb, dev->name2); -+ if (err < 0) { -+ uc_error("error: cannot remove device '%s'", dev->name2); -+ return err; -+ } -+ } -+ -+ /* those lists are no longer used */ -+ uc_mgr_free_dev_name_list(&verb->rename_list); -+ uc_mgr_free_dev_name_list(&verb->remove_list); -+ return 0; - } - - /* -@@ -1180,6 +1277,8 @@ static int parse_verb_file(snd_use_case_mgr_t *uc_mgr, - INIT_LIST_HEAD(&verb->cmpt_device_list); - INIT_LIST_HEAD(&verb->modifier_list); - INIT_LIST_HEAD(&verb->value_list); -+ INIT_LIST_HEAD(&verb->rename_list); -+ INIT_LIST_HEAD(&verb->remove_list); - list_add_tail(&verb->list, &uc_mgr->verb_list); - if (use_case_name == NULL) - return -EINVAL; -@@ -1249,6 +1348,26 @@ static int parse_verb_file(snd_use_case_mgr_t *uc_mgr, - } - continue; - } -+ -+ /* device renames */ -+ if (strcmp(id, "RenameDevice") == 0) { -+ err = parse_dev_name_list(n, &verb->rename_list); -+ if (err < 0) { -+ uc_error("error: %s failed to parse device rename", -+ file); -+ goto _err; -+ } -+ } -+ -+ /* device remove */ -+ if (strcmp(id, "RemoveDevice") == 0) { -+ err = parse_dev_name_list(n, &verb->remove_list); -+ if (err < 0) { -+ uc_error("error: %s failed to parse device remove", -+ file); -+ goto _err; -+ } -+ } - } - - snd_config_delete(cfg); -@@ -1258,6 +1377,14 @@ static int parse_verb_file(snd_use_case_mgr_t *uc_mgr, - uc_error("error: no use case device defined", file); - return -EINVAL; - } -+ -+ /* do device rename and delete */ -+ err = verb_device_management(verb); -+ if (err < 0) { -+ uc_error("error: device management error in verb '%s'", verb->name); -+ return err; -+ } -+ - return 0; - - _err: -diff --git a/src/ucm/ucm_local.h b/src/ucm/ucm_local.h -index fa9fc166..ba8d2acb 100644 ---- a/src/ucm/ucm_local.h -+++ b/src/ucm/ucm_local.h -@@ -117,6 +117,12 @@ struct ctl_list { - snd_ctl_card_info_t *ctl_info; - }; - -+struct ucm_dev_name { -+ struct list_head list; -+ char *name1; -+ char *name2; -+}; -+ - /* - * Describes a Use Case Modifier and it's enable and disable sequences. - * A use case verb can have N modifiers. -@@ -196,6 +202,10 @@ struct use_case_verb { - - /* value list */ - struct list_head value_list; -+ -+ /* temporary modifications lists */ -+ struct list_head rename_list; -+ struct list_head remove_list; - }; - - /* -@@ -252,6 +262,11 @@ int uc_mgr_config_load(int format, const char *file, snd_config_t **cfg); - int uc_mgr_import_master_config(snd_use_case_mgr_t *uc_mgr); - int uc_mgr_scan_master_configs(const char **_list[]); - -+int uc_mgr_remove_device(struct use_case_verb *verb, const char *name); -+int uc_mgr_rename_device(struct use_case_verb *verb, const char *src, -+ const char *dst); -+ -+void uc_mgr_free_dev_name_list(struct list_head *base); - void uc_mgr_free_sequence_element(struct sequence_element *seq); - void uc_mgr_free_transition_element(struct transition_sequence *seq); - void uc_mgr_free_verb(snd_use_case_mgr_t *uc_mgr); -diff --git a/src/ucm/utils.c b/src/ucm/utils.c -index daa568c1..60a59172 100644 ---- a/src/ucm/utils.c -+++ b/src/ucm/utils.c -@@ -328,6 +328,44 @@ void uc_mgr_free_dev_list(struct dev_list *dev_list) - } - } - -+int uc_mgr_rename_in_dev_list(struct dev_list *dev_list, const char *src, -+ const char *dst) -+{ -+ struct list_head *pos; -+ struct dev_list_node *dlist; -+ char *dst1; -+ -+ list_for_each(pos, &dev_list->list) { -+ dlist = list_entry(pos, struct dev_list_node, list); -+ if (strcmp(dlist->name, src) == 0) { -+ dst1 = strdup(dst); -+ if (dst1 == NULL) -+ return -ENOMEM; -+ free(dlist->name); -+ dlist->name = dst1; -+ return 0; -+ } -+ } -+ return -ENOENT; -+} -+ -+int uc_mgr_remove_from_dev_list(struct dev_list *dev_list, const char *name) -+{ -+ struct list_head *pos; -+ struct dev_list_node *dlist; -+ -+ list_for_each(pos, &dev_list->list) { -+ dlist = list_entry(pos, struct dev_list_node, list); -+ if (strcmp(dlist->name, name) == 0) { -+ free(dlist->name); -+ list_del(&dlist->list); -+ free(dlist); -+ return 0; -+ } -+ } -+ return -ENODEV; -+} -+ - void uc_mgr_free_sequence_element(struct sequence_element *seq) - { - if (seq == NULL) -@@ -381,6 +419,20 @@ void uc_mgr_free_transition(struct list_head *base) - } - } - -+void uc_mgr_free_dev_name_list(struct list_head *base) -+{ -+ struct list_head *pos, *npos; -+ struct ucm_dev_name *dev; -+ -+ list_for_each_safe(pos, npos, base) { -+ dev = list_entry(pos, struct ucm_dev_name, list); -+ list_del(&dev->list); -+ free(dev->name1); -+ free(dev->name2); -+ free(dev); -+ } -+} -+ - void uc_mgr_free_modifier(struct list_head *base) - { - struct list_head *pos, *npos; -@@ -400,23 +452,68 @@ void uc_mgr_free_modifier(struct list_head *base) - } - } - --void uc_mgr_free_device(struct list_head *base) -+void uc_mgr_free_device(struct use_case_device *dev) -+{ -+ free(dev->name); -+ free(dev->comment); -+ uc_mgr_free_sequence(&dev->enable_list); -+ uc_mgr_free_sequence(&dev->disable_list); -+ uc_mgr_free_transition(&dev->transition_list); -+ uc_mgr_free_dev_list(&dev->dev_list); -+ uc_mgr_free_value(&dev->value_list); -+ list_del(&dev->list); -+ free(dev); -+} -+ -+void uc_mgr_free_device_list(struct list_head *base) - { - struct list_head *pos, *npos; - struct use_case_device *dev; - - list_for_each_safe(pos, npos, base) { - dev = list_entry(pos, struct use_case_device, list); -- free(dev->name); -- free(dev->comment); -- uc_mgr_free_sequence(&dev->enable_list); -- uc_mgr_free_sequence(&dev->disable_list); -- uc_mgr_free_transition(&dev->transition_list); -- uc_mgr_free_dev_list(&dev->dev_list); -- uc_mgr_free_value(&dev->value_list); -- list_del(&dev->list); -- free(dev); -+ uc_mgr_free_device(dev); -+ } -+} -+ -+int uc_mgr_rename_device(struct use_case_verb *verb, const char *src, -+ const char *dst) -+{ -+ struct use_case_device *device; -+ struct list_head *pos, *npos; -+ char *dst1; -+ -+ /* no errors when device is not found */ -+ list_for_each_safe(pos, npos, &verb->device_list) { -+ device = list_entry(pos, struct use_case_device, list); -+ if (strcmp(device->name, src) == 0) { -+ dst1 = strdup(dst); -+ if (dst1 == NULL) -+ return -ENOMEM; -+ free(device->name); -+ device->name = dst1; -+ continue; -+ } -+ uc_mgr_rename_in_dev_list(&device->dev_list, src, dst); -+ } -+ return 0; -+} -+ -+int uc_mgr_remove_device(struct use_case_verb *verb, const char *name) -+{ -+ struct use_case_device *device; -+ struct list_head *pos, *npos; -+ -+ list_for_each_safe(pos, npos, &verb->device_list) { -+ device = list_entry(pos, struct use_case_device, list); -+ if (strcmp(device->name, name) == 0) { -+ uc_mgr_free_device(device); -+ continue; -+ } -+ uc_mgr_remove_from_dev_list(&device->dev_list, name); -+ return 0; - } -+ return -ENOENT; - } - - void uc_mgr_free_verb(snd_use_case_mgr_t *uc_mgr) -@@ -432,9 +529,11 @@ void uc_mgr_free_verb(snd_use_case_mgr_t *uc_mgr) - uc_mgr_free_sequence(&verb->disable_list); - uc_mgr_free_transition(&verb->transition_list); - uc_mgr_free_value(&verb->value_list); -- uc_mgr_free_device(&verb->device_list); -- uc_mgr_free_device(&verb->cmpt_device_list); -+ uc_mgr_free_device_list(&verb->device_list); -+ uc_mgr_free_device_list(&verb->cmpt_device_list); - uc_mgr_free_modifier(&verb->modifier_list); -+ uc_mgr_free_dev_name_list(&verb->rename_list); -+ uc_mgr_free_dev_name_list(&verb->remove_list); - list_del(&verb->list); - free(verb); - } --- -2.24.1 - - -From fdf96312fa3c9261db2954afcde8c6a15d2ebe44 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 7 Feb 2020 16:18:11 +0100 -Subject: [PATCH 69/69] ucm: fill missing device entries (conflicting / - supported) - -It is not necessary to maintain this information in sync in the configuration -files. Fill the missing entries to the complementary devices. - -Signed-off-by: Jaroslav Kysela ---- - src/ucm/parser.c | 50 ++++++++++++++++++++++++++++++++++++++++++++- - src/ucm/ucm_local.h | 1 + - src/ucm/utils.c | 25 +++++++++++++++++++++++ - 3 files changed, 75 insertions(+), 1 deletion(-) - -diff --git a/src/ucm/parser.c b/src/ucm/parser.c -index f9a8f628..23bf6a63 100644 ---- a/src/ucm/parser.c -+++ b/src/ucm/parser.c -@@ -1112,6 +1112,52 @@ static int parse_modifier_name(snd_use_case_mgr_t *uc_mgr, - return parse_compound(uc_mgr, cfg, parse_modifier, data1, data2); - } - -+static int verb_dev_list_add(struct use_case_verb *verb, -+ enum dev_list_type dst_type, -+ const char *dst, -+ const char *src) -+{ -+ struct use_case_device *device; -+ struct list_head *pos; -+ -+ list_for_each(pos, &verb->device_list) { -+ device = list_entry(pos, struct use_case_device, list); -+ if (strcmp(device->name, dst) != 0) -+ continue; -+ if (device->dev_list.type != dst_type) { -+ if (list_empty(&device->dev_list.list)) { -+ device->dev_list.type = dst_type; -+ } else { -+ uc_error("error: incompatible device list type ('%s', '%s')", -+ device->name, src); -+ return -EINVAL; -+ } -+ } -+ return uc_mgr_put_to_dev_list(&device->dev_list, src); -+ } -+ return -ENOENT; -+} -+ -+static int verb_dev_list_check(struct use_case_verb *verb) -+{ -+ struct list_head *pos, *pos2; -+ struct use_case_device *device; -+ struct dev_list_node *dlist; -+ int err; -+ -+ list_for_each(pos, &verb->device_list) { -+ device = list_entry(pos, struct use_case_device, list); -+ list_for_each(pos2, &device->dev_list.list) { -+ dlist = list_entry(pos2, struct dev_list_node, list); -+ err = verb_dev_list_add(verb, device->dev_list.type, -+ dlist->name, device->name); -+ if (err < 0) -+ return err; -+ } -+ } -+ return 0; -+} -+ - static int verb_device_management(struct use_case_verb *verb) - { - struct list_head *pos; -@@ -1141,7 +1187,9 @@ static int verb_device_management(struct use_case_verb *verb) - /* those lists are no longer used */ - uc_mgr_free_dev_name_list(&verb->rename_list); - uc_mgr_free_dev_name_list(&verb->remove_list); -- return 0; -+ -+ /* handle conflicting/supported lists */ -+ return verb_dev_list_check(verb); - } - - /* -diff --git a/src/ucm/ucm_local.h b/src/ucm/ucm_local.h -index ba8d2acb..acec4bf6 100644 ---- a/src/ucm/ucm_local.h -+++ b/src/ucm/ucm_local.h -@@ -262,6 +262,7 @@ int uc_mgr_config_load(int format, const char *file, snd_config_t **cfg); - int uc_mgr_import_master_config(snd_use_case_mgr_t *uc_mgr); - int uc_mgr_scan_master_configs(const char **_list[]); - -+int uc_mgr_put_to_dev_list(struct dev_list *dev_list, const char *name); - int uc_mgr_remove_device(struct use_case_verb *verb, const char *name); - int uc_mgr_rename_device(struct use_case_verb *verb, const char *src, - const char *dst); -diff --git a/src/ucm/utils.c b/src/ucm/utils.c -index 60a59172..50b2a1df 100644 ---- a/src/ucm/utils.c -+++ b/src/ucm/utils.c -@@ -328,6 +328,31 @@ void uc_mgr_free_dev_list(struct dev_list *dev_list) - } - } - -+int uc_mgr_put_to_dev_list(struct dev_list *dev_list, const char *name) -+{ -+ struct list_head *pos; -+ struct dev_list_node *dlist; -+ char *n; -+ -+ list_for_each(pos, &dev_list->list) { -+ dlist = list_entry(pos, struct dev_list_node, list); -+ if (strcmp(dlist->name, name) == 0) -+ return 0; -+ } -+ -+ dlist = calloc(1, sizeof(*dlist)); -+ if (dlist == NULL) -+ return -ENOMEM; -+ n = strdup(name); -+ if (n == NULL) { -+ free(dlist); -+ return -ENOMEM; -+ } -+ dlist->name = n; -+ list_add(&dlist->list, &dev_list->list); -+ return 0; -+} -+ - int uc_mgr_rename_in_dev_list(struct dev_list *dev_list, const char *src, - const char *dst) - { --- -2.24.1 - diff --git a/alsa-lib.spec b/alsa-lib.spec index 6768960..6fbf3c4 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -2,14 +2,14 @@ #define prever_dot .rc3 #define postver a -%define version_alsa_lib 1.2.1.2 -%define version_alsa_ucm 1.2.1.2 -%define version_alsa_tplg 1.2.1 +%define version_alsa_lib 1.2.2 +%define version_alsa_ucm 1.2.2 +%define version_alsa_tplg 1.2.2 Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 6%{?prever_dot}%{?dist} +Release: 1%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -111,14 +111,14 @@ mkdir -p %{buildroot}/%{_datadir}/alsa/ucm mkdir -p %{buildroot}/%{_datadir}/alsa/ucm2 # Unpack UCMs -tar xvjf %{SOURCE1} -C %{buildroot}/%{_datadir}/alsa ucm ucm2 +tar xvjf %{SOURCE1} -C %{buildroot}/%{_datadir}/alsa --strip-components=1 "*/ucm" "*/ucm2" patch -d %{buildroot}/%{_datadir}/alsa -p1 < %{SOURCE40} # Create topology directory mkdir -p %{buildroot}/%{_datadir}/alsa/topology # Unpack topologies -tar xvjf %{SOURCE2} -C %{buildroot}/%{_datadir}/alsa topology +tar xvjf %{SOURCE2} -C %{buildroot}/%{_datadir}/alsa --strip-components=1 "*/topology" # Remove libtool archives. find %{buildroot} -name '*.la' -delete @@ -163,6 +163,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Wed Feb 19 2020 Jaroslav Kysela - 1.2.2 +- Udpated to 1.2.2 + * Sun Feb 9 2020 Jaroslav Kysela - 1.2.1.2-6 - More UCM2 related fixes diff --git a/alsa-ucm-conf.patch b/alsa-ucm-conf.patch deleted file mode 100644 index fc1a184..0000000 --- a/alsa-ucm-conf.patch +++ /dev/null @@ -1,5648 +0,0 @@ -From 2882eb5085db58b60ff6dd0f61912d32ccbdf911 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Thu, 5 Dec 2019 17:46:53 +0100 -Subject: [PATCH 01/36] sof-hda-dsp: Fix the Dmic0 CaptureMixerElem for v1.4.1 - firmware - -Signed-off-by: Jaroslav Kysela ---- - ucm2/sof-hda-dsp/HiFi.conf | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/ucm2/sof-hda-dsp/HiFi.conf b/ucm2/sof-hda-dsp/HiFi.conf -index f1c81a1..500cbae 100644 ---- a/ucm2/sof-hda-dsp/HiFi.conf -+++ b/ucm2/sof-hda-dsp/HiFi.conf -@@ -162,7 +162,7 @@ SectionDevice."DigitalMic" { - Control "name='Dmic0 Capture Switch'" - } - True { -- CaptureMixerElem "Dmic0 Capture" -+ CaptureMixerElem "Dmic0" - CaptureVolume "Dmic0 Capture Volume" - CaptureSwitch "Dmic0 Capture Switch" - } --- -2.24.1 - - -From adeb572487081f4f88318583d6eefb0ea1b61361 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 6 Dec 2019 11:12:39 +0100 -Subject: [PATCH 02/36] sof-hda-dsp: Use more strict names according latest - use-case.h - -Also remove ConflictinDevice section from the digital microphone. -Those paths are independent. - -BugLink: https://github.com/alsa-project/alsa-ucm-conf/pull/7 -Signed-off-by: Jaroslav Kysela ---- - ucm2/sof-hda-dsp/HiFi.conf | 15 ++++++--------- - 1 file changed, 6 insertions(+), 9 deletions(-) - -diff --git a/ucm2/sof-hda-dsp/HiFi.conf b/ucm2/sof-hda-dsp/HiFi.conf -index 500cbae..5c7236d 100644 ---- a/ucm2/sof-hda-dsp/HiFi.conf -+++ b/ucm2/sof-hda-dsp/HiFi.conf -@@ -6,7 +6,7 @@ SectionVerb { - ] - } - --SectionDevice."Headphones" { -+SectionDevice."Headphones1" { - Comment "Headphones" - - EnableSequence [ -@@ -87,8 +87,9 @@ If.monomic { - Control "name='Input Source'" - ControlEnum "Headphone Mic" - } -+ After.SectionDevice "Mic" - True { -- SectionDevice."HeadphonesMic" { -+ SectionDevice."Headphones2" { - Comment "Headphones Stereo Microphone" - - ConflictingDevice [ -@@ -106,7 +107,7 @@ If.monomic { - } - } - -- SectionDevice."HeadsetMic" { -+ SectionDevice."Headset" { - Comment "Headset Mono Microphone" - - EnableSequence [ -@@ -121,7 +122,7 @@ If.monomic { - } - } - False { -- SectionDevice."HeadphonesMic" { -+ SectionDevice."Headphones2" { - Comment "Headphones Stereo Microphone" - - Value { -@@ -133,13 +134,9 @@ If.monomic { - } - } - --SectionDevice."DigitalMic" { -+SectionDevice."Mic" { - Comment "Digital Microphone" - -- ConflictingDevice [ -- "HeadsetMic" -- ] -- - Value { - CapturePriority 100 - CapturePCM "hw:${CardId},6" --- -2.24.1 - - -From e852e235102b6132e7c873c2ff00bf3e01237af0 Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Mon, 6 Jan 2020 14:11:59 +0100 -Subject: [PATCH 04/36] bytcht-es8316: Fix missing including of HeadPhones.conf - after ucm2 conversion - -The conversion to ucm2 format missed adding an include for: - -codecs/es8316/HeadPhones.conf - -Leading to no sound on the headphones output, this commit adds the missing -include fixing this. - -Cc: youling 257 -Reported-by: youling 257 -Signed-off-by: Hans de Goede -Signed-off-by: Jaroslav Kysela ---- - ucm2/bytcht-es8316/HiFi-Components.conf | 2 ++ - ucm2/bytcht-es8316/HiFi-LongName.conf | 2 ++ - 2 files changed, 4 insertions(+) - -diff --git a/ucm2/bytcht-es8316/HiFi-Components.conf b/ucm2/bytcht-es8316/HiFi-Components.conf -index 314d355..c40bd49 100644 ---- a/ucm2/bytcht-es8316/HiFi-Components.conf -+++ b/ucm2/bytcht-es8316/HiFi-Components.conf -@@ -20,6 +20,8 @@ If.mono { - } - } - -+ -+ - If.in1 { - Condition { - Type String -diff --git a/ucm2/bytcht-es8316/HiFi-LongName.conf b/ucm2/bytcht-es8316/HiFi-LongName.conf -index ea7d1c3..03cf17b 100644 ---- a/ucm2/bytcht-es8316/HiFi-LongName.conf -+++ b/ucm2/bytcht-es8316/HiFi-LongName.conf -@@ -20,6 +20,8 @@ If.mono { - } - } - -+ -+ - If.in1 { - Condition { - Type String --- -2.24.1 - - -From 74f2a0f0884df7b9f2d08d07456a3bc37d1a512e Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Mon, 13 Jan 2020 13:36:55 +0100 -Subject: [PATCH 05/36] ucm2: fix the verb path in - chtrt5645/chtrt5645-dmic2.conf - -Signed-off-by: Jaroslav Kysela ---- - ucm2/chtrt5645/chtrt5645-dmic2.conf | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/ucm2/chtrt5645/chtrt5645-dmic2.conf b/ucm2/chtrt5645/chtrt5645-dmic2.conf -index 9bbebfa..2ea095c 100644 ---- a/ucm2/chtrt5645/chtrt5645-dmic2.conf -+++ b/ucm2/chtrt5645/chtrt5645-dmic2.conf -@@ -1,6 +1,6 @@ - Syntax 2 - Comment "Intel SoC Audio Device" - SectionUseCase."HiFi" { -- File "../LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216/HiFi.conf" -+ File "HiFi-dmic2.conf" - Comment "Default" - } --- -2.24.1 - - -From be86627a9f4179979d208943bb497b10dfc679cb Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 10 Dec 2019 17:08:37 +0100 -Subject: [PATCH 06/36] broadwell-rt286: add support for hardware volume, - conformance fixes - -Signed-off-by: Jaroslav Kysela ---- - ucm2/broadwell-rt286/HiFi.conf | 90 ++++++++++++++++------------------ - 1 file changed, 43 insertions(+), 47 deletions(-) - -diff --git a/ucm2/broadwell-rt286/HiFi.conf b/ucm2/broadwell-rt286/HiFi.conf -index 6cf31e7..e766250 100644 ---- a/ucm2/broadwell-rt286/HiFi.conf -+++ b/ucm2/broadwell-rt286/HiFi.conf -@@ -1,13 +1,31 @@ - # Use case Configuration for Nexus 7 - # Adapted to Ubuntu Touch by David Henningsson - --SectionVerb { -+SectionDevice."Speaker" { -+ Comment "Speaker playback" -+ -+ ConflictingDevice [ -+ "Headphones" -+ ] -+ -+ EnableSequence [ -+ cset "name='SPO Switch' on" -+ cset "name='Speaker Playback Switch' on" -+ cset "name='Speaker Switch' on" -+ ] -+ -+ DisableSequence [ -+ cset "name='Speaker Switch' off" -+ cset "name='Speaker Playback Switch' off" -+ cset "name='SPO Switch' 0" -+ ] - -- # ALSA PCM - Value { -- # ALSA PCM device for HiFi -+ Priority 100 - PlaybackPCM "hw:${CardId}" -- CapturePCM "hw:${CardId}" -+ PlaybackChannels 2 -+ PlaybackMixerElem "DAC0" -+ PlaybackMasterElem "Master" - } - } - -@@ -19,11 +37,9 @@ SectionDevice."Headphones" { - ] - - EnableSequence [ -- cset "name='Master Playback Volume' 30" - cset "name='HPO L Switch' on" - cset "name='HPO R Switch' on" - cset "name='Headphone Jack Switch' on" -- cset "name='DAC0 Playback Volume' 100" - ] - - DisableSequence [ -@@ -33,36 +49,38 @@ SectionDevice."Headphones" { - ] - - Value { -- PlaybackChannels "2" -+ Priority 200 -+ PlaybackPCM "hw:${CardId}" -+ PlaybackChannels 2 -+ PlaybackMixerElem "DAC0" -+ PlaybackMasterElem "Master" - JackDev "rt286-jack" - JackControl "Headphone Jack" - JackHWMute "Speaker" - } - } - --SectionDevice."Speaker" { -- Comment "Speaker playback" -+SectionDevice."Mic" { -+ Comment "Microphone" - - ConflictingDevice [ -- "Headphones" -+ "Handset" - ] - - EnableSequence [ -- cset "name='Master Playback Volume' 30" -- cset "name='DAC0 Playback Volume' 127" -- cset "name='SPO Switch' on" -- cset "name='Speaker Playback Switch' on" -- cset "name='Speaker Switch' on" -+ cset "name='ADC 0 Mux' 2" - ] - - DisableSequence [ -- cset "name='Speaker Switch' off" -- cset "name='Speaker Playback Switch' off" -- cset "name='SPO Switch' 0" -+ cset "name='ADC0 Capture Switch' off" - ] - - Value { -- PlaybackChannels "2" -+ Priority 100 -+ CapturePCM "hw:${CardId}" -+ CaptureChannels "2" -+ CaptureMixerElem "Mic" -+ CaptureMasterElem "ADC0" - } - } - -@@ -70,14 +88,11 @@ SectionDevice."Handset" { - Comment "Handset Microphone" - - ConflictingDevice [ -- "Mainmic" -+ "Mic" - ] - - EnableSequence [ -- cset "name='Mic Capture Volume' 28" - cset "name='ADC 0 Mux' 0" -- cset "name='ADC0 Capture Switch' on" -- cset "name='ADC0 Capture Volume' 127" - cset "name='AMIC Volume' 1" - ] - -@@ -86,32 +101,13 @@ SectionDevice."Handset" { - ] - - Value { -+ Priority 200 -+ CapturePCM "hw:${CardId}" - CaptureChannels "2" -+ CaptureMixerElem "Mic" -+ CaptureMasterElem "ADC0" - JackDev "rt286-jack" - JackControl "Mic Jack" -- JackHWMute "Mainmic" -- } --} -- --SectionDevice."Mainmic" { -- Comment "Main Microphone" -- -- ConflictingDevice [ -- "Handset" -- ] -- -- EnableSequence [ -- cset "name='Mic Capture Volume' 30" -- cset "name='ADC 0 Mux' 2" -- cset "name='ADC0 Capture Switch' on" -- cset "name='ADC0 Capture Volume' 127" -- ] -- -- DisableSequence [ -- cset "name='ADC0 Capture Switch' off" -- ] -- -- Value { -- CaptureChannels "2" -+ JackHWMute "Mic" - } - } --- -2.24.1 - - -From b70e91923bfa61989acb32801bee259a4c04674d Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Thu, 23 Jan 2020 14:13:10 +0100 -Subject: [PATCH 07/36] broxton-rt298: corrections, cleanups - -Signed-off-by: Jaroslav Kysela ---- - ucm2/broxton-rt298/Hdmi.conf | 43 ++++++++++++++++++ - ucm2/broxton-rt298/Hdmi1.conf | 23 ---------- - ucm2/broxton-rt298/Hdmi2.conf | 23 ---------- - ucm2/broxton-rt298/HiFi.conf | 63 ++++++++++++++++----------- - ucm2/broxton-rt298/broxton-rt298.conf | 18 ++------ - 5 files changed, 84 insertions(+), 86 deletions(-) - create mode 100644 ucm2/broxton-rt298/Hdmi.conf - delete mode 100644 ucm2/broxton-rt298/Hdmi1.conf - delete mode 100644 ucm2/broxton-rt298/Hdmi2.conf - -diff --git a/ucm2/broxton-rt298/Hdmi.conf b/ucm2/broxton-rt298/Hdmi.conf -new file mode 100644 -index 0000000..fc64fe7 ---- /dev/null -+++ b/ucm2/broxton-rt298/Hdmi.conf -@@ -0,0 +1,43 @@ -+# Usecase for device HDMI1/Display Port stereo playback on Intel SKYLAKE/KABYLAKE platforms -+ -+SectionDevice."HDMI1" { -+ Comment "HDMI/Display Port 1 Stereo" -+ -+ Value { -+ PlaybackPCM "hw:${CardId},4" -+ PlaybackPriority 500 -+ If.1 { -+ Condition { -+ Type ControlExists -+ Control "iface=CARD,name='HDMI/DP,pcm=4 Jack'" -+ } -+ True { -+ JackControl "HDMI/DP,pcm=4 Jack" -+ } -+ False { -+ JackControl "HDMI/DP, pcm=4 Jack" -+ } -+ } -+ } -+} -+ -+SectionDevice."HDMI2" { -+ Comment "HDMI/Display Port 2 Stereo" -+ -+ Value { -+ PlaybackPCM "hw:${CardId},5" -+ PlaybackPriority 600 -+ If.1 { -+ Condition { -+ Type ControlExists -+ Control "iface=CARD,name='HDMI/DP,pcm=5 Jack'" -+ } -+ True { -+ JackControl "HDMI/DP,pcm=5 Jack" -+ } -+ False { -+ JackControl "HDMI/DP, pcm=5 Jack" -+ } -+ } -+ } -+} -diff --git a/ucm2/broxton-rt298/Hdmi1.conf b/ucm2/broxton-rt298/Hdmi1.conf -deleted file mode 100644 -index ede176b..0000000 ---- a/ucm2/broxton-rt298/Hdmi1.conf -+++ /dev/null -@@ -1,23 +0,0 @@ --# Usecase for device HDMI1/Display Port stereo playback on Intel SKYLAKE/KABYLAKE platforms --# For Audio in I2S mode -- --SectionDevice."Hdmi1" { -- Comment "HDMI/Display Port 1 Stereo" -- -- Value { -- PlaybackPCM "hw:${CardId},4" -- PlaybackPriority "3" -- If.1 { -- Condition { -- Type ControlExists -- Control "iface=CARD,name='HDMI/DP,pcm=4 Jack'" -- } -- True { -- JackControl "HDMI/DP,pcm=4 Jack" -- } -- False { -- JackControl "HDMI/DP, pcm=4 Jack" -- } -- } -- } --} -diff --git a/ucm2/broxton-rt298/Hdmi2.conf b/ucm2/broxton-rt298/Hdmi2.conf -deleted file mode 100644 -index 9718bae..0000000 ---- a/ucm2/broxton-rt298/Hdmi2.conf -+++ /dev/null -@@ -1,23 +0,0 @@ --# Usecase for device HDMI1/Display Port stereo playback on Intel SKYLAKE/KABYLAKE platforms --# For Audio in I2S mode -- --SectionDevice."Hdmi2" { -- Comment "HDMI/Display Port 2 Stereo" -- -- Value { -- PlaybackPCM "hw:${CardId},5" -- PlaybackPriority "4" -- If.1 { -- Condition { -- Type ControlExists -- Control "iface=CARD,name='HDMI/DP,pcm=5 Jack'" -- } -- True { -- JackControl "HDMI/DP,pcm=5 Jack" -- } -- False { -- JackControl "HDMI/DP, pcm=5 Jack" -- } -- } -- } --} -diff --git a/ucm2/broxton-rt298/HiFi.conf b/ucm2/broxton-rt298/HiFi.conf -index 630d5e1..6f5b9a5 100644 ---- a/ucm2/broxton-rt298/HiFi.conf -+++ b/ucm2/broxton-rt298/HiFi.conf -@@ -9,31 +9,29 @@ SectionVerb { - - Value { - TQ "HiFi" -- CapturePCM "hw:${CardId},1" -- PlaybackPCM "hw:${CardId},0" - } - } - --SectionDevice."DigitalMic" { -- Comment "DMIC Stereo" -+SectionDevice."Speaker" { -+ Comment "Speaker" - - ConflictingDevice [ -- "Headset" -+ "Headphones" - ] - - EnableSequence [ -- cset "name='media0_out mo dmic01_hifi_in mi Switch' 1" -- cset "name='media0_out mo codec0_in mi Switch' 0" -- cset "name='Mic Jack Switch' 0" -- -+ cset "name='SPO Switch' 1" -+ cset "name='Speaker Playback Switch' 1,1" -+ cset "name='Speaker Switch' 1" -+ cset "name='HPO L Switch' 0" -+ cset "name='HPO R Switch' 0" - ] - -- DisableSequence [ -- cset "name='media0_out mo codec0_in mi Switch' 1" -- cset "name='media0_out mo dmic01_hifi_in mi Switch' 0" -- cset "name='Mic Jack Switch' 1" -- cset "name='ADC 0 Mux' 0" -- ] -+ Value { -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId}" -+ JackHWMute "Headphones" -+ } - } - - SectionDevice."Headphones" { -@@ -51,36 +49,45 @@ SectionDevice."Headphones" { - ] - - Value { -+ PlaybackPriority 200 -+ PlaybackPCM "hw:${CardId}" - JackControl "Headphone Jack" - JackHWMute "Speaker" - } - } - --SectionDevice."Speaker" { -- Comment "Speaker" -+SectionDevice."Mic" { -+ Comment "Digital Microphone" - - ConflictingDevice [ -- "Headphones" -+ "Headset" - ] - - EnableSequence [ -- cset "name='SPO Switch' 1" -- cset "name='Speaker Playback Switch' 1,1" -- cset "name='Speaker Switch' 1" -- cset "name='HPO L Switch' 0" -- cset "name='HPO R Switch' 0" -+ cset "name='media0_out mo dmic01_hifi_in mi Switch' 1" -+ cset "name='media0_out mo codec0_in mi Switch' 0" -+ cset "name='Mic Jack Switch' 0" -+ -+ ] -+ -+ DisableSequence [ -+ cset "name='media0_out mo codec0_in mi Switch' 1" -+ cset "name='media0_out mo dmic01_hifi_in mi Switch' 0" -+ cset "name='Mic Jack Switch' 1" -+ cset "name='ADC 0 Mux' 0" - ] - - Value { -- JackHWMute "Headphones" -+ CapturePriority 100 -+ CapturePCM "hw:${CardId},1" - } - } - - SectionDevice."Headset" { -- Comment "Headset Mic" -+ Comment "Headset Microphone" - - ConflictingDevice [ -- "DigitalMic" -+ "Mic" - ] - - EnableSequence [ -@@ -97,6 +104,10 @@ SectionDevice."Headset" { - ] - - Value { -+ CapturePriority 200 -+ CapturePCM "hw:${CardId},1" - JackControl "Mic Jack" - } - } -+ -+ -diff --git a/ucm2/broxton-rt298/broxton-rt298.conf b/ucm2/broxton-rt298/broxton-rt298.conf -index 8752e91..1332dc5 100644 ---- a/ucm2/broxton-rt298/broxton-rt298.conf -+++ b/ucm2/broxton-rt298/broxton-rt298.conf -@@ -8,21 +8,11 @@ SectionUseCase."HiFi" { - Comment "Play and record HiFi quality Music" - } - --SectionUseCase."Hdmi1" { -- File "Hdmi1.conf" -- Comment "Play on Hdmi/DP 1" --} -- --SectionUseCase."Hdmi2" { -- File "Hdmi2.conf" -- Comment "Play on Hdmi/DP 2" --} -- - ValueDefaults { -- PlaybackChannels "2" -- PlaybackPriority "1" -- CaptureChannels "2" -- CapturePriority "2" -+ PlaybackChannels 2 -+ PlaybackPriority 1 -+ CaptureChannels 2 -+ CapturePriority 2 - } - - SectionDefaults [ --- -2.24.1 - - -From e1f9bdb95e1cf90c17a44fa5734b41b6656d648d Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Thu, 23 Jan 2020 19:03:53 +0100 -Subject: [PATCH 08/36] bytcr-rt5640: cleanups and corrections - -Signed-off-by: Jaroslav Kysela ---- - ucm2/codecs/rt5640/DigitalMics.conf | 8 ++++---- - ucm2/codecs/rt5640/HeadPhones.conf | 4 +++- - ucm2/codecs/rt5640/HeadsetMic.conf | 8 ++++---- - ucm2/codecs/rt5640/IN1-InternalMic.conf | 6 +++--- - ucm2/codecs/rt5640/IN3-InternalMic.conf | 8 ++++---- - ucm2/codecs/rt5640/MonoSpeaker.conf | 6 ++++-- - ucm2/codecs/rt5640/Speaker.conf | 4 +++- - 7 files changed, 25 insertions(+), 19 deletions(-) - -diff --git a/ucm2/codecs/rt5640/DigitalMics.conf b/ucm2/codecs/rt5640/DigitalMics.conf -index 36982c4..17cae19 100644 ---- a/ucm2/codecs/rt5640/DigitalMics.conf -+++ b/ucm2/codecs/rt5640/DigitalMics.conf -@@ -1,10 +1,8 @@ --SectionDevice."DigitalMics" { -+SectionDevice."Mic" { - Comment "Internal Digital Microphones" - - ConflictingDevice [ -- "IN1-InternalMics" -- "IN3-InternalMics" -- "HeadsetMic" -+ "Headset" - ] - - EnableSequence [ -@@ -22,6 +20,8 @@ SectionDevice."DigitalMics" { - ] - - Value { -+ CapturePriority 100 -+ CapturePCM "hw:${CardId},0" - CaptureChannels 2 - } - } -diff --git a/ucm2/codecs/rt5640/HeadPhones.conf b/ucm2/codecs/rt5640/HeadPhones.conf -index e37442d..dccc943 100644 ---- a/ucm2/codecs/rt5640/HeadPhones.conf -+++ b/ucm2/codecs/rt5640/HeadPhones.conf -@@ -32,7 +32,9 @@ SectionDevice."Headphones" { - ] - - Value { -- PlaybackChannels "2" -+ PlaybackPriority 300 -+ PlaybackPCM "hw:${CardId},0" -+ PlaybackChannels 2 - JackControl "Headphone Jack" - } - } -diff --git a/ucm2/codecs/rt5640/HeadsetMic.conf b/ucm2/codecs/rt5640/HeadsetMic.conf -index a99b295..f6d9423 100644 ---- a/ucm2/codecs/rt5640/HeadsetMic.conf -+++ b/ucm2/codecs/rt5640/HeadsetMic.conf -@@ -1,10 +1,8 @@ --SectionDevice."HeadsetMic" { -+SectionDevice."Headset" { - Comment "Headset Microphone" - - ConflictingDevice [ -- "IN1-InternalMics" -- "IN3-InternalMics" -- "DigitalMics" -+ "Mic" - ] - - EnableSequence [ -@@ -38,6 +36,8 @@ SectionDevice."HeadsetMic" { - ] - - Value { -+ CapturePriority 200 -+ CapturePCM "hw:${CardId},0" - CaptureChannels 2 - JackControl "Headset Mic Jack" - } -diff --git a/ucm2/codecs/rt5640/IN1-InternalMic.conf b/ucm2/codecs/rt5640/IN1-InternalMic.conf -index 95fc89e..435cce8 100644 ---- a/ucm2/codecs/rt5640/IN1-InternalMic.conf -+++ b/ucm2/codecs/rt5640/IN1-InternalMic.conf -@@ -1,10 +1,8 @@ --SectionDevice."IN1-InternalMics" { -+SectionDevice."Mic" { - Comment "Internal Microphone on IN1" - - ConflictingDevice [ -- "DigitalMics" - "HeadsetMic" -- "IN3-InternalMics" - ] - - EnableSequence [ -@@ -41,6 +39,8 @@ SectionDevice."IN1-InternalMics" { - ] - - Value { -+ CapturePriority 100 -+ CapturePCM "hw:${CardId},0" - CaptureChannels 2 - } - } -diff --git a/ucm2/codecs/rt5640/IN3-InternalMic.conf b/ucm2/codecs/rt5640/IN3-InternalMic.conf -index b8270e9..4d4060e 100644 ---- a/ucm2/codecs/rt5640/IN3-InternalMic.conf -+++ b/ucm2/codecs/rt5640/IN3-InternalMic.conf -@@ -1,10 +1,8 @@ --SectionDevice."IN3-InternalMics" { -+SectionDevice."Mic" { - Comment "Internal Microphone on IN3" - - ConflictingDevice [ -- "DigitalMics" -- "HeadsetMic" -- "IN1-InternalMics" -+ "Headset" - ] - - EnableSequence [ -@@ -41,6 +39,8 @@ SectionDevice."IN3-InternalMics" { - ] - - Value { -+ CapturePriority 100 -+ CapturePCM "hw:${CardId},0" - CaptureChannels 2 - } - } -diff --git a/ucm2/codecs/rt5640/MonoSpeaker.conf b/ucm2/codecs/rt5640/MonoSpeaker.conf -index ee4eff3..6ca51e2 100644 ---- a/ucm2/codecs/rt5640/MonoSpeaker.conf -+++ b/ucm2/codecs/rt5640/MonoSpeaker.conf -@@ -1,4 +1,4 @@ --SectionDevice."MonoSpeaker" { -+SectionDevice."Speaker" { - Comment "Mono Speaker" - - ConflictingDevice [ -@@ -37,6 +37,8 @@ SectionDevice."MonoSpeaker" { - ] - - Value { -- PlaybackChannels "2" -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId},0" -+ PlaybackChannels 2 - } - } -diff --git a/ucm2/codecs/rt5640/Speaker.conf b/ucm2/codecs/rt5640/Speaker.conf -index 564a6b3..09b99cf 100644 ---- a/ucm2/codecs/rt5640/Speaker.conf -+++ b/ucm2/codecs/rt5640/Speaker.conf -@@ -37,6 +37,8 @@ SectionDevice."Speaker" { - ] - - Value { -- PlaybackChannels "2" -+ PlaybackPCM "hw:${CardId},0" -+ PlaybackPriority 100 -+ PlaybackChannels 2 - } - } --- -2.24.1 - - -From 38989bd8f548a5b79d53c8278a5f25a5b3904d5f Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Thu, 23 Jan 2020 19:39:08 +0100 -Subject: [PATCH 09/36] bytcr-rt5651: cleanups and corrections - -Signed-off-by: Jaroslav Kysela ---- - ucm2/bytcr-rt5651/HiFi-Components.conf | 7 +++++-- - ucm2/bytcr-rt5651/HiFi-LongName.conf | 6 ++++-- - ucm2/bytcr-rt5651/HiFi.conf | 5 ----- - ucm2/codecs/rt5651/DigitalMic.conf | 12 +++--------- - ucm2/codecs/rt5651/HeadPhones-swapped.conf | 5 +++-- - ucm2/codecs/rt5651/HeadPhones.conf | 5 +++-- - ucm2/codecs/rt5651/IN1-InternalMic.conf | 14 ++++---------- - ucm2/codecs/rt5651/IN12-InternalMic.conf | 14 ++++---------- - ucm2/codecs/rt5651/IN2-HeadsetMic.conf | 12 +++++------- - ucm2/codecs/rt5651/IN2-InternalMic.conf | 14 ++++---------- - ucm2/codecs/rt5651/IN3-HeadsetMic.conf | 12 +++++------- - ucm2/codecs/rt5651/MonoSpeaker.conf | 7 ++++--- - ucm2/codecs/rt5651/Speaker.conf | 5 +++-- - 13 files changed, 47 insertions(+), 71 deletions(-) - -diff --git a/ucm2/bytcr-rt5651/HiFi-Components.conf b/ucm2/bytcr-rt5651/HiFi-Components.conf -index 235838e..53ebcbe 100644 ---- a/ucm2/bytcr-rt5651/HiFi-Components.conf -+++ b/ucm2/bytcr-rt5651/HiFi-Components.conf -@@ -42,6 +42,11 @@ If.dmic1 { - } - True { - -+ -+ SectionDevice."Mic".ConflictingDevice.0 "Headset" -+ } -+ False { -+ - } - } - -@@ -77,5 +82,3 @@ If.in12 { - - } - } -- -- -diff --git a/ucm2/bytcr-rt5651/HiFi-LongName.conf b/ucm2/bytcr-rt5651/HiFi-LongName.conf -index 58eb722..e6dd908 100644 ---- a/ucm2/bytcr-rt5651/HiFi-LongName.conf -+++ b/ucm2/bytcr-rt5651/HiFi-LongName.conf -@@ -42,6 +42,10 @@ If.dmic1 { - } - True { - -+ -+ } -+ False { -+ - } - } - -@@ -77,5 +81,3 @@ If.in12 { - - } - } -- -- -diff --git a/ucm2/bytcr-rt5651/HiFi.conf b/ucm2/bytcr-rt5651/HiFi.conf -index 1f031f2..8a9a402 100644 ---- a/ucm2/bytcr-rt5651/HiFi.conf -+++ b/ucm2/bytcr-rt5651/HiFi.conf -@@ -10,11 +10,6 @@ SectionVerb { - DisableSequence [ - - ] -- -- Value { -- PlaybackPCM "hw:${CardId}" -- CapturePCM "hw:${CardId}" -- } - } - - If.0 { -diff --git a/ucm2/codecs/rt5651/DigitalMic.conf b/ucm2/codecs/rt5651/DigitalMic.conf -index 7a0c4d4..fa1de4c 100644 ---- a/ucm2/codecs/rt5651/DigitalMic.conf -+++ b/ucm2/codecs/rt5651/DigitalMic.conf -@@ -1,14 +1,6 @@ --SectionDevice."DigitalMic" { -+SectionDevice."Mic" { - Comment "Internal Digital Microphone" - -- ConflictingDevice [ -- "InternalMic-IN1" -- "InternalMic-IN2" -- "InternalMic-IN12" -- "HeadsetMic-IN2" -- "HeadsetMic-IN3" -- ] -- - EnableSequence [ - cset "name='Stereo1 ADC MIXL ADC2 Switch' on" - cset "name='Stereo1 ADC MIXR ADC2 Switch' on" -@@ -22,6 +14,8 @@ SectionDevice."DigitalMic" { - ] - - Value { -+ CapturePriority 100 -+ CapturePCM "hw:${CardId}" - CaptureChannels 2 - } - } -diff --git a/ucm2/codecs/rt5651/HeadPhones-swapped.conf b/ucm2/codecs/rt5651/HeadPhones-swapped.conf -index f5260a3..7e91aa2 100644 ---- a/ucm2/codecs/rt5651/HeadPhones-swapped.conf -+++ b/ucm2/codecs/rt5651/HeadPhones-swapped.conf -@@ -3,7 +3,6 @@ SectionDevice."Headphones" { - - ConflictingDevice [ - "Speaker" -- "MonoSpeaker" - ] - - EnableSequence [ -@@ -33,7 +32,9 @@ SectionDevice."Headphones" { - ] - - Value { -- PlaybackChannels "2" -+ PlaybackPriority 200 -+ PlaybackChannels 2 -+ PlaybackPCM "hw:${CardId}" - JackControl "Headphone Jack" - } - } -diff --git a/ucm2/codecs/rt5651/HeadPhones.conf b/ucm2/codecs/rt5651/HeadPhones.conf -index 0a87b32..18a4108 100644 ---- a/ucm2/codecs/rt5651/HeadPhones.conf -+++ b/ucm2/codecs/rt5651/HeadPhones.conf -@@ -3,7 +3,6 @@ SectionDevice."Headphones" { - - ConflictingDevice [ - "Speaker" -- "MonoSpeaker" - ] - - EnableSequence [ -@@ -24,7 +23,9 @@ SectionDevice."Headphones" { - ] - - Value { -- PlaybackChannels "2" -+ PlaybackPriority 200 -+ PlaybackPCM "hw:${CardId}" -+ PlaybackChannels 2 - JackControl "Headphone Jack" - } - } -diff --git a/ucm2/codecs/rt5651/IN1-InternalMic.conf b/ucm2/codecs/rt5651/IN1-InternalMic.conf -index 01b786e..13c7cb6 100644 ---- a/ucm2/codecs/rt5651/IN1-InternalMic.conf -+++ b/ucm2/codecs/rt5651/IN1-InternalMic.conf -@@ -1,14 +1,6 @@ --SectionDevice."InternalMic-IN1" { -+SectionDevice."Mic" { - Comment "Internal Microphone on IN1" - -- ConflictingDevice [ -- "DigitalMic" -- "InternalMic-IN2" -- "InternalMic-IN12" -- "HeadsetMic-IN2" -- "HeadsetMic-IN3" -- ] -- - EnableSequence [ - cset "name='Internal Mic Switch' on" - cset "name='RECMIXL BST1 Switch' on" -@@ -26,6 +18,8 @@ SectionDevice."InternalMic-IN1" { - ] - - Value { -- CaptureChannels "2" -+ CapturePriority 100 -+ CapturePCM "hw:${CardId}" -+ CaptureChannels 2 - } - } -diff --git a/ucm2/codecs/rt5651/IN12-InternalMic.conf b/ucm2/codecs/rt5651/IN12-InternalMic.conf -index 44cc53a..e017541 100644 ---- a/ucm2/codecs/rt5651/IN12-InternalMic.conf -+++ b/ucm2/codecs/rt5651/IN12-InternalMic.conf -@@ -1,14 +1,6 @@ --SectionDevice."InternalMic-IN12" { -+SectionDevice."Mic" { - Comment "Internal Microphones on IN1 and IN2" - -- ConflictingDevice [ -- "DigitalMic" -- "InternalMic-IN1" -- "InternalMic-IN2" -- "HeadsetMic-IN2" -- "HeadsetMic-IN3" -- ] -- - EnableSequence [ - cset "name='Internal Mic Switch' on" - cset "name='RECMIXL BST1 Switch' on" -@@ -30,6 +22,8 @@ SectionDevice."InternalMic-IN12" { - ] - - Value { -- CaptureChannels "2" -+ CapturePriority 100 -+ CapturePCM "hw:${CardId}" -+ CaptureChannels 2 - } - } -diff --git a/ucm2/codecs/rt5651/IN2-HeadsetMic.conf b/ucm2/codecs/rt5651/IN2-HeadsetMic.conf -index 177f70b..5b51439 100644 ---- a/ucm2/codecs/rt5651/IN2-HeadsetMic.conf -+++ b/ucm2/codecs/rt5651/IN2-HeadsetMic.conf -@@ -1,12 +1,8 @@ --SectionDevice."HeadsetMic-IN2" { -+SectionDevice."Headset" { - Comment "Headset Microphone on IN2" - - ConflictingDevice [ -- "DigitalMic" -- "InternalMic-IN1" -- "InternalMic-IN2" -- "InternalMic-IN12" -- "HeadsetMic-IN3" -+ "Mic" - ] - - EnableSequence [ -@@ -26,7 +22,9 @@ SectionDevice."HeadsetMic-IN2" { - ] - - Value { -- CaptureChannels "2" -+ CapturePriority 200 -+ CapturePCM "hw:${CardId}" -+ CaptureChannels 2 - JackControl "Headset Mic Jack" - } - } -diff --git a/ucm2/codecs/rt5651/IN2-InternalMic.conf b/ucm2/codecs/rt5651/IN2-InternalMic.conf -index 611ca6c..9eeef4d 100644 ---- a/ucm2/codecs/rt5651/IN2-InternalMic.conf -+++ b/ucm2/codecs/rt5651/IN2-InternalMic.conf -@@ -1,14 +1,6 @@ --SectionDevice."InternalMic-IN2" { -+SectionDevice."Mic" { - Comment "Internal Microphone on IN2" - -- ConflictingDevice [ -- "DigitalMic" -- "InternalMic-IN1" -- "InternalMic-IN12" -- "HeadsetMic-IN2" -- "HeadsetMic-IN3" -- ] -- - EnableSequence [ - cset "name='Internal Mic Switch' on" - cset "name='RECMIXL BST2 Switch' on" -@@ -26,6 +18,8 @@ SectionDevice."InternalMic-IN2" { - ] - - Value { -- CaptureChannels "2" -+ CapturePriority 100 -+ CapturePCM "hw:${CardId}" -+ CaptureChannels 2 - } - } -diff --git a/ucm2/codecs/rt5651/IN3-HeadsetMic.conf b/ucm2/codecs/rt5651/IN3-HeadsetMic.conf -index 3231e78..d579dcd 100644 ---- a/ucm2/codecs/rt5651/IN3-HeadsetMic.conf -+++ b/ucm2/codecs/rt5651/IN3-HeadsetMic.conf -@@ -1,12 +1,8 @@ --SectionDevice."HeadsetMic-IN3" { -+SectionDevice."Headset" { - Comment "Headset Microphone on IN3" - - ConflictingDevice [ -- "DigitalMic" -- "InternalMic-IN1" -- "InternalMic-IN2" -- "InternalMic-IN12" -- "HeadsetMic-IN2" -+ "Mic" - ] - - EnableSequence [ -@@ -26,7 +22,9 @@ SectionDevice."HeadsetMic-IN3" { - ] - - Value { -- CaptureChannels "2" -+ CapturePriority 200 -+ CapturePCM "hw:${CardId}" -+ CaptureChannels 2 - JackControl "Headset Mic Jack" - } - } -diff --git a/ucm2/codecs/rt5651/MonoSpeaker.conf b/ucm2/codecs/rt5651/MonoSpeaker.conf -index c2276c6..9c780a0 100644 ---- a/ucm2/codecs/rt5651/MonoSpeaker.conf -+++ b/ucm2/codecs/rt5651/MonoSpeaker.conf -@@ -1,8 +1,7 @@ --SectionDevice."MonoSpeaker" { -+SectionDevice."Speaker" { - Comment "Mono Speaker" - - ConflictingDevice [ -- "Speaker" - "Headphones" - ] - -@@ -42,6 +41,8 @@ SectionDevice."MonoSpeaker" { - ] - - Value { -- PlaybackChannels "2" -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId}" -+ PlaybackChannels 2 - } - } -diff --git a/ucm2/codecs/rt5651/Speaker.conf b/ucm2/codecs/rt5651/Speaker.conf -index 463d13b..efc12e5 100644 ---- a/ucm2/codecs/rt5651/Speaker.conf -+++ b/ucm2/codecs/rt5651/Speaker.conf -@@ -2,7 +2,6 @@ SectionDevice."Speaker" { - Comment "Speakers" - - ConflictingDevice [ -- "MonoSpeaker" - "Headphones" - ] - -@@ -24,6 +23,8 @@ SectionDevice."Speaker" { - ] - - Value { -- PlaybackChannels "2" -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId}" -+ PlaybackChannels 2 - } - } --- -2.24.1 - - -From 9b0f31cc65b558c0eee98be583b8a8108341e53d Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Thu, 23 Jan 2020 19:45:00 +0100 -Subject: [PATCH 10/36] bytcht-cx2072x: cleanups and corrections - -Signed-off-by: Jaroslav Kysela ---- - ucm2/bytcht-cx2072x/HiFi.conf | 5 ----- - ucm2/codecs/cx2072x/HeadPhones.conf | 4 +++- - ucm2/codecs/cx2072x/HeadsetMic.conf | 8 +++++--- - ucm2/codecs/cx2072x/InternalMic.conf | 8 +++++--- - ucm2/codecs/cx2072x/Speaker.conf | 4 +++- - 5 files changed, 16 insertions(+), 13 deletions(-) - -diff --git a/ucm2/bytcht-cx2072x/HiFi.conf b/ucm2/bytcht-cx2072x/HiFi.conf -index 60e0229..b329ea4 100644 ---- a/ucm2/bytcht-cx2072x/HiFi.conf -+++ b/ucm2/bytcht-cx2072x/HiFi.conf -@@ -8,11 +8,6 @@ SectionVerb { - - - ] -- -- Value { -- PlaybackPCM "hw:${CardId}" -- CapturePCM "hw:${CardId}" -- } - } - - -diff --git a/ucm2/codecs/cx2072x/HeadPhones.conf b/ucm2/codecs/cx2072x/HeadPhones.conf -index b5d3d3a..484d020 100644 ---- a/ucm2/codecs/cx2072x/HeadPhones.conf -+++ b/ucm2/codecs/cx2072x/HeadPhones.conf -@@ -16,7 +16,9 @@ SectionDevice."Headphones" { - ] - - Value { -- PlaybackChannels "2" -+ PlaybackPriority 200 -+ PlaybackPCM "hw:${CardId}" -+ PlaybackChannels 2 - JackControl "Headphone Jack" - } - } -diff --git a/ucm2/codecs/cx2072x/HeadsetMic.conf b/ucm2/codecs/cx2072x/HeadsetMic.conf -index 0a59750..b1a7771 100644 ---- a/ucm2/codecs/cx2072x/HeadsetMic.conf -+++ b/ucm2/codecs/cx2072x/HeadsetMic.conf -@@ -1,8 +1,8 @@ --SectionDevice."HeadsetMic" { -+SectionDevice."Headset" { - Comment "Headset Microphone" - - ConflictingDevice [ -- "InternalMic" -+ "Mic" - ] - - EnableSequence [ -@@ -17,7 +17,9 @@ SectionDevice."HeadsetMic" { - ] - - Value { -- CaptureChannels "2" -+ CapturePriority 200 -+ CapturePCM "hw:${CardId}" -+ CaptureChannels 2 - JackControl "Headset Mic Jack" - } - } -diff --git a/ucm2/codecs/cx2072x/InternalMic.conf b/ucm2/codecs/cx2072x/InternalMic.conf -index e358c35..831c3cc 100644 ---- a/ucm2/codecs/cx2072x/InternalMic.conf -+++ b/ucm2/codecs/cx2072x/InternalMic.conf -@@ -1,8 +1,8 @@ --SectionDevice."InternalMic" { -+SectionDevice."Mic" { - Comment "Internal Microphone" - - ConflictingDevice [ -- "HeadsetMic" -+ "Headset" - ] - - EnableSequence [ -@@ -17,6 +17,8 @@ SectionDevice."InternalMic" { - ] - - Value { -- CaptureChannels "2" -+ CapturePriority 100 -+ CapturePCM "hw:${CardId}" -+ CaptureChannels 2 - } - } -diff --git a/ucm2/codecs/cx2072x/Speaker.conf b/ucm2/codecs/cx2072x/Speaker.conf -index a83aeae..f60e355 100644 ---- a/ucm2/codecs/cx2072x/Speaker.conf -+++ b/ucm2/codecs/cx2072x/Speaker.conf -@@ -16,6 +16,8 @@ SectionDevice."Speaker" { - ] - - Value { -- PlaybackChannels "2" -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId}" -+ PlaybackChannels 2 - } - } --- -2.24.1 - - -From 7248ff84f18dc56d289937a81adfdc3852ee8a8f Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Thu, 23 Jan 2020 19:53:52 +0100 -Subject: [PATCH 11/36] bytcht-es8316: cleanups and corrections - -Signed-off-by: Jaroslav Kysela ---- - ucm2/codecs/es8316/HeadPhones.conf | 7 ++++--- - ucm2/codecs/es8316/IN1-HeadsetMic.conf | 10 +++++----- - ucm2/codecs/es8316/IN1-InternalMic.conf | 10 +++++----- - ucm2/codecs/es8316/IN2-HeadsetMic.conf | 10 +++++----- - ucm2/codecs/es8316/IN2-InternalMic.conf | 6 ++++-- - ucm2/codecs/es8316/MonoSpeaker.conf | 7 ++++--- - ucm2/codecs/es8316/Speaker.conf | 4 +++- - 7 files changed, 30 insertions(+), 24 deletions(-) - -diff --git a/ucm2/codecs/es8316/HeadPhones.conf b/ucm2/codecs/es8316/HeadPhones.conf -index 3f3e591..603b40c 100644 ---- a/ucm2/codecs/es8316/HeadPhones.conf -+++ b/ucm2/codecs/es8316/HeadPhones.conf -@@ -3,7 +3,6 @@ SectionDevice."Headphones" { - - ConflictingDevice [ - "Speaker" -- "MonoSpeaker" - ] - - EnableSequence [ -@@ -15,8 +14,10 @@ SectionDevice."Headphones" { - ] - - Value { -- PlaybackChannels "2" -+ PlaybackPriority 200 -+ PlaybackPCM "hw:${CardId},0" -+ PlaybackChannels 2 - JackControl "Headphone Jack" -- JackHWMute "Speaker MonoSpeaker" -+ JackHWMute "Speaker" - } - } -diff --git a/ucm2/codecs/es8316/IN1-HeadsetMic.conf b/ucm2/codecs/es8316/IN1-HeadsetMic.conf -index 997a50b..d798270 100644 ---- a/ucm2/codecs/es8316/IN1-HeadsetMic.conf -+++ b/ucm2/codecs/es8316/IN1-HeadsetMic.conf -@@ -1,10 +1,8 @@ --SectionDevice."HeadsetMic-IN1" { -+SectionDevice."Headset" { - Comment "Headset Microphone on IN1" - - ConflictingDevice [ -- "InternalMic-IN1" -- "InternalMic-IN2" -- "HeadsetMic-IN2" -+ "Mic" - ] - - EnableSequence [ -@@ -17,7 +15,9 @@ SectionDevice."HeadsetMic-IN1" { - ] - - Value { -- CaptureChannels "2" -+ CapturePriority 200 -+ CapturePCM "hw:${CardId},0" -+ CaptureChannels 2 - JackControl "Headset Mic Jack" - } - } -diff --git a/ucm2/codecs/es8316/IN1-InternalMic.conf b/ucm2/codecs/es8316/IN1-InternalMic.conf -index 70a77b9..31c5cda 100644 ---- a/ucm2/codecs/es8316/IN1-InternalMic.conf -+++ b/ucm2/codecs/es8316/IN1-InternalMic.conf -@@ -1,10 +1,8 @@ --SectionDevice."InternalMic-IN1" { -+SectionDevice."Mic" { - Comment "Internal Microphone on IN1" - - ConflictingDevice [ -- "InternalMic-IN2" -- "HeadsetMic-IN1" -- "HeadsetMic-IN2" -+ "Headset" - ] - - EnableSequence [ -@@ -17,6 +15,8 @@ SectionDevice."InternalMic-IN1" { - ] - - Value { -- CaptureChannels "2" -+ CapturePriority 100 -+ CapturePCM "hw:${CardId}" -+ CaptureChannels 2 - } - } -diff --git a/ucm2/codecs/es8316/IN2-HeadsetMic.conf b/ucm2/codecs/es8316/IN2-HeadsetMic.conf -index 1ab1221..28f26f8 100644 ---- a/ucm2/codecs/es8316/IN2-HeadsetMic.conf -+++ b/ucm2/codecs/es8316/IN2-HeadsetMic.conf -@@ -1,10 +1,8 @@ --SectionDevice."HeadsetMic-IN2" { -+SectionDevice."Headset" { - Comment "Headset Microphone on IN2" - - ConflictingDevice [ -- "InternalMic-IN1" -- "InternalMic-IN2" -- "HeadsetMic-IN1" -+ "Mic" - ] - - EnableSequence [ -@@ -17,7 +15,9 @@ SectionDevice."HeadsetMic-IN2" { - ] - - Value { -- CaptureChannels "2" -+ CapturePriority 200 -+ CapturePCM "hw:${CardId},0" -+ CaptureChannels 2 - JackControl "Headset Mic Jack" - } - } -diff --git a/ucm2/codecs/es8316/IN2-InternalMic.conf b/ucm2/codecs/es8316/IN2-InternalMic.conf -index 7809f8a..8c0418f 100644 ---- a/ucm2/codecs/es8316/IN2-InternalMic.conf -+++ b/ucm2/codecs/es8316/IN2-InternalMic.conf -@@ -1,4 +1,4 @@ --SectionDevice."InternalMic-IN2" { -+SectionDevice."Mic" { - Comment "Internal Microphone on IN2" - - ConflictingDevice [ -@@ -17,6 +17,8 @@ SectionDevice."InternalMic-IN2" { - ] - - Value { -- CaptureChannels "2" -+ CapturePriority 100 -+ CapturePCM "hw:${CardId},0" -+ CaptureChannels 2 - } - } -diff --git a/ucm2/codecs/es8316/MonoSpeaker.conf b/ucm2/codecs/es8316/MonoSpeaker.conf -index 704556a..f11f2b7 100644 ---- a/ucm2/codecs/es8316/MonoSpeaker.conf -+++ b/ucm2/codecs/es8316/MonoSpeaker.conf -@@ -1,8 +1,7 @@ --SectionDevice."MonoSpeaker" { -+SectionDevice."Speaker" { - Comment "Mono Speaker" - - ConflictingDevice [ -- "Speaker" - "Headphones" - ] - -@@ -32,6 +31,8 @@ SectionDevice."MonoSpeaker" { - ] - - Value { -- PlaybackChannels "2" -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId},0" -+ PlaybackChannels 2 - } - } -diff --git a/ucm2/codecs/es8316/Speaker.conf b/ucm2/codecs/es8316/Speaker.conf -index 0e77746..a1e4491 100644 ---- a/ucm2/codecs/es8316/Speaker.conf -+++ b/ucm2/codecs/es8316/Speaker.conf -@@ -15,6 +15,8 @@ SectionDevice."Speaker" { - ] - - Value { -- PlaybackChannels "2" -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId},0" -+ PlaybackChannels 2 - } - } --- -2.24.1 - - -From 2ccb7969e0be03c1a47260dbb34d0c7865c5593f Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Thu, 23 Jan 2020 19:56:19 +0100 -Subject: [PATCH 12/36] DAISY-I2S: added back PCM devices - -Signed-off-by: Jaroslav Kysela ---- - ucm2/DAISY-I2S/HiFi.conf | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/ucm2/DAISY-I2S/HiFi.conf b/ucm2/DAISY-I2S/HiFi.conf -index 02292f2..877f6ff 100644 ---- a/ucm2/DAISY-I2S/HiFi.conf -+++ b/ucm2/DAISY-I2S/HiFi.conf -@@ -27,6 +27,11 @@ SectionDevice."Headphones" { - cset "name='Left Speaker Mixer Left DAC1 Switch' on" - cset "name='Right Speaker Mixer Right DAC1 Switch' on" - ] -+ -+ Value { -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId}" -+ } - } - - SectionDevice."Mic" { -@@ -43,4 +48,9 @@ SectionDevice."Mic" { - cset "name='DMIC1 Left Capture Switch' on" - cset "name='DMIC1 Right Capture Switch' on" - ] -+ -+ Value { -+ CapturePriority 100 -+ CapturePCM "hw:${CardId}" -+ } - } --- -2.24.1 - - -From 1a824b16b8fc26122deec2a6307b8294dc1bc497 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 24 Jan 2020 10:07:14 +0100 -Subject: [PATCH 13/36] DB410c: cleanups and corrections - ---- - ucm2/DB410c/HDMI.conf | 9 +++++--- - ucm2/DB410c/HiFi.conf | 50 ++++++++++++++++++++++++++++++++++--------- - 2 files changed, 46 insertions(+), 13 deletions(-) - -diff --git a/ucm2/DB410c/HDMI.conf b/ucm2/DB410c/HDMI.conf -index d08a50b..fa44132 100644 ---- a/ucm2/DB410c/HDMI.conf -+++ b/ucm2/DB410c/HDMI.conf -@@ -4,12 +4,15 @@ - SectionVerb { - Value { - TQ "HiFi" -- PlaybackPCM "plughw:${CardId},0" -- PlaybackChannels "2" -+ PlaybackChannels 2 - } - } - --SectionDevice."HDMI-stereo" { -+SectionDevice."HDMI" { - # Name "HDMI-stereo" - Comment "HDMI Digital Stereo Output" -+ Value { -+ PlaybackPriority 200 -+ PlaybackPCM "plughw:${CardId}" -+ } - } -diff --git a/ucm2/DB410c/HiFi.conf b/ucm2/DB410c/HiFi.conf -index 848d02f..1b2716a 100644 ---- a/ucm2/DB410c/HiFi.conf -+++ b/ucm2/DB410c/HiFi.conf -@@ -2,14 +2,9 @@ - # Author: Srinivas Kandagatla - - SectionVerb { -- -- # ALSA PCM - Value { -- # ALSA PCM device for HiFi -- PlaybackPCM "plughw:${CardId},1" -- CapturePCM "plughw:${CardId},2" -- PlaybackChannels "2" -- CaptureChannels "2" -+ PlaybackChannels 2 -+ CaptureChannels 2 - } - } - -@@ -33,6 +28,11 @@ SectionDevice."Speaker" { - cset "name='SPK DAC Switch' 0" - cset "name='RX3 MIX1 INP1' ZERO" - ] -+ -+ Value { -+ PlaybackPriority 200 -+ PlaybackPCM "plughw:${CardId},1" -+ } - } - - -@@ -64,6 +64,11 @@ SectionDevice."Headphones" { - cset "name='RX1 MIX1 INP1' ZERO" - cset "name='RX2 MIX1 INP1' ZERO" - ] -+ -+ Value { -+ PlaybackPriority 300 -+ PlaybackPCM "plughw:${CardId},1" -+ } - } - - SectionDevice."Earpiece" { -@@ -73,6 +78,11 @@ SectionDevice."Earpiece" { - "Speaker" - "Headphones" - ] -+ -+ Value { -+ PlaybackPriority 100 -+ PlaybackPCM "plughw:${CardId},1" -+ } - } - - SectionDevice."Handset" { -@@ -90,9 +100,14 @@ SectionDevice."Handset" { - cset "name='ADC2 Volume' 0" - cset "name='DEC1 MUX' ZERO" - ] -+ -+ Value { -+ CapturePriority 400 -+ CapturePCM "plughw:${CardId},2" -+ } - } - --SectionDevice."PrimaryMic" { -+SectionDevice."Mic1" { - Comment "Primary Microphone" - - EnableSequence [ -@@ -105,9 +120,14 @@ SectionDevice."PrimaryMic" { - cset "name='DEC1 MUX' ZERO" - cset "name='ADC1 Volume' 0" - ] -+ -+ Value { -+ CapturePriority 300 -+ CapturePCM "plughw:${CardId},2" -+ } - } - --SectionDevice."SecondaryMic" { -+SectionDevice."Mic2" { - Comment "Secondary Microphone" - - EnableSequence [ -@@ -122,9 +142,14 @@ SectionDevice."SecondaryMic" { - cset "name='ADC2 Volume' 0" - cset "name='ADC2 MUX' ZERO" - ] -+ -+ Value { -+ CapturePriority 200 -+ CapturePCM "plughw:${CardId},2" -+ } - } - --SectionDevice."DigitalMic" { -+SectionDevice."Mic3" { - Comment "Digital Microphone" - - EnableSequence [ -@@ -135,4 +160,9 @@ SectionDevice."DigitalMic" { - DisableSequence [ - cset "name='DEC1 MUX' ZERO" - ] -+ -+ Value { -+ CapturePriority 100 -+ CapturePCM "plughw:${CardId},2" -+ } - } --- -2.24.1 - - -From 86a9fad7760fa40282821a3d7818ac881dd2f92d Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 24 Jan 2020 10:14:41 +0100 -Subject: [PATCH 14/36] DB820c: cleanups and corrections - -Signed-off-by: Jaroslav Kysela ---- - ucm2/DB820c/HDMI.conf | 10 ++++++---- - ucm2/DB820c/HiFi.conf | 8 +++++--- - 2 files changed, 11 insertions(+), 7 deletions(-) - -diff --git a/ucm2/DB820c/HDMI.conf b/ucm2/DB820c/HDMI.conf -index 76c0e92..c0d40f6 100644 ---- a/ucm2/DB820c/HDMI.conf -+++ b/ucm2/DB820c/HDMI.conf -@@ -8,14 +8,14 @@ SectionVerb { - - DisableSequence [ - cset "name='HDMI Mixer MultiMedia1' 0" -+ ] -+ - Value { - TQ "HiFi" -- PlaybackPCM "plughw:${CardId},0" - } - } - --SectionDevice."HDMI-stereo" { -- #Name "HDMI-stereo" -+SectionDevice."HDMI" { - Comment "HDMI Digital Stereo Output" - - EnableSequence [ -@@ -27,6 +27,8 @@ SectionDevice."HDMI-stereo" { - ] - - Value { -- PlaybackChannels "2" -+ PlaybackPriority 200 -+ PlaybackPCM "plughw:${CardId}" -+ PlaybackChannels 2 - } - } -diff --git a/ucm2/DB820c/HiFi.conf b/ucm2/DB820c/HiFi.conf -index fa7770e..501c263 100644 ---- a/ucm2/DB820c/HiFi.conf -+++ b/ucm2/DB820c/HiFi.conf -@@ -67,12 +67,13 @@ SectionDevice."Headphones" { - ] - - Value { -+ PlaybackPriority 100 - PlaybackPCM "plughw:${CardId},1" -- PlaybackChannels "2" -+ PlaybackChannels 2 - } - } - --SectionDevice."HandsetMic" { -+SectionDevice."Headset" { - Comment "Headset Microphone" - - EnableSequence [ -@@ -93,7 +94,8 @@ SectionDevice."HandsetMic" { - ] - - Value { -+ CapturePriority 100 - CapturePCM "plughw:${CardId},2" -- CaptureChannels "1" -+ CaptureChannels 1 - } - } --- -2.24.1 - - -From 42d0227c417e732ac76328e4168d885b07211f92 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 24 Jan 2020 10:15:58 +0100 -Subject: [PATCH 15/36] Dell-WD15-Dock: cleaups and corrections - -Signed-off-by: Jaroslav Kysela ---- - ucm2/Dell-WD15-Dock/Dell-WD15-Dock.conf | 6 ----- - ucm2/Dell-WD15-Dock/HiFi.conf | 26 ---------------------- - ucm2/USB-Audio/Dell-WD15-Dock-HiFi.conf | 29 +++++++++++++++++++++++++ - ucm2/USB-Audio/Dell-WD15-Dock.conf | 6 +++++ - 4 files changed, 35 insertions(+), 32 deletions(-) - delete mode 100644 ucm2/Dell-WD15-Dock/Dell-WD15-Dock.conf - delete mode 100644 ucm2/Dell-WD15-Dock/HiFi.conf - create mode 100644 ucm2/USB-Audio/Dell-WD15-Dock-HiFi.conf - create mode 100644 ucm2/USB-Audio/Dell-WD15-Dock.conf - -diff --git a/ucm2/Dell-WD15-Dock/Dell-WD15-Dock.conf b/ucm2/Dell-WD15-Dock/Dell-WD15-Dock.conf -deleted file mode 100644 -index 7b96a54..0000000 ---- a/ucm2/Dell-WD15-Dock/Dell-WD15-Dock.conf -+++ /dev/null -@@ -1,6 +0,0 @@ --Syntax 2 --Comment "USB-audio on Dell WD15 docking station" --SectionUseCase."HiFi" { -- File "HiFi.conf" -- Comment "Default" --} -diff --git a/ucm2/Dell-WD15-Dock/HiFi.conf b/ucm2/Dell-WD15-Dock/HiFi.conf -deleted file mode 100644 -index 3b02f81..0000000 ---- a/ucm2/Dell-WD15-Dock/HiFi.conf -+++ /dev/null -@@ -1,26 +0,0 @@ --SectionDevice."Headphones" { -- Comment "Headphones" -- -- Value { -- PlaybackChannels "2" -- PlaybackPCM "hw:${CardId},0" -- } --} -- --SectionDevice."LineOut" { -- Comment "Line Out" -- -- Value { -- PlaybackChannels "2" -- PlaybackPCM "hw:${CardId},1" -- } --} -- --SectionDevice."Mic" { -- Comment "Microphone" -- -- Value { -- CaptureChannels "2" -- CapturePCM "hw:${CardId},0" -- } --} -diff --git a/ucm2/USB-Audio/Dell-WD15-Dock-HiFi.conf b/ucm2/USB-Audio/Dell-WD15-Dock-HiFi.conf -new file mode 100644 -index 0000000..37b7e0d ---- /dev/null -+++ b/ucm2/USB-Audio/Dell-WD15-Dock-HiFi.conf -@@ -0,0 +1,29 @@ -+SectionDevice."Headphones" { -+ Comment "Headphones" -+ -+ Value { -+ PlaybackPriority 100 -+ PlaybackChannels 2 -+ PlaybackPCM "hw:${CardId}" -+ } -+} -+ -+SectionDevice."Line" { -+ Comment "Line Out" -+ -+ Value { -+ PlaybackPriority 200 -+ PlaybackChannels 2 -+ PlaybackPCM "hw:${CardId},1" -+ } -+} -+ -+SectionDevice."Mic" { -+ Comment "Microphone" -+ -+ Value { -+ CapturePriority 100 -+ CaptureChannels 2 -+ CapturePCM "hw:${CardId}" -+ } -+} -diff --git a/ucm2/USB-Audio/Dell-WD15-Dock.conf b/ucm2/USB-Audio/Dell-WD15-Dock.conf -new file mode 100644 -index 0000000..1fbac9e ---- /dev/null -+++ b/ucm2/USB-Audio/Dell-WD15-Dock.conf -@@ -0,0 +1,6 @@ -+Syntax 2 -+Comment "USB-audio on Dell WD15 docking station" -+SectionUseCase."HiFi" { -+ File "Dell-WD15-Dock-HiFi.conf" -+ Comment "Default" -+} --- -2.24.1 - - -From dfad18452427460bf50c55a2c06f9460b2db2123 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 24 Jan 2020 11:06:29 +0100 -Subject: [PATCH 16/36] HDA-Intel/HiFi-dual: fixes and corrections - -Signed-off-by: Jaroslav Kysela ---- - ucm2/HDA Intel PCH/HDAudio-DualCodecs.conf | 6 - - .../HDAudio-Gigabyte-ALC1220DualCodecs.conf | 1 - - .../HDAudio-Lenovo-DualCodecs.conf | 1 - - ucm2/HDA Intel PCH/HiFi-dual.conf | 144 ------------------ - ucm2/HDA-Intel/HDAudio-DualCodecs.conf | 6 + - .../HDAudio-Gigabyte-ALC1220DualCodecs.conf | 1 + - ucm2/HDA-Intel/HDAudio-Lenovo-DualCodecs.conf | 1 + - ucm2/HDA-Intel/HiFi-dual.conf | 118 ++++++++++++++ - 8 files changed, 126 insertions(+), 152 deletions(-) - delete mode 100644 ucm2/HDA Intel PCH/HDAudio-DualCodecs.conf - delete mode 120000 ucm2/HDA Intel PCH/HDAudio-Gigabyte-ALC1220DualCodecs.conf - delete mode 120000 ucm2/HDA Intel PCH/HDAudio-Lenovo-DualCodecs.conf - delete mode 100644 ucm2/HDA Intel PCH/HiFi-dual.conf - create mode 100644 ucm2/HDA-Intel/HDAudio-DualCodecs.conf - create mode 120000 ucm2/HDA-Intel/HDAudio-Gigabyte-ALC1220DualCodecs.conf - create mode 120000 ucm2/HDA-Intel/HDAudio-Lenovo-DualCodecs.conf - create mode 100644 ucm2/HDA-Intel/HiFi-dual.conf - -diff --git a/ucm2/HDA Intel PCH/HDAudio-DualCodecs.conf b/ucm2/HDA Intel PCH/HDAudio-DualCodecs.conf -deleted file mode 100644 -index 8aaabd0..0000000 ---- a/ucm2/HDA Intel PCH/HDAudio-DualCodecs.conf -+++ /dev/null -@@ -1,6 +0,0 @@ --Syntax 2 --Comment "HDAudio with dual HD-audio codecs" --SectionUseCase."HiFi" { -- File "HiFi-dual.conf" -- Comment "Default" --} -diff --git a/ucm2/HDA Intel PCH/HDAudio-Gigabyte-ALC1220DualCodecs.conf b/ucm2/HDA Intel PCH/HDAudio-Gigabyte-ALC1220DualCodecs.conf -deleted file mode 120000 -index 89801aa..0000000 ---- a/ucm2/HDA Intel PCH/HDAudio-Gigabyte-ALC1220DualCodecs.conf -+++ /dev/null -@@ -1 +0,0 @@ --HDAudio-DualCodecs.conf -\ No newline at end of file -diff --git a/ucm2/HDA Intel PCH/HDAudio-Lenovo-DualCodecs.conf b/ucm2/HDA Intel PCH/HDAudio-Lenovo-DualCodecs.conf -deleted file mode 120000 -index 89801aa..0000000 ---- a/ucm2/HDA Intel PCH/HDAudio-Lenovo-DualCodecs.conf -+++ /dev/null -@@ -1 +0,0 @@ --HDAudio-DualCodecs.conf -\ No newline at end of file -diff --git a/ucm2/HDA Intel PCH/HiFi-dual.conf b/ucm2/HDA Intel PCH/HiFi-dual.conf -deleted file mode 100644 -index 63b3fe6..0000000 ---- a/ucm2/HDA Intel PCH/HiFi-dual.conf -+++ /dev/null -@@ -1,144 +0,0 @@ --SectionVerb { -- Value { -- TQ "HiFi" -- } -- -- EnableSequence [ -- cset "name='Front Playback Volume' 100%" -- cset "name='Front Playback Switch' on" -- cset "name='Rear-Panel Capture Volume' 100%" -- cset "name='Rear-Panel Capture Switch' on" -- ] -- -- DisableSequence [ -- cset "name='Front Playback Volume' 0" -- cset "name='Front Playback Switch' off" -- cset "name='Rear-Panel Capture Volume' 0" -- cset "name='Rear-Panel Capture Switch' off" -- ] --} -- --SectionDevice."Speaker" { -- Comment "Speaker" -- -- Value { -- PlaybackChannels "2" -- PlaybackPCM "hw:${CardId},4" -- } -- -- ConflictingDevice [ -- "Headphone" -- ] -- -- EnableSequence [ -- cset "name='Speaker Playback Switch' on" -- cset "name='Speaker Playback Volume' 100%" -- ] -- -- DisableSequence [ -- cset "name='Speaker Playback Volume' 0" -- cset "name='Speaker Playback Switch' off" -- ] --} -- --SectionDevice."LineOut" { -- Comment "Line Out" -- -- Value { -- PlaybackChannels "2" -- PlaybackPCM "hw:${CardId},0" -- JackControl "Line Out Jack" -- JackHWMute "Speaker" -- } --} -- --SectionDevice."Headphones" { -- Comment "Headphones" -- -- Value { -- PlaybackChannels "2" -- PlaybackPCM "hw:${CardId},4" -- JackControl "Front Headphone Jack" -- JackHWMute "Speaker" -- } -- -- ConflictingDevice [ -- "Speaker" -- ] -- -- EnableSequence [ -- cset "name='Headphone Playback Switch' on" -- cset "name='Headphone Playback Volume' 100%" -- ] -- -- DisableSequence [ -- cset "name='Headphone Playback Volume' 0" -- cset "name='Headphone Playback Switch' off" -- ] --} -- --SectionDevice."LineIn" { -- Comment "Rear Line In" -- -- Value { -- CaptureChannels "2" -- CapturePCM "hw:${CardId},0" -- JackControl "Line Jack" -- } -- -- ConflictingDevice [ -- "RearMic" -- ] -- -- EnableSequence [ -- cset "name='Input Source' Line" -- If.0 { -- Condition { -- Type ControlExists -- Control "name='Line Boost Volume'" -- } -- True { -- cset "name='Line Boost Volume' 3" -- } -- } -- ] --} -- --SectionDevice."RearMic" { -- Comment "Rear Microphone" -- -- Value { -- CaptureChannels "2" -- CapturePCM "hw:${CardId},0" -- # CapturePriority "150" -- JackHWMute "LineIn" -- } -- -- ConflictingDevice [ -- "LineIn" -- ] -- -- EnableSequence [ -- cset "name='Input Source' Rear Mic" -- ] --} -- --SectionDevice."FrontMic" { -- Comment "Front Microphone" -- -- Value { -- CaptureChannels "2" -- CapturePCM "hw:${CardId},4" -- JackControl "Front Mic Jack" -- } -- -- EnableSequence [ -- cset "name='Front-Panel Capture Volume' 100%" -- cset "name='Front-Panel Capture Switch' on" -- ] -- -- DisableSequence [ -- cset "name='Front-Panel Capture Volume' 0" -- cset "name='Front-Panel Capture Switch' off" -- ] --} -diff --git a/ucm2/HDA-Intel/HDAudio-DualCodecs.conf b/ucm2/HDA-Intel/HDAudio-DualCodecs.conf -new file mode 100644 -index 0000000..8aaabd0 ---- /dev/null -+++ b/ucm2/HDA-Intel/HDAudio-DualCodecs.conf -@@ -0,0 +1,6 @@ -+Syntax 2 -+Comment "HDAudio with dual HD-audio codecs" -+SectionUseCase."HiFi" { -+ File "HiFi-dual.conf" -+ Comment "Default" -+} -diff --git a/ucm2/HDA-Intel/HDAudio-Gigabyte-ALC1220DualCodecs.conf b/ucm2/HDA-Intel/HDAudio-Gigabyte-ALC1220DualCodecs.conf -new file mode 120000 -index 0000000..89801aa ---- /dev/null -+++ b/ucm2/HDA-Intel/HDAudio-Gigabyte-ALC1220DualCodecs.conf -@@ -0,0 +1 @@ -+HDAudio-DualCodecs.conf -\ No newline at end of file -diff --git a/ucm2/HDA-Intel/HDAudio-Lenovo-DualCodecs.conf b/ucm2/HDA-Intel/HDAudio-Lenovo-DualCodecs.conf -new file mode 120000 -index 0000000..89801aa ---- /dev/null -+++ b/ucm2/HDA-Intel/HDAudio-Lenovo-DualCodecs.conf -@@ -0,0 +1 @@ -+HDAudio-DualCodecs.conf -\ No newline at end of file -diff --git a/ucm2/HDA-Intel/HiFi-dual.conf b/ucm2/HDA-Intel/HiFi-dual.conf -new file mode 100644 -index 0000000..846c6db ---- /dev/null -+++ b/ucm2/HDA-Intel/HiFi-dual.conf -@@ -0,0 +1,118 @@ -+SectionVerb { -+ Value { -+ TQ "HiFi" -+ PlaybackChannels 2 -+ CaptureChannels 2 -+ } -+ -+ EnableSequence [ -+ cset "name='Front Playback Volume' 100%" -+ cset "name='Front Playback Switch' on" -+ cset "name='Rear-Panel Capture Volume' 100%" -+ cset "name='Rear-Panel Capture Switch' on" -+ ] -+ -+ DisableSequence [ -+ cset "name='Front Playback Volume' 0" -+ cset "name='Front Playback Switch' off" -+ cset "name='Rear-Panel Capture Volume' 0" -+ cset "name='Rear-Panel Capture Switch' off" -+ ] -+} -+ -+SectionDevice."Speaker" { -+ Comment "Speaker" -+ -+ Value { -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId},4" -+ PlaybackMixerElem "Speaker" -+ } -+ -+ ConflictingDevice [ -+ "Headphones" -+ ] -+} -+ -+SectionDevice."Line1" { -+ Comment "Line Out" -+ -+ Value { -+ PlaybackPriority 200 -+ PlaybackPCM "hw:${CardId}" -+ JackControl "Line Out Jack" -+ JackHWMute "Speaker" -+ } -+} -+ -+SectionDevice."Headphones" { -+ Comment "Headphones" -+ -+ Value { -+ PlaybackPriority 300 -+ PlaybackPCM "hw:${CardId},4" -+ PlaybackMixerElem "Headphone" -+ JackControl "Front Headphone Jack" -+ JackHWMute "Speaker" -+ } -+ -+ ConflictingDevice [ -+ "Speaker" -+ ] -+} -+ -+SectionDevice."Line2" { -+ Comment "Rear Line In" -+ -+ Value { -+ CapturePriority 200 -+ CapturePCM "hw:${CardId}" -+ JackControl "Line Jack" -+ } -+ -+ ConflictingDevice [ -+ "Mic2" -+ ] -+ -+ EnableSequence [ -+ cset "name='Input Source' Line" -+ If.0 { -+ Condition { -+ Type ControlExists -+ Control "name='Line Boost Volume'" -+ } -+ True { -+ cset "name='Line Boost Volume' 3" -+ } -+ } -+ ] -+} -+ -+SectionDevice."Mic2" { -+ Comment "Rear Microphone" -+ -+ Value { -+ CapturePriority 300 -+ CapturePCM "hw:${CardId}" -+ JackHWMute "Line2" -+ } -+ -+ ConflictingDevice [ -+ "Line2" -+ ] -+ -+ EnableSequence [ -+ cset "name='Input Source' Rear Mic" -+ ] -+} -+ -+SectionDevice."Mic1" { -+ Comment "Front Microphone" -+ -+ Value { -+ CapturePriority 100 -+ CapturePCM "hw:${CardId},4" -+ CaptureMixerElem "Front-Panel" -+ JackControl "Front Mic Jack" -+ } -+} --- -2.24.1 - - -From ffae896c7e958198b795c9680e4e4fb64b88c8ea Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 24 Jan 2020 14:35:10 +0100 -Subject: [PATCH 17/36] cht-bsw-rt5672: fixes and corrections - -Signed-off-by: Jaroslav Kysela ---- - ucm2/cht-bsw-rt5672/HiFi-stereo-dmic2.conf | 9 ++++----- - ucm2/cht-bsw-rt5672/HiFi.conf | 5 ----- - ucm2/codecs/rt5672/DMIC1.conf | 8 +++++--- - ucm2/codecs/rt5672/DMIC2.conf | 8 +++++--- - ucm2/codecs/rt5672/HeadPhones.conf | 8 +++++--- - ucm2/codecs/rt5672/HeadsetMic.conf | 10 ++++++---- - ucm2/codecs/rt5672/MonoSpeaker.conf | 8 +++++--- - ucm2/codecs/rt5672/Speaker.conf | 10 ++++++---- - 8 files changed, 36 insertions(+), 30 deletions(-) - -diff --git a/ucm2/cht-bsw-rt5672/HiFi-stereo-dmic2.conf b/ucm2/cht-bsw-rt5672/HiFi-stereo-dmic2.conf -index 2916490..82c976b 100644 ---- a/ucm2/cht-bsw-rt5672/HiFi-stereo-dmic2.conf -+++ b/ucm2/cht-bsw-rt5672/HiFi-stereo-dmic2.conf -@@ -9,15 +9,14 @@ SectionVerb { - DisableSequence [ - - ] -- -- Value { -- PlaybackPCM "hw:${CardId}" -- CapturePCM "hw:${CardId}" -- } - } - - -+RenameDevice."Speaker1" "Speaker" -+RemoveDevice."Speaker2" "Speaker2" - - - -+RenameDevice."Mic2" "Mic" -+RemoveDevice."Mic1" "Mic1" - -diff --git a/ucm2/cht-bsw-rt5672/HiFi.conf b/ucm2/cht-bsw-rt5672/HiFi.conf -index 18c6932..9a64cc3 100644 ---- a/ucm2/cht-bsw-rt5672/HiFi.conf -+++ b/ucm2/cht-bsw-rt5672/HiFi.conf -@@ -9,11 +9,6 @@ SectionVerb { - DisableSequence [ - - ] -- -- Value { -- PlaybackPCM "hw:${CardId}" -- CapturePCM "hw:${CardId}" -- } - } - - -diff --git a/ucm2/codecs/rt5672/DMIC1.conf b/ucm2/codecs/rt5672/DMIC1.conf -index b3da627..73983af 100644 ---- a/ucm2/codecs/rt5672/DMIC1.conf -+++ b/ucm2/codecs/rt5672/DMIC1.conf -@@ -1,9 +1,9 @@ --SectionDevice."DigitalMic-DMIC1" { -+SectionDevice."Mic1" { - Comment "Internal Digital Microphone on DMIC1" - - ConflictingDevice [ -- "DigitalMic-DMIC2" -- "HeadsetMic" -+ "Mic2" -+ "Headset" - ] - - EnableSequence [ -@@ -21,6 +21,8 @@ SectionDevice."DigitalMic-DMIC1" { - ] - - Value { -+ CapturePriority 100 -+ CapturePCM "hw:${CardId}" - CaptureChannels 2 - } - } -diff --git a/ucm2/codecs/rt5672/DMIC2.conf b/ucm2/codecs/rt5672/DMIC2.conf -index 38fe015..751c95c 100644 ---- a/ucm2/codecs/rt5672/DMIC2.conf -+++ b/ucm2/codecs/rt5672/DMIC2.conf -@@ -1,9 +1,9 @@ --SectionDevice."DigitalMic-DMIC2" { -+SectionDevice."Mic2" { - Comment "Internal Digital Microphone on DMIC2" - - ConflictingDevice [ -- "DigitalMic-DMIC1" -- "HeadsetMic" -+ "Mic1" -+ "Headset" - ] - - EnableSequence [ -@@ -21,6 +21,8 @@ SectionDevice."DigitalMic-DMIC2" { - ] - - Value { -+ CapturePriority 200 -+ CapturePCM "hw:${CardId}" - CaptureChannels 2 - } - } -diff --git a/ucm2/codecs/rt5672/HeadPhones.conf b/ucm2/codecs/rt5672/HeadPhones.conf -index 350fb2b..0542f77 100644 ---- a/ucm2/codecs/rt5672/HeadPhones.conf -+++ b/ucm2/codecs/rt5672/HeadPhones.conf -@@ -2,8 +2,8 @@ SectionDevice."Headphones" { - Comment "Headphones" - - ConflictingDevice [ -- "Speaker" -- "MonoSpeaker" -+ "Speaker1" -+ "Speaker2" - ] - - EnableSequence [ -@@ -15,7 +15,9 @@ SectionDevice."Headphones" { - ] - - Value { -- PlaybackChannels "2" -+ PlaybackPriority 300 -+ PlaybackPCM "hw:${CardId}" -+ PlaybackChannels 2 - JackControl "Headphone Jack" - } - } -diff --git a/ucm2/codecs/rt5672/HeadsetMic.conf b/ucm2/codecs/rt5672/HeadsetMic.conf -index fd02cb3..f407579 100644 ---- a/ucm2/codecs/rt5672/HeadsetMic.conf -+++ b/ucm2/codecs/rt5672/HeadsetMic.conf -@@ -1,9 +1,9 @@ --SectionDevice."HeadsetMic" { -+SectionDevice."Headset" { - Comment "Headset Microphone" - - ConflictingDevice [ -- "DigitalMic-DMIC1" -- "DigitalMic-DMIC2" -+ "Mic1" -+ "Mic2" - ] - - EnableSequence [ -@@ -30,7 +30,9 @@ SectionDevice."HeadsetMic" { - ] - - Value { -- CaptureChannels "2" -+ CapturePriority 300 -+ CapturePCM "hw:${CardId}" -+ CaptureChannels 2 - JackControl "Headset Mic Jack" - } - } -diff --git a/ucm2/codecs/rt5672/MonoSpeaker.conf b/ucm2/codecs/rt5672/MonoSpeaker.conf -index 6308ad9..0849c67 100644 ---- a/ucm2/codecs/rt5672/MonoSpeaker.conf -+++ b/ucm2/codecs/rt5672/MonoSpeaker.conf -@@ -1,8 +1,8 @@ --SectionDevice."MonoSpeaker" { -+SectionDevice."Speaker2" { - Comment "Mono Speaker" - - ConflictingDevice [ -- "Speaker" -+ "Speaker1" - "Headphones" - ] - -@@ -19,6 +19,8 @@ SectionDevice."MonoSpeaker" { - ] - - Value { -- PlaybackChannels "2" -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId}" -+ PlaybackChannels 2 - } - } -diff --git a/ucm2/codecs/rt5672/Speaker.conf b/ucm2/codecs/rt5672/Speaker.conf -index e4391cc..44e73aa 100644 ---- a/ucm2/codecs/rt5672/Speaker.conf -+++ b/ucm2/codecs/rt5672/Speaker.conf -@@ -1,8 +1,8 @@ --SectionDevice."Speaker" { -- Comment "Speakers" -+SectionDevice."Speaker1" { -+ Comment "Stereo Speakers" - - ConflictingDevice [ -- "MonoSpeaker" -+ "Speaker2" - "Headphones" - ] - -@@ -15,6 +15,8 @@ SectionDevice."Speaker" { - ] - - Value { -- PlaybackChannels "2" -+ PlaybackPriority 200 -+ PlaybackPCM "hw:${CardId}" -+ PlaybackChannels 2 - } - } --- -2.24.1 - - -From 54f0ed010f7353b37a7b0eee109537675323b9d8 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 24 Jan 2020 14:39:26 +0100 -Subject: [PATCH 18/36] chtnau8824: fixes and corrections - -Signed-off-by: Jaroslav Kysela ---- - ucm2/chtnau8824/HiFi-mono.conf | 3 --- - ucm2/chtnau8824/HiFi.conf | 8 -------- - ucm2/codecs/nau8824/HeadPhones.conf | 5 +++-- - ucm2/codecs/nau8824/HeadsetMic.conf | 8 +++++--- - ucm2/codecs/nau8824/InternalMic.conf | 9 +++++---- - ucm2/codecs/nau8824/MonoSpeaker.conf | 7 ++++--- - ucm2/codecs/nau8824/Speaker.conf | 5 +++-- - 7 files changed, 20 insertions(+), 25 deletions(-) - -diff --git a/ucm2/chtnau8824/HiFi-mono.conf b/ucm2/chtnau8824/HiFi-mono.conf -index 3433d03..26d6a56 100644 ---- a/ucm2/chtnau8824/HiFi-mono.conf -+++ b/ucm2/chtnau8824/HiFi-mono.conf -@@ -3,9 +3,6 @@ SectionVerb { - - Value { - TQ "HiFi" -- # ALSA PCM device for HiFi -- PlaybackPCM "hw:${CardId}" -- CapturePCM "hw:${CardId}" - } - - EnableSequence [ -diff --git a/ucm2/chtnau8824/HiFi.conf b/ucm2/chtnau8824/HiFi.conf -index 9f7ac74..fd8b741 100644 ---- a/ucm2/chtnau8824/HiFi.conf -+++ b/ucm2/chtnau8824/HiFi.conf -@@ -1,13 +1,5 @@ - - SectionVerb { -- -- Value { -- TQ "HiFi" -- # ALSA PCM device for HiFi -- PlaybackPCM "hw:${CardId}" -- CapturePCM "hw:${CardId}" -- } -- - EnableSequence [ - - -diff --git a/ucm2/codecs/nau8824/HeadPhones.conf b/ucm2/codecs/nau8824/HeadPhones.conf -index f35f4e2..6623365 100644 ---- a/ucm2/codecs/nau8824/HeadPhones.conf -+++ b/ucm2/codecs/nau8824/HeadPhones.conf -@@ -2,12 +2,13 @@ SectionDevice."Headphones" { - Comment "Headphones" - - Value { -- PlaybackChannels "2" -+ PlaybackPriority 200 -+ PlaybackPCM "hw:${CardId}" -+ PlaybackChannels 2 - JackControl "Headphone Jack" - } - - ConflictingDevice [ -- "MonoSpeaker" - "Speaker" - ] - -diff --git a/ucm2/codecs/nau8824/HeadsetMic.conf b/ucm2/codecs/nau8824/HeadsetMic.conf -index bc17f9f..7381638 100644 ---- a/ucm2/codecs/nau8824/HeadsetMic.conf -+++ b/ucm2/codecs/nau8824/HeadsetMic.conf -@@ -1,13 +1,15 @@ --SectionDevice."HeadsetMic" { -+SectionDevice."Headset" { - Comment "Headset Microphone" - - Value { -- CaptureChannels "2" -+ CapturePriority 300 -+ CapturePCM "hw:${CardId}" -+ CaptureChannels 2 - JackControl "Headset Mic Jack" - } - - ConflictingDevice [ -- "InternalMic" -+ "Mic" - ] - - EnableSequence [ -diff --git a/ucm2/codecs/nau8824/InternalMic.conf b/ucm2/codecs/nau8824/InternalMic.conf -index 3793d64..731a261 100644 ---- a/ucm2/codecs/nau8824/InternalMic.conf -+++ b/ucm2/codecs/nau8824/InternalMic.conf -@@ -1,13 +1,14 @@ --SectionDevice."InternalMic" { -+SectionDevice."Mic" { - Comment "Internal Microphone" - - Value { -- CaptureChannels "2" -- CapturePriority "150" -+ CapturePriority 200 -+ CapturePCM "hw:${CardId}" -+ CaptureChannels 2 - } - - ConflictingDevice [ -- "HeadsetMic" -+ "Headset" - ] - - EnableSequence [ -diff --git a/ucm2/codecs/nau8824/MonoSpeaker.conf b/ucm2/codecs/nau8824/MonoSpeaker.conf -index 5321c8a..b02a22c 100644 ---- a/ucm2/codecs/nau8824/MonoSpeaker.conf -+++ b/ucm2/codecs/nau8824/MonoSpeaker.conf -@@ -1,12 +1,13 @@ --SectionDevice."MonoSpeaker" { -+SectionDevice."Speaker" { - Comment "Mono Speaker" - - Value { -- PlaybackChannels "2" -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId}" -+ PlaybackChannels 2 - } - - ConflictingDevice [ -- "Speaker" - "Headphones" - ] - -diff --git a/ucm2/codecs/nau8824/Speaker.conf b/ucm2/codecs/nau8824/Speaker.conf -index 474c373..3658795 100644 ---- a/ucm2/codecs/nau8824/Speaker.conf -+++ b/ucm2/codecs/nau8824/Speaker.conf -@@ -2,11 +2,12 @@ SectionDevice."Speaker" { - Comment "Speaker" - - Value { -- PlaybackChannels "2" -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId}" -+ PlaybackChannels 2 - } - - ConflictingDevice [ -- "MonoSpeaker" - "Headphones" - ] - --- -2.24.1 - - -From ed9918179e37e091a861cea57022d45ff50b2bca Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Mon, 27 Jan 2020 16:01:21 +0100 -Subject: [PATCH 19/36] skylake-rt286: fixes and corrections - -Signed-off-by: Jaroslav Kysela ---- - ucm2/skylake-rt286/Hdmi1.conf | 7 +++--- - ucm2/skylake-rt286/Hdmi2.conf | 7 +++--- - ucm2/skylake-rt286/HiFi.conf | 36 ++++++++++++--------------- - ucm2/skylake-rt286/skylake-rt286.conf | 14 ++--------- - 4 files changed, 24 insertions(+), 40 deletions(-) - -diff --git a/ucm2/skylake-rt286/Hdmi1.conf b/ucm2/skylake-rt286/Hdmi1.conf -index 975fd39..5a56943 100644 ---- a/ucm2/skylake-rt286/Hdmi1.conf -+++ b/ucm2/skylake-rt286/Hdmi1.conf -@@ -1,16 +1,15 @@ - # Usecase for device HDMI1/Display Port stereo playback on Intel SKYLAKE/KABYLAKE platforms - # For Audio in I2S mode - --SectionDevice."Hdmi1" { -+SectionDevice."HDMI1" { - Comment "HDMI/Display Port 1 Stereo" - - Value { -+ PlaybackPriority 300 - PlaybackPCM "hw:${CardId},4" -- PlaybackChannels "2" -- PlaybackPriority "3" - If.1 { - Condition { -- ControlExists -+ Type ControlExists - Control "iface=CARD,name='HDMI/DP,pcm=4 Jack'" - } - True { -diff --git a/ucm2/skylake-rt286/Hdmi2.conf b/ucm2/skylake-rt286/Hdmi2.conf -index d6ca62f..d2780b6 100644 ---- a/ucm2/skylake-rt286/Hdmi2.conf -+++ b/ucm2/skylake-rt286/Hdmi2.conf -@@ -1,16 +1,15 @@ - # Usecase for device HDMI2/Display Port stereo playback on Intel SKYLAKE/KABYLAKE platforms - # For Audio in I2S mode - --SectionDevice."Hdmi2" { -+SectionDevice."HDMI2" { - Comment "HDMI/Display Port 2 Stereo" - - Value { -+ PlaybackPriority 400 - PlaybackPCM "hw:${CardId},5" -- PlaybackChannels "2" -- PlaybackPriority "4" - If.1 { - Condition { -- ControlExists -+ Type ControlExists - Control "iface=CARD,name='HDMI/DP,pcm=5 Jack'" - } - True { -diff --git a/ucm2/skylake-rt286/HiFi.conf b/ucm2/skylake-rt286/HiFi.conf -index 489170f..9e94a1b 100644 ---- a/ucm2/skylake-rt286/HiFi.conf -+++ b/ucm2/skylake-rt286/HiFi.conf -@@ -2,15 +2,12 @@ - # For Audio in I2S mode on Intel SKYLAKE/KABYLAKE platforms - - SectionVerb { -- - EnableSequence [ - cset "name='media0_out mo dmic01_hifi_in mi Switch' 1" - ] - - Value { - TQ "HiFi" -- CapturePCM "hw:${CardId},1" -- PlaybackPCM "hw:${CardId},0" - } - } - -@@ -20,6 +17,7 @@ SectionDevice."Headphones" { - ConflictingDevice [ - "Speaker" - ] -+ - EnableSequence [ - cset "name='HPO L Switch' 1" - cset "name='HPO R Switch' 1" -@@ -27,11 +25,9 @@ SectionDevice."Headphones" { - cset "name='Speaker Playback Switch' 0,0" - ] - -- DisableSequence [ -- ] - Value { -- PlaybackChannels "2" -- PlaybackPriority "1" -+ PlaybackPriority 200 -+ PlaybackPCM "hw:${CardId}" - JackControl "Headphone Jack" - JackHWMute "Speaker" - } -@@ -43,6 +39,7 @@ SectionDevice."Speaker" { - ConflictingDevice [ - "Headphones" - ] -+ - EnableSequence [ - cset "name='SPO Switch' 1" - cset "name='Speaker Playback Switch' 1,1" -@@ -51,20 +48,18 @@ SectionDevice."Speaker" { - cset "name='HPO R Switch' 0" - ] - -- DisableSequence [ -- ] - Value { -- PlaybackChannels "2" -- PlaybackPriority "1" -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId}" - JackHWMute "Headphones" - } - } - - SectionDevice."Headset" { -- Comment "Headset Mic" -+ Comment "Headset Microphone" - - ConflictingDevice [ -- "dmiccap" -+ "Mic" - ] - EnableSequence [ - cset "name='media0_out mo codec0_in mi Switch' 1" -@@ -79,15 +74,14 @@ SectionDevice."Headset" { - cset "name='media0_out mo codec0_in mi Switch' 0" - ] - Value { -- CaptureChannels "2" -- CapturePriority "2" -+ CapturePriority 200 -+ CapturePCM "hw:${CardId},1" - JackControl "Mic Jack" - } - } - -- --SectionDevice."dmiccap" { -- Comment "DMIC Stereo" -+SectionDevice."Mic" { -+ Comment "Digital Stereo Microphone" - - ConflictingDevice [ - "Headset" -@@ -110,8 +104,10 @@ SectionDevice."dmiccap" { - cset "name='ADC 0 Mux' 2" - ] - Value { -- CaptureChannels "2" -- CapturePriority "2" -+ CapturePriority 100 -+ CapturePCM "hw:${CardId},1" - } - } - -+ -+ -diff --git a/ucm2/skylake-rt286/skylake-rt286.conf b/ucm2/skylake-rt286/skylake-rt286.conf -index efb8a20..4ea5777 100644 ---- a/ucm2/skylake-rt286/skylake-rt286.conf -+++ b/ucm2/skylake-rt286/skylake-rt286.conf -@@ -8,19 +8,9 @@ SectionUseCase."HiFi" { - Comment "Play and record HiFi quality Music" - } - --SectionUseCase."Hdmi1" { -- File "Hdmi1.conf" -- Comment "Play on Hdmi/DP 1" --} -- --SectionUseCase."Hdmi2" { -- File "Hdmi2.conf" -- Comment "Play on Hdmi/DP 2" --} -- - ValueDefaults { -- CaptureChannels "2" -- CapturePriority "2" -+ PlaybackChannels 2 -+ CaptureChannels 2 - } - - SectionDefaults [ --- -2.24.1 - - -From 35c2bba4906a278d876503855c55c2e7f9247616 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Mon, 27 Jan 2020 16:06:25 +0100 -Subject: [PATCH 20/36] SDP4430: corrections and fixes - -Signed-off-by: Jaroslav Kysela ---- - ucm2/SDP4430/FMAnalog.conf | 11 +++---- - ucm2/SDP4430/HiFiLP.conf | 7 ++-- - ucm2/SDP4430/Record.conf | 5 ++- - ucm2/SDP4430/SDP4430.conf | 2 +- - ucm2/SDP4430/Voice.conf | 6 ++-- - ucm2/SDP4430/VoiceAll.conf | 63 ------------------------------------ - ucm2/SDP4430/VoiceCall.conf | 64 +++++++++++++++++++++++++++++++++++++ - 7 files changed, 82 insertions(+), 76 deletions(-) - delete mode 100644 ucm2/SDP4430/VoiceAll.conf - create mode 100644 ucm2/SDP4430/VoiceCall.conf - -diff --git a/ucm2/SDP4430/FMAnalog.conf b/ucm2/SDP4430/FMAnalog.conf -index 9681465..2cfabf9 100644 ---- a/ucm2/SDP4430/FMAnalog.conf -+++ b/ucm2/SDP4430/FMAnalog.conf -@@ -9,19 +9,12 @@ SectionVerb { - cset "name='Capture Volume' 4" - ] - -- - DisableSequence [ - cset "name='AMIC_UL PDM Switch' 0" - cset "name='MUX_UL00' 0" - cset "name='MUX_UL01' 0" - cset "name='Capture Volume' 0" - ] -- -- # Optional TQ and ALSA PCMs -- Value { -- TQ "Music" -- CapturePCM "hw:${CardId},0" -- } - } - - SectionDevice."Headset" { -@@ -38,5 +31,9 @@ SectionDevice."Headset" { - cset "name='Analog Right Capture Route' 3" - cset "name='Capture Preamplifier Volume' 0" - ] -+ -+ Value { -+ CapturePCM "hw:${CardId},0" -+ } - } - -diff --git a/ucm2/SDP4430/HiFiLP.conf b/ucm2/SDP4430/HiFiLP.conf -index 51380d9..731ac21 100644 ---- a/ucm2/SDP4430/HiFiLP.conf -+++ b/ucm2/SDP4430/HiFiLP.conf -@@ -18,10 +18,8 @@ SectionVerb { - cset "name='SDT DL Volume' 0" - ] - -- # Optional TQ and ALSA PCMs - Value { - TQ "Music" -- PlaybackPCM "hw:${CardId},6" - } - } - -@@ -39,4 +37,9 @@ SectionDevice."Headset" { - cset "name='HS Left Playback' 0" - cset "name='Headset Playback Volume' 0" - ] -+ -+ Value { -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId},6" -+ } - } -diff --git a/ucm2/SDP4430/Record.conf b/ucm2/SDP4430/Record.conf -index 9f62fd1..d3c4955 100644 ---- a/ucm2/SDP4430/Record.conf -+++ b/ucm2/SDP4430/Record.conf -@@ -19,7 +19,6 @@ SectionVerb { - # Optional TQ and ALSA PCMs - Value { - TQ "Music" -- CapturePCM "hw:${CardId},0" - } - - } -@@ -38,4 +37,8 @@ SectionDevice."Headset" { - cset "name='Analog Right Capture Route' 3" - cset "name='Capture Preamplifier Volume' 0" - ] -+ -+ Value { -+ CapturePCM "hw:${CardId},0" -+ } - } -diff --git a/ucm2/SDP4430/SDP4430.conf b/ucm2/SDP4430/SDP4430.conf -index df5b5b9..fd95890 100644 ---- a/ucm2/SDP4430/SDP4430.conf -+++ b/ucm2/SDP4430/SDP4430.conf -@@ -13,7 +13,7 @@ SectionUseCase."HiFi" { - } - - SectionUseCase."HiFi_Low_Power" { -- File "HiHiLP.conf" -+ File "HiFiLP.conf" - Comment "Play HiFi quality Music in Low Power Mode" - } - -diff --git a/ucm2/SDP4430/Voice.conf b/ucm2/SDP4430/Voice.conf -index 7d10a17..15cd4f0 100644 ---- a/ucm2/SDP4430/Voice.conf -+++ b/ucm2/SDP4430/Voice.conf -@@ -18,10 +18,8 @@ SectionVerb { - cset "name='SDT DL Volume' 0" - ] - -- # Optional TQ and ALSA PCMs - Value { - TQ "Voice" -- PlaybackPCM "hw:${CardId},2" - } - } - -@@ -39,4 +37,8 @@ SectionDevice."Headset" { - cset "name='HS Left Playback' 0" - cset "name='Headset Playback Volume' 0" - ] -+ -+ Value { -+ PlaybackPCM "hw:${CardId},2" -+ } - } -diff --git a/ucm2/SDP4430/VoiceAll.conf b/ucm2/SDP4430/VoiceAll.conf -deleted file mode 100644 -index 07843c5..0000000 ---- a/ucm2/SDP4430/VoiceAll.conf -+++ /dev/null -@@ -1,63 +0,0 @@ --# Use case Configuration for TI SDP4430 HiFi Music --# By Liam Girdwood -- --SectionVerb { -- EnableSequence [ -- cset "name='AMIC_UL PDM Switch' 1" -- cset "name='Sidetone Mixer Capture' 1" -- cset "name='MUX_VX0' 9" -- cset "name='MUX_VX1' 10" -- cset "name='DL1 Mixer Voice' 1" -- cset "name='Sidetone Mixer Playback' 1" -- cset "name='DL1 PDM Switch' 1" -- cset "name='DL1 Voice Playback Volume' 90,90" -- cset "name='Capture Volume' 4" -- cset "name='Capture Mixer Voice Capture' 90,90" -- cset "name='SDT DL Volume' 120" -- ] -- -- -- DisableSequence [ -- cset "name='AMIC_UL PDM Switch' 0" -- cset "name='Sidetone Mixer Capture' 0" -- cset "name='MUX_VX0' 0" -- cset "name='MUX_VX1' 0" -- cset "name='DL1 Mixer Voice' 0" -- cset "name='Sidetone Mixer Playback' 0" -- cset "name='DL1 PDM Switch' 0" -- cset "name='DL1 Voice Playback Volume' 0,0" -- cset "name='Capture Volume' 0" -- cset "name='DL1 Voice Playback Volume' 0,0" -- cset "name='SDT DL Volume' 0" -- ] -- -- # Optional TQ and ALSA PCMs -- Value { -- TQ "Voice" -- CapturePCM "hw:${CardId},2" -- PlaybackPCM "hw:${CardId},2" -- } --} -- --SectionDevice."Headset" { -- Comment "SDP4430 3.5mm Headset" -- -- EnableSequence [ -- cset "name='Analog Left Capture Route' 0" -- cset "name='Analog Right Capture Route' 0" -- cset "name='Capture Preamplifier Volume' 2" -- cset "name='HS Left Playback' 1" -- cset "name='HS Right Playback' 1" -- cset "name='Headset Playback Volume' 13" -- ] -- -- DisableSequence [ -- cset "name='Analog Left Capture Route' 3" -- cset "name='Analog Right Capture Route' 3" -- cset "name='Capture Preamplifier Volume' 0" -- cset "name='HS Right Playback' 0" -- cset "name='HS Left Playback' 0" -- cset "name='Headset Playback Volume' 0" -- ] --} -- -diff --git a/ucm2/SDP4430/VoiceCall.conf b/ucm2/SDP4430/VoiceCall.conf -new file mode 100644 -index 0000000..2f02a2b ---- /dev/null -+++ b/ucm2/SDP4430/VoiceCall.conf -@@ -0,0 +1,64 @@ -+# Use case Configuration for TI SDP4430 HiFi Music -+# By Liam Girdwood -+ -+SectionVerb { -+ EnableSequence [ -+ cset "name='AMIC_UL PDM Switch' 1" -+ cset "name='Sidetone Mixer Capture' 1" -+ cset "name='MUX_VX0' 9" -+ cset "name='MUX_VX1' 10" -+ cset "name='DL1 Mixer Voice' 1" -+ cset "name='Sidetone Mixer Playback' 1" -+ cset "name='DL1 PDM Switch' 1" -+ cset "name='DL1 Voice Playback Volume' 90,90" -+ cset "name='Capture Volume' 4" -+ cset "name='Capture Mixer Voice Capture' 90,90" -+ cset "name='SDT DL Volume' 120" -+ ] -+ -+ -+ DisableSequence [ -+ cset "name='AMIC_UL PDM Switch' 0" -+ cset "name='Sidetone Mixer Capture' 0" -+ cset "name='MUX_VX0' 0" -+ cset "name='MUX_VX1' 0" -+ cset "name='DL1 Mixer Voice' 0" -+ cset "name='Sidetone Mixer Playback' 0" -+ cset "name='DL1 PDM Switch' 0" -+ cset "name='DL1 Voice Playback Volume' 0,0" -+ cset "name='Capture Volume' 0" -+ cset "name='DL1 Voice Playback Volume' 0,0" -+ cset "name='SDT DL Volume' 0" -+ ] -+ -+ Value { -+ TQ "Voice" -+ } -+} -+ -+SectionDevice."Headset" { -+ Comment "SDP4430 3.5mm Headset" -+ -+ EnableSequence [ -+ cset "name='Analog Left Capture Route' 0" -+ cset "name='Analog Right Capture Route' 0" -+ cset "name='Capture Preamplifier Volume' 2" -+ cset "name='HS Left Playback' 1" -+ cset "name='HS Right Playback' 1" -+ cset "name='Headset Playback Volume' 13" -+ ] -+ -+ DisableSequence [ -+ cset "name='Analog Left Capture Route' 3" -+ cset "name='Analog Right Capture Route' 3" -+ cset "name='Capture Preamplifier Volume' 0" -+ cset "name='HS Right Playback' 0" -+ cset "name='HS Left Playback' 0" -+ cset "name='Headset Playback Volume' 0" -+ ] -+ -+ Value { -+ CapturePCM "hw:${CardId},2" -+ PlaybackPCM "hw:${CardId},2" -+ } -+} --- -2.24.1 - - -From 9de65f1f733d178be0e61e3c9f37df1031ab6a81 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 28 Jan 2020 17:57:43 +0100 -Subject: [PATCH 21/36] sof-hda-dsp: fix typo (PlaybackMixerMaster -> - PlaybackMasterElem) - -Signed-off-by: Jaroslav Kysela ---- - ucm2/sof-hda-dsp/HiFi.conf | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/ucm2/sof-hda-dsp/HiFi.conf b/ucm2/sof-hda-dsp/HiFi.conf -index 5c7236d..71cef49 100644 ---- a/ucm2/sof-hda-dsp/HiFi.conf -+++ b/ucm2/sof-hda-dsp/HiFi.conf -@@ -21,7 +21,7 @@ SectionDevice."Headphones1" { - PlaybackPriority 200 - PlaybackPCM "hw:${CardId},0" - PlaybackMixerElem "Headphone" -- PlaybackMixerMaster "Master" -+ PlaybackMasterElem "Master" - PlaybackVolume "Headphone Playback Volume" - PlaybackSwitch "Headphone Playback Switch" - PlaybackChannels "2" --- -2.24.1 - - -From 4fd064eb56bec3a47f8380fd1498bbc190cca703 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 28 Jan 2020 18:15:22 +0100 -Subject: [PATCH 22/36] broadwell-rt286: add correct prefix to Priority field - names - -Signed-off-by: Jaroslav Kysela ---- - ucm2/broadwell-rt286/HiFi.conf | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -diff --git a/ucm2/broadwell-rt286/HiFi.conf b/ucm2/broadwell-rt286/HiFi.conf -index e766250..96b89a0 100644 ---- a/ucm2/broadwell-rt286/HiFi.conf -+++ b/ucm2/broadwell-rt286/HiFi.conf -@@ -21,7 +21,7 @@ SectionDevice."Speaker" { - ] - - Value { -- Priority 100 -+ PlaybackPriority 100 - PlaybackPCM "hw:${CardId}" - PlaybackChannels 2 - PlaybackMixerElem "DAC0" -@@ -49,7 +49,7 @@ SectionDevice."Headphones" { - ] - - Value { -- Priority 200 -+ PlaybackPriority 200 - PlaybackPCM "hw:${CardId}" - PlaybackChannels 2 - PlaybackMixerElem "DAC0" -@@ -76,9 +76,9 @@ SectionDevice."Mic" { - ] - - Value { -- Priority 100 -+ CapturePriority 100 - CapturePCM "hw:${CardId}" -- CaptureChannels "2" -+ CaptureChannels 2 - CaptureMixerElem "Mic" - CaptureMasterElem "ADC0" - } -@@ -101,9 +101,9 @@ SectionDevice."Handset" { - ] - - Value { -- Priority 200 -+ CapturePriority 200 - CapturePCM "hw:${CardId}" -- CaptureChannels "2" -+ CaptureChannels 2 - CaptureMixerElem "Mic" - CaptureMasterElem "ADC0" - JackDev "rt286-jack" --- -2.24.1 - - -From dbf9201ef6cc0008e3d1d10d28490c47689aed0e Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 28 Jan 2020 18:16:54 +0100 -Subject: [PATCH 23/36] GoogleNyan: comment CaptureControl, what is this? - -Signed-off-by: Jaroslav Kysela ---- - ucm2/GoogleNyan/HiFi.conf | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/ucm2/GoogleNyan/HiFi.conf b/ucm2/GoogleNyan/HiFi.conf -index 1f7e93c..0bcd8e8 100644 ---- a/ucm2/GoogleNyan/HiFi.conf -+++ b/ucm2/GoogleNyan/HiFi.conf -@@ -50,7 +50,7 @@ SectionDevice."Headphones" { - - SectionDevice."Mic" { - Value { -- CaptureControl "MIC2" -+ #CaptureControl "MIC2" - } - EnableSequence [ - cset "name='Int Mic Switch' off" --- -2.24.1 - - -From eed10701463b605ba5b6587d897deff742cbb5a0 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 4 Feb 2020 17:48:10 +0100 -Subject: [PATCH 24/36] VEYRON-I2S: corrections and fixes - -Signed-off-by: Jaroslav Kysela ---- - ucm2/VEYRON-I2S/HiFi.conf | 24 ++++++++++++++++-------- - 1 file changed, 16 insertions(+), 8 deletions(-) - -diff --git a/ucm2/VEYRON-I2S/HiFi.conf b/ucm2/VEYRON-I2S/HiFi.conf -index 8d07c73..bed87c5 100644 ---- a/ucm2/VEYRON-I2S/HiFi.conf -+++ b/ucm2/VEYRON-I2S/HiFi.conf -@@ -45,25 +45,31 @@ SectionDevice."Speaker" { - Comment "Speaker" - - Value { -- PlaybackPCM "hw:${CardId},0" -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId}" - } -+ - EnableSequence [ - cset "name='Speaker Switch' on" - ] -+ - DisableSequence [ - cset "name='Speaker Switch' off" - ] - } - --SectionDevice."Internal Mic" { -- Comment "Int Mic" -+SectionDevice."Mic" { -+ Comment "Internal Microphone" - - Value { -- CapturePCM "hw:${CardId},0" -+ CapturePriority 100 -+ CapturePCM "hw:${CardId}" - } -+ - EnableSequence [ - cset "name='Int Mic Switch' on" - ] -+ - DisableSequence [ - cset "name='Int Mic Switch' off" - ] -@@ -73,7 +79,8 @@ SectionDevice."Headphones" { - Comment "Headphones" - - Value { -- PlaybackPCM "hw:${CardId},0" -+ PlaybackPriority 200 -+ PlaybackPCM "hw:${CardId}" - } - - EnableSequence [ -@@ -88,11 +95,12 @@ SectionDevice."Headphones" { - ] - } - --SectionDevice."Mic" { -- Comment "Headset Mic" -+SectionDevice."Headset" { -+ Comment "Headset Microphone" - - Value { -- CapturePCM "hw:${CardId},0" -+ CapturePriority 200 -+ CapturePCM "hw:${CardId}" - } - - EnableSequence [ --- -2.24.1 - - -From c44072f1e12f29de45484d9de946b505c1f4789b Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 4 Feb 2020 17:52:37 +0100 -Subject: [PATCH 25/36] SDP4430: corrections and fixes - -Signed-off-by: Jaroslav Kysela ---- - ucm2/SDP4430/FMAnalog.conf | 1 + - ucm2/SDP4430/Record.conf | 1 + - ucm2/SDP4430/Voice.conf | 1 + - ucm2/SDP4430/VoiceCall.conf | 2 ++ - 4 files changed, 5 insertions(+) - -diff --git a/ucm2/SDP4430/FMAnalog.conf b/ucm2/SDP4430/FMAnalog.conf -index 2cfabf9..da21ab1 100644 ---- a/ucm2/SDP4430/FMAnalog.conf -+++ b/ucm2/SDP4430/FMAnalog.conf -@@ -33,6 +33,7 @@ SectionDevice."Headset" { - ] - - Value { -+ CapturePriority 100 - CapturePCM "hw:${CardId},0" - } - } -diff --git a/ucm2/SDP4430/Record.conf b/ucm2/SDP4430/Record.conf -index d3c4955..44e722b 100644 ---- a/ucm2/SDP4430/Record.conf -+++ b/ucm2/SDP4430/Record.conf -@@ -39,6 +39,7 @@ SectionDevice."Headset" { - ] - - Value { -+ CapturePriority 100 - CapturePCM "hw:${CardId},0" - } - } -diff --git a/ucm2/SDP4430/Voice.conf b/ucm2/SDP4430/Voice.conf -index 15cd4f0..2110332 100644 ---- a/ucm2/SDP4430/Voice.conf -+++ b/ucm2/SDP4430/Voice.conf -@@ -39,6 +39,7 @@ SectionDevice."Headset" { - ] - - Value { -+ PlaybackPriority 100 - PlaybackPCM "hw:${CardId},2" - } - } -diff --git a/ucm2/SDP4430/VoiceCall.conf b/ucm2/SDP4430/VoiceCall.conf -index 2f02a2b..d7d5c90 100644 ---- a/ucm2/SDP4430/VoiceCall.conf -+++ b/ucm2/SDP4430/VoiceCall.conf -@@ -58,7 +58,9 @@ SectionDevice."Headset" { - ] - - Value { -+ CapturePriority 100 - CapturePCM "hw:${CardId},2" -+ PlaybackPriority 100 - PlaybackPCM "hw:${CardId},2" - } - } --- -2.24.1 - - -From 4b7f489f6d2fa1e89592fbd1a01f87b725bc7c9c Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 4 Feb 2020 18:44:49 +0100 -Subject: [PATCH 26/36] chtrt5645: corrections and fixes - -Signed-off-by: Jaroslav Kysela ---- - ucm2/chtrt5645/HiFi-dmic1.conf | 32 +++++++++---------- - ucm2/chtrt5645/HiFi-dmic2.conf | 30 ++++++++--------- - .../HiFi-mono-speaker-analog-mic.conf | 21 ++++++------ - ucm2/chtrt5645/HiFi.conf | 21 ++++++------ - ucm2/codecs/rt5645/AnalogMic.conf | 5 +-- - 5 files changed, 54 insertions(+), 55 deletions(-) - -diff --git a/ucm2/chtrt5645/HiFi-dmic1.conf b/ucm2/chtrt5645/HiFi-dmic1.conf -index 86164c9..4748bd9 100644 ---- a/ucm2/chtrt5645/HiFi-dmic1.conf -+++ b/ucm2/chtrt5645/HiFi-dmic1.conf -@@ -2,10 +2,6 @@ SectionVerb { - # ALSA PCM - Value { - TQ "HiFi" -- -- # ALSA PCM device for HiFi -- PlaybackPCM "hw:${CardId}" -- CapturePCM "hw:${CardId}" - } - - EnableSequence [ -@@ -29,7 +25,9 @@ SectionDevice."Speaker" { - Comment "Speaker" - - Value { -- PlaybackChannels "2" -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId}" -+ PlaybackChannels 2 - } - - ConflictingDevice [ -@@ -50,7 +48,9 @@ SectionDevice."Headphones" { - Comment "Headphones" - - Value { -- PlaybackChannels "2" -+ PlaybackPriority 200 -+ PlaybackPCM "hw:${CardId}" -+ PlaybackChannels 2 - JackControl "Headphone Jack" - JackHWMute "Speaker" - } -@@ -69,12 +69,13 @@ SectionDevice."Headphones" { - ] - } - --SectionDevice."DMic" { -+SectionDevice."Mic" { - Comment "Internal Microphone" - - Value { -- CaptureChannels "2" -- CapturePriority "150" -+ CapturePriority 100 -+ CapturePCM "hw:${CardId}" -+ CaptureChannels 2 - } - - EnableSequence [ -@@ -91,13 +92,15 @@ SectionDevice."DMic" { - ] - } - --SectionDevice."HSMic" { -+SectionDevice."Headset" { - Comment "Headset Microphone" - - Value { -- CaptureChannels "2" -+ CapturePriority 200 -+ CapturePCM "hw:${CardId}" -+ CaptureChannels 2 - JackControl "Headset Mic Jack" -- JackHWMute "DMic" -+ JackHWMute "Mic" - } - - EnableSequence [ -@@ -113,9 +116,6 @@ SectionDevice."HSMic" { - ] - - DisableSequence [ -- -- -- cset "name='Mono ADC MIXL ADC1 Switch' on" -- cset "name='Mono ADC MIXR ADC1 Switch' on" -+ - ] - } -diff --git a/ucm2/chtrt5645/HiFi-dmic2.conf b/ucm2/chtrt5645/HiFi-dmic2.conf -index 5c947ae..459b9f5 100644 ---- a/ucm2/chtrt5645/HiFi-dmic2.conf -+++ b/ucm2/chtrt5645/HiFi-dmic2.conf -@@ -2,10 +2,6 @@ SectionVerb { - # ALSA PCM - Value { - TQ "HiFi" -- -- # ALSA PCM device for HiFi -- PlaybackPCM "hw:${CardId}" -- CapturePCM "hw:${CardId}" - } - - EnableSequence [ -@@ -29,7 +25,9 @@ SectionDevice."Speaker" { - Comment "Speaker" - - Value { -- PlaybackChannels "2" -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId}" -+ PlaybackChannels 2 - } - - ConflictingDevice [ -@@ -50,7 +48,9 @@ SectionDevice."Headphones" { - Comment "Headphones" - - Value { -- PlaybackChannels "2" -+ PlaybackPriority 200 -+ PlaybackPCM "hw:${CardId}" -+ PlaybackChannels 2 - JackControl "Headphone Jack" - JackHWMute "Speaker" - } -@@ -69,12 +69,13 @@ SectionDevice."Headphones" { - ] - } - --SectionDevice."DMic" { -+SectionDevice."Mic" { - Comment "Internal Microphone" - - Value { -- CaptureChannels "2" -- CapturePriority "150" -+ CapturePriority 100 -+ CapturePCM "hw:${CardId}" -+ CaptureChannels 2 - } - - EnableSequence [ -@@ -93,11 +94,13 @@ SectionDevice."DMic" { - ] - } - --SectionDevice."HSMic" { -+SectionDevice."Headset" { - Comment "Headset Microphone" - - Value { -- CaptureChannels "2" -+ CapturePriority 200 -+ CapturePCM "hw:${CardId}" -+ CaptureChannels 2 - JackControl "Headset Mic Jack" - JackHWMute "DMic" - } -@@ -115,9 +118,6 @@ SectionDevice."HSMic" { - ] - - DisableSequence [ -- -- -- cset "name='Mono ADC MIXL ADC1 Switch' on" -- cset "name='Mono ADC MIXR ADC1 Switch' on" -+ - ] - } -diff --git a/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf b/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf -index a1bca67..fe410f3 100644 ---- a/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf -+++ b/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf -@@ -2,10 +2,6 @@ SectionVerb { - # ALSA PCM - Value { - TQ "HiFi" -- -- # ALSA PCM device for HiFi -- PlaybackPCM "hw:${CardId}" -- CapturePCM "hw:${CardId}" - } - - EnableSequence [ -@@ -29,7 +25,9 @@ SectionDevice."Speaker" { - Comment "Speaker" - - Value { -- PlaybackChannels "2" -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId}" -+ PlaybackChannels 2 - } - - ConflictingDevice [ -@@ -54,7 +52,9 @@ SectionDevice."Headphones" { - Comment "Headphones" - - Value { -- PlaybackChannels "2" -+ PlaybackPriority 200 -+ PlaybackPCM "hw:${CardId}" -+ PlaybackChannels 2 - JackControl "Headphone Jack" - JackHWMute "Speaker" - } -@@ -79,11 +79,13 @@ SectionDevice."Headphones" { - - - --SectionDevice."HSMic" { -+SectionDevice."Headset" { - Comment "Headset Microphone" - - Value { -- CaptureChannels "2" -+ CapturePriority 200 -+ CapturePCM "hw:${CardId}" -+ CaptureChannels 2 - JackControl "Headset Mic Jack" - JackHWMute "Mic" - } -@@ -102,8 +104,5 @@ SectionDevice."HSMic" { - - DisableSequence [ - -- -- cset "name='Mono ADC MIXL ADC1 Switch' on" -- cset "name='Mono ADC MIXR ADC1 Switch' on" - ] - } -diff --git a/ucm2/chtrt5645/HiFi.conf b/ucm2/chtrt5645/HiFi.conf -index 7b2a663..954bf68 100644 ---- a/ucm2/chtrt5645/HiFi.conf -+++ b/ucm2/chtrt5645/HiFi.conf -@@ -2,10 +2,6 @@ SectionVerb { - # ALSA PCM - Value { - TQ "HiFi" -- -- # ALSA PCM device for HiFi -- PlaybackPCM "hw:${CardId}" -- CapturePCM "hw:${CardId}" - } - - EnableSequence [ -@@ -29,7 +25,9 @@ SectionDevice."Speaker" { - Comment "Speaker" - - Value { -- PlaybackChannels "2" -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId}" -+ PlaybackChannels 2 - } - - ConflictingDevice [ -@@ -50,7 +48,9 @@ SectionDevice."Headphones" { - Comment "Headphones" - - Value { -- PlaybackChannels "2" -+ PlaybackPriority 200 -+ PlaybackPCM "hw:${CardId}" -+ PlaybackChannels 2 - JackControl "Headphone Jack" - JackHWMute "Speaker" - } -@@ -71,11 +71,13 @@ SectionDevice."Headphones" { - - - --SectionDevice."HSMic" { -+SectionDevice."Headset" { - Comment "Headset Microphone" - - Value { -- CaptureChannels "2" -+ CapturePriority 200 -+ CapturePCM "hw:${CardId}" -+ CaptureChannels 2 - JackControl "Headset Mic Jack" - JackHWMute "Mic" - } -@@ -94,8 +96,5 @@ SectionDevice."HSMic" { - - DisableSequence [ - -- -- cset "name='Mono ADC MIXL ADC1 Switch' on" -- cset "name='Mono ADC MIXR ADC1 Switch' on" - ] - } -diff --git a/ucm2/codecs/rt5645/AnalogMic.conf b/ucm2/codecs/rt5645/AnalogMic.conf -index d52fe61..5583cdb 100644 ---- a/ucm2/codecs/rt5645/AnalogMic.conf -+++ b/ucm2/codecs/rt5645/AnalogMic.conf -@@ -2,8 +2,9 @@ SectionDevice."Mic" { - Comment "Internal Analog Microphone" - - Value { -- CaptureChannels "2" -- CapturePriority "150" -+ CapturePriority 100 -+ CapturePCM "hw:${CardId}" -+ CaptureChannels 2 - } - - EnableSequence [ --- -2.24.1 - - -From 3a92d95926e9289daf7b82335866b1561ccefc0d Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 4 Feb 2020 18:48:05 +0100 -Subject: [PATCH 27/36] GoogleNyan: corrections and fixes - -Signed-off-by: Jaroslav Kysela ---- - ucm2/GoogleNyan/HiFi.conf | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/ucm2/GoogleNyan/HiFi.conf b/ucm2/GoogleNyan/HiFi.conf -index 0bcd8e8..5428591 100644 ---- a/ucm2/GoogleNyan/HiFi.conf -+++ b/ucm2/GoogleNyan/HiFi.conf -@@ -38,6 +38,10 @@ SectionVerb { - } - - SectionDevice."Headphones" { -+ Value { -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId}" -+ } - EnableSequence [ - cset "name='Speakers Switch' off" - cset "name='Headphones Switch' on" -@@ -50,6 +54,8 @@ SectionDevice."Headphones" { - - SectionDevice."Mic" { - Value { -+ CapturePriority 100 -+ CapturePCM "hw:${CardId}" - #CaptureControl "MIC2" - } - EnableSequence [ --- -2.24.1 - - -From c546a3466d0d801b3d5a8fb6c2cd840a068e72f2 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 4 Feb 2020 18:52:18 +0100 -Subject: [PATCH 28/36] PAZ00: corrections and fixes - -Signed-off-by: Jaroslav Kysela ---- - ucm2/PAZ00/HiFi.conf | 4 ++++ - ucm2/PAZ00/Record.conf | 4 ++++ - 2 files changed, 8 insertions(+) - -diff --git a/ucm2/PAZ00/HiFi.conf b/ucm2/PAZ00/HiFi.conf -index 6e30cbe..7f5de05 100644 ---- a/ucm2/PAZ00/HiFi.conf -+++ b/ucm2/PAZ00/HiFi.conf -@@ -32,4 +32,8 @@ SectionDevice."Headset" { - # Internal speaker - cset "name='Int Spk Switch' on" - ] -+ Value { -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId}" -+ } - } -diff --git a/ucm2/PAZ00/Record.conf b/ucm2/PAZ00/Record.conf -index 3cb57b2..20dbac4 100644 ---- a/ucm2/PAZ00/Record.conf -+++ b/ucm2/PAZ00/Record.conf -@@ -52,4 +52,8 @@ SectionDevice."Headset" { - # Internal mic - cset "name='DMIC En Capture Switch' on" - ] -+ Value { -+ CapturePriority 100 -+ CapturePCM "hw:${CardId}" -+ } - } --- -2.24.1 - - -From 3b6bfaa6b5c08b78ee0cbb9b1b1137fc20f92a63 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 4 Feb 2020 18:58:27 +0100 -Subject: [PATCH 29/36] SDP4430: corrections and fixes - -Signed-off-by: Jaroslav Kysela ---- - ucm2/SDP4430/FMAnalog.conf | 2 +- - ucm2/SDP4430/HiFi.conf | 5 +++++ - ucm2/SDP4430/Record.conf | 2 +- - 3 files changed, 7 insertions(+), 2 deletions(-) - -diff --git a/ucm2/SDP4430/FMAnalog.conf b/ucm2/SDP4430/FMAnalog.conf -index da21ab1..e2132d2 100644 ---- a/ucm2/SDP4430/FMAnalog.conf -+++ b/ucm2/SDP4430/FMAnalog.conf -@@ -34,7 +34,7 @@ SectionDevice."Headset" { - - Value { - CapturePriority 100 -- CapturePCM "hw:${CardId},0" -+ CapturePCM "hw:${CardId}" - } - } - -diff --git a/ucm2/SDP4430/HiFi.conf b/ucm2/SDP4430/HiFi.conf -index af5b8fb..8e44a95 100644 ---- a/ucm2/SDP4430/HiFi.conf -+++ b/ucm2/SDP4430/HiFi.conf -@@ -49,4 +49,9 @@ SectionDevice."Headset" { - cset "name='HS Left Playback' 0" - cset "name='Headset Playback Volume' 0" - ] -+ -+ Value { -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId}" -+ } - } -diff --git a/ucm2/SDP4430/Record.conf b/ucm2/SDP4430/Record.conf -index 44e722b..49837e2 100644 ---- a/ucm2/SDP4430/Record.conf -+++ b/ucm2/SDP4430/Record.conf -@@ -40,6 +40,6 @@ SectionDevice."Headset" { - - Value { - CapturePriority 100 -- CapturePCM "hw:${CardId},0" -+ CapturePCM "hw:${CardId}" - } - } --- -2.24.1 - - -From 1e7ea2a0d7afe51447e7efb71f8f03c39b6fcb64 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 4 Feb 2020 19:11:10 +0100 -Subject: [PATCH 30/36] PandaBoard: corrections and fixes - -Signed-off-by: Jaroslav Kysela ---- - ucm2/PandaBoard/FMAnalog.conf | 9 ++++++--- - ucm2/PandaBoard/HiFi.conf | 18 +++++++++++------- - ucm2/PandaBoard/HiFiLP.conf | 8 ++++++-- - ucm2/PandaBoard/Record.conf | 8 ++++++-- - ucm2/PandaBoard/Voice.conf | 8 ++++++-- - ucm2/PandaBoard/VoiceCall.conf | 12 ++++++++---- - 6 files changed, 43 insertions(+), 20 deletions(-) - -diff --git a/ucm2/PandaBoard/FMAnalog.conf b/ucm2/PandaBoard/FMAnalog.conf -index 11a2288..29cbbe8 100644 ---- a/ucm2/PandaBoard/FMAnalog.conf -+++ b/ucm2/PandaBoard/FMAnalog.conf -@@ -17,10 +17,9 @@ SectionVerb { - cset "name='Capture Volume' 0" - ] - -- # Optional TQ and ALSA PCMs -+ # Optional TQ - Value { - TQ "Music" -- CapturePCM "hw:${CardId},0" - } - } - -@@ -38,5 +37,9 @@ SectionDevice."Headset" { - cset "name='Analog Right Capture Route' 3" - cset "name='Capture Preamplifier Volume' 0" - ] --} - -+ Value { -+ CapturePriority 100 -+ CapturePCM "hw:${CardId}" -+ } -+} -diff --git a/ucm2/PandaBoard/HiFi.conf b/ucm2/PandaBoard/HiFi.conf -index 1b16125..5de0c8f 100644 ---- a/ucm2/PandaBoard/HiFi.conf -+++ b/ucm2/PandaBoard/HiFi.conf -@@ -26,13 +26,10 @@ SectionVerb { - cset "name='Headset Playback Volume' 0" - ] - -- # Optional TQ and ALSA PCMs --# Value { --# TQ "Music" --# PlaybackPCM "hw:${CardId},0" --# PlaybackVolume "name='DL1 Media Playback Volume' 90,90" --# PlaybackSwitch "name='DL1 PDM Switch' 1" --# } -+ # Optional TQ -+ Value { -+ TQ "Music" -+ } - } - - SectionDevice."Headset" { -@@ -49,4 +46,11 @@ SectionDevice."Headset" { - cset "name='Headset Left Playback' 0" - cset "name='Headset Playback Volume' 0" - ] -+ -+ Value { -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId}" -+ # PlaybackVolume "name='DL1 Media Playback Volume' 90,90" -+ # PlaybackSwitch "name='DL1 PDM Switch' 1" -+ } - } -diff --git a/ucm2/PandaBoard/HiFiLP.conf b/ucm2/PandaBoard/HiFiLP.conf -index 92de382..c735248 100644 ---- a/ucm2/PandaBoard/HiFiLP.conf -+++ b/ucm2/PandaBoard/HiFiLP.conf -@@ -18,10 +18,9 @@ SectionVerb { - cset "name='SDT DL Volume' 0" - ] - -- # Optional TQ and ALSA PCMs -+ # Optional TQ - Value { - TQ "Music" -- PlaybackPCM "hw:${CardId},6" - } - } - -@@ -39,4 +38,9 @@ SectionDevice."Headset" { - cset "name='Headset Left Playback' 0" - cset "name='Headset Playback Volume' 0" - ] -+ -+ Value { -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId},6" -+ } - } -diff --git a/ucm2/PandaBoard/Record.conf b/ucm2/PandaBoard/Record.conf -index 1fbe74c..e88d6c3 100644 ---- a/ucm2/PandaBoard/Record.conf -+++ b/ucm2/PandaBoard/Record.conf -@@ -18,10 +18,9 @@ SectionVerb { - cset "name='Capture Volume' 0" - ] - -- # Optional TQ and ALSA PCMs -+ # Optional TQ - Value { - TQ "Music" -- CapturePCM "hw:${CardId},0" - } - - } -@@ -40,4 +39,9 @@ SectionDevice."Headset" { - cset "name='Analog Right Capture Route' 3" - cset "name='Capture Preamplifier Volume' 0" - ] -+ -+ Value { -+ CapturePriority 100 -+ CapturePCM "hw:${CardId}" -+ } - } -diff --git a/ucm2/PandaBoard/Voice.conf b/ucm2/PandaBoard/Voice.conf -index 42af48a..6843cc8 100644 ---- a/ucm2/PandaBoard/Voice.conf -+++ b/ucm2/PandaBoard/Voice.conf -@@ -18,10 +18,9 @@ SectionVerb { - cset "name='SDT DL Volume' 0" - ] - -- # Optional TQ and ALSA PCMs -+ # Optional TQ - Value { - TQ "Voice" -- PlaybackPCM "hw:${CardId},2" - } - } - -@@ -39,4 +38,9 @@ SectionDevice."Headset" { - cset "name='Headset Left Playback' 0" - cset "name='Headset Playback Volume' 0" - ] -+ -+ Value { -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId},2" -+ } - } -diff --git a/ucm2/PandaBoard/VoiceCall.conf b/ucm2/PandaBoard/VoiceCall.conf -index c20bf5c..9a8099e 100644 ---- a/ucm2/PandaBoard/VoiceCall.conf -+++ b/ucm2/PandaBoard/VoiceCall.conf -@@ -31,11 +31,9 @@ SectionVerb { - cset "name='SDT DL Volume' 0" - ] - -- # Optional TQ and ALSA PCMs -+ # Optional TQ - Value { - TQ "Voice" -- CapturePCM "hw:${CardId},2" -- PlaybackPCM "hw:${CardId},2" - } - } - -@@ -59,5 +57,11 @@ SectionDevice."Headset" { - cset "name='Headset Left Playback' 0" - cset "name='Headset Playback Volume' 0" - ] --} - -+ Value { -+ CapturePriority 100 -+ CapturePCM "hw:${CardId},2" -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId},2" -+ } -+} --- -2.24.1 - - -From 95f4da477fdb6a06ed321e6f2c0f7fc7d170b2e0 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 4 Feb 2020 19:21:47 +0100 -Subject: [PATCH 31/36] PandaBoardES: corrections and fixes - -Signed-off-by: Jaroslav Kysela ---- - ucm2/PandaBoardES/FMAnalog.conf | 9 ++++++--- - ucm2/PandaBoardES/HiFi.conf | 18 +++++++++++------- - ucm2/PandaBoardES/HiFiLP.conf | 8 ++++++-- - ucm2/PandaBoardES/Record.conf | 8 ++++++-- - ucm2/PandaBoardES/Voice.conf | 8 ++++++-- - ucm2/PandaBoardES/VoiceCall.conf | 10 +++++++--- - 6 files changed, 42 insertions(+), 19 deletions(-) - -diff --git a/ucm2/PandaBoardES/FMAnalog.conf b/ucm2/PandaBoardES/FMAnalog.conf -index a4d5a23..9920bcc 100644 ---- a/ucm2/PandaBoardES/FMAnalog.conf -+++ b/ucm2/PandaBoardES/FMAnalog.conf -@@ -17,10 +17,9 @@ SectionVerb { - cset "name='Capture Volume' 0" - ] - -- # Optional TQ and ALSA PCMs -+ # Optional TQ - Value { - TQ "Music" -- CapturePCM "hw:${CardId},0" - } - } - -@@ -38,5 +37,9 @@ SectionDevice."Headset" { - cset "name='Analog Right Capture Route' 3" - cset "name='Capture Preamplifier Volume' 0" - ] --} - -+ Value { -+ CapturePriority 100 -+ CapturePCM "hw:${CardId}" -+ } -+} -diff --git a/ucm2/PandaBoardES/HiFi.conf b/ucm2/PandaBoardES/HiFi.conf -index 856dd9f..aa78e47 100644 ---- a/ucm2/PandaBoardES/HiFi.conf -+++ b/ucm2/PandaBoardES/HiFi.conf -@@ -26,13 +26,10 @@ SectionVerb { - cset "name='Headset Playback Volume' 0" - ] - -- # Optional TQ and ALSA PCMs --# Value { --# TQ "Music" --# PlaybackPCM "hw:${CardId},0" --# PlaybackVolume "name='DL1 Media Playback Volume' 90,90" --# PlaybackSwitch "name='DL1 PDM Switch' 1" --# } -+ # Optional TQ -+ Value { -+ TQ "Music" -+ } - } - - SectionDevice."Headset" { -@@ -49,4 +46,11 @@ SectionDevice."Headset" { - cset "name='Headset Left Playback' 0" - cset "name='Headset Playback Volume' 0" - ] -+ -+ Value { -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId}" -+ # PlaybackVolume "name='DL1 Media Playback Volume' 90,90" -+ # PlaybackSwitch "name='DL1 PDM Switch' 1" -+ } - } -diff --git a/ucm2/PandaBoardES/HiFiLP.conf b/ucm2/PandaBoardES/HiFiLP.conf -index a6a258d..23164ed 100644 ---- a/ucm2/PandaBoardES/HiFiLP.conf -+++ b/ucm2/PandaBoardES/HiFiLP.conf -@@ -18,10 +18,9 @@ SectionVerb { - cset "name='SDT DL Volume' 0" - ] - -- # Optional TQ and ALSA PCMs -+ # Optional TQ - Value { - TQ "Music" -- PlaybackPCM "hw:${CardId},6" - } - } - -@@ -39,4 +38,9 @@ SectionDevice."Headset" { - cset "name='Headset Left Playback' 0" - cset "name='Headset Playback Volume' 0" - ] -+ -+ Value { -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId},6" -+ } - } -diff --git a/ucm2/PandaBoardES/Record.conf b/ucm2/PandaBoardES/Record.conf -index 57ad612..8cc6fdf 100644 ---- a/ucm2/PandaBoardES/Record.conf -+++ b/ucm2/PandaBoardES/Record.conf -@@ -17,10 +17,9 @@ SectionVerb { - cset "name='Capture Volume' 0" - ] - -- # Optional TQ and ALSA PCMs -+ # Optional TQ - Value { - TQ "Music" -- CapturePCM "hw:${CardId},0" - } - - } -@@ -39,4 +38,9 @@ SectionDevice."Headset" { - cset "name='Analog Right Capture Route' 3" - cset "name='Capture Preamplifier Volume' 0" - ] -+ -+ Value { -+ CapturePriority 100 -+ CapturePCM "hw:${CardId}" -+ } - } -diff --git a/ucm2/PandaBoardES/Voice.conf b/ucm2/PandaBoardES/Voice.conf -index a198c23..e37e7ec 100644 ---- a/ucm2/PandaBoardES/Voice.conf -+++ b/ucm2/PandaBoardES/Voice.conf -@@ -18,10 +18,9 @@ SectionVerb { - cset "name='SDT DL Volume' 0" - ] - -- # Optional TQ and ALSA PCMs -+ # Optional TQ - Value { - TQ "Voice" -- PlaybackPCM "hw:${CardId},2" - } - } - -@@ -39,4 +38,9 @@ SectionDevice."Headset" { - cset "name='Headset Left Playback' 0" - cset "name='Headset Playback Volume' 0" - ] -+ -+ Value { -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId},2" -+ } - } -diff --git a/ucm2/PandaBoardES/VoiceCall.conf b/ucm2/PandaBoardES/VoiceCall.conf -index 4aed020..3e6e092 100644 ---- a/ucm2/PandaBoardES/VoiceCall.conf -+++ b/ucm2/PandaBoardES/VoiceCall.conf -@@ -34,8 +34,6 @@ SectionVerb { - # Optional TQ and ALSA PCMs - Value { - TQ "Voice" -- CapturePCM "hw:${CardId},2" -- PlaybackPCM "hw:${CardId},2" - } - } - -@@ -59,5 +57,11 @@ SectionDevice."Headset" { - cset "name='Headset Left Playback' 0" - cset "name='Headset Playback Volume' 0" - ] --} - -+ Value { -+ CapturePriority 100 -+ CapturePCM "hw:${CardId},2" -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId},2" -+ } -+} --- -2.24.1 - - -From d2f2b3649b2ea4caa2fc93cdabe9ed813efbae68 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 5 Feb 2020 02:54:11 +0100 -Subject: [PATCH 32/36] kblrt5660: corrections and fixes - -Signed-off-by: Jaroslav Kysela ---- - ucm2/kblrt5660/Hdmi1.conf | 28 +++++++++++++++++++--------- - ucm2/kblrt5660/Hdmi2.conf | 30 ++++++++++++++++++++---------- - ucm2/kblrt5660/HiFi.conf | 26 ++++++++++---------------- - 3 files changed, 49 insertions(+), 35 deletions(-) - -diff --git a/ucm2/kblrt5660/Hdmi1.conf b/ucm2/kblrt5660/Hdmi1.conf -index b6adbaa..ccf5118 100755 ---- a/ucm2/kblrt5660/Hdmi1.conf -+++ b/ucm2/kblrt5660/Hdmi1.conf -@@ -1,14 +1,24 @@ - # Usecase for device HDMI1/Display Port stereo playback on Intel KABYLAKE platforms - # For Audio in I2S mode - --SectionDevice."Hdmi1" { -- Comment "HDMI/Display Port 1 Stereo" -+SectionDevice."HDMI1" { -+ Comment "HDMI/Display Port 1 Stereo" - -- Value { -- PlaybackPCM "hw:${CardId},2" -- PlaybackChannels "2" -- PlaybackPriority "2" -- JackControl "HDMI/DP, pcm=4 Jack" -- } -+ Value { -+ PlaybackPriority 200 -+ PlaybackPCM "hw:${CardId},2" -+ PlaybackChannels 2 -+ If.1 { -+ Condition { -+ Type ControlExists -+ Control "iface=CARD,name='HDMI/DP,pcm=4 Jack'" -+ } -+ True { -+ JackControl "HDMI/DP,pcm=4 Jack" -+ } -+ False { -+ JackControl "HDMI/DP, pcm=4 Jack" -+ } -+ } -+ } - } -- -diff --git a/ucm2/kblrt5660/Hdmi2.conf b/ucm2/kblrt5660/Hdmi2.conf -index 19e9bd0..c5e4001 100755 ---- a/ucm2/kblrt5660/Hdmi2.conf -+++ b/ucm2/kblrt5660/Hdmi2.conf -@@ -1,14 +1,24 @@ --# Usecase for device HDMI2/Display Port stereo playback on Intel KABYLAKE platforms -+# Usecase for device HDMI1/Display Port stereo playback on Intel KABYLAKE platforms - # For Audio in I2S mode - --SectionDevice."Hdmi2" { -- Comment "HDMI/Display Port 2 Stereo" -+SectionDevice."HDMI2" { -+ Comment "HDMI/Display Port 2 Stereo" - -- Value { -- PlaybackPCM "hw:${CardId},3" -- PlaybackChannels "2" -- PlaybackPriority "3" -- JackControl "HDMI/DP, pcm=5 Jack" -- } -+ Value { -+ PlaybackPriority 300 -+ PlaybackPCM "hw:${CardId},3" -+ PlaybackChannels 2 -+ If.1 { -+ Condition { -+ Type ControlExists -+ Control "iface=CARD,name='HDMI/DP,pcm=5 Jack'" -+ } -+ True { -+ JackControl "HDMI/DP,pcm=5 Jack" -+ } -+ False { -+ JackControl "HDMI/DP, pcm=5 Jack" -+ } -+ } -+ } - } -- -diff --git a/ucm2/kblrt5660/HiFi.conf b/ucm2/kblrt5660/HiFi.conf -index af0d805..0f5d46d 100755 ---- a/ucm2/kblrt5660/HiFi.conf -+++ b/ucm2/kblrt5660/HiFi.conf -@@ -1,18 +1,8 @@ - # UCM for Intel Kabylake platforms with RT5660 - # For Audio in I2S mode - --SectionVerb { -- -- # ALSA PCM -- Value { -- # ALSA PCM device for HiFi -- PlaybackPCM "hw:${CardId},0" -- CapturePCM "hw:${CardId},1" -- } --} -- --SectionDevice."LineOut" { -- Comment "LineOut playback" -+SectionDevice."Line1" { -+ Comment "Line playback" - - EnableSequence [ - cset "name='DAC1 Playback Volume' 30" -@@ -36,14 +26,16 @@ SectionDevice."LineOut" { - ] - - Value { -- PlaybackChannels "2" -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId}" -+ PlaybackChannels 2 - JackDev "rt5660-jack" - JackControl "Line Out Jack" - } - } - --SectionDevice."LineIn" { -- Comment "LineIn capture" -+SectionDevice."Line2" { -+ Comment "Line capture" - - EnableSequence [ - cset "name='ADC Capture Volume' 30" -@@ -67,7 +59,9 @@ SectionDevice."LineIn" { - ] - - Value { -- CaptureChannels "2" -+ CapturePriority 100 -+ CapturePCM "hw:${CardId},1" -+ CaptureChannels 2 - JackDev "rt5660-jack" - JackControl "Line In Jack" - } --- -2.24.1 - - -From 1e2eddb7e38474f239f9c8f9387c7a04a1bff7e3 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 5 Feb 2020 03:13:06 +0100 -Subject: [PATCH 33/36] bytcr-rt5640: corrections and fixes - -Signed-off-by: Jaroslav Kysela ---- - ucm2/bytcr-rt5640/HiFi.conf | 5 ----- - ucm2/codecs/rt5640/DigitalMics.conf | 2 +- - ucm2/codecs/rt5640/HeadPhones.conf | 3 +-- - ucm2/codecs/rt5640/HeadsetMic.conf | 2 +- - ucm2/codecs/rt5640/IN1-InternalMic.conf | 4 ++-- - ucm2/codecs/rt5640/IN3-InternalMic.conf | 2 +- - ucm2/codecs/rt5640/MonoSpeaker.conf | 3 +-- - ucm2/codecs/rt5640/Speaker.conf | 3 +-- - 8 files changed, 8 insertions(+), 16 deletions(-) - -diff --git a/ucm2/bytcr-rt5640/HiFi.conf b/ucm2/bytcr-rt5640/HiFi.conf -index a616106..e71eb22 100644 ---- a/ucm2/bytcr-rt5640/HiFi.conf -+++ b/ucm2/bytcr-rt5640/HiFi.conf -@@ -10,11 +10,6 @@ SectionVerb { - DisableSequence [ - - ] -- -- Value { -- PlaybackPCM "hw:${CardId}" -- CapturePCM "hw:${CardId}" -- } - } - - If.0 { -diff --git a/ucm2/codecs/rt5640/DigitalMics.conf b/ucm2/codecs/rt5640/DigitalMics.conf -index 17cae19..9cd8a8c 100644 ---- a/ucm2/codecs/rt5640/DigitalMics.conf -+++ b/ucm2/codecs/rt5640/DigitalMics.conf -@@ -21,7 +21,7 @@ SectionDevice."Mic" { - - Value { - CapturePriority 100 -- CapturePCM "hw:${CardId},0" -+ CapturePCM "hw:${CardId}" - CaptureChannels 2 - } - } -diff --git a/ucm2/codecs/rt5640/HeadPhones.conf b/ucm2/codecs/rt5640/HeadPhones.conf -index dccc943..7859b7a 100644 ---- a/ucm2/codecs/rt5640/HeadPhones.conf -+++ b/ucm2/codecs/rt5640/HeadPhones.conf -@@ -3,7 +3,6 @@ SectionDevice."Headphones" { - - ConflictingDevice [ - "Speaker" -- "MonoSpeaker" - ] - - EnableSequence [ -@@ -33,7 +32,7 @@ SectionDevice."Headphones" { - - Value { - PlaybackPriority 300 -- PlaybackPCM "hw:${CardId},0" -+ PlaybackPCM "hw:${CardId}" - PlaybackChannels 2 - JackControl "Headphone Jack" - } -diff --git a/ucm2/codecs/rt5640/HeadsetMic.conf b/ucm2/codecs/rt5640/HeadsetMic.conf -index f6d9423..40e0abe 100644 ---- a/ucm2/codecs/rt5640/HeadsetMic.conf -+++ b/ucm2/codecs/rt5640/HeadsetMic.conf -@@ -37,7 +37,7 @@ SectionDevice."Headset" { - - Value { - CapturePriority 200 -- CapturePCM "hw:${CardId},0" -+ CapturePCM "hw:${CardId}" - CaptureChannels 2 - JackControl "Headset Mic Jack" - } -diff --git a/ucm2/codecs/rt5640/IN1-InternalMic.conf b/ucm2/codecs/rt5640/IN1-InternalMic.conf -index 435cce8..7d76c4f 100644 ---- a/ucm2/codecs/rt5640/IN1-InternalMic.conf -+++ b/ucm2/codecs/rt5640/IN1-InternalMic.conf -@@ -2,7 +2,7 @@ SectionDevice."Mic" { - Comment "Internal Microphone on IN1" - - ConflictingDevice [ -- "HeadsetMic" -+ "Headset" - ] - - EnableSequence [ -@@ -40,7 +40,7 @@ SectionDevice."Mic" { - - Value { - CapturePriority 100 -- CapturePCM "hw:${CardId},0" -+ CapturePCM "hw:${CardId}" - CaptureChannels 2 - } - } -diff --git a/ucm2/codecs/rt5640/IN3-InternalMic.conf b/ucm2/codecs/rt5640/IN3-InternalMic.conf -index 4d4060e..2df2938 100644 ---- a/ucm2/codecs/rt5640/IN3-InternalMic.conf -+++ b/ucm2/codecs/rt5640/IN3-InternalMic.conf -@@ -40,7 +40,7 @@ SectionDevice."Mic" { - - Value { - CapturePriority 100 -- CapturePCM "hw:${CardId},0" -+ CapturePCM "hw:${CardId}" - CaptureChannels 2 - } - } -diff --git a/ucm2/codecs/rt5640/MonoSpeaker.conf b/ucm2/codecs/rt5640/MonoSpeaker.conf -index 6ca51e2..70ab809 100644 ---- a/ucm2/codecs/rt5640/MonoSpeaker.conf -+++ b/ucm2/codecs/rt5640/MonoSpeaker.conf -@@ -3,7 +3,6 @@ SectionDevice."Speaker" { - - ConflictingDevice [ - "Headphones" -- "Speaker" - ] - - EnableSequence [ -@@ -38,7 +37,7 @@ SectionDevice."Speaker" { - - Value { - PlaybackPriority 100 -- PlaybackPCM "hw:${CardId},0" -+ PlaybackPCM "hw:${CardId}" - PlaybackChannels 2 - } - } -diff --git a/ucm2/codecs/rt5640/Speaker.conf b/ucm2/codecs/rt5640/Speaker.conf -index 09b99cf..3b4b296 100644 ---- a/ucm2/codecs/rt5640/Speaker.conf -+++ b/ucm2/codecs/rt5640/Speaker.conf -@@ -3,7 +3,6 @@ SectionDevice."Speaker" { - - ConflictingDevice [ - "Headphones" -- "MonoSpeaker" - ] - - EnableSequence [ -@@ -37,8 +36,8 @@ SectionDevice."Speaker" { - ] - - Value { -- PlaybackPCM "hw:${CardId},0" - PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId}" - PlaybackChannels 2 - } - } --- -2.24.1 - - -From 6a1044da7b104251502421c56c9be42407bd9281 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 5 Feb 2020 03:19:33 +0100 -Subject: [PATCH 34/36] bytcht-es8316: corrections and fixes - -Signed-off-by: Jaroslav Kysela ---- - ucm2/bytcht-es8316/HiFi.conf | 5 ----- - ucm2/codecs/es8316/HeadPhones.conf | 2 +- - ucm2/codecs/es8316/IN1-HeadsetMic.conf | 2 +- - ucm2/codecs/es8316/IN2-HeadsetMic.conf | 2 +- - ucm2/codecs/es8316/IN2-InternalMic.conf | 6 ++---- - ucm2/codecs/es8316/MonoSpeaker.conf | 2 +- - ucm2/codecs/es8316/Speaker.conf | 3 +-- - 7 files changed, 7 insertions(+), 15 deletions(-) - -diff --git a/ucm2/bytcht-es8316/HiFi.conf b/ucm2/bytcht-es8316/HiFi.conf -index 768f010..af053d0 100644 ---- a/ucm2/bytcht-es8316/HiFi.conf -+++ b/ucm2/bytcht-es8316/HiFi.conf -@@ -7,11 +7,6 @@ SectionVerb { - DisableSequence [ - - ] -- -- Value { -- PlaybackPCM "hw:${CardId}" -- CapturePCM "hw:${CardId}" -- } - } - - If.0 { -diff --git a/ucm2/codecs/es8316/HeadPhones.conf b/ucm2/codecs/es8316/HeadPhones.conf -index 603b40c..6a05e54 100644 ---- a/ucm2/codecs/es8316/HeadPhones.conf -+++ b/ucm2/codecs/es8316/HeadPhones.conf -@@ -15,7 +15,7 @@ SectionDevice."Headphones" { - - Value { - PlaybackPriority 200 -- PlaybackPCM "hw:${CardId},0" -+ PlaybackPCM "hw:${CardId}" - PlaybackChannels 2 - JackControl "Headphone Jack" - JackHWMute "Speaker" -diff --git a/ucm2/codecs/es8316/IN1-HeadsetMic.conf b/ucm2/codecs/es8316/IN1-HeadsetMic.conf -index d798270..e9f9061 100644 ---- a/ucm2/codecs/es8316/IN1-HeadsetMic.conf -+++ b/ucm2/codecs/es8316/IN1-HeadsetMic.conf -@@ -16,7 +16,7 @@ SectionDevice."Headset" { - - Value { - CapturePriority 200 -- CapturePCM "hw:${CardId},0" -+ CapturePCM "hw:${CardId}" - CaptureChannels 2 - JackControl "Headset Mic Jack" - } -diff --git a/ucm2/codecs/es8316/IN2-HeadsetMic.conf b/ucm2/codecs/es8316/IN2-HeadsetMic.conf -index 28f26f8..377d84d 100644 ---- a/ucm2/codecs/es8316/IN2-HeadsetMic.conf -+++ b/ucm2/codecs/es8316/IN2-HeadsetMic.conf -@@ -16,7 +16,7 @@ SectionDevice."Headset" { - - Value { - CapturePriority 200 -- CapturePCM "hw:${CardId},0" -+ CapturePCM "hw:${CardId}" - CaptureChannels 2 - JackControl "Headset Mic Jack" - } -diff --git a/ucm2/codecs/es8316/IN2-InternalMic.conf b/ucm2/codecs/es8316/IN2-InternalMic.conf -index 8c0418f..f0ff6f1 100644 ---- a/ucm2/codecs/es8316/IN2-InternalMic.conf -+++ b/ucm2/codecs/es8316/IN2-InternalMic.conf -@@ -2,9 +2,7 @@ SectionDevice."Mic" { - Comment "Internal Microphone on IN2" - - ConflictingDevice [ -- "InternalMic-IN1" -- "HeadsetMic-IN1" -- "HeadsetMic-IN2" -+ "Headset" - ] - - EnableSequence [ -@@ -18,7 +16,7 @@ SectionDevice."Mic" { - - Value { - CapturePriority 100 -- CapturePCM "hw:${CardId},0" -+ CapturePCM "hw:${CardId}" - CaptureChannels 2 - } - } -diff --git a/ucm2/codecs/es8316/MonoSpeaker.conf b/ucm2/codecs/es8316/MonoSpeaker.conf -index f11f2b7..64a7e76 100644 ---- a/ucm2/codecs/es8316/MonoSpeaker.conf -+++ b/ucm2/codecs/es8316/MonoSpeaker.conf -@@ -32,7 +32,7 @@ SectionDevice."Speaker" { - - Value { - PlaybackPriority 100 -- PlaybackPCM "hw:${CardId},0" -+ PlaybackPCM "hw:${CardId}" - PlaybackChannels 2 - } - } -diff --git a/ucm2/codecs/es8316/Speaker.conf b/ucm2/codecs/es8316/Speaker.conf -index a1e4491..58fe078 100644 ---- a/ucm2/codecs/es8316/Speaker.conf -+++ b/ucm2/codecs/es8316/Speaker.conf -@@ -2,7 +2,6 @@ SectionDevice."Speaker" { - Comment "Speakers" - - ConflictingDevice [ -- "MonoSpeaker" - "Headphones" - ] - -@@ -16,7 +15,7 @@ SectionDevice."Speaker" { - - Value { - PlaybackPriority 100 -- PlaybackPCM "hw:${CardId},0" -+ PlaybackPCM "hw:${CardId}" - PlaybackChannels 2 - } - } --- -2.24.1 - - -From acf80f98692ab6f409e77cddb1bb55b387da4b17 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 5 Feb 2020 03:24:00 +0100 -Subject: [PATCH 35/36] sof-hda-dsp: corrections and fixes - -Signed-off-by: Jaroslav Kysela ---- - ucm2/sof-hda-dsp/HDA-Capture-value.conf | 4 ++-- - ucm2/sof-hda-dsp/Hdmi.conf | 6 +++--- - ucm2/sof-hda-dsp/HiFi.conf | 14 +++++++------- - 3 files changed, 12 insertions(+), 12 deletions(-) - -diff --git a/ucm2/sof-hda-dsp/HDA-Capture-value.conf b/ucm2/sof-hda-dsp/HDA-Capture-value.conf -index b3e90aa..5f3c2a3 100644 ---- a/ucm2/sof-hda-dsp/HDA-Capture-value.conf -+++ b/ucm2/sof-hda-dsp/HDA-Capture-value.conf -@@ -1,5 +1,5 @@ --CapturePCM "hw:${CardId},0" -+CapturePCM "hw:${CardId}" - CaptureMixerElem "Capture" - CaptureVolume "Capture Volume" - CaptureSwitch "Capture Switch" --CaptureChannels "2" -+CaptureChannels 2 -diff --git a/ucm2/sof-hda-dsp/Hdmi.conf b/ucm2/sof-hda-dsp/Hdmi.conf -index 7418fa7..1982c72 100644 ---- a/ucm2/sof-hda-dsp/Hdmi.conf -+++ b/ucm2/sof-hda-dsp/Hdmi.conf -@@ -14,7 +14,7 @@ SectionDevice."HDMI1" { - Value { - PlaybackPriority 500 - PlaybackPCM "hw:${CardId},3" -- PlaybackChannels "2" -+ PlaybackChannels 2 - JackControl "HDMI/DP,pcm=3 Jack" - } - } -@@ -33,7 +33,7 @@ SectionDevice."HDMI2" { - Value { - PlaybackPriority 600 - PlaybackPCM "hw:${CardId},4" -- PlaybackChannels "2" -+ PlaybackChannels 2 - JackControl "HDMI/DP,pcm=4 Jack" - } - } -@@ -52,7 +52,7 @@ SectionDevice."HDMI3" { - Value { - PlaybackPriority 700 - PlaybackPCM "hw:${CardId},5" -- PlaybackChannels "2" -+ PlaybackChannels 2 - JackControl "HDMI/DP,pcm=5 Jack" - } - } -diff --git a/ucm2/sof-hda-dsp/HiFi.conf b/ucm2/sof-hda-dsp/HiFi.conf -index 71cef49..6dfdabe 100644 ---- a/ucm2/sof-hda-dsp/HiFi.conf -+++ b/ucm2/sof-hda-dsp/HiFi.conf -@@ -19,12 +19,12 @@ SectionDevice."Headphones1" { - - Value { - PlaybackPriority 200 -- PlaybackPCM "hw:${CardId},0" -+ PlaybackPCM "hw:${CardId}" - PlaybackMixerElem "Headphone" - PlaybackMasterElem "Master" - PlaybackVolume "Headphone Playback Volume" - PlaybackSwitch "Headphone Playback Switch" -- PlaybackChannels "2" -+ PlaybackChannels 2 - If.jack { - Condition { - Type ControlExists -@@ -72,12 +72,12 @@ SectionDevice."Speaker" { - - Value { - PlaybackPriority 100 -- PlaybackPCM "hw:${CardId},0" -+ PlaybackPCM "hw:${CardId}" - PlaybackMixerElem "Speaker" - PlaybackMasterElem "Master" - PlaybackVolume "Speaker Playback Volume" - PlaybackSwitch "Speaker Playback Switch" -- PlaybackChannels "2" -+ PlaybackChannels 2 - } - } - -@@ -93,7 +93,7 @@ If.monomic { - Comment "Headphones Stereo Microphone" - - ConflictingDevice [ -- "HeadsetMic" -+ "Headset" - ] - - EnableSequence [ -@@ -147,10 +147,10 @@ SectionDevice."Mic" { - Needle "cfg-dmics:4" - } - True { -- CaptureChannels "4" -+ CaptureChannels 4 - } - False { -- CaptureChannels "2" -+ CaptureChannels 2 - } - } - If.vol { --- -2.24.1 - - -From 14c768eacd923c3b8bfe3dd027464a5d423e3773 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Thu, 6 Feb 2020 19:44:07 +0100 -Subject: [PATCH 36/36] ucm2: treewide - remove Playback and Capture channels=2 - assignments - -The value 2 is the default. - -Signed-off-by: Jaroslav Kysela ---- - ucm2/DB410c/HDMI.conf | 1 - - ucm2/DB410c/HiFi.conf | 9 --------- - ucm2/DB820c/HDMI.conf | 1 - - ucm2/DB820c/HiFi.conf | 1 - - ucm2/HDA-Intel/HiFi-dual.conf | 2 -- - ucm2/USB-Audio/Dell-WD15-Dock-HiFi.conf | 3 --- - ucm2/broadwell-rt286/HiFi.conf | 4 ---- - ucm2/broxton-rt298/broxton-rt298.conf | 7 ------- - ucm2/chtrt5645/HiFi-dmic1.conf | 4 ---- - ucm2/chtrt5645/HiFi-dmic2.conf | 4 ---- - ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf | 3 --- - ucm2/chtrt5645/HiFi.conf | 3 --- - ucm2/codecs/cx2072x/HeadPhones.conf | 1 - - ucm2/codecs/cx2072x/HeadsetMic.conf | 1 - - ucm2/codecs/cx2072x/InternalMic.conf | 1 - - ucm2/codecs/cx2072x/Speaker.conf | 1 - - ucm2/codecs/es8316/HeadPhones.conf | 1 - - ucm2/codecs/es8316/IN1-HeadsetMic.conf | 1 - - ucm2/codecs/es8316/IN1-InternalMic.conf | 1 - - ucm2/codecs/es8316/IN2-HeadsetMic.conf | 1 - - ucm2/codecs/es8316/IN2-InternalMic.conf | 1 - - ucm2/codecs/es8316/MonoSpeaker.conf | 1 - - ucm2/codecs/es8316/Speaker.conf | 1 - - ucm2/codecs/nau8824/HeadPhones.conf | 1 - - ucm2/codecs/nau8824/HeadsetMic.conf | 1 - - ucm2/codecs/nau8824/InternalMic.conf | 1 - - ucm2/codecs/nau8824/MonoSpeaker.conf | 1 - - ucm2/codecs/nau8824/Speaker.conf | 1 - - ucm2/codecs/rt5640/DigitalMics.conf | 1 - - ucm2/codecs/rt5640/HeadPhones.conf | 1 - - ucm2/codecs/rt5640/HeadsetMic.conf | 1 - - ucm2/codecs/rt5640/IN1-InternalMic.conf | 1 - - ucm2/codecs/rt5640/IN3-InternalMic.conf | 1 - - ucm2/codecs/rt5640/MonoSpeaker.conf | 1 - - ucm2/codecs/rt5640/Speaker.conf | 1 - - ucm2/codecs/rt5645/AnalogMic.conf | 1 - - ucm2/codecs/rt5651/DigitalMic.conf | 1 - - ucm2/codecs/rt5651/HeadPhones-swapped.conf | 1 - - ucm2/codecs/rt5651/HeadPhones.conf | 1 - - ucm2/codecs/rt5651/IN1-InternalMic.conf | 1 - - ucm2/codecs/rt5651/IN12-InternalMic.conf | 1 - - ucm2/codecs/rt5651/IN2-HeadsetMic.conf | 1 - - ucm2/codecs/rt5651/IN2-InternalMic.conf | 1 - - ucm2/codecs/rt5651/IN3-HeadsetMic.conf | 1 - - ucm2/codecs/rt5651/MonoSpeaker.conf | 1 - - ucm2/codecs/rt5651/Speaker.conf | 1 - - ucm2/codecs/rt5672/DMIC1.conf | 1 - - ucm2/codecs/rt5672/DMIC2.conf | 1 - - ucm2/codecs/rt5672/HeadPhones.conf | 1 - - ucm2/codecs/rt5672/HeadsetMic.conf | 1 - - ucm2/codecs/rt5672/MonoSpeaker.conf | 1 - - ucm2/codecs/rt5672/Speaker.conf | 1 - - ucm2/kblrt5660/Hdmi1.conf | 1 - - ucm2/kblrt5660/Hdmi2.conf | 1 - - ucm2/kblrt5660/HiFi.conf | 2 -- - ucm2/skylake-rt286/skylake-rt286.conf | 5 ----- - ucm2/sof-hda-dsp/HDA-Capture-value.conf | 1 - - ucm2/sof-hda-dsp/Hdmi.conf | 3 --- - ucm2/sof-hda-dsp/HiFi.conf | 5 ----- - 59 files changed, 100 deletions(-) - -diff --git a/ucm2/DB410c/HDMI.conf b/ucm2/DB410c/HDMI.conf -index fa44132..3335422 100644 ---- a/ucm2/DB410c/HDMI.conf -+++ b/ucm2/DB410c/HDMI.conf -@@ -4,7 +4,6 @@ - SectionVerb { - Value { - TQ "HiFi" -- PlaybackChannels 2 - } - } - -diff --git a/ucm2/DB410c/HiFi.conf b/ucm2/DB410c/HiFi.conf -index 1b2716a..62ddc8e 100644 ---- a/ucm2/DB410c/HiFi.conf -+++ b/ucm2/DB410c/HiFi.conf -@@ -1,14 +1,6 @@ - # Use case configuration for DB410c board. - # Author: Srinivas Kandagatla - --SectionVerb { -- Value { -- PlaybackChannels 2 -- CaptureChannels 2 -- } --} -- -- - SectionDevice."Speaker" { - Comment "Speaker playback" - -@@ -35,7 +27,6 @@ SectionDevice."Speaker" { - } - } - -- - SectionDevice."Headphones" { - Comment "Headphones playback" - -diff --git a/ucm2/DB820c/HDMI.conf b/ucm2/DB820c/HDMI.conf -index c0d40f6..f0ca015 100644 ---- a/ucm2/DB820c/HDMI.conf -+++ b/ucm2/DB820c/HDMI.conf -@@ -29,6 +29,5 @@ SectionDevice."HDMI" { - Value { - PlaybackPriority 200 - PlaybackPCM "plughw:${CardId}" -- PlaybackChannels 2 - } - } -diff --git a/ucm2/DB820c/HiFi.conf b/ucm2/DB820c/HiFi.conf -index 501c263..89280d7 100644 ---- a/ucm2/DB820c/HiFi.conf -+++ b/ucm2/DB820c/HiFi.conf -@@ -69,7 +69,6 @@ SectionDevice."Headphones" { - Value { - PlaybackPriority 100 - PlaybackPCM "plughw:${CardId},1" -- PlaybackChannels 2 - } - } - -diff --git a/ucm2/HDA-Intel/HiFi-dual.conf b/ucm2/HDA-Intel/HiFi-dual.conf -index 846c6db..174fef4 100644 ---- a/ucm2/HDA-Intel/HiFi-dual.conf -+++ b/ucm2/HDA-Intel/HiFi-dual.conf -@@ -1,8 +1,6 @@ - SectionVerb { - Value { - TQ "HiFi" -- PlaybackChannels 2 -- CaptureChannels 2 - } - - EnableSequence [ -diff --git a/ucm2/USB-Audio/Dell-WD15-Dock-HiFi.conf b/ucm2/USB-Audio/Dell-WD15-Dock-HiFi.conf -index 37b7e0d..2f625e4 100644 ---- a/ucm2/USB-Audio/Dell-WD15-Dock-HiFi.conf -+++ b/ucm2/USB-Audio/Dell-WD15-Dock-HiFi.conf -@@ -3,7 +3,6 @@ SectionDevice."Headphones" { - - Value { - PlaybackPriority 100 -- PlaybackChannels 2 - PlaybackPCM "hw:${CardId}" - } - } -@@ -13,7 +12,6 @@ SectionDevice."Line" { - - Value { - PlaybackPriority 200 -- PlaybackChannels 2 - PlaybackPCM "hw:${CardId},1" - } - } -@@ -23,7 +21,6 @@ SectionDevice."Mic" { - - Value { - CapturePriority 100 -- CaptureChannels 2 - CapturePCM "hw:${CardId}" - } - } -diff --git a/ucm2/broadwell-rt286/HiFi.conf b/ucm2/broadwell-rt286/HiFi.conf -index 96b89a0..611a03e 100644 ---- a/ucm2/broadwell-rt286/HiFi.conf -+++ b/ucm2/broadwell-rt286/HiFi.conf -@@ -23,7 +23,6 @@ SectionDevice."Speaker" { - Value { - PlaybackPriority 100 - PlaybackPCM "hw:${CardId}" -- PlaybackChannels 2 - PlaybackMixerElem "DAC0" - PlaybackMasterElem "Master" - } -@@ -51,7 +50,6 @@ SectionDevice."Headphones" { - Value { - PlaybackPriority 200 - PlaybackPCM "hw:${CardId}" -- PlaybackChannels 2 - PlaybackMixerElem "DAC0" - PlaybackMasterElem "Master" - JackDev "rt286-jack" -@@ -78,7 +76,6 @@ SectionDevice."Mic" { - Value { - CapturePriority 100 - CapturePCM "hw:${CardId}" -- CaptureChannels 2 - CaptureMixerElem "Mic" - CaptureMasterElem "ADC0" - } -@@ -103,7 +100,6 @@ SectionDevice."Handset" { - Value { - CapturePriority 200 - CapturePCM "hw:${CardId}" -- CaptureChannels 2 - CaptureMixerElem "Mic" - CaptureMasterElem "ADC0" - JackDev "rt286-jack" -diff --git a/ucm2/broxton-rt298/broxton-rt298.conf b/ucm2/broxton-rt298/broxton-rt298.conf -index 1332dc5..95f9ac5 100644 ---- a/ucm2/broxton-rt298/broxton-rt298.conf -+++ b/ucm2/broxton-rt298/broxton-rt298.conf -@@ -8,13 +8,6 @@ SectionUseCase."HiFi" { - Comment "Play and record HiFi quality Music" - } - --ValueDefaults { -- PlaybackChannels 2 -- PlaybackPriority 1 -- CaptureChannels 2 -- CapturePriority 2 --} -- - SectionDefaults [ - cset "name='Headphone Jack Switch' 1" - cset "name='Speaker Switch' 1" -diff --git a/ucm2/chtrt5645/HiFi-dmic1.conf b/ucm2/chtrt5645/HiFi-dmic1.conf -index 4748bd9..1a8ee0a 100644 ---- a/ucm2/chtrt5645/HiFi-dmic1.conf -+++ b/ucm2/chtrt5645/HiFi-dmic1.conf -@@ -27,7 +27,6 @@ SectionDevice."Speaker" { - Value { - PlaybackPriority 100 - PlaybackPCM "hw:${CardId}" -- PlaybackChannels 2 - } - - ConflictingDevice [ -@@ -50,7 +49,6 @@ SectionDevice."Headphones" { - Value { - PlaybackPriority 200 - PlaybackPCM "hw:${CardId}" -- PlaybackChannels 2 - JackControl "Headphone Jack" - JackHWMute "Speaker" - } -@@ -75,7 +73,6 @@ SectionDevice."Mic" { - Value { - CapturePriority 100 - CapturePCM "hw:${CardId}" -- CaptureChannels 2 - } - - EnableSequence [ -@@ -98,7 +95,6 @@ SectionDevice."Headset" { - Value { - CapturePriority 200 - CapturePCM "hw:${CardId}" -- CaptureChannels 2 - JackControl "Headset Mic Jack" - JackHWMute "Mic" - } -diff --git a/ucm2/chtrt5645/HiFi-dmic2.conf b/ucm2/chtrt5645/HiFi-dmic2.conf -index 459b9f5..c9fdd79 100644 ---- a/ucm2/chtrt5645/HiFi-dmic2.conf -+++ b/ucm2/chtrt5645/HiFi-dmic2.conf -@@ -27,7 +27,6 @@ SectionDevice."Speaker" { - Value { - PlaybackPriority 100 - PlaybackPCM "hw:${CardId}" -- PlaybackChannels 2 - } - - ConflictingDevice [ -@@ -50,7 +49,6 @@ SectionDevice."Headphones" { - Value { - PlaybackPriority 200 - PlaybackPCM "hw:${CardId}" -- PlaybackChannels 2 - JackControl "Headphone Jack" - JackHWMute "Speaker" - } -@@ -75,7 +73,6 @@ SectionDevice."Mic" { - Value { - CapturePriority 100 - CapturePCM "hw:${CardId}" -- CaptureChannels 2 - } - - EnableSequence [ -@@ -100,7 +97,6 @@ SectionDevice."Headset" { - Value { - CapturePriority 200 - CapturePCM "hw:${CardId}" -- CaptureChannels 2 - JackControl "Headset Mic Jack" - JackHWMute "DMic" - } -diff --git a/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf b/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf -index fe410f3..db866cd 100644 ---- a/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf -+++ b/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf -@@ -27,7 +27,6 @@ SectionDevice."Speaker" { - Value { - PlaybackPriority 100 - PlaybackPCM "hw:${CardId}" -- PlaybackChannels 2 - } - - ConflictingDevice [ -@@ -54,7 +53,6 @@ SectionDevice."Headphones" { - Value { - PlaybackPriority 200 - PlaybackPCM "hw:${CardId}" -- PlaybackChannels 2 - JackControl "Headphone Jack" - JackHWMute "Speaker" - } -@@ -85,7 +83,6 @@ SectionDevice."Headset" { - Value { - CapturePriority 200 - CapturePCM "hw:${CardId}" -- CaptureChannels 2 - JackControl "Headset Mic Jack" - JackHWMute "Mic" - } -diff --git a/ucm2/chtrt5645/HiFi.conf b/ucm2/chtrt5645/HiFi.conf -index 954bf68..58468a8 100644 ---- a/ucm2/chtrt5645/HiFi.conf -+++ b/ucm2/chtrt5645/HiFi.conf -@@ -27,7 +27,6 @@ SectionDevice."Speaker" { - Value { - PlaybackPriority 100 - PlaybackPCM "hw:${CardId}" -- PlaybackChannels 2 - } - - ConflictingDevice [ -@@ -50,7 +49,6 @@ SectionDevice."Headphones" { - Value { - PlaybackPriority 200 - PlaybackPCM "hw:${CardId}" -- PlaybackChannels 2 - JackControl "Headphone Jack" - JackHWMute "Speaker" - } -@@ -77,7 +75,6 @@ SectionDevice."Headset" { - Value { - CapturePriority 200 - CapturePCM "hw:${CardId}" -- CaptureChannels 2 - JackControl "Headset Mic Jack" - JackHWMute "Mic" - } -diff --git a/ucm2/codecs/cx2072x/HeadPhones.conf b/ucm2/codecs/cx2072x/HeadPhones.conf -index 484d020..adb70db 100644 ---- a/ucm2/codecs/cx2072x/HeadPhones.conf -+++ b/ucm2/codecs/cx2072x/HeadPhones.conf -@@ -18,7 +18,6 @@ SectionDevice."Headphones" { - Value { - PlaybackPriority 200 - PlaybackPCM "hw:${CardId}" -- PlaybackChannels 2 - JackControl "Headphone Jack" - } - } -diff --git a/ucm2/codecs/cx2072x/HeadsetMic.conf b/ucm2/codecs/cx2072x/HeadsetMic.conf -index b1a7771..5a6643e 100644 ---- a/ucm2/codecs/cx2072x/HeadsetMic.conf -+++ b/ucm2/codecs/cx2072x/HeadsetMic.conf -@@ -19,7 +19,6 @@ SectionDevice."Headset" { - Value { - CapturePriority 200 - CapturePCM "hw:${CardId}" -- CaptureChannels 2 - JackControl "Headset Mic Jack" - } - } -diff --git a/ucm2/codecs/cx2072x/InternalMic.conf b/ucm2/codecs/cx2072x/InternalMic.conf -index 831c3cc..9c083be 100644 ---- a/ucm2/codecs/cx2072x/InternalMic.conf -+++ b/ucm2/codecs/cx2072x/InternalMic.conf -@@ -19,6 +19,5 @@ SectionDevice."Mic" { - Value { - CapturePriority 100 - CapturePCM "hw:${CardId}" -- CaptureChannels 2 - } - } -diff --git a/ucm2/codecs/cx2072x/Speaker.conf b/ucm2/codecs/cx2072x/Speaker.conf -index f60e355..a641ba2 100644 ---- a/ucm2/codecs/cx2072x/Speaker.conf -+++ b/ucm2/codecs/cx2072x/Speaker.conf -@@ -18,6 +18,5 @@ SectionDevice."Speaker" { - Value { - PlaybackPriority 100 - PlaybackPCM "hw:${CardId}" -- PlaybackChannels 2 - } - } -diff --git a/ucm2/codecs/es8316/HeadPhones.conf b/ucm2/codecs/es8316/HeadPhones.conf -index 6a05e54..b68569a 100644 ---- a/ucm2/codecs/es8316/HeadPhones.conf -+++ b/ucm2/codecs/es8316/HeadPhones.conf -@@ -16,7 +16,6 @@ SectionDevice."Headphones" { - Value { - PlaybackPriority 200 - PlaybackPCM "hw:${CardId}" -- PlaybackChannels 2 - JackControl "Headphone Jack" - JackHWMute "Speaker" - } -diff --git a/ucm2/codecs/es8316/IN1-HeadsetMic.conf b/ucm2/codecs/es8316/IN1-HeadsetMic.conf -index e9f9061..a76b275 100644 ---- a/ucm2/codecs/es8316/IN1-HeadsetMic.conf -+++ b/ucm2/codecs/es8316/IN1-HeadsetMic.conf -@@ -17,7 +17,6 @@ SectionDevice."Headset" { - Value { - CapturePriority 200 - CapturePCM "hw:${CardId}" -- CaptureChannels 2 - JackControl "Headset Mic Jack" - } - } -diff --git a/ucm2/codecs/es8316/IN1-InternalMic.conf b/ucm2/codecs/es8316/IN1-InternalMic.conf -index 31c5cda..ede0a8c 100644 ---- a/ucm2/codecs/es8316/IN1-InternalMic.conf -+++ b/ucm2/codecs/es8316/IN1-InternalMic.conf -@@ -17,6 +17,5 @@ SectionDevice."Mic" { - Value { - CapturePriority 100 - CapturePCM "hw:${CardId}" -- CaptureChannels 2 - } - } -diff --git a/ucm2/codecs/es8316/IN2-HeadsetMic.conf b/ucm2/codecs/es8316/IN2-HeadsetMic.conf -index 377d84d..b114c86 100644 ---- a/ucm2/codecs/es8316/IN2-HeadsetMic.conf -+++ b/ucm2/codecs/es8316/IN2-HeadsetMic.conf -@@ -17,7 +17,6 @@ SectionDevice."Headset" { - Value { - CapturePriority 200 - CapturePCM "hw:${CardId}" -- CaptureChannels 2 - JackControl "Headset Mic Jack" - } - } -diff --git a/ucm2/codecs/es8316/IN2-InternalMic.conf b/ucm2/codecs/es8316/IN2-InternalMic.conf -index f0ff6f1..c8fce62 100644 ---- a/ucm2/codecs/es8316/IN2-InternalMic.conf -+++ b/ucm2/codecs/es8316/IN2-InternalMic.conf -@@ -17,6 +17,5 @@ SectionDevice."Mic" { - Value { - CapturePriority 100 - CapturePCM "hw:${CardId}" -- CaptureChannels 2 - } - } -diff --git a/ucm2/codecs/es8316/MonoSpeaker.conf b/ucm2/codecs/es8316/MonoSpeaker.conf -index 64a7e76..f5f4273 100644 ---- a/ucm2/codecs/es8316/MonoSpeaker.conf -+++ b/ucm2/codecs/es8316/MonoSpeaker.conf -@@ -33,6 +33,5 @@ SectionDevice."Speaker" { - Value { - PlaybackPriority 100 - PlaybackPCM "hw:${CardId}" -- PlaybackChannels 2 - } - } -diff --git a/ucm2/codecs/es8316/Speaker.conf b/ucm2/codecs/es8316/Speaker.conf -index 58fe078..03c21b3 100644 ---- a/ucm2/codecs/es8316/Speaker.conf -+++ b/ucm2/codecs/es8316/Speaker.conf -@@ -16,6 +16,5 @@ SectionDevice."Speaker" { - Value { - PlaybackPriority 100 - PlaybackPCM "hw:${CardId}" -- PlaybackChannels 2 - } - } -diff --git a/ucm2/codecs/nau8824/HeadPhones.conf b/ucm2/codecs/nau8824/HeadPhones.conf -index 6623365..a807f84 100644 ---- a/ucm2/codecs/nau8824/HeadPhones.conf -+++ b/ucm2/codecs/nau8824/HeadPhones.conf -@@ -4,7 +4,6 @@ SectionDevice."Headphones" { - Value { - PlaybackPriority 200 - PlaybackPCM "hw:${CardId}" -- PlaybackChannels 2 - JackControl "Headphone Jack" - } - -diff --git a/ucm2/codecs/nau8824/HeadsetMic.conf b/ucm2/codecs/nau8824/HeadsetMic.conf -index 7381638..1129a6b 100644 ---- a/ucm2/codecs/nau8824/HeadsetMic.conf -+++ b/ucm2/codecs/nau8824/HeadsetMic.conf -@@ -4,7 +4,6 @@ SectionDevice."Headset" { - Value { - CapturePriority 300 - CapturePCM "hw:${CardId}" -- CaptureChannels 2 - JackControl "Headset Mic Jack" - } - -diff --git a/ucm2/codecs/nau8824/InternalMic.conf b/ucm2/codecs/nau8824/InternalMic.conf -index 731a261..409f01b 100644 ---- a/ucm2/codecs/nau8824/InternalMic.conf -+++ b/ucm2/codecs/nau8824/InternalMic.conf -@@ -4,7 +4,6 @@ SectionDevice."Mic" { - Value { - CapturePriority 200 - CapturePCM "hw:${CardId}" -- CaptureChannels 2 - } - - ConflictingDevice [ -diff --git a/ucm2/codecs/nau8824/MonoSpeaker.conf b/ucm2/codecs/nau8824/MonoSpeaker.conf -index b02a22c..6b4ef8a 100644 ---- a/ucm2/codecs/nau8824/MonoSpeaker.conf -+++ b/ucm2/codecs/nau8824/MonoSpeaker.conf -@@ -4,7 +4,6 @@ SectionDevice."Speaker" { - Value { - PlaybackPriority 100 - PlaybackPCM "hw:${CardId}" -- PlaybackChannels 2 - } - - ConflictingDevice [ -diff --git a/ucm2/codecs/nau8824/Speaker.conf b/ucm2/codecs/nau8824/Speaker.conf -index 3658795..a995873 100644 ---- a/ucm2/codecs/nau8824/Speaker.conf -+++ b/ucm2/codecs/nau8824/Speaker.conf -@@ -4,7 +4,6 @@ SectionDevice."Speaker" { - Value { - PlaybackPriority 100 - PlaybackPCM "hw:${CardId}" -- PlaybackChannels 2 - } - - ConflictingDevice [ -diff --git a/ucm2/codecs/rt5640/DigitalMics.conf b/ucm2/codecs/rt5640/DigitalMics.conf -index 9cd8a8c..503c4a9 100644 ---- a/ucm2/codecs/rt5640/DigitalMics.conf -+++ b/ucm2/codecs/rt5640/DigitalMics.conf -@@ -22,6 +22,5 @@ SectionDevice."Mic" { - Value { - CapturePriority 100 - CapturePCM "hw:${CardId}" -- CaptureChannels 2 - } - } -diff --git a/ucm2/codecs/rt5640/HeadPhones.conf b/ucm2/codecs/rt5640/HeadPhones.conf -index 7859b7a..42151d6 100644 ---- a/ucm2/codecs/rt5640/HeadPhones.conf -+++ b/ucm2/codecs/rt5640/HeadPhones.conf -@@ -33,7 +33,6 @@ SectionDevice."Headphones" { - Value { - PlaybackPriority 300 - PlaybackPCM "hw:${CardId}" -- PlaybackChannels 2 - JackControl "Headphone Jack" - } - } -diff --git a/ucm2/codecs/rt5640/HeadsetMic.conf b/ucm2/codecs/rt5640/HeadsetMic.conf -index 40e0abe..7a8dfb8 100644 ---- a/ucm2/codecs/rt5640/HeadsetMic.conf -+++ b/ucm2/codecs/rt5640/HeadsetMic.conf -@@ -38,7 +38,6 @@ SectionDevice."Headset" { - Value { - CapturePriority 200 - CapturePCM "hw:${CardId}" -- CaptureChannels 2 - JackControl "Headset Mic Jack" - } - } -diff --git a/ucm2/codecs/rt5640/IN1-InternalMic.conf b/ucm2/codecs/rt5640/IN1-InternalMic.conf -index 7d76c4f..ebb5b6d 100644 ---- a/ucm2/codecs/rt5640/IN1-InternalMic.conf -+++ b/ucm2/codecs/rt5640/IN1-InternalMic.conf -@@ -41,6 +41,5 @@ SectionDevice."Mic" { - Value { - CapturePriority 100 - CapturePCM "hw:${CardId}" -- CaptureChannels 2 - } - } -diff --git a/ucm2/codecs/rt5640/IN3-InternalMic.conf b/ucm2/codecs/rt5640/IN3-InternalMic.conf -index 2df2938..172d909 100644 ---- a/ucm2/codecs/rt5640/IN3-InternalMic.conf -+++ b/ucm2/codecs/rt5640/IN3-InternalMic.conf -@@ -41,6 +41,5 @@ SectionDevice."Mic" { - Value { - CapturePriority 100 - CapturePCM "hw:${CardId}" -- CaptureChannels 2 - } - } -diff --git a/ucm2/codecs/rt5640/MonoSpeaker.conf b/ucm2/codecs/rt5640/MonoSpeaker.conf -index 70ab809..ddc7ba8 100644 ---- a/ucm2/codecs/rt5640/MonoSpeaker.conf -+++ b/ucm2/codecs/rt5640/MonoSpeaker.conf -@@ -38,6 +38,5 @@ SectionDevice."Speaker" { - Value { - PlaybackPriority 100 - PlaybackPCM "hw:${CardId}" -- PlaybackChannels 2 - } - } -diff --git a/ucm2/codecs/rt5640/Speaker.conf b/ucm2/codecs/rt5640/Speaker.conf -index 3b4b296..411cd13 100644 ---- a/ucm2/codecs/rt5640/Speaker.conf -+++ b/ucm2/codecs/rt5640/Speaker.conf -@@ -38,6 +38,5 @@ SectionDevice."Speaker" { - Value { - PlaybackPriority 100 - PlaybackPCM "hw:${CardId}" -- PlaybackChannels 2 - } - } -diff --git a/ucm2/codecs/rt5645/AnalogMic.conf b/ucm2/codecs/rt5645/AnalogMic.conf -index 5583cdb..1793880 100644 ---- a/ucm2/codecs/rt5645/AnalogMic.conf -+++ b/ucm2/codecs/rt5645/AnalogMic.conf -@@ -4,7 +4,6 @@ SectionDevice."Mic" { - Value { - CapturePriority 100 - CapturePCM "hw:${CardId}" -- CaptureChannels 2 - } - - EnableSequence [ -diff --git a/ucm2/codecs/rt5651/DigitalMic.conf b/ucm2/codecs/rt5651/DigitalMic.conf -index fa1de4c..aa40c1c 100644 ---- a/ucm2/codecs/rt5651/DigitalMic.conf -+++ b/ucm2/codecs/rt5651/DigitalMic.conf -@@ -16,6 +16,5 @@ SectionDevice."Mic" { - Value { - CapturePriority 100 - CapturePCM "hw:${CardId}" -- CaptureChannels 2 - } - } -diff --git a/ucm2/codecs/rt5651/HeadPhones-swapped.conf b/ucm2/codecs/rt5651/HeadPhones-swapped.conf -index 7e91aa2..595f29c 100644 ---- a/ucm2/codecs/rt5651/HeadPhones-swapped.conf -+++ b/ucm2/codecs/rt5651/HeadPhones-swapped.conf -@@ -33,7 +33,6 @@ SectionDevice."Headphones" { - - Value { - PlaybackPriority 200 -- PlaybackChannels 2 - PlaybackPCM "hw:${CardId}" - JackControl "Headphone Jack" - } -diff --git a/ucm2/codecs/rt5651/HeadPhones.conf b/ucm2/codecs/rt5651/HeadPhones.conf -index 18a4108..266c851 100644 ---- a/ucm2/codecs/rt5651/HeadPhones.conf -+++ b/ucm2/codecs/rt5651/HeadPhones.conf -@@ -25,7 +25,6 @@ SectionDevice."Headphones" { - Value { - PlaybackPriority 200 - PlaybackPCM "hw:${CardId}" -- PlaybackChannels 2 - JackControl "Headphone Jack" - } - } -diff --git a/ucm2/codecs/rt5651/IN1-InternalMic.conf b/ucm2/codecs/rt5651/IN1-InternalMic.conf -index 13c7cb6..faa0bfa 100644 ---- a/ucm2/codecs/rt5651/IN1-InternalMic.conf -+++ b/ucm2/codecs/rt5651/IN1-InternalMic.conf -@@ -20,6 +20,5 @@ SectionDevice."Mic" { - Value { - CapturePriority 100 - CapturePCM "hw:${CardId}" -- CaptureChannels 2 - } - } -diff --git a/ucm2/codecs/rt5651/IN12-InternalMic.conf b/ucm2/codecs/rt5651/IN12-InternalMic.conf -index e017541..79c72a3 100644 ---- a/ucm2/codecs/rt5651/IN12-InternalMic.conf -+++ b/ucm2/codecs/rt5651/IN12-InternalMic.conf -@@ -24,6 +24,5 @@ SectionDevice."Mic" { - Value { - CapturePriority 100 - CapturePCM "hw:${CardId}" -- CaptureChannels 2 - } - } -diff --git a/ucm2/codecs/rt5651/IN2-HeadsetMic.conf b/ucm2/codecs/rt5651/IN2-HeadsetMic.conf -index 5b51439..86bbacb 100644 ---- a/ucm2/codecs/rt5651/IN2-HeadsetMic.conf -+++ b/ucm2/codecs/rt5651/IN2-HeadsetMic.conf -@@ -24,7 +24,6 @@ SectionDevice."Headset" { - Value { - CapturePriority 200 - CapturePCM "hw:${CardId}" -- CaptureChannels 2 - JackControl "Headset Mic Jack" - } - } -diff --git a/ucm2/codecs/rt5651/IN2-InternalMic.conf b/ucm2/codecs/rt5651/IN2-InternalMic.conf -index 9eeef4d..da15a6d 100644 ---- a/ucm2/codecs/rt5651/IN2-InternalMic.conf -+++ b/ucm2/codecs/rt5651/IN2-InternalMic.conf -@@ -20,6 +20,5 @@ SectionDevice."Mic" { - Value { - CapturePriority 100 - CapturePCM "hw:${CardId}" -- CaptureChannels 2 - } - } -diff --git a/ucm2/codecs/rt5651/IN3-HeadsetMic.conf b/ucm2/codecs/rt5651/IN3-HeadsetMic.conf -index d579dcd..a40fefc 100644 ---- a/ucm2/codecs/rt5651/IN3-HeadsetMic.conf -+++ b/ucm2/codecs/rt5651/IN3-HeadsetMic.conf -@@ -24,7 +24,6 @@ SectionDevice."Headset" { - Value { - CapturePriority 200 - CapturePCM "hw:${CardId}" -- CaptureChannels 2 - JackControl "Headset Mic Jack" - } - } -diff --git a/ucm2/codecs/rt5651/MonoSpeaker.conf b/ucm2/codecs/rt5651/MonoSpeaker.conf -index 9c780a0..a83b481 100644 ---- a/ucm2/codecs/rt5651/MonoSpeaker.conf -+++ b/ucm2/codecs/rt5651/MonoSpeaker.conf -@@ -43,6 +43,5 @@ SectionDevice."Speaker" { - Value { - PlaybackPriority 100 - PlaybackPCM "hw:${CardId}" -- PlaybackChannels 2 - } - } -diff --git a/ucm2/codecs/rt5651/Speaker.conf b/ucm2/codecs/rt5651/Speaker.conf -index efc12e5..18308b4 100644 ---- a/ucm2/codecs/rt5651/Speaker.conf -+++ b/ucm2/codecs/rt5651/Speaker.conf -@@ -25,6 +25,5 @@ SectionDevice."Speaker" { - Value { - PlaybackPriority 100 - PlaybackPCM "hw:${CardId}" -- PlaybackChannels 2 - } - } -diff --git a/ucm2/codecs/rt5672/DMIC1.conf b/ucm2/codecs/rt5672/DMIC1.conf -index 73983af..2018283 100644 ---- a/ucm2/codecs/rt5672/DMIC1.conf -+++ b/ucm2/codecs/rt5672/DMIC1.conf -@@ -23,6 +23,5 @@ SectionDevice."Mic1" { - Value { - CapturePriority 100 - CapturePCM "hw:${CardId}" -- CaptureChannels 2 - } - } -diff --git a/ucm2/codecs/rt5672/DMIC2.conf b/ucm2/codecs/rt5672/DMIC2.conf -index 751c95c..48e6170 100644 ---- a/ucm2/codecs/rt5672/DMIC2.conf -+++ b/ucm2/codecs/rt5672/DMIC2.conf -@@ -23,6 +23,5 @@ SectionDevice."Mic2" { - Value { - CapturePriority 200 - CapturePCM "hw:${CardId}" -- CaptureChannels 2 - } - } -diff --git a/ucm2/codecs/rt5672/HeadPhones.conf b/ucm2/codecs/rt5672/HeadPhones.conf -index 0542f77..2c8d6e8 100644 ---- a/ucm2/codecs/rt5672/HeadPhones.conf -+++ b/ucm2/codecs/rt5672/HeadPhones.conf -@@ -17,7 +17,6 @@ SectionDevice."Headphones" { - Value { - PlaybackPriority 300 - PlaybackPCM "hw:${CardId}" -- PlaybackChannels 2 - JackControl "Headphone Jack" - } - } -diff --git a/ucm2/codecs/rt5672/HeadsetMic.conf b/ucm2/codecs/rt5672/HeadsetMic.conf -index f407579..a764d82 100644 ---- a/ucm2/codecs/rt5672/HeadsetMic.conf -+++ b/ucm2/codecs/rt5672/HeadsetMic.conf -@@ -32,7 +32,6 @@ SectionDevice."Headset" { - Value { - CapturePriority 300 - CapturePCM "hw:${CardId}" -- CaptureChannels 2 - JackControl "Headset Mic Jack" - } - } -diff --git a/ucm2/codecs/rt5672/MonoSpeaker.conf b/ucm2/codecs/rt5672/MonoSpeaker.conf -index 0849c67..f08c9c6 100644 ---- a/ucm2/codecs/rt5672/MonoSpeaker.conf -+++ b/ucm2/codecs/rt5672/MonoSpeaker.conf -@@ -21,6 +21,5 @@ SectionDevice."Speaker2" { - Value { - PlaybackPriority 100 - PlaybackPCM "hw:${CardId}" -- PlaybackChannels 2 - } - } -diff --git a/ucm2/codecs/rt5672/Speaker.conf b/ucm2/codecs/rt5672/Speaker.conf -index 44e73aa..8b7bcf8 100644 ---- a/ucm2/codecs/rt5672/Speaker.conf -+++ b/ucm2/codecs/rt5672/Speaker.conf -@@ -17,6 +17,5 @@ SectionDevice."Speaker1" { - Value { - PlaybackPriority 200 - PlaybackPCM "hw:${CardId}" -- PlaybackChannels 2 - } - } -diff --git a/ucm2/kblrt5660/Hdmi1.conf b/ucm2/kblrt5660/Hdmi1.conf -index ccf5118..561946f 100755 ---- a/ucm2/kblrt5660/Hdmi1.conf -+++ b/ucm2/kblrt5660/Hdmi1.conf -@@ -7,7 +7,6 @@ SectionDevice."HDMI1" { - Value { - PlaybackPriority 200 - PlaybackPCM "hw:${CardId},2" -- PlaybackChannels 2 - If.1 { - Condition { - Type ControlExists -diff --git a/ucm2/kblrt5660/Hdmi2.conf b/ucm2/kblrt5660/Hdmi2.conf -index c5e4001..756a346 100755 ---- a/ucm2/kblrt5660/Hdmi2.conf -+++ b/ucm2/kblrt5660/Hdmi2.conf -@@ -7,7 +7,6 @@ SectionDevice."HDMI2" { - Value { - PlaybackPriority 300 - PlaybackPCM "hw:${CardId},3" -- PlaybackChannels 2 - If.1 { - Condition { - Type ControlExists -diff --git a/ucm2/kblrt5660/HiFi.conf b/ucm2/kblrt5660/HiFi.conf -index 0f5d46d..c1e8a0f 100755 ---- a/ucm2/kblrt5660/HiFi.conf -+++ b/ucm2/kblrt5660/HiFi.conf -@@ -28,7 +28,6 @@ SectionDevice."Line1" { - Value { - PlaybackPriority 100 - PlaybackPCM "hw:${CardId}" -- PlaybackChannels 2 - JackDev "rt5660-jack" - JackControl "Line Out Jack" - } -@@ -61,7 +60,6 @@ SectionDevice."Line2" { - Value { - CapturePriority 100 - CapturePCM "hw:${CardId},1" -- CaptureChannels 2 - JackDev "rt5660-jack" - JackControl "Line In Jack" - } -diff --git a/ucm2/skylake-rt286/skylake-rt286.conf b/ucm2/skylake-rt286/skylake-rt286.conf -index 4ea5777..97f2a7c 100644 ---- a/ucm2/skylake-rt286/skylake-rt286.conf -+++ b/ucm2/skylake-rt286/skylake-rt286.conf -@@ -8,11 +8,6 @@ SectionUseCase."HiFi" { - Comment "Play and record HiFi quality Music" - } - --ValueDefaults { -- PlaybackChannels 2 -- CaptureChannels 2 --} -- - SectionDefaults [ - cset "name='Headphone Jack Switch' 1" - cset "name='Speaker Switch' 1" -diff --git a/ucm2/sof-hda-dsp/HDA-Capture-value.conf b/ucm2/sof-hda-dsp/HDA-Capture-value.conf -index 5f3c2a3..2f1316a 100644 ---- a/ucm2/sof-hda-dsp/HDA-Capture-value.conf -+++ b/ucm2/sof-hda-dsp/HDA-Capture-value.conf -@@ -2,4 +2,3 @@ CapturePCM "hw:${CardId}" - CaptureMixerElem "Capture" - CaptureVolume "Capture Volume" - CaptureSwitch "Capture Switch" --CaptureChannels 2 -diff --git a/ucm2/sof-hda-dsp/Hdmi.conf b/ucm2/sof-hda-dsp/Hdmi.conf -index 1982c72..be6cb39 100644 ---- a/ucm2/sof-hda-dsp/Hdmi.conf -+++ b/ucm2/sof-hda-dsp/Hdmi.conf -@@ -14,7 +14,6 @@ SectionDevice."HDMI1" { - Value { - PlaybackPriority 500 - PlaybackPCM "hw:${CardId},3" -- PlaybackChannels 2 - JackControl "HDMI/DP,pcm=3 Jack" - } - } -@@ -33,7 +32,6 @@ SectionDevice."HDMI2" { - Value { - PlaybackPriority 600 - PlaybackPCM "hw:${CardId},4" -- PlaybackChannels 2 - JackControl "HDMI/DP,pcm=4 Jack" - } - } -@@ -52,7 +50,6 @@ SectionDevice."HDMI3" { - Value { - PlaybackPriority 700 - PlaybackPCM "hw:${CardId},5" -- PlaybackChannels 2 - JackControl "HDMI/DP,pcm=5 Jack" - } - } -diff --git a/ucm2/sof-hda-dsp/HiFi.conf b/ucm2/sof-hda-dsp/HiFi.conf -index 6dfdabe..60a8693 100644 ---- a/ucm2/sof-hda-dsp/HiFi.conf -+++ b/ucm2/sof-hda-dsp/HiFi.conf -@@ -24,7 +24,6 @@ SectionDevice."Headphones1" { - PlaybackMasterElem "Master" - PlaybackVolume "Headphone Playback Volume" - PlaybackSwitch "Headphone Playback Switch" -- PlaybackChannels 2 - If.jack { - Condition { - Type ControlExists -@@ -77,7 +76,6 @@ SectionDevice."Speaker" { - PlaybackMasterElem "Master" - PlaybackVolume "Speaker Playback Volume" - PlaybackSwitch "Speaker Playback Switch" -- PlaybackChannels 2 - } - } - -@@ -149,9 +147,6 @@ SectionDevice."Mic" { - True { - CaptureChannels 4 - } -- False { -- CaptureChannels 2 -- } - } - If.vol { - Condition { --- -2.24.1 - diff --git a/sources b/sources index 01cab82..c7d59c4 100644 --- a/sources +++ b/sources @@ -1,5 +1,3 @@ -SHA512 (alsa-lib-1.2.1.1.tar.bz2) = 8a0b6f1ecc58d60991b4509e791b1581eebae57cd754b0b4829e66b1cfee81d588b04f42a17f598f06310b9658d9f46fd748cca516cc48b6f2989389c22c42e9 -SHA512 (alsa-ucm-conf-1.2.1.tar.bz2) = 277e335fff02973628454aca4c8e275e49965cfe1b4a0bc7a6c4833ea14537b39f8175dd0c974577aa98c95e4f7f0981078d70f8a5f083f7c15ab2445f851255 -SHA512 (alsa-topology-conf-1.2.1.tar.bz2) = 3480e58f12aeca04b0c1821e074daeb369949acbcf7bc61b09895ee43de84cb716566518a56a4d681babbb3f13faace5a16fff079d8bdaefc7c27fc1382cd41a -SHA512 (alsa-ucm-conf-1.2.1.2.tar.bz2) = e498c4355a765eb6ecd03f03611c8904f757bf73619a3c8159c044f80a4c3ab5cbd343692c227e13c6da307fc2e35259b4726902d3ab8e03eff11aa1c74027d5 -SHA512 (alsa-lib-1.2.1.2.tar.bz2) = e8286fd55f63ee0d95513279d0885c287533de89b7af6c338413dec5d38ba4f5a15da1a4a4ce36e052614e4b730e3778782dab9979d82958283be17b48604913 +SHA512 (alsa-lib-1.2.2.tar.bz2) = d21adb3ff998918c7d1820f9ce2aaf4202dd45ccb87cb092d49da8b2402b6ddaad06325be0fd59f17393a5d9958e3743bfccb4b14bdb947a42e7d791d73c7033 +SHA512 (alsa-ucm-conf-1.2.2.tar.bz2) = 25e3f341c110772c7cffc8c7745b320f2ddd12fe6460380c088939b5dc67b99ae4ad92e69375179574e0e1c40d14ff49961e86494e223fde009e51590f00ca8f +SHA512 (alsa-topology-conf-1.2.2.tar.bz2) = 145ee0e16f7f84d5f97759b1efaa3df9fe35c8b33c7ae863ae1b915f361acd902ad05f59090e1d98b2a4f2ecc14933681592893564fcc45cdbc974899f789b94 From 8a04e40ec3a0554511807328a34a00d98fe4e08b Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 19 Feb 2020 12:14:52 +0100 Subject: [PATCH 033/120] added missing alsa-ucm-conf.patch --- alsa-ucm-conf.patch | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 alsa-ucm-conf.patch diff --git a/alsa-ucm-conf.patch b/alsa-ucm-conf.patch new file mode 100644 index 0000000..e69de29 From 7c33e3c1a68357da8c74587b053fc4737f452990 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 19 Feb 2020 12:24:40 +0100 Subject: [PATCH 034/120] fix the version in comment --- alsa-lib.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 6fbf3c4..8d16958 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -163,7 +163,7 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog -* Wed Feb 19 2020 Jaroslav Kysela - 1.2.2 +* Wed Feb 19 2020 Jaroslav Kysela - 1.2.2-1 - Udpated to 1.2.2 * Sun Feb 9 2020 Jaroslav Kysela - 1.2.1.2-6 From efbf088724b8fbdad1c6f25b9d03a554740745e9 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 3 Mar 2020 09:33:07 +0100 Subject: [PATCH 035/120] add basic tests --- tests/run_tests.sh | 10 ++++++++++ tests/tests.yml | 11 +++++++++++ 2 files changed, 21 insertions(+) create mode 100755 tests/run_tests.sh create mode 100644 tests/tests.yml diff --git a/tests/run_tests.sh b/tests/run_tests.sh new file mode 100755 index 0000000..aa4c1a1 --- /dev/null +++ b/tests/run_tests.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +set -ex + +# a quick PCM API test +str=$(aplay -L | grep -E "^null$") +if [ "$str" != "null" ]; then + echo "The 'null' pcm plugin was not found!" + exit 99 +fi diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..5683a58 --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,11 @@ +- hosts: localhost + roles: + - role: standard-test-basic + tags: + - classic + required_packages: + - alsa-utils + tests: + - simple: + dir: . + run: ./run_tests.sh From 3b0dc213c4c427186017fdebd9f01e360fecc2c0 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 6 Apr 2020 17:25:46 +0200 Subject: [PATCH 036/120] UCM2 fixes (bug#1786723) --- alsa-git.patch | 789 +++++++++++++++++++++++++++++++++++++++++++++++++ alsa-lib.spec | 7 +- 2 files changed, 794 insertions(+), 2 deletions(-) diff --git a/alsa-git.patch b/alsa-git.patch index e69de29..8466fed 100644 --- a/alsa-git.patch +++ b/alsa-git.patch @@ -0,0 +1,789 @@ +From 27c7927842a691ef13724cd16fb26264680c6aa2 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Sat, 29 Feb 2020 10:30:37 +0100 +Subject: [PATCH 01/14] conf: change the order of PCM devices in alsa.conf + +Appearently, some applications use the first device for probe or so. + +Fixes: https://github.com/alsa-project/alsa-lib/issues/27 + +Signed-off-by: Jaroslav Kysela +--- + src/conf/alsa.conf | 46 +++++++++++++++++++++++----------------------- + 1 file changed, 23 insertions(+), 23 deletions(-) + +diff --git a/src/conf/alsa.conf b/src/conf/alsa.conf +index 09980586..a091b810 100644 +--- a/src/conf/alsa.conf ++++ b/src/conf/alsa.conf +@@ -119,29 +119,6 @@ defaults.timer.subdevice 0 + # PCM interface + # + +-# redirect to load-on-demand extended pcm definitions +-pcm.cards cards.pcm +- +-pcm.default cards.pcm.default +-pcm.sysdefault cards.pcm.default +-pcm.front cards.pcm.front +-pcm.rear cards.pcm.rear +-pcm.center_lfe cards.pcm.center_lfe +-pcm.side cards.pcm.side +-pcm.surround21 cards.pcm.surround21 +-pcm.surround40 cards.pcm.surround40 +-pcm.surround41 cards.pcm.surround41 +-pcm.surround50 cards.pcm.surround50 +-pcm.surround51 cards.pcm.surround51 +-pcm.surround71 cards.pcm.surround71 +-pcm.iec958 cards.pcm.iec958 +-pcm.spdif iec958 +-pcm.hdmi cards.pcm.hdmi +-pcm.dmix cards.pcm.dmix +-pcm.dsnoop cards.pcm.dsnoop +-pcm.modem cards.pcm.modem +-pcm.phoneline cards.pcm.phoneline +- + pcm.hw { + @args [ CARD DEV SUBDEV ] + @args.CARD { +@@ -323,6 +300,29 @@ pcm.null { + } + } + ++# redirect to load-on-demand extended pcm definitions ++pcm.cards cards.pcm ++ ++pcm.default cards.pcm.default ++pcm.sysdefault cards.pcm.default ++pcm.front cards.pcm.front ++pcm.rear cards.pcm.rear ++pcm.center_lfe cards.pcm.center_lfe ++pcm.side cards.pcm.side ++pcm.surround21 cards.pcm.surround21 ++pcm.surround40 cards.pcm.surround40 ++pcm.surround41 cards.pcm.surround41 ++pcm.surround50 cards.pcm.surround50 ++pcm.surround51 cards.pcm.surround51 ++pcm.surround71 cards.pcm.surround71 ++pcm.iec958 cards.pcm.iec958 ++pcm.spdif iec958 ++pcm.hdmi cards.pcm.hdmi ++pcm.dmix cards.pcm.dmix ++pcm.dsnoop cards.pcm.dsnoop ++pcm.modem cards.pcm.modem ++pcm.phoneline cards.pcm.phoneline ++ + # + # Control interface + # +-- +2.25.1 + + +From 09e78da4cade7b8fecb8f36717b85c456f2e5487 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Sun, 1 Mar 2020 19:57:06 +0100 +Subject: [PATCH 02/14] conf: namehint - add omit_noargs to the hint section + +Do not list simple surround devices in the namehint function by default. + +Fixes: https://github.com/alsa-project/alsa-lib/issues/27 + +Signed-off-by: Jaroslav Kysela +--- + src/conf/pcm/surround21.conf | 1 + + src/conf/pcm/surround40.conf | 1 + + src/conf/pcm/surround41.conf | 1 + + src/conf/pcm/surround50.conf | 1 + + src/conf/pcm/surround51.conf | 1 + + src/conf/pcm/surround71.conf | 1 + + src/control/namehint.c | 6 +++++- + 7 files changed, 11 insertions(+), 1 deletion(-) + +diff --git a/src/conf/pcm/surround21.conf b/src/conf/pcm/surround21.conf +index 1cf1b7af..ad19507b 100644 +--- a/src/conf/pcm/surround21.conf ++++ b/src/conf/pcm/surround21.conf +@@ -57,5 +57,6 @@ pcm.!surround21 { + hint { + description "2.1 Surround output to Front and Subwoofer speakers" + device_output $DEV ++ omit_noargs true + } + } +diff --git a/src/conf/pcm/surround40.conf b/src/conf/pcm/surround40.conf +index 9788ad48..7c615022 100644 +--- a/src/conf/pcm/surround40.conf ++++ b/src/conf/pcm/surround40.conf +@@ -55,5 +55,6 @@ pcm.!surround40 { + hint { + description "4.0 Surround output to Front and Rear speakers" + device_output $DEV ++ omit_noargs true + } + } +diff --git a/src/conf/pcm/surround41.conf b/src/conf/pcm/surround41.conf +index 7b4ef3be..cb6c0445 100644 +--- a/src/conf/pcm/surround41.conf ++++ b/src/conf/pcm/surround41.conf +@@ -61,5 +61,6 @@ pcm.!surround41 { + hint { + description "4.1 Surround output to Front, Rear and Subwoofer speakers" + device_output $DEV ++ omit_noargs true + } + } +diff --git a/src/conf/pcm/surround50.conf b/src/conf/pcm/surround50.conf +index 7d9a9e79..70d54069 100644 +--- a/src/conf/pcm/surround50.conf ++++ b/src/conf/pcm/surround50.conf +@@ -61,5 +61,6 @@ pcm.!surround50 { + hint { + description "5.0 Surround output to Front, Center and Rear speakers" + device_output $DEV ++ omit_noargs true + } + } +diff --git a/src/conf/pcm/surround51.conf b/src/conf/pcm/surround51.conf +index e67f007e..d0236e42 100644 +--- a/src/conf/pcm/surround51.conf ++++ b/src/conf/pcm/surround51.conf +@@ -57,5 +57,6 @@ pcm.!surround51 { + hint { + description "5.1 Surround output to Front, Center, Rear and Subwoofer speakers" + device_output $DEV ++ omit_noargs true + } + } +diff --git a/src/conf/pcm/surround71.conf b/src/conf/pcm/surround71.conf +index a26c3f36..66792dde 100644 +--- a/src/conf/pcm/surround71.conf ++++ b/src/conf/pcm/surround71.conf +@@ -59,5 +59,6 @@ pcm.!surround71 { + hint { + description "7.1 Surround output to Front, Center, Side, Rear and Woofer speakers" + device_output $DEV ++ omit_noargs true + } + } +diff --git a/src/control/namehint.c b/src/control/namehint.c +index 60c48ae3..169bd421 100644 +--- a/src/control/namehint.c ++++ b/src/control/namehint.c +@@ -287,10 +287,14 @@ static int try_config(snd_config_t *config, + err = -EINVAL; + goto __cleanup; + } ++ if (list->card < 0 && ++ snd_config_search(cfg, "omit_noargs", &n) >= 0 && ++ snd_config_get_bool(n) > 0) ++ goto __skip_add; + if (level == 1 && + snd_config_search(cfg, "show", &n) >= 0 && + snd_config_get_bool(n) <= 0) +- goto __skip_add; ++ goto __skip_add; + if (buf1 == NULL && + snd_config_search(cfg, "description", &n) >= 0 && + snd_config_get_string(n, &str) >= 0) { +-- +2.25.1 + + +From c7efaef195b92e30efb3049a1c03fa1b50310477 Mon Sep 17 00:00:00 2001 +From: be-marc +Date: Tue, 3 Mar 2020 11:01:09 +0100 +Subject: [PATCH 03/14] Change PCM device number of Asus Xonar U5 + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/USB-Audio.conf | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/conf/cards/USB-Audio.conf b/src/conf/cards/USB-Audio.conf +index 1c677937..dd99c44d 100644 +--- a/src/conf/cards/USB-Audio.conf ++++ b/src/conf/cards/USB-Audio.conf +@@ -39,7 +39,8 @@ USB-Audio.pcm.iec958_device { + # "NoiseBlaster 3000" 42 + "USB Sound Blaster HD" 1 + "Xonar U7" 1 +- ++ "ASUS XONAR U5" 1 ++ + # The below don't have digital in/out, so prevent them from being opened. + "Andrea PureAudio USB-SA Headset" 999 + "Blue Snowball" 999 +-- +2.25.1 + + +From 1654f38a29e635ce69a30c6c95ec1ca773ecee37 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 4 Mar 2020 11:27:12 +0100 +Subject: [PATCH 04/14] configure: add --embed for python3-config (python 3.8) + +Fixes: https://github.com/alsa-project/alsa-lib/issues/33 + +Signed-off-by: Jaroslav Kysela +--- + configure.ac | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 0f9fb016..4b5ab662 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -423,7 +423,10 @@ if test "$build_python" = "yes" -a "$build_mixer_pymodules" = "yes"; then + pythonlibs0= + pythoninc0= + if test "$build_python2" != "yes"; then +- pythonlibs0=$(python3-config --libs) ++ pythonlibs0=$(python3-config --libs --embed 2> /dev/null) ++ if test -z "$pythonlibs0"; then ++ pythonlibs0=$(python3-config --libs) ++ fi + pythoninc0=$(python3-config --includes) + fi + if test -z "$pythonlibs0"; then +-- +2.25.1 + + +From 9ed3c65e1569a0ebbec9af1d04d739db9921e775 Mon Sep 17 00:00:00 2001 +From: Tanu Kaskinen +Date: Fri, 13 Mar 2020 09:39:17 +0200 +Subject: [PATCH 05/14] conf: USB-Audio: Add C-Media USB Headphone Set to the + IEC958 blacklist + +Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/317 + +Signed-off-by: Tanu Kaskinen +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/USB-Audio.conf | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/conf/cards/USB-Audio.conf b/src/conf/cards/USB-Audio.conf +index dd99c44d..89811086 100644 +--- a/src/conf/cards/USB-Audio.conf ++++ b/src/conf/cards/USB-Audio.conf +@@ -44,6 +44,7 @@ USB-Audio.pcm.iec958_device { + # The below don't have digital in/out, so prevent them from being opened. + "Andrea PureAudio USB-SA Headset" 999 + "Blue Snowball" 999 ++ "C-Media USB Headphone Set" 999 + "HP Digital Stereo Headset" 999 + "GN 9330" 999 + "Logitech Speaker Lapdesk N700" 999 +-- +2.25.1 + + +From caf77a93cef5bda729bc33e0100cc0e769767389 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 13 Mar 2020 17:05:14 +0100 +Subject: [PATCH 06/14] topology: add back asrc to widget_map in dapm.c + +Fixes: aa1bac2d04bd ("topology: add snd_tplg_save()") +BugLink: https://github.com/thesofproject/sof/issues/2543 + +Signed-off-by: Jaroslav Kysela +--- + src/topology/dapm.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/topology/dapm.c b/src/topology/dapm.c +index cb85e667..70645126 100644 +--- a/src/topology/dapm.c ++++ b/src/topology/dapm.c +@@ -43,6 +43,7 @@ static const struct map_elem widget_map[] = { + {"effect", SND_SOC_TPLG_DAPM_EFFECT}, + {"siggen", SND_SOC_TPLG_DAPM_SIGGEN}, + {"src", SND_SOC_TPLG_DAPM_SRC}, ++ {"asrc", SND_SOC_TPLG_DAPM_ASRC}, + {"encoder", SND_SOC_TPLG_DAPM_ENCODER}, + {"decoder", SND_SOC_TPLG_DAPM_DECODER}, + }; +-- +2.25.1 + + +From 79102bf264f8651692fe9435a4d1bb06aa022d55 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 17 Mar 2020 10:21:10 +0100 +Subject: [PATCH 07/14] ucm: clarify the index syntax for the device names + +Signed-off-by: Jaroslav Kysela +--- + include/use-case.h | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/include/use-case.h b/include/use-case.h +index 134303af..27cb3fe1 100644 +--- a/include/use-case.h ++++ b/include/use-case.h +@@ -117,7 +117,10 @@ extern "C" { + * + * If multiple devices with the same name exists, the number suffixes should + * be added to these names like HDMI1,HDMI2,HDMI3 etc. No number gaps are +- * allowed. The names with numbers must be continuous. ++ * allowed. The names with numbers must be continuous. It is allowed to put ++ * a whitespace between name and index (like 'Line 1') for the better ++ * readability. The device names 'Line 1' and 'Line1' are equal for ++ * thus purpose. + * + * If EnableSequence/DisableSequence controls independent paths in the hardware + * it is also recommended to split playback and capture UCM devices and use +-- +2.25.1 + + +From 6137d263f3805c72781ea74b813b0e3754f5fc34 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 17 Mar 2020 16:20:52 +0100 +Subject: [PATCH 08/14] ucm: fix uc_mgr_scan_master_configs() + +Skip the lookup, if the top level filename does not exist. + +Fixes: https://github.com/alsa-project/alsa-ucm-conf/issues/16 + +Signed-off-by: Jaroslav Kysela +--- + src/ucm/parser.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/ucm/parser.c b/src/ucm/parser.c +index 8d6eea31..0001e595 100644 +--- a/src/ucm/parser.c ++++ b/src/ucm/parser.c +@@ -1969,6 +1969,9 @@ int uc_mgr_scan_master_configs(const char **_list[]) + + configuration_filename2(filename, sizeof(filename), 2, + d_name, d_name, ".conf"); ++ if (eaccess(filename, R_OK)) ++ continue; ++ + err = uc_mgr_config_load(2, filename, &cfg); + if (err < 0) + goto __err; +-- +2.25.1 + + +From d434638a683c01bd6decf8f41863044055237a50 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 27 Mar 2020 11:59:53 +0100 +Subject: [PATCH 09/14] namehint: remember the direction from the upper levels + +The current code resets the direction info for each level. +Simply remove this code. + +Fixes: https://github.com/alsa-project/alsa-lib/issues/39 + +Signed-off-by: Jaroslav Kysela +--- + src/control/namehint.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/src/control/namehint.c b/src/control/namehint.c +index 169bd421..ecd470f3 100644 +--- a/src/control/namehint.c ++++ b/src/control/namehint.c +@@ -270,8 +270,6 @@ static int try_config(snd_config_t *config, + if (snd_config_search(cfg1, "type", &cfg) >= 0 && + snd_config_get_string(cfg, &str) >= 0 && + strcmp(str, "hw") == 0) { +- list->device_input = -1; +- list->device_output = -1; + if (snd_config_search(cfg1, "device", &cfg) >= 0) { + if (snd_config_get_integer(cfg, &dev) < 0) { + SNDERR("(%s) device must be an integer", buf); +-- +2.25.1 + + +From bca39e99d0c2a270a71dad640983fb739dac8bdd Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 27 Mar 2020 18:14:02 +0100 +Subject: [PATCH 10/14] conf: fix namehint for pcm.front and pcm.iec958 + +As suggested in: + +Fixes: https://github.com/alsa-project/alsa-lib/issues/39 + +Signed-off-by: Jaroslav Kysela +--- + src/conf/pcm/front.conf | 3 ++- + src/conf/pcm/iec958.conf | 2 +- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/src/conf/pcm/front.conf b/src/conf/pcm/front.conf +index 7aff0cbf..0edf6a69 100644 +--- a/src/conf/pcm/front.conf ++++ b/src/conf/pcm/front.conf +@@ -53,6 +53,7 @@ pcm.!front { + name defaults.namehint.basic + } + description "Front speakers" +- device $DEV ++ device_output $DEV ++ omit_noargs true + } + } +diff --git a/src/conf/pcm/iec958.conf b/src/conf/pcm/iec958.conf +index ac139b5e..2b084d6f 100644 +--- a/src/conf/pcm/iec958.conf ++++ b/src/conf/pcm/iec958.conf +@@ -78,6 +78,6 @@ pcm.!iec958 { + name defaults.namehint.basic + } + description "IEC958 (S/PDIF) Digital Audio Output" +- device $DEV ++ device_output $DEV + } + } +-- +2.25.1 + + +From 3b46b03f099da2f39c205a25b3cc62ec688fe6b3 Mon Sep 17 00:00:00 2001 +From: Jonas Holmberg +Date: Tue, 31 Mar 2020 17:09:25 +0200 +Subject: [PATCH 11/14] pcm: add chmap option to route plugin + +Add a config definition "chmap" to override the channel maps in the same +way as in the hw and null plugins. + +Signed-off-by: Jonas Holmberg +Signed-off-by: Takashi Iwai +--- + src/pcm/pcm_route.c | 57 +++++++++++++++++++++++++++++++++++++-------- + 1 file changed, 47 insertions(+), 10 deletions(-) + +diff --git a/src/pcm/pcm_route.c b/src/pcm/pcm_route.c +index bbcc6118..d3e5f3ff 100644 +--- a/src/pcm/pcm_route.c ++++ b/src/pcm/pcm_route.c +@@ -104,6 +104,7 @@ typedef struct { + int schannels; + snd_pcm_route_params_t params; + snd_pcm_chmap_t *chmap; ++ snd_pcm_chmap_query_t **chmap_override; + } snd_pcm_route_t; + + #endif /* DOC_HIDDEN */ +@@ -441,6 +442,7 @@ static int snd_pcm_route_close(snd_pcm_t *pcm) + free(params->dsts); + } + free(route->chmap); ++ snd_pcm_free_chmaps(route->chmap_override); + return snd_pcm_generic_close(pcm); + } + +@@ -634,6 +636,9 @@ static snd_pcm_chmap_t *snd_pcm_route_get_chmap(snd_pcm_t *pcm) + snd_pcm_chmap_t *map, *slave_map; + unsigned int src, dst, nsrcs; + ++ if (route->chmap_override) ++ return _snd_pcm_choose_fixed_chmap(pcm, route->chmap_override); ++ + slave_map = snd_pcm_generic_get_chmap(pcm); + if (!slave_map) + return NULL; +@@ -660,8 +665,14 @@ static snd_pcm_chmap_t *snd_pcm_route_get_chmap(snd_pcm_t *pcm) + + static snd_pcm_chmap_query_t **snd_pcm_route_query_chmaps(snd_pcm_t *pcm) + { ++ snd_pcm_route_t *route = pcm->private_data; + snd_pcm_chmap_query_t **maps; +- snd_pcm_chmap_t *map = snd_pcm_route_get_chmap(pcm); ++ snd_pcm_chmap_t *map; ++ ++ if (route->chmap_override) ++ return _snd_pcm_copy_chmap_query(route->chmap_override); ++ ++ map = snd_pcm_route_get_chmap(pcm); + if (!map) + return NULL; + maps = _snd_pcm_make_single_query_chmaps(map); +@@ -818,10 +829,10 @@ err: + return -EINVAL; + } + +-static int find_matching_chmap(snd_pcm_t *spcm, snd_pcm_chmap_t *tt_chmap, ++static int find_matching_chmap(snd_pcm_chmap_query_t **chmaps, ++ snd_pcm_chmap_t *tt_chmap, + snd_pcm_chmap_t **found_chmap, int *schannels) + { +- snd_pcm_chmap_query_t** chmaps = snd_pcm_query_chmaps(spcm); + int i; + + *found_chmap = NULL; +@@ -854,7 +865,6 @@ static int find_matching_chmap(snd_pcm_t *spcm, snd_pcm_chmap_t *tt_chmap, + int size = sizeof(snd_pcm_chmap_t) + c->channels * sizeof(unsigned int); + *found_chmap = malloc(size); + if (!*found_chmap) { +- snd_pcm_free_chmaps(chmaps); + return -ENOMEM; + } + memcpy(*found_chmap, c, size); +@@ -863,8 +873,6 @@ static int find_matching_chmap(snd_pcm_t *spcm, snd_pcm_chmap_t *tt_chmap, + } + } + +- snd_pcm_free_chmaps(chmaps); +- + if (*found_chmap == NULL) { + SNDERR("Found no matching channel map"); + return -EINVAL; +@@ -1252,6 +1260,7 @@ pcm.name { + SCHANNEL REAL # route value (0.0 - 1.0) + } + } ++ [chmap MAP] # Override channel maps; MAP is a string array + } + \endcode + +@@ -1292,6 +1301,7 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name, + snd_pcm_route_ttable_entry_t *ttable = NULL; + unsigned int csize, ssize; + unsigned int cused, sused; ++ snd_pcm_chmap_query_t **chmaps = NULL; + snd_config_for_each(i, next, conf) { + snd_config_t *n = snd_config_iterator_entry(i); + const char *id; +@@ -1306,31 +1316,45 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name, + if (strcmp(id, "ttable") == 0) { + if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) { + SNDERR("Invalid type for %s", id); ++ snd_pcm_free_chmaps(chmaps); + return -EINVAL; + } + tt = n; + continue; + } ++ if (strcmp(id, "chmap") == 0) { ++ chmaps = _snd_pcm_parse_config_chmaps(n); ++ if (!chmaps) { ++ SNDERR("Invalid channel map for %s", id); ++ return -EINVAL; ++ } ++ continue; ++ } + SNDERR("Unknown field %s", id); + return -EINVAL; + } + if (!slave) { + SNDERR("slave is not defined"); ++ snd_pcm_free_chmaps(chmaps); + return -EINVAL; + } + if (!tt) { + SNDERR("ttable is not defined"); ++ snd_pcm_free_chmaps(chmaps); + return -EINVAL; + } + err = snd_pcm_slave_conf(root, slave, &sconf, 2, + SND_PCM_HW_PARAM_FORMAT, 0, &sformat, + SND_PCM_HW_PARAM_CHANNELS, 0, &schannels); +- if (err < 0) ++ if (err < 0) { ++ snd_pcm_free_chmaps(chmaps); + return err; ++ } + if (sformat != SND_PCM_FORMAT_UNKNOWN && + snd_pcm_format_linear(sformat) != 1) { + snd_config_delete(sconf); + SNDERR("slave format is not linear"); ++ snd_pcm_free_chmaps(chmaps); + return -EINVAL; + } + +@@ -1345,13 +1369,19 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name, + if (err < 0) { + free(tt_chmap); + free(ttable); ++ snd_pcm_free_chmaps(chmaps); + return err; + } + + if (tt_chmap) { +- err = find_matching_chmap(spcm, tt_chmap, &chmap, &schannels); ++ if (!chmaps) ++ chmaps = snd_pcm_query_chmaps(spcm); ++ if (chmaps) ++ err = find_matching_chmap(chmaps, tt_chmap, &chmap, ++ &schannels); + free(tt_chmap); +- if (err < 0) { ++ if (chmaps && err < 0) { ++ snd_pcm_free_chmaps(chmaps); + snd_pcm_close(spcm); + return err; + } +@@ -1360,12 +1390,14 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name, + err = _snd_pcm_route_determine_ttable(tt, &csize, &ssize, chmap); + if (err < 0) { + free(chmap); ++ snd_pcm_free_chmaps(chmaps); + snd_pcm_close(spcm); + return err; + } + ttable = malloc(csize * ssize * sizeof(snd_pcm_route_ttable_entry_t)); + if (ttable == NULL) { + free(chmap); ++ snd_pcm_free_chmaps(chmaps); + snd_pcm_close(spcm); + return -ENOMEM; + } +@@ -1374,6 +1406,7 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name, + if (err < 0) { + free(chmap); + free(ttable); ++ snd_pcm_free_chmaps(chmaps); + snd_pcm_close(spcm); + return err; + } +@@ -1385,9 +1418,13 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name, + free(ttable); + if (err < 0) { + free(chmap); ++ snd_pcm_free_chmaps(chmaps); + snd_pcm_close(spcm); + } else { +- ((snd_pcm_route_t*) (*pcmp)->private_data)->chmap = chmap; ++ snd_pcm_route_t *route = (*pcmp)->private_data; ++ ++ route->chmap = chmap; ++ route->chmap_override = chmaps; + } + + return err; +-- +2.25.1 + + +From 341326c21ededb8c768c43ec2c9c7a80e7a26d35 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 3 Apr 2020 18:00:43 +0200 +Subject: [PATCH 12/14] usecase: allow indexes also for modifier names + +Signed-off-by: Jaroslav Kysela +--- + include/use-case.h | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/include/use-case.h b/include/use-case.h +index 27cb3fe1..c2ba79a9 100644 +--- a/include/use-case.h ++++ b/include/use-case.h +@@ -120,7 +120,7 @@ extern "C" { + * allowed. The names with numbers must be continuous. It is allowed to put + * a whitespace between name and index (like 'Line 1') for the better + * readability. The device names 'Line 1' and 'Line1' are equal for +- * thus purpose. ++ * this purpose. + * + * If EnableSequence/DisableSequence controls independent paths in the hardware + * it is also recommended to split playback and capture UCM devices and use +@@ -149,6 +149,13 @@ extern "C" { + * The use case modifier allows runtime configuration changes to deal with + * asynchronous events. + * ++ * If multiple modifiers with the same name exists, the number suffixes should ++ * be added to these names like 'Echo Reference 1','Echo Reference 2' etc. ++ * No number gaps are allowed. The names with numbers must be continuous. ++ * It is allowed to put a whitespace between name and index for the better ++ * readability. The modifier names 'Something 1' and 'Something1' are equal ++ * for this purpose. ++ * + * e.g. to record a voice call :- + * 1. Set verb to SND_USE_CASE_VERB_VOICECALL (for voice call) + * 2. Set modifier SND_USE_CASE_MOD_CAPTURE_VOICE when capture required. +-- +2.25.1 + + +From c9605484d165d2b707f78eef14a224b0b47ba322 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 6 Apr 2020 13:25:43 +0200 +Subject: [PATCH 13/14] ucm: fix the device remove operation + +- allow to remove device only from conflicting lists +- unify the error codes when the device is not found (ENODEV) + +Signed-off-by: Jaroslav Kysela +--- + src/ucm/utils.c | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +diff --git a/src/ucm/utils.c b/src/ucm/utils.c +index 50b2a1df..d78ba91c 100644 +--- a/src/ucm/utils.c ++++ b/src/ucm/utils.c +@@ -371,7 +371,7 @@ int uc_mgr_rename_in_dev_list(struct dev_list *dev_list, const char *src, + return 0; + } + } +- return -ENOENT; ++ return -ENODEV; + } + + int uc_mgr_remove_from_dev_list(struct dev_list *dev_list, const char *name) +@@ -528,17 +528,22 @@ int uc_mgr_remove_device(struct use_case_verb *verb, const char *name) + { + struct use_case_device *device; + struct list_head *pos, *npos; ++ int err, found = 0; + + list_for_each_safe(pos, npos, &verb->device_list) { + device = list_entry(pos, struct use_case_device, list); + if (strcmp(device->name, name) == 0) { + uc_mgr_free_device(device); ++ found++; + continue; + } +- uc_mgr_remove_from_dev_list(&device->dev_list, name); +- return 0; ++ err = uc_mgr_remove_from_dev_list(&device->dev_list, name); ++ if (err < 0 && err != -ENODEV) ++ return err; ++ if (err == 0) ++ found++; + } +- return -ENOENT; ++ return found == 0 ? -ENODEV : 0; + } + + void uc_mgr_free_verb(snd_use_case_mgr_t *uc_mgr) +-- +2.25.1 + + +From fb48ad9e4f6b84fd4ade689bd79e3a3c37d3e034 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 6 Apr 2020 17:20:24 +0200 +Subject: [PATCH 14/14] ucm: fix copy-n-paste typo (RemoveDevice list) + +Signed-off-by: Jaroslav Kysela +--- + src/ucm/parser.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/ucm/parser.c b/src/ucm/parser.c +index 0001e595..aca5ea8c 100644 +--- a/src/ucm/parser.c ++++ b/src/ucm/parser.c +@@ -1176,7 +1176,7 @@ static int verb_device_management(struct use_case_verb *verb) + } + + /* remove devices */ +- list_for_each(pos, &verb->rename_list) { ++ list_for_each(pos, &verb->remove_list) { + dev = list_entry(pos, struct ucm_dev_name, list); + err = uc_mgr_remove_device(verb, dev->name2); + if (err < 0) { +-- +2.25.1 + diff --git a/alsa-lib.spec b/alsa-lib.spec index 8d16958..1b93290 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 1%{?prever_dot}%{?dist} +Release: 2%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -163,8 +163,11 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Mon Apr 6 2020 Jaroslav Kysela - 1.2.2-2 +- UCM2 fixes (RemoveDevice), bug#1786723 + * Wed Feb 19 2020 Jaroslav Kysela - 1.2.2-1 -- Udpated to 1.2.2 +- Updated to 1.2.2 * Sun Feb 9 2020 Jaroslav Kysela - 1.2.1.2-6 - More UCM2 related fixes From e7697e8bed6f1735df6e7c02bd60e5a417a8b8a3 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 6 Apr 2020 17:47:37 +0200 Subject: [PATCH 037/120] update to latest UCM configs --- alsa-ucm-conf.patch | 1018 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1018 insertions(+) diff --git a/alsa-ucm-conf.patch b/alsa-ucm-conf.patch index e69de29..51b93da 100644 --- a/alsa-ucm-conf.patch +++ b/alsa-ucm-conf.patch @@ -0,0 +1,1018 @@ +From 46222753fdddc86d6a0b92c465875f71c628a779 Mon Sep 17 00:00:00 2001 +From: Pierre-Louis Bossart +Date: Thu, 27 Feb 2020 12:40:20 -0600 +Subject: [PATCH 01/10] sof-bdw-rt5677: initial port to UCM2 + +Tested on Pixel 2015/SAMUS Chromebook. + +Known limitations: +Left/Right confusion (probably a firmware issue) +PulseAudio does not switch capture devices on headset plug + +Signed-off-by: Pierre-Louis Bossart +Signed-off-by: Jaroslav Kysela +--- + ucm2/sof-bdw-rt5677/HiFi.conf | 194 ++++++++++++++++++++++++ + ucm2/sof-bdw-rt5677/sof-bdw-rt5677.conf | 6 + + 2 files changed, 200 insertions(+) + create mode 100644 ucm2/sof-bdw-rt5677/HiFi.conf + create mode 100644 ucm2/sof-bdw-rt5677/sof-bdw-rt5677.conf + +diff --git a/ucm2/sof-bdw-rt5677/HiFi.conf b/ucm2/sof-bdw-rt5677/HiFi.conf +new file mode 100644 +index 0000000..f4b1449 +--- /dev/null ++++ b/ucm2/sof-bdw-rt5677/HiFi.conf +@@ -0,0 +1,194 @@ ++# Use case Configuration for sof-bdw-rt5677 ++# command-line sequence to switch playback/capture ++# alsaucm -c sof-bdw-rt5677 set _verb HiFi ++# alsaucm -c sof-bdw-rt5677 set _verb HiFi set _enadev Headphones ++ ++ ++SectionVerb { ++ ++ EnableSequence [ ++ ++ cset "name='PDM1 L Mux' STO1 DAC MIX" ++ cset "name='PDM1 R Mux' STO1 DAC MIX" ++ ++ # Adjust Master Playback volume if needed ++ # cset "name='Master Playback Volume' 30" ++ ++ cset "name='OUT1 Playback Switch' off" ++ cset "name='OUT2 Playback Switch' off" ++ ++ cset "name='DAC1 Playback Volume' 175" ++ cset "name='DAC2 Playback Volume' 175" ++ cset "name='DAC12 SRC Mux' STO1 DAC MIX" ++ ++ cset "name='Stereo DAC MIXL ST L Switch' off" ++ cset "name='Stereo DAC MIXL DAC1 L Switch' off" ++ cset "name='Stereo DAC MIXL DAC2 L Switch' off" ++ cset "name='Stereo DAC MIXL DAC1 R Switch' on" ++ ++ cset "name='Stereo DAC MIXR ST R Switch' off" ++ cset "name='Stereo DAC MIXR DAC1 R Switch' off" ++ cset "name='Stereo DAC MIXR DAC2 R Switch' off" ++ cset "name='Stereo DAC MIXR DAC1 L Switch' on" ++ ++ cset "name='DAC1 MIXL Stereo ADC Switch' off" ++ cset "name='DAC1 MIXL DAC1 Switch' on" ++ ++ cset "name='DAC1 MIXR Stereo ADC Switch' off" ++ cset "name='DAC1 MIXR DAC1 Switch' on" ++ ++ cset "name='DAC1 Mux' IF1 DAC 01" ++ ++ cset "name='Stereo1 DMIC Mux' DMIC1" ++ cset "name='Stereo1 ADC2 Mux' DMIC" ++ cset "name='Stereo1 ADC1 Mux' ADC1/2" ++ ++ cset "name='Sto1 ADC MIXL ADC1 Switch' off" ++ cset "name='Sto1 ADC MIXL ADC2 Switch' off" ++ cset "name='Sto1 ADC MIXL ADC2 Switch' on" ++ ++ cset "name='Sto1 ADC MIXR ADC1 Switch' off" ++ cset "name='Sto1 ADC MIXR ADC2 Switch' off" ++ cset "name='Sto1 ADC MIXR ADC2 Switch' on" ++ ++ cset "name='IF1 ADC1 Mux' STO1 ADC MIX" ++ cset "name='IF1 ADC1 Swap Mux' L/R" ++ ++ # Adjust Mic Capture Volume if needed ++ # cset "name='Mic Capture Volume' 30" ++ ++ cset "name='ADC1 Capture Switch' on" ++ cset "name='ADC1 Capture Volume' 31" ++ cset "name='STO1 ADC Boost Volume' 2" ++ ++ cset "name='Headphone Switch' off" ++ cset "name='Speaker Switch' on" ++ ++ cset "name='Remote DMICs Switch' on" ++ cset "name='Mono DMIC L Mux' DMIC1" ++ cset "name='Mono ADC2 L Mux' DMIC" ++ cset "name='Mono ADC MIXL ADC1 Switch' off" ++ cset "name='Mono ADC MIXL ADC2 Switch' on" ++ cset "name='VAD ADC Mux' MONO ADC MIX L" ++ cset "name='IB01 Mux' VAD ADC/DAC1 FS" ++ cset "name='IB01 Bypass Mux' Bypass" ++ cset "name='Mono ADC Boost Volume' 2" ++ ] ++ ++ DisableSequence [ ++ ] ++} ++ ++SectionDevice."Speaker" { ++ Comment "Speakers" ++ ++ ConflictingDevice [ ++ "Headphones" ++ ] ++ ++ EnableSequence [ ++ ] ++ ++ DisableSequence [ ++ ] ++ ++ Value { ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId}" ++ } ++} ++ ++ ++SectionDevice."Headphones" { ++ Comment "Headphones" ++ ++ ConflictingDevice [ ++ "Speaker" ++ ] ++ ++ EnableSequence [ ++ cset "name='Speaker Switch' off" ++ cset "name='Stereo DAC MIXL DAC1 R Switch' off" ++ cset "name='Stereo DAC MIXR DAC1 L Switch' off" ++ cset "name='Stereo DAC MIXL DAC1 L Switch' on" ++ cset "name='Stereo DAC MIXR DAC1 R Switch' on" ++ cset "name='OUT1 Playback Switch' on" ++ cset "name='OUT2 Playback Switch' on" ++ cset "name='Headphone Switch' on" ++ ] ++ ++ DisableSequence [ ++ cset "name='Headphone Switch' off" ++ cset "name='OUT1 Playback Switch' off" ++ cset "name='OUT2 Playback Switch' off" ++ cset "name='Stereo DAC MIXL DAC1 L Switch' off" ++ cset "name='Stereo DAC MIXR DAC1 R Switch' off" ++ cset "name='Stereo DAC MIXL DAC1 R Switch' on" ++ cset "name='Stereo DAC MIXR DAC1 L Switch' on" ++ cset "name='Speaker Switch' on" ++ ] ++ ++ Value { ++ PlaybackPriority 300 ++ PlaybackPCM "hw:${CardId}" ++ JackControl "Headphone Jack" ++ JackHWMute "Speakers" ++ } ++} ++ ++SectionDevice."Mic" { ++ Comment "Internal Microphone" ++ ++ ConflictingDevice [ ++ "Headset" ++ ] ++ ++ EnableSequence [ ++ ] ++ ++ DisableSequence [ ++ ] ++ ++ Value { ++ CapturePriority 100 ++ CapturePCM "hw:${CardId}" ++ } ++} ++ ++SectionDevice."Headset" { ++ Comment "Headset Microphone" ++ ++ ConflictingDevice [ ++ "Mic" ++ ] ++ ++ EnableSequence [ ++ cset "name='Sto1 ADC MIXL ADC2 Switch' off" ++ cset "name='Sto1 ADC MIXR ADC2 Switch' off" ++ cset "name='Local DMICs Switch' off" ++ ++ cset "name='IF1 ADC1 Swap Mux' L/L" ++ ++ cset "name='Sto1 ADC MIXL ADC1 Switch' on" ++ cset "name='Sto1 ADC MIXR ADC1 Switch' on" ++ cset "name='Headset Mic Switch' on" ++ ] ++ ++ DisableSequence [ ++ cset "name='Sto1 ADC MIXL ADC1 Switch' off" ++ cset "name='Sto1 ADC MIXR ADC1 Switch' off" ++ cset "name='Headset Mic Switch' off" ++ ++ cset "name='IF1 ADC1 Swap Mux' L/R" ++ ++ cset "name='Sto1 ADC MIXL ADC2 Switch' on" ++ cset "name='Sto1 ADC MIXR ADC2 Switch' on" ++ cset "name='Local DMICs Switch' on" ++ ] ++ ++ Value { ++ CapturePriority 300 ++ CapturePCM "hw:${CardId}" ++ JackControl "Mic Jack" ++ } ++} +diff --git a/ucm2/sof-bdw-rt5677/sof-bdw-rt5677.conf b/ucm2/sof-bdw-rt5677/sof-bdw-rt5677.conf +new file mode 100644 +index 0000000..d672df2 +--- /dev/null ++++ b/ucm2/sof-bdw-rt5677/sof-bdw-rt5677.conf +@@ -0,0 +1,6 @@ ++Syntax 2 ++ ++SectionUseCase."HiFi" { ++ File "HiFi.conf" ++ Comment "Default" ++} +-- +2.25.1 + + +From da45a07c756308b57facf1a97c4842274ff04fe3 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Sun, 1 Mar 2020 16:12:28 +0100 +Subject: [PATCH 02/10] ucm2: treewide - JackHWMute fixes + +Fixes: https://github.com/alsa-project/alsa-ucm-conf/issues/14 + +Signed-off-by: Jaroslav Kysela +--- + ucm2/HDA-Intel/HiFi-dual.conf | 1 + + ucm2/broxton-rt298/HiFi.conf | 1 - + ucm2/chtrt5645/HiFi-dmic2.conf | 2 +- + ucm2/skylake-rt286/HiFi.conf | 1 - + ucm2/sof-bdw-rt5677/HiFi.conf | 2 +- + 5 files changed, 3 insertions(+), 4 deletions(-) + +diff --git a/ucm2/HDA-Intel/HiFi-dual.conf b/ucm2/HDA-Intel/HiFi-dual.conf +index 174fef4..277894a 100644 +--- a/ucm2/HDA-Intel/HiFi-dual.conf ++++ b/ucm2/HDA-Intel/HiFi-dual.conf +@@ -93,6 +93,7 @@ SectionDevice."Mic2" { + CapturePriority 300 + CapturePCM "hw:${CardId}" + JackHWMute "Line2" ++ JackControl "Mic Jack" + } + + ConflictingDevice [ +diff --git a/ucm2/broxton-rt298/HiFi.conf b/ucm2/broxton-rt298/HiFi.conf +index 6f5b9a5..f7e561f 100644 +--- a/ucm2/broxton-rt298/HiFi.conf ++++ b/ucm2/broxton-rt298/HiFi.conf +@@ -30,7 +30,6 @@ SectionDevice."Speaker" { + Value { + PlaybackPriority 100 + PlaybackPCM "hw:${CardId}" +- JackHWMute "Headphones" + } + } + +diff --git a/ucm2/chtrt5645/HiFi-dmic2.conf b/ucm2/chtrt5645/HiFi-dmic2.conf +index c9fdd79..d3f880a 100644 +--- a/ucm2/chtrt5645/HiFi-dmic2.conf ++++ b/ucm2/chtrt5645/HiFi-dmic2.conf +@@ -98,7 +98,7 @@ SectionDevice."Headset" { + CapturePriority 200 + CapturePCM "hw:${CardId}" + JackControl "Headset Mic Jack" +- JackHWMute "DMic" ++ JackHWMute "Mic" + } + + EnableSequence [ +diff --git a/ucm2/skylake-rt286/HiFi.conf b/ucm2/skylake-rt286/HiFi.conf +index 9e94a1b..ed4bfa7 100644 +--- a/ucm2/skylake-rt286/HiFi.conf ++++ b/ucm2/skylake-rt286/HiFi.conf +@@ -51,7 +51,6 @@ SectionDevice."Speaker" { + Value { + PlaybackPriority 100 + PlaybackPCM "hw:${CardId}" +- JackHWMute "Headphones" + } + } + +diff --git a/ucm2/sof-bdw-rt5677/HiFi.conf b/ucm2/sof-bdw-rt5677/HiFi.conf +index f4b1449..724a1cc 100644 +--- a/ucm2/sof-bdw-rt5677/HiFi.conf ++++ b/ucm2/sof-bdw-rt5677/HiFi.conf +@@ -132,7 +132,7 @@ SectionDevice."Headphones" { + PlaybackPriority 300 + PlaybackPCM "hw:${CardId}" + JackControl "Headphone Jack" +- JackHWMute "Speakers" ++ JackHWMute "Speaker" + } + } + +-- +2.25.1 + + +From 4722f5b3859903521ba0f92a64d86af31083ca50 Mon Sep 17 00:00:00 2001 +From: Kai Vehmanen +Date: Thu, 5 Mar 2020 14:59:56 +0200 +Subject: [PATCH 03/10] sof-hda-dsp: Support systems without integrated + graphics audio + +On systems where integrated graphics audio is not present +or is disabled, the HDMI PCM nodes are disabled. Add rules to +detect these systems by checking presence of HDMI jack controls +with UCM2 rules. + +Signed-off-by: Kai Vehmanen +Signed-off-by: Jaroslav Kysela +--- + ucm2/sof-hda-dsp/Hdmi.conf | 96 ++++++++++++++++++++++++-------------- + 1 file changed, 60 insertions(+), 36 deletions(-) + +diff --git a/ucm2/sof-hda-dsp/Hdmi.conf b/ucm2/sof-hda-dsp/Hdmi.conf +index be6cb39..6f2c4aa 100644 +--- a/ucm2/sof-hda-dsp/Hdmi.conf ++++ b/ucm2/sof-hda-dsp/Hdmi.conf +@@ -1,55 +1,79 @@ + # Use case Configuration for sof-hda-dsp + +-SectionDevice."HDMI1" { +- Comment "HDMI1/DP1 Output" ++If.hdmi1 { ++ Condition { ++ Type ControlExists ++ Control "iface=CARD,name='HDMI/DP,pcm=3 Jack'" ++ } ++ True { ++ SectionDevice."HDMI1" { ++ Comment "HDMI1/DP1 Output" + +- EnableSequence [ +- cset "name='IEC958 Playback Switch' on" +- ] ++ EnableSequence [ ++ cset "name='IEC958 Playback Switch' on" ++ ] + +- DisableSequence [ +- cset "name='IEC958 Playback Switch' off" +- ] ++ DisableSequence [ ++ cset "name='IEC958 Playback Switch' off" ++ ] + +- Value { +- PlaybackPriority 500 +- PlaybackPCM "hw:${CardId},3" +- JackControl "HDMI/DP,pcm=3 Jack" ++ Value { ++ PlaybackPriority 500 ++ PlaybackPCM "hw:${CardId},3" ++ JackControl "HDMI/DP,pcm=3 Jack" ++ } ++ } + } + } + +-SectionDevice."HDMI2" { +- Comment "HDMI2/DP2 Output" ++If.hdmi2 { ++ Condition { ++ Type ControlExists ++ Control "iface=CARD,name='HDMI/DP,pcm=4 Jack'" ++ } ++ True { ++ SectionDevice."HDMI2" { ++ Comment "HDMI2/DP2 Output" + +- EnableSequence [ +- cset "name='IEC958 Playback Switch',index=1 on" +- ] ++ EnableSequence [ ++ cset "name='IEC958 Playback Switch',index=1 on" ++ ] + +- DisableSequence [ +- cset "name='IEC958 Playback Switch',index=1 off" +- ] ++ DisableSequence [ ++ cset "name='IEC958 Playback Switch',index=1 off" ++ ] + +- Value { +- PlaybackPriority 600 +- PlaybackPCM "hw:${CardId},4" +- JackControl "HDMI/DP,pcm=4 Jack" ++ Value { ++ PlaybackPriority 600 ++ PlaybackPCM "hw:${CardId},4" ++ JackControl "HDMI/DP,pcm=4 Jack" ++ } ++ } + } + } + +-SectionDevice."HDMI3" { +- Comment "HDMI3/DP3 Output" ++If.hdmi3 { ++ Condition { ++ Type ControlExists ++ Control "iface=CARD,name='HDMI/DP,pcm=5 Jack'" ++ } ++ True { ++ SectionDevice."HDMI3" { ++ Comment "HDMI3/DP3 Output" + +- EnableSequence [ +- cset "name='IEC958 Playback Switch',index=2 on" +- ] ++ EnableSequence [ ++ cset "name='IEC958 Playback Switch',index=2 on" ++ ] + +- DisableSequence [ +- cset "name='IEC958 Playback Switch',index=2 off" +- ] ++ DisableSequence [ ++ cset "name='IEC958 Playback Switch',index=2 off" ++ ] + +- Value { +- PlaybackPriority 700 +- PlaybackPCM "hw:${CardId},5" +- JackControl "HDMI/DP,pcm=5 Jack" ++ Value { ++ PlaybackPriority 700 ++ PlaybackPCM "hw:${CardId},5" ++ JackControl "HDMI/DP,pcm=5 Jack" ++ } ++ } + } + } +-- +2.25.1 + + +From 76df616aa2fcae1cca1f948dac24c98a211c2593 Mon Sep 17 00:00:00 2001 +From: Mateusz Gorski +Date: Wed, 18 Mar 2020 11:26:05 +0100 +Subject: [PATCH 04/10] hda-dsp: add basic ucm config + +Basic UCM configuration for Intel Skylake SST with HDA DSP generic +machine driver enabling codec playback and capture on both HDA codec +and DMIC ports. + +Signed-off-by: Mateusz Gorski +Signed-off-by: Jaroslav Kysela +--- + ucm2/hda-dsp/Hdmi1.conf | 24 ++++++++++ + ucm2/hda-dsp/Hdmi2.conf | 23 ++++++++++ + ucm2/hda-dsp/HiFi.conf | 96 +++++++++++++++++++++++++++++++++++++++ + ucm2/hda-dsp/hda-dsp.conf | 16 +++++++ + 4 files changed, 159 insertions(+) + create mode 100644 ucm2/hda-dsp/Hdmi1.conf + create mode 100644 ucm2/hda-dsp/Hdmi2.conf + create mode 100644 ucm2/hda-dsp/HiFi.conf + create mode 100644 ucm2/hda-dsp/hda-dsp.conf + +diff --git a/ucm2/hda-dsp/Hdmi1.conf b/ucm2/hda-dsp/Hdmi1.conf +new file mode 100644 +index 0000000..08fa5dd +--- /dev/null ++++ b/ucm2/hda-dsp/Hdmi1.conf +@@ -0,0 +1,24 @@ ++# Usecase for device HDMI1/Display Port stereo playback on Intel cAVS platforms ++# For Audio in HDA mode ++ ++SectionDevice."HDMI1" { ++ Comment "HDMI/Display Port 1 Stereo" ++ ++ Value { ++ PlaybackPriority 300 ++ PlaybackPCM "hw:${CardId},10" ++ If.1 { ++ Condition { ++ Type ControlExists ++ Control "iface=CARD,name='HDMI/DP,pcm=17 Jack'" ++ } ++ True { ++ JackControl "HDMI/DP,pcm=17 Jack" ++ } ++ False { ++ JackControl "HDMI/DP, pcm=17 Jack" ++ } ++ } ++ } ++} ++ +diff --git a/ucm2/hda-dsp/Hdmi2.conf b/ucm2/hda-dsp/Hdmi2.conf +new file mode 100644 +index 0000000..eb168ea +--- /dev/null ++++ b/ucm2/hda-dsp/Hdmi2.conf +@@ -0,0 +1,23 @@ ++# Usecase for device HDMI2/Display Port stereo playback on Intel cAVS platforms ++# For Audio in HDA mode ++ ++SectionDevice."HDMI2" { ++ Comment "HDMI/Display Port 2 Stereo" ++ ++ Value { ++ PlaybackPriority 400 ++ PlaybackPCM "hw:${CardId},11" ++ If.1 { ++ Condition { ++ Type ControlExists ++ Control "iface=CARD,name='HDMI/DP,pcm=18 Jack'" ++ } ++ True { ++ JackControl "HDMI/DP,pcm=18 Jack" ++ } ++ False { ++ JackControl "HDMI/DP, pcm=18 Jack" ++ } ++ } ++ } ++} +diff --git a/ucm2/hda-dsp/HiFi.conf b/ucm2/hda-dsp/HiFi.conf +new file mode 100644 +index 0000000..cdeb215 +--- /dev/null ++++ b/ucm2/hda-dsp/HiFi.conf +@@ -0,0 +1,96 @@ ++# Usecase for stereo playback Speaker and Headset, Recording on DMIC and Headset MIC. ++# For Audio in HDA mode on Intel cAVS platforms ++ ++SectionVerb { ++ ++ EnableSequence [ ++ cset "name='mch_cap_out mo mch_cap_in mi Switch' 1" ++ ] ++ ++ Value { ++ TQ "HiFi" ++ } ++} ++ ++SectionDevice."Headphones" { ++ Comment "Headphones" ++ ++ ConflictingDevice [ ++ "Speaker" ++ ] ++ ++ EnableSequence [ ++ cset "name='Headphone Playback Switch' 1,1" ++ cset "name='Speaker Playback Switch' 0,0" ++ ] ++ ++ Value { ++ PlaybackPriority 200 ++ PlaybackPCM "hw:${CardId},7" ++ PlaybackMixerElem "Headphone" ++ PlaybackMasterElem "Master" ++ PlaybackVolume "Headphone Playback Volume" ++ PlaybackSwitch "Headphone Playback Switch" ++ JackControl "Front Headphone Jack" ++ JackHWMute "Speaker" ++ } ++} ++ ++SectionDevice."Speaker" { ++ Comment "Speaker" ++ ++ ConflictingDevice [ ++ "Headphones" ++ ] ++ ++ EnableSequence [ ++ cset "name='Headphone Playback Switch' 0,0" ++ cset "name='Speaker Playback Switch' 1,1" ++ ] ++ ++ Value { ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId},7" ++ PlaybackMixerElem "Speaker" ++ PlaybackMasterElem "Master" ++ PlaybackVolume "Speaker Playback Volume" ++ PlaybackSwitch "Speaker Playback Switch" ++ } ++} ++ ++SectionDevice."Headset" { ++ Comment "Headset Microphone" ++ ++ ConflictingDevice [ ++ "Mic" ++ ] ++ ++ EnableSequence [ ++ cset "name='media0_out mo codec0_in mi Switch' 1" ++ ] ++ ++ Value { ++ CapturePriority 200 ++ CapturePCM "hw:${CardId},7" ++ } ++} ++ ++SectionDevice."Mic" { ++ Comment "Digital Microphone" ++ ++ ConflictingDevice [ ++ "Headset" ++ ] ++ ++ EnableSequence [ ++ cset "name='mch_cap_out mo mch_cap_in mi Switch' 1" ++ ] ++ ++ Value { ++ CapturePriority 100 ++ CapturePCM "hw:${CardId},13" ++ } ++} ++ ++ ++ +diff --git a/ucm2/hda-dsp/hda-dsp.conf b/ucm2/hda-dsp/hda-dsp.conf +new file mode 100644 +index 0000000..bf80b09 +--- /dev/null ++++ b/ucm2/hda-dsp/hda-dsp.conf +@@ -0,0 +1,16 @@ ++# UCM for Intel CAVS platforms ++# For Audio in HDA and DMIC mode ++ ++Syntax 2 ++ ++SectionUseCase."HiFi" { ++ File "HiFi.conf" ++ Comment "Play HiFi quality Music" ++} ++ ++SectionDefaults [ ++ cset "name='Master Playback Switch' 1" ++ cset "name='codec0_out mo media0_in mi Switch' 1" ++ cset "name='media0_out mo codec0_in mi Switch' 1" ++ cset "name='mch_cap_out mo mch_cap_in mi Switch' 1" ++] +-- +2.25.1 + + +From 340b8a1d6aaa164bc27bdb8811cc00d729ca2e45 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 30 Mar 2020 16:51:45 +0200 +Subject: [PATCH 05/10] update README files + +- UCM validator +- UCM paths for ucm2/ + +Signed-off-by: Jaroslav Kysela +--- + README.md | 6 ++++++ + ucm2/README.md | 34 +++++++++++++++++++++++++++++++--- + 2 files changed, 37 insertions(+), 3 deletions(-) + +diff --git a/README.md b/README.md +index 574c93c..c5afd96 100644 +--- a/README.md ++++ b/README.md +@@ -2,3 +2,9 @@ + ## ALSA Use Case Manager configuration + + ![Validate UCM configuration](https://github.com/alsa-project/alsa-ucm-conf/workflows/Validate%20UCM%20configuration/badge.svg?branch=master) ++ ++The UCM configurations are automatically valited using the UCM validator ++available at https://github.com/alsa-project/alsa-tests/tree/master/python/ucm-validator . ++ ++If you create a pull request for new hardware, please, add also the ++alsa-info.sh output to emulate this hardware in the UCM validator. +diff --git a/ucm2/README.md b/ucm2/README.md +index 3aefdf7..fc2a178 100644 +--- a/ucm2/README.md ++++ b/ucm2/README.md +@@ -7,9 +7,37 @@ Library directories: + codecs/ + dsps/ + +-Those directories are not inspected for the list of +-available UCM configurations. They contain files +-included from other UCMs. ++Those directories are not inspected for the list of available UCM ++configurations. They contain files included from other UCMs. ++ ++UCM master configuration path lookup (by priority): ++ ++- {ucm_card_name}/{long_card_name}.conf ++- {ucm_card_name}/{ucm_card_name}.conf ++- {driver_name}/{long_card_name}.conf ++- {driver_name}/{driver_name}.conf ++ ++For example: ++ ++- USB-Audio/Dell-WD15-Dock.conf ++-- special configuration for the Dell docking station with USB soundcard ++- TwoCardsMix/TwoCardsMix.conf ++-- virtual UCM from two soundcards ++ ++Note: For the driver configurations, use always the real driver name ++not the ucm card name configuration paths! ++ ++The driver name can be obtained using procfs like: ++ ++```` ++ cat /proc/asound/cards ++ 1 [NVidia ]: HDA-Intel - HDA NVidia ++ HDA NVidia at 0xb5080000 irq 17 ++ ++ driver name: HDA-Intel ++ card short name: HDA NVidia ++ card long name: HDA NVidia at 0xb5080000 irq 17 ++```` + + Syntax, value names + ------------------- +-- +2.25.1 + + +From 85ca26a4f2b73888dbce3437a402df13faf628fa Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Sun, 5 Apr 2020 20:34:50 +0200 +Subject: [PATCH 06/10] bytcr-rt5651: Fix dmic check in HiFi-Components.conf + +The kernel sets cfg-mic:dmic not cfg-mic:dmic1 when a digital mic is +used. The wrong check for cfg-mic:dmic1 causes there to be no "Mic" +device at all, which causes the check for the ConflictingDevices section +of the HeadSet (mic) device to fail like e.g. so: + +[hans@localhost ~]$ alsaucm -c bytcr-rt5651 set _verb HiFi set _enadev Speaker +ALSA lib parser.c:1138:(verb_dev_list_add) error: unable to find device 'Mic' +ALSA lib parser.c:1433:(parse_verb_file) error: device management error in verb 'HiFi' +ALSA lib main.c:962:(snd_use_case_mgr_open) error: failed to import bytcr-rt5651 use case configuration -2 +alsaucm: error failed to open sound card bytcr-rt5651: No such file or directory + +This commit fixes this. + +Signed-off-by: Hans de Goede +Signed-off-by: Jaroslav Kysela +--- + ucm2/bytcr-rt5651/HiFi-Components.conf | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/ucm2/bytcr-rt5651/HiFi-Components.conf b/ucm2/bytcr-rt5651/HiFi-Components.conf +index 53ebcbe..d0a573e 100644 +--- a/ucm2/bytcr-rt5651/HiFi-Components.conf ++++ b/ucm2/bytcr-rt5651/HiFi-Components.conf +@@ -34,11 +34,11 @@ If.headphones { + } + } + +-If.dmic1 { ++If.dmic { + Condition { + Type String + Haystack "${CardComponents}" +- Needle "cfg-mic:dmic1" ++ Needle "cfg-mic:dmic" + } + True { + +-- +2.25.1 + + +From aaa86069ab721683afcf978b9291219855db42f1 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Sun, 5 Apr 2020 20:34:51 +0200 +Subject: [PATCH 07/10] chtrt5645: Add ASUSTeKCOMPUTERINC.-T100HAN-1.0 symlink + to chtrt5645-dmic1.conf + +We already have a ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN symlink to +chtrt5645-dmic1.conf, but since kernel commit 39870b0dec68 ("ASoC: DMI long +name - avoid to add board name if matches with product name"), the kernel +omits the (second) -T100HAN. So with newer kernels that no longer works. + +Arguably this is a kernel regressions, but chances are we already have +some configs depending on the new behavior, so lets fix this on the +UCM2 side by adding a second symlink using the new long name. + +Signed-off-by: Hans de Goede +Signed-off-by: Jaroslav Kysela +--- + ucm2/chtrt5645/ASUSTeKCOMPUTERINC.-T100HAN-1.0.conf | 1 + + 1 file changed, 1 insertion(+) + create mode 120000 ucm2/chtrt5645/ASUSTeKCOMPUTERINC.-T100HAN-1.0.conf + +diff --git a/ucm2/chtrt5645/ASUSTeKCOMPUTERINC.-T100HAN-1.0.conf b/ucm2/chtrt5645/ASUSTeKCOMPUTERINC.-T100HAN-1.0.conf +new file mode 120000 +index 0000000..b4d2816 +--- /dev/null ++++ b/ucm2/chtrt5645/ASUSTeKCOMPUTERINC.-T100HAN-1.0.conf +@@ -0,0 +1 @@ ++chtrt5645-dmic1.conf +\ No newline at end of file +-- +2.25.1 + + +From 5ba4fd1dfca593248a603e5621bf2f53a4e2ddcc Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Sun, 5 Apr 2020 20:34:52 +0200 +Subject: [PATCH 08/10] chtrt5645: Add MEDION-E1239TMD60568-0.1-Wingman.conf + symlink to chtrt5645-dmic2.conf + +The Medion Akoya E1239T 2-in-1 uses a digital mic connected to the +dmic2 pin, rather then the default analog mic on in2. + +Add a long name symlink to chtrt5645-dmic2.conf for this, so that +the right config is used. + +Signed-off-by: Hans de Goede +Signed-off-by: Jaroslav Kysela +--- + ucm2/chtrt5645/MEDION-E1239TMD60568-0.1-Wingman.conf | 1 + + 1 file changed, 1 insertion(+) + create mode 120000 ucm2/chtrt5645/MEDION-E1239TMD60568-0.1-Wingman.conf + +diff --git a/ucm2/chtrt5645/MEDION-E1239TMD60568-0.1-Wingman.conf b/ucm2/chtrt5645/MEDION-E1239TMD60568-0.1-Wingman.conf +new file mode 120000 +index 0000000..7823e31 +--- /dev/null ++++ b/ucm2/chtrt5645/MEDION-E1239TMD60568-0.1-Wingman.conf +@@ -0,0 +1 @@ ++chtrt5645-dmic2.conf +\ No newline at end of file +-- +2.25.1 + + +From d0b1a426ba7cbfb34355a4101bb314ba288a6679 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Sun, 5 Apr 2020 20:34:53 +0200 +Subject: [PATCH 09/10] chtrt5645: Remove bogus JackHWMute settings + +There is no reason why the internal microphone or speakers cannot +be used when a headset is plugged in. + +The jack does not physically disconnect these, so the JackHWMute settings +are wrong, remove them. + +Signed-off-by: Hans de Goede +Signed-off-by: Jaroslav Kysela +--- + ucm2/chtrt5645/HiFi-dmic1.conf | 2 -- + ucm2/chtrt5645/HiFi-dmic2.conf | 2 -- + ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf | 2 -- + ucm2/chtrt5645/HiFi.conf | 2 -- + 4 files changed, 8 deletions(-) + +diff --git a/ucm2/chtrt5645/HiFi-dmic1.conf b/ucm2/chtrt5645/HiFi-dmic1.conf +index 1a8ee0a..c7e12c9 100644 +--- a/ucm2/chtrt5645/HiFi-dmic1.conf ++++ b/ucm2/chtrt5645/HiFi-dmic1.conf +@@ -50,7 +50,6 @@ SectionDevice."Headphones" { + PlaybackPriority 200 + PlaybackPCM "hw:${CardId}" + JackControl "Headphone Jack" +- JackHWMute "Speaker" + } + + ConflictingDevice [ +@@ -96,7 +95,6 @@ SectionDevice."Headset" { + CapturePriority 200 + CapturePCM "hw:${CardId}" + JackControl "Headset Mic Jack" +- JackHWMute "Mic" + } + + EnableSequence [ +diff --git a/ucm2/chtrt5645/HiFi-dmic2.conf b/ucm2/chtrt5645/HiFi-dmic2.conf +index d3f880a..95fedb3 100644 +--- a/ucm2/chtrt5645/HiFi-dmic2.conf ++++ b/ucm2/chtrt5645/HiFi-dmic2.conf +@@ -50,7 +50,6 @@ SectionDevice."Headphones" { + PlaybackPriority 200 + PlaybackPCM "hw:${CardId}" + JackControl "Headphone Jack" +- JackHWMute "Speaker" + } + + ConflictingDevice [ +@@ -98,7 +97,6 @@ SectionDevice."Headset" { + CapturePriority 200 + CapturePCM "hw:${CardId}" + JackControl "Headset Mic Jack" +- JackHWMute "Mic" + } + + EnableSequence [ +diff --git a/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf b/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf +index db866cd..f6180a4 100644 +--- a/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf ++++ b/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf +@@ -54,7 +54,6 @@ SectionDevice."Headphones" { + PlaybackPriority 200 + PlaybackPCM "hw:${CardId}" + JackControl "Headphone Jack" +- JackHWMute "Speaker" + } + + ConflictingDevice [ +@@ -84,7 +83,6 @@ SectionDevice."Headset" { + CapturePriority 200 + CapturePCM "hw:${CardId}" + JackControl "Headset Mic Jack" +- JackHWMute "Mic" + } + + EnableSequence [ +diff --git a/ucm2/chtrt5645/HiFi.conf b/ucm2/chtrt5645/HiFi.conf +index 58468a8..116d456 100644 +--- a/ucm2/chtrt5645/HiFi.conf ++++ b/ucm2/chtrt5645/HiFi.conf +@@ -50,7 +50,6 @@ SectionDevice."Headphones" { + PlaybackPriority 200 + PlaybackPCM "hw:${CardId}" + JackControl "Headphone Jack" +- JackHWMute "Speaker" + } + + ConflictingDevice [ +@@ -76,7 +75,6 @@ SectionDevice."Headset" { + CapturePriority 200 + CapturePCM "hw:${CardId}" + JackControl "Headset Mic Jack" +- JackHWMute "Mic" + } + + EnableSequence [ +-- +2.25.1 + + +From 907c8309b2ee671e1b36630b0d29db1bc3124990 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 6 Apr 2020 17:37:20 +0200 +Subject: [PATCH 10/10] sof-hda-dsp: change Headphones2 to Mic2 + +Fixes: https://github.com/alsa-project/alsa-ucm-conf/issues/19 + +Signed-off-by: Jaroslav Kysela +--- + ucm2/sof-hda-dsp/HiFi.conf | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/ucm2/sof-hda-dsp/HiFi.conf b/ucm2/sof-hda-dsp/HiFi.conf +index 60a8693..9a82930 100644 +--- a/ucm2/sof-hda-dsp/HiFi.conf ++++ b/ucm2/sof-hda-dsp/HiFi.conf +@@ -6,7 +6,7 @@ SectionVerb { + ] + } + +-SectionDevice."Headphones1" { ++SectionDevice."Headphones" { + Comment "Headphones" + + EnableSequence [ +@@ -85,9 +85,9 @@ If.monomic { + Control "name='Input Source'" + ControlEnum "Headphone Mic" + } +- After.SectionDevice "Mic" ++ After.SectionDevice "Mic1" + True { +- SectionDevice."Headphones2" { ++ SectionDevice."Mic2" { + Comment "Headphones Stereo Microphone" + + ConflictingDevice [ +@@ -120,7 +120,7 @@ If.monomic { + } + } + False { +- SectionDevice."Headphones2" { ++ SectionDevice."Mic2" { + Comment "Headphones Stereo Microphone" + + Value { +@@ -132,7 +132,7 @@ If.monomic { + } + } + +-SectionDevice."Mic" { ++SectionDevice."Mic1" { + Comment "Digital Microphone" + + Value { +-- +2.25.1 + From 35f5727aa86a6fae028e0f12aec4bb2a645610dc Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 6 Apr 2020 17:53:20 +0200 Subject: [PATCH 038/120] ucm: remove README patch --- alsa-ucm-conf.patch | 77 --------------------------------------------- 1 file changed, 77 deletions(-) diff --git a/alsa-ucm-conf.patch b/alsa-ucm-conf.patch index 51b93da..537d443 100644 --- a/alsa-ucm-conf.patch +++ b/alsa-ucm-conf.patch @@ -666,83 +666,6 @@ index 0000000..bf80b09 2.25.1 -From 340b8a1d6aaa164bc27bdb8811cc00d729ca2e45 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Mon, 30 Mar 2020 16:51:45 +0200 -Subject: [PATCH 05/10] update README files - -- UCM validator -- UCM paths for ucm2/ - -Signed-off-by: Jaroslav Kysela ---- - README.md | 6 ++++++ - ucm2/README.md | 34 +++++++++++++++++++++++++++++++--- - 2 files changed, 37 insertions(+), 3 deletions(-) - -diff --git a/README.md b/README.md -index 574c93c..c5afd96 100644 ---- a/README.md -+++ b/README.md -@@ -2,3 +2,9 @@ - ## ALSA Use Case Manager configuration - - ![Validate UCM configuration](https://github.com/alsa-project/alsa-ucm-conf/workflows/Validate%20UCM%20configuration/badge.svg?branch=master) -+ -+The UCM configurations are automatically valited using the UCM validator -+available at https://github.com/alsa-project/alsa-tests/tree/master/python/ucm-validator . -+ -+If you create a pull request for new hardware, please, add also the -+alsa-info.sh output to emulate this hardware in the UCM validator. -diff --git a/ucm2/README.md b/ucm2/README.md -index 3aefdf7..fc2a178 100644 ---- a/ucm2/README.md -+++ b/ucm2/README.md -@@ -7,9 +7,37 @@ Library directories: - codecs/ - dsps/ - --Those directories are not inspected for the list of --available UCM configurations. They contain files --included from other UCMs. -+Those directories are not inspected for the list of available UCM -+configurations. They contain files included from other UCMs. -+ -+UCM master configuration path lookup (by priority): -+ -+- {ucm_card_name}/{long_card_name}.conf -+- {ucm_card_name}/{ucm_card_name}.conf -+- {driver_name}/{long_card_name}.conf -+- {driver_name}/{driver_name}.conf -+ -+For example: -+ -+- USB-Audio/Dell-WD15-Dock.conf -+-- special configuration for the Dell docking station with USB soundcard -+- TwoCardsMix/TwoCardsMix.conf -+-- virtual UCM from two soundcards -+ -+Note: For the driver configurations, use always the real driver name -+not the ucm card name configuration paths! -+ -+The driver name can be obtained using procfs like: -+ -+```` -+ cat /proc/asound/cards -+ 1 [NVidia ]: HDA-Intel - HDA NVidia -+ HDA NVidia at 0xb5080000 irq 17 -+ -+ driver name: HDA-Intel -+ card short name: HDA NVidia -+ card long name: HDA NVidia at 0xb5080000 irq 17 -+```` - - Syntax, value names - ------------------- --- -2.25.1 - - From 85ca26a4f2b73888dbce3437a402df13faf628fa Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 5 Apr 2020 20:34:50 +0200 From 6dbf2613acb72a43045aa989b0faca3ebb823223 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Sun, 7 Jun 2020 19:41:58 +0200 Subject: [PATCH 039/120] update to 1.2.3 --- alsa-git.patch | 789 ------------------------------ alsa-lib-1.1.9-config.patch | 10 +- alsa-lib.spec | 6 +- alsa-ucm-conf.patch | 941 ------------------------------------ sources | 6 +- 5 files changed, 11 insertions(+), 1741 deletions(-) diff --git a/alsa-git.patch b/alsa-git.patch index 8466fed..e69de29 100644 --- a/alsa-git.patch +++ b/alsa-git.patch @@ -1,789 +0,0 @@ -From 27c7927842a691ef13724cd16fb26264680c6aa2 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Sat, 29 Feb 2020 10:30:37 +0100 -Subject: [PATCH 01/14] conf: change the order of PCM devices in alsa.conf - -Appearently, some applications use the first device for probe or so. - -Fixes: https://github.com/alsa-project/alsa-lib/issues/27 - -Signed-off-by: Jaroslav Kysela ---- - src/conf/alsa.conf | 46 +++++++++++++++++++++++----------------------- - 1 file changed, 23 insertions(+), 23 deletions(-) - -diff --git a/src/conf/alsa.conf b/src/conf/alsa.conf -index 09980586..a091b810 100644 ---- a/src/conf/alsa.conf -+++ b/src/conf/alsa.conf -@@ -119,29 +119,6 @@ defaults.timer.subdevice 0 - # PCM interface - # - --# redirect to load-on-demand extended pcm definitions --pcm.cards cards.pcm -- --pcm.default cards.pcm.default --pcm.sysdefault cards.pcm.default --pcm.front cards.pcm.front --pcm.rear cards.pcm.rear --pcm.center_lfe cards.pcm.center_lfe --pcm.side cards.pcm.side --pcm.surround21 cards.pcm.surround21 --pcm.surround40 cards.pcm.surround40 --pcm.surround41 cards.pcm.surround41 --pcm.surround50 cards.pcm.surround50 --pcm.surround51 cards.pcm.surround51 --pcm.surround71 cards.pcm.surround71 --pcm.iec958 cards.pcm.iec958 --pcm.spdif iec958 --pcm.hdmi cards.pcm.hdmi --pcm.dmix cards.pcm.dmix --pcm.dsnoop cards.pcm.dsnoop --pcm.modem cards.pcm.modem --pcm.phoneline cards.pcm.phoneline -- - pcm.hw { - @args [ CARD DEV SUBDEV ] - @args.CARD { -@@ -323,6 +300,29 @@ pcm.null { - } - } - -+# redirect to load-on-demand extended pcm definitions -+pcm.cards cards.pcm -+ -+pcm.default cards.pcm.default -+pcm.sysdefault cards.pcm.default -+pcm.front cards.pcm.front -+pcm.rear cards.pcm.rear -+pcm.center_lfe cards.pcm.center_lfe -+pcm.side cards.pcm.side -+pcm.surround21 cards.pcm.surround21 -+pcm.surround40 cards.pcm.surround40 -+pcm.surround41 cards.pcm.surround41 -+pcm.surround50 cards.pcm.surround50 -+pcm.surround51 cards.pcm.surround51 -+pcm.surround71 cards.pcm.surround71 -+pcm.iec958 cards.pcm.iec958 -+pcm.spdif iec958 -+pcm.hdmi cards.pcm.hdmi -+pcm.dmix cards.pcm.dmix -+pcm.dsnoop cards.pcm.dsnoop -+pcm.modem cards.pcm.modem -+pcm.phoneline cards.pcm.phoneline -+ - # - # Control interface - # --- -2.25.1 - - -From 09e78da4cade7b8fecb8f36717b85c456f2e5487 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Sun, 1 Mar 2020 19:57:06 +0100 -Subject: [PATCH 02/14] conf: namehint - add omit_noargs to the hint section - -Do not list simple surround devices in the namehint function by default. - -Fixes: https://github.com/alsa-project/alsa-lib/issues/27 - -Signed-off-by: Jaroslav Kysela ---- - src/conf/pcm/surround21.conf | 1 + - src/conf/pcm/surround40.conf | 1 + - src/conf/pcm/surround41.conf | 1 + - src/conf/pcm/surround50.conf | 1 + - src/conf/pcm/surround51.conf | 1 + - src/conf/pcm/surround71.conf | 1 + - src/control/namehint.c | 6 +++++- - 7 files changed, 11 insertions(+), 1 deletion(-) - -diff --git a/src/conf/pcm/surround21.conf b/src/conf/pcm/surround21.conf -index 1cf1b7af..ad19507b 100644 ---- a/src/conf/pcm/surround21.conf -+++ b/src/conf/pcm/surround21.conf -@@ -57,5 +57,6 @@ pcm.!surround21 { - hint { - description "2.1 Surround output to Front and Subwoofer speakers" - device_output $DEV -+ omit_noargs true - } - } -diff --git a/src/conf/pcm/surround40.conf b/src/conf/pcm/surround40.conf -index 9788ad48..7c615022 100644 ---- a/src/conf/pcm/surround40.conf -+++ b/src/conf/pcm/surround40.conf -@@ -55,5 +55,6 @@ pcm.!surround40 { - hint { - description "4.0 Surround output to Front and Rear speakers" - device_output $DEV -+ omit_noargs true - } - } -diff --git a/src/conf/pcm/surround41.conf b/src/conf/pcm/surround41.conf -index 7b4ef3be..cb6c0445 100644 ---- a/src/conf/pcm/surround41.conf -+++ b/src/conf/pcm/surround41.conf -@@ -61,5 +61,6 @@ pcm.!surround41 { - hint { - description "4.1 Surround output to Front, Rear and Subwoofer speakers" - device_output $DEV -+ omit_noargs true - } - } -diff --git a/src/conf/pcm/surround50.conf b/src/conf/pcm/surround50.conf -index 7d9a9e79..70d54069 100644 ---- a/src/conf/pcm/surround50.conf -+++ b/src/conf/pcm/surround50.conf -@@ -61,5 +61,6 @@ pcm.!surround50 { - hint { - description "5.0 Surround output to Front, Center and Rear speakers" - device_output $DEV -+ omit_noargs true - } - } -diff --git a/src/conf/pcm/surround51.conf b/src/conf/pcm/surround51.conf -index e67f007e..d0236e42 100644 ---- a/src/conf/pcm/surround51.conf -+++ b/src/conf/pcm/surround51.conf -@@ -57,5 +57,6 @@ pcm.!surround51 { - hint { - description "5.1 Surround output to Front, Center, Rear and Subwoofer speakers" - device_output $DEV -+ omit_noargs true - } - } -diff --git a/src/conf/pcm/surround71.conf b/src/conf/pcm/surround71.conf -index a26c3f36..66792dde 100644 ---- a/src/conf/pcm/surround71.conf -+++ b/src/conf/pcm/surround71.conf -@@ -59,5 +59,6 @@ pcm.!surround71 { - hint { - description "7.1 Surround output to Front, Center, Side, Rear and Woofer speakers" - device_output $DEV -+ omit_noargs true - } - } -diff --git a/src/control/namehint.c b/src/control/namehint.c -index 60c48ae3..169bd421 100644 ---- a/src/control/namehint.c -+++ b/src/control/namehint.c -@@ -287,10 +287,14 @@ static int try_config(snd_config_t *config, - err = -EINVAL; - goto __cleanup; - } -+ if (list->card < 0 && -+ snd_config_search(cfg, "omit_noargs", &n) >= 0 && -+ snd_config_get_bool(n) > 0) -+ goto __skip_add; - if (level == 1 && - snd_config_search(cfg, "show", &n) >= 0 && - snd_config_get_bool(n) <= 0) -- goto __skip_add; -+ goto __skip_add; - if (buf1 == NULL && - snd_config_search(cfg, "description", &n) >= 0 && - snd_config_get_string(n, &str) >= 0) { --- -2.25.1 - - -From c7efaef195b92e30efb3049a1c03fa1b50310477 Mon Sep 17 00:00:00 2001 -From: be-marc -Date: Tue, 3 Mar 2020 11:01:09 +0100 -Subject: [PATCH 03/14] Change PCM device number of Asus Xonar U5 - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/USB-Audio.conf | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/src/conf/cards/USB-Audio.conf b/src/conf/cards/USB-Audio.conf -index 1c677937..dd99c44d 100644 ---- a/src/conf/cards/USB-Audio.conf -+++ b/src/conf/cards/USB-Audio.conf -@@ -39,7 +39,8 @@ USB-Audio.pcm.iec958_device { - # "NoiseBlaster 3000" 42 - "USB Sound Blaster HD" 1 - "Xonar U7" 1 -- -+ "ASUS XONAR U5" 1 -+ - # The below don't have digital in/out, so prevent them from being opened. - "Andrea PureAudio USB-SA Headset" 999 - "Blue Snowball" 999 --- -2.25.1 - - -From 1654f38a29e635ce69a30c6c95ec1ca773ecee37 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 4 Mar 2020 11:27:12 +0100 -Subject: [PATCH 04/14] configure: add --embed for python3-config (python 3.8) - -Fixes: https://github.com/alsa-project/alsa-lib/issues/33 - -Signed-off-by: Jaroslav Kysela ---- - configure.ac | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index 0f9fb016..4b5ab662 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -423,7 +423,10 @@ if test "$build_python" = "yes" -a "$build_mixer_pymodules" = "yes"; then - pythonlibs0= - pythoninc0= - if test "$build_python2" != "yes"; then -- pythonlibs0=$(python3-config --libs) -+ pythonlibs0=$(python3-config --libs --embed 2> /dev/null) -+ if test -z "$pythonlibs0"; then -+ pythonlibs0=$(python3-config --libs) -+ fi - pythoninc0=$(python3-config --includes) - fi - if test -z "$pythonlibs0"; then --- -2.25.1 - - -From 9ed3c65e1569a0ebbec9af1d04d739db9921e775 Mon Sep 17 00:00:00 2001 -From: Tanu Kaskinen -Date: Fri, 13 Mar 2020 09:39:17 +0200 -Subject: [PATCH 05/14] conf: USB-Audio: Add C-Media USB Headphone Set to the - IEC958 blacklist - -Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/317 - -Signed-off-by: Tanu Kaskinen -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/USB-Audio.conf | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/conf/cards/USB-Audio.conf b/src/conf/cards/USB-Audio.conf -index dd99c44d..89811086 100644 ---- a/src/conf/cards/USB-Audio.conf -+++ b/src/conf/cards/USB-Audio.conf -@@ -44,6 +44,7 @@ USB-Audio.pcm.iec958_device { - # The below don't have digital in/out, so prevent them from being opened. - "Andrea PureAudio USB-SA Headset" 999 - "Blue Snowball" 999 -+ "C-Media USB Headphone Set" 999 - "HP Digital Stereo Headset" 999 - "GN 9330" 999 - "Logitech Speaker Lapdesk N700" 999 --- -2.25.1 - - -From caf77a93cef5bda729bc33e0100cc0e769767389 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 13 Mar 2020 17:05:14 +0100 -Subject: [PATCH 06/14] topology: add back asrc to widget_map in dapm.c - -Fixes: aa1bac2d04bd ("topology: add snd_tplg_save()") -BugLink: https://github.com/thesofproject/sof/issues/2543 - -Signed-off-by: Jaroslav Kysela ---- - src/topology/dapm.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/topology/dapm.c b/src/topology/dapm.c -index cb85e667..70645126 100644 ---- a/src/topology/dapm.c -+++ b/src/topology/dapm.c -@@ -43,6 +43,7 @@ static const struct map_elem widget_map[] = { - {"effect", SND_SOC_TPLG_DAPM_EFFECT}, - {"siggen", SND_SOC_TPLG_DAPM_SIGGEN}, - {"src", SND_SOC_TPLG_DAPM_SRC}, -+ {"asrc", SND_SOC_TPLG_DAPM_ASRC}, - {"encoder", SND_SOC_TPLG_DAPM_ENCODER}, - {"decoder", SND_SOC_TPLG_DAPM_DECODER}, - }; --- -2.25.1 - - -From 79102bf264f8651692fe9435a4d1bb06aa022d55 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 17 Mar 2020 10:21:10 +0100 -Subject: [PATCH 07/14] ucm: clarify the index syntax for the device names - -Signed-off-by: Jaroslav Kysela ---- - include/use-case.h | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/include/use-case.h b/include/use-case.h -index 134303af..27cb3fe1 100644 ---- a/include/use-case.h -+++ b/include/use-case.h -@@ -117,7 +117,10 @@ extern "C" { - * - * If multiple devices with the same name exists, the number suffixes should - * be added to these names like HDMI1,HDMI2,HDMI3 etc. No number gaps are -- * allowed. The names with numbers must be continuous. -+ * allowed. The names with numbers must be continuous. It is allowed to put -+ * a whitespace between name and index (like 'Line 1') for the better -+ * readability. The device names 'Line 1' and 'Line1' are equal for -+ * thus purpose. - * - * If EnableSequence/DisableSequence controls independent paths in the hardware - * it is also recommended to split playback and capture UCM devices and use --- -2.25.1 - - -From 6137d263f3805c72781ea74b813b0e3754f5fc34 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 17 Mar 2020 16:20:52 +0100 -Subject: [PATCH 08/14] ucm: fix uc_mgr_scan_master_configs() - -Skip the lookup, if the top level filename does not exist. - -Fixes: https://github.com/alsa-project/alsa-ucm-conf/issues/16 - -Signed-off-by: Jaroslav Kysela ---- - src/ucm/parser.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/src/ucm/parser.c b/src/ucm/parser.c -index 8d6eea31..0001e595 100644 ---- a/src/ucm/parser.c -+++ b/src/ucm/parser.c -@@ -1969,6 +1969,9 @@ int uc_mgr_scan_master_configs(const char **_list[]) - - configuration_filename2(filename, sizeof(filename), 2, - d_name, d_name, ".conf"); -+ if (eaccess(filename, R_OK)) -+ continue; -+ - err = uc_mgr_config_load(2, filename, &cfg); - if (err < 0) - goto __err; --- -2.25.1 - - -From d434638a683c01bd6decf8f41863044055237a50 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 27 Mar 2020 11:59:53 +0100 -Subject: [PATCH 09/14] namehint: remember the direction from the upper levels - -The current code resets the direction info for each level. -Simply remove this code. - -Fixes: https://github.com/alsa-project/alsa-lib/issues/39 - -Signed-off-by: Jaroslav Kysela ---- - src/control/namehint.c | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/src/control/namehint.c b/src/control/namehint.c -index 169bd421..ecd470f3 100644 ---- a/src/control/namehint.c -+++ b/src/control/namehint.c -@@ -270,8 +270,6 @@ static int try_config(snd_config_t *config, - if (snd_config_search(cfg1, "type", &cfg) >= 0 && - snd_config_get_string(cfg, &str) >= 0 && - strcmp(str, "hw") == 0) { -- list->device_input = -1; -- list->device_output = -1; - if (snd_config_search(cfg1, "device", &cfg) >= 0) { - if (snd_config_get_integer(cfg, &dev) < 0) { - SNDERR("(%s) device must be an integer", buf); --- -2.25.1 - - -From bca39e99d0c2a270a71dad640983fb739dac8bdd Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 27 Mar 2020 18:14:02 +0100 -Subject: [PATCH 10/14] conf: fix namehint for pcm.front and pcm.iec958 - -As suggested in: - -Fixes: https://github.com/alsa-project/alsa-lib/issues/39 - -Signed-off-by: Jaroslav Kysela ---- - src/conf/pcm/front.conf | 3 ++- - src/conf/pcm/iec958.conf | 2 +- - 2 files changed, 3 insertions(+), 2 deletions(-) - -diff --git a/src/conf/pcm/front.conf b/src/conf/pcm/front.conf -index 7aff0cbf..0edf6a69 100644 ---- a/src/conf/pcm/front.conf -+++ b/src/conf/pcm/front.conf -@@ -53,6 +53,7 @@ pcm.!front { - name defaults.namehint.basic - } - description "Front speakers" -- device $DEV -+ device_output $DEV -+ omit_noargs true - } - } -diff --git a/src/conf/pcm/iec958.conf b/src/conf/pcm/iec958.conf -index ac139b5e..2b084d6f 100644 ---- a/src/conf/pcm/iec958.conf -+++ b/src/conf/pcm/iec958.conf -@@ -78,6 +78,6 @@ pcm.!iec958 { - name defaults.namehint.basic - } - description "IEC958 (S/PDIF) Digital Audio Output" -- device $DEV -+ device_output $DEV - } - } --- -2.25.1 - - -From 3b46b03f099da2f39c205a25b3cc62ec688fe6b3 Mon Sep 17 00:00:00 2001 -From: Jonas Holmberg -Date: Tue, 31 Mar 2020 17:09:25 +0200 -Subject: [PATCH 11/14] pcm: add chmap option to route plugin - -Add a config definition "chmap" to override the channel maps in the same -way as in the hw and null plugins. - -Signed-off-by: Jonas Holmberg -Signed-off-by: Takashi Iwai ---- - src/pcm/pcm_route.c | 57 +++++++++++++++++++++++++++++++++++++-------- - 1 file changed, 47 insertions(+), 10 deletions(-) - -diff --git a/src/pcm/pcm_route.c b/src/pcm/pcm_route.c -index bbcc6118..d3e5f3ff 100644 ---- a/src/pcm/pcm_route.c -+++ b/src/pcm/pcm_route.c -@@ -104,6 +104,7 @@ typedef struct { - int schannels; - snd_pcm_route_params_t params; - snd_pcm_chmap_t *chmap; -+ snd_pcm_chmap_query_t **chmap_override; - } snd_pcm_route_t; - - #endif /* DOC_HIDDEN */ -@@ -441,6 +442,7 @@ static int snd_pcm_route_close(snd_pcm_t *pcm) - free(params->dsts); - } - free(route->chmap); -+ snd_pcm_free_chmaps(route->chmap_override); - return snd_pcm_generic_close(pcm); - } - -@@ -634,6 +636,9 @@ static snd_pcm_chmap_t *snd_pcm_route_get_chmap(snd_pcm_t *pcm) - snd_pcm_chmap_t *map, *slave_map; - unsigned int src, dst, nsrcs; - -+ if (route->chmap_override) -+ return _snd_pcm_choose_fixed_chmap(pcm, route->chmap_override); -+ - slave_map = snd_pcm_generic_get_chmap(pcm); - if (!slave_map) - return NULL; -@@ -660,8 +665,14 @@ static snd_pcm_chmap_t *snd_pcm_route_get_chmap(snd_pcm_t *pcm) - - static snd_pcm_chmap_query_t **snd_pcm_route_query_chmaps(snd_pcm_t *pcm) - { -+ snd_pcm_route_t *route = pcm->private_data; - snd_pcm_chmap_query_t **maps; -- snd_pcm_chmap_t *map = snd_pcm_route_get_chmap(pcm); -+ snd_pcm_chmap_t *map; -+ -+ if (route->chmap_override) -+ return _snd_pcm_copy_chmap_query(route->chmap_override); -+ -+ map = snd_pcm_route_get_chmap(pcm); - if (!map) - return NULL; - maps = _snd_pcm_make_single_query_chmaps(map); -@@ -818,10 +829,10 @@ err: - return -EINVAL; - } - --static int find_matching_chmap(snd_pcm_t *spcm, snd_pcm_chmap_t *tt_chmap, -+static int find_matching_chmap(snd_pcm_chmap_query_t **chmaps, -+ snd_pcm_chmap_t *tt_chmap, - snd_pcm_chmap_t **found_chmap, int *schannels) - { -- snd_pcm_chmap_query_t** chmaps = snd_pcm_query_chmaps(spcm); - int i; - - *found_chmap = NULL; -@@ -854,7 +865,6 @@ static int find_matching_chmap(snd_pcm_t *spcm, snd_pcm_chmap_t *tt_chmap, - int size = sizeof(snd_pcm_chmap_t) + c->channels * sizeof(unsigned int); - *found_chmap = malloc(size); - if (!*found_chmap) { -- snd_pcm_free_chmaps(chmaps); - return -ENOMEM; - } - memcpy(*found_chmap, c, size); -@@ -863,8 +873,6 @@ static int find_matching_chmap(snd_pcm_t *spcm, snd_pcm_chmap_t *tt_chmap, - } - } - -- snd_pcm_free_chmaps(chmaps); -- - if (*found_chmap == NULL) { - SNDERR("Found no matching channel map"); - return -EINVAL; -@@ -1252,6 +1260,7 @@ pcm.name { - SCHANNEL REAL # route value (0.0 - 1.0) - } - } -+ [chmap MAP] # Override channel maps; MAP is a string array - } - \endcode - -@@ -1292,6 +1301,7 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name, - snd_pcm_route_ttable_entry_t *ttable = NULL; - unsigned int csize, ssize; - unsigned int cused, sused; -+ snd_pcm_chmap_query_t **chmaps = NULL; - snd_config_for_each(i, next, conf) { - snd_config_t *n = snd_config_iterator_entry(i); - const char *id; -@@ -1306,31 +1316,45 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name, - if (strcmp(id, "ttable") == 0) { - if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) { - SNDERR("Invalid type for %s", id); -+ snd_pcm_free_chmaps(chmaps); - return -EINVAL; - } - tt = n; - continue; - } -+ if (strcmp(id, "chmap") == 0) { -+ chmaps = _snd_pcm_parse_config_chmaps(n); -+ if (!chmaps) { -+ SNDERR("Invalid channel map for %s", id); -+ return -EINVAL; -+ } -+ continue; -+ } - SNDERR("Unknown field %s", id); - return -EINVAL; - } - if (!slave) { - SNDERR("slave is not defined"); -+ snd_pcm_free_chmaps(chmaps); - return -EINVAL; - } - if (!tt) { - SNDERR("ttable is not defined"); -+ snd_pcm_free_chmaps(chmaps); - return -EINVAL; - } - err = snd_pcm_slave_conf(root, slave, &sconf, 2, - SND_PCM_HW_PARAM_FORMAT, 0, &sformat, - SND_PCM_HW_PARAM_CHANNELS, 0, &schannels); -- if (err < 0) -+ if (err < 0) { -+ snd_pcm_free_chmaps(chmaps); - return err; -+ } - if (sformat != SND_PCM_FORMAT_UNKNOWN && - snd_pcm_format_linear(sformat) != 1) { - snd_config_delete(sconf); - SNDERR("slave format is not linear"); -+ snd_pcm_free_chmaps(chmaps); - return -EINVAL; - } - -@@ -1345,13 +1369,19 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name, - if (err < 0) { - free(tt_chmap); - free(ttable); -+ snd_pcm_free_chmaps(chmaps); - return err; - } - - if (tt_chmap) { -- err = find_matching_chmap(spcm, tt_chmap, &chmap, &schannels); -+ if (!chmaps) -+ chmaps = snd_pcm_query_chmaps(spcm); -+ if (chmaps) -+ err = find_matching_chmap(chmaps, tt_chmap, &chmap, -+ &schannels); - free(tt_chmap); -- if (err < 0) { -+ if (chmaps && err < 0) { -+ snd_pcm_free_chmaps(chmaps); - snd_pcm_close(spcm); - return err; - } -@@ -1360,12 +1390,14 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name, - err = _snd_pcm_route_determine_ttable(tt, &csize, &ssize, chmap); - if (err < 0) { - free(chmap); -+ snd_pcm_free_chmaps(chmaps); - snd_pcm_close(spcm); - return err; - } - ttable = malloc(csize * ssize * sizeof(snd_pcm_route_ttable_entry_t)); - if (ttable == NULL) { - free(chmap); -+ snd_pcm_free_chmaps(chmaps); - snd_pcm_close(spcm); - return -ENOMEM; - } -@@ -1374,6 +1406,7 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name, - if (err < 0) { - free(chmap); - free(ttable); -+ snd_pcm_free_chmaps(chmaps); - snd_pcm_close(spcm); - return err; - } -@@ -1385,9 +1418,13 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name, - free(ttable); - if (err < 0) { - free(chmap); -+ snd_pcm_free_chmaps(chmaps); - snd_pcm_close(spcm); - } else { -- ((snd_pcm_route_t*) (*pcmp)->private_data)->chmap = chmap; -+ snd_pcm_route_t *route = (*pcmp)->private_data; -+ -+ route->chmap = chmap; -+ route->chmap_override = chmaps; - } - - return err; --- -2.25.1 - - -From 341326c21ededb8c768c43ec2c9c7a80e7a26d35 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 3 Apr 2020 18:00:43 +0200 -Subject: [PATCH 12/14] usecase: allow indexes also for modifier names - -Signed-off-by: Jaroslav Kysela ---- - include/use-case.h | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -diff --git a/include/use-case.h b/include/use-case.h -index 27cb3fe1..c2ba79a9 100644 ---- a/include/use-case.h -+++ b/include/use-case.h -@@ -120,7 +120,7 @@ extern "C" { - * allowed. The names with numbers must be continuous. It is allowed to put - * a whitespace between name and index (like 'Line 1') for the better - * readability. The device names 'Line 1' and 'Line1' are equal for -- * thus purpose. -+ * this purpose. - * - * If EnableSequence/DisableSequence controls independent paths in the hardware - * it is also recommended to split playback and capture UCM devices and use -@@ -149,6 +149,13 @@ extern "C" { - * The use case modifier allows runtime configuration changes to deal with - * asynchronous events. - * -+ * If multiple modifiers with the same name exists, the number suffixes should -+ * be added to these names like 'Echo Reference 1','Echo Reference 2' etc. -+ * No number gaps are allowed. The names with numbers must be continuous. -+ * It is allowed to put a whitespace between name and index for the better -+ * readability. The modifier names 'Something 1' and 'Something1' are equal -+ * for this purpose. -+ * - * e.g. to record a voice call :- - * 1. Set verb to SND_USE_CASE_VERB_VOICECALL (for voice call) - * 2. Set modifier SND_USE_CASE_MOD_CAPTURE_VOICE when capture required. --- -2.25.1 - - -From c9605484d165d2b707f78eef14a224b0b47ba322 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Mon, 6 Apr 2020 13:25:43 +0200 -Subject: [PATCH 13/14] ucm: fix the device remove operation - -- allow to remove device only from conflicting lists -- unify the error codes when the device is not found (ENODEV) - -Signed-off-by: Jaroslav Kysela ---- - src/ucm/utils.c | 13 +++++++++---- - 1 file changed, 9 insertions(+), 4 deletions(-) - -diff --git a/src/ucm/utils.c b/src/ucm/utils.c -index 50b2a1df..d78ba91c 100644 ---- a/src/ucm/utils.c -+++ b/src/ucm/utils.c -@@ -371,7 +371,7 @@ int uc_mgr_rename_in_dev_list(struct dev_list *dev_list, const char *src, - return 0; - } - } -- return -ENOENT; -+ return -ENODEV; - } - - int uc_mgr_remove_from_dev_list(struct dev_list *dev_list, const char *name) -@@ -528,17 +528,22 @@ int uc_mgr_remove_device(struct use_case_verb *verb, const char *name) - { - struct use_case_device *device; - struct list_head *pos, *npos; -+ int err, found = 0; - - list_for_each_safe(pos, npos, &verb->device_list) { - device = list_entry(pos, struct use_case_device, list); - if (strcmp(device->name, name) == 0) { - uc_mgr_free_device(device); -+ found++; - continue; - } -- uc_mgr_remove_from_dev_list(&device->dev_list, name); -- return 0; -+ err = uc_mgr_remove_from_dev_list(&device->dev_list, name); -+ if (err < 0 && err != -ENODEV) -+ return err; -+ if (err == 0) -+ found++; - } -- return -ENOENT; -+ return found == 0 ? -ENODEV : 0; - } - - void uc_mgr_free_verb(snd_use_case_mgr_t *uc_mgr) --- -2.25.1 - - -From fb48ad9e4f6b84fd4ade689bd79e3a3c37d3e034 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Mon, 6 Apr 2020 17:20:24 +0200 -Subject: [PATCH 14/14] ucm: fix copy-n-paste typo (RemoveDevice list) - -Signed-off-by: Jaroslav Kysela ---- - src/ucm/parser.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/ucm/parser.c b/src/ucm/parser.c -index 0001e595..aca5ea8c 100644 ---- a/src/ucm/parser.c -+++ b/src/ucm/parser.c -@@ -1176,7 +1176,7 @@ static int verb_device_management(struct use_case_verb *verb) - } - - /* remove devices */ -- list_for_each(pos, &verb->rename_list) { -+ list_for_each(pos, &verb->remove_list) { - dev = list_entry(pos, struct ucm_dev_name, list); - err = uc_mgr_remove_device(verb, dev->name2); - if (err < 0) { --- -2.25.1 - diff --git a/alsa-lib-1.1.9-config.patch b/alsa-lib-1.1.9-config.patch index f8c2c59..3926a98 100644 --- a/alsa-lib-1.1.9-config.patch +++ b/alsa-lib-1.1.9-config.patch @@ -1,19 +1,19 @@ diff --git a/src/conf/alsa.conf b/src/conf/alsa.conf -index 09980586..c4525f0b 100644 +index 08370108..dea39af1 100644 --- a/src/conf/alsa.conf +++ b/src/conf/alsa.conf -@@ -67,8 +67,7 @@ defaults.pcm.nonblock 1 +@@ -80,8 +80,7 @@ defaults.pcm.nonblock 1 defaults.pcm.compat 0 defaults.pcm.minperiodtime 5000 # in us defaults.pcm.ipc_key 5678293 -defaults.pcm.ipc_gid audio -defaults.pcm.ipc_perm 0660 +defaults.pcm.ipc_perm 0600 + defaults.pcm.tstamp_type "default" defaults.pcm.dmix.max_periods 0 defaults.pcm.dmix.channels 2 - defaults.pcm.dmix.rate 48000 diff --git a/src/conf/pcm/dmix.conf b/src/conf/pcm/dmix.conf -index 7fa5c8b2..97936a82 100644 +index 50e573da..70523f29 100644 --- a/src/conf/pcm/dmix.conf +++ b/src/conf/pcm/dmix.conf @@ -48,10 +48,6 @@ pcm.!dmix { @@ -28,7 +28,7 @@ index 7fa5c8b2..97936a82 100644 @func refer name defaults.pcm.ipc_perm diff --git a/src/conf/pcm/dsnoop.conf b/src/conf/pcm/dsnoop.conf -index abbd44f7..528fb6ad 100644 +index f4336e5f..60b9f212 100644 --- a/src/conf/pcm/dsnoop.conf +++ b/src/conf/pcm/dsnoop.conf @@ -41,10 +41,6 @@ pcm.!dsnoop { diff --git a/alsa-lib.spec b/alsa-lib.spec index 1b93290..43c280f 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -2,9 +2,9 @@ #define prever_dot .rc3 #define postver a -%define version_alsa_lib 1.2.2 -%define version_alsa_ucm 1.2.2 -%define version_alsa_tplg 1.2.2 +%define version_alsa_lib 1.2.3 +%define version_alsa_ucm 1.2.3 +%define version_alsa_tplg 1.2.3 Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib diff --git a/alsa-ucm-conf.patch b/alsa-ucm-conf.patch index 537d443..e69de29 100644 --- a/alsa-ucm-conf.patch +++ b/alsa-ucm-conf.patch @@ -1,941 +0,0 @@ -From 46222753fdddc86d6a0b92c465875f71c628a779 Mon Sep 17 00:00:00 2001 -From: Pierre-Louis Bossart -Date: Thu, 27 Feb 2020 12:40:20 -0600 -Subject: [PATCH 01/10] sof-bdw-rt5677: initial port to UCM2 - -Tested on Pixel 2015/SAMUS Chromebook. - -Known limitations: -Left/Right confusion (probably a firmware issue) -PulseAudio does not switch capture devices on headset plug - -Signed-off-by: Pierre-Louis Bossart -Signed-off-by: Jaroslav Kysela ---- - ucm2/sof-bdw-rt5677/HiFi.conf | 194 ++++++++++++++++++++++++ - ucm2/sof-bdw-rt5677/sof-bdw-rt5677.conf | 6 + - 2 files changed, 200 insertions(+) - create mode 100644 ucm2/sof-bdw-rt5677/HiFi.conf - create mode 100644 ucm2/sof-bdw-rt5677/sof-bdw-rt5677.conf - -diff --git a/ucm2/sof-bdw-rt5677/HiFi.conf b/ucm2/sof-bdw-rt5677/HiFi.conf -new file mode 100644 -index 0000000..f4b1449 ---- /dev/null -+++ b/ucm2/sof-bdw-rt5677/HiFi.conf -@@ -0,0 +1,194 @@ -+# Use case Configuration for sof-bdw-rt5677 -+# command-line sequence to switch playback/capture -+# alsaucm -c sof-bdw-rt5677 set _verb HiFi -+# alsaucm -c sof-bdw-rt5677 set _verb HiFi set _enadev Headphones -+ -+ -+SectionVerb { -+ -+ EnableSequence [ -+ -+ cset "name='PDM1 L Mux' STO1 DAC MIX" -+ cset "name='PDM1 R Mux' STO1 DAC MIX" -+ -+ # Adjust Master Playback volume if needed -+ # cset "name='Master Playback Volume' 30" -+ -+ cset "name='OUT1 Playback Switch' off" -+ cset "name='OUT2 Playback Switch' off" -+ -+ cset "name='DAC1 Playback Volume' 175" -+ cset "name='DAC2 Playback Volume' 175" -+ cset "name='DAC12 SRC Mux' STO1 DAC MIX" -+ -+ cset "name='Stereo DAC MIXL ST L Switch' off" -+ cset "name='Stereo DAC MIXL DAC1 L Switch' off" -+ cset "name='Stereo DAC MIXL DAC2 L Switch' off" -+ cset "name='Stereo DAC MIXL DAC1 R Switch' on" -+ -+ cset "name='Stereo DAC MIXR ST R Switch' off" -+ cset "name='Stereo DAC MIXR DAC1 R Switch' off" -+ cset "name='Stereo DAC MIXR DAC2 R Switch' off" -+ cset "name='Stereo DAC MIXR DAC1 L Switch' on" -+ -+ cset "name='DAC1 MIXL Stereo ADC Switch' off" -+ cset "name='DAC1 MIXL DAC1 Switch' on" -+ -+ cset "name='DAC1 MIXR Stereo ADC Switch' off" -+ cset "name='DAC1 MIXR DAC1 Switch' on" -+ -+ cset "name='DAC1 Mux' IF1 DAC 01" -+ -+ cset "name='Stereo1 DMIC Mux' DMIC1" -+ cset "name='Stereo1 ADC2 Mux' DMIC" -+ cset "name='Stereo1 ADC1 Mux' ADC1/2" -+ -+ cset "name='Sto1 ADC MIXL ADC1 Switch' off" -+ cset "name='Sto1 ADC MIXL ADC2 Switch' off" -+ cset "name='Sto1 ADC MIXL ADC2 Switch' on" -+ -+ cset "name='Sto1 ADC MIXR ADC1 Switch' off" -+ cset "name='Sto1 ADC MIXR ADC2 Switch' off" -+ cset "name='Sto1 ADC MIXR ADC2 Switch' on" -+ -+ cset "name='IF1 ADC1 Mux' STO1 ADC MIX" -+ cset "name='IF1 ADC1 Swap Mux' L/R" -+ -+ # Adjust Mic Capture Volume if needed -+ # cset "name='Mic Capture Volume' 30" -+ -+ cset "name='ADC1 Capture Switch' on" -+ cset "name='ADC1 Capture Volume' 31" -+ cset "name='STO1 ADC Boost Volume' 2" -+ -+ cset "name='Headphone Switch' off" -+ cset "name='Speaker Switch' on" -+ -+ cset "name='Remote DMICs Switch' on" -+ cset "name='Mono DMIC L Mux' DMIC1" -+ cset "name='Mono ADC2 L Mux' DMIC" -+ cset "name='Mono ADC MIXL ADC1 Switch' off" -+ cset "name='Mono ADC MIXL ADC2 Switch' on" -+ cset "name='VAD ADC Mux' MONO ADC MIX L" -+ cset "name='IB01 Mux' VAD ADC/DAC1 FS" -+ cset "name='IB01 Bypass Mux' Bypass" -+ cset "name='Mono ADC Boost Volume' 2" -+ ] -+ -+ DisableSequence [ -+ ] -+} -+ -+SectionDevice."Speaker" { -+ Comment "Speakers" -+ -+ ConflictingDevice [ -+ "Headphones" -+ ] -+ -+ EnableSequence [ -+ ] -+ -+ DisableSequence [ -+ ] -+ -+ Value { -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId}" -+ } -+} -+ -+ -+SectionDevice."Headphones" { -+ Comment "Headphones" -+ -+ ConflictingDevice [ -+ "Speaker" -+ ] -+ -+ EnableSequence [ -+ cset "name='Speaker Switch' off" -+ cset "name='Stereo DAC MIXL DAC1 R Switch' off" -+ cset "name='Stereo DAC MIXR DAC1 L Switch' off" -+ cset "name='Stereo DAC MIXL DAC1 L Switch' on" -+ cset "name='Stereo DAC MIXR DAC1 R Switch' on" -+ cset "name='OUT1 Playback Switch' on" -+ cset "name='OUT2 Playback Switch' on" -+ cset "name='Headphone Switch' on" -+ ] -+ -+ DisableSequence [ -+ cset "name='Headphone Switch' off" -+ cset "name='OUT1 Playback Switch' off" -+ cset "name='OUT2 Playback Switch' off" -+ cset "name='Stereo DAC MIXL DAC1 L Switch' off" -+ cset "name='Stereo DAC MIXR DAC1 R Switch' off" -+ cset "name='Stereo DAC MIXL DAC1 R Switch' on" -+ cset "name='Stereo DAC MIXR DAC1 L Switch' on" -+ cset "name='Speaker Switch' on" -+ ] -+ -+ Value { -+ PlaybackPriority 300 -+ PlaybackPCM "hw:${CardId}" -+ JackControl "Headphone Jack" -+ JackHWMute "Speakers" -+ } -+} -+ -+SectionDevice."Mic" { -+ Comment "Internal Microphone" -+ -+ ConflictingDevice [ -+ "Headset" -+ ] -+ -+ EnableSequence [ -+ ] -+ -+ DisableSequence [ -+ ] -+ -+ Value { -+ CapturePriority 100 -+ CapturePCM "hw:${CardId}" -+ } -+} -+ -+SectionDevice."Headset" { -+ Comment "Headset Microphone" -+ -+ ConflictingDevice [ -+ "Mic" -+ ] -+ -+ EnableSequence [ -+ cset "name='Sto1 ADC MIXL ADC2 Switch' off" -+ cset "name='Sto1 ADC MIXR ADC2 Switch' off" -+ cset "name='Local DMICs Switch' off" -+ -+ cset "name='IF1 ADC1 Swap Mux' L/L" -+ -+ cset "name='Sto1 ADC MIXL ADC1 Switch' on" -+ cset "name='Sto1 ADC MIXR ADC1 Switch' on" -+ cset "name='Headset Mic Switch' on" -+ ] -+ -+ DisableSequence [ -+ cset "name='Sto1 ADC MIXL ADC1 Switch' off" -+ cset "name='Sto1 ADC MIXR ADC1 Switch' off" -+ cset "name='Headset Mic Switch' off" -+ -+ cset "name='IF1 ADC1 Swap Mux' L/R" -+ -+ cset "name='Sto1 ADC MIXL ADC2 Switch' on" -+ cset "name='Sto1 ADC MIXR ADC2 Switch' on" -+ cset "name='Local DMICs Switch' on" -+ ] -+ -+ Value { -+ CapturePriority 300 -+ CapturePCM "hw:${CardId}" -+ JackControl "Mic Jack" -+ } -+} -diff --git a/ucm2/sof-bdw-rt5677/sof-bdw-rt5677.conf b/ucm2/sof-bdw-rt5677/sof-bdw-rt5677.conf -new file mode 100644 -index 0000000..d672df2 ---- /dev/null -+++ b/ucm2/sof-bdw-rt5677/sof-bdw-rt5677.conf -@@ -0,0 +1,6 @@ -+Syntax 2 -+ -+SectionUseCase."HiFi" { -+ File "HiFi.conf" -+ Comment "Default" -+} --- -2.25.1 - - -From da45a07c756308b57facf1a97c4842274ff04fe3 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Sun, 1 Mar 2020 16:12:28 +0100 -Subject: [PATCH 02/10] ucm2: treewide - JackHWMute fixes - -Fixes: https://github.com/alsa-project/alsa-ucm-conf/issues/14 - -Signed-off-by: Jaroslav Kysela ---- - ucm2/HDA-Intel/HiFi-dual.conf | 1 + - ucm2/broxton-rt298/HiFi.conf | 1 - - ucm2/chtrt5645/HiFi-dmic2.conf | 2 +- - ucm2/skylake-rt286/HiFi.conf | 1 - - ucm2/sof-bdw-rt5677/HiFi.conf | 2 +- - 5 files changed, 3 insertions(+), 4 deletions(-) - -diff --git a/ucm2/HDA-Intel/HiFi-dual.conf b/ucm2/HDA-Intel/HiFi-dual.conf -index 174fef4..277894a 100644 ---- a/ucm2/HDA-Intel/HiFi-dual.conf -+++ b/ucm2/HDA-Intel/HiFi-dual.conf -@@ -93,6 +93,7 @@ SectionDevice."Mic2" { - CapturePriority 300 - CapturePCM "hw:${CardId}" - JackHWMute "Line2" -+ JackControl "Mic Jack" - } - - ConflictingDevice [ -diff --git a/ucm2/broxton-rt298/HiFi.conf b/ucm2/broxton-rt298/HiFi.conf -index 6f5b9a5..f7e561f 100644 ---- a/ucm2/broxton-rt298/HiFi.conf -+++ b/ucm2/broxton-rt298/HiFi.conf -@@ -30,7 +30,6 @@ SectionDevice."Speaker" { - Value { - PlaybackPriority 100 - PlaybackPCM "hw:${CardId}" -- JackHWMute "Headphones" - } - } - -diff --git a/ucm2/chtrt5645/HiFi-dmic2.conf b/ucm2/chtrt5645/HiFi-dmic2.conf -index c9fdd79..d3f880a 100644 ---- a/ucm2/chtrt5645/HiFi-dmic2.conf -+++ b/ucm2/chtrt5645/HiFi-dmic2.conf -@@ -98,7 +98,7 @@ SectionDevice."Headset" { - CapturePriority 200 - CapturePCM "hw:${CardId}" - JackControl "Headset Mic Jack" -- JackHWMute "DMic" -+ JackHWMute "Mic" - } - - EnableSequence [ -diff --git a/ucm2/skylake-rt286/HiFi.conf b/ucm2/skylake-rt286/HiFi.conf -index 9e94a1b..ed4bfa7 100644 ---- a/ucm2/skylake-rt286/HiFi.conf -+++ b/ucm2/skylake-rt286/HiFi.conf -@@ -51,7 +51,6 @@ SectionDevice."Speaker" { - Value { - PlaybackPriority 100 - PlaybackPCM "hw:${CardId}" -- JackHWMute "Headphones" - } - } - -diff --git a/ucm2/sof-bdw-rt5677/HiFi.conf b/ucm2/sof-bdw-rt5677/HiFi.conf -index f4b1449..724a1cc 100644 ---- a/ucm2/sof-bdw-rt5677/HiFi.conf -+++ b/ucm2/sof-bdw-rt5677/HiFi.conf -@@ -132,7 +132,7 @@ SectionDevice."Headphones" { - PlaybackPriority 300 - PlaybackPCM "hw:${CardId}" - JackControl "Headphone Jack" -- JackHWMute "Speakers" -+ JackHWMute "Speaker" - } - } - --- -2.25.1 - - -From 4722f5b3859903521ba0f92a64d86af31083ca50 Mon Sep 17 00:00:00 2001 -From: Kai Vehmanen -Date: Thu, 5 Mar 2020 14:59:56 +0200 -Subject: [PATCH 03/10] sof-hda-dsp: Support systems without integrated - graphics audio - -On systems where integrated graphics audio is not present -or is disabled, the HDMI PCM nodes are disabled. Add rules to -detect these systems by checking presence of HDMI jack controls -with UCM2 rules. - -Signed-off-by: Kai Vehmanen -Signed-off-by: Jaroslav Kysela ---- - ucm2/sof-hda-dsp/Hdmi.conf | 96 ++++++++++++++++++++++++-------------- - 1 file changed, 60 insertions(+), 36 deletions(-) - -diff --git a/ucm2/sof-hda-dsp/Hdmi.conf b/ucm2/sof-hda-dsp/Hdmi.conf -index be6cb39..6f2c4aa 100644 ---- a/ucm2/sof-hda-dsp/Hdmi.conf -+++ b/ucm2/sof-hda-dsp/Hdmi.conf -@@ -1,55 +1,79 @@ - # Use case Configuration for sof-hda-dsp - --SectionDevice."HDMI1" { -- Comment "HDMI1/DP1 Output" -+If.hdmi1 { -+ Condition { -+ Type ControlExists -+ Control "iface=CARD,name='HDMI/DP,pcm=3 Jack'" -+ } -+ True { -+ SectionDevice."HDMI1" { -+ Comment "HDMI1/DP1 Output" - -- EnableSequence [ -- cset "name='IEC958 Playback Switch' on" -- ] -+ EnableSequence [ -+ cset "name='IEC958 Playback Switch' on" -+ ] - -- DisableSequence [ -- cset "name='IEC958 Playback Switch' off" -- ] -+ DisableSequence [ -+ cset "name='IEC958 Playback Switch' off" -+ ] - -- Value { -- PlaybackPriority 500 -- PlaybackPCM "hw:${CardId},3" -- JackControl "HDMI/DP,pcm=3 Jack" -+ Value { -+ PlaybackPriority 500 -+ PlaybackPCM "hw:${CardId},3" -+ JackControl "HDMI/DP,pcm=3 Jack" -+ } -+ } - } - } - --SectionDevice."HDMI2" { -- Comment "HDMI2/DP2 Output" -+If.hdmi2 { -+ Condition { -+ Type ControlExists -+ Control "iface=CARD,name='HDMI/DP,pcm=4 Jack'" -+ } -+ True { -+ SectionDevice."HDMI2" { -+ Comment "HDMI2/DP2 Output" - -- EnableSequence [ -- cset "name='IEC958 Playback Switch',index=1 on" -- ] -+ EnableSequence [ -+ cset "name='IEC958 Playback Switch',index=1 on" -+ ] - -- DisableSequence [ -- cset "name='IEC958 Playback Switch',index=1 off" -- ] -+ DisableSequence [ -+ cset "name='IEC958 Playback Switch',index=1 off" -+ ] - -- Value { -- PlaybackPriority 600 -- PlaybackPCM "hw:${CardId},4" -- JackControl "HDMI/DP,pcm=4 Jack" -+ Value { -+ PlaybackPriority 600 -+ PlaybackPCM "hw:${CardId},4" -+ JackControl "HDMI/DP,pcm=4 Jack" -+ } -+ } - } - } - --SectionDevice."HDMI3" { -- Comment "HDMI3/DP3 Output" -+If.hdmi3 { -+ Condition { -+ Type ControlExists -+ Control "iface=CARD,name='HDMI/DP,pcm=5 Jack'" -+ } -+ True { -+ SectionDevice."HDMI3" { -+ Comment "HDMI3/DP3 Output" - -- EnableSequence [ -- cset "name='IEC958 Playback Switch',index=2 on" -- ] -+ EnableSequence [ -+ cset "name='IEC958 Playback Switch',index=2 on" -+ ] - -- DisableSequence [ -- cset "name='IEC958 Playback Switch',index=2 off" -- ] -+ DisableSequence [ -+ cset "name='IEC958 Playback Switch',index=2 off" -+ ] - -- Value { -- PlaybackPriority 700 -- PlaybackPCM "hw:${CardId},5" -- JackControl "HDMI/DP,pcm=5 Jack" -+ Value { -+ PlaybackPriority 700 -+ PlaybackPCM "hw:${CardId},5" -+ JackControl "HDMI/DP,pcm=5 Jack" -+ } -+ } - } - } --- -2.25.1 - - -From 76df616aa2fcae1cca1f948dac24c98a211c2593 Mon Sep 17 00:00:00 2001 -From: Mateusz Gorski -Date: Wed, 18 Mar 2020 11:26:05 +0100 -Subject: [PATCH 04/10] hda-dsp: add basic ucm config - -Basic UCM configuration for Intel Skylake SST with HDA DSP generic -machine driver enabling codec playback and capture on both HDA codec -and DMIC ports. - -Signed-off-by: Mateusz Gorski -Signed-off-by: Jaroslav Kysela ---- - ucm2/hda-dsp/Hdmi1.conf | 24 ++++++++++ - ucm2/hda-dsp/Hdmi2.conf | 23 ++++++++++ - ucm2/hda-dsp/HiFi.conf | 96 +++++++++++++++++++++++++++++++++++++++ - ucm2/hda-dsp/hda-dsp.conf | 16 +++++++ - 4 files changed, 159 insertions(+) - create mode 100644 ucm2/hda-dsp/Hdmi1.conf - create mode 100644 ucm2/hda-dsp/Hdmi2.conf - create mode 100644 ucm2/hda-dsp/HiFi.conf - create mode 100644 ucm2/hda-dsp/hda-dsp.conf - -diff --git a/ucm2/hda-dsp/Hdmi1.conf b/ucm2/hda-dsp/Hdmi1.conf -new file mode 100644 -index 0000000..08fa5dd ---- /dev/null -+++ b/ucm2/hda-dsp/Hdmi1.conf -@@ -0,0 +1,24 @@ -+# Usecase for device HDMI1/Display Port stereo playback on Intel cAVS platforms -+# For Audio in HDA mode -+ -+SectionDevice."HDMI1" { -+ Comment "HDMI/Display Port 1 Stereo" -+ -+ Value { -+ PlaybackPriority 300 -+ PlaybackPCM "hw:${CardId},10" -+ If.1 { -+ Condition { -+ Type ControlExists -+ Control "iface=CARD,name='HDMI/DP,pcm=17 Jack'" -+ } -+ True { -+ JackControl "HDMI/DP,pcm=17 Jack" -+ } -+ False { -+ JackControl "HDMI/DP, pcm=17 Jack" -+ } -+ } -+ } -+} -+ -diff --git a/ucm2/hda-dsp/Hdmi2.conf b/ucm2/hda-dsp/Hdmi2.conf -new file mode 100644 -index 0000000..eb168ea ---- /dev/null -+++ b/ucm2/hda-dsp/Hdmi2.conf -@@ -0,0 +1,23 @@ -+# Usecase for device HDMI2/Display Port stereo playback on Intel cAVS platforms -+# For Audio in HDA mode -+ -+SectionDevice."HDMI2" { -+ Comment "HDMI/Display Port 2 Stereo" -+ -+ Value { -+ PlaybackPriority 400 -+ PlaybackPCM "hw:${CardId},11" -+ If.1 { -+ Condition { -+ Type ControlExists -+ Control "iface=CARD,name='HDMI/DP,pcm=18 Jack'" -+ } -+ True { -+ JackControl "HDMI/DP,pcm=18 Jack" -+ } -+ False { -+ JackControl "HDMI/DP, pcm=18 Jack" -+ } -+ } -+ } -+} -diff --git a/ucm2/hda-dsp/HiFi.conf b/ucm2/hda-dsp/HiFi.conf -new file mode 100644 -index 0000000..cdeb215 ---- /dev/null -+++ b/ucm2/hda-dsp/HiFi.conf -@@ -0,0 +1,96 @@ -+# Usecase for stereo playback Speaker and Headset, Recording on DMIC and Headset MIC. -+# For Audio in HDA mode on Intel cAVS platforms -+ -+SectionVerb { -+ -+ EnableSequence [ -+ cset "name='mch_cap_out mo mch_cap_in mi Switch' 1" -+ ] -+ -+ Value { -+ TQ "HiFi" -+ } -+} -+ -+SectionDevice."Headphones" { -+ Comment "Headphones" -+ -+ ConflictingDevice [ -+ "Speaker" -+ ] -+ -+ EnableSequence [ -+ cset "name='Headphone Playback Switch' 1,1" -+ cset "name='Speaker Playback Switch' 0,0" -+ ] -+ -+ Value { -+ PlaybackPriority 200 -+ PlaybackPCM "hw:${CardId},7" -+ PlaybackMixerElem "Headphone" -+ PlaybackMasterElem "Master" -+ PlaybackVolume "Headphone Playback Volume" -+ PlaybackSwitch "Headphone Playback Switch" -+ JackControl "Front Headphone Jack" -+ JackHWMute "Speaker" -+ } -+} -+ -+SectionDevice."Speaker" { -+ Comment "Speaker" -+ -+ ConflictingDevice [ -+ "Headphones" -+ ] -+ -+ EnableSequence [ -+ cset "name='Headphone Playback Switch' 0,0" -+ cset "name='Speaker Playback Switch' 1,1" -+ ] -+ -+ Value { -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId},7" -+ PlaybackMixerElem "Speaker" -+ PlaybackMasterElem "Master" -+ PlaybackVolume "Speaker Playback Volume" -+ PlaybackSwitch "Speaker Playback Switch" -+ } -+} -+ -+SectionDevice."Headset" { -+ Comment "Headset Microphone" -+ -+ ConflictingDevice [ -+ "Mic" -+ ] -+ -+ EnableSequence [ -+ cset "name='media0_out mo codec0_in mi Switch' 1" -+ ] -+ -+ Value { -+ CapturePriority 200 -+ CapturePCM "hw:${CardId},7" -+ } -+} -+ -+SectionDevice."Mic" { -+ Comment "Digital Microphone" -+ -+ ConflictingDevice [ -+ "Headset" -+ ] -+ -+ EnableSequence [ -+ cset "name='mch_cap_out mo mch_cap_in mi Switch' 1" -+ ] -+ -+ Value { -+ CapturePriority 100 -+ CapturePCM "hw:${CardId},13" -+ } -+} -+ -+ -+ -diff --git a/ucm2/hda-dsp/hda-dsp.conf b/ucm2/hda-dsp/hda-dsp.conf -new file mode 100644 -index 0000000..bf80b09 ---- /dev/null -+++ b/ucm2/hda-dsp/hda-dsp.conf -@@ -0,0 +1,16 @@ -+# UCM for Intel CAVS platforms -+# For Audio in HDA and DMIC mode -+ -+Syntax 2 -+ -+SectionUseCase."HiFi" { -+ File "HiFi.conf" -+ Comment "Play HiFi quality Music" -+} -+ -+SectionDefaults [ -+ cset "name='Master Playback Switch' 1" -+ cset "name='codec0_out mo media0_in mi Switch' 1" -+ cset "name='media0_out mo codec0_in mi Switch' 1" -+ cset "name='mch_cap_out mo mch_cap_in mi Switch' 1" -+] --- -2.25.1 - - -From 85ca26a4f2b73888dbce3437a402df13faf628fa Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Sun, 5 Apr 2020 20:34:50 +0200 -Subject: [PATCH 06/10] bytcr-rt5651: Fix dmic check in HiFi-Components.conf - -The kernel sets cfg-mic:dmic not cfg-mic:dmic1 when a digital mic is -used. The wrong check for cfg-mic:dmic1 causes there to be no "Mic" -device at all, which causes the check for the ConflictingDevices section -of the HeadSet (mic) device to fail like e.g. so: - -[hans@localhost ~]$ alsaucm -c bytcr-rt5651 set _verb HiFi set _enadev Speaker -ALSA lib parser.c:1138:(verb_dev_list_add) error: unable to find device 'Mic' -ALSA lib parser.c:1433:(parse_verb_file) error: device management error in verb 'HiFi' -ALSA lib main.c:962:(snd_use_case_mgr_open) error: failed to import bytcr-rt5651 use case configuration -2 -alsaucm: error failed to open sound card bytcr-rt5651: No such file or directory - -This commit fixes this. - -Signed-off-by: Hans de Goede -Signed-off-by: Jaroslav Kysela ---- - ucm2/bytcr-rt5651/HiFi-Components.conf | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/ucm2/bytcr-rt5651/HiFi-Components.conf b/ucm2/bytcr-rt5651/HiFi-Components.conf -index 53ebcbe..d0a573e 100644 ---- a/ucm2/bytcr-rt5651/HiFi-Components.conf -+++ b/ucm2/bytcr-rt5651/HiFi-Components.conf -@@ -34,11 +34,11 @@ If.headphones { - } - } - --If.dmic1 { -+If.dmic { - Condition { - Type String - Haystack "${CardComponents}" -- Needle "cfg-mic:dmic1" -+ Needle "cfg-mic:dmic" - } - True { - --- -2.25.1 - - -From aaa86069ab721683afcf978b9291219855db42f1 Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Sun, 5 Apr 2020 20:34:51 +0200 -Subject: [PATCH 07/10] chtrt5645: Add ASUSTeKCOMPUTERINC.-T100HAN-1.0 symlink - to chtrt5645-dmic1.conf - -We already have a ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN symlink to -chtrt5645-dmic1.conf, but since kernel commit 39870b0dec68 ("ASoC: DMI long -name - avoid to add board name if matches with product name"), the kernel -omits the (second) -T100HAN. So with newer kernels that no longer works. - -Arguably this is a kernel regressions, but chances are we already have -some configs depending on the new behavior, so lets fix this on the -UCM2 side by adding a second symlink using the new long name. - -Signed-off-by: Hans de Goede -Signed-off-by: Jaroslav Kysela ---- - ucm2/chtrt5645/ASUSTeKCOMPUTERINC.-T100HAN-1.0.conf | 1 + - 1 file changed, 1 insertion(+) - create mode 120000 ucm2/chtrt5645/ASUSTeKCOMPUTERINC.-T100HAN-1.0.conf - -diff --git a/ucm2/chtrt5645/ASUSTeKCOMPUTERINC.-T100HAN-1.0.conf b/ucm2/chtrt5645/ASUSTeKCOMPUTERINC.-T100HAN-1.0.conf -new file mode 120000 -index 0000000..b4d2816 ---- /dev/null -+++ b/ucm2/chtrt5645/ASUSTeKCOMPUTERINC.-T100HAN-1.0.conf -@@ -0,0 +1 @@ -+chtrt5645-dmic1.conf -\ No newline at end of file --- -2.25.1 - - -From 5ba4fd1dfca593248a603e5621bf2f53a4e2ddcc Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Sun, 5 Apr 2020 20:34:52 +0200 -Subject: [PATCH 08/10] chtrt5645: Add MEDION-E1239TMD60568-0.1-Wingman.conf - symlink to chtrt5645-dmic2.conf - -The Medion Akoya E1239T 2-in-1 uses a digital mic connected to the -dmic2 pin, rather then the default analog mic on in2. - -Add a long name symlink to chtrt5645-dmic2.conf for this, so that -the right config is used. - -Signed-off-by: Hans de Goede -Signed-off-by: Jaroslav Kysela ---- - ucm2/chtrt5645/MEDION-E1239TMD60568-0.1-Wingman.conf | 1 + - 1 file changed, 1 insertion(+) - create mode 120000 ucm2/chtrt5645/MEDION-E1239TMD60568-0.1-Wingman.conf - -diff --git a/ucm2/chtrt5645/MEDION-E1239TMD60568-0.1-Wingman.conf b/ucm2/chtrt5645/MEDION-E1239TMD60568-0.1-Wingman.conf -new file mode 120000 -index 0000000..7823e31 ---- /dev/null -+++ b/ucm2/chtrt5645/MEDION-E1239TMD60568-0.1-Wingman.conf -@@ -0,0 +1 @@ -+chtrt5645-dmic2.conf -\ No newline at end of file --- -2.25.1 - - -From d0b1a426ba7cbfb34355a4101bb314ba288a6679 Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Sun, 5 Apr 2020 20:34:53 +0200 -Subject: [PATCH 09/10] chtrt5645: Remove bogus JackHWMute settings - -There is no reason why the internal microphone or speakers cannot -be used when a headset is plugged in. - -The jack does not physically disconnect these, so the JackHWMute settings -are wrong, remove them. - -Signed-off-by: Hans de Goede -Signed-off-by: Jaroslav Kysela ---- - ucm2/chtrt5645/HiFi-dmic1.conf | 2 -- - ucm2/chtrt5645/HiFi-dmic2.conf | 2 -- - ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf | 2 -- - ucm2/chtrt5645/HiFi.conf | 2 -- - 4 files changed, 8 deletions(-) - -diff --git a/ucm2/chtrt5645/HiFi-dmic1.conf b/ucm2/chtrt5645/HiFi-dmic1.conf -index 1a8ee0a..c7e12c9 100644 ---- a/ucm2/chtrt5645/HiFi-dmic1.conf -+++ b/ucm2/chtrt5645/HiFi-dmic1.conf -@@ -50,7 +50,6 @@ SectionDevice."Headphones" { - PlaybackPriority 200 - PlaybackPCM "hw:${CardId}" - JackControl "Headphone Jack" -- JackHWMute "Speaker" - } - - ConflictingDevice [ -@@ -96,7 +95,6 @@ SectionDevice."Headset" { - CapturePriority 200 - CapturePCM "hw:${CardId}" - JackControl "Headset Mic Jack" -- JackHWMute "Mic" - } - - EnableSequence [ -diff --git a/ucm2/chtrt5645/HiFi-dmic2.conf b/ucm2/chtrt5645/HiFi-dmic2.conf -index d3f880a..95fedb3 100644 ---- a/ucm2/chtrt5645/HiFi-dmic2.conf -+++ b/ucm2/chtrt5645/HiFi-dmic2.conf -@@ -50,7 +50,6 @@ SectionDevice."Headphones" { - PlaybackPriority 200 - PlaybackPCM "hw:${CardId}" - JackControl "Headphone Jack" -- JackHWMute "Speaker" - } - - ConflictingDevice [ -@@ -98,7 +97,6 @@ SectionDevice."Headset" { - CapturePriority 200 - CapturePCM "hw:${CardId}" - JackControl "Headset Mic Jack" -- JackHWMute "Mic" - } - - EnableSequence [ -diff --git a/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf b/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf -index db866cd..f6180a4 100644 ---- a/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf -+++ b/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf -@@ -54,7 +54,6 @@ SectionDevice."Headphones" { - PlaybackPriority 200 - PlaybackPCM "hw:${CardId}" - JackControl "Headphone Jack" -- JackHWMute "Speaker" - } - - ConflictingDevice [ -@@ -84,7 +83,6 @@ SectionDevice."Headset" { - CapturePriority 200 - CapturePCM "hw:${CardId}" - JackControl "Headset Mic Jack" -- JackHWMute "Mic" - } - - EnableSequence [ -diff --git a/ucm2/chtrt5645/HiFi.conf b/ucm2/chtrt5645/HiFi.conf -index 58468a8..116d456 100644 ---- a/ucm2/chtrt5645/HiFi.conf -+++ b/ucm2/chtrt5645/HiFi.conf -@@ -50,7 +50,6 @@ SectionDevice."Headphones" { - PlaybackPriority 200 - PlaybackPCM "hw:${CardId}" - JackControl "Headphone Jack" -- JackHWMute "Speaker" - } - - ConflictingDevice [ -@@ -76,7 +75,6 @@ SectionDevice."Headset" { - CapturePriority 200 - CapturePCM "hw:${CardId}" - JackControl "Headset Mic Jack" -- JackHWMute "Mic" - } - - EnableSequence [ --- -2.25.1 - - -From 907c8309b2ee671e1b36630b0d29db1bc3124990 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Mon, 6 Apr 2020 17:37:20 +0200 -Subject: [PATCH 10/10] sof-hda-dsp: change Headphones2 to Mic2 - -Fixes: https://github.com/alsa-project/alsa-ucm-conf/issues/19 - -Signed-off-by: Jaroslav Kysela ---- - ucm2/sof-hda-dsp/HiFi.conf | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/ucm2/sof-hda-dsp/HiFi.conf b/ucm2/sof-hda-dsp/HiFi.conf -index 60a8693..9a82930 100644 ---- a/ucm2/sof-hda-dsp/HiFi.conf -+++ b/ucm2/sof-hda-dsp/HiFi.conf -@@ -6,7 +6,7 @@ SectionVerb { - ] - } - --SectionDevice."Headphones1" { -+SectionDevice."Headphones" { - Comment "Headphones" - - EnableSequence [ -@@ -85,9 +85,9 @@ If.monomic { - Control "name='Input Source'" - ControlEnum "Headphone Mic" - } -- After.SectionDevice "Mic" -+ After.SectionDevice "Mic1" - True { -- SectionDevice."Headphones2" { -+ SectionDevice."Mic2" { - Comment "Headphones Stereo Microphone" - - ConflictingDevice [ -@@ -120,7 +120,7 @@ If.monomic { - } - } - False { -- SectionDevice."Headphones2" { -+ SectionDevice."Mic2" { - Comment "Headphones Stereo Microphone" - - Value { -@@ -132,7 +132,7 @@ If.monomic { - } - } - --SectionDevice."Mic" { -+SectionDevice."Mic1" { - Comment "Digital Microphone" - - Value { --- -2.25.1 - diff --git a/sources b/sources index c7d59c4..243a38e 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (alsa-lib-1.2.2.tar.bz2) = d21adb3ff998918c7d1820f9ce2aaf4202dd45ccb87cb092d49da8b2402b6ddaad06325be0fd59f17393a5d9958e3743bfccb4b14bdb947a42e7d791d73c7033 -SHA512 (alsa-ucm-conf-1.2.2.tar.bz2) = 25e3f341c110772c7cffc8c7745b320f2ddd12fe6460380c088939b5dc67b99ae4ad92e69375179574e0e1c40d14ff49961e86494e223fde009e51590f00ca8f -SHA512 (alsa-topology-conf-1.2.2.tar.bz2) = 145ee0e16f7f84d5f97759b1efaa3df9fe35c8b33c7ae863ae1b915f361acd902ad05f59090e1d98b2a4f2ecc14933681592893564fcc45cdbc974899f789b94 +SHA512 (alsa-lib-1.2.3.tar.bz2) = e4e09062786635461bd721c71f1cfa01227a2ec2791bbe386b1cdb0e9f83d12291ced9977d9b1f09d6be6a336da2ad239d51e4bd28bcd48f767864f93492fff0 +SHA512 (alsa-ucm-conf-1.2.3.tar.bz2) = 1bdb024170f1dc18170c1d3699798c14d9cc7bbaccfe6eaef1fac0ec8c28074d08ed722bf47996682d4a0737138112b7eb4d45e224f00b027b3331da728e47cd +SHA512 (alsa-topology-conf-1.2.3.tar.bz2) = e57439212fd76d1d0c1677654ae7cecef0f89c01a6c57f5f00a02ecd2f6d9f22dc31ed4f301cf82464d98ac32c01f2015a91a5b51d08268ddfeb4265e9b951b9 From 66788d6a633283358e22957ce09759b92d47128a Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Sun, 7 Jun 2020 19:43:52 +0200 Subject: [PATCH 040/120] add changelog for 1.2.3 --- alsa-lib.spec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/alsa-lib.spec b/alsa-lib.spec index 43c280f..a29db22 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -163,6 +163,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Sun Jun 7 2020 Jaroslav Kysela - 1.2.3-1 +- update to 1.2.3 + * Mon Apr 6 2020 Jaroslav Kysela - 1.2.2-2 - UCM2 fixes (RemoveDevice), bug#1786723 From 1f4c94a44801c9548b18447f9960a2759bc7ea0b Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Sun, 7 Jun 2020 19:53:38 +0200 Subject: [PATCH 041/120] fix the release number in changelog --- alsa-lib.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index a29db22..e257ee4 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -163,7 +163,7 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog -* Sun Jun 7 2020 Jaroslav Kysela - 1.2.3-1 +* Sun Jun 7 2020 Jaroslav Kysela - 1.2.3-2 - update to 1.2.3 * Mon Apr 6 2020 Jaroslav Kysela - 1.2.2-2 From 3f1a7a5da01101499aabc28257d8d7804bd9042b Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Sun, 7 Jun 2020 21:36:52 +0200 Subject: [PATCH 042/120] rename alsa-lib-1.1.9-config.patch to alsa-lib-1.2.3-config.patch --- alsa-lib-1.1.9-config.patch => alsa-lib-1.2.3-config.patch | 0 alsa-lib.spec | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename alsa-lib-1.1.9-config.patch => alsa-lib-1.2.3-config.patch (100%) diff --git a/alsa-lib-1.1.9-config.patch b/alsa-lib-1.2.3-config.patch similarity index 100% rename from alsa-lib-1.1.9-config.patch rename to alsa-lib-1.2.3-config.patch diff --git a/alsa-lib.spec b/alsa-lib.spec index e257ee4..f604376 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -21,7 +21,7 @@ Source11: modprobe-dist-alsa.conf Source12: modprobe-dist-oss.conf Source40: alsa-ucm-conf.patch Patch0: alsa-git.patch -Patch1: alsa-lib-1.1.9-config.patch +Patch1: alsa-lib-1.2.3-config.patch Patch2: alsa-lib-1.0.14-glibc-open.patch BuildRequires: doxygen From f7063399dcd03dbfccd4d95c6ae3272105c27716 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Sun, 7 Jun 2020 22:54:17 +0200 Subject: [PATCH 043/120] do not move library files from /usr/lib to /lib --- alsa-lib.spec | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index f604376..e64d610 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -89,13 +89,6 @@ make doc make DESTDIR=%{buildroot} install -# We need the library to be available even before /usr might be mounted -mkdir -p %{buildroot}/%{_lib} -mv %{buildroot}%{_libdir}/libasound.so.* %{buildroot}/%{_lib} -ln -snf ../../%{_lib}/libasound.so.2 %{buildroot}%{_libdir}/libasound.so -mv %{buildroot}%{_libdir}/libatopology.so.* %{buildroot}/%{_lib} -ln -snf ../../%{_lib}/libatopology.so.2 %{buildroot}%{_libdir}/libatopology.so - # Install global configuration files mkdir -p -m 755 %{buildroot}/etc install -p -m 644 %{SOURCE10} %{buildroot}/etc @@ -133,8 +126,8 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %license COPYING %doc doc/asoundrc.txt modprobe-dist-oss.conf %config %{_sysconfdir}/asound.conf -/%{_lib}/libasound.so.* -/%{_lib}/libatopology.so.* +/%{_libdir}/libasound.so.* +/%{_libdir}/libatopology.so.* %{_bindir}/aserver #{_libdir}/alsa-lib/ %{_datadir}/alsa/ From b604e1f66f74eae089eeb1c54c5f20cccfc68641 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Sun, 7 Jun 2020 22:55:29 +0200 Subject: [PATCH 044/120] increase release --- alsa-lib.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index e64d610..8f1d9c8 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 2%{?prever_dot}%{?dist} +Release: 3%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -156,7 +156,7 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog -* Sun Jun 7 2020 Jaroslav Kysela - 1.2.3-2 +* Sun Jun 7 2020 Jaroslav Kysela - 1.2.3-3 - update to 1.2.3 * Mon Apr 6 2020 Jaroslav Kysela - 1.2.2-2 From a5b2c7694ee61462cac16100f272fbc96a79c266 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 8 Jun 2020 10:14:27 +0200 Subject: [PATCH 045/120] update the alsa-lib tar ball --- alsa-lib.spec | 4 ++-- sources | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 8f1d9c8..e6fee33 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 3%{?prever_dot}%{?dist} +Release: 4%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -156,7 +156,7 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog -* Sun Jun 7 2020 Jaroslav Kysela - 1.2.3-3 +* Sun Jun 7 2020 Jaroslav Kysela - 1.2.3-4 - update to 1.2.3 * Mon Apr 6 2020 Jaroslav Kysela - 1.2.2-2 diff --git a/sources b/sources index 243a38e..e4fa05f 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (alsa-lib-1.2.3.tar.bz2) = e4e09062786635461bd721c71f1cfa01227a2ec2791bbe386b1cdb0e9f83d12291ced9977d9b1f09d6be6a336da2ad239d51e4bd28bcd48f767864f93492fff0 +SHA512 (alsa-lib-1.2.3.tar.bz2) = 17c5a3c915b4f47245fea3ac4c7a8985e9a5b9667733b938d92458fcf4d1d166cb13077c5b61765a8a2a5d0c9554fe8e7052a8118729af151dc45b75e5cbe3e7 SHA512 (alsa-ucm-conf-1.2.3.tar.bz2) = 1bdb024170f1dc18170c1d3699798c14d9cc7bbaccfe6eaef1fac0ec8c28074d08ed722bf47996682d4a0737138112b7eb4d45e224f00b027b3331da728e47cd SHA512 (alsa-topology-conf-1.2.3.tar.bz2) = e57439212fd76d1d0c1677654ae7cecef0f89c01a6c57f5f00a02ecd2f6d9f22dc31ed4f301cf82464d98ac32c01f2015a91a5b51d08268ddfeb4265e9b951b9 From 90144bdd5ea0dc27cfabc238f79e7abf24560eb3 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 8 Jun 2020 12:12:23 +0200 Subject: [PATCH 046/120] update the alsa-lib tar ball (2nd) --- alsa-lib.spec | 4 ++-- sources | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index e6fee33..59f845a 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 4%{?prever_dot}%{?dist} +Release: 5%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -156,7 +156,7 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog -* Sun Jun 7 2020 Jaroslav Kysela - 1.2.3-4 +* Sun Jun 7 2020 Jaroslav Kysela - 1.2.3-5 - update to 1.2.3 * Mon Apr 6 2020 Jaroslav Kysela - 1.2.2-2 diff --git a/sources b/sources index e4fa05f..61ce79b 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (alsa-lib-1.2.3.tar.bz2) = 17c5a3c915b4f47245fea3ac4c7a8985e9a5b9667733b938d92458fcf4d1d166cb13077c5b61765a8a2a5d0c9554fe8e7052a8118729af151dc45b75e5cbe3e7 +SHA512 (alsa-lib-1.2.3.tar.bz2) = d57c34273fab3e57a7a82e9a854b1f4858e8013f30f037288cf8e97fa90d7c824d62f6b1006fab2304aba266fac51935229ebcb13707611b3c762744797ebc29 SHA512 (alsa-ucm-conf-1.2.3.tar.bz2) = 1bdb024170f1dc18170c1d3699798c14d9cc7bbaccfe6eaef1fac0ec8c28074d08ed722bf47996682d4a0737138112b7eb4d45e224f00b027b3331da728e47cd SHA512 (alsa-topology-conf-1.2.3.tar.bz2) = e57439212fd76d1d0c1677654ae7cecef0f89c01a6c57f5f00a02ecd2f6d9f22dc31ed4f301cf82464d98ac32c01f2015a91a5b51d08268ddfeb4265e9b951b9 From 92e47738e84041619cf7dcf85f8e06001ea60fcd Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 8 Jun 2020 13:20:00 +0200 Subject: [PATCH 047/120] update the alsa-lib tar ball (3rd) --- alsa-lib.spec | 4 ++-- sources | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 59f845a..d55d5cc 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 5%{?prever_dot}%{?dist} +Release: 6%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -156,7 +156,7 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog -* Sun Jun 7 2020 Jaroslav Kysela - 1.2.3-5 +* Sun Jun 7 2020 Jaroslav Kysela - 1.2.3-6 - update to 1.2.3 * Mon Apr 6 2020 Jaroslav Kysela - 1.2.2-2 diff --git a/sources b/sources index 61ce79b..285d275 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (alsa-lib-1.2.3.tar.bz2) = d57c34273fab3e57a7a82e9a854b1f4858e8013f30f037288cf8e97fa90d7c824d62f6b1006fab2304aba266fac51935229ebcb13707611b3c762744797ebc29 +SHA512 (alsa-lib-1.2.3.tar.bz2) = f23d7f30af2d11d9a75d19bfd5349f80926a583e2a5eff74b87865985d6fea36fc7658dbdc1322b505216ddc45264c39da5f45e311229e34b3fa6a85896bb4f5 SHA512 (alsa-ucm-conf-1.2.3.tar.bz2) = 1bdb024170f1dc18170c1d3699798c14d9cc7bbaccfe6eaef1fac0ec8c28074d08ed722bf47996682d4a0737138112b7eb4d45e224f00b027b3331da728e47cd SHA512 (alsa-topology-conf-1.2.3.tar.bz2) = e57439212fd76d1d0c1677654ae7cecef0f89c01a6c57f5f00a02ecd2f6d9f22dc31ed4f301cf82464d98ac32c01f2015a91a5b51d08268ddfeb4265e9b951b9 From 598d1d3cc1f34fdb6e06e06ee9a206149b07eebf Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 8 Jun 2020 13:46:36 +0200 Subject: [PATCH 048/120] update the alsa-lib tar ball (4th) --- sources | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources b/sources index 285d275..58b8e78 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (alsa-lib-1.2.3.tar.bz2) = f23d7f30af2d11d9a75d19bfd5349f80926a583e2a5eff74b87865985d6fea36fc7658dbdc1322b505216ddc45264c39da5f45e311229e34b3fa6a85896bb4f5 SHA512 (alsa-ucm-conf-1.2.3.tar.bz2) = 1bdb024170f1dc18170c1d3699798c14d9cc7bbaccfe6eaef1fac0ec8c28074d08ed722bf47996682d4a0737138112b7eb4d45e224f00b027b3331da728e47cd SHA512 (alsa-topology-conf-1.2.3.tar.bz2) = e57439212fd76d1d0c1677654ae7cecef0f89c01a6c57f5f00a02ecd2f6d9f22dc31ed4f301cf82464d98ac32c01f2015a91a5b51d08268ddfeb4265e9b951b9 +SHA512 (alsa-lib-1.2.3.tar.bz2) = 2233ba65bc4ccb5fe7d38c301497eb11c2c9b55a3fe29751c22cca072421c47a6fba54238e12b13c640ff96bc38fd9a8c9ca1f482dad5e81338968f4315c6db9 From 76316fa323eb55582bfc6c2ed46120948dc9a013 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 8 Jun 2020 13:48:41 +0200 Subject: [PATCH 049/120] increase release --- alsa-lib.spec | 4 ++-- sources | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index d55d5cc..5f91dbe 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 6%{?prever_dot}%{?dist} +Release: 7%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -156,7 +156,7 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog -* Sun Jun 7 2020 Jaroslav Kysela - 1.2.3-6 +* Sun Jun 7 2020 Jaroslav Kysela - 1.2.3-7 - update to 1.2.3 * Mon Apr 6 2020 Jaroslav Kysela - 1.2.2-2 diff --git a/sources b/sources index 58b8e78..e565a4b 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ +SHA512 (alsa-lib-1.2.3.tar.bz2) = 2233ba65bc4ccb5fe7d38c301497eb11c2c9b55a3fe29751c22cca072421c47a6fba54238e12b13c640ff96bc38fd9a8c9ca1f482dad5e81338968f4315c6db9 SHA512 (alsa-ucm-conf-1.2.3.tar.bz2) = 1bdb024170f1dc18170c1d3699798c14d9cc7bbaccfe6eaef1fac0ec8c28074d08ed722bf47996682d4a0737138112b7eb4d45e224f00b027b3331da728e47cd SHA512 (alsa-topology-conf-1.2.3.tar.bz2) = e57439212fd76d1d0c1677654ae7cecef0f89c01a6c57f5f00a02ecd2f6d9f22dc31ed4f301cf82464d98ac32c01f2015a91a5b51d08268ddfeb4265e9b951b9 -SHA512 (alsa-lib-1.2.3.tar.bz2) = 2233ba65bc4ccb5fe7d38c301497eb11c2c9b55a3fe29751c22cca072421c47a6fba54238e12b13c640ff96bc38fd9a8c9ca1f482dad5e81338968f4315c6db9 From 5bc5d0674388418e26764ff8ec4d2510ce37959e Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 8 Jun 2020 15:10:26 +0200 Subject: [PATCH 050/120] update the alsa-lib tar ball (5th) --- alsa-lib.spec | 4 ++-- sources | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 5f91dbe..af4d272 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 7%{?prever_dot}%{?dist} +Release: 8%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -156,7 +156,7 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog -* Sun Jun 7 2020 Jaroslav Kysela - 1.2.3-7 +* Sun Jun 7 2020 Jaroslav Kysela - 1.2.3-8 - update to 1.2.3 * Mon Apr 6 2020 Jaroslav Kysela - 1.2.2-2 diff --git a/sources b/sources index e565a4b..c06023c 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (alsa-lib-1.2.3.tar.bz2) = 2233ba65bc4ccb5fe7d38c301497eb11c2c9b55a3fe29751c22cca072421c47a6fba54238e12b13c640ff96bc38fd9a8c9ca1f482dad5e81338968f4315c6db9 +SHA512 (alsa-lib-1.2.3.tar.bz2) = 567c094914833af511bd7b175b0865ae4e4483ae68a7d4f90a34b12d7f077782835eec24257a7928631c104c78eff588f7b92068aade37e3c4806d79353758a8 SHA512 (alsa-ucm-conf-1.2.3.tar.bz2) = 1bdb024170f1dc18170c1d3699798c14d9cc7bbaccfe6eaef1fac0ec8c28074d08ed722bf47996682d4a0737138112b7eb4d45e224f00b027b3331da728e47cd SHA512 (alsa-topology-conf-1.2.3.tar.bz2) = e57439212fd76d1d0c1677654ae7cecef0f89c01a6c57f5f00a02ecd2f6d9f22dc31ed4f301cf82464d98ac32c01f2015a91a5b51d08268ddfeb4265e9b951b9 From 4ec77094a4760880977dde22251eb506f7b7fc62 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 18 Jun 2020 19:43:36 +0200 Subject: [PATCH 051/120] update to 1.2.3.1 --- ...b-1.2.3-config.patch => alsa-lib-1.2.3.1-config.patch | 4 ++-- alsa-lib.spec | 9 ++++++--- sources | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) rename alsa-lib-1.2.3-config.patch => alsa-lib-1.2.3.1-config.patch (94%) diff --git a/alsa-lib-1.2.3-config.patch b/alsa-lib-1.2.3.1-config.patch similarity index 94% rename from alsa-lib-1.2.3-config.patch rename to alsa-lib-1.2.3.1-config.patch index 3926a98..95961a5 100644 --- a/alsa-lib-1.2.3-config.patch +++ b/alsa-lib-1.2.3.1-config.patch @@ -1,5 +1,5 @@ diff --git a/src/conf/alsa.conf b/src/conf/alsa.conf -index 08370108..dea39af1 100644 +index 18427ec6..1915af4e 100644 --- a/src/conf/alsa.conf +++ b/src/conf/alsa.conf @@ -80,8 +80,7 @@ defaults.pcm.nonblock 1 @@ -9,7 +9,7 @@ index 08370108..dea39af1 100644 -defaults.pcm.ipc_gid audio -defaults.pcm.ipc_perm 0660 +defaults.pcm.ipc_perm 0600 - defaults.pcm.tstamp_type "default" + defaults.pcm.tstamp_type default defaults.pcm.dmix.max_periods 0 defaults.pcm.dmix.channels 2 diff --git a/src/conf/pcm/dmix.conf b/src/conf/pcm/dmix.conf diff --git a/alsa-lib.spec b/alsa-lib.spec index af4d272..5ee696a 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -2,14 +2,14 @@ #define prever_dot .rc3 #define postver a -%define version_alsa_lib 1.2.3 +%define version_alsa_lib 1.2.3.1 %define version_alsa_ucm 1.2.3 %define version_alsa_tplg 1.2.3 Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 8%{?prever_dot}%{?dist} +Release: 1%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -21,7 +21,7 @@ Source11: modprobe-dist-alsa.conf Source12: modprobe-dist-oss.conf Source40: alsa-ucm-conf.patch Patch0: alsa-git.patch -Patch1: alsa-lib-1.2.3-config.patch +Patch1: alsa-lib-1.2.3.1-config.patch Patch2: alsa-lib-1.0.14-glibc-open.patch BuildRequires: doxygen @@ -156,6 +156,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Thu Jun 18 2020 Jaroslav Kysela - 1.2.3.1-1 +- update to 1.2.3.1 + * Sun Jun 7 2020 Jaroslav Kysela - 1.2.3-8 - update to 1.2.3 diff --git a/sources b/sources index c06023c..5711402 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (alsa-lib-1.2.3.tar.bz2) = 567c094914833af511bd7b175b0865ae4e4483ae68a7d4f90a34b12d7f077782835eec24257a7928631c104c78eff588f7b92068aade37e3c4806d79353758a8 +SHA512 (alsa-lib-1.2.3.1.tar.bz2) = ed0a81371117a91a5024f3bef5a881ffa9521399eab5e016924669a3f1eba2d6a02efa284b160089bc581717d39d15325ebb2faf162e4d3dabe4c29785a5fb58 SHA512 (alsa-ucm-conf-1.2.3.tar.bz2) = 1bdb024170f1dc18170c1d3699798c14d9cc7bbaccfe6eaef1fac0ec8c28074d08ed722bf47996682d4a0737138112b7eb4d45e224f00b027b3331da728e47cd SHA512 (alsa-topology-conf-1.2.3.tar.bz2) = e57439212fd76d1d0c1677654ae7cecef0f89c01a6c57f5f00a02ecd2f6d9f22dc31ed4f301cf82464d98ac32c01f2015a91a5b51d08268ddfeb4265e9b951b9 From 31c63faaa997ad41e7e465c7b1a2bda8b7e612cf Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 29 Jun 2020 13:04:27 +0200 Subject: [PATCH 052/120] update to 1.2.3.2 --- alsa-lib.spec | 7 +++++-- sources | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 5ee696a..e5b2cce 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -2,14 +2,14 @@ #define prever_dot .rc3 #define postver a -%define version_alsa_lib 1.2.3.1 +%define version_alsa_lib 1.2.3.2 %define version_alsa_ucm 1.2.3 %define version_alsa_tplg 1.2.3 Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 1%{?prever_dot}%{?dist} +Release: 2%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -156,6 +156,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Mon Jun 29 2020 Jaroslav Kysela - 1.2.3.2-1 +- update to 1.2.3.2 + * Thu Jun 18 2020 Jaroslav Kysela - 1.2.3.1-1 - update to 1.2.3.1 diff --git a/sources b/sources index 5711402..b4c2e87 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (alsa-lib-1.2.3.1.tar.bz2) = ed0a81371117a91a5024f3bef5a881ffa9521399eab5e016924669a3f1eba2d6a02efa284b160089bc581717d39d15325ebb2faf162e4d3dabe4c29785a5fb58 +SHA512 (alsa-lib-1.2.3.2.tar.bz2) = 1fbc6360fda841bd9ca488739bdc9f4142c1b4a07ff767f48f1e160e3d4dff914aed422c97088e238b5e77d7e30aa79ff72569c3348a4cf4a412e1e4bce0bf2a SHA512 (alsa-ucm-conf-1.2.3.tar.bz2) = 1bdb024170f1dc18170c1d3699798c14d9cc7bbaccfe6eaef1fac0ec8c28074d08ed722bf47996682d4a0737138112b7eb4d45e224f00b027b3331da728e47cd SHA512 (alsa-topology-conf-1.2.3.tar.bz2) = e57439212fd76d1d0c1677654ae7cecef0f89c01a6c57f5f00a02ecd2f6d9f22dc31ed4f301cf82464d98ac32c01f2015a91a5b51d08268ddfeb4265e9b951b9 From f95bf4e5604a1286b6472c67a378fc7c92ee2d58 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 29 Jun 2020 13:11:52 +0200 Subject: [PATCH 053/120] fix release version in comment --- alsa-lib.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index e5b2cce..4f065ff 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -156,7 +156,7 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog -* Mon Jun 29 2020 Jaroslav Kysela - 1.2.3.2-1 +* Mon Jun 29 2020 Jaroslav Kysela - 1.2.3.2-2 - update to 1.2.3.2 * Thu Jun 18 2020 Jaroslav Kysela - 1.2.3.1-1 From 9a6aa025e9fa17c4e54d87e9f8257492d8dab586 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Wed, 1 Jul 2020 12:24:26 -0600 Subject: [PATCH 054/120] Disable LTO --- alsa-lib.spec | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 4f065ff..67dd424 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 2%{?prever_dot}%{?dist} +Release: 3%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -74,6 +74,14 @@ contains alsa-lib configuration of SoC topology %patch2 -p1 -b .glibc-open %build +# This package uses top level ASM constructs which are incompatible with LTO. +# Top level ASMs are often used to implement symbol versioning. gcc-10 +# introduces a new mechanism for symbol versioning which works with LTO. +# Converting packages to use that mechanism instead of toplevel ASMs is +# recommended. +# Disable LTO +%define _lto_cflags %{nil} + autoreconf -vif %configure --disable-aload --with-plugindir=%{_libdir}/alsa-lib --disable-alisp @@ -156,6 +164,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Wed Jul 1 2020 Jeff Law - 1.2.3.2-3 +- Disable LTO + * Mon Jun 29 2020 Jaroslav Kysela - 1.2.3.2-2 - update to 1.2.3.2 From 9cf64c7508345a96476c81b2f2f85eebde76a5b4 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Mon, 27 Jul 2020 11:57:17 +0000 Subject: [PATCH 055/120] - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- alsa-lib.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 67dd424..e0a2fe4 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 3%{?prever_dot}%{?dist} +Release: 4%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -164,6 +164,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Mon Jul 27 2020 Fedora Release Engineering - 1.2.3.2-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + * Wed Jul 1 2020 Jeff Law - 1.2.3.2-3 - Disable LTO From d1acbfe5cbd0b61371d377f2bb319155a4e538c0 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 31 Jul 2020 23:55:35 +0000 Subject: [PATCH 056/120] - Second attempt - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- alsa-lib.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index e0a2fe4..9fa60fa 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 4%{?prever_dot}%{?dist} +Release: 5%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -164,6 +164,10 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Fri Jul 31 2020 Fedora Release Engineering - 1.2.3.2-5 +- Second attempt - Rebuilt for + https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + * Mon Jul 27 2020 Fedora Release Engineering - 1.2.3.2-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild From d8f7704e43ad69cf7ab413cce19a8ddee1b5aa11 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 15 Oct 2020 18:39:53 +0200 Subject: [PATCH 057/120] update to 1.2.4 --- alsa-lib.spec | 16 +++++++++++----- sources | 6 +++--- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 9fa60fa..c5ed308 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -2,14 +2,14 @@ #define prever_dot .rc3 #define postver a -%define version_alsa_lib 1.2.3.2 -%define version_alsa_ucm 1.2.3 -%define version_alsa_tplg 1.2.3 +%define version_alsa_lib 1.2.4 +%define version_alsa_ucm 1.2.4 +%define version_alsa_tplg 1.2.4 Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 5%{?prever_dot}%{?dist} +Release: 1%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -79,8 +79,10 @@ contains alsa-lib configuration of SoC topology # introduces a new mechanism for symbol versioning which works with LTO. # Converting packages to use that mechanism instead of toplevel ASMs is # recommended. +# Note: The v1.2.4 contains changes wich are compatible with gcc-10 LTO +# although using the old ASM constructs. # Disable LTO -%define _lto_cflags %{nil} +#%define _lto_cflags %{nil} autoreconf -vif %configure --disable-aload --with-plugindir=%{_libdir}/alsa-lib --disable-alisp @@ -164,6 +166,10 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Thu Oct 15 2020 Jaroslav Kysela - 1.2.4-1 +- update to 1.2.4 +- enable LTO + * Fri Jul 31 2020 Fedora Release Engineering - 1.2.3.2-5 - Second attempt - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild diff --git a/sources b/sources index b4c2e87..09f412c 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (alsa-lib-1.2.3.2.tar.bz2) = 1fbc6360fda841bd9ca488739bdc9f4142c1b4a07ff767f48f1e160e3d4dff914aed422c97088e238b5e77d7e30aa79ff72569c3348a4cf4a412e1e4bce0bf2a -SHA512 (alsa-ucm-conf-1.2.3.tar.bz2) = 1bdb024170f1dc18170c1d3699798c14d9cc7bbaccfe6eaef1fac0ec8c28074d08ed722bf47996682d4a0737138112b7eb4d45e224f00b027b3331da728e47cd -SHA512 (alsa-topology-conf-1.2.3.tar.bz2) = e57439212fd76d1d0c1677654ae7cecef0f89c01a6c57f5f00a02ecd2f6d9f22dc31ed4f301cf82464d98ac32c01f2015a91a5b51d08268ddfeb4265e9b951b9 +SHA512 (alsa-lib-1.2.4.tar.bz2) = 3577a65f803c8ee112c44954d3594c4ae0ddaf26ffa66e1e9974120e245de573e4aec143f82ca0e4ca82e828b94d539e9bc564a43026efa5b1787cdadc029afb +SHA512 (alsa-ucm-conf-1.2.4.tar.bz2) = 9043460e92b2ed44757b08b9faca888e8bfae40d84e4ad7e7df44df2bb3b0617e86ef23783973accd62fb6681788262e67212e2bf67178d75781e57a0fa346d2 +SHA512 (alsa-topology-conf-1.2.4.tar.bz2) = e5b367a23f42ed2c2a83f3dd9df264b4e054f5ba7c4be98520418598f0b06a11627498a8a6ef943522b209951645f83bbbbfb32db7c9c8260aa5db08358970cb From dffef8e6ea70d88f8a03d32f8216486304d9235e Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 15 Oct 2020 19:31:06 +0200 Subject: [PATCH 058/120] fix s390 build --- alsa-lib.spec | 6 +++--- sources | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index c5ed308..c6a853f 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 1%{?prever_dot}%{?dist} +Release: 2%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -82,7 +82,7 @@ contains alsa-lib configuration of SoC topology # Note: The v1.2.4 contains changes wich are compatible with gcc-10 LTO # although using the old ASM constructs. # Disable LTO -#%define _lto_cflags %{nil} +#define _lto_cflags #{nil} autoreconf -vif %configure --disable-aload --with-plugindir=%{_libdir}/alsa-lib --disable-alisp @@ -166,7 +166,7 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog -* Thu Oct 15 2020 Jaroslav Kysela - 1.2.4-1 +* Thu Oct 15 2020 Jaroslav Kysela - 1.2.4-2 - update to 1.2.4 - enable LTO diff --git a/sources b/sources index 09f412c..f5141cf 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (alsa-lib-1.2.4.tar.bz2) = 3577a65f803c8ee112c44954d3594c4ae0ddaf26ffa66e1e9974120e245de573e4aec143f82ca0e4ca82e828b94d539e9bc564a43026efa5b1787cdadc029afb +SHA512 (alsa-lib-1.2.4.tar.bz2) = 4de259c019ccc35fae4a34aee4df3ce7109a0d2f2cb21457ae569ad8d14099cc9eec8afc552309beb7bedd750e0ca27d2680161cfdd5d8ddc1a4e07ce62705ce SHA512 (alsa-ucm-conf-1.2.4.tar.bz2) = 9043460e92b2ed44757b08b9faca888e8bfae40d84e4ad7e7df44df2bb3b0617e86ef23783973accd62fb6681788262e67212e2bf67178d75781e57a0fa346d2 SHA512 (alsa-topology-conf-1.2.4.tar.bz2) = e5b367a23f42ed2c2a83f3dd9df264b4e054f5ba7c4be98520418598f0b06a11627498a8a6ef943522b209951645f83bbbbfb32db7c9c8260aa5db08358970cb From 0b0ace4695ca58c2d77d8295d992a819b13d25e0 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 15 Oct 2020 19:43:55 +0200 Subject: [PATCH 059/120] try to fix lto build --- alsa-lib.spec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index c6a853f..c77197c 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 2%{?prever_dot}%{?dist} +Release: 3%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -82,7 +82,7 @@ contains alsa-lib configuration of SoC topology # Note: The v1.2.4 contains changes wich are compatible with gcc-10 LTO # although using the old ASM constructs. # Disable LTO -#define _lto_cflags #{nil} +%define _lto_cflags -flto -ffat-lto-objects -flto-partition=none autoreconf -vif %configure --disable-aload --with-plugindir=%{_libdir}/alsa-lib --disable-alisp @@ -166,7 +166,7 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog -* Thu Oct 15 2020 Jaroslav Kysela - 1.2.4-2 +* Thu Oct 15 2020 Jaroslav Kysela - 1.2.4-3 - update to 1.2.4 - enable LTO From e21ce7bfabae3353ff2dce41cbf83c9bdd6b5889 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 19 Oct 2020 12:29:43 +0200 Subject: [PATCH 060/120] ucm Linked fix --- alsa-lib.spec | 6 +++--- sources | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index c77197c..6bbc6ac 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 3%{?prever_dot}%{?dist} +Release: 4%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -81,7 +81,7 @@ contains alsa-lib configuration of SoC topology # recommended. # Note: The v1.2.4 contains changes wich are compatible with gcc-10 LTO # although using the old ASM constructs. -# Disable LTO +# Enable custom LTO flags %define _lto_cflags -flto -ffat-lto-objects -flto-partition=none autoreconf -vif @@ -166,7 +166,7 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog -* Thu Oct 15 2020 Jaroslav Kysela - 1.2.4-3 +* Mon Oct 19 2020 Jaroslav Kysela - 1.2.4-4 - update to 1.2.4 - enable LTO diff --git a/sources b/sources index f5141cf..904929f 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (alsa-lib-1.2.4.tar.bz2) = 4de259c019ccc35fae4a34aee4df3ce7109a0d2f2cb21457ae569ad8d14099cc9eec8afc552309beb7bedd750e0ca27d2680161cfdd5d8ddc1a4e07ce62705ce +SHA512 (alsa-lib-1.2.4.tar.bz2) = 12086952dc8f16f1cb6946517858e17b1c3276aeda9ff5703a84bb38aa78eb4c4e9cb4485c5b3f21f174fdbd976b3bcbbc481e85cb2460652858490df51ae844 SHA512 (alsa-ucm-conf-1.2.4.tar.bz2) = 9043460e92b2ed44757b08b9faca888e8bfae40d84e4ad7e7df44df2bb3b0617e86ef23783973accd62fb6681788262e67212e2bf67178d75781e57a0fa346d2 SHA512 (alsa-topology-conf-1.2.4.tar.bz2) = e5b367a23f42ed2c2a83f3dd9df264b4e054f5ba7c4be98520418598f0b06a11627498a8a6ef943522b209951645f83bbbbfb32db7c9c8260aa5db08358970cb From 34ee42470808cb4643b3286be8fa759ca6f3081a Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Wed, 16 Dec 2020 23:24:31 +0000 Subject: [PATCH 061/120] Add BuildRequires: make https://fedoraproject.org/wiki/Changes/Remove_make_from_BuildRoot --- alsa-lib.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/alsa-lib.spec b/alsa-lib.spec index 6bbc6ac..132fc62 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -26,6 +26,7 @@ Patch2: alsa-lib-1.0.14-glibc-open.patch BuildRequires: doxygen BuildRequires: autoconf automake libtool +BuildRequires: make %description The Advanced Linux Sound Architecture (ALSA) provides audio and MIDI From ecd130e246e362ce43939219380a933d6632139f Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Tue, 26 Jan 2021 00:00:33 +0000 Subject: [PATCH 062/120] - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- alsa-lib.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 132fc62..6519280 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 4%{?prever_dot}%{?dist} +Release: 5%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Tue Jan 26 2021 Fedora Release Engineering - 1.2.4-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + * Mon Oct 19 2020 Jaroslav Kysela - 1.2.4-4 - update to 1.2.4 - enable LTO From 3a13c60e87854cf00a763ff4b6858e838946cd04 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 28 May 2021 13:39:51 +0200 Subject: [PATCH 063/120] update to 1.2.5 --- alsa-lib.spec | 11 +++++++---- sources | 6 +++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 6519280..4f6e636 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -2,14 +2,14 @@ #define prever_dot .rc3 #define postver a -%define version_alsa_lib 1.2.4 -%define version_alsa_ucm 1.2.4 -%define version_alsa_tplg 1.2.4 +%define version_alsa_lib 1.2.5 +%define version_alsa_ucm 1.2.5 +%define version_alsa_tplg 1.2.5 Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 5%{?prever_dot}%{?dist} +Release: 1%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Fri May 28 2021 Jaroslav Kysela - 1.2.5-1 +- update to 1.2.5 + * Tue Jan 26 2021 Fedora Release Engineering - 1.2.4-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild diff --git a/sources b/sources index 904929f..b10f9d4 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (alsa-lib-1.2.4.tar.bz2) = 12086952dc8f16f1cb6946517858e17b1c3276aeda9ff5703a84bb38aa78eb4c4e9cb4485c5b3f21f174fdbd976b3bcbbc481e85cb2460652858490df51ae844 -SHA512 (alsa-ucm-conf-1.2.4.tar.bz2) = 9043460e92b2ed44757b08b9faca888e8bfae40d84e4ad7e7df44df2bb3b0617e86ef23783973accd62fb6681788262e67212e2bf67178d75781e57a0fa346d2 -SHA512 (alsa-topology-conf-1.2.4.tar.bz2) = e5b367a23f42ed2c2a83f3dd9df264b4e054f5ba7c4be98520418598f0b06a11627498a8a6ef943522b209951645f83bbbbfb32db7c9c8260aa5db08358970cb +SHA512 (alsa-lib-1.2.5.tar.bz2) = d9b53484737a3684aac7e08b4b18400aac10fec1a78a8bf9101944bea2c50710bc7355e9bb0012541b067e2d5ee7b1b818bf1bdbffbb2b2d7ad0eb15efe49725 +SHA512 (alsa-topology-conf-1.2.5.tar.bz2) = 2eb4d8baf2dcbf0b631dd11dbf15bffc51694d9cc6931619e51787f3ba58d1a091d266e6721a3b737c040ec74a28270b93f39fb97f30a3227cf340dd646e5d51 +SHA512 (alsa-ucm-conf-1.2.5.tar.bz2) = f16e8f04018c65de5e24f2a3eb0b3edff26cbce78cc1820c42c46907c903913c571797b59e803ae36b8ec3136487d0a5aacd034e2a8df3e15ed998b7a70152b7 From 9e061ed2ff01958709fd483da5e64427acce84e2 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 2 Jun 2021 19:21:12 +0200 Subject: [PATCH 064/120] 1.2.5 fixes --- alsa-git.patch | 201 +++++++++++++++++++++++++++++++++++++++++++ alsa-lib.spec | 5 +- alsa-ucm-conf.patch | 204 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 409 insertions(+), 1 deletion(-) diff --git a/alsa-git.patch b/alsa-git.patch index e69de29..eb34f13 100644 --- a/alsa-git.patch +++ b/alsa-git.patch @@ -0,0 +1,201 @@ +From ddfc32abf5697de1618b9e7ffdf57a0f97013090 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 2 Jun 2021 08:49:32 +0200 +Subject: [PATCH 1/3] conf: fix load_for_all_cards() + +The 63f7745b commit is loading the driver specific configuration +multiple times which ends with the array merges (see the bug). + +Introduce the loaded compound which traces the already loaded +driver configurations and skip the multiple load requests. + +Fixes: https://github.com/alsa-project/alsa-lib/issues/143 +Fixes: 63f7745b ("conf: extend load_for_all_cards hook (id/value table)") +Signed-off-by: Jaroslav Kysela +--- + src/conf.c | 33 ++++++++++++++++++++++++++++----- + 1 file changed, 28 insertions(+), 5 deletions(-) + +diff --git a/src/conf.c b/src/conf.c +index f6c80031..d863dec6 100644 +--- a/src/conf.c ++++ b/src/conf.c +@@ -4325,18 +4325,23 @@ static int _snd_config_hook_table(snd_config_t *root, snd_config_t *config, snd_ + int snd_config_hook_load_for_all_cards(snd_config_t *root, snd_config_t *config, snd_config_t **dst, snd_config_t *private_data ATTRIBUTE_UNUSED) + { + int card = -1, err; ++ snd_config_t *loaded; // trace loaded cards + ++ err = snd_config_top(&loaded); ++ if (err < 0) ++ return err; + do { + err = snd_card_next(&card); + if (err < 0) +- return err; ++ goto __fin_err; + if (card >= 0) { +- snd_config_t *n, *private_data = NULL; ++ snd_config_t *n, *m, *private_data = NULL; + const char *driver; + char *fdriver = NULL; ++ bool load; + err = snd_determine_driver(card, &fdriver); + if (err < 0) +- return err; ++ goto __fin_err; + if (snd_config_search(root, fdriver, &n) >= 0) { + if (snd_config_get_string(n, &driver) < 0) { + if (snd_config_get_type(n) == SND_CONFIG_TYPE_COMPOUND) { +@@ -4357,6 +4362,19 @@ int snd_config_hook_load_for_all_cards(snd_config_t *root, snd_config_t *config, + driver = fdriver; + } + __std: ++ load = true; ++ err = snd_config_imake_integer(&m, driver, 1); ++ if (err < 0) ++ goto __err; ++ err = snd_config_add(loaded, m); ++ if (err < 0) { ++ if (err == -EEXIST) { ++ snd_config_delete(m); ++ load = false; ++ } else { ++ goto __err; ++ } ++ } + private_data = _snd_config_hook_private_data(card, driver); + if (!private_data) { + err = -ENOMEM; +@@ -4365,17 +4383,22 @@ int snd_config_hook_load_for_all_cards(snd_config_t *root, snd_config_t *config, + err = _snd_config_hook_table(root, config, private_data); + if (err < 0) + goto __err; +- err = snd_config_hook_load(root, config, &n, private_data); ++ if (load) ++ err = snd_config_hook_load(root, config, &n, private_data); + __err: + if (private_data) + snd_config_delete(private_data); + free(fdriver); + if (err < 0) +- return err; ++ goto __fin_err; + } + } while (card >= 0); ++ snd_config_delete(loaded); + *dst = NULL; + return 0; ++__fin_err: ++ snd_config_delete(loaded); ++ return err; + } + #ifndef DOC_HIDDEN + SND_DLSYM_BUILD_VERSION(snd_config_hook_load_for_all_cards, SND_CONFIG_DLSYM_VERSION_HOOK); +-- +2.30.2 + + +From 0e4ba2ea8c0402f12a645032a14693eb9b1278e6 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 2 Jun 2021 11:09:43 +0200 +Subject: [PATCH 2/3] ucm: add _alibpref to get the private device prefix + +It may be useful to get the device prefix for the local configuration. + +Link: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1251 +Signed-off-by: Jaroslav Kysela +--- + include/use-case.h | 1 + + src/ucm/main.c | 21 +++++++++++++++++++++ + 2 files changed, 22 insertions(+) + +diff --git a/include/use-case.h b/include/use-case.h +index ec1a97b0..7890358b 100644 +--- a/include/use-case.h ++++ b/include/use-case.h +@@ -258,6 +258,7 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, + * - _verb - return current verb + * - _file - return configuration file loaded for current card + * - _alibcfg - return private alsa-lib's configuration for current card ++ * - _alibpref - return private alsa-lib's configuration device prefix for current card + * + * - [=]{NAME}[/[{modifier}|{/device}][/{verb}]] + * - value identifier {NAME} +diff --git a/src/ucm/main.c b/src/ucm/main.c +index 361952f6..3c9ea15d 100644 +--- a/src/ucm/main.c ++++ b/src/ucm/main.c +@@ -2138,6 +2138,25 @@ static int get_alibcfg(snd_use_case_mgr_t *uc_mgr, char **str) + return 0; + } + ++/** ++ * \brief Get device prefix for private alsa-lib configuration ++ * \param uc_mgr Use case manager ++ * \param str Returned value string ++ * \return Zero on success (value is filled), otherwise a negative error code ++ */ ++static int get_alibpref(snd_use_case_mgr_t *uc_mgr, char **str) ++{ ++ const size_t l = 9; ++ char *s; ++ ++ s = malloc(l); ++ if (s == NULL) ++ return -ENOMEM; ++ snprintf(s, l, "_ucm%04X", uc_mgr->ucm_card_number); ++ *str = s; ++ return 0; ++} ++ + /** + * \brief Get current - string + * \param uc_mgr Use case manager +@@ -2193,6 +2212,8 @@ int snd_use_case_get(snd_use_case_mgr_t *uc_mgr, + + } else if (strcmp(identifier, "_alibcfg") == 0) { + err = get_alibcfg(uc_mgr, (char **)value); ++ } else if (strcmp(identifier, "_alibpref") == 0) { ++ err = get_alibpref(uc_mgr, (char **)value); + } else if (identifier[0] == '_') { + err = -ENOENT; + } else { +-- +2.30.2 + + +From 9621d0bff2e60b43e329ffa5059ab19f2914ec14 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 2 Jun 2021 11:21:54 +0200 +Subject: [PATCH 3/3] ucm: fix _alibpref string (add '.' delimiter to the end) + +Fixes: 0e4ba2ea ("ucm: add _alibpref to get the private device prefix") +Signed-off-by: Jaroslav Kysela +--- + src/ucm/main.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/ucm/main.c b/src/ucm/main.c +index 3c9ea15d..c9b37b68 100644 +--- a/src/ucm/main.c ++++ b/src/ucm/main.c +@@ -2146,13 +2146,13 @@ static int get_alibcfg(snd_use_case_mgr_t *uc_mgr, char **str) + */ + static int get_alibpref(snd_use_case_mgr_t *uc_mgr, char **str) + { +- const size_t l = 9; ++ const size_t l = 10; + char *s; + + s = malloc(l); + if (s == NULL) + return -ENOMEM; +- snprintf(s, l, "_ucm%04X", uc_mgr->ucm_card_number); ++ snprintf(s, l, "_ucm%04X.", uc_mgr->ucm_card_number); + *str = s; + return 0; + } +-- +2.30.2 + diff --git a/alsa-lib.spec b/alsa-lib.spec index 4f6e636..619a415 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 1%{?prever_dot}%{?dist} +Release: 2%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Wed Jun 2 2021 Jaroslav Kysela - 1.2.5-2 +- add upstream fixes (conf + ucm) + * Fri May 28 2021 Jaroslav Kysela - 1.2.5-1 - update to 1.2.5 diff --git a/alsa-ucm-conf.patch b/alsa-ucm-conf.patch index e69de29..089c3ee 100644 --- a/alsa-ucm-conf.patch +++ b/alsa-ucm-conf.patch @@ -0,0 +1,204 @@ +From 3bfe5eeb03c3e9fabb9cd8f5b83818c4cfcb74a7 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 31 May 2021 13:26:14 +0200 +Subject: [PATCH 1/4] tegra: shuffle Acer Iconia Tab A500 files + +BugLink: https://github.com/alsa-project/alsa-ucm-conf/pull/94 +Signed-off-by: Jaroslav Kysela +--- + ...r Iconia Tab A500 WM8903.conf => Acer-A500-HiFi.conf} | 0 + ucm2/Tegra/wm8903/Acer-A500.conf | 8 ++++++++ + ucm2/conf.d/tegra/Acer Iconia Tab A500 WM8903.conf | 9 +-------- + 3 files changed, 9 insertions(+), 8 deletions(-) + rename ucm2/Tegra/wm8903/{Acer Iconia Tab A500 WM8903.conf => Acer-A500-HiFi.conf} (100%) + create mode 100644 ucm2/Tegra/wm8903/Acer-A500.conf + mode change 100644 => 120000 ucm2/conf.d/tegra/Acer Iconia Tab A500 WM8903.conf + +diff --git a/ucm2/Tegra/wm8903/Acer Iconia Tab A500 WM8903.conf b/ucm2/Tegra/wm8903/Acer-A500-HiFi.conf +similarity index 100% +rename from ucm2/Tegra/wm8903/Acer Iconia Tab A500 WM8903.conf +rename to ucm2/Tegra/wm8903/Acer-A500-HiFi.conf +diff --git a/ucm2/Tegra/wm8903/Acer-A500.conf b/ucm2/Tegra/wm8903/Acer-A500.conf +new file mode 100644 +index 0000000..e9bd6c4 +--- /dev/null ++++ b/ucm2/Tegra/wm8903/Acer-A500.conf +@@ -0,0 +1,8 @@ ++# Use case Configuration for Acer Iconia Tab A500 ++ ++Syntax 4 ++ ++SectionUseCase."HiFi" { ++ File "/Tegra/wm8903/Acer-A500-HiFi.conf" ++ Comment "Play HiFi quality Music" ++} +diff --git a/ucm2/conf.d/tegra/Acer Iconia Tab A500 WM8903.conf b/ucm2/conf.d/tegra/Acer Iconia Tab A500 WM8903.conf +deleted file mode 100644 +index 1489344..0000000 +--- a/ucm2/conf.d/tegra/Acer Iconia Tab A500 WM8903.conf ++++ /dev/null +@@ -1,8 +0,0 @@ +-# Use case Configuration for Acer Iconia Tab A500 +- +-Syntax 4 +- +-SectionUseCase."HiFi" { +- File "/Tegra/wm8903/Acer Iconia Tab A500 WM8903.conf" +- Comment "Play HiFi quality Music" +-} +diff --git a/ucm2/conf.d/tegra/Acer Iconia Tab A500 WM8903.conf b/ucm2/conf.d/tegra/Acer Iconia Tab A500 WM8903.conf +new file mode 120000 +index 0000000..d000c29 +--- /dev/null ++++ b/ucm2/conf.d/tegra/Acer Iconia Tab A500 WM8903.conf +@@ -0,0 +1 @@ ++../../Tegra/wm8903/Acer-A500.conf +\ No newline at end of file +-- +2.30.2 + + +From 4136b2276e5663a60374d0e2adca54f6861dbafe Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 31 May 2021 13:31:54 +0200 +Subject: [PATCH 2/4] tegra: shuffle ASUS Google Nexus 7 files + +BugLink: https://github.com/alsa-project/alsa-ucm-conf/pull/94 +Signed-off-by: Jaroslav Kysela +--- + ...gle Nexus 7 ALC5642.conf => Google-Nexus-7-HiFi.conf} | 0 + ucm2/Tegra/rt5640/Google-Nexus-7.conf | 8 ++++++++ + ucm2/conf.d/tegra/ASUS Google Nexus 7 ALC5642.conf | 9 +-------- + 3 files changed, 9 insertions(+), 8 deletions(-) + rename ucm2/Tegra/rt5640/{ASUS Google Nexus 7 ALC5642.conf => Google-Nexus-7-HiFi.conf} (100%) + create mode 100644 ucm2/Tegra/rt5640/Google-Nexus-7.conf + mode change 100644 => 120000 ucm2/conf.d/tegra/ASUS Google Nexus 7 ALC5642.conf + +diff --git a/ucm2/Tegra/rt5640/ASUS Google Nexus 7 ALC5642.conf b/ucm2/Tegra/rt5640/Google-Nexus-7-HiFi.conf +similarity index 100% +rename from ucm2/Tegra/rt5640/ASUS Google Nexus 7 ALC5642.conf +rename to ucm2/Tegra/rt5640/Google-Nexus-7-HiFi.conf +diff --git a/ucm2/Tegra/rt5640/Google-Nexus-7.conf b/ucm2/Tegra/rt5640/Google-Nexus-7.conf +new file mode 100644 +index 0000000..1ec7b92 +--- /dev/null ++++ b/ucm2/Tegra/rt5640/Google-Nexus-7.conf +@@ -0,0 +1,8 @@ ++# Use case Configuration for ASUS Google Nexus 7 (2012) ++ ++Syntax 4 ++ ++SectionUseCase."HiFi" { ++ File "/Tegra/rt5640/Google-Nexus-7-HiFi.conf" ++ Comment "Play HiFi quality Music" ++} +diff --git a/ucm2/conf.d/tegra/ASUS Google Nexus 7 ALC5642.conf b/ucm2/conf.d/tegra/ASUS Google Nexus 7 ALC5642.conf +deleted file mode 100644 +index 1a0978c..0000000 +--- a/ucm2/conf.d/tegra/ASUS Google Nexus 7 ALC5642.conf ++++ /dev/null +@@ -1,8 +0,0 @@ +-# Use case Configuration for ASUS Google Nexus 7 (2012) +- +-Syntax 4 +- +-SectionUseCase."HiFi" { +- File "/Tegra/rt5640/ASUS Google Nexus 7 ALC5642.conf" +- Comment "Play HiFi quality Music" +-} +diff --git a/ucm2/conf.d/tegra/ASUS Google Nexus 7 ALC5642.conf b/ucm2/conf.d/tegra/ASUS Google Nexus 7 ALC5642.conf +new file mode 120000 +index 0000000..e598c9c +--- /dev/null ++++ b/ucm2/conf.d/tegra/ASUS Google Nexus 7 ALC5642.conf +@@ -0,0 +1 @@ ++../../Tegra/rt5640/Google-Nexus-7.conf +\ No newline at end of file +-- +2.30.2 + + +From 3f34021beffba4e39f064a14c5faceeaa224b766 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 1 Jun 2021 21:08:53 +0200 +Subject: [PATCH 3/4] HDA-Intel: the lookups are supported from syntax 4 + +Signed-off-by: Jaroslav Kysela +--- + ucm2/HDA-Intel/HDA-Intel.conf | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ucm2/HDA-Intel/HDA-Intel.conf b/ucm2/HDA-Intel/HDA-Intel.conf +index 5794e72..8a8e0e7 100644 +--- a/ucm2/HDA-Intel/HDA-Intel.conf ++++ b/ucm2/HDA-Intel/HDA-Intel.conf +@@ -1,4 +1,4 @@ +-Syntax 3 ++Syntax 4 + + Define.Use "" # a non-empty string to use UCM configuration for HDA devices + +-- +2.30.2 + + +From a4cd64da90d01dc801b1887a7f835420512d0f17 Mon Sep 17 00:00:00 2001 +From: Svyatoslav Ryhel +Date: Mon, 31 May 2021 11:27:36 +0300 +Subject: [PATCH 4/4] tegra: Add UCM for Nvidia Tegra HDMI Audio + +Fixes: https://github.com/alsa-project/alsa-ucm-conf/pull/94 +Signed-off-by: Svyatoslav Ryhel +Signed-off-by: Jaroslav Kysela +--- + ucm2/Tegra/tegra-hda/tegra-hda-HiFi.conf | 12 ++++++++++++ + ucm2/Tegra/tegra-hda/tegra-hda.conf | 8 ++++++++ + ucm2/conf.d/tegra-hda/tegra-hda.conf | 1 + + 3 files changed, 21 insertions(+) + create mode 100644 ucm2/Tegra/tegra-hda/tegra-hda-HiFi.conf + create mode 100644 ucm2/Tegra/tegra-hda/tegra-hda.conf + create mode 120000 ucm2/conf.d/tegra-hda/tegra-hda.conf + +diff --git a/ucm2/Tegra/tegra-hda/tegra-hda-HiFi.conf b/ucm2/Tegra/tegra-hda/tegra-hda-HiFi.conf +new file mode 100644 +index 0000000..859c34f +--- /dev/null ++++ b/ucm2/Tegra/tegra-hda/tegra-hda-HiFi.conf +@@ -0,0 +1,12 @@ ++If.hdmi { ++ Condition { Type String Empty "" } ++ True { ++ Define { ++ HdmiNum 1 ++ HdmiPCM 3 ++ HdmiCtlIndex 0 ++ HdmiPrio 1100 ++ } ++ Include.hdmi.File "/codecs/hda/hdmi.conf" ++ } ++} +diff --git a/ucm2/Tegra/tegra-hda/tegra-hda.conf b/ucm2/Tegra/tegra-hda/tegra-hda.conf +new file mode 100644 +index 0000000..410d973 +--- /dev/null ++++ b/ucm2/Tegra/tegra-hda/tegra-hda.conf +@@ -0,0 +1,8 @@ ++# UCM for Nvidia Tegra30 HDMI Audio ++ ++Syntax 4 ++ ++SectionUseCase."HiFi" { ++ File "/Tegra/tegra-hda/tegra-hda-HiFi.conf" ++ Comment "Play HiFi quality Music" ++} +diff --git a/ucm2/conf.d/tegra-hda/tegra-hda.conf b/ucm2/conf.d/tegra-hda/tegra-hda.conf +new file mode 120000 +index 0000000..0b4867c +--- /dev/null ++++ b/ucm2/conf.d/tegra-hda/tegra-hda.conf +@@ -0,0 +1 @@ ++../../Tegra/tegra-hda/tegra-hda.conf +\ No newline at end of file +-- +2.30.2 + From c9814e5a0fe6669ee6c17f126b5ae839e0e06076 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 2 Jun 2021 19:45:34 +0200 Subject: [PATCH 065/120] remove tegra configs from ucm patch --- alsa-ucm-conf.patch | 190 -------------------------------------------- 1 file changed, 190 deletions(-) diff --git a/alsa-ucm-conf.patch b/alsa-ucm-conf.patch index 089c3ee..dedf95f 100644 --- a/alsa-ucm-conf.patch +++ b/alsa-ucm-conf.patch @@ -1,133 +1,3 @@ -From 3bfe5eeb03c3e9fabb9cd8f5b83818c4cfcb74a7 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Mon, 31 May 2021 13:26:14 +0200 -Subject: [PATCH 1/4] tegra: shuffle Acer Iconia Tab A500 files - -BugLink: https://github.com/alsa-project/alsa-ucm-conf/pull/94 -Signed-off-by: Jaroslav Kysela ---- - ...r Iconia Tab A500 WM8903.conf => Acer-A500-HiFi.conf} | 0 - ucm2/Tegra/wm8903/Acer-A500.conf | 8 ++++++++ - ucm2/conf.d/tegra/Acer Iconia Tab A500 WM8903.conf | 9 +-------- - 3 files changed, 9 insertions(+), 8 deletions(-) - rename ucm2/Tegra/wm8903/{Acer Iconia Tab A500 WM8903.conf => Acer-A500-HiFi.conf} (100%) - create mode 100644 ucm2/Tegra/wm8903/Acer-A500.conf - mode change 100644 => 120000 ucm2/conf.d/tegra/Acer Iconia Tab A500 WM8903.conf - -diff --git a/ucm2/Tegra/wm8903/Acer Iconia Tab A500 WM8903.conf b/ucm2/Tegra/wm8903/Acer-A500-HiFi.conf -similarity index 100% -rename from ucm2/Tegra/wm8903/Acer Iconia Tab A500 WM8903.conf -rename to ucm2/Tegra/wm8903/Acer-A500-HiFi.conf -diff --git a/ucm2/Tegra/wm8903/Acer-A500.conf b/ucm2/Tegra/wm8903/Acer-A500.conf -new file mode 100644 -index 0000000..e9bd6c4 ---- /dev/null -+++ b/ucm2/Tegra/wm8903/Acer-A500.conf -@@ -0,0 +1,8 @@ -+# Use case Configuration for Acer Iconia Tab A500 -+ -+Syntax 4 -+ -+SectionUseCase."HiFi" { -+ File "/Tegra/wm8903/Acer-A500-HiFi.conf" -+ Comment "Play HiFi quality Music" -+} -diff --git a/ucm2/conf.d/tegra/Acer Iconia Tab A500 WM8903.conf b/ucm2/conf.d/tegra/Acer Iconia Tab A500 WM8903.conf -deleted file mode 100644 -index 1489344..0000000 ---- a/ucm2/conf.d/tegra/Acer Iconia Tab A500 WM8903.conf -+++ /dev/null -@@ -1,8 +0,0 @@ --# Use case Configuration for Acer Iconia Tab A500 -- --Syntax 4 -- --SectionUseCase."HiFi" { -- File "/Tegra/wm8903/Acer Iconia Tab A500 WM8903.conf" -- Comment "Play HiFi quality Music" --} -diff --git a/ucm2/conf.d/tegra/Acer Iconia Tab A500 WM8903.conf b/ucm2/conf.d/tegra/Acer Iconia Tab A500 WM8903.conf -new file mode 120000 -index 0000000..d000c29 ---- /dev/null -+++ b/ucm2/conf.d/tegra/Acer Iconia Tab A500 WM8903.conf -@@ -0,0 +1 @@ -+../../Tegra/wm8903/Acer-A500.conf -\ No newline at end of file --- -2.30.2 - - -From 4136b2276e5663a60374d0e2adca54f6861dbafe Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Mon, 31 May 2021 13:31:54 +0200 -Subject: [PATCH 2/4] tegra: shuffle ASUS Google Nexus 7 files - -BugLink: https://github.com/alsa-project/alsa-ucm-conf/pull/94 -Signed-off-by: Jaroslav Kysela ---- - ...gle Nexus 7 ALC5642.conf => Google-Nexus-7-HiFi.conf} | 0 - ucm2/Tegra/rt5640/Google-Nexus-7.conf | 8 ++++++++ - ucm2/conf.d/tegra/ASUS Google Nexus 7 ALC5642.conf | 9 +-------- - 3 files changed, 9 insertions(+), 8 deletions(-) - rename ucm2/Tegra/rt5640/{ASUS Google Nexus 7 ALC5642.conf => Google-Nexus-7-HiFi.conf} (100%) - create mode 100644 ucm2/Tegra/rt5640/Google-Nexus-7.conf - mode change 100644 => 120000 ucm2/conf.d/tegra/ASUS Google Nexus 7 ALC5642.conf - -diff --git a/ucm2/Tegra/rt5640/ASUS Google Nexus 7 ALC5642.conf b/ucm2/Tegra/rt5640/Google-Nexus-7-HiFi.conf -similarity index 100% -rename from ucm2/Tegra/rt5640/ASUS Google Nexus 7 ALC5642.conf -rename to ucm2/Tegra/rt5640/Google-Nexus-7-HiFi.conf -diff --git a/ucm2/Tegra/rt5640/Google-Nexus-7.conf b/ucm2/Tegra/rt5640/Google-Nexus-7.conf -new file mode 100644 -index 0000000..1ec7b92 ---- /dev/null -+++ b/ucm2/Tegra/rt5640/Google-Nexus-7.conf -@@ -0,0 +1,8 @@ -+# Use case Configuration for ASUS Google Nexus 7 (2012) -+ -+Syntax 4 -+ -+SectionUseCase."HiFi" { -+ File "/Tegra/rt5640/Google-Nexus-7-HiFi.conf" -+ Comment "Play HiFi quality Music" -+} -diff --git a/ucm2/conf.d/tegra/ASUS Google Nexus 7 ALC5642.conf b/ucm2/conf.d/tegra/ASUS Google Nexus 7 ALC5642.conf -deleted file mode 100644 -index 1a0978c..0000000 ---- a/ucm2/conf.d/tegra/ASUS Google Nexus 7 ALC5642.conf -+++ /dev/null -@@ -1,8 +0,0 @@ --# Use case Configuration for ASUS Google Nexus 7 (2012) -- --Syntax 4 -- --SectionUseCase."HiFi" { -- File "/Tegra/rt5640/ASUS Google Nexus 7 ALC5642.conf" -- Comment "Play HiFi quality Music" --} -diff --git a/ucm2/conf.d/tegra/ASUS Google Nexus 7 ALC5642.conf b/ucm2/conf.d/tegra/ASUS Google Nexus 7 ALC5642.conf -new file mode 120000 -index 0000000..e598c9c ---- /dev/null -+++ b/ucm2/conf.d/tegra/ASUS Google Nexus 7 ALC5642.conf -@@ -0,0 +1 @@ -+../../Tegra/rt5640/Google-Nexus-7.conf -\ No newline at end of file --- -2.30.2 - - -From 3f34021beffba4e39f064a14c5faceeaa224b766 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 1 Jun 2021 21:08:53 +0200 -Subject: [PATCH 3/4] HDA-Intel: the lookups are supported from syntax 4 - -Signed-off-by: Jaroslav Kysela ---- - ucm2/HDA-Intel/HDA-Intel.conf | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - diff --git a/ucm2/HDA-Intel/HDA-Intel.conf b/ucm2/HDA-Intel/HDA-Intel.conf index 5794e72..8a8e0e7 100644 --- a/ucm2/HDA-Intel/HDA-Intel.conf @@ -142,63 +12,3 @@ index 5794e72..8a8e0e7 100644 2.30.2 -From a4cd64da90d01dc801b1887a7f835420512d0f17 Mon Sep 17 00:00:00 2001 -From: Svyatoslav Ryhel -Date: Mon, 31 May 2021 11:27:36 +0300 -Subject: [PATCH 4/4] tegra: Add UCM for Nvidia Tegra HDMI Audio - -Fixes: https://github.com/alsa-project/alsa-ucm-conf/pull/94 -Signed-off-by: Svyatoslav Ryhel -Signed-off-by: Jaroslav Kysela ---- - ucm2/Tegra/tegra-hda/tegra-hda-HiFi.conf | 12 ++++++++++++ - ucm2/Tegra/tegra-hda/tegra-hda.conf | 8 ++++++++ - ucm2/conf.d/tegra-hda/tegra-hda.conf | 1 + - 3 files changed, 21 insertions(+) - create mode 100644 ucm2/Tegra/tegra-hda/tegra-hda-HiFi.conf - create mode 100644 ucm2/Tegra/tegra-hda/tegra-hda.conf - create mode 120000 ucm2/conf.d/tegra-hda/tegra-hda.conf - -diff --git a/ucm2/Tegra/tegra-hda/tegra-hda-HiFi.conf b/ucm2/Tegra/tegra-hda/tegra-hda-HiFi.conf -new file mode 100644 -index 0000000..859c34f ---- /dev/null -+++ b/ucm2/Tegra/tegra-hda/tegra-hda-HiFi.conf -@@ -0,0 +1,12 @@ -+If.hdmi { -+ Condition { Type String Empty "" } -+ True { -+ Define { -+ HdmiNum 1 -+ HdmiPCM 3 -+ HdmiCtlIndex 0 -+ HdmiPrio 1100 -+ } -+ Include.hdmi.File "/codecs/hda/hdmi.conf" -+ } -+} -diff --git a/ucm2/Tegra/tegra-hda/tegra-hda.conf b/ucm2/Tegra/tegra-hda/tegra-hda.conf -new file mode 100644 -index 0000000..410d973 ---- /dev/null -+++ b/ucm2/Tegra/tegra-hda/tegra-hda.conf -@@ -0,0 +1,8 @@ -+# UCM for Nvidia Tegra30 HDMI Audio -+ -+Syntax 4 -+ -+SectionUseCase."HiFi" { -+ File "/Tegra/tegra-hda/tegra-hda-HiFi.conf" -+ Comment "Play HiFi quality Music" -+} -diff --git a/ucm2/conf.d/tegra-hda/tegra-hda.conf b/ucm2/conf.d/tegra-hda/tegra-hda.conf -new file mode 120000 -index 0000000..0b4867c ---- /dev/null -+++ b/ucm2/conf.d/tegra-hda/tegra-hda.conf -@@ -0,0 +1 @@ -+../../Tegra/tegra-hda/tegra-hda.conf -\ No newline at end of file --- -2.30.2 - From 7eb4b5980766740378580461abef17cba5a6f5f3 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 2 Jun 2021 20:02:15 +0200 Subject: [PATCH 066/120] add coverity fixes --- alsa-git.patch | 533 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 530 insertions(+), 3 deletions(-) diff --git a/alsa-git.patch b/alsa-git.patch index eb34f13..b42c2d2 100644 --- a/alsa-git.patch +++ b/alsa-git.patch @@ -1,7 +1,7 @@ From ddfc32abf5697de1618b9e7ffdf57a0f97013090 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 2 Jun 2021 08:49:32 +0200 -Subject: [PATCH 1/3] conf: fix load_for_all_cards() +Subject: [PATCH 01/18] conf: fix load_for_all_cards() The 63f7745b commit is loading the driver specific configuration multiple times which ends with the array merges (see the bug). @@ -99,7 +99,7 @@ index f6c80031..d863dec6 100644 From 0e4ba2ea8c0402f12a645032a14693eb9b1278e6 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 2 Jun 2021 11:09:43 +0200 -Subject: [PATCH 2/3] ucm: add _alibpref to get the private device prefix +Subject: [PATCH 02/18] ucm: add _alibpref to get the private device prefix It may be useful to get the device prefix for the local configuration. @@ -168,7 +168,8 @@ index 361952f6..3c9ea15d 100644 From 9621d0bff2e60b43e329ffa5059ab19f2914ec14 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 2 Jun 2021 11:21:54 +0200 -Subject: [PATCH 3/3] ucm: fix _alibpref string (add '.' delimiter to the end) +Subject: [PATCH 03/18] ucm: fix _alibpref string (add '.' delimiter to the + end) Fixes: 0e4ba2ea ("ucm: add _alibpref to get the private device prefix") Signed-off-by: Jaroslav Kysela @@ -199,3 +200,529 @@ index 3c9ea15d..c9b37b68 100644 -- 2.30.2 + +From 2a1dafdbe5932260aeb4db359ce5d630b8106889 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 2 Jun 2021 19:26:47 +0200 +Subject: [PATCH 04/18] conf: remove dead code in snd_config_get_card() + +Signed-off-by: Jaroslav Kysela +--- + src/confmisc.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/confmisc.c b/src/confmisc.c +index 3663d164..a561040c 100644 +--- a/src/confmisc.c ++++ b/src/confmisc.c +@@ -154,10 +154,10 @@ int snd_config_get_card(const snd_config_t *conf) + long v; + int err; + +- if ((err = snd_config_get_integer(conf, &v)) < 0) { ++ if (snd_config_get_integer(conf, &v) < 0) { + if ((err = snd_config_get_string(conf, &str)) < 0) { +- snd_config_get_id(conf, &id); +- SNDERR("Invalid field %s", id); ++ if (snd_config_get_id(conf, &id) >= 0) ++ SNDERR("Invalid field %s", id); + return -EINVAL; + } + err = snd_card_get_index(str); +-- +2.30.2 + + +From 013ec607db9de11b682f2b85d843be062ca0d046 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 2 Jun 2021 19:28:32 +0200 +Subject: [PATCH 05/18] control: remap - fix uninitialized value in + parse_map_vindex() + +Signed-off-by: Jaroslav Kysela +--- + src/control/control_remap.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/control/control_remap.c b/src/control/control_remap.c +index f3d65010..17c6558a 100644 +--- a/src/control/control_remap.c ++++ b/src/control/control_remap.c +@@ -1040,7 +1040,7 @@ static int parse_map_vindex(struct snd_ctl_map_ctl *mctl, snd_config_t *conf) + + snd_config_for_each(i, next, conf) { + snd_config_t *n = snd_config_iterator_entry(i); +- long idx, chn; ++ long idx = -1, chn = -1; + const char *id; + if (snd_config_get_id(n, &id) < 0) + continue; +-- +2.30.2 + + +From 2fee6af9b6e157475159d284af8de1e879bb7a36 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 2 Jun 2021 19:35:44 +0200 +Subject: [PATCH 06/18] pcm: direct - fix pcmp error path in + _snd_pcm_direct_new() + +Signed-off-by: Jaroslav Kysela +--- + src/pcm/pcm_direct.c | 21 ++++++++++++--------- + 1 file changed, 12 insertions(+), 9 deletions(-) + +diff --git a/src/pcm/pcm_direct.c b/src/pcm/pcm_direct.c +index 0e5e0421..361805bd 100644 +--- a/src/pcm/pcm_direct.c ++++ b/src/pcm/pcm_direct.c +@@ -2126,24 +2126,20 @@ int _snd_pcm_direct_new(snd_pcm_t **pcmp, snd_pcm_direct_t **_dmix, int type, + dmix->type = type; + + ret = snd_pcm_new(pcmp, type, name, stream, mode); +- if (ret < 0) { +-_err_nosem: +- free(dmix->bindings); +- free(dmix); +- return ret; +- } ++ if (ret < 0) ++ goto _err_nosem; + + while (1) { + ret = snd_pcm_direct_semaphore_create_or_connect(dmix); + if (ret < 0) { + SNDERR("unable to create IPC semaphore"); +- goto _err_nosem; ++ goto _err_nosem_free; + } + ret = snd_pcm_direct_semaphore_down(dmix, DIRECT_IPC_SEM_CLIENT); + if (ret < 0) { + snd_pcm_direct_semaphore_discard(dmix); + if (--fail_sem_loop <= 0) +- goto _err_nosem; ++ goto _err_nosem_free; + continue; + } + break; +@@ -2153,10 +2149,17 @@ _err_nosem: + if (ret < 0) { + SNDERR("unable to create IPC shm instance"); + snd_pcm_direct_semaphore_up(dmix, DIRECT_IPC_SEM_CLIENT); +- goto _err_nosem; ++ goto _err_nosem_free; + } else { + *_dmix = dmix; + } + ++ return ret; ++_err_nosem_free: ++ snd_pcm_free(*pcmp); ++ *pcmp = NULL; ++_err_nosem: ++ free(dmix->bindings); ++ free(dmix); + return ret; + } +-- +2.30.2 + + +From eb95cad4e22a0bf2577f1fa4a3f6fd18caed3362 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 2 Jun 2021 19:37:53 +0200 +Subject: [PATCH 07/18] pcm: remove extra NULL checks in snd_pcm_dmix_open() + +Signed-off-by: Jaroslav Kysela +--- + src/pcm/pcm_dmix.c | 11 ++++------- + 1 file changed, 4 insertions(+), 7 deletions(-) + +diff --git a/src/pcm/pcm_dmix.c b/src/pcm/pcm_dmix.c +index 8747450f..608593f1 100644 +--- a/src/pcm/pcm_dmix.c ++++ b/src/pcm/pcm_dmix.c +@@ -998,7 +998,7 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name, + snd_config_t *root, snd_config_t *sconf, + snd_pcm_stream_t stream, int mode) + { +- snd_pcm_t *pcm = NULL, *spcm = NULL; ++ snd_pcm_t *pcm, *spcm = NULL; + snd_pcm_direct_t *dmix; + int ret, first_instance; + +@@ -1154,12 +1154,9 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name, + } else + snd_pcm_direct_semaphore_up(dmix, DIRECT_IPC_SEM_CLIENT); + _err_nosem: +- if (dmix) { +- free(dmix->bindings); +- free(dmix); +- } +- if (pcm) +- snd_pcm_free(pcm); ++ free(dmix->bindings); ++ free(dmix); ++ snd_pcm_free(pcm); + return ret; + } + +-- +2.30.2 + + +From 01a45aec6fcd5a5378a5b5e0ae0f9dacde2068e4 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 2 Jun 2021 19:39:32 +0200 +Subject: [PATCH 08/18] pcm: remove extra NULL checks in snd_pcm_dsnoop_open() + +Signed-off-by: Jaroslav Kysela +--- + src/pcm/pcm_dsnoop.c | 13 +++++-------- + 1 file changed, 5 insertions(+), 8 deletions(-) + +diff --git a/src/pcm/pcm_dsnoop.c b/src/pcm/pcm_dsnoop.c +index fb1b02c2..2c3b9f43 100644 +--- a/src/pcm/pcm_dsnoop.c ++++ b/src/pcm/pcm_dsnoop.c +@@ -564,8 +564,8 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name, + snd_config_t *root, snd_config_t *sconf, + snd_pcm_stream_t stream, int mode) + { +- snd_pcm_t *pcm = NULL, *spcm = NULL; +- snd_pcm_direct_t *dsnoop = NULL; ++ snd_pcm_t *pcm, *spcm = NULL; ++ snd_pcm_direct_t *dsnoop; + int ret, first_instance; + + assert(pcmp); +@@ -708,12 +708,9 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name, + snd_pcm_direct_semaphore_up(dsnoop, DIRECT_IPC_SEM_CLIENT); + + _err_nosem: +- if (dsnoop) { +- free(dsnoop->bindings); +- free(dsnoop); +- } +- if (pcm) +- snd_pcm_free(pcm); ++ free(dsnoop->bindings); ++ free(dsnoop); ++ snd_pcm_free(pcm); + return ret; + } + +-- +2.30.2 + + +From 74c6382df6cf18b801659d8c5c53407a7ea1f02b Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 2 Jun 2021 19:46:46 +0200 +Subject: [PATCH 09/18] pcm: remove extra NULL checks in snd_pcm_dshare_open() + +Signed-off-by: Jaroslav Kysela +--- + src/pcm/pcm_dshare.c | 13 +++++-------- + 1 file changed, 5 insertions(+), 8 deletions(-) + +diff --git a/src/pcm/pcm_dshare.c b/src/pcm/pcm_dshare.c +index 0f5238a6..a918512b 100644 +--- a/src/pcm/pcm_dshare.c ++++ b/src/pcm/pcm_dshare.c +@@ -690,8 +690,8 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name, + snd_config_t *root, snd_config_t *sconf, + snd_pcm_stream_t stream, int mode) + { +- snd_pcm_t *pcm = NULL, *spcm = NULL; +- snd_pcm_direct_t *dshare = NULL; ++ snd_pcm_t *pcm, *spcm = NULL; ++ snd_pcm_direct_t *dshare; + int ret, first_instance; + unsigned int chn; + +@@ -851,12 +851,9 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name, + } else + snd_pcm_direct_semaphore_up(dshare, DIRECT_IPC_SEM_CLIENT); + _err_nosem: +- if (dshare) { +- free(dshare->bindings); +- free(dshare); +- } +- if (pcm) +- snd_pcm_free(pcm); ++ free(dshare->bindings); ++ free(dshare); ++ snd_pcm_free(pcm); + return ret; + } + +-- +2.30.2 + + +From eabadf545c51d4c88c5f359db73726ec3ac653ba Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 2 Jun 2021 19:49:29 +0200 +Subject: [PATCH 10/18] pcm: softvol - fix early exit in add_tlv_info() + +Signed-off-by: Jaroslav Kysela +--- + src/pcm/pcm_softvol.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/pcm/pcm_softvol.c b/src/pcm/pcm_softvol.c +index e2bdd31a..eea322ca 100644 +--- a/src/pcm/pcm_softvol.c ++++ b/src/pcm/pcm_softvol.c +@@ -711,13 +711,13 @@ static int add_tlv_info(snd_pcm_softvol_t *svol, snd_ctl_elem_info_t *cinfo, + unsigned int *old_tlv, size_t old_tlv_size) + { + unsigned int tlv[4]; +- if (sizeof(tlv) <= old_tlv_size && memcmp(tlv, old_tlv, sizeof(tlv)) == 0) +- return 0; + tlv[SNDRV_CTL_TLVO_TYPE] = SND_CTL_TLVT_DB_SCALE; + tlv[SNDRV_CTL_TLVO_LEN] = 2 * sizeof(int); + tlv[SNDRV_CTL_TLVO_DB_SCALE_MIN] = (int)(svol->min_dB * 100); + tlv[SNDRV_CTL_TLVO_DB_SCALE_MUTE_AND_STEP] = + (int)((svol->max_dB - svol->min_dB) * 100 / svol->max_val); ++ if (sizeof(tlv) <= old_tlv_size && memcmp(tlv, old_tlv, sizeof(tlv)) == 0) ++ return 0; + return snd_ctl_elem_tlv_write(svol->ctl, &cinfo->id, tlv); + } + +-- +2.30.2 + + +From cf3846d46053b23006e6a9042b586fc78e81af55 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 2 Jun 2021 19:50:17 +0200 +Subject: [PATCH 11/18] timer: remove dead code in _snd_timer_hw_open() + +--- + src/timer/timer_hw.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/src/timer/timer_hw.c b/src/timer/timer_hw.c +index cfb77463..fe4e40bb 100644 +--- a/src/timer/timer_hw.c ++++ b/src/timer/timer_hw.c +@@ -330,8 +330,6 @@ int _snd_timer_hw_open(snd_timer_t **timer, char *name, + SNDERR("Unexpected field %s", id); + return -EINVAL; + } +- if (card < 0) +- return -EINVAL; + return snd_timer_hw_open(timer, name, dev_class, dev_sclass, card, device, subdevice, mode); + } + SND_DLSYM_BUILD_VERSION(_snd_timer_hw_open, SND_TIMER_DLSYM_VERSION); +-- +2.30.2 + + +From 200d18cda7a700607c21ad5dc9faaea2a1e27dbd Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 2 Jun 2021 19:51:13 +0200 +Subject: [PATCH 12/18] ucm: fix error path in execute_cfgsave() + +Signed-off-by: Jaroslav Kysela +--- + src/ucm/main.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/ucm/main.c b/src/ucm/main.c +index c9b37b68..42fdaa1d 100644 +--- a/src/ucm/main.c ++++ b/src/ucm/main.c +@@ -605,8 +605,10 @@ static int execute_cfgsave(snd_use_case_mgr_t *uc_mgr, const char *filename) + uc_error("unable to open file '%s': %s", file, snd_strerror(err)); + goto _err; + } +- if (!config || snd_config_is_empty(config)) ++ if (!config || snd_config_is_empty(config)) { ++ snd_output_close(out); + goto _err; ++ } + if (with_root) { + snd_output_printf(out, "%s ", root); + err = _snd_config_save_node_value(config, out, 0); +-- +2.30.2 + + +From 9b71d53bde21c8bb0d900c17863664e12753d844 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 2 Jun 2021 19:52:12 +0200 +Subject: [PATCH 13/18] ucm: fix use after free in if_eval_regex_match() + +Signed-off-by: Jaroslav Kysela +--- + src/ucm/ucm_cond.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/ucm/ucm_cond.c b/src/ucm/ucm_cond.c +index 59d1a155..adb0ecd9 100644 +--- a/src/ucm/ucm_cond.c ++++ b/src/ucm/ucm_cond.c +@@ -160,11 +160,12 @@ static int if_eval_regex_match(snd_use_case_mgr_t *uc_mgr, snd_config_t *eval) + if (err < 0) + return err; + err = regcomp(&re, s, options); +- free(s); + if (err) { + uc_error("Regex '%s' compilation failed (code %d)", s, err); ++ free(s); + return -EINVAL; + } ++ free(s); + + err = uc_mgr_get_substituted_value(uc_mgr, &s, string); + if (err < 0) { +-- +2.30.2 + + +From 7764e3e621a4c8a52327833d44e32c8b6fe3a131 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 2 Jun 2021 19:53:24 +0200 +Subject: [PATCH 14/18] ucm: fix if_eval_path() - access NULL pointer + +Signed-off-by: Jaroslav Kysela +--- + src/ucm/ucm_cond.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/ucm/ucm_cond.c b/src/ucm/ucm_cond.c +index adb0ecd9..0ed0b690 100644 +--- a/src/ucm/ucm_cond.c ++++ b/src/ucm/ucm_cond.c +@@ -272,7 +272,7 @@ static int if_eval_control_exists(snd_use_case_mgr_t *uc_mgr, snd_config_t *eval + + static int if_eval_path(snd_use_case_mgr_t *uc_mgr, snd_config_t *eval) + { +- const char *path, *mode = NULL; ++ const char *path, *mode = ""; + int err, amode = F_OK; + + if (uc_mgr->conf_format < 4) { +-- +2.30.2 + + +From 7fcb1aadd56e94f03e51c4747e72d77279151c22 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 2 Jun 2021 19:56:01 +0200 +Subject: [PATCH 15/18] ucm: find_exec() - fix memory leak (dir) + +Signed-off-by: Jaroslav Kysela +--- + src/ucm/ucm_exec.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/ucm/ucm_exec.c b/src/ucm/ucm_exec.c +index a22df8fe..1cdb2633 100644 +--- a/src/ucm/ucm_exec.c ++++ b/src/ucm/ucm_exec.c +@@ -73,6 +73,7 @@ static int find_exec(const char *name, char *out, size_t len) + || !(st.st_mode & S_IEXEC)) + continue; + snd_strlcpy(out, bin, len); ++ closedir(dir); + return 1; + } + closedir(dir); +-- +2.30.2 + + +From 26ab7fc3e4cba416cf51aa0fb48fdddaa0d861ee Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 2 Jun 2021 19:58:04 +0200 +Subject: [PATCH 16/18] ucm: fix possible NULL pointer dereference in + uc_mgr_exec() + +Signed-off-by: Jaroslav Kysela +--- + src/ucm/ucm_exec.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/ucm/ucm_exec.c b/src/ucm/ucm_exec.c +index 1cdb2633..d83206d0 100644 +--- a/src/ucm/ucm_exec.c ++++ b/src/ucm/ucm_exec.c +@@ -185,7 +185,11 @@ int uc_mgr_exec(const char *prog) + return -EINVAL; + + prog = argv[0]; +- if (argv[0][0] != '/' && argv[0][0] != '.') { ++ if (prog == NULL) { ++ err = -EINVAL; ++ goto __error; ++ } ++ if (prog[0] != '/' && prog[0] != '.') { + if (!find_exec(argv[0], bin, sizeof(bin))) { + err = -ENOEXEC; + goto __error; +-- +2.30.2 + + +From 64a6d4d1e827732bef7c68e1e6d2cb6863b4597c Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 2 Jun 2021 19:59:10 +0200 +Subject: [PATCH 17/18] ucm: check error value in parse_lookup_query() + +Signed-off-by: Jaroslav Kysela +--- + src/ucm/ucm_subs.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/ucm/ucm_subs.c b/src/ucm/ucm_subs.c +index c56730c5..0bc4e63f 100644 +--- a/src/ucm/ucm_subs.c ++++ b/src/ucm/ucm_subs.c +@@ -224,7 +224,11 @@ static snd_config_t *parse_lookup_query(const char *query) + uc_error("unable to create memory input buffer"); + return NULL; + } +- snd_config_top(&config); ++ err = snd_config_top(&config); ++ if (err < 0) { ++ snd_input_close(input); ++ return NULL; ++ } + err = snd_config_load(config, input); + snd_input_close(input); + if (err < 0) { +-- +2.30.2 + + +From 30d1d256e792fbabf14c57efb98c489541b19f37 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 2 Jun 2021 20:01:08 +0200 +Subject: [PATCH 18/18] ucm: fix out-of-array access in + rval_device_lookup_init() + +Signed-off-by: Jaroslav Kysela +--- + src/ucm/ucm_subs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/ucm/ucm_subs.c b/src/ucm/ucm_subs.c +index 0bc4e63f..20905c3f 100644 +--- a/src/ucm/ucm_subs.c ++++ b/src/ucm/ucm_subs.c +@@ -489,7 +489,7 @@ static int rval_device_lookup_init(snd_use_case_mgr_t *uc_mgr, + uc_error("Missing device type!"); + return -EINVAL; + } +- for (t = types; t; t++) ++ for (t = types; t->name; t++) + if (strcasecmp(t->name, s) == 0) + return t->init(iter, config); + uc_error("Device type '%s' is invalid", s); +-- +2.30.2 + From e62f8551303b32bca0e77f932e606a2a81709c8a Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 14 Jun 2021 13:51:54 +0200 Subject: [PATCH 067/120] update to 1.2.5.1 --- alsa-git.patch | 728 -------------------------------------------- alsa-lib.spec | 9 +- alsa-ucm-conf.patch | 14 - sources | 4 +- 4 files changed, 8 insertions(+), 747 deletions(-) diff --git a/alsa-git.patch b/alsa-git.patch index b42c2d2..e69de29 100644 --- a/alsa-git.patch +++ b/alsa-git.patch @@ -1,728 +0,0 @@ -From ddfc32abf5697de1618b9e7ffdf57a0f97013090 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 2 Jun 2021 08:49:32 +0200 -Subject: [PATCH 01/18] conf: fix load_for_all_cards() - -The 63f7745b commit is loading the driver specific configuration -multiple times which ends with the array merges (see the bug). - -Introduce the loaded compound which traces the already loaded -driver configurations and skip the multiple load requests. - -Fixes: https://github.com/alsa-project/alsa-lib/issues/143 -Fixes: 63f7745b ("conf: extend load_for_all_cards hook (id/value table)") -Signed-off-by: Jaroslav Kysela ---- - src/conf.c | 33 ++++++++++++++++++++++++++++----- - 1 file changed, 28 insertions(+), 5 deletions(-) - -diff --git a/src/conf.c b/src/conf.c -index f6c80031..d863dec6 100644 ---- a/src/conf.c -+++ b/src/conf.c -@@ -4325,18 +4325,23 @@ static int _snd_config_hook_table(snd_config_t *root, snd_config_t *config, snd_ - int snd_config_hook_load_for_all_cards(snd_config_t *root, snd_config_t *config, snd_config_t **dst, snd_config_t *private_data ATTRIBUTE_UNUSED) - { - int card = -1, err; -+ snd_config_t *loaded; // trace loaded cards - -+ err = snd_config_top(&loaded); -+ if (err < 0) -+ return err; - do { - err = snd_card_next(&card); - if (err < 0) -- return err; -+ goto __fin_err; - if (card >= 0) { -- snd_config_t *n, *private_data = NULL; -+ snd_config_t *n, *m, *private_data = NULL; - const char *driver; - char *fdriver = NULL; -+ bool load; - err = snd_determine_driver(card, &fdriver); - if (err < 0) -- return err; -+ goto __fin_err; - if (snd_config_search(root, fdriver, &n) >= 0) { - if (snd_config_get_string(n, &driver) < 0) { - if (snd_config_get_type(n) == SND_CONFIG_TYPE_COMPOUND) { -@@ -4357,6 +4362,19 @@ int snd_config_hook_load_for_all_cards(snd_config_t *root, snd_config_t *config, - driver = fdriver; - } - __std: -+ load = true; -+ err = snd_config_imake_integer(&m, driver, 1); -+ if (err < 0) -+ goto __err; -+ err = snd_config_add(loaded, m); -+ if (err < 0) { -+ if (err == -EEXIST) { -+ snd_config_delete(m); -+ load = false; -+ } else { -+ goto __err; -+ } -+ } - private_data = _snd_config_hook_private_data(card, driver); - if (!private_data) { - err = -ENOMEM; -@@ -4365,17 +4383,22 @@ int snd_config_hook_load_for_all_cards(snd_config_t *root, snd_config_t *config, - err = _snd_config_hook_table(root, config, private_data); - if (err < 0) - goto __err; -- err = snd_config_hook_load(root, config, &n, private_data); -+ if (load) -+ err = snd_config_hook_load(root, config, &n, private_data); - __err: - if (private_data) - snd_config_delete(private_data); - free(fdriver); - if (err < 0) -- return err; -+ goto __fin_err; - } - } while (card >= 0); -+ snd_config_delete(loaded); - *dst = NULL; - return 0; -+__fin_err: -+ snd_config_delete(loaded); -+ return err; - } - #ifndef DOC_HIDDEN - SND_DLSYM_BUILD_VERSION(snd_config_hook_load_for_all_cards, SND_CONFIG_DLSYM_VERSION_HOOK); --- -2.30.2 - - -From 0e4ba2ea8c0402f12a645032a14693eb9b1278e6 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 2 Jun 2021 11:09:43 +0200 -Subject: [PATCH 02/18] ucm: add _alibpref to get the private device prefix - -It may be useful to get the device prefix for the local configuration. - -Link: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1251 -Signed-off-by: Jaroslav Kysela ---- - include/use-case.h | 1 + - src/ucm/main.c | 21 +++++++++++++++++++++ - 2 files changed, 22 insertions(+) - -diff --git a/include/use-case.h b/include/use-case.h -index ec1a97b0..7890358b 100644 ---- a/include/use-case.h -+++ b/include/use-case.h -@@ -258,6 +258,7 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, - * - _verb - return current verb - * - _file - return configuration file loaded for current card - * - _alibcfg - return private alsa-lib's configuration for current card -+ * - _alibpref - return private alsa-lib's configuration device prefix for current card - * - * - [=]{NAME}[/[{modifier}|{/device}][/{verb}]] - * - value identifier {NAME} -diff --git a/src/ucm/main.c b/src/ucm/main.c -index 361952f6..3c9ea15d 100644 ---- a/src/ucm/main.c -+++ b/src/ucm/main.c -@@ -2138,6 +2138,25 @@ static int get_alibcfg(snd_use_case_mgr_t *uc_mgr, char **str) - return 0; - } - -+/** -+ * \brief Get device prefix for private alsa-lib configuration -+ * \param uc_mgr Use case manager -+ * \param str Returned value string -+ * \return Zero on success (value is filled), otherwise a negative error code -+ */ -+static int get_alibpref(snd_use_case_mgr_t *uc_mgr, char **str) -+{ -+ const size_t l = 9; -+ char *s; -+ -+ s = malloc(l); -+ if (s == NULL) -+ return -ENOMEM; -+ snprintf(s, l, "_ucm%04X", uc_mgr->ucm_card_number); -+ *str = s; -+ return 0; -+} -+ - /** - * \brief Get current - string - * \param uc_mgr Use case manager -@@ -2193,6 +2212,8 @@ int snd_use_case_get(snd_use_case_mgr_t *uc_mgr, - - } else if (strcmp(identifier, "_alibcfg") == 0) { - err = get_alibcfg(uc_mgr, (char **)value); -+ } else if (strcmp(identifier, "_alibpref") == 0) { -+ err = get_alibpref(uc_mgr, (char **)value); - } else if (identifier[0] == '_') { - err = -ENOENT; - } else { --- -2.30.2 - - -From 9621d0bff2e60b43e329ffa5059ab19f2914ec14 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 2 Jun 2021 11:21:54 +0200 -Subject: [PATCH 03/18] ucm: fix _alibpref string (add '.' delimiter to the - end) - -Fixes: 0e4ba2ea ("ucm: add _alibpref to get the private device prefix") -Signed-off-by: Jaroslav Kysela ---- - src/ucm/main.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/ucm/main.c b/src/ucm/main.c -index 3c9ea15d..c9b37b68 100644 ---- a/src/ucm/main.c -+++ b/src/ucm/main.c -@@ -2146,13 +2146,13 @@ static int get_alibcfg(snd_use_case_mgr_t *uc_mgr, char **str) - */ - static int get_alibpref(snd_use_case_mgr_t *uc_mgr, char **str) - { -- const size_t l = 9; -+ const size_t l = 10; - char *s; - - s = malloc(l); - if (s == NULL) - return -ENOMEM; -- snprintf(s, l, "_ucm%04X", uc_mgr->ucm_card_number); -+ snprintf(s, l, "_ucm%04X.", uc_mgr->ucm_card_number); - *str = s; - return 0; - } --- -2.30.2 - - -From 2a1dafdbe5932260aeb4db359ce5d630b8106889 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 2 Jun 2021 19:26:47 +0200 -Subject: [PATCH 04/18] conf: remove dead code in snd_config_get_card() - -Signed-off-by: Jaroslav Kysela ---- - src/confmisc.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/src/confmisc.c b/src/confmisc.c -index 3663d164..a561040c 100644 ---- a/src/confmisc.c -+++ b/src/confmisc.c -@@ -154,10 +154,10 @@ int snd_config_get_card(const snd_config_t *conf) - long v; - int err; - -- if ((err = snd_config_get_integer(conf, &v)) < 0) { -+ if (snd_config_get_integer(conf, &v) < 0) { - if ((err = snd_config_get_string(conf, &str)) < 0) { -- snd_config_get_id(conf, &id); -- SNDERR("Invalid field %s", id); -+ if (snd_config_get_id(conf, &id) >= 0) -+ SNDERR("Invalid field %s", id); - return -EINVAL; - } - err = snd_card_get_index(str); --- -2.30.2 - - -From 013ec607db9de11b682f2b85d843be062ca0d046 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 2 Jun 2021 19:28:32 +0200 -Subject: [PATCH 05/18] control: remap - fix uninitialized value in - parse_map_vindex() - -Signed-off-by: Jaroslav Kysela ---- - src/control/control_remap.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/control/control_remap.c b/src/control/control_remap.c -index f3d65010..17c6558a 100644 ---- a/src/control/control_remap.c -+++ b/src/control/control_remap.c -@@ -1040,7 +1040,7 @@ static int parse_map_vindex(struct snd_ctl_map_ctl *mctl, snd_config_t *conf) - - snd_config_for_each(i, next, conf) { - snd_config_t *n = snd_config_iterator_entry(i); -- long idx, chn; -+ long idx = -1, chn = -1; - const char *id; - if (snd_config_get_id(n, &id) < 0) - continue; --- -2.30.2 - - -From 2fee6af9b6e157475159d284af8de1e879bb7a36 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 2 Jun 2021 19:35:44 +0200 -Subject: [PATCH 06/18] pcm: direct - fix pcmp error path in - _snd_pcm_direct_new() - -Signed-off-by: Jaroslav Kysela ---- - src/pcm/pcm_direct.c | 21 ++++++++++++--------- - 1 file changed, 12 insertions(+), 9 deletions(-) - -diff --git a/src/pcm/pcm_direct.c b/src/pcm/pcm_direct.c -index 0e5e0421..361805bd 100644 ---- a/src/pcm/pcm_direct.c -+++ b/src/pcm/pcm_direct.c -@@ -2126,24 +2126,20 @@ int _snd_pcm_direct_new(snd_pcm_t **pcmp, snd_pcm_direct_t **_dmix, int type, - dmix->type = type; - - ret = snd_pcm_new(pcmp, type, name, stream, mode); -- if (ret < 0) { --_err_nosem: -- free(dmix->bindings); -- free(dmix); -- return ret; -- } -+ if (ret < 0) -+ goto _err_nosem; - - while (1) { - ret = snd_pcm_direct_semaphore_create_or_connect(dmix); - if (ret < 0) { - SNDERR("unable to create IPC semaphore"); -- goto _err_nosem; -+ goto _err_nosem_free; - } - ret = snd_pcm_direct_semaphore_down(dmix, DIRECT_IPC_SEM_CLIENT); - if (ret < 0) { - snd_pcm_direct_semaphore_discard(dmix); - if (--fail_sem_loop <= 0) -- goto _err_nosem; -+ goto _err_nosem_free; - continue; - } - break; -@@ -2153,10 +2149,17 @@ _err_nosem: - if (ret < 0) { - SNDERR("unable to create IPC shm instance"); - snd_pcm_direct_semaphore_up(dmix, DIRECT_IPC_SEM_CLIENT); -- goto _err_nosem; -+ goto _err_nosem_free; - } else { - *_dmix = dmix; - } - -+ return ret; -+_err_nosem_free: -+ snd_pcm_free(*pcmp); -+ *pcmp = NULL; -+_err_nosem: -+ free(dmix->bindings); -+ free(dmix); - return ret; - } --- -2.30.2 - - -From eb95cad4e22a0bf2577f1fa4a3f6fd18caed3362 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 2 Jun 2021 19:37:53 +0200 -Subject: [PATCH 07/18] pcm: remove extra NULL checks in snd_pcm_dmix_open() - -Signed-off-by: Jaroslav Kysela ---- - src/pcm/pcm_dmix.c | 11 ++++------- - 1 file changed, 4 insertions(+), 7 deletions(-) - -diff --git a/src/pcm/pcm_dmix.c b/src/pcm/pcm_dmix.c -index 8747450f..608593f1 100644 ---- a/src/pcm/pcm_dmix.c -+++ b/src/pcm/pcm_dmix.c -@@ -998,7 +998,7 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name, - snd_config_t *root, snd_config_t *sconf, - snd_pcm_stream_t stream, int mode) - { -- snd_pcm_t *pcm = NULL, *spcm = NULL; -+ snd_pcm_t *pcm, *spcm = NULL; - snd_pcm_direct_t *dmix; - int ret, first_instance; - -@@ -1154,12 +1154,9 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name, - } else - snd_pcm_direct_semaphore_up(dmix, DIRECT_IPC_SEM_CLIENT); - _err_nosem: -- if (dmix) { -- free(dmix->bindings); -- free(dmix); -- } -- if (pcm) -- snd_pcm_free(pcm); -+ free(dmix->bindings); -+ free(dmix); -+ snd_pcm_free(pcm); - return ret; - } - --- -2.30.2 - - -From 01a45aec6fcd5a5378a5b5e0ae0f9dacde2068e4 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 2 Jun 2021 19:39:32 +0200 -Subject: [PATCH 08/18] pcm: remove extra NULL checks in snd_pcm_dsnoop_open() - -Signed-off-by: Jaroslav Kysela ---- - src/pcm/pcm_dsnoop.c | 13 +++++-------- - 1 file changed, 5 insertions(+), 8 deletions(-) - -diff --git a/src/pcm/pcm_dsnoop.c b/src/pcm/pcm_dsnoop.c -index fb1b02c2..2c3b9f43 100644 ---- a/src/pcm/pcm_dsnoop.c -+++ b/src/pcm/pcm_dsnoop.c -@@ -564,8 +564,8 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name, - snd_config_t *root, snd_config_t *sconf, - snd_pcm_stream_t stream, int mode) - { -- snd_pcm_t *pcm = NULL, *spcm = NULL; -- snd_pcm_direct_t *dsnoop = NULL; -+ snd_pcm_t *pcm, *spcm = NULL; -+ snd_pcm_direct_t *dsnoop; - int ret, first_instance; - - assert(pcmp); -@@ -708,12 +708,9 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name, - snd_pcm_direct_semaphore_up(dsnoop, DIRECT_IPC_SEM_CLIENT); - - _err_nosem: -- if (dsnoop) { -- free(dsnoop->bindings); -- free(dsnoop); -- } -- if (pcm) -- snd_pcm_free(pcm); -+ free(dsnoop->bindings); -+ free(dsnoop); -+ snd_pcm_free(pcm); - return ret; - } - --- -2.30.2 - - -From 74c6382df6cf18b801659d8c5c53407a7ea1f02b Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 2 Jun 2021 19:46:46 +0200 -Subject: [PATCH 09/18] pcm: remove extra NULL checks in snd_pcm_dshare_open() - -Signed-off-by: Jaroslav Kysela ---- - src/pcm/pcm_dshare.c | 13 +++++-------- - 1 file changed, 5 insertions(+), 8 deletions(-) - -diff --git a/src/pcm/pcm_dshare.c b/src/pcm/pcm_dshare.c -index 0f5238a6..a918512b 100644 ---- a/src/pcm/pcm_dshare.c -+++ b/src/pcm/pcm_dshare.c -@@ -690,8 +690,8 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name, - snd_config_t *root, snd_config_t *sconf, - snd_pcm_stream_t stream, int mode) - { -- snd_pcm_t *pcm = NULL, *spcm = NULL; -- snd_pcm_direct_t *dshare = NULL; -+ snd_pcm_t *pcm, *spcm = NULL; -+ snd_pcm_direct_t *dshare; - int ret, first_instance; - unsigned int chn; - -@@ -851,12 +851,9 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name, - } else - snd_pcm_direct_semaphore_up(dshare, DIRECT_IPC_SEM_CLIENT); - _err_nosem: -- if (dshare) { -- free(dshare->bindings); -- free(dshare); -- } -- if (pcm) -- snd_pcm_free(pcm); -+ free(dshare->bindings); -+ free(dshare); -+ snd_pcm_free(pcm); - return ret; - } - --- -2.30.2 - - -From eabadf545c51d4c88c5f359db73726ec3ac653ba Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 2 Jun 2021 19:49:29 +0200 -Subject: [PATCH 10/18] pcm: softvol - fix early exit in add_tlv_info() - -Signed-off-by: Jaroslav Kysela ---- - src/pcm/pcm_softvol.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/pcm/pcm_softvol.c b/src/pcm/pcm_softvol.c -index e2bdd31a..eea322ca 100644 ---- a/src/pcm/pcm_softvol.c -+++ b/src/pcm/pcm_softvol.c -@@ -711,13 +711,13 @@ static int add_tlv_info(snd_pcm_softvol_t *svol, snd_ctl_elem_info_t *cinfo, - unsigned int *old_tlv, size_t old_tlv_size) - { - unsigned int tlv[4]; -- if (sizeof(tlv) <= old_tlv_size && memcmp(tlv, old_tlv, sizeof(tlv)) == 0) -- return 0; - tlv[SNDRV_CTL_TLVO_TYPE] = SND_CTL_TLVT_DB_SCALE; - tlv[SNDRV_CTL_TLVO_LEN] = 2 * sizeof(int); - tlv[SNDRV_CTL_TLVO_DB_SCALE_MIN] = (int)(svol->min_dB * 100); - tlv[SNDRV_CTL_TLVO_DB_SCALE_MUTE_AND_STEP] = - (int)((svol->max_dB - svol->min_dB) * 100 / svol->max_val); -+ if (sizeof(tlv) <= old_tlv_size && memcmp(tlv, old_tlv, sizeof(tlv)) == 0) -+ return 0; - return snd_ctl_elem_tlv_write(svol->ctl, &cinfo->id, tlv); - } - --- -2.30.2 - - -From cf3846d46053b23006e6a9042b586fc78e81af55 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 2 Jun 2021 19:50:17 +0200 -Subject: [PATCH 11/18] timer: remove dead code in _snd_timer_hw_open() - ---- - src/timer/timer_hw.c | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/src/timer/timer_hw.c b/src/timer/timer_hw.c -index cfb77463..fe4e40bb 100644 ---- a/src/timer/timer_hw.c -+++ b/src/timer/timer_hw.c -@@ -330,8 +330,6 @@ int _snd_timer_hw_open(snd_timer_t **timer, char *name, - SNDERR("Unexpected field %s", id); - return -EINVAL; - } -- if (card < 0) -- return -EINVAL; - return snd_timer_hw_open(timer, name, dev_class, dev_sclass, card, device, subdevice, mode); - } - SND_DLSYM_BUILD_VERSION(_snd_timer_hw_open, SND_TIMER_DLSYM_VERSION); --- -2.30.2 - - -From 200d18cda7a700607c21ad5dc9faaea2a1e27dbd Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 2 Jun 2021 19:51:13 +0200 -Subject: [PATCH 12/18] ucm: fix error path in execute_cfgsave() - -Signed-off-by: Jaroslav Kysela ---- - src/ucm/main.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/src/ucm/main.c b/src/ucm/main.c -index c9b37b68..42fdaa1d 100644 ---- a/src/ucm/main.c -+++ b/src/ucm/main.c -@@ -605,8 +605,10 @@ static int execute_cfgsave(snd_use_case_mgr_t *uc_mgr, const char *filename) - uc_error("unable to open file '%s': %s", file, snd_strerror(err)); - goto _err; - } -- if (!config || snd_config_is_empty(config)) -+ if (!config || snd_config_is_empty(config)) { -+ snd_output_close(out); - goto _err; -+ } - if (with_root) { - snd_output_printf(out, "%s ", root); - err = _snd_config_save_node_value(config, out, 0); --- -2.30.2 - - -From 9b71d53bde21c8bb0d900c17863664e12753d844 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 2 Jun 2021 19:52:12 +0200 -Subject: [PATCH 13/18] ucm: fix use after free in if_eval_regex_match() - -Signed-off-by: Jaroslav Kysela ---- - src/ucm/ucm_cond.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/src/ucm/ucm_cond.c b/src/ucm/ucm_cond.c -index 59d1a155..adb0ecd9 100644 ---- a/src/ucm/ucm_cond.c -+++ b/src/ucm/ucm_cond.c -@@ -160,11 +160,12 @@ static int if_eval_regex_match(snd_use_case_mgr_t *uc_mgr, snd_config_t *eval) - if (err < 0) - return err; - err = regcomp(&re, s, options); -- free(s); - if (err) { - uc_error("Regex '%s' compilation failed (code %d)", s, err); -+ free(s); - return -EINVAL; - } -+ free(s); - - err = uc_mgr_get_substituted_value(uc_mgr, &s, string); - if (err < 0) { --- -2.30.2 - - -From 7764e3e621a4c8a52327833d44e32c8b6fe3a131 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 2 Jun 2021 19:53:24 +0200 -Subject: [PATCH 14/18] ucm: fix if_eval_path() - access NULL pointer - -Signed-off-by: Jaroslav Kysela ---- - src/ucm/ucm_cond.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/ucm/ucm_cond.c b/src/ucm/ucm_cond.c -index adb0ecd9..0ed0b690 100644 ---- a/src/ucm/ucm_cond.c -+++ b/src/ucm/ucm_cond.c -@@ -272,7 +272,7 @@ static int if_eval_control_exists(snd_use_case_mgr_t *uc_mgr, snd_config_t *eval - - static int if_eval_path(snd_use_case_mgr_t *uc_mgr, snd_config_t *eval) - { -- const char *path, *mode = NULL; -+ const char *path, *mode = ""; - int err, amode = F_OK; - - if (uc_mgr->conf_format < 4) { --- -2.30.2 - - -From 7fcb1aadd56e94f03e51c4747e72d77279151c22 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 2 Jun 2021 19:56:01 +0200 -Subject: [PATCH 15/18] ucm: find_exec() - fix memory leak (dir) - -Signed-off-by: Jaroslav Kysela ---- - src/ucm/ucm_exec.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/ucm/ucm_exec.c b/src/ucm/ucm_exec.c -index a22df8fe..1cdb2633 100644 ---- a/src/ucm/ucm_exec.c -+++ b/src/ucm/ucm_exec.c -@@ -73,6 +73,7 @@ static int find_exec(const char *name, char *out, size_t len) - || !(st.st_mode & S_IEXEC)) - continue; - snd_strlcpy(out, bin, len); -+ closedir(dir); - return 1; - } - closedir(dir); --- -2.30.2 - - -From 26ab7fc3e4cba416cf51aa0fb48fdddaa0d861ee Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 2 Jun 2021 19:58:04 +0200 -Subject: [PATCH 16/18] ucm: fix possible NULL pointer dereference in - uc_mgr_exec() - -Signed-off-by: Jaroslav Kysela ---- - src/ucm/ucm_exec.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/src/ucm/ucm_exec.c b/src/ucm/ucm_exec.c -index 1cdb2633..d83206d0 100644 ---- a/src/ucm/ucm_exec.c -+++ b/src/ucm/ucm_exec.c -@@ -185,7 +185,11 @@ int uc_mgr_exec(const char *prog) - return -EINVAL; - - prog = argv[0]; -- if (argv[0][0] != '/' && argv[0][0] != '.') { -+ if (prog == NULL) { -+ err = -EINVAL; -+ goto __error; -+ } -+ if (prog[0] != '/' && prog[0] != '.') { - if (!find_exec(argv[0], bin, sizeof(bin))) { - err = -ENOEXEC; - goto __error; --- -2.30.2 - - -From 64a6d4d1e827732bef7c68e1e6d2cb6863b4597c Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 2 Jun 2021 19:59:10 +0200 -Subject: [PATCH 17/18] ucm: check error value in parse_lookup_query() - -Signed-off-by: Jaroslav Kysela ---- - src/ucm/ucm_subs.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/src/ucm/ucm_subs.c b/src/ucm/ucm_subs.c -index c56730c5..0bc4e63f 100644 ---- a/src/ucm/ucm_subs.c -+++ b/src/ucm/ucm_subs.c -@@ -224,7 +224,11 @@ static snd_config_t *parse_lookup_query(const char *query) - uc_error("unable to create memory input buffer"); - return NULL; - } -- snd_config_top(&config); -+ err = snd_config_top(&config); -+ if (err < 0) { -+ snd_input_close(input); -+ return NULL; -+ } - err = snd_config_load(config, input); - snd_input_close(input); - if (err < 0) { --- -2.30.2 - - -From 30d1d256e792fbabf14c57efb98c489541b19f37 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 2 Jun 2021 20:01:08 +0200 -Subject: [PATCH 18/18] ucm: fix out-of-array access in - rval_device_lookup_init() - -Signed-off-by: Jaroslav Kysela ---- - src/ucm/ucm_subs.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/ucm/ucm_subs.c b/src/ucm/ucm_subs.c -index 0bc4e63f..20905c3f 100644 ---- a/src/ucm/ucm_subs.c -+++ b/src/ucm/ucm_subs.c -@@ -489,7 +489,7 @@ static int rval_device_lookup_init(snd_use_case_mgr_t *uc_mgr, - uc_error("Missing device type!"); - return -EINVAL; - } -- for (t = types; t; t++) -+ for (t = types; t->name; t++) - if (strcasecmp(t->name, s) == 0) - return t->init(iter, config); - uc_error("Device type '%s' is invalid", s); --- -2.30.2 - diff --git a/alsa-lib.spec b/alsa-lib.spec index 619a415..b9cf697 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -2,14 +2,14 @@ #define prever_dot .rc3 #define postver a -%define version_alsa_lib 1.2.5 -%define version_alsa_ucm 1.2.5 +%define version_alsa_lib 1.2.5.1 +%define version_alsa_ucm 1.2.5.1 %define version_alsa_tplg 1.2.5 Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 2%{?prever_dot}%{?dist} +Release: 1%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Mon Jun 14 2021 Jaroslav Kysela - 1.2.5.1-1 +- update to 1.2.5.1 + * Wed Jun 2 2021 Jaroslav Kysela - 1.2.5-2 - add upstream fixes (conf + ucm) diff --git a/alsa-ucm-conf.patch b/alsa-ucm-conf.patch index dedf95f..e69de29 100644 --- a/alsa-ucm-conf.patch +++ b/alsa-ucm-conf.patch @@ -1,14 +0,0 @@ -diff --git a/ucm2/HDA-Intel/HDA-Intel.conf b/ucm2/HDA-Intel/HDA-Intel.conf -index 5794e72..8a8e0e7 100644 ---- a/ucm2/HDA-Intel/HDA-Intel.conf -+++ b/ucm2/HDA-Intel/HDA-Intel.conf -@@ -1,4 +1,4 @@ --Syntax 3 -+Syntax 4 - - Define.Use "" # a non-empty string to use UCM configuration for HDA devices - --- -2.30.2 - - diff --git a/sources b/sources index b10f9d4..ddf88ed 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (alsa-lib-1.2.5.tar.bz2) = d9b53484737a3684aac7e08b4b18400aac10fec1a78a8bf9101944bea2c50710bc7355e9bb0012541b067e2d5ee7b1b818bf1bdbffbb2b2d7ad0eb15efe49725 +SHA512 (alsa-lib-1.2.5.1.tar.bz2) = 01998ffa449e925ff552c13aea47f9540903afdc533086067c78dcaba4d239c347180d3d28bb0000e6d19b7779c7249fcc77a30057930ca22d18ba55e163fa1c SHA512 (alsa-topology-conf-1.2.5.tar.bz2) = 2eb4d8baf2dcbf0b631dd11dbf15bffc51694d9cc6931619e51787f3ba58d1a091d266e6721a3b737c040ec74a28270b93f39fb97f30a3227cf340dd646e5d51 -SHA512 (alsa-ucm-conf-1.2.5.tar.bz2) = f16e8f04018c65de5e24f2a3eb0b3edff26cbce78cc1820c42c46907c903913c571797b59e803ae36b8ec3136487d0a5aacd034e2a8df3e15ed998b7a70152b7 +SHA512 (alsa-ucm-conf-1.2.5.1.tar.bz2) = 774d6da1a0ee6fb1fcd764c1d4b3eb5812a35508cf27db71f6c82784f125eca207992da9081d25783fecb31e548d8b34124d4b3b3d506e33215b76ea48f71012 From 4dbf7080feacb807144b89d44fdefc2f1abb6299 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 21 Jul 2021 12:32:47 +0000 Subject: [PATCH 068/120] - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild Signed-off-by: Fedora Release Engineering From 3f83c1ca47d8d2d55bb472b9b98572a115972b5b Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 21 Jul 2021 17:28:11 +0000 Subject: [PATCH 069/120] - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- alsa-lib.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index b9cf697..eff5b83 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 1%{?prever_dot}%{?dist} +Release: 2%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Wed Jul 21 2021 Fedora Release Engineering - 1.2.5.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + * Mon Jun 14 2021 Jaroslav Kysela - 1.2.5.1-1 - update to 1.2.5.1 From e42bd8613d169034a53f5277d0bcfc9179c08e94 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 31 Aug 2021 09:55:42 +0200 Subject: [PATCH 070/120] ucm fixes for 1.2.5.1 --- alsa-git.patch | 1916 ++++++++++++++++++++++++++++++++++++++++++++++++ alsa-lib.spec | 5 +- 2 files changed, 1920 insertions(+), 1 deletion(-) diff --git a/alsa-git.patch b/alsa-git.patch index e69de29..f88de1b 100644 --- a/alsa-git.patch +++ b/alsa-git.patch @@ -0,0 +1,1916 @@ +From 81e7923fbfad45b2f353a4d6e3053af51f5f7d0b Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 15 Jun 2021 23:21:42 +0200 +Subject: [PATCH 01/20] control: empty - fix the static build + +Reported-by: Jan Palus +Fixes: https://github.com/alsa-project/alsa-lib/issues/157 +Signed-off-by: Jaroslav Kysela +--- + src/control/control_empty.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/control/control_empty.c b/src/control/control_empty.c +index 49d1026c..c9b048c1 100644 +--- a/src/control/control_empty.c ++++ b/src/control/control_empty.c +@@ -30,7 +30,7 @@ + + #ifndef PIC + /* entry for static linking */ +-const char *_snd_module_ctl_empty = ""; ++const char *_snd_module_control_empty = ""; + #endif + + /*! \page control_plugins +-- +2.31.1 + + +From 5089358aa99d698bd846b05c1890a09613d740b3 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Thu, 17 Jun 2021 10:20:25 +0200 +Subject: [PATCH 02/20] pcm: rate: Refactoring temporary buffer allocations + +Introduce common helpers to allocate and release the temporary buffers +and the associated snd_pcm_channel. Now two allocated objects are +used instead of one malloc to be split. + +Also, change the snd_pcm_channel set up to be in interleaved mode. +This will be necessary in the following change in the rate plugin. + +Signed-off-by: Takashi Iwai +--- + src/pcm/pcm_rate.c | 80 ++++++++++++++++++++++++++++------------------ + 1 file changed, 49 insertions(+), 31 deletions(-) + +diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c +index 770aafea..1e996134 100644 +--- a/src/pcm/pcm_rate.c ++++ b/src/pcm/pcm_rate.c +@@ -76,6 +76,45 @@ struct _snd_pcm_rate { + + #endif /* DOC_HIDDEN */ + ++/* allocate a channel area and a temporary buffer for the given size */ ++static snd_pcm_channel_area_t * ++rate_alloc_tmp_buf(snd_pcm_rate_t *rate, snd_pcm_format_t format, ++ unsigned int channels, unsigned int frames) ++{ ++ snd_pcm_channel_area_t *ap; ++ int width = snd_pcm_format_physical_width(format); ++ int i; ++ ++ ap = malloc(sizeof(*ap) * channels); ++ if (!ap) ++ return NULL; ++ ap->addr = malloc(frames * channels * width / 8); ++ if (!ap->addr) { ++ free(ap); ++ return NULL; ++ } ++ ++ /* set up in interleaved format */ ++ for (i = 0; i < channels; i++) { ++ ap[i].addr = ap[0].addr + (i * width) / 8; ++ ap[i].first = 0; ++ ap[i].step = width * channels; ++ } ++ ++ return ap; ++} ++ ++static void rate_free_tmp_buf(snd_pcm_channel_area_t **ptr) ++{ ++ snd_pcm_channel_area_t *c = *ptr; ++ ++ if (c) { ++ free(c->addr); ++ free(c); ++ *ptr = NULL; ++ } ++} ++ + static int snd_pcm_rate_hw_refine_cprepare(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params) + { + snd_pcm_rate_t *rate = pcm->private_data; +@@ -286,28 +325,13 @@ static int snd_pcm_rate_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params) + if (err < 0) + return err; + +- rate->pareas = malloc(2 * channels * sizeof(*rate->pareas)); +- if (rate->pareas == NULL) ++ rate->pareas = rate_alloc_tmp_buf(rate, cinfo->format, channels, ++ cinfo->period_size); ++ rate->sareas = rate_alloc_tmp_buf(rate, sinfo->format, channels, ++ sinfo->period_size); ++ if (!rate->pareas || !rate->sareas) + goto error; + +- cwidth = snd_pcm_format_physical_width(cinfo->format); +- swidth = snd_pcm_format_physical_width(sinfo->format); +- rate->pareas[0].addr = malloc(((cwidth * channels * cinfo->period_size) / 8) + +- ((swidth * channels * sinfo->period_size) / 8)); +- if (rate->pareas[0].addr == NULL) +- goto error; +- +- rate->sareas = rate->pareas + channels; +- rate->sareas[0].addr = (char *)rate->pareas[0].addr + ((cwidth * channels * cinfo->period_size) / 8); +- for (chn = 0; chn < channels; chn++) { +- rate->pareas[chn].addr = (char *)rate->pareas[0].addr + (cwidth * chn * cinfo->period_size) / 8; +- rate->pareas[chn].first = 0; +- rate->pareas[chn].step = cwidth; +- rate->sareas[chn].addr = (char *)rate->sareas[0].addr + (swidth * chn * sinfo->period_size) / 8; +- rate->sareas[chn].first = 0; +- rate->sareas[chn].step = swidth; +- } +- + if (rate->ops.convert_s16) { + rate->get_idx = snd_pcm_linear_get_index(rate->info.in.format, SND_PCM_FORMAT_S16); + rate->put_idx = snd_pcm_linear_put_index(SND_PCM_FORMAT_S16, rate->info.out.format); +@@ -322,11 +346,8 @@ static int snd_pcm_rate_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params) + return 0; + + error: +- if (rate->pareas) { +- free(rate->pareas[0].addr); +- free(rate->pareas); +- rate->pareas = NULL; +- } ++ rate_free_tmp_buf(&rate->pareas); ++ rate_free_tmp_buf(&rate->sareas); + if (rate->ops.free) + rate->ops.free(rate->obj); + return -ENOMEM; +@@ -335,12 +356,9 @@ static int snd_pcm_rate_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params) + static int snd_pcm_rate_hw_free(snd_pcm_t *pcm) + { + snd_pcm_rate_t *rate = pcm->private_data; +- if (rate->pareas) { +- free(rate->pareas[0].addr); +- free(rate->pareas); +- rate->pareas = NULL; +- rate->sareas = NULL; +- } ++ ++ rate_free_tmp_buf(&rate->pareas); ++ rate_free_tmp_buf(&rate->sareas); + if (rate->ops.free) + rate->ops.free(rate->obj); + free(rate->src_buf); +-- +2.31.1 + + +From 119d9c1678b1193f8b969a6483cae1f7bf95e609 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Thu, 17 Jun 2021 10:03:17 +0200 +Subject: [PATCH 03/20] pcm: rate: Improve the support multiple formats + +This patch extends the PCM rate plugin for allowing its converter +plugin to deal with multiple formats. Currently, the converter plugin +is allowed to take different formats only when convert callback is +defined. And for this way (so far only the standard linear rate +plugin does), all linear formats have to be handled, and it's +cumbersome. + +OTOH, most other rate plugins are implemented with convert_s16 +callback, which accepts only S16 format. This is often not ideal +because many converter engines can handle 32bit formats. Also, the +target format is often 32bit format, hence this would require +additional conversion even if the converter engine can output 32bit +natively. + +In this patch, for addressing the problems above, the rate plugin API +is extended in the following way: + +- The new get_supported_formats callback is added; this stores the bit + masks of the supported input and output formats, as well as the + behavior flags. Currently only linear formats are allowed. +- When the plugin accepts only the interleaved stream, set + SND_PCM_RATE_FLAG_INTERLEAVED flag bit. Otherwise the code has to + handle snd_pcm_channel_area at each call. +- When both input and output formats have to be identical, pass + SND_PCM_RATE_FLAG_SYNC_FORMATS flag bit. +- When the converter wants to process different formats, use convert + callback instead of convert_s16. You can put both in the ops for + compatibility, too. + The input and output formats are found in the info argument of init + callback. +- Now the PCM rate plugin core will skip the temporary buffer + allocation and conversions for pre- and post-process if not needed + (i.e. matching with the requested input or output format). + +The rate plugin API version is bumped to 0x010003. + +Signed-off-by: Takashi Iwai +--- + include/pcm_rate.h | 36 ++++- + src/pcm/pcm_rate.c | 358 +++++++++++++++++++++++++++------------------ + 2 files changed, 251 insertions(+), 143 deletions(-) + +diff --git a/include/pcm_rate.h b/include/pcm_rate.h +index 4171fb9d..48473ed4 100644 +--- a/include/pcm_rate.h ++++ b/include/pcm_rate.h +@@ -38,7 +38,7 @@ extern "C" { + /** + * Protocol version + */ +-#define SND_PCM_RATE_PLUGIN_VERSION 0x010002 ++#define SND_PCM_RATE_PLUGIN_VERSION 0x010003 + + /** hw_params information for a single side */ + typedef struct snd_pcm_rate_side_info { +@@ -55,6 +55,11 @@ typedef struct snd_pcm_rate_info { + unsigned int channels; + } snd_pcm_rate_info_t; + ++enum { ++ SND_PCM_RATE_FLAG_INTERLEAVED = (1U << 0), /** only interleaved format */ ++ SND_PCM_RATE_FLAG_SYNC_FORMATS = (1U << 1), /** both input and output formats have to be identical */ ++}; ++ + /** Callback table of rate-converter */ + typedef struct snd_pcm_rate_ops { + /** +@@ -114,6 +119,13 @@ typedef struct snd_pcm_rate_ops { + * new ops since version 0x010002 + */ + void (*dump)(void *obj, snd_output_t *out); ++ /** ++ * get the supported input and output formats (optional); ++ * new ops since version 0x010003 ++ */ ++ int (*get_supported_formats)(void *obj, uint64_t *in_formats, ++ uint64_t *out_formats, ++ unsigned int *flags); + } snd_pcm_rate_ops_t; + + /** open function type */ +@@ -147,6 +159,28 @@ typedef struct snd_pcm_rate_old_ops { + snd_pcm_uframes_t (*input_frames)(void *obj, snd_pcm_uframes_t frames); + snd_pcm_uframes_t (*output_frames)(void *obj, snd_pcm_uframes_t frames); + } snd_pcm_rate_old_ops_t; ++ ++/* old rate_ops for protocol version 0x010002 */ ++typedef struct snd_pcm_rate_v2_ops { ++ void (*close)(void *obj); ++ int (*init)(void *obj, snd_pcm_rate_info_t *info); ++ void (*free)(void *obj); ++ void (*reset)(void *obj); ++ int (*adjust_pitch)(void *obj, snd_pcm_rate_info_t *info); ++ void (*convert)(void *obj, ++ const snd_pcm_channel_area_t *dst_areas, ++ snd_pcm_uframes_t dst_offset, unsigned int dst_frames, ++ const snd_pcm_channel_area_t *src_areas, ++ snd_pcm_uframes_t src_offset, unsigned int src_frames); ++ void (*convert_s16)(void *obj, int16_t *dst, unsigned int dst_frames, ++ const int16_t *src, unsigned int src_frames); ++ snd_pcm_uframes_t (*input_frames)(void *obj, snd_pcm_uframes_t frames); ++ snd_pcm_uframes_t (*output_frames)(void *obj, snd_pcm_uframes_t frames); ++ unsigned int version; ++ int (*get_supported_rates)(void *obj, unsigned int *rate_min, ++ unsigned int *rate_max); ++ void (*dump)(void *obj, snd_output_t *out); ++} snd_pcm_rate_v2_ops_t; + #endif + + #ifdef __cplusplus +diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c +index 1e996134..13111d29 100644 +--- a/src/pcm/pcm_rate.c ++++ b/src/pcm/pcm_rate.c +@@ -62,18 +62,22 @@ struct _snd_pcm_rate { + void *open_func; + void *obj; + snd_pcm_rate_ops_t ops; +- unsigned int get_idx; +- unsigned int put_idx; +- int16_t *src_buf; +- int16_t *dst_buf; ++ unsigned int src_conv_idx; ++ unsigned int dst_conv_idx; ++ snd_pcm_channel_area_t *src_buf; ++ snd_pcm_channel_area_t *dst_buf; + int start_pending; /* start is triggered but not commited to slave */ + snd_htimestamp_t trigger_tstamp; + unsigned int plugin_version; + unsigned int rate_min, rate_max; ++ snd_pcm_format_t orig_in_format; ++ snd_pcm_format_t orig_out_format; ++ uint64_t in_formats; ++ uint64_t out_formats; ++ unsigned int format_flags; + }; + + #define SND_PCM_RATE_PLUGIN_VERSION_OLD 0x010001 /* old rate plugin */ +- + #endif /* DOC_HIDDEN */ + + /* allocate a channel area and a temporary buffer for the given size */ +@@ -274,12 +278,84 @@ static int snd_pcm_rate_hw_refine(snd_pcm_t *pcm, + snd_pcm_generic_hw_refine); + } + ++/* evaluate the best matching available format to the given format */ ++static int get_best_format(uint64_t mask, snd_pcm_format_t orig) ++{ ++ int pwidth = snd_pcm_format_physical_width(orig); ++ int width = snd_pcm_format_width(orig); ++ int signd = snd_pcm_format_signed(orig); ++ int best_score = -1; ++ int match = -1; ++ int f, score; ++ ++ for (f = 0; f <= SND_PCM_FORMAT_LAST; f++) { ++ if (!(mask & (1ULL << f))) ++ continue; ++ score = 0; ++ if (snd_pcm_format_linear(f)) { ++ if (snd_pcm_format_physical_width(f) == pwidth) ++ score++; ++ if (snd_pcm_format_physical_width(f) >= pwidth) ++ score++; ++ if (snd_pcm_format_width(f) == width) ++ score++; ++ if (snd_pcm_format_signed(f) == signd) ++ score++; ++ } ++ if (score > best_score) { ++ match = f; ++ best_score = score; ++ } ++ } ++ ++ return match; ++} ++ ++/* set up the input and output formats from the available lists */ ++static int choose_preferred_format(snd_pcm_rate_t *rate) ++{ ++ uint64_t in_mask = rate->in_formats; ++ uint64_t out_mask = rate->out_formats; ++ int in, out; ++ ++ if (!in_mask || !out_mask) ++ return 0; ++ ++ if (rate->orig_in_format == rate->orig_out_format) ++ if (in_mask & out_mask & (1ULL << rate->orig_in_format)) ++ return 0; /* nothing changed */ ++ ++ repeat: ++ in = get_best_format(in_mask, rate->orig_in_format); ++ out = get_best_format(out_mask, rate->orig_out_format); ++ if (in < 0 || out < 0) ++ return -ENOENT; ++ ++ if ((rate->format_flags & SND_PCM_RATE_FLAG_SYNC_FORMATS) && ++ in != out) { ++ if (out_mask & (1ULL << in)) ++ out = in; ++ else if (in_mask & (1ULL << out)) ++ in = out; ++ else { ++ in_mask &= ~(1ULL << in); ++ out_mask &= ~(1ULL << out); ++ goto repeat; ++ } ++ } ++ ++ rate->info.in.format = in; ++ rate->info.out.format = out; ++ return 0; ++} ++ + static int snd_pcm_rate_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params) + { + snd_pcm_rate_t *rate = pcm->private_data; + snd_pcm_t *slave = rate->gen.slave; + snd_pcm_rate_side_info_t *sinfo, *cinfo; +- unsigned int channels, cwidth, swidth, chn; ++ unsigned int channels, cwidth, swidth, chn, acc; ++ int need_src_buf, need_dst_buf; + int err = snd_pcm_hw_params_slave(pcm, params, + snd_pcm_rate_hw_refine_cchange, + snd_pcm_rate_hw_refine_sprepare, +@@ -308,6 +384,9 @@ static int snd_pcm_rate_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params) + if (err < 0) + return err; + err = INTERNAL(snd_pcm_hw_params_get_channels)(params, &channels); ++ if (err < 0) ++ return err; ++ err = INTERNAL(snd_pcm_hw_params_get_access)(params, &acc); + if (err < 0) + return err; + +@@ -321,36 +400,80 @@ static int snd_pcm_rate_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params) + SNDMSG("rate plugin already in use"); + return -EBUSY; + } +- err = rate->ops.init(rate->obj, &rate->info); +- if (err < 0) +- return err; + + rate->pareas = rate_alloc_tmp_buf(rate, cinfo->format, channels, + cinfo->period_size); + rate->sareas = rate_alloc_tmp_buf(rate, sinfo->format, channels, + sinfo->period_size); +- if (!rate->pareas || !rate->sareas) +- goto error; +- +- if (rate->ops.convert_s16) { +- rate->get_idx = snd_pcm_linear_get_index(rate->info.in.format, SND_PCM_FORMAT_S16); +- rate->put_idx = snd_pcm_linear_put_index(SND_PCM_FORMAT_S16, rate->info.out.format); +- free(rate->src_buf); +- rate->src_buf = malloc(channels * rate->info.in.period_size * 2); +- free(rate->dst_buf); +- rate->dst_buf = malloc(channels * rate->info.out.period_size * 2); +- if (! rate->src_buf || ! rate->dst_buf) ++ if (!rate->pareas || !rate->sareas) { ++ err = -ENOMEM; ++ goto error_pareas; ++ } ++ ++ rate->orig_in_format = rate->info.in.format; ++ rate->orig_out_format = rate->info.out.format; ++ if (choose_preferred_format(rate) < 0) { ++ SNDERR("No matching format in rate plugin"); ++ err = -EINVAL; ++ goto error_pareas; ++ } ++ ++ err = rate->ops.init(rate->obj, &rate->info); ++ if (err < 0) ++ goto error_init; ++ ++ rate_free_tmp_buf(&rate->src_buf); ++ rate_free_tmp_buf(&rate->dst_buf); ++ ++ need_src_buf = need_dst_buf = 0; ++ ++ if ((rate->format_flags & SND_PCM_RATE_FLAG_INTERLEAVED) && ++ !(acc == SND_PCM_ACCESS_MMAP_INTERLEAVED || ++ acc == SND_PCM_ACCESS_RW_INTERLEAVED)) { ++ need_src_buf = need_dst_buf = 1; ++ } else { ++ if (rate->orig_in_format != rate->info.in.format) ++ need_src_buf = 1; ++ if (rate->orig_out_format != rate->info.out.format) ++ need_dst_buf = 1; ++ } ++ ++ if (need_src_buf) { ++ rate->src_conv_idx = ++ snd_pcm_linear_convert_index(rate->orig_in_format, ++ rate->info.in.format); ++ rate->src_buf = rate_alloc_tmp_buf(rate, rate->info.in.format, ++ channels, rate->info.in.period_size); ++ if (!rate->src_buf) { ++ err = -ENOMEM; + goto error; ++ } ++ } ++ ++ if (need_dst_buf) { ++ rate->dst_conv_idx = ++ snd_pcm_linear_convert_index(rate->info.out.format, ++ rate->orig_out_format); ++ rate->dst_buf = rate_alloc_tmp_buf(rate, rate->info.out.format, ++ channels, rate->info.out.period_size); ++ if (!rate->dst_buf) { ++ err = -ENOMEM; ++ goto error; ++ } + } + + return 0; + + error: +- rate_free_tmp_buf(&rate->pareas); +- rate_free_tmp_buf(&rate->sareas); ++ rate_free_tmp_buf(&rate->src_buf); ++ rate_free_tmp_buf(&rate->dst_buf); ++ error_init: + if (rate->ops.free) + rate->ops.free(rate->obj); +- return -ENOMEM; ++ error_pareas: ++ rate_free_tmp_buf(&rate->pareas); ++ rate_free_tmp_buf(&rate->sareas); ++ return err; + } + + static int snd_pcm_rate_hw_free(snd_pcm_t *pcm) +@@ -361,9 +484,8 @@ static int snd_pcm_rate_hw_free(snd_pcm_t *pcm) + rate_free_tmp_buf(&rate->sareas); + if (rate->ops.free) + rate->ops.free(rate->obj); +- free(rate->src_buf); +- free(rate->dst_buf); +- rate->src_buf = rate->dst_buf = NULL; ++ rate_free_tmp_buf(&rate->src_buf); ++ rate_free_tmp_buf(&rate->dst_buf); + return snd_pcm_hw_free(rate->gen.slave); + } + +@@ -444,82 +566,6 @@ static int snd_pcm_rate_init(snd_pcm_t *pcm) + return 0; + } + +-static void convert_to_s16(snd_pcm_rate_t *rate, int16_t *buf, +- const snd_pcm_channel_area_t *areas, +- snd_pcm_uframes_t offset, unsigned int frames, +- unsigned int channels) +-{ +-#ifndef DOC_HIDDEN +-#define GET16_LABELS +-#include "plugin_ops.h" +-#undef GET16_LABELS +-#endif /* DOC_HIDDEN */ +- void *get = get16_labels[rate->get_idx]; +- const char *src; +- int16_t sample; +- const char *srcs[channels]; +- int src_step[channels]; +- unsigned int c; +- +- for (c = 0; c < channels; c++) { +- srcs[c] = snd_pcm_channel_area_addr(areas + c, offset); +- src_step[c] = snd_pcm_channel_area_step(areas + c); +- } +- +- while (frames--) { +- for (c = 0; c < channels; c++) { +- src = srcs[c]; +- goto *get; +-#ifndef DOC_HIDDEN +-#define GET16_END after_get +-#include "plugin_ops.h" +-#undef GET16_END +-#endif /* DOC_HIDDEN */ +- after_get: +- *buf++ = sample; +- srcs[c] += src_step[c]; +- } +- } +-} +- +-static void convert_from_s16(snd_pcm_rate_t *rate, const int16_t *buf, +- const snd_pcm_channel_area_t *areas, +- snd_pcm_uframes_t offset, unsigned int frames, +- unsigned int channels) +-{ +-#ifndef DOC_HIDDEN +-#define PUT16_LABELS +-#include "plugin_ops.h" +-#undef PUT16_LABELS +-#endif /* DOC_HIDDEN */ +- void *put = put16_labels[rate->put_idx]; +- char *dst; +- int16_t sample; +- char *dsts[channels]; +- int dst_step[channels]; +- unsigned int c; +- +- for (c = 0; c < channels; c++) { +- dsts[c] = snd_pcm_channel_area_addr(areas + c, offset); +- dst_step[c] = snd_pcm_channel_area_step(areas + c); +- } +- +- while (frames--) { +- for (c = 0; c < channels; c++) { +- dst = dsts[c]; +- sample = *buf++; +- goto *put; +-#ifndef DOC_HIDDEN +-#define PUT16_END after_put +-#include "plugin_ops.h" +-#undef PUT16_END +-#endif /* DOC_HIDDEN */ +- after_put: +- dsts[c] += dst_step[c]; +- } +- } +-} +- + static void do_convert(const snd_pcm_channel_area_t *dst_areas, + snd_pcm_uframes_t dst_offset, unsigned int dst_frames, + const snd_pcm_channel_area_t *src_areas, +@@ -527,28 +573,40 @@ static void do_convert(const snd_pcm_channel_area_t *dst_areas, + unsigned int channels, + snd_pcm_rate_t *rate) + { +- if (rate->ops.convert_s16) { +- const int16_t *src; +- int16_t *dst; +- if (! rate->src_buf) +- src = (int16_t *)src_areas->addr + src_offset * channels; +- else { +- convert_to_s16(rate, rate->src_buf, src_areas, src_offset, +- src_frames, channels); +- src = rate->src_buf; +- } +- if (! rate->dst_buf) +- dst = (int16_t *)dst_areas->addr + dst_offset * channels; +- else +- dst = rate->dst_buf; +- rate->ops.convert_s16(rate->obj, dst, dst_frames, src, src_frames); +- if (dst == rate->dst_buf) +- convert_from_s16(rate, rate->dst_buf, dst_areas, dst_offset, +- dst_frames, channels); ++ const snd_pcm_channel_area_t *out_areas; ++ snd_pcm_uframes_t out_offset; ++ ++ if (rate->dst_buf) { ++ out_areas = rate->dst_buf; ++ out_offset = 0; + } else { +- rate->ops.convert(rate->obj, dst_areas, dst_offset, dst_frames, +- src_areas, src_offset, src_frames); ++ out_areas = dst_areas; ++ out_offset = dst_offset; ++ } ++ ++ if (rate->src_buf) { ++ snd_pcm_linear_convert(rate->src_buf, 0, ++ src_areas, src_offset, ++ channels, src_frames, ++ rate->src_conv_idx); ++ src_areas = rate->src_buf; ++ src_offset = 0; + } ++ ++ if (rate->ops.convert) ++ rate->ops.convert(rate->obj, out_areas, out_offset, dst_frames, ++ src_areas, src_offset, src_frames); ++ else ++ rate->ops.convert_s16(rate->obj, ++ snd_pcm_channel_area_addr(out_areas, out_offset), ++ dst_frames, ++ snd_pcm_channel_area_addr(src_areas, src_offset), ++ src_frames); ++ if (rate->dst_buf) ++ snd_pcm_linear_convert(dst_areas, dst_offset, ++ rate->dst_buf, 0, ++ channels, dst_frames, ++ rate->dst_conv_idx); + } + + static inline void +@@ -1276,6 +1334,30 @@ const snd_config_t *snd_pcm_rate_get_default_converter(snd_config_t *root) + return NULL; + } + ++static void rate_initial_setup(snd_pcm_rate_t *rate) ++{ ++ if (rate->plugin_version == SND_PCM_RATE_PLUGIN_VERSION) ++ rate->plugin_version = rate->ops.version; ++ ++ if (rate->plugin_version >= 0x010002 && ++ rate->ops.get_supported_rates) ++ rate->ops.get_supported_rates(rate->obj, ++ &rate->rate_min, ++ &rate->rate_max); ++ ++ if (rate->plugin_version >= 0x010003 && ++ rate->ops.get_supported_formats) { ++ rate->ops.get_supported_formats(rate->obj, ++ &rate->in_formats, ++ &rate->out_formats, ++ &rate->format_flags); ++ } else if (!rate->ops.convert && rate->ops.convert_s16) { ++ rate->in_formats = rate->out_formats = ++ 1ULL << SND_PCM_FORMAT_S16; ++ rate->format_flags = SND_PCM_RATE_FLAG_INTERLEAVED; ++ } ++} ++ + #ifdef PIC + static int is_builtin_plugin(const char *type) + { +@@ -1301,20 +1383,11 @@ static int rate_open_func(snd_pcm_rate_t *rate, const char *type, const snd_conf + lib = lib_name; + } + +- rate->rate_min = SND_PCM_PLUGIN_RATE_MIN; +- rate->rate_max = SND_PCM_PLUGIN_RATE_MAX; +- rate->plugin_version = SND_PCM_RATE_PLUGIN_VERSION; +- + open_conf_func = snd_dlobj_cache_get(lib, open_conf_name, NULL, verbose && converter_conf != NULL); + if (open_conf_func) { + err = open_conf_func(SND_PCM_RATE_PLUGIN_VERSION, + &rate->obj, &rate->ops, converter_conf); + if (!err) { +- rate->plugin_version = rate->ops.version; +- if (rate->ops.get_supported_rates) +- rate->ops.get_supported_rates(rate->obj, +- &rate->rate_min, +- &rate->rate_max); + rate->open_func = open_conf_func; + return 0; + } else { +@@ -1330,23 +1403,18 @@ static int rate_open_func(snd_pcm_rate_t *rate, const char *type, const snd_conf + rate->open_func = open_func; + + err = open_func(SND_PCM_RATE_PLUGIN_VERSION, &rate->obj, &rate->ops); +- if (!err) { +- rate->plugin_version = rate->ops.version; +- if (rate->ops.get_supported_rates) +- rate->ops.get_supported_rates(rate->obj, +- &rate->rate_min, +- &rate->rate_max); ++ if (!err) + return 0; +- } + + /* try to open with the old protocol version */ + rate->plugin_version = SND_PCM_RATE_PLUGIN_VERSION_OLD; + err = open_func(SND_PCM_RATE_PLUGIN_VERSION_OLD, + &rate->obj, &rate->ops); +- if (err) { +- snd_dlobj_cache_put(open_func); +- rate->open_func = NULL; +- } ++ if (!err) ++ return 0; ++ ++ snd_dlobj_cache_put(open_func); ++ rate->open_func = NULL; + return err; + } + #endif +@@ -1417,6 +1485,10 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name, + rate->srate = srate; + rate->sformat = sformat; + ++ rate->rate_min = SND_PCM_PLUGIN_RATE_MIN; ++ rate->rate_max = SND_PCM_PLUGIN_RATE_MAX; ++ rate->plugin_version = SND_PCM_RATE_PLUGIN_VERSION; ++ + err = snd_pcm_new(&pcm, SND_PCM_TYPE_RATE, name, slave->stream, slave->mode); + if (err < 0) { + free(rate); +@@ -1496,6 +1568,8 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name, + return err; + } + ++ rate_initial_setup(rate); ++ + pcm->ops = &snd_pcm_rate_ops; + pcm->fast_ops = &snd_pcm_rate_fast_ops; + pcm->private_data = rate; +-- +2.31.1 + + +From 3f737a2a2c8d20e78dea3ea836997f9d74f602a0 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 18 Jun 2021 11:35:30 +0200 +Subject: [PATCH 04/20] pcm: improve docs for snd_pcm_sw_params_get_avail_min() + and snd_pcm_status_get_avail_max() + +Fixes: https://github.com/alsa-project/alsa-lib/issues/44 +Signed-off-by: Jaroslav Kysela +--- + src/pcm/pcm.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c +index 09df0f12..892abf98 100644 +--- a/src/pcm/pcm.c ++++ b/src/pcm/pcm.c +@@ -6500,6 +6500,9 @@ int snd_pcm_sw_params_set_avail_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, + * \param params Software configuration container + * \param val returned minimum available frames to consider PCM ready + * \return 0 otherwise a negative error code ++ * ++ * This is a threshold value when the PCM stream is considered as ready for ++ * another read/write operation or poll event. + */ + #ifndef DOXYGEN + EXPORT_SYMBOL int INTERNAL(snd_pcm_sw_params_get_avail_min)(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val) +@@ -6960,6 +6963,8 @@ snd_pcm_uframes_t snd_pcm_status_get_avail(const snd_pcm_status_t *obj) + /** + * \brief Get maximum number of frames available from a PCM status container after last #snd_pcm_status call + * \return Maximum number of frames ready to be read/written ++ * ++ * This value returns the peak for the available frames between #snd_pcm_status calls. + */ + snd_pcm_uframes_t snd_pcm_status_get_avail_max(const snd_pcm_status_t *obj) + { +-- +2.31.1 + + +From 212c6c18c4317af48c007a0866efc029b9c3a593 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 21 Jun 2021 09:23:02 +0200 +Subject: [PATCH 05/20] pcm: dmix - use pcm_frame_diff() in + snd_pcm_dmix_sync_ptr0() + +Signed-off-by: Jaroslav Kysela +--- + src/pcm/pcm_dmix.c | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/src/pcm/pcm_dmix.c b/src/pcm/pcm_dmix.c +index 608593f1..0d0d0bff 100644 +--- a/src/pcm/pcm_dmix.c ++++ b/src/pcm/pcm_dmix.c +@@ -393,17 +393,13 @@ static int snd_pcm_dmix_sync_ptr0(snd_pcm_t *pcm, snd_pcm_uframes_t slave_hw_ptr + + old_slave_hw_ptr = dmix->slave_hw_ptr; + dmix->slave_hw_ptr = slave_hw_ptr; +- diff = slave_hw_ptr - old_slave_hw_ptr; ++ diff = pcm_frame_diff(slave_hw_ptr, old_slave_hw_ptr, dmix->slave_boundary); + if (diff == 0) /* fast path */ + return 0; + if (dmix->state != SND_PCM_STATE_RUNNING && + dmix->state != SND_PCM_STATE_DRAINING) + /* not really started yet - don't update hw_ptr */ + return 0; +- if (diff < 0) { +- slave_hw_ptr += dmix->slave_boundary; +- diff = slave_hw_ptr - old_slave_hw_ptr; +- } + dmix->hw_ptr += diff; + dmix->hw_ptr %= pcm->boundary; + if (pcm->stop_threshold >= pcm->boundary) /* don't care */ +-- +2.31.1 + + +From dd609ef9684987d3ca61d5c5cc3c77589ff9c29f Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 21 Jun 2021 09:28:41 +0200 +Subject: [PATCH 06/20] pcm: direct plugins - fix hw_ptr in the status callback + +The parent hw_ptr may be in another range (boundary limit). +Set the correct value for the caller. + +BugLink: https://github.com/alsa-project/alsa-lib/issues/155 +Signed-off-by: Jaroslav Kysela +--- + src/pcm/pcm_dmix.c | 1 + + src/pcm/pcm_dshare.c | 1 + + src/pcm/pcm_dsnoop.c | 1 + + 3 files changed, 3 insertions(+) + +diff --git a/src/pcm/pcm_dmix.c b/src/pcm/pcm_dmix.c +index 0d0d0bff..94dbb1e0 100644 +--- a/src/pcm/pcm_dmix.c ++++ b/src/pcm/pcm_dmix.c +@@ -491,6 +491,7 @@ static int snd_pcm_dmix_status(snd_pcm_t *pcm, snd_pcm_status_t * status) + } + + status->state = snd_pcm_dmix_state(pcm); ++ status->hw_ptr = *pcm->hw.ptr; /* boundary may be different */ + status->appl_ptr = *pcm->appl.ptr; /* slave PCM doesn't set appl_ptr */ + status->trigger_tstamp = dmix->trigger_tstamp; + status->avail = snd_pcm_mmap_playback_avail(pcm); +diff --git a/src/pcm/pcm_dshare.c b/src/pcm/pcm_dshare.c +index a918512b..01814dc8 100644 +--- a/src/pcm/pcm_dshare.c ++++ b/src/pcm/pcm_dshare.c +@@ -243,6 +243,7 @@ static int snd_pcm_dshare_status(snd_pcm_t *pcm, snd_pcm_status_t * status) + break; + } + status->state = snd_pcm_dshare_state(pcm); ++ status->hw_ptr = *pcm->hw.ptr; /* boundary may be different */ + status->appl_ptr = *pcm->appl.ptr; /* slave PCM doesn't set appl_ptr */ + status->trigger_tstamp = dshare->trigger_tstamp; + status->avail = snd_pcm_mmap_playback_avail(pcm); +diff --git a/src/pcm/pcm_dsnoop.c b/src/pcm/pcm_dsnoop.c +index 2c3b9f43..3f28df99 100644 +--- a/src/pcm/pcm_dsnoop.c ++++ b/src/pcm/pcm_dsnoop.c +@@ -193,6 +193,7 @@ static int snd_pcm_dsnoop_status(snd_pcm_t *pcm, snd_pcm_status_t * status) + snd_pcm_status(dsnoop->spcm, status); + state = snd_pcm_state(dsnoop->spcm); + status->state = state == SND_PCM_STATE_RUNNING ? dsnoop->state : state; ++ status->hw_ptr = *pcm->hw.ptr; /* boundary may be different */ + status->appl_ptr = *pcm->appl.ptr; /* slave PCM doesn't set appl_ptr */ + status->trigger_tstamp = dsnoop->trigger_tstamp; + status->avail = snd_pcm_mmap_capture_avail(pcm); +-- +2.31.1 + + +From a5e11f9a810391777ea7750f04ba66f9c9e624de Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Mon, 21 Jun 2021 14:21:26 +0200 +Subject: [PATCH 07/20] pcm: Move snd_pcm_channel_area_addr() and _step() to + public header + +Used in the rate plugins commonly. + +Signed-off-by: Takashi Iwai +--- + include/pcm.h | 23 +++++++++++++++++++++++ + src/pcm/pcm_local.h | 13 ------------- + 2 files changed, 23 insertions(+), 13 deletions(-) + +diff --git a/include/pcm.h b/include/pcm.h +index e300b951..b5a514fa 100644 +--- a/include/pcm.h ++++ b/include/pcm.h +@@ -1173,6 +1173,29 @@ int snd_pcm_areas_copy_wrap(const snd_pcm_channel_area_t *dst_channels, + snd_pcm_uframes_t frames, + const snd_pcm_format_t format); + ++/** ++ * \brief get the address of the given PCM channel area ++ * \param area PCM channel area ++ * \param offset Offset in frames ++ * ++ * Returns the pointer corresponding to the given offset on the channel area. ++ */ ++static inline void *snd_pcm_channel_area_addr(const snd_pcm_channel_area_t *area, snd_pcm_uframes_t offset) ++{ ++ return (char *)area->addr + (area->first + area->step * offset) / 8; ++} ++ ++/** ++ * \brief get the step size of the given PCM channel area in bytes ++ * \param area PCM channel area ++ * ++ * Returns the step size in bytes from the given channel area. ++ */ ++static inline unsigned int snd_pcm_channel_area_step(const snd_pcm_channel_area_t *area) ++{ ++ return area->step / 8; ++} ++ + /** \} */ + + /** +diff --git a/src/pcm/pcm_local.h b/src/pcm/pcm_local.h +index a63f4be0..6f03365c 100644 +--- a/src/pcm/pcm_local.h ++++ b/src/pcm/pcm_local.h +@@ -632,19 +632,6 @@ static inline snd_pcm_sframes_t snd_pcm_mmap_delay(snd_pcm_t *pcm) + return snd_pcm_mmap_capture_delay(pcm); + } + +-static inline void *snd_pcm_channel_area_addr(const snd_pcm_channel_area_t *area, snd_pcm_uframes_t offset) +-{ +- unsigned int bitofs = area->first + area->step * offset; +- assert(bitofs % 8 == 0); +- return (char *) area->addr + bitofs / 8; +-} +- +-static inline unsigned int snd_pcm_channel_area_step(const snd_pcm_channel_area_t *area) +-{ +- assert(area->step % 8 == 0); +- return area->step / 8; +-} +- + static inline snd_pcm_sframes_t _snd_pcm_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size) + { + /* lock handled in the callback */ +-- +2.31.1 + + +From e0e084659083c2ab75d5c894f24227ea2f67010f Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 21 Jun 2021 15:14:18 +0200 +Subject: [PATCH 08/20] pcm: direct plugins - fix bad memory access when + channel bindings do not match hw + +Fix and cleanup snd_pcm_direct_check_interleave() function. +Add requested / hardware channel check and use goto when the interleaved + +Fixes: https://github.com/alsa-project/alsa-lib/issues/117 +Signed-off-by: Jaroslav Kysela +--- + src/pcm/pcm_direct.c | 40 +++++++++++++++++----------------------- + 1 file changed, 17 insertions(+), 23 deletions(-) + +diff --git a/src/pcm/pcm_direct.c b/src/pcm/pcm_direct.c +index d50503e3..90417b2f 100644 +--- a/src/pcm/pcm_direct.c ++++ b/src/pcm/pcm_direct.c +@@ -1627,43 +1627,37 @@ int snd_pcm_direct_set_timer_params(snd_pcm_direct_t *dmix) + int snd_pcm_direct_check_interleave(snd_pcm_direct_t *dmix, snd_pcm_t *pcm) + { + unsigned int chn, channels; +- int bits, interleaved = 1; ++ int bits; + const snd_pcm_channel_area_t *dst_areas; + const snd_pcm_channel_area_t *src_areas; + + bits = snd_pcm_format_physical_width(pcm->format); + if ((bits % 8) != 0) +- interleaved = 0; ++ goto __nointerleaved; + channels = dmix->channels; ++ if (channels != dmix->spcm->channels) ++ goto __nointerleaved; + dst_areas = snd_pcm_mmap_areas(dmix->spcm); + src_areas = snd_pcm_mmap_areas(pcm); + for (chn = 1; chn < channels; chn++) { +- if (dst_areas[chn-1].addr != dst_areas[chn].addr) { +- interleaved = 0; +- break; +- } +- if (src_areas[chn-1].addr != src_areas[chn].addr) { +- interleaved = 0; +- break; +- } ++ if (dst_areas[chn-1].addr != dst_areas[chn].addr) ++ goto __nointerleaved; ++ if (src_areas[chn-1].addr != src_areas[chn].addr) ++ goto __nointerleaved; + } + for (chn = 0; chn < channels; chn++) { +- if (dmix->bindings && dmix->bindings[chn] != chn) { +- interleaved = 0; +- break; +- } ++ if (dmix->bindings && dmix->bindings[chn] != chn) ++ goto __nointerleaved; + if (dst_areas[chn].first != chn * bits || +- dst_areas[chn].step != channels * bits) { +- interleaved = 0; +- break; +- } ++ dst_areas[chn].step != channels * bits) ++ goto __nointerleaved; + if (src_areas[chn].first != chn * bits || +- src_areas[chn].step != channels * bits) { +- interleaved = 0; +- break; +- } ++ src_areas[chn].step != channels * bits) ++ goto __nointerleaved; + } +- return dmix->interleaved = interleaved; ++ return dmix->interleaved = 1; ++__nointerleaved: ++ return dmix->interleaved = 0; + } + + /* +-- +2.31.1 + + +From ccc14ae897d170156f1c2905ea5d18a3295e7b36 Mon Sep 17 00:00:00 2001 +From: "Tanjeff-N. Moos" +Date: Thu, 17 Jun 2021 10:36:38 +0200 +Subject: [PATCH 09/20] control: Add documentation for snd_ctl_card_* and + friends. + +In this patch series, I added a description about control interface +handling and how control interfaces are identified. + +In addition, I added/improved Doxygen documentation for the +snd_ctl_card_info_t type and related corresponding functions, +e.g. snd_ctl_card_info(). I also documented other card-related like +snd_card_next(). + +Along the way I did minor documentation improvements. + +Signed-off-by: Tanjeff-N. Moos +Signed-off-by: Takashi Iwai +--- + include/control.h | 40 +++++++++- + src/control/cards.c | 56 +++++++++----- + src/control/control.c | 175 +++++++++++++++++++++++++++++++----------- + 3 files changed, 202 insertions(+), 69 deletions(-) + +diff --git a/include/control.h b/include/control.h +index ccf906e2..9ebb4905 100644 +--- a/include/control.h ++++ b/include/control.h +@@ -50,7 +50,32 @@ typedef struct snd_aes_iec958 { + unsigned char dig_subframe[4]; /**< AES/IEC958 subframe bits */ + } snd_aes_iec958_t; + +-/** CTL card info container */ ++/** \brief CTL card info container. ++ * ++ * This type contains meta information about a sound card, such as the index, ++ * name, longname, etc. ++ * ++ * \par Memory management ++ * ++ * Before using a snd_ctl_card_info_t object, it must be allocated using ++ * snd_ctl_card_info_alloca() or snd_ctl_card_info_malloc(). When using the ++ * latter, it must be freed again using snd_ctl_card_info_free(). ++ * ++ * A card info object can be zeroed out using snd_ctl_card_info_clear(). ++ * ++ * A card info object can be copied to another one using ++ * snd_ctl_card_info_copy(). ++ * ++ * \par Obtaining the Information ++ * ++ * To obtain the card information, it must first be opened using ++ * snd_ctl_open(), and a snd_ctl_card_info_t container must be ++ * allocated. Then, the information can be read using ++ * snd_ctl_card_info_get_card(). ++ * ++ * Thereafter, the card properties can be read using the ++ * snd_ctl_card_info_get_*() functions. ++ */ + typedef struct _snd_ctl_card_info snd_ctl_card_info_t; + + /** CTL element identifier container */ +@@ -442,11 +467,20 @@ void snd_ctl_elem_id_set_name(snd_ctl_elem_id_t *obj, const char *val); + void snd_ctl_elem_id_set_index(snd_ctl_elem_id_t *obj, unsigned int val); + + size_t snd_ctl_card_info_sizeof(void); ++ + /** \hideinitializer +- * \brief allocate an invalid #snd_ctl_card_info_t using standard alloca +- * \param ptr returned pointer ++ * \brief Allocate an invalid #snd_ctl_card_info_t on the stack. ++ * ++ * Allocate space for a card info object on the stack. The allocated ++ * memory need not be freed, because it is on the stack. ++ * ++ * See snd_ctl_card_info_t for details. ++ * ++ * \param ptr Pointer to a snd_ctl_elem_value_t pointer. The address ++ * of the allocated space will returned here. + */ + #define snd_ctl_card_info_alloca(ptr) __snd_alloca(ptr, snd_ctl_card_info) ++ + int snd_ctl_card_info_malloc(snd_ctl_card_info_t **ptr); + void snd_ctl_card_info_free(snd_ctl_card_info_t *obj); + void snd_ctl_card_info_clear(snd_ctl_card_info_t *obj); +diff --git a/src/control/cards.c b/src/control/cards.c +index e57457c2..8226c42d 100644 +--- a/src/control/cards.c ++++ b/src/control/cards.c +@@ -77,8 +77,8 @@ static int snd_card_load1(int card) + + /** + * \brief Try to load the driver for a card. +- * \param card Card number. +- * \return 1 if driver is present, zero if driver is not present ++ * \param card Card index. ++ * \return 1 if driver is present, zero if driver is not present. + */ + int snd_card_load(int card) + { +@@ -86,14 +86,24 @@ int snd_card_load(int card) + } + + /** +- * \brief Try to determine the next card. +- * \param rcard pointer to card number +- * \result zero if success, otherwise a negative error code ++ * \brief Iterate over physical sound cards. ++ * ++ * This function takes the index of a physical sound card and sets it to the ++ * index of the next card. If index is -1, it is set to the index of the first ++ * card. After the last card, the index is set to -1. ++ * ++ * For example, if you have 2 sound cards (with index 0 and 1), the index will ++ * be modified as follows: ++ * ++ * - -1 --> 0 ++ * - 0 --> 1 ++ * - 1 --> -1 ++ * ++ * This does not work for virtual sound cards. + * +- * Tries to determine the next card from given card number. +- * If card number is -1, then the first available card is +- * returned. If the result card number is -1, no more cards +- * are available. ++ * \param rcard Index of current card. The index of the next card is stored ++ * here. ++ * \result zero if success, otherwise a negative error code. + */ + int snd_card_next(int *rcard) + { +@@ -114,13 +124,18 @@ int snd_card_next(int *rcard) + } + + /** +- * \brief Convert card string to an integer value. +- * \param string String containing card identifier +- * \return zero if success, otherwise a negative error code ++ * \brief Convert a card string to the card index. + * +- * The accepted format is an integer value in ASCII representation +- * or the card identifier (the id parameter for sound-card drivers). +- * The control device name like /dev/snd/controlC0 is accepted, too. ++ * This works only for physical sound cards, not for virtual cards. ++ * ++ * \param string A string identifying the card. ++ * \return The index of the card. On error, a a negative error code ++ * is returned. ++ * ++ * The accepted formats for "string" are: ++ * - The index of the card (as listed in /proc/asound/cards), given as string ++ * - The ID of the card (as listed in /proc/asound/cards) ++ * - The control device name (like /dev/snd/controlC0) + */ + int snd_card_get_index(const char *string) + { +@@ -163,8 +178,9 @@ int snd_card_get_index(const char *string) + + /** + * \brief Obtain the card name. +- * \param card Card number +- * \param name Result - card name corresponding to card number ++ * ++ * \param card The index of the card. ++ * \param name Result - card name corresponding to card index. + * \result zero if success, otherwise a negative error code + * + * The value returned in name is allocated with strdup and should be +@@ -193,9 +209,9 @@ int snd_card_get_name(int card, char **name) + + /** + * \brief Obtain the card long name. +- * \param card Card number +- * \param name Result - card long name corresponding to card number +- * \result zero if success, otherwise a negative error code ++ * \param card Index of the card. ++ * \param name Result - card long name corresponding to card index. ++ * \result Zero if success, otherwise a negative error code. + * + * The value returned in name is allocated with strdup and should be + * freed when no longer used. +diff --git a/src/control/control.c b/src/control/control.c +index ed986e54..7cf4decb 100644 +--- a/src/control/control.c ++++ b/src/control/control.c +@@ -33,8 +33,50 @@ +

Control interface is designed to access primitive controls. There is + also an interface for notifying about control and structure changes. + ++ + \section control_general_overview General overview + ++In Alsa, there are physical sound cards, such as USB headsets, and ++virtual sound cards, such as "pulse", which represents the PulseAudio ++Sound system. Each sound card offers a control interface, making its ++settings (e.g. volume knobs) available. The complete list of available ++control interfaces can be obtained using snd_device_name_hint(), ++giving -1 as card index and "ctl" as interface type. Each returned ++NAME hint identifies a control interface. ++ ++Sound cards have an ID (a string), an index (an int, sometimes called ++the "card number"), a name, a longname, a mixername and a "components" ++property. The file /proc/asound/cards lists most of these properties ++for physical sound cards. Virtual sound cards are not listed in that ++file. The format is: ++ ++\verbatim ++index [ID ] Driver - name ++ longname ++\endverbatim ++ ++Note that the mixername and components are not listed. ++ ++ ++\subsection control_cards_id Identifying and Opening Control Interfaces ++ ++To work with a control interface, is must be opened first, using ++snd_ctl_open(). This function takes the interface name. ++ ++For physical sound cards, the control interface can be identified ++using the string "hw:" (e.g. `hw:2`). The NAME hint - which is ++"hw:CARD=" - can also be used. Further, its device file (something ++like `/dev/snd/controlC0`) is also acceptable. Either of them can be ++given to snd_ctl_open(). ++ ++For virtual sound cards, the NAME hint is given to snd_ctl_open(). ++ ++The functions snd_card_get_index(), snd_card_get_name() and ++snd_card_get_longname() can be used to find an identifying property ++when another one is already known. ++ ++\section control_elements Elements ++ + In ALSA control feature, each sound card can have control elements. The elements + are managed according to below model. + +@@ -65,7 +107,7 @@ are managed according to below model. + of userspace applications and drivers in kernel. + + +-\section identifying_elements Identifying Elements ++\subsection identifying_elements Identifying Elements + + Each element has the following identifying properties: + +@@ -84,7 +126,7 @@ but in practice this is rare). The numid can change on each boot. + In case of an USB sound card, the numid can also change when it + is reconnected. The short numid is used to reduce the lookup time. + +-\section element_lists Element Lists ++\subsection element_lists Element Lists + + An element list can be used to obtain a list of all elements of the + sound card. The list contains generic information (e.g. how many +@@ -93,7 +135,7 @@ elements the card has), and the identifying properties of the elements + element lists. + + +-\section working_with_elements Working with Elements ++\subsection working_with_elements Working with Elements + + It is possible to obtain information about an element using the + snd_ctl_elem_info_*() functions. For enums, the allowed values can be +@@ -108,7 +150,7 @@ actual values or settings. It is also possible to get and set the ID + values (such as the numid or the name). + + +-\section element_sets Element Sets ++\subsection element_sets Element Sets + + The type of element set is one of integer, integer64, boolean, enumerators, + bytes and IEC958 structure. This indicates the type of value for each member in +@@ -329,10 +371,15 @@ int snd_ctl_subscribe_events(snd_ctl_t *ctl, int subscribe) + + + /** +- * \brief Get card related information +- * \param ctl CTL handle +- * \param info Card info pointer +- * \return 0 on success otherwise a negative error code ++ * \brief Get information about the sound card. ++ * ++ * Obtain information about the sound card previously opened using ++ * snd_ctl_open(). The object "info" must be allocated prior to calling this ++ * function. See snd_ctl_card_info_t for details. ++ * ++ * \param ctl The CTL handle. ++ * \param info The card information is stored here. ++ * \return 0 on success, otherwise a negative error code. + */ + int snd_ctl_card_info(snd_ctl_t *ctl, snd_ctl_card_info_t *info) + { +@@ -1508,11 +1555,13 @@ int _snd_ctl_open_named_child(snd_ctl_t **pctl, const char *name, + #endif + + /** +- * \brief Opens a CTL +- * \param ctlp Returned CTL handle +- * \param name ASCII identifier of the CTL handle +- * \param mode Open mode (see #SND_CTL_NONBLOCK, #SND_CTL_ASYNC) +- * \return 0 on success otherwise a negative error code ++ * \brief Opens a sound card. ++ * ++ * \param ctlp Returned CTL handle. ++ * \param name A string identifying the card (See \ref control_cards_id). ++ * \param mode Open mode (see #SND_CTL_NONBLOCK, #SND_CTL_ASYNC). ++ * ++ * \return 0 on success otherwise a negative error code. + */ + int snd_ctl_open(snd_ctl_t **ctlp, const char *name, int mode) + { +@@ -2027,8 +2076,8 @@ void snd_ctl_elem_id_set_index(snd_ctl_elem_id_t *obj, unsigned int val) + } + + /** +- * \brief get size of #snd_ctl_card_info_t +- * \return size in bytes ++ * \brief get size of #snd_ctl_card_info_t. ++ * \return Size in bytes. + */ + size_t snd_ctl_card_info_sizeof() + { +@@ -2036,9 +2085,16 @@ size_t snd_ctl_card_info_sizeof() + } + + /** +- * \brief allocate an invalid #snd_ctl_card_info_t using standard malloc +- * \param ptr returned pointer +- * \return 0 on success otherwise negative error code ++ * \brief Allocate an invalid #snd_ctl_card_info_t on the heap. ++ * ++ * Allocate space for a card info object on the heap. The allocated memory ++ * must be freed using snd_ctl_card_info_free(). ++ * ++ * See snd_ctl_card_info_t for details. ++ * ++ * \param ptr Pointer to a snd_ctl_card_info_t pointer. The address ++ * of the allocated space will be returned here. ++ * \return 0 on success, otherwise a negative error code. + */ + int snd_ctl_card_info_malloc(snd_ctl_card_info_t **ptr) + { +@@ -2050,8 +2106,10 @@ int snd_ctl_card_info_malloc(snd_ctl_card_info_t **ptr) + } + + /** +- * \brief frees a previously allocated #snd_ctl_card_info_t +- * \param obj pointer to object to free ++ * \brief Free an #snd_ctl_card_info_t previously allocated using ++ * snd_ctl_card_info_malloc(). ++ * ++ * \param obj Pointer to the snd_ctl_card_info_t. + */ + void snd_ctl_card_info_free(snd_ctl_card_info_t *obj) + { +@@ -2059,8 +2117,11 @@ void snd_ctl_card_info_free(snd_ctl_card_info_t *obj) + } + + /** +- * \brief clear given #snd_ctl_card_info_t object +- * \param obj pointer to object to clear ++ * \brief Clear given card info object. ++ * ++ * See snd_ctl_elem_value_t for details. ++ * ++ * \param obj Card info object. + */ + void snd_ctl_card_info_clear(snd_ctl_card_info_t *obj) + { +@@ -2068,9 +2129,10 @@ void snd_ctl_card_info_clear(snd_ctl_card_info_t *obj) + } + + /** +- * \brief copy one #snd_ctl_card_info_t to another +- * \param dst pointer to destination +- * \param src pointer to source ++ * \brief Bitwise copy of a #snd_ctl_card_info_t object. ++ * ++ * \param dst Pointer to destination. ++ * \param src Pointer to source. + */ + void snd_ctl_card_info_copy(snd_ctl_card_info_t *dst, const snd_ctl_card_info_t *src) + { +@@ -2079,9 +2141,12 @@ void snd_ctl_card_info_copy(snd_ctl_card_info_t *dst, const snd_ctl_card_info_t + } + + /** +- * \brief Get card number from a CTL card info +- * \param obj CTL card info +- * \return card number ++ * \brief Get the sound card index from the given info object. ++ * ++ * See snd_ctl_card_info_t for more details. ++ * ++ * \param obj The card info object. ++ * \return Sound card index. + */ + int snd_ctl_card_info_get_card(const snd_ctl_card_info_t *obj) + { +@@ -2090,9 +2155,12 @@ int snd_ctl_card_info_get_card(const snd_ctl_card_info_t *obj) + } + + /** +- * \brief Get card identifier from a CTL card info +- * \param obj CTL card info +- * \return card identifier ++ * \brief Get the sound card ID from the given info object. ++ * ++ * See snd_ctl_card_info_t for more details. ++ * ++ * \param obj The card info object. ++ * \return Sound card ID. + */ + const char *snd_ctl_card_info_get_id(const snd_ctl_card_info_t *obj) + { +@@ -2101,9 +2169,12 @@ const char *snd_ctl_card_info_get_id(const snd_ctl_card_info_t *obj) + } + + /** +- * \brief Get card driver name from a CTL card info +- * \param obj CTL card info +- * \return card driver name ++ * \brief Get the sound card driver from the given info object. ++ * ++ * See snd_ctl_card_info_t for more details. ++ * ++ * \param obj The card info object. ++ * \return The sound card driver. + */ + const char *snd_ctl_card_info_get_driver(const snd_ctl_card_info_t *obj) + { +@@ -2112,9 +2183,12 @@ const char *snd_ctl_card_info_get_driver(const snd_ctl_card_info_t *obj) + } + + /** +- * \brief Get card name from a CTL card info +- * \param obj CTL card info +- * \return card name ++ * \brief Get the sound card name from the given info object. ++ * ++ * See snd_ctl_card_info_t for more details. ++ * ++ * \param obj The card info object. ++ * \return Sound card name. + */ + const char *snd_ctl_card_info_get_name(const snd_ctl_card_info_t *obj) + { +@@ -2123,9 +2197,12 @@ const char *snd_ctl_card_info_get_name(const snd_ctl_card_info_t *obj) + } + + /** +- * \brief Get card long name from a CTL card info +- * \param obj CTL card info +- * \return card long name ++ * \brief Get the sound cards long name from the given info object. ++ * ++ * See snd_ctl_card_info_t for more details. ++ * ++ * \param obj The card info object. ++ * \return Sound cards long name. + */ + const char *snd_ctl_card_info_get_longname(const snd_ctl_card_info_t *obj) + { +@@ -2134,9 +2211,12 @@ const char *snd_ctl_card_info_get_longname(const snd_ctl_card_info_t *obj) + } + + /** +- * \brief Get card mixer name from a CTL card info +- * \param obj CTL card info +- * \return card mixer name ++ * \brief Get the sound card mixer name from the given info object. ++ * ++ * See snd_ctl_card_info_t for more details. ++ * ++ * \param obj The card info object. ++ * \return Sound card mixer name. + */ + const char *snd_ctl_card_info_get_mixername(const snd_ctl_card_info_t *obj) + { +@@ -2145,9 +2225,12 @@ const char *snd_ctl_card_info_get_mixername(const snd_ctl_card_info_t *obj) + } + + /** +- * \brief Get card component list from a CTL card info +- * \param obj CTL card info +- * \return card mixer identifier ++ * \brief Get the sound cards "components" property from the given info object. ++ * ++ * See snd_ctl_card_info_t for more details. ++ * ++ * \param obj The card info object. ++ * \return Sound cards "components" property. + */ + const char *snd_ctl_card_info_get_components(const snd_ctl_card_info_t *obj) + { +-- +2.31.1 + + +From 7ba3f888d07cafbad04391b915db23408c663dad Mon Sep 17 00:00:00 2001 +From: "Tanjeff-N. Moos" +Date: Thu, 17 Jun 2021 10:36:39 +0200 +Subject: [PATCH 10/20] control: Minor documentation fixes. + +Signed-off-by: Tanjeff-N. Moos +Signed-off-by: Takashi Iwai +--- + include/control.h | 9 +++++++-- + src/control/cards.c | 5 ++++- + src/control/control.c | 2 +- + 3 files changed, 12 insertions(+), 4 deletions(-) + +diff --git a/include/control.h b/include/control.h +index 9ebb4905..e386ecec 100644 +--- a/include/control.h ++++ b/include/control.h +@@ -155,7 +155,7 @@ typedef struct _snd_ctl_elem_list snd_ctl_elem_list_t; + /** CTL element info container */ + typedef struct _snd_ctl_elem_info snd_ctl_elem_info_t; + +-/** CTL element value container ++/** CTL element value container. + * + * Contains the value(s) (i.e. members) of a single element. All + * values of a given element are of the same type. +@@ -167,6 +167,11 @@ typedef struct _snd_ctl_elem_info snd_ctl_elem_info_t; + * using the latter, it must be freed again using + * snd_ctl_elem_value_free(). + * ++ * A value object can be zeroed out using snd_ctl_elem_value_clear(). ++ * ++ * A value object can be copied to another one using ++ * snd_ctl_elem_value_copy(). ++ * + * \par Identifier + * + * Then, the ID must be filled. It is sufficient to fill only the +@@ -621,7 +626,7 @@ size_t snd_ctl_elem_value_sizeof(void); + * \brief Allocate an invalid #snd_ctl_elem_value_t on the stack. + * + * Allocate space for a value object on the stack. The allocated +- * memory need not be freed, because is on the stack. ++ * memory need not be freed, because it is on the stack. + * + * See snd_ctl_elem_value_t for details. + * +diff --git a/src/control/cards.c b/src/control/cards.c +index 8226c42d..6145ebcd 100644 +--- a/src/control/cards.c ++++ b/src/control/cards.c +@@ -147,6 +147,7 @@ int snd_card_get_index(const char *string) + return -EINVAL; + if ((isdigit(*string) && *(string + 1) == 0) || + (isdigit(*string) && isdigit(*(string + 1)) && *(string + 2) == 0)) { ++ /* We got an index */ + if (sscanf(string, "%i", &card) != 1) + return -EINVAL; + if (card < 0 || card >= SND_MAX_CARDS) +@@ -156,8 +157,10 @@ int snd_card_get_index(const char *string) + return card; + return err; + } +- if (string[0] == '/') /* device name */ ++ if (string[0] == '/') ++ /* We got a device name */ + return snd_card_load2(string); ++ /* We got in ID */ + for (card = 0; card < SND_MAX_CARDS; card++) { + #ifdef SUPPORT_ALOAD + if (! snd_card_load(card)) +diff --git a/src/control/control.c b/src/control/control.c +index 7cf4decb..91415b51 100644 +--- a/src/control/control.c ++++ b/src/control/control.c +@@ -3127,7 +3127,7 @@ size_t snd_ctl_elem_value_sizeof() + /** + * \brief Allocate an invalid #snd_ctl_elem_value_t on the heap. + * +- * Allocate space for a value object on the head. The allocated memory ++ * Allocate space for a value object on the heap. The allocated memory + * must be freed using snd_ctl_elem_value_free(). + * + * See snd_ctl_elem_value_t for details. +-- +2.31.1 + + +From f4f29d42be8b8ad60ea4c5697374adad4bfe6868 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 28 Jun 2021 12:08:53 +0200 +Subject: [PATCH 11/20] fix build with --disable-ucm + +Link: https://mailman.alsa-project.org/pipermail/alsa-devel/2021-June/186729.html +Reported-by: Michael Forney +Signed-off-by: Jaroslav Kysela +--- + include/local.h | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/include/local.h b/include/local.h +index 4e7d88a0..7cfcec53 100644 +--- a/include/local.h ++++ b/include/local.h +@@ -374,6 +374,8 @@ int _snd_config_load_with_include(snd_config_t *config, snd_input_t *in, + void *INTERNAL(snd_dlopen)(const char *name, int mode, char *errbuf, size_t errbuflen); + #endif + ++#ifdef BUILD_UCM ++ + const char *uc_mgr_alibcfg_by_device(snd_config_t **config, const char *name); + + static inline int _snd_is_ucm_device(const char *name) +@@ -381,4 +383,12 @@ static inline int _snd_is_ucm_device(const char *name) + return name && name[0] == '_' && name[1] == 'u' && name[2] == 'c' && name[3] == 'm'; + } + ++#else ++ ++static inline const char *uc_mgr_alibcfg_by_device(snd_config_t **config, const char *name) { return NULL; } ++static inline int _snd_is_ucm_device(const char *name) { return 0; } ++ ++ ++#endif ++ + #endif +-- +2.31.1 + + +From 1a1f0fb244c477c430e156da878475ef57d198f9 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 28 Jun 2021 12:11:54 +0200 +Subject: [PATCH 12/20] pcm: rate - fix some gcc warnings + +Signed-off-by: Jaroslav Kysela +--- + src/pcm/pcm_rate.c | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c +index 13111d29..c45895a9 100644 +--- a/src/pcm/pcm_rate.c ++++ b/src/pcm/pcm_rate.c +@@ -82,12 +82,12 @@ struct _snd_pcm_rate { + + /* allocate a channel area and a temporary buffer for the given size */ + static snd_pcm_channel_area_t * +-rate_alloc_tmp_buf(snd_pcm_rate_t *rate, snd_pcm_format_t format, ++rate_alloc_tmp_buf(snd_pcm_format_t format, + unsigned int channels, unsigned int frames) + { + snd_pcm_channel_area_t *ap; + int width = snd_pcm_format_physical_width(format); +- int i; ++ unsigned int i; + + ap = malloc(sizeof(*ap) * channels); + if (!ap) +@@ -354,7 +354,7 @@ static int snd_pcm_rate_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params) + snd_pcm_rate_t *rate = pcm->private_data; + snd_pcm_t *slave = rate->gen.slave; + snd_pcm_rate_side_info_t *sinfo, *cinfo; +- unsigned int channels, cwidth, swidth, chn, acc; ++ unsigned int channels, acc; + int need_src_buf, need_dst_buf; + int err = snd_pcm_hw_params_slave(pcm, params, + snd_pcm_rate_hw_refine_cchange, +@@ -401,9 +401,9 @@ static int snd_pcm_rate_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params) + return -EBUSY; + } + +- rate->pareas = rate_alloc_tmp_buf(rate, cinfo->format, channels, ++ rate->pareas = rate_alloc_tmp_buf(cinfo->format, channels, + cinfo->period_size); +- rate->sareas = rate_alloc_tmp_buf(rate, sinfo->format, channels, ++ rate->sareas = rate_alloc_tmp_buf(sinfo->format, channels, + sinfo->period_size); + if (!rate->pareas || !rate->sareas) { + err = -ENOMEM; +@@ -442,7 +442,7 @@ static int snd_pcm_rate_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params) + rate->src_conv_idx = + snd_pcm_linear_convert_index(rate->orig_in_format, + rate->info.in.format); +- rate->src_buf = rate_alloc_tmp_buf(rate, rate->info.in.format, ++ rate->src_buf = rate_alloc_tmp_buf(rate->info.in.format, + channels, rate->info.in.period_size); + if (!rate->src_buf) { + err = -ENOMEM; +@@ -454,7 +454,7 @@ static int snd_pcm_rate_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params) + rate->dst_conv_idx = + snd_pcm_linear_convert_index(rate->info.out.format, + rate->orig_out_format); +- rate->dst_buf = rate_alloc_tmp_buf(rate, rate->info.out.format, ++ rate->dst_buf = rate_alloc_tmp_buf(rate->info.out.format, + channels, rate->info.out.period_size); + if (!rate->dst_buf) { + err = -ENOMEM; +-- +2.31.1 + + +From e47c11822d6b459a9b3704b3ee6a4a5c9a1b85be Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 29 Jun 2021 18:02:27 +0200 +Subject: [PATCH 13/20] control: remap - assign right name to the child handle + for no-op + +Fixes: https://github.com/alsa-project/alsa-utils/issues/100 +Signed-off-by: Jaroslav Kysela +--- + src/control/control_remap.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/control/control_remap.c b/src/control/control_remap.c +index a85c1725..81524014 100644 +--- a/src/control/control_remap.c ++++ b/src/control/control_remap.c +@@ -1173,6 +1173,10 @@ int snd_ctl_remap_open(snd_ctl_t **handlep, const char *name, snd_config_t *rema + /* no-op check, remove the plugin */ + if (priv->map_items == 0 && priv->remap_items == 0) { + remap_free(priv); ++ free(child->name); ++ child->name = name ? strdup(name) : NULL; ++ if (name && !child->name) ++ return -ENOMEM; + *handlep = child; + return 0; + } +-- +2.31.1 + + +From 23a191a82c693456e61431ab699cddc1e5782a26 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 29 Jun 2021 19:31:28 +0200 +Subject: [PATCH 14/20] control: remap - assign right name to the child handle + for no-op (2nd case) + +Fixes: https://github.com/alsa-project/alsa-utils/issues/100 +Signed-off-by: Jaroslav Kysela +--- + src/control/control_remap.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/src/control/control_remap.c b/src/control/control_remap.c +index 81524014..4914f960 100644 +--- a/src/control/control_remap.c ++++ b/src/control/control_remap.c +@@ -1154,6 +1154,10 @@ int snd_ctl_remap_open(snd_ctl_t **handlep, const char *name, snd_config_t *rema + snd_ctl_t *ctl; + int result, err; + ++ /* no-op, remove the plugin */ ++ if (!remap && !map) ++ goto _noop; ++ + priv = calloc(1, sizeof(*priv)); + if (priv == NULL) + return -ENOMEM; +@@ -1173,6 +1177,7 @@ int snd_ctl_remap_open(snd_ctl_t **handlep, const char *name, snd_config_t *rema + /* no-op check, remove the plugin */ + if (priv->map_items == 0 && priv->remap_items == 0) { + remap_free(priv); ++ _noop: + free(child->name); + child->name = name ? strdup(name) : NULL; + if (name && !child->name) +@@ -1316,11 +1321,6 @@ int _snd_ctl_remap_open(snd_ctl_t **handlep, char *name, snd_config_t *root, snd + err = _snd_ctl_open_child(&cctl, root, child, mode, conf); + if (err < 0) + return err; +- /* no-op, remove the plugin */ +- if (!remap && !map) { +- *handlep = cctl; +- return 0; +- } + err = snd_ctl_remap_open(handlep, name, remap, map, cctl, mode); + if (err < 0) + snd_ctl_close(cctl); +-- +2.31.1 + + +From 7d40a76ef5494e08af00fa4e7bfefbd43aba4827 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 31 Aug 2021 09:25:12 +0200 +Subject: [PATCH 19/20] ucm: avoid zero card instance number + +Signed-off-by: Jaroslav Kysela +--- + src/ucm/utils.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/ucm/utils.c b/src/ucm/utils.c +index f3a8c9ba..10b21c34 100644 +--- a/src/ucm/utils.c ++++ b/src/ucm/utils.c +@@ -780,6 +780,9 @@ int uc_mgr_card_open(snd_use_case_mgr_t *uc_mgr) + while (uc_mgr_card_find(ucm_card_assign)) { + ucm_card_assign++; + ucm_card_assign &= 0xffff; ++ /* avoid zero card instance number */ ++ if (ucm_card_assign == 0) ++ ucm_card_assign++; + if (ucm_card_assign == prev) { + pthread_mutex_unlock(&ucm_cards_mutex); + return -ENOMEM; +-- +2.31.1 + + +From 4a52ae4c329ae17117375a4b85b80f37994a4044 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 31 Aug 2021 09:40:42 +0200 +Subject: [PATCH 20/20] ucm: fix the parsing of the hexadecimal prefix + +The safe_strtol() function use strtol() which expects +to have the '0x' prefix for the hexadecimal number (when +base argument is zero). + +BugLink: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1553 +Signed-off-by: Jaroslav Kysela +--- + src/ucm/utils.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/src/ucm/utils.c b/src/ucm/utils.c +index 10b21c34..2fbc4c8c 100644 +--- a/src/ucm/utils.c ++++ b/src/ucm/utils.c +@@ -811,7 +811,7 @@ void uc_mgr_card_close(snd_use_case_mgr_t *uc_mgr) + */ + const char *uc_mgr_alibcfg_by_device(snd_config_t **top, const char *name) + { +- char buf[5]; ++ char buf[7]; + long card_num; + snd_config_t *config; + snd_use_case_mgr_t *uc_mgr; +@@ -819,8 +819,10 @@ const char *uc_mgr_alibcfg_by_device(snd_config_t **top, const char *name) + + if (strncmp(name, "_ucm", 4) || strlen(name) < 12 || name[8] != '.') + return NULL; +- strncpy(buf, name + 4, 4); +- buf[4] = '\0'; ++ buf[0] = '0'; ++ buf[1] = 'x'; ++ strncpy(buf + 2, name + 4, 4); ++ buf[6] = '\0'; + err = safe_strtol(buf, &card_num); + if (err < 0 || card_num < 0 || card_num > 0xffff) + return NULL; +-- +2.31.1 + diff --git a/alsa-lib.spec b/alsa-lib.spec index eff5b83..fe19b44 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 2%{?prever_dot}%{?dist} +Release: 3%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Tue Aug 31 2021 Jaroslav Kysela - 1.2.5.1-3 +- add UCM related fixes + * Wed Jul 21 2021 Fedora Release Engineering - 1.2.5.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild From 4f7869e8258c9827aeaa0bf064eda0b08c2e3ebe Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Sat, 13 Nov 2021 12:20:58 +0000 Subject: [PATCH 071/120] Add Rockchip ES8316 support (from upstreama) --- alsa-lib.spec | 5 +- alsa-ucm-conf.patch | 147 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 151 insertions(+), 1 deletion(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index fe19b44..5493e3c 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 3%{?prever_dot}%{?dist} +Release: 4%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Sat Nov 13 2021 Peter Robinson - 1.2.5.1-4 +- Add Rockchip ES8316 support + * Tue Aug 31 2021 Jaroslav Kysela - 1.2.5.1-3 - add UCM related fixes diff --git a/alsa-ucm-conf.patch b/alsa-ucm-conf.patch index e69de29..0ceffd8 100644 --- a/alsa-ucm-conf.patch +++ b/alsa-ucm-conf.patch @@ -0,0 +1,147 @@ +From 85eea19783cfccaccd859e303fda62adb63c219d Mon Sep 17 00:00:00 2001 +From: Jian-Hong Pan +Date: Tue, 7 Sep 2021 11:38:14 +0800 +Subject: [PATCH] ucm2: Add UCM support for rockchip_es8316 on Pinebook Pro + +Add UCM config files for Pinebook Pro's audio. The config files are +transformed and tuned from Manjaro ARM's packages: +* pinebookpro-post-install's asound.state [1] +* pinebookpro-audio's audio_jack_plugged_in.sh [2] + +By the way, with these config files, the Speaker and Headphones will be +switched according to the (un)plugged state automatically. + +[1] https://gitlab.manjaro.org/manjaro-arm/packages/community/pinebookpro-post-install/-/blob/4b4206c57b21044bf9c00848bd1f8b6f710d19eb/asound.state +[2] https://gitlab.manjaro.org/manjaro-arm/packages/community/pinebookpro-audio/-/blob/1f567db09495acc3beb5405c9ef85c3c07b86785/audio_jack_plugged_in.sh + +Fixes: https://github.com/alsa-project/alsa-ucm-conf/issues/110 +Fixes: https://github.com/alsa-project/alsa-ucm-conf/pull/112 +Signed-off-by: Jian-Hong Pan +Signed-off-by: Jaroslav Kysela +--- + ucm2/Rockchip/es8316/HiFi.conf | 66 +++++++++++++++++++ + ucm2/Rockchip/es8316/es8316.conf | 29 ++++++++ + .../rockchip_es8316/rockchip_es8316.conf | 1 + + 3 files changed, 96 insertions(+) + create mode 100644 ucm2/Rockchip/es8316/HiFi.conf + create mode 100644 ucm2/Rockchip/es8316/es8316.conf + create mode 120000 ucm2/conf.d/rockchip_es8316/rockchip_es8316.conf + +diff --git a/ucm2/Rockchip/es8316/HiFi.conf b/ucm2/Rockchip/es8316/HiFi.conf +new file mode 100644 +index 0000000..2124ded +--- /dev/null ++++ b/ucm2/Rockchip/es8316/HiFi.conf +@@ -0,0 +1,66 @@ ++# Reference: ++# https://gitlab.manjaro.org/manjaro-arm/packages/community/pinebookpro-post-install/-/blob/4b4206c57b21044bf9c00848bd1f8b6f710d19eb/asound.state ++# https://gitlab.manjaro.org/manjaro-arm/packages/community/pinebookpro-audio/-/blob/1f567db09495acc3beb5405c9ef85c3c07b86785/audio_jack_plugged_in.sh ++ ++SectionDevice."Speaker" { ++ Comment "Speaker" ++ ++ ConflictingDevice [ ++ "Headphones" ++ ] ++ ++ EnableSequence [ ++ cset "name='Playback Polarity' 'R Invert'" ++ cset "name='Speaker Switch' on" ++ ] ++ ++ DisableSequence [ ++ cset "name='Speaker Switch' off" ++ ] ++ ++ Value { ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId}" ++ PlaybackMixerElem "Headphone Mixer" ++ PlaybackMasterElem "DAC" ++ } ++} ++ ++SectionDevice."Mic" { ++ Comment "Internal Microphone" ++ ++ EnableSequence [ ++ cset "name='Differential Mux' lin1-rin1" ++ ] ++ ++ Value { ++ CapturePriority 100 ++ CapturePCM "hw:${CardId}" ++ CaptureMixerElem "ADC PGA Gain" ++ CaptureMasterElem "ADC" ++ } ++} ++ ++SectionDevice."Headphones" { ++ Comment "Headphones" ++ ++ ConflictingDevice [ ++ "Speaker" ++ ] ++ ++ EnableSequence [ ++ cset "name='Playback Polarity' 'Normal'" ++ ] ++ DisableSequence [ ++ cset "name='Playback Polarity' 'R Invert'" ++ ] ++ ++ Value { ++ PlaybackPriority 200 ++ PlaybackPCM "hw:${CardId}" ++ PlaybackMixerElem "Headphone Mixer" ++ PlaybackMasterElem "DAC" ++ JackControl "Headphones Jack" ++ JackHWMute "Speaker" ++ } ++} +diff --git a/ucm2/Rockchip/es8316/es8316.conf b/ucm2/Rockchip/es8316/es8316.conf +new file mode 100644 +index 0000000..62044e6 +--- /dev/null ++++ b/ucm2/Rockchip/es8316/es8316.conf +@@ -0,0 +1,29 @@ ++Syntax 3 ++ ++SectionUseCase."HiFi" { ++ File "/Rockchip/es8316/HiFi.conf" ++ Comment "Play HiFi quality Music" ++} ++ ++BootSequence [ ++ # Disable all outputs ++ cset "name='Speaker Switch' off" ++ ++ # Set HP vol to 0 dB (3/3) ++ cset "name='Headphone Playback Volume' 3" ++ # Set HP mixer vol to 0 dB ++ cset "name='Headphone Mixer Volume' 11" ++ # Set DAC vol to 0 dB (192/192) ++ cset "name='DAC Playback Volume' 192" ++ ++ # Disable Auto Level Control ++ cset "name='ALC Capture Switch' off" ++ # Set ADC vol to 0 dB (192/192) ++ cset "name='ADC Capture Volume' 192" ++ # Set Mic amplifier to +16 dB ++ cset "name='ADC PGA Gain Volume' 7" ++ ++ # Setup muxes / switches ++ cset "name='Left Headphone Mixer Left DAC Switch' on" ++ cset "name='Right Headphone Mixer Right DAC Switch' on" ++] +diff --git a/ucm2/conf.d/rockchip_es8316/rockchip_es8316.conf b/ucm2/conf.d/rockchip_es8316/rockchip_es8316.conf +new file mode 120000 +index 0000000..6d1864f +--- /dev/null ++++ b/ucm2/conf.d/rockchip_es8316/rockchip_es8316.conf +@@ -0,0 +1 @@ ++../../Rockchip/es8316/es8316.conf +\ No newline at end of file +-- +2.33.1 + From f42322213844fd97c4daf83ab60145a3709a586d Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 6 Dec 2021 13:17:48 +0100 Subject: [PATCH 072/120] update to 1.2.6 --- alsa-git.patch | 1916 ------------------------------------------- alsa-lib.spec | 9 +- alsa-ucm-conf.patch | 147 ---- sources | 4 +- 4 files changed, 8 insertions(+), 2068 deletions(-) diff --git a/alsa-git.patch b/alsa-git.patch index f88de1b..e69de29 100644 --- a/alsa-git.patch +++ b/alsa-git.patch @@ -1,1916 +0,0 @@ -From 81e7923fbfad45b2f353a4d6e3053af51f5f7d0b Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 15 Jun 2021 23:21:42 +0200 -Subject: [PATCH 01/20] control: empty - fix the static build - -Reported-by: Jan Palus -Fixes: https://github.com/alsa-project/alsa-lib/issues/157 -Signed-off-by: Jaroslav Kysela ---- - src/control/control_empty.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/control/control_empty.c b/src/control/control_empty.c -index 49d1026c..c9b048c1 100644 ---- a/src/control/control_empty.c -+++ b/src/control/control_empty.c -@@ -30,7 +30,7 @@ - - #ifndef PIC - /* entry for static linking */ --const char *_snd_module_ctl_empty = ""; -+const char *_snd_module_control_empty = ""; - #endif - - /*! \page control_plugins --- -2.31.1 - - -From 5089358aa99d698bd846b05c1890a09613d740b3 Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Thu, 17 Jun 2021 10:20:25 +0200 -Subject: [PATCH 02/20] pcm: rate: Refactoring temporary buffer allocations - -Introduce common helpers to allocate and release the temporary buffers -and the associated snd_pcm_channel. Now two allocated objects are -used instead of one malloc to be split. - -Also, change the snd_pcm_channel set up to be in interleaved mode. -This will be necessary in the following change in the rate plugin. - -Signed-off-by: Takashi Iwai ---- - src/pcm/pcm_rate.c | 80 ++++++++++++++++++++++++++++------------------ - 1 file changed, 49 insertions(+), 31 deletions(-) - -diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c -index 770aafea..1e996134 100644 ---- a/src/pcm/pcm_rate.c -+++ b/src/pcm/pcm_rate.c -@@ -76,6 +76,45 @@ struct _snd_pcm_rate { - - #endif /* DOC_HIDDEN */ - -+/* allocate a channel area and a temporary buffer for the given size */ -+static snd_pcm_channel_area_t * -+rate_alloc_tmp_buf(snd_pcm_rate_t *rate, snd_pcm_format_t format, -+ unsigned int channels, unsigned int frames) -+{ -+ snd_pcm_channel_area_t *ap; -+ int width = snd_pcm_format_physical_width(format); -+ int i; -+ -+ ap = malloc(sizeof(*ap) * channels); -+ if (!ap) -+ return NULL; -+ ap->addr = malloc(frames * channels * width / 8); -+ if (!ap->addr) { -+ free(ap); -+ return NULL; -+ } -+ -+ /* set up in interleaved format */ -+ for (i = 0; i < channels; i++) { -+ ap[i].addr = ap[0].addr + (i * width) / 8; -+ ap[i].first = 0; -+ ap[i].step = width * channels; -+ } -+ -+ return ap; -+} -+ -+static void rate_free_tmp_buf(snd_pcm_channel_area_t **ptr) -+{ -+ snd_pcm_channel_area_t *c = *ptr; -+ -+ if (c) { -+ free(c->addr); -+ free(c); -+ *ptr = NULL; -+ } -+} -+ - static int snd_pcm_rate_hw_refine_cprepare(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params) - { - snd_pcm_rate_t *rate = pcm->private_data; -@@ -286,28 +325,13 @@ static int snd_pcm_rate_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params) - if (err < 0) - return err; - -- rate->pareas = malloc(2 * channels * sizeof(*rate->pareas)); -- if (rate->pareas == NULL) -+ rate->pareas = rate_alloc_tmp_buf(rate, cinfo->format, channels, -+ cinfo->period_size); -+ rate->sareas = rate_alloc_tmp_buf(rate, sinfo->format, channels, -+ sinfo->period_size); -+ if (!rate->pareas || !rate->sareas) - goto error; - -- cwidth = snd_pcm_format_physical_width(cinfo->format); -- swidth = snd_pcm_format_physical_width(sinfo->format); -- rate->pareas[0].addr = malloc(((cwidth * channels * cinfo->period_size) / 8) + -- ((swidth * channels * sinfo->period_size) / 8)); -- if (rate->pareas[0].addr == NULL) -- goto error; -- -- rate->sareas = rate->pareas + channels; -- rate->sareas[0].addr = (char *)rate->pareas[0].addr + ((cwidth * channels * cinfo->period_size) / 8); -- for (chn = 0; chn < channels; chn++) { -- rate->pareas[chn].addr = (char *)rate->pareas[0].addr + (cwidth * chn * cinfo->period_size) / 8; -- rate->pareas[chn].first = 0; -- rate->pareas[chn].step = cwidth; -- rate->sareas[chn].addr = (char *)rate->sareas[0].addr + (swidth * chn * sinfo->period_size) / 8; -- rate->sareas[chn].first = 0; -- rate->sareas[chn].step = swidth; -- } -- - if (rate->ops.convert_s16) { - rate->get_idx = snd_pcm_linear_get_index(rate->info.in.format, SND_PCM_FORMAT_S16); - rate->put_idx = snd_pcm_linear_put_index(SND_PCM_FORMAT_S16, rate->info.out.format); -@@ -322,11 +346,8 @@ static int snd_pcm_rate_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params) - return 0; - - error: -- if (rate->pareas) { -- free(rate->pareas[0].addr); -- free(rate->pareas); -- rate->pareas = NULL; -- } -+ rate_free_tmp_buf(&rate->pareas); -+ rate_free_tmp_buf(&rate->sareas); - if (rate->ops.free) - rate->ops.free(rate->obj); - return -ENOMEM; -@@ -335,12 +356,9 @@ static int snd_pcm_rate_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params) - static int snd_pcm_rate_hw_free(snd_pcm_t *pcm) - { - snd_pcm_rate_t *rate = pcm->private_data; -- if (rate->pareas) { -- free(rate->pareas[0].addr); -- free(rate->pareas); -- rate->pareas = NULL; -- rate->sareas = NULL; -- } -+ -+ rate_free_tmp_buf(&rate->pareas); -+ rate_free_tmp_buf(&rate->sareas); - if (rate->ops.free) - rate->ops.free(rate->obj); - free(rate->src_buf); --- -2.31.1 - - -From 119d9c1678b1193f8b969a6483cae1f7bf95e609 Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Thu, 17 Jun 2021 10:03:17 +0200 -Subject: [PATCH 03/20] pcm: rate: Improve the support multiple formats - -This patch extends the PCM rate plugin for allowing its converter -plugin to deal with multiple formats. Currently, the converter plugin -is allowed to take different formats only when convert callback is -defined. And for this way (so far only the standard linear rate -plugin does), all linear formats have to be handled, and it's -cumbersome. - -OTOH, most other rate plugins are implemented with convert_s16 -callback, which accepts only S16 format. This is often not ideal -because many converter engines can handle 32bit formats. Also, the -target format is often 32bit format, hence this would require -additional conversion even if the converter engine can output 32bit -natively. - -In this patch, for addressing the problems above, the rate plugin API -is extended in the following way: - -- The new get_supported_formats callback is added; this stores the bit - masks of the supported input and output formats, as well as the - behavior flags. Currently only linear formats are allowed. -- When the plugin accepts only the interleaved stream, set - SND_PCM_RATE_FLAG_INTERLEAVED flag bit. Otherwise the code has to - handle snd_pcm_channel_area at each call. -- When both input and output formats have to be identical, pass - SND_PCM_RATE_FLAG_SYNC_FORMATS flag bit. -- When the converter wants to process different formats, use convert - callback instead of convert_s16. You can put both in the ops for - compatibility, too. - The input and output formats are found in the info argument of init - callback. -- Now the PCM rate plugin core will skip the temporary buffer - allocation and conversions for pre- and post-process if not needed - (i.e. matching with the requested input or output format). - -The rate plugin API version is bumped to 0x010003. - -Signed-off-by: Takashi Iwai ---- - include/pcm_rate.h | 36 ++++- - src/pcm/pcm_rate.c | 358 +++++++++++++++++++++++++++------------------ - 2 files changed, 251 insertions(+), 143 deletions(-) - -diff --git a/include/pcm_rate.h b/include/pcm_rate.h -index 4171fb9d..48473ed4 100644 ---- a/include/pcm_rate.h -+++ b/include/pcm_rate.h -@@ -38,7 +38,7 @@ extern "C" { - /** - * Protocol version - */ --#define SND_PCM_RATE_PLUGIN_VERSION 0x010002 -+#define SND_PCM_RATE_PLUGIN_VERSION 0x010003 - - /** hw_params information for a single side */ - typedef struct snd_pcm_rate_side_info { -@@ -55,6 +55,11 @@ typedef struct snd_pcm_rate_info { - unsigned int channels; - } snd_pcm_rate_info_t; - -+enum { -+ SND_PCM_RATE_FLAG_INTERLEAVED = (1U << 0), /** only interleaved format */ -+ SND_PCM_RATE_FLAG_SYNC_FORMATS = (1U << 1), /** both input and output formats have to be identical */ -+}; -+ - /** Callback table of rate-converter */ - typedef struct snd_pcm_rate_ops { - /** -@@ -114,6 +119,13 @@ typedef struct snd_pcm_rate_ops { - * new ops since version 0x010002 - */ - void (*dump)(void *obj, snd_output_t *out); -+ /** -+ * get the supported input and output formats (optional); -+ * new ops since version 0x010003 -+ */ -+ int (*get_supported_formats)(void *obj, uint64_t *in_formats, -+ uint64_t *out_formats, -+ unsigned int *flags); - } snd_pcm_rate_ops_t; - - /** open function type */ -@@ -147,6 +159,28 @@ typedef struct snd_pcm_rate_old_ops { - snd_pcm_uframes_t (*input_frames)(void *obj, snd_pcm_uframes_t frames); - snd_pcm_uframes_t (*output_frames)(void *obj, snd_pcm_uframes_t frames); - } snd_pcm_rate_old_ops_t; -+ -+/* old rate_ops for protocol version 0x010002 */ -+typedef struct snd_pcm_rate_v2_ops { -+ void (*close)(void *obj); -+ int (*init)(void *obj, snd_pcm_rate_info_t *info); -+ void (*free)(void *obj); -+ void (*reset)(void *obj); -+ int (*adjust_pitch)(void *obj, snd_pcm_rate_info_t *info); -+ void (*convert)(void *obj, -+ const snd_pcm_channel_area_t *dst_areas, -+ snd_pcm_uframes_t dst_offset, unsigned int dst_frames, -+ const snd_pcm_channel_area_t *src_areas, -+ snd_pcm_uframes_t src_offset, unsigned int src_frames); -+ void (*convert_s16)(void *obj, int16_t *dst, unsigned int dst_frames, -+ const int16_t *src, unsigned int src_frames); -+ snd_pcm_uframes_t (*input_frames)(void *obj, snd_pcm_uframes_t frames); -+ snd_pcm_uframes_t (*output_frames)(void *obj, snd_pcm_uframes_t frames); -+ unsigned int version; -+ int (*get_supported_rates)(void *obj, unsigned int *rate_min, -+ unsigned int *rate_max); -+ void (*dump)(void *obj, snd_output_t *out); -+} snd_pcm_rate_v2_ops_t; - #endif - - #ifdef __cplusplus -diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c -index 1e996134..13111d29 100644 ---- a/src/pcm/pcm_rate.c -+++ b/src/pcm/pcm_rate.c -@@ -62,18 +62,22 @@ struct _snd_pcm_rate { - void *open_func; - void *obj; - snd_pcm_rate_ops_t ops; -- unsigned int get_idx; -- unsigned int put_idx; -- int16_t *src_buf; -- int16_t *dst_buf; -+ unsigned int src_conv_idx; -+ unsigned int dst_conv_idx; -+ snd_pcm_channel_area_t *src_buf; -+ snd_pcm_channel_area_t *dst_buf; - int start_pending; /* start is triggered but not commited to slave */ - snd_htimestamp_t trigger_tstamp; - unsigned int plugin_version; - unsigned int rate_min, rate_max; -+ snd_pcm_format_t orig_in_format; -+ snd_pcm_format_t orig_out_format; -+ uint64_t in_formats; -+ uint64_t out_formats; -+ unsigned int format_flags; - }; - - #define SND_PCM_RATE_PLUGIN_VERSION_OLD 0x010001 /* old rate plugin */ -- - #endif /* DOC_HIDDEN */ - - /* allocate a channel area and a temporary buffer for the given size */ -@@ -274,12 +278,84 @@ static int snd_pcm_rate_hw_refine(snd_pcm_t *pcm, - snd_pcm_generic_hw_refine); - } - -+/* evaluate the best matching available format to the given format */ -+static int get_best_format(uint64_t mask, snd_pcm_format_t orig) -+{ -+ int pwidth = snd_pcm_format_physical_width(orig); -+ int width = snd_pcm_format_width(orig); -+ int signd = snd_pcm_format_signed(orig); -+ int best_score = -1; -+ int match = -1; -+ int f, score; -+ -+ for (f = 0; f <= SND_PCM_FORMAT_LAST; f++) { -+ if (!(mask & (1ULL << f))) -+ continue; -+ score = 0; -+ if (snd_pcm_format_linear(f)) { -+ if (snd_pcm_format_physical_width(f) == pwidth) -+ score++; -+ if (snd_pcm_format_physical_width(f) >= pwidth) -+ score++; -+ if (snd_pcm_format_width(f) == width) -+ score++; -+ if (snd_pcm_format_signed(f) == signd) -+ score++; -+ } -+ if (score > best_score) { -+ match = f; -+ best_score = score; -+ } -+ } -+ -+ return match; -+} -+ -+/* set up the input and output formats from the available lists */ -+static int choose_preferred_format(snd_pcm_rate_t *rate) -+{ -+ uint64_t in_mask = rate->in_formats; -+ uint64_t out_mask = rate->out_formats; -+ int in, out; -+ -+ if (!in_mask || !out_mask) -+ return 0; -+ -+ if (rate->orig_in_format == rate->orig_out_format) -+ if (in_mask & out_mask & (1ULL << rate->orig_in_format)) -+ return 0; /* nothing changed */ -+ -+ repeat: -+ in = get_best_format(in_mask, rate->orig_in_format); -+ out = get_best_format(out_mask, rate->orig_out_format); -+ if (in < 0 || out < 0) -+ return -ENOENT; -+ -+ if ((rate->format_flags & SND_PCM_RATE_FLAG_SYNC_FORMATS) && -+ in != out) { -+ if (out_mask & (1ULL << in)) -+ out = in; -+ else if (in_mask & (1ULL << out)) -+ in = out; -+ else { -+ in_mask &= ~(1ULL << in); -+ out_mask &= ~(1ULL << out); -+ goto repeat; -+ } -+ } -+ -+ rate->info.in.format = in; -+ rate->info.out.format = out; -+ return 0; -+} -+ - static int snd_pcm_rate_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params) - { - snd_pcm_rate_t *rate = pcm->private_data; - snd_pcm_t *slave = rate->gen.slave; - snd_pcm_rate_side_info_t *sinfo, *cinfo; -- unsigned int channels, cwidth, swidth, chn; -+ unsigned int channels, cwidth, swidth, chn, acc; -+ int need_src_buf, need_dst_buf; - int err = snd_pcm_hw_params_slave(pcm, params, - snd_pcm_rate_hw_refine_cchange, - snd_pcm_rate_hw_refine_sprepare, -@@ -308,6 +384,9 @@ static int snd_pcm_rate_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params) - if (err < 0) - return err; - err = INTERNAL(snd_pcm_hw_params_get_channels)(params, &channels); -+ if (err < 0) -+ return err; -+ err = INTERNAL(snd_pcm_hw_params_get_access)(params, &acc); - if (err < 0) - return err; - -@@ -321,36 +400,80 @@ static int snd_pcm_rate_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params) - SNDMSG("rate plugin already in use"); - return -EBUSY; - } -- err = rate->ops.init(rate->obj, &rate->info); -- if (err < 0) -- return err; - - rate->pareas = rate_alloc_tmp_buf(rate, cinfo->format, channels, - cinfo->period_size); - rate->sareas = rate_alloc_tmp_buf(rate, sinfo->format, channels, - sinfo->period_size); -- if (!rate->pareas || !rate->sareas) -- goto error; -- -- if (rate->ops.convert_s16) { -- rate->get_idx = snd_pcm_linear_get_index(rate->info.in.format, SND_PCM_FORMAT_S16); -- rate->put_idx = snd_pcm_linear_put_index(SND_PCM_FORMAT_S16, rate->info.out.format); -- free(rate->src_buf); -- rate->src_buf = malloc(channels * rate->info.in.period_size * 2); -- free(rate->dst_buf); -- rate->dst_buf = malloc(channels * rate->info.out.period_size * 2); -- if (! rate->src_buf || ! rate->dst_buf) -+ if (!rate->pareas || !rate->sareas) { -+ err = -ENOMEM; -+ goto error_pareas; -+ } -+ -+ rate->orig_in_format = rate->info.in.format; -+ rate->orig_out_format = rate->info.out.format; -+ if (choose_preferred_format(rate) < 0) { -+ SNDERR("No matching format in rate plugin"); -+ err = -EINVAL; -+ goto error_pareas; -+ } -+ -+ err = rate->ops.init(rate->obj, &rate->info); -+ if (err < 0) -+ goto error_init; -+ -+ rate_free_tmp_buf(&rate->src_buf); -+ rate_free_tmp_buf(&rate->dst_buf); -+ -+ need_src_buf = need_dst_buf = 0; -+ -+ if ((rate->format_flags & SND_PCM_RATE_FLAG_INTERLEAVED) && -+ !(acc == SND_PCM_ACCESS_MMAP_INTERLEAVED || -+ acc == SND_PCM_ACCESS_RW_INTERLEAVED)) { -+ need_src_buf = need_dst_buf = 1; -+ } else { -+ if (rate->orig_in_format != rate->info.in.format) -+ need_src_buf = 1; -+ if (rate->orig_out_format != rate->info.out.format) -+ need_dst_buf = 1; -+ } -+ -+ if (need_src_buf) { -+ rate->src_conv_idx = -+ snd_pcm_linear_convert_index(rate->orig_in_format, -+ rate->info.in.format); -+ rate->src_buf = rate_alloc_tmp_buf(rate, rate->info.in.format, -+ channels, rate->info.in.period_size); -+ if (!rate->src_buf) { -+ err = -ENOMEM; - goto error; -+ } -+ } -+ -+ if (need_dst_buf) { -+ rate->dst_conv_idx = -+ snd_pcm_linear_convert_index(rate->info.out.format, -+ rate->orig_out_format); -+ rate->dst_buf = rate_alloc_tmp_buf(rate, rate->info.out.format, -+ channels, rate->info.out.period_size); -+ if (!rate->dst_buf) { -+ err = -ENOMEM; -+ goto error; -+ } - } - - return 0; - - error: -- rate_free_tmp_buf(&rate->pareas); -- rate_free_tmp_buf(&rate->sareas); -+ rate_free_tmp_buf(&rate->src_buf); -+ rate_free_tmp_buf(&rate->dst_buf); -+ error_init: - if (rate->ops.free) - rate->ops.free(rate->obj); -- return -ENOMEM; -+ error_pareas: -+ rate_free_tmp_buf(&rate->pareas); -+ rate_free_tmp_buf(&rate->sareas); -+ return err; - } - - static int snd_pcm_rate_hw_free(snd_pcm_t *pcm) -@@ -361,9 +484,8 @@ static int snd_pcm_rate_hw_free(snd_pcm_t *pcm) - rate_free_tmp_buf(&rate->sareas); - if (rate->ops.free) - rate->ops.free(rate->obj); -- free(rate->src_buf); -- free(rate->dst_buf); -- rate->src_buf = rate->dst_buf = NULL; -+ rate_free_tmp_buf(&rate->src_buf); -+ rate_free_tmp_buf(&rate->dst_buf); - return snd_pcm_hw_free(rate->gen.slave); - } - -@@ -444,82 +566,6 @@ static int snd_pcm_rate_init(snd_pcm_t *pcm) - return 0; - } - --static void convert_to_s16(snd_pcm_rate_t *rate, int16_t *buf, -- const snd_pcm_channel_area_t *areas, -- snd_pcm_uframes_t offset, unsigned int frames, -- unsigned int channels) --{ --#ifndef DOC_HIDDEN --#define GET16_LABELS --#include "plugin_ops.h" --#undef GET16_LABELS --#endif /* DOC_HIDDEN */ -- void *get = get16_labels[rate->get_idx]; -- const char *src; -- int16_t sample; -- const char *srcs[channels]; -- int src_step[channels]; -- unsigned int c; -- -- for (c = 0; c < channels; c++) { -- srcs[c] = snd_pcm_channel_area_addr(areas + c, offset); -- src_step[c] = snd_pcm_channel_area_step(areas + c); -- } -- -- while (frames--) { -- for (c = 0; c < channels; c++) { -- src = srcs[c]; -- goto *get; --#ifndef DOC_HIDDEN --#define GET16_END after_get --#include "plugin_ops.h" --#undef GET16_END --#endif /* DOC_HIDDEN */ -- after_get: -- *buf++ = sample; -- srcs[c] += src_step[c]; -- } -- } --} -- --static void convert_from_s16(snd_pcm_rate_t *rate, const int16_t *buf, -- const snd_pcm_channel_area_t *areas, -- snd_pcm_uframes_t offset, unsigned int frames, -- unsigned int channels) --{ --#ifndef DOC_HIDDEN --#define PUT16_LABELS --#include "plugin_ops.h" --#undef PUT16_LABELS --#endif /* DOC_HIDDEN */ -- void *put = put16_labels[rate->put_idx]; -- char *dst; -- int16_t sample; -- char *dsts[channels]; -- int dst_step[channels]; -- unsigned int c; -- -- for (c = 0; c < channels; c++) { -- dsts[c] = snd_pcm_channel_area_addr(areas + c, offset); -- dst_step[c] = snd_pcm_channel_area_step(areas + c); -- } -- -- while (frames--) { -- for (c = 0; c < channels; c++) { -- dst = dsts[c]; -- sample = *buf++; -- goto *put; --#ifndef DOC_HIDDEN --#define PUT16_END after_put --#include "plugin_ops.h" --#undef PUT16_END --#endif /* DOC_HIDDEN */ -- after_put: -- dsts[c] += dst_step[c]; -- } -- } --} -- - static void do_convert(const snd_pcm_channel_area_t *dst_areas, - snd_pcm_uframes_t dst_offset, unsigned int dst_frames, - const snd_pcm_channel_area_t *src_areas, -@@ -527,28 +573,40 @@ static void do_convert(const snd_pcm_channel_area_t *dst_areas, - unsigned int channels, - snd_pcm_rate_t *rate) - { -- if (rate->ops.convert_s16) { -- const int16_t *src; -- int16_t *dst; -- if (! rate->src_buf) -- src = (int16_t *)src_areas->addr + src_offset * channels; -- else { -- convert_to_s16(rate, rate->src_buf, src_areas, src_offset, -- src_frames, channels); -- src = rate->src_buf; -- } -- if (! rate->dst_buf) -- dst = (int16_t *)dst_areas->addr + dst_offset * channels; -- else -- dst = rate->dst_buf; -- rate->ops.convert_s16(rate->obj, dst, dst_frames, src, src_frames); -- if (dst == rate->dst_buf) -- convert_from_s16(rate, rate->dst_buf, dst_areas, dst_offset, -- dst_frames, channels); -+ const snd_pcm_channel_area_t *out_areas; -+ snd_pcm_uframes_t out_offset; -+ -+ if (rate->dst_buf) { -+ out_areas = rate->dst_buf; -+ out_offset = 0; - } else { -- rate->ops.convert(rate->obj, dst_areas, dst_offset, dst_frames, -- src_areas, src_offset, src_frames); -+ out_areas = dst_areas; -+ out_offset = dst_offset; -+ } -+ -+ if (rate->src_buf) { -+ snd_pcm_linear_convert(rate->src_buf, 0, -+ src_areas, src_offset, -+ channels, src_frames, -+ rate->src_conv_idx); -+ src_areas = rate->src_buf; -+ src_offset = 0; - } -+ -+ if (rate->ops.convert) -+ rate->ops.convert(rate->obj, out_areas, out_offset, dst_frames, -+ src_areas, src_offset, src_frames); -+ else -+ rate->ops.convert_s16(rate->obj, -+ snd_pcm_channel_area_addr(out_areas, out_offset), -+ dst_frames, -+ snd_pcm_channel_area_addr(src_areas, src_offset), -+ src_frames); -+ if (rate->dst_buf) -+ snd_pcm_linear_convert(dst_areas, dst_offset, -+ rate->dst_buf, 0, -+ channels, dst_frames, -+ rate->dst_conv_idx); - } - - static inline void -@@ -1276,6 +1334,30 @@ const snd_config_t *snd_pcm_rate_get_default_converter(snd_config_t *root) - return NULL; - } - -+static void rate_initial_setup(snd_pcm_rate_t *rate) -+{ -+ if (rate->plugin_version == SND_PCM_RATE_PLUGIN_VERSION) -+ rate->plugin_version = rate->ops.version; -+ -+ if (rate->plugin_version >= 0x010002 && -+ rate->ops.get_supported_rates) -+ rate->ops.get_supported_rates(rate->obj, -+ &rate->rate_min, -+ &rate->rate_max); -+ -+ if (rate->plugin_version >= 0x010003 && -+ rate->ops.get_supported_formats) { -+ rate->ops.get_supported_formats(rate->obj, -+ &rate->in_formats, -+ &rate->out_formats, -+ &rate->format_flags); -+ } else if (!rate->ops.convert && rate->ops.convert_s16) { -+ rate->in_formats = rate->out_formats = -+ 1ULL << SND_PCM_FORMAT_S16; -+ rate->format_flags = SND_PCM_RATE_FLAG_INTERLEAVED; -+ } -+} -+ - #ifdef PIC - static int is_builtin_plugin(const char *type) - { -@@ -1301,20 +1383,11 @@ static int rate_open_func(snd_pcm_rate_t *rate, const char *type, const snd_conf - lib = lib_name; - } - -- rate->rate_min = SND_PCM_PLUGIN_RATE_MIN; -- rate->rate_max = SND_PCM_PLUGIN_RATE_MAX; -- rate->plugin_version = SND_PCM_RATE_PLUGIN_VERSION; -- - open_conf_func = snd_dlobj_cache_get(lib, open_conf_name, NULL, verbose && converter_conf != NULL); - if (open_conf_func) { - err = open_conf_func(SND_PCM_RATE_PLUGIN_VERSION, - &rate->obj, &rate->ops, converter_conf); - if (!err) { -- rate->plugin_version = rate->ops.version; -- if (rate->ops.get_supported_rates) -- rate->ops.get_supported_rates(rate->obj, -- &rate->rate_min, -- &rate->rate_max); - rate->open_func = open_conf_func; - return 0; - } else { -@@ -1330,23 +1403,18 @@ static int rate_open_func(snd_pcm_rate_t *rate, const char *type, const snd_conf - rate->open_func = open_func; - - err = open_func(SND_PCM_RATE_PLUGIN_VERSION, &rate->obj, &rate->ops); -- if (!err) { -- rate->plugin_version = rate->ops.version; -- if (rate->ops.get_supported_rates) -- rate->ops.get_supported_rates(rate->obj, -- &rate->rate_min, -- &rate->rate_max); -+ if (!err) - return 0; -- } - - /* try to open with the old protocol version */ - rate->plugin_version = SND_PCM_RATE_PLUGIN_VERSION_OLD; - err = open_func(SND_PCM_RATE_PLUGIN_VERSION_OLD, - &rate->obj, &rate->ops); -- if (err) { -- snd_dlobj_cache_put(open_func); -- rate->open_func = NULL; -- } -+ if (!err) -+ return 0; -+ -+ snd_dlobj_cache_put(open_func); -+ rate->open_func = NULL; - return err; - } - #endif -@@ -1417,6 +1485,10 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name, - rate->srate = srate; - rate->sformat = sformat; - -+ rate->rate_min = SND_PCM_PLUGIN_RATE_MIN; -+ rate->rate_max = SND_PCM_PLUGIN_RATE_MAX; -+ rate->plugin_version = SND_PCM_RATE_PLUGIN_VERSION; -+ - err = snd_pcm_new(&pcm, SND_PCM_TYPE_RATE, name, slave->stream, slave->mode); - if (err < 0) { - free(rate); -@@ -1496,6 +1568,8 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name, - return err; - } - -+ rate_initial_setup(rate); -+ - pcm->ops = &snd_pcm_rate_ops; - pcm->fast_ops = &snd_pcm_rate_fast_ops; - pcm->private_data = rate; --- -2.31.1 - - -From 3f737a2a2c8d20e78dea3ea836997f9d74f602a0 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 18 Jun 2021 11:35:30 +0200 -Subject: [PATCH 04/20] pcm: improve docs for snd_pcm_sw_params_get_avail_min() - and snd_pcm_status_get_avail_max() - -Fixes: https://github.com/alsa-project/alsa-lib/issues/44 -Signed-off-by: Jaroslav Kysela ---- - src/pcm/pcm.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c -index 09df0f12..892abf98 100644 ---- a/src/pcm/pcm.c -+++ b/src/pcm/pcm.c -@@ -6500,6 +6500,9 @@ int snd_pcm_sw_params_set_avail_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, - * \param params Software configuration container - * \param val returned minimum available frames to consider PCM ready - * \return 0 otherwise a negative error code -+ * -+ * This is a threshold value when the PCM stream is considered as ready for -+ * another read/write operation or poll event. - */ - #ifndef DOXYGEN - EXPORT_SYMBOL int INTERNAL(snd_pcm_sw_params_get_avail_min)(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val) -@@ -6960,6 +6963,8 @@ snd_pcm_uframes_t snd_pcm_status_get_avail(const snd_pcm_status_t *obj) - /** - * \brief Get maximum number of frames available from a PCM status container after last #snd_pcm_status call - * \return Maximum number of frames ready to be read/written -+ * -+ * This value returns the peak for the available frames between #snd_pcm_status calls. - */ - snd_pcm_uframes_t snd_pcm_status_get_avail_max(const snd_pcm_status_t *obj) - { --- -2.31.1 - - -From 212c6c18c4317af48c007a0866efc029b9c3a593 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Mon, 21 Jun 2021 09:23:02 +0200 -Subject: [PATCH 05/20] pcm: dmix - use pcm_frame_diff() in - snd_pcm_dmix_sync_ptr0() - -Signed-off-by: Jaroslav Kysela ---- - src/pcm/pcm_dmix.c | 6 +----- - 1 file changed, 1 insertion(+), 5 deletions(-) - -diff --git a/src/pcm/pcm_dmix.c b/src/pcm/pcm_dmix.c -index 608593f1..0d0d0bff 100644 ---- a/src/pcm/pcm_dmix.c -+++ b/src/pcm/pcm_dmix.c -@@ -393,17 +393,13 @@ static int snd_pcm_dmix_sync_ptr0(snd_pcm_t *pcm, snd_pcm_uframes_t slave_hw_ptr - - old_slave_hw_ptr = dmix->slave_hw_ptr; - dmix->slave_hw_ptr = slave_hw_ptr; -- diff = slave_hw_ptr - old_slave_hw_ptr; -+ diff = pcm_frame_diff(slave_hw_ptr, old_slave_hw_ptr, dmix->slave_boundary); - if (diff == 0) /* fast path */ - return 0; - if (dmix->state != SND_PCM_STATE_RUNNING && - dmix->state != SND_PCM_STATE_DRAINING) - /* not really started yet - don't update hw_ptr */ - return 0; -- if (diff < 0) { -- slave_hw_ptr += dmix->slave_boundary; -- diff = slave_hw_ptr - old_slave_hw_ptr; -- } - dmix->hw_ptr += diff; - dmix->hw_ptr %= pcm->boundary; - if (pcm->stop_threshold >= pcm->boundary) /* don't care */ --- -2.31.1 - - -From dd609ef9684987d3ca61d5c5cc3c77589ff9c29f Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Mon, 21 Jun 2021 09:28:41 +0200 -Subject: [PATCH 06/20] pcm: direct plugins - fix hw_ptr in the status callback - -The parent hw_ptr may be in another range (boundary limit). -Set the correct value for the caller. - -BugLink: https://github.com/alsa-project/alsa-lib/issues/155 -Signed-off-by: Jaroslav Kysela ---- - src/pcm/pcm_dmix.c | 1 + - src/pcm/pcm_dshare.c | 1 + - src/pcm/pcm_dsnoop.c | 1 + - 3 files changed, 3 insertions(+) - -diff --git a/src/pcm/pcm_dmix.c b/src/pcm/pcm_dmix.c -index 0d0d0bff..94dbb1e0 100644 ---- a/src/pcm/pcm_dmix.c -+++ b/src/pcm/pcm_dmix.c -@@ -491,6 +491,7 @@ static int snd_pcm_dmix_status(snd_pcm_t *pcm, snd_pcm_status_t * status) - } - - status->state = snd_pcm_dmix_state(pcm); -+ status->hw_ptr = *pcm->hw.ptr; /* boundary may be different */ - status->appl_ptr = *pcm->appl.ptr; /* slave PCM doesn't set appl_ptr */ - status->trigger_tstamp = dmix->trigger_tstamp; - status->avail = snd_pcm_mmap_playback_avail(pcm); -diff --git a/src/pcm/pcm_dshare.c b/src/pcm/pcm_dshare.c -index a918512b..01814dc8 100644 ---- a/src/pcm/pcm_dshare.c -+++ b/src/pcm/pcm_dshare.c -@@ -243,6 +243,7 @@ static int snd_pcm_dshare_status(snd_pcm_t *pcm, snd_pcm_status_t * status) - break; - } - status->state = snd_pcm_dshare_state(pcm); -+ status->hw_ptr = *pcm->hw.ptr; /* boundary may be different */ - status->appl_ptr = *pcm->appl.ptr; /* slave PCM doesn't set appl_ptr */ - status->trigger_tstamp = dshare->trigger_tstamp; - status->avail = snd_pcm_mmap_playback_avail(pcm); -diff --git a/src/pcm/pcm_dsnoop.c b/src/pcm/pcm_dsnoop.c -index 2c3b9f43..3f28df99 100644 ---- a/src/pcm/pcm_dsnoop.c -+++ b/src/pcm/pcm_dsnoop.c -@@ -193,6 +193,7 @@ static int snd_pcm_dsnoop_status(snd_pcm_t *pcm, snd_pcm_status_t * status) - snd_pcm_status(dsnoop->spcm, status); - state = snd_pcm_state(dsnoop->spcm); - status->state = state == SND_PCM_STATE_RUNNING ? dsnoop->state : state; -+ status->hw_ptr = *pcm->hw.ptr; /* boundary may be different */ - status->appl_ptr = *pcm->appl.ptr; /* slave PCM doesn't set appl_ptr */ - status->trigger_tstamp = dsnoop->trigger_tstamp; - status->avail = snd_pcm_mmap_capture_avail(pcm); --- -2.31.1 - - -From a5e11f9a810391777ea7750f04ba66f9c9e624de Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Mon, 21 Jun 2021 14:21:26 +0200 -Subject: [PATCH 07/20] pcm: Move snd_pcm_channel_area_addr() and _step() to - public header - -Used in the rate plugins commonly. - -Signed-off-by: Takashi Iwai ---- - include/pcm.h | 23 +++++++++++++++++++++++ - src/pcm/pcm_local.h | 13 ------------- - 2 files changed, 23 insertions(+), 13 deletions(-) - -diff --git a/include/pcm.h b/include/pcm.h -index e300b951..b5a514fa 100644 ---- a/include/pcm.h -+++ b/include/pcm.h -@@ -1173,6 +1173,29 @@ int snd_pcm_areas_copy_wrap(const snd_pcm_channel_area_t *dst_channels, - snd_pcm_uframes_t frames, - const snd_pcm_format_t format); - -+/** -+ * \brief get the address of the given PCM channel area -+ * \param area PCM channel area -+ * \param offset Offset in frames -+ * -+ * Returns the pointer corresponding to the given offset on the channel area. -+ */ -+static inline void *snd_pcm_channel_area_addr(const snd_pcm_channel_area_t *area, snd_pcm_uframes_t offset) -+{ -+ return (char *)area->addr + (area->first + area->step * offset) / 8; -+} -+ -+/** -+ * \brief get the step size of the given PCM channel area in bytes -+ * \param area PCM channel area -+ * -+ * Returns the step size in bytes from the given channel area. -+ */ -+static inline unsigned int snd_pcm_channel_area_step(const snd_pcm_channel_area_t *area) -+{ -+ return area->step / 8; -+} -+ - /** \} */ - - /** -diff --git a/src/pcm/pcm_local.h b/src/pcm/pcm_local.h -index a63f4be0..6f03365c 100644 ---- a/src/pcm/pcm_local.h -+++ b/src/pcm/pcm_local.h -@@ -632,19 +632,6 @@ static inline snd_pcm_sframes_t snd_pcm_mmap_delay(snd_pcm_t *pcm) - return snd_pcm_mmap_capture_delay(pcm); - } - --static inline void *snd_pcm_channel_area_addr(const snd_pcm_channel_area_t *area, snd_pcm_uframes_t offset) --{ -- unsigned int bitofs = area->first + area->step * offset; -- assert(bitofs % 8 == 0); -- return (char *) area->addr + bitofs / 8; --} -- --static inline unsigned int snd_pcm_channel_area_step(const snd_pcm_channel_area_t *area) --{ -- assert(area->step % 8 == 0); -- return area->step / 8; --} -- - static inline snd_pcm_sframes_t _snd_pcm_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size) - { - /* lock handled in the callback */ --- -2.31.1 - - -From e0e084659083c2ab75d5c894f24227ea2f67010f Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Mon, 21 Jun 2021 15:14:18 +0200 -Subject: [PATCH 08/20] pcm: direct plugins - fix bad memory access when - channel bindings do not match hw - -Fix and cleanup snd_pcm_direct_check_interleave() function. -Add requested / hardware channel check and use goto when the interleaved - -Fixes: https://github.com/alsa-project/alsa-lib/issues/117 -Signed-off-by: Jaroslav Kysela ---- - src/pcm/pcm_direct.c | 40 +++++++++++++++++----------------------- - 1 file changed, 17 insertions(+), 23 deletions(-) - -diff --git a/src/pcm/pcm_direct.c b/src/pcm/pcm_direct.c -index d50503e3..90417b2f 100644 ---- a/src/pcm/pcm_direct.c -+++ b/src/pcm/pcm_direct.c -@@ -1627,43 +1627,37 @@ int snd_pcm_direct_set_timer_params(snd_pcm_direct_t *dmix) - int snd_pcm_direct_check_interleave(snd_pcm_direct_t *dmix, snd_pcm_t *pcm) - { - unsigned int chn, channels; -- int bits, interleaved = 1; -+ int bits; - const snd_pcm_channel_area_t *dst_areas; - const snd_pcm_channel_area_t *src_areas; - - bits = snd_pcm_format_physical_width(pcm->format); - if ((bits % 8) != 0) -- interleaved = 0; -+ goto __nointerleaved; - channels = dmix->channels; -+ if (channels != dmix->spcm->channels) -+ goto __nointerleaved; - dst_areas = snd_pcm_mmap_areas(dmix->spcm); - src_areas = snd_pcm_mmap_areas(pcm); - for (chn = 1; chn < channels; chn++) { -- if (dst_areas[chn-1].addr != dst_areas[chn].addr) { -- interleaved = 0; -- break; -- } -- if (src_areas[chn-1].addr != src_areas[chn].addr) { -- interleaved = 0; -- break; -- } -+ if (dst_areas[chn-1].addr != dst_areas[chn].addr) -+ goto __nointerleaved; -+ if (src_areas[chn-1].addr != src_areas[chn].addr) -+ goto __nointerleaved; - } - for (chn = 0; chn < channels; chn++) { -- if (dmix->bindings && dmix->bindings[chn] != chn) { -- interleaved = 0; -- break; -- } -+ if (dmix->bindings && dmix->bindings[chn] != chn) -+ goto __nointerleaved; - if (dst_areas[chn].first != chn * bits || -- dst_areas[chn].step != channels * bits) { -- interleaved = 0; -- break; -- } -+ dst_areas[chn].step != channels * bits) -+ goto __nointerleaved; - if (src_areas[chn].first != chn * bits || -- src_areas[chn].step != channels * bits) { -- interleaved = 0; -- break; -- } -+ src_areas[chn].step != channels * bits) -+ goto __nointerleaved; - } -- return dmix->interleaved = interleaved; -+ return dmix->interleaved = 1; -+__nointerleaved: -+ return dmix->interleaved = 0; - } - - /* --- -2.31.1 - - -From ccc14ae897d170156f1c2905ea5d18a3295e7b36 Mon Sep 17 00:00:00 2001 -From: "Tanjeff-N. Moos" -Date: Thu, 17 Jun 2021 10:36:38 +0200 -Subject: [PATCH 09/20] control: Add documentation for snd_ctl_card_* and - friends. - -In this patch series, I added a description about control interface -handling and how control interfaces are identified. - -In addition, I added/improved Doxygen documentation for the -snd_ctl_card_info_t type and related corresponding functions, -e.g. snd_ctl_card_info(). I also documented other card-related like -snd_card_next(). - -Along the way I did minor documentation improvements. - -Signed-off-by: Tanjeff-N. Moos -Signed-off-by: Takashi Iwai ---- - include/control.h | 40 +++++++++- - src/control/cards.c | 56 +++++++++----- - src/control/control.c | 175 +++++++++++++++++++++++++++++++----------- - 3 files changed, 202 insertions(+), 69 deletions(-) - -diff --git a/include/control.h b/include/control.h -index ccf906e2..9ebb4905 100644 ---- a/include/control.h -+++ b/include/control.h -@@ -50,7 +50,32 @@ typedef struct snd_aes_iec958 { - unsigned char dig_subframe[4]; /**< AES/IEC958 subframe bits */ - } snd_aes_iec958_t; - --/** CTL card info container */ -+/** \brief CTL card info container. -+ * -+ * This type contains meta information about a sound card, such as the index, -+ * name, longname, etc. -+ * -+ * \par Memory management -+ * -+ * Before using a snd_ctl_card_info_t object, it must be allocated using -+ * snd_ctl_card_info_alloca() or snd_ctl_card_info_malloc(). When using the -+ * latter, it must be freed again using snd_ctl_card_info_free(). -+ * -+ * A card info object can be zeroed out using snd_ctl_card_info_clear(). -+ * -+ * A card info object can be copied to another one using -+ * snd_ctl_card_info_copy(). -+ * -+ * \par Obtaining the Information -+ * -+ * To obtain the card information, it must first be opened using -+ * snd_ctl_open(), and a snd_ctl_card_info_t container must be -+ * allocated. Then, the information can be read using -+ * snd_ctl_card_info_get_card(). -+ * -+ * Thereafter, the card properties can be read using the -+ * snd_ctl_card_info_get_*() functions. -+ */ - typedef struct _snd_ctl_card_info snd_ctl_card_info_t; - - /** CTL element identifier container */ -@@ -442,11 +467,20 @@ void snd_ctl_elem_id_set_name(snd_ctl_elem_id_t *obj, const char *val); - void snd_ctl_elem_id_set_index(snd_ctl_elem_id_t *obj, unsigned int val); - - size_t snd_ctl_card_info_sizeof(void); -+ - /** \hideinitializer -- * \brief allocate an invalid #snd_ctl_card_info_t using standard alloca -- * \param ptr returned pointer -+ * \brief Allocate an invalid #snd_ctl_card_info_t on the stack. -+ * -+ * Allocate space for a card info object on the stack. The allocated -+ * memory need not be freed, because it is on the stack. -+ * -+ * See snd_ctl_card_info_t for details. -+ * -+ * \param ptr Pointer to a snd_ctl_elem_value_t pointer. The address -+ * of the allocated space will returned here. - */ - #define snd_ctl_card_info_alloca(ptr) __snd_alloca(ptr, snd_ctl_card_info) -+ - int snd_ctl_card_info_malloc(snd_ctl_card_info_t **ptr); - void snd_ctl_card_info_free(snd_ctl_card_info_t *obj); - void snd_ctl_card_info_clear(snd_ctl_card_info_t *obj); -diff --git a/src/control/cards.c b/src/control/cards.c -index e57457c2..8226c42d 100644 ---- a/src/control/cards.c -+++ b/src/control/cards.c -@@ -77,8 +77,8 @@ static int snd_card_load1(int card) - - /** - * \brief Try to load the driver for a card. -- * \param card Card number. -- * \return 1 if driver is present, zero if driver is not present -+ * \param card Card index. -+ * \return 1 if driver is present, zero if driver is not present. - */ - int snd_card_load(int card) - { -@@ -86,14 +86,24 @@ int snd_card_load(int card) - } - - /** -- * \brief Try to determine the next card. -- * \param rcard pointer to card number -- * \result zero if success, otherwise a negative error code -+ * \brief Iterate over physical sound cards. -+ * -+ * This function takes the index of a physical sound card and sets it to the -+ * index of the next card. If index is -1, it is set to the index of the first -+ * card. After the last card, the index is set to -1. -+ * -+ * For example, if you have 2 sound cards (with index 0 and 1), the index will -+ * be modified as follows: -+ * -+ * - -1 --> 0 -+ * - 0 --> 1 -+ * - 1 --> -1 -+ * -+ * This does not work for virtual sound cards. - * -- * Tries to determine the next card from given card number. -- * If card number is -1, then the first available card is -- * returned. If the result card number is -1, no more cards -- * are available. -+ * \param rcard Index of current card. The index of the next card is stored -+ * here. -+ * \result zero if success, otherwise a negative error code. - */ - int snd_card_next(int *rcard) - { -@@ -114,13 +124,18 @@ int snd_card_next(int *rcard) - } - - /** -- * \brief Convert card string to an integer value. -- * \param string String containing card identifier -- * \return zero if success, otherwise a negative error code -+ * \brief Convert a card string to the card index. - * -- * The accepted format is an integer value in ASCII representation -- * or the card identifier (the id parameter for sound-card drivers). -- * The control device name like /dev/snd/controlC0 is accepted, too. -+ * This works only for physical sound cards, not for virtual cards. -+ * -+ * \param string A string identifying the card. -+ * \return The index of the card. On error, a a negative error code -+ * is returned. -+ * -+ * The accepted formats for "string" are: -+ * - The index of the card (as listed in /proc/asound/cards), given as string -+ * - The ID of the card (as listed in /proc/asound/cards) -+ * - The control device name (like /dev/snd/controlC0) - */ - int snd_card_get_index(const char *string) - { -@@ -163,8 +178,9 @@ int snd_card_get_index(const char *string) - - /** - * \brief Obtain the card name. -- * \param card Card number -- * \param name Result - card name corresponding to card number -+ * -+ * \param card The index of the card. -+ * \param name Result - card name corresponding to card index. - * \result zero if success, otherwise a negative error code - * - * The value returned in name is allocated with strdup and should be -@@ -193,9 +209,9 @@ int snd_card_get_name(int card, char **name) - - /** - * \brief Obtain the card long name. -- * \param card Card number -- * \param name Result - card long name corresponding to card number -- * \result zero if success, otherwise a negative error code -+ * \param card Index of the card. -+ * \param name Result - card long name corresponding to card index. -+ * \result Zero if success, otherwise a negative error code. - * - * The value returned in name is allocated with strdup and should be - * freed when no longer used. -diff --git a/src/control/control.c b/src/control/control.c -index ed986e54..7cf4decb 100644 ---- a/src/control/control.c -+++ b/src/control/control.c -@@ -33,8 +33,50 @@ -

Control interface is designed to access primitive controls. There is - also an interface for notifying about control and structure changes. - -+ - \section control_general_overview General overview - -+In Alsa, there are physical sound cards, such as USB headsets, and -+virtual sound cards, such as "pulse", which represents the PulseAudio -+Sound system. Each sound card offers a control interface, making its -+settings (e.g. volume knobs) available. The complete list of available -+control interfaces can be obtained using snd_device_name_hint(), -+giving -1 as card index and "ctl" as interface type. Each returned -+NAME hint identifies a control interface. -+ -+Sound cards have an ID (a string), an index (an int, sometimes called -+the "card number"), a name, a longname, a mixername and a "components" -+property. The file /proc/asound/cards lists most of these properties -+for physical sound cards. Virtual sound cards are not listed in that -+file. The format is: -+ -+\verbatim -+index [ID ] Driver - name -+ longname -+\endverbatim -+ -+Note that the mixername and components are not listed. -+ -+ -+\subsection control_cards_id Identifying and Opening Control Interfaces -+ -+To work with a control interface, is must be opened first, using -+snd_ctl_open(). This function takes the interface name. -+ -+For physical sound cards, the control interface can be identified -+using the string "hw:" (e.g. `hw:2`). The NAME hint - which is -+"hw:CARD=" - can also be used. Further, its device file (something -+like `/dev/snd/controlC0`) is also acceptable. Either of them can be -+given to snd_ctl_open(). -+ -+For virtual sound cards, the NAME hint is given to snd_ctl_open(). -+ -+The functions snd_card_get_index(), snd_card_get_name() and -+snd_card_get_longname() can be used to find an identifying property -+when another one is already known. -+ -+\section control_elements Elements -+ - In ALSA control feature, each sound card can have control elements. The elements - are managed according to below model. - -@@ -65,7 +107,7 @@ are managed according to below model. - of userspace applications and drivers in kernel. - - --\section identifying_elements Identifying Elements -+\subsection identifying_elements Identifying Elements - - Each element has the following identifying properties: - -@@ -84,7 +126,7 @@ but in practice this is rare). The numid can change on each boot. - In case of an USB sound card, the numid can also change when it - is reconnected. The short numid is used to reduce the lookup time. - --\section element_lists Element Lists -+\subsection element_lists Element Lists - - An element list can be used to obtain a list of all elements of the - sound card. The list contains generic information (e.g. how many -@@ -93,7 +135,7 @@ elements the card has), and the identifying properties of the elements - element lists. - - --\section working_with_elements Working with Elements -+\subsection working_with_elements Working with Elements - - It is possible to obtain information about an element using the - snd_ctl_elem_info_*() functions. For enums, the allowed values can be -@@ -108,7 +150,7 @@ actual values or settings. It is also possible to get and set the ID - values (such as the numid or the name). - - --\section element_sets Element Sets -+\subsection element_sets Element Sets - - The type of element set is one of integer, integer64, boolean, enumerators, - bytes and IEC958 structure. This indicates the type of value for each member in -@@ -329,10 +371,15 @@ int snd_ctl_subscribe_events(snd_ctl_t *ctl, int subscribe) - - - /** -- * \brief Get card related information -- * \param ctl CTL handle -- * \param info Card info pointer -- * \return 0 on success otherwise a negative error code -+ * \brief Get information about the sound card. -+ * -+ * Obtain information about the sound card previously opened using -+ * snd_ctl_open(). The object "info" must be allocated prior to calling this -+ * function. See snd_ctl_card_info_t for details. -+ * -+ * \param ctl The CTL handle. -+ * \param info The card information is stored here. -+ * \return 0 on success, otherwise a negative error code. - */ - int snd_ctl_card_info(snd_ctl_t *ctl, snd_ctl_card_info_t *info) - { -@@ -1508,11 +1555,13 @@ int _snd_ctl_open_named_child(snd_ctl_t **pctl, const char *name, - #endif - - /** -- * \brief Opens a CTL -- * \param ctlp Returned CTL handle -- * \param name ASCII identifier of the CTL handle -- * \param mode Open mode (see #SND_CTL_NONBLOCK, #SND_CTL_ASYNC) -- * \return 0 on success otherwise a negative error code -+ * \brief Opens a sound card. -+ * -+ * \param ctlp Returned CTL handle. -+ * \param name A string identifying the card (See \ref control_cards_id). -+ * \param mode Open mode (see #SND_CTL_NONBLOCK, #SND_CTL_ASYNC). -+ * -+ * \return 0 on success otherwise a negative error code. - */ - int snd_ctl_open(snd_ctl_t **ctlp, const char *name, int mode) - { -@@ -2027,8 +2076,8 @@ void snd_ctl_elem_id_set_index(snd_ctl_elem_id_t *obj, unsigned int val) - } - - /** -- * \brief get size of #snd_ctl_card_info_t -- * \return size in bytes -+ * \brief get size of #snd_ctl_card_info_t. -+ * \return Size in bytes. - */ - size_t snd_ctl_card_info_sizeof() - { -@@ -2036,9 +2085,16 @@ size_t snd_ctl_card_info_sizeof() - } - - /** -- * \brief allocate an invalid #snd_ctl_card_info_t using standard malloc -- * \param ptr returned pointer -- * \return 0 on success otherwise negative error code -+ * \brief Allocate an invalid #snd_ctl_card_info_t on the heap. -+ * -+ * Allocate space for a card info object on the heap. The allocated memory -+ * must be freed using snd_ctl_card_info_free(). -+ * -+ * See snd_ctl_card_info_t for details. -+ * -+ * \param ptr Pointer to a snd_ctl_card_info_t pointer. The address -+ * of the allocated space will be returned here. -+ * \return 0 on success, otherwise a negative error code. - */ - int snd_ctl_card_info_malloc(snd_ctl_card_info_t **ptr) - { -@@ -2050,8 +2106,10 @@ int snd_ctl_card_info_malloc(snd_ctl_card_info_t **ptr) - } - - /** -- * \brief frees a previously allocated #snd_ctl_card_info_t -- * \param obj pointer to object to free -+ * \brief Free an #snd_ctl_card_info_t previously allocated using -+ * snd_ctl_card_info_malloc(). -+ * -+ * \param obj Pointer to the snd_ctl_card_info_t. - */ - void snd_ctl_card_info_free(snd_ctl_card_info_t *obj) - { -@@ -2059,8 +2117,11 @@ void snd_ctl_card_info_free(snd_ctl_card_info_t *obj) - } - - /** -- * \brief clear given #snd_ctl_card_info_t object -- * \param obj pointer to object to clear -+ * \brief Clear given card info object. -+ * -+ * See snd_ctl_elem_value_t for details. -+ * -+ * \param obj Card info object. - */ - void snd_ctl_card_info_clear(snd_ctl_card_info_t *obj) - { -@@ -2068,9 +2129,10 @@ void snd_ctl_card_info_clear(snd_ctl_card_info_t *obj) - } - - /** -- * \brief copy one #snd_ctl_card_info_t to another -- * \param dst pointer to destination -- * \param src pointer to source -+ * \brief Bitwise copy of a #snd_ctl_card_info_t object. -+ * -+ * \param dst Pointer to destination. -+ * \param src Pointer to source. - */ - void snd_ctl_card_info_copy(snd_ctl_card_info_t *dst, const snd_ctl_card_info_t *src) - { -@@ -2079,9 +2141,12 @@ void snd_ctl_card_info_copy(snd_ctl_card_info_t *dst, const snd_ctl_card_info_t - } - - /** -- * \brief Get card number from a CTL card info -- * \param obj CTL card info -- * \return card number -+ * \brief Get the sound card index from the given info object. -+ * -+ * See snd_ctl_card_info_t for more details. -+ * -+ * \param obj The card info object. -+ * \return Sound card index. - */ - int snd_ctl_card_info_get_card(const snd_ctl_card_info_t *obj) - { -@@ -2090,9 +2155,12 @@ int snd_ctl_card_info_get_card(const snd_ctl_card_info_t *obj) - } - - /** -- * \brief Get card identifier from a CTL card info -- * \param obj CTL card info -- * \return card identifier -+ * \brief Get the sound card ID from the given info object. -+ * -+ * See snd_ctl_card_info_t for more details. -+ * -+ * \param obj The card info object. -+ * \return Sound card ID. - */ - const char *snd_ctl_card_info_get_id(const snd_ctl_card_info_t *obj) - { -@@ -2101,9 +2169,12 @@ const char *snd_ctl_card_info_get_id(const snd_ctl_card_info_t *obj) - } - - /** -- * \brief Get card driver name from a CTL card info -- * \param obj CTL card info -- * \return card driver name -+ * \brief Get the sound card driver from the given info object. -+ * -+ * See snd_ctl_card_info_t for more details. -+ * -+ * \param obj The card info object. -+ * \return The sound card driver. - */ - const char *snd_ctl_card_info_get_driver(const snd_ctl_card_info_t *obj) - { -@@ -2112,9 +2183,12 @@ const char *snd_ctl_card_info_get_driver(const snd_ctl_card_info_t *obj) - } - - /** -- * \brief Get card name from a CTL card info -- * \param obj CTL card info -- * \return card name -+ * \brief Get the sound card name from the given info object. -+ * -+ * See snd_ctl_card_info_t for more details. -+ * -+ * \param obj The card info object. -+ * \return Sound card name. - */ - const char *snd_ctl_card_info_get_name(const snd_ctl_card_info_t *obj) - { -@@ -2123,9 +2197,12 @@ const char *snd_ctl_card_info_get_name(const snd_ctl_card_info_t *obj) - } - - /** -- * \brief Get card long name from a CTL card info -- * \param obj CTL card info -- * \return card long name -+ * \brief Get the sound cards long name from the given info object. -+ * -+ * See snd_ctl_card_info_t for more details. -+ * -+ * \param obj The card info object. -+ * \return Sound cards long name. - */ - const char *snd_ctl_card_info_get_longname(const snd_ctl_card_info_t *obj) - { -@@ -2134,9 +2211,12 @@ const char *snd_ctl_card_info_get_longname(const snd_ctl_card_info_t *obj) - } - - /** -- * \brief Get card mixer name from a CTL card info -- * \param obj CTL card info -- * \return card mixer name -+ * \brief Get the sound card mixer name from the given info object. -+ * -+ * See snd_ctl_card_info_t for more details. -+ * -+ * \param obj The card info object. -+ * \return Sound card mixer name. - */ - const char *snd_ctl_card_info_get_mixername(const snd_ctl_card_info_t *obj) - { -@@ -2145,9 +2225,12 @@ const char *snd_ctl_card_info_get_mixername(const snd_ctl_card_info_t *obj) - } - - /** -- * \brief Get card component list from a CTL card info -- * \param obj CTL card info -- * \return card mixer identifier -+ * \brief Get the sound cards "components" property from the given info object. -+ * -+ * See snd_ctl_card_info_t for more details. -+ * -+ * \param obj The card info object. -+ * \return Sound cards "components" property. - */ - const char *snd_ctl_card_info_get_components(const snd_ctl_card_info_t *obj) - { --- -2.31.1 - - -From 7ba3f888d07cafbad04391b915db23408c663dad Mon Sep 17 00:00:00 2001 -From: "Tanjeff-N. Moos" -Date: Thu, 17 Jun 2021 10:36:39 +0200 -Subject: [PATCH 10/20] control: Minor documentation fixes. - -Signed-off-by: Tanjeff-N. Moos -Signed-off-by: Takashi Iwai ---- - include/control.h | 9 +++++++-- - src/control/cards.c | 5 ++++- - src/control/control.c | 2 +- - 3 files changed, 12 insertions(+), 4 deletions(-) - -diff --git a/include/control.h b/include/control.h -index 9ebb4905..e386ecec 100644 ---- a/include/control.h -+++ b/include/control.h -@@ -155,7 +155,7 @@ typedef struct _snd_ctl_elem_list snd_ctl_elem_list_t; - /** CTL element info container */ - typedef struct _snd_ctl_elem_info snd_ctl_elem_info_t; - --/** CTL element value container -+/** CTL element value container. - * - * Contains the value(s) (i.e. members) of a single element. All - * values of a given element are of the same type. -@@ -167,6 +167,11 @@ typedef struct _snd_ctl_elem_info snd_ctl_elem_info_t; - * using the latter, it must be freed again using - * snd_ctl_elem_value_free(). - * -+ * A value object can be zeroed out using snd_ctl_elem_value_clear(). -+ * -+ * A value object can be copied to another one using -+ * snd_ctl_elem_value_copy(). -+ * - * \par Identifier - * - * Then, the ID must be filled. It is sufficient to fill only the -@@ -621,7 +626,7 @@ size_t snd_ctl_elem_value_sizeof(void); - * \brief Allocate an invalid #snd_ctl_elem_value_t on the stack. - * - * Allocate space for a value object on the stack. The allocated -- * memory need not be freed, because is on the stack. -+ * memory need not be freed, because it is on the stack. - * - * See snd_ctl_elem_value_t for details. - * -diff --git a/src/control/cards.c b/src/control/cards.c -index 8226c42d..6145ebcd 100644 ---- a/src/control/cards.c -+++ b/src/control/cards.c -@@ -147,6 +147,7 @@ int snd_card_get_index(const char *string) - return -EINVAL; - if ((isdigit(*string) && *(string + 1) == 0) || - (isdigit(*string) && isdigit(*(string + 1)) && *(string + 2) == 0)) { -+ /* We got an index */ - if (sscanf(string, "%i", &card) != 1) - return -EINVAL; - if (card < 0 || card >= SND_MAX_CARDS) -@@ -156,8 +157,10 @@ int snd_card_get_index(const char *string) - return card; - return err; - } -- if (string[0] == '/') /* device name */ -+ if (string[0] == '/') -+ /* We got a device name */ - return snd_card_load2(string); -+ /* We got in ID */ - for (card = 0; card < SND_MAX_CARDS; card++) { - #ifdef SUPPORT_ALOAD - if (! snd_card_load(card)) -diff --git a/src/control/control.c b/src/control/control.c -index 7cf4decb..91415b51 100644 ---- a/src/control/control.c -+++ b/src/control/control.c -@@ -3127,7 +3127,7 @@ size_t snd_ctl_elem_value_sizeof() - /** - * \brief Allocate an invalid #snd_ctl_elem_value_t on the heap. - * -- * Allocate space for a value object on the head. The allocated memory -+ * Allocate space for a value object on the heap. The allocated memory - * must be freed using snd_ctl_elem_value_free(). - * - * See snd_ctl_elem_value_t for details. --- -2.31.1 - - -From f4f29d42be8b8ad60ea4c5697374adad4bfe6868 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Mon, 28 Jun 2021 12:08:53 +0200 -Subject: [PATCH 11/20] fix build with --disable-ucm - -Link: https://mailman.alsa-project.org/pipermail/alsa-devel/2021-June/186729.html -Reported-by: Michael Forney -Signed-off-by: Jaroslav Kysela ---- - include/local.h | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/include/local.h b/include/local.h -index 4e7d88a0..7cfcec53 100644 ---- a/include/local.h -+++ b/include/local.h -@@ -374,6 +374,8 @@ int _snd_config_load_with_include(snd_config_t *config, snd_input_t *in, - void *INTERNAL(snd_dlopen)(const char *name, int mode, char *errbuf, size_t errbuflen); - #endif - -+#ifdef BUILD_UCM -+ - const char *uc_mgr_alibcfg_by_device(snd_config_t **config, const char *name); - - static inline int _snd_is_ucm_device(const char *name) -@@ -381,4 +383,12 @@ static inline int _snd_is_ucm_device(const char *name) - return name && name[0] == '_' && name[1] == 'u' && name[2] == 'c' && name[3] == 'm'; - } - -+#else -+ -+static inline const char *uc_mgr_alibcfg_by_device(snd_config_t **config, const char *name) { return NULL; } -+static inline int _snd_is_ucm_device(const char *name) { return 0; } -+ -+ -+#endif -+ - #endif --- -2.31.1 - - -From 1a1f0fb244c477c430e156da878475ef57d198f9 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Mon, 28 Jun 2021 12:11:54 +0200 -Subject: [PATCH 12/20] pcm: rate - fix some gcc warnings - -Signed-off-by: Jaroslav Kysela ---- - src/pcm/pcm_rate.c | 14 +++++++------- - 1 file changed, 7 insertions(+), 7 deletions(-) - -diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c -index 13111d29..c45895a9 100644 ---- a/src/pcm/pcm_rate.c -+++ b/src/pcm/pcm_rate.c -@@ -82,12 +82,12 @@ struct _snd_pcm_rate { - - /* allocate a channel area and a temporary buffer for the given size */ - static snd_pcm_channel_area_t * --rate_alloc_tmp_buf(snd_pcm_rate_t *rate, snd_pcm_format_t format, -+rate_alloc_tmp_buf(snd_pcm_format_t format, - unsigned int channels, unsigned int frames) - { - snd_pcm_channel_area_t *ap; - int width = snd_pcm_format_physical_width(format); -- int i; -+ unsigned int i; - - ap = malloc(sizeof(*ap) * channels); - if (!ap) -@@ -354,7 +354,7 @@ static int snd_pcm_rate_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params) - snd_pcm_rate_t *rate = pcm->private_data; - snd_pcm_t *slave = rate->gen.slave; - snd_pcm_rate_side_info_t *sinfo, *cinfo; -- unsigned int channels, cwidth, swidth, chn, acc; -+ unsigned int channels, acc; - int need_src_buf, need_dst_buf; - int err = snd_pcm_hw_params_slave(pcm, params, - snd_pcm_rate_hw_refine_cchange, -@@ -401,9 +401,9 @@ static int snd_pcm_rate_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params) - return -EBUSY; - } - -- rate->pareas = rate_alloc_tmp_buf(rate, cinfo->format, channels, -+ rate->pareas = rate_alloc_tmp_buf(cinfo->format, channels, - cinfo->period_size); -- rate->sareas = rate_alloc_tmp_buf(rate, sinfo->format, channels, -+ rate->sareas = rate_alloc_tmp_buf(sinfo->format, channels, - sinfo->period_size); - if (!rate->pareas || !rate->sareas) { - err = -ENOMEM; -@@ -442,7 +442,7 @@ static int snd_pcm_rate_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params) - rate->src_conv_idx = - snd_pcm_linear_convert_index(rate->orig_in_format, - rate->info.in.format); -- rate->src_buf = rate_alloc_tmp_buf(rate, rate->info.in.format, -+ rate->src_buf = rate_alloc_tmp_buf(rate->info.in.format, - channels, rate->info.in.period_size); - if (!rate->src_buf) { - err = -ENOMEM; -@@ -454,7 +454,7 @@ static int snd_pcm_rate_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params) - rate->dst_conv_idx = - snd_pcm_linear_convert_index(rate->info.out.format, - rate->orig_out_format); -- rate->dst_buf = rate_alloc_tmp_buf(rate, rate->info.out.format, -+ rate->dst_buf = rate_alloc_tmp_buf(rate->info.out.format, - channels, rate->info.out.period_size); - if (!rate->dst_buf) { - err = -ENOMEM; --- -2.31.1 - - -From e47c11822d6b459a9b3704b3ee6a4a5c9a1b85be Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 29 Jun 2021 18:02:27 +0200 -Subject: [PATCH 13/20] control: remap - assign right name to the child handle - for no-op - -Fixes: https://github.com/alsa-project/alsa-utils/issues/100 -Signed-off-by: Jaroslav Kysela ---- - src/control/control_remap.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/src/control/control_remap.c b/src/control/control_remap.c -index a85c1725..81524014 100644 ---- a/src/control/control_remap.c -+++ b/src/control/control_remap.c -@@ -1173,6 +1173,10 @@ int snd_ctl_remap_open(snd_ctl_t **handlep, const char *name, snd_config_t *rema - /* no-op check, remove the plugin */ - if (priv->map_items == 0 && priv->remap_items == 0) { - remap_free(priv); -+ free(child->name); -+ child->name = name ? strdup(name) : NULL; -+ if (name && !child->name) -+ return -ENOMEM; - *handlep = child; - return 0; - } --- -2.31.1 - - -From 23a191a82c693456e61431ab699cddc1e5782a26 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 29 Jun 2021 19:31:28 +0200 -Subject: [PATCH 14/20] control: remap - assign right name to the child handle - for no-op (2nd case) - -Fixes: https://github.com/alsa-project/alsa-utils/issues/100 -Signed-off-by: Jaroslav Kysela ---- - src/control/control_remap.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/src/control/control_remap.c b/src/control/control_remap.c -index 81524014..4914f960 100644 ---- a/src/control/control_remap.c -+++ b/src/control/control_remap.c -@@ -1154,6 +1154,10 @@ int snd_ctl_remap_open(snd_ctl_t **handlep, const char *name, snd_config_t *rema - snd_ctl_t *ctl; - int result, err; - -+ /* no-op, remove the plugin */ -+ if (!remap && !map) -+ goto _noop; -+ - priv = calloc(1, sizeof(*priv)); - if (priv == NULL) - return -ENOMEM; -@@ -1173,6 +1177,7 @@ int snd_ctl_remap_open(snd_ctl_t **handlep, const char *name, snd_config_t *rema - /* no-op check, remove the plugin */ - if (priv->map_items == 0 && priv->remap_items == 0) { - remap_free(priv); -+ _noop: - free(child->name); - child->name = name ? strdup(name) : NULL; - if (name && !child->name) -@@ -1316,11 +1321,6 @@ int _snd_ctl_remap_open(snd_ctl_t **handlep, char *name, snd_config_t *root, snd - err = _snd_ctl_open_child(&cctl, root, child, mode, conf); - if (err < 0) - return err; -- /* no-op, remove the plugin */ -- if (!remap && !map) { -- *handlep = cctl; -- return 0; -- } - err = snd_ctl_remap_open(handlep, name, remap, map, cctl, mode); - if (err < 0) - snd_ctl_close(cctl); --- -2.31.1 - - -From 7d40a76ef5494e08af00fa4e7bfefbd43aba4827 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 31 Aug 2021 09:25:12 +0200 -Subject: [PATCH 19/20] ucm: avoid zero card instance number - -Signed-off-by: Jaroslav Kysela ---- - src/ucm/utils.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/src/ucm/utils.c b/src/ucm/utils.c -index f3a8c9ba..10b21c34 100644 ---- a/src/ucm/utils.c -+++ b/src/ucm/utils.c -@@ -780,6 +780,9 @@ int uc_mgr_card_open(snd_use_case_mgr_t *uc_mgr) - while (uc_mgr_card_find(ucm_card_assign)) { - ucm_card_assign++; - ucm_card_assign &= 0xffff; -+ /* avoid zero card instance number */ -+ if (ucm_card_assign == 0) -+ ucm_card_assign++; - if (ucm_card_assign == prev) { - pthread_mutex_unlock(&ucm_cards_mutex); - return -ENOMEM; --- -2.31.1 - - -From 4a52ae4c329ae17117375a4b85b80f37994a4044 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 31 Aug 2021 09:40:42 +0200 -Subject: [PATCH 20/20] ucm: fix the parsing of the hexadecimal prefix - -The safe_strtol() function use strtol() which expects -to have the '0x' prefix for the hexadecimal number (when -base argument is zero). - -BugLink: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1553 -Signed-off-by: Jaroslav Kysela ---- - src/ucm/utils.c | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/src/ucm/utils.c b/src/ucm/utils.c -index 10b21c34..2fbc4c8c 100644 ---- a/src/ucm/utils.c -+++ b/src/ucm/utils.c -@@ -811,7 +811,7 @@ void uc_mgr_card_close(snd_use_case_mgr_t *uc_mgr) - */ - const char *uc_mgr_alibcfg_by_device(snd_config_t **top, const char *name) - { -- char buf[5]; -+ char buf[7]; - long card_num; - snd_config_t *config; - snd_use_case_mgr_t *uc_mgr; -@@ -819,8 +819,10 @@ const char *uc_mgr_alibcfg_by_device(snd_config_t **top, const char *name) - - if (strncmp(name, "_ucm", 4) || strlen(name) < 12 || name[8] != '.') - return NULL; -- strncpy(buf, name + 4, 4); -- buf[4] = '\0'; -+ buf[0] = '0'; -+ buf[1] = 'x'; -+ strncpy(buf + 2, name + 4, 4); -+ buf[6] = '\0'; - err = safe_strtol(buf, &card_num); - if (err < 0 || card_num < 0 || card_num > 0xffff) - return NULL; --- -2.31.1 - diff --git a/alsa-lib.spec b/alsa-lib.spec index 5493e3c..e5448f5 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -2,14 +2,14 @@ #define prever_dot .rc3 #define postver a -%define version_alsa_lib 1.2.5.1 -%define version_alsa_ucm 1.2.5.1 +%define version_alsa_lib 1.2.6 +%define version_alsa_ucm 1.2.6 %define version_alsa_tplg 1.2.5 Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 4%{?prever_dot}%{?dist} +Release: 1%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Mon Dec 6 2021 Jaroslav Kysela - 1.2.6-1 +- update to 1.2.6 + * Sat Nov 13 2021 Peter Robinson - 1.2.5.1-4 - Add Rockchip ES8316 support diff --git a/alsa-ucm-conf.patch b/alsa-ucm-conf.patch index 0ceffd8..e69de29 100644 --- a/alsa-ucm-conf.patch +++ b/alsa-ucm-conf.patch @@ -1,147 +0,0 @@ -From 85eea19783cfccaccd859e303fda62adb63c219d Mon Sep 17 00:00:00 2001 -From: Jian-Hong Pan -Date: Tue, 7 Sep 2021 11:38:14 +0800 -Subject: [PATCH] ucm2: Add UCM support for rockchip_es8316 on Pinebook Pro - -Add UCM config files for Pinebook Pro's audio. The config files are -transformed and tuned from Manjaro ARM's packages: -* pinebookpro-post-install's asound.state [1] -* pinebookpro-audio's audio_jack_plugged_in.sh [2] - -By the way, with these config files, the Speaker and Headphones will be -switched according to the (un)plugged state automatically. - -[1] https://gitlab.manjaro.org/manjaro-arm/packages/community/pinebookpro-post-install/-/blob/4b4206c57b21044bf9c00848bd1f8b6f710d19eb/asound.state -[2] https://gitlab.manjaro.org/manjaro-arm/packages/community/pinebookpro-audio/-/blob/1f567db09495acc3beb5405c9ef85c3c07b86785/audio_jack_plugged_in.sh - -Fixes: https://github.com/alsa-project/alsa-ucm-conf/issues/110 -Fixes: https://github.com/alsa-project/alsa-ucm-conf/pull/112 -Signed-off-by: Jian-Hong Pan -Signed-off-by: Jaroslav Kysela ---- - ucm2/Rockchip/es8316/HiFi.conf | 66 +++++++++++++++++++ - ucm2/Rockchip/es8316/es8316.conf | 29 ++++++++ - .../rockchip_es8316/rockchip_es8316.conf | 1 + - 3 files changed, 96 insertions(+) - create mode 100644 ucm2/Rockchip/es8316/HiFi.conf - create mode 100644 ucm2/Rockchip/es8316/es8316.conf - create mode 120000 ucm2/conf.d/rockchip_es8316/rockchip_es8316.conf - -diff --git a/ucm2/Rockchip/es8316/HiFi.conf b/ucm2/Rockchip/es8316/HiFi.conf -new file mode 100644 -index 0000000..2124ded ---- /dev/null -+++ b/ucm2/Rockchip/es8316/HiFi.conf -@@ -0,0 +1,66 @@ -+# Reference: -+# https://gitlab.manjaro.org/manjaro-arm/packages/community/pinebookpro-post-install/-/blob/4b4206c57b21044bf9c00848bd1f8b6f710d19eb/asound.state -+# https://gitlab.manjaro.org/manjaro-arm/packages/community/pinebookpro-audio/-/blob/1f567db09495acc3beb5405c9ef85c3c07b86785/audio_jack_plugged_in.sh -+ -+SectionDevice."Speaker" { -+ Comment "Speaker" -+ -+ ConflictingDevice [ -+ "Headphones" -+ ] -+ -+ EnableSequence [ -+ cset "name='Playback Polarity' 'R Invert'" -+ cset "name='Speaker Switch' on" -+ ] -+ -+ DisableSequence [ -+ cset "name='Speaker Switch' off" -+ ] -+ -+ Value { -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId}" -+ PlaybackMixerElem "Headphone Mixer" -+ PlaybackMasterElem "DAC" -+ } -+} -+ -+SectionDevice."Mic" { -+ Comment "Internal Microphone" -+ -+ EnableSequence [ -+ cset "name='Differential Mux' lin1-rin1" -+ ] -+ -+ Value { -+ CapturePriority 100 -+ CapturePCM "hw:${CardId}" -+ CaptureMixerElem "ADC PGA Gain" -+ CaptureMasterElem "ADC" -+ } -+} -+ -+SectionDevice."Headphones" { -+ Comment "Headphones" -+ -+ ConflictingDevice [ -+ "Speaker" -+ ] -+ -+ EnableSequence [ -+ cset "name='Playback Polarity' 'Normal'" -+ ] -+ DisableSequence [ -+ cset "name='Playback Polarity' 'R Invert'" -+ ] -+ -+ Value { -+ PlaybackPriority 200 -+ PlaybackPCM "hw:${CardId}" -+ PlaybackMixerElem "Headphone Mixer" -+ PlaybackMasterElem "DAC" -+ JackControl "Headphones Jack" -+ JackHWMute "Speaker" -+ } -+} -diff --git a/ucm2/Rockchip/es8316/es8316.conf b/ucm2/Rockchip/es8316/es8316.conf -new file mode 100644 -index 0000000..62044e6 ---- /dev/null -+++ b/ucm2/Rockchip/es8316/es8316.conf -@@ -0,0 +1,29 @@ -+Syntax 3 -+ -+SectionUseCase."HiFi" { -+ File "/Rockchip/es8316/HiFi.conf" -+ Comment "Play HiFi quality Music" -+} -+ -+BootSequence [ -+ # Disable all outputs -+ cset "name='Speaker Switch' off" -+ -+ # Set HP vol to 0 dB (3/3) -+ cset "name='Headphone Playback Volume' 3" -+ # Set HP mixer vol to 0 dB -+ cset "name='Headphone Mixer Volume' 11" -+ # Set DAC vol to 0 dB (192/192) -+ cset "name='DAC Playback Volume' 192" -+ -+ # Disable Auto Level Control -+ cset "name='ALC Capture Switch' off" -+ # Set ADC vol to 0 dB (192/192) -+ cset "name='ADC Capture Volume' 192" -+ # Set Mic amplifier to +16 dB -+ cset "name='ADC PGA Gain Volume' 7" -+ -+ # Setup muxes / switches -+ cset "name='Left Headphone Mixer Left DAC Switch' on" -+ cset "name='Right Headphone Mixer Right DAC Switch' on" -+] -diff --git a/ucm2/conf.d/rockchip_es8316/rockchip_es8316.conf b/ucm2/conf.d/rockchip_es8316/rockchip_es8316.conf -new file mode 120000 -index 0000000..6d1864f ---- /dev/null -+++ b/ucm2/conf.d/rockchip_es8316/rockchip_es8316.conf -@@ -0,0 +1 @@ -+../../Rockchip/es8316/es8316.conf -\ No newline at end of file --- -2.33.1 - diff --git a/sources b/sources index ddf88ed..07eab63 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (alsa-lib-1.2.5.1.tar.bz2) = 01998ffa449e925ff552c13aea47f9540903afdc533086067c78dcaba4d239c347180d3d28bb0000e6d19b7779c7249fcc77a30057930ca22d18ba55e163fa1c +SHA512 (alsa-lib-1.2.6.tar.bz2) = ae95718813abf62811fe44c6df2a8de5a1227da4b022c4dd97dd8e7c1001f48307ba36bf04208bdbe24e8a8eebf4ed5a59f40ee6750dcbe976678071c3f2f5b7 +SHA512 (alsa-ucm-conf-1.2.6.tar.bz2) = 5fe85643b60c8defeafcdfcf97e61b5d05e6db28cef2466a70f63b8fffba22bdd50b83a5ca88806a6350de6e9d802dd3c2240b293190b9d05daea515c03d4397 SHA512 (alsa-topology-conf-1.2.5.tar.bz2) = 2eb4d8baf2dcbf0b631dd11dbf15bffc51694d9cc6931619e51787f3ba58d1a091d266e6721a3b737c040ec74a28270b93f39fb97f30a3227cf340dd646e5d51 -SHA512 (alsa-ucm-conf-1.2.5.1.tar.bz2) = 774d6da1a0ee6fb1fcd764c1d4b3eb5812a35508cf27db71f6c82784f125eca207992da9081d25783fecb31e548d8b34124d4b3b3d506e33215b76ea48f71012 From e0c620c59083c594c919e08209af26f096bcf718 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 9 Dec 2021 10:26:39 +0100 Subject: [PATCH 073/120] device open fixes from upstream --- alsa-git.patch | 97 +++++++++++++++++++++++++++++++++++++++++++++ alsa-lib.spec | 5 ++- alsa-ucm-conf.patch | 28 +++++++++++++ 3 files changed, 129 insertions(+), 1 deletion(-) diff --git a/alsa-git.patch b/alsa-git.patch index e69de29..4082c0c 100644 --- a/alsa-git.patch +++ b/alsa-git.patch @@ -0,0 +1,97 @@ +From f44c94f24c2422c5ee1c4c58253ec17412b248a9 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 7 Dec 2021 09:21:24 +0100 +Subject: [PATCH 1/2] conf: accept '_' character in the variable name + +Fixes: https://github.com/alsa-project/alsa-lib/issues/197 +Signed-off-by: Jaroslav Kysela +--- + src/confeval.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/confeval.c b/src/confeval.c +index a971bf38..be9ac874 100644 +--- a/src/confeval.c ++++ b/src/confeval.c +@@ -190,7 +190,7 @@ int _snd_eval_string(snd_config_t **dst, const char *s, + } else { + e = s + 1; + while (*e) { +- if (!isalnum(*e)) ++ if (!isalnum(*e) && *e != '_') + break; + e++; + } +-- +2.31.1 + + +From 4b22871ee5a3bbc8eef7039bfc8db5e65ff3895f Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 9 Dec 2021 10:15:29 +0100 +Subject: [PATCH 2/2] conf: fix the device parsing when arguments has no + defaults + +The commit bf528b90 sets the value to an empty string which causes +these errors: + + pcm_hw.c: Invalid type for device + pcm_hw.c: Invalid type for subdevice + +When device arguments (@args) have no default values set, +the field must be skipped to keep the compatibility. + +BugLink: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/1246 +Fixes: https://github.com/alsa-project/alsa-lib/issues/199 +Fixes: bf528b90 ("conf: add possibility to evaluate simple integer math expressions") +Signed-off-by: Jaroslav Kysela +--- + src/conf.c | 8 ++++++-- + src/confeval.c | 5 +++++ + 2 files changed, 11 insertions(+), 2 deletions(-) + +diff --git a/src/conf.c b/src/conf.c +index 0f6d2ba8..d3597cbc 100644 +--- a/src/conf.c ++++ b/src/conf.c +@@ -4994,8 +4994,10 @@ int snd_config_copy(snd_config_t **dst, + static int _snd_config_expand_vars(snd_config_t **dst, const char *s, void *private_data) + { + snd_config_t *val, *vars = private_data; +- if (snd_config_search(vars, s, &val) < 0) +- return snd_config_make_string(dst, ""); ++ if (snd_config_search(vars, s, &val) < 0) { ++ *dst = NULL; ++ return 0; ++ } + return snd_config_copy(dst, val); + } + +@@ -5060,6 +5062,8 @@ static int _snd_config_expand(snd_config_t *src, + err = snd_config_evaluate_string(dst, s, fcn, vars); + if (err < 0) + return err; ++ if (*dst == NULL) ++ return 0; + err = snd_config_set_id(*dst, id); + if (err < 0) { + snd_config_delete(*dst); +diff --git a/src/confeval.c b/src/confeval.c +index be9ac874..4a6f8c2e 100644 +--- a/src/confeval.c ++++ b/src/confeval.c +@@ -203,6 +203,11 @@ int _snd_eval_string(snd_config_t **dst, const char *s, + free(m); + if (err < 0) + return err; ++ if (tmp == NULL) { ++ err = snd_config_imake_integer(&tmp, NULL, 0); ++ if (err < 0) ++ return err; ++ } + s = e; + } + err = _to_integer(op == LEFT ? &left : &right, tmp); +-- +2.31.1 + diff --git a/alsa-lib.spec b/alsa-lib.spec index e5448f5..28c4a33 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 1%{?prever_dot}%{?dist} +Release: 2%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Thu Dec 9 2021 Jaroslav Kysela - 1.2.6-2 +- device open fixes from upstream + * Mon Dec 6 2021 Jaroslav Kysela - 1.2.6-1 - update to 1.2.6 diff --git a/alsa-ucm-conf.patch b/alsa-ucm-conf.patch index e69de29..b04faba 100644 --- a/alsa-ucm-conf.patch +++ b/alsa-ucm-conf.patch @@ -0,0 +1,28 @@ +From 244fc744e90c85f2816c5baba9fee08a85fec58e Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 9 Dec 2021 09:00:12 +0100 +Subject: [PATCH] USB-Audio: fix the wrong condition type for + If.realtek-alc1220-vb + +BugLink: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/1246 +Signed-off-by: Jaroslav Kysela +--- + ucm2/USB-Audio/USB-Audio.conf | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ucm2/USB-Audio/USB-Audio.conf b/ucm2/USB-Audio/USB-Audio.conf +index 878d16d..d9d740e 100644 +--- a/ucm2/USB-Audio/USB-Audio.conf ++++ b/ucm2/USB-Audio/USB-Audio.conf +@@ -15,7 +15,7 @@ If.linked { + If.realtek-alc1220-vb { + + Condition { +- Type Regex ++ Type RegexMatch + String "${CardComponents}" + # 0414:a002 Gigabyte TRX40 Aorus Pro WiFi + # 0b05:1917 ASUS ROG Strix +-- +2.31.1 + From e25e8171473f844cf64788b27af0df6558fa90ba Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 9 Dec 2021 12:24:17 +0100 Subject: [PATCH 074/120] AMD acp UCM fix --- alsa-lib.spec | 4 +- alsa-ucm-conf.patch | 228 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 229 insertions(+), 3 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 28c4a33..450ce1d 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 2%{?prever_dot}%{?dist} +Release: 3%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -167,7 +167,7 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog -* Thu Dec 9 2021 Jaroslav Kysela - 1.2.6-2 +* Thu Dec 9 2021 Jaroslav Kysela - 1.2.6-3 - device open fixes from upstream * Mon Dec 6 2021 Jaroslav Kysela - 1.2.6-1 diff --git a/alsa-ucm-conf.patch b/alsa-ucm-conf.patch index b04faba..f7e2ff1 100644 --- a/alsa-ucm-conf.patch +++ b/alsa-ucm-conf.patch @@ -1,7 +1,7 @@ From 244fc744e90c85f2816c5baba9fee08a85fec58e Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 9 Dec 2021 09:00:12 +0100 -Subject: [PATCH] USB-Audio: fix the wrong condition type for +Subject: [PATCH 1/3] USB-Audio: fix the wrong condition type for If.realtek-alc1220-vb BugLink: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/1246 @@ -26,3 +26,229 @@ index 878d16d..d9d740e 100644 -- 2.31.1 + +From cefbdeb9f763ab4cbba1c338716d40acb6a4e43a Mon Sep 17 00:00:00 2001 +From: AngeloGioacchino Del Regno +Date: Wed, 10 Nov 2021 14:12:39 +0100 +Subject: [PATCH 2/3] ucm2: Add support for SC7180 Trogdor Lazor Chromebooks + +Almost all Trogdor Chromebooks are using RT5682 for headphones/headset +on 3.5mm jack, internal microphone and headset microphone, and MAX98357A +for the internal speakers (Lazor and Limozeen). + +This adds support for the sc7180-rt5682-max98357a-1mic sound card found +on the aforementioned Chromebooks. + +Signed-off-by: AngeloGioacchino Del Regno +Signed-off-by: Jaroslav Kysela +--- + .../sc7180/rt5682-max98357a/HiFi.conf | 101 ++++++++++++++++++ + .../sc7180/rt5682-max98357a/init.conf | 24 +++++ + .../sc7180-rt5682-max98357a-1mic.conf | 11 ++ + .../SC7180/sc7180-rt5682-max98357a-1mic.conf | 1 + + 4 files changed, 137 insertions(+) + create mode 100644 ucm2/Qualcomm/sc7180/rt5682-max98357a/HiFi.conf + create mode 100644 ucm2/Qualcomm/sc7180/rt5682-max98357a/init.conf + create mode 100644 ucm2/Qualcomm/sc7180/rt5682-max98357a/sc7180-rt5682-max98357a-1mic.conf + create mode 120000 ucm2/conf.d/SC7180/sc7180-rt5682-max98357a-1mic.conf + +diff --git a/ucm2/Qualcomm/sc7180/rt5682-max98357a/HiFi.conf b/ucm2/Qualcomm/sc7180/rt5682-max98357a/HiFi.conf +new file mode 100644 +index 0000000..c93b4f7 +--- /dev/null ++++ b/ucm2/Qualcomm/sc7180/rt5682-max98357a/HiFi.conf +@@ -0,0 +1,101 @@ ++# Use case configuration for ALC5682+MAX98357A on SC7180 ++ ++SectionVerb { ++ Value { ++ TQ "HiFi" ++ } ++} ++ ++SectionDevice."Speaker" { ++ Comment "Speaker" ++ ++ Value { ++ PlaybackChannels 2 ++ PlaybackPCM "hw:${CardId},1" ++ PlaybackPriority 100 ++ PlaybackMixerElem "Speaker" ++ PlaybackVolume "Speaker Playback Volume" ++ } ++} ++ ++SectionDevice."Headphones" { ++ Comment "Headphones" ++ ++ EnableSequence [ ++ cset "name='HPOL Playback Switch' 1" ++ cset "name='HPOR Playback Switch' 1" ++ cset "name='Stereo1 DAC MIXL DAC L1 Switch' 1" ++ cset "name='Stereo1 DAC MIXR DAC R1 Switch' 1" ++ ] ++ ++ DisableSequence [ ++ cset "name='HPOL Playback Switch' 0" ++ cset "name='HPOR Playback Switch' 0" ++ cset "name='Stereo1 DAC MIXL DAC L1 Switch' 0" ++ cset "name='Stereo1 DAC MIXR DAC R1 Switch' 0" ++ ] ++ ++ Value { ++ PlaybackPCM "hw:${CardId},0" ++ PlaybackPriority 200 ++ PlaybackMasterElem "DAC1" ++ PlaybackMixerElem "Headphone" ++ PlaybackVolume "Headphone Playback Volume" ++ } ++} ++ ++SectionDevice."Mic" { ++ Comment "Internal Microphone" ++ ++ ConflictingDevice [ ++ "Headset" ++ ] ++ ++ EnableSequence [ ++ cset "name='IF1 01 ADC Swap Mux' 1" ++ cset "name='Stereo1 ADC L2 Mux' 1" ++ cset "name='Stereo1 ADC R2 Mux' 1" ++ cset "name='Stereo1 ADC MIXL ADC2 Switch' 1" ++ cset "name='Stereo1 ADC MIXR ADC2 Switch' 1" ++ ] ++ ++ DisableSequence [ ++ cset "name='Stereo1 ADC L2 Mux' 0" ++ cset "name='Stereo1 ADC R2 Mux' 0" ++ cset "name='Stereo1 ADC MIXL ADC2 Switch' 0" ++ cset "name='Stereo1 ADC MIXR ADC2 Switch' 0" ++ ] ++ ++ Value { ++ CapturePCM "hw:${CardId},0" ++ CapturePriority 100 ++ CaptureMixerElem "STO1 ADC" ++ CaptureVolume "STO1 ADC Capture Volume" ++ } ++} ++ ++SectionDevice."Headset" { ++ Comment "Headset Microphone" ++ ++ EnableSequence [ ++ cset "name='IF1 01 ADC Swap Mux' 2" ++ cset "name='Stereo1 ADC L1 Mux' 1" ++ cset "name='Stereo1 ADC R1 Mux' 1" ++ cset "name='Stereo1 ADC MIXL ADC1 Switch' 1" ++ cset "name='Stereo1 ADC MIXR ADC1 Switch' 1" ++ ] ++ ++ DisableSequence [ ++ cset "name='Stereo1 ADC L1 Mux' 0" ++ cset "name='Stereo1 ADC R1 Mux' 0" ++ cset "name='Stereo1 ADC MIXL ADC1 Switch' 0" ++ cset "name='Stereo1 ADC MIXR ADC1 Switch' 0" ++ ] ++ ++ Value { ++ CapturePCM "hw:${CardId},0" ++ CapturePriority 200 ++ CaptureMixerElem "STO1 ADC" ++ CaptureVolume "STO1 ADC Capture Volume" ++ } ++} +diff --git a/ucm2/Qualcomm/sc7180/rt5682-max98357a/init.conf b/ucm2/Qualcomm/sc7180/rt5682-max98357a/init.conf +new file mode 100644 +index 0000000..5dee38a +--- /dev/null ++++ b/ucm2/Qualcomm/sc7180/rt5682-max98357a/init.conf +@@ -0,0 +1,24 @@ ++BootSequence [ ++ # Headphone ++ cset "name='HPOL Playback Switch' 0" ++ cset "name='HPOR Playback Switch' 0" ++ cset "name='Stereo1 DAC MIXL DAC L1 Switch' 0" ++ cset "name='Stereo1 DAC MIXR DAC R1 Switch' 0" ++ ++ # Headset mic ++ cset "name='Stereo1 ADC L Mux' 0" ++ cset "name='STO1 ADC Capture Switch' on" ++ cset "name='RECMIX1L CBJ Switch' 1" ++ cset "name='CBJ Boost Volume' 3" ++ cset "name='Stereo1 ADC L1 Mux' 0" ++ cset "name='Stereo1 ADC R1 Mux' 0" ++ cset "name='Stereo1 ADC MIXL ADC1 Switch' 0" ++ cset "name='Stereo1 ADC MIXR ADC1 Switch' 0" ++ ++ # Internal mic on ALC5682 ++ cset "name='IF1 01 ADC Swap Mux' 1" ++ cset "name='Stereo1 ADC L2 Mux' 0" ++ cset "name='Stereo1 ADC R2 Mux' 0" ++ cset "name='Stereo1 ADC MIXL ADC2 Switch' 0" ++ cset "name='Stereo1 ADC MIXR ADC2 Switch' 0" ++] +diff --git a/ucm2/Qualcomm/sc7180/rt5682-max98357a/sc7180-rt5682-max98357a-1mic.conf b/ucm2/Qualcomm/sc7180/rt5682-max98357a/sc7180-rt5682-max98357a-1mic.conf +new file mode 100644 +index 0000000..6a2be7e +--- /dev/null ++++ b/ucm2/Qualcomm/sc7180/rt5682-max98357a/sc7180-rt5682-max98357a-1mic.conf +@@ -0,0 +1,11 @@ ++Comment "SC7180 RT5682 MAX98357A single microphone sound card" ++Syntax 4 ++ ++SectionUseCase."HiFi" { ++ File "/Qualcomm/sc7180/rt5682-max98357a/HiFi.conf" ++ Comment "Default" ++} ++ ++Include.card-init.File "/lib/card-init.conf" ++Include.ctl-remap.File "/lib/ctl-remap.conf" ++Include.init.File "/Qualcomm/sc7180/rt5682-max98357a/init.conf" +diff --git a/ucm2/conf.d/SC7180/sc7180-rt5682-max98357a-1mic.conf b/ucm2/conf.d/SC7180/sc7180-rt5682-max98357a-1mic.conf +new file mode 120000 +index 0000000..00f3e9e +--- /dev/null ++++ b/ucm2/conf.d/SC7180/sc7180-rt5682-max98357a-1mic.conf +@@ -0,0 +1 @@ ++../../Qualcomm/sc7180/rt5682-max98357a/sc7180-rt5682-max98357a-1mic.conf +\ No newline at end of file +-- +2.31.1 + + +From 60ea26507390bad3742af2272ba08b21f009d0ef Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 9 Dec 2021 11:24:14 +0100 +Subject: [PATCH 3/3] acp: fix linked configuration + +Fixes: https://github.com/alsa-project/alsa-lib/issues/199 +Signed-off-by: Jaroslav Kysela +--- + ucm2/common/linked-card.conf | 3 +++ + ucm2/conf.d/acp/acp.conf | 2 +- + 2 files changed, 4 insertions(+), 1 deletion(-) + create mode 100644 ucm2/common/linked-card.conf + +diff --git a/ucm2/common/linked-card.conf b/ucm2/common/linked-card.conf +new file mode 100644 +index 0000000..a90f20e +--- /dev/null ++++ b/ucm2/common/linked-card.conf +@@ -0,0 +1,3 @@ ++Syntax 3 ++ ++Include.linked.File "/common/linked.conf" +diff --git a/ucm2/conf.d/acp/acp.conf b/ucm2/conf.d/acp/acp.conf +index 5f056c7..7298c24 120000 +--- a/ucm2/conf.d/acp/acp.conf ++++ b/ucm2/conf.d/acp/acp.conf +@@ -1 +1 @@ +-../../common/linked.conf +\ No newline at end of file ++../../common/linked-card.conf +\ No newline at end of file +-- +2.31.1 + From 90dfeee30761fea770a3241789bc8dffb2fa2cde Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 10 Dec 2021 10:11:53 +0100 Subject: [PATCH 075/120] updated alsa-lib to 1.2.6.1 and alsa-ucm-conf to 1.2.6.2 --- alsa-git.patch | 97 ----------------- alsa-lib.spec | 9 +- alsa-ucm-conf.patch | 254 -------------------------------------------- sources | 5 +- 4 files changed, 9 insertions(+), 356 deletions(-) diff --git a/alsa-git.patch b/alsa-git.patch index 4082c0c..e69de29 100644 --- a/alsa-git.patch +++ b/alsa-git.patch @@ -1,97 +0,0 @@ -From f44c94f24c2422c5ee1c4c58253ec17412b248a9 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 7 Dec 2021 09:21:24 +0100 -Subject: [PATCH 1/2] conf: accept '_' character in the variable name - -Fixes: https://github.com/alsa-project/alsa-lib/issues/197 -Signed-off-by: Jaroslav Kysela ---- - src/confeval.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/confeval.c b/src/confeval.c -index a971bf38..be9ac874 100644 ---- a/src/confeval.c -+++ b/src/confeval.c -@@ -190,7 +190,7 @@ int _snd_eval_string(snd_config_t **dst, const char *s, - } else { - e = s + 1; - while (*e) { -- if (!isalnum(*e)) -+ if (!isalnum(*e) && *e != '_') - break; - e++; - } --- -2.31.1 - - -From 4b22871ee5a3bbc8eef7039bfc8db5e65ff3895f Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Thu, 9 Dec 2021 10:15:29 +0100 -Subject: [PATCH 2/2] conf: fix the device parsing when arguments has no - defaults - -The commit bf528b90 sets the value to an empty string which causes -these errors: - - pcm_hw.c: Invalid type for device - pcm_hw.c: Invalid type for subdevice - -When device arguments (@args) have no default values set, -the field must be skipped to keep the compatibility. - -BugLink: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/1246 -Fixes: https://github.com/alsa-project/alsa-lib/issues/199 -Fixes: bf528b90 ("conf: add possibility to evaluate simple integer math expressions") -Signed-off-by: Jaroslav Kysela ---- - src/conf.c | 8 ++++++-- - src/confeval.c | 5 +++++ - 2 files changed, 11 insertions(+), 2 deletions(-) - -diff --git a/src/conf.c b/src/conf.c -index 0f6d2ba8..d3597cbc 100644 ---- a/src/conf.c -+++ b/src/conf.c -@@ -4994,8 +4994,10 @@ int snd_config_copy(snd_config_t **dst, - static int _snd_config_expand_vars(snd_config_t **dst, const char *s, void *private_data) - { - snd_config_t *val, *vars = private_data; -- if (snd_config_search(vars, s, &val) < 0) -- return snd_config_make_string(dst, ""); -+ if (snd_config_search(vars, s, &val) < 0) { -+ *dst = NULL; -+ return 0; -+ } - return snd_config_copy(dst, val); - } - -@@ -5060,6 +5062,8 @@ static int _snd_config_expand(snd_config_t *src, - err = snd_config_evaluate_string(dst, s, fcn, vars); - if (err < 0) - return err; -+ if (*dst == NULL) -+ return 0; - err = snd_config_set_id(*dst, id); - if (err < 0) { - snd_config_delete(*dst); -diff --git a/src/confeval.c b/src/confeval.c -index be9ac874..4a6f8c2e 100644 ---- a/src/confeval.c -+++ b/src/confeval.c -@@ -203,6 +203,11 @@ int _snd_eval_string(snd_config_t **dst, const char *s, - free(m); - if (err < 0) - return err; -+ if (tmp == NULL) { -+ err = snd_config_imake_integer(&tmp, NULL, 0); -+ if (err < 0) -+ return err; -+ } - s = e; - } - err = _to_integer(op == LEFT ? &left : &right, tmp); --- -2.31.1 - diff --git a/alsa-lib.spec b/alsa-lib.spec index 450ce1d..ca20bee 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -2,14 +2,14 @@ #define prever_dot .rc3 #define postver a -%define version_alsa_lib 1.2.6 -%define version_alsa_ucm 1.2.6 +%define version_alsa_lib 1.2.6.1 +%define version_alsa_ucm 1.2.6.2 %define version_alsa_tplg 1.2.5 Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 3%{?prever_dot}%{?dist} +Release: 1%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Fri Dec 10 2021 Jaroslav Kysela - 1.2.6.1-1 +- updated alsa-lib to 1.2.6.1 and alsa-ucm-conf to 1.2.6.2 + * Thu Dec 9 2021 Jaroslav Kysela - 1.2.6-3 - device open fixes from upstream diff --git a/alsa-ucm-conf.patch b/alsa-ucm-conf.patch index f7e2ff1..e69de29 100644 --- a/alsa-ucm-conf.patch +++ b/alsa-ucm-conf.patch @@ -1,254 +0,0 @@ -From 244fc744e90c85f2816c5baba9fee08a85fec58e Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Thu, 9 Dec 2021 09:00:12 +0100 -Subject: [PATCH 1/3] USB-Audio: fix the wrong condition type for - If.realtek-alc1220-vb - -BugLink: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/1246 -Signed-off-by: Jaroslav Kysela ---- - ucm2/USB-Audio/USB-Audio.conf | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/ucm2/USB-Audio/USB-Audio.conf b/ucm2/USB-Audio/USB-Audio.conf -index 878d16d..d9d740e 100644 ---- a/ucm2/USB-Audio/USB-Audio.conf -+++ b/ucm2/USB-Audio/USB-Audio.conf -@@ -15,7 +15,7 @@ If.linked { - If.realtek-alc1220-vb { - - Condition { -- Type Regex -+ Type RegexMatch - String "${CardComponents}" - # 0414:a002 Gigabyte TRX40 Aorus Pro WiFi - # 0b05:1917 ASUS ROG Strix --- -2.31.1 - - -From cefbdeb9f763ab4cbba1c338716d40acb6a4e43a Mon Sep 17 00:00:00 2001 -From: AngeloGioacchino Del Regno -Date: Wed, 10 Nov 2021 14:12:39 +0100 -Subject: [PATCH 2/3] ucm2: Add support for SC7180 Trogdor Lazor Chromebooks - -Almost all Trogdor Chromebooks are using RT5682 for headphones/headset -on 3.5mm jack, internal microphone and headset microphone, and MAX98357A -for the internal speakers (Lazor and Limozeen). - -This adds support for the sc7180-rt5682-max98357a-1mic sound card found -on the aforementioned Chromebooks. - -Signed-off-by: AngeloGioacchino Del Regno -Signed-off-by: Jaroslav Kysela ---- - .../sc7180/rt5682-max98357a/HiFi.conf | 101 ++++++++++++++++++ - .../sc7180/rt5682-max98357a/init.conf | 24 +++++ - .../sc7180-rt5682-max98357a-1mic.conf | 11 ++ - .../SC7180/sc7180-rt5682-max98357a-1mic.conf | 1 + - 4 files changed, 137 insertions(+) - create mode 100644 ucm2/Qualcomm/sc7180/rt5682-max98357a/HiFi.conf - create mode 100644 ucm2/Qualcomm/sc7180/rt5682-max98357a/init.conf - create mode 100644 ucm2/Qualcomm/sc7180/rt5682-max98357a/sc7180-rt5682-max98357a-1mic.conf - create mode 120000 ucm2/conf.d/SC7180/sc7180-rt5682-max98357a-1mic.conf - -diff --git a/ucm2/Qualcomm/sc7180/rt5682-max98357a/HiFi.conf b/ucm2/Qualcomm/sc7180/rt5682-max98357a/HiFi.conf -new file mode 100644 -index 0000000..c93b4f7 ---- /dev/null -+++ b/ucm2/Qualcomm/sc7180/rt5682-max98357a/HiFi.conf -@@ -0,0 +1,101 @@ -+# Use case configuration for ALC5682+MAX98357A on SC7180 -+ -+SectionVerb { -+ Value { -+ TQ "HiFi" -+ } -+} -+ -+SectionDevice."Speaker" { -+ Comment "Speaker" -+ -+ Value { -+ PlaybackChannels 2 -+ PlaybackPCM "hw:${CardId},1" -+ PlaybackPriority 100 -+ PlaybackMixerElem "Speaker" -+ PlaybackVolume "Speaker Playback Volume" -+ } -+} -+ -+SectionDevice."Headphones" { -+ Comment "Headphones" -+ -+ EnableSequence [ -+ cset "name='HPOL Playback Switch' 1" -+ cset "name='HPOR Playback Switch' 1" -+ cset "name='Stereo1 DAC MIXL DAC L1 Switch' 1" -+ cset "name='Stereo1 DAC MIXR DAC R1 Switch' 1" -+ ] -+ -+ DisableSequence [ -+ cset "name='HPOL Playback Switch' 0" -+ cset "name='HPOR Playback Switch' 0" -+ cset "name='Stereo1 DAC MIXL DAC L1 Switch' 0" -+ cset "name='Stereo1 DAC MIXR DAC R1 Switch' 0" -+ ] -+ -+ Value { -+ PlaybackPCM "hw:${CardId},0" -+ PlaybackPriority 200 -+ PlaybackMasterElem "DAC1" -+ PlaybackMixerElem "Headphone" -+ PlaybackVolume "Headphone Playback Volume" -+ } -+} -+ -+SectionDevice."Mic" { -+ Comment "Internal Microphone" -+ -+ ConflictingDevice [ -+ "Headset" -+ ] -+ -+ EnableSequence [ -+ cset "name='IF1 01 ADC Swap Mux' 1" -+ cset "name='Stereo1 ADC L2 Mux' 1" -+ cset "name='Stereo1 ADC R2 Mux' 1" -+ cset "name='Stereo1 ADC MIXL ADC2 Switch' 1" -+ cset "name='Stereo1 ADC MIXR ADC2 Switch' 1" -+ ] -+ -+ DisableSequence [ -+ cset "name='Stereo1 ADC L2 Mux' 0" -+ cset "name='Stereo1 ADC R2 Mux' 0" -+ cset "name='Stereo1 ADC MIXL ADC2 Switch' 0" -+ cset "name='Stereo1 ADC MIXR ADC2 Switch' 0" -+ ] -+ -+ Value { -+ CapturePCM "hw:${CardId},0" -+ CapturePriority 100 -+ CaptureMixerElem "STO1 ADC" -+ CaptureVolume "STO1 ADC Capture Volume" -+ } -+} -+ -+SectionDevice."Headset" { -+ Comment "Headset Microphone" -+ -+ EnableSequence [ -+ cset "name='IF1 01 ADC Swap Mux' 2" -+ cset "name='Stereo1 ADC L1 Mux' 1" -+ cset "name='Stereo1 ADC R1 Mux' 1" -+ cset "name='Stereo1 ADC MIXL ADC1 Switch' 1" -+ cset "name='Stereo1 ADC MIXR ADC1 Switch' 1" -+ ] -+ -+ DisableSequence [ -+ cset "name='Stereo1 ADC L1 Mux' 0" -+ cset "name='Stereo1 ADC R1 Mux' 0" -+ cset "name='Stereo1 ADC MIXL ADC1 Switch' 0" -+ cset "name='Stereo1 ADC MIXR ADC1 Switch' 0" -+ ] -+ -+ Value { -+ CapturePCM "hw:${CardId},0" -+ CapturePriority 200 -+ CaptureMixerElem "STO1 ADC" -+ CaptureVolume "STO1 ADC Capture Volume" -+ } -+} -diff --git a/ucm2/Qualcomm/sc7180/rt5682-max98357a/init.conf b/ucm2/Qualcomm/sc7180/rt5682-max98357a/init.conf -new file mode 100644 -index 0000000..5dee38a ---- /dev/null -+++ b/ucm2/Qualcomm/sc7180/rt5682-max98357a/init.conf -@@ -0,0 +1,24 @@ -+BootSequence [ -+ # Headphone -+ cset "name='HPOL Playback Switch' 0" -+ cset "name='HPOR Playback Switch' 0" -+ cset "name='Stereo1 DAC MIXL DAC L1 Switch' 0" -+ cset "name='Stereo1 DAC MIXR DAC R1 Switch' 0" -+ -+ # Headset mic -+ cset "name='Stereo1 ADC L Mux' 0" -+ cset "name='STO1 ADC Capture Switch' on" -+ cset "name='RECMIX1L CBJ Switch' 1" -+ cset "name='CBJ Boost Volume' 3" -+ cset "name='Stereo1 ADC L1 Mux' 0" -+ cset "name='Stereo1 ADC R1 Mux' 0" -+ cset "name='Stereo1 ADC MIXL ADC1 Switch' 0" -+ cset "name='Stereo1 ADC MIXR ADC1 Switch' 0" -+ -+ # Internal mic on ALC5682 -+ cset "name='IF1 01 ADC Swap Mux' 1" -+ cset "name='Stereo1 ADC L2 Mux' 0" -+ cset "name='Stereo1 ADC R2 Mux' 0" -+ cset "name='Stereo1 ADC MIXL ADC2 Switch' 0" -+ cset "name='Stereo1 ADC MIXR ADC2 Switch' 0" -+] -diff --git a/ucm2/Qualcomm/sc7180/rt5682-max98357a/sc7180-rt5682-max98357a-1mic.conf b/ucm2/Qualcomm/sc7180/rt5682-max98357a/sc7180-rt5682-max98357a-1mic.conf -new file mode 100644 -index 0000000..6a2be7e ---- /dev/null -+++ b/ucm2/Qualcomm/sc7180/rt5682-max98357a/sc7180-rt5682-max98357a-1mic.conf -@@ -0,0 +1,11 @@ -+Comment "SC7180 RT5682 MAX98357A single microphone sound card" -+Syntax 4 -+ -+SectionUseCase."HiFi" { -+ File "/Qualcomm/sc7180/rt5682-max98357a/HiFi.conf" -+ Comment "Default" -+} -+ -+Include.card-init.File "/lib/card-init.conf" -+Include.ctl-remap.File "/lib/ctl-remap.conf" -+Include.init.File "/Qualcomm/sc7180/rt5682-max98357a/init.conf" -diff --git a/ucm2/conf.d/SC7180/sc7180-rt5682-max98357a-1mic.conf b/ucm2/conf.d/SC7180/sc7180-rt5682-max98357a-1mic.conf -new file mode 120000 -index 0000000..00f3e9e ---- /dev/null -+++ b/ucm2/conf.d/SC7180/sc7180-rt5682-max98357a-1mic.conf -@@ -0,0 +1 @@ -+../../Qualcomm/sc7180/rt5682-max98357a/sc7180-rt5682-max98357a-1mic.conf -\ No newline at end of file --- -2.31.1 - - -From 60ea26507390bad3742af2272ba08b21f009d0ef Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Thu, 9 Dec 2021 11:24:14 +0100 -Subject: [PATCH 3/3] acp: fix linked configuration - -Fixes: https://github.com/alsa-project/alsa-lib/issues/199 -Signed-off-by: Jaroslav Kysela ---- - ucm2/common/linked-card.conf | 3 +++ - ucm2/conf.d/acp/acp.conf | 2 +- - 2 files changed, 4 insertions(+), 1 deletion(-) - create mode 100644 ucm2/common/linked-card.conf - -diff --git a/ucm2/common/linked-card.conf b/ucm2/common/linked-card.conf -new file mode 100644 -index 0000000..a90f20e ---- /dev/null -+++ b/ucm2/common/linked-card.conf -@@ -0,0 +1,3 @@ -+Syntax 3 -+ -+Include.linked.File "/common/linked.conf" -diff --git a/ucm2/conf.d/acp/acp.conf b/ucm2/conf.d/acp/acp.conf -index 5f056c7..7298c24 120000 ---- a/ucm2/conf.d/acp/acp.conf -+++ b/ucm2/conf.d/acp/acp.conf -@@ -1 +1 @@ --../../common/linked.conf -\ No newline at end of file -+../../common/linked-card.conf -\ No newline at end of file --- -2.31.1 - diff --git a/sources b/sources index 07eab63..1544afe 100644 --- a/sources +++ b/sources @@ -1,3 +1,4 @@ -SHA512 (alsa-lib-1.2.6.tar.bz2) = ae95718813abf62811fe44c6df2a8de5a1227da4b022c4dd97dd8e7c1001f48307ba36bf04208bdbe24e8a8eebf4ed5a59f40ee6750dcbe976678071c3f2f5b7 -SHA512 (alsa-ucm-conf-1.2.6.tar.bz2) = 5fe85643b60c8defeafcdfcf97e61b5d05e6db28cef2466a70f63b8fffba22bdd50b83a5ca88806a6350de6e9d802dd3c2240b293190b9d05daea515c03d4397 +SHA512 (alsa-lib-1.2.6.1.tar.bz2) = 70e539cf092b5d43e00e4134d8a3e184f0dc34312823e4b58a574320cbf06cb7369bc3251ecb1858033756a7a8c35d36faa8da48d49f6efe0cec905784adbd45 +SHA512 (alsa-ucm-conf-1.2.6.2.tar.bz2) = d7122279bc36ab16dfe1a5f2e24b9dda57e1b59b7c7aeac3c8755af62b464053ed038aa56ebb52d7707ecae01674cac920ea784bb7493d978276a98cbf78d873 SHA512 (alsa-topology-conf-1.2.5.tar.bz2) = 2eb4d8baf2dcbf0b631dd11dbf15bffc51694d9cc6931619e51787f3ba58d1a091d266e6721a3b737c040ec74a28270b93f39fb97f30a3227cf340dd646e5d51 + From 82be0e2f26737e92a0fe75da4bc30e45c76e1953 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 10 Dec 2021 11:38:41 +0100 Subject: [PATCH 076/120] correct Requires --- alsa-lib.spec | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index ca20bee..54e6b2b 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 1%{?prever_dot}%{?dist} +Release: 2%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -52,7 +52,7 @@ against the ALSA libraries and interfaces. Summary: ALSA Use Case Manager configuration BuildArch: noarch License: BSD -Requires: %{name} >= %{version_alsa_ucm} +Requires: %{name} >= %{version_alsa_lib} %description -n alsa-ucm The Advanced Linux Sound Architecture (ALSA) Use Case Manager configuration @@ -62,7 +62,7 @@ contains alsa-lib configuration of Audio input/output names and routing Summary: ALSA Topology configuration BuildArch: noarch License: BSD -Requires: %{name} >= %{version_alsa_tplg} +Requires: %{name} >= %{version_alsa_lib} %description -n alsa-topology The Advanced Linux Sound Architecture (ALSA) topology configuration @@ -167,7 +167,7 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog -* Fri Dec 10 2021 Jaroslav Kysela - 1.2.6.1-1 +* Fri Dec 10 2021 Jaroslav Kysela - 1.2.6.1-2 - updated alsa-lib to 1.2.6.1 and alsa-ucm-conf to 1.2.6.2 * Thu Dec 9 2021 Jaroslav Kysela - 1.2.6-3 From dc95b94f410f463ef5a7aba1e74d5560e11ef6dc Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 17 Dec 2021 17:57:34 +0100 Subject: [PATCH 077/120] updated alsa-ucm-conf to 1.2.6.3 Signed-off-by: Jaroslav Kysela --- alsa-lib.spec | 7 +++++-- sources | 3 +-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 54e6b2b..6609be4 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -3,13 +3,13 @@ #define postver a %define version_alsa_lib 1.2.6.1 -%define version_alsa_ucm 1.2.6.2 +%define version_alsa_ucm 1.2.6.3 %define version_alsa_tplg 1.2.5 Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 2%{?prever_dot}%{?dist} +Release: 3%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Fri Dec 17 2021 Jaroslav Kysela - 1.2.6.1-3 +- updated alsa-ucm-conf to 1.2.6.3 + * Fri Dec 10 2021 Jaroslav Kysela - 1.2.6.1-2 - updated alsa-lib to 1.2.6.1 and alsa-ucm-conf to 1.2.6.2 diff --git a/sources b/sources index 1544afe..b6ee355 100644 --- a/sources +++ b/sources @@ -1,4 +1,3 @@ SHA512 (alsa-lib-1.2.6.1.tar.bz2) = 70e539cf092b5d43e00e4134d8a3e184f0dc34312823e4b58a574320cbf06cb7369bc3251ecb1858033756a7a8c35d36faa8da48d49f6efe0cec905784adbd45 -SHA512 (alsa-ucm-conf-1.2.6.2.tar.bz2) = d7122279bc36ab16dfe1a5f2e24b9dda57e1b59b7c7aeac3c8755af62b464053ed038aa56ebb52d7707ecae01674cac920ea784bb7493d978276a98cbf78d873 +SHA512 (alsa-ucm-conf-1.2.6.3.tar.bz2) = 14031173dd9b44c506f13172fcf89d1119e4b2d409a749ec8ef4948e75231a5e5091206e826dff9e70f1f803de8cfb9fd94886ef70764c705f65c1c7ebdf649f SHA512 (alsa-topology-conf-1.2.5.tar.bz2) = 2eb4d8baf2dcbf0b631dd11dbf15bffc51694d9cc6931619e51787f3ba58d1a091d266e6721a3b737c040ec74a28270b93f39fb97f30a3227cf340dd646e5d51 - From 390f3b3f7f3f8328f19c6cc09f315bc7e2cc85ce Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 19 Jan 2022 21:09:13 +0000 Subject: [PATCH 078/120] - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- alsa-lib.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 6609be4..0fd8903 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 3%{?prever_dot}%{?dist} +Release: 4%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Wed Jan 19 2022 Fedora Release Engineering - 1.2.6.1-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + * Fri Dec 17 2021 Jaroslav Kysela - 1.2.6.1-3 - updated alsa-ucm-conf to 1.2.6.3 From dcc23d2d03dcbcf29eebb8e697d9a12a2843e310 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 31 May 2022 17:01:32 +0200 Subject: [PATCH 079/120] update to 1.2.7 Signed-off-by: Jaroslav Kysela --- alsa-lib.spec | 9 ++++++--- sources | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 0fd8903..3945f7d 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -2,14 +2,14 @@ #define prever_dot .rc3 #define postver a -%define version_alsa_lib 1.2.6.1 -%define version_alsa_ucm 1.2.6.3 +%define version_alsa_lib 1.2.7 +%define version_alsa_ucm 1.2.7 %define version_alsa_tplg 1.2.5 Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 4%{?prever_dot}%{?dist} +Release: 1%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Tue May 31 2022 Jaroslav Kysela - 1.2.7-1 +- update to 1.2.7 + * Wed Jan 19 2022 Fedora Release Engineering - 1.2.6.1-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild diff --git a/sources b/sources index b6ee355..2ea7d58 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (alsa-lib-1.2.6.1.tar.bz2) = 70e539cf092b5d43e00e4134d8a3e184f0dc34312823e4b58a574320cbf06cb7369bc3251ecb1858033756a7a8c35d36faa8da48d49f6efe0cec905784adbd45 -SHA512 (alsa-ucm-conf-1.2.6.3.tar.bz2) = 14031173dd9b44c506f13172fcf89d1119e4b2d409a749ec8ef4948e75231a5e5091206e826dff9e70f1f803de8cfb9fd94886ef70764c705f65c1c7ebdf649f +SHA512 (alsa-lib-1.2.7.tar.bz2) = 6bd48b07d659fddad792876326a93b2a549ce94bc191131670365599c31f81f737bfd8e94dec6fe296bc5d86df2e3e381bbb7a694d24fe7e8e501f1c994ed084 +SHA512 (alsa-ucm-conf-1.2.7.tar.bz2) = 3f69343213632ca4196d83f2713302ff9839d9c5fcdf9e0c0be4d358a854844085f9c18acad01dfdf492eda203e2bd5d40939b09074e9c0b57692732bb3136ae SHA512 (alsa-topology-conf-1.2.5.tar.bz2) = 2eb4d8baf2dcbf0b631dd11dbf15bffc51694d9cc6931619e51787f3ba58d1a091d266e6721a3b737c040ec74a28270b93f39fb97f30a3227cf340dd646e5d51 From afa3fc0a7e03df871fb7cfcddd3ae2de5e5fba10 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 17 Jun 2022 12:02:36 +0200 Subject: [PATCH 080/120] update to 1.2.7.1 Signed-off-by: Jaroslav Kysela --- alsa-lib.spec | 7 +++++-- sources | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 3945f7d..6e72097 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -2,8 +2,8 @@ #define prever_dot .rc3 #define postver a -%define version_alsa_lib 1.2.7 -%define version_alsa_ucm 1.2.7 +%define version_alsa_lib 1.2.7.1 +%define version_alsa_ucm 1.2.7.1 %define version_alsa_tplg 1.2.5 Summary: The Advanced Linux Sound Architecture (ALSA) library @@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Fri Jun 17 2022 Jaroslav Kysela - 1.2.7.1-1 +- update to 1.2.7.1 + * Tue May 31 2022 Jaroslav Kysela - 1.2.7-1 - update to 1.2.7 diff --git a/sources b/sources index 2ea7d58..32115d2 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (alsa-lib-1.2.7.tar.bz2) = 6bd48b07d659fddad792876326a93b2a549ce94bc191131670365599c31f81f737bfd8e94dec6fe296bc5d86df2e3e381bbb7a694d24fe7e8e501f1c994ed084 -SHA512 (alsa-ucm-conf-1.2.7.tar.bz2) = 3f69343213632ca4196d83f2713302ff9839d9c5fcdf9e0c0be4d358a854844085f9c18acad01dfdf492eda203e2bd5d40939b09074e9c0b57692732bb3136ae +SHA512 (alsa-lib-1.2.7.1.tar.bz2) = 2a0b4205e8bf602b56a6f5007ba219799e5443827393058e439adf5b391bb6c4815a48bb994b5d108b9f31a90db0eb43a96a0d7741216e2d710dc63d372de27e +SHA512 (alsa-ucm-conf-1.2.7.1.tar.bz2) = e2ade1b4f4d26cfb77fb423b82b7eea1b51bbb4857b771acb845da3f3f99c846ec28a415eb184c7d79ffbe1edf21f026951778f905e23658d78deaebb1315759 SHA512 (alsa-topology-conf-1.2.5.tar.bz2) = 2eb4d8baf2dcbf0b631dd11dbf15bffc51694d9cc6931619e51787f3ba58d1a091d266e6721a3b737c040ec74a28270b93f39fb97f30a3227cf340dd646e5d51 From 218694a669c4a5039bd3cceadd95b8f437ff66e3 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 8 Jul 2022 17:43:32 +0200 Subject: [PATCH 081/120] update to 1.2.7.2 Signed-off-by: Jaroslav Kysela --- alsa-lib.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 6e72097..de479e2 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -2,8 +2,8 @@ #define prever_dot .rc3 #define postver a -%define version_alsa_lib 1.2.7.1 -%define version_alsa_ucm 1.2.7.1 +%define version_alsa_lib 1.2.7.2 +%define version_alsa_ucm 1.2.7.2 %define version_alsa_tplg 1.2.5 Summary: The Advanced Linux Sound Architecture (ALSA) library @@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Fri Jul 8 2022 Jaroslav Kysela - 1.2.7.1-2 +- update to 1.2.7.2 + * Fri Jun 17 2022 Jaroslav Kysela - 1.2.7.1-1 - update to 1.2.7.1 From c2ac4b6efa1eb3219dc51b76160ac698c6cce687 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 8 Jul 2022 17:48:32 +0200 Subject: [PATCH 082/120] add missing sources --- sources | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources b/sources index 32115d2..9cdca5b 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (alsa-lib-1.2.7.1.tar.bz2) = 2a0b4205e8bf602b56a6f5007ba219799e5443827393058e439adf5b391bb6c4815a48bb994b5d108b9f31a90db0eb43a96a0d7741216e2d710dc63d372de27e -SHA512 (alsa-ucm-conf-1.2.7.1.tar.bz2) = e2ade1b4f4d26cfb77fb423b82b7eea1b51bbb4857b771acb845da3f3f99c846ec28a415eb184c7d79ffbe1edf21f026951778f905e23658d78deaebb1315759 +SHA512 (alsa-lib-1.2.7.2.tar.bz2) = 79e5920384e570a1acd8ecd1eb8812879333c3cedb1d15780080afc40125b97df893c33f4163d9dd863871b628bc6026265f8ace2c8634fc1af5b52b62ac9cfe +SHA512 (alsa-ucm-conf-1.2.7.2.tar.bz2) = b6866f1ca6a3f4d69d7923bc1107a64b49944a3a8756f129f39034e5390e08db1c295669e54dfe1437ca934cc11abf407f60fc8319f5cba3f021966e8654c2db SHA512 (alsa-topology-conf-1.2.5.tar.bz2) = 2eb4d8baf2dcbf0b631dd11dbf15bffc51694d9cc6931619e51787f3ba58d1a091d266e6721a3b737c040ec74a28270b93f39fb97f30a3227cf340dd646e5d51 From 17a5a602622cc190657d5a69e1ba615b66d4804b Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 20 Jul 2022 20:40:54 +0000 Subject: [PATCH 083/120] Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- alsa-lib.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index de479e2..a8fc106 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 1%{?prever_dot}%{?dist} +Release: 2%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Wed Jul 20 2022 Fedora Release Engineering - 1.2.7.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + * Fri Jul 8 2022 Jaroslav Kysela - 1.2.7.1-2 - update to 1.2.7.2 From 8362c2ece3232f65955e2bbbffbabd353e5995f7 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 24 Oct 2022 10:43:23 +0200 Subject: [PATCH 084/120] update to 1.2.8 Signed-off-by: Jaroslav Kysela --- alsa-lib.spec | 9 ++++++--- sources | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index a8fc106..b665d0f 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -2,14 +2,14 @@ #define prever_dot .rc3 #define postver a -%define version_alsa_lib 1.2.7.2 -%define version_alsa_ucm 1.2.7.2 +%define version_alsa_lib 1.2.8 +%define version_alsa_ucm 1.2.8 %define version_alsa_tplg 1.2.5 Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 2%{?prever_dot}%{?dist} +Release: 1%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Mon Oct 24 2022 Jaroslav Kysela - 1.2.8-1 +- update to 1.2.8 + * Wed Jul 20 2022 Fedora Release Engineering - 1.2.7.2-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild diff --git a/sources b/sources index 9cdca5b..81824da 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (alsa-lib-1.2.7.2.tar.bz2) = 79e5920384e570a1acd8ecd1eb8812879333c3cedb1d15780080afc40125b97df893c33f4163d9dd863871b628bc6026265f8ace2c8634fc1af5b52b62ac9cfe -SHA512 (alsa-ucm-conf-1.2.7.2.tar.bz2) = b6866f1ca6a3f4d69d7923bc1107a64b49944a3a8756f129f39034e5390e08db1c295669e54dfe1437ca934cc11abf407f60fc8319f5cba3f021966e8654c2db +SHA512 (alsa-lib-1.2.8.tar.bz2) = 865ff05a8f589996f8d63d43a91c961f1b64144f3e1d17c7074b7ac16f25b3fd1c371d46ed63a8cc20fa01e63c76b75f1a9802b56889ae1073854dd050d27688 +SHA512 (alsa-ucm-conf-1.2.8.tar.bz2) = a15a9ca52c108ee95a421b91f3fad4329f1e9fb1c004a40d5ff1a57d6701bad19a31d5a296426d26439be9b87d2d543ce51588a98402d24c17f0f92aaf1096ca SHA512 (alsa-topology-conf-1.2.5.tar.bz2) = 2eb4d8baf2dcbf0b631dd11dbf15bffc51694d9cc6931619e51787f3ba58d1a091d266e6721a3b737c040ec74a28270b93f39fb97f30a3227cf340dd646e5d51 From f2b55673dfa966c7aec1331d4efe044fcf8b1a3b Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 7 Dec 2022 15:04:08 +0100 Subject: [PATCH 085/120] update alsa-lib and ucm conf to latest git BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=2134824 Signed-off-by: Jaroslav Kysela --- alsa-git.patch | 1511 +++++++++++++++++++++++++++++++++++++++++++ alsa-lib.spec | 6 +- alsa-ucm-conf.patch | 1296 +++++++++++++++++++++++++++++++++++++ 3 files changed, 2812 insertions(+), 1 deletion(-) diff --git a/alsa-git.patch b/alsa-git.patch index e69de29..b023625 100644 --- a/alsa-git.patch +++ b/alsa-git.patch @@ -0,0 +1,1511 @@ +From 1b436862ed6253629d79edc2e09826efd4e0f4e3 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 2 Nov 2022 15:01:56 +0100 +Subject: [PATCH 01/18] ucm: fix enhanced ID parsing in + snd_use_case_parse_ctl_elem_id() + +Reported-by: Takashi Iwai +Signed-off-by: Jaroslav Kysela +--- + src/ucm/main.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/ucm/main.c b/src/ucm/main.c +index 30ab1e41..28c60565 100644 +--- a/src/ucm/main.c ++++ b/src/ucm/main.c +@@ -2793,7 +2793,7 @@ int snd_use_case_parse_ctl_elem_id(snd_ctl_elem_id_t *dst, + strcmp(ucm_id, "CaptureSwitch")) + return -EINVAL; + snd_ctl_elem_id_clear(dst); +- if (strcasestr(ucm_id, "name=")) ++ if (strcasestr(value, "name=")) + return __snd_ctl_ascii_elem_id_parse(dst, value, NULL); + iface = SND_CTL_ELEM_IFACE_MIXER; + if (jack_control) +-- +2.38.1 + + +From aa4f56c3c952269c36464cc0da9db5a1381648fa Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 9 Nov 2022 08:11:42 +0100 +Subject: [PATCH 02/18] pcm: rate - fix the crash in + snd_pcm_rate_may_wait_for_avail_min() + +The pcm argument passed to the conversion function in +snd_pcm_plugin_may_wait_for_avail_min_conv() should be +pcm->fast_op_arg. + +Test command: arecord -Dplughw:x -r12000 -c2 -fS16_LE -M temp.wav + +Fixes: d9dbb57b ("pcm: rate - rewrite the may_wait_for_avail_min callback for the rate plugin") + +BugLink: https://lore.kernel.org/alsa-devel/1667793912-18957-1-git-send-email-shengjiu.wang@nxp.com/ +Fixes: https://github.com/alsa-project/alsa-lib/issues/282 +Reported-by: Shengjiu Wang +Signed-off-by: Jaroslav Kysela +--- + src/pcm/pcm_plugin.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c +index 6bb90b8b..ec64604c 100644 +--- a/src/pcm/pcm_plugin.c ++++ b/src/pcm/pcm_plugin.c +@@ -622,7 +622,7 @@ int snd_pcm_plugin_may_wait_for_avail_min_conv( + * This code is also used by extplug, but extplug does not allow to alter the sampling rate. + */ + if (conv) +- needed_slave_avail_min = conv(pcm, needed_slave_avail_min); ++ needed_slave_avail_min = conv(pcm->fast_op_arg, needed_slave_avail_min); + + if (slave->avail_min != needed_slave_avail_min) { + snd_pcm_sw_params_t *swparams; +-- +2.38.1 + + +From 39060852d810461dc8cd1464cfb2ffe84da42d56 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 9 Nov 2022 09:31:34 +0100 +Subject: [PATCH 03/18] pcm: rate - correct the previous fix for + snd_pcm_rate_may_wait_for_avail_min() + +The previous fix in aa4f56c3 was not correct. The root of the cause is +implementation in snd_pcm_may_wait_for_avail_min() inline function +where the improper pcm argument is passed to the fast_ops function. + +Fixes: aa4f56c3 ("pcm: rate - fix the crash in snd_pcm_rate_may_wait_for_avail_min()") +Fixes: d9dbb57b ("pcm: rate - rewrite the may_wait_for_avail_min callback for the rate plugin") +Signed-off-by: Jaroslav Kysela +--- + src/pcm/pcm_local.h | 2 +- + src/pcm/pcm_plugin.c | 10 +++++++--- + 2 files changed, 8 insertions(+), 4 deletions(-) + +diff --git a/src/pcm/pcm_local.h b/src/pcm/pcm_local.h +index 8d25971f..ae0c44bf 100644 +--- a/src/pcm/pcm_local.h ++++ b/src/pcm/pcm_local.h +@@ -1144,7 +1144,7 @@ static inline int snd_pcm_may_wait_for_avail_min(snd_pcm_t *pcm, snd_pcm_uframes + if (avail >= pcm->avail_min) + return 0; + if (pcm->fast_ops->may_wait_for_avail_min) +- return pcm->fast_ops->may_wait_for_avail_min(pcm, avail); ++ return pcm->fast_ops->may_wait_for_avail_min(pcm->fast_op_arg, avail); + return 1; + } + +diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c +index ec64604c..b3af1fb7 100644 +--- a/src/pcm/pcm_plugin.c ++++ b/src/pcm/pcm_plugin.c +@@ -597,8 +597,12 @@ int snd_pcm_plugin_may_wait_for_avail_min_conv( + * a) the slave can provide contineous hw_ptr between periods + * b) avail_min does not match one slave_period + */ +- snd_pcm_plugin_t *plugin = pcm->private_data; +- snd_pcm_t *slave = plugin->gen.slave; ++ snd_pcm_generic_t *generic = pcm->private_data; ++ /* ++ * do not use snd_pcm_plugin_t pointer here ++ * this code is used from the generic plugins, too ++ */ ++ snd_pcm_t *slave = generic->slave; + snd_pcm_uframes_t needed_slave_avail_min; + snd_pcm_sframes_t available; + +@@ -622,7 +626,7 @@ int snd_pcm_plugin_may_wait_for_avail_min_conv( + * This code is also used by extplug, but extplug does not allow to alter the sampling rate. + */ + if (conv) +- needed_slave_avail_min = conv(pcm->fast_op_arg, needed_slave_avail_min); ++ needed_slave_avail_min = conv(pcm, needed_slave_avail_min); + + if (slave->avail_min != needed_slave_avail_min) { + snd_pcm_sw_params_t *swparams; +-- +2.38.1 + + +From 161f47da5f196c291ac0e11d066fa5ff5f79fa04 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 9 Nov 2022 14:37:45 +0100 +Subject: [PATCH 04/18] include: pcm_old.h - use a macro for the symbol + versioning + +Make the header file more readable and error prone. + +Signed-off-by: Jaroslav Kysela +--- + include/pcm_old.h | 133 ++++++++++++++++++++++++---------------------- + 1 file changed, 68 insertions(+), 65 deletions(-) + +diff --git a/include/pcm_old.h b/include/pcm_old.h +index e6e050fc..a9f5308f 100644 +--- a/include/pcm_old.h ++++ b/include/pcm_old.h +@@ -2,11 +2,14 @@ + * Old ALSA 0.9.x API + */ + ++#define ___symbol_version(name, version) \ ++ __asm__ (".symver " #name "," #name "@" version) ++ + #ifdef ALSA_PCM_OLD_HW_PARAMS_API + +-asm(".symver snd_pcm_hw_params_get_access,snd_pcm_hw_params_get_access@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_set_access_first,snd_pcm_hw_params_set_access_first@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_set_access_last,snd_pcm_hw_params_set_access_last@ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_get_access, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_set_access_first, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_set_access_last, "ALSA_0.9"); + + int snd_pcm_hw_params_get_access(const snd_pcm_hw_params_t *params); + int snd_pcm_hw_params_test_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t val); +@@ -16,9 +19,9 @@ snd_pcm_access_t snd_pcm_hw_params_set_access_last(snd_pcm_t *pcm, snd_pcm_hw_pa + int snd_pcm_hw_params_set_access_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask); + void snd_pcm_hw_params_get_access_mask(snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask); + +-asm(".symver snd_pcm_hw_params_get_format,snd_pcm_hw_params_get_format@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_set_format_first,snd_pcm_hw_params_set_format_first@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_set_format_last,snd_pcm_hw_params_set_format_last@ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_get_format, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_set_format_first, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_set_format_last, "ALSA_0.9"); + + int snd_pcm_hw_params_get_format(const snd_pcm_hw_params_t *params); + int snd_pcm_hw_params_test_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val); +@@ -28,9 +31,9 @@ snd_pcm_format_t snd_pcm_hw_params_set_format_last(snd_pcm_t *pcm, snd_pcm_hw_pa + int snd_pcm_hw_params_set_format_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask); + void snd_pcm_hw_params_get_format_mask(snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask); + +-asm(".symver snd_pcm_hw_params_get_subformat,snd_pcm_hw_params_get_subformat@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_set_subformat_first,snd_pcm_hw_params_set_subformat_first@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_set_subformat_last,snd_pcm_hw_params_set_subformat_last@ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_get_subformat, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_set_subformat_first, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_set_subformat_last, "ALSA_0.9"); + + int snd_pcm_hw_params_test_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t val); + int snd_pcm_hw_params_get_subformat(const snd_pcm_hw_params_t *params); +@@ -40,12 +43,12 @@ snd_pcm_subformat_t snd_pcm_hw_params_set_subformat_last(snd_pcm_t *pcm, snd_pcm + int snd_pcm_hw_params_set_subformat_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask); + void snd_pcm_hw_params_get_subformat_mask(snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask); + +-asm(".symver snd_pcm_hw_params_get_channels,snd_pcm_hw_params_get_channels@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_get_channels_min,snd_pcm_hw_params_get_channels_min@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_get_channels_max,snd_pcm_hw_params_get_channels_max@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_set_channels_near,snd_pcm_hw_params_set_channels_near@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_set_channels_first,snd_pcm_hw_params_set_channels_first@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_set_channels_last,snd_pcm_hw_params_set_channels_last@ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_get_channels, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_get_channels_min, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_get_channels_max, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_set_channels_near, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_set_channels_first, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_set_channels_last, "ALSA_0.9"); + + int snd_pcm_hw_params_get_channels(const snd_pcm_hw_params_t *params); + unsigned int snd_pcm_hw_params_get_channels_min(const snd_pcm_hw_params_t *params); +@@ -59,12 +62,12 @@ unsigned int snd_pcm_hw_params_set_channels_near(snd_pcm_t *pcm, snd_pcm_hw_para + unsigned int snd_pcm_hw_params_set_channels_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); + unsigned int snd_pcm_hw_params_set_channels_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); + +-asm(".symver snd_pcm_hw_params_get_rate,snd_pcm_hw_params_get_rate@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_get_rate_min,snd_pcm_hw_params_get_rate_min@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_get_rate_max,snd_pcm_hw_params_get_rate_max@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_set_rate_near,snd_pcm_hw_params_set_rate_near@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_set_rate_first,snd_pcm_hw_params_set_rate_first@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_set_rate_last,snd_pcm_hw_params_set_rate_last@ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_get_rate, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_get_rate_min, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_get_rate_max, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_set_rate_near, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_set_rate_first, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_set_rate_last, "ALSA_0.9"); + + int snd_pcm_hw_params_get_rate(const snd_pcm_hw_params_t *params, int *dir); + unsigned int snd_pcm_hw_params_get_rate_min(const snd_pcm_hw_params_t *params, int *dir); +@@ -80,12 +83,12 @@ unsigned int snd_pcm_hw_params_set_rate_last(snd_pcm_t *pcm, snd_pcm_hw_params_t + int snd_pcm_hw_params_set_rate_resample(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val); + int snd_pcm_hw_params_get_rate_resample(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val); + +-asm(".symver snd_pcm_hw_params_get_period_time,snd_pcm_hw_params_get_period_time@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_get_period_time_min,snd_pcm_hw_params_get_period_time_min@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_get_period_time_max,snd_pcm_hw_params_get_period_time_max@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_set_period_time_near,snd_pcm_hw_params_set_period_time_near@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_set_period_time_first,snd_pcm_hw_params_set_period_time_first@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_set_period_time_last,snd_pcm_hw_params_set_period_time_last@ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_get_period_time, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_get_period_time_min, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_get_period_time_max, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_set_period_time_near, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_set_period_time_first, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_set_period_time_last, "ALSA_0.9"); + + int snd_pcm_hw_params_get_period_time(const snd_pcm_hw_params_t *params, int *dir); + unsigned int snd_pcm_hw_params_get_period_time_min(const snd_pcm_hw_params_t *params, int *dir); +@@ -99,12 +102,12 @@ unsigned int snd_pcm_hw_params_set_period_time_near(snd_pcm_t *pcm, snd_pcm_hw_p + unsigned int snd_pcm_hw_params_set_period_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); + unsigned int snd_pcm_hw_params_set_period_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); + +-asm(".symver snd_pcm_hw_params_get_period_size,snd_pcm_hw_params_get_period_size@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_get_period_size_min,snd_pcm_hw_params_get_period_size_min@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_get_period_size_max,snd_pcm_hw_params_get_period_size_max@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_set_period_size_near,snd_pcm_hw_params_set_period_size_near@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_set_period_size_first,snd_pcm_hw_params_set_period_size_first@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_set_period_size_last,snd_pcm_hw_params_set_period_size_last@ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_get_period_size, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_get_period_size_min, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_get_period_size_max, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_set_period_size_near, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_set_period_size_first, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_set_period_size_last, "ALSA_0.9"); + + snd_pcm_sframes_t snd_pcm_hw_params_get_period_size(const snd_pcm_hw_params_t *params, int *dir); + snd_pcm_uframes_t snd_pcm_hw_params_get_period_size_min(const snd_pcm_hw_params_t *params, int *dir); +@@ -119,12 +122,12 @@ snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_first(snd_pcm_t *pcm, snd_pc + snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); + int snd_pcm_hw_params_set_period_size_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); + +-asm(".symver snd_pcm_hw_params_get_periods,snd_pcm_hw_params_get_periods@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_get_periods_min,snd_pcm_hw_params_get_periods_min@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_get_periods_max,snd_pcm_hw_params_get_periods_max@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_set_periods_near,snd_pcm_hw_params_set_periods_near@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_set_periods_first,snd_pcm_hw_params_set_periods_first@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_set_periods_last,snd_pcm_hw_params_set_periods_last@ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_get_periods, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_get_periods_min, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_get_periods_max, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_set_periods_near, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_set_periods_first, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_set_periods_last, "ALSA_0.9"); + + int snd_pcm_hw_params_get_periods(const snd_pcm_hw_params_t *params, int *dir); + unsigned int snd_pcm_hw_params_get_periods_min(const snd_pcm_hw_params_t *params, int *dir); +@@ -139,12 +142,12 @@ unsigned int snd_pcm_hw_params_set_periods_first(snd_pcm_t *pcm, snd_pcm_hw_para + unsigned int snd_pcm_hw_params_set_periods_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); + int snd_pcm_hw_params_set_periods_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); + +-asm(".symver snd_pcm_hw_params_get_buffer_time,snd_pcm_hw_params_get_buffer_time@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_get_buffer_time_min,snd_pcm_hw_params_get_buffer_time_min@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_get_buffer_time_max,snd_pcm_hw_params_get_buffer_time_max@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_set_buffer_time_near,snd_pcm_hw_params_set_buffer_time_near@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_set_buffer_time_first,snd_pcm_hw_params_set_buffer_time_first@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_set_buffer_time_last,snd_pcm_hw_params_set_buffer_time_last@ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_get_buffer_time, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_get_buffer_time_min, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_get_buffer_time_max, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_set_buffer_time_near, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_set_buffer_time_first, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_set_buffer_time_last, "ALSA_0.9"); + + int snd_pcm_hw_params_get_buffer_time(const snd_pcm_hw_params_t *params, int *dir); + unsigned int snd_pcm_hw_params_get_buffer_time_min(const snd_pcm_hw_params_t *params, int *dir); +@@ -158,12 +161,12 @@ unsigned int snd_pcm_hw_params_set_buffer_time_near(snd_pcm_t *pcm, snd_pcm_hw_p + unsigned int snd_pcm_hw_params_set_buffer_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); + unsigned int snd_pcm_hw_params_set_buffer_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); + +-asm(".symver snd_pcm_hw_params_get_buffer_size,snd_pcm_hw_params_get_buffer_size@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_get_buffer_size_min,snd_pcm_hw_params_get_buffer_size_min@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_get_buffer_size_max,snd_pcm_hw_params_get_buffer_size_max@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_set_buffer_size_near,snd_pcm_hw_params_set_buffer_size_near@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_set_buffer_size_first,snd_pcm_hw_params_set_buffer_size_first@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_set_buffer_size_last,snd_pcm_hw_params_set_buffer_size_last@ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_get_buffer_size, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_get_buffer_size_min, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_get_buffer_size_max, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_set_buffer_size_near, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_set_buffer_size_first, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_set_buffer_size_last, "ALSA_0.9"); + + snd_pcm_sframes_t snd_pcm_hw_params_get_buffer_size(const snd_pcm_hw_params_t *params); + snd_pcm_uframes_t snd_pcm_hw_params_get_buffer_size_min(const snd_pcm_hw_params_t *params); +@@ -177,12 +180,12 @@ snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_near(snd_pcm_t *pcm, snd_pcm + snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); + snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); + +-asm(".symver snd_pcm_hw_params_get_tick_time,snd_pcm_hw_params_get_tick_time@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_get_tick_time_min,snd_pcm_hw_params_get_tick_time_min@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_get_tick_time_max,snd_pcm_hw_params_get_tick_time_max@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_set_tick_time_near,snd_pcm_hw_params_set_tick_time_near@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_set_tick_time_first,snd_pcm_hw_params_set_tick_time_first@ALSA_0.9"); +-asm(".symver snd_pcm_hw_params_set_tick_time_last,snd_pcm_hw_params_set_tick_time_last@ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_get_tick_time, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_get_tick_time_min, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_get_tick_time_max, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_set_tick_time_near, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_set_tick_time_first, "ALSA_0.9"); ++___symbol_version(snd_pcm_hw_params_set_tick_time_last, "ALSA_0.9"); + + int snd_pcm_hw_params_get_tick_time(const snd_pcm_hw_params_t *params, int *dir); + unsigned int snd_pcm_hw_params_get_tick_time_min(const snd_pcm_hw_params_t *params, int *dir); +@@ -201,14 +204,14 @@ unsigned int snd_pcm_hw_params_set_tick_time_last(snd_pcm_t *pcm, snd_pcm_hw_par + + #ifdef ALSA_PCM_OLD_SW_PARAMS_API + +-asm(".symver snd_pcm_sw_params_get_tstamp_mode,snd_pcm_sw_params_get_tstamp_mode@ALSA_0.9"); +-asm(".symver snd_pcm_sw_params_get_sleep_min,snd_pcm_sw_params_get_sleep_min@ALSA_0.9"); +-asm(".symver snd_pcm_sw_params_get_avail_min,snd_pcm_sw_params_get_avail_min@ALSA_0.9"); +-asm(".symver snd_pcm_sw_params_get_xfer_align,snd_pcm_sw_params_get_xfer_align@ALSA_0.9"); +-asm(".symver snd_pcm_sw_params_get_start_threshold,snd_pcm_sw_params_get_start_threshold@ALSA_0.9"); +-asm(".symver snd_pcm_sw_params_get_stop_threshold,snd_pcm_sw_params_get_stop_threshold@ALSA_0.9"); +-asm(".symver snd_pcm_sw_params_get_silence_threshold,snd_pcm_sw_params_get_silence_threshold@ALSA_0.9"); +-asm(".symver snd_pcm_sw_params_get_silence_size,snd_pcm_sw_params_get_silence_size@ALSA_0.9"); ++___symbol_version(snd_pcm_sw_params_get_tstamp_mode, "ALSA_0.9"); ++___symbol_version(snd_pcm_sw_params_get_sleep_min, "ALSA_0.9"); ++___symbol_version(snd_pcm_sw_params_get_avail_min, "ALSA_0.9"); ++___symbol_version(snd_pcm_sw_params_get_xfer_align, "ALSA_0.9"); ++___symbol_version(snd_pcm_sw_params_get_start_threshold, "ALSA_0.9"); ++___symbol_version(snd_pcm_sw_params_get_stop_threshold, "ALSA_0.9"); ++___symbol_version(snd_pcm_sw_params_get_silence_threshold, "ALSA_0.9"); ++___symbol_version(snd_pcm_sw_params_get_silence_size, "ALSA_0.9"); + + int snd_pcm_sw_params_set_tstamp_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_tstamp_t val); + snd_pcm_tstamp_t snd_pcm_sw_params_get_tstamp_mode(const snd_pcm_sw_params_t *params); +-- +2.38.1 + + +From 152983f01b0bc1178ea0d461ebf66e2d2a8e2e02 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 9 Nov 2022 15:04:06 +0100 +Subject: [PATCH 05/18] include: alsa-symbols.h - use newer gcc symver function + attribute + +Use the symver function attribute for newer gccs (version 11+). +The symver function attribute was introduced probably earlier +(gcc-10). We can fix that on demand later. + +Signed-off-by: Jaroslav Kysela +--- + include/alsa-symbols.h | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/include/alsa-symbols.h b/include/alsa-symbols.h +index 344f021a..f8c49103 100644 +--- a/include/alsa-symbols.h ++++ b/include/alsa-symbols.h +@@ -29,10 +29,17 @@ + #define INTERNAL_CONCAT2_2(Pre, Post) Pre##Post + #define INTERNAL(Name) INTERNAL_CONCAT2_2(__, Name) + ++#if __GNUC__ > 10 ++#define symbol_version(real, name, version) \ ++ extern __typeof (real) real __attribute__((symver (#name "@" #version))) ++#define default_symbol_version(real, name, version) \ ++ extern __typeof (real) real __attribute__((symver (#name "@@" #version))) ++#else + #define symbol_version(real, name, version) \ + __asm__ (".symver " ASM_NAME(#real) "," ASM_NAME(#name) "@" #version) + #define default_symbol_version(real, name, version) \ + __asm__ (".symver " ASM_NAME(#real) "," ASM_NAME(#name) "@@" #version) ++#endif + + #ifdef __clang__ + #define EXPORT_SYMBOL __attribute__((visibility("default"))) +-- +2.38.1 + + +From 78b20e3caa7bba930095e05f3f8cbe665204fcfd Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 14 Nov 2022 12:36:04 +0100 +Subject: [PATCH 06/18] test: latency - use snd_pcm_format_physical_width() + +We need to allocate frames using the physical size not +the sample bit size. + +Signed-off-by: Jaroslav Kysela +--- + src/topology/ctl.c | 7 ++++++- + test/latency.c | 6 +++--- + 2 files changed, 9 insertions(+), 4 deletions(-) + +diff --git a/src/topology/ctl.c b/src/topology/ctl.c +index dd05424d..2c500ffc 100644 +--- a/src/topology/ctl.c ++++ b/src/topology/ctl.c +@@ -17,9 +17,13 @@ + Liam Girdwood + */ + ++#define ALSA_PCM_OLD_HW_PARAMS_API 1 ++#define ALSA_PCM_OLD_SW_PARAMS_API 1 ++#include "../../include/asoundlib.h" + #include "list.h" + #include "tplg_local.h" + ++ + #define ENUM_VAL_SIZE (SNDRV_CTL_ELEM_ID_NAME_MAXLEN >> 2) + + struct ctl_access_elem { +@@ -71,7 +75,8 @@ static int parse_access_values(snd_config_t *cfg, + } + } + } +- ++ return snd_pcm_hw_params_get_channels(NULL); ++ //return snd_pcm_hw_params_get_access(NULL); + return 0; + } + +diff --git a/test/latency.c b/test/latency.c +index 298bab8a..95b3c0ee 100644 +--- a/test/latency.c ++++ b/test/latency.c +@@ -354,7 +354,7 @@ long readbuf(snd_pcm_t *handle, char *buf, long len, size_t *frames, size_t *max + } + // printf("read = %li\n", r); + } else { +- int frame_bytes = (snd_pcm_format_width(format) / 8) * channels; ++ int frame_bytes = (snd_pcm_format_physical_width(format) / 8) * channels; + do { + r = snd_pcm_readi(handle, buf, len); + if (r > 0) { +@@ -374,7 +374,7 @@ long readbuf(snd_pcm_t *handle, char *buf, long len, size_t *frames, size_t *max + long writebuf(snd_pcm_t *handle, char *buf, long len, size_t *frames) + { + long r; +- int frame_bytes = (snd_pcm_format_width(format) / 8) * channels; ++ int frame_bytes = (snd_pcm_format_physical_width(format) / 8) * channels; + + while (len > 0) { + r = snd_pcm_writei(handle, buf, len); +@@ -579,7 +579,7 @@ int main(int argc, char *argv[]) + + loop_limit = loop_sec * rate; + latency = latency_min - 4; +- buffer = malloc((latency_max * snd_pcm_format_width(format) / 8) * 2); ++ buffer = malloc((latency_max * snd_pcm_format_physical_width(format) / 8) * 2); + + setscheduler(); + +-- +2.38.1 + + +From 425e4d1fbea4965ea0fb7529b1ee6cbb47eb7227 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 14 Nov 2022 14:34:46 +0100 +Subject: [PATCH 07/18] pcm: fix the fast_ops pcm argument for fast_ops + +The fast_ops callback invocation must always pass the fast_op_arg +as the pcm argument. Plugins expect that. + +Signed-off-by: Jaroslav Kysela +--- + src/pcm/pcm.c | 4 ++-- + src/pcm/pcm_direct.c | 2 +- + src/pcm/pcm_hw.c | 2 +- + src/pcm/pcm_multi.c | 5 +++-- + 4 files changed, 7 insertions(+), 6 deletions(-) + +diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c +index 927aa055..2b966d44 100644 +--- a/src/pcm/pcm.c ++++ b/src/pcm/pcm.c +@@ -1705,7 +1705,7 @@ int snd_pcm_link(snd_pcm_t *pcm1, snd_pcm_t *pcm2) + assert(pcm1); + assert(pcm2); + if (pcm1->fast_ops->link) +- err = pcm1->fast_ops->link(pcm1, pcm2); ++ err = pcm1->fast_ops->link(pcm1->fast_op_arg, pcm2); + else + err = -ENOSYS; + return err; +@@ -1722,7 +1722,7 @@ int snd_pcm_unlink(snd_pcm_t *pcm) + + assert(pcm); + if (pcm->fast_ops->unlink) +- err = pcm->fast_ops->unlink(pcm); ++ err = pcm->fast_ops->unlink(pcm->fast_op_arg); + else + err = -ENOSYS; + return err; +diff --git a/src/pcm/pcm_direct.c b/src/pcm/pcm_direct.c +index 4803b81b..3cc5305f 100644 +--- a/src/pcm/pcm_direct.c ++++ b/src/pcm/pcm_direct.c +@@ -688,7 +688,7 @@ int snd_pcm_direct_check_xrun(snd_pcm_direct_t *direct, snd_pcm_t *pcm) + * so don't increment but just update to actual counter + */ + direct->recoveries = direct->shmptr->s.recoveries; +- pcm->fast_ops->drop(pcm); ++ pcm->fast_ops->drop(pcm->fast_op_arg); + /* trigger_tstamp update is missing in drop callbacks */ + gettimestamp(&direct->trigger_tstamp, pcm->tstamp_type); + /* no timer clear: +diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c +index 5dfe32ee..0588ce5e 100644 +--- a/src/pcm/pcm_hw.c ++++ b/src/pcm/pcm_hw.c +@@ -838,7 +838,7 @@ static int snd_pcm_hw_link(snd_pcm_t *pcm1, snd_pcm_t *pcm2) + { + if (pcm2->type != SND_PCM_TYPE_HW) { + if (pcm2->fast_ops->link_slaves) +- return pcm2->fast_ops->link_slaves(pcm2, pcm1); ++ return pcm2->fast_ops->link_slaves(pcm2->fast_op_arg, pcm1); + return -ENOSYS; + } + return hw_link(pcm1, pcm2); +diff --git a/src/pcm/pcm_multi.c b/src/pcm/pcm_multi.c +index bec6d06f..3e7ce82c 100644 +--- a/src/pcm/pcm_multi.c ++++ b/src/pcm/pcm_multi.c +@@ -759,8 +759,9 @@ static int snd_pcm_multi_link_slaves(snd_pcm_t *pcm, snd_pcm_t *master) + static int snd_pcm_multi_link(snd_pcm_t *pcm1, snd_pcm_t *pcm2) + { + snd_pcm_multi_t *multi = pcm1->private_data; +- if (multi->slaves[0].pcm->fast_ops->link) +- return multi->slaves[0].pcm->fast_ops->link(multi->slaves[0].pcm, pcm2); ++ snd_pcm_t *main_pcm = multi->slaves[0].pcm; ++ if (main_pcm->fast_ops->link) ++ return main_pcm->fast_ops->link(main_pcm->fast_op_arg, pcm2); + return -ENOSYS; + } + +-- +2.38.1 + + +From 3e4aeba25bf4a4808183c4b64270f7321b436c13 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 14 Nov 2022 20:42:10 +0100 +Subject: [PATCH 08/18] test: latency - add more realtime tests + +Add '-x' and '-X' tests and '-U' - I/O update mode based +on the system timing. + +It may be required to check the position updates for the specific hardware. +Print the real time / stream time differences. + +Also include code to make valgrind happy (including the wrong memory +llocation for the stream buffer). + +Signed-off-by: Jaroslav Kysela +--- + test/latency.c | 163 +++++++++++++++++++++++++++++++++++++++++++++---- + 1 file changed, 151 insertions(+), 12 deletions(-) + +diff --git a/test/latency.c b/test/latency.c +index 95b3c0ee..91bef1a1 100644 +--- a/test/latency.c ++++ b/test/latency.c +@@ -33,10 +33,13 @@ + #include + #include + #include ++#include + #include "../include/asoundlib.h" + #include + #include + ++typedef struct timespec timestamp_t; ++ + char *pdevice = "hw:0,0"; + char *cdevice = "hw:0,0"; + snd_pcm_format_t format = SND_PCM_FORMAT_S16_LE; +@@ -50,10 +53,40 @@ int loop_sec = 30; /* seconds */ + int block = 0; /* block mode */ + int use_poll = 0; + int resample = 1; ++int sys_latency = 0; /* data I/O: use system timings instead driver wakeups */ ++int pos_dump = 0; /* dump positions */ ++int realtime_check = 0; + unsigned long loop_limit; ++snd_pcm_uframes_t playback_buffer_size; + + snd_output_t *output = NULL; + ++static inline long long frames_to_micro(size_t frames) ++{ ++ return (long long)((frames * 1000000LL) + (rate / 2)) / rate; ++} ++ ++void timestamp_now(timestamp_t *tstamp) ++{ ++ if (clock_gettime(CLOCK_MONOTONIC_RAW, tstamp)) ++ printf("clock_gettime() failed\n"); ++} ++ ++long long timestamp_diff_micro(timestamp_t *tstamp) ++{ ++ timestamp_t now, diff; ++ timestamp_now(&now); ++ if (tstamp->tv_nsec > now.tv_nsec) { ++ diff.tv_sec = now.tv_sec - tstamp->tv_sec - 1; ++ diff.tv_nsec = (now.tv_nsec + 1000000000L) - tstamp->tv_nsec; ++ } else { ++ diff.tv_sec = now.tv_sec - tstamp->tv_sec; ++ diff.tv_nsec = now.tv_nsec - tstamp->tv_nsec; ++ } ++ /* microseconds */ ++ return (diff.tv_sec * 1000000) + ((diff.tv_nsec + 500L) / 1000L); ++} ++ + int setparams_stream(snd_pcm_t *handle, + snd_pcm_hw_params_t *params, + const char *id) +@@ -96,6 +129,14 @@ int setparams_stream(snd_pcm_t *handle, + printf("Rate doesn't match (requested %iHz, get %iHz)\n", rate, err); + return -EINVAL; + } ++ /* we do not want driver wakeups */ ++ if (sys_latency > 0 && snd_pcm_hw_params_can_disable_period_wakeup(params)) { ++ err = snd_pcm_hw_params_set_period_wakeup(handle, params, 0); ++ if (err < 0) { ++ printf("Cannot disable period wakeups for %s\n", id); ++ return err; ++ } ++ } + return 0; + } + +@@ -227,6 +268,7 @@ int setparams(snd_pcm_t *phandle, snd_pcm_t *chandle, int *bufsize) + goto __again; + + snd_pcm_hw_params_get_buffer_size(p_params, &p_size); ++ playback_buffer_size = p_size; + if (p_psize * 2 < p_size) { + snd_pcm_hw_params_get_periods_min(p_params, &val, NULL); + if (val > 2) { +@@ -390,7 +432,7 @@ long writebuf(snd_pcm_t *handle, char *buf, long len, size_t *frames) + } + return 0; + } +- ++ + #define FILTERSWEEP_LFO_CENTER 2000. + #define FILTERSWEEP_LFO_DEPTH 1800. + #define FILTERSWEEP_LFO_FREQ 0.2 +@@ -434,6 +476,19 @@ void applyeffect(char* buffer,int r) + } + } + ++static ssize_t get_avail(snd_pcm_t *pcm) ++{ ++ ssize_t avail; ++ ++ while (1) { ++ avail = snd_pcm_avail(pcm); ++ if (avail == -EAGAIN) ++ continue; ++ break; ++ } ++ return avail; ++} ++ + void help(void) + { + int k; +@@ -444,6 +499,7 @@ void help(void) + "-C,--cdevice capture device\n" + "-m,--min minimum latency in frames\n" + "-M,--max maximum latency in frames\n" ++"-U,--updates I/O updates in milliseconds (0 = off)\n" + "-F,--frames frames to transfer\n" + "-f,--format sample format\n" + "-c,--channels channels\n" +@@ -454,6 +510,8 @@ void help(void) + "-b,--block block mode\n" + "-p,--poll use poll (wait for event - reduces CPU usage)\n" + "-e,--effect apply an effect (bandpass filter sweep)\n" ++"-x,--posdump dump buffer positions\n" ++"-X,--realtime do a realtime check (buffering)\n" + ); + printf("Recognized sample formats are:"); + for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) { +@@ -480,6 +538,7 @@ int main(int argc, char *argv[]) + {"cdevice", 1, NULL, 'C'}, + {"min", 1, NULL, 'm'}, + {"max", 1, NULL, 'M'}, ++ {"updates", 1, NULL, 'U'}, + {"frames", 1, NULL, 'F'}, + {"format", 1, NULL, 'f'}, + {"channels", 1, NULL, 'c'}, +@@ -490,20 +549,23 @@ int main(int argc, char *argv[]) + {"block", 0, NULL, 'b'}, + {"poll", 0, NULL, 'p'}, + {"effect", 0, NULL, 'e'}, ++ {"posdump", 0, NULL, 'x'}, ++ {"realtime", 0, NULL, 'X'}, + {NULL, 0, NULL, 0}, + }; + snd_pcm_t *phandle, *chandle; + char *buffer; + int err, latency, morehelp; +- int ok; ++ int ok, first_avail; + snd_timestamp_t p_tstamp, c_tstamp; +- ssize_t r; ++ ssize_t r, cap_avail, cap_avail_max, pbk_fill, pbk_fill_min; + size_t frames_in, frames_out, in_max; ++ timestamp_t tstamp_start; + int effect = 0; + morehelp = 0; + while (1) { + int c; +- if ((c = getopt_long(argc, argv, "hP:C:m:M:F:f:c:r:B:E:s:bpen", long_option, NULL)) < 0) ++ if ((c = getopt_long(argc, argv, "hP:C:m:M:U:F:f:c:r:B:E:s:bpenxX", long_option, NULL)) < 0) + break; + switch (c) { + case 'h': +@@ -525,6 +587,10 @@ int main(int argc, char *argv[]) + err = atoi(optarg) / 2; + latency_max = latency_min > err ? latency_min : err; + break; ++ case 'U': ++ err = atoi(optarg); ++ sys_latency = err <= 0 ? 0 : err; ++ break; + case 'f': + format = snd_pcm_format_value(optarg); + if (format == SND_PCM_FORMAT_UNKNOWN) { +@@ -564,6 +630,12 @@ int main(int argc, char *argv[]) + case 'n': + resample = 0; + break; ++ case 'x': ++ pos_dump = 1; ++ break; ++ case 'X': ++ realtime_check = 1; ++ break; + } + } + +@@ -579,15 +651,27 @@ int main(int argc, char *argv[]) + + loop_limit = loop_sec * rate; + latency = latency_min - 4; +- buffer = malloc((latency_max * snd_pcm_format_physical_width(format) / 8) * 2); ++ buffer = malloc((latency_max * 2 * snd_pcm_format_physical_width(format) / 8) * channels); ++ ++ /* I/O updates based on a system timer */ ++ if (sys_latency > 0) { ++ block = 0; ++ use_poll = 0; ++ } + + setscheduler(); + + printf("Playback device is %s\n", pdevice); + printf("Capture device is %s\n", cdevice); +- printf("Parameters are %iHz, %s, %i channels, %s mode\n", rate, snd_pcm_format_name(format), channels, block ? "blocking" : "non-blocking"); +- printf("Poll mode: %s\n", use_poll ? "yes" : "no"); +- printf("Loop limit is %lu frames, minimum latency = %i, maximum latency = %i\n", loop_limit, latency_min * 2, latency_max * 2); ++ printf("Parameters are %iHz, %s, %i channels, %s mode, use poll %s\n", ++ rate, snd_pcm_format_name(format), ++ channels, block ? "blocking" : "non-blocking", ++ use_poll ? "yes" : "no"); ++ printf("Loop limit is %lu frames, minimum latency = %i, maximum latency = %i", ++ loop_limit, latency_min * 2, latency_max * 2); ++ if (sys_latency > 0) ++ printf(", I/O updates %ims", sys_latency); ++ printf("\n"); + + if ((err = snd_pcm_open(&phandle, pdevice, SND_PCM_STREAM_PLAYBACK, block ? 0 : SND_PCM_NONBLOCK)) < 0) { + printf("Playback open error: %s\n", snd_strerror(err)); +@@ -613,6 +697,9 @@ int main(int argc, char *argv[]) + y[1] = (float*) malloc(channels*sizeof(float)); + y[2] = (float*) malloc(channels*sizeof(float)); + } ++ ++ cap_avail_max = 0; ++ pbk_fill_min = latency * 2; + + while (1) { + frames_in = frames_out = 0; +@@ -623,7 +710,7 @@ int main(int argc, char *argv[]) + printf("Streams link error: %s\n", snd_strerror(err)); + exit(0); + } +- if (snd_pcm_format_set_silence(format, buffer, latency*channels) < 0) { ++ if (snd_pcm_format_set_silence(format, buffer, latency * channels) < 0) { + fprintf(stderr, "silence error\n"); + break; + } +@@ -640,6 +727,8 @@ int main(int argc, char *argv[]) + printf("Go error: %s\n", snd_strerror(err)); + exit(0); + } ++ if (realtime_check) ++ timestamp_now(&tstamp_start); + gettimestamp(phandle, &p_tstamp); + gettimestamp(chandle, &c_tstamp); + #if 0 +@@ -651,16 +740,54 @@ int main(int argc, char *argv[]) + + ok = 1; + in_max = 0; ++ first_avail = 1; + while (ok && frames_in < loop_limit) { +- if (use_poll) { ++ cap_avail = latency; ++ if (sys_latency > 0) { ++ poll(NULL, 0, sys_latency); ++ cap_avail = get_avail(chandle); ++ if (cap_avail < 0) { ++ printf("Avail failed: %s\n", snd_strerror(cap_avail)); ++ ok = 0; ++ break; ++ } ++ if (first_avail && realtime_check) { ++ long long diff = timestamp_diff_micro(&tstamp_start); ++ long long pos = frames_to_micro(cap_avail); ++ printf("POS FIRST CHECK: c=%zd (rt=%lldus)\n", cap_avail, pos - diff); ++ first_avail = 0; ++ } ++ } else if (use_poll) { + /* use poll to wait for next event */ + snd_pcm_wait(chandle, 1000); + } +- if ((r = readbuf(chandle, buffer, latency, &frames_in, &in_max)) < 0) ++ if (pos_dump || realtime_check) { ++ if (sys_latency <= 0) ++ cap_avail = get_avail(chandle); ++ pbk_fill = get_avail(phandle); ++ if (pbk_fill >= 0) ++ pbk_fill = playback_buffer_size - pbk_fill; ++ if (cap_avail > cap_avail_max) ++ cap_avail_max = cap_avail; ++ if (pbk_fill >= 0 && pbk_fill < pbk_fill_min) ++ pbk_fill_min = pbk_fill; ++ if (realtime_check) { ++ long long diff = timestamp_diff_micro(&tstamp_start); ++ long long cap_pos = frames_to_micro(frames_in + cap_avail); ++ long long pbk_pos = frames_to_micro(frames_out - pbk_fill); ++ printf("POS: p=%zd (min=%zd, rt=%lldus) c=%zd (max=%zd, rt=%lldus)\n", ++ pbk_fill, pbk_fill_min, pbk_pos - diff, ++ cap_avail, cap_avail_max, cap_pos - diff); ++ } else if (pos_dump) { ++ printf("POS: p=%zd (min=%zd), c=%zd (max=%zd)\n", ++ pbk_fill, pbk_fill_min, cap_avail, cap_avail_max); ++ } ++ } ++ if ((r = readbuf(chandle, buffer, cap_avail, &frames_in, &in_max)) < 0) + ok = 0; + else { + if (effect) +- applyeffect(buffer,r); ++ applyeffect(buffer, r); + if (writebuf(phandle, buffer, r, &frames_out) < 0) + ok = 0; + } +@@ -677,6 +804,13 @@ int main(int argc, char *argv[]) + if (p_tstamp.tv_sec == c_tstamp.tv_sec && + p_tstamp.tv_usec == c_tstamp.tv_usec) + printf("Hardware sync\n"); ++ if (realtime_check) { ++ long long diff = timestamp_diff_micro(&tstamp_start); ++ long long mtime = frames_to_micro(frames_in); ++ printf("Elapsed real time: %lldus\n", diff); ++ printf("Elapsed device time: %lldus\n", mtime); ++ printf("Test time diff (device - real): %lldus\n", mtime - diff); ++ } + snd_pcm_drop(chandle); + snd_pcm_nonblock(phandle, 0); + snd_pcm_drain(phandle); +@@ -698,5 +832,10 @@ int main(int argc, char *argv[]) + } + snd_pcm_close(phandle); + snd_pcm_close(chandle); ++ snd_output_close(output); ++ snd_config_update_free_global(); ++ free(buffer); ++ free(pdevice); ++ free(cdevice); + return 0; + } +-- +2.38.1 + + +From a0836e2af1f2c37b66e723d8caf399e80b76825b Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 14 Nov 2022 21:26:39 +0100 +Subject: [PATCH 09/18] latency: add timestamps to the POS lines + +- remove first capture pos line +- measure the snd_pcm_start() call, too + +Signed-off-by: Jaroslav Kysela +--- + test/latency.c | 17 ++++++----------- + 1 file changed, 6 insertions(+), 11 deletions(-) + +diff --git a/test/latency.c b/test/latency.c +index 91bef1a1..3aff37c1 100644 +--- a/test/latency.c ++++ b/test/latency.c +@@ -556,7 +556,7 @@ int main(int argc, char *argv[]) + snd_pcm_t *phandle, *chandle; + char *buffer; + int err, latency, morehelp; +- int ok, first_avail; ++ int ok; + snd_timestamp_t p_tstamp, c_tstamp; + ssize_t r, cap_avail, cap_avail_max, pbk_fill, pbk_fill_min; + size_t frames_in, frames_out, in_max; +@@ -723,12 +723,14 @@ int main(int argc, char *argv[]) + break; + } + ++ if (realtime_check) ++ timestamp_now(&tstamp_start); + if ((err = snd_pcm_start(chandle)) < 0) { + printf("Go error: %s\n", snd_strerror(err)); + exit(0); + } + if (realtime_check) +- timestamp_now(&tstamp_start); ++ printf("[%lldus] Stream start\n", timestamp_diff_micro(&tstamp_start)); + gettimestamp(phandle, &p_tstamp); + gettimestamp(chandle, &c_tstamp); + #if 0 +@@ -740,7 +742,6 @@ int main(int argc, char *argv[]) + + ok = 1; + in_max = 0; +- first_avail = 1; + while (ok && frames_in < loop_limit) { + cap_avail = latency; + if (sys_latency > 0) { +@@ -751,12 +752,6 @@ int main(int argc, char *argv[]) + ok = 0; + break; + } +- if (first_avail && realtime_check) { +- long long diff = timestamp_diff_micro(&tstamp_start); +- long long pos = frames_to_micro(cap_avail); +- printf("POS FIRST CHECK: c=%zd (rt=%lldus)\n", cap_avail, pos - diff); +- first_avail = 0; +- } + } else if (use_poll) { + /* use poll to wait for next event */ + snd_pcm_wait(chandle, 1000); +@@ -775,8 +770,8 @@ int main(int argc, char *argv[]) + long long diff = timestamp_diff_micro(&tstamp_start); + long long cap_pos = frames_to_micro(frames_in + cap_avail); + long long pbk_pos = frames_to_micro(frames_out - pbk_fill); +- printf("POS: p=%zd (min=%zd, rt=%lldus) c=%zd (max=%zd, rt=%lldus)\n", +- pbk_fill, pbk_fill_min, pbk_pos - diff, ++ printf("[%lldus] POS: p=%zd (min=%zd, rt=%lldus) c=%zd (max=%zd, rt=%lldus)\n", ++ diff, pbk_fill, pbk_fill_min, pbk_pos - diff, + cap_avail, cap_avail_max, cap_pos - diff); + } else if (pos_dump) { + printf("POS: p=%zd (min=%zd), c=%zd (max=%zd)\n", +-- +2.38.1 + + +From 8b64f22459b6c55ec54f985f35ff701e18800616 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 15 Nov 2022 17:25:59 +0100 +Subject: [PATCH 10/18] ucm: clarify set_defaults calls + +- do full reset in snd_use_case_mgr_reload + +Signed-off-by: Jaroslav Kysela +--- + src/ucm/main.c | 36 +++++++++++++++++++++++++----------- + 1 file changed, 25 insertions(+), 11 deletions(-) + +diff --git a/src/ucm/main.c b/src/ucm/main.c +index 28c60565..4f36648c 100644 +--- a/src/ucm/main.c ++++ b/src/ucm/main.c +@@ -998,13 +998,14 @@ static int add_auto_values(snd_use_case_mgr_t *uc_mgr) + /** + * \brief execute default commands + * \param uc_mgr Use case manager ++ * \param force Force run + * \return zero on success, otherwise a negative error code + */ +-static int set_defaults(snd_use_case_mgr_t *uc_mgr) ++static int set_defaults(snd_use_case_mgr_t *uc_mgr, bool force) + { + int err; + +- if (uc_mgr->default_list_executed) ++ if (!force && uc_mgr->default_list_executed) + return 0; + err = execute_sequence(uc_mgr, NULL, &uc_mgr->default_list, + &uc_mgr->value_list, NULL, NULL); +@@ -1351,7 +1352,7 @@ static int set_verb(snd_use_case_mgr_t *uc_mgr, + int err; + + if (enable) { +- err = set_defaults(uc_mgr); ++ err = set_defaults(uc_mgr, false); + if (err < 0) + return err; + seq = &verb->enable_list; +@@ -1435,6 +1436,22 @@ static int set_device(snd_use_case_mgr_t *uc_mgr, + return err; + } + ++/** ++ * \brief Do the full reset ++ * \param uc_mgr Use case manager ++ * \return zero on success, otherwise a negative error code ++ */ ++static int do_reset(snd_use_case_mgr_t *uc_mgr) ++{ ++ int err; ++ ++ err = set_defaults(uc_mgr, true); ++ INIT_LIST_HEAD(&uc_mgr->active_modifiers); ++ INIT_LIST_HEAD(&uc_mgr->active_devices); ++ uc_mgr->active_verb = NULL; ++ return err; ++} ++ + /** + * \brief Parse open arguments + * \param uc_mgr Use case manager +@@ -1569,6 +1586,8 @@ int snd_use_case_mgr_reload(snd_use_case_mgr_t *uc_mgr) + + pthread_mutex_lock(&uc_mgr->mutex); + ++ do_reset(uc_mgr); ++ + uc_mgr_free_verb(uc_mgr); + + uc_mgr->default_list_executed = 0; +@@ -1633,8 +1652,7 @@ static int dismantle_use_case(snd_use_case_mgr_t *uc_mgr) + } + uc_mgr->active_verb = NULL; + +- err = execute_sequence(uc_mgr, NULL, &uc_mgr->default_list, +- &uc_mgr->value_list, NULL, NULL); ++ err = set_defaults(uc_mgr, true); + + return err; + } +@@ -1649,11 +1667,7 @@ int snd_use_case_mgr_reset(snd_use_case_mgr_t *uc_mgr) + int err; + + pthread_mutex_lock(&uc_mgr->mutex); +- err = execute_sequence(uc_mgr, NULL, &uc_mgr->default_list, +- &uc_mgr->value_list, NULL, NULL); +- INIT_LIST_HEAD(&uc_mgr->active_modifiers); +- INIT_LIST_HEAD(&uc_mgr->active_devices); +- uc_mgr->active_verb = NULL; ++ err = do_reset(uc_mgr); + pthread_mutex_unlock(&uc_mgr->mutex); + return err; + } +@@ -2512,7 +2526,7 @@ static int set_defaults_user(snd_use_case_mgr_t *uc_mgr, + uc_error("error: wrong value for _defaults (%s)", value); + return -EINVAL; + } +- return set_defaults(uc_mgr); ++ return set_defaults(uc_mgr, false); + } + + static int handle_transition_verb(snd_use_case_mgr_t *uc_mgr, +-- +2.38.1 + + +From 9649b64c6f72984c53f469dad8dd4221d307e06d Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 22 Nov 2022 09:59:04 +0100 +Subject: [PATCH 11/18] ucm: handle empty string also for ${env:} substitution + +Signed-off-by: Jaroslav Kysela +--- + src/ucm/ucm_subs.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/src/ucm/ucm_subs.c b/src/ucm/ucm_subs.c +index 2261bdc2..e62290ea 100644 +--- a/src/ucm/ucm_subs.c ++++ b/src/ucm/ucm_subs.c +@@ -490,7 +490,13 @@ static char *rval_env(snd_use_case_mgr_t *uc_mgr ATTRIBUTE_UNUSED, const char *i + { + char *e; + +- e = getenv(id); ++ if (*id == '-') { ++ e = getenv(id + 1); ++ if (e == NULL) ++ e = ""; ++ } else { ++ e = getenv(id); ++ } + if (e) + return strdup(e); + return NULL; +-- +2.38.1 + + +From f0f054517c05ff4ef7a1615851a686a3a202b9ff Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 23 Nov 2022 17:56:20 +0100 +Subject: [PATCH 12/18] test: latency - add -y option (I/O usleep) + +Signed-off-by: Jaroslav Kysela +--- + test/latency.c | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/test/latency.c b/test/latency.c +index 3aff37c1..161d1f68 100644 +--- a/test/latency.c ++++ b/test/latency.c +@@ -52,6 +52,7 @@ int latency_max = 2048; /* in frames / 2 */ + int loop_sec = 30; /* seconds */ + int block = 0; /* block mode */ + int use_poll = 0; ++int usleep_val = 0; + int resample = 1; + int sys_latency = 0; /* data I/O: use system timings instead driver wakeups */ + int pos_dump = 0; /* dump positions */ +@@ -509,6 +510,8 @@ void help(void) + "-s,--seconds duration of test in seconds\n" + "-b,--block block mode\n" + "-p,--poll use poll (wait for event - reduces CPU usage)\n" ++"-y,--usleep sleep for the specified amount of microseconds between\n" ++" stream updates (default 0 - off)\n" + "-e,--effect apply an effect (bandpass filter sweep)\n" + "-x,--posdump dump buffer positions\n" + "-X,--realtime do a realtime check (buffering)\n" +@@ -548,6 +551,7 @@ int main(int argc, char *argv[]) + {"seconds", 1, NULL, 's'}, + {"block", 0, NULL, 'b'}, + {"poll", 0, NULL, 'p'}, ++ {"usleep", 1, NULL, 'y'}, + {"effect", 0, NULL, 'e'}, + {"posdump", 0, NULL, 'x'}, + {"realtime", 0, NULL, 'X'}, +@@ -565,7 +569,7 @@ int main(int argc, char *argv[]) + morehelp = 0; + while (1) { + int c; +- if ((c = getopt_long(argc, argv, "hP:C:m:M:U:F:f:c:r:B:E:s:bpenxX", long_option, NULL)) < 0) ++ if ((c = getopt_long(argc, argv, "hP:C:m:M:U:F:f:c:r:B:E:s:y:bpenxX", long_option, NULL)) < 0) + break; + switch (c) { + case 'h': +@@ -624,6 +628,9 @@ int main(int argc, char *argv[]) + case 'p': + use_poll = 1; + break; ++ case 'y': ++ usleep_val = atoi(optarg); ++ break; + case 'e': + effect = 1; + break; +@@ -671,6 +678,8 @@ int main(int argc, char *argv[]) + loop_limit, latency_min * 2, latency_max * 2); + if (sys_latency > 0) + printf(", I/O updates %ims", sys_latency); ++ else if (!block) ++ printf(", I/O usleep %ius", usleep_val); + printf("\n"); + + if ((err = snd_pcm_open(&phandle, pdevice, SND_PCM_STREAM_PLAYBACK, block ? 0 : SND_PCM_NONBLOCK)) < 0) { +@@ -755,6 +764,8 @@ int main(int argc, char *argv[]) + } else if (use_poll) { + /* use poll to wait for next event */ + snd_pcm_wait(chandle, 1000); ++ } else if (usleep_val > 0) { ++ usleep(usleep_val); + } + if (pos_dump || realtime_check) { + if (sys_latency <= 0) +-- +2.38.1 + + +From 536c93928bc57d941a7cd146dbcbd62df0be2d83 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 23 Nov 2022 19:45:15 +0100 +Subject: [PATCH 13/18] test: latency - usleep should not be used in the block + mode + +Signed-off-by: Jaroslav Kysela +--- + test/latency.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/test/latency.c b/test/latency.c +index 161d1f68..1b4848d6 100644 +--- a/test/latency.c ++++ b/test/latency.c +@@ -678,7 +678,7 @@ int main(int argc, char *argv[]) + loop_limit, latency_min * 2, latency_max * 2); + if (sys_latency > 0) + printf(", I/O updates %ims", sys_latency); +- else if (!block) ++ else if (!block && !use_poll) + printf(", I/O usleep %ius", usleep_val); + printf("\n"); + +@@ -764,7 +764,7 @@ int main(int argc, char *argv[]) + } else if (use_poll) { + /* use poll to wait for next event */ + snd_pcm_wait(chandle, 1000); +- } else if (usleep_val > 0) { ++ } else if (!block && usleep_val > 0) { + usleep(usleep_val); + } + if (pos_dump || realtime_check) { +-- +2.38.1 + + +From ea0850f3f3780652869c2b4550576894bc21684f Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 24 Nov 2022 08:33:47 +0100 +Subject: [PATCH 14/18] test: latency - add --policy option to allow using + SCHED_FIFO + +Signed-off-by: Jaroslav Kysela +--- + test/latency.c | 22 +++++++++++++++++----- + 1 file changed, 17 insertions(+), 5 deletions(-) + +diff --git a/test/latency.c b/test/latency.c +index 1b4848d6..3b20e1c1 100644 +--- a/test/latency.c ++++ b/test/latency.c +@@ -40,6 +40,7 @@ + + typedef struct timespec timestamp_t; + ++char *sched_policy = "rr"; + char *pdevice = "hw:0,0"; + char *cdevice = "hw:0,0"; + snd_pcm_format_t format = SND_PCM_FORMAT_S16_LE; +@@ -354,18 +355,24 @@ void gettimestamp(snd_pcm_t *handle, snd_timestamp_t *timestamp) + void setscheduler(void) + { + struct sched_param sched_param; ++ int policy = SCHED_RR; ++ const char *spolicy = "Round Robin"; + ++ if (strcasecmp(sched_policy, "fifo") == 0) { ++ policy = SCHED_FIFO; ++ spolicy = "FIFO"; ++ } + if (sched_getparam(0, &sched_param) < 0) { + printf("Scheduler getparam failed...\n"); + return; + } +- sched_param.sched_priority = sched_get_priority_max(SCHED_RR); +- if (!sched_setscheduler(0, SCHED_RR, &sched_param)) { +- printf("Scheduler set to Round Robin with priority %i...\n", sched_param.sched_priority); ++ sched_param.sched_priority = sched_get_priority_max(policy); ++ if (!sched_setscheduler(0, policy, &sched_param)) { ++ printf("Scheduler set to %s with priority %i...\n", spolicy, sched_param.sched_priority); + fflush(stdout); + return; + } +- printf("!!!Scheduler set to Round Robin with priority %i FAILED!!!\n", sched_param.sched_priority); ++ printf("!!!Scheduler set to %s with priority %i FAILED!!!\n", spolicy, sched_param.sched_priority); + } + + long timediff(snd_timestamp_t t1, snd_timestamp_t t2) +@@ -515,6 +522,7 @@ void help(void) + "-e,--effect apply an effect (bandpass filter sweep)\n" + "-x,--posdump dump buffer positions\n" + "-X,--realtime do a realtime check (buffering)\n" ++"-O,--policy set scheduler policy (RR or FIFO)\n" + ); + printf("Recognized sample formats are:"); + for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) { +@@ -555,6 +563,7 @@ int main(int argc, char *argv[]) + {"effect", 0, NULL, 'e'}, + {"posdump", 0, NULL, 'x'}, + {"realtime", 0, NULL, 'X'}, ++ {"policy", 1, NULL, 'O'}, + {NULL, 0, NULL, 0}, + }; + snd_pcm_t *phandle, *chandle; +@@ -569,7 +578,7 @@ int main(int argc, char *argv[]) + morehelp = 0; + while (1) { + int c; +- if ((c = getopt_long(argc, argv, "hP:C:m:M:U:F:f:c:r:B:E:s:y:bpenxX", long_option, NULL)) < 0) ++ if ((c = getopt_long(argc, argv, "hP:C:m:M:U:F:f:c:r:B:E:s:y:O:bpenxX", long_option, NULL)) < 0) + break; + switch (c) { + case 'h': +@@ -643,6 +652,9 @@ int main(int argc, char *argv[]) + case 'X': + realtime_check = 1; + break; ++ case 'O': ++ sched_policy = optarg; ++ break; + } + } + +-- +2.38.1 + + +From 75f8e2e73e03f628a4f2ba55ca8aa3e9f50cdbd9 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 24 Nov 2022 10:55:32 +0100 +Subject: [PATCH 15/18] test: latency - --policy option - allow using + SCHED_OTHER + +Signed-off-by: Jaroslav Kysela +--- + test/latency.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/test/latency.c b/test/latency.c +index 3b20e1c1..5e67015c 100644 +--- a/test/latency.c ++++ b/test/latency.c +@@ -361,6 +361,9 @@ void setscheduler(void) + if (strcasecmp(sched_policy, "fifo") == 0) { + policy = SCHED_FIFO; + spolicy = "FIFO"; ++ } else if (strcasecmp(sched_policy, "other") == 0) { ++ policy = SCHED_OTHER; ++ spolicy = "OTHER"; + } + if (sched_getparam(0, &sched_param) < 0) { + printf("Scheduler getparam failed...\n"); +@@ -522,7 +525,7 @@ void help(void) + "-e,--effect apply an effect (bandpass filter sweep)\n" + "-x,--posdump dump buffer positions\n" + "-X,--realtime do a realtime check (buffering)\n" +-"-O,--policy set scheduler policy (RR or FIFO)\n" ++"-O,--policy set scheduler policy (RR, FIFO or OTHER)\n" + ); + printf("Recognized sample formats are:"); + for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) { +-- +2.38.1 + + +From d28e8cb29485cc93f741b01dc65893c798359963 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 29 Nov 2022 19:42:13 +0100 +Subject: [PATCH 16/18] topology: ctl - remove the wrong (debug) code + +This code was commited by mistake. It was used for testing +of ALSA_PCM_OLD_HW/SW_PARAMS_API. + +BugLink: https://github.com/thesofproject/sof/issues/6667 +Related-to: 78b20e3c ("test: latency - use snd_pcm_format_physical_width()") +Reported-by: Jaska Uimonen +Signed-off-by: Jaroslav Kysela +--- + src/topology/ctl.c | 7 +------ + 1 file changed, 1 insertion(+), 6 deletions(-) + +diff --git a/src/topology/ctl.c b/src/topology/ctl.c +index 2c500ffc..dd05424d 100644 +--- a/src/topology/ctl.c ++++ b/src/topology/ctl.c +@@ -17,13 +17,9 @@ + Liam Girdwood + */ + +-#define ALSA_PCM_OLD_HW_PARAMS_API 1 +-#define ALSA_PCM_OLD_SW_PARAMS_API 1 +-#include "../../include/asoundlib.h" + #include "list.h" + #include "tplg_local.h" + +- + #define ENUM_VAL_SIZE (SNDRV_CTL_ELEM_ID_NAME_MAXLEN >> 2) + + struct ctl_access_elem { +@@ -75,8 +71,7 @@ static int parse_access_values(snd_config_t *cfg, + } + } + } +- return snd_pcm_hw_params_get_channels(NULL); +- //return snd_pcm_hw_params_get_access(NULL); ++ + return 0; + } + +-- +2.38.1 + + +From e29413a2205099b2bffe584210d7a2b59f531f90 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 7 Dec 2022 14:49:48 +0100 +Subject: [PATCH 17/18] ucm: execute_sysw - fix possible use-after-free + +Signed-off-by: Jaroslav Kysela +--- + src/ucm/main.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/src/ucm/main.c b/src/ucm/main.c +index 4f36648c..2ff4d3f3 100644 +--- a/src/ucm/main.c ++++ b/src/ucm/main.c +@@ -572,16 +572,17 @@ static int execute_sysw(const char *sysw) + wlen = write(fd, value, len); + myerrno = errno; + close(fd); +- free(s); + + if (ignore_error) +- return 0; ++ goto __end; + + if (wlen != (ssize_t)len) { + uc_error("unable to write '%s' to '%s': %s", value, path, strerror(myerrno)); + return -EINVAL; + } + ++__end: ++ free(s); + return 0; + } + +-- +2.38.1 + + +From 13e31fb1ecd5f666ffda09e87ef1aa53b4fae022 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 7 Dec 2022 14:54:30 +0100 +Subject: [PATCH 18/18] alsa-lib: conf - fix possible use-after-free in + get_char_skip_comments + +Signed-off-by: Jaroslav Kysela +--- + src/conf.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/conf.c b/src/conf.c +index eb38c344..65f2e1a7 100644 +--- a/src/conf.c ++++ b/src/conf.c +@@ -814,11 +814,12 @@ static int get_char_skip_comments(input_t *input) + closedir(dirp); + + err = add_include_path(input->current, str); +- free(str); + if (err < 0) { + SNDERR("Cannot add search dir %s", str); ++ free(str); + return err; + } ++ free(str); + continue; + } + +-- +2.38.1 + diff --git a/alsa-lib.spec b/alsa-lib.spec index b665d0f..4a2ed9d 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 1%{?prever_dot}%{?dist} +Release: 2%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -167,6 +167,10 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Wed Dec 7 2022 Jaroslav Kysela - 1.2.8-2 +- update lib code to latest git +- update ucm configs to latest git + * Mon Oct 24 2022 Jaroslav Kysela - 1.2.8-1 - update to 1.2.8 diff --git a/alsa-ucm-conf.patch b/alsa-ucm-conf.patch index e69de29..1bc6bae 100644 --- a/alsa-ucm-conf.patch +++ b/alsa-ucm-conf.patch @@ -0,0 +1,1296 @@ +From 2667378a6b9120d99e44f783ac4d247fb683d83c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?N=C3=ADcolas=20F=2E=20R=2E=20A=2E=20Prado?= + +Date: Thu, 24 Mar 2022 18:13:45 -0400 +Subject: [PATCH 01/14] ucm2: Add support for MT8192 Asurada Spherion + Chromebook +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add support for the Acer Chromebook 514 CP514-2H, powered by MediaTek +Kompanio 820 (MT8192). This machine uses a MT6359 PMIC, with RT1015P as +speaker codec and RT5682 as headphone codec. + +Fixes: https://github.com/alsa-project/alsa-ucm-conf/pull/217 +Signed-off-by: Nícolas F. R. A. Prado +Signed-off-by: Jaroslav Kysela +--- + .../mt8192/mt6359-rt1015p-rt5682/HiFi.conf | 88 +++++++++++++++++++ + .../mt8192/mt6359-rt1015p-rt5682/init.conf | 24 +++++ + .../mt8192_mt6359_rt1015p_rt5682.conf | 11 +++ + .../mt8192_mt6359_rt1015p_rt5682.conf | 1 + + 4 files changed, 124 insertions(+) + create mode 100644 ucm2/MediaTek/mt8192/mt6359-rt1015p-rt5682/HiFi.conf + create mode 100644 ucm2/MediaTek/mt8192/mt6359-rt1015p-rt5682/init.conf + create mode 100644 ucm2/MediaTek/mt8192/mt6359-rt1015p-rt5682/mt8192_mt6359_rt1015p_rt5682.conf + create mode 120000 ucm2/conf.d/mt8192_mt6359/mt8192_mt6359_rt1015p_rt5682.conf + +diff --git a/ucm2/MediaTek/mt8192/mt6359-rt1015p-rt5682/HiFi.conf b/ucm2/MediaTek/mt8192/mt6359-rt1015p-rt5682/HiFi.conf +new file mode 100644 +index 0000000..cf0d2c1 +--- /dev/null ++++ b/ucm2/MediaTek/mt8192/mt6359-rt1015p-rt5682/HiFi.conf +@@ -0,0 +1,88 @@ ++SectionVerb { ++ EnableSequence [ ++ disdevall "" ++ ] ++ ++ Value { ++ TQ "HiFi" ++ } ++} ++ ++SectionDevice."Speaker" { ++ Comment "Speaker" ++ ++ EnableSequence [ ++ cset "name='Speakers Switch' 1" ++ ] ++ ++ DisableSequence [ ++ cset "name='Speakers Switch' 0" ++ ] ++ ++ Value { ++ PlaybackPCM "hw:${CardId},0" ++ PlaybackPriority 100 ++ } ++} ++ ++SectionDevice."Headphones" { ++ Comment "Headphones" ++ ++ EnableSequence [ ++ cset "name='Headphone Jack Switch' 1" ++ ] ++ ++ DisableSequence [ ++ cset "name='Headphone Jack Switch' 0" ++ ] ++ ++ Value { ++ PlaybackPCM "hw:${CardId},3" ++ JackControl "Headphone Jack" ++ PlaybackMixerElem "DAC1" ++ PlaybackPriority 200 ++ } ++} ++ ++SectionDevice."Mic" { ++ Comment "Internal Microphone" ++ ++ EnableSequence [ ++ cset "name='MTKAIF_DMIC Switch' 1" ++ ] ++ ++ DisableSequence [ ++ cset "name='MTKAIF_DMIC Switch' 0" ++ ] ++ ++ Value { ++ CapturePCM "hw:${CardId},10" ++ CapturePriority 100 ++ } ++} ++ ++SectionDevice."Headset" { ++ Comment "Headset Microphone" ++ ++ EnableSequence [ ++ cset "name='Headset Mic Switch' 1" ++ cset "name='STO1 ADC Capture Switch' 1" ++ cset "name='RECMIX1L CBJ Switch' 1" ++ cset "name='Stereo1 ADC MIXL ADC1 Switch' 1" ++ cset "name='Stereo1 ADC MIXR ADC1 Switch' 1" ++ ] ++ ++ DisableSequence [ ++ cset "name='STO1 ADC Capture Switch' 0" ++ cset "name='RECMIX1L CBJ Switch' 0" ++ cset "name='Stereo1 ADC MIXL ADC1 Switch' 0" ++ cset "name='Stereo1 ADC MIXR ADC1 Switch' 0" ++ cset "name='Headset Mic Switch' 0" ++ ] ++ ++ Value { ++ CapturePCM "hw:${CardId},11" ++ JackControl "Headset Mic Jack" ++ CapturePriority 200 ++ } ++} +diff --git a/ucm2/MediaTek/mt8192/mt6359-rt1015p-rt5682/init.conf b/ucm2/MediaTek/mt8192/mt6359-rt1015p-rt5682/init.conf +new file mode 100644 +index 0000000..b53178e +--- /dev/null ++++ b/ucm2/MediaTek/mt8192/mt6359-rt1015p-rt5682/init.conf +@@ -0,0 +1,24 @@ ++BootSequence [ ++ # Speaker ++ cset "name='I2S3_CH1 DL1_CH1' 1" ++ cset "name='I2S3_CH2 DL1_CH2' 1" ++ cset "name='I2S3_HD_Mux' 1" ++ ++ # Headphone ++ cset "name='I2S9_CH1 DL3_CH1' 1" ++ cset "name='I2S9_CH2 DL3_CH2' 1" ++ cset "name='I2S9_HD_Mux' 1" ++ ++ # Internal Mic ++ cset "name='UL1_CH1 ADDA_UL_CH1' 1" ++ cset "name='UL1_CH2 ADDA_UL_CH2' 1" ++ cset "name='UL_SRC_MUX' DMIC" ++ ++ # Headset Mic ++ cset "name='UL2_CH1 I2S8_CH1' 1" ++ cset "name='UL2_CH2 I2S8_CH2' 1" ++ cset "name='I2S8_HD_Mux' 1" ++ cset "name='Stereo1 ADC L1 Mux' 1" ++ cset "name='Stereo1 ADC R1 Mux' 1" ++ cset "name='CBJ Boost Volume' 3" ++] +diff --git a/ucm2/MediaTek/mt8192/mt6359-rt1015p-rt5682/mt8192_mt6359_rt1015p_rt5682.conf b/ucm2/MediaTek/mt8192/mt6359-rt1015p-rt5682/mt8192_mt6359_rt1015p_rt5682.conf +new file mode 100644 +index 0000000..b4e124d +--- /dev/null ++++ b/ucm2/MediaTek/mt8192/mt6359-rt1015p-rt5682/mt8192_mt6359_rt1015p_rt5682.conf +@@ -0,0 +1,11 @@ ++Comment "MT8192 MT6359 RT1015P RT5682 sound card" ++Syntax 4 ++ ++SectionUseCase."HiFi" { ++ File "HiFi.conf" ++ Comment "Default" ++} ++ ++Include.card-init.File "/lib/card-init.conf" ++Include.ctl-remap.File "/lib/ctl-remap.conf" ++Include.init.File "init.conf" +diff --git a/ucm2/conf.d/mt8192_mt6359/mt8192_mt6359_rt1015p_rt5682.conf b/ucm2/conf.d/mt8192_mt6359/mt8192_mt6359_rt1015p_rt5682.conf +new file mode 120000 +index 0000000..4425b19 +--- /dev/null ++++ b/ucm2/conf.d/mt8192_mt6359/mt8192_mt6359_rt1015p_rt5682.conf +@@ -0,0 +1 @@ ++../../MediaTek/mt8192/mt6359-rt1015p-rt5682/mt8192_mt6359_rt1015p_rt5682.conf +\ No newline at end of file +-- +2.38.1 + + +From 6dee56f11fbd48dd412179722a445416fcd779ef Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Sun, 6 Nov 2022 18:08:27 +0100 +Subject: [PATCH 02/14] ucm: USB-Audio - Add support for Focusrite Scarlett 2i2 + gen2 + +BugLink: https://github.com/alsa-project/alsa-ucm-conf/pull/234 +Signed-off-by: Jaroslav Kysela +--- + ...2-HiFi.conf => Scarlett-2i-gen2-HiFi.conf} | 45 +++++++++++-------- + .../USB-Audio/Focusrite/Scarlett-2i-gen2.conf | 22 +++++++++ + .../Focusrite/Scarlett-2i4-gen2.conf | 11 ----- + ucm2/USB-Audio/USB-Audio.conf | 10 ++--- + 4 files changed, 53 insertions(+), 35 deletions(-) + rename ucm2/USB-Audio/Focusrite/{Scarlett-2i4-gen2-HiFi.conf => Scarlett-2i-gen2-HiFi.conf} (65%) + create mode 100644 ucm2/USB-Audio/Focusrite/Scarlett-2i-gen2.conf + delete mode 100644 ucm2/USB-Audio/Focusrite/Scarlett-2i4-gen2.conf + +diff --git a/ucm2/USB-Audio/Focusrite/Scarlett-2i4-gen2-HiFi.conf b/ucm2/USB-Audio/Focusrite/Scarlett-2i-gen2-HiFi.conf +similarity index 65% +rename from ucm2/USB-Audio/Focusrite/Scarlett-2i4-gen2-HiFi.conf +rename to ucm2/USB-Audio/Focusrite/Scarlett-2i-gen2-HiFi.conf +index 5ee5076..ab69bc7 100644 +--- a/ucm2/USB-Audio/Focusrite/Scarlett-2i4-gen2-HiFi.conf ++++ b/ucm2/USB-Audio/Focusrite/Scarlett-2i-gen2-HiFi.conf +@@ -3,7 +3,7 @@ Include.pcm_split.File "/common/pcm/split.conf" + Macro [ + { + SplitPCM { +- Name "scarlett2i4_stereo_out" ++ Name "scarlett2i_stereo_out" + Direction Playback + Format S32_LE + Channels 2 +@@ -16,7 +16,7 @@ Macro [ + } + { + SplitPCM { +- Name "scarlett2i4_mono_in" ++ Name "scarlett2i_mono_in" + Direction Capture + Format S32_LE + Channels 1 +@@ -33,7 +33,7 @@ SectionDevice."Line1" { + PlaybackPriority 200 + } + Macro.pcm_split.SplitPCMDevice { +- Name "scarlett2i4_stereo_out" ++ Name "scarlett2i_stereo_out" + Direction Playback + HWChannels 4 + Channels 2 +@@ -44,21 +44,28 @@ SectionDevice."Line1" { + } + } + +-SectionDevice."Line2" { +- Comment "Line 3-4" +- +- Value { +- PlaybackPriority 100 ++If.scarlett_2i4 { ++ Condition { ++ Type String ++ String1 "${var:PlaybackChannels}" ++ String2 "4" + } +- Macro.pcm_split.SplitPCMDevice { +- Name "scarlett2i4_stereo_out" +- Direction Playback +- HWChannels 4 +- Channels 2 +- Channel0 2 +- Channel1 3 +- ChannelPos0 FL +- ChannelPos1 FR ++ True.SectionDevice."Line2" { ++ Comment "Line 3-4" ++ ++ Value { ++ PlaybackPriority 100 ++ } ++ Macro.pcm_split.SplitPCMDevice { ++ Name "scarlett2i_stereo_out" ++ Direction Playback ++ HWChannels 4 ++ Channels 2 ++ Channel0 2 ++ Channel1 3 ++ ChannelPos0 FL ++ ChannelPos1 FR ++ } + } + } + +@@ -69,7 +76,7 @@ SectionDevice."Mic1" { + CapturePriority 200 + } + Macro.pcm_split.SplitPCMDevice { +- Name "scarlett2i4_mono_in" ++ Name "scarlett2i_mono_in" + Direction Capture + HWChannels 2 + Channels 1 +@@ -85,7 +92,7 @@ SectionDevice."Mic2" { + CapturePriority 100 + } + Macro.pcm_split.SplitPCMDevice { +- Name "scarlett2i4_mono_in" ++ Name "scarlett2i_mono_in" + Direction Capture + HWChannels 2 + Channels 1 +diff --git a/ucm2/USB-Audio/Focusrite/Scarlett-2i-gen2.conf b/ucm2/USB-Audio/Focusrite/Scarlett-2i-gen2.conf +new file mode 100644 +index 0000000..ee5b0b5 +--- /dev/null ++++ b/ucm2/USB-Audio/Focusrite/Scarlett-2i-gen2.conf +@@ -0,0 +1,22 @@ ++Define.PlaybackChannels 4 ++ ++If.scarlett_2i4 { ++ Condition { ++ Type String ++ Haystack "${CardComponents}" ++ Needle "USB1235:8202" ++ } ++ True.Define.PlaybackChannels 2 ++} ++ ++Comment "Focusrite Scarlett 2i${var:PlaybackChannels} Gen 2" ++ ++SectionUseCase."HiFi" { ++ Comment "Default" ++ File "/USB-Audio/Focusrite/Scarlett-2i-gen2-HiFi.conf" ++} ++ ++Define.DirectPlaybackChannels "${var:PlaybackChannels}" ++Define.DirectCaptureChannels 2 ++ ++Include.dhw.File "/common/direct.conf" +diff --git a/ucm2/USB-Audio/Focusrite/Scarlett-2i4-gen2.conf b/ucm2/USB-Audio/Focusrite/Scarlett-2i4-gen2.conf +deleted file mode 100644 +index ffc296d..0000000 +--- a/ucm2/USB-Audio/Focusrite/Scarlett-2i4-gen2.conf ++++ /dev/null +@@ -1,11 +0,0 @@ +-Comment "Focusrite Scarlett 2i4 Gen 2" +- +-SectionUseCase."HiFi" { +- Comment "Default" +- File "/USB-Audio/Focusrite/Scarlett-2i4-gen2-HiFi.conf" +-} +- +-Define.DirectPlaybackChannels 4 +-Define.DirectCaptureChannels 2 +- +-Include.dhw.File "/common/direct.conf" +diff --git a/ucm2/USB-Audio/USB-Audio.conf b/ucm2/USB-Audio/USB-Audio.conf +index 90a88d4..3479ba1 100644 +--- a/ucm2/USB-Audio/USB-Audio.conf ++++ b/ucm2/USB-Audio/USB-Audio.conf +@@ -135,14 +135,14 @@ If.goxlr { + True.Define.ProfileName "GoXLR/GoXLR" + } + +-If.focusrite-scarlett-2i4-gen2 { ++If.focusrite-scarlett-2i-gen2 { + Condition { +- Type String +- Haystack "${CardComponents}" +- Needle "USB1235:8200" ++ Type RegexMatch ++ String "${CardComponents}" ++ Regex "USB1235:820[02]" + } + True.Define { +- ProfileName "Focusrite/Scarlett-2i4-gen2" ++ ProfileName "Focusrite/Scarlett-2i-gen2" + } + } + +-- +2.38.1 + + +From b50a903f488e3f6479001b603c1b42b2a9600882 Mon Sep 17 00:00:00 2001 +From: Manu Linares +Date: Sat, 5 Nov 2022 19:32:27 -0300 +Subject: [PATCH 04/14] ucm2: USB-Audio - Added Digidesign Mbox 3 support + +Fixes: https://github.com/alsa-project/alsa-ucm-conf/pull/237 +Signed-off-by: Manu Linares +Signed-off-by: Jaroslav Kysela +--- + .../Digidesign/Digidesign-Mbox-3-HiFi.conf | 126 ++++++++++++++++++ + .../Digidesign/Digidesign-Mbox-3.conf | 11 ++ + ucm2/USB-Audio/USB-Audio.conf | 9 ++ + 3 files changed, 146 insertions(+) + create mode 100644 ucm2/USB-Audio/Digidesign/Digidesign-Mbox-3-HiFi.conf + create mode 100644 ucm2/USB-Audio/Digidesign/Digidesign-Mbox-3.conf + +diff --git a/ucm2/USB-Audio/Digidesign/Digidesign-Mbox-3-HiFi.conf b/ucm2/USB-Audio/Digidesign/Digidesign-Mbox-3-HiFi.conf +new file mode 100644 +index 0000000..7219bea +--- /dev/null ++++ b/ucm2/USB-Audio/Digidesign/Digidesign-Mbox-3-HiFi.conf +@@ -0,0 +1,126 @@ ++Include.pcm_split.File "/common/pcm/split.conf" ++ ++Macro [ ++ { ++ SplitPCM { ++ Name "mbox3_stereo_out" ++ Direction Playback ++ Channels 2 ++ HWChannels 4 ++ HWChannelPos0 FL ++ HWChannelPos1 FR ++ HWChannelPos2 FL ++ HWChannelPos3 FR ++ } ++ } ++ { ++ SplitPCM { ++ Name "mbox3_stereo_in" ++ Direction Capture ++ Channels 2 ++ HWChannels 4 ++ HWChannelPos0 FL ++ HWChannelPos1 FR ++ HWChannelPos2 FL ++ HWChannelPos3 FR ++ } ++ } ++ { ++ SplitPCM { ++ Name "mbox3_mono_in" ++ Direction Capture ++ Channels 1 ++ HWChannels 4 ++ HWChannelPos0 MONO ++ HWChannelPos1 MONO ++ HWChannelPos2 MONO ++ HWChannelPos3 MONO ++ } ++ } ++] ++ ++SectionDevice."Line1" { ++ Comment "Main Output L/R" ++ ++ Value { ++ PlaybackPriority 300 ++ } ++ Macro.pcm_split.SplitPCMDevice { ++ Name "mbox3_stereo_out" ++ Direction Playback ++ HWChannels 4 ++ Channels 2 ++ Channel0 0 ++ Channel1 1 ++ ChannelPos0 FL ++ ChannelPos1 FR ++ } ++} ++ ++ ++SectionDevice."line2SPDIF" { ++ Comment "SPDIF Out" ++ Value { ++ PlaybackPriority 100 ++ } ++ Macro.pcm_split.SplitPCMDevice { ++ Name "mbox3_stereo_out" ++ Direction Playback ++ HWChannels 4 ++ Channels 2 ++ Channel0 2 ++ Channel1 3 ++ ChannelPos0 FL ++ ChannelPos1 FR ++ } ++} ++ ++SectionDevice."mic1" { ++ Comment "Mic/Line 1" ++ ++ Value { ++ CapturePriority 300 ++ } ++ Macro.pcm_split.SplitPCMDevice { ++ Name "mbox3_mono_in" ++ Direction Capture ++ HWChannels 4 ++ Channels 1 ++ Channel0 0 ++ ChannelPos0 MONO ++ } ++} ++ ++SectionDevice."mic2" { ++ Comment "Mic/Line 2" ++ ++ Value { ++ CapturePriority 200 ++ } ++ Macro.pcm_split.SplitPCMDevice { ++ Name "mbox3_mono_in" ++ Direction Capture ++ HWChannels 4 ++ Channels 1 ++ Channel0 1 ++ ChannelPos0 MONO ++ } ++} ++ ++SectionDevice."mic3SPDIF" { ++ Comment "SPDIF In" ++ ++ Value { ++ CapturePriority 100 ++ } ++ Macro.pcm_split.SplitPCMDevice { ++ Name "mbox3_stereo_in" ++ Direction Capture ++ HWChannels 4 ++ Channels 2 ++ Channel0 2 ++ Channel1 3 ++ ChannelPos0 FL ++ ChannelPos1 FR ++ } ++} +diff --git a/ucm2/USB-Audio/Digidesign/Digidesign-Mbox-3.conf b/ucm2/USB-Audio/Digidesign/Digidesign-Mbox-3.conf +new file mode 100644 +index 0000000..d6e19f9 +--- /dev/null ++++ b/ucm2/USB-Audio/Digidesign/Digidesign-Mbox-3.conf +@@ -0,0 +1,11 @@ ++Comment "Digidesign Mbox 3" ++ ++SectionUseCase."Mixer" { ++ Comment "Stereo Duplex" ++ File "/USB-Audio/Digidesign/Digidesign-Mbox-3-HiFi.conf" ++} ++ ++Define.DirectPlaybackChannels 4 ++Define.DirectCaptureChannels 4 ++ ++Include.dhw.File "/common/direct.conf" +diff --git a/ucm2/USB-Audio/USB-Audio.conf b/ucm2/USB-Audio/USB-Audio.conf +index 3479ba1..d1d70d8 100644 +--- a/ucm2/USB-Audio/USB-Audio.conf ++++ b/ucm2/USB-Audio/USB-Audio.conf +@@ -126,6 +126,15 @@ If.dell-desktop-rear { + True.Define.ProfileName "Dell/Desktop-Rear" + } + ++If.mbox3 { ++ Condition { ++ Type String ++ Haystack "${CardComponents}" ++ Needle "USB0dba:5000" ++ } ++ True.Define.ProfileName "Digidesign/Digidesign-Mbox-3" ++} ++ + If.goxlr { + Condition { + Type RegexMatch +-- +2.38.1 + + +From 88f232dffd54e1b9222ea76c7885445efebaa74d Mon Sep 17 00:00:00 2001 +From: "Ben Scholzen (DASPRiD)" +Date: Mon, 31 Oct 2022 17:41:02 +0100 +Subject: [PATCH 05/14] ucm2: Alc4080 - add support for ASUS ROG Strix Z790-E + Gaming Wifi + +Fixes: https://github.com/alsa-project/alsa-ucm-conf/pull/235 +Signed-off-by: Ben Scholzen (DASPRiD) +Signed-off-by: Jaroslav Kysela +--- + ucm2/USB-Audio/Realtek/ALC4080-HiFi.conf | 2 +- + ucm2/USB-Audio/USB-Audio.conf | 3 ++- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/ucm2/USB-Audio/Realtek/ALC4080-HiFi.conf b/ucm2/USB-Audio/Realtek/ALC4080-HiFi.conf +index 519f3b0..fa8d445 100644 +--- a/ucm2/USB-Audio/Realtek/ALC4080-HiFi.conf ++++ b/ucm2/USB-Audio/Realtek/ALC4080-HiFi.conf +@@ -68,7 +68,7 @@ If.spdif_dev2 { + Condition { + Type RegexMatch + String "${CardComponents}" +- Regex "USB(0b05:1996|0db0:1feb)" ++ Regex "USB(0b05:1996|0b05:1a52|0db0:1feb)" + } + True.Define.SpdifPCM "hw:${CardId},2" + } +diff --git a/ucm2/USB-Audio/USB-Audio.conf b/ucm2/USB-Audio/USB-Audio.conf +index d1d70d8..e30dc2b 100644 +--- a/ucm2/USB-Audio/USB-Audio.conf ++++ b/ucm2/USB-Audio/USB-Audio.conf +@@ -41,6 +41,7 @@ If.realtek-alc4080 { + # 0b05:1a16 ASUS ROG Strix B660-F Gaming WiFi + # 0b05:1a20 ASUS ROG STRIX Z690-I Gaming Wifi + # 0b05:1a27 ALC4082 on ASUS ROG Maximus Z690 Hero ++ # 0b05:1a52 ASUS ROG Strix Z790-E Gaming Wifi + # 0db0:005a MSI MPG Z690 CARBON WIFI + # 0db0:151f MSI X570S EDGE MAX WIFI + # 0db0:1feb MSI Edge Wifi Z690 +@@ -50,7 +51,7 @@ If.realtek-alc4080 { + # 0db0:a47c MSI MEG X570S Ace Max + # 0db0:b202 MSI MAG Z690 Tomahawk Wifi + # 0db0:d6e7 MSI MPG X670E Carbon Wifi +- Regex "USB((0414:a00e)|(0b05:(1996|1a(16|2[07])))|(0db0:(005a|151f|1feb|419c|82c7|a073|a47c|b202|d6e7)))" ++ Regex "USB((0414:a00e)|(0b05:(1996|1a(16|2[07]|52)))|(0db0:(005a|151f|1feb|419c|82c7|a073|a47c|b202|d6e7)))" + } + True.Define.ProfileName "Realtek/ALC4080" + } +-- +2.38.1 + + +From b121b63f30c24e89beec506ae1d2bac9ebb3cc61 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 15 Nov 2022 17:49:13 +0100 +Subject: [PATCH 06/14] USB-Audio: ALC4080 - add 0db0:6cc9 MSI MPG Z590 Gaming + Plus device + +BugLink: https://github.com/alsa-project/alsa-ucm-conf/issues/241 +Signed-off-by: Jaroslav Kysela +--- + ucm2/USB-Audio/USB-Audio.conf | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/ucm2/USB-Audio/USB-Audio.conf b/ucm2/USB-Audio/USB-Audio.conf +index e30dc2b..89482cb 100644 +--- a/ucm2/USB-Audio/USB-Audio.conf ++++ b/ucm2/USB-Audio/USB-Audio.conf +@@ -46,12 +46,13 @@ If.realtek-alc4080 { + # 0db0:151f MSI X570S EDGE MAX WIFI + # 0db0:1feb MSI Edge Wifi Z690 + # 0db0:419c MSI MPG X570S Carbon Max Wifi ++ # 0db0:6cc9 MSI MPG Z590 Gaming Plus + # 0db0:82c7 MSI MEG Z690I Unify + # 0db0:a073 MSI MAG X570S Torpedo Max + # 0db0:a47c MSI MEG X570S Ace Max + # 0db0:b202 MSI MAG Z690 Tomahawk Wifi + # 0db0:d6e7 MSI MPG X670E Carbon Wifi +- Regex "USB((0414:a00e)|(0b05:(1996|1a(16|2[07]|52)))|(0db0:(005a|151f|1feb|419c|82c7|a073|a47c|b202|d6e7)))" ++ Regex "USB((0414:a00e)|(0b05:(1996|1a(16|2[07]|52)))|(0db0:(005a|151f|1feb|419c|6cc9|82c7|a073|a47c|b202|d6e7)))" + } + True.Define.ProfileName "Realtek/ALC4080" + } +-- +2.38.1 + + +From c82c400fb653292bbf0570e278d60e1ba14cc341 Mon Sep 17 00:00:00 2001 +From: Shuming Fan +Date: Wed, 16 Nov 2022 17:36:51 +0800 +Subject: [PATCH 07/14] ucm2: sof-soundwire: add basic settings for RT1318 SDCA + device + +Add support for rt1318 amplifier + +Fixes: https://github.com/alsa-project/alsa-ucm-conf/pull/242 +Signed-off-by: Shuming Fan +Signed-off-by: Jaroslav Kysela +--- + ucm2/sof-soundwire/rt1318-1.conf | 20 ++++++++++++++++++++ + ucm2/sof-soundwire/rt1318-2.conf | 25 +++++++++++++++++++++++++ + 2 files changed, 45 insertions(+) + create mode 100644 ucm2/sof-soundwire/rt1318-1.conf + create mode 100644 ucm2/sof-soundwire/rt1318-2.conf + +diff --git a/ucm2/sof-soundwire/rt1318-1.conf b/ucm2/sof-soundwire/rt1318-1.conf +new file mode 100644 +index 0000000..13d77e1 +--- /dev/null ++++ b/ucm2/sof-soundwire/rt1318-1.conf +@@ -0,0 +1,20 @@ ++# Use case Configuration for sof-soundwire card ++ ++SectionDevice."Speaker" { ++ Comment "Speaker" ++ ++ EnableSequence [ ++ cset "name='rt1318-1 DAC Switch' 1" ++ cset "name='Speaker Switch' on" ++ ] ++ ++ DisableSequence [ ++ cset "name='rt1318-1 DAC Switch' 0" ++ cset "name='Speaker Switch' off" ++ ] ++ ++ Value { ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId},2" ++ } ++} +diff --git a/ucm2/sof-soundwire/rt1318-2.conf b/ucm2/sof-soundwire/rt1318-2.conf +new file mode 100644 +index 0000000..5602470 +--- /dev/null ++++ b/ucm2/sof-soundwire/rt1318-2.conf +@@ -0,0 +1,25 @@ ++# Use case Configuration for sof-soundwire card ++ ++SectionDevice."Speaker" { ++ Comment "Speaker" ++ ++ EnableSequence [ ++ cset "name='rt1318-1 RX Channel Select' L,L" ++ cset "name='rt1318-2 RX Channel Select' R,R" ++ ++ cset "name='rt1318-1 DAC Switch' 1" ++ cset "name='rt1318-2 DAC Switch' 1" ++ cset "name='Speaker Switch' on" ++ ] ++ ++ DisableSequence [ ++ cset "name='rt1318-1 DAC Switch' 0" ++ cset "name='rt1318-2 DAC Switch' 0" ++ cset "name='Speaker Switch' off" ++ ] ++ ++ Value { ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId},2" ++ } ++} +-- +2.38.1 + + +From 998849d9510754960d808e20dad4c440adaf87ef Mon Sep 17 00:00:00 2001 +From: Clayton Craft +Date: Wed, 29 Jun 2022 15:23:23 -0700 +Subject: [PATCH 08/14] ucm2: add profile for the Librem 5 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Fixes: https://github.com/alsa-project/alsa-ucm-conf/pull/181 +Tested-by: Guido Günther +Signed-off-by: Jaroslav Kysela +--- + ucm2/NXP/iMX8/Librem_5/HiFi.conf | 151 ++++++++++++++++++++++++++ + ucm2/NXP/iMX8/Librem_5/Librem 5.conf | 25 +++++ + ucm2/conf.d/simple-card/Librem 5.conf | 1 + + 3 files changed, 177 insertions(+) + create mode 100644 ucm2/NXP/iMX8/Librem_5/HiFi.conf + create mode 100644 ucm2/NXP/iMX8/Librem_5/Librem 5.conf + create mode 120000 ucm2/conf.d/simple-card/Librem 5.conf + +diff --git a/ucm2/NXP/iMX8/Librem_5/HiFi.conf b/ucm2/NXP/iMX8/Librem_5/HiFi.conf +new file mode 100644 +index 0000000..55eabe3 +--- /dev/null ++++ b/ucm2/NXP/iMX8/Librem_5/HiFi.conf +@@ -0,0 +1,151 @@ ++SectionVerb { ++ EnableSequence [ ++ disdevall "" ++ ] ++ ++ Value.TQ "HiFi" ++} ++ ++SectionDevice."Handset" { ++ Comment "Handset" ++ ++ ConflictingDevice [ ++ "Headphones" ++ "Speaker" ++ ] ++ ++ EnableSequence [ ++ cset "name='Speaker Switch' off,on" ++ cset "name='DAC L/R Swap Switch' on" ++ cset "name='DAC Monomix Switch' on" ++ cset "name='SPKOUTR PGA' DAC" ++ cset "name='Speaker Boost Volume' 2" ++ ] ++ ++ DisableSequence [ ++ cset "name='Speaker Switch' off,off" ++ cset "name='DAC L/R Swap Switch' off" ++ cset "name='DAC Monomix Switch' off" ++ cset "name='SPKOUTR PGA' Mixer" ++ ] ++ ++ Value { ++ PlaybackPriority "100" ++ PlaybackVolume "name='Speaker Volume'" ++ PlaybackSwitch "name='Speaker Switch'" ++ PlaybackMixerElem "Speaker" ++ PlaybackPCM "hw:${CardId}" ++ } ++} ++ ++SectionDevice."Speaker" { ++ Comment "Speaker" ++ ++ ConflictingDevice [ ++ "Handset" ++ "Headphones" ++ ] ++ ++ EnableSequence [ ++ cset "name='Speaker Switch' on,off" ++ cset "name='DAC Monomix Switch' on" ++ cset "name='SPKOUTL PGA' DAC" ++ cset "name='Speaker Boost Volume' 6" ++ ] ++ ++ DisableSequence [ ++ cset "name='Speaker Switch' off,off" ++ cset "name='DAC Monomix Switch' off" ++ cset "name='SPKOUTL PGA' Mixer" ++ ] ++ ++ Value { ++ PlaybackPriority "500" ++ PlaybackVolume "name='Speaker Volume'" ++ PlaybackSwitch "name='Speaker Switch'" ++ PlaybackMixerElem "Speaker" ++ PlaybackPCM "hw:${CardId}" ++ } ++} ++ ++SectionDevice."Headphones" { ++ Comment "Headphones" ++ ++ ConflictingDevice [ ++ "Handset" ++ "Speaker" ++ ] ++ ++ EnableSequence [ ++ cset "name='Headphone Switch' on,on" ++ cset "name='HPOUTL PGA' 0 unmute" ++ cset "name='HPOUTR PGA' 0 unmute" ++ ] ++ ++ DisableSequence [ ++ cset "name='Headphone Switch' off off" ++ cset "name='HPOUTL PGA' 0 mute" ++ cset "name='HPOUTR PGA' 0 mute" ++ ] ++ ++ Value { ++ PlaybackPriority "1000" ++ PlaybackVolume "name='Headphone Volume'" ++ PlaybackSwitch "name='Headphone Switch'" ++ PlaybackMixerElem "Headphone" ++ PlaybackPCM "hw:${CardId}" ++ JackControl "Headphones Jack" ++ } ++} ++ ++SectionDevice."Mic" { ++ Comment "Internal Microphone" ++ ++ ConflictingDevice [ ++ "Headset" ++ ] ++ ++ EnableSequence [ ++ cset "name='ADC L/R Swap Switch' on" ++ cset "name='Input Mode' Digital" ++ ] ++ ++ DisableSequence [ ++ cset "name='ADC L/R Swap Switch' off" ++ ] ++ ++ Value { ++ CapturePriority "500" ++ CaptureVolume "name='Digital Capture Volume'" ++ CaptureMixerElem "Digital" ++ CapturePCM "hw:${CardId}" ++ } ++} ++ ++SectionDevice."Headset" { ++ Comment "Headset Microphone" ++ ++ ConflictingDevice [ ++ "Mic" ++ ] ++ ++ EnableSequence [ ++ cset "name='Input Mode' Analog" ++ cset "name='MIXINR PGA Switch' on,on" ++ cset "name='Capture Switch' on,on" ++ ] ++ ++ DisableSequence [ ++ cset "name='Capture Switch' off,off" ++ cset "name='MIXINR PGA Switch' off,off" ++ cset "name='Input Mode' Digital" ++ ] ++ ++ Value { ++ CapturePriority "100" ++ CaptureVolume "name='Capture Volume'" ++ CaptureMixerElem "Capture" ++ CapturePCM "hw:${CardId}" ++ JackControl "Headphones Jack" ++ } ++} +diff --git a/ucm2/NXP/iMX8/Librem_5/Librem 5.conf b/ucm2/NXP/iMX8/Librem_5/Librem 5.conf +new file mode 100644 +index 0000000..4d7dbd6 +--- /dev/null ++++ b/ucm2/NXP/iMX8/Librem_5/Librem 5.conf +@@ -0,0 +1,25 @@ ++Syntax 2 ++ ++SectionUseCase."HiFi" { ++ File "HiFi.conf" ++ Comment "Default" ++} ++ ++BootSequence [ ++ cset "name='Digital Playback Volume' 100,100" ++ cset "name='MIXINL IN2L Switch' off" ++ cset "name='MIXINL IN3L Switch' off" ++ cset "name='MIXINR IN2R Switch' off" ++ cset "name='MIXINR IN3R Switch' off" ++ cset "name='INPGAR IN1R Switch' off" ++ cset "name='INPGAR IN2R Switch' off" ++ cset "name='INPGAR IN3R Switch' on" ++ cset "name='INPGAR IN4R Switch' off" ++ cset "name='INPGAL IN1L Switch' off" ++ cset "name='INPGAL IN2L Switch' off" ++ cset "name='INPGAL IN3L Switch' off" ++ cset "name='INPGAL IN4L Switch' off" ++ cset "name='Input Mixer Switch' off,on" ++ cset "name='SPKOUTL PGA' Mixer" ++ cset "name='SPKOUTR PGA' Mixer" ++] +diff --git a/ucm2/conf.d/simple-card/Librem 5.conf b/ucm2/conf.d/simple-card/Librem 5.conf +new file mode 120000 +index 0000000..c687942 +--- /dev/null ++++ b/ucm2/conf.d/simple-card/Librem 5.conf +@@ -0,0 +1 @@ ++../../NXP/iMX8/Librem_5/Librem 5.conf +\ No newline at end of file +-- +2.38.1 + + +From 71ff24cdd2e0fecb71c2fcf8a45a1ae50233c34b Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 21 Nov 2022 09:51:54 +0100 +Subject: [PATCH 09/14] USB-Audio: allow to configure period size for PCM split +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The environment variable UCM_USB_PERIOD_TIME (microseconds / μs) +can define the period size for the PCM channel split over +the default value 10000μs. + +BugLink: https://github.com/alsa-project/alsa-ucm-conf/pull/240 +Fixes: https://github.com/alsa-project/alsa-ucm-conf/issues/238 +Signed-off-by: Jaroslav Kysela +--- + ucm2/USB-Audio/USB-Audio.conf | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/ucm2/USB-Audio/USB-Audio.conf b/ucm2/USB-Audio/USB-Audio.conf +index 89482cb..fdc29ec 100644 +--- a/ucm2/USB-Audio/USB-Audio.conf ++++ b/ucm2/USB-Audio/USB-Audio.conf +@@ -4,6 +4,14 @@ Define.ProfileName "" + Define.MixerRemap "" + Define.SplitPCMPeriodTime 10000 # 10ms + ++If.env1 { ++ Condition { ++ Type String ++ Empty "${env:UCM_USB_PERIOD_TIME}" ++ } ++ False.Define.SplitPCMPeriodTime "${env:UCM_USB_PERIOD_TIME}" ++} ++ + If.linked { + Condition { + Type RegexMatch +-- +2.38.1 + + +From 445c079665979802d50b237fe5a55be82ffd0bd9 Mon Sep 17 00:00:00 2001 +From: Fadwa Chiby +Date: Fri, 22 Jul 2022 09:45:07 +0000 +Subject: [PATCH 10/14] mt8195-demo: fix soundcard initialization + +The previous initialization in Bootsequence set all Switch +to off after boot. + +So remove the setting off of the Switch in the BootSequence +and define Enable/DisableSequence in verb section for +a proper setting. + +Note that the controls enable access to the PCM devices +(controls routes between Front End and Back End in ASoC). + +Fixes: https://github.com/alsa-project/alsa-ucm-conf/pull/211 +Signed-off-by: Fadwa Chiby +Signed-off-by: Jaroslav Kysela +--- + ucm2/MediaTek/mt8195_demo/HiFi.conf | 57 ++++++++++++++++++++++ + ucm2/MediaTek/mt8195_demo/mt8195_demo.conf | 36 ++++---------- + 2 files changed, 66 insertions(+), 27 deletions(-) + +diff --git a/ucm2/MediaTek/mt8195_demo/HiFi.conf b/ucm2/MediaTek/mt8195_demo/HiFi.conf +index 95f2b51..660b4ad 100644 +--- a/ucm2/MediaTek/mt8195_demo/HiFi.conf ++++ b/ucm2/MediaTek/mt8195_demo/HiFi.conf +@@ -1,3 +1,60 @@ ++SectionVerb { ++ ++ EnableSequence [ ++ cset "name='HDMI_OUT_MUX' Connect" ++ cset "name='DPTX_OUT_MUX' Connect" ++ cset "name='O176 I070 Switch' on" ++ cset "name='O177 I071 Switch' on" ++ cset "name='O034 I168 Switch' on" ++ cset "name='O035 I169 Switch' on" ++ cset "name='O036 I012 Switch' on" ++ cset "name='O037 I013 Switch' on" ++ cset "name='O072 I022 Switch' on" ++ cset "name='O073 I023 Switch' on" ++ cset "name='O074 I024 Switch' on" ++ cset "name='O075 I025 Switch' on" ++ cset "name='O076 I026 Switch' on" ++ cset "name='O077 I027 Switch' on" ++ cset "name='O078 I028 Switch' on" ++ cset "name='O079 I029 Switch' on" ++ cset "name='O002 I004 Switch' on" ++ cset "name='O003 I005 Switch' on" ++ cset "name='O004 I006 Switch' on" ++ cset "name='O005 I007 Switch' on" ++ cset "name='O006 I008 Switch' on" ++ cset "name='O007 I009 Switch' on" ++ cset "name='O008 I010 Switch' on" ++ cset "name='O009 I011 Switch' on" ++ ] ++ ++ DisableSequence [ ++ cset "name='HDMI_OUT_MUX' Disconnect" ++ cset "name='DPTX_OUT_MUX' Disconnect" ++ cset "name='O176 I070 Switch' off" ++ cset "name='O177 I071 Switch' off" ++ cset "name='O034 I168 Switch' off" ++ cset "name='O035 I169 Switch' off" ++ cset "name='O036 I012 Switch' off" ++ cset "name='O037 I013 Switch' off" ++ cset "name='O072 I022 Switch' off" ++ cset "name='O073 I023 Switch' off" ++ cset "name='O074 I024 Switch' off" ++ cset "name='O075 I025 Switch' off" ++ cset "name='O076 I026 Switch' off" ++ cset "name='O077 I027 Switch' off" ++ cset "name='O078 I028 Switch' off" ++ cset "name='O079 I029 Switch' off" ++ cset "name='O002 I004 Switch' off" ++ cset "name='O003 I005 Switch' off" ++ cset "name='O004 I006 Switch' off" ++ cset "name='O005 I007 Switch' off" ++ cset "name='O006 I008 Switch' off" ++ cset "name='O007 I009 Switch' off" ++ cset "name='O008 I010 Switch' off" ++ cset "name='O009 I011 Switch' off" ++ ] ++} ++ + SectionDevice."HDMI" { + Comment "Hdmi/DP output" + +diff --git a/ucm2/MediaTek/mt8195_demo/mt8195_demo.conf b/ucm2/MediaTek/mt8195_demo/mt8195_demo.conf +index c23dc37..896b6dc 100644 +--- a/ucm2/MediaTek/mt8195_demo/mt8195_demo.conf ++++ b/ucm2/MediaTek/mt8195_demo/mt8195_demo.conf +@@ -1,4 +1,4 @@ +-Syntax 3 ++Syntax 2 + + SectionUseCase."HiFi" { + File "/MediaTek/mt8195_demo/HiFi.conf" +@@ -16,12 +16,12 @@ BootSequence [ + cset "name='PGA_L_Mux' AIN1" + cset "name='HDMI_OUT_MUX' Connect" + cset "name='DPTX_OUT_MUX' Connect" ++ # we need to enable all devices before starting PA. ++ # In our driver we use PCM, which means that we have ++ # to route Front End to a BackEnd and then only we can ++ # open a device. Without linking to BE it will fail. + cset "name='O176 I070 Switch' on" + cset "name='O177 I071 Switch' on" +- cset "name='O034 I168 Switch' on" +- cset "name='O035 I169 Switch' on" +- cset "name='O036 I012 Switch' on" +- cset "name='O037 I013 Switch' on" + cset "name='O072 I022 Switch' on" + cset "name='O073 I023 Switch' on" + cset "name='O074 I024 Switch' on" +@@ -30,6 +30,10 @@ BootSequence [ + cset "name='O077 I027 Switch' on" + cset "name='O078 I028 Switch' on" + cset "name='O079 I029 Switch' on" ++ cset "name='O034 I168 Switch' on" ++ cset "name='O035 I169 Switch' on" ++ cset "name='O036 I012 Switch' on" ++ cset "name='O037 I013 Switch' on" + cset "name='O002 I004 Switch' on" + cset "name='O003 I005 Switch' on" + cset "name='O004 I006 Switch' on" +@@ -38,26 +42,4 @@ BootSequence [ + cset "name='O007 I009 Switch' on" + cset "name='O008 I010 Switch' on" + cset "name='O009 I011 Switch' on" +- cset "name='O176 I070 Switch' off" +- cset "name='O177 I071 Switch' off" +- cset "name='O034 I168 Switch' off" +- cset "name='O035 I169 Switch' off" +- cset "name='O036 I012 Switch' off" +- cset "name='O037 I013 Switch' off" +- cset "name='O072 I022 Switch' off" +- cset "name='O073 I023 Switch' off" +- cset "name='O074 I024 Switch' off" +- cset "name='O075 I025 Switch' off" +- cset "name='O076 I026 Switch' off" +- cset "name='O077 I027 Switch' off" +- cset "name='O078 I028 Switch' off" +- cset "name='O079 I029 Switch' off" +- cset "name='O002 I004 Switch' off" +- cset "name='O003 I005 Switch' off" +- cset "name='O004 I006 Switch' off" +- cset "name='O005 I007 Switch' off" +- cset "name='O006 I008 Switch' off" +- cset "name='O007 I009 Switch' off" +- cset "name='O008 I010 Switch' off" +- cset "name='O009 I011 Switch' off" + ] +-- +2.38.1 + + +From 5c865236e8de9fd75c741892fd3bd2cff62d4f3f Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 22 Nov 2022 09:54:22 +0100 +Subject: [PATCH 11/14] USB-Audio: the environment variable UCM_USB_PERIOD_TIME + may be undefined + +Fixes: 71ff24c ("USB-Audio: allow to configure period size for PCM split") +BugLink: https://github.com/alsa-project/alsa-ucm-conf/pull/240 +Signed-off-by: Jaroslav Kysela +--- + ucm2/USB-Audio/USB-Audio.conf | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ucm2/USB-Audio/USB-Audio.conf b/ucm2/USB-Audio/USB-Audio.conf +index fdc29ec..1c11da9 100644 +--- a/ucm2/USB-Audio/USB-Audio.conf ++++ b/ucm2/USB-Audio/USB-Audio.conf +@@ -7,7 +7,7 @@ Define.SplitPCMPeriodTime 10000 # 10ms + If.env1 { + Condition { + Type String +- Empty "${env:UCM_USB_PERIOD_TIME}" ++ Empty "$${env:UCM_USB_PERIOD_TIME}" + } + False.Define.SplitPCMPeriodTime "${env:UCM_USB_PERIOD_TIME}" + } +-- +2.38.1 + + +From 01e37f4fb7aab57e3f0051d81f5f6e5b2f15c831 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 21 Nov 2022 10:16:57 +0100 +Subject: [PATCH 12/14] HDA: DualCodecs - handle S/PDIF without analog + connections + +When no analog wires are connected, the S/PDIF output cannot be +selected in pipewire. Handle this for motherboards without Speaker +UCM device. + +Fixes: https://github.com/alsa-project/alsa-ucm-conf/issues/239 +Signed-off-by: Jaroslav Kysela +--- + ucm2/HDA/DualCodecs/HiFi.conf | 15 +++++++++++---- + 1 file changed, 11 insertions(+), 4 deletions(-) + +diff --git a/ucm2/HDA/DualCodecs/HiFi.conf b/ucm2/HDA/DualCodecs/HiFi.conf +index 10c9162..8c0f403 100644 +--- a/ucm2/HDA/DualCodecs/HiFi.conf ++++ b/ucm2/HDA/DualCodecs/HiFi.conf +@@ -66,13 +66,20 @@ SectionDevice."Line1" { + } + True.Value.PlaybackMixerElem "Front" + } +- If.1 { ++ # make S/PDIF output working when no analog jacks are connected ++ If.speaker { + Condition { + Type ControlExists +- Control "iface=CARD,name='Line Out Front Jack'" ++ Control "name='Speaker Playback Switch'" ++ } ++ True.If.1 { ++ Condition { ++ Type ControlExists ++ Control "iface=CARD,name='Line Out Front Jack'" ++ } ++ True.Value.JackControl "Line Out Front Jack" ++ False.Value.JackControl "Line Out Jack" + } +- True.Value.JackControl "Line Out Front Jack" +- False.Value.JackControl "Line Out Jack" + } + } + +-- +2.38.1 + + +From 79a8ec44d3dcf097f4a4492c506cbcf338324175 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 7 Dec 2022 10:18:04 +0100 +Subject: [PATCH 13/14] ucm2: sof-hda-dsp: Update Mic LED settings + +Users expect to turn the LED on when only internal mic is off, but +it makes sense to turn this LED when all internal inputs are off. + +This configuration may be changed when the affected applications +are updated. + +BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=2134824 +Signed-off-by: Jaroslav Kysela +--- + ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf b/ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf +index e6a8a15..9e85914 100644 +--- a/ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf ++++ b/ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf +@@ -9,7 +9,17 @@ If.devdmic { + Haystack "${CardComponents}" + Needle "cfg-dmics:" + } +- True.Define.DeviceDmic "Mic1" ++ True { ++ Define.DeviceDmic "Mic1" ++ FixedBootSequence [ ++ # ++ # users expect to turn the LED on when only internal ++ # mic is off, but it makes sense to turn this LED ++ # when all internal inputs are off ++ # ++ sysw "-/class/sound/ctl-led/mic/card${CardNumber}/detach:Capture Switch" ++ ] ++ } + True.Define.DeviceMic "Mic2" + } + +-- +2.38.1 + + +From 9ce9ddb4a84fb467602b716575ea1d8f2bab0c39 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 7 Dec 2022 15:00:35 +0100 +Subject: [PATCH 14/14] ucm2: HDA: Update Mic LED settings for ACP DMIC + +Users expect to turn the LED on when only internal mic is off, but +it makes sense to turn this LED when all internal inputs are off. + +This configuration may be changed when the affected applications +are updated. + +BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=2134824 +Signed-off-by: Jaroslav Kysela +--- + ucm2/HDA/HDA.conf | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/ucm2/HDA/HDA.conf b/ucm2/HDA/HDA.conf +index 64ffe83..47dfc05 100644 +--- a/ucm2/HDA/HDA.conf ++++ b/ucm2/HDA/HDA.conf +@@ -55,6 +55,7 @@ If.use { + cset-new "name='Mic ACP LED Capture Switch' type=bool,count=1 off" + exec "-/sbin/modprobe snd_ctl_led" + sysw "-/class/sound/ctl-led/mic/card${CardNumber}/attach:Mic ACP LED Capture Switch" ++ sysw "-/class/sound/ctl-led/mic/card${CardNumber}/detach:Capture Switch" + ] + } + } +-- +2.38.1 + From 425def71d7620320e11a8f1f475e030412487d09 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 18 Jan 2023 21:37:36 +0000 Subject: [PATCH 086/120] Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- alsa-lib.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 4a2ed9d..9d9250a 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 2%{?prever_dot}%{?dist} +Release: 3%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Wed Jan 18 2023 Fedora Release Engineering - 1.2.8-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + * Wed Dec 7 2022 Jaroslav Kysela - 1.2.8-2 - update lib code to latest git - update ucm configs to latest git From d6f38125d0013482b14f48ff7c8575578053ce4f Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 4 May 2023 09:39:34 +0200 Subject: [PATCH 087/120] update to 1.2.9 Signed-off-by: Jaroslav Kysela --- alsa-git.patch | 1511 ------------------------------------------------ alsa-lib.spec | 9 +- sources | 4 +- 3 files changed, 8 insertions(+), 1516 deletions(-) diff --git a/alsa-git.patch b/alsa-git.patch index b023625..e69de29 100644 --- a/alsa-git.patch +++ b/alsa-git.patch @@ -1,1511 +0,0 @@ -From 1b436862ed6253629d79edc2e09826efd4e0f4e3 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 2 Nov 2022 15:01:56 +0100 -Subject: [PATCH 01/18] ucm: fix enhanced ID parsing in - snd_use_case_parse_ctl_elem_id() - -Reported-by: Takashi Iwai -Signed-off-by: Jaroslav Kysela ---- - src/ucm/main.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/ucm/main.c b/src/ucm/main.c -index 30ab1e41..28c60565 100644 ---- a/src/ucm/main.c -+++ b/src/ucm/main.c -@@ -2793,7 +2793,7 @@ int snd_use_case_parse_ctl_elem_id(snd_ctl_elem_id_t *dst, - strcmp(ucm_id, "CaptureSwitch")) - return -EINVAL; - snd_ctl_elem_id_clear(dst); -- if (strcasestr(ucm_id, "name=")) -+ if (strcasestr(value, "name=")) - return __snd_ctl_ascii_elem_id_parse(dst, value, NULL); - iface = SND_CTL_ELEM_IFACE_MIXER; - if (jack_control) --- -2.38.1 - - -From aa4f56c3c952269c36464cc0da9db5a1381648fa Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 9 Nov 2022 08:11:42 +0100 -Subject: [PATCH 02/18] pcm: rate - fix the crash in - snd_pcm_rate_may_wait_for_avail_min() - -The pcm argument passed to the conversion function in -snd_pcm_plugin_may_wait_for_avail_min_conv() should be -pcm->fast_op_arg. - -Test command: arecord -Dplughw:x -r12000 -c2 -fS16_LE -M temp.wav - -Fixes: d9dbb57b ("pcm: rate - rewrite the may_wait_for_avail_min callback for the rate plugin") - -BugLink: https://lore.kernel.org/alsa-devel/1667793912-18957-1-git-send-email-shengjiu.wang@nxp.com/ -Fixes: https://github.com/alsa-project/alsa-lib/issues/282 -Reported-by: Shengjiu Wang -Signed-off-by: Jaroslav Kysela ---- - src/pcm/pcm_plugin.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c -index 6bb90b8b..ec64604c 100644 ---- a/src/pcm/pcm_plugin.c -+++ b/src/pcm/pcm_plugin.c -@@ -622,7 +622,7 @@ int snd_pcm_plugin_may_wait_for_avail_min_conv( - * This code is also used by extplug, but extplug does not allow to alter the sampling rate. - */ - if (conv) -- needed_slave_avail_min = conv(pcm, needed_slave_avail_min); -+ needed_slave_avail_min = conv(pcm->fast_op_arg, needed_slave_avail_min); - - if (slave->avail_min != needed_slave_avail_min) { - snd_pcm_sw_params_t *swparams; --- -2.38.1 - - -From 39060852d810461dc8cd1464cfb2ffe84da42d56 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 9 Nov 2022 09:31:34 +0100 -Subject: [PATCH 03/18] pcm: rate - correct the previous fix for - snd_pcm_rate_may_wait_for_avail_min() - -The previous fix in aa4f56c3 was not correct. The root of the cause is -implementation in snd_pcm_may_wait_for_avail_min() inline function -where the improper pcm argument is passed to the fast_ops function. - -Fixes: aa4f56c3 ("pcm: rate - fix the crash in snd_pcm_rate_may_wait_for_avail_min()") -Fixes: d9dbb57b ("pcm: rate - rewrite the may_wait_for_avail_min callback for the rate plugin") -Signed-off-by: Jaroslav Kysela ---- - src/pcm/pcm_local.h | 2 +- - src/pcm/pcm_plugin.c | 10 +++++++--- - 2 files changed, 8 insertions(+), 4 deletions(-) - -diff --git a/src/pcm/pcm_local.h b/src/pcm/pcm_local.h -index 8d25971f..ae0c44bf 100644 ---- a/src/pcm/pcm_local.h -+++ b/src/pcm/pcm_local.h -@@ -1144,7 +1144,7 @@ static inline int snd_pcm_may_wait_for_avail_min(snd_pcm_t *pcm, snd_pcm_uframes - if (avail >= pcm->avail_min) - return 0; - if (pcm->fast_ops->may_wait_for_avail_min) -- return pcm->fast_ops->may_wait_for_avail_min(pcm, avail); -+ return pcm->fast_ops->may_wait_for_avail_min(pcm->fast_op_arg, avail); - return 1; - } - -diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c -index ec64604c..b3af1fb7 100644 ---- a/src/pcm/pcm_plugin.c -+++ b/src/pcm/pcm_plugin.c -@@ -597,8 +597,12 @@ int snd_pcm_plugin_may_wait_for_avail_min_conv( - * a) the slave can provide contineous hw_ptr between periods - * b) avail_min does not match one slave_period - */ -- snd_pcm_plugin_t *plugin = pcm->private_data; -- snd_pcm_t *slave = plugin->gen.slave; -+ snd_pcm_generic_t *generic = pcm->private_data; -+ /* -+ * do not use snd_pcm_plugin_t pointer here -+ * this code is used from the generic plugins, too -+ */ -+ snd_pcm_t *slave = generic->slave; - snd_pcm_uframes_t needed_slave_avail_min; - snd_pcm_sframes_t available; - -@@ -622,7 +626,7 @@ int snd_pcm_plugin_may_wait_for_avail_min_conv( - * This code is also used by extplug, but extplug does not allow to alter the sampling rate. - */ - if (conv) -- needed_slave_avail_min = conv(pcm->fast_op_arg, needed_slave_avail_min); -+ needed_slave_avail_min = conv(pcm, needed_slave_avail_min); - - if (slave->avail_min != needed_slave_avail_min) { - snd_pcm_sw_params_t *swparams; --- -2.38.1 - - -From 161f47da5f196c291ac0e11d066fa5ff5f79fa04 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 9 Nov 2022 14:37:45 +0100 -Subject: [PATCH 04/18] include: pcm_old.h - use a macro for the symbol - versioning - -Make the header file more readable and error prone. - -Signed-off-by: Jaroslav Kysela ---- - include/pcm_old.h | 133 ++++++++++++++++++++++++---------------------- - 1 file changed, 68 insertions(+), 65 deletions(-) - -diff --git a/include/pcm_old.h b/include/pcm_old.h -index e6e050fc..a9f5308f 100644 ---- a/include/pcm_old.h -+++ b/include/pcm_old.h -@@ -2,11 +2,14 @@ - * Old ALSA 0.9.x API - */ - -+#define ___symbol_version(name, version) \ -+ __asm__ (".symver " #name "," #name "@" version) -+ - #ifdef ALSA_PCM_OLD_HW_PARAMS_API - --asm(".symver snd_pcm_hw_params_get_access,snd_pcm_hw_params_get_access@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_set_access_first,snd_pcm_hw_params_set_access_first@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_set_access_last,snd_pcm_hw_params_set_access_last@ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_get_access, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_set_access_first, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_set_access_last, "ALSA_0.9"); - - int snd_pcm_hw_params_get_access(const snd_pcm_hw_params_t *params); - int snd_pcm_hw_params_test_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t val); -@@ -16,9 +19,9 @@ snd_pcm_access_t snd_pcm_hw_params_set_access_last(snd_pcm_t *pcm, snd_pcm_hw_pa - int snd_pcm_hw_params_set_access_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask); - void snd_pcm_hw_params_get_access_mask(snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask); - --asm(".symver snd_pcm_hw_params_get_format,snd_pcm_hw_params_get_format@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_set_format_first,snd_pcm_hw_params_set_format_first@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_set_format_last,snd_pcm_hw_params_set_format_last@ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_get_format, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_set_format_first, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_set_format_last, "ALSA_0.9"); - - int snd_pcm_hw_params_get_format(const snd_pcm_hw_params_t *params); - int snd_pcm_hw_params_test_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val); -@@ -28,9 +31,9 @@ snd_pcm_format_t snd_pcm_hw_params_set_format_last(snd_pcm_t *pcm, snd_pcm_hw_pa - int snd_pcm_hw_params_set_format_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask); - void snd_pcm_hw_params_get_format_mask(snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask); - --asm(".symver snd_pcm_hw_params_get_subformat,snd_pcm_hw_params_get_subformat@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_set_subformat_first,snd_pcm_hw_params_set_subformat_first@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_set_subformat_last,snd_pcm_hw_params_set_subformat_last@ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_get_subformat, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_set_subformat_first, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_set_subformat_last, "ALSA_0.9"); - - int snd_pcm_hw_params_test_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t val); - int snd_pcm_hw_params_get_subformat(const snd_pcm_hw_params_t *params); -@@ -40,12 +43,12 @@ snd_pcm_subformat_t snd_pcm_hw_params_set_subformat_last(snd_pcm_t *pcm, snd_pcm - int snd_pcm_hw_params_set_subformat_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask); - void snd_pcm_hw_params_get_subformat_mask(snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask); - --asm(".symver snd_pcm_hw_params_get_channels,snd_pcm_hw_params_get_channels@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_get_channels_min,snd_pcm_hw_params_get_channels_min@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_get_channels_max,snd_pcm_hw_params_get_channels_max@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_set_channels_near,snd_pcm_hw_params_set_channels_near@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_set_channels_first,snd_pcm_hw_params_set_channels_first@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_set_channels_last,snd_pcm_hw_params_set_channels_last@ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_get_channels, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_get_channels_min, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_get_channels_max, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_set_channels_near, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_set_channels_first, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_set_channels_last, "ALSA_0.9"); - - int snd_pcm_hw_params_get_channels(const snd_pcm_hw_params_t *params); - unsigned int snd_pcm_hw_params_get_channels_min(const snd_pcm_hw_params_t *params); -@@ -59,12 +62,12 @@ unsigned int snd_pcm_hw_params_set_channels_near(snd_pcm_t *pcm, snd_pcm_hw_para - unsigned int snd_pcm_hw_params_set_channels_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); - unsigned int snd_pcm_hw_params_set_channels_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); - --asm(".symver snd_pcm_hw_params_get_rate,snd_pcm_hw_params_get_rate@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_get_rate_min,snd_pcm_hw_params_get_rate_min@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_get_rate_max,snd_pcm_hw_params_get_rate_max@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_set_rate_near,snd_pcm_hw_params_set_rate_near@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_set_rate_first,snd_pcm_hw_params_set_rate_first@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_set_rate_last,snd_pcm_hw_params_set_rate_last@ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_get_rate, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_get_rate_min, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_get_rate_max, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_set_rate_near, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_set_rate_first, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_set_rate_last, "ALSA_0.9"); - - int snd_pcm_hw_params_get_rate(const snd_pcm_hw_params_t *params, int *dir); - unsigned int snd_pcm_hw_params_get_rate_min(const snd_pcm_hw_params_t *params, int *dir); -@@ -80,12 +83,12 @@ unsigned int snd_pcm_hw_params_set_rate_last(snd_pcm_t *pcm, snd_pcm_hw_params_t - int snd_pcm_hw_params_set_rate_resample(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val); - int snd_pcm_hw_params_get_rate_resample(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val); - --asm(".symver snd_pcm_hw_params_get_period_time,snd_pcm_hw_params_get_period_time@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_get_period_time_min,snd_pcm_hw_params_get_period_time_min@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_get_period_time_max,snd_pcm_hw_params_get_period_time_max@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_set_period_time_near,snd_pcm_hw_params_set_period_time_near@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_set_period_time_first,snd_pcm_hw_params_set_period_time_first@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_set_period_time_last,snd_pcm_hw_params_set_period_time_last@ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_get_period_time, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_get_period_time_min, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_get_period_time_max, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_set_period_time_near, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_set_period_time_first, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_set_period_time_last, "ALSA_0.9"); - - int snd_pcm_hw_params_get_period_time(const snd_pcm_hw_params_t *params, int *dir); - unsigned int snd_pcm_hw_params_get_period_time_min(const snd_pcm_hw_params_t *params, int *dir); -@@ -99,12 +102,12 @@ unsigned int snd_pcm_hw_params_set_period_time_near(snd_pcm_t *pcm, snd_pcm_hw_p - unsigned int snd_pcm_hw_params_set_period_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); - unsigned int snd_pcm_hw_params_set_period_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); - --asm(".symver snd_pcm_hw_params_get_period_size,snd_pcm_hw_params_get_period_size@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_get_period_size_min,snd_pcm_hw_params_get_period_size_min@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_get_period_size_max,snd_pcm_hw_params_get_period_size_max@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_set_period_size_near,snd_pcm_hw_params_set_period_size_near@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_set_period_size_first,snd_pcm_hw_params_set_period_size_first@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_set_period_size_last,snd_pcm_hw_params_set_period_size_last@ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_get_period_size, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_get_period_size_min, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_get_period_size_max, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_set_period_size_near, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_set_period_size_first, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_set_period_size_last, "ALSA_0.9"); - - snd_pcm_sframes_t snd_pcm_hw_params_get_period_size(const snd_pcm_hw_params_t *params, int *dir); - snd_pcm_uframes_t snd_pcm_hw_params_get_period_size_min(const snd_pcm_hw_params_t *params, int *dir); -@@ -119,12 +122,12 @@ snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_first(snd_pcm_t *pcm, snd_pc - snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); - int snd_pcm_hw_params_set_period_size_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); - --asm(".symver snd_pcm_hw_params_get_periods,snd_pcm_hw_params_get_periods@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_get_periods_min,snd_pcm_hw_params_get_periods_min@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_get_periods_max,snd_pcm_hw_params_get_periods_max@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_set_periods_near,snd_pcm_hw_params_set_periods_near@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_set_periods_first,snd_pcm_hw_params_set_periods_first@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_set_periods_last,snd_pcm_hw_params_set_periods_last@ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_get_periods, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_get_periods_min, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_get_periods_max, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_set_periods_near, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_set_periods_first, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_set_periods_last, "ALSA_0.9"); - - int snd_pcm_hw_params_get_periods(const snd_pcm_hw_params_t *params, int *dir); - unsigned int snd_pcm_hw_params_get_periods_min(const snd_pcm_hw_params_t *params, int *dir); -@@ -139,12 +142,12 @@ unsigned int snd_pcm_hw_params_set_periods_first(snd_pcm_t *pcm, snd_pcm_hw_para - unsigned int snd_pcm_hw_params_set_periods_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); - int snd_pcm_hw_params_set_periods_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); - --asm(".symver snd_pcm_hw_params_get_buffer_time,snd_pcm_hw_params_get_buffer_time@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_get_buffer_time_min,snd_pcm_hw_params_get_buffer_time_min@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_get_buffer_time_max,snd_pcm_hw_params_get_buffer_time_max@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_set_buffer_time_near,snd_pcm_hw_params_set_buffer_time_near@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_set_buffer_time_first,snd_pcm_hw_params_set_buffer_time_first@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_set_buffer_time_last,snd_pcm_hw_params_set_buffer_time_last@ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_get_buffer_time, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_get_buffer_time_min, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_get_buffer_time_max, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_set_buffer_time_near, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_set_buffer_time_first, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_set_buffer_time_last, "ALSA_0.9"); - - int snd_pcm_hw_params_get_buffer_time(const snd_pcm_hw_params_t *params, int *dir); - unsigned int snd_pcm_hw_params_get_buffer_time_min(const snd_pcm_hw_params_t *params, int *dir); -@@ -158,12 +161,12 @@ unsigned int snd_pcm_hw_params_set_buffer_time_near(snd_pcm_t *pcm, snd_pcm_hw_p - unsigned int snd_pcm_hw_params_set_buffer_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); - unsigned int snd_pcm_hw_params_set_buffer_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); - --asm(".symver snd_pcm_hw_params_get_buffer_size,snd_pcm_hw_params_get_buffer_size@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_get_buffer_size_min,snd_pcm_hw_params_get_buffer_size_min@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_get_buffer_size_max,snd_pcm_hw_params_get_buffer_size_max@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_set_buffer_size_near,snd_pcm_hw_params_set_buffer_size_near@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_set_buffer_size_first,snd_pcm_hw_params_set_buffer_size_first@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_set_buffer_size_last,snd_pcm_hw_params_set_buffer_size_last@ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_get_buffer_size, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_get_buffer_size_min, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_get_buffer_size_max, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_set_buffer_size_near, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_set_buffer_size_first, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_set_buffer_size_last, "ALSA_0.9"); - - snd_pcm_sframes_t snd_pcm_hw_params_get_buffer_size(const snd_pcm_hw_params_t *params); - snd_pcm_uframes_t snd_pcm_hw_params_get_buffer_size_min(const snd_pcm_hw_params_t *params); -@@ -177,12 +180,12 @@ snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_near(snd_pcm_t *pcm, snd_pcm - snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); - snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); - --asm(".symver snd_pcm_hw_params_get_tick_time,snd_pcm_hw_params_get_tick_time@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_get_tick_time_min,snd_pcm_hw_params_get_tick_time_min@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_get_tick_time_max,snd_pcm_hw_params_get_tick_time_max@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_set_tick_time_near,snd_pcm_hw_params_set_tick_time_near@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_set_tick_time_first,snd_pcm_hw_params_set_tick_time_first@ALSA_0.9"); --asm(".symver snd_pcm_hw_params_set_tick_time_last,snd_pcm_hw_params_set_tick_time_last@ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_get_tick_time, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_get_tick_time_min, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_get_tick_time_max, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_set_tick_time_near, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_set_tick_time_first, "ALSA_0.9"); -+___symbol_version(snd_pcm_hw_params_set_tick_time_last, "ALSA_0.9"); - - int snd_pcm_hw_params_get_tick_time(const snd_pcm_hw_params_t *params, int *dir); - unsigned int snd_pcm_hw_params_get_tick_time_min(const snd_pcm_hw_params_t *params, int *dir); -@@ -201,14 +204,14 @@ unsigned int snd_pcm_hw_params_set_tick_time_last(snd_pcm_t *pcm, snd_pcm_hw_par - - #ifdef ALSA_PCM_OLD_SW_PARAMS_API - --asm(".symver snd_pcm_sw_params_get_tstamp_mode,snd_pcm_sw_params_get_tstamp_mode@ALSA_0.9"); --asm(".symver snd_pcm_sw_params_get_sleep_min,snd_pcm_sw_params_get_sleep_min@ALSA_0.9"); --asm(".symver snd_pcm_sw_params_get_avail_min,snd_pcm_sw_params_get_avail_min@ALSA_0.9"); --asm(".symver snd_pcm_sw_params_get_xfer_align,snd_pcm_sw_params_get_xfer_align@ALSA_0.9"); --asm(".symver snd_pcm_sw_params_get_start_threshold,snd_pcm_sw_params_get_start_threshold@ALSA_0.9"); --asm(".symver snd_pcm_sw_params_get_stop_threshold,snd_pcm_sw_params_get_stop_threshold@ALSA_0.9"); --asm(".symver snd_pcm_sw_params_get_silence_threshold,snd_pcm_sw_params_get_silence_threshold@ALSA_0.9"); --asm(".symver snd_pcm_sw_params_get_silence_size,snd_pcm_sw_params_get_silence_size@ALSA_0.9"); -+___symbol_version(snd_pcm_sw_params_get_tstamp_mode, "ALSA_0.9"); -+___symbol_version(snd_pcm_sw_params_get_sleep_min, "ALSA_0.9"); -+___symbol_version(snd_pcm_sw_params_get_avail_min, "ALSA_0.9"); -+___symbol_version(snd_pcm_sw_params_get_xfer_align, "ALSA_0.9"); -+___symbol_version(snd_pcm_sw_params_get_start_threshold, "ALSA_0.9"); -+___symbol_version(snd_pcm_sw_params_get_stop_threshold, "ALSA_0.9"); -+___symbol_version(snd_pcm_sw_params_get_silence_threshold, "ALSA_0.9"); -+___symbol_version(snd_pcm_sw_params_get_silence_size, "ALSA_0.9"); - - int snd_pcm_sw_params_set_tstamp_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_tstamp_t val); - snd_pcm_tstamp_t snd_pcm_sw_params_get_tstamp_mode(const snd_pcm_sw_params_t *params); --- -2.38.1 - - -From 152983f01b0bc1178ea0d461ebf66e2d2a8e2e02 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 9 Nov 2022 15:04:06 +0100 -Subject: [PATCH 05/18] include: alsa-symbols.h - use newer gcc symver function - attribute - -Use the symver function attribute for newer gccs (version 11+). -The symver function attribute was introduced probably earlier -(gcc-10). We can fix that on demand later. - -Signed-off-by: Jaroslav Kysela ---- - include/alsa-symbols.h | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/include/alsa-symbols.h b/include/alsa-symbols.h -index 344f021a..f8c49103 100644 ---- a/include/alsa-symbols.h -+++ b/include/alsa-symbols.h -@@ -29,10 +29,17 @@ - #define INTERNAL_CONCAT2_2(Pre, Post) Pre##Post - #define INTERNAL(Name) INTERNAL_CONCAT2_2(__, Name) - -+#if __GNUC__ > 10 -+#define symbol_version(real, name, version) \ -+ extern __typeof (real) real __attribute__((symver (#name "@" #version))) -+#define default_symbol_version(real, name, version) \ -+ extern __typeof (real) real __attribute__((symver (#name "@@" #version))) -+#else - #define symbol_version(real, name, version) \ - __asm__ (".symver " ASM_NAME(#real) "," ASM_NAME(#name) "@" #version) - #define default_symbol_version(real, name, version) \ - __asm__ (".symver " ASM_NAME(#real) "," ASM_NAME(#name) "@@" #version) -+#endif - - #ifdef __clang__ - #define EXPORT_SYMBOL __attribute__((visibility("default"))) --- -2.38.1 - - -From 78b20e3caa7bba930095e05f3f8cbe665204fcfd Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Mon, 14 Nov 2022 12:36:04 +0100 -Subject: [PATCH 06/18] test: latency - use snd_pcm_format_physical_width() - -We need to allocate frames using the physical size not -the sample bit size. - -Signed-off-by: Jaroslav Kysela ---- - src/topology/ctl.c | 7 ++++++- - test/latency.c | 6 +++--- - 2 files changed, 9 insertions(+), 4 deletions(-) - -diff --git a/src/topology/ctl.c b/src/topology/ctl.c -index dd05424d..2c500ffc 100644 ---- a/src/topology/ctl.c -+++ b/src/topology/ctl.c -@@ -17,9 +17,13 @@ - Liam Girdwood - */ - -+#define ALSA_PCM_OLD_HW_PARAMS_API 1 -+#define ALSA_PCM_OLD_SW_PARAMS_API 1 -+#include "../../include/asoundlib.h" - #include "list.h" - #include "tplg_local.h" - -+ - #define ENUM_VAL_SIZE (SNDRV_CTL_ELEM_ID_NAME_MAXLEN >> 2) - - struct ctl_access_elem { -@@ -71,7 +75,8 @@ static int parse_access_values(snd_config_t *cfg, - } - } - } -- -+ return snd_pcm_hw_params_get_channels(NULL); -+ //return snd_pcm_hw_params_get_access(NULL); - return 0; - } - -diff --git a/test/latency.c b/test/latency.c -index 298bab8a..95b3c0ee 100644 ---- a/test/latency.c -+++ b/test/latency.c -@@ -354,7 +354,7 @@ long readbuf(snd_pcm_t *handle, char *buf, long len, size_t *frames, size_t *max - } - // printf("read = %li\n", r); - } else { -- int frame_bytes = (snd_pcm_format_width(format) / 8) * channels; -+ int frame_bytes = (snd_pcm_format_physical_width(format) / 8) * channels; - do { - r = snd_pcm_readi(handle, buf, len); - if (r > 0) { -@@ -374,7 +374,7 @@ long readbuf(snd_pcm_t *handle, char *buf, long len, size_t *frames, size_t *max - long writebuf(snd_pcm_t *handle, char *buf, long len, size_t *frames) - { - long r; -- int frame_bytes = (snd_pcm_format_width(format) / 8) * channels; -+ int frame_bytes = (snd_pcm_format_physical_width(format) / 8) * channels; - - while (len > 0) { - r = snd_pcm_writei(handle, buf, len); -@@ -579,7 +579,7 @@ int main(int argc, char *argv[]) - - loop_limit = loop_sec * rate; - latency = latency_min - 4; -- buffer = malloc((latency_max * snd_pcm_format_width(format) / 8) * 2); -+ buffer = malloc((latency_max * snd_pcm_format_physical_width(format) / 8) * 2); - - setscheduler(); - --- -2.38.1 - - -From 425e4d1fbea4965ea0fb7529b1ee6cbb47eb7227 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Mon, 14 Nov 2022 14:34:46 +0100 -Subject: [PATCH 07/18] pcm: fix the fast_ops pcm argument for fast_ops - -The fast_ops callback invocation must always pass the fast_op_arg -as the pcm argument. Plugins expect that. - -Signed-off-by: Jaroslav Kysela ---- - src/pcm/pcm.c | 4 ++-- - src/pcm/pcm_direct.c | 2 +- - src/pcm/pcm_hw.c | 2 +- - src/pcm/pcm_multi.c | 5 +++-- - 4 files changed, 7 insertions(+), 6 deletions(-) - -diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c -index 927aa055..2b966d44 100644 ---- a/src/pcm/pcm.c -+++ b/src/pcm/pcm.c -@@ -1705,7 +1705,7 @@ int snd_pcm_link(snd_pcm_t *pcm1, snd_pcm_t *pcm2) - assert(pcm1); - assert(pcm2); - if (pcm1->fast_ops->link) -- err = pcm1->fast_ops->link(pcm1, pcm2); -+ err = pcm1->fast_ops->link(pcm1->fast_op_arg, pcm2); - else - err = -ENOSYS; - return err; -@@ -1722,7 +1722,7 @@ int snd_pcm_unlink(snd_pcm_t *pcm) - - assert(pcm); - if (pcm->fast_ops->unlink) -- err = pcm->fast_ops->unlink(pcm); -+ err = pcm->fast_ops->unlink(pcm->fast_op_arg); - else - err = -ENOSYS; - return err; -diff --git a/src/pcm/pcm_direct.c b/src/pcm/pcm_direct.c -index 4803b81b..3cc5305f 100644 ---- a/src/pcm/pcm_direct.c -+++ b/src/pcm/pcm_direct.c -@@ -688,7 +688,7 @@ int snd_pcm_direct_check_xrun(snd_pcm_direct_t *direct, snd_pcm_t *pcm) - * so don't increment but just update to actual counter - */ - direct->recoveries = direct->shmptr->s.recoveries; -- pcm->fast_ops->drop(pcm); -+ pcm->fast_ops->drop(pcm->fast_op_arg); - /* trigger_tstamp update is missing in drop callbacks */ - gettimestamp(&direct->trigger_tstamp, pcm->tstamp_type); - /* no timer clear: -diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c -index 5dfe32ee..0588ce5e 100644 ---- a/src/pcm/pcm_hw.c -+++ b/src/pcm/pcm_hw.c -@@ -838,7 +838,7 @@ static int snd_pcm_hw_link(snd_pcm_t *pcm1, snd_pcm_t *pcm2) - { - if (pcm2->type != SND_PCM_TYPE_HW) { - if (pcm2->fast_ops->link_slaves) -- return pcm2->fast_ops->link_slaves(pcm2, pcm1); -+ return pcm2->fast_ops->link_slaves(pcm2->fast_op_arg, pcm1); - return -ENOSYS; - } - return hw_link(pcm1, pcm2); -diff --git a/src/pcm/pcm_multi.c b/src/pcm/pcm_multi.c -index bec6d06f..3e7ce82c 100644 ---- a/src/pcm/pcm_multi.c -+++ b/src/pcm/pcm_multi.c -@@ -759,8 +759,9 @@ static int snd_pcm_multi_link_slaves(snd_pcm_t *pcm, snd_pcm_t *master) - static int snd_pcm_multi_link(snd_pcm_t *pcm1, snd_pcm_t *pcm2) - { - snd_pcm_multi_t *multi = pcm1->private_data; -- if (multi->slaves[0].pcm->fast_ops->link) -- return multi->slaves[0].pcm->fast_ops->link(multi->slaves[0].pcm, pcm2); -+ snd_pcm_t *main_pcm = multi->slaves[0].pcm; -+ if (main_pcm->fast_ops->link) -+ return main_pcm->fast_ops->link(main_pcm->fast_op_arg, pcm2); - return -ENOSYS; - } - --- -2.38.1 - - -From 3e4aeba25bf4a4808183c4b64270f7321b436c13 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Mon, 14 Nov 2022 20:42:10 +0100 -Subject: [PATCH 08/18] test: latency - add more realtime tests - -Add '-x' and '-X' tests and '-U' - I/O update mode based -on the system timing. - -It may be required to check the position updates for the specific hardware. -Print the real time / stream time differences. - -Also include code to make valgrind happy (including the wrong memory -llocation for the stream buffer). - -Signed-off-by: Jaroslav Kysela ---- - test/latency.c | 163 +++++++++++++++++++++++++++++++++++++++++++++---- - 1 file changed, 151 insertions(+), 12 deletions(-) - -diff --git a/test/latency.c b/test/latency.c -index 95b3c0ee..91bef1a1 100644 ---- a/test/latency.c -+++ b/test/latency.c -@@ -33,10 +33,13 @@ - #include - #include - #include -+#include - #include "../include/asoundlib.h" - #include - #include - -+typedef struct timespec timestamp_t; -+ - char *pdevice = "hw:0,0"; - char *cdevice = "hw:0,0"; - snd_pcm_format_t format = SND_PCM_FORMAT_S16_LE; -@@ -50,10 +53,40 @@ int loop_sec = 30; /* seconds */ - int block = 0; /* block mode */ - int use_poll = 0; - int resample = 1; -+int sys_latency = 0; /* data I/O: use system timings instead driver wakeups */ -+int pos_dump = 0; /* dump positions */ -+int realtime_check = 0; - unsigned long loop_limit; -+snd_pcm_uframes_t playback_buffer_size; - - snd_output_t *output = NULL; - -+static inline long long frames_to_micro(size_t frames) -+{ -+ return (long long)((frames * 1000000LL) + (rate / 2)) / rate; -+} -+ -+void timestamp_now(timestamp_t *tstamp) -+{ -+ if (clock_gettime(CLOCK_MONOTONIC_RAW, tstamp)) -+ printf("clock_gettime() failed\n"); -+} -+ -+long long timestamp_diff_micro(timestamp_t *tstamp) -+{ -+ timestamp_t now, diff; -+ timestamp_now(&now); -+ if (tstamp->tv_nsec > now.tv_nsec) { -+ diff.tv_sec = now.tv_sec - tstamp->tv_sec - 1; -+ diff.tv_nsec = (now.tv_nsec + 1000000000L) - tstamp->tv_nsec; -+ } else { -+ diff.tv_sec = now.tv_sec - tstamp->tv_sec; -+ diff.tv_nsec = now.tv_nsec - tstamp->tv_nsec; -+ } -+ /* microseconds */ -+ return (diff.tv_sec * 1000000) + ((diff.tv_nsec + 500L) / 1000L); -+} -+ - int setparams_stream(snd_pcm_t *handle, - snd_pcm_hw_params_t *params, - const char *id) -@@ -96,6 +129,14 @@ int setparams_stream(snd_pcm_t *handle, - printf("Rate doesn't match (requested %iHz, get %iHz)\n", rate, err); - return -EINVAL; - } -+ /* we do not want driver wakeups */ -+ if (sys_latency > 0 && snd_pcm_hw_params_can_disable_period_wakeup(params)) { -+ err = snd_pcm_hw_params_set_period_wakeup(handle, params, 0); -+ if (err < 0) { -+ printf("Cannot disable period wakeups for %s\n", id); -+ return err; -+ } -+ } - return 0; - } - -@@ -227,6 +268,7 @@ int setparams(snd_pcm_t *phandle, snd_pcm_t *chandle, int *bufsize) - goto __again; - - snd_pcm_hw_params_get_buffer_size(p_params, &p_size); -+ playback_buffer_size = p_size; - if (p_psize * 2 < p_size) { - snd_pcm_hw_params_get_periods_min(p_params, &val, NULL); - if (val > 2) { -@@ -390,7 +432,7 @@ long writebuf(snd_pcm_t *handle, char *buf, long len, size_t *frames) - } - return 0; - } -- -+ - #define FILTERSWEEP_LFO_CENTER 2000. - #define FILTERSWEEP_LFO_DEPTH 1800. - #define FILTERSWEEP_LFO_FREQ 0.2 -@@ -434,6 +476,19 @@ void applyeffect(char* buffer,int r) - } - } - -+static ssize_t get_avail(snd_pcm_t *pcm) -+{ -+ ssize_t avail; -+ -+ while (1) { -+ avail = snd_pcm_avail(pcm); -+ if (avail == -EAGAIN) -+ continue; -+ break; -+ } -+ return avail; -+} -+ - void help(void) - { - int k; -@@ -444,6 +499,7 @@ void help(void) - "-C,--cdevice capture device\n" - "-m,--min minimum latency in frames\n" - "-M,--max maximum latency in frames\n" -+"-U,--updates I/O updates in milliseconds (0 = off)\n" - "-F,--frames frames to transfer\n" - "-f,--format sample format\n" - "-c,--channels channels\n" -@@ -454,6 +510,8 @@ void help(void) - "-b,--block block mode\n" - "-p,--poll use poll (wait for event - reduces CPU usage)\n" - "-e,--effect apply an effect (bandpass filter sweep)\n" -+"-x,--posdump dump buffer positions\n" -+"-X,--realtime do a realtime check (buffering)\n" - ); - printf("Recognized sample formats are:"); - for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) { -@@ -480,6 +538,7 @@ int main(int argc, char *argv[]) - {"cdevice", 1, NULL, 'C'}, - {"min", 1, NULL, 'm'}, - {"max", 1, NULL, 'M'}, -+ {"updates", 1, NULL, 'U'}, - {"frames", 1, NULL, 'F'}, - {"format", 1, NULL, 'f'}, - {"channels", 1, NULL, 'c'}, -@@ -490,20 +549,23 @@ int main(int argc, char *argv[]) - {"block", 0, NULL, 'b'}, - {"poll", 0, NULL, 'p'}, - {"effect", 0, NULL, 'e'}, -+ {"posdump", 0, NULL, 'x'}, -+ {"realtime", 0, NULL, 'X'}, - {NULL, 0, NULL, 0}, - }; - snd_pcm_t *phandle, *chandle; - char *buffer; - int err, latency, morehelp; -- int ok; -+ int ok, first_avail; - snd_timestamp_t p_tstamp, c_tstamp; -- ssize_t r; -+ ssize_t r, cap_avail, cap_avail_max, pbk_fill, pbk_fill_min; - size_t frames_in, frames_out, in_max; -+ timestamp_t tstamp_start; - int effect = 0; - morehelp = 0; - while (1) { - int c; -- if ((c = getopt_long(argc, argv, "hP:C:m:M:F:f:c:r:B:E:s:bpen", long_option, NULL)) < 0) -+ if ((c = getopt_long(argc, argv, "hP:C:m:M:U:F:f:c:r:B:E:s:bpenxX", long_option, NULL)) < 0) - break; - switch (c) { - case 'h': -@@ -525,6 +587,10 @@ int main(int argc, char *argv[]) - err = atoi(optarg) / 2; - latency_max = latency_min > err ? latency_min : err; - break; -+ case 'U': -+ err = atoi(optarg); -+ sys_latency = err <= 0 ? 0 : err; -+ break; - case 'f': - format = snd_pcm_format_value(optarg); - if (format == SND_PCM_FORMAT_UNKNOWN) { -@@ -564,6 +630,12 @@ int main(int argc, char *argv[]) - case 'n': - resample = 0; - break; -+ case 'x': -+ pos_dump = 1; -+ break; -+ case 'X': -+ realtime_check = 1; -+ break; - } - } - -@@ -579,15 +651,27 @@ int main(int argc, char *argv[]) - - loop_limit = loop_sec * rate; - latency = latency_min - 4; -- buffer = malloc((latency_max * snd_pcm_format_physical_width(format) / 8) * 2); -+ buffer = malloc((latency_max * 2 * snd_pcm_format_physical_width(format) / 8) * channels); -+ -+ /* I/O updates based on a system timer */ -+ if (sys_latency > 0) { -+ block = 0; -+ use_poll = 0; -+ } - - setscheduler(); - - printf("Playback device is %s\n", pdevice); - printf("Capture device is %s\n", cdevice); -- printf("Parameters are %iHz, %s, %i channels, %s mode\n", rate, snd_pcm_format_name(format), channels, block ? "blocking" : "non-blocking"); -- printf("Poll mode: %s\n", use_poll ? "yes" : "no"); -- printf("Loop limit is %lu frames, minimum latency = %i, maximum latency = %i\n", loop_limit, latency_min * 2, latency_max * 2); -+ printf("Parameters are %iHz, %s, %i channels, %s mode, use poll %s\n", -+ rate, snd_pcm_format_name(format), -+ channels, block ? "blocking" : "non-blocking", -+ use_poll ? "yes" : "no"); -+ printf("Loop limit is %lu frames, minimum latency = %i, maximum latency = %i", -+ loop_limit, latency_min * 2, latency_max * 2); -+ if (sys_latency > 0) -+ printf(", I/O updates %ims", sys_latency); -+ printf("\n"); - - if ((err = snd_pcm_open(&phandle, pdevice, SND_PCM_STREAM_PLAYBACK, block ? 0 : SND_PCM_NONBLOCK)) < 0) { - printf("Playback open error: %s\n", snd_strerror(err)); -@@ -613,6 +697,9 @@ int main(int argc, char *argv[]) - y[1] = (float*) malloc(channels*sizeof(float)); - y[2] = (float*) malloc(channels*sizeof(float)); - } -+ -+ cap_avail_max = 0; -+ pbk_fill_min = latency * 2; - - while (1) { - frames_in = frames_out = 0; -@@ -623,7 +710,7 @@ int main(int argc, char *argv[]) - printf("Streams link error: %s\n", snd_strerror(err)); - exit(0); - } -- if (snd_pcm_format_set_silence(format, buffer, latency*channels) < 0) { -+ if (snd_pcm_format_set_silence(format, buffer, latency * channels) < 0) { - fprintf(stderr, "silence error\n"); - break; - } -@@ -640,6 +727,8 @@ int main(int argc, char *argv[]) - printf("Go error: %s\n", snd_strerror(err)); - exit(0); - } -+ if (realtime_check) -+ timestamp_now(&tstamp_start); - gettimestamp(phandle, &p_tstamp); - gettimestamp(chandle, &c_tstamp); - #if 0 -@@ -651,16 +740,54 @@ int main(int argc, char *argv[]) - - ok = 1; - in_max = 0; -+ first_avail = 1; - while (ok && frames_in < loop_limit) { -- if (use_poll) { -+ cap_avail = latency; -+ if (sys_latency > 0) { -+ poll(NULL, 0, sys_latency); -+ cap_avail = get_avail(chandle); -+ if (cap_avail < 0) { -+ printf("Avail failed: %s\n", snd_strerror(cap_avail)); -+ ok = 0; -+ break; -+ } -+ if (first_avail && realtime_check) { -+ long long diff = timestamp_diff_micro(&tstamp_start); -+ long long pos = frames_to_micro(cap_avail); -+ printf("POS FIRST CHECK: c=%zd (rt=%lldus)\n", cap_avail, pos - diff); -+ first_avail = 0; -+ } -+ } else if (use_poll) { - /* use poll to wait for next event */ - snd_pcm_wait(chandle, 1000); - } -- if ((r = readbuf(chandle, buffer, latency, &frames_in, &in_max)) < 0) -+ if (pos_dump || realtime_check) { -+ if (sys_latency <= 0) -+ cap_avail = get_avail(chandle); -+ pbk_fill = get_avail(phandle); -+ if (pbk_fill >= 0) -+ pbk_fill = playback_buffer_size - pbk_fill; -+ if (cap_avail > cap_avail_max) -+ cap_avail_max = cap_avail; -+ if (pbk_fill >= 0 && pbk_fill < pbk_fill_min) -+ pbk_fill_min = pbk_fill; -+ if (realtime_check) { -+ long long diff = timestamp_diff_micro(&tstamp_start); -+ long long cap_pos = frames_to_micro(frames_in + cap_avail); -+ long long pbk_pos = frames_to_micro(frames_out - pbk_fill); -+ printf("POS: p=%zd (min=%zd, rt=%lldus) c=%zd (max=%zd, rt=%lldus)\n", -+ pbk_fill, pbk_fill_min, pbk_pos - diff, -+ cap_avail, cap_avail_max, cap_pos - diff); -+ } else if (pos_dump) { -+ printf("POS: p=%zd (min=%zd), c=%zd (max=%zd)\n", -+ pbk_fill, pbk_fill_min, cap_avail, cap_avail_max); -+ } -+ } -+ if ((r = readbuf(chandle, buffer, cap_avail, &frames_in, &in_max)) < 0) - ok = 0; - else { - if (effect) -- applyeffect(buffer,r); -+ applyeffect(buffer, r); - if (writebuf(phandle, buffer, r, &frames_out) < 0) - ok = 0; - } -@@ -677,6 +804,13 @@ int main(int argc, char *argv[]) - if (p_tstamp.tv_sec == c_tstamp.tv_sec && - p_tstamp.tv_usec == c_tstamp.tv_usec) - printf("Hardware sync\n"); -+ if (realtime_check) { -+ long long diff = timestamp_diff_micro(&tstamp_start); -+ long long mtime = frames_to_micro(frames_in); -+ printf("Elapsed real time: %lldus\n", diff); -+ printf("Elapsed device time: %lldus\n", mtime); -+ printf("Test time diff (device - real): %lldus\n", mtime - diff); -+ } - snd_pcm_drop(chandle); - snd_pcm_nonblock(phandle, 0); - snd_pcm_drain(phandle); -@@ -698,5 +832,10 @@ int main(int argc, char *argv[]) - } - snd_pcm_close(phandle); - snd_pcm_close(chandle); -+ snd_output_close(output); -+ snd_config_update_free_global(); -+ free(buffer); -+ free(pdevice); -+ free(cdevice); - return 0; - } --- -2.38.1 - - -From a0836e2af1f2c37b66e723d8caf399e80b76825b Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Mon, 14 Nov 2022 21:26:39 +0100 -Subject: [PATCH 09/18] latency: add timestamps to the POS lines - -- remove first capture pos line -- measure the snd_pcm_start() call, too - -Signed-off-by: Jaroslav Kysela ---- - test/latency.c | 17 ++++++----------- - 1 file changed, 6 insertions(+), 11 deletions(-) - -diff --git a/test/latency.c b/test/latency.c -index 91bef1a1..3aff37c1 100644 ---- a/test/latency.c -+++ b/test/latency.c -@@ -556,7 +556,7 @@ int main(int argc, char *argv[]) - snd_pcm_t *phandle, *chandle; - char *buffer; - int err, latency, morehelp; -- int ok, first_avail; -+ int ok; - snd_timestamp_t p_tstamp, c_tstamp; - ssize_t r, cap_avail, cap_avail_max, pbk_fill, pbk_fill_min; - size_t frames_in, frames_out, in_max; -@@ -723,12 +723,14 @@ int main(int argc, char *argv[]) - break; - } - -+ if (realtime_check) -+ timestamp_now(&tstamp_start); - if ((err = snd_pcm_start(chandle)) < 0) { - printf("Go error: %s\n", snd_strerror(err)); - exit(0); - } - if (realtime_check) -- timestamp_now(&tstamp_start); -+ printf("[%lldus] Stream start\n", timestamp_diff_micro(&tstamp_start)); - gettimestamp(phandle, &p_tstamp); - gettimestamp(chandle, &c_tstamp); - #if 0 -@@ -740,7 +742,6 @@ int main(int argc, char *argv[]) - - ok = 1; - in_max = 0; -- first_avail = 1; - while (ok && frames_in < loop_limit) { - cap_avail = latency; - if (sys_latency > 0) { -@@ -751,12 +752,6 @@ int main(int argc, char *argv[]) - ok = 0; - break; - } -- if (first_avail && realtime_check) { -- long long diff = timestamp_diff_micro(&tstamp_start); -- long long pos = frames_to_micro(cap_avail); -- printf("POS FIRST CHECK: c=%zd (rt=%lldus)\n", cap_avail, pos - diff); -- first_avail = 0; -- } - } else if (use_poll) { - /* use poll to wait for next event */ - snd_pcm_wait(chandle, 1000); -@@ -775,8 +770,8 @@ int main(int argc, char *argv[]) - long long diff = timestamp_diff_micro(&tstamp_start); - long long cap_pos = frames_to_micro(frames_in + cap_avail); - long long pbk_pos = frames_to_micro(frames_out - pbk_fill); -- printf("POS: p=%zd (min=%zd, rt=%lldus) c=%zd (max=%zd, rt=%lldus)\n", -- pbk_fill, pbk_fill_min, pbk_pos - diff, -+ printf("[%lldus] POS: p=%zd (min=%zd, rt=%lldus) c=%zd (max=%zd, rt=%lldus)\n", -+ diff, pbk_fill, pbk_fill_min, pbk_pos - diff, - cap_avail, cap_avail_max, cap_pos - diff); - } else if (pos_dump) { - printf("POS: p=%zd (min=%zd), c=%zd (max=%zd)\n", --- -2.38.1 - - -From 8b64f22459b6c55ec54f985f35ff701e18800616 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 15 Nov 2022 17:25:59 +0100 -Subject: [PATCH 10/18] ucm: clarify set_defaults calls - -- do full reset in snd_use_case_mgr_reload - -Signed-off-by: Jaroslav Kysela ---- - src/ucm/main.c | 36 +++++++++++++++++++++++++----------- - 1 file changed, 25 insertions(+), 11 deletions(-) - -diff --git a/src/ucm/main.c b/src/ucm/main.c -index 28c60565..4f36648c 100644 ---- a/src/ucm/main.c -+++ b/src/ucm/main.c -@@ -998,13 +998,14 @@ static int add_auto_values(snd_use_case_mgr_t *uc_mgr) - /** - * \brief execute default commands - * \param uc_mgr Use case manager -+ * \param force Force run - * \return zero on success, otherwise a negative error code - */ --static int set_defaults(snd_use_case_mgr_t *uc_mgr) -+static int set_defaults(snd_use_case_mgr_t *uc_mgr, bool force) - { - int err; - -- if (uc_mgr->default_list_executed) -+ if (!force && uc_mgr->default_list_executed) - return 0; - err = execute_sequence(uc_mgr, NULL, &uc_mgr->default_list, - &uc_mgr->value_list, NULL, NULL); -@@ -1351,7 +1352,7 @@ static int set_verb(snd_use_case_mgr_t *uc_mgr, - int err; - - if (enable) { -- err = set_defaults(uc_mgr); -+ err = set_defaults(uc_mgr, false); - if (err < 0) - return err; - seq = &verb->enable_list; -@@ -1435,6 +1436,22 @@ static int set_device(snd_use_case_mgr_t *uc_mgr, - return err; - } - -+/** -+ * \brief Do the full reset -+ * \param uc_mgr Use case manager -+ * \return zero on success, otherwise a negative error code -+ */ -+static int do_reset(snd_use_case_mgr_t *uc_mgr) -+{ -+ int err; -+ -+ err = set_defaults(uc_mgr, true); -+ INIT_LIST_HEAD(&uc_mgr->active_modifiers); -+ INIT_LIST_HEAD(&uc_mgr->active_devices); -+ uc_mgr->active_verb = NULL; -+ return err; -+} -+ - /** - * \brief Parse open arguments - * \param uc_mgr Use case manager -@@ -1569,6 +1586,8 @@ int snd_use_case_mgr_reload(snd_use_case_mgr_t *uc_mgr) - - pthread_mutex_lock(&uc_mgr->mutex); - -+ do_reset(uc_mgr); -+ - uc_mgr_free_verb(uc_mgr); - - uc_mgr->default_list_executed = 0; -@@ -1633,8 +1652,7 @@ static int dismantle_use_case(snd_use_case_mgr_t *uc_mgr) - } - uc_mgr->active_verb = NULL; - -- err = execute_sequence(uc_mgr, NULL, &uc_mgr->default_list, -- &uc_mgr->value_list, NULL, NULL); -+ err = set_defaults(uc_mgr, true); - - return err; - } -@@ -1649,11 +1667,7 @@ int snd_use_case_mgr_reset(snd_use_case_mgr_t *uc_mgr) - int err; - - pthread_mutex_lock(&uc_mgr->mutex); -- err = execute_sequence(uc_mgr, NULL, &uc_mgr->default_list, -- &uc_mgr->value_list, NULL, NULL); -- INIT_LIST_HEAD(&uc_mgr->active_modifiers); -- INIT_LIST_HEAD(&uc_mgr->active_devices); -- uc_mgr->active_verb = NULL; -+ err = do_reset(uc_mgr); - pthread_mutex_unlock(&uc_mgr->mutex); - return err; - } -@@ -2512,7 +2526,7 @@ static int set_defaults_user(snd_use_case_mgr_t *uc_mgr, - uc_error("error: wrong value for _defaults (%s)", value); - return -EINVAL; - } -- return set_defaults(uc_mgr); -+ return set_defaults(uc_mgr, false); - } - - static int handle_transition_verb(snd_use_case_mgr_t *uc_mgr, --- -2.38.1 - - -From 9649b64c6f72984c53f469dad8dd4221d307e06d Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 22 Nov 2022 09:59:04 +0100 -Subject: [PATCH 11/18] ucm: handle empty string also for ${env:} substitution - -Signed-off-by: Jaroslav Kysela ---- - src/ucm/ucm_subs.c | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/src/ucm/ucm_subs.c b/src/ucm/ucm_subs.c -index 2261bdc2..e62290ea 100644 ---- a/src/ucm/ucm_subs.c -+++ b/src/ucm/ucm_subs.c -@@ -490,7 +490,13 @@ static char *rval_env(snd_use_case_mgr_t *uc_mgr ATTRIBUTE_UNUSED, const char *i - { - char *e; - -- e = getenv(id); -+ if (*id == '-') { -+ e = getenv(id + 1); -+ if (e == NULL) -+ e = ""; -+ } else { -+ e = getenv(id); -+ } - if (e) - return strdup(e); - return NULL; --- -2.38.1 - - -From f0f054517c05ff4ef7a1615851a686a3a202b9ff Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 23 Nov 2022 17:56:20 +0100 -Subject: [PATCH 12/18] test: latency - add -y option (I/O usleep) - -Signed-off-by: Jaroslav Kysela ---- - test/latency.c | 13 ++++++++++++- - 1 file changed, 12 insertions(+), 1 deletion(-) - -diff --git a/test/latency.c b/test/latency.c -index 3aff37c1..161d1f68 100644 ---- a/test/latency.c -+++ b/test/latency.c -@@ -52,6 +52,7 @@ int latency_max = 2048; /* in frames / 2 */ - int loop_sec = 30; /* seconds */ - int block = 0; /* block mode */ - int use_poll = 0; -+int usleep_val = 0; - int resample = 1; - int sys_latency = 0; /* data I/O: use system timings instead driver wakeups */ - int pos_dump = 0; /* dump positions */ -@@ -509,6 +510,8 @@ void help(void) - "-s,--seconds duration of test in seconds\n" - "-b,--block block mode\n" - "-p,--poll use poll (wait for event - reduces CPU usage)\n" -+"-y,--usleep sleep for the specified amount of microseconds between\n" -+" stream updates (default 0 - off)\n" - "-e,--effect apply an effect (bandpass filter sweep)\n" - "-x,--posdump dump buffer positions\n" - "-X,--realtime do a realtime check (buffering)\n" -@@ -548,6 +551,7 @@ int main(int argc, char *argv[]) - {"seconds", 1, NULL, 's'}, - {"block", 0, NULL, 'b'}, - {"poll", 0, NULL, 'p'}, -+ {"usleep", 1, NULL, 'y'}, - {"effect", 0, NULL, 'e'}, - {"posdump", 0, NULL, 'x'}, - {"realtime", 0, NULL, 'X'}, -@@ -565,7 +569,7 @@ int main(int argc, char *argv[]) - morehelp = 0; - while (1) { - int c; -- if ((c = getopt_long(argc, argv, "hP:C:m:M:U:F:f:c:r:B:E:s:bpenxX", long_option, NULL)) < 0) -+ if ((c = getopt_long(argc, argv, "hP:C:m:M:U:F:f:c:r:B:E:s:y:bpenxX", long_option, NULL)) < 0) - break; - switch (c) { - case 'h': -@@ -624,6 +628,9 @@ int main(int argc, char *argv[]) - case 'p': - use_poll = 1; - break; -+ case 'y': -+ usleep_val = atoi(optarg); -+ break; - case 'e': - effect = 1; - break; -@@ -671,6 +678,8 @@ int main(int argc, char *argv[]) - loop_limit, latency_min * 2, latency_max * 2); - if (sys_latency > 0) - printf(", I/O updates %ims", sys_latency); -+ else if (!block) -+ printf(", I/O usleep %ius", usleep_val); - printf("\n"); - - if ((err = snd_pcm_open(&phandle, pdevice, SND_PCM_STREAM_PLAYBACK, block ? 0 : SND_PCM_NONBLOCK)) < 0) { -@@ -755,6 +764,8 @@ int main(int argc, char *argv[]) - } else if (use_poll) { - /* use poll to wait for next event */ - snd_pcm_wait(chandle, 1000); -+ } else if (usleep_val > 0) { -+ usleep(usleep_val); - } - if (pos_dump || realtime_check) { - if (sys_latency <= 0) --- -2.38.1 - - -From 536c93928bc57d941a7cd146dbcbd62df0be2d83 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 23 Nov 2022 19:45:15 +0100 -Subject: [PATCH 13/18] test: latency - usleep should not be used in the block - mode - -Signed-off-by: Jaroslav Kysela ---- - test/latency.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/test/latency.c b/test/latency.c -index 161d1f68..1b4848d6 100644 ---- a/test/latency.c -+++ b/test/latency.c -@@ -678,7 +678,7 @@ int main(int argc, char *argv[]) - loop_limit, latency_min * 2, latency_max * 2); - if (sys_latency > 0) - printf(", I/O updates %ims", sys_latency); -- else if (!block) -+ else if (!block && !use_poll) - printf(", I/O usleep %ius", usleep_val); - printf("\n"); - -@@ -764,7 +764,7 @@ int main(int argc, char *argv[]) - } else if (use_poll) { - /* use poll to wait for next event */ - snd_pcm_wait(chandle, 1000); -- } else if (usleep_val > 0) { -+ } else if (!block && usleep_val > 0) { - usleep(usleep_val); - } - if (pos_dump || realtime_check) { --- -2.38.1 - - -From ea0850f3f3780652869c2b4550576894bc21684f Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Thu, 24 Nov 2022 08:33:47 +0100 -Subject: [PATCH 14/18] test: latency - add --policy option to allow using - SCHED_FIFO - -Signed-off-by: Jaroslav Kysela ---- - test/latency.c | 22 +++++++++++++++++----- - 1 file changed, 17 insertions(+), 5 deletions(-) - -diff --git a/test/latency.c b/test/latency.c -index 1b4848d6..3b20e1c1 100644 ---- a/test/latency.c -+++ b/test/latency.c -@@ -40,6 +40,7 @@ - - typedef struct timespec timestamp_t; - -+char *sched_policy = "rr"; - char *pdevice = "hw:0,0"; - char *cdevice = "hw:0,0"; - snd_pcm_format_t format = SND_PCM_FORMAT_S16_LE; -@@ -354,18 +355,24 @@ void gettimestamp(snd_pcm_t *handle, snd_timestamp_t *timestamp) - void setscheduler(void) - { - struct sched_param sched_param; -+ int policy = SCHED_RR; -+ const char *spolicy = "Round Robin"; - -+ if (strcasecmp(sched_policy, "fifo") == 0) { -+ policy = SCHED_FIFO; -+ spolicy = "FIFO"; -+ } - if (sched_getparam(0, &sched_param) < 0) { - printf("Scheduler getparam failed...\n"); - return; - } -- sched_param.sched_priority = sched_get_priority_max(SCHED_RR); -- if (!sched_setscheduler(0, SCHED_RR, &sched_param)) { -- printf("Scheduler set to Round Robin with priority %i...\n", sched_param.sched_priority); -+ sched_param.sched_priority = sched_get_priority_max(policy); -+ if (!sched_setscheduler(0, policy, &sched_param)) { -+ printf("Scheduler set to %s with priority %i...\n", spolicy, sched_param.sched_priority); - fflush(stdout); - return; - } -- printf("!!!Scheduler set to Round Robin with priority %i FAILED!!!\n", sched_param.sched_priority); -+ printf("!!!Scheduler set to %s with priority %i FAILED!!!\n", spolicy, sched_param.sched_priority); - } - - long timediff(snd_timestamp_t t1, snd_timestamp_t t2) -@@ -515,6 +522,7 @@ void help(void) - "-e,--effect apply an effect (bandpass filter sweep)\n" - "-x,--posdump dump buffer positions\n" - "-X,--realtime do a realtime check (buffering)\n" -+"-O,--policy set scheduler policy (RR or FIFO)\n" - ); - printf("Recognized sample formats are:"); - for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) { -@@ -555,6 +563,7 @@ int main(int argc, char *argv[]) - {"effect", 0, NULL, 'e'}, - {"posdump", 0, NULL, 'x'}, - {"realtime", 0, NULL, 'X'}, -+ {"policy", 1, NULL, 'O'}, - {NULL, 0, NULL, 0}, - }; - snd_pcm_t *phandle, *chandle; -@@ -569,7 +578,7 @@ int main(int argc, char *argv[]) - morehelp = 0; - while (1) { - int c; -- if ((c = getopt_long(argc, argv, "hP:C:m:M:U:F:f:c:r:B:E:s:y:bpenxX", long_option, NULL)) < 0) -+ if ((c = getopt_long(argc, argv, "hP:C:m:M:U:F:f:c:r:B:E:s:y:O:bpenxX", long_option, NULL)) < 0) - break; - switch (c) { - case 'h': -@@ -643,6 +652,9 @@ int main(int argc, char *argv[]) - case 'X': - realtime_check = 1; - break; -+ case 'O': -+ sched_policy = optarg; -+ break; - } - } - --- -2.38.1 - - -From 75f8e2e73e03f628a4f2ba55ca8aa3e9f50cdbd9 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Thu, 24 Nov 2022 10:55:32 +0100 -Subject: [PATCH 15/18] test: latency - --policy option - allow using - SCHED_OTHER - -Signed-off-by: Jaroslav Kysela ---- - test/latency.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/test/latency.c b/test/latency.c -index 3b20e1c1..5e67015c 100644 ---- a/test/latency.c -+++ b/test/latency.c -@@ -361,6 +361,9 @@ void setscheduler(void) - if (strcasecmp(sched_policy, "fifo") == 0) { - policy = SCHED_FIFO; - spolicy = "FIFO"; -+ } else if (strcasecmp(sched_policy, "other") == 0) { -+ policy = SCHED_OTHER; -+ spolicy = "OTHER"; - } - if (sched_getparam(0, &sched_param) < 0) { - printf("Scheduler getparam failed...\n"); -@@ -522,7 +525,7 @@ void help(void) - "-e,--effect apply an effect (bandpass filter sweep)\n" - "-x,--posdump dump buffer positions\n" - "-X,--realtime do a realtime check (buffering)\n" --"-O,--policy set scheduler policy (RR or FIFO)\n" -+"-O,--policy set scheduler policy (RR, FIFO or OTHER)\n" - ); - printf("Recognized sample formats are:"); - for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) { --- -2.38.1 - - -From d28e8cb29485cc93f741b01dc65893c798359963 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 29 Nov 2022 19:42:13 +0100 -Subject: [PATCH 16/18] topology: ctl - remove the wrong (debug) code - -This code was commited by mistake. It was used for testing -of ALSA_PCM_OLD_HW/SW_PARAMS_API. - -BugLink: https://github.com/thesofproject/sof/issues/6667 -Related-to: 78b20e3c ("test: latency - use snd_pcm_format_physical_width()") -Reported-by: Jaska Uimonen -Signed-off-by: Jaroslav Kysela ---- - src/topology/ctl.c | 7 +------ - 1 file changed, 1 insertion(+), 6 deletions(-) - -diff --git a/src/topology/ctl.c b/src/topology/ctl.c -index 2c500ffc..dd05424d 100644 ---- a/src/topology/ctl.c -+++ b/src/topology/ctl.c -@@ -17,13 +17,9 @@ - Liam Girdwood - */ - --#define ALSA_PCM_OLD_HW_PARAMS_API 1 --#define ALSA_PCM_OLD_SW_PARAMS_API 1 --#include "../../include/asoundlib.h" - #include "list.h" - #include "tplg_local.h" - -- - #define ENUM_VAL_SIZE (SNDRV_CTL_ELEM_ID_NAME_MAXLEN >> 2) - - struct ctl_access_elem { -@@ -75,8 +71,7 @@ static int parse_access_values(snd_config_t *cfg, - } - } - } -- return snd_pcm_hw_params_get_channels(NULL); -- //return snd_pcm_hw_params_get_access(NULL); -+ - return 0; - } - --- -2.38.1 - - -From e29413a2205099b2bffe584210d7a2b59f531f90 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 7 Dec 2022 14:49:48 +0100 -Subject: [PATCH 17/18] ucm: execute_sysw - fix possible use-after-free - -Signed-off-by: Jaroslav Kysela ---- - src/ucm/main.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/src/ucm/main.c b/src/ucm/main.c -index 4f36648c..2ff4d3f3 100644 ---- a/src/ucm/main.c -+++ b/src/ucm/main.c -@@ -572,16 +572,17 @@ static int execute_sysw(const char *sysw) - wlen = write(fd, value, len); - myerrno = errno; - close(fd); -- free(s); - - if (ignore_error) -- return 0; -+ goto __end; - - if (wlen != (ssize_t)len) { - uc_error("unable to write '%s' to '%s': %s", value, path, strerror(myerrno)); - return -EINVAL; - } - -+__end: -+ free(s); - return 0; - } - --- -2.38.1 - - -From 13e31fb1ecd5f666ffda09e87ef1aa53b4fae022 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 7 Dec 2022 14:54:30 +0100 -Subject: [PATCH 18/18] alsa-lib: conf - fix possible use-after-free in - get_char_skip_comments - -Signed-off-by: Jaroslav Kysela ---- - src/conf.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/src/conf.c b/src/conf.c -index eb38c344..65f2e1a7 100644 ---- a/src/conf.c -+++ b/src/conf.c -@@ -814,11 +814,12 @@ static int get_char_skip_comments(input_t *input) - closedir(dirp); - - err = add_include_path(input->current, str); -- free(str); - if (err < 0) { - SNDERR("Cannot add search dir %s", str); -+ free(str); - return err; - } -+ free(str); - continue; - } - --- -2.38.1 - diff --git a/alsa-lib.spec b/alsa-lib.spec index 9d9250a..1256eab 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -2,14 +2,14 @@ #define prever_dot .rc3 #define postver a -%define version_alsa_lib 1.2.8 -%define version_alsa_ucm 1.2.8 +%define version_alsa_lib 1.2.9 +%define version_alsa_ucm 1.2.9 %define version_alsa_tplg 1.2.5 Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 3%{?prever_dot}%{?dist} +Release: 1%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Thu May 4 2023 Jaroslav Kysela - 1.2.9-1 +- update to 1.2.9 + * Wed Jan 18 2023 Fedora Release Engineering - 1.2.8-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild diff --git a/sources b/sources index 81824da..d92c338 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (alsa-lib-1.2.8.tar.bz2) = 865ff05a8f589996f8d63d43a91c961f1b64144f3e1d17c7074b7ac16f25b3fd1c371d46ed63a8cc20fa01e63c76b75f1a9802b56889ae1073854dd050d27688 -SHA512 (alsa-ucm-conf-1.2.8.tar.bz2) = a15a9ca52c108ee95a421b91f3fad4329f1e9fb1c004a40d5ff1a57d6701bad19a31d5a296426d26439be9b87d2d543ce51588a98402d24c17f0f92aaf1096ca +SHA512 (alsa-lib-1.2.9.tar.bz2) = 8f39c8166c3648d46695a9287d9b9a35e5bfffed11d79e868ff7aba92d0fee792e82784186ebeb2a3e44d6b617c916025c7fce9a802565bb8e0dc8fdcce2311a +SHA512 (alsa-ucm-conf-1.2.9.tar.bz2) = 3aced4d4df76044a5525f1217851e05f7ad177389d2008e3e3dd0fb4d2cf72cd0897b140659a7729cc37d5b737c2d0cf5b607df4f576647044accd560d8cb87b SHA512 (alsa-topology-conf-1.2.5.tar.bz2) = 2eb4d8baf2dcbf0b631dd11dbf15bffc51694d9cc6931619e51787f3ba58d1a091d266e6721a3b737c040ec74a28270b93f39fb97f30a3227cf340dd646e5d51 From 645ed004549d591c1f3f5fbfc48b94b037b6618d Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 4 May 2023 09:50:51 +0200 Subject: [PATCH 088/120] fix the 1.2.9 build --- alsa-lib.spec | 6 +- alsa-ucm-conf.patch | 1296 ------------------------------------------- 2 files changed, 3 insertions(+), 1299 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 1256eab..64da136 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -70,9 +70,9 @@ contains alsa-lib configuration of SoC topology %prep %setup -q -n %{name}-%{version}%{?prever}%{?postver} -%patch0 -p1 -b .alsa-git -%patch1 -p1 -b .config -%patch2 -p1 -b .glibc-open +%patch -P0 -p1 -b .alsa-git +%patch -P1 -p1 -b .config +%patch -P2 -p1 -b .glibc-open %build # This package uses top level ASM constructs which are incompatible with LTO. diff --git a/alsa-ucm-conf.patch b/alsa-ucm-conf.patch index 1bc6bae..e69de29 100644 --- a/alsa-ucm-conf.patch +++ b/alsa-ucm-conf.patch @@ -1,1296 +0,0 @@ -From 2667378a6b9120d99e44f783ac4d247fb683d83c Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?N=C3=ADcolas=20F=2E=20R=2E=20A=2E=20Prado?= - -Date: Thu, 24 Mar 2022 18:13:45 -0400 -Subject: [PATCH 01/14] ucm2: Add support for MT8192 Asurada Spherion - Chromebook -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Add support for the Acer Chromebook 514 CP514-2H, powered by MediaTek -Kompanio 820 (MT8192). This machine uses a MT6359 PMIC, with RT1015P as -speaker codec and RT5682 as headphone codec. - -Fixes: https://github.com/alsa-project/alsa-ucm-conf/pull/217 -Signed-off-by: Nícolas F. R. A. Prado -Signed-off-by: Jaroslav Kysela ---- - .../mt8192/mt6359-rt1015p-rt5682/HiFi.conf | 88 +++++++++++++++++++ - .../mt8192/mt6359-rt1015p-rt5682/init.conf | 24 +++++ - .../mt8192_mt6359_rt1015p_rt5682.conf | 11 +++ - .../mt8192_mt6359_rt1015p_rt5682.conf | 1 + - 4 files changed, 124 insertions(+) - create mode 100644 ucm2/MediaTek/mt8192/mt6359-rt1015p-rt5682/HiFi.conf - create mode 100644 ucm2/MediaTek/mt8192/mt6359-rt1015p-rt5682/init.conf - create mode 100644 ucm2/MediaTek/mt8192/mt6359-rt1015p-rt5682/mt8192_mt6359_rt1015p_rt5682.conf - create mode 120000 ucm2/conf.d/mt8192_mt6359/mt8192_mt6359_rt1015p_rt5682.conf - -diff --git a/ucm2/MediaTek/mt8192/mt6359-rt1015p-rt5682/HiFi.conf b/ucm2/MediaTek/mt8192/mt6359-rt1015p-rt5682/HiFi.conf -new file mode 100644 -index 0000000..cf0d2c1 ---- /dev/null -+++ b/ucm2/MediaTek/mt8192/mt6359-rt1015p-rt5682/HiFi.conf -@@ -0,0 +1,88 @@ -+SectionVerb { -+ EnableSequence [ -+ disdevall "" -+ ] -+ -+ Value { -+ TQ "HiFi" -+ } -+} -+ -+SectionDevice."Speaker" { -+ Comment "Speaker" -+ -+ EnableSequence [ -+ cset "name='Speakers Switch' 1" -+ ] -+ -+ DisableSequence [ -+ cset "name='Speakers Switch' 0" -+ ] -+ -+ Value { -+ PlaybackPCM "hw:${CardId},0" -+ PlaybackPriority 100 -+ } -+} -+ -+SectionDevice."Headphones" { -+ Comment "Headphones" -+ -+ EnableSequence [ -+ cset "name='Headphone Jack Switch' 1" -+ ] -+ -+ DisableSequence [ -+ cset "name='Headphone Jack Switch' 0" -+ ] -+ -+ Value { -+ PlaybackPCM "hw:${CardId},3" -+ JackControl "Headphone Jack" -+ PlaybackMixerElem "DAC1" -+ PlaybackPriority 200 -+ } -+} -+ -+SectionDevice."Mic" { -+ Comment "Internal Microphone" -+ -+ EnableSequence [ -+ cset "name='MTKAIF_DMIC Switch' 1" -+ ] -+ -+ DisableSequence [ -+ cset "name='MTKAIF_DMIC Switch' 0" -+ ] -+ -+ Value { -+ CapturePCM "hw:${CardId},10" -+ CapturePriority 100 -+ } -+} -+ -+SectionDevice."Headset" { -+ Comment "Headset Microphone" -+ -+ EnableSequence [ -+ cset "name='Headset Mic Switch' 1" -+ cset "name='STO1 ADC Capture Switch' 1" -+ cset "name='RECMIX1L CBJ Switch' 1" -+ cset "name='Stereo1 ADC MIXL ADC1 Switch' 1" -+ cset "name='Stereo1 ADC MIXR ADC1 Switch' 1" -+ ] -+ -+ DisableSequence [ -+ cset "name='STO1 ADC Capture Switch' 0" -+ cset "name='RECMIX1L CBJ Switch' 0" -+ cset "name='Stereo1 ADC MIXL ADC1 Switch' 0" -+ cset "name='Stereo1 ADC MIXR ADC1 Switch' 0" -+ cset "name='Headset Mic Switch' 0" -+ ] -+ -+ Value { -+ CapturePCM "hw:${CardId},11" -+ JackControl "Headset Mic Jack" -+ CapturePriority 200 -+ } -+} -diff --git a/ucm2/MediaTek/mt8192/mt6359-rt1015p-rt5682/init.conf b/ucm2/MediaTek/mt8192/mt6359-rt1015p-rt5682/init.conf -new file mode 100644 -index 0000000..b53178e ---- /dev/null -+++ b/ucm2/MediaTek/mt8192/mt6359-rt1015p-rt5682/init.conf -@@ -0,0 +1,24 @@ -+BootSequence [ -+ # Speaker -+ cset "name='I2S3_CH1 DL1_CH1' 1" -+ cset "name='I2S3_CH2 DL1_CH2' 1" -+ cset "name='I2S3_HD_Mux' 1" -+ -+ # Headphone -+ cset "name='I2S9_CH1 DL3_CH1' 1" -+ cset "name='I2S9_CH2 DL3_CH2' 1" -+ cset "name='I2S9_HD_Mux' 1" -+ -+ # Internal Mic -+ cset "name='UL1_CH1 ADDA_UL_CH1' 1" -+ cset "name='UL1_CH2 ADDA_UL_CH2' 1" -+ cset "name='UL_SRC_MUX' DMIC" -+ -+ # Headset Mic -+ cset "name='UL2_CH1 I2S8_CH1' 1" -+ cset "name='UL2_CH2 I2S8_CH2' 1" -+ cset "name='I2S8_HD_Mux' 1" -+ cset "name='Stereo1 ADC L1 Mux' 1" -+ cset "name='Stereo1 ADC R1 Mux' 1" -+ cset "name='CBJ Boost Volume' 3" -+] -diff --git a/ucm2/MediaTek/mt8192/mt6359-rt1015p-rt5682/mt8192_mt6359_rt1015p_rt5682.conf b/ucm2/MediaTek/mt8192/mt6359-rt1015p-rt5682/mt8192_mt6359_rt1015p_rt5682.conf -new file mode 100644 -index 0000000..b4e124d ---- /dev/null -+++ b/ucm2/MediaTek/mt8192/mt6359-rt1015p-rt5682/mt8192_mt6359_rt1015p_rt5682.conf -@@ -0,0 +1,11 @@ -+Comment "MT8192 MT6359 RT1015P RT5682 sound card" -+Syntax 4 -+ -+SectionUseCase."HiFi" { -+ File "HiFi.conf" -+ Comment "Default" -+} -+ -+Include.card-init.File "/lib/card-init.conf" -+Include.ctl-remap.File "/lib/ctl-remap.conf" -+Include.init.File "init.conf" -diff --git a/ucm2/conf.d/mt8192_mt6359/mt8192_mt6359_rt1015p_rt5682.conf b/ucm2/conf.d/mt8192_mt6359/mt8192_mt6359_rt1015p_rt5682.conf -new file mode 120000 -index 0000000..4425b19 ---- /dev/null -+++ b/ucm2/conf.d/mt8192_mt6359/mt8192_mt6359_rt1015p_rt5682.conf -@@ -0,0 +1 @@ -+../../MediaTek/mt8192/mt6359-rt1015p-rt5682/mt8192_mt6359_rt1015p_rt5682.conf -\ No newline at end of file --- -2.38.1 - - -From 6dee56f11fbd48dd412179722a445416fcd779ef Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Sun, 6 Nov 2022 18:08:27 +0100 -Subject: [PATCH 02/14] ucm: USB-Audio - Add support for Focusrite Scarlett 2i2 - gen2 - -BugLink: https://github.com/alsa-project/alsa-ucm-conf/pull/234 -Signed-off-by: Jaroslav Kysela ---- - ...2-HiFi.conf => Scarlett-2i-gen2-HiFi.conf} | 45 +++++++++++-------- - .../USB-Audio/Focusrite/Scarlett-2i-gen2.conf | 22 +++++++++ - .../Focusrite/Scarlett-2i4-gen2.conf | 11 ----- - ucm2/USB-Audio/USB-Audio.conf | 10 ++--- - 4 files changed, 53 insertions(+), 35 deletions(-) - rename ucm2/USB-Audio/Focusrite/{Scarlett-2i4-gen2-HiFi.conf => Scarlett-2i-gen2-HiFi.conf} (65%) - create mode 100644 ucm2/USB-Audio/Focusrite/Scarlett-2i-gen2.conf - delete mode 100644 ucm2/USB-Audio/Focusrite/Scarlett-2i4-gen2.conf - -diff --git a/ucm2/USB-Audio/Focusrite/Scarlett-2i4-gen2-HiFi.conf b/ucm2/USB-Audio/Focusrite/Scarlett-2i-gen2-HiFi.conf -similarity index 65% -rename from ucm2/USB-Audio/Focusrite/Scarlett-2i4-gen2-HiFi.conf -rename to ucm2/USB-Audio/Focusrite/Scarlett-2i-gen2-HiFi.conf -index 5ee5076..ab69bc7 100644 ---- a/ucm2/USB-Audio/Focusrite/Scarlett-2i4-gen2-HiFi.conf -+++ b/ucm2/USB-Audio/Focusrite/Scarlett-2i-gen2-HiFi.conf -@@ -3,7 +3,7 @@ Include.pcm_split.File "/common/pcm/split.conf" - Macro [ - { - SplitPCM { -- Name "scarlett2i4_stereo_out" -+ Name "scarlett2i_stereo_out" - Direction Playback - Format S32_LE - Channels 2 -@@ -16,7 +16,7 @@ Macro [ - } - { - SplitPCM { -- Name "scarlett2i4_mono_in" -+ Name "scarlett2i_mono_in" - Direction Capture - Format S32_LE - Channels 1 -@@ -33,7 +33,7 @@ SectionDevice."Line1" { - PlaybackPriority 200 - } - Macro.pcm_split.SplitPCMDevice { -- Name "scarlett2i4_stereo_out" -+ Name "scarlett2i_stereo_out" - Direction Playback - HWChannels 4 - Channels 2 -@@ -44,21 +44,28 @@ SectionDevice."Line1" { - } - } - --SectionDevice."Line2" { -- Comment "Line 3-4" -- -- Value { -- PlaybackPriority 100 -+If.scarlett_2i4 { -+ Condition { -+ Type String -+ String1 "${var:PlaybackChannels}" -+ String2 "4" - } -- Macro.pcm_split.SplitPCMDevice { -- Name "scarlett2i4_stereo_out" -- Direction Playback -- HWChannels 4 -- Channels 2 -- Channel0 2 -- Channel1 3 -- ChannelPos0 FL -- ChannelPos1 FR -+ True.SectionDevice."Line2" { -+ Comment "Line 3-4" -+ -+ Value { -+ PlaybackPriority 100 -+ } -+ Macro.pcm_split.SplitPCMDevice { -+ Name "scarlett2i_stereo_out" -+ Direction Playback -+ HWChannels 4 -+ Channels 2 -+ Channel0 2 -+ Channel1 3 -+ ChannelPos0 FL -+ ChannelPos1 FR -+ } - } - } - -@@ -69,7 +76,7 @@ SectionDevice."Mic1" { - CapturePriority 200 - } - Macro.pcm_split.SplitPCMDevice { -- Name "scarlett2i4_mono_in" -+ Name "scarlett2i_mono_in" - Direction Capture - HWChannels 2 - Channels 1 -@@ -85,7 +92,7 @@ SectionDevice."Mic2" { - CapturePriority 100 - } - Macro.pcm_split.SplitPCMDevice { -- Name "scarlett2i4_mono_in" -+ Name "scarlett2i_mono_in" - Direction Capture - HWChannels 2 - Channels 1 -diff --git a/ucm2/USB-Audio/Focusrite/Scarlett-2i-gen2.conf b/ucm2/USB-Audio/Focusrite/Scarlett-2i-gen2.conf -new file mode 100644 -index 0000000..ee5b0b5 ---- /dev/null -+++ b/ucm2/USB-Audio/Focusrite/Scarlett-2i-gen2.conf -@@ -0,0 +1,22 @@ -+Define.PlaybackChannels 4 -+ -+If.scarlett_2i4 { -+ Condition { -+ Type String -+ Haystack "${CardComponents}" -+ Needle "USB1235:8202" -+ } -+ True.Define.PlaybackChannels 2 -+} -+ -+Comment "Focusrite Scarlett 2i${var:PlaybackChannels} Gen 2" -+ -+SectionUseCase."HiFi" { -+ Comment "Default" -+ File "/USB-Audio/Focusrite/Scarlett-2i-gen2-HiFi.conf" -+} -+ -+Define.DirectPlaybackChannels "${var:PlaybackChannels}" -+Define.DirectCaptureChannels 2 -+ -+Include.dhw.File "/common/direct.conf" -diff --git a/ucm2/USB-Audio/Focusrite/Scarlett-2i4-gen2.conf b/ucm2/USB-Audio/Focusrite/Scarlett-2i4-gen2.conf -deleted file mode 100644 -index ffc296d..0000000 ---- a/ucm2/USB-Audio/Focusrite/Scarlett-2i4-gen2.conf -+++ /dev/null -@@ -1,11 +0,0 @@ --Comment "Focusrite Scarlett 2i4 Gen 2" -- --SectionUseCase."HiFi" { -- Comment "Default" -- File "/USB-Audio/Focusrite/Scarlett-2i4-gen2-HiFi.conf" --} -- --Define.DirectPlaybackChannels 4 --Define.DirectCaptureChannels 2 -- --Include.dhw.File "/common/direct.conf" -diff --git a/ucm2/USB-Audio/USB-Audio.conf b/ucm2/USB-Audio/USB-Audio.conf -index 90a88d4..3479ba1 100644 ---- a/ucm2/USB-Audio/USB-Audio.conf -+++ b/ucm2/USB-Audio/USB-Audio.conf -@@ -135,14 +135,14 @@ If.goxlr { - True.Define.ProfileName "GoXLR/GoXLR" - } - --If.focusrite-scarlett-2i4-gen2 { -+If.focusrite-scarlett-2i-gen2 { - Condition { -- Type String -- Haystack "${CardComponents}" -- Needle "USB1235:8200" -+ Type RegexMatch -+ String "${CardComponents}" -+ Regex "USB1235:820[02]" - } - True.Define { -- ProfileName "Focusrite/Scarlett-2i4-gen2" -+ ProfileName "Focusrite/Scarlett-2i-gen2" - } - } - --- -2.38.1 - - -From b50a903f488e3f6479001b603c1b42b2a9600882 Mon Sep 17 00:00:00 2001 -From: Manu Linares -Date: Sat, 5 Nov 2022 19:32:27 -0300 -Subject: [PATCH 04/14] ucm2: USB-Audio - Added Digidesign Mbox 3 support - -Fixes: https://github.com/alsa-project/alsa-ucm-conf/pull/237 -Signed-off-by: Manu Linares -Signed-off-by: Jaroslav Kysela ---- - .../Digidesign/Digidesign-Mbox-3-HiFi.conf | 126 ++++++++++++++++++ - .../Digidesign/Digidesign-Mbox-3.conf | 11 ++ - ucm2/USB-Audio/USB-Audio.conf | 9 ++ - 3 files changed, 146 insertions(+) - create mode 100644 ucm2/USB-Audio/Digidesign/Digidesign-Mbox-3-HiFi.conf - create mode 100644 ucm2/USB-Audio/Digidesign/Digidesign-Mbox-3.conf - -diff --git a/ucm2/USB-Audio/Digidesign/Digidesign-Mbox-3-HiFi.conf b/ucm2/USB-Audio/Digidesign/Digidesign-Mbox-3-HiFi.conf -new file mode 100644 -index 0000000..7219bea ---- /dev/null -+++ b/ucm2/USB-Audio/Digidesign/Digidesign-Mbox-3-HiFi.conf -@@ -0,0 +1,126 @@ -+Include.pcm_split.File "/common/pcm/split.conf" -+ -+Macro [ -+ { -+ SplitPCM { -+ Name "mbox3_stereo_out" -+ Direction Playback -+ Channels 2 -+ HWChannels 4 -+ HWChannelPos0 FL -+ HWChannelPos1 FR -+ HWChannelPos2 FL -+ HWChannelPos3 FR -+ } -+ } -+ { -+ SplitPCM { -+ Name "mbox3_stereo_in" -+ Direction Capture -+ Channels 2 -+ HWChannels 4 -+ HWChannelPos0 FL -+ HWChannelPos1 FR -+ HWChannelPos2 FL -+ HWChannelPos3 FR -+ } -+ } -+ { -+ SplitPCM { -+ Name "mbox3_mono_in" -+ Direction Capture -+ Channels 1 -+ HWChannels 4 -+ HWChannelPos0 MONO -+ HWChannelPos1 MONO -+ HWChannelPos2 MONO -+ HWChannelPos3 MONO -+ } -+ } -+] -+ -+SectionDevice."Line1" { -+ Comment "Main Output L/R" -+ -+ Value { -+ PlaybackPriority 300 -+ } -+ Macro.pcm_split.SplitPCMDevice { -+ Name "mbox3_stereo_out" -+ Direction Playback -+ HWChannels 4 -+ Channels 2 -+ Channel0 0 -+ Channel1 1 -+ ChannelPos0 FL -+ ChannelPos1 FR -+ } -+} -+ -+ -+SectionDevice."line2SPDIF" { -+ Comment "SPDIF Out" -+ Value { -+ PlaybackPriority 100 -+ } -+ Macro.pcm_split.SplitPCMDevice { -+ Name "mbox3_stereo_out" -+ Direction Playback -+ HWChannels 4 -+ Channels 2 -+ Channel0 2 -+ Channel1 3 -+ ChannelPos0 FL -+ ChannelPos1 FR -+ } -+} -+ -+SectionDevice."mic1" { -+ Comment "Mic/Line 1" -+ -+ Value { -+ CapturePriority 300 -+ } -+ Macro.pcm_split.SplitPCMDevice { -+ Name "mbox3_mono_in" -+ Direction Capture -+ HWChannels 4 -+ Channels 1 -+ Channel0 0 -+ ChannelPos0 MONO -+ } -+} -+ -+SectionDevice."mic2" { -+ Comment "Mic/Line 2" -+ -+ Value { -+ CapturePriority 200 -+ } -+ Macro.pcm_split.SplitPCMDevice { -+ Name "mbox3_mono_in" -+ Direction Capture -+ HWChannels 4 -+ Channels 1 -+ Channel0 1 -+ ChannelPos0 MONO -+ } -+} -+ -+SectionDevice."mic3SPDIF" { -+ Comment "SPDIF In" -+ -+ Value { -+ CapturePriority 100 -+ } -+ Macro.pcm_split.SplitPCMDevice { -+ Name "mbox3_stereo_in" -+ Direction Capture -+ HWChannels 4 -+ Channels 2 -+ Channel0 2 -+ Channel1 3 -+ ChannelPos0 FL -+ ChannelPos1 FR -+ } -+} -diff --git a/ucm2/USB-Audio/Digidesign/Digidesign-Mbox-3.conf b/ucm2/USB-Audio/Digidesign/Digidesign-Mbox-3.conf -new file mode 100644 -index 0000000..d6e19f9 ---- /dev/null -+++ b/ucm2/USB-Audio/Digidesign/Digidesign-Mbox-3.conf -@@ -0,0 +1,11 @@ -+Comment "Digidesign Mbox 3" -+ -+SectionUseCase."Mixer" { -+ Comment "Stereo Duplex" -+ File "/USB-Audio/Digidesign/Digidesign-Mbox-3-HiFi.conf" -+} -+ -+Define.DirectPlaybackChannels 4 -+Define.DirectCaptureChannels 4 -+ -+Include.dhw.File "/common/direct.conf" -diff --git a/ucm2/USB-Audio/USB-Audio.conf b/ucm2/USB-Audio/USB-Audio.conf -index 3479ba1..d1d70d8 100644 ---- a/ucm2/USB-Audio/USB-Audio.conf -+++ b/ucm2/USB-Audio/USB-Audio.conf -@@ -126,6 +126,15 @@ If.dell-desktop-rear { - True.Define.ProfileName "Dell/Desktop-Rear" - } - -+If.mbox3 { -+ Condition { -+ Type String -+ Haystack "${CardComponents}" -+ Needle "USB0dba:5000" -+ } -+ True.Define.ProfileName "Digidesign/Digidesign-Mbox-3" -+} -+ - If.goxlr { - Condition { - Type RegexMatch --- -2.38.1 - - -From 88f232dffd54e1b9222ea76c7885445efebaa74d Mon Sep 17 00:00:00 2001 -From: "Ben Scholzen (DASPRiD)" -Date: Mon, 31 Oct 2022 17:41:02 +0100 -Subject: [PATCH 05/14] ucm2: Alc4080 - add support for ASUS ROG Strix Z790-E - Gaming Wifi - -Fixes: https://github.com/alsa-project/alsa-ucm-conf/pull/235 -Signed-off-by: Ben Scholzen (DASPRiD) -Signed-off-by: Jaroslav Kysela ---- - ucm2/USB-Audio/Realtek/ALC4080-HiFi.conf | 2 +- - ucm2/USB-Audio/USB-Audio.conf | 3 ++- - 2 files changed, 3 insertions(+), 2 deletions(-) - -diff --git a/ucm2/USB-Audio/Realtek/ALC4080-HiFi.conf b/ucm2/USB-Audio/Realtek/ALC4080-HiFi.conf -index 519f3b0..fa8d445 100644 ---- a/ucm2/USB-Audio/Realtek/ALC4080-HiFi.conf -+++ b/ucm2/USB-Audio/Realtek/ALC4080-HiFi.conf -@@ -68,7 +68,7 @@ If.spdif_dev2 { - Condition { - Type RegexMatch - String "${CardComponents}" -- Regex "USB(0b05:1996|0db0:1feb)" -+ Regex "USB(0b05:1996|0b05:1a52|0db0:1feb)" - } - True.Define.SpdifPCM "hw:${CardId},2" - } -diff --git a/ucm2/USB-Audio/USB-Audio.conf b/ucm2/USB-Audio/USB-Audio.conf -index d1d70d8..e30dc2b 100644 ---- a/ucm2/USB-Audio/USB-Audio.conf -+++ b/ucm2/USB-Audio/USB-Audio.conf -@@ -41,6 +41,7 @@ If.realtek-alc4080 { - # 0b05:1a16 ASUS ROG Strix B660-F Gaming WiFi - # 0b05:1a20 ASUS ROG STRIX Z690-I Gaming Wifi - # 0b05:1a27 ALC4082 on ASUS ROG Maximus Z690 Hero -+ # 0b05:1a52 ASUS ROG Strix Z790-E Gaming Wifi - # 0db0:005a MSI MPG Z690 CARBON WIFI - # 0db0:151f MSI X570S EDGE MAX WIFI - # 0db0:1feb MSI Edge Wifi Z690 -@@ -50,7 +51,7 @@ If.realtek-alc4080 { - # 0db0:a47c MSI MEG X570S Ace Max - # 0db0:b202 MSI MAG Z690 Tomahawk Wifi - # 0db0:d6e7 MSI MPG X670E Carbon Wifi -- Regex "USB((0414:a00e)|(0b05:(1996|1a(16|2[07])))|(0db0:(005a|151f|1feb|419c|82c7|a073|a47c|b202|d6e7)))" -+ Regex "USB((0414:a00e)|(0b05:(1996|1a(16|2[07]|52)))|(0db0:(005a|151f|1feb|419c|82c7|a073|a47c|b202|d6e7)))" - } - True.Define.ProfileName "Realtek/ALC4080" - } --- -2.38.1 - - -From b121b63f30c24e89beec506ae1d2bac9ebb3cc61 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 15 Nov 2022 17:49:13 +0100 -Subject: [PATCH 06/14] USB-Audio: ALC4080 - add 0db0:6cc9 MSI MPG Z590 Gaming - Plus device - -BugLink: https://github.com/alsa-project/alsa-ucm-conf/issues/241 -Signed-off-by: Jaroslav Kysela ---- - ucm2/USB-Audio/USB-Audio.conf | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/ucm2/USB-Audio/USB-Audio.conf b/ucm2/USB-Audio/USB-Audio.conf -index e30dc2b..89482cb 100644 ---- a/ucm2/USB-Audio/USB-Audio.conf -+++ b/ucm2/USB-Audio/USB-Audio.conf -@@ -46,12 +46,13 @@ If.realtek-alc4080 { - # 0db0:151f MSI X570S EDGE MAX WIFI - # 0db0:1feb MSI Edge Wifi Z690 - # 0db0:419c MSI MPG X570S Carbon Max Wifi -+ # 0db0:6cc9 MSI MPG Z590 Gaming Plus - # 0db0:82c7 MSI MEG Z690I Unify - # 0db0:a073 MSI MAG X570S Torpedo Max - # 0db0:a47c MSI MEG X570S Ace Max - # 0db0:b202 MSI MAG Z690 Tomahawk Wifi - # 0db0:d6e7 MSI MPG X670E Carbon Wifi -- Regex "USB((0414:a00e)|(0b05:(1996|1a(16|2[07]|52)))|(0db0:(005a|151f|1feb|419c|82c7|a073|a47c|b202|d6e7)))" -+ Regex "USB((0414:a00e)|(0b05:(1996|1a(16|2[07]|52)))|(0db0:(005a|151f|1feb|419c|6cc9|82c7|a073|a47c|b202|d6e7)))" - } - True.Define.ProfileName "Realtek/ALC4080" - } --- -2.38.1 - - -From c82c400fb653292bbf0570e278d60e1ba14cc341 Mon Sep 17 00:00:00 2001 -From: Shuming Fan -Date: Wed, 16 Nov 2022 17:36:51 +0800 -Subject: [PATCH 07/14] ucm2: sof-soundwire: add basic settings for RT1318 SDCA - device - -Add support for rt1318 amplifier - -Fixes: https://github.com/alsa-project/alsa-ucm-conf/pull/242 -Signed-off-by: Shuming Fan -Signed-off-by: Jaroslav Kysela ---- - ucm2/sof-soundwire/rt1318-1.conf | 20 ++++++++++++++++++++ - ucm2/sof-soundwire/rt1318-2.conf | 25 +++++++++++++++++++++++++ - 2 files changed, 45 insertions(+) - create mode 100644 ucm2/sof-soundwire/rt1318-1.conf - create mode 100644 ucm2/sof-soundwire/rt1318-2.conf - -diff --git a/ucm2/sof-soundwire/rt1318-1.conf b/ucm2/sof-soundwire/rt1318-1.conf -new file mode 100644 -index 0000000..13d77e1 ---- /dev/null -+++ b/ucm2/sof-soundwire/rt1318-1.conf -@@ -0,0 +1,20 @@ -+# Use case Configuration for sof-soundwire card -+ -+SectionDevice."Speaker" { -+ Comment "Speaker" -+ -+ EnableSequence [ -+ cset "name='rt1318-1 DAC Switch' 1" -+ cset "name='Speaker Switch' on" -+ ] -+ -+ DisableSequence [ -+ cset "name='rt1318-1 DAC Switch' 0" -+ cset "name='Speaker Switch' off" -+ ] -+ -+ Value { -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId},2" -+ } -+} -diff --git a/ucm2/sof-soundwire/rt1318-2.conf b/ucm2/sof-soundwire/rt1318-2.conf -new file mode 100644 -index 0000000..5602470 ---- /dev/null -+++ b/ucm2/sof-soundwire/rt1318-2.conf -@@ -0,0 +1,25 @@ -+# Use case Configuration for sof-soundwire card -+ -+SectionDevice."Speaker" { -+ Comment "Speaker" -+ -+ EnableSequence [ -+ cset "name='rt1318-1 RX Channel Select' L,L" -+ cset "name='rt1318-2 RX Channel Select' R,R" -+ -+ cset "name='rt1318-1 DAC Switch' 1" -+ cset "name='rt1318-2 DAC Switch' 1" -+ cset "name='Speaker Switch' on" -+ ] -+ -+ DisableSequence [ -+ cset "name='rt1318-1 DAC Switch' 0" -+ cset "name='rt1318-2 DAC Switch' 0" -+ cset "name='Speaker Switch' off" -+ ] -+ -+ Value { -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId},2" -+ } -+} --- -2.38.1 - - -From 998849d9510754960d808e20dad4c440adaf87ef Mon Sep 17 00:00:00 2001 -From: Clayton Craft -Date: Wed, 29 Jun 2022 15:23:23 -0700 -Subject: [PATCH 08/14] ucm2: add profile for the Librem 5 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Fixes: https://github.com/alsa-project/alsa-ucm-conf/pull/181 -Tested-by: Guido Günther -Signed-off-by: Jaroslav Kysela ---- - ucm2/NXP/iMX8/Librem_5/HiFi.conf | 151 ++++++++++++++++++++++++++ - ucm2/NXP/iMX8/Librem_5/Librem 5.conf | 25 +++++ - ucm2/conf.d/simple-card/Librem 5.conf | 1 + - 3 files changed, 177 insertions(+) - create mode 100644 ucm2/NXP/iMX8/Librem_5/HiFi.conf - create mode 100644 ucm2/NXP/iMX8/Librem_5/Librem 5.conf - create mode 120000 ucm2/conf.d/simple-card/Librem 5.conf - -diff --git a/ucm2/NXP/iMX8/Librem_5/HiFi.conf b/ucm2/NXP/iMX8/Librem_5/HiFi.conf -new file mode 100644 -index 0000000..55eabe3 ---- /dev/null -+++ b/ucm2/NXP/iMX8/Librem_5/HiFi.conf -@@ -0,0 +1,151 @@ -+SectionVerb { -+ EnableSequence [ -+ disdevall "" -+ ] -+ -+ Value.TQ "HiFi" -+} -+ -+SectionDevice."Handset" { -+ Comment "Handset" -+ -+ ConflictingDevice [ -+ "Headphones" -+ "Speaker" -+ ] -+ -+ EnableSequence [ -+ cset "name='Speaker Switch' off,on" -+ cset "name='DAC L/R Swap Switch' on" -+ cset "name='DAC Monomix Switch' on" -+ cset "name='SPKOUTR PGA' DAC" -+ cset "name='Speaker Boost Volume' 2" -+ ] -+ -+ DisableSequence [ -+ cset "name='Speaker Switch' off,off" -+ cset "name='DAC L/R Swap Switch' off" -+ cset "name='DAC Monomix Switch' off" -+ cset "name='SPKOUTR PGA' Mixer" -+ ] -+ -+ Value { -+ PlaybackPriority "100" -+ PlaybackVolume "name='Speaker Volume'" -+ PlaybackSwitch "name='Speaker Switch'" -+ PlaybackMixerElem "Speaker" -+ PlaybackPCM "hw:${CardId}" -+ } -+} -+ -+SectionDevice."Speaker" { -+ Comment "Speaker" -+ -+ ConflictingDevice [ -+ "Handset" -+ "Headphones" -+ ] -+ -+ EnableSequence [ -+ cset "name='Speaker Switch' on,off" -+ cset "name='DAC Monomix Switch' on" -+ cset "name='SPKOUTL PGA' DAC" -+ cset "name='Speaker Boost Volume' 6" -+ ] -+ -+ DisableSequence [ -+ cset "name='Speaker Switch' off,off" -+ cset "name='DAC Monomix Switch' off" -+ cset "name='SPKOUTL PGA' Mixer" -+ ] -+ -+ Value { -+ PlaybackPriority "500" -+ PlaybackVolume "name='Speaker Volume'" -+ PlaybackSwitch "name='Speaker Switch'" -+ PlaybackMixerElem "Speaker" -+ PlaybackPCM "hw:${CardId}" -+ } -+} -+ -+SectionDevice."Headphones" { -+ Comment "Headphones" -+ -+ ConflictingDevice [ -+ "Handset" -+ "Speaker" -+ ] -+ -+ EnableSequence [ -+ cset "name='Headphone Switch' on,on" -+ cset "name='HPOUTL PGA' 0 unmute" -+ cset "name='HPOUTR PGA' 0 unmute" -+ ] -+ -+ DisableSequence [ -+ cset "name='Headphone Switch' off off" -+ cset "name='HPOUTL PGA' 0 mute" -+ cset "name='HPOUTR PGA' 0 mute" -+ ] -+ -+ Value { -+ PlaybackPriority "1000" -+ PlaybackVolume "name='Headphone Volume'" -+ PlaybackSwitch "name='Headphone Switch'" -+ PlaybackMixerElem "Headphone" -+ PlaybackPCM "hw:${CardId}" -+ JackControl "Headphones Jack" -+ } -+} -+ -+SectionDevice."Mic" { -+ Comment "Internal Microphone" -+ -+ ConflictingDevice [ -+ "Headset" -+ ] -+ -+ EnableSequence [ -+ cset "name='ADC L/R Swap Switch' on" -+ cset "name='Input Mode' Digital" -+ ] -+ -+ DisableSequence [ -+ cset "name='ADC L/R Swap Switch' off" -+ ] -+ -+ Value { -+ CapturePriority "500" -+ CaptureVolume "name='Digital Capture Volume'" -+ CaptureMixerElem "Digital" -+ CapturePCM "hw:${CardId}" -+ } -+} -+ -+SectionDevice."Headset" { -+ Comment "Headset Microphone" -+ -+ ConflictingDevice [ -+ "Mic" -+ ] -+ -+ EnableSequence [ -+ cset "name='Input Mode' Analog" -+ cset "name='MIXINR PGA Switch' on,on" -+ cset "name='Capture Switch' on,on" -+ ] -+ -+ DisableSequence [ -+ cset "name='Capture Switch' off,off" -+ cset "name='MIXINR PGA Switch' off,off" -+ cset "name='Input Mode' Digital" -+ ] -+ -+ Value { -+ CapturePriority "100" -+ CaptureVolume "name='Capture Volume'" -+ CaptureMixerElem "Capture" -+ CapturePCM "hw:${CardId}" -+ JackControl "Headphones Jack" -+ } -+} -diff --git a/ucm2/NXP/iMX8/Librem_5/Librem 5.conf b/ucm2/NXP/iMX8/Librem_5/Librem 5.conf -new file mode 100644 -index 0000000..4d7dbd6 ---- /dev/null -+++ b/ucm2/NXP/iMX8/Librem_5/Librem 5.conf -@@ -0,0 +1,25 @@ -+Syntax 2 -+ -+SectionUseCase."HiFi" { -+ File "HiFi.conf" -+ Comment "Default" -+} -+ -+BootSequence [ -+ cset "name='Digital Playback Volume' 100,100" -+ cset "name='MIXINL IN2L Switch' off" -+ cset "name='MIXINL IN3L Switch' off" -+ cset "name='MIXINR IN2R Switch' off" -+ cset "name='MIXINR IN3R Switch' off" -+ cset "name='INPGAR IN1R Switch' off" -+ cset "name='INPGAR IN2R Switch' off" -+ cset "name='INPGAR IN3R Switch' on" -+ cset "name='INPGAR IN4R Switch' off" -+ cset "name='INPGAL IN1L Switch' off" -+ cset "name='INPGAL IN2L Switch' off" -+ cset "name='INPGAL IN3L Switch' off" -+ cset "name='INPGAL IN4L Switch' off" -+ cset "name='Input Mixer Switch' off,on" -+ cset "name='SPKOUTL PGA' Mixer" -+ cset "name='SPKOUTR PGA' Mixer" -+] -diff --git a/ucm2/conf.d/simple-card/Librem 5.conf b/ucm2/conf.d/simple-card/Librem 5.conf -new file mode 120000 -index 0000000..c687942 ---- /dev/null -+++ b/ucm2/conf.d/simple-card/Librem 5.conf -@@ -0,0 +1 @@ -+../../NXP/iMX8/Librem_5/Librem 5.conf -\ No newline at end of file --- -2.38.1 - - -From 71ff24cdd2e0fecb71c2fcf8a45a1ae50233c34b Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Mon, 21 Nov 2022 09:51:54 +0100 -Subject: [PATCH 09/14] USB-Audio: allow to configure period size for PCM split -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The environment variable UCM_USB_PERIOD_TIME (microseconds / μs) -can define the period size for the PCM channel split over -the default value 10000μs. - -BugLink: https://github.com/alsa-project/alsa-ucm-conf/pull/240 -Fixes: https://github.com/alsa-project/alsa-ucm-conf/issues/238 -Signed-off-by: Jaroslav Kysela ---- - ucm2/USB-Audio/USB-Audio.conf | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/ucm2/USB-Audio/USB-Audio.conf b/ucm2/USB-Audio/USB-Audio.conf -index 89482cb..fdc29ec 100644 ---- a/ucm2/USB-Audio/USB-Audio.conf -+++ b/ucm2/USB-Audio/USB-Audio.conf -@@ -4,6 +4,14 @@ Define.ProfileName "" - Define.MixerRemap "" - Define.SplitPCMPeriodTime 10000 # 10ms - -+If.env1 { -+ Condition { -+ Type String -+ Empty "${env:UCM_USB_PERIOD_TIME}" -+ } -+ False.Define.SplitPCMPeriodTime "${env:UCM_USB_PERIOD_TIME}" -+} -+ - If.linked { - Condition { - Type RegexMatch --- -2.38.1 - - -From 445c079665979802d50b237fe5a55be82ffd0bd9 Mon Sep 17 00:00:00 2001 -From: Fadwa Chiby -Date: Fri, 22 Jul 2022 09:45:07 +0000 -Subject: [PATCH 10/14] mt8195-demo: fix soundcard initialization - -The previous initialization in Bootsequence set all Switch -to off after boot. - -So remove the setting off of the Switch in the BootSequence -and define Enable/DisableSequence in verb section for -a proper setting. - -Note that the controls enable access to the PCM devices -(controls routes between Front End and Back End in ASoC). - -Fixes: https://github.com/alsa-project/alsa-ucm-conf/pull/211 -Signed-off-by: Fadwa Chiby -Signed-off-by: Jaroslav Kysela ---- - ucm2/MediaTek/mt8195_demo/HiFi.conf | 57 ++++++++++++++++++++++ - ucm2/MediaTek/mt8195_demo/mt8195_demo.conf | 36 ++++---------- - 2 files changed, 66 insertions(+), 27 deletions(-) - -diff --git a/ucm2/MediaTek/mt8195_demo/HiFi.conf b/ucm2/MediaTek/mt8195_demo/HiFi.conf -index 95f2b51..660b4ad 100644 ---- a/ucm2/MediaTek/mt8195_demo/HiFi.conf -+++ b/ucm2/MediaTek/mt8195_demo/HiFi.conf -@@ -1,3 +1,60 @@ -+SectionVerb { -+ -+ EnableSequence [ -+ cset "name='HDMI_OUT_MUX' Connect" -+ cset "name='DPTX_OUT_MUX' Connect" -+ cset "name='O176 I070 Switch' on" -+ cset "name='O177 I071 Switch' on" -+ cset "name='O034 I168 Switch' on" -+ cset "name='O035 I169 Switch' on" -+ cset "name='O036 I012 Switch' on" -+ cset "name='O037 I013 Switch' on" -+ cset "name='O072 I022 Switch' on" -+ cset "name='O073 I023 Switch' on" -+ cset "name='O074 I024 Switch' on" -+ cset "name='O075 I025 Switch' on" -+ cset "name='O076 I026 Switch' on" -+ cset "name='O077 I027 Switch' on" -+ cset "name='O078 I028 Switch' on" -+ cset "name='O079 I029 Switch' on" -+ cset "name='O002 I004 Switch' on" -+ cset "name='O003 I005 Switch' on" -+ cset "name='O004 I006 Switch' on" -+ cset "name='O005 I007 Switch' on" -+ cset "name='O006 I008 Switch' on" -+ cset "name='O007 I009 Switch' on" -+ cset "name='O008 I010 Switch' on" -+ cset "name='O009 I011 Switch' on" -+ ] -+ -+ DisableSequence [ -+ cset "name='HDMI_OUT_MUX' Disconnect" -+ cset "name='DPTX_OUT_MUX' Disconnect" -+ cset "name='O176 I070 Switch' off" -+ cset "name='O177 I071 Switch' off" -+ cset "name='O034 I168 Switch' off" -+ cset "name='O035 I169 Switch' off" -+ cset "name='O036 I012 Switch' off" -+ cset "name='O037 I013 Switch' off" -+ cset "name='O072 I022 Switch' off" -+ cset "name='O073 I023 Switch' off" -+ cset "name='O074 I024 Switch' off" -+ cset "name='O075 I025 Switch' off" -+ cset "name='O076 I026 Switch' off" -+ cset "name='O077 I027 Switch' off" -+ cset "name='O078 I028 Switch' off" -+ cset "name='O079 I029 Switch' off" -+ cset "name='O002 I004 Switch' off" -+ cset "name='O003 I005 Switch' off" -+ cset "name='O004 I006 Switch' off" -+ cset "name='O005 I007 Switch' off" -+ cset "name='O006 I008 Switch' off" -+ cset "name='O007 I009 Switch' off" -+ cset "name='O008 I010 Switch' off" -+ cset "name='O009 I011 Switch' off" -+ ] -+} -+ - SectionDevice."HDMI" { - Comment "Hdmi/DP output" - -diff --git a/ucm2/MediaTek/mt8195_demo/mt8195_demo.conf b/ucm2/MediaTek/mt8195_demo/mt8195_demo.conf -index c23dc37..896b6dc 100644 ---- a/ucm2/MediaTek/mt8195_demo/mt8195_demo.conf -+++ b/ucm2/MediaTek/mt8195_demo/mt8195_demo.conf -@@ -1,4 +1,4 @@ --Syntax 3 -+Syntax 2 - - SectionUseCase."HiFi" { - File "/MediaTek/mt8195_demo/HiFi.conf" -@@ -16,12 +16,12 @@ BootSequence [ - cset "name='PGA_L_Mux' AIN1" - cset "name='HDMI_OUT_MUX' Connect" - cset "name='DPTX_OUT_MUX' Connect" -+ # we need to enable all devices before starting PA. -+ # In our driver we use PCM, which means that we have -+ # to route Front End to a BackEnd and then only we can -+ # open a device. Without linking to BE it will fail. - cset "name='O176 I070 Switch' on" - cset "name='O177 I071 Switch' on" -- cset "name='O034 I168 Switch' on" -- cset "name='O035 I169 Switch' on" -- cset "name='O036 I012 Switch' on" -- cset "name='O037 I013 Switch' on" - cset "name='O072 I022 Switch' on" - cset "name='O073 I023 Switch' on" - cset "name='O074 I024 Switch' on" -@@ -30,6 +30,10 @@ BootSequence [ - cset "name='O077 I027 Switch' on" - cset "name='O078 I028 Switch' on" - cset "name='O079 I029 Switch' on" -+ cset "name='O034 I168 Switch' on" -+ cset "name='O035 I169 Switch' on" -+ cset "name='O036 I012 Switch' on" -+ cset "name='O037 I013 Switch' on" - cset "name='O002 I004 Switch' on" - cset "name='O003 I005 Switch' on" - cset "name='O004 I006 Switch' on" -@@ -38,26 +42,4 @@ BootSequence [ - cset "name='O007 I009 Switch' on" - cset "name='O008 I010 Switch' on" - cset "name='O009 I011 Switch' on" -- cset "name='O176 I070 Switch' off" -- cset "name='O177 I071 Switch' off" -- cset "name='O034 I168 Switch' off" -- cset "name='O035 I169 Switch' off" -- cset "name='O036 I012 Switch' off" -- cset "name='O037 I013 Switch' off" -- cset "name='O072 I022 Switch' off" -- cset "name='O073 I023 Switch' off" -- cset "name='O074 I024 Switch' off" -- cset "name='O075 I025 Switch' off" -- cset "name='O076 I026 Switch' off" -- cset "name='O077 I027 Switch' off" -- cset "name='O078 I028 Switch' off" -- cset "name='O079 I029 Switch' off" -- cset "name='O002 I004 Switch' off" -- cset "name='O003 I005 Switch' off" -- cset "name='O004 I006 Switch' off" -- cset "name='O005 I007 Switch' off" -- cset "name='O006 I008 Switch' off" -- cset "name='O007 I009 Switch' off" -- cset "name='O008 I010 Switch' off" -- cset "name='O009 I011 Switch' off" - ] --- -2.38.1 - - -From 5c865236e8de9fd75c741892fd3bd2cff62d4f3f Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 22 Nov 2022 09:54:22 +0100 -Subject: [PATCH 11/14] USB-Audio: the environment variable UCM_USB_PERIOD_TIME - may be undefined - -Fixes: 71ff24c ("USB-Audio: allow to configure period size for PCM split") -BugLink: https://github.com/alsa-project/alsa-ucm-conf/pull/240 -Signed-off-by: Jaroslav Kysela ---- - ucm2/USB-Audio/USB-Audio.conf | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/ucm2/USB-Audio/USB-Audio.conf b/ucm2/USB-Audio/USB-Audio.conf -index fdc29ec..1c11da9 100644 ---- a/ucm2/USB-Audio/USB-Audio.conf -+++ b/ucm2/USB-Audio/USB-Audio.conf -@@ -7,7 +7,7 @@ Define.SplitPCMPeriodTime 10000 # 10ms - If.env1 { - Condition { - Type String -- Empty "${env:UCM_USB_PERIOD_TIME}" -+ Empty "$${env:UCM_USB_PERIOD_TIME}" - } - False.Define.SplitPCMPeriodTime "${env:UCM_USB_PERIOD_TIME}" - } --- -2.38.1 - - -From 01e37f4fb7aab57e3f0051d81f5f6e5b2f15c831 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Mon, 21 Nov 2022 10:16:57 +0100 -Subject: [PATCH 12/14] HDA: DualCodecs - handle S/PDIF without analog - connections - -When no analog wires are connected, the S/PDIF output cannot be -selected in pipewire. Handle this for motherboards without Speaker -UCM device. - -Fixes: https://github.com/alsa-project/alsa-ucm-conf/issues/239 -Signed-off-by: Jaroslav Kysela ---- - ucm2/HDA/DualCodecs/HiFi.conf | 15 +++++++++++---- - 1 file changed, 11 insertions(+), 4 deletions(-) - -diff --git a/ucm2/HDA/DualCodecs/HiFi.conf b/ucm2/HDA/DualCodecs/HiFi.conf -index 10c9162..8c0f403 100644 ---- a/ucm2/HDA/DualCodecs/HiFi.conf -+++ b/ucm2/HDA/DualCodecs/HiFi.conf -@@ -66,13 +66,20 @@ SectionDevice."Line1" { - } - True.Value.PlaybackMixerElem "Front" - } -- If.1 { -+ # make S/PDIF output working when no analog jacks are connected -+ If.speaker { - Condition { - Type ControlExists -- Control "iface=CARD,name='Line Out Front Jack'" -+ Control "name='Speaker Playback Switch'" -+ } -+ True.If.1 { -+ Condition { -+ Type ControlExists -+ Control "iface=CARD,name='Line Out Front Jack'" -+ } -+ True.Value.JackControl "Line Out Front Jack" -+ False.Value.JackControl "Line Out Jack" - } -- True.Value.JackControl "Line Out Front Jack" -- False.Value.JackControl "Line Out Jack" - } - } - --- -2.38.1 - - -From 79a8ec44d3dcf097f4a4492c506cbcf338324175 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 7 Dec 2022 10:18:04 +0100 -Subject: [PATCH 13/14] ucm2: sof-hda-dsp: Update Mic LED settings - -Users expect to turn the LED on when only internal mic is off, but -it makes sense to turn this LED when all internal inputs are off. - -This configuration may be changed when the affected applications -are updated. - -BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=2134824 -Signed-off-by: Jaroslav Kysela ---- - ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf | 12 +++++++++++- - 1 file changed, 11 insertions(+), 1 deletion(-) - -diff --git a/ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf b/ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf -index e6a8a15..9e85914 100644 ---- a/ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf -+++ b/ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf -@@ -9,7 +9,17 @@ If.devdmic { - Haystack "${CardComponents}" - Needle "cfg-dmics:" - } -- True.Define.DeviceDmic "Mic1" -+ True { -+ Define.DeviceDmic "Mic1" -+ FixedBootSequence [ -+ # -+ # users expect to turn the LED on when only internal -+ # mic is off, but it makes sense to turn this LED -+ # when all internal inputs are off -+ # -+ sysw "-/class/sound/ctl-led/mic/card${CardNumber}/detach:Capture Switch" -+ ] -+ } - True.Define.DeviceMic "Mic2" - } - --- -2.38.1 - - -From 9ce9ddb4a84fb467602b716575ea1d8f2bab0c39 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 7 Dec 2022 15:00:35 +0100 -Subject: [PATCH 14/14] ucm2: HDA: Update Mic LED settings for ACP DMIC - -Users expect to turn the LED on when only internal mic is off, but -it makes sense to turn this LED when all internal inputs are off. - -This configuration may be changed when the affected applications -are updated. - -BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=2134824 -Signed-off-by: Jaroslav Kysela ---- - ucm2/HDA/HDA.conf | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/ucm2/HDA/HDA.conf b/ucm2/HDA/HDA.conf -index 64ffe83..47dfc05 100644 ---- a/ucm2/HDA/HDA.conf -+++ b/ucm2/HDA/HDA.conf -@@ -55,6 +55,7 @@ If.use { - cset-new "name='Mic ACP LED Capture Switch' type=bool,count=1 off" - exec "-/sbin/modprobe snd_ctl_led" - sysw "-/class/sound/ctl-led/mic/card${CardNumber}/attach:Mic ACP LED Capture Switch" -+ sysw "-/class/sound/ctl-led/mic/card${CardNumber}/detach:Capture Switch" - ] - } - } --- -2.38.1 - From ec4e2ba2d77337378732d059f3a537b07c6e4d6e Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 16 May 2023 17:50:39 +0200 Subject: [PATCH 089/120] update ucm (nhlt-dmic-info) --- alsa-lib.spec | 5 +- alsa-ucm-conf.patch | 179 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 183 insertions(+), 1 deletion(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 64da136..58ffd41 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 1%{?prever_dot}%{?dist} +Release: 2%{?prever_dot}%{?dist} License: LGPLv2+ URL: http://www.alsa-project.org/ @@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Tue May 16 2023 Jaroslav Kysela - 1.2.9-2 +- update ucm (nhlt-dmic-info) + * Thu May 4 2023 Jaroslav Kysela - 1.2.9-1 - update to 1.2.9 diff --git a/alsa-ucm-conf.patch b/alsa-ucm-conf.patch index e69de29..836a828 100644 --- a/alsa-ucm-conf.patch +++ b/alsa-ucm-conf.patch @@ -0,0 +1,179 @@ +From 906f692e4ed84dc136c270c05e1b490a554de99b Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 4 May 2023 14:36:49 +0200 +Subject: [PATCH 1/3] sof-essx8336: Dmic is not a valid UCM device identifier, + use Mic + +Signed-off-by: Jaroslav Kysela +--- + ucm2/Intel/sof-essx8336/sof-essx8336.conf | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ucm2/Intel/sof-essx8336/sof-essx8336.conf b/ucm2/Intel/sof-essx8336/sof-essx8336.conf +index f74e007..f579a45 100644 +--- a/ucm2/Intel/sof-essx8336/sof-essx8336.conf ++++ b/ucm2/Intel/sof-essx8336/sof-essx8336.conf +@@ -32,7 +32,7 @@ If.devdmic { + Haystack "${CardComponents}" + Needle "cfg-dmics:" + } +- True.Define.DeviceDmic "Dmic" ++ True.Define.DeviceDmic "Mic" + } + + SectionUseCase."HiFi" { +-- +2.39.2 + + +From 9fa70add76388087613d02b821acd656268060c4 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 16 May 2023 16:26:38 +0200 +Subject: [PATCH 2/3] sof-hda-dsp,sof-soundwire: add CaptureMicInfoFile fields + for dmics + +Signed-off-by: Jaroslav Kysela +--- + ucm2/Intel/sof-hda-dsp/HiFi.conf | 1 + + ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf | 3 +++ + ucm2/sof-soundwire/dmic.conf | 1 + + ucm2/sof-soundwire/rt715-sdca.conf | 11 ++++++----- + ucm2/sof-soundwire/rt715.conf | 1 + + ucm2/sof-soundwire/sof-soundwire.conf | 11 +++++++++++ + 6 files changed, 23 insertions(+), 5 deletions(-) + +diff --git a/ucm2/Intel/sof-hda-dsp/HiFi.conf b/ucm2/Intel/sof-hda-dsp/HiFi.conf +index 265949e..2063fc0 100644 +--- a/ucm2/Intel/sof-hda-dsp/HiFi.conf ++++ b/ucm2/Intel/sof-hda-dsp/HiFi.conf +@@ -22,6 +22,7 @@ If.dmic { + Value { + CapturePriority 100 + CapturePCM "hw:${CardId},6" ++ CaptureMicInfoFile "${var:LibDir}/dmics-nhlt.json" + If.chn { + Condition { + Type RegexMatch +diff --git a/ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf b/ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf +index e430a7b..44acd69 100644 +--- a/ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf ++++ b/ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf +@@ -12,6 +12,7 @@ If.devdmic { + True { + Define.DeviceDmic "Mic1" + Define.DeviceMic "Mic2" ++ Include.card-init.File "/lib/card-init.conf" + FixedBootSequence [ + # + # users expect to turn the LED on when only internal +@@ -19,6 +20,8 @@ If.devdmic { + # when all internal inputs are off + # + sysw "-/class/sound/ctl-led/mic/card${CardNumber}/detach:Capture Switch" ++ # dmic array info ++ exec "-nhlt-dmic-info -o ${var:LibDir}/dmics-nhlt.json" + ] + } + } +diff --git a/ucm2/sof-soundwire/dmic.conf b/ucm2/sof-soundwire/dmic.conf +index 755840a..c53d381 100644 +--- a/ucm2/sof-soundwire/dmic.conf ++++ b/ucm2/sof-soundwire/dmic.conf +@@ -17,5 +17,6 @@ SectionDevice."Mic" { + CaptureMixerElem "Dmic0" + CaptureVolume "Dmic0 Capture Volume" + CaptureSwitch "Dmic0 Capture Switch" ++ CaptureMicInfoFile "${var:LibDir}/dmics-nhlt.json" + } + } +diff --git a/ucm2/sof-soundwire/rt715-sdca.conf b/ucm2/sof-soundwire/rt715-sdca.conf +index 6e481e1..268a247 100644 +--- a/ucm2/sof-soundwire/rt715-sdca.conf ++++ b/ucm2/sof-soundwire/rt715-sdca.conf +@@ -12,10 +12,11 @@ SectionDevice."Mic" { + ] + + Value { +- CapturePriority 100 +- CapturePCM "hw:${CardId},4" +- CaptureSwitch "rt714 FU02 Capture Switch" +- CaptureVolume "rt714 FU02 Capture Volume" +- CaptureMixerElem "rt714 FU02" ++ CapturePriority 100 ++ CapturePCM "hw:${CardId},4" ++ CaptureSwitch "rt714 FU02 Capture Switch" ++ CaptureVolume "rt714 FU02 Capture Volume" ++ CaptureMixerElem "rt714 FU02" ++ CaptureMicInfoFile "${var:LibDir}/dmics-nhlt.json" + } + } +diff --git a/ucm2/sof-soundwire/rt715.conf b/ucm2/sof-soundwire/rt715.conf +index a733c08..090b663 100644 +--- a/ucm2/sof-soundwire/rt715.conf ++++ b/ucm2/sof-soundwire/rt715.conf +@@ -26,5 +26,6 @@ SectionDevice."Mic" { + CaptureSwitch "${var:rt715ctl} Switch" + CaptureVolume "${var:rt715ctl} Volume" + CaptureMixerElem "${var:rt715ctl}" ++ CaptureMicInfoFile "${var:LibDir}/dmics-nhlt.json" + } + } +diff --git a/ucm2/sof-soundwire/sof-soundwire.conf b/ucm2/sof-soundwire/sof-soundwire.conf +index 786ba63..3368d65 100644 +--- a/ucm2/sof-soundwire/sof-soundwire.conf ++++ b/ucm2/sof-soundwire/sof-soundwire.conf +@@ -92,3 +92,14 @@ If.pga_init_pga5 { + cset "name='PGA5.0 5 Master Capture Switch' 1" + ] + } ++ ++If.mics-array { ++ Condition { ++ Type String ++ Empty "${var:Mics1}" ++ } ++ False.FixedBootSequence { ++ # dmic array info ++ exec "-nhlt-dmic-info -o ${var:LibDir}/dmics-nhlt.json" ++ } ++} +-- +2.39.2 + + +From 5cdbc7e283cd80994f31f2e2a3f4df8af778ccb8 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 16 May 2023 17:39:00 +0200 +Subject: [PATCH 3/3] sof-hda-dsp: move card-init include to top + +... otherwise the rm is called after the nhlt-dmic-info + +Signed-off-by: Jaroslav Kysela +--- + ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf b/ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf +index 44acd69..98098e7 100644 +--- a/ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf ++++ b/ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf +@@ -3,6 +3,8 @@ Syntax 6 + Define.DeviceMic "Mic" + Define.DeviceDmic "" + ++Include.card-init.File "/lib/card-init.conf" ++ + If.devdmic { + Condition { + Type String +@@ -12,7 +14,6 @@ If.devdmic { + True { + Define.DeviceDmic "Mic1" + Define.DeviceMic "Mic2" +- Include.card-init.File "/lib/card-init.conf" + FixedBootSequence [ + # + # users expect to turn the LED on when only internal +-- +2.39.2 + From 2e7fc81a6d585209711f061407fa3f94c77c6e6a Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 6 Jun 2023 20:06:33 +0200 Subject: [PATCH 090/120] update licenses to SPDX format --- alsa-lib.spec | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 58ffd41..7713f4e 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,8 +9,8 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 2%{?prever_dot}%{?dist} -License: LGPLv2+ +Release: 3%{?prever_dot}%{?dist} +License: LGPL-2.1-or-later URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/lib/%{name}-%{version}%{?prever}%{?postver}.tar.bz2 @@ -51,7 +51,7 @@ against the ALSA libraries and interfaces. %package -n alsa-ucm Summary: ALSA Use Case Manager configuration BuildArch: noarch -License: BSD +License: BSD-3-Clause Requires: %{name} >= %{version_alsa_lib} %description -n alsa-ucm @@ -61,7 +61,7 @@ contains alsa-lib configuration of Audio input/output names and routing %package -n alsa-topology Summary: ALSA Topology configuration BuildArch: noarch -License: BSD +License: BSD-3-Clause Requires: %{name} >= %{version_alsa_lib} %description -n alsa-topology @@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Tue Jun 6 2023 Jaroslav Kysela - 1.2.9-3 +- SPDX licences + * Tue May 16 2023 Jaroslav Kysela - 1.2.9-2 - update ucm (nhlt-dmic-info) From 5281fc6ccad39c844e027f517e7a10a2783a9f09 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 19 Jul 2023 13:09:34 +0000 Subject: [PATCH 091/120] Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- alsa-lib.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 7713f4e..2efade0 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 3%{?prever_dot}%{?dist} +Release: 4%{?prever_dot}%{?dist} License: LGPL-2.1-or-later URL: http://www.alsa-project.org/ @@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Wed Jul 19 2023 Fedora Release Engineering - 1.2.9-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + * Tue Jun 6 2023 Jaroslav Kysela - 1.2.9-3 - SPDX licences From ace9ef33a642b696bc1837aa7f8dee0ff7df29d3 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 1 Sep 2023 18:21:55 +0200 Subject: [PATCH 092/120] update to 1.2.10 Signed-off-by: Jaroslav Kysela --- alsa-lib.spec | 11 ++- alsa-ucm-conf.patch | 179 -------------------------------------------- sources | 4 +- 3 files changed, 9 insertions(+), 185 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 2efade0..386a27d 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -2,14 +2,14 @@ #define prever_dot .rc3 #define postver a -%define version_alsa_lib 1.2.9 -%define version_alsa_ucm 1.2.9 +%define version_alsa_lib 1.2.10 +%define version_alsa_ucm 1.2.10 %define version_alsa_tplg 1.2.5 Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 4%{?prever_dot}%{?dist} +Release: 1%{?prever_dot}%{?dist} License: LGPL-2.1-or-later URL: http://www.alsa-project.org/ @@ -22,7 +22,7 @@ Source12: modprobe-dist-oss.conf Source40: alsa-ucm-conf.patch Patch0: alsa-git.patch Patch1: alsa-lib-1.2.3.1-config.patch -Patch2: alsa-lib-1.0.14-glibc-open.patch +Patch2: alsa-lib-1.2.10-glibc-open.patch BuildRequires: doxygen BuildRequires: autoconf automake libtool @@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Fri Sep 1 2023 Jaroslav Kysela - 1.2.10-1 +- update to 1.2.10 + * Wed Jul 19 2023 Fedora Release Engineering - 1.2.9-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild diff --git a/alsa-ucm-conf.patch b/alsa-ucm-conf.patch index 836a828..e69de29 100644 --- a/alsa-ucm-conf.patch +++ b/alsa-ucm-conf.patch @@ -1,179 +0,0 @@ -From 906f692e4ed84dc136c270c05e1b490a554de99b Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Thu, 4 May 2023 14:36:49 +0200 -Subject: [PATCH 1/3] sof-essx8336: Dmic is not a valid UCM device identifier, - use Mic - -Signed-off-by: Jaroslav Kysela ---- - ucm2/Intel/sof-essx8336/sof-essx8336.conf | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/ucm2/Intel/sof-essx8336/sof-essx8336.conf b/ucm2/Intel/sof-essx8336/sof-essx8336.conf -index f74e007..f579a45 100644 ---- a/ucm2/Intel/sof-essx8336/sof-essx8336.conf -+++ b/ucm2/Intel/sof-essx8336/sof-essx8336.conf -@@ -32,7 +32,7 @@ If.devdmic { - Haystack "${CardComponents}" - Needle "cfg-dmics:" - } -- True.Define.DeviceDmic "Dmic" -+ True.Define.DeviceDmic "Mic" - } - - SectionUseCase."HiFi" { --- -2.39.2 - - -From 9fa70add76388087613d02b821acd656268060c4 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 16 May 2023 16:26:38 +0200 -Subject: [PATCH 2/3] sof-hda-dsp,sof-soundwire: add CaptureMicInfoFile fields - for dmics - -Signed-off-by: Jaroslav Kysela ---- - ucm2/Intel/sof-hda-dsp/HiFi.conf | 1 + - ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf | 3 +++ - ucm2/sof-soundwire/dmic.conf | 1 + - ucm2/sof-soundwire/rt715-sdca.conf | 11 ++++++----- - ucm2/sof-soundwire/rt715.conf | 1 + - ucm2/sof-soundwire/sof-soundwire.conf | 11 +++++++++++ - 6 files changed, 23 insertions(+), 5 deletions(-) - -diff --git a/ucm2/Intel/sof-hda-dsp/HiFi.conf b/ucm2/Intel/sof-hda-dsp/HiFi.conf -index 265949e..2063fc0 100644 ---- a/ucm2/Intel/sof-hda-dsp/HiFi.conf -+++ b/ucm2/Intel/sof-hda-dsp/HiFi.conf -@@ -22,6 +22,7 @@ If.dmic { - Value { - CapturePriority 100 - CapturePCM "hw:${CardId},6" -+ CaptureMicInfoFile "${var:LibDir}/dmics-nhlt.json" - If.chn { - Condition { - Type RegexMatch -diff --git a/ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf b/ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf -index e430a7b..44acd69 100644 ---- a/ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf -+++ b/ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf -@@ -12,6 +12,7 @@ If.devdmic { - True { - Define.DeviceDmic "Mic1" - Define.DeviceMic "Mic2" -+ Include.card-init.File "/lib/card-init.conf" - FixedBootSequence [ - # - # users expect to turn the LED on when only internal -@@ -19,6 +20,8 @@ If.devdmic { - # when all internal inputs are off - # - sysw "-/class/sound/ctl-led/mic/card${CardNumber}/detach:Capture Switch" -+ # dmic array info -+ exec "-nhlt-dmic-info -o ${var:LibDir}/dmics-nhlt.json" - ] - } - } -diff --git a/ucm2/sof-soundwire/dmic.conf b/ucm2/sof-soundwire/dmic.conf -index 755840a..c53d381 100644 ---- a/ucm2/sof-soundwire/dmic.conf -+++ b/ucm2/sof-soundwire/dmic.conf -@@ -17,5 +17,6 @@ SectionDevice."Mic" { - CaptureMixerElem "Dmic0" - CaptureVolume "Dmic0 Capture Volume" - CaptureSwitch "Dmic0 Capture Switch" -+ CaptureMicInfoFile "${var:LibDir}/dmics-nhlt.json" - } - } -diff --git a/ucm2/sof-soundwire/rt715-sdca.conf b/ucm2/sof-soundwire/rt715-sdca.conf -index 6e481e1..268a247 100644 ---- a/ucm2/sof-soundwire/rt715-sdca.conf -+++ b/ucm2/sof-soundwire/rt715-sdca.conf -@@ -12,10 +12,11 @@ SectionDevice."Mic" { - ] - - Value { -- CapturePriority 100 -- CapturePCM "hw:${CardId},4" -- CaptureSwitch "rt714 FU02 Capture Switch" -- CaptureVolume "rt714 FU02 Capture Volume" -- CaptureMixerElem "rt714 FU02" -+ CapturePriority 100 -+ CapturePCM "hw:${CardId},4" -+ CaptureSwitch "rt714 FU02 Capture Switch" -+ CaptureVolume "rt714 FU02 Capture Volume" -+ CaptureMixerElem "rt714 FU02" -+ CaptureMicInfoFile "${var:LibDir}/dmics-nhlt.json" - } - } -diff --git a/ucm2/sof-soundwire/rt715.conf b/ucm2/sof-soundwire/rt715.conf -index a733c08..090b663 100644 ---- a/ucm2/sof-soundwire/rt715.conf -+++ b/ucm2/sof-soundwire/rt715.conf -@@ -26,5 +26,6 @@ SectionDevice."Mic" { - CaptureSwitch "${var:rt715ctl} Switch" - CaptureVolume "${var:rt715ctl} Volume" - CaptureMixerElem "${var:rt715ctl}" -+ CaptureMicInfoFile "${var:LibDir}/dmics-nhlt.json" - } - } -diff --git a/ucm2/sof-soundwire/sof-soundwire.conf b/ucm2/sof-soundwire/sof-soundwire.conf -index 786ba63..3368d65 100644 ---- a/ucm2/sof-soundwire/sof-soundwire.conf -+++ b/ucm2/sof-soundwire/sof-soundwire.conf -@@ -92,3 +92,14 @@ If.pga_init_pga5 { - cset "name='PGA5.0 5 Master Capture Switch' 1" - ] - } -+ -+If.mics-array { -+ Condition { -+ Type String -+ Empty "${var:Mics1}" -+ } -+ False.FixedBootSequence { -+ # dmic array info -+ exec "-nhlt-dmic-info -o ${var:LibDir}/dmics-nhlt.json" -+ } -+} --- -2.39.2 - - -From 5cdbc7e283cd80994f31f2e2a3f4df8af778ccb8 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 16 May 2023 17:39:00 +0200 -Subject: [PATCH 3/3] sof-hda-dsp: move card-init include to top - -... otherwise the rm is called after the nhlt-dmic-info - -Signed-off-by: Jaroslav Kysela ---- - ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf b/ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf -index 44acd69..98098e7 100644 ---- a/ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf -+++ b/ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf -@@ -3,6 +3,8 @@ Syntax 6 - Define.DeviceMic "Mic" - Define.DeviceDmic "" - -+Include.card-init.File "/lib/card-init.conf" -+ - If.devdmic { - Condition { - Type String -@@ -12,7 +14,6 @@ If.devdmic { - True { - Define.DeviceDmic "Mic1" - Define.DeviceMic "Mic2" -- Include.card-init.File "/lib/card-init.conf" - FixedBootSequence [ - # - # users expect to turn the LED on when only internal --- -2.39.2 - diff --git a/sources b/sources index d92c338..98f5c7a 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (alsa-lib-1.2.9.tar.bz2) = 8f39c8166c3648d46695a9287d9b9a35e5bfffed11d79e868ff7aba92d0fee792e82784186ebeb2a3e44d6b617c916025c7fce9a802565bb8e0dc8fdcce2311a -SHA512 (alsa-ucm-conf-1.2.9.tar.bz2) = 3aced4d4df76044a5525f1217851e05f7ad177389d2008e3e3dd0fb4d2cf72cd0897b140659a7729cc37d5b737c2d0cf5b607df4f576647044accd560d8cb87b +SHA512 (alsa-lib-1.2.10.tar.bz2) = 4ccbd1dc5a612044571c26290923009e4c3f7959b30a5d0bed47daa68bbefaff9059c4f0fa3bc16f22c1eed2d36f079139369f40243da5921ae4de02a4541939 +SHA512 (alsa-ucm-conf-1.2.10.tar.bz2) = 172956a2c127e9afa5be9c6ada43bfa9fda825823f8f6acbe252edef3381afe3adfa3299c1419f04375599be7721a551c6800be99db44b091611aeb824ffcd72 SHA512 (alsa-topology-conf-1.2.5.tar.bz2) = 2eb4d8baf2dcbf0b631dd11dbf15bffc51694d9cc6931619e51787f3ba58d1a091d266e6721a3b737c040ec74a28270b93f39fb97f30a3227cf340dd646e5d51 From ed9a35b694134fa8067a6fa414ecf72a82ca5dca Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 1 Sep 2023 18:22:57 +0200 Subject: [PATCH 093/120] add missing alsa-lib-1.2.10-glibc-open.patch Signed-off-by: Jaroslav Kysela --- alsa-lib-1.2.10-glibc-open.patch | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 alsa-lib-1.2.10-glibc-open.patch diff --git a/alsa-lib-1.2.10-glibc-open.patch b/alsa-lib-1.2.10-glibc-open.patch new file mode 100644 index 0000000..2e53a92 --- /dev/null +++ b/alsa-lib-1.2.10-glibc-open.patch @@ -0,0 +1,10 @@ +--- alsa-lib-1.2.10/aserver/aserver.c~ 2023-09-01 17:35:48.000000000 +0200 ++++ alsa-lib-1.2.10/aserver/aserver.c 2023-09-01 18:13:11.339601685 +0200 +@@ -35,6 +35,7 @@ + #include + #include + ++#undef open + + char *command; + From 77501925abf95a09e8df8773be7c55cbb37e9760 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 1 Sep 2023 18:23:43 +0200 Subject: [PATCH 094/120] remove alsa-lib-1.0.14-glibc-open.patch Signed-off-by: Jaroslav Kysela --- alsa-lib-1.0.14-glibc-open.patch | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 alsa-lib-1.0.14-glibc-open.patch diff --git a/alsa-lib-1.0.14-glibc-open.patch b/alsa-lib-1.0.14-glibc-open.patch deleted file mode 100644 index bc625bd..0000000 --- a/alsa-lib-1.0.14-glibc-open.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- alsa-lib-1.0.14/aserver/aserver.c 2007-05-31 10:05:13.000000000 +0200 -+++ alsa-lib-1.0.14.lennart/aserver/aserver.c 2007-08-15 15:53:32.000000000 +0200 -@@ -35,6 +35,8 @@ - - #include "aserver.h" - -+#undef open -+ - char *command; - - #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) From bf0d819031cefc68093f7b7375dd1b6c2c947c1d Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 4 Sep 2023 10:19:43 +0200 Subject: [PATCH 095/120] fix control.h header file (ump) Signed-off-by: Jaroslav Kysela --- alsa-git.patch | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++ alsa-lib.spec | 5 ++- 2 files changed, 86 insertions(+), 1 deletion(-) diff --git a/alsa-git.patch b/alsa-git.patch index e69de29..3ba704a 100644 --- a/alsa-git.patch +++ b/alsa-git.patch @@ -0,0 +1,82 @@ +From 9685505bf438467d9b11919b332b066d3a1c94d0 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 4 Sep 2023 09:37:29 +0200 +Subject: [PATCH 1/2] gitcompile: Add static build + +Signed-off-by: Jaroslav Kysela +--- + gitcompile | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/gitcompile b/gitcompile +index 0fe092ce..c70448f7 100755 +--- a/gitcompile ++++ b/gitcompile +@@ -32,6 +32,10 @@ if [ $# -ne 0 ]; then + lto="-flto -flto-partition=none" + echo "Forced lto build..." + shift ;; ++ static) ++ static=yes ++ echo "Selected static build..." ++ shift ;; + *) + endloop=yes + ;; +@@ -75,6 +79,12 @@ if [ "$python2" = "yes" ]; then + args="$args --enable-python2" + fi + ++if [ "$static" = "yes" ]; then ++ #args="$args --enable-shared=no --enable-static=yes" ++ args="$args --disable-shared" ++fi ++ ++ + touch ltconfig + libtoolize --force --copy --automake + aclocal $ACLOCAL_FLAGS +-- +2.41.0 + + +From fcce13a6726c52882bd8b7131c61c4eba308792c Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 4 Sep 2023 09:38:26 +0200 +Subject: [PATCH 2/2] control.h: Fix ump header file detection +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Apparently, the control.h is used from apps separately (outside +asoundlib.h). Avoid errors like: + +/usr/include/alsa/control.h:417:47: error: ‘snd_ump_endpoint_info_t’ has not been declared + 417 | int snd_ctl_ump_endpoint_info(snd_ctl_t *ctl, snd_ump_endpoint_info_t *info); + | ^~~~~~~~~~~~~~~~~~~~~~~ +/usr/include/alsa/control.h:418:44: error: ‘snd_ump_block_info_t’ has not been declared + 418 | int snd_ctl_ump_block_info(snd_ctl_t *ctl, snd_ump_block_info_t *info); + | ^~~~~~~~~~~~~~~~~~~~ + +Fixes: https://github.com/alsa-project/alsa-lib/issues/348 +Signed-off-by: Jaroslav Kysela +--- + include/control.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/include/control.h b/include/control.h +index ab482ba4..e7541d56 100644 +--- a/include/control.h ++++ b/include/control.h +@@ -413,6 +413,8 @@ int snd_ctl_pcm_prefer_subdevice(snd_ctl_t *ctl, int subdev); + int snd_ctl_rawmidi_next_device(snd_ctl_t *ctl, int * device); + int snd_ctl_rawmidi_info(snd_ctl_t *ctl, snd_rawmidi_info_t * info); + int snd_ctl_rawmidi_prefer_subdevice(snd_ctl_t *ctl, int subdev); ++#endif ++#ifdef __ALSA_UMP_H + int snd_ctl_ump_next_device(snd_ctl_t *ctl, int *device); + int snd_ctl_ump_endpoint_info(snd_ctl_t *ctl, snd_ump_endpoint_info_t *info); + int snd_ctl_ump_block_info(snd_ctl_t *ctl, snd_ump_block_info_t *info); +-- +2.41.0 + diff --git a/alsa-lib.spec b/alsa-lib.spec index 386a27d..38c30a9 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 1%{?prever_dot}%{?dist} +Release: 2%{?prever_dot}%{?dist} License: LGPL-2.1-or-later URL: http://www.alsa-project.org/ @@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Mon Sep 4 2023 Jaroslav Kysela - 1.2.10-2 +- fix control.h header file (ump) + * Fri Sep 1 2023 Jaroslav Kysela - 1.2.10-1 - update to 1.2.10 From 313e6bd3442251c75a92604db2e6cf8cad193db2 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 4 Sep 2023 17:17:29 +0200 Subject: [PATCH 096/120] fix SplitPCM (alsa-ucm) Signed-off-by: Jaroslav Kysela --- alsa-lib.spec | 5 +++-- alsa-ucm-conf.patch | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 38c30a9..62ca19b 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 2%{?prever_dot}%{?dist} +Release: 3%{?prever_dot}%{?dist} License: LGPL-2.1-or-later URL: http://www.alsa-project.org/ @@ -167,8 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog -* Mon Sep 4 2023 Jaroslav Kysela - 1.2.10-2 +* Mon Sep 4 2023 Jaroslav Kysela - 1.2.10-3 - fix control.h header file (ump) +- fix SplitPCM (alsa-ucm) * Fri Sep 1 2023 Jaroslav Kysela - 1.2.10-1 - update to 1.2.10 diff --git a/alsa-ucm-conf.patch b/alsa-ucm-conf.patch index e69de29..bd3790c 100644 --- a/alsa-ucm-conf.patch +++ b/alsa-ucm-conf.patch @@ -0,0 +1,28 @@ +From b68aa52acdd2763fedad5eec0f435fbf43e5ccc6 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 4 Sep 2023 16:39:52 +0200 +Subject: [PATCH] SplitPCM: Device argument may not be set + +Link: https://github.com/alsa-project/alsa-ucm-conf/issues/346 +Fixes: 10967ea ("SplitPCM: Fix Device variable in SplitPCMDevice macro") +Signed-off-by: Jaroslav Kysela +--- + ucm2/common/pcm/split.conf | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ucm2/common/pcm/split.conf b/ucm2/common/pcm/split.conf +index 80f23e6..9ed2f95 100644 +--- a/ucm2/common/pcm/split.conf ++++ b/ucm2/common/pcm/split.conf +@@ -326,7 +326,7 @@ DefineMacro.SplitPCMDevice { + If.0 { + Condition { + Type String +- Empty "${var:__Device}" ++ Empty "${var:-__Device}" + } + True.Define.__Device "0" + } +-- +2.41.0 + From e928063161a31a1c55e2d84912ffce40ffd21d80 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 19 Jan 2024 12:44:50 +0000 Subject: [PATCH 097/120] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- alsa-lib.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 62ca19b..3340a62 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 3%{?prever_dot}%{?dist} +Release: 4%{?prever_dot}%{?dist} License: LGPL-2.1-or-later URL: http://www.alsa-project.org/ @@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Fri Jan 19 2024 Fedora Release Engineering - 1.2.10-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Mon Sep 4 2023 Jaroslav Kysela - 1.2.10-3 - fix control.h header file (ump) - fix SplitPCM (alsa-ucm) From 286a38aadf5877ef44ecb970865d228b58fdbb6b Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Mon, 22 Jan 2024 22:56:09 +0000 Subject: [PATCH 098/120] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- alsa-lib.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 3340a62..132f9bc 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 4%{?prever_dot}%{?dist} +Release: 5%{?prever_dot}%{?dist} License: LGPL-2.1-or-later URL: http://www.alsa-project.org/ @@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Mon Jan 22 2024 Fedora Release Engineering - 1.2.10-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Fri Jan 19 2024 Fedora Release Engineering - 1.2.10-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From 92b901cd68ba0f956eb518deb1a946ffccaee659 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 29 Jan 2024 14:22:58 +0100 Subject: [PATCH 099/120] update to 1.2.11 Signed-off-by: Jaroslav Kysela --- alsa-git.patch | 82 --------------------------------------------- alsa-lib.spec | 9 +++-- alsa-ucm-conf.patch | 28 ---------------- sources | 4 +-- 4 files changed, 8 insertions(+), 115 deletions(-) diff --git a/alsa-git.patch b/alsa-git.patch index 3ba704a..e69de29 100644 --- a/alsa-git.patch +++ b/alsa-git.patch @@ -1,82 +0,0 @@ -From 9685505bf438467d9b11919b332b066d3a1c94d0 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Mon, 4 Sep 2023 09:37:29 +0200 -Subject: [PATCH 1/2] gitcompile: Add static build - -Signed-off-by: Jaroslav Kysela ---- - gitcompile | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/gitcompile b/gitcompile -index 0fe092ce..c70448f7 100755 ---- a/gitcompile -+++ b/gitcompile -@@ -32,6 +32,10 @@ if [ $# -ne 0 ]; then - lto="-flto -flto-partition=none" - echo "Forced lto build..." - shift ;; -+ static) -+ static=yes -+ echo "Selected static build..." -+ shift ;; - *) - endloop=yes - ;; -@@ -75,6 +79,12 @@ if [ "$python2" = "yes" ]; then - args="$args --enable-python2" - fi - -+if [ "$static" = "yes" ]; then -+ #args="$args --enable-shared=no --enable-static=yes" -+ args="$args --disable-shared" -+fi -+ -+ - touch ltconfig - libtoolize --force --copy --automake - aclocal $ACLOCAL_FLAGS --- -2.41.0 - - -From fcce13a6726c52882bd8b7131c61c4eba308792c Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Mon, 4 Sep 2023 09:38:26 +0200 -Subject: [PATCH 2/2] control.h: Fix ump header file detection -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Apparently, the control.h is used from apps separately (outside -asoundlib.h). Avoid errors like: - -/usr/include/alsa/control.h:417:47: error: ‘snd_ump_endpoint_info_t’ has not been declared - 417 | int snd_ctl_ump_endpoint_info(snd_ctl_t *ctl, snd_ump_endpoint_info_t *info); - | ^~~~~~~~~~~~~~~~~~~~~~~ -/usr/include/alsa/control.h:418:44: error: ‘snd_ump_block_info_t’ has not been declared - 418 | int snd_ctl_ump_block_info(snd_ctl_t *ctl, snd_ump_block_info_t *info); - | ^~~~~~~~~~~~~~~~~~~~ - -Fixes: https://github.com/alsa-project/alsa-lib/issues/348 -Signed-off-by: Jaroslav Kysela ---- - include/control.h | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/include/control.h b/include/control.h -index ab482ba4..e7541d56 100644 ---- a/include/control.h -+++ b/include/control.h -@@ -413,6 +413,8 @@ int snd_ctl_pcm_prefer_subdevice(snd_ctl_t *ctl, int subdev); - int snd_ctl_rawmidi_next_device(snd_ctl_t *ctl, int * device); - int snd_ctl_rawmidi_info(snd_ctl_t *ctl, snd_rawmidi_info_t * info); - int snd_ctl_rawmidi_prefer_subdevice(snd_ctl_t *ctl, int subdev); -+#endif -+#ifdef __ALSA_UMP_H - int snd_ctl_ump_next_device(snd_ctl_t *ctl, int *device); - int snd_ctl_ump_endpoint_info(snd_ctl_t *ctl, snd_ump_endpoint_info_t *info); - int snd_ctl_ump_block_info(snd_ctl_t *ctl, snd_ump_block_info_t *info); --- -2.41.0 - diff --git a/alsa-lib.spec b/alsa-lib.spec index 132f9bc..069fdb6 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -2,14 +2,14 @@ #define prever_dot .rc3 #define postver a -%define version_alsa_lib 1.2.10 -%define version_alsa_ucm 1.2.10 +%define version_alsa_lib 1.2.11 +%define version_alsa_ucm 1.2.11 %define version_alsa_tplg 1.2.5 Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 5%{?prever_dot}%{?dist} +Release: 1%{?prever_dot}%{?dist} License: LGPL-2.1-or-later URL: http://www.alsa-project.org/ @@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Mon Jan 29 2024 Jaroslav Kysela - 1.2.11-1 +- update to 1.2.11 + * Mon Jan 22 2024 Fedora Release Engineering - 1.2.10-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild diff --git a/alsa-ucm-conf.patch b/alsa-ucm-conf.patch index bd3790c..e69de29 100644 --- a/alsa-ucm-conf.patch +++ b/alsa-ucm-conf.patch @@ -1,28 +0,0 @@ -From b68aa52acdd2763fedad5eec0f435fbf43e5ccc6 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Mon, 4 Sep 2023 16:39:52 +0200 -Subject: [PATCH] SplitPCM: Device argument may not be set - -Link: https://github.com/alsa-project/alsa-ucm-conf/issues/346 -Fixes: 10967ea ("SplitPCM: Fix Device variable in SplitPCMDevice macro") -Signed-off-by: Jaroslav Kysela ---- - ucm2/common/pcm/split.conf | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/ucm2/common/pcm/split.conf b/ucm2/common/pcm/split.conf -index 80f23e6..9ed2f95 100644 ---- a/ucm2/common/pcm/split.conf -+++ b/ucm2/common/pcm/split.conf -@@ -326,7 +326,7 @@ DefineMacro.SplitPCMDevice { - If.0 { - Condition { - Type String -- Empty "${var:__Device}" -+ Empty "${var:-__Device}" - } - True.Define.__Device "0" - } --- -2.41.0 - diff --git a/sources b/sources index 98f5c7a..3416e13 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (alsa-lib-1.2.10.tar.bz2) = 4ccbd1dc5a612044571c26290923009e4c3f7959b30a5d0bed47daa68bbefaff9059c4f0fa3bc16f22c1eed2d36f079139369f40243da5921ae4de02a4541939 -SHA512 (alsa-ucm-conf-1.2.10.tar.bz2) = 172956a2c127e9afa5be9c6ada43bfa9fda825823f8f6acbe252edef3381afe3adfa3299c1419f04375599be7721a551c6800be99db44b091611aeb824ffcd72 +SHA512 (alsa-lib-1.2.11.tar.bz2) = 7497329811cf63adb605c75a6d5b75e7871eab9549c9e91f98299ab0d63a78040b4ab47bf2bfc28264b8afe85e7406627277bcddc0720efaf492444bd6ca4da8 +SHA512 (alsa-ucm-conf-1.2.11.tar.bz2) = b202e7410a579789be0005564b4868f70bca0fd8664c02add95fc9ff90ab64faebda978fbd3e83a3274c37242dccf8efbebd03f529e35ca3033daf55f425cb8d SHA512 (alsa-topology-conf-1.2.5.tar.bz2) = 2eb4d8baf2dcbf0b631dd11dbf15bffc51694d9cc6931619e51787f3ba58d1a091d266e6721a3b737c040ec74a28270b93f39fb97f30a3227cf340dd646e5d51 From d50c4594a0a6f8b9ef6b86593e11d002b74055d8 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 29 Jan 2024 17:27:31 +0100 Subject: [PATCH 100/120] update 1.2.11 source package --- alsa-lib.spec | 4 ++-- sources | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 069fdb6..b84cb6d 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 1%{?prever_dot}%{?dist} +Release: 2%{?prever_dot}%{?dist} License: LGPL-2.1-or-later URL: http://www.alsa-project.org/ @@ -167,7 +167,7 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog -* Mon Jan 29 2024 Jaroslav Kysela - 1.2.11-1 +* Mon Jan 29 2024 Jaroslav Kysela - 1.2.11-2 - update to 1.2.11 * Mon Jan 22 2024 Fedora Release Engineering - 1.2.10-5 diff --git a/sources b/sources index 3416e13..0d62672 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (alsa-lib-1.2.11.tar.bz2) = 7497329811cf63adb605c75a6d5b75e7871eab9549c9e91f98299ab0d63a78040b4ab47bf2bfc28264b8afe85e7406627277bcddc0720efaf492444bd6ca4da8 +SHA512 (alsa-lib-1.2.11.tar.bz2) = 7bf2c541dff5262c0302a1c716ca10cdb5105f4e0ad48f3341c3c7e975b0c3ea835a298a05974c3e216a85912c368d8025ba3cdda3ff04a7683133ce5b2a286d SHA512 (alsa-ucm-conf-1.2.11.tar.bz2) = b202e7410a579789be0005564b4868f70bca0fd8664c02add95fc9ff90ab64faebda978fbd3e83a3274c37242dccf8efbebd03f529e35ca3033daf55f425cb8d SHA512 (alsa-topology-conf-1.2.5.tar.bz2) = 2eb4d8baf2dcbf0b631dd11dbf15bffc51694d9cc6931619e51787f3ba58d1a091d266e6721a3b737c040ec74a28270b93f39fb97f30a3227cf340dd646e5d51 From 205206c994296c769db195ea5e3b87abbd017b14 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 10 Jun 2024 14:19:37 +0200 Subject: [PATCH 101/120] update to 1.2.12 Signed-off-by: Jaroslav Kysela --- alsa-lib.spec | 13 ++++++++----- sources | 4 ++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index b84cb6d..499037f 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -2,14 +2,14 @@ #define prever_dot .rc3 #define postver a -%define version_alsa_lib 1.2.11 -%define version_alsa_ucm 1.2.11 +%define version_alsa_lib 1.2.12 +%define version_alsa_ucm 1.2.12 %define version_alsa_tplg 1.2.5 Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 2%{?prever_dot}%{?dist} +Release: 1%{?prever_dot}%{?dist} License: LGPL-2.1-or-later URL: http://www.alsa-project.org/ @@ -20,7 +20,7 @@ Source10: asound.conf Source11: modprobe-dist-alsa.conf Source12: modprobe-dist-oss.conf Source40: alsa-ucm-conf.patch -Patch0: alsa-git.patch +#Patch0: alsa-git.patch Patch1: alsa-lib-1.2.3.1-config.patch Patch2: alsa-lib-1.2.10-glibc-open.patch @@ -70,7 +70,7 @@ contains alsa-lib configuration of SoC topology %prep %setup -q -n %{name}-%{version}%{?prever}%{?postver} -%patch -P0 -p1 -b .alsa-git +#patch -P0 -p1 -b .alsa-git %patch -P1 -p1 -b .config %patch -P2 -p1 -b .glibc-open @@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Mon Jun 10 2024 Jaroslav Kysela - 1.2.12-1 +- update to 1.2.12 + * Mon Jan 29 2024 Jaroslav Kysela - 1.2.11-2 - update to 1.2.11 diff --git a/sources b/sources index 0d62672..a2a4b9b 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (alsa-lib-1.2.11.tar.bz2) = 7bf2c541dff5262c0302a1c716ca10cdb5105f4e0ad48f3341c3c7e975b0c3ea835a298a05974c3e216a85912c368d8025ba3cdda3ff04a7683133ce5b2a286d -SHA512 (alsa-ucm-conf-1.2.11.tar.bz2) = b202e7410a579789be0005564b4868f70bca0fd8664c02add95fc9ff90ab64faebda978fbd3e83a3274c37242dccf8efbebd03f529e35ca3033daf55f425cb8d +SHA512 (alsa-lib-1.2.12.tar.bz2) = 053e36e51c0ff28f07028b89c8845b50682a5c14035ab85c2fc8cae2f2f0d05e4cd45ed879602c15c1596fb7fe84bfd50ec0d119dfb55c66589a2d458a9b317d +SHA512 (alsa-ucm-conf-1.2.12.tar.bz2) = 391dde123271172d899c04865d1d6e21b4ad0060ee9b2256dfbc6fc89ad48edcaa43c861893ab0e5c70d972e20d15c528defc19c00308e7465f13f954cce25d7 SHA512 (alsa-topology-conf-1.2.5.tar.bz2) = 2eb4d8baf2dcbf0b631dd11dbf15bffc51694d9cc6931619e51787f3ba58d1a091d266e6721a3b737c040ec74a28270b93f39fb97f30a3227cf340dd646e5d51 From 943c8b44cd77286843a25a88f9ab8986130be8a8 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 17 Jul 2024 16:52:40 +0000 Subject: [PATCH 102/120] Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild --- alsa-lib.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 499037f..23e2730 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 1%{?prever_dot}%{?dist} +Release: 2%{?prever_dot}%{?dist} License: LGPL-2.1-or-later URL: http://www.alsa-project.org/ @@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Wed Jul 17 2024 Fedora Release Engineering - 1.2.12-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + * Mon Jun 10 2024 Jaroslav Kysela - 1.2.12-1 - update to 1.2.12 From 0d731622177e1031766b78a5d675747df9106977 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 12 Nov 2024 13:11:57 +0100 Subject: [PATCH 103/120] update to 1.2.13 Signed-off-by: Jaroslav Kysela --- alsa-lib.spec | 9 ++++++--- sources | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 23e2730..1566e84 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -2,14 +2,14 @@ #define prever_dot .rc3 #define postver a -%define version_alsa_lib 1.2.12 -%define version_alsa_ucm 1.2.12 +%define version_alsa_lib 1.2.13 +%define version_alsa_ucm 1.2.13 %define version_alsa_tplg 1.2.5 Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 2%{?prever_dot}%{?dist} +Release: 1%{?prever_dot}%{?dist} License: LGPL-2.1-or-later URL: http://www.alsa-project.org/ @@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Tue Nov 12 2024 Jaroslav Kysela - 1.2.13-1 +- update to 1.2.13 + * Wed Jul 17 2024 Fedora Release Engineering - 1.2.12-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild diff --git a/sources b/sources index a2a4b9b..e7b27b3 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (alsa-lib-1.2.12.tar.bz2) = 053e36e51c0ff28f07028b89c8845b50682a5c14035ab85c2fc8cae2f2f0d05e4cd45ed879602c15c1596fb7fe84bfd50ec0d119dfb55c66589a2d458a9b317d -SHA512 (alsa-ucm-conf-1.2.12.tar.bz2) = 391dde123271172d899c04865d1d6e21b4ad0060ee9b2256dfbc6fc89ad48edcaa43c861893ab0e5c70d972e20d15c528defc19c00308e7465f13f954cce25d7 +SHA512 (alsa-lib-1.2.13.tar.bz2) = b0c0666e38e881dca985b61386523c045c71072a88be4952c986ffbe2107ec736da528858ebeffdf439de5c290914bf3facc654100a228c6d26fff9429142ef0 +SHA512 (alsa-ucm-conf-1.2.13.tar.bz2) = cad867268851ac178f3a5378a00e292184b0e0ec7955f297ae7ed56073d3dddb06c08666b23b1bf6b0065068a9370ee34608bd687763658c79d34b64059b1c85 SHA512 (alsa-topology-conf-1.2.5.tar.bz2) = 2eb4d8baf2dcbf0b631dd11dbf15bffc51694d9cc6931619e51787f3ba58d1a091d266e6721a3b737c040ec74a28270b93f39fb97f30a3227cf340dd646e5d51 From e561588491e96907c4d5523ae0a13d724bf0462f Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 13 Nov 2024 16:26:28 +0100 Subject: [PATCH 104/120] fix SOF HDA UCM configuration Signed-off-by: Jaroslav Kysela --- alsa-lib.spec | 4 +- alsa-ucm-conf.patch | 101 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+), 2 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 1566e84..adf2731 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 1%{?prever_dot}%{?dist} +Release: 2%{?prever_dot}%{?dist} License: LGPL-2.1-or-later URL: http://www.alsa-project.org/ @@ -167,7 +167,7 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog -* Tue Nov 12 2024 Jaroslav Kysela - 1.2.13-1 +* Wed Nov 13 2024 Jaroslav Kysela - 1.2.13-2 - update to 1.2.13 * Wed Jul 17 2024 Fedora Release Engineering - 1.2.12-2 diff --git a/alsa-ucm-conf.patch b/alsa-ucm-conf.patch index e69de29..ff46a0c 100644 --- a/alsa-ucm-conf.patch +++ b/alsa-ucm-conf.patch @@ -0,0 +1,101 @@ +From 11b028a9a01e47fc9b48e4a566803752011902e2 Mon Sep 17 00:00:00 2001 +From: Seppo Ingalsuo +Date: Wed, 13 Nov 2024 14:48:38 +0200 +Subject: [PATCH 1/2] UCM2: Intel: sof-hda-dsp: Fix handling of empty + sys_vendor + +The mistake in UCM syntax caused in alsaucm start error: + +ALSA lib ucm_cond.c:367:(if_eval) unknown If.Condition.Type + +Fixes: 13022a97711d ("sof-hda-dsp: Fix the case where sysfs dmi + sys_vendor attribute is not set") + +Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/463 +Signed-off-by: Seppo Ingalsuo +Signed-off-by: Jaroslav Kysela +--- + ucm2/Intel/sof-hda-dsp/HiFi-sof.conf | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/ucm2/Intel/sof-hda-dsp/HiFi-sof.conf b/ucm2/Intel/sof-hda-dsp/HiFi-sof.conf +index fea8159..c755ba2 100644 +--- a/ucm2/Intel/sof-hda-dsp/HiFi-sof.conf ++++ b/ucm2/Intel/sof-hda-dsp/HiFi-sof.conf +@@ -6,8 +6,8 @@ Define.SOFVendor "$${sys:devices/virtual/dmi/id/sys_vendor}" + + If.SOFVendor { + Condition { +- Type Empty +- String "${var:SOFVendor}" ++ Type String ++ Empty "${var:SOFVendor}" + } + True.Define.SOFVendor "${sys:devices/virtual/dmi/id/board_vendor}" + } +-- +2.47.0 + + +From 6397c663d7086b87ca5cbba323ea3dcd0ecd3200 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 13 Nov 2024 16:19:15 +0100 +Subject: [PATCH 2/2] sof-hda-dsp: Fix the case where sysfs dmi product_name + attribute is not set + + !!DMI Information + !!--------------- + + Manufacturer: + Product Name: + Product Version: + Firmware Version: R6G07 + System SKU: Default string + Board Vendor: Default string + Board Name: Default string + +BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=2292583 +Signed-off-by: Jaroslav Kysela +--- + ucm2/Intel/sof-hda-dsp/HiFi-sof.conf | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/ucm2/Intel/sof-hda-dsp/HiFi-sof.conf b/ucm2/Intel/sof-hda-dsp/HiFi-sof.conf +index c755ba2..5fd1843 100644 +--- a/ucm2/Intel/sof-hda-dsp/HiFi-sof.conf ++++ b/ucm2/Intel/sof-hda-dsp/HiFi-sof.conf +@@ -3,6 +3,7 @@ + # File paths for controlling SOF processing + + Define.SOFVendor "$${sys:devices/virtual/dmi/id/sys_vendor}" ++Define.SOFProduct "$${sys:devices/virtual/dmi/id/product_name}" + + If.SOFVendor { + Condition { +@@ -12,6 +13,14 @@ If.SOFVendor { + True.Define.SOFVendor "${sys:devices/virtual/dmi/id/board_vendor}" + } + ++If.SOFProduct { ++ Condition { ++ Type String ++ Empty "${var:SOFProduct}" ++ } ++ True.Define.SOFProduct "${sys:devices/virtual/dmi/id/board_name}" ++} ++ + If.SOFIPCVer { + Condition { + Type ControlExists +@@ -43,7 +52,7 @@ If.SOFPath { + HeadphoneIirBlob "${var:BlobPath}/eq_iir/pass.blob" + HeadphoneFirBlob "${var:BlobPath}/eq_fir/pass.blob" + HeadphoneDrcBlob "${var:BlobPath}/drc/passthrough.blob" +- ConfPathFromDMI "${var:SOFVendor}/${sys:devices/virtual/dmi/id/product_name}.conf" ++ ConfPathFromDMI "${var:SOFVendor}/${var:SOFProduct}" + SOFProductConfig "/blobs/sof/product_configs/${var:ConfPathFromDMI}" + SOFConfFullPath "${ConfTopDir}${var:SOFProductConfig}" + SOFUserConfig "/blobs/sof/user_configs/${var:ConfPathFromDMI}" +-- +2.47.0 + From 67fd486ada26ad3b84298565ea8c5e4562fefa90 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 15 Nov 2024 09:34:14 +0100 Subject: [PATCH 105/120] fix snd_seq_has_queue_tempo_base symbol version Signed-off-by: Jaroslav Kysela --- alsa-git.patch | 42 ++++++++++++++++++++++++++++++++++++++++++ alsa-lib.spec | 4 ++-- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/alsa-git.patch b/alsa-git.patch index e69de29..1f6cb46 100644 --- a/alsa-git.patch +++ b/alsa-git.patch @@ -0,0 +1,42 @@ +From 76edab4e595bd5f3f4c636cccc8d7976d3c519d6 Mon Sep 17 00:00:00 2001 +From: Nicholas Vinson +Date: Thu, 14 Nov 2024 07:49:53 -0500 +Subject: [PATCH] src/Versions.in.in: Update *_tempo_base name + +Change @SYMBOL_PREFIX@snd_has_tempo_base to +@SYMBOL_PREFIX@snd_has_queue_tempo_base. + +Starting with version 1.2.13, alsa-lib fails to link with ld.lld-19 due +to "version script assignment of 'ALSA_1.2.13' to symbol +'snd_seq_has_tempo_base' failed: symbol not defined". + +Per commit 769d1db1b0a213a39c7e59c0d1d724e7f45b1ac3 the correct name for +the symbol is @SYMBOL_PREFIX@snd_has_queue_tempo_base; therefore, update +src/Vesions.in.in to match. + +Fixes bug #420 +Fixes Gentoo bug 943399 (https://bugs.gentoo.org/943399) + +Closes: https://github.com/alsa-project/alsa-lib/pull/421 +Signed-off-by: Nicholas Vinson +Signed-off-by: Jaroslav Kysela +--- + src/Versions.in.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/Versions.in.in b/src/Versions.in.in +index 350ec3d8..7ad6a633 100644 +--- a/src/Versions.in.in ++++ b/src/Versions.in.in +@@ -212,7 +212,7 @@ ALSA_1.2.13 { + @SYMBOL_PREFIX@snd_seq_create_ump_block; + @SYMBOL_PREFIX@snd_seq_queue_tempo_get_tempo_base; + @SYMBOL_PREFIX@snd_seq_queue_tempo_set_tempo_base; +- @SYMBOL_PREFIX@snd_seq_has_tempo_base; ++ @SYMBOL_PREFIX@snd_seq_has_queue_tempo_base; + @SYMBOL_PREFIX@snd_seq_port_info_get_ump_is_midi1; + @SYMBOL_PREFIX@snd_seq_port_info_set_ump_is_midi1; + #endif +-- +2.47.0 + diff --git a/alsa-lib.spec b/alsa-lib.spec index adf2731..ff2f85c 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -20,7 +20,7 @@ Source10: asound.conf Source11: modprobe-dist-alsa.conf Source12: modprobe-dist-oss.conf Source40: alsa-ucm-conf.patch -#Patch0: alsa-git.patch +Patch0: alsa-git.patch Patch1: alsa-lib-1.2.3.1-config.patch Patch2: alsa-lib-1.2.10-glibc-open.patch @@ -70,7 +70,7 @@ contains alsa-lib configuration of SoC topology %prep %setup -q -n %{name}-%{version}%{?prever}%{?postver} -#patch -P0 -p1 -b .alsa-git +%patch -P0 -p1 -b .alsa-git %patch -P1 -p1 -b .config %patch -P2 -p1 -b .glibc-open From 220911de7a16ed3d8db3b967552c0aabe6edc96b Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 15 Nov 2024 09:40:05 +0100 Subject: [PATCH 106/120] fix snd_seq_has_queue_tempo_base symbol version #2 Signed-off-by: Jaroslav Kysela --- alsa-lib.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index ff2f85c..b1c8552 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 2%{?prever_dot}%{?dist} +Release: 3%{?prever_dot}%{?dist} License: LGPL-2.1-or-later URL: http://www.alsa-project.org/ @@ -167,7 +167,7 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog -* Wed Nov 13 2024 Jaroslav Kysela - 1.2.13-2 +* Fri Nov 15 2024 Jaroslav Kysela - 1.2.13-3 - update to 1.2.13 * Wed Jul 17 2024 Fedora Release Engineering - 1.2.12-2 From ce98cbeca1abddcb2bdf9fd33728bc2cf0ea22f9 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 16 Jan 2025 10:54:10 +0000 Subject: [PATCH 107/120] Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild --- alsa-lib.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index b1c8552..963b312 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 3%{?prever_dot}%{?dist} +Release: 4%{?prever_dot}%{?dist} License: LGPL-2.1-or-later URL: http://www.alsa-project.org/ @@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Thu Jan 16 2025 Fedora Release Engineering - 1.2.13-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + * Fri Nov 15 2024 Jaroslav Kysela - 1.2.13-3 - update to 1.2.13 From ecc98ea4c403640f7f250ea6366346f8d2beaf2f Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 14 Apr 2025 11:11:13 +0200 Subject: [PATCH 108/120] update to 1.2.14 Signed-off-by: Jaroslav Kysela --- alsa-git.patch | 42 ------------------ alsa-lib.spec | 17 +++++--- alsa-ucm-conf.patch | 101 -------------------------------------------- sources | 4 +- 4 files changed, 12 insertions(+), 152 deletions(-) delete mode 100644 alsa-git.patch delete mode 100644 alsa-ucm-conf.patch diff --git a/alsa-git.patch b/alsa-git.patch deleted file mode 100644 index 1f6cb46..0000000 --- a/alsa-git.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 76edab4e595bd5f3f4c636cccc8d7976d3c519d6 Mon Sep 17 00:00:00 2001 -From: Nicholas Vinson -Date: Thu, 14 Nov 2024 07:49:53 -0500 -Subject: [PATCH] src/Versions.in.in: Update *_tempo_base name - -Change @SYMBOL_PREFIX@snd_has_tempo_base to -@SYMBOL_PREFIX@snd_has_queue_tempo_base. - -Starting with version 1.2.13, alsa-lib fails to link with ld.lld-19 due -to "version script assignment of 'ALSA_1.2.13' to symbol -'snd_seq_has_tempo_base' failed: symbol not defined". - -Per commit 769d1db1b0a213a39c7e59c0d1d724e7f45b1ac3 the correct name for -the symbol is @SYMBOL_PREFIX@snd_has_queue_tempo_base; therefore, update -src/Vesions.in.in to match. - -Fixes bug #420 -Fixes Gentoo bug 943399 (https://bugs.gentoo.org/943399) - -Closes: https://github.com/alsa-project/alsa-lib/pull/421 -Signed-off-by: Nicholas Vinson -Signed-off-by: Jaroslav Kysela ---- - src/Versions.in.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/Versions.in.in b/src/Versions.in.in -index 350ec3d8..7ad6a633 100644 ---- a/src/Versions.in.in -+++ b/src/Versions.in.in -@@ -212,7 +212,7 @@ ALSA_1.2.13 { - @SYMBOL_PREFIX@snd_seq_create_ump_block; - @SYMBOL_PREFIX@snd_seq_queue_tempo_get_tempo_base; - @SYMBOL_PREFIX@snd_seq_queue_tempo_set_tempo_base; -- @SYMBOL_PREFIX@snd_seq_has_tempo_base; -+ @SYMBOL_PREFIX@snd_seq_has_queue_tempo_base; - @SYMBOL_PREFIX@snd_seq_port_info_get_ump_is_midi1; - @SYMBOL_PREFIX@snd_seq_port_info_set_ump_is_midi1; - #endif --- -2.47.0 - diff --git a/alsa-lib.spec b/alsa-lib.spec index 963b312..0fd0ae6 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -2,14 +2,14 @@ #define prever_dot .rc3 #define postver a -%define version_alsa_lib 1.2.13 -%define version_alsa_ucm 1.2.13 +%define version_alsa_lib 1.2.14 +%define version_alsa_ucm 1.2.14 %define version_alsa_tplg 1.2.5 Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 4%{?prever_dot}%{?dist} +Release: 1%{?prever_dot}%{?dist} License: LGPL-2.1-or-later URL: http://www.alsa-project.org/ @@ -19,8 +19,8 @@ Source2: ftp://ftp.alsa-project.org/pub/lib/alsa-topology-conf-%{version_alsa_t Source10: asound.conf Source11: modprobe-dist-alsa.conf Source12: modprobe-dist-oss.conf -Source40: alsa-ucm-conf.patch -Patch0: alsa-git.patch +#Source40: alsa-ucm-conf.patch +#Patch0: alsa-git.patch Patch1: alsa-lib-1.2.3.1-config.patch Patch2: alsa-lib-1.2.10-glibc-open.patch @@ -70,7 +70,7 @@ contains alsa-lib configuration of SoC topology %prep %setup -q -n %{name}-%{version}%{?prever}%{?postver} -%patch -P0 -p1 -b .alsa-git +#patch -P0 -p1 -b .alsa-git %patch -P1 -p1 -b .config %patch -P2 -p1 -b .glibc-open @@ -116,7 +116,7 @@ mkdir -p %{buildroot}/%{_datadir}/alsa/ucm2 # Unpack UCMs tar xvjf %{SOURCE1} -C %{buildroot}/%{_datadir}/alsa --strip-components=1 "*/ucm" "*/ucm2" -patch -d %{buildroot}/%{_datadir}/alsa -p1 < %{SOURCE40} +#patch -d %{buildroot}/%{_datadir}/alsa -p1 < %{SOURCE40} # Create topology directory mkdir -p %{buildroot}/%{_datadir}/alsa/topology @@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Mon Apr 14 2025 Jaroslav Kysela - 1.2.14-1 +- update to 1.2.14 + * Thu Jan 16 2025 Fedora Release Engineering - 1.2.13-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild diff --git a/alsa-ucm-conf.patch b/alsa-ucm-conf.patch deleted file mode 100644 index ff46a0c..0000000 --- a/alsa-ucm-conf.patch +++ /dev/null @@ -1,101 +0,0 @@ -From 11b028a9a01e47fc9b48e4a566803752011902e2 Mon Sep 17 00:00:00 2001 -From: Seppo Ingalsuo -Date: Wed, 13 Nov 2024 14:48:38 +0200 -Subject: [PATCH 1/2] UCM2: Intel: sof-hda-dsp: Fix handling of empty - sys_vendor - -The mistake in UCM syntax caused in alsaucm start error: - -ALSA lib ucm_cond.c:367:(if_eval) unknown If.Condition.Type - -Fixes: 13022a97711d ("sof-hda-dsp: Fix the case where sysfs dmi - sys_vendor attribute is not set") - -Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/463 -Signed-off-by: Seppo Ingalsuo -Signed-off-by: Jaroslav Kysela ---- - ucm2/Intel/sof-hda-dsp/HiFi-sof.conf | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/ucm2/Intel/sof-hda-dsp/HiFi-sof.conf b/ucm2/Intel/sof-hda-dsp/HiFi-sof.conf -index fea8159..c755ba2 100644 ---- a/ucm2/Intel/sof-hda-dsp/HiFi-sof.conf -+++ b/ucm2/Intel/sof-hda-dsp/HiFi-sof.conf -@@ -6,8 +6,8 @@ Define.SOFVendor "$${sys:devices/virtual/dmi/id/sys_vendor}" - - If.SOFVendor { - Condition { -- Type Empty -- String "${var:SOFVendor}" -+ Type String -+ Empty "${var:SOFVendor}" - } - True.Define.SOFVendor "${sys:devices/virtual/dmi/id/board_vendor}" - } --- -2.47.0 - - -From 6397c663d7086b87ca5cbba323ea3dcd0ecd3200 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 13 Nov 2024 16:19:15 +0100 -Subject: [PATCH 2/2] sof-hda-dsp: Fix the case where sysfs dmi product_name - attribute is not set - - !!DMI Information - !!--------------- - - Manufacturer: - Product Name: - Product Version: - Firmware Version: R6G07 - System SKU: Default string - Board Vendor: Default string - Board Name: Default string - -BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=2292583 -Signed-off-by: Jaroslav Kysela ---- - ucm2/Intel/sof-hda-dsp/HiFi-sof.conf | 11 ++++++++++- - 1 file changed, 10 insertions(+), 1 deletion(-) - -diff --git a/ucm2/Intel/sof-hda-dsp/HiFi-sof.conf b/ucm2/Intel/sof-hda-dsp/HiFi-sof.conf -index c755ba2..5fd1843 100644 ---- a/ucm2/Intel/sof-hda-dsp/HiFi-sof.conf -+++ b/ucm2/Intel/sof-hda-dsp/HiFi-sof.conf -@@ -3,6 +3,7 @@ - # File paths for controlling SOF processing - - Define.SOFVendor "$${sys:devices/virtual/dmi/id/sys_vendor}" -+Define.SOFProduct "$${sys:devices/virtual/dmi/id/product_name}" - - If.SOFVendor { - Condition { -@@ -12,6 +13,14 @@ If.SOFVendor { - True.Define.SOFVendor "${sys:devices/virtual/dmi/id/board_vendor}" - } - -+If.SOFProduct { -+ Condition { -+ Type String -+ Empty "${var:SOFProduct}" -+ } -+ True.Define.SOFProduct "${sys:devices/virtual/dmi/id/board_name}" -+} -+ - If.SOFIPCVer { - Condition { - Type ControlExists -@@ -43,7 +52,7 @@ If.SOFPath { - HeadphoneIirBlob "${var:BlobPath}/eq_iir/pass.blob" - HeadphoneFirBlob "${var:BlobPath}/eq_fir/pass.blob" - HeadphoneDrcBlob "${var:BlobPath}/drc/passthrough.blob" -- ConfPathFromDMI "${var:SOFVendor}/${sys:devices/virtual/dmi/id/product_name}.conf" -+ ConfPathFromDMI "${var:SOFVendor}/${var:SOFProduct}" - SOFProductConfig "/blobs/sof/product_configs/${var:ConfPathFromDMI}" - SOFConfFullPath "${ConfTopDir}${var:SOFProductConfig}" - SOFUserConfig "/blobs/sof/user_configs/${var:ConfPathFromDMI}" --- -2.47.0 - diff --git a/sources b/sources index e7b27b3..9e16b4d 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (alsa-lib-1.2.13.tar.bz2) = b0c0666e38e881dca985b61386523c045c71072a88be4952c986ffbe2107ec736da528858ebeffdf439de5c290914bf3facc654100a228c6d26fff9429142ef0 -SHA512 (alsa-ucm-conf-1.2.13.tar.bz2) = cad867268851ac178f3a5378a00e292184b0e0ec7955f297ae7ed56073d3dddb06c08666b23b1bf6b0065068a9370ee34608bd687763658c79d34b64059b1c85 +SHA512 (alsa-lib-1.2.14.tar.bz2) = af7c405f8e0dbe3b4420c3e414c6ab1b0abf7802d0b8b986ae2762ed11e1c8259eb7aa9101fadc4258da5997d94da2f6f7baeb254435c554c2e33fc1c9bb0eb7 +SHA512 (alsa-ucm-conf-1.2.14.tar.bz2) = a224e890919306bdcd606dfb873b089950c9fa89f24c02947692ee8ab1a05c419f2a8dc174440d17c8a9575cab293806630f2cb43d74677f7ef0d956b7883dc5 SHA512 (alsa-topology-conf-1.2.5.tar.bz2) = 2eb4d8baf2dcbf0b631dd11dbf15bffc51694d9cc6931619e51787f3ba58d1a091d266e6721a3b737c040ec74a28270b93f39fb97f30a3227cf340dd646e5d51 From ab1b5f63036d1bf38932aa87757c680e50855686 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 14 Apr 2025 18:52:51 +0200 Subject: [PATCH 109/120] use updated tar ball Signed-off-by: Jaroslav Kysela --- alsa-lib.spec | 4 ++-- sources | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 0fd0ae6..6b8b1a4 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 1%{?prever_dot}%{?dist} +Release: 2%{?prever_dot}%{?dist} License: LGPL-2.1-or-later URL: http://www.alsa-project.org/ @@ -167,7 +167,7 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog -* Mon Apr 14 2025 Jaroslav Kysela - 1.2.14-1 +* Mon Apr 14 2025 Jaroslav Kysela - 1.2.14-2 - update to 1.2.14 * Thu Jan 16 2025 Fedora Release Engineering - 1.2.13-4 diff --git a/sources b/sources index 9e16b4d..99910eb 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (alsa-lib-1.2.14.tar.bz2) = af7c405f8e0dbe3b4420c3e414c6ab1b0abf7802d0b8b986ae2762ed11e1c8259eb7aa9101fadc4258da5997d94da2f6f7baeb254435c554c2e33fc1c9bb0eb7 +SHA512 (alsa-lib-1.2.14.tar.bz2) = 2716cc3a2299da4a1a170d734af082d78dc452b253179d0f1a9ec190140734aecf002b6924eec4ff2699ce88ce1ae5c56821c267f36384910984db726d1f9626 SHA512 (alsa-ucm-conf-1.2.14.tar.bz2) = a224e890919306bdcd606dfb873b089950c9fa89f24c02947692ee8ab1a05c419f2a8dc174440d17c8a9575cab293806630f2cb43d74677f7ef0d956b7883dc5 SHA512 (alsa-topology-conf-1.2.5.tar.bz2) = 2eb4d8baf2dcbf0b631dd11dbf15bffc51694d9cc6931619e51787f3ba58d1a091d266e6721a3b737c040ec74a28270b93f39fb97f30a3227cf340dd646e5d51 From 9535a12c2cc5597418baa3baa4b3f8ca888734a5 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 24 Jun 2025 15:24:30 +0200 Subject: [PATCH 110/120] update alsa-ucm-conf files to latest Signed-off-by: Jaroslav Kysela --- alsa-git.patch | 31 + alsa-lib.spec | 13 +- alsa-ucm-conf.patch | 2374 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 2413 insertions(+), 5 deletions(-) create mode 100644 alsa-git.patch create mode 100644 alsa-ucm-conf.patch diff --git a/alsa-git.patch b/alsa-git.patch new file mode 100644 index 0000000..ded7dfb --- /dev/null +++ b/alsa-git.patch @@ -0,0 +1,31 @@ +From 07ec2ad34c42dba8656d3f543164f360f481c52e Mon Sep 17 00:00:00 2001 +From: Daniel Dadap +Date: Thu, 15 May 2025 08:32:35 -0500 +Subject: [PATCH] conf: aliases: add hda-acpi -> HDA-Intel alias + +The new snd_hda_acpi driver in Linux exposes the existing Azalia +interface to non-PCI devices advertised over ACPI. Add an alias +to the existing HDA-Intel configuration file so that devices using +this driver can be discovered properly. + +Signed-off-by: Daniel Dadap +Signed-off-by: Takashi Iwai +--- + src/conf/cards/aliases.conf | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/conf/cards/aliases.conf b/src/conf/cards/aliases.conf +index a54824ae..e2d59aa7 100644 +--- a/src/conf/cards/aliases.conf ++++ b/src/conf/cards/aliases.conf +@@ -57,6 +57,7 @@ CMI8786 cards.CMI8788 + CMI8787 cards.CMI8788 + pistachio cards.pistachio-card + VC4-HDMI cards.vc4-hdmi ++hda-acpi cards.HDA-Intel + + + +-- +2.49.0 + diff --git a/alsa-lib.spec b/alsa-lib.spec index 6b8b1a4..2e492b4 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 2%{?prever_dot}%{?dist} +Release: 3%{?prever_dot}%{?dist} License: LGPL-2.1-or-later URL: http://www.alsa-project.org/ @@ -19,8 +19,8 @@ Source2: ftp://ftp.alsa-project.org/pub/lib/alsa-topology-conf-%{version_alsa_t Source10: asound.conf Source11: modprobe-dist-alsa.conf Source12: modprobe-dist-oss.conf -#Source40: alsa-ucm-conf.patch -#Patch0: alsa-git.patch +Source40: alsa-ucm-conf.patch +Patch0: alsa-git.patch Patch1: alsa-lib-1.2.3.1-config.patch Patch2: alsa-lib-1.2.10-glibc-open.patch @@ -70,7 +70,7 @@ contains alsa-lib configuration of SoC topology %prep %setup -q -n %{name}-%{version}%{?prever}%{?postver} -#patch -P0 -p1 -b .alsa-git +%patch -P0 -p1 -b .alsa-git %patch -P1 -p1 -b .config %patch -P2 -p1 -b .glibc-open @@ -116,7 +116,7 @@ mkdir -p %{buildroot}/%{_datadir}/alsa/ucm2 # Unpack UCMs tar xvjf %{SOURCE1} -C %{buildroot}/%{_datadir}/alsa --strip-components=1 "*/ucm" "*/ucm2" -#patch -d %{buildroot}/%{_datadir}/alsa -p1 < %{SOURCE40} +patch -d %{buildroot}/%{_datadir}/alsa -p1 < %{SOURCE40} # Create topology directory mkdir -p %{buildroot}/%{_datadir}/alsa/topology @@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Tue Jan 24 2025 Jaroslav Kysela - 1.2.14-3 +- update to latest alsa-ucm-conf files + * Mon Apr 14 2025 Jaroslav Kysela - 1.2.14-2 - update to 1.2.14 diff --git a/alsa-ucm-conf.patch b/alsa-ucm-conf.patch new file mode 100644 index 0000000..917177c --- /dev/null +++ b/alsa-ucm-conf.patch @@ -0,0 +1,2374 @@ +From 25f519f66c3e496b21ca1ad83ebc6114dfaa9fc3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Maja=20K=C4=85dzio=C5=82ka?= +Date: Tue, 22 Apr 2025 07:46:21 +0200 +Subject: [PATCH 01/24] acp3x-alc5682-max98357: Fix path of HiFi.conf +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/551 +Closes: https://github.com/alsa-project/alsa-ucm-conf/issues/550 +Fixes: 1048796e7fa9 ("Rename ucm2/AMD/acp3xalc5682m98 to ucm2/AMD/acp3x-alc5682-max98357") +Signed-off-by: Maja Kądziołka +Signed-off-by: Jaroslav Kysela +--- + ucm2/AMD/acp3x-alc5682-max98357/acp3x-alc5682-max98357.conf | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ucm2/AMD/acp3x-alc5682-max98357/acp3x-alc5682-max98357.conf b/ucm2/AMD/acp3x-alc5682-max98357/acp3x-alc5682-max98357.conf +index e1f1c9e..5b3f24a 100644 +--- a/ucm2/AMD/acp3x-alc5682-max98357/acp3x-alc5682-max98357.conf ++++ b/ucm2/AMD/acp3x-alc5682-max98357/acp3x-alc5682-max98357.conf +@@ -66,7 +66,7 @@ If.found { + Empty "${var:Found}" + } + False.SectionUseCase."HiFi" { +- File "/AMD/acp3xalc5682m98/HiFi.conf" ++ File "HiFi.conf" + Comment "Default" + } + } +-- +2.49.0 + + +From ac64586ab4ad3a0f162af3ec8a196bfd3799c5c0 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 25 Apr 2025 11:47:20 +0200 +Subject: [PATCH 02/24] USB-Audio: Remove useless sections for Solid State Labs + SSL 2+ + +Signed-off-by: Jaroslav Kysela +--- + ucm2/USB-Audio/SolidStateLabs/SSL2Plus-HiFi.conf | 8 -------- + 1 file changed, 8 deletions(-) + +diff --git a/ucm2/USB-Audio/SolidStateLabs/SSL2Plus-HiFi.conf b/ucm2/USB-Audio/SolidStateLabs/SSL2Plus-HiFi.conf +index d07e499..94e040f 100644 +--- a/ucm2/USB-Audio/SolidStateLabs/SSL2Plus-HiFi.conf ++++ b/ucm2/USB-Audio/SolidStateLabs/SSL2Plus-HiFi.conf +@@ -28,14 +28,6 @@ Macro [ + SectionDevice."Line1" { + Comment "Line Outputs 1/L + 2/R" + +- EnableSequence [ +- cdev "hw:${CardId}" +- ] +- +- DisableSequence [ +- cdev "hw:${CardId}" +- ] +- + Value { + PlaybackPriority 200 + } +-- +2.49.0 + + +From fc17ed4f991836bb92f288b8714ad7efe6c05926 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 25 Apr 2025 11:53:11 +0200 +Subject: [PATCH 03/24] USB-Audio: Solid State Labs SSL 2+ - fix capture + channels + +It seems that there are 4 capture channels per report in issue #552: + + Capture: + Status: Stop + Interface 2 + Altset 1 + Format: S32_LE + Channels: 4 + Endpoint: 0x81 (1 IN) (ASYNC) + Rates: 44100, 48000, 88200, 96000, 176400, 192000 + Data packet interval: 125 us + Bits: 24 + Channel map: FL FR FC LFE + +Closes: https://github.com/alsa-project/alsa-ucm-conf/issues/552 +Signed-off-by: Jaroslav Kysela +--- + ucm2/USB-Audio/SolidStateLabs/SSL2Plus-HiFi.conf | 6 +++--- + ucm2/USB-Audio/SolidStateLabs/SSL2Plus.conf | 2 +- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/ucm2/USB-Audio/SolidStateLabs/SSL2Plus-HiFi.conf b/ucm2/USB-Audio/SolidStateLabs/SSL2Plus-HiFi.conf +index 94e040f..30160d3 100644 +--- a/ucm2/USB-Audio/SolidStateLabs/SSL2Plus-HiFi.conf ++++ b/ucm2/USB-Audio/SolidStateLabs/SSL2Plus-HiFi.conf +@@ -18,7 +18,7 @@ Macro [ + Name "ssl2plus_mono_in" + Direction Capture + Channels 1 +- HWChannels 2 ++ HWChannels 4 + HWChannelPos0 MONO + HWChannelPos1 MONO + } +@@ -70,7 +70,7 @@ SectionDevice."Mic1" { + Macro.pcm_split.SplitPCMDevice { + Name "ssl2plus_mono_in" + Direction Capture +- HWChannels 2 ++ HWChannels 4 + Channels 1 + Channel0 0 + ChannelPos0 MONO +@@ -86,7 +86,7 @@ SectionDevice."Mic2" { + Macro.pcm_split.SplitPCMDevice { + Name "ssl2plus_mono_in" + Direction Capture +- HWChannels 2 ++ HWChannels 4 + Channels 1 + Channel0 1 + ChannelPos0 MONO +diff --git a/ucm2/USB-Audio/SolidStateLabs/SSL2Plus.conf b/ucm2/USB-Audio/SolidStateLabs/SSL2Plus.conf +index 2ffe4c4..c886593 100644 +--- a/ucm2/USB-Audio/SolidStateLabs/SSL2Plus.conf ++++ b/ucm2/USB-Audio/SolidStateLabs/SSL2Plus.conf +@@ -6,6 +6,6 @@ SectionUseCase."HiFi" { + } + + Define.DirectPlaybackChannels 4 +-Define.DirectCaptureChannels 2 ++Define.DirectCaptureChannels 4 + + Include.dhw.File "/common/direct.conf" +-- +2.49.0 + + +From 6c2177e856ffa884929ba84de2ba379b80e054a3 Mon Sep 17 00:00:00 2001 +From: Konrad Dybcio +Date: Mon, 14 Apr 2025 20:47:38 +0200 +Subject: [PATCH 04/24] ucm2: Qualcomm: x1e80100: Also match DMI board name + +The Surface Laptop 7 only says "Microsoft Corporation" and "Surface" +in the board_vendor and product_family fields respectively. Add another +field to match on. + +Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/546 +Signed-off-by: Konrad Dybcio +Signed-off-by: Jaroslav Kysela +--- + ucm2/Qualcomm/x1e80100/x1e80100.conf | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ucm2/Qualcomm/x1e80100/x1e80100.conf b/ucm2/Qualcomm/x1e80100/x1e80100.conf +index 3f89986..3eef4d4 100644 +--- a/ucm2/Qualcomm/x1e80100/x1e80100.conf ++++ b/ucm2/Qualcomm/x1e80100/x1e80100.conf +@@ -1,6 +1,6 @@ + Syntax 4 + +-Define.DMI_info "${sys:devices/virtual/dmi/id/board_vendor}-${sys:devices/virtual/dmi/id/product_family}" ++Define.DMI_info "${sys:devices/virtual/dmi/id/board_vendor}-${sys:devices/virtual/dmi/id/product_family}-${sys:devices/virtual/dmi/id/board_name}" + + If.LENOVOT14s { + Condition { +-- +2.49.0 + + +From c93b7c8cc3137180cf1e91af2dd212bbf604b66f Mon Sep 17 00:00:00 2001 +From: Konrad Dybcio +Date: Mon, 14 Apr 2025 20:47:38 +0200 +Subject: [PATCH 05/24] ucm2: Qualcomm: Add Surface Laptop 7 + +2 speakers, 2 dmics, combo jack, just like the T14s - reuse its +configuration + +Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/546 +Signed-off-by: Konrad Dybcio +Signed-off-by: Jaroslav Kysela +--- + ucm2/Qualcomm/x1e80100/x1e80100.conf | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ucm2/Qualcomm/x1e80100/x1e80100.conf b/ucm2/Qualcomm/x1e80100/x1e80100.conf +index 3eef4d4..10faf5f 100644 +--- a/ucm2/Qualcomm/x1e80100/x1e80100.conf ++++ b/ucm2/Qualcomm/x1e80100/x1e80100.conf +@@ -6,7 +6,7 @@ If.LENOVOT14s { + Condition { + Type RegexMatch + String "${var:DMI_info}" +- Regex "LENOVO.*Think((Pad T14s Gen 6.*)|(Book 16 G7 QOY))|(HP.*Omnibook X.*)|(ASUSTeK COMPUTER.*ASUS Zenbook A14)" ++ Regex "LENOVO.*Think((Pad T14s Gen 6.*)|(Book 16 G7 QOY))|(HP.*Omnibook X.*)|(ASUSTeK COMPUTER.*ASUS Zenbook A14)|(Microsoft Corporation.*Surface.*Microsoft Surface Laptop, 7th Edition)" + } + True.Include.t14s.File "/Qualcomm/x1e80100/LENOVO-T14s.conf" + } +-- +2.49.0 + + +From 9105573b6cb71c4821d88e6eef0c4b2cfbb4ea61 Mon Sep 17 00:00:00 2001 +From: Svyatoslav Ryhel +Date: Sun, 27 Apr 2025 13:02:19 +0300 +Subject: [PATCH 06/24] tegra: max98089: fix cset names + +Adjust configs to match Linux kernel MAX98089 codec driver change. + +Fixes: 725570f9 ("ASoC: max98088: Remove duplicate DACs") + +Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/556 +Signed-off-by: Svyatoslav Ryhel +Signed-off-by: Jaroslav Kysela +--- + ucm2/Tegra/max98089/lge-x3-HiFi.conf | 24 +++++---------- + ucm2/Tegra/max98089/lge-x3-VoiceCall.conf | 36 ++++++++--------------- + ucm2/Tegra/max98089/lge-x3.conf | 6 ++-- + 3 files changed, 22 insertions(+), 44 deletions(-) + +diff --git a/ucm2/Tegra/max98089/lge-x3-HiFi.conf b/ucm2/Tegra/max98089/lge-x3-HiFi.conf +index 3738d72..d074b9f 100644 +--- a/ucm2/Tegra/max98089/lge-x3-HiFi.conf ++++ b/ucm2/Tegra/max98089/lge-x3-HiFi.conf +@@ -11,20 +11,16 @@ SectionDevice."Speaker" { + cset "name='Speaker Switch' on" + cset "name='Int Spk Switch' on" + +- cset "name='Left SPK Mixer Left DAC1 Switch' on" +- cset "name='Left SPK Mixer Left DAC2 Switch' on" +- cset "name='Left SPK Mixer Right DAC1 Switch' on" +- cset "name='Left SPK Mixer Right DAC2 Switch' on" ++ cset "name='Left SPK Mixer Left DAC Switch' on" ++ cset "name='Left SPK Mixer Right DAC Switch' on" + ] + + DisableSequence [ + cset "name='Speaker Switch' off" + cset "name='Int Spk Switch' off" + +- cset "name='Left SPK Mixer Left DAC1 Switch' off" +- cset "name='Left SPK Mixer Left DAC2 Switch' off" +- cset "name='Left SPK Mixer Right DAC1 Switch' off" +- cset "name='Left SPK Mixer Right DAC2 Switch' off" ++ cset "name='Left SPK Mixer Left DAC Switch' off" ++ cset "name='Left SPK Mixer Right DAC Switch' off" + ] + + Value { +@@ -46,19 +42,15 @@ SectionDevice."Headphones" { + EnableSequence [ + cset "name='Headphone Switch' on" + +- cset "name='Left HP Mixer Left DAC1 Switch' on" +- cset "name='Left HP Mixer Left DAC2 Switch' on" +- cset "name='Right HP Mixer Right DAC1 Switch' on" +- cset "name='Right HP Mixer Right DAC2 Switch' on" ++ cset "name='Left HP Mixer Left DAC Switch' on" ++ cset "name='Right HP Mixer Right DAC Switch' on" + ] + + DisableSequence [ + cset "name='Headphone Switch' off" + +- cset "name='Left HP Mixer Left DAC1 Switch' off" +- cset "name='Left HP Mixer Left DAC2 Switch' off" +- cset "name='Right HP Mixer Right DAC1 Switch' off" +- cset "name='Right HP Mixer Right DAC2 Switch' off" ++ cset "name='Left HP Mixer Left DAC Switch' off" ++ cset "name='Right HP Mixer Right DAC Switch' off" + ] + + Value { +diff --git a/ucm2/Tegra/max98089/lge-x3-VoiceCall.conf b/ucm2/Tegra/max98089/lge-x3-VoiceCall.conf +index 1634c7b..8e3a389 100644 +--- a/ucm2/Tegra/max98089/lge-x3-VoiceCall.conf ++++ b/ucm2/Tegra/max98089/lge-x3-VoiceCall.conf +@@ -11,20 +11,16 @@ SectionDevice."Speaker" { + cset "name='Speaker Switch' on" + cset "name='Int Spk Switch' on" + +- cset "name='Left SPK Mixer Left DAC1 Switch' on" +- cset "name='Left SPK Mixer Left DAC2 Switch' on" +- cset "name='Left SPK Mixer Right DAC1 Switch' on" +- cset "name='Left SPK Mixer Right DAC2 Switch' on" ++ cset "name='Left SPK Mixer Left DAC Switch' on" ++ cset "name='Left SPK Mixer Right DAC Switch' on" + ] + + DisableSequence [ + cset "name='Speaker Switch' off" + cset "name='Int Spk Switch' off" + +- cset "name='Left SPK Mixer Left DAC1 Switch' off" +- cset "name='Left SPK Mixer Left DAC2 Switch' off" +- cset "name='Left SPK Mixer Right DAC1 Switch' off" +- cset "name='Left SPK Mixer Right DAC2 Switch' off" ++ cset "name='Left SPK Mixer Left DAC Switch' off" ++ cset "name='Left SPK Mixer Right DAC Switch' off" + ] + + Value { +@@ -47,30 +43,22 @@ SectionDevice."Earpiece" { + cset "name='Receiver Switch' on" + cset "name='Earpiece Switch' on" + +- cset "name='Left REC Mixer Left DAC1 Switch' on" +- cset "name='Left REC Mixer Left DAC2 Switch' on" +- cset "name='Left REC Mixer Right DAC1 Switch' on" +- cset "name='Left REC Mixer Right DAC2 Switch' on" ++ cset "name='Left REC Mixer Left DAC Switch' on" ++ cset "name='Left REC Mixer Right DAC Switch' on" + +- cset "name='Right REC Mixer Left DAC1 Switch' on" +- cset "name='Right REC Mixer Left DAC2 Switch' on" +- cset "name='Right REC Mixer Right DAC1 Switch' on" +- cset "name='Right REC Mixer Right DAC2 Switch' on" ++ cset "name='Right REC Mixer Left DAC Switch' on" ++ cset "name='Right REC Mixer Right DAC Switch' on" + ] + + DisableSequence [ + cset "name='Receiver Switch' off" + cset "name='Earpiece Switch' off" + +- cset "name='Left REC Mixer Left DAC1 Switch' off" +- cset "name='Left REC Mixer Left DAC2 Switch' off" +- cset "name='Left REC Mixer Right DAC1 Switch' off" +- cset "name='Left REC Mixer Right DAC2 Switch' off" ++ cset "name='Left REC Mixer Left DAC Switch' off" ++ cset "name='Left REC Mixer Right DAC Switch' off" + +- cset "name='Right REC Mixer Left DAC1 Switch' off" +- cset "name='Right REC Mixer Left DAC2 Switch' off" +- cset "name='Right REC Mixer Right DAC1 Switch' off" +- cset "name='Right REC Mixer Right DAC2 Switch' off" ++ cset "name='Right REC Mixer Left DAC Switch' off" ++ cset "name='Right REC Mixer Right DAC Switch' off" + ] + + Value { +diff --git a/ucm2/Tegra/max98089/lge-x3.conf b/ucm2/Tegra/max98089/lge-x3.conf +index 9bea0cc..c90c4a1 100644 +--- a/ucm2/Tegra/max98089/lge-x3.conf ++++ b/ucm2/Tegra/max98089/lge-x3.conf +@@ -30,10 +30,8 @@ BootSequence [ + cset "name='Internal Mic 2 Switch' off" + cset "name='Mic Jack Switch' off" + +- cset "name='Right SPK Mixer Left DAC1 Switch' on" +- cset "name='Right SPK Mixer Left DAC2 Switch' on" +- cset "name='Right SPK Mixer Right DAC1 Switch' on" +- cset "name='Right SPK Mixer Right DAC2 Switch' on" ++ cset "name='Right SPK Mixer Left DAC Switch' on" ++ cset "name='Right SPK Mixer Right DAC Switch' on" + ] + + SectionUseCase."HiFi" { +-- +2.49.0 + + +From a1edaee761d301f7d010124599fd9f82c34fc7db Mon Sep 17 00:00:00 2001 +From: Markus Parviainen +Date: Sun, 27 Apr 2025 20:20:42 +0300 +Subject: [PATCH 07/24] Fix Presonus Revelator IO44 HWChannels count + +Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/557 +Signed-off-by: Markus Parviainen +Signed-off-by: Jaroslav Kysela +--- + ucm2/USB-Audio/Presonus/Revelator-IO-44-HiFi.conf | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/ucm2/USB-Audio/Presonus/Revelator-IO-44-HiFi.conf b/ucm2/USB-Audio/Presonus/Revelator-IO-44-HiFi.conf +index f223e08..6439613 100644 +--- a/ucm2/USB-Audio/Presonus/Revelator-IO-44-HiFi.conf ++++ b/ucm2/USB-Audio/Presonus/Revelator-IO-44-HiFi.conf +@@ -59,7 +59,7 @@ SectionDevice."Line1" { + Macro.pcm_split.SplitPCMDevice { + Name "revelator_stereo_out" + Direction Playback +- HWChannels 2 ++ HWChannels 6 + Channels 2 + Channel0 0 + Channel1 1 +@@ -78,7 +78,7 @@ SectionDevice."Line2" { + Macro.pcm_split.SplitPCMDevice { + Name "revelator_stereo_out" + Direction Playback +- HWChannels 2 ++ HWChannels 6 + Channels 2 + Channel0 2 + Channel1 3 +@@ -97,7 +97,7 @@ SectionDevice."Line3" { + Macro.pcm_split.SplitPCMDevice { + Name "revelator_stereo_out" + Direction Playback +- HWChannels 2 ++ HWChannels 6 + Channels 2 + Channel0 4 + Channel1 5 +-- +2.49.0 + + +From aa25928dd03299afc9bff994f06c37fc700bb8c0 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Thu, 15 May 2025 15:06:56 +0200 +Subject: [PATCH 08/24] ucm2: Qualcomm: sc8280xp: fix internal microphones + device + +A recent change renamed the internal microphones device from "DMic01" to +"Mic", but the latter name is already used by the headset microphone so +this breaks the internal microphones on the Lenovo ThinkPad X13s. + +Rename the headset microphone device so that the names are unique and +fix up the jack hw mute property which is still using the old name. + +Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/563 +Fixes: ea7a065a7b50 ("ucm: fix SectionDevice identifiers") +Signed-off-by: Johan Hovold +Signed-off-by: Jaroslav Kysela +--- + ucm2/Qualcomm/sc8280xp/HiFi.conf | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/ucm2/Qualcomm/sc8280xp/HiFi.conf b/ucm2/Qualcomm/sc8280xp/HiFi.conf +index e20aa9c..916f1ee 100644 +--- a/ucm2/Qualcomm/sc8280xp/HiFi.conf ++++ b/ucm2/Qualcomm/sc8280xp/HiFi.conf +@@ -50,8 +50,8 @@ SectionDevice."Headphones" { + } + } + +-SectionDevice."Mic" { +- Comment "Mic" ++SectionDevice."Headset" { ++ Comment "Headset microphone" + + Include.wcdmice.File "/codecs/wcd938x/HeadphoneMicEnableSeq.conf" + Include.wcdmicd.File "/codecs/wcd938x/HeadphoneMicDisableSeq.conf" +@@ -63,12 +63,12 @@ SectionDevice."Mic" { + CapturePCM "hw:${CardId},2" + CaptureMixerElem "ADC2" + JackControl "Mic Jack" +- JackHWMute "DMic01" ++ JackHWMute "Mic" + } + } + + SectionDevice."Mic" { +- Comment "Microphone" ++ Comment "Internal microphones" + + Include.vadm0e.File "/codecs/qcom-lpass/va-macro/DMIC0EnableSeq.conf" + Include.vadm0d.File "/codecs/qcom-lpass/va-macro/DMIC0DisableSeq.conf" +-- +2.49.0 + + +From 88e1cd78633ea0ad46115ffe8779140fa91fd2f5 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Thu, 15 May 2025 15:14:53 +0200 +Subject: [PATCH 09/24] ucm2: Qualcomm: sm8650: QRD: fix headset jack hw mute + +A recent change renamed the internal microphone devices but failed to +update the headset jack hw mute properties that are still using the old +names. + +Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/563 +Fixes: ea7a065a7b50 ("ucm: fix SectionDevice identifiers") +Signed-off-by: Johan Hovold +Signed-off-by: Jaroslav Kysela +--- + ucm2/Qualcomm/sm8650/QRD/HiFi.conf | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/ucm2/Qualcomm/sm8650/QRD/HiFi.conf b/ucm2/Qualcomm/sm8650/QRD/HiFi.conf +index 4336525..ca40c29 100644 +--- a/ucm2/Qualcomm/sm8650/QRD/HiFi.conf ++++ b/ucm2/Qualcomm/sm8650/QRD/HiFi.conf +@@ -77,8 +77,8 @@ SectionDevice."Headset" { + CapturePCM "hw:${CardId},2" + CaptureMixerElem "ADC2" + JackControl "Mic Jack" +- JackHWMute "Bottom" +- JackHWMute "Back" ++ JackHWMute "Mic1" ++ JackHWMute "Mic2" + } + } + +-- +2.49.0 + + +From bab88e0c31cee1c2603428c2ce6444aea343b646 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Thu, 15 May 2025 15:17:02 +0200 +Subject: [PATCH 10/24] ucm2: tegra: max98090: fix headphones conflicting + device + +A recent change renames the speaker device but failed to update the +headphones conflicting device list. + +Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/563 +Fixes: ea7a065a7b50 ("ucm: fix SectionDevice identifiers") +Signed-off-by: Johan Hovold +Signed-off-by: Jaroslav Kysela +--- + ucm2/Tegra/max98090/HiFi.conf | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ucm2/Tegra/max98090/HiFi.conf b/ucm2/Tegra/max98090/HiFi.conf +index d6e4e9d..5d4ef71 100644 +--- a/ucm2/Tegra/max98090/HiFi.conf ++++ b/ucm2/Tegra/max98090/HiFi.conf +@@ -33,7 +33,7 @@ SectionDevice."Headphones" { + Comment = "Headphones" + + ConflictingDevice [ +- "Speakers" ++ "Speaker" + ] + + EnableSequence [ +-- +2.49.0 + + +From 24d62b54d5ad6c7e6f9cff4cedcc334b1c98602f Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Thu, 15 May 2025 15:19:01 +0200 +Subject: [PATCH 11/24] ucm2: USB-Audio: Behringer: Flow8: fix conflicting + devices + +A recent change renamed the Line-56 and Line-78 devices but failed to +update the conflicting device lists. + +Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/563 +Fixes: ea7a065a7b50 ("ucm: fix SectionDevice identifiers") +Signed-off-by: Johan Hovold +Signed-off-by: Jaroslav Kysela +--- + ucm2/USB-Audio/Behringer/Flow8-Recording-Hifi.conf | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/ucm2/USB-Audio/Behringer/Flow8-Recording-Hifi.conf b/ucm2/USB-Audio/Behringer/Flow8-Recording-Hifi.conf +index 5dce19c..8ce7590 100644 +--- a/ucm2/USB-Audio/Behringer/Flow8-Recording-Hifi.conf ++++ b/ucm2/USB-Audio/Behringer/Flow8-Recording-Hifi.conf +@@ -157,7 +157,7 @@ SectionDevice."Line5" { + Comment "Line/Inst 5 (L)" + + ConflictingDevice [ +- "Line56" ++ "Line9" + ] + + Value { +@@ -177,7 +177,7 @@ SectionDevice."Line6" { + Comment "Line/Inst(HiZ) 6 (R)" + + ConflictingDevice [ +- "Line56" ++ "Line9" + ] + + Value { +@@ -197,7 +197,7 @@ SectionDevice."Line7" { + Comment "Line/Inst 7 (L)" + + ConflictingDevice [ +- "Line78" ++ "Line10" + ] + + Value { +@@ -217,7 +217,7 @@ SectionDevice."Line8" { + Comment "Line/Inst(HiZ) 8 (R)" + + ConflictingDevice [ +- "Line78" ++ "Line10" + ] + + Value { +-- +2.49.0 + + +From 1f816194a9feb2ce0c973ccc2a93551a6f641d77 Mon Sep 17 00:00:00 2001 +From: Hiago De Franco +Date: Mon, 12 May 2025 13:57:32 -0300 +Subject: [PATCH 12/24] ucm2: IO-Boards: Toradex: smarc: add support + +Add support for Toradex SMARC Development board, using the WM8904 audio +codec. + +This is a carrier board for the Toradex SMARC family, where any SMARC +SoM can be connected to it, therefore this is being added to the +IO-Boards instead of a specific hardware vendor. + +Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/562 +Signed-off-by: Hiago De Franco +Signed-off-by: Jaroslav Kysela +--- + ucm2/IO-Boards/Toradex/smarc/dev-HiFi.conf | 39 +++++++++++++++++++ + ucm2/IO-Boards/Toradex/smarc/dev.conf | 17 ++++++++ + ucm2/conf.d/simple-card/tdx-smarc-wm8904.conf | 1 + + 3 files changed, 57 insertions(+) + create mode 100644 ucm2/IO-Boards/Toradex/smarc/dev-HiFi.conf + create mode 100644 ucm2/IO-Boards/Toradex/smarc/dev.conf + create mode 120000 ucm2/conf.d/simple-card/tdx-smarc-wm8904.conf + +diff --git a/ucm2/IO-Boards/Toradex/smarc/dev-HiFi.conf b/ucm2/IO-Boards/Toradex/smarc/dev-HiFi.conf +new file mode 100644 +index 0000000..7d2dffc +--- /dev/null ++++ b/ucm2/IO-Boards/Toradex/smarc/dev-HiFi.conf +@@ -0,0 +1,39 @@ ++# Use case configuration for Toradex SMARC Development Carrier Board ++# This is a carrier board for the Toradex SMARC family, where any Toradex SMARC ++# SoM (with different SoCs as iMX8MP, iMX95...) can be connected to it. ++ ++SectionDevice."Headphones" { ++ Comment "Headphones" ++ ++ EnableSequence [ ++ cset "name='Headphone Switch' on" ++ ] ++ ++ DisableSequence [ ++ cset "name='Headphone Switch' off" ++ ] ++ ++ Value { ++ PlaybackPCM "hw:${CardId}" ++ PlaybackVolume "Headphone Volume" ++ PlaybackSwitch "Headphone Switch" ++ } ++} ++ ++SectionDevice."Mic" { ++ Comment "Microphone" ++ ++ EnableSequence [ ++ cset "name='Capture Switch' on" ++ ] ++ ++ DisableSequence [ ++ cset "name='Capture Switch' off" ++ ] ++ ++ Value { ++ CapturePCM "hw:${CardId}" ++ CaptureVolume "Capture Volume" ++ CaptureSwitch "Capture Switch" ++ } ++} +diff --git a/ucm2/IO-Boards/Toradex/smarc/dev.conf b/ucm2/IO-Boards/Toradex/smarc/dev.conf +new file mode 100644 +index 0000000..e795068 +--- /dev/null ++++ b/ucm2/IO-Boards/Toradex/smarc/dev.conf +@@ -0,0 +1,17 @@ ++# Use case configuration for Toradex SMARC Development Carrier Board ++# This is a carrier board for the Toradex SMARC family, where any Toradex SMARC ++# SoM (with different SoCs as iMX8MP, iMX95...) can be connected to it. ++ ++Syntax 4 ++ ++SectionUseCase."HiFi" { ++ File "/IO-Boards/Toradex/smarc/dev-HiFi.conf" ++ Comment "Default" ++} ++ ++BootSequence [ ++ cset "name='Headphone Volume' 50%" ++ cset "name='Left Capture Inverting Mux' 'IN1L'" ++ cset "name='Right Capture Inverting Mux' 'IN1R'" ++ cset "name='Capture Volume' 31" ++] +diff --git a/ucm2/conf.d/simple-card/tdx-smarc-wm8904.conf b/ucm2/conf.d/simple-card/tdx-smarc-wm8904.conf +new file mode 120000 +index 0000000..096f833 +--- /dev/null ++++ b/ucm2/conf.d/simple-card/tdx-smarc-wm8904.conf +@@ -0,0 +1 @@ ++../../IO-Boards/Toradex/smarc/dev.conf +\ No newline at end of file +-- +2.49.0 + + +From ac918f9b606f6bfe102c449997a1bcab01934db0 Mon Sep 17 00:00:00 2001 +From: Flo +Date: Sat, 24 May 2025 11:52:12 +0200 +Subject: [PATCH 13/24] USB-Audio: Solid State Labs SSL 2 - fix capture + channels + +Same fix as for SSL+, commit fc17ed4. +Capture configuration is the same, with 4 channels. + + Capture: + Status: Stop + Interface 2 + Altset 1 + Format: S32_LE + Channels: 4 + Endpoint: 0x81 (1 IN) (ASYNC) + Rates: 44100, 48000, 88200, 96000, 176400, 192000 + Data packet interval: 125 us + Bits: 24 + Channel map: FL FR FC LFE + +Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/566 +Signed-off-by: Flo +Signed-off-by: Jaroslav Kysela +--- + ucm2/USB-Audio/SolidStateLabs/SSL2-HiFi.conf | 6 +++--- + ucm2/USB-Audio/SolidStateLabs/SSL2.conf | 2 +- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/ucm2/USB-Audio/SolidStateLabs/SSL2-HiFi.conf b/ucm2/USB-Audio/SolidStateLabs/SSL2-HiFi.conf +index 46b2e26..8663384 100644 +--- a/ucm2/USB-Audio/SolidStateLabs/SSL2-HiFi.conf ++++ b/ucm2/USB-Audio/SolidStateLabs/SSL2-HiFi.conf +@@ -6,7 +6,7 @@ Macro [ + Name "ssl2_mono_in" + Direction Capture + Channels 1 +- HWChannels 2 ++ HWChannels 4 + HWChannelPos0 MONO + HWChannelPos1 MONO + } +@@ -31,7 +31,7 @@ SectionDevice."Mic1" { + Macro.pcm_split.SplitPCMDevice { + Name "ssl2_mono_in" + Direction Capture +- HWChannels 2 ++ HWChannels 4 + Channels 1 + Channel0 0 + ChannelPos0 MONO +@@ -47,7 +47,7 @@ SectionDevice."Mic2" { + Macro.pcm_split.SplitPCMDevice { + Name "ssl2_mono_in" + Direction Capture +- HWChannels 2 ++ HWChannels 4 + Channels 1 + Channel0 1 + ChannelPos0 MONO +diff --git a/ucm2/USB-Audio/SolidStateLabs/SSL2.conf b/ucm2/USB-Audio/SolidStateLabs/SSL2.conf +index 5531834..3cdb60b 100644 +--- a/ucm2/USB-Audio/SolidStateLabs/SSL2.conf ++++ b/ucm2/USB-Audio/SolidStateLabs/SSL2.conf +@@ -6,6 +6,6 @@ SectionUseCase."HiFi" { + } + + Define.DirectPlaybackChannels 2 +-Define.DirectCaptureChannels 2 ++Define.DirectCaptureChannels 4 + + Include.dhw.File "/common/direct.conf" +-- +2.49.0 + + +From 421e37bae75efc1fc134fbc84bc301f041aaff3b Mon Sep 17 00:00:00 2001 +From: Craig McLure +Date: Tue, 6 May 2025 18:40:47 +0100 +Subject: [PATCH 14/24] USB-Audio: Added Beacn Mic and Studio Support + +Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/558 +Signed-off-by: Craig McLure +Signed-off-by: Jaroslav Kysela +--- + ucm2/USB-Audio/Beacn/Beacn-Mic-HiFi.conf | 63 ++++++ + ucm2/USB-Audio/Beacn/Beacn-Mic.conf | 11 ++ + .../Beacn/Beacn-Studio-USB1-Channels.conf | 41 ++++ + .../Beacn/Beacn-Studio-USB1-HiFi.conf | 35 ++++ + .../Beacn/Beacn-Studio-USB1-Link-HiFi.conf | 179 ++++++++++++++++++ + .../Beacn/Beacn-Studio-USB2-HiFi.conf | 175 +++++++++++++++++ + ucm2/USB-Audio/Beacn/Beacn-Studio.conf | 42 ++++ + ucm2/USB-Audio/USB-Audio.conf | 16 ++ + 8 files changed, 562 insertions(+) + create mode 100644 ucm2/USB-Audio/Beacn/Beacn-Mic-HiFi.conf + create mode 100644 ucm2/USB-Audio/Beacn/Beacn-Mic.conf + create mode 100644 ucm2/USB-Audio/Beacn/Beacn-Studio-USB1-Channels.conf + create mode 100644 ucm2/USB-Audio/Beacn/Beacn-Studio-USB1-HiFi.conf + create mode 100644 ucm2/USB-Audio/Beacn/Beacn-Studio-USB1-Link-HiFi.conf + create mode 100644 ucm2/USB-Audio/Beacn/Beacn-Studio-USB2-HiFi.conf + create mode 100644 ucm2/USB-Audio/Beacn/Beacn-Studio.conf + +diff --git a/ucm2/USB-Audio/Beacn/Beacn-Mic-HiFi.conf b/ucm2/USB-Audio/Beacn/Beacn-Mic-HiFi.conf +new file mode 100644 +index 0000000..2445531 +--- /dev/null ++++ b/ucm2/USB-Audio/Beacn/Beacn-Mic-HiFi.conf +@@ -0,0 +1,63 @@ ++Include.pcm_split.File "/common/pcm/split.conf" ++ ++Macro [ ++ { ++ SplitPCM { ++ Name "beacn_mic_stereo_out" ++ Direction Playback ++ Channels 2 ++ HWChannels 3 ++ HWChannelPos0 FL ++ HWChannelPos1 FR ++ HWChannelPos2 MONO ++ } ++ } ++ { ++ SplitPCM { ++ Name "beacn_mic_stereo_in" ++ Direction Capture ++ Channels 2 ++ HWChannels 4 ++ HWChannelPos0 FL ++ HWChannelPos1 FR ++ HWChannelPos2 MONO # Dry Mic ++ HWChannelPos3 MONO # Dry + Expander ++ } ++ } ++] ++ ++SectionDevice."Headphones" { ++ Comment "Headphones" ++ ++ Value { ++ PlaybackPriority 200 ++ } ++ Macro.pcm_split.SplitPCMDevice { ++ Name "beacn_mic_stereo_out" ++ Direction Playback ++ HWChannels 3 ++ Channels 2 ++ Channel0 0 ++ Channel1 1 ++ ChannelPos0 FL ++ ChannelPos1 FR ++ } ++} ++ ++SectionDevice."Mic" { ++ Comment "Microphone" ++ ++ Value { ++ CapturePriority 200 ++ } ++ Macro.pcm_split.SplitPCMDevice { ++ Name "beacn_mic_stereo_in" ++ Direction Capture ++ HWChannels 4 ++ Channels 2 ++ Channel0 0 ++ Channel1 1 ++ ChannelPos0 FL ++ ChannelPos1 FR ++ } ++} +diff --git a/ucm2/USB-Audio/Beacn/Beacn-Mic.conf b/ucm2/USB-Audio/Beacn/Beacn-Mic.conf +new file mode 100644 +index 0000000..95c6f81 +--- /dev/null ++++ b/ucm2/USB-Audio/Beacn/Beacn-Mic.conf +@@ -0,0 +1,11 @@ ++Comment "Beacn Mic USB" ++ ++SectionUseCase."HiFi" { ++ Comment "Default Alsa Profile" ++ File "/USB-Audio/Beacn/Beacn-Mic-HiFi.conf" ++} ++ ++Define.DirectPlaybackChannels 3 ++Define.DirectCaptureChannels 4 ++ ++Include.dhw.File "/common/direct.conf" +diff --git a/ucm2/USB-Audio/Beacn/Beacn-Studio-USB1-Channels.conf b/ucm2/USB-Audio/Beacn/Beacn-Studio-USB1-Channels.conf +new file mode 100644 +index 0000000..b9886f4 +--- /dev/null ++++ b/ucm2/USB-Audio/Beacn/Beacn-Studio-USB1-Channels.conf +@@ -0,0 +1,41 @@ ++Include.pcm_split.File "/common/pcm/split.conf" ++ ++Macro.playback.SplitPCM { ++ Name "beacn_studio_stereo_out" ++ Direction Playback ++ Channels 2 ++ HWChannels 11 ++ HWChannelPos0 FL # Headphone Left ++ HWChannelPos1 FR # Headphone Right ++ HWChannelPos2 MONO # Unused Channel ++ HWChannelPos3 FL # Link 1 Out Left ++ HWChannelPos4 FR # Link 1 Out Right ++ HWChannelPos5 FL # Link 2 Out Left ++ HWChannelPos6 FR # Link 2 Out Right ++ HWChannelPos7 FL # Link 3 Out Left ++ HWChannelPos8 FR # Link 3 Out Right ++ HWChannelPos9 FL # Link 4 Out Left ++ HWChannelPos10 FR # Link 4 Out Right ++} ++ ++Macro.capture.SplitPCM { ++ Name "beacn_studio_stereo_in" ++ Direction Capture ++ Channels 2 ++ HWChannels 12 ++ ++ HWChannelPos0 FL # Microphone Left ++ HWChannelPos1 FR # Microphone Right ++ ++ HWChannelPos2 MONO # UNKNOWN (Possible Dry Mic) ++ HWChannelPos3 MONO # UNKNOWN (Possible Dry + Expander) ++ ++ HWChannelPos4 FL # Link 1 In Left ++ HWChannelPos5 FR # Link 1 In Right ++ HWChannelPos6 FL # Link 2 In Left ++ HWChannelPos7 FR # Link 2 In Right ++ HWChannelPos8 FL # Link 3 In Left ++ HWChannelPos9 FR # Link 3 In Right ++ HWChannelPos10 FL # Link 4 In Left ++ HWChannelPos11 FR # Link 4 In Right ++} +diff --git a/ucm2/USB-Audio/Beacn/Beacn-Studio-USB1-HiFi.conf b/ucm2/USB-Audio/Beacn/Beacn-Studio-USB1-HiFi.conf +new file mode 100644 +index 0000000..8c90d5b +--- /dev/null ++++ b/ucm2/USB-Audio/Beacn/Beacn-Studio-USB1-HiFi.conf +@@ -0,0 +1,35 @@ ++SectionDevice."Headphones" { ++ Comment "Headphones" ++ ++ Value { ++ PlaybackPriority 100 ++ } ++ Macro.pcm_split.SplitPCMDevice { ++ Name "beacn_studio_stereo_out" ++ Direction Playback ++ HWChannels 11 ++ Channels 2 ++ Channel0 0 ++ Channel1 1 ++ ChannelPos0 FL ++ ChannelPos1 FR ++ } ++} ++ ++SectionDevice."Mic" { ++ Comment "Microphone" ++ ++ Value { ++ CapturePriority 100 ++ } ++ Macro.pcm_split.SplitPCMDevice { ++ Name "beacn_studio_stereo_in" ++ Direction Capture ++ HWChannels 12 ++ Channels 2 ++ Channel0 0 ++ Channel1 1 ++ ChannelPos0 FL ++ ChannelPos1 FR ++ } ++} +diff --git a/ucm2/USB-Audio/Beacn/Beacn-Studio-USB1-Link-HiFi.conf b/ucm2/USB-Audio/Beacn/Beacn-Studio-USB1-Link-HiFi.conf +new file mode 100644 +index 0000000..74ff142 +--- /dev/null ++++ b/ucm2/USB-Audio/Beacn/Beacn-Studio-USB1-Link-HiFi.conf +@@ -0,0 +1,179 @@ ++SectionDevice."Line1" { ++ Comment "Link 4" ++ ++ Value { ++ PlaybackPriority 400 ++ } ++ Macro.pcm_split.SplitPCMDevice { ++ Name "beacn_studio_stereo_out" ++ Direction Playback ++ HWChannels 11 ++ Channels 2 ++ Channel0 9 ++ Channel1 10 ++ ChannelPos0 FL ++ ChannelPos1 FR ++ } ++} ++ ++SectionDevice."Line2" { ++ Comment "Link 3" ++ ++ Value { ++ PlaybackPriority 400 ++ } ++ Macro.pcm_split.SplitPCMDevice { ++ Name "beacn_studio_stereo_out" ++ Direction Playback ++ HWChannels 11 ++ Channels 2 ++ Channel0 7 ++ Channel1 8 ++ ChannelPos0 FL ++ ChannelPos1 FR ++ } ++} ++ ++SectionDevice."Line3" { ++ Comment "Link 2" ++ ++ Value { ++ PlaybackPriority 400 ++ } ++ Macro.pcm_split.SplitPCMDevice { ++ Name "beacn_studio_stereo_out" ++ Direction Playback ++ HWChannels 11 ++ Channels 2 ++ Channel0 5 ++ Channel1 6 ++ ChannelPos0 FL ++ ChannelPos1 FR ++ } ++} ++ ++SectionDevice."Line4" { ++ Comment "Link 1" ++ ++ Value { ++ PlaybackPriority 400 ++ } ++ Macro.pcm_split.SplitPCMDevice { ++ Name "beacn_studio_stereo_out" ++ Direction Playback ++ HWChannels 11 ++ Channels 2 ++ Channel0 3 ++ Channel1 4 ++ ChannelPos0 FL ++ ChannelPos1 FR ++ } ++} ++ ++SectionDevice."Headphones" { ++ Comment "Headphones" ++ ++ Value { ++ PlaybackPriority 100 ++ } ++ Macro.pcm_split.SplitPCMDevice { ++ Name "beacn_studio_stereo_out" ++ Direction Playback ++ HWChannels 11 ++ Channels 2 ++ Channel0 0 ++ Channel1 1 ++ ChannelPos0 FL ++ ChannelPos1 FR ++ } ++} ++ ++SectionDevice."Line5" { ++ Comment "Link 4" ++ ++ Value { ++ PlaybackPriority 400 ++ } ++ Macro.pcm_split.SplitPCMDevice { ++ Name "beacn_studio_stereo_in" ++ Direction Capture ++ HWChannels 12 ++ Channels 2 ++ Channel0 10 ++ Channel1 11 ++ ChannelPos0 FL ++ ChannelPos1 FR ++ } ++} ++ ++SectionDevice."Line6" { ++ Comment "Link 3" ++ ++ Value { ++ PlaybackPriority 400 ++ } ++ Macro.pcm_split.SplitPCMDevice { ++ Name "beacn_studio_stereo_in" ++ Direction Capture ++ HWChannels 12 ++ Channels 2 ++ Channel0 8 ++ Channel1 9 ++ ChannelPos0 FL ++ ChannelPos1 FR ++ } ++} ++ ++SectionDevice."Line7" { ++ Comment "Link 2" ++ ++ Value { ++ PlaybackPriority 400 ++ } ++ Macro.pcm_split.SplitPCMDevice { ++ Name "beacn_studio_stereo_in" ++ Direction Capture ++ HWChannels 12 ++ Channels 2 ++ Channel0 6 ++ Channel1 7 ++ ChannelPos0 FL ++ ChannelPos1 FR ++ } ++} ++ ++SectionDevice."Line8" { ++ Comment "Link 1" ++ ++ Value { ++ PlaybackPriority 400 ++ } ++ Macro.pcm_split.SplitPCMDevice { ++ Name "beacn_studio_stereo_in" ++ Direction Capture ++ HWChannels 12 ++ Channels 2 ++ Channel0 4 ++ Channel1 5 ++ ChannelPos0 FL ++ ChannelPos1 FR ++ } ++} ++ ++SectionDevice."Mic" { ++ Comment "Microphone" ++ ++ Value { ++ CapturePriority 100 ++ } ++ Macro.pcm_split.SplitPCMDevice { ++ Name "beacn_studio_stereo_in" ++ Direction Capture ++ HWChannels 12 ++ Channels 2 ++ Channel0 0 ++ Channel1 1 ++ ChannelPos0 FL ++ ChannelPos1 FR ++ } ++} +diff --git a/ucm2/USB-Audio/Beacn/Beacn-Studio-USB2-HiFi.conf b/ucm2/USB-Audio/Beacn/Beacn-Studio-USB2-HiFi.conf +new file mode 100644 +index 0000000..5988d41 +--- /dev/null ++++ b/ucm2/USB-Audio/Beacn/Beacn-Studio-USB2-HiFi.conf +@@ -0,0 +1,175 @@ ++Include.pcm_split.File "/common/pcm/split.conf" ++ ++Macro.playback.SplitPCM { ++ Name "beacn_studio_stereo_out" ++ Direction Playback ++ Channels 2 ++ HWChannels 8 ++ HWChannelPos0 FL ++ HWChannelPos1 FR ++ HWChannelPos2 FL ++ HWChannelPos3 FR ++ HWChannelPos4 FL ++ HWChannelPos5 FR ++ HWChannelPos6 FL ++ HWChannelPos7 FR ++} ++ ++Macro.capture.SplitPCM { ++ Name "beacn_studio_stereo_in" ++ Direction Capture ++ Channels 2 ++ HWChannels 8 ++ HWChannelPos0 FL ++ HWChannelPos1 FR ++ HWChannelPos2 FL ++ HWChannelPos3 FR ++ HWChannelPos4 FL ++ HWChannelPos5 FR ++ HWChannelPos6 FL ++ HWChannelPos7 FR ++} ++ ++SectionDevice."Line1" { ++ Comment "Link 4" ++ ++ Value { ++ PlaybackPriority 400 ++ } ++ Macro.pcm_split.SplitPCMDevice { ++ Name "beacn_studio_stereo_out" ++ Direction Playback ++ HWChannels 8 ++ Channels 2 ++ Channel0 6 ++ Channel1 7 ++ ChannelPos0 FL ++ ChannelPos1 FR ++ } ++} ++ ++SectionDevice."Line2" { ++ Comment "Link 3" ++ ++ Value { ++ PlaybackPriority 400 ++ } ++ Macro.pcm_split.SplitPCMDevice { ++ Name "beacn_studio_stereo_out" ++ Direction Playback ++ HWChannels 8 ++ Channels 2 ++ Channel0 4 ++ Channel1 5 ++ ChannelPos0 FL ++ ChannelPos1 FR ++ } ++} ++ ++SectionDevice."Line3" { ++ Comment "Link 2" ++ ++ Value { ++ PlaybackPriority 400 ++ } ++ Macro.pcm_split.SplitPCMDevice { ++ Name "beacn_studio_stereo_out" ++ Direction Playback ++ HWChannels 8 ++ Channels 2 ++ Channel0 2 ++ Channel1 3 ++ ChannelPos0 FL ++ ChannelPos1 FR ++ } ++} ++ ++SectionDevice."Line4" { ++ Comment "Link 1" ++ ++ Value { ++ PlaybackPriority 400 ++ } ++ Macro.pcm_split.SplitPCMDevice { ++ Name "beacn_studio_stereo_out" ++ Direction Playback ++ HWChannels 8 ++ Channels 2 ++ Channel0 0 ++ Channel1 1 ++ ChannelPos0 FL ++ ChannelPos1 FR ++ } ++} ++ ++SectionDevice."Line5" { ++ Comment "Link 4" ++ ++ Value { ++ PlaybackPriority 400 ++ } ++ Macro.pcm_split.SplitPCMDevice { ++ Name "beacn_studio_stereo_in" ++ Direction Capture ++ HWChannels 8 ++ Channels 2 ++ Channel0 6 ++ Channel1 7 ++ ChannelPos0 FL ++ ChannelPos1 FR ++ } ++} ++ ++SectionDevice."Line6" { ++ Comment "Link 3" ++ ++ Value { ++ PlaybackPriority 400 ++ } ++ Macro.pcm_split.SplitPCMDevice { ++ Name "beacn_studio_stereo_in" ++ Direction Capture ++ HWChannels 8 ++ Channels 2 ++ Channel0 4 ++ Channel1 5 ++ ChannelPos0 FL ++ ChannelPos1 FR ++ } ++} ++ ++SectionDevice."Line7" { ++ Comment "Link 2" ++ ++ Value { ++ PlaybackPriority 400 ++ } ++ Macro.pcm_split.SplitPCMDevice { ++ Name "beacn_studio_stereo_in" ++ Direction Capture ++ HWChannels 8 ++ Channels 2 ++ Channel0 2 ++ Channel1 3 ++ ChannelPos0 FL ++ ChannelPos1 FR ++ } ++} ++ ++SectionDevice."Line8" { ++ Comment "Link 1" ++ ++ Value { ++ PlaybackPriority 400 ++ } ++ Macro.pcm_split.SplitPCMDevice { ++ Name "beacn_studio_stereo_in" ++ Direction Capture ++ HWChannels 8 ++ Channels 2 ++ Channel0 0 ++ Channel1 1 ++ ChannelPos0 FL ++ ChannelPos1 FR ++ } ++} +diff --git a/ucm2/USB-Audio/Beacn/Beacn-Studio.conf b/ucm2/USB-Audio/Beacn/Beacn-Studio.conf +new file mode 100644 +index 0000000..1b3adc0 +--- /dev/null ++++ b/ucm2/USB-Audio/Beacn/Beacn-Studio.conf +@@ -0,0 +1,42 @@ ++# The Beacn Studio has two USB ports which both present different PIDs, so we do ++# individual checks, and load the appropriate configs for the port connected. ++ ++Comment "Beacn Studio USB" ++If.usb1 { ++ Condition { ++ Type String ++ Haystack "${CardComponents}" ++ Needle "USB33ae:0003" ++ } ++ True { ++ # Channel configuration is common between all the profiles, so we'll include it here ++ Include.pcm_split.File "/USB-Audio/Beacn/Beacn-Studio-USB1-Channels.conf" ++ ++ # If the user isn't using the 'Dual PC' feature of the Beacn Studio, there isn't really ++ # much point presenting them with an additional 4 unusable inputs and outputs, so we'll ++ # offer two profile options so those channels can be hidden. ++ SectionUseCase."Basic" { ++ Comment "Beacn Studio" ++ File "/USB-Audio/Beacn/Beacn-Studio-USB1-HiFi.conf" ++ } ++ ++ SectionUseCase."Link" { ++ Comment "Beacn Studio with Link" ++ File "/USB-Audio/Beacn/Beacn-Studio-USB1-Link-HiFi.conf" ++ } ++ } ++} ++ ++If.usb2 { ++ Condition { ++ Type String ++ Haystack "${CardComponents}" ++ Needle "USB33ae:4003" ++ } ++ True { ++ SectionUseCase."Link" { ++ Comment "Beacn Studio Link" ++ File "/USB-Audio/Beacn/Beacn-Studio-USB2-HiFi.conf" ++ } ++ } ++} +diff --git a/ucm2/USB-Audio/USB-Audio.conf b/ucm2/USB-Audio/USB-Audio.conf +index fe2cd46..d90db39 100644 +--- a/ucm2/USB-Audio/USB-Audio.conf ++++ b/ucm2/USB-Audio/USB-Audio.conf +@@ -541,7 +541,23 @@ If.ssl2plus { + ProfileName "SolidStateLabs/SSL2Plus" + } + } ++If.beacn-mic { ++ Condition { ++ Type String ++ Haystack "${CardComponents}" ++ Needle "USB33ae:0001" ++ } ++ True.Define.ProfileName "Beacn/Beacn-Mic" ++} + ++If.beacn-studio { ++ Condition { ++ Type RegexMatch ++ String "${CardComponents}" ++ Regex "USB33ae:[04]003" ++ } ++ True.Define.ProfileName "Beacn/Beacn-Studio" ++} + If.mixremap { + Condition { + Type String +-- +2.49.0 + + +From e055d16bdf971e26c3d92d998bccb2ca4e4f3c1a Mon Sep 17 00:00:00 2001 +From: binarycraft007 +Date: Mon, 2 Jun 2025 13:41:38 +0800 +Subject: [PATCH 15/24] ucm2: Qualcomm: add ASUS Vivobook S 15 support + +S15 supports: + - 2 speakers. + - 2 dmics + - headset with mic. + +This patch adds support to all these, however only speakers, dmic and +headset playback is tested. + +Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/570 +Signed-off-by: binarycraft007 +Signed-off-by: Jaroslav Kysela +--- + ucm2/Qualcomm/x1e80100/x1e80100.conf | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ucm2/Qualcomm/x1e80100/x1e80100.conf b/ucm2/Qualcomm/x1e80100/x1e80100.conf +index 10faf5f..ecbb13d 100644 +--- a/ucm2/Qualcomm/x1e80100/x1e80100.conf ++++ b/ucm2/Qualcomm/x1e80100/x1e80100.conf +@@ -6,7 +6,7 @@ If.LENOVOT14s { + Condition { + Type RegexMatch + String "${var:DMI_info}" +- Regex "LENOVO.*Think((Pad T14s Gen 6.*)|(Book 16 G7 QOY))|(HP.*Omnibook X.*)|(ASUSTeK COMPUTER.*ASUS Zenbook A14)|(Microsoft Corporation.*Surface.*Microsoft Surface Laptop, 7th Edition)" ++ Regex "LENOVO.*Think((Pad T14s Gen 6.*)|(Book 16 G7 QOY))|(HP.*Omnibook X.*)|ASUSTeK COMPUTER.*ASUS (Zenbook A14|Vivobook S 15)|(Microsoft Corporation.*Surface.*Microsoft Surface Laptop, 7th Edition)" + } + True.Include.t14s.File "/Qualcomm/x1e80100/LENOVO-T14s.conf" + } +-- +2.49.0 + + +From 59d53fd9cac27e9a05623251aefa6d06da94260c Mon Sep 17 00:00:00 2001 +From: Craig McLure +Date: Wed, 4 Jun 2025 23:25:51 +0100 +Subject: [PATCH 16/24] Changed 'Stream Mix' channel names to match the latest + Window release + +Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/572 +Signed-off-by: Craig McLure +Signed-off-by: Jaroslav Kysela +--- + ucm2/USB-Audio/GoXLR/GoXLR-HiFi.conf | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/ucm2/USB-Audio/GoXLR/GoXLR-HiFi.conf b/ucm2/USB-Audio/GoXLR/GoXLR-HiFi.conf +index 6614b00..17c6580 100644 +--- a/ucm2/USB-Audio/GoXLR/GoXLR-HiFi.conf ++++ b/ucm2/USB-Audio/GoXLR/GoXLR-HiFi.conf +@@ -140,7 +140,7 @@ SectionDevice."Line3" { + } + + SectionDevice."Line4" { +- Comment "Broadcast Stream Mix" ++ Comment "Stream Mix 1" + + Value { + CapturePriority 200 +@@ -200,7 +200,7 @@ If.mix2 { + String2 "25" + } + True.SectionDevice."Line6" { +- Comment "Broadcast Stream Mix 2" ++ Comment "Stream Mix 2" + + Value { + CapturePriority 200 +-- +2.49.0 + + +From bd5cf3839f902b67a355669fdf1bd3231e0cb4c1 Mon Sep 17 00:00:00 2001 +From: Mohammad Rafi Shaik +Date: Mon, 9 Jun 2025 20:52:42 +0530 +Subject: [PATCH 17/24] Qualcomm: Add QCS9075-IQ-EVK HiFi config + +Add UCM2 configs for the Qualcomm QCS9075-IQ-EVK Board to handle: + - I2S Speaker Amplifier + - I2S Mic + +Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/576 +Signed-off-by: Mohammad Rafi Shaik +Signed-off-by: Jaroslav Kysela +--- + .../qcs9075/qcs9075-iq-evk-snd-card/HiFi.conf | 29 +++++++++++++++++++ + .../qcs9075-iq-evk-snd-card.conf | 6 ++++ + .../qcs9075/qcs9075-iq-evk-snd-card.conf | 6 ++++ + 3 files changed, 41 insertions(+) + create mode 100644 ucm2/Qualcomm/qcs9075/qcs9075-iq-evk-snd-card/HiFi.conf + create mode 100644 ucm2/Qualcomm/qcs9075/qcs9075-iq-evk-snd-card/qcs9075-iq-evk-snd-card.conf + create mode 100644 ucm2/conf.d/qcs9075/qcs9075-iq-evk-snd-card.conf + +diff --git a/ucm2/Qualcomm/qcs9075/qcs9075-iq-evk-snd-card/HiFi.conf b/ucm2/Qualcomm/qcs9075/qcs9075-iq-evk-snd-card/HiFi.conf +new file mode 100644 +index 0000000..6673324 +--- /dev/null ++++ b/ucm2/Qualcomm/qcs9075/qcs9075-iq-evk-snd-card/HiFi.conf +@@ -0,0 +1,29 @@ ++SectionVerb { ++ Value { ++ TQ "HiFi" ++ } ++ EnableSequence [ ++ cset "name='PRIMARY_SDR_MI2S_RX Audio Mixer MULTIMEDIA0' 1" ++ cset "name='MULTIMEDIA1 Audio Mixer TERTIARY_SDR_MI2S_TX' 1" ++ ] ++} ++ ++SectionDevice."Speaker" { ++ Comment "Speaker playback" ++ ++ Value { ++ PlaybackPriority 100 ++ PlaybackPCM "hw:${CardId},0" ++ PlaybackMixer "default:${CardId}" ++ PlaybackMixerElem "Speakers" ++ } ++} ++ ++SectionDevice."Mic" { ++ Comment "Mic" ++ ++ Value { ++ CapturePriority 100 ++ CapturePCM "hw:${CardId},1" ++ } ++} +diff --git a/ucm2/Qualcomm/qcs9075/qcs9075-iq-evk-snd-card/qcs9075-iq-evk-snd-card.conf b/ucm2/Qualcomm/qcs9075/qcs9075-iq-evk-snd-card/qcs9075-iq-evk-snd-card.conf +new file mode 100644 +index 0000000..669ba6b +--- /dev/null ++++ b/ucm2/Qualcomm/qcs9075/qcs9075-iq-evk-snd-card/qcs9075-iq-evk-snd-card.conf +@@ -0,0 +1,6 @@ ++Syntax 4 ++ ++SectionUseCase."HiFi" { ++ File "/Qualcomm/qcs9075/qcs9075-iq-evk-snd-card/HiFi.conf" ++ Comment "HiFi quality Music" ++} +diff --git a/ucm2/conf.d/qcs9075/qcs9075-iq-evk-snd-card.conf b/ucm2/conf.d/qcs9075/qcs9075-iq-evk-snd-card.conf +new file mode 100644 +index 0000000..1e49d38 +--- /dev/null ++++ b/ucm2/conf.d/qcs9075/qcs9075-iq-evk-snd-card.conf +@@ -0,0 +1,6 @@ ++Syntax 4 ++ ++SectionUseCase."HiFi" { ++ File "/Qualcomm/qcs9075/qcs9075-iq-evk-snd-card/HiFi.conf" ++ Comment "HiFi quality Music." ++} +-- +2.49.0 + + +From e7ec0f1ac3eebfa04e18a944d511bbb5fa57239d Mon Sep 17 00:00:00 2001 +From: Mohammad Rafi Shaik +Date: Tue, 10 Jun 2025 16:46:59 +0530 +Subject: [PATCH 18/24] ucm2: Qualcomm: Update the QCM6490 and QCS6490 hifi + conf files + +Rename the HiFi conf files for QCM6490-IDP and QCS6490-RB3Gen2 boards +to match with soundcard name. + +Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/577 +Signed-off-by: Mohammad Rafi Shaik +Signed-off-by: Jaroslav Kysela +--- + .../QCM6490-IDP/{QCM6490-IDP.conf => qcm6490-idp-snd-card.conf} | 0 + .../{QCS6490-RB3Gen2.conf => qcs6490-rb3gen2-snd-card.conf} | 0 + .../qcm6490/{QCM6490-IDP.conf => qcm6490-idp-snd-card.conf} | 0 + .../{QCS6490-RB3Gen2.conf => qcs6490-rb3gen2-snd-card.conf} | 0 + 4 files changed, 0 insertions(+), 0 deletions(-) + rename ucm2/Qualcomm/qcm6490/QCM6490-IDP/{QCM6490-IDP.conf => qcm6490-idp-snd-card.conf} (100%) + rename ucm2/Qualcomm/qcs6490/QCS6490-RB3Gen2/{QCS6490-RB3Gen2.conf => qcs6490-rb3gen2-snd-card.conf} (100%) + rename ucm2/conf.d/qcm6490/{QCM6490-IDP.conf => qcm6490-idp-snd-card.conf} (100%) + rename ucm2/conf.d/qcs6490/{QCS6490-RB3Gen2.conf => qcs6490-rb3gen2-snd-card.conf} (100%) + +diff --git a/ucm2/Qualcomm/qcm6490/QCM6490-IDP/QCM6490-IDP.conf b/ucm2/Qualcomm/qcm6490/QCM6490-IDP/qcm6490-idp-snd-card.conf +similarity index 100% +rename from ucm2/Qualcomm/qcm6490/QCM6490-IDP/QCM6490-IDP.conf +rename to ucm2/Qualcomm/qcm6490/QCM6490-IDP/qcm6490-idp-snd-card.conf +diff --git a/ucm2/Qualcomm/qcs6490/QCS6490-RB3Gen2/QCS6490-RB3Gen2.conf b/ucm2/Qualcomm/qcs6490/QCS6490-RB3Gen2/qcs6490-rb3gen2-snd-card.conf +similarity index 100% +rename from ucm2/Qualcomm/qcs6490/QCS6490-RB3Gen2/QCS6490-RB3Gen2.conf +rename to ucm2/Qualcomm/qcs6490/QCS6490-RB3Gen2/qcs6490-rb3gen2-snd-card.conf +diff --git a/ucm2/conf.d/qcm6490/QCM6490-IDP.conf b/ucm2/conf.d/qcm6490/qcm6490-idp-snd-card.conf +similarity index 100% +rename from ucm2/conf.d/qcm6490/QCM6490-IDP.conf +rename to ucm2/conf.d/qcm6490/qcm6490-idp-snd-card.conf +diff --git a/ucm2/conf.d/qcs6490/QCS6490-RB3Gen2.conf b/ucm2/conf.d/qcs6490/qcs6490-rb3gen2-snd-card.conf +similarity index 100% +rename from ucm2/conf.d/qcs6490/QCS6490-RB3Gen2.conf +rename to ucm2/conf.d/qcs6490/qcs6490-rb3gen2-snd-card.conf +-- +2.49.0 + + +From a98b12220989e2187a47b0e06ac9145c92232a8e Mon Sep 17 00:00:00 2001 +From: Mohammad Rafi Shaik +Date: Wed, 18 Jun 2025 16:46:18 +0530 +Subject: [PATCH 19/24] ucm2: Qualcomm: Update the HIFI enable mixer commands + for qcm6490-idp and qcs6490-rb3gen2 + +Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/577 +Signed-off-by: Mohammad Rafi Shaik +Signed-off-by: Jaroslav Kysela +--- + ucm2/Qualcomm/qcm6490/QCM6490-IDP/HiFi.conf | 8 ++++---- + ucm2/Qualcomm/qcs6490/QCS6490-RB3Gen2/HiFi.conf | 4 ++-- + 2 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/ucm2/Qualcomm/qcm6490/QCM6490-IDP/HiFi.conf b/ucm2/Qualcomm/qcm6490/QCM6490-IDP/HiFi.conf +index 0d6497e..0a0d331 100644 +--- a/ucm2/Qualcomm/qcm6490/QCM6490-IDP/HiFi.conf ++++ b/ucm2/Qualcomm/qcm6490/QCM6490-IDP/HiFi.conf +@@ -3,10 +3,10 @@ SectionVerb { + TQ "HiFi" + } + EnableSequence [ +- cset "name='WSA_CODEC_DMA_RX_0 Audio Mixer MULTIMEDIA0' 1" +- cset "name='MULTIMEDIA1 Audio Mixer VA_CODEC_DMA_TX_0' 1" +- cset "name='RX_CODEC_DMA_RX_0 Audio Mixer MULTIMEDIA2' 1" +- cset "name='MULTIMEDIA3 Audio Mixer TX_CODEC_DMA_TX_3' 1" ++ cset "name='WSA_CODEC_DMA_RX_0 Audio Mixer MultiMedia1' 1" ++ cset "name='MultiMedia2 Mixer VA_CODEC_DMA_TX_0' 1" ++ cset "name='RX_CODEC_DMA_RX_0 Audio Mixer MultiMedia3' 1" ++ cset "name='MultiMedia4 Mixer TX_CODEC_DMA_TX_3' 1" + ] + + Include.wsae.File "/codecs/wsa883x/DefaultEnableSeq.conf" +diff --git a/ucm2/Qualcomm/qcs6490/QCS6490-RB3Gen2/HiFi.conf b/ucm2/Qualcomm/qcs6490/QCS6490-RB3Gen2/HiFi.conf +index 954dbfa..2488523 100644 +--- a/ucm2/Qualcomm/qcs6490/QCS6490-RB3Gen2/HiFi.conf ++++ b/ucm2/Qualcomm/qcs6490/QCS6490-RB3Gen2/HiFi.conf +@@ -3,8 +3,8 @@ SectionVerb { + TQ "HiFi" + } + EnableSequence [ +- cset "name='WSA_CODEC_DMA_RX_0 Audio Mixer MULTIMEDIA0' 1" +- cset "name='MULTIMEDIA1 Audio Mixer VA_CODEC_DMA_TX_0' 1" ++ cset "name='WSA_CODEC_DMA_RX_0 Audio Mixer MultiMedia1' 1" ++ cset "name='MultiMedia2 Mixer VA_CODEC_DMA_TX_0' 1" + ] + + Include.wsae.File "/codecs/wsa883x/DefaultEnableSeq.conf" +-- +2.49.0 + + +From 56cbdfd04339cf9598cd9d57f5c1a382504ae902 Mon Sep 17 00:00:00 2001 +From: Peter Ujfalusi +Date: Thu, 12 Jun 2025 16:33:01 +0300 +Subject: [PATCH 20/24] UCM2: Intel: sof-hda-dsp: HiFi: Fix handling of mono + DMICs + +When a single DMIC is present in the system we need to set the +CaptureChannels to 1 since the PCM device only supports mono, PA/PW will +reject the profile since it cannot open the DMIC PCM device. + +Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/579 +Signed-off-by: Peter Ujfalusi +Signed-off-by: Jaroslav Kysela +--- + ucm2/Intel/sof-hda-dsp/HiFi.conf | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/ucm2/Intel/sof-hda-dsp/HiFi.conf b/ucm2/Intel/sof-hda-dsp/HiFi.conf +index 9689b56..e452f83 100644 +--- a/ucm2/Intel/sof-hda-dsp/HiFi.conf ++++ b/ucm2/Intel/sof-hda-dsp/HiFi.conf +@@ -34,6 +34,16 @@ If.dmic { + True { + CaptureChannels 4 + } ++ False.If.mono { ++ Condition { ++ Type RegexMatch ++ Regex "cfg-dmics:[1]" ++ String "${CardComponents}" ++ } ++ True { ++ CaptureChannels 1 ++ } ++ } + } + If.vol { + Condition { +-- +2.49.0 + + +From e4791900954c3951d15038822a55a3031aac49d2 Mon Sep 17 00:00:00 2001 +From: Shuming Fan +Date: Fri, 6 Jun 2025 12:47:08 +0800 +Subject: [PATCH 21/24] ucm2: sof-soundwire: add rt712-vb device + +Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/573 +Signed-off-by: Shuming Fan +Signed-off-by: Jaroslav Kysela +--- + ucm2/codecs/rt712/init.conf | 34 ++++++++++++++++++++++++++++------ + ucm2/sof-soundwire/rt712.conf | 29 +++++++++++++++++++++++++++++ + 2 files changed, 57 insertions(+), 6 deletions(-) + +diff --git a/ucm2/codecs/rt712/init.conf b/ucm2/codecs/rt712/init.conf +index e09bf7f..1e45380 100644 +--- a/ucm2/codecs/rt712/init.conf ++++ b/ucm2/codecs/rt712/init.conf +@@ -1,8 +1,30 @@ + # RT712 specific volume control settings + +-BootSequence [ +- cset "name='rt712 FU05 Playback Volume' 87" +- cset "name='rt712 ADC 23 Mux' 'MIC2'" +- cset "name='rt712 FU0F Capture Volume' 57" +- cset "name='rt712 FU0F Capture Switch' 1" +-] ++If.rt712_init { ++ Condition { ++ Type RegexMatch ++ Regex "(rt712(-sdca)?)" ++ String "${var:MultiMicShadow}" ++ } ++ True { ++ # RT712-VB integrated with DMIC ++ BootSequence [ ++ cset "name='rt712 FU05 Playback Volume' 87" ++ cset "name='rt712 ADC 23 Mux' 'MIC2'" ++ cset "name='rt712 FU0F Capture Volume' 57" ++ cset "name='rt712 FU0F Capture Switch' 1" ++ cset "name='rt712 FU1E Capture Switch' 1" ++ cset "name='rt712 FU1E Capture Volume' 47" ++ cset "name='rt712 ADC 0A Mux' 'DMIC1'" ++ cset "name='rt712 ADC 0B Mux' 'DMIC2'" ++ ] ++ } ++ False { ++ BootSequence [ ++ cset "name='rt712 FU05 Playback Volume' 87" ++ cset "name='rt712 ADC 23 Mux' 'MIC2'" ++ cset "name='rt712 FU0F Capture Volume' 57" ++ cset "name='rt712 FU0F Capture Switch' 1" ++ ] ++ } ++} +diff --git a/ucm2/sof-soundwire/rt712.conf b/ucm2/sof-soundwire/rt712.conf +index 409bef9..346cff1 100644 +--- a/ucm2/sof-soundwire/rt712.conf ++++ b/ucm2/sof-soundwire/rt712.conf +@@ -85,3 +85,32 @@ SectionDevice."Headset" { + JackControl "Headset Mic Jack" + } + } ++ ++If.codecmic { ++ Condition { ++ Type RegexMatch ++ Regex "(rt712(-sdca)?)" ++ String "${var:MultiMicShadow}" ++ } ++ True { ++ SectionDevice."Mic" { ++ Comment "SoundWire Microphones" ++ ++ EnableSequence [ ++ cset "name='rt712 FU1E Capture Switch' 1" ++ ] ++ ++ DisableSequence [ ++ cset "name='rt712 FU1E Capture Switch' 0" ++ ] ++ ++ Value { ++ CapturePriority 100 ++ CapturePCM "hw:${CardId},4" ++ CaptureSwitch "rt712 FU1E Capture Switch" ++ CaptureVolume "rt712 FU1E Capture Volume" ++ CaptureMixerElem "rt712 FU1E" ++ } ++ } ++ } ++} +-- +2.49.0 + + +From 436fbad2a02b91435645e039664af469595ab500 Mon Sep 17 00:00:00 2001 +From: DanielDecker <90106468+DanielDecker@users.noreply.github.com> +Date: Mon, 16 Jun 2025 18:27:21 +0200 +Subject: [PATCH 22/24] add MSI MAG B850M Mortar Wifi to USB-Audio.conf + +add MSI MAG B850M Mortar Wifi USB-ID for Realtek/ALC4080 to USB-Audio.conf + +Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/581 +Signed-off-by: DanielDecker <90106468+DanielDecker@users.noreply.github.com> +Signed-off-by: Jaroslav Kysela +--- + ucm2/USB-Audio/USB-Audio.conf | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/ucm2/USB-Audio/USB-Audio.conf b/ucm2/USB-Audio/USB-Audio.conf +index d90db39..ef88ded 100644 +--- a/ucm2/USB-Audio/USB-Audio.conf ++++ b/ucm2/USB-Audio/USB-Audio.conf +@@ -89,6 +89,7 @@ If.realtek-alc4080 { + # 0db0:a47c MSI MEG X570S Ace Max + # 0db0:a74b MSI MPG Z790 Edge Wifi + # 0db0:b202 MSI MAG Z690 Tomahawk Wifi ++ # 0db0:cc78 MSI MAG B850M Mortar Wifi + # 0db0:cd0e MSI X870 Tomahawk + # 0db0:d1d7 MSI PRO Z790-A WIFI + # 0db0:d6e7 MSI MPG X670E Carbon Wifi +@@ -96,7 +97,7 @@ If.realtek-alc4080 { + # 26ce:0a06 ASRock X670E/Z790 Taichi + # 26ce:0a08 ASRock Z790 PG-ITX/TB4, X870 Steel Legend + # 26ce:0a0b ASRock X870E Taichi +- Regex "USB((0414:a0(0e|1[0124]))|(0b05:(19(84|9[69])|1a(16|2[07]|5[23c]|97|f1)|1b(7c|9b|e1)))|(0db0:(005a|0b58|124b|151f|1feb|3130|36e7|4(19c|22d|240|88c)|543d|62a4|6c[0c]9|70d3|7696|82c7|8af7|961e|9e6d|a(073|228|47c|74b)|b202|cd0e|d1d7|d6e7|e1f8))|(26ce:0a0[68b]))" ++ Regex "USB((0414:a0(0e|1[0124]))|(0b05:(19(84|9[69])|1a(16|2[07]|5[23c]|97|f1)|1b(7c|9b|e1)))|(0db0:(005a|0b58|124b|151f|1feb|3130|36e7|4(19c|22d|240|88c)|543d|62a4|6c[0c]9|70d3|7696|82c7|8af7|961e|9e6d|a(073|228|47c|74b)|b202|c(c78|d0e)|d1d7|d6e7|e1f8))|(26ce:0a0[68b]))" + } + True.Define.ProfileName "Realtek/ALC4080" + } +-- +2.49.0 + + +From b4896cf413e618f4b20c570544a4e668aaa72f64 Mon Sep 17 00:00:00 2001 +From: Harald Sitter +Date: Sat, 21 Jun 2025 17:10:20 +0200 +Subject: [PATCH 23/24] ucm2: USB-Audio: Add Teufel CAGE PRO + +two stereo outputs: one for "game" and one for "chat". +one mono input + +Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/582 +Signed-off-by: Harald Sitter +Signed-off-by: Jaroslav Kysela +--- + ucm2/USB-Audio/Teufel/CAGE-PRO-HiFi.conf | 21 +++++++++++++++++++++ + ucm2/USB-Audio/Teufel/CAGE-PRO.conf | 9 +++++++++ + ucm2/USB-Audio/USB-Audio.conf | 10 ++++++++++ + 3 files changed, 40 insertions(+) + create mode 100644 ucm2/USB-Audio/Teufel/CAGE-PRO-HiFi.conf + create mode 100644 ucm2/USB-Audio/Teufel/CAGE-PRO.conf + +diff --git a/ucm2/USB-Audio/Teufel/CAGE-PRO-HiFi.conf b/ucm2/USB-Audio/Teufel/CAGE-PRO-HiFi.conf +new file mode 100644 +index 0000000..c0fbe7b +--- /dev/null ++++ b/ucm2/USB-Audio/Teufel/CAGE-PRO-HiFi.conf +@@ -0,0 +1,21 @@ ++# SPDX-License-Identifier: MIT ++# SPDX-FileCopyrightText: 2025 Harald Sitter ++ ++SectionDevice."Headset" { ++ Comment "Chat" ++ Value { ++ PlaybackPCM "hw:${CardId},0" ++ PlaybackMixerElem "PCM" ++ CapturePCM "hw:${CardId},0" ++ CaptureMixerElem "Mic" ++ CaptureChannels 1 ++ } ++} ++ ++SectionDevice."Headphones" { ++ Comment "Game" ++ Value { ++ PlaybackPCM "hw:${CardId},1" ++ PlaybackMixerElem "PCM,1" ++ } ++} +diff --git a/ucm2/USB-Audio/Teufel/CAGE-PRO.conf b/ucm2/USB-Audio/Teufel/CAGE-PRO.conf +new file mode 100644 +index 0000000..bf75033 +--- /dev/null ++++ b/ucm2/USB-Audio/Teufel/CAGE-PRO.conf +@@ -0,0 +1,9 @@ ++# SPDX-License-Identifier: MIT ++# SPDX-FileCopyrightText: 2025 Harald Sitter ++ ++Comment "Lautsprecher Teufel GmbH CAGE PRO" ++ ++SectionUseCase."HiFi" { ++ Comment "Default" ++ File "/USB-Audio/Teufel/CAGE-PRO-HiFi.conf" ++} +diff --git a/ucm2/USB-Audio/USB-Audio.conf b/ucm2/USB-Audio/USB-Audio.conf +index ef88ded..7a6a0ac 100644 +--- a/ucm2/USB-Audio/USB-Audio.conf ++++ b/ucm2/USB-Audio/USB-Audio.conf +@@ -521,6 +521,15 @@ If.ua-volt2 { + } + } + ++If.teufel-cage-pro { ++ Condition { ++ Type String ++ Haystack "${CardComponents}" ++ Needle "USB2cc2:0033" ++ } ++ True.Define.ProfileName "Teufel/CAGE-PRO" ++} ++ + If.ssl2 { + Condition { + Type String +@@ -559,6 +568,7 @@ If.beacn-studio { + } + True.Define.ProfileName "Beacn/Beacn-Studio" + } ++ + If.mixremap { + Condition { + Type String +-- +2.49.0 + + +From 63f161cb8d65ed828a1ce49b506f4e1b9a7c58e4 Mon Sep 17 00:00:00 2001 +From: Zoran Zhan +Date: Wed, 7 May 2025 14:41:14 +0800 +Subject: [PATCH 24/24] ucm2: MediaTek: mt8365-evk: Add SOF support + +Add support for MT8365 EVK with SOF enabled. When SOF is +disabled, the "HiFi" use case is used; when SOF is enabled, +the "SOF" use case is used. + +The main difference compared to the UCM with SOF disabled is +the device number for playback and capture, which now uses the +PCMs for SOF instead. + +Define these parameters as variables for each case (with and +without SOF), and move the common initialization to init.conf, +so the UCM can be shared by both configurations. + +Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/583 +Signed-off-by: Zoran Zhan +Signed-off-by: Jaroslav Kysela +--- + ucm2/MediaTek/mt8365-evk/HiFi.conf | 126 ++++++------------ + ucm2/MediaTek/mt8365-evk/init.conf | 31 +++++ + ucm2/MediaTek/mt8365-evk/mt8365-evk.conf | 40 +----- + ucm2/MediaTek/mt8365-evk/sof/SOF.conf | 87 ++++++++++++ + .../mt8365-evk/sof/sof-mt8365-evk.conf | 9 ++ + .../conf.d/sof-mt8365-evk/sof-mt8365-evk.conf | 1 + + 6 files changed, 174 insertions(+), 120 deletions(-) + create mode 100644 ucm2/MediaTek/mt8365-evk/init.conf + create mode 100644 ucm2/MediaTek/mt8365-evk/sof/SOF.conf + create mode 100644 ucm2/MediaTek/mt8365-evk/sof/sof-mt8365-evk.conf + create mode 120000 ucm2/conf.d/sof-mt8365-evk/sof-mt8365-evk.conf + +diff --git a/ucm2/MediaTek/mt8365-evk/HiFi.conf b/ucm2/MediaTek/mt8365-evk/HiFi.conf +index 81f563f..83514c7 100644 +--- a/ucm2/MediaTek/mt8365-evk/HiFi.conf ++++ b/ucm2/MediaTek/mt8365-evk/HiFi.conf +@@ -1,141 +1,97 @@ + SectionDevice."HDMI" { +- Comment "Hdmi output" ++ Comment "HDMI output" + + Value { +- PlaybackPriority 250 ++ PlaybackPriority 100 + PlaybackChannels 2 + PlaybackPCM "hw:${CardId},1" + } +- +- EnableSequence [ +- cset "name='O00 I07 Switch' on" +- cset "name='O01 I08 Switch' on" +- ] +- +- DisableSequence [ +- cset "name='O00 I07 Switch' off" +- cset "name='O01 I08 Switch' off" +- ] + } + + SectionDevice."Speaker" { +- Comment "Line-out Jack " ++ Comment "Lineout speaker" + + ConflictingDevice [ + "Headphones" + ] + +- Value { +- PlaybackPriority 300 +- PlaybackChannels 2 +- PlaybackPCM "hw:${CardId},0" +- PlaybackVolume "name='Lineout_PGAL_GAIN'" +- } +- + EnableSequence [ +- cset "name='Audio_Amp_L_Switch' Off" +- cset "name='Audio_Amp_R_Switch' Off" +- cset "name='Lineout_PGAL_GAIN' 0" +- cset "name='Speaker_Amp_Switch' On" ++ cset "name='Headphone Left Source' Open" ++ cset "name='Headphone Right Source' Open" ++ cset "name='Line Out Source' Playback" + ] + +- DisableSequence [ +- cset "name='Audio_Amp_L_Switch' On" +- cset "name='Audio_Amp_R_Switch' On" +- cset "name='Speaker_Amp_Switch' Off" +- ] ++ Value { ++ PlaybackPriority 200 ++ PlaybackChannels 2 ++ PlaybackPCM "hw:${CardId},${var:PlayDevN}" ++ } + } + + SectionDevice."Headphones" { +- Comment "Headset speakers" ++ Comment "Earphone speaker" + + ConflictingDevice [ + "Speaker" + ] + ++ EnableSequence [ ++ cset "name='Headphone Left Source' DAC" ++ cset "name='Headphone Right Source' DAC" ++ cset "name='Line Out Source' Open" ++ ] ++ + Value { + PlaybackPriority 300 + PlaybackChannels 2 +- PlaybackPCM "hw:${CardId},0" +- PlaybackVolume "name='Headset_PGAL_GAIN'" ++ PlaybackPCM "hw:${CardId},${var:PlayDevN}" + } +- +- EnableSequence [ +- cset "name='Audio_Amp_L_Switch' On" +- cset "name='Audio_Amp_R_Switch' On" +- cset "name='Headset_PGAL_GAIN' 1" +- cset "name='Speaker_Amp_Switch' Off" +- ] +- +- DisableSequence [ +- cset "name='Audio_Amp_L_Switch' Off" +- cset "name='Audio_Amp_R_Switch' Off" +- cset "name='Speaker_Amp_Switch' On" +- ] + } + +-SectionDevice."Mic1" { +- Comment "Amic" ++SectionDevice."Headset" { ++ Comment "Earphone microphone" + + ConflictingDevice [ +- "Mic2" ++ "Mic1" + ] + +- Value { +- CapturePriority 300 +- CaptureChannels 1 +- CapturePCM "hw:${CardId},2" +- } +- + EnableSequence [ +- cset "name='Audio_MicSource1_Setting' ADC1" +- cset "name='Audio_MICBIAS0_Switch' Off" ++ cset "name='PGA L Mux' AIN1" ++ cset "name='PGA R Mux' AIN1" + ] + +- DisableSequence [ +- cset "name='Audio_MicSource1_Setting' ADC2" +- cset "name='Audio_MICBIAS0_Switch' On" +- ] ++ Value { ++ CapturePriority 300 ++ CaptureChannels "${var:CapChanN}" ++ CapturePCM "hw:${CardId},${var:CapDevN}" ++ } + } + +-SectionDevice."Mic2" { +- Comment "Headset microphone" ++SectionDevice."Mic1" { ++ Comment "Analog microphone" + + ConflictingDevice [ +- "Mic1" ++ "Headset" + ] + +- Value { +- CapturePriority 350 +- CaptureChannels 1 +- CapturePCM "hw:${CardId},2" +- } +- + EnableSequence [ +- cset "name='Audio_MicSource1_Setting' ADC2" +- cset "name='Audio_MICBIAS0_Switch' On" ++ cset "name='PGA L Mux' AIN0" ++ cset "name='PGA R Mux' AIN0" + ] + +- DisableSequence [ +- cset "name='Audio_MicSource1_Setting' ADC1" +- cset "name='Audio_MICBIAS0_Switch' Off" +- ] ++ Value { ++ CapturePriority 200 ++ CaptureChannels "${var:CapChanN}" ++ CapturePCM "hw:${CardId},${var:CapDevN}" ++ } + } + +-SectionDevice."Mic3" { +- Comment "PDM microphones" ++SectionDevice."Mic2" { ++ Comment "Digital microphone" + + Value { + CapturePriority 100 + CaptureChannels 2 + CapturePCM "hw:${CardId},3" + } +- +- EnableSequence [ +- cset "name='Audio_MICBIAS0_Switch' On" +- ] +- +- DisableSequence [ +- cset "name='Audio_MICBIAS0_Switch' Off" +- ] + } +diff --git a/ucm2/MediaTek/mt8365-evk/init.conf b/ucm2/MediaTek/mt8365-evk/init.conf +new file mode 100644 +index 0000000..269530a +--- /dev/null ++++ b/ucm2/MediaTek/mt8365-evk/init.conf +@@ -0,0 +1,31 @@ ++Syntax 4 ++ ++SectionUseCase."HiFi" { ++ File "/MediaTek/mt8365-evk/HiFi.conf" ++ Comment "Default" ++} ++ ++SectionUseCase."SOF" { ++ File "/MediaTek/mt8365-evk/sof/SOF.conf" ++ Comment "Enable SOF" ++} ++ ++BootSequence [ ++ cset "name='Headphone Left Source' DAC" ++ cset "name='Headphone Right Source' DAC" ++ cset "name='Line Out Source' Open" ++ cset "name='PGA L Mux' AIN1" ++ cset "name='PGA R Mux' AIN1" ++ cset "name='Mic Type Mux' DCC" ++ cset "name='INT ADDA O03_O04 Switch' on" ++ cset "name='Headphone Volume' 10" ++ cset "name='Lineout Volume' 10" ++ cset "name='O00 I07 Switch' on" ++ cset "name='O01 I08 Switch' on" ++ cset "name='O03 I05 Switch' on" ++ cset "name='O04 I06 Switch' on" ++ cset "name='O05 I03 Switch' on" ++ cset "name='O06 I04 Switch' on" ++ cset "name='O09 I14 Switch' on" ++ cset "name='O10 I15 Switch' on" ++] +diff --git a/ucm2/MediaTek/mt8365-evk/mt8365-evk.conf b/ucm2/MediaTek/mt8365-evk/mt8365-evk.conf +index e396f8c..9df5644 100644 +--- a/ucm2/MediaTek/mt8365-evk/mt8365-evk.conf ++++ b/ucm2/MediaTek/mt8365-evk/mt8365-evk.conf +@@ -1,39 +1,9 @@ + Syntax 4 + +-SectionUseCase."HiFi" { +- File "/MediaTek/mt8365-evk/HiFi.conf" +- Comment "Play high quality music" ++Define { ++ PlayDevN "0" ++ CapDevN "2" ++ CapChanN "1" + } + +-BootSequence [ +- #Audio volume +- cset "name='Headset_PGAL_GAIN' 0" +- cset "name='Lineout_PGAL_GAIN' 0" +- +- #Audio amp +- cset "name='Audio_Amp_R_Switch' On" +- cset "name='Audio_Amp_L_Switch' On" +- +- #Headset out +- cset "name='Speaker_Amp_Switch' Off" +- +- #Dmic +- cset "name='Audio_MICBIAS0_Switch' On" +- +- #HDMI audio (I2S3 Out) +- cset "name='O00 I07 Switch' on" +- cset "name='O01 I08 Switch' on" +- +- #jack_mic Headset In +- cset "name='Audio_MicSource1_Setting' ADC2" +- +- cset "name='O03 I05 Switch' on" +- cset "name='O04 I06 Switch' on" +- cset "name='O05 I03 Switch' on" +- cset "name='O06 I04 Switch' on" +- cset "name='O09 I14 Switch' on" +- cset "name='O10 I15 Switch' on" +- cset "name='AUD_CLK_BUF_Switch' On" +- cset "name='Audio_ADC_1_Switch' On" +- cset "name='INT ADDA O03_O04 Switch' on" +-] ++Include.init.File "/MediaTek/mt8365-evk/init.conf" +diff --git a/ucm2/MediaTek/mt8365-evk/sof/SOF.conf b/ucm2/MediaTek/mt8365-evk/sof/SOF.conf +new file mode 100644 +index 0000000..af44feb +--- /dev/null ++++ b/ucm2/MediaTek/mt8365-evk/sof/SOF.conf +@@ -0,0 +1,87 @@ ++SectionDevice."Speaker" { ++ Comment "SOF Lineout speaker" ++ ++ ConflictingDevice [ ++ "Headphones" ++ ] ++ ++ EnableSequence [ ++ cset "name='Headphone Left Source' Open" ++ cset "name='Headphone Right Source' Open" ++ cset "name='Line Out Source' Playback" ++ ] ++ ++ Value { ++ PlaybackPriority 100 ++ PlaybackChannels 2 ++ PlaybackPCM "hw:${CardId},${var:PlayDevN}" ++ } ++} ++ ++SectionDevice."Headphones" { ++ Comment "SOF Earphone speaker" ++ ++ ConflictingDevice [ ++ "Speaker" ++ ] ++ ++ EnableSequence [ ++ cset "name='Headphone Left Source' DAC" ++ cset "name='Headphone Right Source' DAC" ++ cset "name='Line Out Source' Open" ++ ] ++ ++ Value { ++ PlaybackPriority 200 ++ PlaybackChannels 2 ++ PlaybackPCM "hw:${CardId},${var:PlayDevN}" ++ } ++} ++ ++SectionDevice."Headset" { ++ Comment "SOF Earphone microphone" ++ ++ ConflictingDevice [ ++ "Mic1" ++ ] ++ ++ EnableSequence [ ++ cset "name='PGA L Mux' AIN1" ++ cset "name='PGA R Mux' AIN1" ++ ] ++ ++ Value { ++ CapturePriority 300 ++ CaptureChannels "${var:CapChanN}" ++ CapturePCM "hw:${CardId},${var:CapDevN}" ++ } ++} ++ ++SectionDevice."Mic1" { ++ Comment "SOF Analog microphone" ++ ++ ConflictingDevice [ ++ "Headset" ++ ] ++ ++ EnableSequence [ ++ cset "name='PGA L Mux' AIN0" ++ cset "name='PGA R Mux' AIN0" ++ ] ++ ++ Value { ++ CapturePriority 200 ++ CaptureChannels "${var:CapChanN}" ++ CapturePCM "hw:${CardId},${var:CapDevN}" ++ } ++} ++ ++SectionDevice."Mic2" { ++ Comment "SOF Digital microphone" ++ ++ Value { ++ CapturePriority 100 ++ CaptureChannels 2 ++ CapturePCM "hw:${CardId},19" ++ } ++} +diff --git a/ucm2/MediaTek/mt8365-evk/sof/sof-mt8365-evk.conf b/ucm2/MediaTek/mt8365-evk/sof/sof-mt8365-evk.conf +new file mode 100644 +index 0000000..6369aac +--- /dev/null ++++ b/ucm2/MediaTek/mt8365-evk/sof/sof-mt8365-evk.conf +@@ -0,0 +1,9 @@ ++Syntax 4 ++ ++Define { ++ PlayDevN "16" ++ CapDevN "18" ++ CapChanN "2" ++} ++ ++Include.init.File "/MediaTek/mt8365-evk/init.conf" +diff --git a/ucm2/conf.d/sof-mt8365-evk/sof-mt8365-evk.conf b/ucm2/conf.d/sof-mt8365-evk/sof-mt8365-evk.conf +new file mode 120000 +index 0000000..527f25f +--- /dev/null ++++ b/ucm2/conf.d/sof-mt8365-evk/sof-mt8365-evk.conf +@@ -0,0 +1 @@ ++../../MediaTek/mt8365-evk/sof/sof-mt8365-evk.conf +\ No newline at end of file +-- +2.49.0 + From e8691ba09c3da1af3b60d64979f9debfd3ff5e50 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 23 Jul 2025 16:55:03 +0000 Subject: [PATCH 111/120] Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild --- alsa-lib.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 2e492b4..e6abd87 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 3%{?prever_dot}%{?dist} +Release: 4%{?prever_dot}%{?dist} License: LGPL-2.1-or-later URL: http://www.alsa-project.org/ @@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Wed Jul 23 2025 Fedora Release Engineering - 1.2.14-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + * Tue Jan 24 2025 Jaroslav Kysela - 1.2.14-3 - update to latest alsa-ucm-conf files From e97c40908c67c532094483c8e85b7205cc0c807a Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Sun, 7 Dec 2025 22:28:17 +0100 Subject: [PATCH 112/120] update to 1.2.15 Signed-off-by: Jaroslav Kysela --- alsa-git.patch | 31 - alsa-lib.spec | 19 +- alsa-ucm-conf.patch | 2374 ------------------------------------------- 3 files changed, 11 insertions(+), 2413 deletions(-) delete mode 100644 alsa-git.patch delete mode 100644 alsa-ucm-conf.patch diff --git a/alsa-git.patch b/alsa-git.patch deleted file mode 100644 index ded7dfb..0000000 --- a/alsa-git.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 07ec2ad34c42dba8656d3f543164f360f481c52e Mon Sep 17 00:00:00 2001 -From: Daniel Dadap -Date: Thu, 15 May 2025 08:32:35 -0500 -Subject: [PATCH] conf: aliases: add hda-acpi -> HDA-Intel alias - -The new snd_hda_acpi driver in Linux exposes the existing Azalia -interface to non-PCI devices advertised over ACPI. Add an alias -to the existing HDA-Intel configuration file so that devices using -this driver can be discovered properly. - -Signed-off-by: Daniel Dadap -Signed-off-by: Takashi Iwai ---- - src/conf/cards/aliases.conf | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/conf/cards/aliases.conf b/src/conf/cards/aliases.conf -index a54824ae..e2d59aa7 100644 ---- a/src/conf/cards/aliases.conf -+++ b/src/conf/cards/aliases.conf -@@ -57,6 +57,7 @@ CMI8786 cards.CMI8788 - CMI8787 cards.CMI8788 - pistachio cards.pistachio-card - VC4-HDMI cards.vc4-hdmi -+hda-acpi cards.HDA-Intel - - - --- -2.49.0 - diff --git a/alsa-lib.spec b/alsa-lib.spec index e6abd87..7c2e8fa 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -2,14 +2,14 @@ #define prever_dot .rc3 #define postver a -%define version_alsa_lib 1.2.14 -%define version_alsa_ucm 1.2.14 +%define version_alsa_lib 1.2.15 +%define version_alsa_ucm 1.2.15 %define version_alsa_tplg 1.2.5 Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 4%{?prever_dot}%{?dist} +Release: 1%{?prever_dot}%{?dist} License: LGPL-2.1-or-later URL: http://www.alsa-project.org/ @@ -19,8 +19,8 @@ Source2: ftp://ftp.alsa-project.org/pub/lib/alsa-topology-conf-%{version_alsa_t Source10: asound.conf Source11: modprobe-dist-alsa.conf Source12: modprobe-dist-oss.conf -Source40: alsa-ucm-conf.patch -Patch0: alsa-git.patch +#Source40: alsa-ucm-conf.patch +#Patch0: alsa-git.patch Patch1: alsa-lib-1.2.3.1-config.patch Patch2: alsa-lib-1.2.10-glibc-open.patch @@ -70,7 +70,7 @@ contains alsa-lib configuration of SoC topology %prep %setup -q -n %{name}-%{version}%{?prever}%{?postver} -%patch -P0 -p1 -b .alsa-git +#patch -P0 -p1 -b .alsa-git %patch -P1 -p1 -b .config %patch -P2 -p1 -b .glibc-open @@ -116,7 +116,7 @@ mkdir -p %{buildroot}/%{_datadir}/alsa/ucm2 # Unpack UCMs tar xvjf %{SOURCE1} -C %{buildroot}/%{_datadir}/alsa --strip-components=1 "*/ucm" "*/ucm2" -patch -d %{buildroot}/%{_datadir}/alsa -p1 < %{SOURCE40} +#patch -d %{buildroot}/%{_datadir}/alsa -p1 < %{SOURCE40} # Create topology directory mkdir -p %{buildroot}/%{_datadir}/alsa/topology @@ -167,10 +167,13 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Sun Dec 7 2025 Jaroslav Kysela - 1.2.15-1 +- update to 1.2.15 + * Wed Jul 23 2025 Fedora Release Engineering - 1.2.14-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild -* Tue Jan 24 2025 Jaroslav Kysela - 1.2.14-3 +* Tue Jun 24 2025 Jaroslav Kysela - 1.2.14-3 - update to latest alsa-ucm-conf files * Mon Apr 14 2025 Jaroslav Kysela - 1.2.14-2 diff --git a/alsa-ucm-conf.patch b/alsa-ucm-conf.patch deleted file mode 100644 index 917177c..0000000 --- a/alsa-ucm-conf.patch +++ /dev/null @@ -1,2374 +0,0 @@ -From 25f519f66c3e496b21ca1ad83ebc6114dfaa9fc3 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Maja=20K=C4=85dzio=C5=82ka?= -Date: Tue, 22 Apr 2025 07:46:21 +0200 -Subject: [PATCH 01/24] acp3x-alc5682-max98357: Fix path of HiFi.conf -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/551 -Closes: https://github.com/alsa-project/alsa-ucm-conf/issues/550 -Fixes: 1048796e7fa9 ("Rename ucm2/AMD/acp3xalc5682m98 to ucm2/AMD/acp3x-alc5682-max98357") -Signed-off-by: Maja Kądziołka -Signed-off-by: Jaroslav Kysela ---- - ucm2/AMD/acp3x-alc5682-max98357/acp3x-alc5682-max98357.conf | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/ucm2/AMD/acp3x-alc5682-max98357/acp3x-alc5682-max98357.conf b/ucm2/AMD/acp3x-alc5682-max98357/acp3x-alc5682-max98357.conf -index e1f1c9e..5b3f24a 100644 ---- a/ucm2/AMD/acp3x-alc5682-max98357/acp3x-alc5682-max98357.conf -+++ b/ucm2/AMD/acp3x-alc5682-max98357/acp3x-alc5682-max98357.conf -@@ -66,7 +66,7 @@ If.found { - Empty "${var:Found}" - } - False.SectionUseCase."HiFi" { -- File "/AMD/acp3xalc5682m98/HiFi.conf" -+ File "HiFi.conf" - Comment "Default" - } - } --- -2.49.0 - - -From ac64586ab4ad3a0f162af3ec8a196bfd3799c5c0 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 25 Apr 2025 11:47:20 +0200 -Subject: [PATCH 02/24] USB-Audio: Remove useless sections for Solid State Labs - SSL 2+ - -Signed-off-by: Jaroslav Kysela ---- - ucm2/USB-Audio/SolidStateLabs/SSL2Plus-HiFi.conf | 8 -------- - 1 file changed, 8 deletions(-) - -diff --git a/ucm2/USB-Audio/SolidStateLabs/SSL2Plus-HiFi.conf b/ucm2/USB-Audio/SolidStateLabs/SSL2Plus-HiFi.conf -index d07e499..94e040f 100644 ---- a/ucm2/USB-Audio/SolidStateLabs/SSL2Plus-HiFi.conf -+++ b/ucm2/USB-Audio/SolidStateLabs/SSL2Plus-HiFi.conf -@@ -28,14 +28,6 @@ Macro [ - SectionDevice."Line1" { - Comment "Line Outputs 1/L + 2/R" - -- EnableSequence [ -- cdev "hw:${CardId}" -- ] -- -- DisableSequence [ -- cdev "hw:${CardId}" -- ] -- - Value { - PlaybackPriority 200 - } --- -2.49.0 - - -From fc17ed4f991836bb92f288b8714ad7efe6c05926 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 25 Apr 2025 11:53:11 +0200 -Subject: [PATCH 03/24] USB-Audio: Solid State Labs SSL 2+ - fix capture - channels - -It seems that there are 4 capture channels per report in issue #552: - - Capture: - Status: Stop - Interface 2 - Altset 1 - Format: S32_LE - Channels: 4 - Endpoint: 0x81 (1 IN) (ASYNC) - Rates: 44100, 48000, 88200, 96000, 176400, 192000 - Data packet interval: 125 us - Bits: 24 - Channel map: FL FR FC LFE - -Closes: https://github.com/alsa-project/alsa-ucm-conf/issues/552 -Signed-off-by: Jaroslav Kysela ---- - ucm2/USB-Audio/SolidStateLabs/SSL2Plus-HiFi.conf | 6 +++--- - ucm2/USB-Audio/SolidStateLabs/SSL2Plus.conf | 2 +- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/ucm2/USB-Audio/SolidStateLabs/SSL2Plus-HiFi.conf b/ucm2/USB-Audio/SolidStateLabs/SSL2Plus-HiFi.conf -index 94e040f..30160d3 100644 ---- a/ucm2/USB-Audio/SolidStateLabs/SSL2Plus-HiFi.conf -+++ b/ucm2/USB-Audio/SolidStateLabs/SSL2Plus-HiFi.conf -@@ -18,7 +18,7 @@ Macro [ - Name "ssl2plus_mono_in" - Direction Capture - Channels 1 -- HWChannels 2 -+ HWChannels 4 - HWChannelPos0 MONO - HWChannelPos1 MONO - } -@@ -70,7 +70,7 @@ SectionDevice."Mic1" { - Macro.pcm_split.SplitPCMDevice { - Name "ssl2plus_mono_in" - Direction Capture -- HWChannels 2 -+ HWChannels 4 - Channels 1 - Channel0 0 - ChannelPos0 MONO -@@ -86,7 +86,7 @@ SectionDevice."Mic2" { - Macro.pcm_split.SplitPCMDevice { - Name "ssl2plus_mono_in" - Direction Capture -- HWChannels 2 -+ HWChannels 4 - Channels 1 - Channel0 1 - ChannelPos0 MONO -diff --git a/ucm2/USB-Audio/SolidStateLabs/SSL2Plus.conf b/ucm2/USB-Audio/SolidStateLabs/SSL2Plus.conf -index 2ffe4c4..c886593 100644 ---- a/ucm2/USB-Audio/SolidStateLabs/SSL2Plus.conf -+++ b/ucm2/USB-Audio/SolidStateLabs/SSL2Plus.conf -@@ -6,6 +6,6 @@ SectionUseCase."HiFi" { - } - - Define.DirectPlaybackChannels 4 --Define.DirectCaptureChannels 2 -+Define.DirectCaptureChannels 4 - - Include.dhw.File "/common/direct.conf" --- -2.49.0 - - -From 6c2177e856ffa884929ba84de2ba379b80e054a3 Mon Sep 17 00:00:00 2001 -From: Konrad Dybcio -Date: Mon, 14 Apr 2025 20:47:38 +0200 -Subject: [PATCH 04/24] ucm2: Qualcomm: x1e80100: Also match DMI board name - -The Surface Laptop 7 only says "Microsoft Corporation" and "Surface" -in the board_vendor and product_family fields respectively. Add another -field to match on. - -Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/546 -Signed-off-by: Konrad Dybcio -Signed-off-by: Jaroslav Kysela ---- - ucm2/Qualcomm/x1e80100/x1e80100.conf | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/ucm2/Qualcomm/x1e80100/x1e80100.conf b/ucm2/Qualcomm/x1e80100/x1e80100.conf -index 3f89986..3eef4d4 100644 ---- a/ucm2/Qualcomm/x1e80100/x1e80100.conf -+++ b/ucm2/Qualcomm/x1e80100/x1e80100.conf -@@ -1,6 +1,6 @@ - Syntax 4 - --Define.DMI_info "${sys:devices/virtual/dmi/id/board_vendor}-${sys:devices/virtual/dmi/id/product_family}" -+Define.DMI_info "${sys:devices/virtual/dmi/id/board_vendor}-${sys:devices/virtual/dmi/id/product_family}-${sys:devices/virtual/dmi/id/board_name}" - - If.LENOVOT14s { - Condition { --- -2.49.0 - - -From c93b7c8cc3137180cf1e91af2dd212bbf604b66f Mon Sep 17 00:00:00 2001 -From: Konrad Dybcio -Date: Mon, 14 Apr 2025 20:47:38 +0200 -Subject: [PATCH 05/24] ucm2: Qualcomm: Add Surface Laptop 7 - -2 speakers, 2 dmics, combo jack, just like the T14s - reuse its -configuration - -Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/546 -Signed-off-by: Konrad Dybcio -Signed-off-by: Jaroslav Kysela ---- - ucm2/Qualcomm/x1e80100/x1e80100.conf | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/ucm2/Qualcomm/x1e80100/x1e80100.conf b/ucm2/Qualcomm/x1e80100/x1e80100.conf -index 3eef4d4..10faf5f 100644 ---- a/ucm2/Qualcomm/x1e80100/x1e80100.conf -+++ b/ucm2/Qualcomm/x1e80100/x1e80100.conf -@@ -6,7 +6,7 @@ If.LENOVOT14s { - Condition { - Type RegexMatch - String "${var:DMI_info}" -- Regex "LENOVO.*Think((Pad T14s Gen 6.*)|(Book 16 G7 QOY))|(HP.*Omnibook X.*)|(ASUSTeK COMPUTER.*ASUS Zenbook A14)" -+ Regex "LENOVO.*Think((Pad T14s Gen 6.*)|(Book 16 G7 QOY))|(HP.*Omnibook X.*)|(ASUSTeK COMPUTER.*ASUS Zenbook A14)|(Microsoft Corporation.*Surface.*Microsoft Surface Laptop, 7th Edition)" - } - True.Include.t14s.File "/Qualcomm/x1e80100/LENOVO-T14s.conf" - } --- -2.49.0 - - -From 9105573b6cb71c4821d88e6eef0c4b2cfbb4ea61 Mon Sep 17 00:00:00 2001 -From: Svyatoslav Ryhel -Date: Sun, 27 Apr 2025 13:02:19 +0300 -Subject: [PATCH 06/24] tegra: max98089: fix cset names - -Adjust configs to match Linux kernel MAX98089 codec driver change. - -Fixes: 725570f9 ("ASoC: max98088: Remove duplicate DACs") - -Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/556 -Signed-off-by: Svyatoslav Ryhel -Signed-off-by: Jaroslav Kysela ---- - ucm2/Tegra/max98089/lge-x3-HiFi.conf | 24 +++++---------- - ucm2/Tegra/max98089/lge-x3-VoiceCall.conf | 36 ++++++++--------------- - ucm2/Tegra/max98089/lge-x3.conf | 6 ++-- - 3 files changed, 22 insertions(+), 44 deletions(-) - -diff --git a/ucm2/Tegra/max98089/lge-x3-HiFi.conf b/ucm2/Tegra/max98089/lge-x3-HiFi.conf -index 3738d72..d074b9f 100644 ---- a/ucm2/Tegra/max98089/lge-x3-HiFi.conf -+++ b/ucm2/Tegra/max98089/lge-x3-HiFi.conf -@@ -11,20 +11,16 @@ SectionDevice."Speaker" { - cset "name='Speaker Switch' on" - cset "name='Int Spk Switch' on" - -- cset "name='Left SPK Mixer Left DAC1 Switch' on" -- cset "name='Left SPK Mixer Left DAC2 Switch' on" -- cset "name='Left SPK Mixer Right DAC1 Switch' on" -- cset "name='Left SPK Mixer Right DAC2 Switch' on" -+ cset "name='Left SPK Mixer Left DAC Switch' on" -+ cset "name='Left SPK Mixer Right DAC Switch' on" - ] - - DisableSequence [ - cset "name='Speaker Switch' off" - cset "name='Int Spk Switch' off" - -- cset "name='Left SPK Mixer Left DAC1 Switch' off" -- cset "name='Left SPK Mixer Left DAC2 Switch' off" -- cset "name='Left SPK Mixer Right DAC1 Switch' off" -- cset "name='Left SPK Mixer Right DAC2 Switch' off" -+ cset "name='Left SPK Mixer Left DAC Switch' off" -+ cset "name='Left SPK Mixer Right DAC Switch' off" - ] - - Value { -@@ -46,19 +42,15 @@ SectionDevice."Headphones" { - EnableSequence [ - cset "name='Headphone Switch' on" - -- cset "name='Left HP Mixer Left DAC1 Switch' on" -- cset "name='Left HP Mixer Left DAC2 Switch' on" -- cset "name='Right HP Mixer Right DAC1 Switch' on" -- cset "name='Right HP Mixer Right DAC2 Switch' on" -+ cset "name='Left HP Mixer Left DAC Switch' on" -+ cset "name='Right HP Mixer Right DAC Switch' on" - ] - - DisableSequence [ - cset "name='Headphone Switch' off" - -- cset "name='Left HP Mixer Left DAC1 Switch' off" -- cset "name='Left HP Mixer Left DAC2 Switch' off" -- cset "name='Right HP Mixer Right DAC1 Switch' off" -- cset "name='Right HP Mixer Right DAC2 Switch' off" -+ cset "name='Left HP Mixer Left DAC Switch' off" -+ cset "name='Right HP Mixer Right DAC Switch' off" - ] - - Value { -diff --git a/ucm2/Tegra/max98089/lge-x3-VoiceCall.conf b/ucm2/Tegra/max98089/lge-x3-VoiceCall.conf -index 1634c7b..8e3a389 100644 ---- a/ucm2/Tegra/max98089/lge-x3-VoiceCall.conf -+++ b/ucm2/Tegra/max98089/lge-x3-VoiceCall.conf -@@ -11,20 +11,16 @@ SectionDevice."Speaker" { - cset "name='Speaker Switch' on" - cset "name='Int Spk Switch' on" - -- cset "name='Left SPK Mixer Left DAC1 Switch' on" -- cset "name='Left SPK Mixer Left DAC2 Switch' on" -- cset "name='Left SPK Mixer Right DAC1 Switch' on" -- cset "name='Left SPK Mixer Right DAC2 Switch' on" -+ cset "name='Left SPK Mixer Left DAC Switch' on" -+ cset "name='Left SPK Mixer Right DAC Switch' on" - ] - - DisableSequence [ - cset "name='Speaker Switch' off" - cset "name='Int Spk Switch' off" - -- cset "name='Left SPK Mixer Left DAC1 Switch' off" -- cset "name='Left SPK Mixer Left DAC2 Switch' off" -- cset "name='Left SPK Mixer Right DAC1 Switch' off" -- cset "name='Left SPK Mixer Right DAC2 Switch' off" -+ cset "name='Left SPK Mixer Left DAC Switch' off" -+ cset "name='Left SPK Mixer Right DAC Switch' off" - ] - - Value { -@@ -47,30 +43,22 @@ SectionDevice."Earpiece" { - cset "name='Receiver Switch' on" - cset "name='Earpiece Switch' on" - -- cset "name='Left REC Mixer Left DAC1 Switch' on" -- cset "name='Left REC Mixer Left DAC2 Switch' on" -- cset "name='Left REC Mixer Right DAC1 Switch' on" -- cset "name='Left REC Mixer Right DAC2 Switch' on" -+ cset "name='Left REC Mixer Left DAC Switch' on" -+ cset "name='Left REC Mixer Right DAC Switch' on" - -- cset "name='Right REC Mixer Left DAC1 Switch' on" -- cset "name='Right REC Mixer Left DAC2 Switch' on" -- cset "name='Right REC Mixer Right DAC1 Switch' on" -- cset "name='Right REC Mixer Right DAC2 Switch' on" -+ cset "name='Right REC Mixer Left DAC Switch' on" -+ cset "name='Right REC Mixer Right DAC Switch' on" - ] - - DisableSequence [ - cset "name='Receiver Switch' off" - cset "name='Earpiece Switch' off" - -- cset "name='Left REC Mixer Left DAC1 Switch' off" -- cset "name='Left REC Mixer Left DAC2 Switch' off" -- cset "name='Left REC Mixer Right DAC1 Switch' off" -- cset "name='Left REC Mixer Right DAC2 Switch' off" -+ cset "name='Left REC Mixer Left DAC Switch' off" -+ cset "name='Left REC Mixer Right DAC Switch' off" - -- cset "name='Right REC Mixer Left DAC1 Switch' off" -- cset "name='Right REC Mixer Left DAC2 Switch' off" -- cset "name='Right REC Mixer Right DAC1 Switch' off" -- cset "name='Right REC Mixer Right DAC2 Switch' off" -+ cset "name='Right REC Mixer Left DAC Switch' off" -+ cset "name='Right REC Mixer Right DAC Switch' off" - ] - - Value { -diff --git a/ucm2/Tegra/max98089/lge-x3.conf b/ucm2/Tegra/max98089/lge-x3.conf -index 9bea0cc..c90c4a1 100644 ---- a/ucm2/Tegra/max98089/lge-x3.conf -+++ b/ucm2/Tegra/max98089/lge-x3.conf -@@ -30,10 +30,8 @@ BootSequence [ - cset "name='Internal Mic 2 Switch' off" - cset "name='Mic Jack Switch' off" - -- cset "name='Right SPK Mixer Left DAC1 Switch' on" -- cset "name='Right SPK Mixer Left DAC2 Switch' on" -- cset "name='Right SPK Mixer Right DAC1 Switch' on" -- cset "name='Right SPK Mixer Right DAC2 Switch' on" -+ cset "name='Right SPK Mixer Left DAC Switch' on" -+ cset "name='Right SPK Mixer Right DAC Switch' on" - ] - - SectionUseCase."HiFi" { --- -2.49.0 - - -From a1edaee761d301f7d010124599fd9f82c34fc7db Mon Sep 17 00:00:00 2001 -From: Markus Parviainen -Date: Sun, 27 Apr 2025 20:20:42 +0300 -Subject: [PATCH 07/24] Fix Presonus Revelator IO44 HWChannels count - -Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/557 -Signed-off-by: Markus Parviainen -Signed-off-by: Jaroslav Kysela ---- - ucm2/USB-Audio/Presonus/Revelator-IO-44-HiFi.conf | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/ucm2/USB-Audio/Presonus/Revelator-IO-44-HiFi.conf b/ucm2/USB-Audio/Presonus/Revelator-IO-44-HiFi.conf -index f223e08..6439613 100644 ---- a/ucm2/USB-Audio/Presonus/Revelator-IO-44-HiFi.conf -+++ b/ucm2/USB-Audio/Presonus/Revelator-IO-44-HiFi.conf -@@ -59,7 +59,7 @@ SectionDevice."Line1" { - Macro.pcm_split.SplitPCMDevice { - Name "revelator_stereo_out" - Direction Playback -- HWChannels 2 -+ HWChannels 6 - Channels 2 - Channel0 0 - Channel1 1 -@@ -78,7 +78,7 @@ SectionDevice."Line2" { - Macro.pcm_split.SplitPCMDevice { - Name "revelator_stereo_out" - Direction Playback -- HWChannels 2 -+ HWChannels 6 - Channels 2 - Channel0 2 - Channel1 3 -@@ -97,7 +97,7 @@ SectionDevice."Line3" { - Macro.pcm_split.SplitPCMDevice { - Name "revelator_stereo_out" - Direction Playback -- HWChannels 2 -+ HWChannels 6 - Channels 2 - Channel0 4 - Channel1 5 --- -2.49.0 - - -From aa25928dd03299afc9bff994f06c37fc700bb8c0 Mon Sep 17 00:00:00 2001 -From: Johan Hovold -Date: Thu, 15 May 2025 15:06:56 +0200 -Subject: [PATCH 08/24] ucm2: Qualcomm: sc8280xp: fix internal microphones - device - -A recent change renamed the internal microphones device from "DMic01" to -"Mic", but the latter name is already used by the headset microphone so -this breaks the internal microphones on the Lenovo ThinkPad X13s. - -Rename the headset microphone device so that the names are unique and -fix up the jack hw mute property which is still using the old name. - -Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/563 -Fixes: ea7a065a7b50 ("ucm: fix SectionDevice identifiers") -Signed-off-by: Johan Hovold -Signed-off-by: Jaroslav Kysela ---- - ucm2/Qualcomm/sc8280xp/HiFi.conf | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/ucm2/Qualcomm/sc8280xp/HiFi.conf b/ucm2/Qualcomm/sc8280xp/HiFi.conf -index e20aa9c..916f1ee 100644 ---- a/ucm2/Qualcomm/sc8280xp/HiFi.conf -+++ b/ucm2/Qualcomm/sc8280xp/HiFi.conf -@@ -50,8 +50,8 @@ SectionDevice."Headphones" { - } - } - --SectionDevice."Mic" { -- Comment "Mic" -+SectionDevice."Headset" { -+ Comment "Headset microphone" - - Include.wcdmice.File "/codecs/wcd938x/HeadphoneMicEnableSeq.conf" - Include.wcdmicd.File "/codecs/wcd938x/HeadphoneMicDisableSeq.conf" -@@ -63,12 +63,12 @@ SectionDevice."Mic" { - CapturePCM "hw:${CardId},2" - CaptureMixerElem "ADC2" - JackControl "Mic Jack" -- JackHWMute "DMic01" -+ JackHWMute "Mic" - } - } - - SectionDevice."Mic" { -- Comment "Microphone" -+ Comment "Internal microphones" - - Include.vadm0e.File "/codecs/qcom-lpass/va-macro/DMIC0EnableSeq.conf" - Include.vadm0d.File "/codecs/qcom-lpass/va-macro/DMIC0DisableSeq.conf" --- -2.49.0 - - -From 88e1cd78633ea0ad46115ffe8779140fa91fd2f5 Mon Sep 17 00:00:00 2001 -From: Johan Hovold -Date: Thu, 15 May 2025 15:14:53 +0200 -Subject: [PATCH 09/24] ucm2: Qualcomm: sm8650: QRD: fix headset jack hw mute - -A recent change renamed the internal microphone devices but failed to -update the headset jack hw mute properties that are still using the old -names. - -Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/563 -Fixes: ea7a065a7b50 ("ucm: fix SectionDevice identifiers") -Signed-off-by: Johan Hovold -Signed-off-by: Jaroslav Kysela ---- - ucm2/Qualcomm/sm8650/QRD/HiFi.conf | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/ucm2/Qualcomm/sm8650/QRD/HiFi.conf b/ucm2/Qualcomm/sm8650/QRD/HiFi.conf -index 4336525..ca40c29 100644 ---- a/ucm2/Qualcomm/sm8650/QRD/HiFi.conf -+++ b/ucm2/Qualcomm/sm8650/QRD/HiFi.conf -@@ -77,8 +77,8 @@ SectionDevice."Headset" { - CapturePCM "hw:${CardId},2" - CaptureMixerElem "ADC2" - JackControl "Mic Jack" -- JackHWMute "Bottom" -- JackHWMute "Back" -+ JackHWMute "Mic1" -+ JackHWMute "Mic2" - } - } - --- -2.49.0 - - -From bab88e0c31cee1c2603428c2ce6444aea343b646 Mon Sep 17 00:00:00 2001 -From: Johan Hovold -Date: Thu, 15 May 2025 15:17:02 +0200 -Subject: [PATCH 10/24] ucm2: tegra: max98090: fix headphones conflicting - device - -A recent change renames the speaker device but failed to update the -headphones conflicting device list. - -Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/563 -Fixes: ea7a065a7b50 ("ucm: fix SectionDevice identifiers") -Signed-off-by: Johan Hovold -Signed-off-by: Jaroslav Kysela ---- - ucm2/Tegra/max98090/HiFi.conf | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/ucm2/Tegra/max98090/HiFi.conf b/ucm2/Tegra/max98090/HiFi.conf -index d6e4e9d..5d4ef71 100644 ---- a/ucm2/Tegra/max98090/HiFi.conf -+++ b/ucm2/Tegra/max98090/HiFi.conf -@@ -33,7 +33,7 @@ SectionDevice."Headphones" { - Comment = "Headphones" - - ConflictingDevice [ -- "Speakers" -+ "Speaker" - ] - - EnableSequence [ --- -2.49.0 - - -From 24d62b54d5ad6c7e6f9cff4cedcc334b1c98602f Mon Sep 17 00:00:00 2001 -From: Johan Hovold -Date: Thu, 15 May 2025 15:19:01 +0200 -Subject: [PATCH 11/24] ucm2: USB-Audio: Behringer: Flow8: fix conflicting - devices - -A recent change renamed the Line-56 and Line-78 devices but failed to -update the conflicting device lists. - -Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/563 -Fixes: ea7a065a7b50 ("ucm: fix SectionDevice identifiers") -Signed-off-by: Johan Hovold -Signed-off-by: Jaroslav Kysela ---- - ucm2/USB-Audio/Behringer/Flow8-Recording-Hifi.conf | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/ucm2/USB-Audio/Behringer/Flow8-Recording-Hifi.conf b/ucm2/USB-Audio/Behringer/Flow8-Recording-Hifi.conf -index 5dce19c..8ce7590 100644 ---- a/ucm2/USB-Audio/Behringer/Flow8-Recording-Hifi.conf -+++ b/ucm2/USB-Audio/Behringer/Flow8-Recording-Hifi.conf -@@ -157,7 +157,7 @@ SectionDevice."Line5" { - Comment "Line/Inst 5 (L)" - - ConflictingDevice [ -- "Line56" -+ "Line9" - ] - - Value { -@@ -177,7 +177,7 @@ SectionDevice."Line6" { - Comment "Line/Inst(HiZ) 6 (R)" - - ConflictingDevice [ -- "Line56" -+ "Line9" - ] - - Value { -@@ -197,7 +197,7 @@ SectionDevice."Line7" { - Comment "Line/Inst 7 (L)" - - ConflictingDevice [ -- "Line78" -+ "Line10" - ] - - Value { -@@ -217,7 +217,7 @@ SectionDevice."Line8" { - Comment "Line/Inst(HiZ) 8 (R)" - - ConflictingDevice [ -- "Line78" -+ "Line10" - ] - - Value { --- -2.49.0 - - -From 1f816194a9feb2ce0c973ccc2a93551a6f641d77 Mon Sep 17 00:00:00 2001 -From: Hiago De Franco -Date: Mon, 12 May 2025 13:57:32 -0300 -Subject: [PATCH 12/24] ucm2: IO-Boards: Toradex: smarc: add support - -Add support for Toradex SMARC Development board, using the WM8904 audio -codec. - -This is a carrier board for the Toradex SMARC family, where any SMARC -SoM can be connected to it, therefore this is being added to the -IO-Boards instead of a specific hardware vendor. - -Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/562 -Signed-off-by: Hiago De Franco -Signed-off-by: Jaroslav Kysela ---- - ucm2/IO-Boards/Toradex/smarc/dev-HiFi.conf | 39 +++++++++++++++++++ - ucm2/IO-Boards/Toradex/smarc/dev.conf | 17 ++++++++ - ucm2/conf.d/simple-card/tdx-smarc-wm8904.conf | 1 + - 3 files changed, 57 insertions(+) - create mode 100644 ucm2/IO-Boards/Toradex/smarc/dev-HiFi.conf - create mode 100644 ucm2/IO-Boards/Toradex/smarc/dev.conf - create mode 120000 ucm2/conf.d/simple-card/tdx-smarc-wm8904.conf - -diff --git a/ucm2/IO-Boards/Toradex/smarc/dev-HiFi.conf b/ucm2/IO-Boards/Toradex/smarc/dev-HiFi.conf -new file mode 100644 -index 0000000..7d2dffc ---- /dev/null -+++ b/ucm2/IO-Boards/Toradex/smarc/dev-HiFi.conf -@@ -0,0 +1,39 @@ -+# Use case configuration for Toradex SMARC Development Carrier Board -+# This is a carrier board for the Toradex SMARC family, where any Toradex SMARC -+# SoM (with different SoCs as iMX8MP, iMX95...) can be connected to it. -+ -+SectionDevice."Headphones" { -+ Comment "Headphones" -+ -+ EnableSequence [ -+ cset "name='Headphone Switch' on" -+ ] -+ -+ DisableSequence [ -+ cset "name='Headphone Switch' off" -+ ] -+ -+ Value { -+ PlaybackPCM "hw:${CardId}" -+ PlaybackVolume "Headphone Volume" -+ PlaybackSwitch "Headphone Switch" -+ } -+} -+ -+SectionDevice."Mic" { -+ Comment "Microphone" -+ -+ EnableSequence [ -+ cset "name='Capture Switch' on" -+ ] -+ -+ DisableSequence [ -+ cset "name='Capture Switch' off" -+ ] -+ -+ Value { -+ CapturePCM "hw:${CardId}" -+ CaptureVolume "Capture Volume" -+ CaptureSwitch "Capture Switch" -+ } -+} -diff --git a/ucm2/IO-Boards/Toradex/smarc/dev.conf b/ucm2/IO-Boards/Toradex/smarc/dev.conf -new file mode 100644 -index 0000000..e795068 ---- /dev/null -+++ b/ucm2/IO-Boards/Toradex/smarc/dev.conf -@@ -0,0 +1,17 @@ -+# Use case configuration for Toradex SMARC Development Carrier Board -+# This is a carrier board for the Toradex SMARC family, where any Toradex SMARC -+# SoM (with different SoCs as iMX8MP, iMX95...) can be connected to it. -+ -+Syntax 4 -+ -+SectionUseCase."HiFi" { -+ File "/IO-Boards/Toradex/smarc/dev-HiFi.conf" -+ Comment "Default" -+} -+ -+BootSequence [ -+ cset "name='Headphone Volume' 50%" -+ cset "name='Left Capture Inverting Mux' 'IN1L'" -+ cset "name='Right Capture Inverting Mux' 'IN1R'" -+ cset "name='Capture Volume' 31" -+] -diff --git a/ucm2/conf.d/simple-card/tdx-smarc-wm8904.conf b/ucm2/conf.d/simple-card/tdx-smarc-wm8904.conf -new file mode 120000 -index 0000000..096f833 ---- /dev/null -+++ b/ucm2/conf.d/simple-card/tdx-smarc-wm8904.conf -@@ -0,0 +1 @@ -+../../IO-Boards/Toradex/smarc/dev.conf -\ No newline at end of file --- -2.49.0 - - -From ac918f9b606f6bfe102c449997a1bcab01934db0 Mon Sep 17 00:00:00 2001 -From: Flo -Date: Sat, 24 May 2025 11:52:12 +0200 -Subject: [PATCH 13/24] USB-Audio: Solid State Labs SSL 2 - fix capture - channels - -Same fix as for SSL+, commit fc17ed4. -Capture configuration is the same, with 4 channels. - - Capture: - Status: Stop - Interface 2 - Altset 1 - Format: S32_LE - Channels: 4 - Endpoint: 0x81 (1 IN) (ASYNC) - Rates: 44100, 48000, 88200, 96000, 176400, 192000 - Data packet interval: 125 us - Bits: 24 - Channel map: FL FR FC LFE - -Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/566 -Signed-off-by: Flo -Signed-off-by: Jaroslav Kysela ---- - ucm2/USB-Audio/SolidStateLabs/SSL2-HiFi.conf | 6 +++--- - ucm2/USB-Audio/SolidStateLabs/SSL2.conf | 2 +- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/ucm2/USB-Audio/SolidStateLabs/SSL2-HiFi.conf b/ucm2/USB-Audio/SolidStateLabs/SSL2-HiFi.conf -index 46b2e26..8663384 100644 ---- a/ucm2/USB-Audio/SolidStateLabs/SSL2-HiFi.conf -+++ b/ucm2/USB-Audio/SolidStateLabs/SSL2-HiFi.conf -@@ -6,7 +6,7 @@ Macro [ - Name "ssl2_mono_in" - Direction Capture - Channels 1 -- HWChannels 2 -+ HWChannels 4 - HWChannelPos0 MONO - HWChannelPos1 MONO - } -@@ -31,7 +31,7 @@ SectionDevice."Mic1" { - Macro.pcm_split.SplitPCMDevice { - Name "ssl2_mono_in" - Direction Capture -- HWChannels 2 -+ HWChannels 4 - Channels 1 - Channel0 0 - ChannelPos0 MONO -@@ -47,7 +47,7 @@ SectionDevice."Mic2" { - Macro.pcm_split.SplitPCMDevice { - Name "ssl2_mono_in" - Direction Capture -- HWChannels 2 -+ HWChannels 4 - Channels 1 - Channel0 1 - ChannelPos0 MONO -diff --git a/ucm2/USB-Audio/SolidStateLabs/SSL2.conf b/ucm2/USB-Audio/SolidStateLabs/SSL2.conf -index 5531834..3cdb60b 100644 ---- a/ucm2/USB-Audio/SolidStateLabs/SSL2.conf -+++ b/ucm2/USB-Audio/SolidStateLabs/SSL2.conf -@@ -6,6 +6,6 @@ SectionUseCase."HiFi" { - } - - Define.DirectPlaybackChannels 2 --Define.DirectCaptureChannels 2 -+Define.DirectCaptureChannels 4 - - Include.dhw.File "/common/direct.conf" --- -2.49.0 - - -From 421e37bae75efc1fc134fbc84bc301f041aaff3b Mon Sep 17 00:00:00 2001 -From: Craig McLure -Date: Tue, 6 May 2025 18:40:47 +0100 -Subject: [PATCH 14/24] USB-Audio: Added Beacn Mic and Studio Support - -Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/558 -Signed-off-by: Craig McLure -Signed-off-by: Jaroslav Kysela ---- - ucm2/USB-Audio/Beacn/Beacn-Mic-HiFi.conf | 63 ++++++ - ucm2/USB-Audio/Beacn/Beacn-Mic.conf | 11 ++ - .../Beacn/Beacn-Studio-USB1-Channels.conf | 41 ++++ - .../Beacn/Beacn-Studio-USB1-HiFi.conf | 35 ++++ - .../Beacn/Beacn-Studio-USB1-Link-HiFi.conf | 179 ++++++++++++++++++ - .../Beacn/Beacn-Studio-USB2-HiFi.conf | 175 +++++++++++++++++ - ucm2/USB-Audio/Beacn/Beacn-Studio.conf | 42 ++++ - ucm2/USB-Audio/USB-Audio.conf | 16 ++ - 8 files changed, 562 insertions(+) - create mode 100644 ucm2/USB-Audio/Beacn/Beacn-Mic-HiFi.conf - create mode 100644 ucm2/USB-Audio/Beacn/Beacn-Mic.conf - create mode 100644 ucm2/USB-Audio/Beacn/Beacn-Studio-USB1-Channels.conf - create mode 100644 ucm2/USB-Audio/Beacn/Beacn-Studio-USB1-HiFi.conf - create mode 100644 ucm2/USB-Audio/Beacn/Beacn-Studio-USB1-Link-HiFi.conf - create mode 100644 ucm2/USB-Audio/Beacn/Beacn-Studio-USB2-HiFi.conf - create mode 100644 ucm2/USB-Audio/Beacn/Beacn-Studio.conf - -diff --git a/ucm2/USB-Audio/Beacn/Beacn-Mic-HiFi.conf b/ucm2/USB-Audio/Beacn/Beacn-Mic-HiFi.conf -new file mode 100644 -index 0000000..2445531 ---- /dev/null -+++ b/ucm2/USB-Audio/Beacn/Beacn-Mic-HiFi.conf -@@ -0,0 +1,63 @@ -+Include.pcm_split.File "/common/pcm/split.conf" -+ -+Macro [ -+ { -+ SplitPCM { -+ Name "beacn_mic_stereo_out" -+ Direction Playback -+ Channels 2 -+ HWChannels 3 -+ HWChannelPos0 FL -+ HWChannelPos1 FR -+ HWChannelPos2 MONO -+ } -+ } -+ { -+ SplitPCM { -+ Name "beacn_mic_stereo_in" -+ Direction Capture -+ Channels 2 -+ HWChannels 4 -+ HWChannelPos0 FL -+ HWChannelPos1 FR -+ HWChannelPos2 MONO # Dry Mic -+ HWChannelPos3 MONO # Dry + Expander -+ } -+ } -+] -+ -+SectionDevice."Headphones" { -+ Comment "Headphones" -+ -+ Value { -+ PlaybackPriority 200 -+ } -+ Macro.pcm_split.SplitPCMDevice { -+ Name "beacn_mic_stereo_out" -+ Direction Playback -+ HWChannels 3 -+ Channels 2 -+ Channel0 0 -+ Channel1 1 -+ ChannelPos0 FL -+ ChannelPos1 FR -+ } -+} -+ -+SectionDevice."Mic" { -+ Comment "Microphone" -+ -+ Value { -+ CapturePriority 200 -+ } -+ Macro.pcm_split.SplitPCMDevice { -+ Name "beacn_mic_stereo_in" -+ Direction Capture -+ HWChannels 4 -+ Channels 2 -+ Channel0 0 -+ Channel1 1 -+ ChannelPos0 FL -+ ChannelPos1 FR -+ } -+} -diff --git a/ucm2/USB-Audio/Beacn/Beacn-Mic.conf b/ucm2/USB-Audio/Beacn/Beacn-Mic.conf -new file mode 100644 -index 0000000..95c6f81 ---- /dev/null -+++ b/ucm2/USB-Audio/Beacn/Beacn-Mic.conf -@@ -0,0 +1,11 @@ -+Comment "Beacn Mic USB" -+ -+SectionUseCase."HiFi" { -+ Comment "Default Alsa Profile" -+ File "/USB-Audio/Beacn/Beacn-Mic-HiFi.conf" -+} -+ -+Define.DirectPlaybackChannels 3 -+Define.DirectCaptureChannels 4 -+ -+Include.dhw.File "/common/direct.conf" -diff --git a/ucm2/USB-Audio/Beacn/Beacn-Studio-USB1-Channels.conf b/ucm2/USB-Audio/Beacn/Beacn-Studio-USB1-Channels.conf -new file mode 100644 -index 0000000..b9886f4 ---- /dev/null -+++ b/ucm2/USB-Audio/Beacn/Beacn-Studio-USB1-Channels.conf -@@ -0,0 +1,41 @@ -+Include.pcm_split.File "/common/pcm/split.conf" -+ -+Macro.playback.SplitPCM { -+ Name "beacn_studio_stereo_out" -+ Direction Playback -+ Channels 2 -+ HWChannels 11 -+ HWChannelPos0 FL # Headphone Left -+ HWChannelPos1 FR # Headphone Right -+ HWChannelPos2 MONO # Unused Channel -+ HWChannelPos3 FL # Link 1 Out Left -+ HWChannelPos4 FR # Link 1 Out Right -+ HWChannelPos5 FL # Link 2 Out Left -+ HWChannelPos6 FR # Link 2 Out Right -+ HWChannelPos7 FL # Link 3 Out Left -+ HWChannelPos8 FR # Link 3 Out Right -+ HWChannelPos9 FL # Link 4 Out Left -+ HWChannelPos10 FR # Link 4 Out Right -+} -+ -+Macro.capture.SplitPCM { -+ Name "beacn_studio_stereo_in" -+ Direction Capture -+ Channels 2 -+ HWChannels 12 -+ -+ HWChannelPos0 FL # Microphone Left -+ HWChannelPos1 FR # Microphone Right -+ -+ HWChannelPos2 MONO # UNKNOWN (Possible Dry Mic) -+ HWChannelPos3 MONO # UNKNOWN (Possible Dry + Expander) -+ -+ HWChannelPos4 FL # Link 1 In Left -+ HWChannelPos5 FR # Link 1 In Right -+ HWChannelPos6 FL # Link 2 In Left -+ HWChannelPos7 FR # Link 2 In Right -+ HWChannelPos8 FL # Link 3 In Left -+ HWChannelPos9 FR # Link 3 In Right -+ HWChannelPos10 FL # Link 4 In Left -+ HWChannelPos11 FR # Link 4 In Right -+} -diff --git a/ucm2/USB-Audio/Beacn/Beacn-Studio-USB1-HiFi.conf b/ucm2/USB-Audio/Beacn/Beacn-Studio-USB1-HiFi.conf -new file mode 100644 -index 0000000..8c90d5b ---- /dev/null -+++ b/ucm2/USB-Audio/Beacn/Beacn-Studio-USB1-HiFi.conf -@@ -0,0 +1,35 @@ -+SectionDevice."Headphones" { -+ Comment "Headphones" -+ -+ Value { -+ PlaybackPriority 100 -+ } -+ Macro.pcm_split.SplitPCMDevice { -+ Name "beacn_studio_stereo_out" -+ Direction Playback -+ HWChannels 11 -+ Channels 2 -+ Channel0 0 -+ Channel1 1 -+ ChannelPos0 FL -+ ChannelPos1 FR -+ } -+} -+ -+SectionDevice."Mic" { -+ Comment "Microphone" -+ -+ Value { -+ CapturePriority 100 -+ } -+ Macro.pcm_split.SplitPCMDevice { -+ Name "beacn_studio_stereo_in" -+ Direction Capture -+ HWChannels 12 -+ Channels 2 -+ Channel0 0 -+ Channel1 1 -+ ChannelPos0 FL -+ ChannelPos1 FR -+ } -+} -diff --git a/ucm2/USB-Audio/Beacn/Beacn-Studio-USB1-Link-HiFi.conf b/ucm2/USB-Audio/Beacn/Beacn-Studio-USB1-Link-HiFi.conf -new file mode 100644 -index 0000000..74ff142 ---- /dev/null -+++ b/ucm2/USB-Audio/Beacn/Beacn-Studio-USB1-Link-HiFi.conf -@@ -0,0 +1,179 @@ -+SectionDevice."Line1" { -+ Comment "Link 4" -+ -+ Value { -+ PlaybackPriority 400 -+ } -+ Macro.pcm_split.SplitPCMDevice { -+ Name "beacn_studio_stereo_out" -+ Direction Playback -+ HWChannels 11 -+ Channels 2 -+ Channel0 9 -+ Channel1 10 -+ ChannelPos0 FL -+ ChannelPos1 FR -+ } -+} -+ -+SectionDevice."Line2" { -+ Comment "Link 3" -+ -+ Value { -+ PlaybackPriority 400 -+ } -+ Macro.pcm_split.SplitPCMDevice { -+ Name "beacn_studio_stereo_out" -+ Direction Playback -+ HWChannels 11 -+ Channels 2 -+ Channel0 7 -+ Channel1 8 -+ ChannelPos0 FL -+ ChannelPos1 FR -+ } -+} -+ -+SectionDevice."Line3" { -+ Comment "Link 2" -+ -+ Value { -+ PlaybackPriority 400 -+ } -+ Macro.pcm_split.SplitPCMDevice { -+ Name "beacn_studio_stereo_out" -+ Direction Playback -+ HWChannels 11 -+ Channels 2 -+ Channel0 5 -+ Channel1 6 -+ ChannelPos0 FL -+ ChannelPos1 FR -+ } -+} -+ -+SectionDevice."Line4" { -+ Comment "Link 1" -+ -+ Value { -+ PlaybackPriority 400 -+ } -+ Macro.pcm_split.SplitPCMDevice { -+ Name "beacn_studio_stereo_out" -+ Direction Playback -+ HWChannels 11 -+ Channels 2 -+ Channel0 3 -+ Channel1 4 -+ ChannelPos0 FL -+ ChannelPos1 FR -+ } -+} -+ -+SectionDevice."Headphones" { -+ Comment "Headphones" -+ -+ Value { -+ PlaybackPriority 100 -+ } -+ Macro.pcm_split.SplitPCMDevice { -+ Name "beacn_studio_stereo_out" -+ Direction Playback -+ HWChannels 11 -+ Channels 2 -+ Channel0 0 -+ Channel1 1 -+ ChannelPos0 FL -+ ChannelPos1 FR -+ } -+} -+ -+SectionDevice."Line5" { -+ Comment "Link 4" -+ -+ Value { -+ PlaybackPriority 400 -+ } -+ Macro.pcm_split.SplitPCMDevice { -+ Name "beacn_studio_stereo_in" -+ Direction Capture -+ HWChannels 12 -+ Channels 2 -+ Channel0 10 -+ Channel1 11 -+ ChannelPos0 FL -+ ChannelPos1 FR -+ } -+} -+ -+SectionDevice."Line6" { -+ Comment "Link 3" -+ -+ Value { -+ PlaybackPriority 400 -+ } -+ Macro.pcm_split.SplitPCMDevice { -+ Name "beacn_studio_stereo_in" -+ Direction Capture -+ HWChannels 12 -+ Channels 2 -+ Channel0 8 -+ Channel1 9 -+ ChannelPos0 FL -+ ChannelPos1 FR -+ } -+} -+ -+SectionDevice."Line7" { -+ Comment "Link 2" -+ -+ Value { -+ PlaybackPriority 400 -+ } -+ Macro.pcm_split.SplitPCMDevice { -+ Name "beacn_studio_stereo_in" -+ Direction Capture -+ HWChannels 12 -+ Channels 2 -+ Channel0 6 -+ Channel1 7 -+ ChannelPos0 FL -+ ChannelPos1 FR -+ } -+} -+ -+SectionDevice."Line8" { -+ Comment "Link 1" -+ -+ Value { -+ PlaybackPriority 400 -+ } -+ Macro.pcm_split.SplitPCMDevice { -+ Name "beacn_studio_stereo_in" -+ Direction Capture -+ HWChannels 12 -+ Channels 2 -+ Channel0 4 -+ Channel1 5 -+ ChannelPos0 FL -+ ChannelPos1 FR -+ } -+} -+ -+SectionDevice."Mic" { -+ Comment "Microphone" -+ -+ Value { -+ CapturePriority 100 -+ } -+ Macro.pcm_split.SplitPCMDevice { -+ Name "beacn_studio_stereo_in" -+ Direction Capture -+ HWChannels 12 -+ Channels 2 -+ Channel0 0 -+ Channel1 1 -+ ChannelPos0 FL -+ ChannelPos1 FR -+ } -+} -diff --git a/ucm2/USB-Audio/Beacn/Beacn-Studio-USB2-HiFi.conf b/ucm2/USB-Audio/Beacn/Beacn-Studio-USB2-HiFi.conf -new file mode 100644 -index 0000000..5988d41 ---- /dev/null -+++ b/ucm2/USB-Audio/Beacn/Beacn-Studio-USB2-HiFi.conf -@@ -0,0 +1,175 @@ -+Include.pcm_split.File "/common/pcm/split.conf" -+ -+Macro.playback.SplitPCM { -+ Name "beacn_studio_stereo_out" -+ Direction Playback -+ Channels 2 -+ HWChannels 8 -+ HWChannelPos0 FL -+ HWChannelPos1 FR -+ HWChannelPos2 FL -+ HWChannelPos3 FR -+ HWChannelPos4 FL -+ HWChannelPos5 FR -+ HWChannelPos6 FL -+ HWChannelPos7 FR -+} -+ -+Macro.capture.SplitPCM { -+ Name "beacn_studio_stereo_in" -+ Direction Capture -+ Channels 2 -+ HWChannels 8 -+ HWChannelPos0 FL -+ HWChannelPos1 FR -+ HWChannelPos2 FL -+ HWChannelPos3 FR -+ HWChannelPos4 FL -+ HWChannelPos5 FR -+ HWChannelPos6 FL -+ HWChannelPos7 FR -+} -+ -+SectionDevice."Line1" { -+ Comment "Link 4" -+ -+ Value { -+ PlaybackPriority 400 -+ } -+ Macro.pcm_split.SplitPCMDevice { -+ Name "beacn_studio_stereo_out" -+ Direction Playback -+ HWChannels 8 -+ Channels 2 -+ Channel0 6 -+ Channel1 7 -+ ChannelPos0 FL -+ ChannelPos1 FR -+ } -+} -+ -+SectionDevice."Line2" { -+ Comment "Link 3" -+ -+ Value { -+ PlaybackPriority 400 -+ } -+ Macro.pcm_split.SplitPCMDevice { -+ Name "beacn_studio_stereo_out" -+ Direction Playback -+ HWChannels 8 -+ Channels 2 -+ Channel0 4 -+ Channel1 5 -+ ChannelPos0 FL -+ ChannelPos1 FR -+ } -+} -+ -+SectionDevice."Line3" { -+ Comment "Link 2" -+ -+ Value { -+ PlaybackPriority 400 -+ } -+ Macro.pcm_split.SplitPCMDevice { -+ Name "beacn_studio_stereo_out" -+ Direction Playback -+ HWChannels 8 -+ Channels 2 -+ Channel0 2 -+ Channel1 3 -+ ChannelPos0 FL -+ ChannelPos1 FR -+ } -+} -+ -+SectionDevice."Line4" { -+ Comment "Link 1" -+ -+ Value { -+ PlaybackPriority 400 -+ } -+ Macro.pcm_split.SplitPCMDevice { -+ Name "beacn_studio_stereo_out" -+ Direction Playback -+ HWChannels 8 -+ Channels 2 -+ Channel0 0 -+ Channel1 1 -+ ChannelPos0 FL -+ ChannelPos1 FR -+ } -+} -+ -+SectionDevice."Line5" { -+ Comment "Link 4" -+ -+ Value { -+ PlaybackPriority 400 -+ } -+ Macro.pcm_split.SplitPCMDevice { -+ Name "beacn_studio_stereo_in" -+ Direction Capture -+ HWChannels 8 -+ Channels 2 -+ Channel0 6 -+ Channel1 7 -+ ChannelPos0 FL -+ ChannelPos1 FR -+ } -+} -+ -+SectionDevice."Line6" { -+ Comment "Link 3" -+ -+ Value { -+ PlaybackPriority 400 -+ } -+ Macro.pcm_split.SplitPCMDevice { -+ Name "beacn_studio_stereo_in" -+ Direction Capture -+ HWChannels 8 -+ Channels 2 -+ Channel0 4 -+ Channel1 5 -+ ChannelPos0 FL -+ ChannelPos1 FR -+ } -+} -+ -+SectionDevice."Line7" { -+ Comment "Link 2" -+ -+ Value { -+ PlaybackPriority 400 -+ } -+ Macro.pcm_split.SplitPCMDevice { -+ Name "beacn_studio_stereo_in" -+ Direction Capture -+ HWChannels 8 -+ Channels 2 -+ Channel0 2 -+ Channel1 3 -+ ChannelPos0 FL -+ ChannelPos1 FR -+ } -+} -+ -+SectionDevice."Line8" { -+ Comment "Link 1" -+ -+ Value { -+ PlaybackPriority 400 -+ } -+ Macro.pcm_split.SplitPCMDevice { -+ Name "beacn_studio_stereo_in" -+ Direction Capture -+ HWChannels 8 -+ Channels 2 -+ Channel0 0 -+ Channel1 1 -+ ChannelPos0 FL -+ ChannelPos1 FR -+ } -+} -diff --git a/ucm2/USB-Audio/Beacn/Beacn-Studio.conf b/ucm2/USB-Audio/Beacn/Beacn-Studio.conf -new file mode 100644 -index 0000000..1b3adc0 ---- /dev/null -+++ b/ucm2/USB-Audio/Beacn/Beacn-Studio.conf -@@ -0,0 +1,42 @@ -+# The Beacn Studio has two USB ports which both present different PIDs, so we do -+# individual checks, and load the appropriate configs for the port connected. -+ -+Comment "Beacn Studio USB" -+If.usb1 { -+ Condition { -+ Type String -+ Haystack "${CardComponents}" -+ Needle "USB33ae:0003" -+ } -+ True { -+ # Channel configuration is common between all the profiles, so we'll include it here -+ Include.pcm_split.File "/USB-Audio/Beacn/Beacn-Studio-USB1-Channels.conf" -+ -+ # If the user isn't using the 'Dual PC' feature of the Beacn Studio, there isn't really -+ # much point presenting them with an additional 4 unusable inputs and outputs, so we'll -+ # offer two profile options so those channels can be hidden. -+ SectionUseCase."Basic" { -+ Comment "Beacn Studio" -+ File "/USB-Audio/Beacn/Beacn-Studio-USB1-HiFi.conf" -+ } -+ -+ SectionUseCase."Link" { -+ Comment "Beacn Studio with Link" -+ File "/USB-Audio/Beacn/Beacn-Studio-USB1-Link-HiFi.conf" -+ } -+ } -+} -+ -+If.usb2 { -+ Condition { -+ Type String -+ Haystack "${CardComponents}" -+ Needle "USB33ae:4003" -+ } -+ True { -+ SectionUseCase."Link" { -+ Comment "Beacn Studio Link" -+ File "/USB-Audio/Beacn/Beacn-Studio-USB2-HiFi.conf" -+ } -+ } -+} -diff --git a/ucm2/USB-Audio/USB-Audio.conf b/ucm2/USB-Audio/USB-Audio.conf -index fe2cd46..d90db39 100644 ---- a/ucm2/USB-Audio/USB-Audio.conf -+++ b/ucm2/USB-Audio/USB-Audio.conf -@@ -541,7 +541,23 @@ If.ssl2plus { - ProfileName "SolidStateLabs/SSL2Plus" - } - } -+If.beacn-mic { -+ Condition { -+ Type String -+ Haystack "${CardComponents}" -+ Needle "USB33ae:0001" -+ } -+ True.Define.ProfileName "Beacn/Beacn-Mic" -+} - -+If.beacn-studio { -+ Condition { -+ Type RegexMatch -+ String "${CardComponents}" -+ Regex "USB33ae:[04]003" -+ } -+ True.Define.ProfileName "Beacn/Beacn-Studio" -+} - If.mixremap { - Condition { - Type String --- -2.49.0 - - -From e055d16bdf971e26c3d92d998bccb2ca4e4f3c1a Mon Sep 17 00:00:00 2001 -From: binarycraft007 -Date: Mon, 2 Jun 2025 13:41:38 +0800 -Subject: [PATCH 15/24] ucm2: Qualcomm: add ASUS Vivobook S 15 support - -S15 supports: - - 2 speakers. - - 2 dmics - - headset with mic. - -This patch adds support to all these, however only speakers, dmic and -headset playback is tested. - -Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/570 -Signed-off-by: binarycraft007 -Signed-off-by: Jaroslav Kysela ---- - ucm2/Qualcomm/x1e80100/x1e80100.conf | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/ucm2/Qualcomm/x1e80100/x1e80100.conf b/ucm2/Qualcomm/x1e80100/x1e80100.conf -index 10faf5f..ecbb13d 100644 ---- a/ucm2/Qualcomm/x1e80100/x1e80100.conf -+++ b/ucm2/Qualcomm/x1e80100/x1e80100.conf -@@ -6,7 +6,7 @@ If.LENOVOT14s { - Condition { - Type RegexMatch - String "${var:DMI_info}" -- Regex "LENOVO.*Think((Pad T14s Gen 6.*)|(Book 16 G7 QOY))|(HP.*Omnibook X.*)|(ASUSTeK COMPUTER.*ASUS Zenbook A14)|(Microsoft Corporation.*Surface.*Microsoft Surface Laptop, 7th Edition)" -+ Regex "LENOVO.*Think((Pad T14s Gen 6.*)|(Book 16 G7 QOY))|(HP.*Omnibook X.*)|ASUSTeK COMPUTER.*ASUS (Zenbook A14|Vivobook S 15)|(Microsoft Corporation.*Surface.*Microsoft Surface Laptop, 7th Edition)" - } - True.Include.t14s.File "/Qualcomm/x1e80100/LENOVO-T14s.conf" - } --- -2.49.0 - - -From 59d53fd9cac27e9a05623251aefa6d06da94260c Mon Sep 17 00:00:00 2001 -From: Craig McLure -Date: Wed, 4 Jun 2025 23:25:51 +0100 -Subject: [PATCH 16/24] Changed 'Stream Mix' channel names to match the latest - Window release - -Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/572 -Signed-off-by: Craig McLure -Signed-off-by: Jaroslav Kysela ---- - ucm2/USB-Audio/GoXLR/GoXLR-HiFi.conf | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/ucm2/USB-Audio/GoXLR/GoXLR-HiFi.conf b/ucm2/USB-Audio/GoXLR/GoXLR-HiFi.conf -index 6614b00..17c6580 100644 ---- a/ucm2/USB-Audio/GoXLR/GoXLR-HiFi.conf -+++ b/ucm2/USB-Audio/GoXLR/GoXLR-HiFi.conf -@@ -140,7 +140,7 @@ SectionDevice."Line3" { - } - - SectionDevice."Line4" { -- Comment "Broadcast Stream Mix" -+ Comment "Stream Mix 1" - - Value { - CapturePriority 200 -@@ -200,7 +200,7 @@ If.mix2 { - String2 "25" - } - True.SectionDevice."Line6" { -- Comment "Broadcast Stream Mix 2" -+ Comment "Stream Mix 2" - - Value { - CapturePriority 200 --- -2.49.0 - - -From bd5cf3839f902b67a355669fdf1bd3231e0cb4c1 Mon Sep 17 00:00:00 2001 -From: Mohammad Rafi Shaik -Date: Mon, 9 Jun 2025 20:52:42 +0530 -Subject: [PATCH 17/24] Qualcomm: Add QCS9075-IQ-EVK HiFi config - -Add UCM2 configs for the Qualcomm QCS9075-IQ-EVK Board to handle: - - I2S Speaker Amplifier - - I2S Mic - -Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/576 -Signed-off-by: Mohammad Rafi Shaik -Signed-off-by: Jaroslav Kysela ---- - .../qcs9075/qcs9075-iq-evk-snd-card/HiFi.conf | 29 +++++++++++++++++++ - .../qcs9075-iq-evk-snd-card.conf | 6 ++++ - .../qcs9075/qcs9075-iq-evk-snd-card.conf | 6 ++++ - 3 files changed, 41 insertions(+) - create mode 100644 ucm2/Qualcomm/qcs9075/qcs9075-iq-evk-snd-card/HiFi.conf - create mode 100644 ucm2/Qualcomm/qcs9075/qcs9075-iq-evk-snd-card/qcs9075-iq-evk-snd-card.conf - create mode 100644 ucm2/conf.d/qcs9075/qcs9075-iq-evk-snd-card.conf - -diff --git a/ucm2/Qualcomm/qcs9075/qcs9075-iq-evk-snd-card/HiFi.conf b/ucm2/Qualcomm/qcs9075/qcs9075-iq-evk-snd-card/HiFi.conf -new file mode 100644 -index 0000000..6673324 ---- /dev/null -+++ b/ucm2/Qualcomm/qcs9075/qcs9075-iq-evk-snd-card/HiFi.conf -@@ -0,0 +1,29 @@ -+SectionVerb { -+ Value { -+ TQ "HiFi" -+ } -+ EnableSequence [ -+ cset "name='PRIMARY_SDR_MI2S_RX Audio Mixer MULTIMEDIA0' 1" -+ cset "name='MULTIMEDIA1 Audio Mixer TERTIARY_SDR_MI2S_TX' 1" -+ ] -+} -+ -+SectionDevice."Speaker" { -+ Comment "Speaker playback" -+ -+ Value { -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId},0" -+ PlaybackMixer "default:${CardId}" -+ PlaybackMixerElem "Speakers" -+ } -+} -+ -+SectionDevice."Mic" { -+ Comment "Mic" -+ -+ Value { -+ CapturePriority 100 -+ CapturePCM "hw:${CardId},1" -+ } -+} -diff --git a/ucm2/Qualcomm/qcs9075/qcs9075-iq-evk-snd-card/qcs9075-iq-evk-snd-card.conf b/ucm2/Qualcomm/qcs9075/qcs9075-iq-evk-snd-card/qcs9075-iq-evk-snd-card.conf -new file mode 100644 -index 0000000..669ba6b ---- /dev/null -+++ b/ucm2/Qualcomm/qcs9075/qcs9075-iq-evk-snd-card/qcs9075-iq-evk-snd-card.conf -@@ -0,0 +1,6 @@ -+Syntax 4 -+ -+SectionUseCase."HiFi" { -+ File "/Qualcomm/qcs9075/qcs9075-iq-evk-snd-card/HiFi.conf" -+ Comment "HiFi quality Music" -+} -diff --git a/ucm2/conf.d/qcs9075/qcs9075-iq-evk-snd-card.conf b/ucm2/conf.d/qcs9075/qcs9075-iq-evk-snd-card.conf -new file mode 100644 -index 0000000..1e49d38 ---- /dev/null -+++ b/ucm2/conf.d/qcs9075/qcs9075-iq-evk-snd-card.conf -@@ -0,0 +1,6 @@ -+Syntax 4 -+ -+SectionUseCase."HiFi" { -+ File "/Qualcomm/qcs9075/qcs9075-iq-evk-snd-card/HiFi.conf" -+ Comment "HiFi quality Music." -+} --- -2.49.0 - - -From e7ec0f1ac3eebfa04e18a944d511bbb5fa57239d Mon Sep 17 00:00:00 2001 -From: Mohammad Rafi Shaik -Date: Tue, 10 Jun 2025 16:46:59 +0530 -Subject: [PATCH 18/24] ucm2: Qualcomm: Update the QCM6490 and QCS6490 hifi - conf files - -Rename the HiFi conf files for QCM6490-IDP and QCS6490-RB3Gen2 boards -to match with soundcard name. - -Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/577 -Signed-off-by: Mohammad Rafi Shaik -Signed-off-by: Jaroslav Kysela ---- - .../QCM6490-IDP/{QCM6490-IDP.conf => qcm6490-idp-snd-card.conf} | 0 - .../{QCS6490-RB3Gen2.conf => qcs6490-rb3gen2-snd-card.conf} | 0 - .../qcm6490/{QCM6490-IDP.conf => qcm6490-idp-snd-card.conf} | 0 - .../{QCS6490-RB3Gen2.conf => qcs6490-rb3gen2-snd-card.conf} | 0 - 4 files changed, 0 insertions(+), 0 deletions(-) - rename ucm2/Qualcomm/qcm6490/QCM6490-IDP/{QCM6490-IDP.conf => qcm6490-idp-snd-card.conf} (100%) - rename ucm2/Qualcomm/qcs6490/QCS6490-RB3Gen2/{QCS6490-RB3Gen2.conf => qcs6490-rb3gen2-snd-card.conf} (100%) - rename ucm2/conf.d/qcm6490/{QCM6490-IDP.conf => qcm6490-idp-snd-card.conf} (100%) - rename ucm2/conf.d/qcs6490/{QCS6490-RB3Gen2.conf => qcs6490-rb3gen2-snd-card.conf} (100%) - -diff --git a/ucm2/Qualcomm/qcm6490/QCM6490-IDP/QCM6490-IDP.conf b/ucm2/Qualcomm/qcm6490/QCM6490-IDP/qcm6490-idp-snd-card.conf -similarity index 100% -rename from ucm2/Qualcomm/qcm6490/QCM6490-IDP/QCM6490-IDP.conf -rename to ucm2/Qualcomm/qcm6490/QCM6490-IDP/qcm6490-idp-snd-card.conf -diff --git a/ucm2/Qualcomm/qcs6490/QCS6490-RB3Gen2/QCS6490-RB3Gen2.conf b/ucm2/Qualcomm/qcs6490/QCS6490-RB3Gen2/qcs6490-rb3gen2-snd-card.conf -similarity index 100% -rename from ucm2/Qualcomm/qcs6490/QCS6490-RB3Gen2/QCS6490-RB3Gen2.conf -rename to ucm2/Qualcomm/qcs6490/QCS6490-RB3Gen2/qcs6490-rb3gen2-snd-card.conf -diff --git a/ucm2/conf.d/qcm6490/QCM6490-IDP.conf b/ucm2/conf.d/qcm6490/qcm6490-idp-snd-card.conf -similarity index 100% -rename from ucm2/conf.d/qcm6490/QCM6490-IDP.conf -rename to ucm2/conf.d/qcm6490/qcm6490-idp-snd-card.conf -diff --git a/ucm2/conf.d/qcs6490/QCS6490-RB3Gen2.conf b/ucm2/conf.d/qcs6490/qcs6490-rb3gen2-snd-card.conf -similarity index 100% -rename from ucm2/conf.d/qcs6490/QCS6490-RB3Gen2.conf -rename to ucm2/conf.d/qcs6490/qcs6490-rb3gen2-snd-card.conf --- -2.49.0 - - -From a98b12220989e2187a47b0e06ac9145c92232a8e Mon Sep 17 00:00:00 2001 -From: Mohammad Rafi Shaik -Date: Wed, 18 Jun 2025 16:46:18 +0530 -Subject: [PATCH 19/24] ucm2: Qualcomm: Update the HIFI enable mixer commands - for qcm6490-idp and qcs6490-rb3gen2 - -Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/577 -Signed-off-by: Mohammad Rafi Shaik -Signed-off-by: Jaroslav Kysela ---- - ucm2/Qualcomm/qcm6490/QCM6490-IDP/HiFi.conf | 8 ++++---- - ucm2/Qualcomm/qcs6490/QCS6490-RB3Gen2/HiFi.conf | 4 ++-- - 2 files changed, 6 insertions(+), 6 deletions(-) - -diff --git a/ucm2/Qualcomm/qcm6490/QCM6490-IDP/HiFi.conf b/ucm2/Qualcomm/qcm6490/QCM6490-IDP/HiFi.conf -index 0d6497e..0a0d331 100644 ---- a/ucm2/Qualcomm/qcm6490/QCM6490-IDP/HiFi.conf -+++ b/ucm2/Qualcomm/qcm6490/QCM6490-IDP/HiFi.conf -@@ -3,10 +3,10 @@ SectionVerb { - TQ "HiFi" - } - EnableSequence [ -- cset "name='WSA_CODEC_DMA_RX_0 Audio Mixer MULTIMEDIA0' 1" -- cset "name='MULTIMEDIA1 Audio Mixer VA_CODEC_DMA_TX_0' 1" -- cset "name='RX_CODEC_DMA_RX_0 Audio Mixer MULTIMEDIA2' 1" -- cset "name='MULTIMEDIA3 Audio Mixer TX_CODEC_DMA_TX_3' 1" -+ cset "name='WSA_CODEC_DMA_RX_0 Audio Mixer MultiMedia1' 1" -+ cset "name='MultiMedia2 Mixer VA_CODEC_DMA_TX_0' 1" -+ cset "name='RX_CODEC_DMA_RX_0 Audio Mixer MultiMedia3' 1" -+ cset "name='MultiMedia4 Mixer TX_CODEC_DMA_TX_3' 1" - ] - - Include.wsae.File "/codecs/wsa883x/DefaultEnableSeq.conf" -diff --git a/ucm2/Qualcomm/qcs6490/QCS6490-RB3Gen2/HiFi.conf b/ucm2/Qualcomm/qcs6490/QCS6490-RB3Gen2/HiFi.conf -index 954dbfa..2488523 100644 ---- a/ucm2/Qualcomm/qcs6490/QCS6490-RB3Gen2/HiFi.conf -+++ b/ucm2/Qualcomm/qcs6490/QCS6490-RB3Gen2/HiFi.conf -@@ -3,8 +3,8 @@ SectionVerb { - TQ "HiFi" - } - EnableSequence [ -- cset "name='WSA_CODEC_DMA_RX_0 Audio Mixer MULTIMEDIA0' 1" -- cset "name='MULTIMEDIA1 Audio Mixer VA_CODEC_DMA_TX_0' 1" -+ cset "name='WSA_CODEC_DMA_RX_0 Audio Mixer MultiMedia1' 1" -+ cset "name='MultiMedia2 Mixer VA_CODEC_DMA_TX_0' 1" - ] - - Include.wsae.File "/codecs/wsa883x/DefaultEnableSeq.conf" --- -2.49.0 - - -From 56cbdfd04339cf9598cd9d57f5c1a382504ae902 Mon Sep 17 00:00:00 2001 -From: Peter Ujfalusi -Date: Thu, 12 Jun 2025 16:33:01 +0300 -Subject: [PATCH 20/24] UCM2: Intel: sof-hda-dsp: HiFi: Fix handling of mono - DMICs - -When a single DMIC is present in the system we need to set the -CaptureChannels to 1 since the PCM device only supports mono, PA/PW will -reject the profile since it cannot open the DMIC PCM device. - -Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/579 -Signed-off-by: Peter Ujfalusi -Signed-off-by: Jaroslav Kysela ---- - ucm2/Intel/sof-hda-dsp/HiFi.conf | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/ucm2/Intel/sof-hda-dsp/HiFi.conf b/ucm2/Intel/sof-hda-dsp/HiFi.conf -index 9689b56..e452f83 100644 ---- a/ucm2/Intel/sof-hda-dsp/HiFi.conf -+++ b/ucm2/Intel/sof-hda-dsp/HiFi.conf -@@ -34,6 +34,16 @@ If.dmic { - True { - CaptureChannels 4 - } -+ False.If.mono { -+ Condition { -+ Type RegexMatch -+ Regex "cfg-dmics:[1]" -+ String "${CardComponents}" -+ } -+ True { -+ CaptureChannels 1 -+ } -+ } - } - If.vol { - Condition { --- -2.49.0 - - -From e4791900954c3951d15038822a55a3031aac49d2 Mon Sep 17 00:00:00 2001 -From: Shuming Fan -Date: Fri, 6 Jun 2025 12:47:08 +0800 -Subject: [PATCH 21/24] ucm2: sof-soundwire: add rt712-vb device - -Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/573 -Signed-off-by: Shuming Fan -Signed-off-by: Jaroslav Kysela ---- - ucm2/codecs/rt712/init.conf | 34 ++++++++++++++++++++++++++++------ - ucm2/sof-soundwire/rt712.conf | 29 +++++++++++++++++++++++++++++ - 2 files changed, 57 insertions(+), 6 deletions(-) - -diff --git a/ucm2/codecs/rt712/init.conf b/ucm2/codecs/rt712/init.conf -index e09bf7f..1e45380 100644 ---- a/ucm2/codecs/rt712/init.conf -+++ b/ucm2/codecs/rt712/init.conf -@@ -1,8 +1,30 @@ - # RT712 specific volume control settings - --BootSequence [ -- cset "name='rt712 FU05 Playback Volume' 87" -- cset "name='rt712 ADC 23 Mux' 'MIC2'" -- cset "name='rt712 FU0F Capture Volume' 57" -- cset "name='rt712 FU0F Capture Switch' 1" --] -+If.rt712_init { -+ Condition { -+ Type RegexMatch -+ Regex "(rt712(-sdca)?)" -+ String "${var:MultiMicShadow}" -+ } -+ True { -+ # RT712-VB integrated with DMIC -+ BootSequence [ -+ cset "name='rt712 FU05 Playback Volume' 87" -+ cset "name='rt712 ADC 23 Mux' 'MIC2'" -+ cset "name='rt712 FU0F Capture Volume' 57" -+ cset "name='rt712 FU0F Capture Switch' 1" -+ cset "name='rt712 FU1E Capture Switch' 1" -+ cset "name='rt712 FU1E Capture Volume' 47" -+ cset "name='rt712 ADC 0A Mux' 'DMIC1'" -+ cset "name='rt712 ADC 0B Mux' 'DMIC2'" -+ ] -+ } -+ False { -+ BootSequence [ -+ cset "name='rt712 FU05 Playback Volume' 87" -+ cset "name='rt712 ADC 23 Mux' 'MIC2'" -+ cset "name='rt712 FU0F Capture Volume' 57" -+ cset "name='rt712 FU0F Capture Switch' 1" -+ ] -+ } -+} -diff --git a/ucm2/sof-soundwire/rt712.conf b/ucm2/sof-soundwire/rt712.conf -index 409bef9..346cff1 100644 ---- a/ucm2/sof-soundwire/rt712.conf -+++ b/ucm2/sof-soundwire/rt712.conf -@@ -85,3 +85,32 @@ SectionDevice."Headset" { - JackControl "Headset Mic Jack" - } - } -+ -+If.codecmic { -+ Condition { -+ Type RegexMatch -+ Regex "(rt712(-sdca)?)" -+ String "${var:MultiMicShadow}" -+ } -+ True { -+ SectionDevice."Mic" { -+ Comment "SoundWire Microphones" -+ -+ EnableSequence [ -+ cset "name='rt712 FU1E Capture Switch' 1" -+ ] -+ -+ DisableSequence [ -+ cset "name='rt712 FU1E Capture Switch' 0" -+ ] -+ -+ Value { -+ CapturePriority 100 -+ CapturePCM "hw:${CardId},4" -+ CaptureSwitch "rt712 FU1E Capture Switch" -+ CaptureVolume "rt712 FU1E Capture Volume" -+ CaptureMixerElem "rt712 FU1E" -+ } -+ } -+ } -+} --- -2.49.0 - - -From 436fbad2a02b91435645e039664af469595ab500 Mon Sep 17 00:00:00 2001 -From: DanielDecker <90106468+DanielDecker@users.noreply.github.com> -Date: Mon, 16 Jun 2025 18:27:21 +0200 -Subject: [PATCH 22/24] add MSI MAG B850M Mortar Wifi to USB-Audio.conf - -add MSI MAG B850M Mortar Wifi USB-ID for Realtek/ALC4080 to USB-Audio.conf - -Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/581 -Signed-off-by: DanielDecker <90106468+DanielDecker@users.noreply.github.com> -Signed-off-by: Jaroslav Kysela ---- - ucm2/USB-Audio/USB-Audio.conf | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/ucm2/USB-Audio/USB-Audio.conf b/ucm2/USB-Audio/USB-Audio.conf -index d90db39..ef88ded 100644 ---- a/ucm2/USB-Audio/USB-Audio.conf -+++ b/ucm2/USB-Audio/USB-Audio.conf -@@ -89,6 +89,7 @@ If.realtek-alc4080 { - # 0db0:a47c MSI MEG X570S Ace Max - # 0db0:a74b MSI MPG Z790 Edge Wifi - # 0db0:b202 MSI MAG Z690 Tomahawk Wifi -+ # 0db0:cc78 MSI MAG B850M Mortar Wifi - # 0db0:cd0e MSI X870 Tomahawk - # 0db0:d1d7 MSI PRO Z790-A WIFI - # 0db0:d6e7 MSI MPG X670E Carbon Wifi -@@ -96,7 +97,7 @@ If.realtek-alc4080 { - # 26ce:0a06 ASRock X670E/Z790 Taichi - # 26ce:0a08 ASRock Z790 PG-ITX/TB4, X870 Steel Legend - # 26ce:0a0b ASRock X870E Taichi -- Regex "USB((0414:a0(0e|1[0124]))|(0b05:(19(84|9[69])|1a(16|2[07]|5[23c]|97|f1)|1b(7c|9b|e1)))|(0db0:(005a|0b58|124b|151f|1feb|3130|36e7|4(19c|22d|240|88c)|543d|62a4|6c[0c]9|70d3|7696|82c7|8af7|961e|9e6d|a(073|228|47c|74b)|b202|cd0e|d1d7|d6e7|e1f8))|(26ce:0a0[68b]))" -+ Regex "USB((0414:a0(0e|1[0124]))|(0b05:(19(84|9[69])|1a(16|2[07]|5[23c]|97|f1)|1b(7c|9b|e1)))|(0db0:(005a|0b58|124b|151f|1feb|3130|36e7|4(19c|22d|240|88c)|543d|62a4|6c[0c]9|70d3|7696|82c7|8af7|961e|9e6d|a(073|228|47c|74b)|b202|c(c78|d0e)|d1d7|d6e7|e1f8))|(26ce:0a0[68b]))" - } - True.Define.ProfileName "Realtek/ALC4080" - } --- -2.49.0 - - -From b4896cf413e618f4b20c570544a4e668aaa72f64 Mon Sep 17 00:00:00 2001 -From: Harald Sitter -Date: Sat, 21 Jun 2025 17:10:20 +0200 -Subject: [PATCH 23/24] ucm2: USB-Audio: Add Teufel CAGE PRO - -two stereo outputs: one for "game" and one for "chat". -one mono input - -Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/582 -Signed-off-by: Harald Sitter -Signed-off-by: Jaroslav Kysela ---- - ucm2/USB-Audio/Teufel/CAGE-PRO-HiFi.conf | 21 +++++++++++++++++++++ - ucm2/USB-Audio/Teufel/CAGE-PRO.conf | 9 +++++++++ - ucm2/USB-Audio/USB-Audio.conf | 10 ++++++++++ - 3 files changed, 40 insertions(+) - create mode 100644 ucm2/USB-Audio/Teufel/CAGE-PRO-HiFi.conf - create mode 100644 ucm2/USB-Audio/Teufel/CAGE-PRO.conf - -diff --git a/ucm2/USB-Audio/Teufel/CAGE-PRO-HiFi.conf b/ucm2/USB-Audio/Teufel/CAGE-PRO-HiFi.conf -new file mode 100644 -index 0000000..c0fbe7b ---- /dev/null -+++ b/ucm2/USB-Audio/Teufel/CAGE-PRO-HiFi.conf -@@ -0,0 +1,21 @@ -+# SPDX-License-Identifier: MIT -+# SPDX-FileCopyrightText: 2025 Harald Sitter -+ -+SectionDevice."Headset" { -+ Comment "Chat" -+ Value { -+ PlaybackPCM "hw:${CardId},0" -+ PlaybackMixerElem "PCM" -+ CapturePCM "hw:${CardId},0" -+ CaptureMixerElem "Mic" -+ CaptureChannels 1 -+ } -+} -+ -+SectionDevice."Headphones" { -+ Comment "Game" -+ Value { -+ PlaybackPCM "hw:${CardId},1" -+ PlaybackMixerElem "PCM,1" -+ } -+} -diff --git a/ucm2/USB-Audio/Teufel/CAGE-PRO.conf b/ucm2/USB-Audio/Teufel/CAGE-PRO.conf -new file mode 100644 -index 0000000..bf75033 ---- /dev/null -+++ b/ucm2/USB-Audio/Teufel/CAGE-PRO.conf -@@ -0,0 +1,9 @@ -+# SPDX-License-Identifier: MIT -+# SPDX-FileCopyrightText: 2025 Harald Sitter -+ -+Comment "Lautsprecher Teufel GmbH CAGE PRO" -+ -+SectionUseCase."HiFi" { -+ Comment "Default" -+ File "/USB-Audio/Teufel/CAGE-PRO-HiFi.conf" -+} -diff --git a/ucm2/USB-Audio/USB-Audio.conf b/ucm2/USB-Audio/USB-Audio.conf -index ef88ded..7a6a0ac 100644 ---- a/ucm2/USB-Audio/USB-Audio.conf -+++ b/ucm2/USB-Audio/USB-Audio.conf -@@ -521,6 +521,15 @@ If.ua-volt2 { - } - } - -+If.teufel-cage-pro { -+ Condition { -+ Type String -+ Haystack "${CardComponents}" -+ Needle "USB2cc2:0033" -+ } -+ True.Define.ProfileName "Teufel/CAGE-PRO" -+} -+ - If.ssl2 { - Condition { - Type String -@@ -559,6 +568,7 @@ If.beacn-studio { - } - True.Define.ProfileName "Beacn/Beacn-Studio" - } -+ - If.mixremap { - Condition { - Type String --- -2.49.0 - - -From 63f161cb8d65ed828a1ce49b506f4e1b9a7c58e4 Mon Sep 17 00:00:00 2001 -From: Zoran Zhan -Date: Wed, 7 May 2025 14:41:14 +0800 -Subject: [PATCH 24/24] ucm2: MediaTek: mt8365-evk: Add SOF support - -Add support for MT8365 EVK with SOF enabled. When SOF is -disabled, the "HiFi" use case is used; when SOF is enabled, -the "SOF" use case is used. - -The main difference compared to the UCM with SOF disabled is -the device number for playback and capture, which now uses the -PCMs for SOF instead. - -Define these parameters as variables for each case (with and -without SOF), and move the common initialization to init.conf, -so the UCM can be shared by both configurations. - -Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/583 -Signed-off-by: Zoran Zhan -Signed-off-by: Jaroslav Kysela ---- - ucm2/MediaTek/mt8365-evk/HiFi.conf | 126 ++++++------------ - ucm2/MediaTek/mt8365-evk/init.conf | 31 +++++ - ucm2/MediaTek/mt8365-evk/mt8365-evk.conf | 40 +----- - ucm2/MediaTek/mt8365-evk/sof/SOF.conf | 87 ++++++++++++ - .../mt8365-evk/sof/sof-mt8365-evk.conf | 9 ++ - .../conf.d/sof-mt8365-evk/sof-mt8365-evk.conf | 1 + - 6 files changed, 174 insertions(+), 120 deletions(-) - create mode 100644 ucm2/MediaTek/mt8365-evk/init.conf - create mode 100644 ucm2/MediaTek/mt8365-evk/sof/SOF.conf - create mode 100644 ucm2/MediaTek/mt8365-evk/sof/sof-mt8365-evk.conf - create mode 120000 ucm2/conf.d/sof-mt8365-evk/sof-mt8365-evk.conf - -diff --git a/ucm2/MediaTek/mt8365-evk/HiFi.conf b/ucm2/MediaTek/mt8365-evk/HiFi.conf -index 81f563f..83514c7 100644 ---- a/ucm2/MediaTek/mt8365-evk/HiFi.conf -+++ b/ucm2/MediaTek/mt8365-evk/HiFi.conf -@@ -1,141 +1,97 @@ - SectionDevice."HDMI" { -- Comment "Hdmi output" -+ Comment "HDMI output" - - Value { -- PlaybackPriority 250 -+ PlaybackPriority 100 - PlaybackChannels 2 - PlaybackPCM "hw:${CardId},1" - } -- -- EnableSequence [ -- cset "name='O00 I07 Switch' on" -- cset "name='O01 I08 Switch' on" -- ] -- -- DisableSequence [ -- cset "name='O00 I07 Switch' off" -- cset "name='O01 I08 Switch' off" -- ] - } - - SectionDevice."Speaker" { -- Comment "Line-out Jack " -+ Comment "Lineout speaker" - - ConflictingDevice [ - "Headphones" - ] - -- Value { -- PlaybackPriority 300 -- PlaybackChannels 2 -- PlaybackPCM "hw:${CardId},0" -- PlaybackVolume "name='Lineout_PGAL_GAIN'" -- } -- - EnableSequence [ -- cset "name='Audio_Amp_L_Switch' Off" -- cset "name='Audio_Amp_R_Switch' Off" -- cset "name='Lineout_PGAL_GAIN' 0" -- cset "name='Speaker_Amp_Switch' On" -+ cset "name='Headphone Left Source' Open" -+ cset "name='Headphone Right Source' Open" -+ cset "name='Line Out Source' Playback" - ] - -- DisableSequence [ -- cset "name='Audio_Amp_L_Switch' On" -- cset "name='Audio_Amp_R_Switch' On" -- cset "name='Speaker_Amp_Switch' Off" -- ] -+ Value { -+ PlaybackPriority 200 -+ PlaybackChannels 2 -+ PlaybackPCM "hw:${CardId},${var:PlayDevN}" -+ } - } - - SectionDevice."Headphones" { -- Comment "Headset speakers" -+ Comment "Earphone speaker" - - ConflictingDevice [ - "Speaker" - ] - -+ EnableSequence [ -+ cset "name='Headphone Left Source' DAC" -+ cset "name='Headphone Right Source' DAC" -+ cset "name='Line Out Source' Open" -+ ] -+ - Value { - PlaybackPriority 300 - PlaybackChannels 2 -- PlaybackPCM "hw:${CardId},0" -- PlaybackVolume "name='Headset_PGAL_GAIN'" -+ PlaybackPCM "hw:${CardId},${var:PlayDevN}" - } -- -- EnableSequence [ -- cset "name='Audio_Amp_L_Switch' On" -- cset "name='Audio_Amp_R_Switch' On" -- cset "name='Headset_PGAL_GAIN' 1" -- cset "name='Speaker_Amp_Switch' Off" -- ] -- -- DisableSequence [ -- cset "name='Audio_Amp_L_Switch' Off" -- cset "name='Audio_Amp_R_Switch' Off" -- cset "name='Speaker_Amp_Switch' On" -- ] - } - --SectionDevice."Mic1" { -- Comment "Amic" -+SectionDevice."Headset" { -+ Comment "Earphone microphone" - - ConflictingDevice [ -- "Mic2" -+ "Mic1" - ] - -- Value { -- CapturePriority 300 -- CaptureChannels 1 -- CapturePCM "hw:${CardId},2" -- } -- - EnableSequence [ -- cset "name='Audio_MicSource1_Setting' ADC1" -- cset "name='Audio_MICBIAS0_Switch' Off" -+ cset "name='PGA L Mux' AIN1" -+ cset "name='PGA R Mux' AIN1" - ] - -- DisableSequence [ -- cset "name='Audio_MicSource1_Setting' ADC2" -- cset "name='Audio_MICBIAS0_Switch' On" -- ] -+ Value { -+ CapturePriority 300 -+ CaptureChannels "${var:CapChanN}" -+ CapturePCM "hw:${CardId},${var:CapDevN}" -+ } - } - --SectionDevice."Mic2" { -- Comment "Headset microphone" -+SectionDevice."Mic1" { -+ Comment "Analog microphone" - - ConflictingDevice [ -- "Mic1" -+ "Headset" - ] - -- Value { -- CapturePriority 350 -- CaptureChannels 1 -- CapturePCM "hw:${CardId},2" -- } -- - EnableSequence [ -- cset "name='Audio_MicSource1_Setting' ADC2" -- cset "name='Audio_MICBIAS0_Switch' On" -+ cset "name='PGA L Mux' AIN0" -+ cset "name='PGA R Mux' AIN0" - ] - -- DisableSequence [ -- cset "name='Audio_MicSource1_Setting' ADC1" -- cset "name='Audio_MICBIAS0_Switch' Off" -- ] -+ Value { -+ CapturePriority 200 -+ CaptureChannels "${var:CapChanN}" -+ CapturePCM "hw:${CardId},${var:CapDevN}" -+ } - } - --SectionDevice."Mic3" { -- Comment "PDM microphones" -+SectionDevice."Mic2" { -+ Comment "Digital microphone" - - Value { - CapturePriority 100 - CaptureChannels 2 - CapturePCM "hw:${CardId},3" - } -- -- EnableSequence [ -- cset "name='Audio_MICBIAS0_Switch' On" -- ] -- -- DisableSequence [ -- cset "name='Audio_MICBIAS0_Switch' Off" -- ] - } -diff --git a/ucm2/MediaTek/mt8365-evk/init.conf b/ucm2/MediaTek/mt8365-evk/init.conf -new file mode 100644 -index 0000000..269530a ---- /dev/null -+++ b/ucm2/MediaTek/mt8365-evk/init.conf -@@ -0,0 +1,31 @@ -+Syntax 4 -+ -+SectionUseCase."HiFi" { -+ File "/MediaTek/mt8365-evk/HiFi.conf" -+ Comment "Default" -+} -+ -+SectionUseCase."SOF" { -+ File "/MediaTek/mt8365-evk/sof/SOF.conf" -+ Comment "Enable SOF" -+} -+ -+BootSequence [ -+ cset "name='Headphone Left Source' DAC" -+ cset "name='Headphone Right Source' DAC" -+ cset "name='Line Out Source' Open" -+ cset "name='PGA L Mux' AIN1" -+ cset "name='PGA R Mux' AIN1" -+ cset "name='Mic Type Mux' DCC" -+ cset "name='INT ADDA O03_O04 Switch' on" -+ cset "name='Headphone Volume' 10" -+ cset "name='Lineout Volume' 10" -+ cset "name='O00 I07 Switch' on" -+ cset "name='O01 I08 Switch' on" -+ cset "name='O03 I05 Switch' on" -+ cset "name='O04 I06 Switch' on" -+ cset "name='O05 I03 Switch' on" -+ cset "name='O06 I04 Switch' on" -+ cset "name='O09 I14 Switch' on" -+ cset "name='O10 I15 Switch' on" -+] -diff --git a/ucm2/MediaTek/mt8365-evk/mt8365-evk.conf b/ucm2/MediaTek/mt8365-evk/mt8365-evk.conf -index e396f8c..9df5644 100644 ---- a/ucm2/MediaTek/mt8365-evk/mt8365-evk.conf -+++ b/ucm2/MediaTek/mt8365-evk/mt8365-evk.conf -@@ -1,39 +1,9 @@ - Syntax 4 - --SectionUseCase."HiFi" { -- File "/MediaTek/mt8365-evk/HiFi.conf" -- Comment "Play high quality music" -+Define { -+ PlayDevN "0" -+ CapDevN "2" -+ CapChanN "1" - } - --BootSequence [ -- #Audio volume -- cset "name='Headset_PGAL_GAIN' 0" -- cset "name='Lineout_PGAL_GAIN' 0" -- -- #Audio amp -- cset "name='Audio_Amp_R_Switch' On" -- cset "name='Audio_Amp_L_Switch' On" -- -- #Headset out -- cset "name='Speaker_Amp_Switch' Off" -- -- #Dmic -- cset "name='Audio_MICBIAS0_Switch' On" -- -- #HDMI audio (I2S3 Out) -- cset "name='O00 I07 Switch' on" -- cset "name='O01 I08 Switch' on" -- -- #jack_mic Headset In -- cset "name='Audio_MicSource1_Setting' ADC2" -- -- cset "name='O03 I05 Switch' on" -- cset "name='O04 I06 Switch' on" -- cset "name='O05 I03 Switch' on" -- cset "name='O06 I04 Switch' on" -- cset "name='O09 I14 Switch' on" -- cset "name='O10 I15 Switch' on" -- cset "name='AUD_CLK_BUF_Switch' On" -- cset "name='Audio_ADC_1_Switch' On" -- cset "name='INT ADDA O03_O04 Switch' on" --] -+Include.init.File "/MediaTek/mt8365-evk/init.conf" -diff --git a/ucm2/MediaTek/mt8365-evk/sof/SOF.conf b/ucm2/MediaTek/mt8365-evk/sof/SOF.conf -new file mode 100644 -index 0000000..af44feb ---- /dev/null -+++ b/ucm2/MediaTek/mt8365-evk/sof/SOF.conf -@@ -0,0 +1,87 @@ -+SectionDevice."Speaker" { -+ Comment "SOF Lineout speaker" -+ -+ ConflictingDevice [ -+ "Headphones" -+ ] -+ -+ EnableSequence [ -+ cset "name='Headphone Left Source' Open" -+ cset "name='Headphone Right Source' Open" -+ cset "name='Line Out Source' Playback" -+ ] -+ -+ Value { -+ PlaybackPriority 100 -+ PlaybackChannels 2 -+ PlaybackPCM "hw:${CardId},${var:PlayDevN}" -+ } -+} -+ -+SectionDevice."Headphones" { -+ Comment "SOF Earphone speaker" -+ -+ ConflictingDevice [ -+ "Speaker" -+ ] -+ -+ EnableSequence [ -+ cset "name='Headphone Left Source' DAC" -+ cset "name='Headphone Right Source' DAC" -+ cset "name='Line Out Source' Open" -+ ] -+ -+ Value { -+ PlaybackPriority 200 -+ PlaybackChannels 2 -+ PlaybackPCM "hw:${CardId},${var:PlayDevN}" -+ } -+} -+ -+SectionDevice."Headset" { -+ Comment "SOF Earphone microphone" -+ -+ ConflictingDevice [ -+ "Mic1" -+ ] -+ -+ EnableSequence [ -+ cset "name='PGA L Mux' AIN1" -+ cset "name='PGA R Mux' AIN1" -+ ] -+ -+ Value { -+ CapturePriority 300 -+ CaptureChannels "${var:CapChanN}" -+ CapturePCM "hw:${CardId},${var:CapDevN}" -+ } -+} -+ -+SectionDevice."Mic1" { -+ Comment "SOF Analog microphone" -+ -+ ConflictingDevice [ -+ "Headset" -+ ] -+ -+ EnableSequence [ -+ cset "name='PGA L Mux' AIN0" -+ cset "name='PGA R Mux' AIN0" -+ ] -+ -+ Value { -+ CapturePriority 200 -+ CaptureChannels "${var:CapChanN}" -+ CapturePCM "hw:${CardId},${var:CapDevN}" -+ } -+} -+ -+SectionDevice."Mic2" { -+ Comment "SOF Digital microphone" -+ -+ Value { -+ CapturePriority 100 -+ CaptureChannels 2 -+ CapturePCM "hw:${CardId},19" -+ } -+} -diff --git a/ucm2/MediaTek/mt8365-evk/sof/sof-mt8365-evk.conf b/ucm2/MediaTek/mt8365-evk/sof/sof-mt8365-evk.conf -new file mode 100644 -index 0000000..6369aac ---- /dev/null -+++ b/ucm2/MediaTek/mt8365-evk/sof/sof-mt8365-evk.conf -@@ -0,0 +1,9 @@ -+Syntax 4 -+ -+Define { -+ PlayDevN "16" -+ CapDevN "18" -+ CapChanN "2" -+} -+ -+Include.init.File "/MediaTek/mt8365-evk/init.conf" -diff --git a/ucm2/conf.d/sof-mt8365-evk/sof-mt8365-evk.conf b/ucm2/conf.d/sof-mt8365-evk/sof-mt8365-evk.conf -new file mode 120000 -index 0000000..527f25f ---- /dev/null -+++ b/ucm2/conf.d/sof-mt8365-evk/sof-mt8365-evk.conf -@@ -0,0 +1 @@ -+../../MediaTek/mt8365-evk/sof/sof-mt8365-evk.conf -\ No newline at end of file --- -2.49.0 - From 0ed21ea73d17f2faa5dbd870fa5f7ae60abe3fa3 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Sun, 7 Dec 2025 22:38:53 +0100 Subject: [PATCH 113/120] update sources for 1.2.15 Signed-off-by: Jaroslav Kysela --- sources | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources b/sources index 99910eb..9ce5bdb 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (alsa-lib-1.2.14.tar.bz2) = 2716cc3a2299da4a1a170d734af082d78dc452b253179d0f1a9ec190140734aecf002b6924eec4ff2699ce88ce1ae5c56821c267f36384910984db726d1f9626 -SHA512 (alsa-ucm-conf-1.2.14.tar.bz2) = a224e890919306bdcd606dfb873b089950c9fa89f24c02947692ee8ab1a05c419f2a8dc174440d17c8a9575cab293806630f2cb43d74677f7ef0d956b7883dc5 +SHA512 (alsa-lib-1.2.15.tar.bz2) = 6cea9059265ef353a07f1b442004506f0f13883692ea35f03090282ca80db88055f470d2dca5bb54394fef0012711f0e9502d2d0f7fb66b27aa334bffb811559 +SHA512 (alsa-ucm-conf-1.2.15.tar.bz2) = 61dcbfe32ad912b793bf70d6f9e0e462353431b9589623ce8a7ec18b5dba48c230f5ba509e47384764625ae82f132babfbf62a8e5f4bb951377476ba147939e2 SHA512 (alsa-topology-conf-1.2.5.tar.bz2) = 2eb4d8baf2dcbf0b631dd11dbf15bffc51694d9cc6931619e51787f3ba58d1a091d266e6721a3b737c040ec74a28270b93f39fb97f30a3227cf340dd646e5d51 From 91324e7b927e4a5d27e8060eb28ff3056b0904a5 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 9 Dec 2025 18:16:30 +0100 Subject: [PATCH 114/120] apply upstream 1.2.15 fixes #1 Signed-off-by: Jaroslav Kysela --- alsa-git.patch | 150 +++++++++++++++++++++++++ alsa-lib.spec | 10 +- alsa-ucm-conf.patch | 264 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 419 insertions(+), 5 deletions(-) create mode 100644 alsa-git.patch create mode 100644 alsa-ucm-conf.patch diff --git a/alsa-git.patch b/alsa-git.patch new file mode 100644 index 0000000..486803f --- /dev/null +++ b/alsa-git.patch @@ -0,0 +1,150 @@ +From a068cf08ad67447893b707cddfce31c9cafee643 Mon Sep 17 00:00:00 2001 +From: Mike Gilbert +Date: Mon, 8 Dec 2025 23:46:17 -0500 +Subject: [PATCH 1/3] ucm: use closefrom instead of close_range + +closefrom is a library function with a fallback mechanism for when the +kernel does not support the close_range syscall. + +Also check for the function properly instead of assuming it is available +with _GNU_SOURCE defined. + +Closes: https://github.com/alsa-project/alsa-lib/pull/486 +Fixes: https://github.com/alsa-project/alsa-lib/issues/485 +Signed-off-by: Mike Gilbert +Signed-off-by: Jaroslav Kysela +--- + configure.ac | 1 + + src/ucm/ucm_exec.c | 4 ++-- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 8f4bd0de..f4862f64 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -52,6 +52,7 @@ dnl Checks for library functions. + AC_PROG_GCC_TRADITIONAL + AC_CHECK_FUNCS([uselocale]) + AC_CHECK_FUNCS([eaccess]) ++AC_CHECK_DECLS([closefrom]) + + dnl Enable largefile support + AC_SYS_LARGEFILE +diff --git a/src/ucm/ucm_exec.c b/src/ucm/ucm_exec.c +index b5a22023..713039b4 100644 +--- a/src/ucm/ucm_exec.c ++++ b/src/ucm/ucm_exec.c +@@ -259,8 +259,8 @@ int uc_mgr_exec(const char *prog) + + close(f); + +-#if defined(_GNU_SOURCE) +- close_range(3, maxfd, 0); ++#if HAVE_DECL_CLOSEFROM ++ closefrom(3); + #else + for (f = 3; f < maxfd; f++) + close(f); +-- +2.51.1 + + +From 813ffe34ff6c720dcc56e4549338bf9e9184af1f Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 9 Dec 2025 17:48:34 +0100 +Subject: [PATCH 2/3] ucm: exec - fix maxfd used warning + +Fixes: a068cf08 ("ucm: use closefrom instead of close_range") +Signed-off-by: Jaroslav Kysela +--- + src/ucm/ucm_exec.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/src/ucm/ucm_exec.c b/src/ucm/ucm_exec.c +index 713039b4..c16a4cfd 100644 +--- a/src/ucm/ucm_exec.c ++++ b/src/ucm/ucm_exec.c +@@ -183,7 +183,7 @@ static int parse_args(char ***argv, int argc, const char *cmd) + */ + int uc_mgr_exec(const char *prog) + { +- pid_t p, f, maxfd; ++ pid_t p, f; + int err = 0, status; + char bin[PATH_MAX]; + struct sigaction sa; +@@ -212,8 +212,6 @@ int uc_mgr_exec(const char *prog) + prog = bin; + } + +- maxfd = sysconf(_SC_OPEN_MAX); +- + /* + * block SIGCHLD signal + * ignore SIGINT and SIGQUIT in parent +@@ -262,8 +260,11 @@ int uc_mgr_exec(const char *prog) + #if HAVE_DECL_CLOSEFROM + closefrom(3); + #else +- for (f = 3; f < maxfd; f++) +- close(f); ++ { ++ pid_t maxfd = sysconf(_SC_OPEN_MAX); ++ for (f = 3; f < maxfd; f++) ++ close(f); ++ } + #endif + + /* install default handlers for the forked process */ +-- +2.51.1 + + +From a6238053c4fa518b214f99d91a01b96c5ef6e3ca Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 9 Dec 2025 18:04:07 +0100 +Subject: [PATCH 3/3] conf: merge card specific contents per file (whole) after + parsing + +Unfortunately, mentioned fix caused a regression for items stored in one file. +Merge the file contents after parsing not inside parsing process. + +BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=2420645 +Fixes: eda76146 ("conf: fix load_for_all_cards() - do not merge the card specific contents") +Signed-off-by: Jaroslav Kysela +--- + src/conf.c | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +diff --git a/src/conf.c b/src/conf.c +index 49499ecd..b1ec9b38 100644 +--- a/src/conf.c ++++ b/src/conf.c +@@ -4119,14 +4119,21 @@ static int config_filename_filter(const struct dirent64 *dirent) + static int config_file_open(snd_config_t *root, const char *filename, int merge) + { + snd_input_t *in; ++ snd_config_t *top; + int err; + + err = snd_input_stdio_open(&in, filename, "r"); + if (err >= 0) { +- if (merge) ++ if (merge) { + err = snd_config_load(root, in); +- else +- err = snd_config_load_override(root, in); ++ } else { ++ err = snd_config_top(&top); ++ if (err >= 0) { ++ err = snd_config_load(top, in); ++ if (err >= 0) ++ err = snd_config_merge(root, top, 1); ++ } ++ } + snd_input_close(in); + if (err < 0) + snd_error(CORE, "%s may be old or corrupted: consider to remove or fix it", filename); +-- +2.51.1 + diff --git a/alsa-lib.spec b/alsa-lib.spec index 7c2e8fa..d91c95d 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 1%{?prever_dot}%{?dist} +Release: 2%{?prever_dot}%{?dist} License: LGPL-2.1-or-later URL: http://www.alsa-project.org/ @@ -19,8 +19,8 @@ Source2: ftp://ftp.alsa-project.org/pub/lib/alsa-topology-conf-%{version_alsa_t Source10: asound.conf Source11: modprobe-dist-alsa.conf Source12: modprobe-dist-oss.conf -#Source40: alsa-ucm-conf.patch -#Patch0: alsa-git.patch +Source40: alsa-ucm-conf.patch +Patch0: alsa-git.patch Patch1: alsa-lib-1.2.3.1-config.patch Patch2: alsa-lib-1.2.10-glibc-open.patch @@ -70,7 +70,7 @@ contains alsa-lib configuration of SoC topology %prep %setup -q -n %{name}-%{version}%{?prever}%{?postver} -#patch -P0 -p1 -b .alsa-git +%patch -P0 -p1 -b .alsa-git %patch -P1 -p1 -b .config %patch -P2 -p1 -b .glibc-open @@ -116,7 +116,7 @@ mkdir -p %{buildroot}/%{_datadir}/alsa/ucm2 # Unpack UCMs tar xvjf %{SOURCE1} -C %{buildroot}/%{_datadir}/alsa --strip-components=1 "*/ucm" "*/ucm2" -#patch -d %{buildroot}/%{_datadir}/alsa -p1 < %{SOURCE40} +patch -d %{buildroot}/%{_datadir}/alsa -p1 < %{SOURCE40} # Create topology directory mkdir -p %{buildroot}/%{_datadir}/alsa/topology diff --git a/alsa-ucm-conf.patch b/alsa-ucm-conf.patch new file mode 100644 index 0000000..0447c61 --- /dev/null +++ b/alsa-ucm-conf.patch @@ -0,0 +1,264 @@ +From d57d800c6a5a77e6c475719b0297bebb098f7533 Mon Sep 17 00:00:00 2001 +From: Maciej Strozek +Date: Tue, 9 Dec 2025 13:00:44 +0000 +Subject: [PATCH 1/3] sof-soundwire: third fix for multi-codec + +Ensure MultiCodec-based actions are only done when MultiCodec1 is not empty + +Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/658 +Signed-off-by: Maciej Strozek +Signed-off-by: Jaroslav Kysela +--- + ucm2/sof-soundwire/sof-soundwire.conf | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +diff --git a/ucm2/sof-soundwire/sof-soundwire.conf b/ucm2/sof-soundwire/sof-soundwire.conf +index 7f9c7dc..895f479 100644 +--- a/ucm2/sof-soundwire/sof-soundwire.conf ++++ b/ucm2/sof-soundwire/sof-soundwire.conf +@@ -72,8 +72,9 @@ If.multi_init { + If.multi_speaker { + Condition { + Type RegexMatch +- Regex "(${var:MultiCodec1}(-sdca)?)" +- String "${var:SpeakerCodec1}" ++ # guard with "=" to avoid empty string matching ++ Regex "=(${var:MultiCodec1}(-sdca)?)=" ++ String "=${var:SpeakerCodec1}=" + } + True { + Define.SpeakerCodec1 "" +@@ -83,8 +84,9 @@ If.multi_speaker { + If.multi_mic { + Condition { + Type RegexMatch +- Regex "(${var:MultiCodec1}(-sdca)?)" +- String "${var:MicCodec1}" ++ # guard with "=" to avoid empty string matching ++ Regex "=(${var:MultiCodec1}(-sdca)?)=" ++ String "=${var:MicCodec1}=" + } + True { + Define.MicCodec1 "" +@@ -94,8 +96,9 @@ If.multi_mic { + If.multi_headset { + Condition { + Type RegexMatch +- Regex "(${var:MultiCodec1}(-sdca)?)" +- String "${var:HeadsetCodec1}" ++ # guard with "=" to avoid empty string matching ++ Regex "=(${var:MultiCodec1}(-sdca)?)=" ++ String "=${var:HeadsetCodec1}=" + } + True { + Define.HeadsetCodec1 "" +-- +2.51.1 + + +From 51bada5f0c1b634b5db92de428f33c0188e68e82 Mon Sep 17 00:00:00 2001 +From: Maciej Strozek +Date: Fri, 28 Nov 2025 16:08:23 +0000 +Subject: [PATCH 2/3] ucm2: sof-soundwire: Simplify cs42l45 configs + +Simplify cs42l45 configs following machine driver changes [1] +which bring normal switches instead of mute switches. + +[1] https://lore.kernel.org/all/20251127163426.2500633-2-ckeepax@opensource.cirrus.com/ + +Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/655 +Signed-off-by: Maciej Strozek +Signed-off-by: Jaroslav Kysela +--- + ucm2/codecs/cs42l45-dmic/init.conf | 17 +++++++++++++++-- + ucm2/codecs/cs42l45/init.conf | 24 ++++++++++++++++++++++++ + ucm2/sof-soundwire/cs42l45-dmic.conf | 8 ++------ + ucm2/sof-soundwire/cs42l45.conf | 18 +++--------------- + ucm2/sof-soundwire/sof-soundwire.conf | 2 +- + 5 files changed, 45 insertions(+), 24 deletions(-) + create mode 100644 ucm2/codecs/cs42l45/init.conf + +diff --git a/ucm2/codecs/cs42l45-dmic/init.conf b/ucm2/codecs/cs42l45-dmic/init.conf +index 6dd19bb..deefb3d 100644 +--- a/ucm2/codecs/cs42l45-dmic/init.conf ++++ b/ucm2/codecs/cs42l45-dmic/init.conf +@@ -1,9 +1,22 @@ + # cs42l45 specific control settings + ++LibraryConfig.remap.Config { ++ ctl.default.map { ++ "name='cs42l45 Microphone Capture Switch'" { ++ "name='cs42l45 FU 113 Channel Switch'".vindex.0 0 ++ "name='cs42l45 FU 113 Channel Switch'".vindex.1 1 ++ } ++ "name='cs42l45 Microphone Capture Volume'" { ++ "name='cs42l45 FU 113 Channel Volume'".vindex.0 0 ++ "name='cs42l45 FU 113 Channel Volume'".vindex.1 1 ++ } ++ } ++} ++ + BootSequence [ +- cset "name='cs42l45 FU 113 Mute Switch' 0" ++ cset "name='cs42l45 FU 113 Channel Switch' 0" + ] + + Macro [ +- { SetLED { LED="mic" Action="attach" CtlId="cs42l45 FU 113 Mute Switch" Mode="follow-route"} } ++ { SetLED { LED="mic" Action="attach" CtlId="cs42l45 FU 113 Channel Switch"} } + ] +diff --git a/ucm2/codecs/cs42l45/init.conf b/ucm2/codecs/cs42l45/init.conf +new file mode 100644 +index 0000000..f4aee4a +--- /dev/null ++++ b/ucm2/codecs/cs42l45/init.conf +@@ -0,0 +1,24 @@ ++# cs42l45 specific control settings ++ ++LibraryConfig.remap.Config { ++ ctl.default.map { ++ "name='cs42l45 Jack Microphone Capture Switch'" { ++ "name='cs42l45 FU 36 Channel Switch'".vindex.0 0 ++ "name='cs42l45 FU 36 Channel Switch'".vindex.1 1 ++ } ++ "name='cs42l45 Jack Microphone Capture Volume'" { ++ "name='cs42l45 FU 36 Channel Volume'".vindex.0 0 ++ "name='cs42l45 FU 36 Channel Volume'".vindex.1 1 ++ } ++ } ++ ctl.default.map { ++ "name='cs42l45 Headphone Playback Switch'" { ++ "name='cs42l45 FU 41 Channel Switch'".vindex.0 0 ++ "name='cs42l45 FU 41 Channel Switch'".vindex.1 1 ++ } ++ "name='cs42l45 Headphone Playback Volume'" { ++ "name='cs42l45 FU 41 Channel Volume'".vindex.0 0 ++ "name='cs42l45 FU 41 Channel Volume'".vindex.1 1 ++ } ++ } ++} +\ No newline at end of file +diff --git a/ucm2/sof-soundwire/cs42l45-dmic.conf b/ucm2/sof-soundwire/cs42l45-dmic.conf +index 9477cba..d46808e 100644 +--- a/ucm2/sof-soundwire/cs42l45-dmic.conf ++++ b/ucm2/sof-soundwire/cs42l45-dmic.conf +@@ -7,18 +7,14 @@ SectionDevice."Mic" { + "Headset" + ] + +- EnableSequence [ +- cset "name='cs42l45 FU 113 Mute Switch' 0" +- ] +- + DisableSequence [ +- cset "name='cs42l45 FU 113 Mute Switch' 1" ++ cset "name='cs42l45 FU 113 Channel Switch' 0" + ] + + Value { + CapturePriority 100 + CapturePCM "hw:${CardId},4" + CaptureMixer "default:${CardId}" +- CaptureVolume "cs42l45 FU 113 Channel Volume" ++ CaptureMixerElem "cs42l45 Microphone" + } + } +diff --git a/ucm2/sof-soundwire/cs42l45.conf b/ucm2/sof-soundwire/cs42l45.conf +index ba61048..c88562a 100644 +--- a/ucm2/sof-soundwire/cs42l45.conf ++++ b/ucm2/sof-soundwire/cs42l45.conf +@@ -3,19 +3,11 @@ + SectionDevice."Headphones" { + Comment "Headphones" + +- EnableSequence [ +- cset "name='cs42l45 FU 41 Mute Switch' 0" +- ] +- +- DisableSequence [ +- cset "name='cs42l45 FU 41 Mute Switch' 1" +- ] +- + Value { + PlaybackPriority 200 + PlaybackPCM "hw:${CardId},0" + PlaybackMixer "default:${CardId}" +- PlaybackVolume "cs42l45 FU 41 Channel Volume" ++ PlaybackMixerElem "cs42l45 Headphone" + JackControl "cs42l45 OT 43 Headphone Jack" + } + } +@@ -23,19 +15,15 @@ SectionDevice."Headphones" { + SectionDevice."Headset" { + Comment "Jack Microphone" + +- EnableSequence [ +- cset "name='cs42l45 FU 36 Mute Switch' 0" +- ] +- + DisableSequence [ +- cset "name='cs42l45 FU 36 Mute Switch' 1" ++ cset "name='cs42l45 FU 36 Channel Switch' 0" + ] + + Value { + CapturePriority 200 + CapturePCM "hw:${CardId},1" + CaptureMixer "default:${CardId}" +- CaptureVolume "cs42l45 FU 36 Channel Volume" ++ CaptureMixerElem "cs42l45 Jack Microphone" + JackControl "cs42l45 IT 31 Microphone Jack" + } + } +diff --git a/ucm2/sof-soundwire/sof-soundwire.conf b/ucm2/sof-soundwire/sof-soundwire.conf +index 895f479..7a00209 100644 +--- a/ucm2/sof-soundwire/sof-soundwire.conf ++++ b/ucm2/sof-soundwire/sof-soundwire.conf +@@ -117,7 +117,7 @@ If.spk_init { + If.hs_init { + Condition { + Type RegexMatch +- Regex "(cs42l43|rt5682|rt700|rt711|rt713(-sdca)?)" ++ Regex "(cs42l43|cs42l45|rt5682|rt700|rt711|rt713(-sdca)?)" + String "${var:HeadsetCodec1}" + } + True.Include.hs_init.File "/codecs/${var:HeadsetCodec1}/init.conf" +-- +2.51.1 + + +From 5d0d2bd660b4378f802c94be3eadd8375c4c7a3a Mon Sep 17 00:00:00 2001 +From: Shuming Fan +Date: Tue, 9 Dec 2025 15:40:49 +0800 +Subject: [PATCH 3/3] ucm2: codecs: rt722: add condition to SetLED for mic + +Some SKUs don't have the internal mic, so the patch adds the condition to check +whether the SKU has the internal mic or not. + +Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/657 +Signed-off-by: Shuming Fan +Signed-off-by: Jaroslav Kysela +--- + ucm2/codecs/rt722/init.conf | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/ucm2/codecs/rt722/init.conf b/ucm2/codecs/rt722/init.conf +index c820e55..40f2458 100644 +--- a/ucm2/codecs/rt722/init.conf ++++ b/ucm2/codecs/rt722/init.conf +@@ -10,4 +10,11 @@ BootSequence [ + cset "name='rt722 FU0F Capture Volume' 63" + ] + +-Macro [{ SetLED { LED="mic" Action="attach" CtlId="rt722 FU1E Capture Switch" } }] ++If.mic_init_rt722 { ++ Condition { ++ Type String ++ Needle "rt722" ++ Haystack "${var:MicCodec1}" ++ } ++ True.Macro [{ SetLED { LED="mic" Action="attach" CtlId="rt722 FU1E Capture Switch" } }] ++} +-- +2.51.1 + From 0c2415ae0bff58ebcd85fac9993c5d7be7f60a30 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 10 Dec 2025 12:17:42 +0100 Subject: [PATCH 115/120] apply upstream 1.2.15 fixes #2 Signed-off-by: Jaroslav Kysela --- alsa-git.patch | 518 ++++++++++++++++++++++++++++++++++++++++++++++++- alsa-lib.spec | 4 +- 2 files changed, 517 insertions(+), 5 deletions(-) diff --git a/alsa-git.patch b/alsa-git.patch index 486803f..f0124a0 100644 --- a/alsa-git.patch +++ b/alsa-git.patch @@ -1,7 +1,7 @@ From a068cf08ad67447893b707cddfce31c9cafee643 Mon Sep 17 00:00:00 2001 From: Mike Gilbert Date: Mon, 8 Dec 2025 23:46:17 -0500 -Subject: [PATCH 1/3] ucm: use closefrom instead of close_range +Subject: [PATCH 1/7] ucm: use closefrom instead of close_range closefrom is a library function with a fallback mechanism for when the kernel does not support the close_range syscall. @@ -52,7 +52,7 @@ index b5a22023..713039b4 100644 From 813ffe34ff6c720dcc56e4549338bf9e9184af1f Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 9 Dec 2025 17:48:34 +0100 -Subject: [PATCH 2/3] ucm: exec - fix maxfd used warning +Subject: [PATCH 2/7] ucm: exec - fix maxfd used warning Fixes: a068cf08 ("ucm: use closefrom instead of close_range") Signed-off-by: Jaroslav Kysela @@ -103,7 +103,7 @@ index 713039b4..c16a4cfd 100644 From a6238053c4fa518b214f99d91a01b96c5ef6e3ca Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 9 Dec 2025 18:04:07 +0100 -Subject: [PATCH 3/3] conf: merge card specific contents per file (whole) after +Subject: [PATCH 3/7] conf: merge card specific contents per file (whole) after parsing Unfortunately, mentioned fix caused a regression for items stored in one file. @@ -148,3 +148,515 @@ index 49499ecd..b1ec9b38 100644 -- 2.51.1 + +From 2f59398c83b8065fb9ff58939df3a9187746068e Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 9 Dec 2025 18:39:52 +0100 +Subject: [PATCH 4/7] conf: fix possible memory leak in config_file_open() - + error path + +Fixes: a6238053 ("conf: merge card specific contents per file (whole) after parsing") +Signed-off-by: Jaroslav Kysela +--- + src/conf.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/conf.c b/src/conf.c +index b1ec9b38..d90f6dc3 100644 +--- a/src/conf.c ++++ b/src/conf.c +@@ -4130,8 +4130,11 @@ static int config_file_open(snd_config_t *root, const char *filename, int merge) + err = snd_config_top(&top); + if (err >= 0) { + err = snd_config_load(top, in); +- if (err >= 0) ++ if (err >= 0) { + err = snd_config_merge(root, top, 1); ++ if (err < 0) ++ snd_config_delete(top); ++ } + } + } + snd_input_close(in); +-- +2.51.1 + + +From 2ef8952b46a46b97a6df2f29bcd182f895ebf9e4 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 12:03:29 +0100 +Subject: [PATCH 5/7] Revert "conf: fix load_for_all_cards() - do not merge the + card specific contents" + +This reverts commit eda76146c5653ff1d5bc4b4c53f7a2d5ccc17da2. + +Also, revert additional related commits: + + Revert "conf: fix possible memory leak in config_file_open() - error path" + This reverts commit 2f59398c83b8065fb9ff58939df3a9187746068e. + + Revert "conf: merge card specific contents per file (whole) after parsing" + This reverts commit a6238053c4fa518b214f99d91a01b96c5ef6e3ca. + +Signed-off-by: Jaroslav Kysela +--- + src/conf.c | 42 ++++++++++++------------------------------ + 1 file changed, 12 insertions(+), 30 deletions(-) + +diff --git a/src/conf.c b/src/conf.c +index d90f6dc3..fb9f0658 100644 +--- a/src/conf.c ++++ b/src/conf.c +@@ -4116,27 +4116,14 @@ static int config_filename_filter(const struct dirent64 *dirent) + return 0; + } + +-static int config_file_open(snd_config_t *root, const char *filename, int merge) ++static int config_file_open(snd_config_t *root, const char *filename) + { + snd_input_t *in; +- snd_config_t *top; + int err; + + err = snd_input_stdio_open(&in, filename, "r"); + if (err >= 0) { +- if (merge) { +- err = snd_config_load(root, in); +- } else { +- err = snd_config_top(&top); +- if (err >= 0) { +- err = snd_config_load(top, in); +- if (err >= 0) { +- err = snd_config_merge(root, top, 1); +- if (err < 0) +- snd_config_delete(top); +- } +- } +- } ++ err = snd_config_load(root, in); + snd_input_close(in); + if (err < 0) + snd_error(CORE, "%s may be old or corrupted: consider to remove or fix it", filename); +@@ -4146,7 +4133,7 @@ static int config_file_open(snd_config_t *root, const char *filename, int merge) + return err; + } + +-static int config_file_load(snd_config_t *root, const char *fn, int errors, int merge) ++static int config_file_load(snd_config_t *root, const char *fn, int errors) + { + struct stat64 st; + struct dirent64 **namelist; +@@ -4159,7 +4146,7 @@ static int config_file_load(snd_config_t *root, const char *fn, int errors, int + return 1; + } + if (!S_ISDIR(st.st_mode)) +- return config_file_open(root, fn, merge); ++ return config_file_open(root, fn); + #ifndef DOC_HIDDEN + #if defined(_GNU_SOURCE) && \ + !defined(__NetBSD__) && \ +@@ -4185,7 +4172,7 @@ static int config_file_load(snd_config_t *root, const char *fn, int errors, int + snprintf(filename, sl, "%s/%s", fn, namelist[j]->d_name); + filename[sl-1] = '\0'; + +- err = config_file_open(root, filename, merge); ++ err = config_file_open(root, filename); + free(filename); + } + free(namelist[j]); +@@ -4197,20 +4184,20 @@ static int config_file_load(snd_config_t *root, const char *fn, int errors, int + return 0; + } + +-static int config_file_load_user(snd_config_t *root, const char *fn, int errors, int merge) ++static int config_file_load_user(snd_config_t *root, const char *fn, int errors) + { + char *fn2; + int err; + + err = snd_user_file(fn, &fn2); + if (err < 0) +- return config_file_load(root, fn, errors, merge); +- err = config_file_load(root, fn2, errors, merge); ++ return config_file_load(root, fn, errors); ++ err = config_file_load(root, fn2, errors); + free(fn2); + return err; + } + +-static int config_file_load_user_all(snd_config_t *_root, snd_config_t *_file, int errors, int merge) ++static int config_file_load_user_all(snd_config_t *_root, snd_config_t *_file, int errors) + { + snd_config_t *file = _file, *root = _root, *n; + char *name, *name2, *remain, *rname = NULL; +@@ -4241,7 +4228,7 @@ static int config_file_load_user_all(snd_config_t *_root, snd_config_t *_file, i + *remain = '\0'; + remain += 3; + } +- err = config_file_load_user(root, name2, errors, merge); ++ err = config_file_load_user(root, name2, errors); + if (err < 0) + goto _err; + if (err == 0) /* first hit wins */ +@@ -4290,7 +4277,7 @@ int snd_config_hook_load(snd_config_t *root, snd_config_t *config, snd_config_t + { + snd_config_t *n; + snd_config_iterator_t i, next; +- int err, idx = 0, errors = 1, merge = 1, hit; ++ int err, idx = 0, errors = 1, hit; + + assert(root && dst); + if ((err = snd_config_search(config, "errors", &n)) >= 0) { +@@ -4300,10 +4287,6 @@ int snd_config_hook_load(snd_config_t *root, snd_config_t *config, snd_config_t + return errors; + } + } +- /* special case, we know the card number (may be multiple times) */ +- if (private_data && snd_config_search(private_data, "integer", &n) >= 0) { +- merge = 0; +- } + if ((err = snd_config_search(config, "files", &n)) < 0) { + snd_error(CORE, "Unable to find field files in the pre-load section"); + return -EINVAL; +@@ -4316,7 +4299,6 @@ int snd_config_hook_load(snd_config_t *root, snd_config_t *config, snd_config_t + snd_error(CORE, "Invalid type for field filenames"); + goto _err; + } +- + do { + hit = 0; + snd_config_for_each(i, next, n) { +@@ -4330,7 +4312,7 @@ int snd_config_hook_load(snd_config_t *root, snd_config_t *config, snd_config_t + goto _err; + } + if (i == idx) { +- err = config_file_load_user_all(root, n, errors, merge); ++ err = config_file_load_user_all(root, n, errors); + if (err < 0) + goto _err; + idx++; +-- +2.51.1 + + +From 16ab43db6ed6f71424d5ad78e62f85baaeae5051 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 12:12:47 +0100 +Subject: [PATCH 6/7] conf: USB-Audio: define pcm configuration block only one + time + +There may be multiple USB soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/USB-Audio.conf | 30 +++++++++++++++--------------- + 1 file changed, 15 insertions(+), 15 deletions(-) + +diff --git a/src/conf/cards/USB-Audio.conf b/src/conf/cards/USB-Audio.conf +index 2f6d2ee0..1fc540e2 100644 +--- a/src/conf/cards/USB-Audio.conf ++++ b/src/conf/cards/USB-Audio.conf +@@ -99,7 +99,7 @@ USB-Audio.pcm.iec958_2_device { + # device 0: analog output, digital input + # device 1: digital output, analog input + USB-Audio."AudioPhile".pcm.default "cards.USB-Audio.Audiophile USB (tm).pcm.default" +-USB-Audio."Audiophile USB (tm)".pcm.default { ++USB-Audio."Audiophile USB (tm)".pcm.!default { + @args [ CARD ] + @args.CARD { type string } + type asym +@@ -120,7 +120,7 @@ USB-Audio."Audiophile USB (tm)".pcm.default { + } + } + USB-Audio."AudioPhile".pcm.iec958 "cards.USB-Audio.Audiophile USB (tm).pcm.iec958" +-USB-Audio."Audiophile USB (tm)".pcm.iec958 { ++USB-Audio."Audiophile USB (tm)".pcm.!iec958 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } +@@ -142,7 +142,7 @@ USB-Audio."Audiophile USB (tm)".pcm.iec958 { + + # For this card we can (and must to get IEC61937) set AES bits + USB-Audio."MicroII".pcm.iec958 "cards.USB-Audio.Audio Advantage MicroII.pcm.iec958" +-USB-Audio."Audio Advantage MicroII".pcm.iec958 { ++USB-Audio."Audio Advantage MicroII".pcm.!iec958 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } +@@ -180,7 +180,7 @@ USB-Audio."Audio Advantage MicroII".pcm.iec958 { + + + +-USB-Audio.pcm.front.0 { ++USB-Audio.pcm.front.!0 { + @args [ CARD ] + @args.CARD { type string } + @func refer +@@ -201,7 +201,7 @@ USB-Audio.pcm.front.0 { + } + } + +-USB-Audio.pcm.default { ++USB-Audio.pcm.!default { + @args [ CARD ] + @args.CARD { type string } + @func refer +@@ -249,14 +249,14 @@ USB-Audio.pcm.default { + } + } + +-USB-Audio.pcm.default_playback_dmix_yes { ++USB-Audio.pcm.!default_playback_dmix_yes { + @args [ CARD ] + @args.CARD { type string } + @func concat + strings [ "dmix:" $CARD ] + } + +-USB-Audio.pcm.default_playback_dmix_no { ++USB-Audio.pcm.!default_playback_dmix_no { + @args [ CARD ] + @args.CARD { type string } + type hw +@@ -266,7 +266,7 @@ USB-Audio.pcm.default_playback_dmix_no { + + + +-USB-Audio.pcm.surround40.0 { ++USB-Audio.pcm.surround40.!0 { + @args [ CARD ] + @args.CARD { type string } + @func refer +@@ -301,7 +301,7 @@ USB-Audio.pcm.surround40.0 { + } + } + +-USB-Audio.pcm.surround40_default { ++USB-Audio.pcm.!surround40_default { + @args [ CARD ] + @args.CARD { type string } + type hw +@@ -309,7 +309,7 @@ USB-Audio.pcm.surround40_default { + device 0 + } + +-USB-Audio.pcm.surround40_six_channels { ++USB-Audio.pcm.!surround40_six_channels { + @args [ CARD ] + @args.CARD { type string } + type route +@@ -327,7 +327,7 @@ USB-Audio.pcm.surround40_six_channels { + } + } + +-USB-Audio.pcm.surround40_two_stereo_devices { ++USB-Audio.pcm.!surround40_two_stereo_devices { + @args [ CARD ] + @args.CARD { type string } + type route +@@ -369,7 +369,7 @@ USB-Audio.pcm.surround40_two_stereo_devices { + + + +-USB-Audio.pcm.surround51.0 { ++USB-Audio.pcm.surround51.!0 { + @args [ CARD ] + @args.CARD { type string } + @func refer +@@ -402,7 +402,7 @@ USB-Audio.pcm.surround51.0 { + + + +-USB-Audio.pcm.surround71.0 { ++USB-Audio.pcm.surround71.!0 { + @args [ CARD ] + @args.CARD { type string } + @func refer +@@ -437,7 +437,7 @@ USB-Audio.pcm.surround71.0 { + + + +-USB-Audio.pcm.iec958.0 { ++USB-Audio.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } +@@ -472,7 +472,7 @@ USB-Audio.pcm.iec958.0 { + } + } + +-USB-Audio.pcm.iec958.1 { ++USB-Audio.pcm.iec958.!1 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } +-- +2.51.1 + + +From 010b699c92a9a6ffdca1874cd2e3c6c054d212e0 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 12:12:47 +0100 +Subject: [PATCH 7/7] conf: HDA-Intel: define pcm configuration block only one + time + +There may be multiple HDA-Intel soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/HDA-Intel.conf | 32 ++++++++++++++++---------------- + 1 file changed, 16 insertions(+), 16 deletions(-) + +diff --git a/src/conf/cards/HDA-Intel.conf b/src/conf/cards/HDA-Intel.conf +index 5451606f..76775b97 100644 +--- a/src/conf/cards/HDA-Intel.conf ++++ b/src/conf/cards/HDA-Intel.conf +@@ -4,7 +4,7 @@ + + + +-HDA-Intel.pcm.front.0 { ++HDA-Intel.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -29,7 +29,7 @@ HDA-Intel.pcm.front.0 { + } + + # default with dmix+softvol & dsnoop +-HDA-Intel.pcm.default { ++HDA-Intel.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +@@ -84,7 +84,7 @@ HDA-Intel.pcm.surround71.0 cards.HDA-Intel.pcm.front.0 + + + +-HDA-Intel.pcm.iec958.0 { ++HDA-Intel.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +@@ -163,7 +163,7 @@ HDA-Intel.pcm.iec958.0 { + hint.device 1 + } + +-HDA-Intel.pcm.hdmi.common { ++HDA-Intel.pcm.hdmi.!common { + @args [ CARD DEVICE CTLINDEX AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +@@ -212,7 +212,7 @@ HDA-Intel.pcm.hdmi.common { + hint.device $DEVICE + } + +-HDA-Intel.pcm.hdmi.0 { ++HDA-Intel.pcm.hdmi.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } +@@ -235,7 +235,7 @@ HDA-Intel.pcm.hdmi.0 { + } + } + +-HDA-Intel.pcm.hdmi.1 { ++HDA-Intel.pcm.hdmi.!1 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } +@@ -258,7 +258,7 @@ HDA-Intel.pcm.hdmi.1 { + } + } + +-HDA-Intel.pcm.hdmi.2 { ++HDA-Intel.pcm.hdmi.!2 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } +@@ -281,7 +281,7 @@ HDA-Intel.pcm.hdmi.2 { + } + } + +-HDA-Intel.pcm.hdmi.3 { ++HDA-Intel.pcm.hdmi.!3 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } +@@ -304,7 +304,7 @@ HDA-Intel.pcm.hdmi.3 { + } + } + +-HDA-Intel.pcm.hdmi.4 { ++HDA-Intel.pcm.hdmi.!4 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } +@@ -327,7 +327,7 @@ HDA-Intel.pcm.hdmi.4 { + } + } + +-HDA-Intel.pcm.hdmi.5 { ++HDA-Intel.pcm.hdmi.!5 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } +@@ -350,7 +350,7 @@ HDA-Intel.pcm.hdmi.5 { + } + } + +-HDA-Intel.pcm.hdmi.6 { ++HDA-Intel.pcm.hdmi.!6 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } +@@ -373,7 +373,7 @@ HDA-Intel.pcm.hdmi.6 { + } + } + +-HDA-Intel.pcm.hdmi.7 { ++HDA-Intel.pcm.hdmi.!7 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } +@@ -396,7 +396,7 @@ HDA-Intel.pcm.hdmi.7 { + } + } + +-HDA-Intel.pcm.hdmi.8 { ++HDA-Intel.pcm.hdmi.!8 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } +@@ -419,7 +419,7 @@ HDA-Intel.pcm.hdmi.8 { + } + } + +-HDA-Intel.pcm.hdmi.9 { ++HDA-Intel.pcm.hdmi.!9 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } +@@ -442,7 +442,7 @@ HDA-Intel.pcm.hdmi.9 { + } + } + +-HDA-Intel.pcm.hdmi.10 { ++HDA-Intel.pcm.hdmi.!10 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } +@@ -467,7 +467,7 @@ HDA-Intel.pcm.hdmi.10 { + + + +-HDA-Intel.pcm.modem.0 { ++HDA-Intel.pcm.modem.!0 { + @args [ CARD ] + @args.CARD { + type string +-- +2.51.1 + diff --git a/alsa-lib.spec b/alsa-lib.spec index d91c95d..e11c07f 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 2%{?prever_dot}%{?dist} +Release: 3%{?prever_dot}%{?dist} License: LGPL-2.1-or-later URL: http://www.alsa-project.org/ @@ -167,7 +167,7 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog -* Sun Dec 7 2025 Jaroslav Kysela - 1.2.15-1 +* Sun Dec 10 2025 Jaroslav Kysela - 1.2.15-3 - update to 1.2.15 * Wed Jul 23 2025 Fedora Release Engineering - 1.2.14-4 From 3a48b2356c7243239d307f25c91e42d711cff471 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 10 Dec 2025 16:41:01 +0100 Subject: [PATCH 116/120] apply upstream 1.2.15 fixes #3 Signed-off-by: Jaroslav Kysela --- alsa-git.patch | 4346 +++++++++++++++++++++++++++++++++++++++++++++++- alsa-lib.spec | 4 +- 2 files changed, 4337 insertions(+), 13 deletions(-) diff --git a/alsa-git.patch b/alsa-git.patch index f0124a0..b0fcde8 100644 --- a/alsa-git.patch +++ b/alsa-git.patch @@ -1,7 +1,7 @@ From a068cf08ad67447893b707cddfce31c9cafee643 Mon Sep 17 00:00:00 2001 From: Mike Gilbert Date: Mon, 8 Dec 2025 23:46:17 -0500 -Subject: [PATCH 1/7] ucm: use closefrom instead of close_range +Subject: [PATCH 01/43] ucm: use closefrom instead of close_range closefrom is a library function with a fallback mechanism for when the kernel does not support the close_range syscall. @@ -52,7 +52,7 @@ index b5a22023..713039b4 100644 From 813ffe34ff6c720dcc56e4549338bf9e9184af1f Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 9 Dec 2025 17:48:34 +0100 -Subject: [PATCH 2/7] ucm: exec - fix maxfd used warning +Subject: [PATCH 02/43] ucm: exec - fix maxfd used warning Fixes: a068cf08 ("ucm: use closefrom instead of close_range") Signed-off-by: Jaroslav Kysela @@ -103,8 +103,8 @@ index 713039b4..c16a4cfd 100644 From a6238053c4fa518b214f99d91a01b96c5ef6e3ca Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 9 Dec 2025 18:04:07 +0100 -Subject: [PATCH 3/7] conf: merge card specific contents per file (whole) after - parsing +Subject: [PATCH 03/43] conf: merge card specific contents per file (whole) + after parsing Unfortunately, mentioned fix caused a regression for items stored in one file. Merge the file contents after parsing not inside parsing process. @@ -152,7 +152,7 @@ index 49499ecd..b1ec9b38 100644 From 2f59398c83b8065fb9ff58939df3a9187746068e Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 9 Dec 2025 18:39:52 +0100 -Subject: [PATCH 4/7] conf: fix possible memory leak in config_file_open() - +Subject: [PATCH 04/43] conf: fix possible memory leak in config_file_open() - error path Fixes: a6238053 ("conf: merge card specific contents per file (whole) after parsing") @@ -185,8 +185,8 @@ index b1ec9b38..d90f6dc3 100644 From 2ef8952b46a46b97a6df2f29bcd182f895ebf9e4 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 10 Dec 2025 12:03:29 +0100 -Subject: [PATCH 5/7] Revert "conf: fix load_for_all_cards() - do not merge the - card specific contents" +Subject: [PATCH 05/43] Revert "conf: fix load_for_all_cards() - do not merge + the card specific contents" This reverts commit eda76146c5653ff1d5bc4b4c53f7a2d5ccc17da2. @@ -342,8 +342,8 @@ index d90f6dc3..fb9f0658 100644 From 16ab43db6ed6f71424d5ad78e62f85baaeae5051 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 10 Dec 2025 12:12:47 +0100 -Subject: [PATCH 6/7] conf: USB-Audio: define pcm configuration block only one - time +Subject: [PATCH 06/43] conf: USB-Audio: define pcm configuration block only + one time There may be multiple USB soundcards in the system. Overwrite the PCM configurations when loaded multiple times. @@ -498,8 +498,8 @@ index 2f6d2ee0..1fc540e2 100644 From 010b699c92a9a6ffdca1874cd2e3c6c054d212e0 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 10 Dec 2025 12:12:47 +0100 -Subject: [PATCH 7/7] conf: HDA-Intel: define pcm configuration block only one - time +Subject: [PATCH 07/43] conf: HDA-Intel: define pcm configuration block only + one time There may be multiple HDA-Intel soundcards in the system. Overwrite the PCM configurations when loaded multiple times. @@ -660,3 +660,4327 @@ index 5451606f..76775b97 100644 -- 2.51.1 + +From d83af363f1fc17e2b3e7cf2a0f848722f6643a9a Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 12:12:47 +0100 +Subject: [PATCH 08/43] conf: vc4-hdmi: define pcm configuration block only one + time + +There may be multiple vc4-hdmi soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +BugLink: https://github.com/alsa-project/alsa-lib/issues/488 +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/vc4-hdmi.conf | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/conf/cards/vc4-hdmi.conf b/src/conf/cards/vc4-hdmi.conf +index 0f313d82..7041d185 100644 +--- a/src/conf/cards/vc4-hdmi.conf ++++ b/src/conf/cards/vc4-hdmi.conf +@@ -3,7 +3,7 @@ + # subframe conversion + # + +-vc4-hdmi.pcm.hdmi.0 { ++vc4-hdmi.pcm.hdmi.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +@@ -50,7 +50,7 @@ vc4-hdmi.pcm.hdmi.0 { + } + + # default with plug and softvol +-vc4-hdmi.pcm.default { ++vc4-hdmi.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +-- +2.51.1 + + +From 3969e458124f6933e2f440c2b0b39b29de791a78 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 12:12:47 +0100 +Subject: [PATCH 09/43] conf: AACI,ATIIXP: define pcm configuration block only + one time + +There may be multiple AACI,ATIIXP soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/AACI.conf | 4 ++-- + src/conf/cards/ATIIXP-MODEM.conf | 2 +- + src/conf/cards/ATIIXP-SPDMA.conf | 10 +++++----- + src/conf/cards/ATIIXP.conf | 10 +++++----- + 4 files changed, 13 insertions(+), 13 deletions(-) + +diff --git a/src/conf/cards/AACI.conf b/src/conf/cards/AACI.conf +index 748586a0..ff4778b4 100644 +--- a/src/conf/cards/AACI.conf ++++ b/src/conf/cards/AACI.conf +@@ -4,7 +4,7 @@ + + + +-AACI.pcm.front.0 { ++AACI.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -19,7 +19,7 @@ AACI.pcm.surround40.0 "cards.AACI.pcm.front.0" + + + +-AACI.pcm.surround51.0 { ++AACI.pcm.surround51.!0 { + @args [ CARD ] + @args.CARD { + type string +diff --git a/src/conf/cards/ATIIXP-MODEM.conf b/src/conf/cards/ATIIXP-MODEM.conf +index 6e52af05..1f69b735 100644 +--- a/src/conf/cards/ATIIXP-MODEM.conf ++++ b/src/conf/cards/ATIIXP-MODEM.conf +@@ -4,7 +4,7 @@ + + + +-ATIIXP-MODEM.pcm.modem.0 { ++ATIIXP-MODEM.pcm.modem.!0 { + @args [ CARD ] + @args.CARD { + type string +diff --git a/src/conf/cards/ATIIXP-SPDMA.conf b/src/conf/cards/ATIIXP-SPDMA.conf +index 42540d68..12c40efc 100644 +--- a/src/conf/cards/ATIIXP-SPDMA.conf ++++ b/src/conf/cards/ATIIXP-SPDMA.conf +@@ -4,7 +4,7 @@ + + + +-ATIIXP-SPDMA.pcm.front.0 { ++ATIIXP-SPDMA.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -14,7 +14,7 @@ ATIIXP-SPDMA.pcm.front.0 { + } + + # default with dmix/dsnoop +-ATIIXP.pcm.default { ++ATIIXP.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +@@ -38,7 +38,7 @@ ATIIXP.pcm.default { + + + +-ATIIXP-SPDMA.pcm.surround40.0 { ++ATIIXP-SPDMA.pcm.surround40.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -82,7 +82,7 @@ ATIIXP-SPDMA.pcm.surround40.0 { + + + +-ATIIXP-SPDMA.pcm.surround51.0 { ++ATIIXP-SPDMA.pcm.surround51.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -136,7 +136,7 @@ ATIIXP-SPDMA.pcm.surround51.0 { + + + +-ATIIXP-SPDMA.pcm.iec958.0 { ++ATIIXP-SPDMA.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +diff --git a/src/conf/cards/ATIIXP.conf b/src/conf/cards/ATIIXP.conf +index c4d33ef3..13e01c48 100644 +--- a/src/conf/cards/ATIIXP.conf ++++ b/src/conf/cards/ATIIXP.conf +@@ -4,7 +4,7 @@ + + + +-ATIIXP.pcm.front.0 { ++ATIIXP.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -14,7 +14,7 @@ ATIIXP.pcm.front.0 { + } + + # default with dmix/dsnoop +-ATIIXP.pcm.default { ++ATIIXP.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +@@ -38,7 +38,7 @@ ATIIXP.pcm.default { + + + +-ATIIXP.pcm.surround40.0 { ++ATIIXP.pcm.surround40.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -82,7 +82,7 @@ ATIIXP.pcm.surround40.0 { + + + +-ATIIXP.pcm.surround51.0 { ++ATIIXP.pcm.surround51.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -136,7 +136,7 @@ ATIIXP.pcm.surround51.0 { + + + +-ATIIXP.pcm.iec958.0 { ++ATIIXP.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +-- +2.51.1 + + +From e5dbefdff1254fb66ffa82983c6fed08ba8e37df Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 12:12:47 +0100 +Subject: [PATCH 10/43] conf: Audigy: define pcm configuration block only one + time + +There may be multiple Audigy soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/Audigy.conf | 12 ++++++------ + src/conf/cards/Audigy2.conf | 16 ++++++++-------- + 2 files changed, 14 insertions(+), 14 deletions(-) + +diff --git a/src/conf/cards/Audigy.conf b/src/conf/cards/Audigy.conf +index 42692cfd..a353c624 100644 +--- a/src/conf/cards/Audigy.conf ++++ b/src/conf/cards/Audigy.conf +@@ -4,7 +4,7 @@ + + + +-Audigy.pcm.front.0 { ++Audigy.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -40,7 +40,7 @@ Audigy.pcm.front.0 { + + + +-Audigy.pcm.rear.0 { ++Audigy.pcm.rear.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -68,7 +68,7 @@ Audigy.pcm.rear.0 { + + + +-Audigy.pcm.center_lfe.0 { ++Audigy.pcm.center_lfe.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -107,7 +107,7 @@ Audigy.pcm.center_lfe.0 { + + + +-Audigy.pcm.surround40.0 { ++Audigy.pcm.surround40.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -143,7 +143,7 @@ Audigy.pcm.surround40.0 { + + + +-Audigy.pcm.surround51.0 { ++Audigy.pcm.surround51.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -190,7 +190,7 @@ Audigy.pcm.surround51.0 { + + + +-Audigy.pcm.iec958.0 { ++Audigy.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +diff --git a/src/conf/cards/Audigy2.conf b/src/conf/cards/Audigy2.conf +index 35126d23..3c15fd1d 100644 +--- a/src/conf/cards/Audigy2.conf ++++ b/src/conf/cards/Audigy2.conf +@@ -4,7 +4,7 @@ + + + +-Audigy2.pcm.front.0 { ++Audigy2.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -41,7 +41,7 @@ Audigy2.pcm.front.0 { + + + +-Audigy2.pcm.rear.0 { ++Audigy2.pcm.rear.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -69,7 +69,7 @@ Audigy2.pcm.rear.0 { + + + +-Audigy2.pcm.center_lfe.0 { ++Audigy2.pcm.center_lfe.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -105,7 +105,7 @@ Audigy2.pcm.center_lfe.0 { + + + +-Audigy2.pcm.side.0 { ++Audigy2.pcm.side.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -144,7 +144,7 @@ Audigy2.pcm.side.0 { + + + +-Audigy2.pcm.surround40.0 { ++Audigy2.pcm.surround40.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -180,7 +180,7 @@ Audigy2.pcm.surround40.0 { + + + +-Audigy2.pcm.surround51.0 { ++Audigy2.pcm.surround51.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -227,7 +227,7 @@ Audigy2.pcm.surround51.0 { + + + +-Audigy2.pcm.surround71.0 { ++Audigy2.pcm.surround71.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -285,7 +285,7 @@ Audigy2.pcm.surround71.0 { + + + +-Audigy2.pcm.iec958.0 { ++Audigy2.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +-- +2.51.1 + + +From 7079887cd21077fe9569a0d910b11e40f7e5153d Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 12:12:47 +0100 +Subject: [PATCH 11/43] conf: Aureon: define pcm configuration block only one + time + +There may be multiple Aureon soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/Aureon51.conf | 14 +++++++------- + src/conf/cards/Aureon71.conf | 18 +++++++++--------- + 2 files changed, 16 insertions(+), 16 deletions(-) + +diff --git a/src/conf/cards/Aureon51.conf b/src/conf/cards/Aureon51.conf +index 07be4a77..9bf34661 100644 +--- a/src/conf/cards/Aureon51.conf ++++ b/src/conf/cards/Aureon51.conf +@@ -3,7 +3,7 @@ + # + + # default with dmix & dsnoop +-Aureon51.pcm.default { ++Aureon51.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +@@ -27,7 +27,7 @@ Aureon51.pcm.default { + + + +-Aureon51.pcm.front.0 { ++Aureon51.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -38,7 +38,7 @@ Aureon51.pcm.front.0 { + + + +-Aureon51.pcm.rear.0 { ++Aureon51.pcm.rear.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -51,7 +51,7 @@ Aureon51.pcm.rear.0 { + + + +-Aureon51.pcm.center_lfe.0 { ++Aureon51.pcm.center_lfe.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -63,7 +63,7 @@ Aureon51.pcm.center_lfe.0 { + + + +-Aureon51.pcm.side.0 { ++Aureon51.pcm.side.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -91,7 +91,7 @@ Aureon51.pcm.surround40.0 { + + + +-Aureon51.pcm.surround51.0 { ++Aureon51.pcm.surround51.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -103,7 +103,7 @@ Aureon51.pcm.surround51.0 { + + + +-Aureon51.pcm.iec958.0 { ++Aureon51.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +diff --git a/src/conf/cards/Aureon71.conf b/src/conf/cards/Aureon71.conf +index a43ce2ce..f29bc297 100644 +--- a/src/conf/cards/Aureon71.conf ++++ b/src/conf/cards/Aureon71.conf +@@ -3,7 +3,7 @@ + # + + # default with dmix & dsnoop +-Aureon71.pcm.default { ++Aureon71.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +@@ -27,7 +27,7 @@ Aureon71.pcm.default { + + + +-Aureon71.pcm.front.0 { ++Aureon71.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -38,7 +38,7 @@ Aureon71.pcm.front.0 { + + + +-Aureon71.pcm.rear.0 { ++Aureon71.pcm.rear.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -50,7 +50,7 @@ Aureon71.pcm.rear.0 { + + + +-Aureon71.pcm.center_lfe.0 { ++Aureon71.pcm.center_lfe.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -63,7 +63,7 @@ Aureon71.pcm.center_lfe.0 { + + + +-Aureon71.pcm.side.0 { ++Aureon71.pcm.side.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -76,7 +76,7 @@ Aureon71.pcm.side.0 { + + + +-Aureon71.pcm.surround40.0 { ++Aureon71.pcm.surround40.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -91,7 +91,7 @@ Aureon71.pcm.surround40.0 { + + + +-Aureon71.pcm.surround51.0 { ++Aureon71.pcm.surround51.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -103,7 +103,7 @@ Aureon71.pcm.surround51.0 { + + + +-Aureon71.pcm.surround71.0 { ++Aureon71.pcm.surround71.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -114,7 +114,7 @@ Aureon71.pcm.surround71.0 { + + + +-Aureon71.pcm.iec958.0 { ++Aureon71.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +-- +2.51.1 + + +From ea984c3a7d6fbc3613c72614f5fce18ad2c7f9b1 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 12:12:47 +0100 +Subject: [PATCH 12/43] conf: AU88[123]0: define pcm configuration block only + one time + +There may be multiple AU88[123]0 soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/AU8810.conf | 4 ++-- + src/conf/cards/AU8820.conf | 2 +- + src/conf/cards/AU8830.conf | 4 ++-- + 3 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/src/conf/cards/AU8810.conf b/src/conf/cards/AU8810.conf +index 24d46c34..6b596b68 100644 +--- a/src/conf/cards/AU8810.conf ++++ b/src/conf/cards/AU8810.conf +@@ -4,7 +4,7 @@ + + + +-AU8810.pcm.front.0 { ++AU8810.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -15,7 +15,7 @@ AU8810.pcm.front.0 { + + + +-AU8810.pcm.iec958.0 { ++AU8810.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +diff --git a/src/conf/cards/AU8820.conf b/src/conf/cards/AU8820.conf +index 07890254..fe2cbc11 100644 +--- a/src/conf/cards/AU8820.conf ++++ b/src/conf/cards/AU8820.conf +@@ -4,7 +4,7 @@ + + + +-AU8820.pcm.front.0 { ++AU8820.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +diff --git a/src/conf/cards/AU8830.conf b/src/conf/cards/AU8830.conf +index 39e66d50..9cd78b3e 100644 +--- a/src/conf/cards/AU8830.conf ++++ b/src/conf/cards/AU8830.conf +@@ -4,7 +4,7 @@ + + + +-AU8830.pcm.front.0 { ++AU8830.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -19,7 +19,7 @@ AU8830.pcm.surround40.0 "cards.AU8830.pcm.front.0" + + + +-AU8830.pcm.iec958.0 { ++AU8830.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +-- +2.51.1 + + +From 68b8b435416ea734dda55c39f59bea90ea4b0dd6 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 12:12:47 +0100 +Subject: [PATCH 13/43] conf: CA0106: define pcm configuration block only one + time + +There may be multiple CA0106 soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/CA0106.conf | 18 +++++++++--------- + 1 file changed, 9 insertions(+), 9 deletions(-) + +diff --git a/src/conf/cards/CA0106.conf b/src/conf/cards/CA0106.conf +index 2f0eaf0a..1fea79f5 100644 +--- a/src/conf/cards/CA0106.conf ++++ b/src/conf/cards/CA0106.conf +@@ -3,7 +3,7 @@ + # + + # default with dmix & dsnoop +-CA0106.pcm.default { ++CA0106.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +@@ -27,7 +27,7 @@ CA0106.pcm.default { + + + +-CA0106.pcm.front.0 { ++CA0106.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -38,7 +38,7 @@ CA0106.pcm.front.0 { + + + +-CA0106.pcm.rear.0 { ++CA0106.pcm.rear.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -50,7 +50,7 @@ CA0106.pcm.rear.0 { + + + +-CA0106.pcm.center_lfe.0 { ++CA0106.pcm.center_lfe.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -62,7 +62,7 @@ CA0106.pcm.center_lfe.0 { + + + +-CA0106.pcm.side.0 { ++CA0106.pcm.side.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -74,7 +74,7 @@ CA0106.pcm.side.0 { + + + +-CA0106.pcm.surround40.0 { ++CA0106.pcm.surround40.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -114,7 +114,7 @@ CA0106.pcm.surround40.0 { + + + +-CA0106.pcm.surround51.0 { ++CA0106.pcm.surround51.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -159,7 +159,7 @@ CA0106.pcm.surround51.0 { + ] + } + +-CA0106.pcm.surround71.0 { ++CA0106.pcm.surround71.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -220,7 +220,7 @@ CA0106.pcm.surround71.0 { + + + +-CA0106.pcm.iec958.0 { ++CA0106.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +-- +2.51.1 + + +From 041299ea39a7a8d2cb55cb8c2cb5a2e985d38fc3 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 12:12:47 +0100 +Subject: [PATCH 14/43] conf: CMI8xxx: define pcm configuration block only one + time + +There may be multiple CMI8xxx soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/CMI8338-SWIEC.conf | 10 +++++----- + src/conf/cards/CMI8338.conf | 10 +++++----- + src/conf/cards/CMI8738-MC6.conf | 12 ++++++------ + src/conf/cards/CMI8738-MC8.conf | 14 +++++++------- + src/conf/cards/CMI8788.conf | 12 ++++++------ + 5 files changed, 29 insertions(+), 29 deletions(-) + +diff --git a/src/conf/cards/CMI8338-SWIEC.conf b/src/conf/cards/CMI8338-SWIEC.conf +index af3a579f..ca86c466 100644 +--- a/src/conf/cards/CMI8338-SWIEC.conf ++++ b/src/conf/cards/CMI8338-SWIEC.conf +@@ -5,7 +5,7 @@ + + + +-CMI8338-SWIEC.pcm.front.0 { ++CMI8338-SWIEC.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -15,7 +15,7 @@ CMI8338-SWIEC.pcm.front.0 { + } + + # default with dmix/dsnoop +-CMI8338-SWIEC.pcm.default { ++CMI8338-SWIEC.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +@@ -41,7 +41,7 @@ CMI8338-SWIEC.pcm.default { + + # 2nd DAC + # FIXME: we need a volume attenuator for rear channel. +-CMI8338-SWIEC.pcm.rear.0 { ++CMI8338-SWIEC.pcm.rear.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -54,7 +54,7 @@ CMI8338-SWIEC.pcm.rear.0 { + + + # for the old CM8738 with 2nd DAC for rear +-CMI8338-SWIEC.pcm.surround40.0 { ++CMI8338-SWIEC.pcm.surround40.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -91,7 +91,7 @@ CMI8338-SWIEC.pcm.surround40.0 { + + + +-CMI8338-SWIEC.pcm.iec958.0 { ++CMI8338-SWIEC.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +diff --git a/src/conf/cards/CMI8338.conf b/src/conf/cards/CMI8338.conf +index 144fc9b0..0f92ad0b 100644 +--- a/src/conf/cards/CMI8338.conf ++++ b/src/conf/cards/CMI8338.conf +@@ -4,7 +4,7 @@ + + + +-CMI8338.pcm.front.0 { ++CMI8338.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -14,7 +14,7 @@ CMI8338.pcm.front.0 { + } + + # default with dmix/dsnoop +-CMI8338.pcm.default { ++CMI8338.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +@@ -40,7 +40,7 @@ CMI8338.pcm.default { + + # 2nd DAC + # FIXME: we need a volume attenuator for rear channel. +-CMI8338.pcm.rear.0 { ++CMI8338.pcm.rear.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -53,7 +53,7 @@ CMI8338.pcm.rear.0 { + + + # for the old CM8738 with 2nd DAC for rear +-CMI8338.pcm.surround40.0 { ++CMI8338.pcm.surround40.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -90,7 +90,7 @@ CMI8338.pcm.surround40.0 { + + + +-CMI8338.pcm.iec958.0 { ++CMI8338.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +diff --git a/src/conf/cards/CMI8738-MC6.conf b/src/conf/cards/CMI8738-MC6.conf +index edc67d44..2b1c7d05 100644 +--- a/src/conf/cards/CMI8738-MC6.conf ++++ b/src/conf/cards/CMI8738-MC6.conf +@@ -4,7 +4,7 @@ + + + +-CMI8738-MC6.pcm.front.0 { ++CMI8738-MC6.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -14,7 +14,7 @@ CMI8738-MC6.pcm.front.0 { + } + + # default with dmix/dsnoop +-CMI8738-MC6.pcm.default { ++CMI8738-MC6.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +@@ -40,7 +40,7 @@ CMI8738-MC6.pcm.default { + + # 2nd DAC + # FIXME: we need a volume attenuator for rear channel. +-CMI8738-MC6.pcm.rear.0 { ++CMI8738-MC6.pcm.rear.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -52,7 +52,7 @@ CMI8738-MC6.pcm.rear.0 { + + + +-CMI8738-MC6.pcm.surround40.0 { ++CMI8738-MC6.pcm.surround40.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -82,7 +82,7 @@ CMI8738-MC6.pcm.surround40.0 { + + + +-CMI8738-MC6.pcm.surround51.0 { ++CMI8738-MC6.pcm.surround51.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -109,7 +109,7 @@ CMI8738-MC6.pcm.surround51.0 { + + + +-CMI8738-MC6.pcm.iec958.0 { ++CMI8738-MC6.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +diff --git a/src/conf/cards/CMI8738-MC8.conf b/src/conf/cards/CMI8738-MC8.conf +index ddff7530..96cb3f10 100644 +--- a/src/conf/cards/CMI8738-MC8.conf ++++ b/src/conf/cards/CMI8738-MC8.conf +@@ -4,7 +4,7 @@ + + + +-CMI8738-MC8.pcm.front.0 { ++CMI8738-MC8.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -21,7 +21,7 @@ CMI8738-MC8.pcm.front.0 { + } + + # default with dmix+softvol & dsnoop +-CMI8738-MC8.pcm.default { ++CMI8738-MC8.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +@@ -53,7 +53,7 @@ CMI8738-MC8.pcm.default { + + + # 2nd DAC +-CMI8738-MC8.pcm.rear.0 { ++CMI8738-MC8.pcm.rear.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -72,7 +72,7 @@ CMI8738-MC8.pcm.rear.0 { + + + +-CMI8738-MC8.pcm.surround40.0 { ++CMI8738-MC8.pcm.surround40.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -110,7 +110,7 @@ CMI8738-MC8.pcm.surround40.0 { + + + +-CMI8738-MC8.pcm.surround51.0 { ++CMI8738-MC8.pcm.surround51.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -144,7 +144,7 @@ CMI8738-MC8.pcm.surround51.0 { + + + +-CMI8738-MC8.pcm.surround71.0 { ++CMI8738-MC8.pcm.surround71.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -178,7 +178,7 @@ CMI8738-MC8.pcm.surround71.0 { + + + +-CMI8738-MC8.pcm.iec958.0 { ++CMI8738-MC8.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +diff --git a/src/conf/cards/CMI8788.conf b/src/conf/cards/CMI8788.conf +index edcb0c9c..c4ad9f48 100644 +--- a/src/conf/cards/CMI8788.conf ++++ b/src/conf/cards/CMI8788.conf +@@ -4,7 +4,7 @@ + + + +-CMI8788.pcm.front.0 { ++CMI8788.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -14,7 +14,7 @@ CMI8788.pcm.front.0 { + } + + # default with dmix & dsnoop +-CMI8788.pcm.default { ++CMI8788.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +@@ -38,7 +38,7 @@ CMI8788.pcm.default { + + + +-CMI8788.pcm.surround40.0 { ++CMI8788.pcm.surround40.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -53,7 +53,7 @@ CMI8788.pcm.surround40.0 { + + + +-CMI8788.pcm.surround51.0 { ++CMI8788.pcm.surround51.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -65,7 +65,7 @@ CMI8788.pcm.surround51.0 { + + + +-CMI8788.pcm.surround71.0 { ++CMI8788.pcm.surround71.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -77,7 +77,7 @@ CMI8788.pcm.surround71.0 { + + + +-CMI8788.pcm.iec958.0 { ++CMI8788.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +-- +2.51.1 + + +From 1e29ff18400e9b219159f9d0cb9aaf4be3b82efa Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 12:12:47 +0100 +Subject: [PATCH 15/43] conf: CS46xx: define pcm configuration block only one + time + +There may be multiple CS46xx soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/CS46xx.conf | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/src/conf/cards/CS46xx.conf b/src/conf/cards/CS46xx.conf +index b71c30aa..478cbf3e 100644 +--- a/src/conf/cards/CS46xx.conf ++++ b/src/conf/cards/CS46xx.conf +@@ -4,7 +4,7 @@ + + + +-CS46xx.pcm.front.0 { ++CS46xx.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -15,7 +15,7 @@ CS46xx.pcm.front.0 { + + # default with plughw + # CS46xx supports multi-playback +-CS46xx.pcm.default { ++CS46xx.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +@@ -39,7 +39,7 @@ CS46xx.pcm.default { + + + +-CS46xx.pcm.rear.0 { ++CS46xx.pcm.rear.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -66,7 +66,7 @@ CS46xx.pcm.rear.0 { + + + +-CS46xx.pcm.center_lfe.0 { ++CS46xx.pcm.center_lfe.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -78,7 +78,7 @@ CS46xx.pcm.center_lfe.0 { + + + +-CS46xx.pcm.surround40.0 { ++CS46xx.pcm.surround40.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -117,7 +117,7 @@ CS46xx.pcm.surround40.0 { + + + +-CS46xx.pcm.surround51.0 { ++CS46xx.pcm.surround51.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -164,7 +164,7 @@ CS46xx.pcm.surround51.0 { + + + +-CS46xx.pcm.iec958.0 { ++CS46xx.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +-- +2.51.1 + + +From 0ba7c2716567875d207b71b61e1205b855c7fd9c Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 12:12:47 +0100 +Subject: [PATCH 16/43] conf: Echo3G: define pcm configuration block only one + time + +There may be multiple Echo3G soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/Echo_Echo3G.conf | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +diff --git a/src/conf/cards/Echo_Echo3G.conf b/src/conf/cards/Echo_Echo3G.conf +index 766f13f7..fb2a7b67 100644 +--- a/src/conf/cards/Echo_Echo3G.conf ++++ b/src/conf/cards/Echo_Echo3G.conf +@@ -3,7 +3,7 @@ + # + + +-Echo_Echo3G.pcm.front.0 { ++Echo_Echo3G.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -15,7 +15,7 @@ Echo_Echo3G.pcm.front.0 { + } + + +-Echo_Echo3G.pcm.rear.0 { ++Echo_Echo3G.pcm.rear.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -27,7 +27,7 @@ Echo_Echo3G.pcm.rear.0 { + } + + +-Echo_Echo3G.pcm.center_lfe.0 { ++Echo_Echo3G.pcm.center_lfe.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -39,7 +39,7 @@ Echo_Echo3G.pcm.center_lfe.0 { + } + + +-Echo_Echo3G.pcm.side.0 { ++Echo_Echo3G.pcm.side.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -51,7 +51,7 @@ Echo_Echo3G.pcm.side.0 { + } + + +-Echo_Echo3G.pcm.surround40.0 { ++Echo_Echo3G.pcm.surround40.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -86,7 +86,7 @@ Echo_Echo3G.pcm.surround40.0 { + } + + +-Echo_Echo3G.pcm.surround41.0 { ++Echo_Echo3G.pcm.surround41.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -131,7 +131,7 @@ Echo_Echo3G.pcm.surround41.0 { + } + + +-Echo_Echo3G.pcm.surround50.0 { ++Echo_Echo3G.pcm.surround50.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -176,7 +176,7 @@ Echo_Echo3G.pcm.surround50.0 { + } + + +-Echo_Echo3G.pcm.surround51.0 { ++Echo_Echo3G.pcm.surround51.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -222,7 +222,7 @@ Echo_Echo3G.pcm.surround51.0 { + } + + +-Echo_Echo3G.pcm.surround71.0 { ++Echo_Echo3G.pcm.surround71.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -279,7 +279,7 @@ Echo_Echo3G.pcm.surround71.0 { + } + + +-Echo_Echo3G.pcm.iec958.0 { ++Echo_Echo3G.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +-- +2.51.1 + + +From 8c1005624495b61919080959088dc744d6d213ea Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 16:08:42 +0100 +Subject: [PATCH 17/43] conf: Aureon51: define pcm configuration block only one + time + +There may be multiple Aureon51 soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/Aureon51.conf | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/conf/cards/Aureon51.conf b/src/conf/cards/Aureon51.conf +index 9bf34661..db907f82 100644 +--- a/src/conf/cards/Aureon51.conf ++++ b/src/conf/cards/Aureon51.conf +@@ -76,7 +76,7 @@ Aureon51.pcm.side.!0 { + + + +-Aureon51.pcm.surround40.0 { ++Aureon51.pcm.surround40.!0 { + @args [ CARD ] + @args.CARD { + type string +-- +2.51.1 + + +From ed4884cbe179f42a10771584ebe9fff844b90d4f Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 16:08:42 +0100 +Subject: [PATCH 18/43] conf: EMU10K1: define pcm configuration block only one + time + +There may be multiple EMU10K1 soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/EMU10K1.conf | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/src/conf/cards/EMU10K1.conf b/src/conf/cards/EMU10K1.conf +index 430926c7..5ef12c03 100644 +--- a/src/conf/cards/EMU10K1.conf ++++ b/src/conf/cards/EMU10K1.conf +@@ -4,7 +4,7 @@ + + + +-EMU10K1.pcm.front.0 { ++EMU10K1.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -47,7 +47,7 @@ EMU10K1.pcm.front.0 { + + + +-EMU10K1.pcm.rear.0 { ++EMU10K1.pcm.rear.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -78,7 +78,7 @@ EMU10K1.pcm.rear.0 { + + + +-EMU10K1.pcm.center_lfe.0 { ++EMU10K1.pcm.center_lfe.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -143,7 +143,7 @@ EMU10K1.pcm.center_lfe.0 { + + + +-EMU10K1.pcm.surround40.0 { ++EMU10K1.pcm.surround40.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -182,7 +182,7 @@ EMU10K1.pcm.surround40.0 { + + + +-EMU10K1.pcm.surround51.0 { ++EMU10K1.pcm.surround51.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -229,7 +229,7 @@ EMU10K1.pcm.surround51.0 { + + + +-EMU10K1.pcm.iec958.0 { ++EMU10K1.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +-- +2.51.1 + + +From dba724706a6eec70e52e31595b3ff1ec055bf50c Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 16:17:45 +0100 +Subject: [PATCH 19/43] conf: EMU10K1X: define pcm configuration block only one + time + +There may be multiple EMU10K1X soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/EMU10K1X.conf | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/src/conf/cards/EMU10K1X.conf b/src/conf/cards/EMU10K1X.conf +index f7428636..334f897d 100644 +--- a/src/conf/cards/EMU10K1X.conf ++++ b/src/conf/cards/EMU10K1X.conf +@@ -3,7 +3,7 @@ + # + + # default with dmix & dsnoop +-EMU10K1X.pcm.default { ++EMU10K1X.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +@@ -27,7 +27,7 @@ EMU10K1X.pcm.default { + + + +-EMU10K1X.pcm.front.0 { ++EMU10K1X.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -38,7 +38,7 @@ EMU10K1X.pcm.front.0 { + + + +-EMU10K1X.pcm.rear.0 { ++EMU10K1X.pcm.rear.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -50,7 +50,7 @@ EMU10K1X.pcm.rear.0 { + + + +-EMU10K1X.pcm.center_lfe.0 { ++EMU10K1X.pcm.center_lfe.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -62,7 +62,7 @@ EMU10K1X.pcm.center_lfe.0 { + + + +-EMU10K1X.pcm.surround40.0 { ++EMU10K1X.pcm.surround40.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -101,7 +101,7 @@ EMU10K1X.pcm.surround40.0 { + + + +-EMU10K1X.pcm.surround51.0 { ++EMU10K1X.pcm.surround51.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -148,7 +148,7 @@ EMU10K1X.pcm.surround51.0 { + + + +-EMU10K1X.pcm.iec958.0 { ++EMU10K1X.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +-- +2.51.1 + + +From 7cf26f603823cccd3e89eb57f459642c890b79af Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 16:17:45 +0100 +Subject: [PATCH 20/43] conf: ENS137[01]: define pcm configuration block only + one time + +There may be multiple ENS137[01] soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/ENS1370.conf | 8 ++++---- + src/conf/cards/ENS1371.conf | 10 +++++----- + 2 files changed, 9 insertions(+), 9 deletions(-) + +diff --git a/src/conf/cards/ENS1370.conf b/src/conf/cards/ENS1370.conf +index 32e4782e..c65e224f 100644 +--- a/src/conf/cards/ENS1370.conf ++++ b/src/conf/cards/ENS1370.conf +@@ -4,7 +4,7 @@ + + + +-ENS1370.pcm.front.0 { ++ENS1370.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -15,7 +15,7 @@ ENS1370.pcm.front.0 { + } + + # default with dmix/dsnoop +-ENS1370.pcm.default { ++ENS1370.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +@@ -39,7 +39,7 @@ ENS1370.pcm.default { + + + +-ENS1370.pcm.rear.0 { ++ENS1370.pcm.rear.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -71,7 +71,7 @@ ENS1370.pcm.rear.0 { + + + +-ENS1370.pcm.surround40.0 { ++ENS1370.pcm.surround40.!0 { + @args [ CARD ] + @args.CARD { + type string +diff --git a/src/conf/cards/ENS1371.conf b/src/conf/cards/ENS1371.conf +index a6df4251..560fda9f 100644 +--- a/src/conf/cards/ENS1371.conf ++++ b/src/conf/cards/ENS1371.conf +@@ -4,7 +4,7 @@ + + + +-ENS1371.pcm.front.0 { ++ENS1371.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -14,7 +14,7 @@ ENS1371.pcm.front.0 { + } + + # default with dmix/dsnoop +-ENS1371.pcm.default { ++ENS1371.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +@@ -38,7 +38,7 @@ ENS1371.pcm.default { + + + +-ENS1371.pcm.rear.0 { ++ENS1371.pcm.rear.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -65,7 +65,7 @@ ENS1371.pcm.rear.0 { + + + +-ENS1371.pcm.surround40.0 { ++ENS1371.pcm.surround40.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -97,7 +97,7 @@ ENS1371.pcm.surround40.0 { + + + +-ENS1371.pcm.iec958.0 { ++ENS1371.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +-- +2.51.1 + + +From 001a2f3809865d071b53e802d4fbc89bb37a2fe1 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 16:17:45 +0100 +Subject: [PATCH 21/43] conf: ES1968: define pcm configuration block only one + time + +There may be multiple ES1968 soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/ES1968.conf | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/conf/cards/ES1968.conf b/src/conf/cards/ES1968.conf +index a6ee1192..296baa13 100644 +--- a/src/conf/cards/ES1968.conf ++++ b/src/conf/cards/ES1968.conf +@@ -2,7 +2,7 @@ + + + +-ES1968.pcm.front.0 { ++ES1968.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +-- +2.51.1 + + +From 2d5aa02738faf79895fa7457182810bee2ce7b90 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 16:17:46 +0100 +Subject: [PATCH 22/43] conf: FireWave: define pcm configuration block only one + time + +There may be multiple FireWave soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/FireWave.conf | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/conf/cards/FireWave.conf b/src/conf/cards/FireWave.conf +index fcfc83cc..786169f2 100644 +--- a/src/conf/cards/FireWave.conf ++++ b/src/conf/cards/FireWave.conf +@@ -2,7 +2,7 @@ + # Configuration for the Griffin FireWave Surround + # + +-FireWave.pcm.default { ++FireWave.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +@@ -16,7 +16,7 @@ FireWave.pcm.default { + + + +-FireWave.pcm.front.0 { ++FireWave.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -30,7 +30,7 @@ FireWave.pcm.front.0 { + + + +-FireWave.pcm.surround51.0 { ++FireWave.pcm.surround51.!0 { + @args [ CARD ] + @args.CARD { + type string +-- +2.51.1 + + +From 9f46e1a5a48f863e38794aa5b7c350d291078924 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 16:17:46 +0100 +Subject: [PATCH 23/43] conf: FM801: define pcm configuration block only one + time + +There may be multiple FM801 soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/FM801.conf | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/conf/cards/FM801.conf b/src/conf/cards/FM801.conf +index 0ddf799c..14cfdbe8 100644 +--- a/src/conf/cards/FM801.conf ++++ b/src/conf/cards/FM801.conf +@@ -4,7 +4,7 @@ + + + +-FM801.pcm.front.0 { ++FM801.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -14,7 +14,7 @@ FM801.pcm.front.0 { + } + + # default with dmix/dsnoop +-FM801.pcm.default { ++FM801.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +@@ -49,7 +49,7 @@ FM801.pcm.surround51.0 "cards.FM801.pcm.front.0" + + + +-FM801.pcm.iec958.0 { ++FM801.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +-- +2.51.1 + + +From ea939799299ff88c254344c7a89e86ffa159e5a7 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 16:17:46 +0100 +Subject: [PATCH 24/43] conf: FWSpeakers: define pcm configuration block only + one time + +There may be multiple FWSpeakers soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/FWSpeakers.conf | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/conf/cards/FWSpeakers.conf b/src/conf/cards/FWSpeakers.conf +index cd6fa605..96ab5cb9 100644 +--- a/src/conf/cards/FWSpeakers.conf ++++ b/src/conf/cards/FWSpeakers.conf +@@ -2,7 +2,7 @@ + # Configuration for the LaCie Firewire speakers + # + +-FWSpeakers.pcm.default { ++FWSpeakers.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +@@ -16,7 +16,7 @@ FWSpeakers.pcm.default { + + + +-FWSpeakers.pcm.front.0 { ++FWSpeakers.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +-- +2.51.1 + + +From a87570df7247d979eb5106ca549fa776e4c51ab3 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 16:17:47 +0100 +Subject: [PATCH 25/43] conf: GUS: define pcm configuration block only one time + +There may be multiple GUS soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/GUS.conf | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/conf/cards/GUS.conf b/src/conf/cards/GUS.conf +index d744c548..a1ccd0e9 100644 +--- a/src/conf/cards/GUS.conf ++++ b/src/conf/cards/GUS.conf +@@ -4,7 +4,7 @@ + + + +-GUS.pcm.front.0 { ++GUS.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +-- +2.51.1 + + +From dded72a687e8e8210b276ab13f4e26b63bfa782b Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 16:17:47 +0100 +Subject: [PATCH 26/43] conf: HdmiLpeAudio: define pcm configuration block only + one time + +There may be multiple HdmiLpeAudio soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/HdmiLpeAudio.conf | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/conf/cards/HdmiLpeAudio.conf b/src/conf/cards/HdmiLpeAudio.conf +index a9104f43..799946a2 100644 +--- a/src/conf/cards/HdmiLpeAudio.conf ++++ b/src/conf/cards/HdmiLpeAudio.conf +@@ -2,7 +2,7 @@ + # Configuration for the Intel HDMI/DP LPE audio + # + +-HdmiLpeAudio.pcm.hdmi.0 { ++HdmiLpeAudio.pcm.hdmi.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +@@ -39,7 +39,7 @@ HdmiLpeAudio.pcm.hdmi.0 { + } + } + +-HdmiLpeAudio.pcm.hdmi.1 { ++HdmiLpeAudio.pcm.hdmi.!1 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +@@ -77,7 +77,7 @@ HdmiLpeAudio.pcm.hdmi.1 { + } + } + +-HdmiLpeAudio.pcm.hdmi.2 { ++HdmiLpeAudio.pcm.hdmi.!2 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +-- +2.51.1 + + +From 1f52b57ff8f023b396b459407e60d8498c69f6e7 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 16:17:57 +0100 +Subject: [PATCH 27/43] conf: ICE17[12][24]: define pcm configuration block + only one time + +There may be multiple ICE17[12][24] soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/ICE1712.conf | 12 ++++++------ + src/conf/cards/ICE1724.conf | 18 +++++++++--------- + 2 files changed, 15 insertions(+), 15 deletions(-) + +diff --git a/src/conf/cards/ICE1712.conf b/src/conf/cards/ICE1712.conf +index db62684e..190d2c59 100644 +--- a/src/conf/cards/ICE1712.conf ++++ b/src/conf/cards/ICE1712.conf +@@ -3,7 +3,7 @@ + # + + # default with dmix & dsnoop +-ICE1712.pcm.default { ++ICE1712.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +@@ -27,7 +27,7 @@ ICE1712.pcm.default { + + + +-ICE1712.pcm.front.0 { ++ICE1712.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -57,7 +57,7 @@ ICE1712.pcm.front.0 { + + + +-ICE1712.pcm.surround40.0 { ++ICE1712.pcm.surround40.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -80,7 +80,7 @@ ICE1712.pcm.surround40.0 { + + + +-ICE1712.pcm.surround51.0 { ++ICE1712.pcm.surround51.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -99,7 +99,7 @@ ICE1712.pcm.surround51.0 { + slave.channels 10 + } + +-ICE1712.pcm.surround71.0 { ++ICE1712.pcm.surround71.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -122,7 +122,7 @@ ICE1712.pcm.surround71.0 { + + + +-ICE1712.pcm.iec958.0 { ++ICE1712.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +diff --git a/src/conf/cards/ICE1724.conf b/src/conf/cards/ICE1724.conf +index 61cac013..16045dc4 100644 +--- a/src/conf/cards/ICE1724.conf ++++ b/src/conf/cards/ICE1724.conf +@@ -3,7 +3,7 @@ + # + + # default with dmix & dsnoop +-ICE1724.pcm.default { ++ICE1724.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +@@ -27,7 +27,7 @@ ICE1724.pcm.default { + + + +-ICE1724.pcm.front.0 { ++ICE1724.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -38,7 +38,7 @@ ICE1724.pcm.front.0 { + + + +-ICE1724.pcm.rear.0 { ++ICE1724.pcm.rear.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -51,7 +51,7 @@ ICE1724.pcm.rear.0 { + + + +-ICE1724.pcm.center_lfe.0 { ++ICE1724.pcm.center_lfe.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -63,7 +63,7 @@ ICE1724.pcm.center_lfe.0 { + + + +-ICE1724.pcm.side.0 { ++ICE1724.pcm.side.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -76,7 +76,7 @@ ICE1724.pcm.side.0 { + + + +-ICE1724.pcm.surround40.0 { ++ICE1724.pcm.surround40.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -100,7 +100,7 @@ ICE1724.pcm.surround40.0 { + + + +-ICE1724.pcm.surround51.0 { ++ICE1724.pcm.surround51.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -123,7 +123,7 @@ ICE1724.pcm.surround51.0 { + + + +-ICE1724.pcm.surround71.0 { ++ICE1724.pcm.surround71.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -148,7 +148,7 @@ ICE1724.pcm.surround71.0 { + + + +-ICE1724.pcm.iec958.0 { ++ICE1724.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +-- +2.51.1 + + +From 99f1987a1e864523a7a423f1840ca6a76045d619 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 16:17:57 +0100 +Subject: [PATCH 28/43] conf: ICH,ICH4,ICH-MODEM: define pcm configuration + block only one time + +There may be multiple ICH soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/ICH-MODEM.conf | 2 +- + src/conf/cards/ICH.conf | 10 +++++----- + src/conf/cards/ICH4.conf | 10 +++++----- + 3 files changed, 11 insertions(+), 11 deletions(-) + +diff --git a/src/conf/cards/ICH-MODEM.conf b/src/conf/cards/ICH-MODEM.conf +index b96b5aaf..855f3a96 100644 +--- a/src/conf/cards/ICH-MODEM.conf ++++ b/src/conf/cards/ICH-MODEM.conf +@@ -4,7 +4,7 @@ + + + +-ICH-MODEM.pcm.modem.0 { ++ICH-MODEM.pcm.modem.!0 { + @args [ CARD ] + @args.CARD { + type string +diff --git a/src/conf/cards/ICH.conf b/src/conf/cards/ICH.conf +index 6fc9a5a2..c35c8d02 100644 +--- a/src/conf/cards/ICH.conf ++++ b/src/conf/cards/ICH.conf +@@ -4,7 +4,7 @@ + + + +-ICH.pcm.front.0 { ++ICH.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -21,7 +21,7 @@ ICH.pcm.front.0 { + } + + # default with dmix+softvol & dsnoop +-ICH.pcm.default { ++ICH.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +@@ -52,7 +52,7 @@ ICH.pcm.default { + + + +-ICH.pcm.surround40.0 { ++ICH.pcm.surround40.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -103,7 +103,7 @@ ICH.pcm.surround40.0 { + + + +-ICH.pcm.surround51.0 { ++ICH.pcm.surround51.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -174,7 +174,7 @@ ICH.pcm.surround51.0 { + + + +-ICH.pcm.iec958.0 { ++ICH.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +diff --git a/src/conf/cards/ICH4.conf b/src/conf/cards/ICH4.conf +index 64ec883d..11c85a6e 100644 +--- a/src/conf/cards/ICH4.conf ++++ b/src/conf/cards/ICH4.conf +@@ -4,7 +4,7 @@ + + + +-ICH4.pcm.front.0 { ++ICH4.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -21,7 +21,7 @@ ICH4.pcm.front.0 { + } + + # default with dmix+softvol & dsnoop +-ICH4.pcm.default { ++ICH4.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +@@ -52,7 +52,7 @@ ICH4.pcm.default { + + + +-ICH4.pcm.surround40.0 { ++ICH4.pcm.surround40.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -103,7 +103,7 @@ ICH4.pcm.surround40.0 { + + + +-ICH4.pcm.surround51.0 { ++ICH4.pcm.surround51.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -164,7 +164,7 @@ ICH4.pcm.surround51.0 { + + + +-ICH4.pcm.iec958.0 { ++ICH4.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +-- +2.51.1 + + +From ff4fb7f8c98157010c44f7335a32a09e9fc085d6 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 16:17:57 +0100 +Subject: [PATCH 29/43] conf: Loopback: define pcm configuration block only one + time + +There may be multiple Loopback soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/Loopback.conf | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/conf/cards/Loopback.conf b/src/conf/cards/Loopback.conf +index 1ae6d453..21c8429c 100644 +--- a/src/conf/cards/Loopback.conf ++++ b/src/conf/cards/Loopback.conf +@@ -4,7 +4,7 @@ + + + +-Loopback.pcm.front.0 { ++Loopback.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -21,7 +21,7 @@ Loopback.pcm.front.0 { + } + + # default with dmix+softvol & dsnoop +-Loopback.pcm.default { ++Loopback.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +-- +2.51.1 + + +From de72d657281c043c8d48d23cb8da9b1c4c5f31de Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 16:17:57 +0100 +Subject: [PATCH 30/43] conf: Maestro3: define pcm configuration block only one + time + +There may be multiple Maestro3 soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/Maestro3.conf | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/conf/cards/Maestro3.conf b/src/conf/cards/Maestro3.conf +index 94323227..a8d89a48 100644 +--- a/src/conf/cards/Maestro3.conf ++++ b/src/conf/cards/Maestro3.conf +@@ -2,7 +2,7 @@ + + + +-Maestro3.pcm.front.0 { ++Maestro3.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -12,7 +12,7 @@ Maestro3.pcm.front.0 { + } + + # default with dmix/dsnoop +-Maestro3.pcm.default { ++Maestro3.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +-- +2.51.1 + + +From ebb5ab7d846e2702640a7d754127083412b15816 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 16:18:06 +0100 +Subject: [PATCH 31/43] conf: NFORCE: define pcm configuration block only one + time + +There may be multiple NFORCE soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/NFORCE.conf | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/src/conf/cards/NFORCE.conf b/src/conf/cards/NFORCE.conf +index 64d15479..088cd8ce 100644 +--- a/src/conf/cards/NFORCE.conf ++++ b/src/conf/cards/NFORCE.conf +@@ -4,7 +4,7 @@ + + + +-NFORCE.pcm.front.0 { ++NFORCE.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -21,7 +21,7 @@ NFORCE.pcm.front.0 { + } + + # default with dmix+softvol & dsnoop +-NFORCE.pcm.default { ++NFORCE.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +@@ -52,7 +52,7 @@ NFORCE.pcm.default { + + + +-NFORCE.pcm.surround40.0 { ++NFORCE.pcm.surround40.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -103,7 +103,7 @@ NFORCE.pcm.surround40.0 { + + + +-NFORCE.pcm.surround51.0 { ++NFORCE.pcm.surround51.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -174,7 +174,7 @@ NFORCE.pcm.surround51.0 { + + + +-NFORCE.pcm.surround71.0 { ++NFORCE.pcm.surround71.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -247,7 +247,7 @@ NFORCE.pcm.surround71.0 { + + + +-NFORCE.pcm.iec958.0 { ++NFORCE.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +-- +2.51.1 + + +From 3d636ff5309e3672c0acc784c9539af4396d2dfb Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 16:18:06 +0100 +Subject: [PATCH 32/43] conf: PC-Speaker: define pcm configuration block only + one time + +There may be multiple PC-Speaker soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/PC-Speaker.conf | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/conf/cards/PC-Speaker.conf b/src/conf/cards/PC-Speaker.conf +index c82654d8..8a40a139 100644 +--- a/src/conf/cards/PC-Speaker.conf ++++ b/src/conf/cards/PC-Speaker.conf +@@ -4,7 +4,7 @@ + + + +-PC-Speaker.pcm.front.0 { ++PC-Speaker.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -23,7 +23,7 @@ PC-Speaker.pcm.front.0 { + } + + # default with dmix & null +-PC-Speaker.pcm.default { ++PC-Speaker.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +-- +2.51.1 + + +From a3028a492a641d5077640294d1fb655c4b4aa84a Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 16:18:06 +0100 +Subject: [PATCH 33/43] conf: PMac,PMacToonie: define pcm configuration block + only one time + +There may be multiple PMac soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/PMac.conf | 4 ++-- + src/conf/cards/PMacToonie.conf | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/conf/cards/PMac.conf b/src/conf/cards/PMac.conf +index d1fdb17b..00f3bc89 100644 +--- a/src/conf/cards/PMac.conf ++++ b/src/conf/cards/PMac.conf +@@ -4,7 +4,7 @@ + + + +-PMac.pcm.front.0 { ++PMac.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -14,7 +14,7 @@ PMac.pcm.front.0 { + } + + # default with dmix/dsnoop +-PMac.pcm.default { ++PMac.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +diff --git a/src/conf/cards/PMacToonie.conf b/src/conf/cards/PMacToonie.conf +index 1e0eb59c..aff1ea65 100644 +--- a/src/conf/cards/PMacToonie.conf ++++ b/src/conf/cards/PMacToonie.conf +@@ -4,7 +4,7 @@ + + + +-PMacToonie.pcm.front.0 { ++PMacToonie.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -21,7 +21,7 @@ PMacToonie.pcm.front.0 { + } + + # default with dmix+softvol & dsnoop +-PMacToonie.pcm.default { ++PMacToonie.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +-- +2.51.1 + + +From 8340b3c6b31a4e4c02f69bf36f3958d390c724b9 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 16:18:06 +0100 +Subject: [PATCH 34/43] conf: PS3: define pcm configuration block only one time + +There may be multiple PS3 soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/PS3.conf | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/conf/cards/PS3.conf b/src/conf/cards/PS3.conf +index b642f0dc..486d790c 100644 +--- a/src/conf/cards/PS3.conf ++++ b/src/conf/cards/PS3.conf +@@ -4,7 +4,7 @@ + + + +-PS3.pcm.front.0 { ++PS3.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -22,7 +22,7 @@ PS3.pcm.front.0 { + } + + # default with dmix+softvol +-PS3.pcm.default { ++PS3.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +@@ -47,7 +47,7 @@ PS3.pcm.default { + + + +-PS3.pcm.iec958.0 { ++PS3.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +-- +2.51.1 + + +From f03528daf2ee177d2003b4d40824506f3a3558f4 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 16:18:15 +0100 +Subject: [PATCH 35/43] conf: RME96[35][26]: define pcm configuration block + only one time + +There may be multiple RME96[35][26] soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/RME9636.conf | 4 ++-- + src/conf/cards/RME9652.conf | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/conf/cards/RME9636.conf b/src/conf/cards/RME9636.conf +index e8dc5fad..17b3a1ab 100644 +--- a/src/conf/cards/RME9636.conf ++++ b/src/conf/cards/RME9636.conf +@@ -4,7 +4,7 @@ + + + +-RME9636.pcm.front.0 { ++RME9636.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -17,7 +17,7 @@ RME9636.pcm.front.0 { + + + +-RME9636.pcm.iec958.0 { ++RME9636.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +diff --git a/src/conf/cards/RME9652.conf b/src/conf/cards/RME9652.conf +index 1147d810..a11e42b2 100644 +--- a/src/conf/cards/RME9652.conf ++++ b/src/conf/cards/RME9652.conf +@@ -4,7 +4,7 @@ + + + +-RME9652.pcm.front.0 { ++RME9652.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -17,7 +17,7 @@ RME9652.pcm.front.0 { + + + +-RME9652.pcm.iec958.0 { ++RME9652.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +-- +2.51.1 + + +From 1cd87775c5d9d46e418dc67a4d9c93fe5104ee3f Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 16:18:15 +0100 +Subject: [PATCH 36/43] conf: SB-XFi: define pcm configuration block only one + time + +There may be multiple SB-XFi soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/SB-XFi.conf | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/src/conf/cards/SB-XFi.conf b/src/conf/cards/SB-XFi.conf +index eb2218bf..9ce9c8ac 100644 +--- a/src/conf/cards/SB-XFi.conf ++++ b/src/conf/cards/SB-XFi.conf +@@ -4,7 +4,7 @@ + + + +-SB-XFi.pcm.front.0 { ++SB-XFi.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -16,7 +16,7 @@ SB-XFi.pcm.front.0 { + + + +-SB-XFi.pcm.rear.0 { ++SB-XFi.pcm.rear.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -29,7 +29,7 @@ SB-XFi.pcm.rear.0 { + + + +-SB-XFi.pcm.center_lfe.0 { ++SB-XFi.pcm.center_lfe.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -42,7 +42,7 @@ SB-XFi.pcm.center_lfe.0 { + + + +-SB-XFi.pcm.side.0 { ++SB-XFi.pcm.side.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -66,7 +66,7 @@ SB-XFi.pcm.surround71.0 cards.SB-XFi.pcm.front.0 + + + +-SB-XFi.pcm.iec958.0 { ++SB-XFi.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +-- +2.51.1 + + +From 51d75e5f072698d6ec03957cf87b735117f05ab4 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 16:18:15 +0100 +Subject: [PATCH 37/43] conf: SI7018: define pcm configuration block only one + time + +There may be multiple SI7018 soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/SI7018.conf | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/src/conf/cards/SI7018.conf b/src/conf/cards/SI7018.conf +index 02b8fc87..33d19085 100644 +--- a/src/conf/cards/SI7018.conf ++++ b/src/conf/cards/SI7018.conf +@@ -6,7 +6,7 @@ + + + +-SI7018.pcm.front.0 { ++SI7018.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -18,7 +18,7 @@ SI7018.pcm.front.0 { + + + +-SI7018.pcm.rear.0 { ++SI7018.pcm.rear.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -44,7 +44,7 @@ SI7018.pcm.rear.0 { + + + +-SI7018.pcm.surround40.0 { ++SI7018.pcm.surround40.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -83,7 +83,7 @@ SI7018.pcm.surround40.0 { + + + +-SI7018.pcm.surround51.0 { ++SI7018.pcm.surround51.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -130,7 +130,7 @@ SI7018.pcm.surround51.0 { + + + +-SI7018.pcm.iec958.0 { ++SI7018.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +-- +2.51.1 + + +From 4c74f3a568583744dddab01e4cce5a2e8f207067 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 16:18:15 +0100 +Subject: [PATCH 38/43] conf: TRID4DWAVENX: define pcm configuration block only + one time + +There may be multiple TRID4DWAVENX soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/TRID4DWAVENX.conf | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/conf/cards/TRID4DWAVENX.conf b/src/conf/cards/TRID4DWAVENX.conf +index 717b1408..5001297e 100644 +--- a/src/conf/cards/TRID4DWAVENX.conf ++++ b/src/conf/cards/TRID4DWAVENX.conf +@@ -4,7 +4,7 @@ + + + +-TRID4DWAVENX.pcm.front.0 { ++TRID4DWAVENX.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -16,7 +16,7 @@ TRID4DWAVENX.pcm.front.0 { + + + +-TRID4DWAVENX.pcm.rear.0 { ++TRID4DWAVENX.pcm.rear.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -56,7 +56,7 @@ TRID4DWAVENX.pcm.rear.0 { + + + +-TRID4DWAVENX.pcm.surround40.0 { ++TRID4DWAVENX.pcm.surround40.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -92,7 +92,7 @@ TRID4DWAVENX.pcm.surround40.0 { + + + +-TRID4DWAVENX.pcm.iec958.0 { ++TRID4DWAVENX.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +-- +2.51.1 + + +From d6b9d7e0bef5ca8a019881b06de7183528ec5bd5 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 16:18:22 +0100 +Subject: [PATCH 39/43] conf: VIA686A,VIA82xx: define pcm configuration block + only one time + +There may be multiple VIA soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/VIA686A.conf | 6 +++--- + src/conf/cards/VIA8233.conf | 10 +++++----- + src/conf/cards/VIA8233A.conf | 10 +++++----- + src/conf/cards/VIA8237.conf | 10 +++++----- + 4 files changed, 18 insertions(+), 18 deletions(-) + +diff --git a/src/conf/cards/VIA686A.conf b/src/conf/cards/VIA686A.conf +index e4a06f23..c53dd71b 100644 +--- a/src/conf/cards/VIA686A.conf ++++ b/src/conf/cards/VIA686A.conf +@@ -7,7 +7,7 @@ + + + +-VIA686A.pcm.front.0 { ++VIA686A.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -17,7 +17,7 @@ VIA686A.pcm.front.0 { + } + + # default with dmix/dsnoop +-VIA686A.pcm.default { ++VIA686A.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +@@ -41,7 +41,7 @@ VIA686A.pcm.default { + + + +-VIA686A.pcm.iec958.0 { ++VIA686A.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +diff --git a/src/conf/cards/VIA8233.conf b/src/conf/cards/VIA8233.conf +index 9ad321f7..3c25a11b 100644 +--- a/src/conf/cards/VIA8233.conf ++++ b/src/conf/cards/VIA8233.conf +@@ -4,7 +4,7 @@ + + + +-VIA8233.pcm.front.0 { ++VIA8233.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -15,7 +15,7 @@ VIA8233.pcm.front.0 { + + # default with softvol/dsnoop + # VIA8233 supports multi-playback +-VIA8233.pcm.default { ++VIA8233.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +@@ -46,7 +46,7 @@ VIA8233.pcm.default { + + + +-VIA8233.pcm.surround40.0 { ++VIA8233.pcm.surround40.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -91,7 +91,7 @@ VIA8233.pcm.surround40.0 { + + + +-VIA8233.pcm.surround51.0 { ++VIA8233.pcm.surround51.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -146,7 +146,7 @@ VIA8233.pcm.surround51.0 { + + + +-VIA8233.pcm.iec958.0 { ++VIA8233.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +diff --git a/src/conf/cards/VIA8233A.conf b/src/conf/cards/VIA8233A.conf +index 679fccf3..c9e56e20 100644 +--- a/src/conf/cards/VIA8233A.conf ++++ b/src/conf/cards/VIA8233A.conf +@@ -4,7 +4,7 @@ + + + +-VIA8233A.pcm.front.0 { ++VIA8233A.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -14,7 +14,7 @@ VIA8233A.pcm.front.0 { + } + + # default with dmix/dsnoop +-VIA8233A.pcm.default { ++VIA8233A.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +@@ -38,7 +38,7 @@ VIA8233A.pcm.default { + + + +-VIA8233A.pcm.surround40.0 { ++VIA8233A.pcm.surround40.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -89,7 +89,7 @@ VIA8233A.pcm.surround40.0 { + + + +-VIA8233A.pcm.surround51.0 { ++VIA8233A.pcm.surround51.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -150,7 +150,7 @@ VIA8233A.pcm.surround51.0 { + + + +-VIA8233A.pcm.iec958.0 { ++VIA8233A.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +diff --git a/src/conf/cards/VIA8237.conf b/src/conf/cards/VIA8237.conf +index 29d8e00f..49fd6f2c 100644 +--- a/src/conf/cards/VIA8237.conf ++++ b/src/conf/cards/VIA8237.conf +@@ -4,7 +4,7 @@ + + + +-VIA8237.pcm.front.0 { ++VIA8237.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -15,7 +15,7 @@ VIA8237.pcm.front.0 { + + # default with softvol/dsnoop + # VIA8237 supports multi-playback +-VIA8237.pcm.default { ++VIA8237.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +@@ -46,7 +46,7 @@ VIA8237.pcm.default { + + + +-VIA8237.pcm.surround40.0 { ++VIA8237.pcm.surround40.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -84,7 +84,7 @@ VIA8237.pcm.surround40.0 { + + + +-VIA8237.pcm.surround51.0 { ++VIA8237.pcm.surround51.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -136,7 +136,7 @@ VIA8237.pcm.surround51.0 { + + + +-VIA8237.pcm.iec958.0 { ++VIA8237.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +-- +2.51.1 + + +From 4bcd33ef9dc6d8439cc6573575907ecf89271fe2 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 16:18:22 +0100 +Subject: [PATCH 40/43] conf: VX222,VXPocket: define pcm configuration block + only one time + +There may be multiple VX soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/VX222.conf | 4 ++-- + src/conf/cards/VXPocket.conf | 4 ++-- + src/conf/cards/VXPocket440.conf | 8 ++++---- + 3 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/src/conf/cards/VX222.conf b/src/conf/cards/VX222.conf +index 3385f25b..2c6e2297 100644 +--- a/src/conf/cards/VX222.conf ++++ b/src/conf/cards/VX222.conf +@@ -4,7 +4,7 @@ + + + +-VX222.pcm.front.0 { ++VX222.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -15,7 +15,7 @@ VX222.pcm.front.0 { + + + +-VX222.pcm.iec958.0 { ++VX222.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +diff --git a/src/conf/cards/VXPocket.conf b/src/conf/cards/VXPocket.conf +index fe44ff53..90b13347 100644 +--- a/src/conf/cards/VXPocket.conf ++++ b/src/conf/cards/VXPocket.conf +@@ -4,7 +4,7 @@ + + + +-VXPocket.pcm.front.0 { ++VXPocket.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -15,7 +15,7 @@ VXPocket.pcm.front.0 { + + + +-VXPocket.pcm.iec958.0 { ++VXPocket.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +diff --git a/src/conf/cards/VXPocket440.conf b/src/conf/cards/VXPocket440.conf +index 197c2d6c..87a0855a 100644 +--- a/src/conf/cards/VXPocket440.conf ++++ b/src/conf/cards/VXPocket440.conf +@@ -4,7 +4,7 @@ + + + +-VXPocket440.pcm.front.0 { ++VXPocket440.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -15,7 +15,7 @@ VXPocket440.pcm.front.0 { + + + +-VXPocket440.pcm.rear.0 { ++VXPocket440.pcm.rear.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -27,7 +27,7 @@ VXPocket440.pcm.rear.0 { + + + +-VXPocket440.pcm.surround40.0 { ++VXPocket440.pcm.surround40.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -64,7 +64,7 @@ VXPocket440.pcm.surround40.0 { + + + +-VXPocket440.pcm.iec958.0 { ++VXPocket440.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +-- +2.51.1 + + +From 29fa26b4b5e0d3b7ab539b38d6604d83430bf70b Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 16:18:22 +0100 +Subject: [PATCH 41/43] conf: YMF744: define pcm configuration block only one + time + +There may be multiple YMF744 soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/YMF744.conf | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/conf/cards/YMF744.conf b/src/conf/cards/YMF744.conf +index 84dbcbec..ad1f2132 100644 +--- a/src/conf/cards/YMF744.conf ++++ b/src/conf/cards/YMF744.conf +@@ -4,7 +4,7 @@ + + + +-YMF744.pcm.front.0 { ++YMF744.pcm.front.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -15,7 +15,7 @@ YMF744.pcm.front.0 { + + + +-YMF744.pcm.rear.0 { ++YMF744.pcm.rear.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -27,7 +27,7 @@ YMF744.pcm.rear.0 { + + + +-YMF744.pcm.surround40.0 { ++YMF744.pcm.surround40.!0 { + @args [ CARD ] + @args.CARD { + type string +@@ -63,7 +63,7 @@ YMF744.pcm.surround40.0 { + + + +-YMF744.pcm.iec958.0 { ++YMF744.pcm.iec958.!0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string +-- +2.51.1 + + +From 17ffe17f0356f333f8bf8734a02ab419bd19cd99 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 16:25:34 +0100 +Subject: [PATCH 42/43] conf: pistachio-card: define pcm configuration block + only one time + +There may be multiple pistachio-card soundcards in the system. Overwrite +the PCM configurations when loaded multiple times. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/pistachio-card.conf | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/conf/cards/pistachio-card.conf b/src/conf/cards/pistachio-card.conf +index f68865eb..15cfd60b 100644 +--- a/src/conf/cards/pistachio-card.conf ++++ b/src/conf/cards/pistachio-card.conf +@@ -29,7 +29,7 @@ https://docs.creatordev.io/ci40/guides/hardwaredocs/MIPS_Creator_cXT200_Technica + # Subdevice #0: subdevice #0 + # + +-pistachio-card.pcm.default{ ++pistachio-card.pcm.!default { + @args [ CARD ] + @args.CARD { + type string +-- +2.51.1 + + +From f30c355278cf9c86420b49ab9efc7eee890b658c Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 10 Dec 2025 16:44:12 +0100 +Subject: [PATCH 43/43] conf: cards: unify whitespace - use tabs and remove + trailing spaces + +Convert leading spaces to tabs for consistent indentation, +remove trailing whitespace from all lines, and normalize +file endings across all card configuration files. + +Signed-off-by: Jaroslav Kysela +--- + src/conf/cards/AACI.conf | 2 +- + src/conf/cards/ATIIXP-SPDMA.conf | 2 +- + src/conf/cards/ATIIXP.conf | 2 +- + src/conf/cards/AU8810.conf | 2 +- + src/conf/cards/AU8820.conf | 2 +- + src/conf/cards/AU8830.conf | 2 +- + src/conf/cards/Audigy.conf | 6 +- + src/conf/cards/Audigy2.conf | 4 +- + src/conf/cards/Aureon51.conf | 8 +- + src/conf/cards/Aureon71.conf | 8 +- + src/conf/cards/CA0106.conf | 8 +- + src/conf/cards/CMI8338-SWIEC.conf | 2 +- + src/conf/cards/CMI8338.conf | 2 +- + src/conf/cards/CMI8738-MC6.conf | 6 +- + src/conf/cards/CMI8738-MC8.conf | 8 +- + src/conf/cards/CMI8788.conf | 8 +- + src/conf/cards/CS46xx.conf | 6 +- + src/conf/cards/EMU10K1.conf | 6 +- + src/conf/cards/EMU10K1X.conf | 6 +- + src/conf/cards/ENS1370.conf | 4 +- + src/conf/cards/ENS1371.conf | 10 +-- + src/conf/cards/ES1968.conf | 2 +- + src/conf/cards/FM801.conf | 2 +- + src/conf/cards/GUS.conf | 2 +- + src/conf/cards/HDA-Intel.conf | 2 +- + src/conf/cards/ICE1712.conf | 4 +- + src/conf/cards/ICE1724.conf | 10 +-- + src/conf/cards/ICH.conf | 2 +- + src/conf/cards/ICH4.conf | 2 +- + src/conf/cards/Loopback.conf | 2 +- + src/conf/cards/Maestro3.conf | 3 +- + src/conf/cards/NFORCE.conf | 138 ++++++++++++++--------------- + src/conf/cards/PC-Speaker.conf | 3 +- + src/conf/cards/PMac.conf | 2 +- + src/conf/cards/PMacToonie.conf | 2 +- + src/conf/cards/PS3.conf | 6 +- + src/conf/cards/RME9636.conf | 2 +- + src/conf/cards/RME9652.conf | 2 +- + src/conf/cards/SB-XFi.conf | 8 +- + src/conf/cards/SI7018.conf | 6 +- + src/conf/cards/TRID4DWAVENX.conf | 4 +- + src/conf/cards/USB-Audio.conf | 2 +- + src/conf/cards/VIA686A.conf | 2 +- + src/conf/cards/VIA8233.conf | 2 +- + src/conf/cards/VIA8233A.conf | 2 +- + src/conf/cards/VIA8237.conf | 2 +- + src/conf/cards/VX222.conf | 2 +- + src/conf/cards/VXPocket.conf | 2 +- + src/conf/cards/VXPocket440.conf | 2 +- + src/conf/cards/YMF744.conf | 4 +- + src/conf/cards/pistachio-card.conf | 54 +++++------ + 51 files changed, 190 insertions(+), 192 deletions(-) + +diff --git a/src/conf/cards/AACI.conf b/src/conf/cards/AACI.conf +index ff4778b4..2f036dd6 100644 +--- a/src/conf/cards/AACI.conf ++++ b/src/conf/cards/AACI.conf +@@ -11,7 +11,7 @@ AACI.pcm.front.!0 { + } + type hw + card $CARD +-} ++} + + + +diff --git a/src/conf/cards/ATIIXP-SPDMA.conf b/src/conf/cards/ATIIXP-SPDMA.conf +index 12c40efc..6d7344e8 100644 +--- a/src/conf/cards/ATIIXP-SPDMA.conf ++++ b/src/conf/cards/ATIIXP-SPDMA.conf +@@ -11,7 +11,7 @@ ATIIXP-SPDMA.pcm.front.!0 { + } + type hw + card $CARD +-} ++} + + # default with dmix/dsnoop + ATIIXP.pcm.!default { +diff --git a/src/conf/cards/ATIIXP.conf b/src/conf/cards/ATIIXP.conf +index 13e01c48..d2736c3c 100644 +--- a/src/conf/cards/ATIIXP.conf ++++ b/src/conf/cards/ATIIXP.conf +@@ -11,7 +11,7 @@ ATIIXP.pcm.front.!0 { + } + type hw + card $CARD +-} ++} + + # default with dmix/dsnoop + ATIIXP.pcm.!default { +diff --git a/src/conf/cards/AU8810.conf b/src/conf/cards/AU8810.conf +index 6b596b68..46de6dbc 100644 +--- a/src/conf/cards/AU8810.conf ++++ b/src/conf/cards/AU8810.conf +@@ -11,7 +11,7 @@ AU8810.pcm.front.!0 { + } + type hw + card $CARD +-} ++} + + + +diff --git a/src/conf/cards/AU8820.conf b/src/conf/cards/AU8820.conf +index fe2cbc11..8e262a6f 100644 +--- a/src/conf/cards/AU8820.conf ++++ b/src/conf/cards/AU8820.conf +@@ -11,4 +11,4 @@ AU8820.pcm.front.!0 { + } + type hw + card $CARD +-} ++} +diff --git a/src/conf/cards/AU8830.conf b/src/conf/cards/AU8830.conf +index 9cd78b3e..a31d8a57 100644 +--- a/src/conf/cards/AU8830.conf ++++ b/src/conf/cards/AU8830.conf +@@ -11,7 +11,7 @@ AU8830.pcm.front.!0 { + } + type hw + card $CARD +-} ++} + + + +diff --git a/src/conf/cards/Audigy.conf b/src/conf/cards/Audigy.conf +index a353c624..d2b54d3b 100644 +--- a/src/conf/cards/Audigy.conf ++++ b/src/conf/cards/Audigy.conf +@@ -36,7 +36,7 @@ Audigy.pcm.front.!0 { + } + ] + } +-} ++} + + + +@@ -64,7 +64,7 @@ Audigy.pcm.rear.!0 { + } + ] + } +-} ++} + + + +@@ -100,7 +100,7 @@ Audigy.pcm.center_lfe.!0 { + } + ] + } +-} ++} + + + +diff --git a/src/conf/cards/Audigy2.conf b/src/conf/cards/Audigy2.conf +index 3c15fd1d..47d75680 100644 +--- a/src/conf/cards/Audigy2.conf ++++ b/src/conf/cards/Audigy2.conf +@@ -37,7 +37,7 @@ Audigy2.pcm.front.!0 { + + ] + } +-} ++} + + + +@@ -65,7 +65,7 @@ Audigy2.pcm.rear.!0 { + } + ] + } +-} ++} + + + +diff --git a/src/conf/cards/Aureon51.conf b/src/conf/cards/Aureon51.conf +index db907f82..da7e26dc 100644 +--- a/src/conf/cards/Aureon51.conf ++++ b/src/conf/cards/Aureon51.conf +@@ -34,7 +34,7 @@ Aureon51.pcm.front.!0 { + } + type hw + card $CARD +-} ++} + + + +@@ -47,7 +47,7 @@ Aureon51.pcm.rear.!0 { + card $CARD + device 2 + subdevice 1 +-} ++} + + + +@@ -59,7 +59,7 @@ Aureon51.pcm.center_lfe.!0 { + type hw + card $CARD + device 2 +-} ++} + + + +@@ -84,7 +84,7 @@ Aureon51.pcm.surround40.!0 { + type hw + card $CARD + channels 4 +-} ++} + + + +diff --git a/src/conf/cards/Aureon71.conf b/src/conf/cards/Aureon71.conf +index f29bc297..98e65ab0 100644 +--- a/src/conf/cards/Aureon71.conf ++++ b/src/conf/cards/Aureon71.conf +@@ -34,7 +34,7 @@ Aureon71.pcm.front.!0 { + } + type hw + card $CARD +-} ++} + + + +@@ -46,7 +46,7 @@ Aureon71.pcm.rear.!0 { + type hw + card $CARD + device 2 +-} ++} + + + +@@ -59,7 +59,7 @@ Aureon71.pcm.center_lfe.!0 { + card $CARD + device 2 + subdevice 1 +-} ++} + + + +@@ -84,7 +84,7 @@ Aureon71.pcm.surround40.!0 { + type hw + card $CARD + channels 4 +-} ++} + + + +diff --git a/src/conf/cards/CA0106.conf b/src/conf/cards/CA0106.conf +index 1fea79f5..bf90c3c6 100644 +--- a/src/conf/cards/CA0106.conf ++++ b/src/conf/cards/CA0106.conf +@@ -34,7 +34,7 @@ CA0106.pcm.front.!0 { + } + type hw + card $CARD +-} ++} + + + +@@ -46,7 +46,7 @@ CA0106.pcm.rear.!0 { + type hw + card $CARD + device 1 +-} ++} + + + +@@ -58,7 +58,7 @@ CA0106.pcm.center_lfe.!0 { + type hw + card $CARD + device 2 +-} ++} + + + +@@ -70,7 +70,7 @@ CA0106.pcm.side.!0 { + type hw + card $CARD + device 3 +-} ++} + + + +diff --git a/src/conf/cards/CMI8338-SWIEC.conf b/src/conf/cards/CMI8338-SWIEC.conf +index ca86c466..2a9b777c 100644 +--- a/src/conf/cards/CMI8338-SWIEC.conf ++++ b/src/conf/cards/CMI8338-SWIEC.conf +@@ -12,7 +12,7 @@ CMI8338-SWIEC.pcm.front.!0 { + } + type hw + card $CARD +-} ++} + + # default with dmix/dsnoop + CMI8338-SWIEC.pcm.!default { +diff --git a/src/conf/cards/CMI8338.conf b/src/conf/cards/CMI8338.conf +index 0f92ad0b..8bd1159d 100644 +--- a/src/conf/cards/CMI8338.conf ++++ b/src/conf/cards/CMI8338.conf +@@ -11,7 +11,7 @@ CMI8338.pcm.front.!0 { + } + type hw + card $CARD +-} ++} + + # default with dmix/dsnoop + CMI8338.pcm.!default { +diff --git a/src/conf/cards/CMI8738-MC6.conf b/src/conf/cards/CMI8738-MC6.conf +index 2b1c7d05..6bb17712 100644 +--- a/src/conf/cards/CMI8738-MC6.conf ++++ b/src/conf/cards/CMI8738-MC6.conf +@@ -11,7 +11,7 @@ CMI8738-MC6.pcm.front.!0 { + } + type hw + card $CARD +-} ++} + + # default with dmix/dsnoop + CMI8738-MC6.pcm.!default { +@@ -75,7 +75,7 @@ CMI8738-MC6.pcm.surround40.!0 { + } + ] + } +-} ++} + + + +@@ -105,7 +105,7 @@ CMI8738-MC6.pcm.surround51.!0 { + } + ] + } +-} ++} + + + +diff --git a/src/conf/cards/CMI8738-MC8.conf b/src/conf/cards/CMI8738-MC8.conf +index 96cb3f10..239014d4 100644 +--- a/src/conf/cards/CMI8738-MC8.conf ++++ b/src/conf/cards/CMI8738-MC8.conf +@@ -18,7 +18,7 @@ CMI8738-MC8.pcm.front.!0 { + name "PCM Playback Volume" + card $CARD + } +-} ++} + + # default with dmix+softvol & dsnoop + CMI8738-MC8.pcm.!default { +@@ -102,7 +102,7 @@ CMI8738-MC8.pcm.surround40.!0 { + name "PCM Playback Volume" + card $CARD + } +-} ++} + + + +@@ -140,7 +140,7 @@ CMI8738-MC8.pcm.surround51.!0 { + name "PCM Playback Volume" + card $CARD + } +-} ++} + + + +@@ -174,7 +174,7 @@ CMI8738-MC8.pcm.surround71.!0 { + name "PCM Playback Volume" + card $CARD + } +-} ++} + + + +diff --git a/src/conf/cards/CMI8788.conf b/src/conf/cards/CMI8788.conf +index c4ad9f48..32ab8fb4 100644 +--- a/src/conf/cards/CMI8788.conf ++++ b/src/conf/cards/CMI8788.conf +@@ -11,7 +11,7 @@ CMI8788.pcm.front.!0 { + } + type hw + card $CARD +-} ++} + + # default with dmix & dsnoop + CMI8788.pcm.!default { +@@ -46,7 +46,7 @@ CMI8788.pcm.surround40.!0 { + type hw + card $CARD + channels 4 +-} ++} + + + +@@ -61,7 +61,7 @@ CMI8788.pcm.surround51.!0 { + type hw + card $CARD + channels 6 +-} ++} + + + +@@ -73,7 +73,7 @@ CMI8788.pcm.surround71.!0 { + type hw + card $CARD + channels 8 +-} ++} + + + +diff --git a/src/conf/cards/CS46xx.conf b/src/conf/cards/CS46xx.conf +index 478cbf3e..ad6a2218 100644 +--- a/src/conf/cards/CS46xx.conf ++++ b/src/conf/cards/CS46xx.conf +@@ -11,7 +11,7 @@ CS46xx.pcm.front.!0 { + } + type hw + card $CARD +-} ++} + + # default with plughw + # CS46xx supports multi-playback +@@ -62,7 +62,7 @@ CS46xx.pcm.rear.!0 { + } + ] + } +-} ++} + + + +@@ -74,7 +74,7 @@ CS46xx.pcm.center_lfe.!0 { + type hw + card $CARD + device 3 +-} ++} + + + +diff --git a/src/conf/cards/EMU10K1.conf b/src/conf/cards/EMU10K1.conf +index 5ef12c03..c2dc7590 100644 +--- a/src/conf/cards/EMU10K1.conf ++++ b/src/conf/cards/EMU10K1.conf +@@ -43,7 +43,7 @@ EMU10K1.pcm.front.!0 { + type hw + card $CARD + } +-} ++} + + + +@@ -74,7 +74,7 @@ EMU10K1.pcm.rear.!0 { + ] + } + } +-} ++} + + + +@@ -139,7 +139,7 @@ EMU10K1.pcm.center_lfe.!0 { + ] + } + } +-} ++} + + + +diff --git a/src/conf/cards/EMU10K1X.conf b/src/conf/cards/EMU10K1X.conf +index 334f897d..7d73ba44 100644 +--- a/src/conf/cards/EMU10K1X.conf ++++ b/src/conf/cards/EMU10K1X.conf +@@ -34,7 +34,7 @@ EMU10K1X.pcm.front.!0 { + } + type hw + card $CARD +-} ++} + + + +@@ -46,7 +46,7 @@ EMU10K1X.pcm.rear.!0 { + type hw + card $CARD + device 1 +-} ++} + + + +@@ -58,7 +58,7 @@ EMU10K1X.pcm.center_lfe.!0 { + type hw + card $CARD + device 2 +-} ++} + + + +diff --git a/src/conf/cards/ENS1370.conf b/src/conf/cards/ENS1370.conf +index c65e224f..446c2f7d 100644 +--- a/src/conf/cards/ENS1370.conf ++++ b/src/conf/cards/ENS1370.conf +@@ -12,7 +12,7 @@ ENS1370.pcm.front.!0 { + type hw + card $CARD + device 1 +-} ++} + + # default with dmix/dsnoop + ENS1370.pcm.!default { +@@ -67,7 +67,7 @@ ENS1370.pcm.rear.!0 { + } + ] + } +-} ++} + + + +diff --git a/src/conf/cards/ENS1371.conf b/src/conf/cards/ENS1371.conf +index 560fda9f..549fd7c9 100644 +--- a/src/conf/cards/ENS1371.conf ++++ b/src/conf/cards/ENS1371.conf +@@ -11,7 +11,7 @@ ENS1371.pcm.front.!0 { + } + type hw + card $CARD +-} ++} + + # default with dmix/dsnoop + ENS1371.pcm.!default { +@@ -61,7 +61,7 @@ ENS1371.pcm.rear.!0 { + } + ] + } +-} ++} + + + +@@ -78,11 +78,11 @@ ENS1371.pcm.surround40.!0 { + strings [ "cards.ENS1371.pcm.front.0:CARD=" $CARD ] + } + channels 2 +- } ++ } + { + pcm { + @func concat +- strings [ "cards.ENS1371.pcm.rear.0:CARD=" $CARD ] ++ strings [ "cards.ENS1371.pcm.rear.0:CARD=" $CARD ] + } + channels 2 + } +@@ -94,7 +94,7 @@ ENS1371.pcm.surround40.!0 { + { slave 1 channel 1 } + ] + } +- ++ + + + ENS1371.pcm.iec958.!0 { +diff --git a/src/conf/cards/ES1968.conf b/src/conf/cards/ES1968.conf +index 296baa13..83dcf93b 100644 +--- a/src/conf/cards/ES1968.conf ++++ b/src/conf/cards/ES1968.conf +@@ -9,4 +9,4 @@ ES1968.pcm.front.!0 { + } + type hw + card $CARD +-} ++} +diff --git a/src/conf/cards/FM801.conf b/src/conf/cards/FM801.conf +index 14cfdbe8..b8bed781 100644 +--- a/src/conf/cards/FM801.conf ++++ b/src/conf/cards/FM801.conf +@@ -11,7 +11,7 @@ FM801.pcm.front.!0 { + } + type hw + card $CARD +-} ++} + + # default with dmix/dsnoop + FM801.pcm.!default { +diff --git a/src/conf/cards/GUS.conf b/src/conf/cards/GUS.conf +index a1ccd0e9..42a612a6 100644 +--- a/src/conf/cards/GUS.conf ++++ b/src/conf/cards/GUS.conf +@@ -16,4 +16,4 @@ GUS.pcm.front.!0 { + type hw + card $CARD + } +-} ++} +diff --git a/src/conf/cards/HDA-Intel.conf b/src/conf/cards/HDA-Intel.conf +index 76775b97..cacd2815 100644 +--- a/src/conf/cards/HDA-Intel.conf ++++ b/src/conf/cards/HDA-Intel.conf +@@ -26,7 +26,7 @@ HDA-Intel.pcm.front.!0 { + type hw + card $CARD + } +-} ++} + + # default with dmix+softvol & dsnoop + HDA-Intel.pcm.!default { +diff --git a/src/conf/cards/ICE1712.conf b/src/conf/cards/ICE1712.conf +index 190d2c59..08b84f30 100644 +--- a/src/conf/cards/ICE1712.conf ++++ b/src/conf/cards/ICE1712.conf +@@ -53,7 +53,7 @@ ICE1712.pcm.front.!0 { + } + slave.channels 12 + } +-} ++} + + + +@@ -72,7 +72,7 @@ ICE1712.pcm.surround40.!0 { + card $CARD + } + slave.channels 10 +-} ++} + + + +diff --git a/src/conf/cards/ICE1724.conf b/src/conf/cards/ICE1724.conf +index 16045dc4..678df41d 100644 +--- a/src/conf/cards/ICE1724.conf ++++ b/src/conf/cards/ICE1724.conf +@@ -34,7 +34,7 @@ ICE1724.pcm.front.!0 { + } + type hw + card $CARD +-} ++} + + + +@@ -47,7 +47,7 @@ ICE1724.pcm.rear.!0 { + card $CARD + device 2 + subdevice 1 +-} ++} + + + +@@ -59,7 +59,7 @@ ICE1724.pcm.center_lfe.!0 { + type hw + card $CARD + device 2 +-} ++} + + + +@@ -93,7 +93,7 @@ ICE1724.pcm.surround40.!0 { + card $CARD + } + } +-} ++} + + + +@@ -114,7 +114,7 @@ ICE1724.pcm.surround51.!0 { + ttable.5.3 1 + slave { + channels 6 +- pcm { ++ pcm { + type hw + card $CARD + } +diff --git a/src/conf/cards/ICH.conf b/src/conf/cards/ICH.conf +index c35c8d02..573b9e26 100644 +--- a/src/conf/cards/ICH.conf ++++ b/src/conf/cards/ICH.conf +@@ -18,7 +18,7 @@ ICH.pcm.front.!0 { + name "PCM Playback Volume" + card $CARD + } +-} ++} + + # default with dmix+softvol & dsnoop + ICH.pcm.!default { +diff --git a/src/conf/cards/ICH4.conf b/src/conf/cards/ICH4.conf +index 11c85a6e..5641c9c4 100644 +--- a/src/conf/cards/ICH4.conf ++++ b/src/conf/cards/ICH4.conf +@@ -18,7 +18,7 @@ ICH4.pcm.front.!0 { + name "PCM Playback Volume" + card $CARD + } +-} ++} + + # default with dmix+softvol & dsnoop + ICH4.pcm.!default { +diff --git a/src/conf/cards/Loopback.conf b/src/conf/cards/Loopback.conf +index 21c8429c..3911aed5 100644 +--- a/src/conf/cards/Loopback.conf ++++ b/src/conf/cards/Loopback.conf +@@ -18,7 +18,7 @@ Loopback.pcm.front.!0 { + name "PCM Playback Volume" + card $CARD + } +-} ++} + + # default with dmix+softvol & dsnoop + Loopback.pcm.!default { +diff --git a/src/conf/cards/Maestro3.conf b/src/conf/cards/Maestro3.conf +index a8d89a48..c0e3da31 100644 +--- a/src/conf/cards/Maestro3.conf ++++ b/src/conf/cards/Maestro3.conf +@@ -9,7 +9,7 @@ Maestro3.pcm.front.!0 { + } + type hw + card $CARD +-} ++} + + # default with dmix/dsnoop + Maestro3.pcm.!default { +@@ -35,4 +35,3 @@ Maestro3.pcm.!default { + } + } + } +- +diff --git a/src/conf/cards/NFORCE.conf b/src/conf/cards/NFORCE.conf +index 088cd8ce..aeef6b40 100644 +--- a/src/conf/cards/NFORCE.conf ++++ b/src/conf/cards/NFORCE.conf +@@ -18,7 +18,7 @@ NFORCE.pcm.front.!0 { + name "PCM Playback Volume" + card $CARD + } +-} ++} + + # default with dmix+softvol & dsnoop + NFORCE.pcm.!default { +@@ -175,74 +175,74 @@ NFORCE.pcm.surround51.!0 { + + + NFORCE.pcm.surround71.!0 { +- @args [ CARD ] +- @args.CARD { +- type string +- } +- type softvol +- slave.pcm { +- type route +- ttable.0.0 1 +- ttable.1.1 1 +- ttable.2.4 1 +- ttable.3.5 1 +- ttable.4.2 1 +- ttable.5.3 1 +- ttable.6.6 1 +- ttable.7.7 1 +- slave.pcm { +- type hooks +- slave.pcm { +- type hw +- card $CARD +- device 0 +- } +- hooks.0 { +- type ctl_elems +- hook_args [ +- { +- name "Channel Mode" +- preserve true +- value "8ch" +- lock true +- optional true +- } +- # for old drivers +- { +- name "Line-In As Surround" +- preserve true +- value true +- optional true +- } +- { +- name "Mic As Center/LFE" +- preserve true +- value true +- optional true +- } +- { +- name "Surround Down Mix" +- preserve true +- value off +- lock true +- optional true +- } +- { +- name "Center/LFE Down Mix" +- preserve true +- value off +- lock true +- optional true +- } +- ] +- } +- } +- slave.channels 8 +- } +- control { +- name "PCM Playback Volume" +- card $CARD +- } ++ @args [ CARD ] ++ @args.CARD { ++ type string ++ } ++ type softvol ++ slave.pcm { ++ type route ++ ttable.0.0 1 ++ ttable.1.1 1 ++ ttable.2.4 1 ++ ttable.3.5 1 ++ ttable.4.2 1 ++ ttable.5.3 1 ++ ttable.6.6 1 ++ ttable.7.7 1 ++ slave.pcm { ++ type hooks ++ slave.pcm { ++ type hw ++ card $CARD ++ device 0 ++ } ++ hooks.0 { ++ type ctl_elems ++ hook_args [ ++ { ++ name "Channel Mode" ++ preserve true ++ value "8ch" ++ lock true ++ optional true ++ } ++ # for old drivers ++ { ++ name "Line-In As Surround" ++ preserve true ++ value true ++ optional true ++ } ++ { ++ name "Mic As Center/LFE" ++ preserve true ++ value true ++ optional true ++ } ++ { ++ name "Surround Down Mix" ++ preserve true ++ value off ++ lock true ++ optional true ++ } ++ { ++ name "Center/LFE Down Mix" ++ preserve true ++ value off ++ lock true ++ optional true ++ } ++ ] ++ } ++ } ++ slave.channels 8 ++ } ++ control { ++ name "PCM Playback Volume" ++ card $CARD ++ } + } + + +diff --git a/src/conf/cards/PC-Speaker.conf b/src/conf/cards/PC-Speaker.conf +index 8a40a139..97cb0d5d 100644 +--- a/src/conf/cards/PC-Speaker.conf ++++ b/src/conf/cards/PC-Speaker.conf +@@ -20,7 +20,7 @@ PC-Speaker.pcm.front.!0 { + } + min_dB -10.0 + max_dB 20.0 +-} ++} + + # default with dmix & null + PC-Speaker.pcm.!default { +@@ -49,4 +49,3 @@ PC-Speaker.pcm.!default { + type null + } + } +- +diff --git a/src/conf/cards/PMac.conf b/src/conf/cards/PMac.conf +index 00f3bc89..67dfabc6 100644 +--- a/src/conf/cards/PMac.conf ++++ b/src/conf/cards/PMac.conf +@@ -11,7 +11,7 @@ PMac.pcm.front.!0 { + } + type hw + card $CARD +-} ++} + + # default with dmix/dsnoop + PMac.pcm.!default { +diff --git a/src/conf/cards/PMacToonie.conf b/src/conf/cards/PMacToonie.conf +index aff1ea65..c45cf12b 100644 +--- a/src/conf/cards/PMacToonie.conf ++++ b/src/conf/cards/PMacToonie.conf +@@ -18,7 +18,7 @@ PMacToonie.pcm.front.!0 { + name "PCM Playback Volume" + card $CARD + } +-} ++} + + # default with dmix+softvol & dsnoop + PMacToonie.pcm.!default { +diff --git a/src/conf/cards/PS3.conf b/src/conf/cards/PS3.conf +index 486d790c..8a165fc3 100644 +--- a/src/conf/cards/PS3.conf ++++ b/src/conf/cards/PS3.conf +@@ -19,7 +19,7 @@ PS3.pcm.front.!0 { + name "PCM Playback Volume" + card $CARD + } +-} ++} + + # default with dmix+softvol + PS3.pcm.!default { +@@ -34,8 +34,8 @@ PS3.pcm.!default { + type softvol + slave.pcm { + @func concat +- #strings [ "dmix:CARD=" $CARD ] +- strings [ "dmix:CARD=" $CARD ",FORMAT=S16" ] ++ #strings [ "dmix:CARD=" $CARD ] ++ strings [ "dmix:CARD=" $CARD ",FORMAT=S16" ] + } + control { + name "PCM Playback Volume" +diff --git a/src/conf/cards/RME9636.conf b/src/conf/cards/RME9636.conf +index 17b3a1ab..c5c74ee9 100644 +--- a/src/conf/cards/RME9636.conf ++++ b/src/conf/cards/RME9636.conf +@@ -11,7 +11,7 @@ RME9636.pcm.front.!0 { + } + type hw + card $CARD +-} ++} + + # FIXME: This configuration is not valid for double-speed rates. + +diff --git a/src/conf/cards/RME9652.conf b/src/conf/cards/RME9652.conf +index a11e42b2..34ef91bb 100644 +--- a/src/conf/cards/RME9652.conf ++++ b/src/conf/cards/RME9652.conf +@@ -11,7 +11,7 @@ RME9652.pcm.front.!0 { + } + type hw + card $CARD +-} ++} + + # FIXME: This configuration is not valid for double-speed rates. + +diff --git a/src/conf/cards/SB-XFi.conf b/src/conf/cards/SB-XFi.conf +index 9ce9c8ac..64e3d082 100644 +--- a/src/conf/cards/SB-XFi.conf ++++ b/src/conf/cards/SB-XFi.conf +@@ -12,7 +12,7 @@ SB-XFi.pcm.front.!0 { + type hw + card $CARD + device 0 +-} ++} + + + +@@ -25,7 +25,7 @@ SB-XFi.pcm.rear.!0 { + card $CARD + device 1 + hint.device 1 +-} ++} + + + +@@ -38,7 +38,7 @@ SB-XFi.pcm.center_lfe.!0 { + card $CARD + device 2 + hint.device 2 +-} ++} + + + +@@ -51,7 +51,7 @@ SB-XFi.pcm.side.!0 { + card $CARD + device 3 + hint.device 3 +-} ++} + + + +diff --git a/src/conf/cards/SI7018.conf b/src/conf/cards/SI7018.conf +index 33d19085..3a22107c 100644 +--- a/src/conf/cards/SI7018.conf ++++ b/src/conf/cards/SI7018.conf +@@ -14,7 +14,7 @@ SI7018.pcm.front.!0 { + type hw + card $CARD + chmap [ "UNKNOWN" "FL,FR" ] +-} ++} + + + +@@ -23,7 +23,7 @@ SI7018.pcm.rear.!0 { + @args.CARD { + type string + } +- type hooks ++ type hooks + slave.pcm { + type hw + card $CARD +@@ -40,7 +40,7 @@ SI7018.pcm.rear.!0 { + } + ] + } +-} ++} + + + +diff --git a/src/conf/cards/TRID4DWAVENX.conf b/src/conf/cards/TRID4DWAVENX.conf +index 5001297e..3c25515e 100644 +--- a/src/conf/cards/TRID4DWAVENX.conf ++++ b/src/conf/cards/TRID4DWAVENX.conf +@@ -12,7 +12,7 @@ TRID4DWAVENX.pcm.front.!0 { + type hw + card $CARD + chmap [ "UNKNOWN" "FL,FR" ] +-} ++} + + + +@@ -52,7 +52,7 @@ TRID4DWAVENX.pcm.rear.!0 { + } + ] + } +-} ++} + + + +diff --git a/src/conf/cards/USB-Audio.conf b/src/conf/cards/USB-Audio.conf +index 1fc540e2..33d856f2 100644 +--- a/src/conf/cards/USB-Audio.conf ++++ b/src/conf/cards/USB-Audio.conf +@@ -47,7 +47,7 @@ USB-Audio.pcm.iec958_device { + "XONAR U5" 1 + "XONAR SOUND CARD" 1 + "Xonar SoundCard" 2 +- ++ + # The below don't have digital in/out, so prevent them from being opened. + "Andrea PureAudio USB-SA Headset" 999 + "Blue Snowball" 999 +diff --git a/src/conf/cards/VIA686A.conf b/src/conf/cards/VIA686A.conf +index c53dd71b..40c2f89e 100644 +--- a/src/conf/cards/VIA686A.conf ++++ b/src/conf/cards/VIA686A.conf +@@ -14,7 +14,7 @@ VIA686A.pcm.front.!0 { + } + type hw + card $CARD +-} ++} + + # default with dmix/dsnoop + VIA686A.pcm.!default { +diff --git a/src/conf/cards/VIA8233.conf b/src/conf/cards/VIA8233.conf +index 3c25a11b..ccc7fe2f 100644 +--- a/src/conf/cards/VIA8233.conf ++++ b/src/conf/cards/VIA8233.conf +@@ -11,7 +11,7 @@ VIA8233.pcm.front.!0 { + } + type hw + card $CARD +-} ++} + + # default with softvol/dsnoop + # VIA8233 supports multi-playback +diff --git a/src/conf/cards/VIA8233A.conf b/src/conf/cards/VIA8233A.conf +index c9e56e20..e566edeb 100644 +--- a/src/conf/cards/VIA8233A.conf ++++ b/src/conf/cards/VIA8233A.conf +@@ -11,7 +11,7 @@ VIA8233A.pcm.front.!0 { + } + type hw + card $CARD +-} ++} + + # default with dmix/dsnoop + VIA8233A.pcm.!default { +diff --git a/src/conf/cards/VIA8237.conf b/src/conf/cards/VIA8237.conf +index 49fd6f2c..074e342c 100644 +--- a/src/conf/cards/VIA8237.conf ++++ b/src/conf/cards/VIA8237.conf +@@ -11,7 +11,7 @@ VIA8237.pcm.front.!0 { + } + type hw + card $CARD +-} ++} + + # default with softvol/dsnoop + # VIA8237 supports multi-playback +diff --git a/src/conf/cards/VX222.conf b/src/conf/cards/VX222.conf +index 2c6e2297..96ea32f6 100644 +--- a/src/conf/cards/VX222.conf ++++ b/src/conf/cards/VX222.conf +@@ -11,7 +11,7 @@ VX222.pcm.front.!0 { + } + type hw + card $CARD +-} ++} + + + +diff --git a/src/conf/cards/VXPocket.conf b/src/conf/cards/VXPocket.conf +index 90b13347..81260a7d 100644 +--- a/src/conf/cards/VXPocket.conf ++++ b/src/conf/cards/VXPocket.conf +@@ -11,7 +11,7 @@ VXPocket.pcm.front.!0 { + } + type hw + card $CARD +-} ++} + + + +diff --git a/src/conf/cards/VXPocket440.conf b/src/conf/cards/VXPocket440.conf +index 87a0855a..6b3aea40 100644 +--- a/src/conf/cards/VXPocket440.conf ++++ b/src/conf/cards/VXPocket440.conf +@@ -11,7 +11,7 @@ VXPocket440.pcm.front.!0 { + } + type hw + card $CARD +-} ++} + + + +diff --git a/src/conf/cards/YMF744.conf b/src/conf/cards/YMF744.conf +index ad1f2132..974bf791 100644 +--- a/src/conf/cards/YMF744.conf ++++ b/src/conf/cards/YMF744.conf +@@ -11,7 +11,7 @@ YMF744.pcm.front.!0 { + } + type hw + card $CARD +-} ++} + + + +@@ -23,7 +23,7 @@ YMF744.pcm.rear.!0 { + type hw + card $CARD + device 2 +-} ++} + + + +diff --git a/src/conf/cards/pistachio-card.conf b/src/conf/cards/pistachio-card.conf +index 15cfd60b..d92c019a 100644 +--- a/src/conf/cards/pistachio-card.conf ++++ b/src/conf/cards/pistachio-card.conf +@@ -1,10 +1,10 @@ + # + # Configuration for the pistachio chip. + # +-# The data sheet of the chip and technical reference manual can be +-found at ++# The data sheet of the chip and technical reference manual can be ++found at + https://docs.creatordev.io/ci40/guides/hardwaredocs/cXT200_datasheet2.p +-df # and ++df # and + https://docs.creatordev.io/ci40/guides/hardwaredocs/MIPS_Creator_cXT200_Technical_Reference_Manual_1.0.112.pdf. + # + # The list of hardware devices is as per below: +@@ -30,30 +30,30 @@ https://docs.creatordev.io/ci40/guides/hardwaredocs/MIPS_Creator_cXT200_Technica + # + + pistachio-card.pcm.!default { +- @args [ CARD ] +- @args.CARD { +- type string +- default "pistachio" +- } +- @args.DEVICE { +- type integer +- default 2 +- } ++ @args [ CARD ] ++ @args.CARD { ++ type string ++ default "pistachio" ++ } ++ @args.DEVICE { ++ type integer ++ default 2 ++ } + +- type asym +- capture.pcm { +- type multi +- slaves.a.pcm "hw:0,4" +- slaves.a.channels 12 +- bindings.0.slave a +- bindings.0.channel 4 +- bindings.1.slave a +- bindings.1.channel 5 +- } ++ type asym ++ capture.pcm { ++ type multi ++ slaves.a.pcm "hw:0,4" ++ slaves.a.channels 12 ++ bindings.0.slave a ++ bindings.0.channel 4 ++ bindings.1.slave a ++ bindings.1.channel 5 ++ } + +- playback.pcm { +- type hw +- card $CARD +- device $DEVICE +- } ++ playback.pcm { ++ type hw ++ card $CARD ++ device $DEVICE ++ } + } +-- +2.51.1 + diff --git a/alsa-lib.spec b/alsa-lib.spec index e11c07f..f64c71c 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -9,7 +9,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 3%{?prever_dot}%{?dist} +Release: 4%{?prever_dot}%{?dist} License: LGPL-2.1-or-later URL: http://www.alsa-project.org/ @@ -167,7 +167,7 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog -* Sun Dec 10 2025 Jaroslav Kysela - 1.2.15-3 +* Wed Dec 10 2025 Jaroslav Kysela - 1.2.15-4 - update to 1.2.15 * Wed Jul 23 2025 Fedora Release Engineering - 1.2.14-4 From f26eb0d2f984346d2e5ecf1ed5ad2f26ba171308 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 19 Dec 2025 12:01:03 +0100 Subject: [PATCH 117/120] update to 1.2.15.1 Signed-off-by: Jaroslav Kysela --- alsa-git.patch | 4986 ------------------------------------------- alsa-lib.spec | 20 +- alsa-ucm-conf.patch | 264 --- sources | 4 +- 4 files changed, 19 insertions(+), 5255 deletions(-) delete mode 100644 alsa-git.patch delete mode 100644 alsa-ucm-conf.patch diff --git a/alsa-git.patch b/alsa-git.patch deleted file mode 100644 index b0fcde8..0000000 --- a/alsa-git.patch +++ /dev/null @@ -1,4986 +0,0 @@ -From a068cf08ad67447893b707cddfce31c9cafee643 Mon Sep 17 00:00:00 2001 -From: Mike Gilbert -Date: Mon, 8 Dec 2025 23:46:17 -0500 -Subject: [PATCH 01/43] ucm: use closefrom instead of close_range - -closefrom is a library function with a fallback mechanism for when the -kernel does not support the close_range syscall. - -Also check for the function properly instead of assuming it is available -with _GNU_SOURCE defined. - -Closes: https://github.com/alsa-project/alsa-lib/pull/486 -Fixes: https://github.com/alsa-project/alsa-lib/issues/485 -Signed-off-by: Mike Gilbert -Signed-off-by: Jaroslav Kysela ---- - configure.ac | 1 + - src/ucm/ucm_exec.c | 4 ++-- - 2 files changed, 3 insertions(+), 2 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 8f4bd0de..f4862f64 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -52,6 +52,7 @@ dnl Checks for library functions. - AC_PROG_GCC_TRADITIONAL - AC_CHECK_FUNCS([uselocale]) - AC_CHECK_FUNCS([eaccess]) -+AC_CHECK_DECLS([closefrom]) - - dnl Enable largefile support - AC_SYS_LARGEFILE -diff --git a/src/ucm/ucm_exec.c b/src/ucm/ucm_exec.c -index b5a22023..713039b4 100644 ---- a/src/ucm/ucm_exec.c -+++ b/src/ucm/ucm_exec.c -@@ -259,8 +259,8 @@ int uc_mgr_exec(const char *prog) - - close(f); - --#if defined(_GNU_SOURCE) -- close_range(3, maxfd, 0); -+#if HAVE_DECL_CLOSEFROM -+ closefrom(3); - #else - for (f = 3; f < maxfd; f++) - close(f); --- -2.51.1 - - -From 813ffe34ff6c720dcc56e4549338bf9e9184af1f Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 9 Dec 2025 17:48:34 +0100 -Subject: [PATCH 02/43] ucm: exec - fix maxfd used warning - -Fixes: a068cf08 ("ucm: use closefrom instead of close_range") -Signed-off-by: Jaroslav Kysela ---- - src/ucm/ucm_exec.c | 11 ++++++----- - 1 file changed, 6 insertions(+), 5 deletions(-) - -diff --git a/src/ucm/ucm_exec.c b/src/ucm/ucm_exec.c -index 713039b4..c16a4cfd 100644 ---- a/src/ucm/ucm_exec.c -+++ b/src/ucm/ucm_exec.c -@@ -183,7 +183,7 @@ static int parse_args(char ***argv, int argc, const char *cmd) - */ - int uc_mgr_exec(const char *prog) - { -- pid_t p, f, maxfd; -+ pid_t p, f; - int err = 0, status; - char bin[PATH_MAX]; - struct sigaction sa; -@@ -212,8 +212,6 @@ int uc_mgr_exec(const char *prog) - prog = bin; - } - -- maxfd = sysconf(_SC_OPEN_MAX); -- - /* - * block SIGCHLD signal - * ignore SIGINT and SIGQUIT in parent -@@ -262,8 +260,11 @@ int uc_mgr_exec(const char *prog) - #if HAVE_DECL_CLOSEFROM - closefrom(3); - #else -- for (f = 3; f < maxfd; f++) -- close(f); -+ { -+ pid_t maxfd = sysconf(_SC_OPEN_MAX); -+ for (f = 3; f < maxfd; f++) -+ close(f); -+ } - #endif - - /* install default handlers for the forked process */ --- -2.51.1 - - -From a6238053c4fa518b214f99d91a01b96c5ef6e3ca Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 9 Dec 2025 18:04:07 +0100 -Subject: [PATCH 03/43] conf: merge card specific contents per file (whole) - after parsing - -Unfortunately, mentioned fix caused a regression for items stored in one file. -Merge the file contents after parsing not inside parsing process. - -BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=2420645 -Fixes: eda76146 ("conf: fix load_for_all_cards() - do not merge the card specific contents") -Signed-off-by: Jaroslav Kysela ---- - src/conf.c | 13 ++++++++++--- - 1 file changed, 10 insertions(+), 3 deletions(-) - -diff --git a/src/conf.c b/src/conf.c -index 49499ecd..b1ec9b38 100644 ---- a/src/conf.c -+++ b/src/conf.c -@@ -4119,14 +4119,21 @@ static int config_filename_filter(const struct dirent64 *dirent) - static int config_file_open(snd_config_t *root, const char *filename, int merge) - { - snd_input_t *in; -+ snd_config_t *top; - int err; - - err = snd_input_stdio_open(&in, filename, "r"); - if (err >= 0) { -- if (merge) -+ if (merge) { - err = snd_config_load(root, in); -- else -- err = snd_config_load_override(root, in); -+ } else { -+ err = snd_config_top(&top); -+ if (err >= 0) { -+ err = snd_config_load(top, in); -+ if (err >= 0) -+ err = snd_config_merge(root, top, 1); -+ } -+ } - snd_input_close(in); - if (err < 0) - snd_error(CORE, "%s may be old or corrupted: consider to remove or fix it", filename); --- -2.51.1 - - -From 2f59398c83b8065fb9ff58939df3a9187746068e Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 9 Dec 2025 18:39:52 +0100 -Subject: [PATCH 04/43] conf: fix possible memory leak in config_file_open() - - error path - -Fixes: a6238053 ("conf: merge card specific contents per file (whole) after parsing") -Signed-off-by: Jaroslav Kysela ---- - src/conf.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/src/conf.c b/src/conf.c -index b1ec9b38..d90f6dc3 100644 ---- a/src/conf.c -+++ b/src/conf.c -@@ -4130,8 +4130,11 @@ static int config_file_open(snd_config_t *root, const char *filename, int merge) - err = snd_config_top(&top); - if (err >= 0) { - err = snd_config_load(top, in); -- if (err >= 0) -+ if (err >= 0) { - err = snd_config_merge(root, top, 1); -+ if (err < 0) -+ snd_config_delete(top); -+ } - } - } - snd_input_close(in); --- -2.51.1 - - -From 2ef8952b46a46b97a6df2f29bcd182f895ebf9e4 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 12:03:29 +0100 -Subject: [PATCH 05/43] Revert "conf: fix load_for_all_cards() - do not merge - the card specific contents" - -This reverts commit eda76146c5653ff1d5bc4b4c53f7a2d5ccc17da2. - -Also, revert additional related commits: - - Revert "conf: fix possible memory leak in config_file_open() - error path" - This reverts commit 2f59398c83b8065fb9ff58939df3a9187746068e. - - Revert "conf: merge card specific contents per file (whole) after parsing" - This reverts commit a6238053c4fa518b214f99d91a01b96c5ef6e3ca. - -Signed-off-by: Jaroslav Kysela ---- - src/conf.c | 42 ++++++++++++------------------------------ - 1 file changed, 12 insertions(+), 30 deletions(-) - -diff --git a/src/conf.c b/src/conf.c -index d90f6dc3..fb9f0658 100644 ---- a/src/conf.c -+++ b/src/conf.c -@@ -4116,27 +4116,14 @@ static int config_filename_filter(const struct dirent64 *dirent) - return 0; - } - --static int config_file_open(snd_config_t *root, const char *filename, int merge) -+static int config_file_open(snd_config_t *root, const char *filename) - { - snd_input_t *in; -- snd_config_t *top; - int err; - - err = snd_input_stdio_open(&in, filename, "r"); - if (err >= 0) { -- if (merge) { -- err = snd_config_load(root, in); -- } else { -- err = snd_config_top(&top); -- if (err >= 0) { -- err = snd_config_load(top, in); -- if (err >= 0) { -- err = snd_config_merge(root, top, 1); -- if (err < 0) -- snd_config_delete(top); -- } -- } -- } -+ err = snd_config_load(root, in); - snd_input_close(in); - if (err < 0) - snd_error(CORE, "%s may be old or corrupted: consider to remove or fix it", filename); -@@ -4146,7 +4133,7 @@ static int config_file_open(snd_config_t *root, const char *filename, int merge) - return err; - } - --static int config_file_load(snd_config_t *root, const char *fn, int errors, int merge) -+static int config_file_load(snd_config_t *root, const char *fn, int errors) - { - struct stat64 st; - struct dirent64 **namelist; -@@ -4159,7 +4146,7 @@ static int config_file_load(snd_config_t *root, const char *fn, int errors, int - return 1; - } - if (!S_ISDIR(st.st_mode)) -- return config_file_open(root, fn, merge); -+ return config_file_open(root, fn); - #ifndef DOC_HIDDEN - #if defined(_GNU_SOURCE) && \ - !defined(__NetBSD__) && \ -@@ -4185,7 +4172,7 @@ static int config_file_load(snd_config_t *root, const char *fn, int errors, int - snprintf(filename, sl, "%s/%s", fn, namelist[j]->d_name); - filename[sl-1] = '\0'; - -- err = config_file_open(root, filename, merge); -+ err = config_file_open(root, filename); - free(filename); - } - free(namelist[j]); -@@ -4197,20 +4184,20 @@ static int config_file_load(snd_config_t *root, const char *fn, int errors, int - return 0; - } - --static int config_file_load_user(snd_config_t *root, const char *fn, int errors, int merge) -+static int config_file_load_user(snd_config_t *root, const char *fn, int errors) - { - char *fn2; - int err; - - err = snd_user_file(fn, &fn2); - if (err < 0) -- return config_file_load(root, fn, errors, merge); -- err = config_file_load(root, fn2, errors, merge); -+ return config_file_load(root, fn, errors); -+ err = config_file_load(root, fn2, errors); - free(fn2); - return err; - } - --static int config_file_load_user_all(snd_config_t *_root, snd_config_t *_file, int errors, int merge) -+static int config_file_load_user_all(snd_config_t *_root, snd_config_t *_file, int errors) - { - snd_config_t *file = _file, *root = _root, *n; - char *name, *name2, *remain, *rname = NULL; -@@ -4241,7 +4228,7 @@ static int config_file_load_user_all(snd_config_t *_root, snd_config_t *_file, i - *remain = '\0'; - remain += 3; - } -- err = config_file_load_user(root, name2, errors, merge); -+ err = config_file_load_user(root, name2, errors); - if (err < 0) - goto _err; - if (err == 0) /* first hit wins */ -@@ -4290,7 +4277,7 @@ int snd_config_hook_load(snd_config_t *root, snd_config_t *config, snd_config_t - { - snd_config_t *n; - snd_config_iterator_t i, next; -- int err, idx = 0, errors = 1, merge = 1, hit; -+ int err, idx = 0, errors = 1, hit; - - assert(root && dst); - if ((err = snd_config_search(config, "errors", &n)) >= 0) { -@@ -4300,10 +4287,6 @@ int snd_config_hook_load(snd_config_t *root, snd_config_t *config, snd_config_t - return errors; - } - } -- /* special case, we know the card number (may be multiple times) */ -- if (private_data && snd_config_search(private_data, "integer", &n) >= 0) { -- merge = 0; -- } - if ((err = snd_config_search(config, "files", &n)) < 0) { - snd_error(CORE, "Unable to find field files in the pre-load section"); - return -EINVAL; -@@ -4316,7 +4299,6 @@ int snd_config_hook_load(snd_config_t *root, snd_config_t *config, snd_config_t - snd_error(CORE, "Invalid type for field filenames"); - goto _err; - } -- - do { - hit = 0; - snd_config_for_each(i, next, n) { -@@ -4330,7 +4312,7 @@ int snd_config_hook_load(snd_config_t *root, snd_config_t *config, snd_config_t - goto _err; - } - if (i == idx) { -- err = config_file_load_user_all(root, n, errors, merge); -+ err = config_file_load_user_all(root, n, errors); - if (err < 0) - goto _err; - idx++; --- -2.51.1 - - -From 16ab43db6ed6f71424d5ad78e62f85baaeae5051 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 12:12:47 +0100 -Subject: [PATCH 06/43] conf: USB-Audio: define pcm configuration block only - one time - -There may be multiple USB soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/USB-Audio.conf | 30 +++++++++++++++--------------- - 1 file changed, 15 insertions(+), 15 deletions(-) - -diff --git a/src/conf/cards/USB-Audio.conf b/src/conf/cards/USB-Audio.conf -index 2f6d2ee0..1fc540e2 100644 ---- a/src/conf/cards/USB-Audio.conf -+++ b/src/conf/cards/USB-Audio.conf -@@ -99,7 +99,7 @@ USB-Audio.pcm.iec958_2_device { - # device 0: analog output, digital input - # device 1: digital output, analog input - USB-Audio."AudioPhile".pcm.default "cards.USB-Audio.Audiophile USB (tm).pcm.default" --USB-Audio."Audiophile USB (tm)".pcm.default { -+USB-Audio."Audiophile USB (tm)".pcm.!default { - @args [ CARD ] - @args.CARD { type string } - type asym -@@ -120,7 +120,7 @@ USB-Audio."Audiophile USB (tm)".pcm.default { - } - } - USB-Audio."AudioPhile".pcm.iec958 "cards.USB-Audio.Audiophile USB (tm).pcm.iec958" --USB-Audio."Audiophile USB (tm)".pcm.iec958 { -+USB-Audio."Audiophile USB (tm)".pcm.!iec958 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { type string } - @args.AES0 { type integer } -@@ -142,7 +142,7 @@ USB-Audio."Audiophile USB (tm)".pcm.iec958 { - - # For this card we can (and must to get IEC61937) set AES bits - USB-Audio."MicroII".pcm.iec958 "cards.USB-Audio.Audio Advantage MicroII.pcm.iec958" --USB-Audio."Audio Advantage MicroII".pcm.iec958 { -+USB-Audio."Audio Advantage MicroII".pcm.!iec958 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { type string } - @args.AES0 { type integer } -@@ -180,7 +180,7 @@ USB-Audio."Audio Advantage MicroII".pcm.iec958 { - - - --USB-Audio.pcm.front.0 { -+USB-Audio.pcm.front.!0 { - @args [ CARD ] - @args.CARD { type string } - @func refer -@@ -201,7 +201,7 @@ USB-Audio.pcm.front.0 { - } - } - --USB-Audio.pcm.default { -+USB-Audio.pcm.!default { - @args [ CARD ] - @args.CARD { type string } - @func refer -@@ -249,14 +249,14 @@ USB-Audio.pcm.default { - } - } - --USB-Audio.pcm.default_playback_dmix_yes { -+USB-Audio.pcm.!default_playback_dmix_yes { - @args [ CARD ] - @args.CARD { type string } - @func concat - strings [ "dmix:" $CARD ] - } - --USB-Audio.pcm.default_playback_dmix_no { -+USB-Audio.pcm.!default_playback_dmix_no { - @args [ CARD ] - @args.CARD { type string } - type hw -@@ -266,7 +266,7 @@ USB-Audio.pcm.default_playback_dmix_no { - - - --USB-Audio.pcm.surround40.0 { -+USB-Audio.pcm.surround40.!0 { - @args [ CARD ] - @args.CARD { type string } - @func refer -@@ -301,7 +301,7 @@ USB-Audio.pcm.surround40.0 { - } - } - --USB-Audio.pcm.surround40_default { -+USB-Audio.pcm.!surround40_default { - @args [ CARD ] - @args.CARD { type string } - type hw -@@ -309,7 +309,7 @@ USB-Audio.pcm.surround40_default { - device 0 - } - --USB-Audio.pcm.surround40_six_channels { -+USB-Audio.pcm.!surround40_six_channels { - @args [ CARD ] - @args.CARD { type string } - type route -@@ -327,7 +327,7 @@ USB-Audio.pcm.surround40_six_channels { - } - } - --USB-Audio.pcm.surround40_two_stereo_devices { -+USB-Audio.pcm.!surround40_two_stereo_devices { - @args [ CARD ] - @args.CARD { type string } - type route -@@ -369,7 +369,7 @@ USB-Audio.pcm.surround40_two_stereo_devices { - - - --USB-Audio.pcm.surround51.0 { -+USB-Audio.pcm.surround51.!0 { - @args [ CARD ] - @args.CARD { type string } - @func refer -@@ -402,7 +402,7 @@ USB-Audio.pcm.surround51.0 { - - - --USB-Audio.pcm.surround71.0 { -+USB-Audio.pcm.surround71.!0 { - @args [ CARD ] - @args.CARD { type string } - @func refer -@@ -437,7 +437,7 @@ USB-Audio.pcm.surround71.0 { - - - --USB-Audio.pcm.iec958.0 { -+USB-Audio.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { type string } - @args.AES0 { type integer } -@@ -472,7 +472,7 @@ USB-Audio.pcm.iec958.0 { - } - } - --USB-Audio.pcm.iec958.1 { -+USB-Audio.pcm.iec958.!1 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { type string } - @args.AES0 { type integer } --- -2.51.1 - - -From 010b699c92a9a6ffdca1874cd2e3c6c054d212e0 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 12:12:47 +0100 -Subject: [PATCH 07/43] conf: HDA-Intel: define pcm configuration block only - one time - -There may be multiple HDA-Intel soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/HDA-Intel.conf | 32 ++++++++++++++++---------------- - 1 file changed, 16 insertions(+), 16 deletions(-) - -diff --git a/src/conf/cards/HDA-Intel.conf b/src/conf/cards/HDA-Intel.conf -index 5451606f..76775b97 100644 ---- a/src/conf/cards/HDA-Intel.conf -+++ b/src/conf/cards/HDA-Intel.conf -@@ -4,7 +4,7 @@ - - - --HDA-Intel.pcm.front.0 { -+HDA-Intel.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -29,7 +29,7 @@ HDA-Intel.pcm.front.0 { - } - - # default with dmix+softvol & dsnoop --HDA-Intel.pcm.default { -+HDA-Intel.pcm.!default { - @args [ CARD ] - @args.CARD { - type string -@@ -84,7 +84,7 @@ HDA-Intel.pcm.surround71.0 cards.HDA-Intel.pcm.front.0 - - - --HDA-Intel.pcm.iec958.0 { -+HDA-Intel.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string -@@ -163,7 +163,7 @@ HDA-Intel.pcm.iec958.0 { - hint.device 1 - } - --HDA-Intel.pcm.hdmi.common { -+HDA-Intel.pcm.hdmi.!common { - @args [ CARD DEVICE CTLINDEX AES0 AES1 AES2 AES3 ] - @args.CARD { - type string -@@ -212,7 +212,7 @@ HDA-Intel.pcm.hdmi.common { - hint.device $DEVICE - } - --HDA-Intel.pcm.hdmi.0 { -+HDA-Intel.pcm.hdmi.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { type string } - @args.AES0 { type integer } -@@ -235,7 +235,7 @@ HDA-Intel.pcm.hdmi.0 { - } - } - --HDA-Intel.pcm.hdmi.1 { -+HDA-Intel.pcm.hdmi.!1 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { type string } - @args.AES0 { type integer } -@@ -258,7 +258,7 @@ HDA-Intel.pcm.hdmi.1 { - } - } - --HDA-Intel.pcm.hdmi.2 { -+HDA-Intel.pcm.hdmi.!2 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { type string } - @args.AES0 { type integer } -@@ -281,7 +281,7 @@ HDA-Intel.pcm.hdmi.2 { - } - } - --HDA-Intel.pcm.hdmi.3 { -+HDA-Intel.pcm.hdmi.!3 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { type string } - @args.AES0 { type integer } -@@ -304,7 +304,7 @@ HDA-Intel.pcm.hdmi.3 { - } - } - --HDA-Intel.pcm.hdmi.4 { -+HDA-Intel.pcm.hdmi.!4 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { type string } - @args.AES0 { type integer } -@@ -327,7 +327,7 @@ HDA-Intel.pcm.hdmi.4 { - } - } - --HDA-Intel.pcm.hdmi.5 { -+HDA-Intel.pcm.hdmi.!5 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { type string } - @args.AES0 { type integer } -@@ -350,7 +350,7 @@ HDA-Intel.pcm.hdmi.5 { - } - } - --HDA-Intel.pcm.hdmi.6 { -+HDA-Intel.pcm.hdmi.!6 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { type string } - @args.AES0 { type integer } -@@ -373,7 +373,7 @@ HDA-Intel.pcm.hdmi.6 { - } - } - --HDA-Intel.pcm.hdmi.7 { -+HDA-Intel.pcm.hdmi.!7 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { type string } - @args.AES0 { type integer } -@@ -396,7 +396,7 @@ HDA-Intel.pcm.hdmi.7 { - } - } - --HDA-Intel.pcm.hdmi.8 { -+HDA-Intel.pcm.hdmi.!8 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { type string } - @args.AES0 { type integer } -@@ -419,7 +419,7 @@ HDA-Intel.pcm.hdmi.8 { - } - } - --HDA-Intel.pcm.hdmi.9 { -+HDA-Intel.pcm.hdmi.!9 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { type string } - @args.AES0 { type integer } -@@ -442,7 +442,7 @@ HDA-Intel.pcm.hdmi.9 { - } - } - --HDA-Intel.pcm.hdmi.10 { -+HDA-Intel.pcm.hdmi.!10 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { type string } - @args.AES0 { type integer } -@@ -467,7 +467,7 @@ HDA-Intel.pcm.hdmi.10 { - - - --HDA-Intel.pcm.modem.0 { -+HDA-Intel.pcm.modem.!0 { - @args [ CARD ] - @args.CARD { - type string --- -2.51.1 - - -From d83af363f1fc17e2b3e7cf2a0f848722f6643a9a Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 12:12:47 +0100 -Subject: [PATCH 08/43] conf: vc4-hdmi: define pcm configuration block only one - time - -There may be multiple vc4-hdmi soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -BugLink: https://github.com/alsa-project/alsa-lib/issues/488 -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/vc4-hdmi.conf | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/conf/cards/vc4-hdmi.conf b/src/conf/cards/vc4-hdmi.conf -index 0f313d82..7041d185 100644 ---- a/src/conf/cards/vc4-hdmi.conf -+++ b/src/conf/cards/vc4-hdmi.conf -@@ -3,7 +3,7 @@ - # subframe conversion - # - --vc4-hdmi.pcm.hdmi.0 { -+vc4-hdmi.pcm.hdmi.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string -@@ -50,7 +50,7 @@ vc4-hdmi.pcm.hdmi.0 { - } - - # default with plug and softvol --vc4-hdmi.pcm.default { -+vc4-hdmi.pcm.!default { - @args [ CARD ] - @args.CARD { - type string --- -2.51.1 - - -From 3969e458124f6933e2f440c2b0b39b29de791a78 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 12:12:47 +0100 -Subject: [PATCH 09/43] conf: AACI,ATIIXP: define pcm configuration block only - one time - -There may be multiple AACI,ATIIXP soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/AACI.conf | 4 ++-- - src/conf/cards/ATIIXP-MODEM.conf | 2 +- - src/conf/cards/ATIIXP-SPDMA.conf | 10 +++++----- - src/conf/cards/ATIIXP.conf | 10 +++++----- - 4 files changed, 13 insertions(+), 13 deletions(-) - -diff --git a/src/conf/cards/AACI.conf b/src/conf/cards/AACI.conf -index 748586a0..ff4778b4 100644 ---- a/src/conf/cards/AACI.conf -+++ b/src/conf/cards/AACI.conf -@@ -4,7 +4,7 @@ - - - --AACI.pcm.front.0 { -+AACI.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -19,7 +19,7 @@ AACI.pcm.surround40.0 "cards.AACI.pcm.front.0" - - - --AACI.pcm.surround51.0 { -+AACI.pcm.surround51.!0 { - @args [ CARD ] - @args.CARD { - type string -diff --git a/src/conf/cards/ATIIXP-MODEM.conf b/src/conf/cards/ATIIXP-MODEM.conf -index 6e52af05..1f69b735 100644 ---- a/src/conf/cards/ATIIXP-MODEM.conf -+++ b/src/conf/cards/ATIIXP-MODEM.conf -@@ -4,7 +4,7 @@ - - - --ATIIXP-MODEM.pcm.modem.0 { -+ATIIXP-MODEM.pcm.modem.!0 { - @args [ CARD ] - @args.CARD { - type string -diff --git a/src/conf/cards/ATIIXP-SPDMA.conf b/src/conf/cards/ATIIXP-SPDMA.conf -index 42540d68..12c40efc 100644 ---- a/src/conf/cards/ATIIXP-SPDMA.conf -+++ b/src/conf/cards/ATIIXP-SPDMA.conf -@@ -4,7 +4,7 @@ - - - --ATIIXP-SPDMA.pcm.front.0 { -+ATIIXP-SPDMA.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -14,7 +14,7 @@ ATIIXP-SPDMA.pcm.front.0 { - } - - # default with dmix/dsnoop --ATIIXP.pcm.default { -+ATIIXP.pcm.!default { - @args [ CARD ] - @args.CARD { - type string -@@ -38,7 +38,7 @@ ATIIXP.pcm.default { - - - --ATIIXP-SPDMA.pcm.surround40.0 { -+ATIIXP-SPDMA.pcm.surround40.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -82,7 +82,7 @@ ATIIXP-SPDMA.pcm.surround40.0 { - - - --ATIIXP-SPDMA.pcm.surround51.0 { -+ATIIXP-SPDMA.pcm.surround51.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -136,7 +136,7 @@ ATIIXP-SPDMA.pcm.surround51.0 { - - - --ATIIXP-SPDMA.pcm.iec958.0 { -+ATIIXP-SPDMA.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string -diff --git a/src/conf/cards/ATIIXP.conf b/src/conf/cards/ATIIXP.conf -index c4d33ef3..13e01c48 100644 ---- a/src/conf/cards/ATIIXP.conf -+++ b/src/conf/cards/ATIIXP.conf -@@ -4,7 +4,7 @@ - - - --ATIIXP.pcm.front.0 { -+ATIIXP.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -14,7 +14,7 @@ ATIIXP.pcm.front.0 { - } - - # default with dmix/dsnoop --ATIIXP.pcm.default { -+ATIIXP.pcm.!default { - @args [ CARD ] - @args.CARD { - type string -@@ -38,7 +38,7 @@ ATIIXP.pcm.default { - - - --ATIIXP.pcm.surround40.0 { -+ATIIXP.pcm.surround40.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -82,7 +82,7 @@ ATIIXP.pcm.surround40.0 { - - - --ATIIXP.pcm.surround51.0 { -+ATIIXP.pcm.surround51.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -136,7 +136,7 @@ ATIIXP.pcm.surround51.0 { - - - --ATIIXP.pcm.iec958.0 { -+ATIIXP.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string --- -2.51.1 - - -From e5dbefdff1254fb66ffa82983c6fed08ba8e37df Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 12:12:47 +0100 -Subject: [PATCH 10/43] conf: Audigy: define pcm configuration block only one - time - -There may be multiple Audigy soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/Audigy.conf | 12 ++++++------ - src/conf/cards/Audigy2.conf | 16 ++++++++-------- - 2 files changed, 14 insertions(+), 14 deletions(-) - -diff --git a/src/conf/cards/Audigy.conf b/src/conf/cards/Audigy.conf -index 42692cfd..a353c624 100644 ---- a/src/conf/cards/Audigy.conf -+++ b/src/conf/cards/Audigy.conf -@@ -4,7 +4,7 @@ - - - --Audigy.pcm.front.0 { -+Audigy.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -40,7 +40,7 @@ Audigy.pcm.front.0 { - - - --Audigy.pcm.rear.0 { -+Audigy.pcm.rear.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -68,7 +68,7 @@ Audigy.pcm.rear.0 { - - - --Audigy.pcm.center_lfe.0 { -+Audigy.pcm.center_lfe.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -107,7 +107,7 @@ Audigy.pcm.center_lfe.0 { - - - --Audigy.pcm.surround40.0 { -+Audigy.pcm.surround40.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -143,7 +143,7 @@ Audigy.pcm.surround40.0 { - - - --Audigy.pcm.surround51.0 { -+Audigy.pcm.surround51.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -190,7 +190,7 @@ Audigy.pcm.surround51.0 { - - - --Audigy.pcm.iec958.0 { -+Audigy.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string -diff --git a/src/conf/cards/Audigy2.conf b/src/conf/cards/Audigy2.conf -index 35126d23..3c15fd1d 100644 ---- a/src/conf/cards/Audigy2.conf -+++ b/src/conf/cards/Audigy2.conf -@@ -4,7 +4,7 @@ - - - --Audigy2.pcm.front.0 { -+Audigy2.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -41,7 +41,7 @@ Audigy2.pcm.front.0 { - - - --Audigy2.pcm.rear.0 { -+Audigy2.pcm.rear.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -69,7 +69,7 @@ Audigy2.pcm.rear.0 { - - - --Audigy2.pcm.center_lfe.0 { -+Audigy2.pcm.center_lfe.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -105,7 +105,7 @@ Audigy2.pcm.center_lfe.0 { - - - --Audigy2.pcm.side.0 { -+Audigy2.pcm.side.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -144,7 +144,7 @@ Audigy2.pcm.side.0 { - - - --Audigy2.pcm.surround40.0 { -+Audigy2.pcm.surround40.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -180,7 +180,7 @@ Audigy2.pcm.surround40.0 { - - - --Audigy2.pcm.surround51.0 { -+Audigy2.pcm.surround51.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -227,7 +227,7 @@ Audigy2.pcm.surround51.0 { - - - --Audigy2.pcm.surround71.0 { -+Audigy2.pcm.surround71.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -285,7 +285,7 @@ Audigy2.pcm.surround71.0 { - - - --Audigy2.pcm.iec958.0 { -+Audigy2.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string --- -2.51.1 - - -From 7079887cd21077fe9569a0d910b11e40f7e5153d Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 12:12:47 +0100 -Subject: [PATCH 11/43] conf: Aureon: define pcm configuration block only one - time - -There may be multiple Aureon soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/Aureon51.conf | 14 +++++++------- - src/conf/cards/Aureon71.conf | 18 +++++++++--------- - 2 files changed, 16 insertions(+), 16 deletions(-) - -diff --git a/src/conf/cards/Aureon51.conf b/src/conf/cards/Aureon51.conf -index 07be4a77..9bf34661 100644 ---- a/src/conf/cards/Aureon51.conf -+++ b/src/conf/cards/Aureon51.conf -@@ -3,7 +3,7 @@ - # - - # default with dmix & dsnoop --Aureon51.pcm.default { -+Aureon51.pcm.!default { - @args [ CARD ] - @args.CARD { - type string -@@ -27,7 +27,7 @@ Aureon51.pcm.default { - - - --Aureon51.pcm.front.0 { -+Aureon51.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -38,7 +38,7 @@ Aureon51.pcm.front.0 { - - - --Aureon51.pcm.rear.0 { -+Aureon51.pcm.rear.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -51,7 +51,7 @@ Aureon51.pcm.rear.0 { - - - --Aureon51.pcm.center_lfe.0 { -+Aureon51.pcm.center_lfe.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -63,7 +63,7 @@ Aureon51.pcm.center_lfe.0 { - - - --Aureon51.pcm.side.0 { -+Aureon51.pcm.side.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -91,7 +91,7 @@ Aureon51.pcm.surround40.0 { - - - --Aureon51.pcm.surround51.0 { -+Aureon51.pcm.surround51.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -103,7 +103,7 @@ Aureon51.pcm.surround51.0 { - - - --Aureon51.pcm.iec958.0 { -+Aureon51.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string -diff --git a/src/conf/cards/Aureon71.conf b/src/conf/cards/Aureon71.conf -index a43ce2ce..f29bc297 100644 ---- a/src/conf/cards/Aureon71.conf -+++ b/src/conf/cards/Aureon71.conf -@@ -3,7 +3,7 @@ - # - - # default with dmix & dsnoop --Aureon71.pcm.default { -+Aureon71.pcm.!default { - @args [ CARD ] - @args.CARD { - type string -@@ -27,7 +27,7 @@ Aureon71.pcm.default { - - - --Aureon71.pcm.front.0 { -+Aureon71.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -38,7 +38,7 @@ Aureon71.pcm.front.0 { - - - --Aureon71.pcm.rear.0 { -+Aureon71.pcm.rear.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -50,7 +50,7 @@ Aureon71.pcm.rear.0 { - - - --Aureon71.pcm.center_lfe.0 { -+Aureon71.pcm.center_lfe.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -63,7 +63,7 @@ Aureon71.pcm.center_lfe.0 { - - - --Aureon71.pcm.side.0 { -+Aureon71.pcm.side.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -76,7 +76,7 @@ Aureon71.pcm.side.0 { - - - --Aureon71.pcm.surround40.0 { -+Aureon71.pcm.surround40.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -91,7 +91,7 @@ Aureon71.pcm.surround40.0 { - - - --Aureon71.pcm.surround51.0 { -+Aureon71.pcm.surround51.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -103,7 +103,7 @@ Aureon71.pcm.surround51.0 { - - - --Aureon71.pcm.surround71.0 { -+Aureon71.pcm.surround71.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -114,7 +114,7 @@ Aureon71.pcm.surround71.0 { - - - --Aureon71.pcm.iec958.0 { -+Aureon71.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string --- -2.51.1 - - -From ea984c3a7d6fbc3613c72614f5fce18ad2c7f9b1 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 12:12:47 +0100 -Subject: [PATCH 12/43] conf: AU88[123]0: define pcm configuration block only - one time - -There may be multiple AU88[123]0 soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/AU8810.conf | 4 ++-- - src/conf/cards/AU8820.conf | 2 +- - src/conf/cards/AU8830.conf | 4 ++-- - 3 files changed, 5 insertions(+), 5 deletions(-) - -diff --git a/src/conf/cards/AU8810.conf b/src/conf/cards/AU8810.conf -index 24d46c34..6b596b68 100644 ---- a/src/conf/cards/AU8810.conf -+++ b/src/conf/cards/AU8810.conf -@@ -4,7 +4,7 @@ - - - --AU8810.pcm.front.0 { -+AU8810.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -15,7 +15,7 @@ AU8810.pcm.front.0 { - - - --AU8810.pcm.iec958.0 { -+AU8810.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string -diff --git a/src/conf/cards/AU8820.conf b/src/conf/cards/AU8820.conf -index 07890254..fe2cbc11 100644 ---- a/src/conf/cards/AU8820.conf -+++ b/src/conf/cards/AU8820.conf -@@ -4,7 +4,7 @@ - - - --AU8820.pcm.front.0 { -+AU8820.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -diff --git a/src/conf/cards/AU8830.conf b/src/conf/cards/AU8830.conf -index 39e66d50..9cd78b3e 100644 ---- a/src/conf/cards/AU8830.conf -+++ b/src/conf/cards/AU8830.conf -@@ -4,7 +4,7 @@ - - - --AU8830.pcm.front.0 { -+AU8830.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -19,7 +19,7 @@ AU8830.pcm.surround40.0 "cards.AU8830.pcm.front.0" - - - --AU8830.pcm.iec958.0 { -+AU8830.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string --- -2.51.1 - - -From 68b8b435416ea734dda55c39f59bea90ea4b0dd6 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 12:12:47 +0100 -Subject: [PATCH 13/43] conf: CA0106: define pcm configuration block only one - time - -There may be multiple CA0106 soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/CA0106.conf | 18 +++++++++--------- - 1 file changed, 9 insertions(+), 9 deletions(-) - -diff --git a/src/conf/cards/CA0106.conf b/src/conf/cards/CA0106.conf -index 2f0eaf0a..1fea79f5 100644 ---- a/src/conf/cards/CA0106.conf -+++ b/src/conf/cards/CA0106.conf -@@ -3,7 +3,7 @@ - # - - # default with dmix & dsnoop --CA0106.pcm.default { -+CA0106.pcm.!default { - @args [ CARD ] - @args.CARD { - type string -@@ -27,7 +27,7 @@ CA0106.pcm.default { - - - --CA0106.pcm.front.0 { -+CA0106.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -38,7 +38,7 @@ CA0106.pcm.front.0 { - - - --CA0106.pcm.rear.0 { -+CA0106.pcm.rear.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -50,7 +50,7 @@ CA0106.pcm.rear.0 { - - - --CA0106.pcm.center_lfe.0 { -+CA0106.pcm.center_lfe.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -62,7 +62,7 @@ CA0106.pcm.center_lfe.0 { - - - --CA0106.pcm.side.0 { -+CA0106.pcm.side.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -74,7 +74,7 @@ CA0106.pcm.side.0 { - - - --CA0106.pcm.surround40.0 { -+CA0106.pcm.surround40.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -114,7 +114,7 @@ CA0106.pcm.surround40.0 { - - - --CA0106.pcm.surround51.0 { -+CA0106.pcm.surround51.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -159,7 +159,7 @@ CA0106.pcm.surround51.0 { - ] - } - --CA0106.pcm.surround71.0 { -+CA0106.pcm.surround71.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -220,7 +220,7 @@ CA0106.pcm.surround71.0 { - - - --CA0106.pcm.iec958.0 { -+CA0106.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string --- -2.51.1 - - -From 041299ea39a7a8d2cb55cb8c2cb5a2e985d38fc3 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 12:12:47 +0100 -Subject: [PATCH 14/43] conf: CMI8xxx: define pcm configuration block only one - time - -There may be multiple CMI8xxx soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/CMI8338-SWIEC.conf | 10 +++++----- - src/conf/cards/CMI8338.conf | 10 +++++----- - src/conf/cards/CMI8738-MC6.conf | 12 ++++++------ - src/conf/cards/CMI8738-MC8.conf | 14 +++++++------- - src/conf/cards/CMI8788.conf | 12 ++++++------ - 5 files changed, 29 insertions(+), 29 deletions(-) - -diff --git a/src/conf/cards/CMI8338-SWIEC.conf b/src/conf/cards/CMI8338-SWIEC.conf -index af3a579f..ca86c466 100644 ---- a/src/conf/cards/CMI8338-SWIEC.conf -+++ b/src/conf/cards/CMI8338-SWIEC.conf -@@ -5,7 +5,7 @@ - - - --CMI8338-SWIEC.pcm.front.0 { -+CMI8338-SWIEC.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -15,7 +15,7 @@ CMI8338-SWIEC.pcm.front.0 { - } - - # default with dmix/dsnoop --CMI8338-SWIEC.pcm.default { -+CMI8338-SWIEC.pcm.!default { - @args [ CARD ] - @args.CARD { - type string -@@ -41,7 +41,7 @@ CMI8338-SWIEC.pcm.default { - - # 2nd DAC - # FIXME: we need a volume attenuator for rear channel. --CMI8338-SWIEC.pcm.rear.0 { -+CMI8338-SWIEC.pcm.rear.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -54,7 +54,7 @@ CMI8338-SWIEC.pcm.rear.0 { - - - # for the old CM8738 with 2nd DAC for rear --CMI8338-SWIEC.pcm.surround40.0 { -+CMI8338-SWIEC.pcm.surround40.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -91,7 +91,7 @@ CMI8338-SWIEC.pcm.surround40.0 { - - - --CMI8338-SWIEC.pcm.iec958.0 { -+CMI8338-SWIEC.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string -diff --git a/src/conf/cards/CMI8338.conf b/src/conf/cards/CMI8338.conf -index 144fc9b0..0f92ad0b 100644 ---- a/src/conf/cards/CMI8338.conf -+++ b/src/conf/cards/CMI8338.conf -@@ -4,7 +4,7 @@ - - - --CMI8338.pcm.front.0 { -+CMI8338.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -14,7 +14,7 @@ CMI8338.pcm.front.0 { - } - - # default with dmix/dsnoop --CMI8338.pcm.default { -+CMI8338.pcm.!default { - @args [ CARD ] - @args.CARD { - type string -@@ -40,7 +40,7 @@ CMI8338.pcm.default { - - # 2nd DAC - # FIXME: we need a volume attenuator for rear channel. --CMI8338.pcm.rear.0 { -+CMI8338.pcm.rear.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -53,7 +53,7 @@ CMI8338.pcm.rear.0 { - - - # for the old CM8738 with 2nd DAC for rear --CMI8338.pcm.surround40.0 { -+CMI8338.pcm.surround40.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -90,7 +90,7 @@ CMI8338.pcm.surround40.0 { - - - --CMI8338.pcm.iec958.0 { -+CMI8338.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string -diff --git a/src/conf/cards/CMI8738-MC6.conf b/src/conf/cards/CMI8738-MC6.conf -index edc67d44..2b1c7d05 100644 ---- a/src/conf/cards/CMI8738-MC6.conf -+++ b/src/conf/cards/CMI8738-MC6.conf -@@ -4,7 +4,7 @@ - - - --CMI8738-MC6.pcm.front.0 { -+CMI8738-MC6.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -14,7 +14,7 @@ CMI8738-MC6.pcm.front.0 { - } - - # default with dmix/dsnoop --CMI8738-MC6.pcm.default { -+CMI8738-MC6.pcm.!default { - @args [ CARD ] - @args.CARD { - type string -@@ -40,7 +40,7 @@ CMI8738-MC6.pcm.default { - - # 2nd DAC - # FIXME: we need a volume attenuator for rear channel. --CMI8738-MC6.pcm.rear.0 { -+CMI8738-MC6.pcm.rear.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -52,7 +52,7 @@ CMI8738-MC6.pcm.rear.0 { - - - --CMI8738-MC6.pcm.surround40.0 { -+CMI8738-MC6.pcm.surround40.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -82,7 +82,7 @@ CMI8738-MC6.pcm.surround40.0 { - - - --CMI8738-MC6.pcm.surround51.0 { -+CMI8738-MC6.pcm.surround51.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -109,7 +109,7 @@ CMI8738-MC6.pcm.surround51.0 { - - - --CMI8738-MC6.pcm.iec958.0 { -+CMI8738-MC6.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string -diff --git a/src/conf/cards/CMI8738-MC8.conf b/src/conf/cards/CMI8738-MC8.conf -index ddff7530..96cb3f10 100644 ---- a/src/conf/cards/CMI8738-MC8.conf -+++ b/src/conf/cards/CMI8738-MC8.conf -@@ -4,7 +4,7 @@ - - - --CMI8738-MC8.pcm.front.0 { -+CMI8738-MC8.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -21,7 +21,7 @@ CMI8738-MC8.pcm.front.0 { - } - - # default with dmix+softvol & dsnoop --CMI8738-MC8.pcm.default { -+CMI8738-MC8.pcm.!default { - @args [ CARD ] - @args.CARD { - type string -@@ -53,7 +53,7 @@ CMI8738-MC8.pcm.default { - - - # 2nd DAC --CMI8738-MC8.pcm.rear.0 { -+CMI8738-MC8.pcm.rear.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -72,7 +72,7 @@ CMI8738-MC8.pcm.rear.0 { - - - --CMI8738-MC8.pcm.surround40.0 { -+CMI8738-MC8.pcm.surround40.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -110,7 +110,7 @@ CMI8738-MC8.pcm.surround40.0 { - - - --CMI8738-MC8.pcm.surround51.0 { -+CMI8738-MC8.pcm.surround51.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -144,7 +144,7 @@ CMI8738-MC8.pcm.surround51.0 { - - - --CMI8738-MC8.pcm.surround71.0 { -+CMI8738-MC8.pcm.surround71.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -178,7 +178,7 @@ CMI8738-MC8.pcm.surround71.0 { - - - --CMI8738-MC8.pcm.iec958.0 { -+CMI8738-MC8.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string -diff --git a/src/conf/cards/CMI8788.conf b/src/conf/cards/CMI8788.conf -index edcb0c9c..c4ad9f48 100644 ---- a/src/conf/cards/CMI8788.conf -+++ b/src/conf/cards/CMI8788.conf -@@ -4,7 +4,7 @@ - - - --CMI8788.pcm.front.0 { -+CMI8788.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -14,7 +14,7 @@ CMI8788.pcm.front.0 { - } - - # default with dmix & dsnoop --CMI8788.pcm.default { -+CMI8788.pcm.!default { - @args [ CARD ] - @args.CARD { - type string -@@ -38,7 +38,7 @@ CMI8788.pcm.default { - - - --CMI8788.pcm.surround40.0 { -+CMI8788.pcm.surround40.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -53,7 +53,7 @@ CMI8788.pcm.surround40.0 { - - - --CMI8788.pcm.surround51.0 { -+CMI8788.pcm.surround51.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -65,7 +65,7 @@ CMI8788.pcm.surround51.0 { - - - --CMI8788.pcm.surround71.0 { -+CMI8788.pcm.surround71.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -77,7 +77,7 @@ CMI8788.pcm.surround71.0 { - - - --CMI8788.pcm.iec958.0 { -+CMI8788.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string --- -2.51.1 - - -From 1e29ff18400e9b219159f9d0cb9aaf4be3b82efa Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 12:12:47 +0100 -Subject: [PATCH 15/43] conf: CS46xx: define pcm configuration block only one - time - -There may be multiple CS46xx soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/CS46xx.conf | 14 +++++++------- - 1 file changed, 7 insertions(+), 7 deletions(-) - -diff --git a/src/conf/cards/CS46xx.conf b/src/conf/cards/CS46xx.conf -index b71c30aa..478cbf3e 100644 ---- a/src/conf/cards/CS46xx.conf -+++ b/src/conf/cards/CS46xx.conf -@@ -4,7 +4,7 @@ - - - --CS46xx.pcm.front.0 { -+CS46xx.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -15,7 +15,7 @@ CS46xx.pcm.front.0 { - - # default with plughw - # CS46xx supports multi-playback --CS46xx.pcm.default { -+CS46xx.pcm.!default { - @args [ CARD ] - @args.CARD { - type string -@@ -39,7 +39,7 @@ CS46xx.pcm.default { - - - --CS46xx.pcm.rear.0 { -+CS46xx.pcm.rear.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -66,7 +66,7 @@ CS46xx.pcm.rear.0 { - - - --CS46xx.pcm.center_lfe.0 { -+CS46xx.pcm.center_lfe.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -78,7 +78,7 @@ CS46xx.pcm.center_lfe.0 { - - - --CS46xx.pcm.surround40.0 { -+CS46xx.pcm.surround40.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -117,7 +117,7 @@ CS46xx.pcm.surround40.0 { - - - --CS46xx.pcm.surround51.0 { -+CS46xx.pcm.surround51.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -164,7 +164,7 @@ CS46xx.pcm.surround51.0 { - - - --CS46xx.pcm.iec958.0 { -+CS46xx.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string --- -2.51.1 - - -From 0ba7c2716567875d207b71b61e1205b855c7fd9c Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 12:12:47 +0100 -Subject: [PATCH 16/43] conf: Echo3G: define pcm configuration block only one - time - -There may be multiple Echo3G soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/Echo_Echo3G.conf | 20 ++++++++++---------- - 1 file changed, 10 insertions(+), 10 deletions(-) - -diff --git a/src/conf/cards/Echo_Echo3G.conf b/src/conf/cards/Echo_Echo3G.conf -index 766f13f7..fb2a7b67 100644 ---- a/src/conf/cards/Echo_Echo3G.conf -+++ b/src/conf/cards/Echo_Echo3G.conf -@@ -3,7 +3,7 @@ - # - - --Echo_Echo3G.pcm.front.0 { -+Echo_Echo3G.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -15,7 +15,7 @@ Echo_Echo3G.pcm.front.0 { - } - - --Echo_Echo3G.pcm.rear.0 { -+Echo_Echo3G.pcm.rear.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -27,7 +27,7 @@ Echo_Echo3G.pcm.rear.0 { - } - - --Echo_Echo3G.pcm.center_lfe.0 { -+Echo_Echo3G.pcm.center_lfe.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -39,7 +39,7 @@ Echo_Echo3G.pcm.center_lfe.0 { - } - - --Echo_Echo3G.pcm.side.0 { -+Echo_Echo3G.pcm.side.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -51,7 +51,7 @@ Echo_Echo3G.pcm.side.0 { - } - - --Echo_Echo3G.pcm.surround40.0 { -+Echo_Echo3G.pcm.surround40.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -86,7 +86,7 @@ Echo_Echo3G.pcm.surround40.0 { - } - - --Echo_Echo3G.pcm.surround41.0 { -+Echo_Echo3G.pcm.surround41.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -131,7 +131,7 @@ Echo_Echo3G.pcm.surround41.0 { - } - - --Echo_Echo3G.pcm.surround50.0 { -+Echo_Echo3G.pcm.surround50.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -176,7 +176,7 @@ Echo_Echo3G.pcm.surround50.0 { - } - - --Echo_Echo3G.pcm.surround51.0 { -+Echo_Echo3G.pcm.surround51.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -222,7 +222,7 @@ Echo_Echo3G.pcm.surround51.0 { - } - - --Echo_Echo3G.pcm.surround71.0 { -+Echo_Echo3G.pcm.surround71.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -279,7 +279,7 @@ Echo_Echo3G.pcm.surround71.0 { - } - - --Echo_Echo3G.pcm.iec958.0 { -+Echo_Echo3G.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string --- -2.51.1 - - -From 8c1005624495b61919080959088dc744d6d213ea Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 16:08:42 +0100 -Subject: [PATCH 17/43] conf: Aureon51: define pcm configuration block only one - time - -There may be multiple Aureon51 soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/Aureon51.conf | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/conf/cards/Aureon51.conf b/src/conf/cards/Aureon51.conf -index 9bf34661..db907f82 100644 ---- a/src/conf/cards/Aureon51.conf -+++ b/src/conf/cards/Aureon51.conf -@@ -76,7 +76,7 @@ Aureon51.pcm.side.!0 { - - - --Aureon51.pcm.surround40.0 { -+Aureon51.pcm.surround40.!0 { - @args [ CARD ] - @args.CARD { - type string --- -2.51.1 - - -From ed4884cbe179f42a10771584ebe9fff844b90d4f Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 16:08:42 +0100 -Subject: [PATCH 18/43] conf: EMU10K1: define pcm configuration block only one - time - -There may be multiple EMU10K1 soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/EMU10K1.conf | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -diff --git a/src/conf/cards/EMU10K1.conf b/src/conf/cards/EMU10K1.conf -index 430926c7..5ef12c03 100644 ---- a/src/conf/cards/EMU10K1.conf -+++ b/src/conf/cards/EMU10K1.conf -@@ -4,7 +4,7 @@ - - - --EMU10K1.pcm.front.0 { -+EMU10K1.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -47,7 +47,7 @@ EMU10K1.pcm.front.0 { - - - --EMU10K1.pcm.rear.0 { -+EMU10K1.pcm.rear.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -78,7 +78,7 @@ EMU10K1.pcm.rear.0 { - - - --EMU10K1.pcm.center_lfe.0 { -+EMU10K1.pcm.center_lfe.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -143,7 +143,7 @@ EMU10K1.pcm.center_lfe.0 { - - - --EMU10K1.pcm.surround40.0 { -+EMU10K1.pcm.surround40.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -182,7 +182,7 @@ EMU10K1.pcm.surround40.0 { - - - --EMU10K1.pcm.surround51.0 { -+EMU10K1.pcm.surround51.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -229,7 +229,7 @@ EMU10K1.pcm.surround51.0 { - - - --EMU10K1.pcm.iec958.0 { -+EMU10K1.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string --- -2.51.1 - - -From dba724706a6eec70e52e31595b3ff1ec055bf50c Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 16:17:45 +0100 -Subject: [PATCH 19/43] conf: EMU10K1X: define pcm configuration block only one - time - -There may be multiple EMU10K1X soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/EMU10K1X.conf | 14 +++++++------- - 1 file changed, 7 insertions(+), 7 deletions(-) - -diff --git a/src/conf/cards/EMU10K1X.conf b/src/conf/cards/EMU10K1X.conf -index f7428636..334f897d 100644 ---- a/src/conf/cards/EMU10K1X.conf -+++ b/src/conf/cards/EMU10K1X.conf -@@ -3,7 +3,7 @@ - # - - # default with dmix & dsnoop --EMU10K1X.pcm.default { -+EMU10K1X.pcm.!default { - @args [ CARD ] - @args.CARD { - type string -@@ -27,7 +27,7 @@ EMU10K1X.pcm.default { - - - --EMU10K1X.pcm.front.0 { -+EMU10K1X.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -38,7 +38,7 @@ EMU10K1X.pcm.front.0 { - - - --EMU10K1X.pcm.rear.0 { -+EMU10K1X.pcm.rear.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -50,7 +50,7 @@ EMU10K1X.pcm.rear.0 { - - - --EMU10K1X.pcm.center_lfe.0 { -+EMU10K1X.pcm.center_lfe.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -62,7 +62,7 @@ EMU10K1X.pcm.center_lfe.0 { - - - --EMU10K1X.pcm.surround40.0 { -+EMU10K1X.pcm.surround40.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -101,7 +101,7 @@ EMU10K1X.pcm.surround40.0 { - - - --EMU10K1X.pcm.surround51.0 { -+EMU10K1X.pcm.surround51.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -148,7 +148,7 @@ EMU10K1X.pcm.surround51.0 { - - - --EMU10K1X.pcm.iec958.0 { -+EMU10K1X.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string --- -2.51.1 - - -From 7cf26f603823cccd3e89eb57f459642c890b79af Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 16:17:45 +0100 -Subject: [PATCH 20/43] conf: ENS137[01]: define pcm configuration block only - one time - -There may be multiple ENS137[01] soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/ENS1370.conf | 8 ++++---- - src/conf/cards/ENS1371.conf | 10 +++++----- - 2 files changed, 9 insertions(+), 9 deletions(-) - -diff --git a/src/conf/cards/ENS1370.conf b/src/conf/cards/ENS1370.conf -index 32e4782e..c65e224f 100644 ---- a/src/conf/cards/ENS1370.conf -+++ b/src/conf/cards/ENS1370.conf -@@ -4,7 +4,7 @@ - - - --ENS1370.pcm.front.0 { -+ENS1370.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -15,7 +15,7 @@ ENS1370.pcm.front.0 { - } - - # default with dmix/dsnoop --ENS1370.pcm.default { -+ENS1370.pcm.!default { - @args [ CARD ] - @args.CARD { - type string -@@ -39,7 +39,7 @@ ENS1370.pcm.default { - - - --ENS1370.pcm.rear.0 { -+ENS1370.pcm.rear.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -71,7 +71,7 @@ ENS1370.pcm.rear.0 { - - - --ENS1370.pcm.surround40.0 { -+ENS1370.pcm.surround40.!0 { - @args [ CARD ] - @args.CARD { - type string -diff --git a/src/conf/cards/ENS1371.conf b/src/conf/cards/ENS1371.conf -index a6df4251..560fda9f 100644 ---- a/src/conf/cards/ENS1371.conf -+++ b/src/conf/cards/ENS1371.conf -@@ -4,7 +4,7 @@ - - - --ENS1371.pcm.front.0 { -+ENS1371.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -14,7 +14,7 @@ ENS1371.pcm.front.0 { - } - - # default with dmix/dsnoop --ENS1371.pcm.default { -+ENS1371.pcm.!default { - @args [ CARD ] - @args.CARD { - type string -@@ -38,7 +38,7 @@ ENS1371.pcm.default { - - - --ENS1371.pcm.rear.0 { -+ENS1371.pcm.rear.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -65,7 +65,7 @@ ENS1371.pcm.rear.0 { - - - --ENS1371.pcm.surround40.0 { -+ENS1371.pcm.surround40.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -97,7 +97,7 @@ ENS1371.pcm.surround40.0 { - - - --ENS1371.pcm.iec958.0 { -+ENS1371.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string --- -2.51.1 - - -From 001a2f3809865d071b53e802d4fbc89bb37a2fe1 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 16:17:45 +0100 -Subject: [PATCH 21/43] conf: ES1968: define pcm configuration block only one - time - -There may be multiple ES1968 soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/ES1968.conf | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/conf/cards/ES1968.conf b/src/conf/cards/ES1968.conf -index a6ee1192..296baa13 100644 ---- a/src/conf/cards/ES1968.conf -+++ b/src/conf/cards/ES1968.conf -@@ -2,7 +2,7 @@ - - - --ES1968.pcm.front.0 { -+ES1968.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string --- -2.51.1 - - -From 2d5aa02738faf79895fa7457182810bee2ce7b90 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 16:17:46 +0100 -Subject: [PATCH 22/43] conf: FireWave: define pcm configuration block only one - time - -There may be multiple FireWave soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/FireWave.conf | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/src/conf/cards/FireWave.conf b/src/conf/cards/FireWave.conf -index fcfc83cc..786169f2 100644 ---- a/src/conf/cards/FireWave.conf -+++ b/src/conf/cards/FireWave.conf -@@ -2,7 +2,7 @@ - # Configuration for the Griffin FireWave Surround - # - --FireWave.pcm.default { -+FireWave.pcm.!default { - @args [ CARD ] - @args.CARD { - type string -@@ -16,7 +16,7 @@ FireWave.pcm.default { - - - --FireWave.pcm.front.0 { -+FireWave.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -30,7 +30,7 @@ FireWave.pcm.front.0 { - - - --FireWave.pcm.surround51.0 { -+FireWave.pcm.surround51.!0 { - @args [ CARD ] - @args.CARD { - type string --- -2.51.1 - - -From 9f46e1a5a48f863e38794aa5b7c350d291078924 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 16:17:46 +0100 -Subject: [PATCH 23/43] conf: FM801: define pcm configuration block only one - time - -There may be multiple FM801 soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/FM801.conf | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/src/conf/cards/FM801.conf b/src/conf/cards/FM801.conf -index 0ddf799c..14cfdbe8 100644 ---- a/src/conf/cards/FM801.conf -+++ b/src/conf/cards/FM801.conf -@@ -4,7 +4,7 @@ - - - --FM801.pcm.front.0 { -+FM801.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -14,7 +14,7 @@ FM801.pcm.front.0 { - } - - # default with dmix/dsnoop --FM801.pcm.default { -+FM801.pcm.!default { - @args [ CARD ] - @args.CARD { - type string -@@ -49,7 +49,7 @@ FM801.pcm.surround51.0 "cards.FM801.pcm.front.0" - - - --FM801.pcm.iec958.0 { -+FM801.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string --- -2.51.1 - - -From ea939799299ff88c254344c7a89e86ffa159e5a7 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 16:17:46 +0100 -Subject: [PATCH 24/43] conf: FWSpeakers: define pcm configuration block only - one time - -There may be multiple FWSpeakers soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/FWSpeakers.conf | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/conf/cards/FWSpeakers.conf b/src/conf/cards/FWSpeakers.conf -index cd6fa605..96ab5cb9 100644 ---- a/src/conf/cards/FWSpeakers.conf -+++ b/src/conf/cards/FWSpeakers.conf -@@ -2,7 +2,7 @@ - # Configuration for the LaCie Firewire speakers - # - --FWSpeakers.pcm.default { -+FWSpeakers.pcm.!default { - @args [ CARD ] - @args.CARD { - type string -@@ -16,7 +16,7 @@ FWSpeakers.pcm.default { - - - --FWSpeakers.pcm.front.0 { -+FWSpeakers.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string --- -2.51.1 - - -From a87570df7247d979eb5106ca549fa776e4c51ab3 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 16:17:47 +0100 -Subject: [PATCH 25/43] conf: GUS: define pcm configuration block only one time - -There may be multiple GUS soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/GUS.conf | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/conf/cards/GUS.conf b/src/conf/cards/GUS.conf -index d744c548..a1ccd0e9 100644 ---- a/src/conf/cards/GUS.conf -+++ b/src/conf/cards/GUS.conf -@@ -4,7 +4,7 @@ - - - --GUS.pcm.front.0 { -+GUS.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string --- -2.51.1 - - -From dded72a687e8e8210b276ab13f4e26b63bfa782b Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 16:17:47 +0100 -Subject: [PATCH 26/43] conf: HdmiLpeAudio: define pcm configuration block only - one time - -There may be multiple HdmiLpeAudio soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/HdmiLpeAudio.conf | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/src/conf/cards/HdmiLpeAudio.conf b/src/conf/cards/HdmiLpeAudio.conf -index a9104f43..799946a2 100644 ---- a/src/conf/cards/HdmiLpeAudio.conf -+++ b/src/conf/cards/HdmiLpeAudio.conf -@@ -2,7 +2,7 @@ - # Configuration for the Intel HDMI/DP LPE audio - # - --HdmiLpeAudio.pcm.hdmi.0 { -+HdmiLpeAudio.pcm.hdmi.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string -@@ -39,7 +39,7 @@ HdmiLpeAudio.pcm.hdmi.0 { - } - } - --HdmiLpeAudio.pcm.hdmi.1 { -+HdmiLpeAudio.pcm.hdmi.!1 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string -@@ -77,7 +77,7 @@ HdmiLpeAudio.pcm.hdmi.1 { - } - } - --HdmiLpeAudio.pcm.hdmi.2 { -+HdmiLpeAudio.pcm.hdmi.!2 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string --- -2.51.1 - - -From 1f52b57ff8f023b396b459407e60d8498c69f6e7 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 16:17:57 +0100 -Subject: [PATCH 27/43] conf: ICE17[12][24]: define pcm configuration block - only one time - -There may be multiple ICE17[12][24] soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/ICE1712.conf | 12 ++++++------ - src/conf/cards/ICE1724.conf | 18 +++++++++--------- - 2 files changed, 15 insertions(+), 15 deletions(-) - -diff --git a/src/conf/cards/ICE1712.conf b/src/conf/cards/ICE1712.conf -index db62684e..190d2c59 100644 ---- a/src/conf/cards/ICE1712.conf -+++ b/src/conf/cards/ICE1712.conf -@@ -3,7 +3,7 @@ - # - - # default with dmix & dsnoop --ICE1712.pcm.default { -+ICE1712.pcm.!default { - @args [ CARD ] - @args.CARD { - type string -@@ -27,7 +27,7 @@ ICE1712.pcm.default { - - - --ICE1712.pcm.front.0 { -+ICE1712.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -57,7 +57,7 @@ ICE1712.pcm.front.0 { - - - --ICE1712.pcm.surround40.0 { -+ICE1712.pcm.surround40.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -80,7 +80,7 @@ ICE1712.pcm.surround40.0 { - - - --ICE1712.pcm.surround51.0 { -+ICE1712.pcm.surround51.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -99,7 +99,7 @@ ICE1712.pcm.surround51.0 { - slave.channels 10 - } - --ICE1712.pcm.surround71.0 { -+ICE1712.pcm.surround71.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -122,7 +122,7 @@ ICE1712.pcm.surround71.0 { - - - --ICE1712.pcm.iec958.0 { -+ICE1712.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string -diff --git a/src/conf/cards/ICE1724.conf b/src/conf/cards/ICE1724.conf -index 61cac013..16045dc4 100644 ---- a/src/conf/cards/ICE1724.conf -+++ b/src/conf/cards/ICE1724.conf -@@ -3,7 +3,7 @@ - # - - # default with dmix & dsnoop --ICE1724.pcm.default { -+ICE1724.pcm.!default { - @args [ CARD ] - @args.CARD { - type string -@@ -27,7 +27,7 @@ ICE1724.pcm.default { - - - --ICE1724.pcm.front.0 { -+ICE1724.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -38,7 +38,7 @@ ICE1724.pcm.front.0 { - - - --ICE1724.pcm.rear.0 { -+ICE1724.pcm.rear.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -51,7 +51,7 @@ ICE1724.pcm.rear.0 { - - - --ICE1724.pcm.center_lfe.0 { -+ICE1724.pcm.center_lfe.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -63,7 +63,7 @@ ICE1724.pcm.center_lfe.0 { - - - --ICE1724.pcm.side.0 { -+ICE1724.pcm.side.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -76,7 +76,7 @@ ICE1724.pcm.side.0 { - - - --ICE1724.pcm.surround40.0 { -+ICE1724.pcm.surround40.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -100,7 +100,7 @@ ICE1724.pcm.surround40.0 { - - - --ICE1724.pcm.surround51.0 { -+ICE1724.pcm.surround51.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -123,7 +123,7 @@ ICE1724.pcm.surround51.0 { - - - --ICE1724.pcm.surround71.0 { -+ICE1724.pcm.surround71.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -148,7 +148,7 @@ ICE1724.pcm.surround71.0 { - - - --ICE1724.pcm.iec958.0 { -+ICE1724.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string --- -2.51.1 - - -From 99f1987a1e864523a7a423f1840ca6a76045d619 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 16:17:57 +0100 -Subject: [PATCH 28/43] conf: ICH,ICH4,ICH-MODEM: define pcm configuration - block only one time - -There may be multiple ICH soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/ICH-MODEM.conf | 2 +- - src/conf/cards/ICH.conf | 10 +++++----- - src/conf/cards/ICH4.conf | 10 +++++----- - 3 files changed, 11 insertions(+), 11 deletions(-) - -diff --git a/src/conf/cards/ICH-MODEM.conf b/src/conf/cards/ICH-MODEM.conf -index b96b5aaf..855f3a96 100644 ---- a/src/conf/cards/ICH-MODEM.conf -+++ b/src/conf/cards/ICH-MODEM.conf -@@ -4,7 +4,7 @@ - - - --ICH-MODEM.pcm.modem.0 { -+ICH-MODEM.pcm.modem.!0 { - @args [ CARD ] - @args.CARD { - type string -diff --git a/src/conf/cards/ICH.conf b/src/conf/cards/ICH.conf -index 6fc9a5a2..c35c8d02 100644 ---- a/src/conf/cards/ICH.conf -+++ b/src/conf/cards/ICH.conf -@@ -4,7 +4,7 @@ - - - --ICH.pcm.front.0 { -+ICH.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -21,7 +21,7 @@ ICH.pcm.front.0 { - } - - # default with dmix+softvol & dsnoop --ICH.pcm.default { -+ICH.pcm.!default { - @args [ CARD ] - @args.CARD { - type string -@@ -52,7 +52,7 @@ ICH.pcm.default { - - - --ICH.pcm.surround40.0 { -+ICH.pcm.surround40.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -103,7 +103,7 @@ ICH.pcm.surround40.0 { - - - --ICH.pcm.surround51.0 { -+ICH.pcm.surround51.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -174,7 +174,7 @@ ICH.pcm.surround51.0 { - - - --ICH.pcm.iec958.0 { -+ICH.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string -diff --git a/src/conf/cards/ICH4.conf b/src/conf/cards/ICH4.conf -index 64ec883d..11c85a6e 100644 ---- a/src/conf/cards/ICH4.conf -+++ b/src/conf/cards/ICH4.conf -@@ -4,7 +4,7 @@ - - - --ICH4.pcm.front.0 { -+ICH4.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -21,7 +21,7 @@ ICH4.pcm.front.0 { - } - - # default with dmix+softvol & dsnoop --ICH4.pcm.default { -+ICH4.pcm.!default { - @args [ CARD ] - @args.CARD { - type string -@@ -52,7 +52,7 @@ ICH4.pcm.default { - - - --ICH4.pcm.surround40.0 { -+ICH4.pcm.surround40.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -103,7 +103,7 @@ ICH4.pcm.surround40.0 { - - - --ICH4.pcm.surround51.0 { -+ICH4.pcm.surround51.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -164,7 +164,7 @@ ICH4.pcm.surround51.0 { - - - --ICH4.pcm.iec958.0 { -+ICH4.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string --- -2.51.1 - - -From ff4fb7f8c98157010c44f7335a32a09e9fc085d6 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 16:17:57 +0100 -Subject: [PATCH 29/43] conf: Loopback: define pcm configuration block only one - time - -There may be multiple Loopback soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/Loopback.conf | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/conf/cards/Loopback.conf b/src/conf/cards/Loopback.conf -index 1ae6d453..21c8429c 100644 ---- a/src/conf/cards/Loopback.conf -+++ b/src/conf/cards/Loopback.conf -@@ -4,7 +4,7 @@ - - - --Loopback.pcm.front.0 { -+Loopback.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -21,7 +21,7 @@ Loopback.pcm.front.0 { - } - - # default with dmix+softvol & dsnoop --Loopback.pcm.default { -+Loopback.pcm.!default { - @args [ CARD ] - @args.CARD { - type string --- -2.51.1 - - -From de72d657281c043c8d48d23cb8da9b1c4c5f31de Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 16:17:57 +0100 -Subject: [PATCH 30/43] conf: Maestro3: define pcm configuration block only one - time - -There may be multiple Maestro3 soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/Maestro3.conf | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/conf/cards/Maestro3.conf b/src/conf/cards/Maestro3.conf -index 94323227..a8d89a48 100644 ---- a/src/conf/cards/Maestro3.conf -+++ b/src/conf/cards/Maestro3.conf -@@ -2,7 +2,7 @@ - - - --Maestro3.pcm.front.0 { -+Maestro3.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -12,7 +12,7 @@ Maestro3.pcm.front.0 { - } - - # default with dmix/dsnoop --Maestro3.pcm.default { -+Maestro3.pcm.!default { - @args [ CARD ] - @args.CARD { - type string --- -2.51.1 - - -From ebb5ab7d846e2702640a7d754127083412b15816 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 16:18:06 +0100 -Subject: [PATCH 31/43] conf: NFORCE: define pcm configuration block only one - time - -There may be multiple NFORCE soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/NFORCE.conf | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -diff --git a/src/conf/cards/NFORCE.conf b/src/conf/cards/NFORCE.conf -index 64d15479..088cd8ce 100644 ---- a/src/conf/cards/NFORCE.conf -+++ b/src/conf/cards/NFORCE.conf -@@ -4,7 +4,7 @@ - - - --NFORCE.pcm.front.0 { -+NFORCE.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -21,7 +21,7 @@ NFORCE.pcm.front.0 { - } - - # default with dmix+softvol & dsnoop --NFORCE.pcm.default { -+NFORCE.pcm.!default { - @args [ CARD ] - @args.CARD { - type string -@@ -52,7 +52,7 @@ NFORCE.pcm.default { - - - --NFORCE.pcm.surround40.0 { -+NFORCE.pcm.surround40.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -103,7 +103,7 @@ NFORCE.pcm.surround40.0 { - - - --NFORCE.pcm.surround51.0 { -+NFORCE.pcm.surround51.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -174,7 +174,7 @@ NFORCE.pcm.surround51.0 { - - - --NFORCE.pcm.surround71.0 { -+NFORCE.pcm.surround71.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -247,7 +247,7 @@ NFORCE.pcm.surround71.0 { - - - --NFORCE.pcm.iec958.0 { -+NFORCE.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string --- -2.51.1 - - -From 3d636ff5309e3672c0acc784c9539af4396d2dfb Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 16:18:06 +0100 -Subject: [PATCH 32/43] conf: PC-Speaker: define pcm configuration block only - one time - -There may be multiple PC-Speaker soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/PC-Speaker.conf | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/conf/cards/PC-Speaker.conf b/src/conf/cards/PC-Speaker.conf -index c82654d8..8a40a139 100644 ---- a/src/conf/cards/PC-Speaker.conf -+++ b/src/conf/cards/PC-Speaker.conf -@@ -4,7 +4,7 @@ - - - --PC-Speaker.pcm.front.0 { -+PC-Speaker.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -23,7 +23,7 @@ PC-Speaker.pcm.front.0 { - } - - # default with dmix & null --PC-Speaker.pcm.default { -+PC-Speaker.pcm.!default { - @args [ CARD ] - @args.CARD { - type string --- -2.51.1 - - -From a3028a492a641d5077640294d1fb655c4b4aa84a Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 16:18:06 +0100 -Subject: [PATCH 33/43] conf: PMac,PMacToonie: define pcm configuration block - only one time - -There may be multiple PMac soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/PMac.conf | 4 ++-- - src/conf/cards/PMacToonie.conf | 4 ++-- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/src/conf/cards/PMac.conf b/src/conf/cards/PMac.conf -index d1fdb17b..00f3bc89 100644 ---- a/src/conf/cards/PMac.conf -+++ b/src/conf/cards/PMac.conf -@@ -4,7 +4,7 @@ - - - --PMac.pcm.front.0 { -+PMac.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -14,7 +14,7 @@ PMac.pcm.front.0 { - } - - # default with dmix/dsnoop --PMac.pcm.default { -+PMac.pcm.!default { - @args [ CARD ] - @args.CARD { - type string -diff --git a/src/conf/cards/PMacToonie.conf b/src/conf/cards/PMacToonie.conf -index 1e0eb59c..aff1ea65 100644 ---- a/src/conf/cards/PMacToonie.conf -+++ b/src/conf/cards/PMacToonie.conf -@@ -4,7 +4,7 @@ - - - --PMacToonie.pcm.front.0 { -+PMacToonie.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -21,7 +21,7 @@ PMacToonie.pcm.front.0 { - } - - # default with dmix+softvol & dsnoop --PMacToonie.pcm.default { -+PMacToonie.pcm.!default { - @args [ CARD ] - @args.CARD { - type string --- -2.51.1 - - -From 8340b3c6b31a4e4c02f69bf36f3958d390c724b9 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 16:18:06 +0100 -Subject: [PATCH 34/43] conf: PS3: define pcm configuration block only one time - -There may be multiple PS3 soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/PS3.conf | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/src/conf/cards/PS3.conf b/src/conf/cards/PS3.conf -index b642f0dc..486d790c 100644 ---- a/src/conf/cards/PS3.conf -+++ b/src/conf/cards/PS3.conf -@@ -4,7 +4,7 @@ - - - --PS3.pcm.front.0 { -+PS3.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -22,7 +22,7 @@ PS3.pcm.front.0 { - } - - # default with dmix+softvol --PS3.pcm.default { -+PS3.pcm.!default { - @args [ CARD ] - @args.CARD { - type string -@@ -47,7 +47,7 @@ PS3.pcm.default { - - - --PS3.pcm.iec958.0 { -+PS3.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string --- -2.51.1 - - -From f03528daf2ee177d2003b4d40824506f3a3558f4 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 16:18:15 +0100 -Subject: [PATCH 35/43] conf: RME96[35][26]: define pcm configuration block - only one time - -There may be multiple RME96[35][26] soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/RME9636.conf | 4 ++-- - src/conf/cards/RME9652.conf | 4 ++-- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/src/conf/cards/RME9636.conf b/src/conf/cards/RME9636.conf -index e8dc5fad..17b3a1ab 100644 ---- a/src/conf/cards/RME9636.conf -+++ b/src/conf/cards/RME9636.conf -@@ -4,7 +4,7 @@ - - - --RME9636.pcm.front.0 { -+RME9636.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -17,7 +17,7 @@ RME9636.pcm.front.0 { - - - --RME9636.pcm.iec958.0 { -+RME9636.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string -diff --git a/src/conf/cards/RME9652.conf b/src/conf/cards/RME9652.conf -index 1147d810..a11e42b2 100644 ---- a/src/conf/cards/RME9652.conf -+++ b/src/conf/cards/RME9652.conf -@@ -4,7 +4,7 @@ - - - --RME9652.pcm.front.0 { -+RME9652.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -17,7 +17,7 @@ RME9652.pcm.front.0 { - - - --RME9652.pcm.iec958.0 { -+RME9652.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string --- -2.51.1 - - -From 1cd87775c5d9d46e418dc67a4d9c93fe5104ee3f Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 16:18:15 +0100 -Subject: [PATCH 36/43] conf: SB-XFi: define pcm configuration block only one - time - -There may be multiple SB-XFi soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/SB-XFi.conf | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/src/conf/cards/SB-XFi.conf b/src/conf/cards/SB-XFi.conf -index eb2218bf..9ce9c8ac 100644 ---- a/src/conf/cards/SB-XFi.conf -+++ b/src/conf/cards/SB-XFi.conf -@@ -4,7 +4,7 @@ - - - --SB-XFi.pcm.front.0 { -+SB-XFi.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -16,7 +16,7 @@ SB-XFi.pcm.front.0 { - - - --SB-XFi.pcm.rear.0 { -+SB-XFi.pcm.rear.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -29,7 +29,7 @@ SB-XFi.pcm.rear.0 { - - - --SB-XFi.pcm.center_lfe.0 { -+SB-XFi.pcm.center_lfe.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -42,7 +42,7 @@ SB-XFi.pcm.center_lfe.0 { - - - --SB-XFi.pcm.side.0 { -+SB-XFi.pcm.side.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -66,7 +66,7 @@ SB-XFi.pcm.surround71.0 cards.SB-XFi.pcm.front.0 - - - --SB-XFi.pcm.iec958.0 { -+SB-XFi.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string --- -2.51.1 - - -From 51d75e5f072698d6ec03957cf87b735117f05ab4 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 16:18:15 +0100 -Subject: [PATCH 37/43] conf: SI7018: define pcm configuration block only one - time - -There may be multiple SI7018 soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/SI7018.conf | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/src/conf/cards/SI7018.conf b/src/conf/cards/SI7018.conf -index 02b8fc87..33d19085 100644 ---- a/src/conf/cards/SI7018.conf -+++ b/src/conf/cards/SI7018.conf -@@ -6,7 +6,7 @@ - - - --SI7018.pcm.front.0 { -+SI7018.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -18,7 +18,7 @@ SI7018.pcm.front.0 { - - - --SI7018.pcm.rear.0 { -+SI7018.pcm.rear.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -44,7 +44,7 @@ SI7018.pcm.rear.0 { - - - --SI7018.pcm.surround40.0 { -+SI7018.pcm.surround40.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -83,7 +83,7 @@ SI7018.pcm.surround40.0 { - - - --SI7018.pcm.surround51.0 { -+SI7018.pcm.surround51.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -130,7 +130,7 @@ SI7018.pcm.surround51.0 { - - - --SI7018.pcm.iec958.0 { -+SI7018.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string --- -2.51.1 - - -From 4c74f3a568583744dddab01e4cce5a2e8f207067 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 16:18:15 +0100 -Subject: [PATCH 38/43] conf: TRID4DWAVENX: define pcm configuration block only - one time - -There may be multiple TRID4DWAVENX soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/TRID4DWAVENX.conf | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/src/conf/cards/TRID4DWAVENX.conf b/src/conf/cards/TRID4DWAVENX.conf -index 717b1408..5001297e 100644 ---- a/src/conf/cards/TRID4DWAVENX.conf -+++ b/src/conf/cards/TRID4DWAVENX.conf -@@ -4,7 +4,7 @@ - - - --TRID4DWAVENX.pcm.front.0 { -+TRID4DWAVENX.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -16,7 +16,7 @@ TRID4DWAVENX.pcm.front.0 { - - - --TRID4DWAVENX.pcm.rear.0 { -+TRID4DWAVENX.pcm.rear.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -56,7 +56,7 @@ TRID4DWAVENX.pcm.rear.0 { - - - --TRID4DWAVENX.pcm.surround40.0 { -+TRID4DWAVENX.pcm.surround40.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -92,7 +92,7 @@ TRID4DWAVENX.pcm.surround40.0 { - - - --TRID4DWAVENX.pcm.iec958.0 { -+TRID4DWAVENX.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string --- -2.51.1 - - -From d6b9d7e0bef5ca8a019881b06de7183528ec5bd5 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 16:18:22 +0100 -Subject: [PATCH 39/43] conf: VIA686A,VIA82xx: define pcm configuration block - only one time - -There may be multiple VIA soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/VIA686A.conf | 6 +++--- - src/conf/cards/VIA8233.conf | 10 +++++----- - src/conf/cards/VIA8233A.conf | 10 +++++----- - src/conf/cards/VIA8237.conf | 10 +++++----- - 4 files changed, 18 insertions(+), 18 deletions(-) - -diff --git a/src/conf/cards/VIA686A.conf b/src/conf/cards/VIA686A.conf -index e4a06f23..c53dd71b 100644 ---- a/src/conf/cards/VIA686A.conf -+++ b/src/conf/cards/VIA686A.conf -@@ -7,7 +7,7 @@ - - - --VIA686A.pcm.front.0 { -+VIA686A.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -17,7 +17,7 @@ VIA686A.pcm.front.0 { - } - - # default with dmix/dsnoop --VIA686A.pcm.default { -+VIA686A.pcm.!default { - @args [ CARD ] - @args.CARD { - type string -@@ -41,7 +41,7 @@ VIA686A.pcm.default { - - - --VIA686A.pcm.iec958.0 { -+VIA686A.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string -diff --git a/src/conf/cards/VIA8233.conf b/src/conf/cards/VIA8233.conf -index 9ad321f7..3c25a11b 100644 ---- a/src/conf/cards/VIA8233.conf -+++ b/src/conf/cards/VIA8233.conf -@@ -4,7 +4,7 @@ - - - --VIA8233.pcm.front.0 { -+VIA8233.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -15,7 +15,7 @@ VIA8233.pcm.front.0 { - - # default with softvol/dsnoop - # VIA8233 supports multi-playback --VIA8233.pcm.default { -+VIA8233.pcm.!default { - @args [ CARD ] - @args.CARD { - type string -@@ -46,7 +46,7 @@ VIA8233.pcm.default { - - - --VIA8233.pcm.surround40.0 { -+VIA8233.pcm.surround40.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -91,7 +91,7 @@ VIA8233.pcm.surround40.0 { - - - --VIA8233.pcm.surround51.0 { -+VIA8233.pcm.surround51.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -146,7 +146,7 @@ VIA8233.pcm.surround51.0 { - - - --VIA8233.pcm.iec958.0 { -+VIA8233.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string -diff --git a/src/conf/cards/VIA8233A.conf b/src/conf/cards/VIA8233A.conf -index 679fccf3..c9e56e20 100644 ---- a/src/conf/cards/VIA8233A.conf -+++ b/src/conf/cards/VIA8233A.conf -@@ -4,7 +4,7 @@ - - - --VIA8233A.pcm.front.0 { -+VIA8233A.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -14,7 +14,7 @@ VIA8233A.pcm.front.0 { - } - - # default with dmix/dsnoop --VIA8233A.pcm.default { -+VIA8233A.pcm.!default { - @args [ CARD ] - @args.CARD { - type string -@@ -38,7 +38,7 @@ VIA8233A.pcm.default { - - - --VIA8233A.pcm.surround40.0 { -+VIA8233A.pcm.surround40.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -89,7 +89,7 @@ VIA8233A.pcm.surround40.0 { - - - --VIA8233A.pcm.surround51.0 { -+VIA8233A.pcm.surround51.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -150,7 +150,7 @@ VIA8233A.pcm.surround51.0 { - - - --VIA8233A.pcm.iec958.0 { -+VIA8233A.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string -diff --git a/src/conf/cards/VIA8237.conf b/src/conf/cards/VIA8237.conf -index 29d8e00f..49fd6f2c 100644 ---- a/src/conf/cards/VIA8237.conf -+++ b/src/conf/cards/VIA8237.conf -@@ -4,7 +4,7 @@ - - - --VIA8237.pcm.front.0 { -+VIA8237.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -15,7 +15,7 @@ VIA8237.pcm.front.0 { - - # default with softvol/dsnoop - # VIA8237 supports multi-playback --VIA8237.pcm.default { -+VIA8237.pcm.!default { - @args [ CARD ] - @args.CARD { - type string -@@ -46,7 +46,7 @@ VIA8237.pcm.default { - - - --VIA8237.pcm.surround40.0 { -+VIA8237.pcm.surround40.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -84,7 +84,7 @@ VIA8237.pcm.surround40.0 { - - - --VIA8237.pcm.surround51.0 { -+VIA8237.pcm.surround51.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -136,7 +136,7 @@ VIA8237.pcm.surround51.0 { - - - --VIA8237.pcm.iec958.0 { -+VIA8237.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string --- -2.51.1 - - -From 4bcd33ef9dc6d8439cc6573575907ecf89271fe2 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 16:18:22 +0100 -Subject: [PATCH 40/43] conf: VX222,VXPocket: define pcm configuration block - only one time - -There may be multiple VX soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/VX222.conf | 4 ++-- - src/conf/cards/VXPocket.conf | 4 ++-- - src/conf/cards/VXPocket440.conf | 8 ++++---- - 3 files changed, 8 insertions(+), 8 deletions(-) - -diff --git a/src/conf/cards/VX222.conf b/src/conf/cards/VX222.conf -index 3385f25b..2c6e2297 100644 ---- a/src/conf/cards/VX222.conf -+++ b/src/conf/cards/VX222.conf -@@ -4,7 +4,7 @@ - - - --VX222.pcm.front.0 { -+VX222.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -15,7 +15,7 @@ VX222.pcm.front.0 { - - - --VX222.pcm.iec958.0 { -+VX222.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string -diff --git a/src/conf/cards/VXPocket.conf b/src/conf/cards/VXPocket.conf -index fe44ff53..90b13347 100644 ---- a/src/conf/cards/VXPocket.conf -+++ b/src/conf/cards/VXPocket.conf -@@ -4,7 +4,7 @@ - - - --VXPocket.pcm.front.0 { -+VXPocket.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -15,7 +15,7 @@ VXPocket.pcm.front.0 { - - - --VXPocket.pcm.iec958.0 { -+VXPocket.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string -diff --git a/src/conf/cards/VXPocket440.conf b/src/conf/cards/VXPocket440.conf -index 197c2d6c..87a0855a 100644 ---- a/src/conf/cards/VXPocket440.conf -+++ b/src/conf/cards/VXPocket440.conf -@@ -4,7 +4,7 @@ - - - --VXPocket440.pcm.front.0 { -+VXPocket440.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -15,7 +15,7 @@ VXPocket440.pcm.front.0 { - - - --VXPocket440.pcm.rear.0 { -+VXPocket440.pcm.rear.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -27,7 +27,7 @@ VXPocket440.pcm.rear.0 { - - - --VXPocket440.pcm.surround40.0 { -+VXPocket440.pcm.surround40.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -64,7 +64,7 @@ VXPocket440.pcm.surround40.0 { - - - --VXPocket440.pcm.iec958.0 { -+VXPocket440.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string --- -2.51.1 - - -From 29fa26b4b5e0d3b7ab539b38d6604d83430bf70b Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 16:18:22 +0100 -Subject: [PATCH 41/43] conf: YMF744: define pcm configuration block only one - time - -There may be multiple YMF744 soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/YMF744.conf | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/src/conf/cards/YMF744.conf b/src/conf/cards/YMF744.conf -index 84dbcbec..ad1f2132 100644 ---- a/src/conf/cards/YMF744.conf -+++ b/src/conf/cards/YMF744.conf -@@ -4,7 +4,7 @@ - - - --YMF744.pcm.front.0 { -+YMF744.pcm.front.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -15,7 +15,7 @@ YMF744.pcm.front.0 { - - - --YMF744.pcm.rear.0 { -+YMF744.pcm.rear.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -27,7 +27,7 @@ YMF744.pcm.rear.0 { - - - --YMF744.pcm.surround40.0 { -+YMF744.pcm.surround40.!0 { - @args [ CARD ] - @args.CARD { - type string -@@ -63,7 +63,7 @@ YMF744.pcm.surround40.0 { - - - --YMF744.pcm.iec958.0 { -+YMF744.pcm.iec958.!0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string --- -2.51.1 - - -From 17ffe17f0356f333f8bf8734a02ab419bd19cd99 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 16:25:34 +0100 -Subject: [PATCH 42/43] conf: pistachio-card: define pcm configuration block - only one time - -There may be multiple pistachio-card soundcards in the system. Overwrite -the PCM configurations when loaded multiple times. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/pistachio-card.conf | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/conf/cards/pistachio-card.conf b/src/conf/cards/pistachio-card.conf -index f68865eb..15cfd60b 100644 ---- a/src/conf/cards/pistachio-card.conf -+++ b/src/conf/cards/pistachio-card.conf -@@ -29,7 +29,7 @@ https://docs.creatordev.io/ci40/guides/hardwaredocs/MIPS_Creator_cXT200_Technica - # Subdevice #0: subdevice #0 - # - --pistachio-card.pcm.default{ -+pistachio-card.pcm.!default { - @args [ CARD ] - @args.CARD { - type string --- -2.51.1 - - -From f30c355278cf9c86420b49ab9efc7eee890b658c Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 10 Dec 2025 16:44:12 +0100 -Subject: [PATCH 43/43] conf: cards: unify whitespace - use tabs and remove - trailing spaces - -Convert leading spaces to tabs for consistent indentation, -remove trailing whitespace from all lines, and normalize -file endings across all card configuration files. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/cards/AACI.conf | 2 +- - src/conf/cards/ATIIXP-SPDMA.conf | 2 +- - src/conf/cards/ATIIXP.conf | 2 +- - src/conf/cards/AU8810.conf | 2 +- - src/conf/cards/AU8820.conf | 2 +- - src/conf/cards/AU8830.conf | 2 +- - src/conf/cards/Audigy.conf | 6 +- - src/conf/cards/Audigy2.conf | 4 +- - src/conf/cards/Aureon51.conf | 8 +- - src/conf/cards/Aureon71.conf | 8 +- - src/conf/cards/CA0106.conf | 8 +- - src/conf/cards/CMI8338-SWIEC.conf | 2 +- - src/conf/cards/CMI8338.conf | 2 +- - src/conf/cards/CMI8738-MC6.conf | 6 +- - src/conf/cards/CMI8738-MC8.conf | 8 +- - src/conf/cards/CMI8788.conf | 8 +- - src/conf/cards/CS46xx.conf | 6 +- - src/conf/cards/EMU10K1.conf | 6 +- - src/conf/cards/EMU10K1X.conf | 6 +- - src/conf/cards/ENS1370.conf | 4 +- - src/conf/cards/ENS1371.conf | 10 +-- - src/conf/cards/ES1968.conf | 2 +- - src/conf/cards/FM801.conf | 2 +- - src/conf/cards/GUS.conf | 2 +- - src/conf/cards/HDA-Intel.conf | 2 +- - src/conf/cards/ICE1712.conf | 4 +- - src/conf/cards/ICE1724.conf | 10 +-- - src/conf/cards/ICH.conf | 2 +- - src/conf/cards/ICH4.conf | 2 +- - src/conf/cards/Loopback.conf | 2 +- - src/conf/cards/Maestro3.conf | 3 +- - src/conf/cards/NFORCE.conf | 138 ++++++++++++++--------------- - src/conf/cards/PC-Speaker.conf | 3 +- - src/conf/cards/PMac.conf | 2 +- - src/conf/cards/PMacToonie.conf | 2 +- - src/conf/cards/PS3.conf | 6 +- - src/conf/cards/RME9636.conf | 2 +- - src/conf/cards/RME9652.conf | 2 +- - src/conf/cards/SB-XFi.conf | 8 +- - src/conf/cards/SI7018.conf | 6 +- - src/conf/cards/TRID4DWAVENX.conf | 4 +- - src/conf/cards/USB-Audio.conf | 2 +- - src/conf/cards/VIA686A.conf | 2 +- - src/conf/cards/VIA8233.conf | 2 +- - src/conf/cards/VIA8233A.conf | 2 +- - src/conf/cards/VIA8237.conf | 2 +- - src/conf/cards/VX222.conf | 2 +- - src/conf/cards/VXPocket.conf | 2 +- - src/conf/cards/VXPocket440.conf | 2 +- - src/conf/cards/YMF744.conf | 4 +- - src/conf/cards/pistachio-card.conf | 54 +++++------ - 51 files changed, 190 insertions(+), 192 deletions(-) - -diff --git a/src/conf/cards/AACI.conf b/src/conf/cards/AACI.conf -index ff4778b4..2f036dd6 100644 ---- a/src/conf/cards/AACI.conf -+++ b/src/conf/cards/AACI.conf -@@ -11,7 +11,7 @@ AACI.pcm.front.!0 { - } - type hw - card $CARD --} -+} - - - -diff --git a/src/conf/cards/ATIIXP-SPDMA.conf b/src/conf/cards/ATIIXP-SPDMA.conf -index 12c40efc..6d7344e8 100644 ---- a/src/conf/cards/ATIIXP-SPDMA.conf -+++ b/src/conf/cards/ATIIXP-SPDMA.conf -@@ -11,7 +11,7 @@ ATIIXP-SPDMA.pcm.front.!0 { - } - type hw - card $CARD --} -+} - - # default with dmix/dsnoop - ATIIXP.pcm.!default { -diff --git a/src/conf/cards/ATIIXP.conf b/src/conf/cards/ATIIXP.conf -index 13e01c48..d2736c3c 100644 ---- a/src/conf/cards/ATIIXP.conf -+++ b/src/conf/cards/ATIIXP.conf -@@ -11,7 +11,7 @@ ATIIXP.pcm.front.!0 { - } - type hw - card $CARD --} -+} - - # default with dmix/dsnoop - ATIIXP.pcm.!default { -diff --git a/src/conf/cards/AU8810.conf b/src/conf/cards/AU8810.conf -index 6b596b68..46de6dbc 100644 ---- a/src/conf/cards/AU8810.conf -+++ b/src/conf/cards/AU8810.conf -@@ -11,7 +11,7 @@ AU8810.pcm.front.!0 { - } - type hw - card $CARD --} -+} - - - -diff --git a/src/conf/cards/AU8820.conf b/src/conf/cards/AU8820.conf -index fe2cbc11..8e262a6f 100644 ---- a/src/conf/cards/AU8820.conf -+++ b/src/conf/cards/AU8820.conf -@@ -11,4 +11,4 @@ AU8820.pcm.front.!0 { - } - type hw - card $CARD --} -+} -diff --git a/src/conf/cards/AU8830.conf b/src/conf/cards/AU8830.conf -index 9cd78b3e..a31d8a57 100644 ---- a/src/conf/cards/AU8830.conf -+++ b/src/conf/cards/AU8830.conf -@@ -11,7 +11,7 @@ AU8830.pcm.front.!0 { - } - type hw - card $CARD --} -+} - - - -diff --git a/src/conf/cards/Audigy.conf b/src/conf/cards/Audigy.conf -index a353c624..d2b54d3b 100644 ---- a/src/conf/cards/Audigy.conf -+++ b/src/conf/cards/Audigy.conf -@@ -36,7 +36,7 @@ Audigy.pcm.front.!0 { - } - ] - } --} -+} - - - -@@ -64,7 +64,7 @@ Audigy.pcm.rear.!0 { - } - ] - } --} -+} - - - -@@ -100,7 +100,7 @@ Audigy.pcm.center_lfe.!0 { - } - ] - } --} -+} - - - -diff --git a/src/conf/cards/Audigy2.conf b/src/conf/cards/Audigy2.conf -index 3c15fd1d..47d75680 100644 ---- a/src/conf/cards/Audigy2.conf -+++ b/src/conf/cards/Audigy2.conf -@@ -37,7 +37,7 @@ Audigy2.pcm.front.!0 { - - ] - } --} -+} - - - -@@ -65,7 +65,7 @@ Audigy2.pcm.rear.!0 { - } - ] - } --} -+} - - - -diff --git a/src/conf/cards/Aureon51.conf b/src/conf/cards/Aureon51.conf -index db907f82..da7e26dc 100644 ---- a/src/conf/cards/Aureon51.conf -+++ b/src/conf/cards/Aureon51.conf -@@ -34,7 +34,7 @@ Aureon51.pcm.front.!0 { - } - type hw - card $CARD --} -+} - - - -@@ -47,7 +47,7 @@ Aureon51.pcm.rear.!0 { - card $CARD - device 2 - subdevice 1 --} -+} - - - -@@ -59,7 +59,7 @@ Aureon51.pcm.center_lfe.!0 { - type hw - card $CARD - device 2 --} -+} - - - -@@ -84,7 +84,7 @@ Aureon51.pcm.surround40.!0 { - type hw - card $CARD - channels 4 --} -+} - - - -diff --git a/src/conf/cards/Aureon71.conf b/src/conf/cards/Aureon71.conf -index f29bc297..98e65ab0 100644 ---- a/src/conf/cards/Aureon71.conf -+++ b/src/conf/cards/Aureon71.conf -@@ -34,7 +34,7 @@ Aureon71.pcm.front.!0 { - } - type hw - card $CARD --} -+} - - - -@@ -46,7 +46,7 @@ Aureon71.pcm.rear.!0 { - type hw - card $CARD - device 2 --} -+} - - - -@@ -59,7 +59,7 @@ Aureon71.pcm.center_lfe.!0 { - card $CARD - device 2 - subdevice 1 --} -+} - - - -@@ -84,7 +84,7 @@ Aureon71.pcm.surround40.!0 { - type hw - card $CARD - channels 4 --} -+} - - - -diff --git a/src/conf/cards/CA0106.conf b/src/conf/cards/CA0106.conf -index 1fea79f5..bf90c3c6 100644 ---- a/src/conf/cards/CA0106.conf -+++ b/src/conf/cards/CA0106.conf -@@ -34,7 +34,7 @@ CA0106.pcm.front.!0 { - } - type hw - card $CARD --} -+} - - - -@@ -46,7 +46,7 @@ CA0106.pcm.rear.!0 { - type hw - card $CARD - device 1 --} -+} - - - -@@ -58,7 +58,7 @@ CA0106.pcm.center_lfe.!0 { - type hw - card $CARD - device 2 --} -+} - - - -@@ -70,7 +70,7 @@ CA0106.pcm.side.!0 { - type hw - card $CARD - device 3 --} -+} - - - -diff --git a/src/conf/cards/CMI8338-SWIEC.conf b/src/conf/cards/CMI8338-SWIEC.conf -index ca86c466..2a9b777c 100644 ---- a/src/conf/cards/CMI8338-SWIEC.conf -+++ b/src/conf/cards/CMI8338-SWIEC.conf -@@ -12,7 +12,7 @@ CMI8338-SWIEC.pcm.front.!0 { - } - type hw - card $CARD --} -+} - - # default with dmix/dsnoop - CMI8338-SWIEC.pcm.!default { -diff --git a/src/conf/cards/CMI8338.conf b/src/conf/cards/CMI8338.conf -index 0f92ad0b..8bd1159d 100644 ---- a/src/conf/cards/CMI8338.conf -+++ b/src/conf/cards/CMI8338.conf -@@ -11,7 +11,7 @@ CMI8338.pcm.front.!0 { - } - type hw - card $CARD --} -+} - - # default with dmix/dsnoop - CMI8338.pcm.!default { -diff --git a/src/conf/cards/CMI8738-MC6.conf b/src/conf/cards/CMI8738-MC6.conf -index 2b1c7d05..6bb17712 100644 ---- a/src/conf/cards/CMI8738-MC6.conf -+++ b/src/conf/cards/CMI8738-MC6.conf -@@ -11,7 +11,7 @@ CMI8738-MC6.pcm.front.!0 { - } - type hw - card $CARD --} -+} - - # default with dmix/dsnoop - CMI8738-MC6.pcm.!default { -@@ -75,7 +75,7 @@ CMI8738-MC6.pcm.surround40.!0 { - } - ] - } --} -+} - - - -@@ -105,7 +105,7 @@ CMI8738-MC6.pcm.surround51.!0 { - } - ] - } --} -+} - - - -diff --git a/src/conf/cards/CMI8738-MC8.conf b/src/conf/cards/CMI8738-MC8.conf -index 96cb3f10..239014d4 100644 ---- a/src/conf/cards/CMI8738-MC8.conf -+++ b/src/conf/cards/CMI8738-MC8.conf -@@ -18,7 +18,7 @@ CMI8738-MC8.pcm.front.!0 { - name "PCM Playback Volume" - card $CARD - } --} -+} - - # default with dmix+softvol & dsnoop - CMI8738-MC8.pcm.!default { -@@ -102,7 +102,7 @@ CMI8738-MC8.pcm.surround40.!0 { - name "PCM Playback Volume" - card $CARD - } --} -+} - - - -@@ -140,7 +140,7 @@ CMI8738-MC8.pcm.surround51.!0 { - name "PCM Playback Volume" - card $CARD - } --} -+} - - - -@@ -174,7 +174,7 @@ CMI8738-MC8.pcm.surround71.!0 { - name "PCM Playback Volume" - card $CARD - } --} -+} - - - -diff --git a/src/conf/cards/CMI8788.conf b/src/conf/cards/CMI8788.conf -index c4ad9f48..32ab8fb4 100644 ---- a/src/conf/cards/CMI8788.conf -+++ b/src/conf/cards/CMI8788.conf -@@ -11,7 +11,7 @@ CMI8788.pcm.front.!0 { - } - type hw - card $CARD --} -+} - - # default with dmix & dsnoop - CMI8788.pcm.!default { -@@ -46,7 +46,7 @@ CMI8788.pcm.surround40.!0 { - type hw - card $CARD - channels 4 --} -+} - - - -@@ -61,7 +61,7 @@ CMI8788.pcm.surround51.!0 { - type hw - card $CARD - channels 6 --} -+} - - - -@@ -73,7 +73,7 @@ CMI8788.pcm.surround71.!0 { - type hw - card $CARD - channels 8 --} -+} - - - -diff --git a/src/conf/cards/CS46xx.conf b/src/conf/cards/CS46xx.conf -index 478cbf3e..ad6a2218 100644 ---- a/src/conf/cards/CS46xx.conf -+++ b/src/conf/cards/CS46xx.conf -@@ -11,7 +11,7 @@ CS46xx.pcm.front.!0 { - } - type hw - card $CARD --} -+} - - # default with plughw - # CS46xx supports multi-playback -@@ -62,7 +62,7 @@ CS46xx.pcm.rear.!0 { - } - ] - } --} -+} - - - -@@ -74,7 +74,7 @@ CS46xx.pcm.center_lfe.!0 { - type hw - card $CARD - device 3 --} -+} - - - -diff --git a/src/conf/cards/EMU10K1.conf b/src/conf/cards/EMU10K1.conf -index 5ef12c03..c2dc7590 100644 ---- a/src/conf/cards/EMU10K1.conf -+++ b/src/conf/cards/EMU10K1.conf -@@ -43,7 +43,7 @@ EMU10K1.pcm.front.!0 { - type hw - card $CARD - } --} -+} - - - -@@ -74,7 +74,7 @@ EMU10K1.pcm.rear.!0 { - ] - } - } --} -+} - - - -@@ -139,7 +139,7 @@ EMU10K1.pcm.center_lfe.!0 { - ] - } - } --} -+} - - - -diff --git a/src/conf/cards/EMU10K1X.conf b/src/conf/cards/EMU10K1X.conf -index 334f897d..7d73ba44 100644 ---- a/src/conf/cards/EMU10K1X.conf -+++ b/src/conf/cards/EMU10K1X.conf -@@ -34,7 +34,7 @@ EMU10K1X.pcm.front.!0 { - } - type hw - card $CARD --} -+} - - - -@@ -46,7 +46,7 @@ EMU10K1X.pcm.rear.!0 { - type hw - card $CARD - device 1 --} -+} - - - -@@ -58,7 +58,7 @@ EMU10K1X.pcm.center_lfe.!0 { - type hw - card $CARD - device 2 --} -+} - - - -diff --git a/src/conf/cards/ENS1370.conf b/src/conf/cards/ENS1370.conf -index c65e224f..446c2f7d 100644 ---- a/src/conf/cards/ENS1370.conf -+++ b/src/conf/cards/ENS1370.conf -@@ -12,7 +12,7 @@ ENS1370.pcm.front.!0 { - type hw - card $CARD - device 1 --} -+} - - # default with dmix/dsnoop - ENS1370.pcm.!default { -@@ -67,7 +67,7 @@ ENS1370.pcm.rear.!0 { - } - ] - } --} -+} - - - -diff --git a/src/conf/cards/ENS1371.conf b/src/conf/cards/ENS1371.conf -index 560fda9f..549fd7c9 100644 ---- a/src/conf/cards/ENS1371.conf -+++ b/src/conf/cards/ENS1371.conf -@@ -11,7 +11,7 @@ ENS1371.pcm.front.!0 { - } - type hw - card $CARD --} -+} - - # default with dmix/dsnoop - ENS1371.pcm.!default { -@@ -61,7 +61,7 @@ ENS1371.pcm.rear.!0 { - } - ] - } --} -+} - - - -@@ -78,11 +78,11 @@ ENS1371.pcm.surround40.!0 { - strings [ "cards.ENS1371.pcm.front.0:CARD=" $CARD ] - } - channels 2 -- } -+ } - { - pcm { - @func concat -- strings [ "cards.ENS1371.pcm.rear.0:CARD=" $CARD ] -+ strings [ "cards.ENS1371.pcm.rear.0:CARD=" $CARD ] - } - channels 2 - } -@@ -94,7 +94,7 @@ ENS1371.pcm.surround40.!0 { - { slave 1 channel 1 } - ] - } -- -+ - - - ENS1371.pcm.iec958.!0 { -diff --git a/src/conf/cards/ES1968.conf b/src/conf/cards/ES1968.conf -index 296baa13..83dcf93b 100644 ---- a/src/conf/cards/ES1968.conf -+++ b/src/conf/cards/ES1968.conf -@@ -9,4 +9,4 @@ ES1968.pcm.front.!0 { - } - type hw - card $CARD --} -+} -diff --git a/src/conf/cards/FM801.conf b/src/conf/cards/FM801.conf -index 14cfdbe8..b8bed781 100644 ---- a/src/conf/cards/FM801.conf -+++ b/src/conf/cards/FM801.conf -@@ -11,7 +11,7 @@ FM801.pcm.front.!0 { - } - type hw - card $CARD --} -+} - - # default with dmix/dsnoop - FM801.pcm.!default { -diff --git a/src/conf/cards/GUS.conf b/src/conf/cards/GUS.conf -index a1ccd0e9..42a612a6 100644 ---- a/src/conf/cards/GUS.conf -+++ b/src/conf/cards/GUS.conf -@@ -16,4 +16,4 @@ GUS.pcm.front.!0 { - type hw - card $CARD - } --} -+} -diff --git a/src/conf/cards/HDA-Intel.conf b/src/conf/cards/HDA-Intel.conf -index 76775b97..cacd2815 100644 ---- a/src/conf/cards/HDA-Intel.conf -+++ b/src/conf/cards/HDA-Intel.conf -@@ -26,7 +26,7 @@ HDA-Intel.pcm.front.!0 { - type hw - card $CARD - } --} -+} - - # default with dmix+softvol & dsnoop - HDA-Intel.pcm.!default { -diff --git a/src/conf/cards/ICE1712.conf b/src/conf/cards/ICE1712.conf -index 190d2c59..08b84f30 100644 ---- a/src/conf/cards/ICE1712.conf -+++ b/src/conf/cards/ICE1712.conf -@@ -53,7 +53,7 @@ ICE1712.pcm.front.!0 { - } - slave.channels 12 - } --} -+} - - - -@@ -72,7 +72,7 @@ ICE1712.pcm.surround40.!0 { - card $CARD - } - slave.channels 10 --} -+} - - - -diff --git a/src/conf/cards/ICE1724.conf b/src/conf/cards/ICE1724.conf -index 16045dc4..678df41d 100644 ---- a/src/conf/cards/ICE1724.conf -+++ b/src/conf/cards/ICE1724.conf -@@ -34,7 +34,7 @@ ICE1724.pcm.front.!0 { - } - type hw - card $CARD --} -+} - - - -@@ -47,7 +47,7 @@ ICE1724.pcm.rear.!0 { - card $CARD - device 2 - subdevice 1 --} -+} - - - -@@ -59,7 +59,7 @@ ICE1724.pcm.center_lfe.!0 { - type hw - card $CARD - device 2 --} -+} - - - -@@ -93,7 +93,7 @@ ICE1724.pcm.surround40.!0 { - card $CARD - } - } --} -+} - - - -@@ -114,7 +114,7 @@ ICE1724.pcm.surround51.!0 { - ttable.5.3 1 - slave { - channels 6 -- pcm { -+ pcm { - type hw - card $CARD - } -diff --git a/src/conf/cards/ICH.conf b/src/conf/cards/ICH.conf -index c35c8d02..573b9e26 100644 ---- a/src/conf/cards/ICH.conf -+++ b/src/conf/cards/ICH.conf -@@ -18,7 +18,7 @@ ICH.pcm.front.!0 { - name "PCM Playback Volume" - card $CARD - } --} -+} - - # default with dmix+softvol & dsnoop - ICH.pcm.!default { -diff --git a/src/conf/cards/ICH4.conf b/src/conf/cards/ICH4.conf -index 11c85a6e..5641c9c4 100644 ---- a/src/conf/cards/ICH4.conf -+++ b/src/conf/cards/ICH4.conf -@@ -18,7 +18,7 @@ ICH4.pcm.front.!0 { - name "PCM Playback Volume" - card $CARD - } --} -+} - - # default with dmix+softvol & dsnoop - ICH4.pcm.!default { -diff --git a/src/conf/cards/Loopback.conf b/src/conf/cards/Loopback.conf -index 21c8429c..3911aed5 100644 ---- a/src/conf/cards/Loopback.conf -+++ b/src/conf/cards/Loopback.conf -@@ -18,7 +18,7 @@ Loopback.pcm.front.!0 { - name "PCM Playback Volume" - card $CARD - } --} -+} - - # default with dmix+softvol & dsnoop - Loopback.pcm.!default { -diff --git a/src/conf/cards/Maestro3.conf b/src/conf/cards/Maestro3.conf -index a8d89a48..c0e3da31 100644 ---- a/src/conf/cards/Maestro3.conf -+++ b/src/conf/cards/Maestro3.conf -@@ -9,7 +9,7 @@ Maestro3.pcm.front.!0 { - } - type hw - card $CARD --} -+} - - # default with dmix/dsnoop - Maestro3.pcm.!default { -@@ -35,4 +35,3 @@ Maestro3.pcm.!default { - } - } - } -- -diff --git a/src/conf/cards/NFORCE.conf b/src/conf/cards/NFORCE.conf -index 088cd8ce..aeef6b40 100644 ---- a/src/conf/cards/NFORCE.conf -+++ b/src/conf/cards/NFORCE.conf -@@ -18,7 +18,7 @@ NFORCE.pcm.front.!0 { - name "PCM Playback Volume" - card $CARD - } --} -+} - - # default with dmix+softvol & dsnoop - NFORCE.pcm.!default { -@@ -175,74 +175,74 @@ NFORCE.pcm.surround51.!0 { - - - NFORCE.pcm.surround71.!0 { -- @args [ CARD ] -- @args.CARD { -- type string -- } -- type softvol -- slave.pcm { -- type route -- ttable.0.0 1 -- ttable.1.1 1 -- ttable.2.4 1 -- ttable.3.5 1 -- ttable.4.2 1 -- ttable.5.3 1 -- ttable.6.6 1 -- ttable.7.7 1 -- slave.pcm { -- type hooks -- slave.pcm { -- type hw -- card $CARD -- device 0 -- } -- hooks.0 { -- type ctl_elems -- hook_args [ -- { -- name "Channel Mode" -- preserve true -- value "8ch" -- lock true -- optional true -- } -- # for old drivers -- { -- name "Line-In As Surround" -- preserve true -- value true -- optional true -- } -- { -- name "Mic As Center/LFE" -- preserve true -- value true -- optional true -- } -- { -- name "Surround Down Mix" -- preserve true -- value off -- lock true -- optional true -- } -- { -- name "Center/LFE Down Mix" -- preserve true -- value off -- lock true -- optional true -- } -- ] -- } -- } -- slave.channels 8 -- } -- control { -- name "PCM Playback Volume" -- card $CARD -- } -+ @args [ CARD ] -+ @args.CARD { -+ type string -+ } -+ type softvol -+ slave.pcm { -+ type route -+ ttable.0.0 1 -+ ttable.1.1 1 -+ ttable.2.4 1 -+ ttable.3.5 1 -+ ttable.4.2 1 -+ ttable.5.3 1 -+ ttable.6.6 1 -+ ttable.7.7 1 -+ slave.pcm { -+ type hooks -+ slave.pcm { -+ type hw -+ card $CARD -+ device 0 -+ } -+ hooks.0 { -+ type ctl_elems -+ hook_args [ -+ { -+ name "Channel Mode" -+ preserve true -+ value "8ch" -+ lock true -+ optional true -+ } -+ # for old drivers -+ { -+ name "Line-In As Surround" -+ preserve true -+ value true -+ optional true -+ } -+ { -+ name "Mic As Center/LFE" -+ preserve true -+ value true -+ optional true -+ } -+ { -+ name "Surround Down Mix" -+ preserve true -+ value off -+ lock true -+ optional true -+ } -+ { -+ name "Center/LFE Down Mix" -+ preserve true -+ value off -+ lock true -+ optional true -+ } -+ ] -+ } -+ } -+ slave.channels 8 -+ } -+ control { -+ name "PCM Playback Volume" -+ card $CARD -+ } - } - - -diff --git a/src/conf/cards/PC-Speaker.conf b/src/conf/cards/PC-Speaker.conf -index 8a40a139..97cb0d5d 100644 ---- a/src/conf/cards/PC-Speaker.conf -+++ b/src/conf/cards/PC-Speaker.conf -@@ -20,7 +20,7 @@ PC-Speaker.pcm.front.!0 { - } - min_dB -10.0 - max_dB 20.0 --} -+} - - # default with dmix & null - PC-Speaker.pcm.!default { -@@ -49,4 +49,3 @@ PC-Speaker.pcm.!default { - type null - } - } -- -diff --git a/src/conf/cards/PMac.conf b/src/conf/cards/PMac.conf -index 00f3bc89..67dfabc6 100644 ---- a/src/conf/cards/PMac.conf -+++ b/src/conf/cards/PMac.conf -@@ -11,7 +11,7 @@ PMac.pcm.front.!0 { - } - type hw - card $CARD --} -+} - - # default with dmix/dsnoop - PMac.pcm.!default { -diff --git a/src/conf/cards/PMacToonie.conf b/src/conf/cards/PMacToonie.conf -index aff1ea65..c45cf12b 100644 ---- a/src/conf/cards/PMacToonie.conf -+++ b/src/conf/cards/PMacToonie.conf -@@ -18,7 +18,7 @@ PMacToonie.pcm.front.!0 { - name "PCM Playback Volume" - card $CARD - } --} -+} - - # default with dmix+softvol & dsnoop - PMacToonie.pcm.!default { -diff --git a/src/conf/cards/PS3.conf b/src/conf/cards/PS3.conf -index 486d790c..8a165fc3 100644 ---- a/src/conf/cards/PS3.conf -+++ b/src/conf/cards/PS3.conf -@@ -19,7 +19,7 @@ PS3.pcm.front.!0 { - name "PCM Playback Volume" - card $CARD - } --} -+} - - # default with dmix+softvol - PS3.pcm.!default { -@@ -34,8 +34,8 @@ PS3.pcm.!default { - type softvol - slave.pcm { - @func concat -- #strings [ "dmix:CARD=" $CARD ] -- strings [ "dmix:CARD=" $CARD ",FORMAT=S16" ] -+ #strings [ "dmix:CARD=" $CARD ] -+ strings [ "dmix:CARD=" $CARD ",FORMAT=S16" ] - } - control { - name "PCM Playback Volume" -diff --git a/src/conf/cards/RME9636.conf b/src/conf/cards/RME9636.conf -index 17b3a1ab..c5c74ee9 100644 ---- a/src/conf/cards/RME9636.conf -+++ b/src/conf/cards/RME9636.conf -@@ -11,7 +11,7 @@ RME9636.pcm.front.!0 { - } - type hw - card $CARD --} -+} - - # FIXME: This configuration is not valid for double-speed rates. - -diff --git a/src/conf/cards/RME9652.conf b/src/conf/cards/RME9652.conf -index a11e42b2..34ef91bb 100644 ---- a/src/conf/cards/RME9652.conf -+++ b/src/conf/cards/RME9652.conf -@@ -11,7 +11,7 @@ RME9652.pcm.front.!0 { - } - type hw - card $CARD --} -+} - - # FIXME: This configuration is not valid for double-speed rates. - -diff --git a/src/conf/cards/SB-XFi.conf b/src/conf/cards/SB-XFi.conf -index 9ce9c8ac..64e3d082 100644 ---- a/src/conf/cards/SB-XFi.conf -+++ b/src/conf/cards/SB-XFi.conf -@@ -12,7 +12,7 @@ SB-XFi.pcm.front.!0 { - type hw - card $CARD - device 0 --} -+} - - - -@@ -25,7 +25,7 @@ SB-XFi.pcm.rear.!0 { - card $CARD - device 1 - hint.device 1 --} -+} - - - -@@ -38,7 +38,7 @@ SB-XFi.pcm.center_lfe.!0 { - card $CARD - device 2 - hint.device 2 --} -+} - - - -@@ -51,7 +51,7 @@ SB-XFi.pcm.side.!0 { - card $CARD - device 3 - hint.device 3 --} -+} - - - -diff --git a/src/conf/cards/SI7018.conf b/src/conf/cards/SI7018.conf -index 33d19085..3a22107c 100644 ---- a/src/conf/cards/SI7018.conf -+++ b/src/conf/cards/SI7018.conf -@@ -14,7 +14,7 @@ SI7018.pcm.front.!0 { - type hw - card $CARD - chmap [ "UNKNOWN" "FL,FR" ] --} -+} - - - -@@ -23,7 +23,7 @@ SI7018.pcm.rear.!0 { - @args.CARD { - type string - } -- type hooks -+ type hooks - slave.pcm { - type hw - card $CARD -@@ -40,7 +40,7 @@ SI7018.pcm.rear.!0 { - } - ] - } --} -+} - - - -diff --git a/src/conf/cards/TRID4DWAVENX.conf b/src/conf/cards/TRID4DWAVENX.conf -index 5001297e..3c25515e 100644 ---- a/src/conf/cards/TRID4DWAVENX.conf -+++ b/src/conf/cards/TRID4DWAVENX.conf -@@ -12,7 +12,7 @@ TRID4DWAVENX.pcm.front.!0 { - type hw - card $CARD - chmap [ "UNKNOWN" "FL,FR" ] --} -+} - - - -@@ -52,7 +52,7 @@ TRID4DWAVENX.pcm.rear.!0 { - } - ] - } --} -+} - - - -diff --git a/src/conf/cards/USB-Audio.conf b/src/conf/cards/USB-Audio.conf -index 1fc540e2..33d856f2 100644 ---- a/src/conf/cards/USB-Audio.conf -+++ b/src/conf/cards/USB-Audio.conf -@@ -47,7 +47,7 @@ USB-Audio.pcm.iec958_device { - "XONAR U5" 1 - "XONAR SOUND CARD" 1 - "Xonar SoundCard" 2 -- -+ - # The below don't have digital in/out, so prevent them from being opened. - "Andrea PureAudio USB-SA Headset" 999 - "Blue Snowball" 999 -diff --git a/src/conf/cards/VIA686A.conf b/src/conf/cards/VIA686A.conf -index c53dd71b..40c2f89e 100644 ---- a/src/conf/cards/VIA686A.conf -+++ b/src/conf/cards/VIA686A.conf -@@ -14,7 +14,7 @@ VIA686A.pcm.front.!0 { - } - type hw - card $CARD --} -+} - - # default with dmix/dsnoop - VIA686A.pcm.!default { -diff --git a/src/conf/cards/VIA8233.conf b/src/conf/cards/VIA8233.conf -index 3c25a11b..ccc7fe2f 100644 ---- a/src/conf/cards/VIA8233.conf -+++ b/src/conf/cards/VIA8233.conf -@@ -11,7 +11,7 @@ VIA8233.pcm.front.!0 { - } - type hw - card $CARD --} -+} - - # default with softvol/dsnoop - # VIA8233 supports multi-playback -diff --git a/src/conf/cards/VIA8233A.conf b/src/conf/cards/VIA8233A.conf -index c9e56e20..e566edeb 100644 ---- a/src/conf/cards/VIA8233A.conf -+++ b/src/conf/cards/VIA8233A.conf -@@ -11,7 +11,7 @@ VIA8233A.pcm.front.!0 { - } - type hw - card $CARD --} -+} - - # default with dmix/dsnoop - VIA8233A.pcm.!default { -diff --git a/src/conf/cards/VIA8237.conf b/src/conf/cards/VIA8237.conf -index 49fd6f2c..074e342c 100644 ---- a/src/conf/cards/VIA8237.conf -+++ b/src/conf/cards/VIA8237.conf -@@ -11,7 +11,7 @@ VIA8237.pcm.front.!0 { - } - type hw - card $CARD --} -+} - - # default with softvol/dsnoop - # VIA8237 supports multi-playback -diff --git a/src/conf/cards/VX222.conf b/src/conf/cards/VX222.conf -index 2c6e2297..96ea32f6 100644 ---- a/src/conf/cards/VX222.conf -+++ b/src/conf/cards/VX222.conf -@@ -11,7 +11,7 @@ VX222.pcm.front.!0 { - } - type hw - card $CARD --} -+} - - - -diff --git a/src/conf/cards/VXPocket.conf b/src/conf/cards/VXPocket.conf -index 90b13347..81260a7d 100644 ---- a/src/conf/cards/VXPocket.conf -+++ b/src/conf/cards/VXPocket.conf -@@ -11,7 +11,7 @@ VXPocket.pcm.front.!0 { - } - type hw - card $CARD --} -+} - - - -diff --git a/src/conf/cards/VXPocket440.conf b/src/conf/cards/VXPocket440.conf -index 87a0855a..6b3aea40 100644 ---- a/src/conf/cards/VXPocket440.conf -+++ b/src/conf/cards/VXPocket440.conf -@@ -11,7 +11,7 @@ VXPocket440.pcm.front.!0 { - } - type hw - card $CARD --} -+} - - - -diff --git a/src/conf/cards/YMF744.conf b/src/conf/cards/YMF744.conf -index ad1f2132..974bf791 100644 ---- a/src/conf/cards/YMF744.conf -+++ b/src/conf/cards/YMF744.conf -@@ -11,7 +11,7 @@ YMF744.pcm.front.!0 { - } - type hw - card $CARD --} -+} - - - -@@ -23,7 +23,7 @@ YMF744.pcm.rear.!0 { - type hw - card $CARD - device 2 --} -+} - - - -diff --git a/src/conf/cards/pistachio-card.conf b/src/conf/cards/pistachio-card.conf -index 15cfd60b..d92c019a 100644 ---- a/src/conf/cards/pistachio-card.conf -+++ b/src/conf/cards/pistachio-card.conf -@@ -1,10 +1,10 @@ - # - # Configuration for the pistachio chip. - # --# The data sheet of the chip and technical reference manual can be --found at -+# The data sheet of the chip and technical reference manual can be -+found at - https://docs.creatordev.io/ci40/guides/hardwaredocs/cXT200_datasheet2.p --df # and -+df # and - https://docs.creatordev.io/ci40/guides/hardwaredocs/MIPS_Creator_cXT200_Technical_Reference_Manual_1.0.112.pdf. - # - # The list of hardware devices is as per below: -@@ -30,30 +30,30 @@ https://docs.creatordev.io/ci40/guides/hardwaredocs/MIPS_Creator_cXT200_Technica - # - - pistachio-card.pcm.!default { -- @args [ CARD ] -- @args.CARD { -- type string -- default "pistachio" -- } -- @args.DEVICE { -- type integer -- default 2 -- } -+ @args [ CARD ] -+ @args.CARD { -+ type string -+ default "pistachio" -+ } -+ @args.DEVICE { -+ type integer -+ default 2 -+ } - -- type asym -- capture.pcm { -- type multi -- slaves.a.pcm "hw:0,4" -- slaves.a.channels 12 -- bindings.0.slave a -- bindings.0.channel 4 -- bindings.1.slave a -- bindings.1.channel 5 -- } -+ type asym -+ capture.pcm { -+ type multi -+ slaves.a.pcm "hw:0,4" -+ slaves.a.channels 12 -+ bindings.0.slave a -+ bindings.0.channel 4 -+ bindings.1.slave a -+ bindings.1.channel 5 -+ } - -- playback.pcm { -- type hw -- card $CARD -- device $DEVICE -- } -+ playback.pcm { -+ type hw -+ card $CARD -+ device $DEVICE -+ } - } --- -2.51.1 - diff --git a/alsa-lib.spec b/alsa-lib.spec index f64c71c..c7f5e16 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -2,14 +2,17 @@ #define prever_dot .rc3 #define postver a -%define version_alsa_lib 1.2.15 -%define version_alsa_ucm 1.2.15 +%define version_alsa_lib 1.2.15.1 +%define version_alsa_ucm 1.2.15.1 %define version_alsa_tplg 1.2.5 +%global lib_patch 0 +%global ucm_patch 0 + Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 4%{?prever_dot}%{?dist} +Release: 1%{?prever_dot}%{?dist} License: LGPL-2.1-or-later URL: http://www.alsa-project.org/ @@ -19,8 +22,12 @@ Source2: ftp://ftp.alsa-project.org/pub/lib/alsa-topology-conf-%{version_alsa_t Source10: asound.conf Source11: modprobe-dist-alsa.conf Source12: modprobe-dist-oss.conf +%if %{ucm_patch} Source40: alsa-ucm-conf.patch +%endif +%if %{lib_patch} Patch0: alsa-git.patch +%endif Patch1: alsa-lib-1.2.3.1-config.patch Patch2: alsa-lib-1.2.10-glibc-open.patch @@ -70,7 +77,9 @@ contains alsa-lib configuration of SoC topology %prep %setup -q -n %{name}-%{version}%{?prever}%{?postver} +%if %{lib_patch} %patch -P0 -p1 -b .alsa-git +%endif %patch -P1 -p1 -b .config %patch -P2 -p1 -b .glibc-open @@ -116,7 +125,9 @@ mkdir -p %{buildroot}/%{_datadir}/alsa/ucm2 # Unpack UCMs tar xvjf %{SOURCE1} -C %{buildroot}/%{_datadir}/alsa --strip-components=1 "*/ucm" "*/ucm2" +%if %{ucm_patch} patch -d %{buildroot}/%{_datadir}/alsa -p1 < %{SOURCE40} +%endif # Create topology directory mkdir -p %{buildroot}/%{_datadir}/alsa/topology @@ -167,6 +178,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Fri Dec 19 2025 Jaroslav Kysela - 1.2.15.1-1 +- update to 1.2.15.1 + * Wed Dec 10 2025 Jaroslav Kysela - 1.2.15-4 - update to 1.2.15 diff --git a/alsa-ucm-conf.patch b/alsa-ucm-conf.patch deleted file mode 100644 index 0447c61..0000000 --- a/alsa-ucm-conf.patch +++ /dev/null @@ -1,264 +0,0 @@ -From d57d800c6a5a77e6c475719b0297bebb098f7533 Mon Sep 17 00:00:00 2001 -From: Maciej Strozek -Date: Tue, 9 Dec 2025 13:00:44 +0000 -Subject: [PATCH 1/3] sof-soundwire: third fix for multi-codec - -Ensure MultiCodec-based actions are only done when MultiCodec1 is not empty - -Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/658 -Signed-off-by: Maciej Strozek -Signed-off-by: Jaroslav Kysela ---- - ucm2/sof-soundwire/sof-soundwire.conf | 15 +++++++++------ - 1 file changed, 9 insertions(+), 6 deletions(-) - -diff --git a/ucm2/sof-soundwire/sof-soundwire.conf b/ucm2/sof-soundwire/sof-soundwire.conf -index 7f9c7dc..895f479 100644 ---- a/ucm2/sof-soundwire/sof-soundwire.conf -+++ b/ucm2/sof-soundwire/sof-soundwire.conf -@@ -72,8 +72,9 @@ If.multi_init { - If.multi_speaker { - Condition { - Type RegexMatch -- Regex "(${var:MultiCodec1}(-sdca)?)" -- String "${var:SpeakerCodec1}" -+ # guard with "=" to avoid empty string matching -+ Regex "=(${var:MultiCodec1}(-sdca)?)=" -+ String "=${var:SpeakerCodec1}=" - } - True { - Define.SpeakerCodec1 "" -@@ -83,8 +84,9 @@ If.multi_speaker { - If.multi_mic { - Condition { - Type RegexMatch -- Regex "(${var:MultiCodec1}(-sdca)?)" -- String "${var:MicCodec1}" -+ # guard with "=" to avoid empty string matching -+ Regex "=(${var:MultiCodec1}(-sdca)?)=" -+ String "=${var:MicCodec1}=" - } - True { - Define.MicCodec1 "" -@@ -94,8 +96,9 @@ If.multi_mic { - If.multi_headset { - Condition { - Type RegexMatch -- Regex "(${var:MultiCodec1}(-sdca)?)" -- String "${var:HeadsetCodec1}" -+ # guard with "=" to avoid empty string matching -+ Regex "=(${var:MultiCodec1}(-sdca)?)=" -+ String "=${var:HeadsetCodec1}=" - } - True { - Define.HeadsetCodec1 "" --- -2.51.1 - - -From 51bada5f0c1b634b5db92de428f33c0188e68e82 Mon Sep 17 00:00:00 2001 -From: Maciej Strozek -Date: Fri, 28 Nov 2025 16:08:23 +0000 -Subject: [PATCH 2/3] ucm2: sof-soundwire: Simplify cs42l45 configs - -Simplify cs42l45 configs following machine driver changes [1] -which bring normal switches instead of mute switches. - -[1] https://lore.kernel.org/all/20251127163426.2500633-2-ckeepax@opensource.cirrus.com/ - -Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/655 -Signed-off-by: Maciej Strozek -Signed-off-by: Jaroslav Kysela ---- - ucm2/codecs/cs42l45-dmic/init.conf | 17 +++++++++++++++-- - ucm2/codecs/cs42l45/init.conf | 24 ++++++++++++++++++++++++ - ucm2/sof-soundwire/cs42l45-dmic.conf | 8 ++------ - ucm2/sof-soundwire/cs42l45.conf | 18 +++--------------- - ucm2/sof-soundwire/sof-soundwire.conf | 2 +- - 5 files changed, 45 insertions(+), 24 deletions(-) - create mode 100644 ucm2/codecs/cs42l45/init.conf - -diff --git a/ucm2/codecs/cs42l45-dmic/init.conf b/ucm2/codecs/cs42l45-dmic/init.conf -index 6dd19bb..deefb3d 100644 ---- a/ucm2/codecs/cs42l45-dmic/init.conf -+++ b/ucm2/codecs/cs42l45-dmic/init.conf -@@ -1,9 +1,22 @@ - # cs42l45 specific control settings - -+LibraryConfig.remap.Config { -+ ctl.default.map { -+ "name='cs42l45 Microphone Capture Switch'" { -+ "name='cs42l45 FU 113 Channel Switch'".vindex.0 0 -+ "name='cs42l45 FU 113 Channel Switch'".vindex.1 1 -+ } -+ "name='cs42l45 Microphone Capture Volume'" { -+ "name='cs42l45 FU 113 Channel Volume'".vindex.0 0 -+ "name='cs42l45 FU 113 Channel Volume'".vindex.1 1 -+ } -+ } -+} -+ - BootSequence [ -- cset "name='cs42l45 FU 113 Mute Switch' 0" -+ cset "name='cs42l45 FU 113 Channel Switch' 0" - ] - - Macro [ -- { SetLED { LED="mic" Action="attach" CtlId="cs42l45 FU 113 Mute Switch" Mode="follow-route"} } -+ { SetLED { LED="mic" Action="attach" CtlId="cs42l45 FU 113 Channel Switch"} } - ] -diff --git a/ucm2/codecs/cs42l45/init.conf b/ucm2/codecs/cs42l45/init.conf -new file mode 100644 -index 0000000..f4aee4a ---- /dev/null -+++ b/ucm2/codecs/cs42l45/init.conf -@@ -0,0 +1,24 @@ -+# cs42l45 specific control settings -+ -+LibraryConfig.remap.Config { -+ ctl.default.map { -+ "name='cs42l45 Jack Microphone Capture Switch'" { -+ "name='cs42l45 FU 36 Channel Switch'".vindex.0 0 -+ "name='cs42l45 FU 36 Channel Switch'".vindex.1 1 -+ } -+ "name='cs42l45 Jack Microphone Capture Volume'" { -+ "name='cs42l45 FU 36 Channel Volume'".vindex.0 0 -+ "name='cs42l45 FU 36 Channel Volume'".vindex.1 1 -+ } -+ } -+ ctl.default.map { -+ "name='cs42l45 Headphone Playback Switch'" { -+ "name='cs42l45 FU 41 Channel Switch'".vindex.0 0 -+ "name='cs42l45 FU 41 Channel Switch'".vindex.1 1 -+ } -+ "name='cs42l45 Headphone Playback Volume'" { -+ "name='cs42l45 FU 41 Channel Volume'".vindex.0 0 -+ "name='cs42l45 FU 41 Channel Volume'".vindex.1 1 -+ } -+ } -+} -\ No newline at end of file -diff --git a/ucm2/sof-soundwire/cs42l45-dmic.conf b/ucm2/sof-soundwire/cs42l45-dmic.conf -index 9477cba..d46808e 100644 ---- a/ucm2/sof-soundwire/cs42l45-dmic.conf -+++ b/ucm2/sof-soundwire/cs42l45-dmic.conf -@@ -7,18 +7,14 @@ SectionDevice."Mic" { - "Headset" - ] - -- EnableSequence [ -- cset "name='cs42l45 FU 113 Mute Switch' 0" -- ] -- - DisableSequence [ -- cset "name='cs42l45 FU 113 Mute Switch' 1" -+ cset "name='cs42l45 FU 113 Channel Switch' 0" - ] - - Value { - CapturePriority 100 - CapturePCM "hw:${CardId},4" - CaptureMixer "default:${CardId}" -- CaptureVolume "cs42l45 FU 113 Channel Volume" -+ CaptureMixerElem "cs42l45 Microphone" - } - } -diff --git a/ucm2/sof-soundwire/cs42l45.conf b/ucm2/sof-soundwire/cs42l45.conf -index ba61048..c88562a 100644 ---- a/ucm2/sof-soundwire/cs42l45.conf -+++ b/ucm2/sof-soundwire/cs42l45.conf -@@ -3,19 +3,11 @@ - SectionDevice."Headphones" { - Comment "Headphones" - -- EnableSequence [ -- cset "name='cs42l45 FU 41 Mute Switch' 0" -- ] -- -- DisableSequence [ -- cset "name='cs42l45 FU 41 Mute Switch' 1" -- ] -- - Value { - PlaybackPriority 200 - PlaybackPCM "hw:${CardId},0" - PlaybackMixer "default:${CardId}" -- PlaybackVolume "cs42l45 FU 41 Channel Volume" -+ PlaybackMixerElem "cs42l45 Headphone" - JackControl "cs42l45 OT 43 Headphone Jack" - } - } -@@ -23,19 +15,15 @@ SectionDevice."Headphones" { - SectionDevice."Headset" { - Comment "Jack Microphone" - -- EnableSequence [ -- cset "name='cs42l45 FU 36 Mute Switch' 0" -- ] -- - DisableSequence [ -- cset "name='cs42l45 FU 36 Mute Switch' 1" -+ cset "name='cs42l45 FU 36 Channel Switch' 0" - ] - - Value { - CapturePriority 200 - CapturePCM "hw:${CardId},1" - CaptureMixer "default:${CardId}" -- CaptureVolume "cs42l45 FU 36 Channel Volume" -+ CaptureMixerElem "cs42l45 Jack Microphone" - JackControl "cs42l45 IT 31 Microphone Jack" - } - } -diff --git a/ucm2/sof-soundwire/sof-soundwire.conf b/ucm2/sof-soundwire/sof-soundwire.conf -index 895f479..7a00209 100644 ---- a/ucm2/sof-soundwire/sof-soundwire.conf -+++ b/ucm2/sof-soundwire/sof-soundwire.conf -@@ -117,7 +117,7 @@ If.spk_init { - If.hs_init { - Condition { - Type RegexMatch -- Regex "(cs42l43|rt5682|rt700|rt711|rt713(-sdca)?)" -+ Regex "(cs42l43|cs42l45|rt5682|rt700|rt711|rt713(-sdca)?)" - String "${var:HeadsetCodec1}" - } - True.Include.hs_init.File "/codecs/${var:HeadsetCodec1}/init.conf" --- -2.51.1 - - -From 5d0d2bd660b4378f802c94be3eadd8375c4c7a3a Mon Sep 17 00:00:00 2001 -From: Shuming Fan -Date: Tue, 9 Dec 2025 15:40:49 +0800 -Subject: [PATCH 3/3] ucm2: codecs: rt722: add condition to SetLED for mic - -Some SKUs don't have the internal mic, so the patch adds the condition to check -whether the SKU has the internal mic or not. - -Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/657 -Signed-off-by: Shuming Fan -Signed-off-by: Jaroslav Kysela ---- - ucm2/codecs/rt722/init.conf | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -diff --git a/ucm2/codecs/rt722/init.conf b/ucm2/codecs/rt722/init.conf -index c820e55..40f2458 100644 ---- a/ucm2/codecs/rt722/init.conf -+++ b/ucm2/codecs/rt722/init.conf -@@ -10,4 +10,11 @@ BootSequence [ - cset "name='rt722 FU0F Capture Volume' 63" - ] - --Macro [{ SetLED { LED="mic" Action="attach" CtlId="rt722 FU1E Capture Switch" } }] -+If.mic_init_rt722 { -+ Condition { -+ Type String -+ Needle "rt722" -+ Haystack "${var:MicCodec1}" -+ } -+ True.Macro [{ SetLED { LED="mic" Action="attach" CtlId="rt722 FU1E Capture Switch" } }] -+} --- -2.51.1 - diff --git a/sources b/sources index 9ce5bdb..db04fd8 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (alsa-lib-1.2.15.tar.bz2) = 6cea9059265ef353a07f1b442004506f0f13883692ea35f03090282ca80db88055f470d2dca5bb54394fef0012711f0e9502d2d0f7fb66b27aa334bffb811559 -SHA512 (alsa-ucm-conf-1.2.15.tar.bz2) = 61dcbfe32ad912b793bf70d6f9e0e462353431b9589623ce8a7ec18b5dba48c230f5ba509e47384764625ae82f132babfbf62a8e5f4bb951377476ba147939e2 +SHA512 (alsa-lib-1.2.15.1.tar.bz2) = 36d79055537cf516dd435db56559ee59f3efbbea72ae0dbe5244191cfba4e181ed13100d908eb51bfd3a3be70aa87081df9b56921e7d24c3b3728e4374507236 +SHA512 (alsa-ucm-conf-1.2.15.1.tar.bz2) = 1c506cd6ed18ecf3f549dce9d945684594cbc3ca315b2c9d399dc5b8d6617209400053509dfb76ba5dd48a215803e5c0bbc654a40498bb8097ea6fa1baa90f9e SHA512 (alsa-topology-conf-1.2.5.tar.bz2) = 2eb4d8baf2dcbf0b631dd11dbf15bffc51694d9cc6931619e51787f3ba58d1a091d266e6721a3b737c040ec74a28270b93f39fb97f30a3227cf340dd646e5d51 From 2bb0b91c53b6610b3990f51f09ad34152f39e37a Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 8 Jan 2026 15:48:16 +0100 Subject: [PATCH 118/120] update to 1.2.15.2 Signed-off-by: Jaroslav Kysela --- alsa-lib.spec | 7 +++++-- sources | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index c7f5e16..769a956 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -2,8 +2,8 @@ #define prever_dot .rc3 #define postver a -%define version_alsa_lib 1.2.15.1 -%define version_alsa_ucm 1.2.15.1 +%define version_alsa_lib 1.2.15.2 +%define version_alsa_ucm 1.2.15.2 %define version_alsa_tplg 1.2.5 %global lib_patch 0 @@ -178,6 +178,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Thu Jan 8 2026 Jaroslav Kysela - 1.2.15.2-1 +- update to 1.2.15.2 + * Fri Dec 19 2025 Jaroslav Kysela - 1.2.15.1-1 - update to 1.2.15.1 diff --git a/sources b/sources index db04fd8..23cfc23 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (alsa-lib-1.2.15.1.tar.bz2) = 36d79055537cf516dd435db56559ee59f3efbbea72ae0dbe5244191cfba4e181ed13100d908eb51bfd3a3be70aa87081df9b56921e7d24c3b3728e4374507236 -SHA512 (alsa-ucm-conf-1.2.15.1.tar.bz2) = 1c506cd6ed18ecf3f549dce9d945684594cbc3ca315b2c9d399dc5b8d6617209400053509dfb76ba5dd48a215803e5c0bbc654a40498bb8097ea6fa1baa90f9e +SHA512 (alsa-lib-1.2.15.2.tar.bz2) = e9a13aafa9693be2ce501059db0ff9f83a0044d07019bd6b420617da44cc4e7df6f444da9eccf37577893ed81426dce44ecdb9a652d1db047e24a3b803da4a8a +SHA512 (alsa-ucm-conf-1.2.15.2.tar.bz2) = 32781f28814b360c1ddabafa23ab989be18b284990dbc013cb712a9c6c12d5236e493b1fb33582e5edfd73f282a6f2db82adf0754356a8337e1fa4bd2a656dac SHA512 (alsa-topology-conf-1.2.5.tar.bz2) = 2eb4d8baf2dcbf0b631dd11dbf15bffc51694d9cc6931619e51787f3ba58d1a091d266e6721a3b737c040ec74a28270b93f39fb97f30a3227cf340dd646e5d51 From 454530bd653b061f3f453da187b4a89372b52d27 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 13 Jan 2026 08:29:06 +0100 Subject: [PATCH 119/120] update to 1.2.15.3 Signed-off-by: Jaroslav Kysela --- alsa-lib.spec | 7 +++++-- sources | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index 769a956..ee7b134 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -2,8 +2,8 @@ #define prever_dot .rc3 #define postver a -%define version_alsa_lib 1.2.15.2 -%define version_alsa_ucm 1.2.15.2 +%define version_alsa_lib 1.2.15.3 +%define version_alsa_ucm 1.2.15.3 %define version_alsa_tplg 1.2.5 %global lib_patch 0 @@ -178,6 +178,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Tue Jan 13 2026 Jaroslav Kysela - 1.2.15.3-1 +- update to 1.2.15.3 + * Thu Jan 8 2026 Jaroslav Kysela - 1.2.15.2-1 - update to 1.2.15.2 diff --git a/sources b/sources index 23cfc23..8a1161f 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (alsa-lib-1.2.15.2.tar.bz2) = e9a13aafa9693be2ce501059db0ff9f83a0044d07019bd6b420617da44cc4e7df6f444da9eccf37577893ed81426dce44ecdb9a652d1db047e24a3b803da4a8a -SHA512 (alsa-ucm-conf-1.2.15.2.tar.bz2) = 32781f28814b360c1ddabafa23ab989be18b284990dbc013cb712a9c6c12d5236e493b1fb33582e5edfd73f282a6f2db82adf0754356a8337e1fa4bd2a656dac +SHA512 (alsa-lib-1.2.15.3.tar.bz2) = 7fc0fa8a5ae02d3404d2c262c6a14fcbb8b08e25993eac86b9e89b8419ed4d293b422da77b3eb7a1930f26c316b638e5aa7bdba78b0ada9908b0362d132a0cc0 +SHA512 (alsa-ucm-conf-1.2.15.3.tar.bz2) = 079aeb45bc3f98448f6e48a1267db5d3f46a51d7060eb8275d0a084574e23eec34f07108610538e898c397fa24941ccf1bb7722c6b4bb0fa9c48904addc03973 SHA512 (alsa-topology-conf-1.2.5.tar.bz2) = 2eb4d8baf2dcbf0b631dd11dbf15bffc51694d9cc6931619e51787f3ba58d1a091d266e6721a3b737c040ec74a28270b93f39fb97f30a3227cf340dd646e5d51 From 44510615c1fb478490de273b6e24336dccbcae1c Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 16 Jan 2026 03:36:37 +0000 Subject: [PATCH 120/120] Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild --- alsa-lib.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index ee7b134..df66e75 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -12,7 +12,7 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib Version: %{version_alsa_lib} -Release: 1%{?prever_dot}%{?dist} +Release: 2%{?prever_dot}%{?dist} License: LGPL-2.1-or-later URL: http://www.alsa-project.org/ @@ -178,6 +178,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Fri Jan 16 2026 Fedora Release Engineering - 1.2.15.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild + * Tue Jan 13 2026 Jaroslav Kysela - 1.2.15.3-1 - update to 1.2.15.3