1.2.5 fixes

This commit is contained in:
Jaroslav Kysela 2021-06-02 19:21:12 +02:00
parent 3a13c60e87
commit 9e061ed2ff
3 changed files with 409 additions and 1 deletions

View File

@ -0,0 +1,201 @@
From ddfc32abf5697de1618b9e7ffdf57a0f97013090 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
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 <perex@perex.cz>
---
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 <perex@perex.cz>
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 <perex@perex.cz>
---
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 <perex@perex.cz>
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 <perex@perex.cz>
---
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

View File

@ -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 <perex@perex.cz> - 1.2.5-2
- add upstream fixes (conf + ucm)
* Fri May 28 2021 Jaroslav Kysela <perex@perex.cz> - 1.2.5-1
- update to 1.2.5

View File

@ -0,0 +1,204 @@
From 3bfe5eeb03c3e9fabb9cd8f5b83818c4cfcb74a7 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
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 <perex@perex.cz>
---
...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 <perex@perex.cz>
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 <perex@perex.cz>
---
...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 <perex@perex.cz>
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 <perex@perex.cz>
---
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 <clamor95@gmail.com>
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 <clamor95@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
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