import fixes from upstream (UCM: AMD ACP6x, HDA, sof-hda-dsp)

Resolves: rhbz#2005061
This commit is contained in:
Jaroslav Kysela 2022-02-09 16:24:32 +01:00
parent c0e77db165
commit d4bd778aea
3 changed files with 445 additions and 1 deletions

View File

@ -0,0 +1,285 @@
From d6adde0e32376554e461098dcd7cfdb824fabd1e Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Mon, 13 Dec 2021 14:40:56 +0100
Subject: [PATCH 1/4] ucm: top-level path - set directory from symlink
It is useful to read the top-level symlink and set the configuration
directory according this symlink for the relative paths.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
src/ucm/parser.c | 55 +++++++++++++++++++++++++++++++++++++++---------
1 file changed, 45 insertions(+), 10 deletions(-)
diff --git a/src/ucm/parser.c b/src/ucm/parser.c
index 48790057..7bdaa8fe 100644
--- a/src/ucm/parser.c
+++ b/src/ucm/parser.c
@@ -31,6 +31,7 @@
*/
#include "ucm_local.h"
+#include <sys/stat.h>
#include <stdbool.h>
#include <dirent.h>
#include <limits.h>
@@ -2186,6 +2187,7 @@ static int parse_toplevel_path(snd_use_case_mgr_t *uc_mgr,
snd_config_t *n, *n2;
const char *id;
char *dir = NULL, *file = NULL, fn[PATH_MAX];
+ struct stat st;
long version;
int err;
@@ -2260,23 +2262,51 @@ static int parse_toplevel_path(snd_use_case_mgr_t *uc_mgr,
}
ucm_filename(fn, sizeof(fn), version, dir, file);
- if (access(fn, R_OK) == 0) {
- if (replace_string(&uc_mgr->conf_dir_name, dir) == NULL) {
- err = -ENOMEM;
- goto __error;
- }
- if (replace_string(&uc_mgr->conf_file_name, file) == NULL) {
- err = -ENOMEM;
- goto __error;
+ if (access(fn, R_OK) == 0 && lstat(fn, &st) == 0) {
+ if (st.st_mode & S_IFLNK) {
+ ssize_t r;
+ char *link, *dir2, *p;
+
+ link = malloc(PATH_MAX);
+ if (link == NULL)
+ goto __enomem;
+ r = readlink(fn, link, PATH_MAX - 1);
+ if (r <= 0) {
+ free(link);
+ goto __next;
+ }
+ link[r] = '\0';
+ p = strrchr(link, '/');
+ if (p) {
+ *p = '\0';
+ dir2 = malloc(PATH_MAX);
+ if (dir2 == NULL) {
+ free(link);
+ goto __enomem;
+ }
+ strncpy(dir2, dir, PATH_MAX - 1);
+ strncat(dir2, "/", PATH_MAX - 1);
+ strncat(dir2, link, PATH_MAX - 1);
+ fn[PATH_MAX - 1] = '\0';
+ free(dir);
+ dir = dir2;
+ }
+ free(link);
}
+ if (replace_string(&uc_mgr->conf_dir_name, dir) == NULL)
+ goto __enomem;
+ if (replace_string(&uc_mgr->conf_file_name, file) == NULL)
+ goto __enomem;
strncpy(filename, fn, PATH_MAX);
+ filename[PATH_MAX - 1] = '\0';
uc_mgr->conf_format = version;
goto __ok;
}
__next:
free(file);
- free(dir);
+ if (dir != fn)
+ free(dir);
dir = NULL;
file = NULL;
}
@@ -2284,11 +2314,16 @@ __next:
err = -ENOENT;
goto __error;
+__enomem:
+ err = -ENOMEM;
+ goto __error;
+
__ok:
err = 0;
__error:
free(file);
- free(dir);
+ if (dir != fn)
+ free(dir);
return err;
}
--
2.34.1
From 47252054b4a2d5c8382cb1342f5d4eb89dabf95f Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Sat, 1 Jan 2022 17:20:47 +0100
Subject: [PATCH 2/4] src/topology/parser.c: drop duplicate safe_strtol_base
The safe_strtol_base() function is defined twice since
f547b2e3 ("conf: introduce safe_strtol_base()") and
5fab157a ("topology: do not call strtol directly")
resulting in the following build failure when alsa-utils is built
statically because safe_strtol_base is defined twice.
Fixes: http://autobuild.buildroot.org/results/08d028004090b2a8292f03910cb9bf80a73ac804
Fixes: https://github.com/alsa-project/alsa-lib/pull/207
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
src/topology/parser.c | 19 -------------------
1 file changed, 19 deletions(-)
diff --git a/src/topology/parser.c b/src/topology/parser.c
index 01c95afa..e70173f6 100644
--- a/src/topology/parser.c
+++ b/src/topology/parser.c
@@ -21,25 +21,6 @@
#include "list.h"
#include "tplg_local.h"
-/*
- * Safe strtol call
- */
-int safe_strtol_base(const char *str, long *val, int base)
-{
- char *end;
- long v;
- if (!*str)
- return -EINVAL;
- errno = 0;
- v = strtol(str, &end, base);
- if (errno)
- return -errno;
- if (*end)
- return -EINVAL;
- *val = v;
- return 0;
-}
-
/*
* Get integer value
*/
--
2.34.1
From c687c482107f746332dd18f7407f6c6efbffccb2 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Sat, 1 Jan 2022 19:18:25 +0100
Subject: [PATCH 3/4] conf: fix the export of safe_strto* functions from
libasound
Only one library should define the safe_strto function. Export it
correctly and add _snd_ prefix to avoid possible clashes with the other
application code.
Fixes: 47252054 ("src/topology/parser.c: drop duplicate safe_strtol_base")
Fixes: https://github.com/alsa-project/alsa-lib/pull/208
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
include/local.h | 8 ++++++--
src/Versions.in | 6 ++++++
src/conf.c | 6 +++---
3 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/include/local.h b/include/local.h
index ebc9350c..f64fe9d8 100644
--- a/include/local.h
+++ b/include/local.h
@@ -232,10 +232,14 @@ size_t page_align(size_t size);
size_t page_size(void);
size_t page_ptr(size_t object_offset, size_t object_size, size_t *offset, size_t *mmap_offset);
-int safe_strtoll_base(const char *str, long long *val, int base);
+#define safe_strtoll_base _snd_safe_strtoll_base
+int _snd_safe_strtoll_base(const char *str, long long *val, int base);
static inline int safe_strtoll(const char *str, long long *val) { return safe_strtoll_base(str, val, 0); }
-int safe_strtol_base(const char *str, long *val, int base);
+#define safe_strtol_base _snd_safe_strtol_base
+int _snd_safe_strtol_base(const char *str, long *val, int base);
static inline int safe_strtol(const char *str, long *val) { return safe_strtol_base(str, val, 0); }
+#define safe_strtod _snd_safe_strtod
+int _snd_safe_strtod(const char *str, double *val);
int snd_send_fd(int sock, void *data, size_t len, int fd);
int snd_receive_fd(int sock, void *data, size_t len, int *fd);
diff --git a/src/Versions.in b/src/Versions.in
index 5daccbd4..85031b38 100644
--- a/src/Versions.in
+++ b/src/Versions.in
@@ -134,3 +134,9 @@ ALSA_1.1.6 {
@SYMBOL_PREFIX@snd_dlopen;
} ALSA_0.9.7;
+
+ALSA_1.2.6 {
+ global:
+
+ @SYMBOL_PREFIX@_snd_safe_strto*;
+} ALSA_1.1.6;
diff --git a/src/conf.c b/src/conf.c
index d3597cbc..098ebd63 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -663,7 +663,7 @@ static int input_stdio_open(snd_input_t **inputp, const char *file,
return err;
}
-int safe_strtoll_base(const char *str, long long *val, int base)
+int _snd_safe_strtoll_base(const char *str, long long *val, int base)
{
char *end;
long v;
@@ -679,7 +679,7 @@ int safe_strtoll_base(const char *str, long long *val, int base)
return 0;
}
-int safe_strtol_base(const char *str, long *val, int base)
+int _snd_safe_strtol_base(const char *str, long *val, int base)
{
char *end;
long v;
@@ -695,7 +695,7 @@ int safe_strtol_base(const char *str, long *val, int base)
return 0;
}
-static int safe_strtod(const char *str, double *val)
+int _snd_safe_strtod(const char *str, double *val)
{
char *end;
double v;
--
2.34.1
From 3dbe072d8deba7c11f6e766ef80c0e50a69447d0 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Thu, 27 Jan 2022 18:25:00 +0100
Subject: [PATCH 4/4] conf: snd_config_merge - fix comment (overwrite /
override)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
src/conf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/conf.c b/src/conf.c
index 098ebd63..70f0e773 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -2276,7 +2276,7 @@ static int _snd_config_array_merge(snd_config_t *dst, snd_config_t *src, int ind
*
* \par Errors:
* <dl>
- * <dt>-EEXIST<dd>identifier already exists (!overwrite)
+ * <dt>-EEXIST<dd>identifier already exists (!override)
* <dt>-ENOMEM<dd>not enough memory
* </dl>
*/
--
2.34.1

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 Feb 9 2022 Jaroslav Kysela <perex@perex.cz> - 1.2.6.1-2
- import fixes from upstream (UCM: AMD ACP6x, HDA, sof-hda-dsp)
* Mon Dec 20 2021 Jaroslav Kysela <perex@perex.cz> - 1.2.6.1-1
- update to alsa-lib 1.2.6.1 and alsa-ucm-conf 1.2.6.3

View File

@ -0,0 +1,156 @@
From 0b2aa9d22f8897cbe68f1aa2ffe437ad3194ec4b Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Mon, 27 Dec 2021 22:05:16 +0100
Subject: [PATCH 1/4] HDA-DualCodecs: fix typo in Speaker condition
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
ucm2/HDA/DualCodecs/HiFi.conf | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ucm2/HDA/DualCodecs/HiFi.conf b/ucm2/HDA/DualCodecs/HiFi.conf
index 7dcd6b0..1f7e58d 100644
--- a/ucm2/HDA/DualCodecs/HiFi.conf
+++ b/ucm2/HDA/DualCodecs/HiFi.conf
@@ -19,7 +19,7 @@ SectionVerb {
If.speaker {
Condition {
Type ControlExists
- Control "name='Speaker Volume Switch'"
+ Control "name='Speaker Playback Switch'"
}
True {
SectionVerb {
@@ -100,7 +100,7 @@ SectionDevice."Headphones" {
If.speaker {
Condition {
Type ControlExists
- Control "name='Speaker Volume Switch'"
+ Control "name='Speaker Playback Switch'"
}
True.Value.JackHWMute "Speaker"
}
--
2.34.1
From 369f8b497e15a993d411df81a39ee5c8c1433363 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Fri, 7 Jan 2022 10:57:48 +0100
Subject: [PATCH 2/4] HDA-acp: avoid to create 'Mic ACP LED' control for the
HDMI card
BugLink: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1849#note_1210933
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
ucm2/HDA/HDA.conf | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/ucm2/HDA/HDA.conf b/ucm2/HDA/HDA.conf
index 003d941..ab80fa5 100644
--- a/ucm2/HDA/HDA.conf
+++ b/ucm2/HDA/HDA.conf
@@ -43,13 +43,21 @@ If.use {
Comment "Play HiFi quality Music"
}
- Include.init.File "/HDA/init.conf"
+ If.analog {
+ Condition {
+ Type ControlExists
+ Control "name='Master Playback Switch'"
+ }
+ True {
+ Include.init.File "/HDA/init.conf"
- FixedBootSequence [
- 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"
- ]
+ FixedBootSequence [
+ 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"
+ ]
+ }
+ }
}
}
--
2.34.1
From 642db9b51ff7f8ad022fee0362871ceaa46599bf Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Thu, 27 Jan 2022 21:50:32 +0100
Subject: [PATCH 3/4] acp6x: add initial support for AMD Yellow Carp - ACP6x
Link: https://github.com/alsa-project/alsa-ucm-conf/issues/136
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
ucm2/HDA/HDA.conf | 2 +-
ucm2/conf.d/acp6x/acp6x.conf | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
create mode 120000 ucm2/conf.d/acp6x/acp6x.conf
diff --git a/ucm2/HDA/HDA.conf b/ucm2/HDA/HDA.conf
index ab80fa5..411f2e7 100644
--- a/ucm2/HDA/HDA.conf
+++ b/ucm2/HDA/HDA.conf
@@ -3,7 +3,7 @@ Syntax 4
Define.Use "" # a non-empty string to use UCM configuration for HDA devices
Define.Done "" # a non-empty string to skip the end error
-Define.AcpCardId "$${find-card:field=name,return=id,regex='^acp$'}"
+Define.AcpCardId "$${find-card:field=name,return=id,regex='^(acp|acp6x)$'}"
Define.DeviceMic "Mic"
If.dualcodec {
diff --git a/ucm2/conf.d/acp6x/acp6x.conf b/ucm2/conf.d/acp6x/acp6x.conf
new file mode 120000
index 0000000..7298c24
--- /dev/null
+++ b/ucm2/conf.d/acp6x/acp6x.conf
@@ -0,0 +1 @@
+../../common/linked-card.conf
\ No newline at end of file
--
2.34.1
From 8170fffa7bad33c67b7c59ef5d98d92c0c742e91 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Wed, 9 Feb 2022 16:19:31 +0100
Subject: [PATCH 4/4] sof-hda-dsp: fix multiple If.dmic blocks
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Fix multiple If.dmic blocks - rename the first to devdmic
initialization.
Fixes: https://github.com/alsa-project/alsa-ucm-conf/pull/132
Reported-by: Kacper Michajłow <kasper93@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf | 2 +-
1 file changed, 1 insertion(+), 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 b47777b..eb243d1 100644
--- a/ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf
+++ b/ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf
@@ -3,7 +3,7 @@ Syntax 4
Define.DeviceMic "Mic"
Define.DeviceDmic ""
-If.dmic {
+If.devdmic {
Condition {
Type String
Haystack "${CardComponents}"
--
2.34.1