From 3760b256baf7b8b77eed8f0f06300965f0bd3713 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Jun 04 2021 04:11:08 +0000 Subject: import alsa-lib-1.2.5-3.el8 --- diff --git a/.alsa-lib.metadata b/.alsa-lib.metadata index 533b623..41cbb81 100644 --- a/.alsa-lib.metadata +++ b/.alsa-lib.metadata @@ -1,3 +1,3 @@ -5404393a44906f92ba87189b6fd7fa0c031a037e SOURCES/alsa-lib-1.2.4.tar.bz2 -ec30157ecb964594f630dc193f964ddb2ad8bc57 SOURCES/alsa-topology-conf-1.2.4.tar.bz2 -0883058d77c2516d1e2638e16d59e8693dd2e467 SOURCES/alsa-ucm-conf-1.2.4.tar.bz2 +66669eca0b5ab98985082d4971316a29d2a2cbbf SOURCES/alsa-lib-1.2.5.tar.bz2 +8c1d225b9fe108797349e8d0cb6161271aab0f50 SOURCES/alsa-topology-conf-1.2.5.tar.bz2 +d2011adda869a9e1d78a6b029252f2a8cd6a68f6 SOURCES/alsa-ucm-conf-1.2.5.tar.bz2 diff --git a/.gitignore b/.gitignore index 6df8c62..60b4c6a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -SOURCES/alsa-lib-1.2.4.tar.bz2 -SOURCES/alsa-topology-conf-1.2.4.tar.bz2 -SOURCES/alsa-ucm-conf-1.2.4.tar.bz2 +SOURCES/alsa-lib-1.2.5.tar.bz2 +SOURCES/alsa-topology-conf-1.2.5.tar.bz2 +SOURCES/alsa-ucm-conf-1.2.5.tar.bz2 diff --git a/SOURCES/alsa-git.patch b/SOURCES/alsa-git.patch index 5132808..b8f5813 100644 --- a/SOURCES/alsa-git.patch +++ b/SOURCES/alsa-git.patch @@ -1,2459 +1,863 @@ -From ad8c8e5503980295dd8e5e54a6285d2d7e32eb1e Mon Sep 17 00:00:00 2001 +From ddfc32abf5697de1618b9e7ffdf57a0f97013090 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela -Date: Thu, 22 Oct 2020 20:57:32 +0200 -Subject: [PATCH 01/49] dlmisc: the snd_plugin_dir_set / snd_plugin_dir must be - declared even for \!DL_ORIGIN_AVAILABLE +Date: Wed, 2 Jun 2021 08:49:32 +0200 +Subject: [PATCH 01/22] conf: fix load_for_all_cards() -Fixes: 8580c081c2 ("dlsym: add support for ALSA_PLUGIN_DIR environment variable") -BugLink: https://github.com/alsa-project/alsa-lib/issues/91 -Signed-off-by: Jaroslav Kysela ---- - src/dlmisc.c | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/src/dlmisc.c b/src/dlmisc.c -index c9517c55..f20eb593 100644 ---- a/src/dlmisc.c -+++ b/src/dlmisc.c -@@ -42,11 +42,9 @@ - #ifndef PIC - struct snd_dlsym_link *snd_dlsym_start = NULL; - #endif --#ifdef DL_ORIGIN_AVAILABLE - static int snd_plugin_dir_set = 0; - static char *snd_plugin_dir = NULL; - #endif --#endif - - #if defined(DL_ORIGIN_AVAILABLE) && defined(HAVE_LIBPTHREAD) - static pthread_mutex_t snd_dlpath_mutex = PTHREAD_MUTEX_INITIALIZER; --- -2.29.2 - - -From 1d993b37ab4e0b9b6e6b795d7be84ce97b29e20b Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Thu, 29 Oct 2020 20:31:19 +0100 -Subject: [PATCH 02/49] dlmisc: fix snd_plugin_dir locking for not - DL_ORIGIN_AVAILABLE - -Fixes: 8580c081c2 ("dlsym: add support for ALSA_PLUGIN_DIR environment variable") -Signed-off-by: Jaroslav Kysela ---- - src/dlmisc.c | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - -diff --git a/src/dlmisc.c b/src/dlmisc.c -index f20eb593..1dd91356 100644 ---- a/src/dlmisc.c -+++ b/src/dlmisc.c -@@ -46,7 +46,7 @@ static int snd_plugin_dir_set = 0; - static char *snd_plugin_dir = NULL; - #endif - --#if defined(DL_ORIGIN_AVAILABLE) && defined(HAVE_LIBPTHREAD) -+#ifdef HAVE_LIBPTHREAD - static pthread_mutex_t snd_dlpath_mutex = PTHREAD_MUTEX_INITIALIZER; - - static inline void snd_dlpath_lock(void) -@@ -440,12 +440,10 @@ void snd_dlobj_cache_cleanup(void) - free(c); - } - snd_dlobj_unlock(); --#ifdef DL_ORIGIN_AVAILABLE - snd_dlpath_lock(); - snd_plugin_dir_set = 0; - free(snd_plugin_dir); - snd_plugin_dir = NULL; - snd_dlpath_unlock(); --#endif - } - #endif --- -2.29.2 - - -From 2757191e3b85d491705b31c6ecca2dbd96d26ade Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Thu, 29 Oct 2020 20:34:17 +0100 -Subject: [PATCH 03/49] pcm: snd_pcm_mmap_readi - fix typo in comment - -\param size frames to be *read* - -Signed-off-by: Jaroslav Kysela ---- - src/pcm/pcm_mmap.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/pcm/pcm_mmap.c b/src/pcm/pcm_mmap.c -index 9600c383..9cbaae05 100644 ---- a/src/pcm/pcm_mmap.c -+++ b/src/pcm/pcm_mmap.c -@@ -183,7 +183,7 @@ snd_pcm_sframes_t snd_pcm_mmap_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_ufram - * \brief Read interleaved frames from a PCM using direct buffer (mmap) - * \param pcm PCM handle - * \param buffer frames containing buffer -- * \param size frames to be written -+ * \param size frames to be read - * \return a positive number of frames actually read otherwise a - * negative error code - * \retval -EBADFD PCM is not in the right state (#SND_PCM_STATE_PREPARED or #SND_PCM_STATE_RUNNING) --- -2.29.2 - - -From 39bd0e1a5be3620f9123f7fe72ffa6cb7d463b21 Mon Sep 17 00:00:00 2001 -From: Pierre-Louis Bossart -Date: Thu, 12 Nov 2020 10:29:38 -0600 -Subject: [PATCH 04/49] topology: use inclusive language for bclk - -use bclk_provider for structure fields, 'codec_provider' and -'codec_consumer' for options and modify #defines to use CP and CC -suffixes. - -Signed-off-by: Pierre-Louis Bossart -Signed-off-by: Takashi Iwai ---- - include/sound/uapi/asoc.h | 11 +++++++---- - include/topology.h | 2 +- - src/topology/pcm.c | 36 ++++++++++++++++++++++++++---------- - 3 files changed, 34 insertions(+), 15 deletions(-) - -diff --git a/include/sound/uapi/asoc.h b/include/sound/uapi/asoc.h -index 4efb4ec4..ceafb1a9 100644 ---- a/include/sound/uapi/asoc.h -+++ b/include/sound/uapi/asoc.h -@@ -169,10 +169,13 @@ - #define SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP (1 << 3) - - /* DAI topology BCLK parameter -- * For the backwards capability, by default codec is bclk master -+ * For the backwards capability, by default codec is bclk provider - */ --#define SND_SOC_TPLG_BCLK_CM 0 /* codec is bclk master */ --#define SND_SOC_TPLG_BCLK_CS 1 /* codec is bclk slave */ -+#define SND_SOC_TPLG_BCLK_CP 0 /* codec is bclk provider */ -+#define SND_SOC_TPLG_BCLK_CC 1 /* codec is bclk consumer */ -+/* keep previous definitions for compatibility */ -+#define SND_SOC_TPLG_BCLK_CM SND_SOC_TPLG_BCLK_CP -+#define SND_SOC_TPLG_BCLK_CS SND_SOC_TPLG_BCLK_CC - - /* DAI topology FSYNC parameter - * For the backwards capability, by default codec is fsync master -@@ -335,7 +338,7 @@ struct snd_soc_tplg_hw_config { - __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 bclk_provider; /* 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 */ -diff --git a/include/topology.h b/include/topology.h -index 1f52e66e..6c970649 100644 ---- a/include/topology.h -+++ b/include/topology.h -@@ -1028,7 +1028,7 @@ struct snd_tplg_hw_config_template { - unsigned char clock_gated; /* SND_SOC_TPLG_DAI_CLK_GATE_ value */ - unsigned char invert_bclk; /* 1 for inverted BCLK, 0 for normal */ - unsigned char invert_fsync; /* 1 for inverted frame clock, 0 for normal */ -- unsigned char bclk_master; /* SND_SOC_TPLG_BCLK_ value */ -+ unsigned char bclk_provider; /* SND_SOC_TPLG_BCLK_ value */ - unsigned char fsync_master; /* SND_SOC_TPLG_FSYNC_ value */ - unsigned char mclk_direction; /* SND_SOC_TPLG_MCLK_ value */ - unsigned short reserved; /* for 32bit alignment */ -diff --git a/src/topology/pcm.c b/src/topology/pcm.c -index 191b7a0a..f05df348 100644 ---- a/src/topology/pcm.c -+++ b/src/topology/pcm.c -@@ -1411,6 +1411,7 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, - snd_config_t *n; - const char *id, *val = NULL; - int ret, ival; -+ bool provider_legacy; - - elem = tplg_elem_new_common(tplg, cfg, NULL, SND_TPLG_TYPE_HW_CONFIG); - if (!elem) -@@ -1451,8 +1452,15 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, - continue; - } - -- if (strcmp(id, "bclk") == 0 || -- strcmp(id, "bclk_master") == 0) { -+ provider_legacy = false; -+ if (strcmp(id, "bclk_master") == 0) { -+ SNDERR("deprecated option %s, please use 'bclk'\n", id); -+ provider_legacy = true; -+ } -+ -+ if (provider_legacy || -+ strcmp(id, "bclk") == 0) { -+ - if (snd_config_get_string(n, &val) < 0) - return -EINVAL; - -@@ -1462,11 +1470,19 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, - */ - SNDERR("deprecated bclk value '%s'", val); - -- hw_cfg->bclk_master = SND_SOC_TPLG_BCLK_CS; -+ hw_cfg->bclk_provider = SND_SOC_TPLG_BCLK_CC; - } else if (!strcmp(val, "codec_slave")) { -- hw_cfg->bclk_master = SND_SOC_TPLG_BCLK_CS; -+ SNDERR("deprecated bclk value '%s', use 'codec_consumer'", val); -+ -+ hw_cfg->bclk_provider = SND_SOC_TPLG_BCLK_CC; -+ } else if (!strcmp(val, "codec_consumer")) { -+ hw_cfg->bclk_provider = SND_SOC_TPLG_BCLK_CC; - } else if (!strcmp(val, "codec_master")) { -- hw_cfg->bclk_master = SND_SOC_TPLG_BCLK_CM; -+ SNDERR("deprecated bclk value '%s', use 'codec_provider", val); -+ -+ hw_cfg->bclk_provider = SND_SOC_TPLG_BCLK_CP; -+ } else if (!strcmp(val, "codec_provider")) { -+ hw_cfg->bclk_provider = SND_SOC_TPLG_BCLK_CP; - } - continue; - } -@@ -1623,10 +1639,10 @@ int tplg_save_hw_config(snd_tplg_t *tplg ATTRIBUTE_UNUSED, - 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) -+ if (err >= 0 && hc->bclk_provider) - err = tplg_save_printf(dst, pfx, "\tbclk '%s'\n", -- hc->bclk_master == SND_SOC_TPLG_BCLK_CS ? -- "codec_slave" : "codec_master"); -+ hc->bclk_provider == SND_SOC_TPLG_BCLK_CC ? -+ "codec_consumer" : "codec_provider"); - if (err >= 0 && hc->bclk_rate) - err = tplg_save_printf(dst, pfx, "\tbclk_freq %u\n", - hc->bclk_rate); -@@ -1791,7 +1807,7 @@ static int set_link_hw_config(struct snd_soc_tplg_hw_config *cfg, - cfg->clock_gated = tpl->clock_gated; - cfg->invert_bclk = tpl->invert_bclk; - cfg->invert_fsync = tpl->invert_fsync; -- cfg->bclk_master = tpl->bclk_master; -+ cfg->bclk_provider = tpl->bclk_provider; - cfg->fsync_master = tpl->fsync_master; - cfg->mclk_direction = tpl->mclk_direction; - cfg->reserved = tpl->reserved; -@@ -2174,7 +2190,7 @@ next: - 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->bclk_provider = link->hw_config[i].bclk_provider; - 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; --- -2.29.2 - - -From 706192341d1d0bbb906d690b227b9dee5c1fc4b5 Mon Sep 17 00:00:00 2001 -From: Pierre-Louis Bossart -Date: Thu, 12 Nov 2020 10:29:39 -0600 -Subject: [PATCH 05/49] topology: use inclusive language for fsync - -use fsync_provider for structure fields, 'codec_provider' and -'codec_consumer' for options and modify #defines to use CP and CC -suffixes. - -Signed-off-by: Pierre-Louis Bossart -Signed-off-by: Takashi Iwai ---- - include/sound/uapi/asoc.h | 11 +++++++---- - include/topology.h | 2 +- - src/topology/pcm.c | 37 ++++++++++++++++++++++++++----------- - 3 files changed, 34 insertions(+), 16 deletions(-) - -diff --git a/include/sound/uapi/asoc.h b/include/sound/uapi/asoc.h -index ceafb1a9..f32c5697 100644 ---- a/include/sound/uapi/asoc.h -+++ b/include/sound/uapi/asoc.h -@@ -178,10 +178,13 @@ - #define SND_SOC_TPLG_BCLK_CS SND_SOC_TPLG_BCLK_CC - - /* DAI topology FSYNC parameter -- * For the backwards capability, by default codec is fsync master -+ * For the backwards capability, by default codec is fsync provider - */ --#define SND_SOC_TPLG_FSYNC_CM 0 /* codec is fsync master */ --#define SND_SOC_TPLG_FSYNC_CS 1 /* codec is fsync slave */ -+#define SND_SOC_TPLG_FSYNC_CP 0 /* codec is fsync provider */ -+#define SND_SOC_TPLG_FSYNC_CC 1 /* codec is fsync consumer */ -+/* keep previous definitions for compatibility */ -+#define SND_SOC_TPLG_FSYNC_CM SND_SOC_TPLG_FSYNC_CP -+#define SND_SOC_TPLG_FSYNC_CS SND_SOC_TPLG_FSYNC_CC - - /* - * Block Header. -@@ -339,7 +342,7 @@ struct snd_soc_tplg_hw_config { - __u8 invert_bclk; /* 1 for inverted BCLK, 0 for normal */ - __u8 invert_fsync; /* 1 for inverted frame clock, 0 for normal */ - __u8 bclk_provider; /* SND_SOC_TPLG_BCLK_ value */ -- __u8 fsync_master; /* SND_SOC_TPLG_FSYNC_ value */ -+ __u8 fsync_provider; /* 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 */ -diff --git a/include/topology.h b/include/topology.h -index 6c970649..4ade20df 100644 ---- a/include/topology.h -+++ b/include/topology.h -@@ -1029,7 +1029,7 @@ struct snd_tplg_hw_config_template { - unsigned char invert_bclk; /* 1 for inverted BCLK, 0 for normal */ - unsigned char invert_fsync; /* 1 for inverted frame clock, 0 for normal */ - unsigned char bclk_provider; /* SND_SOC_TPLG_BCLK_ value */ -- unsigned char fsync_master; /* SND_SOC_TPLG_FSYNC_ value */ -+ unsigned char fsync_provider; /* SND_SOC_TPLG_FSYNC_ value */ - unsigned char mclk_direction; /* SND_SOC_TPLG_MCLK_ value */ - unsigned short reserved; /* for 32bit alignment */ - unsigned int mclk_rate; /* MCLK or SYSCLK freqency in Hz */ -diff --git a/src/topology/pcm.c b/src/topology/pcm.c -index f05df348..c8f41862 100644 ---- a/src/topology/pcm.c -+++ b/src/topology/pcm.c -@@ -1504,8 +1504,15 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, - continue; - } - -- if (strcmp(id, "fsync") == 0 || -- strcmp(id, "fsync_master") == 0) { -+ provider_legacy = false; -+ if (strcmp(id, "fsync_master") == 0) { -+ SNDERR("deprecated option %s, please use 'fsync'\n", id); -+ provider_legacy = true; -+ } -+ -+ if (provider_legacy || -+ strcmp(id, "fsync") == 0) { -+ - if (snd_config_get_string(n, &val) < 0) - return -EINVAL; - -@@ -1515,11 +1522,19 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, - */ - SNDERR("deprecated fsync value '%s'", val); - -- hw_cfg->fsync_master = SND_SOC_TPLG_FSYNC_CS; -+ hw_cfg->fsync_provider = SND_SOC_TPLG_FSYNC_CC; - } else if (!strcmp(val, "codec_slave")) { -- hw_cfg->fsync_master = SND_SOC_TPLG_FSYNC_CS; -+ SNDERR("deprecated fsync value '%s', use 'codec_consumer'", val); -+ -+ hw_cfg->fsync_provider = SND_SOC_TPLG_FSYNC_CC; -+ } else if (!strcmp(val, "codec_consumer")) { -+ hw_cfg->fsync_provider = SND_SOC_TPLG_FSYNC_CC; - } else if (!strcmp(val, "codec_master")) { -- hw_cfg->fsync_master = SND_SOC_TPLG_FSYNC_CM; -+ SNDERR("deprecated fsync value '%s', use 'codec_provider'", val); -+ -+ hw_cfg->fsync_provider = SND_SOC_TPLG_FSYNC_CP; -+ } else if (!strcmp(val, "codec_provider")) { -+ hw_cfg->fsync_provider = SND_SOC_TPLG_FSYNC_CP; - } - continue; - } -@@ -1648,10 +1663,10 @@ int tplg_save_hw_config(snd_tplg_t *tplg ATTRIBUTE_UNUSED, - 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_provider) -+ err = tplg_save_printf(dst, pfx, "\tfsync_provider '%s'\n", -+ hc->fsync_provider == SND_SOC_TPLG_FSYNC_CC ? -+ "codec_consumer" : "codec_provider"); - if (err >= 0 && hc->fsync_rate) - err = tplg_save_printf(dst, pfx, "\tfsync_freq %u\n", - hc->fsync_rate); -@@ -1808,7 +1823,7 @@ static int set_link_hw_config(struct snd_soc_tplg_hw_config *cfg, - cfg->invert_bclk = tpl->invert_bclk; - cfg->invert_fsync = tpl->invert_fsync; - cfg->bclk_provider = tpl->bclk_provider; -- cfg->fsync_master = tpl->fsync_master; -+ cfg->fsync_provider = tpl->fsync_provider; - cfg->mclk_direction = tpl->mclk_direction; - cfg->reserved = tpl->reserved; - cfg->mclk_rate = tpl->mclk_rate; -@@ -2191,7 +2206,7 @@ next: - hw->invert_bclk = link->hw_config[i].invert_bclk; - hw->invert_fsync = link->hw_config[i].invert_fsync; - hw->bclk_provider = link->hw_config[i].bclk_provider; -- hw->fsync_master = link->hw_config[i].fsync_master; -+ hw->fsync_provider = link->hw_config[i].fsync_provider; - 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; --- -2.29.2 - - -From e5c350d7bc6f3d45702059c0ae8d32b3603273c1 Mon Sep 17 00:00:00 2001 -From: Pierre-Louis Bossart -Date: Thu, 12 Nov 2020 10:29:40 -0600 -Subject: [PATCH 06/49] topology: use inclusive language in documentation - -Use codec_provider and codec_consumer for bclk and fsync - -Signed-off-by: Pierre-Louis Bossart -Signed-off-by: Takashi Iwai ---- - include/topology.h | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/include/topology.h b/include/topology.h -index 4ade20df..d1feee4d 100644 ---- a/include/topology.h -+++ b/include/topology.h -@@ -658,8 +658,8 @@ extern "C" { - * - * id "1" # used for binding to the config - * format "I2S" # physical audio format. -- * bclk "master" # Platform is master of bit clock -- * fsync "slave" # Platform is slave of fsync -+ * bclk "codec_provider" # Codec provides the bit clock -+ * fsync "codec_consumer" # Codec follows the fsync - * } - * - * --- -2.29.2 - - -From 7d36895225d09ae26868997382445cc7ad2e9513 Mon Sep 17 00:00:00 2001 -From: Jonas Holmberg -Date: Wed, 4 Nov 2020 14:49:56 +0100 -Subject: [PATCH 07/49] pcm: set the snd_pcm_ioplug_status() tstamp field - -Set the status tstamp field so that it can be accessed with -snd_pcm_status_get_htstamp(). - -Signed-off-by: Jonas Holmberg -Signed-off-by: Takashi Iwai ---- - src/pcm/pcm_ioplug.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/pcm/pcm_ioplug.c b/src/pcm/pcm_ioplug.c -index a437ca32..9b1b8ac3 100644 ---- a/src/pcm/pcm_ioplug.c -+++ b/src/pcm/pcm_ioplug.c -@@ -115,6 +115,7 @@ static int snd_pcm_ioplug_status(snd_pcm_t *pcm, snd_pcm_status_t * status) - snd_pcm_ioplug_hw_ptr_update(pcm); - status->state = io->data->state; - status->trigger_tstamp = io->trigger_tstamp; -+ gettimestamp(&status->tstamp, pcm->tstamp_type); - status->avail = snd_pcm_mmap_avail(pcm); - status->avail_max = io->avail_max; - return 0; --- -2.29.2 - - -From 6d3311fefb1b41c7484fd728e4ad4a6fb5b55ad4 Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Thu, 10 Dec 2020 10:36:41 +0100 -Subject: [PATCH 08/49] Makefile: Add README.md to EXTRA_DIST - -Signed-off-by: Takashi Iwai ---- - Makefile.am | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Makefile.am b/Makefile.am -index c484d4da..ff4c963a 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -16,7 +16,7 @@ SUBDIRS += alsalisp - endif - endif - SUBDIRS += test utils --EXTRA_DIST=ChangeLog INSTALL TODO NOTES configure gitcompile libtool \ -+EXTRA_DIST=README.md ChangeLog INSTALL TODO NOTES configure gitcompile libtool \ - depcomp version MEMORY-LEAK m4/attributes.m4 - AUTOMAKE_OPTIONS=foreign - --- -2.29.2 - - -From ea02dbd20a535085638c63c6b8bec94e628486c4 Mon Sep 17 00:00:00 2001 -From: David Henningsson -Date: Wed, 16 Dec 2020 19:55:22 +0100 -Subject: [PATCH 09/49] pcm: Add snd_pcm_audio_tstamp_type_t constants - -These are mostly a copy-paste from the kernel headers. But since functions -snd_pcm_audio_tstamp_config make use of these they should be added to the -public API as well. - -Reported-by: Alex Moon -Signed-off-by: David Henningsson -Signed-off-by: Takashi Iwai ---- - include/pcm.h | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -diff --git a/include/pcm.h b/include/pcm.h -index 5b078231..cf1eea8b 100644 ---- a/include/pcm.h -+++ b/include/pcm.h -@@ -350,6 +350,20 @@ typedef enum _snd_pcm_tstamp_type { - SND_PCM_TSTAMP_TYPE_LAST = SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW, - } snd_pcm_tstamp_type_t; - -+typedef enum _snd_pcm_audio_tstamp_type { -+ /** -+ * first definition for backwards compatibility only, -+ * maps to wallclock/link time for HDAudio playback and DEFAULT/DMA time for everything else -+ */ -+ SND_PCM_AUDIO_TSTAMP_TYPE_COMPAT = 0, -+ SND_PCM_AUDIO_TSTAMP_TYPE_DEFAULT = 1, /**< DMA time, reported as per hw_ptr */ -+ SND_PCM_AUDIO_TSTAMP_TYPE_LINK = 2, /**< link time reported by sample or wallclock counter, reset on startup */ -+ SND_PCM_AUDIO_TSTAMP_TYPE_LINK_ABSOLUTE = 3, /**< link time reported by sample or wallclock counter, not reset on startup */ -+ SND_PCM_AUDIO_TSTAMP_TYPE_LINK_ESTIMATED = 4, /**< link time estimated indirectly */ -+ SND_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED = 5, /**< link time synchronized with system time */ -+ SND_PCM_AUDIO_TSTAMP_TYPE_LAST = SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED -+} snd_pcm_audio_tstamp_type_t; -+ - typedef struct _snd_pcm_audio_tstamp_config { - /* 5 of max 16 bits used */ - unsigned int type_requested:4; --- -2.29.2 - - -From dcda999d0000cbdabe61d3d175943b5f23c30057 Mon Sep 17 00:00:00 2001 -From: David Henningsson -Date: Wed, 16 Dec 2020 20:02:52 +0100 -Subject: [PATCH 10/49] test/audio_time: Make use of SND_PCM_AUDIO_TSTAMP_TYPE - constants - -Also fixup the usage row which seemed wrong to me. - -Signed-off-by: David Henningsson -Signed-off-by: Takashi Iwai ---- - test/audio_time.c | 26 +++++++++++++------------- - 1 file changed, 13 insertions(+), 13 deletions(-) - -diff --git a/test/audio_time.c b/test/audio_time.c -index 530922d9..e4d4a944 100644 ---- a/test/audio_time.c -+++ b/test/audio_time.c -@@ -32,7 +32,7 @@ static void usage(char *command) - "-d, --delay add delay \n" - "-D, --device=NAME select PCM by name \n" - "-p, --playback playback tstamps \n" -- "-t, --ts_type=TYPE Default(0),link(1),link_estimated(2),synchronized(3) \n" -+ "-t, --ts_type=TYPE Compat(0),default(1),link(2),link_absolute(3),link_estimated(4),link_synchronized(5) \n" - "-r, --report show audio timestamp and accuracy validity\n" - , command); - } -@@ -201,17 +201,17 @@ int main(int argc, char *argv[]) - goto _exit; - } - -- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, 0)) -+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, SND_PCM_AUDIO_TSTAMP_TYPE_COMPAT)) - printf("Playback supports audio compat timestamps\n"); -- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, 1)) -+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, SND_PCM_AUDIO_TSTAMP_TYPE_DEFAULT)) - printf("Playback supports audio default timestamps\n"); -- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, 2)) -+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, SND_PCM_AUDIO_TSTAMP_TYPE_LINK)) - printf("Playback supports audio link timestamps\n"); -- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, 3)) -+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, SND_PCM_AUDIO_TSTAMP_TYPE_LINK_ABSOLUTE)) - printf("Playback supports audio link absolute timestamps\n"); -- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, 4)) -+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, SND_PCM_AUDIO_TSTAMP_TYPE_LINK_ESTIMATED)) - printf("Playback supports audio link estimated timestamps\n"); -- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, 5)) -+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, SND_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED)) - printf("Playback supports audio link synchronized timestamps\n"); - - snd_pcm_sw_params_alloca(&swparams_p); -@@ -269,17 +269,17 @@ int main(int argc, char *argv[]) - goto _exit; - } - -- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, 0)) -+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, SND_PCM_AUDIO_TSTAMP_TYPE_COMPAT)) - printf("Capture supports audio compat timestamps\n"); -- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, 1)) -+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, SND_PCM_AUDIO_TSTAMP_TYPE_DEFAULT)) - printf("Capture supports audio default timestamps\n"); -- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, 2)) -+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, SND_PCM_AUDIO_TSTAMP_TYPE_LINK)) - printf("Capture supports audio link timestamps\n"); -- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, 3)) -+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, SND_PCM_AUDIO_TSTAMP_TYPE_LINK_ABSOLUTE)) - printf("Capture supports audio link absolute timestamps\n"); -- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, 4)) -+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, SND_PCM_AUDIO_TSTAMP_TYPE_LINK_ESTIMATED)) - printf("Capture supports audio link estimated timestamps\n"); -- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, 5)) -+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, SND_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED)) - printf("Capture supports audio link synchronized timestamps\n"); - - snd_pcm_sw_params_alloca(&swparams_c); --- -2.29.2 - - -From a9cbfecd87777d76a83e5a912ca9bdcf48e31fa9 Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Tue, 22 Dec 2020 16:10:16 +0100 -Subject: [PATCH 11/49] pcm: Fix a typo in SND_PCM_AUDIO_TSTAMP_TYPE_LAST - definition - -It was wrongly defined with SNDRV_ prefix. Fix it. - -Fixes: ea02dbd20a53 ("pcm: Add snd_pcm_audio_tstamp_type_t constants") -Signed-off-by: Takashi Iwai ---- - include/pcm.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/include/pcm.h b/include/pcm.h -index cf1eea8b..e300b951 100644 ---- a/include/pcm.h -+++ b/include/pcm.h -@@ -361,7 +361,7 @@ typedef enum _snd_pcm_audio_tstamp_type { - SND_PCM_AUDIO_TSTAMP_TYPE_LINK_ABSOLUTE = 3, /**< link time reported by sample or wallclock counter, not reset on startup */ - SND_PCM_AUDIO_TSTAMP_TYPE_LINK_ESTIMATED = 4, /**< link time estimated indirectly */ - SND_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED = 5, /**< link time synchronized with system time */ -- SND_PCM_AUDIO_TSTAMP_TYPE_LAST = SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED -+ SND_PCM_AUDIO_TSTAMP_TYPE_LAST = SND_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED - } snd_pcm_audio_tstamp_type_t; - - typedef struct _snd_pcm_audio_tstamp_config { --- -2.29.2 - - -From 5275d170e05639473e68e5feb349aec65bf26428 Mon Sep 17 00:00:00 2001 -From: Alex Henrie -Date: Sat, 26 Dec 2020 14:35:39 -0700 -Subject: [PATCH 12/49] conf: fix use after free in - _snd_config_load_with_include - -Signed-off-by: Alex Henrie -Signed-off-by: Takashi Iwai ---- - src/conf.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/src/conf.c b/src/conf.c -index 7df2b4e7..44d1bfde 100644 ---- a/src/conf.c -+++ b/src/conf.c -@@ -1970,7 +1970,9 @@ int _snd_config_load_with_include(snd_config_t *config, snd_input_t *in, - SNDERR("%s:%d:%d:%s", fd->name ? fd->name : "_toplevel_", fd->line, fd->column, str); - goto _end; - } -- if (get_char(&input) != LOCAL_UNEXPECTED_EOF) { -+ err = get_char(&input); -+ fd = input.current; -+ if (err != LOCAL_UNEXPECTED_EOF) { - SNDERR("%s:%d:%d:Unexpected }", fd->name ? fd->name : "", fd->line, fd->column); - err = -EINVAL; - goto _end; --- -2.29.2 - - -From 0f4821ec1729cd72a3dde3ea63f7857e92a10919 Mon Sep 17 00:00:00 2001 -From: Alex Henrie -Date: Sat, 26 Dec 2020 14:35:40 -0700 -Subject: [PATCH 13/49] ucm: fix bad frees in get_list0 and get_list20 - -Signed-off-by: Alex Henrie -Signed-off-by: Takashi Iwai ---- - 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 3871d5aa..754b967e 100644 ---- a/src/ucm/main.c -+++ b/src/ucm/main.c -@@ -666,7 +666,7 @@ static int get_list0(struct list_head *list, - } - return cnt; - __fail: -- snd_use_case_free_list((const char **)res, cnt); -+ snd_use_case_free_list(*result, cnt); - return -ENOMEM; - } - -@@ -724,7 +724,7 @@ static int get_list20(struct list_head *list, - } - return cnt; - __fail: -- snd_use_case_free_list((const char **)res, cnt); -+ snd_use_case_free_list(*result, cnt); - return -ENOMEM; - } - --- -2.29.2 - - -From c56278cfda55b9f5d106890c7354176dba8c8f4d Mon Sep 17 00:00:00 2001 -From: Alex Henrie -Date: Sat, 26 Dec 2020 14:35:41 -0700 -Subject: [PATCH 14/49] rawmidi: fix memory leak in snd_rawmidi_virtual_open - -Signed-off-by: Alex Henrie -Signed-off-by: Takashi Iwai ---- - src/rawmidi/rawmidi_virt.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/src/rawmidi/rawmidi_virt.c b/src/rawmidi/rawmidi_virt.c -index 2c4c27f5..884b8ff8 100644 ---- a/src/rawmidi/rawmidi_virt.c -+++ b/src/rawmidi/rawmidi_virt.c -@@ -315,7 +315,7 @@ int snd_rawmidi_virtual_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp, - int merge, int mode) - { - int err; -- snd_rawmidi_t *rmidi; -+ snd_rawmidi_t *rmidi = NULL; - snd_rawmidi_virtual_t *virt = NULL; - struct pollfd pfd; - -@@ -392,6 +392,7 @@ int snd_rawmidi_virtual_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp, - free(*inputp); - if (outputp) - free(*outputp); -+ free(rmidi); - return err; - } - --- -2.29.2 - - -From aa28847248f2f416d9ecc6cbfa75192455400f6f Mon Sep 17 00:00:00 2001 -From: Alex Henrie -Date: Sat, 26 Dec 2020 14:35:43 -0700 -Subject: [PATCH 15/49] timer: fix sizeof operator mismatch in - snd_timer_query_hw_open - -Signed-off-by: Alex Henrie -Signed-off-by: Takashi Iwai ---- - src/timer/timer_query_hw.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/timer/timer_query_hw.c b/src/timer/timer_query_hw.c -index dad228c8..d8bac6e7 100644 ---- a/src/timer/timer_query_hw.c -+++ b/src/timer/timer_query_hw.c -@@ -104,7 +104,7 @@ int snd_timer_query_hw_open(snd_timer_query_t **handle, const char *name, int mo - close(fd); - return -SND_ERROR_INCOMPATIBLE_VERSION; - } -- tmr = (snd_timer_query_t *) calloc(1, sizeof(snd_timer_t)); -+ tmr = (snd_timer_query_t *) calloc(1, sizeof(snd_timer_query_t)); - if (tmr == NULL) { - close(fd); - return -ENOMEM; --- -2.29.2 +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. -From 2e470d59d84a563a9efa81572ddc48d9858ceb92 Mon Sep 17 00:00:00 2001 -From: Alex Henrie -Date: Sat, 26 Dec 2020 14:35:44 -0700 -Subject: [PATCH 16/49] pcm: remove dead assignments from - snd_pcm_rate_(commit_area|grab_next_period) - -Signed-off-by: Alex Henrie -Signed-off-by: Takashi Iwai ---- - src/pcm/pcm_rate.c | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c -index 5bf7dbb9..dc38e95e 100644 ---- a/src/pcm/pcm_rate.c -+++ b/src/pcm/pcm_rate.c -@@ -746,7 +746,6 @@ static int snd_pcm_rate_commit_area(snd_pcm_t *pcm, snd_pcm_rate_t *rate, - if (result < 0) - return result; - __partial: -- xfer = 0; - cont = slave_frames; - if (cont > slave_size) - cont = slave_size; -@@ -846,7 +845,6 @@ static int snd_pcm_rate_grab_next_period(snd_pcm_t *pcm, snd_pcm_uframes_t hw_of - if (result < 0) - return result; - __partial: -- xfer = 0; - cont = slave_frames; - if (cont > rate->gen.slave->period_size) - cont = rate->gen.slave->period_size; --- -2.29.2 - - -From fc719bfe4e97bbfce899cc7e67df08ecd573c5d3 Mon Sep 17 00:00:00 2001 -From: Alex Henrie -Date: Sat, 26 Dec 2020 14:35:45 -0700 -Subject: [PATCH 17/49] pcm_multi: remove dead assignment from - _snd_pcm_multi_open - -Signed-off-by: Alex Henrie -Signed-off-by: Takashi Iwai ---- - src/pcm/pcm_multi.c | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/src/pcm/pcm_multi.c b/src/pcm/pcm_multi.c -index 53c414d5..5fa09b9b 100644 ---- a/src/pcm/pcm_multi.c -+++ b/src/pcm/pcm_multi.c -@@ -1323,7 +1323,6 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name, - err = -ENOMEM; - goto _free; - } -- idx = 0; - for (idx = 0; idx < channels_count; ++idx) - channels_sidx[idx] = -1; - idx = 0; --- -2.29.2 - - -From 9ebd29d2d31df0f8967f3e60cf24bb63c95d4984 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Sun, 27 Dec 2020 13:17:26 +0100 -Subject: [PATCH 18/49] conf: fix get_hexachar() return value - -Reported-by: Alex Henrie +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 | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + src/conf.c | 33 ++++++++++++++++++++++++++++----- + 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/src/conf.c b/src/conf.c -index 44d1bfde..6cfe65bf 100644 +index f6c80031..d863dec6 100644 --- a/src/conf.c +++ b/src/conf.c -@@ -887,7 +887,7 @@ static inline int get_hexachar(input_t *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; -+ return num; - } - - static int get_quotedchar(input_t *input) --- -2.29.2 - - -From 36aff79747b23b9535e81befe8b7b2972837bce3 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Sun, 27 Dec 2020 13:29:33 +0100 -Subject: [PATCH 19/49] pcm: fix __snd_pcm_state() return value - -The __snd_pcm_state() must return a valid state, not an error value -when the plugin callback is not defined. Use the first state -SND_PCM_STATE_OPEN - the other functions will return the error -code depending on this state. - -Link: https://lore.kernel.org/alsa-devel/20201226213547.175071-10-alexhenrie24@gmail.com/ -Reported-by: Alex Henrie -Signed-off-by: Jaroslav Kysela ---- - src/pcm/pcm_local.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/pcm/pcm_local.h b/src/pcm/pcm_local.h -index fe77e50d..bec5a408 100644 ---- a/src/pcm/pcm_local.h -+++ b/src/pcm/pcm_local.h -@@ -444,7 +444,7 @@ static inline int __snd_pcm_start(snd_pcm_t *pcm) - static inline snd_pcm_state_t __snd_pcm_state(snd_pcm_t *pcm) +@@ -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) { - if (!pcm->fast_ops->state) -- return -ENOSYS; -+ return SND_PCM_STATE_OPEN; - return pcm->fast_ops->state(pcm->fast_op_arg); - } - --- -2.29.2 - - -From a92ad2fea4b36d7282f4a571275fb492dd1bba75 Mon Sep 17 00:00:00 2001 -From: Alex Henrie -Date: Sun, 27 Dec 2020 18:43:15 -0700 -Subject: [PATCH 20/49] confmisc: fix memory leak in snd_func_concat - -Signed-off-by: Alex Henrie -Signed-off-by: Takashi Iwai ---- - src/confmisc.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/src/confmisc.c b/src/confmisc.c -index eb8218c1..3ce95c7a 100644 ---- a/src/confmisc.c -+++ b/src/confmisc.c -@@ -419,7 +419,6 @@ int snd_func_concat(snd_config_t **dst, snd_config_t *root, snd_config_t *src, - tmp = realloc(res, len + len1 + 1); - if (tmp == NULL) { - free(ptr); -- free(res); - err = -ENOMEM; - goto __error; - } -@@ -440,8 +439,8 @@ int snd_func_concat(snd_config_t **dst, snd_config_t *root, snd_config_t *src, - err = snd_config_get_id(src, &id); - if (err >= 0) - err = snd_config_imake_string(dst, id, res); -- free(res); - __error: -+ free(res); - return err; - } - #ifndef DOC_HIDDEN --- -2.29.2 - - -From 6c24cd2e60cc9c1fca809ffeeb7ffe8af94b201e Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 29 Dec 2020 11:15:46 +0100 -Subject: [PATCH 21/49] conf: fix return code in _snd_config_load_with_include - -Fixes: 5275d170e0 ("conf: fix use after free in _snd_config_load_with_include") -BugLink: https://github.com/alsa-project/alsa-lib/issues/108 -Signed-off-by: Jaroslav Kysela ---- - src/conf.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/conf.c b/src/conf.c -index 6cfe65bf..3c943db2 100644 ---- a/src/conf.c -+++ b/src/conf.c -@@ -1977,6 +1977,7 @@ int _snd_config_load_with_include(snd_config_t *config, snd_input_t *in, - err = -EINVAL; - goto _end; - } -+ err = 0; - _end: - while (fd->next) { - fd_next = fd->next; --- -2.29.2 - - -From afe6ff3b33ee6e5ea3511fe458bfd4e516b10bcf Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 30 Dec 2020 09:31:10 +0100 -Subject: [PATCH 22/49] pcm: plugin status - fix the return value (regression) - -The snd_pcm_plugin_avail_update() error code in snd_pcm_plugin_status() -should not be reported to the caller. The state errors can be determined -using the state member in the status structure. - -Fixes: 4f90392f07e ("pcm: fix the snd_pcm_plugin_status() avail and delay fields") -BugLink: https://github.com/alsa-project/alsa-lib/issues/107 -Signed-off-by: Jaroslav Kysela ---- - src/pcm/pcm_plugin.c | 8 +++----- - 1 file changed, 3 insertions(+), 5 deletions(-) - -diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c -index 5739cfc2..76a524fa 100644 ---- a/src/pcm/pcm_plugin.c -+++ b/src/pcm/pcm_plugin.c -@@ -541,19 +541,17 @@ static snd_pcm_sframes_t snd_pcm_plugin_avail_update(snd_pcm_t *pcm) - static int snd_pcm_plugin_status(snd_pcm_t *pcm, snd_pcm_status_t * status) - { - snd_pcm_plugin_t *plugin = pcm->private_data; -- snd_pcm_sframes_t err, avail; -+ snd_pcm_sframes_t err; - - /* sync with the latest hw and appl ptrs */ -- avail = snd_pcm_plugin_avail_update(pcm); -- if (avail < 0) -- return avail; -+ snd_pcm_plugin_avail_update(pcm); - - err = snd_pcm_status(plugin->gen.slave, status); - if (err < 0) - return err; - status->appl_ptr = *pcm->appl.ptr; - status->hw_ptr = *pcm->hw.ptr; -- status->avail = avail; -+ status->avail = snd_pcm_mmap_avail(pcm); - status->delay = snd_pcm_mmap_delay(pcm); - return 0; - } --- -2.29.2 - - -From 49eea5d7bc7d39f9a4cc1f3b3a813e90b90519eb Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Sun, 3 Jan 2021 16:16:10 +0100 -Subject: [PATCH 23/49] pcm: plugin status - revert the recent changes - -It's no reason to sync the avail/delay fields using the mirrored -buffer pointers. The slave information must be valid. - -The original report probably tries to fix something for -the specific plugin. Revert all changes. - -Fixes: afe6ff3b33e ("pcm: plugin status - fix the return value (regression)") -Fixes: 4f90392f07e ("pcm: fix the snd_pcm_plugin_status() avail and delay fields") -Signed-off-by: Jaroslav Kysela ---- - src/pcm/pcm_plugin.c | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c -index 76a524fa..ea60eb98 100644 ---- a/src/pcm/pcm_plugin.c -+++ b/src/pcm/pcm_plugin.c -@@ -551,8 +551,6 @@ static int snd_pcm_plugin_status(snd_pcm_t *pcm, snd_pcm_status_t * status) - return err; - status->appl_ptr = *pcm->appl.ptr; - status->hw_ptr = *pcm->hw.ptr; -- status->avail = snd_pcm_mmap_avail(pcm); -- status->delay = snd_pcm_mmap_delay(pcm); - return 0; - } - --- -2.29.2 - - -From fa1895aa2b4f3f154e537bee92860fe793045643 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Sun, 3 Jan 2021 16:34:04 +0100 -Subject: [PATCH 24/49] pcm: plugin - tidy snd_pcm_plugin_avail_update() - -No functional changes - move the code to snd_pcm_plugin_sync_hw_ptr() -and put the mmap capture updates to separate function for readability. - -Signed-off-by: Jaroslav Kysela ---- - src/pcm/pcm_plugin.c | 142 +++++++++++++++++++++++-------------------- - 1 file changed, 76 insertions(+), 66 deletions(-) - -diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c -index ea60eb98..83793397 100644 ---- a/src/pcm/pcm_plugin.c -+++ b/src/pcm/pcm_plugin.c -@@ -460,82 +460,92 @@ snd_pcm_plugin_mmap_commit(snd_pcm_t *pcm, - return xfer > 0 ? xfer : err; - } - --static snd_pcm_sframes_t snd_pcm_plugin_avail_update(snd_pcm_t *pcm) -+static snd_pcm_sframes_t -+snd_pcm_plugin_sync_hw_ptr_capture(snd_pcm_t *pcm, -+ snd_pcm_sframes_t slave_size) - { - snd_pcm_plugin_t *plugin = pcm->private_data; - snd_pcm_t *slave = plugin->gen.slave; -- snd_pcm_sframes_t slave_size; -+ const snd_pcm_channel_area_t *areas; -+ snd_pcm_uframes_t xfer, hw_offset, size; - int err; - -- slave_size = snd_pcm_avail_update(slave); -+ xfer = snd_pcm_mmap_capture_avail(pcm); -+ size = pcm->buffer_size - xfer; -+ areas = snd_pcm_mmap_areas(pcm); -+ hw_offset = snd_pcm_mmap_hw_offset(pcm); -+ while (size > 0 && slave_size > 0) { -+ snd_pcm_uframes_t frames = size; -+ snd_pcm_uframes_t cont = pcm->buffer_size - hw_offset; -+ const snd_pcm_channel_area_t *slave_areas; -+ snd_pcm_uframes_t slave_offset; -+ snd_pcm_uframes_t slave_frames = ULONG_MAX; -+ snd_pcm_sframes_t result; -+ /* As mentioned in the ALSA API (see pcm/pcm.c:942): -+ * The function #snd_pcm_avail_update() -+ * have to be called before any mmap begin+commit operation. -+ * Otherwise the snd_pcm_areas_copy will not called a second time. -+ * But this is needed, if the ring buffer wrap is reached and -+ * there is more data available. -+ */ -+ slave_size = snd_pcm_avail_update(slave); -+ result = snd_pcm_mmap_begin(slave, &slave_areas, &slave_offset, &slave_frames); -+ if (result < 0) { -+ err = result; -+ goto error; -+ } -+ if (frames > cont) -+ frames = cont; -+ frames = (plugin->read)(pcm, areas, hw_offset, frames, -+ slave_areas, slave_offset, &slave_frames); -+ result = snd_pcm_mmap_commit(slave, slave_offset, slave_frames); -+ if (result > 0 && (snd_pcm_uframes_t)result != slave_frames) { -+ snd_pcm_sframes_t res; -+ res = plugin->undo_read(slave, areas, hw_offset, frames, slave_frames - result); -+ if (res < 0) { -+ err = res; -+ goto error; + 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; ++ } + } -+ frames -= res; -+ } -+ if (result <= 0) { -+ err = result; -+ goto error; -+ } -+ snd_pcm_mmap_hw_forward(pcm, frames); -+ if (frames == cont) -+ hw_offset = 0; -+ else -+ hw_offset += frames; -+ size -= frames; -+ slave_size -= slave_frames; -+ xfer += frames; -+ } -+ return (snd_pcm_sframes_t)xfer; -+error: -+ return xfer > 0 ? (snd_pcm_sframes_t)xfer : err; -+} -+ -+static snd_pcm_sframes_t snd_pcm_plugin_sync_hw_ptr(snd_pcm_t *pcm, -+ snd_pcm_uframes_t slave_hw_ptr, -+ snd_pcm_sframes_t slave_size) -+{ - if (pcm->stream == SND_PCM_STREAM_CAPTURE && - pcm->access != SND_PCM_ACCESS_RW_INTERLEAVED && - pcm->access != SND_PCM_ACCESS_RW_NONINTERLEAVED) -- goto _capture; -- *pcm->hw.ptr = *slave->hw.ptr; -+ return snd_pcm_plugin_sync_hw_ptr_capture(pcm, slave_size); -+ *pcm->hw.ptr = slave_hw_ptr; - return slave_size; -- _capture: -- { -- const snd_pcm_channel_area_t *areas; -- snd_pcm_uframes_t xfer, hw_offset, size; -- -- xfer = snd_pcm_mmap_capture_avail(pcm); -- size = pcm->buffer_size - xfer; -- areas = snd_pcm_mmap_areas(pcm); -- hw_offset = snd_pcm_mmap_hw_offset(pcm); -- while (size > 0 && slave_size > 0) { -- snd_pcm_uframes_t frames = size; -- snd_pcm_uframes_t cont = pcm->buffer_size - hw_offset; -- const snd_pcm_channel_area_t *slave_areas; -- snd_pcm_uframes_t slave_offset; -- snd_pcm_uframes_t slave_frames = ULONG_MAX; -- snd_pcm_sframes_t result; -- /* As mentioned in the ALSA API (see pcm/pcm.c:942): -- * The function #snd_pcm_avail_update() -- * have to be called before any mmap begin+commit operation. -- * Otherwise the snd_pcm_areas_copy will not called a second time. -- * But this is needed, if the ring buffer wrap is reached and -- * there is more data available. -- */ -- slave_size = snd_pcm_avail_update(slave); -- result = snd_pcm_mmap_begin(slave, &slave_areas, &slave_offset, &slave_frames); -- if (result < 0) { -- err = result; -- goto error; -- } -- if (frames > cont) -- frames = cont; -- frames = (plugin->read)(pcm, areas, hw_offset, frames, -- slave_areas, slave_offset, &slave_frames); -- result = snd_pcm_mmap_commit(slave, slave_offset, slave_frames); -- if (result > 0 && (snd_pcm_uframes_t)result != slave_frames) { -- snd_pcm_sframes_t res; -- -- res = plugin->undo_read(slave, areas, hw_offset, frames, slave_frames - result); -- if (res < 0) { -- err = res; -- goto error; -- } -- frames -= res; -- } -- if (result <= 0) { -- err = result; -- goto error; -- } -- snd_pcm_mmap_hw_forward(pcm, frames); -- if (frames == cont) -- hw_offset = 0; -- else -- hw_offset += frames; -- size -= frames; -- slave_size -= slave_frames; -- xfer += frames; -- } -- return (snd_pcm_sframes_t)xfer; -+} - -- error: -- return xfer > 0 ? (snd_pcm_sframes_t)xfer : err; -- } -+static snd_pcm_sframes_t snd_pcm_plugin_avail_update(snd_pcm_t *pcm) -+{ -+ snd_pcm_plugin_t *plugin = pcm->private_data; -+ snd_pcm_t *slave = plugin->gen.slave; -+ snd_pcm_sframes_t slave_size; -+ -+ slave_size = snd_pcm_avail_update(slave); -+ return snd_pcm_plugin_sync_hw_ptr(pcm, *slave->hw.ptr, slave_size); - } - - static int snd_pcm_plugin_status(snd_pcm_t *pcm, snd_pcm_status_t * status) --- -2.29.2 - - -From 28cc099d9ea3962b033cb1cb9c3e07db828d9ff7 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Sun, 3 Jan 2021 16:41:29 +0100 -Subject: [PATCH 25/49] pcm: plugin - optimize sync in snd_pcm_plugin_status() - -Do hw_ptr sync only once after the status call. This avoids -double update. - -Also, the application pointer must not change when -the status is called. Add assert() call for this condition. - -Signed-off-by: Jaroslav Kysela ---- - src/pcm/pcm_plugin.c | 7 ++----- - 1 file changed, 2 insertions(+), 5 deletions(-) - -diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c -index 83793397..6a815145 100644 ---- a/src/pcm/pcm_plugin.c -+++ b/src/pcm/pcm_plugin.c -@@ -553,14 +553,11 @@ static int snd_pcm_plugin_status(snd_pcm_t *pcm, snd_pcm_status_t * status) - snd_pcm_plugin_t *plugin = pcm->private_data; - snd_pcm_sframes_t err; - -- /* sync with the latest hw and appl ptrs */ -- snd_pcm_plugin_avail_update(pcm); -- - err = snd_pcm_status(plugin->gen.slave, status); - if (err < 0) - return err; -- status->appl_ptr = *pcm->appl.ptr; -- status->hw_ptr = *pcm->hw.ptr; -+ assert(status->appl_ptr == *pcm->appl.ptr); -+ snd_pcm_plugin_sync_hw_ptr(pcm, status->hw_ptr, status->avail); + 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.29.2 +2.30.2 -From 21549e6583f1dfe5b2fe1aaa88345e4645dd96d0 Mon Sep 17 00:00:00 2001 +From 0e4ba2ea8c0402f12a645032a14693eb9b1278e6 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela -Date: Wed, 30 Dec 2020 17:49:33 +0100 -Subject: [PATCH 26/49] Revert "pcm_plugin: fix delay" +Date: Wed, 2 Jun 2021 11:09:43 +0200 +Subject: [PATCH 02/22] ucm: add _alibpref to get the private device prefix -This reverts commit aba87e509898ec9ddb3e319267d7c267409ff100. - -The commit does not look good. The plugins must handle -the delay value correctly. +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 --- - src/pcm/pcm_plugin.c | 6 ------ - 1 file changed, 6 deletions(-) - -diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c -index 6a815145..5787a43d 100644 ---- a/src/pcm/pcm_plugin.c -+++ b/src/pcm/pcm_plugin.c -@@ -142,12 +142,6 @@ static int snd_pcm_plugin_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp) - int err = snd_pcm_delay(plugin->gen.slave, &sd); - if (err < 0) - return err; -- if (pcm->stream == SND_PCM_STREAM_CAPTURE && -- pcm->access != SND_PCM_ACCESS_RW_INTERLEAVED && -- pcm->access != SND_PCM_ACCESS_RW_NONINTERLEAVED) { -- sd += snd_pcm_mmap_capture_avail(pcm); -- } -- - *delayp = sd; - return 0; - } --- -2.29.2 - + include/use-case.h | 1 + + src/ucm/main.c | 21 +++++++++++++++++++++ + 2 files changed, 22 insertions(+) -From 6ca01c07ee13435d6c2db4e9121d9a86cc4b1457 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 30 Dec 2020 19:14:25 +0100 -Subject: [PATCH 27/49] pcm: ioplug - fix the delay calculation in the status - callback - -Signed-off-by: Jaroslav Kysela ---- - src/pcm/pcm_ioplug.c | 32 ++++++++++++++++++-------------- - 1 file changed, 18 insertions(+), 14 deletions(-) - -diff --git a/src/pcm/pcm_ioplug.c b/src/pcm/pcm_ioplug.c -index 9b1b8ac3..f2315a10 100644 ---- a/src/pcm/pcm_ioplug.c -+++ b/src/pcm/pcm_ioplug.c -@@ -107,9 +107,24 @@ static int snd_pcm_ioplug_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t *i - return snd_pcm_channel_info_shm(pcm, info, -1); - } - -+static int snd_pcm_ioplug_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp) -+{ -+ ioplug_priv_t *io = pcm->private_data; -+ -+ if (io->data->version >= 0x010001 && -+ io->data->callback->delay) -+ return io->data->callback->delay(io->data, delayp); -+ else { -+ snd_pcm_ioplug_hw_ptr_update(pcm); -+ *delayp = snd_pcm_mmap_hw_avail(pcm); -+ } -+ return 0; -+} -+ - static int snd_pcm_ioplug_status(snd_pcm_t *pcm, snd_pcm_status_t * status) - { - ioplug_priv_t *io = pcm->private_data; -+ snd_pcm_sframes_t sd; - - memset(status, 0, sizeof(*status)); - snd_pcm_ioplug_hw_ptr_update(pcm); -@@ -118,6 +133,9 @@ static int snd_pcm_ioplug_status(snd_pcm_t *pcm, snd_pcm_status_t * status) - gettimestamp(&status->tstamp, pcm->tstamp_type); - status->avail = snd_pcm_mmap_avail(pcm); - status->avail_max = io->avail_max; -+ if (snd_pcm_ioplug_delay(pcm, &sd) < 0) -+ sd = snd_pcm_mmap_delay(pcm); -+ status->delay = sd; - return 0; - } - -@@ -133,20 +151,6 @@ static int snd_pcm_ioplug_hwsync(snd_pcm_t *pcm) +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; } --static int snd_pcm_ioplug_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp) --{ -- ioplug_priv_t *io = pcm->private_data; -- -- if (io->data->version >= 0x010001 && -- io->data->callback->delay) -- return io->data->callback->delay(io->data, delayp); -- else { -- snd_pcm_ioplug_hw_ptr_update(pcm); -- *delayp = snd_pcm_mmap_hw_avail(pcm); -- } -- return 0; --} -- - static int snd_pcm_ioplug_reset(snd_pcm_t *pcm) - { - ioplug_priv_t *io = pcm->private_data; --- -2.29.2 - - -From 5988bb3ff42827ab4c13f248291ad1767c8d973d Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Sun, 3 Jan 2021 16:56:38 +0100 -Subject: [PATCH 28/49] pcm: rate - tidy up snd_pcm_rate_avail_update() - -No functional change - just move the capture code to -a separate function for the better readability. - -Signed-off-by: Jaroslav Kysela ---- - src/pcm/pcm_rate.c | 37 +++++++++++++++++++++---------------- - 1 file changed, 21 insertions(+), 16 deletions(-) - -diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c -index dc38e95e..7073f8ab 100644 ---- a/src/pcm/pcm_rate.c -+++ b/src/pcm/pcm_rate.c -@@ -964,29 +964,18 @@ static snd_pcm_sframes_t snd_pcm_rate_mmap_commit(snd_pcm_t *pcm, - return size; - } - --static snd_pcm_sframes_t snd_pcm_rate_avail_update(snd_pcm_t *pcm) -+static snd_pcm_sframes_t snd_pcm_rate_avail_update_capture(snd_pcm_t *pcm, -+ snd_pcm_sframes_t slave_size) - { - snd_pcm_rate_t *rate = pcm->private_data; - snd_pcm_t *slave = rate->gen.slave; -- snd_pcm_sframes_t slave_size; -- -- slave_size = snd_pcm_avail_update(slave); -- if (slave_size < 0) -- return slave_size; -- -- if (pcm->stream == SND_PCM_STREAM_CAPTURE) -- goto _capture; -- snd_pcm_rate_sync_hwptr(pcm); -- snd_pcm_rate_sync_playback_area(pcm, rate->appl_ptr); -- return snd_pcm_mmap_avail(pcm); -- _capture: { - snd_pcm_uframes_t xfer, hw_offset, size; - - xfer = snd_pcm_mmap_capture_avail(pcm); - size = pcm->buffer_size - xfer; - hw_offset = snd_pcm_mmap_hw_offset(pcm); - while (size >= pcm->period_size && -- (snd_pcm_uframes_t)slave_size >= rate->gen.slave->period_size) { -+ (snd_pcm_uframes_t)slave_size >= slave->period_size) { - int err = snd_pcm_rate_grab_next_period(pcm, hw_offset); - if (err < 0) - return err; -@@ -994,13 +983,29 @@ static snd_pcm_sframes_t snd_pcm_rate_avail_update(snd_pcm_t *pcm) - return (snd_pcm_sframes_t)xfer; - xfer += pcm->period_size; - size -= pcm->period_size; -- slave_size -= rate->gen.slave->period_size; -+ slave_size -= slave->period_size; - hw_offset += pcm->period_size; - hw_offset %= pcm->buffer_size; - snd_pcm_mmap_hw_forward(pcm, pcm->period_size); - } - return (snd_pcm_sframes_t)xfer; -- } -+} -+ -+static snd_pcm_sframes_t snd_pcm_rate_avail_update(snd_pcm_t *pcm) ++/** ++ * \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) +{ -+ snd_pcm_rate_t *rate = pcm->private_data; -+ snd_pcm_sframes_t slave_size; ++ const size_t l = 9; ++ char *s; + -+ slave_size = snd_pcm_avail_update(rate->gen.slave); -+ if (slave_size < 0) -+ return slave_size; -+ -+ if (pcm->stream == SND_PCM_STREAM_CAPTURE) -+ return snd_pcm_rate_avail_update_capture(pcm, slave_size); ++ s = malloc(l); ++ if (s == NULL) ++ return -ENOMEM; ++ snprintf(s, l, "_ucm%04X", uc_mgr->ucm_card_number); ++ *str = s; ++ return 0; ++} + -+ snd_pcm_rate_sync_hwptr(pcm); -+ snd_pcm_rate_sync_playback_area(pcm, rate->appl_ptr); -+ return snd_pcm_mmap_avail(pcm); - } - - static int snd_pcm_rate_htimestamp(snd_pcm_t *pcm, + /** + * \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.29.2 +2.30.2 -From 6cee452eabc5cfdf0a6955033b8ac8f6e12ea883 Mon Sep 17 00:00:00 2001 +From 9621d0bff2e60b43e329ffa5059ab19f2914ec14 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela -Date: Sun, 3 Jan 2021 17:13:50 +0100 -Subject: [PATCH 29/49] pcm: ioplug - fix the delay calculation for old plugins +Date: Wed, 2 Jun 2021 11:21:54 +0200 +Subject: [PATCH 03/22] 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/pcm/pcm_ioplug.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + src/ucm/main.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) -diff --git a/src/pcm/pcm_ioplug.c b/src/pcm/pcm_ioplug.c -index f2315a10..e141b1f9 100644 ---- a/src/pcm/pcm_ioplug.c -+++ b/src/pcm/pcm_ioplug.c -@@ -116,7 +116,7 @@ static int snd_pcm_ioplug_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp) - return io->data->callback->delay(io->data, delayp); - else { - snd_pcm_ioplug_hw_ptr_update(pcm); -- *delayp = snd_pcm_mmap_hw_avail(pcm); -+ *delayp = snd_pcm_mmap_delay(pcm); - } +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.29.2 +2.30.2 -From fc0f7af9ee7bd4c31c2bab229e8e79eb96e908fa Mon Sep 17 00:00:00 2001 +From 2a1dafdbe5932260aeb4db359ce5d630b8106889 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela -Date: Mon, 4 Jan 2021 12:29:00 +0100 -Subject: [PATCH 30/49] pcm: rate - use pcm_frame_diff() in - snd_pcm_rate_playback_internal_delay() +Date: Wed, 2 Jun 2021 19:26:47 +0200 +Subject: [PATCH 04/22] conf: remove dead code in snd_config_get_card() Signed-off-by: Jaroslav Kysela --- - src/pcm/pcm_rate.c | 6 +----- - 1 file changed, 1 insertion(+), 5 deletions(-) - -diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c -index 7073f8ab..abb2753f 100644 ---- a/src/pcm/pcm_rate.c -+++ b/src/pcm/pcm_rate.c -@@ -612,11 +612,7 @@ static snd_pcm_uframes_t snd_pcm_rate_playback_internal_delay(snd_pcm_t *pcm) - { - snd_pcm_rate_t *rate = pcm->private_data; - -- if (rate->appl_ptr < rate->last_commit_ptr) { -- return rate->appl_ptr - rate->last_commit_ptr + pcm->boundary; -- } else { -- return rate->appl_ptr - rate->last_commit_ptr; -- } -+ return pcm_frame_diff(rate->appl_ptr, rate->last_commit_ptr, pcm->boundary); - } + 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; - static int snd_pcm_rate_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp) +- 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.29.2 +2.30.2 -From da5b70d3fae091a8568b80a476c1cf340965805a Mon Sep 17 00:00:00 2001 +From 013ec607db9de11b682f2b85d843be062ca0d046 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela -Date: Mon, 4 Jan 2021 12:32:25 +0100 -Subject: [PATCH 31/49] pcm: plugin - fix status code for capture - -The recent updates do not take in account the possible -calls for the capture stream. Fix the avail and delay -inconsistencies (and assert). +Date: Wed, 2 Jun 2021 19:28:32 +0200 +Subject: [PATCH 05/22] control: remap - fix uninitialized value in + parse_map_vindex() Signed-off-by: Jaroslav Kysela --- - src/pcm/pcm_plugin.c | 21 +++++++++++++++++++-- - 1 file changed, 19 insertions(+), 2 deletions(-) - -diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c -index 5787a43d..7ed6f25a 100644 ---- a/src/pcm/pcm_plugin.c -+++ b/src/pcm/pcm_plugin.c -@@ -545,13 +545,30 @@ static snd_pcm_sframes_t snd_pcm_plugin_avail_update(snd_pcm_t *pcm) - static int snd_pcm_plugin_status(snd_pcm_t *pcm, snd_pcm_status_t * status) - { - snd_pcm_plugin_t *plugin = pcm->private_data; -- snd_pcm_sframes_t err; -+ snd_pcm_sframes_t err, diff; - - err = snd_pcm_status(plugin->gen.slave, status); - if (err < 0) - return err; -- assert(status->appl_ptr == *pcm->appl.ptr); - snd_pcm_plugin_sync_hw_ptr(pcm, status->hw_ptr, status->avail); -+ /* -+ * For capture stream, the situation is more complicated, because -+ * snd_pcm_plugin_avail_update() commits the data to the slave pcm. -+ * It means that the slave appl_ptr is updated. Calculate diff and -+ * update the delay and avail. -+ * -+ * This resolves the data inconsistency for immediate calls: -+ * snd_pcm_avail_update() -+ * snd_pcm_status() -+ */ -+ if (pcm->stream == SND_PCM_STREAM_CAPTURE) { -+ status->appl_ptr = *pcm->appl.ptr; -+ diff = pcm_frame_diff(status->appl_ptr, *pcm->appl.ptr, pcm->boundary); -+ status->avail += diff; -+ status->delay += diff; -+ } else { -+ assert(status->appl_ptr == *pcm->appl.ptr); -+ } - return 0; - } - + 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.29.2 +2.30.2 -From ac520b2ed11f31e789a4da1d55e360e3eaeac50d Mon Sep 17 00:00:00 2001 +From 2fee6af9b6e157475159d284af8de1e879bb7a36 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela -Date: Mon, 4 Jan 2021 17:14:42 +0100 -Subject: [PATCH 32/49] pcm: rate - use pcm_frame_diff() on related places +Date: Wed, 2 Jun 2021 19:35:44 +0200 +Subject: [PATCH 06/22] pcm: direct - fix pcmp error path in + _snd_pcm_direct_new() Signed-off-by: Jaroslav Kysela --- - src/pcm/pcm_rate.c | 20 +++++++------------- - 1 file changed, 7 insertions(+), 13 deletions(-) - -diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c -index abb2753f..3d301d0e 100644 ---- a/src/pcm/pcm_rate.c -+++ b/src/pcm/pcm_rate.c -@@ -561,17 +561,16 @@ snd_pcm_rate_read_areas1(snd_pcm_t *pcm, - - static inline void snd_pcm_rate_sync_hwptr0(snd_pcm_t *pcm, snd_pcm_uframes_t slave_hw_ptr) - { -- snd_pcm_rate_t *rate = pcm->private_data; -- -- snd_pcm_sframes_t slave_hw_ptr_diff = slave_hw_ptr - rate->last_slave_hw_ptr; -+ snd_pcm_rate_t *rate; -+ snd_pcm_sframes_t slave_hw_ptr_diff; - snd_pcm_sframes_t last_slave_hw_ptr_frac; - - if (pcm->stream != SND_PCM_STREAM_PLAYBACK) - return; - -- if (slave_hw_ptr_diff < 0) -- slave_hw_ptr_diff += rate->gen.slave->boundary; /* slave boundary wraparound */ -- else if (slave_hw_ptr_diff == 0) -+ rate = pcm->private_data; -+ slave_hw_ptr_diff = pcm_frame_diff(slave_hw_ptr, rate->last_slave_hw_ptr, rate->gen.slave->boundary); -+ if (slave_hw_ptr_diff == 0) - return; - last_slave_hw_ptr_frac = rate->last_slave_hw_ptr % rate->gen.slave->period_size; - /* While handling fraction part fo slave period, rounded value will be -@@ -922,10 +921,7 @@ static int snd_pcm_rate_sync_playback_area(snd_pcm_t *pcm, snd_pcm_uframes_t app - if (slave_size < 0) - return slave_size; + 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; -- if (appl_ptr < rate->last_commit_ptr) -- xfer = appl_ptr - rate->last_commit_ptr + pcm->boundary; -- else -- xfer = appl_ptr - rate->last_commit_ptr; -+ xfer = pcm_frame_diff(appl_ptr, rate->last_commit_ptr, pcm->boundary); - while (xfer >= pcm->period_size && - (snd_pcm_uframes_t)slave_size >= rate->gen.slave->period_size) { - err = snd_pcm_rate_commit_next_period(pcm, rate->last_commit_ptr % pcm->buffer_size); -@@ -1059,9 +1055,7 @@ static int snd_pcm_rate_drain(snd_pcm_t *pcm) - sw_params.avail_min = 1; - snd_pcm_sw_params(rate->gen.slave, &sw_params); + 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; + } -- size = rate->appl_ptr - rate->last_commit_ptr; -- if (size > pcm->boundary) -- size -= pcm->boundary; -+ size = pcm_frame_diff(rate->appl_ptr, rate->last_commit_ptr, pcm->boundary); - ofs = rate->last_commit_ptr % pcm->buffer_size; - while (size > 0) { - snd_pcm_uframes_t psize, spsize; ++ return ret; ++_err_nosem_free: ++ snd_pcm_free(*pcmp); ++ *pcmp = NULL; ++_err_nosem: ++ free(dmix->bindings); ++ free(dmix); + return ret; + } -- -2.29.2 +2.30.2 -From b62f66442bfbcea7c11afe4917e196fa95a65083 Mon Sep 17 00:00:00 2001 +From eb95cad4e22a0bf2577f1fa4a3f6fd18caed3362 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela -Date: Mon, 4 Jan 2021 17:27:32 +0100 -Subject: [PATCH 33/49] pcm: rate - fix the capture delay values - -Use the correct snd_pcm_mmap_capture_delay() function instead -snd_pcm_mmap_capture_hw_avail(). +Date: Wed, 2 Jun 2021 19:37:53 +0200 +Subject: [PATCH 07/22] pcm: remove extra NULL checks in snd_pcm_dmix_open() Signed-off-by: Jaroslav Kysela --- - src/pcm/pcm_rate.c | 8 ++------ - 1 file changed, 2 insertions(+), 6 deletions(-) - -diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c -index 3d301d0e..770aafea 100644 ---- a/src/pcm/pcm_rate.c -+++ b/src/pcm/pcm_rate.c -@@ -632,7 +632,7 @@ static int snd_pcm_rate_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp) - + snd_pcm_rate_playback_internal_delay(pcm); - } else { - *delayp = rate->ops.output_frames(rate->obj, slave_delay) -- + snd_pcm_mmap_capture_hw_avail(pcm); -+ + snd_pcm_mmap_capture_delay(pcm); - } - return 0; + 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; } -@@ -1157,12 +1157,8 @@ static int snd_pcm_rate_status(snd_pcm_t *pcm, snd_pcm_status_t * status) - status->avail = snd_pcm_mmap_playback_avail(pcm); - status->avail_max = rate->ops.input_frames(rate->obj, status->avail_max); - } else { -- /* FIXME: Maybe possible to somthing similar to -- * snd_pcm_rate_playback_internal_delay() -- * for the capture case. -- */ - status->delay = rate->ops.output_frames(rate->obj, status->delay) -- + snd_pcm_mmap_capture_hw_avail(pcm); -+ + snd_pcm_mmap_capture_delay(pcm); - status->avail = snd_pcm_mmap_capture_avail(pcm); - status->avail_max = rate->ops.output_frames(rate->obj, status->avail_max); - } + -- -2.29.2 +2.30.2 -From 437b5b3aae8b1d9f65289f563deb0fa6356a0fa6 Mon Sep 17 00:00:00 2001 +From 01a45aec6fcd5a5378a5b5e0ae0f9dacde2068e4 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela -Date: Thu, 7 Jan 2021 17:32:11 +0100 -Subject: [PATCH 34/49] ucm: fix possible memory leak in parse_verb_file() +Date: Wed, 2 Jun 2021 19:39:32 +0200 +Subject: [PATCH 08/22] pcm: remove extra NULL checks in snd_pcm_dsnoop_open() Signed-off-by: Jaroslav Kysela --- - src/ucm/parser.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + src/pcm/pcm_dsnoop.c | 13 +++++-------- + 1 file changed, 5 insertions(+), 8 deletions(-) -diff --git a/src/ucm/parser.c b/src/ucm/parser.c -index 75b78826..c8bee1f2 100644 ---- a/src/ucm/parser.c -+++ b/src/ucm/parser.c -@@ -1575,7 +1575,7 @@ static int parse_verb_file(snd_use_case_mgr_t *uc_mgr, - /* in-place evaluation */ - err = uc_mgr_evaluate_inplace(uc_mgr, cfg); - if (err < 0) -- return err; -+ goto _err; +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; + } - /* parse master config sections */ - snd_config_for_each(i, next, cfg) { -- -2.29.2 +2.30.2 -From d0bb8f84c92357bfd0e024efe5f6d53a963c4d7a Mon Sep 17 00:00:00 2001 +From 74c6382df6cf18b801659d8c5c53407a7ea1f02b Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela -Date: Thu, 7 Jan 2021 17:34:00 +0100 -Subject: [PATCH 35/49] topology: tplg_pprint_integer() fix coverity - uninitalized variable error +Date: Wed, 2 Jun 2021 19:46:46 +0200 +Subject: [PATCH 09/22] pcm: remove extra NULL checks in snd_pcm_dshare_open() Signed-off-by: Jaroslav Kysela --- - src/topology/save.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/topology/save.c b/src/topology/save.c -index c7a5a801..f7af7af3 100644 ---- a/src/topology/save.c -+++ b/src/topology/save.c -@@ -133,6 +133,8 @@ static int tplg_pprint_integer(snd_config_t *n, char **ret) - if (llval < INT_MIN || llval > UINT_MAX) - return snd_config_get_ascii(n, ret); - lval = llval; -+ } else { -+ lval = 0; - } - err = tplg_nice_value_format(buf, sizeof(buf), (unsigned int)lval); - if (err < 0) + 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.29.2 +2.30.2 -From b8764a061b83284be60adc01c1f7b035c4484ace Mon Sep 17 00:00:00 2001 +From eabadf545c51d4c88c5f359db73726ec3ac653ba Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela -Date: Thu, 7 Jan 2021 17:36:04 +0100 -Subject: [PATCH 36/49] topology: tplg_add_widget_object() - do not use invalid - elem_ctl +Date: Wed, 2 Jun 2021 19:49:29 +0200 +Subject: [PATCH 10/22] pcm: softvol - fix early exit in add_tlv_info() Signed-off-by: Jaroslav Kysela --- - src/topology/dapm.c | 1 + - 1 file changed, 1 insertion(+) + src/pcm/pcm_softvol.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) -diff --git a/src/topology/dapm.c b/src/topology/dapm.c -index 92dc01aa..f6a84a60 100644 ---- a/src/topology/dapm.c -+++ b/src/topology/dapm.c -@@ -836,6 +836,7 @@ int tplg_add_widget_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) - default: - SNDERR("widget %s: invalid type %d for ctl %d", - wt->name, ct->type, i); -+ ret = -EINVAL; - break; - } +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.29.2 +2.30.2 -From 0dbaba95f4bc59602bf2d3fb12a60db7444e5892 Mon Sep 17 00:00:00 2001 +From cf3846d46053b23006e6a9042b586fc78e81af55 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela -Date: Thu, 7 Jan 2021 17:38:50 +0100 -Subject: [PATCH 37/49] topology: tplg_decode_pcm() - add missing log argument - (compress) +Date: Wed, 2 Jun 2021 19:50:17 +0200 +Subject: [PATCH 11/22] timer: remove dead code in _snd_timer_hw_open() -Signed-off-by: Jaroslav Kysela --- - src/topology/pcm.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + src/timer/timer_hw.c | 2 -- + 1 file changed, 2 deletions(-) -diff --git a/src/topology/pcm.c b/src/topology/pcm.c -index c8f41862..a473b59b 100644 ---- a/src/topology/pcm.c -+++ b/src/topology/pcm.c -@@ -2020,7 +2020,7 @@ next: - pt->playback = pcm->playback; - pt->capture = pcm->capture; - pt->compress = pcm->compress; -- tplg_log(tplg, 'D', pos, "pcm: playback %d capture %d compress", -+ tplg_log(tplg, 'D', pos, "pcm: playback %d capture %d compress %d", - pt->playback, pt->capture, pt->compress); - pt->num_streams = pcm->num_streams; - pt->flag_mask = pcm->flag_mask; +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.29.2 +2.30.2 -From 51e1d486ce4535923692bd1d7e59d5aa3a29cd50 Mon Sep 17 00:00:00 2001 +From 200d18cda7a700607c21ad5dc9faaea2a1e27dbd Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela -Date: Thu, 7 Jan 2021 17:40:42 +0100 -Subject: [PATCH 38/49] topology: parse_tuple_set() - remove dead condition - code +Date: Wed, 2 Jun 2021 19:51:13 +0200 +Subject: [PATCH 12/22] ucm: fix error path in execute_cfgsave() Signed-off-by: Jaroslav Kysela --- - src/topology/data.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + src/ucm/main.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) -diff --git a/src/topology/data.c b/src/topology/data.c -index c2931bd2..5633cdc3 100644 ---- a/src/topology/data.c -+++ b/src/topology/data.c -@@ -860,7 +860,7 @@ static int parse_tuple_set(snd_config_t *cfg, - } - - if ((type == SND_SOC_TPLG_TUPLE_TYPE_WORD -- && tuple_val > UINT_MAX) -+ /* && tuple_val > UINT_MAX */) - || (type == SND_SOC_TPLG_TUPLE_TYPE_SHORT - && tuple_val > USHRT_MAX) - || (type == SND_SOC_TPLG_TUPLE_TYPE_BYTE +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.29.2 +2.30.2 -From 3f63dc26445ae7c215e48a57af83b6da325f166d Mon Sep 17 00:00:00 2001 +From 9b71d53bde21c8bb0d900c17863664e12753d844 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela -Date: Thu, 7 Jan 2021 17:41:38 +0100 -Subject: [PATCH 39/49] ucm: uc_mgr_substitute_tree() fix use after free +Date: Wed, 2 Jun 2021 19:52:12 +0200 +Subject: [PATCH 13/22] ucm: fix use after free in if_eval_regex_match() Signed-off-by: Jaroslav Kysela --- - src/ucm/ucm_subs.c | 3 ++- + src/ucm/ucm_cond.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -diff --git a/src/ucm/ucm_subs.c b/src/ucm/ucm_subs.c -index f608bb09..df6d736f 100644 ---- a/src/ucm/ucm_subs.c -+++ b/src/ucm/ucm_subs.c -@@ -417,11 +417,12 @@ int uc_mgr_substitute_tree(snd_use_case_mgr_t *uc_mgr, snd_config_t *node) - if (err < 0) - return err; - err = snd_config_set_id(node, s); -- free(s); - if (err < 0) { - uc_error("unable to set substituted id '%s' (old id '%s')", s, id); -+ free(s); - return err; - } +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; } - if (snd_config_get_type(node) != SND_CONFIG_TYPE_COMPOUND) { - if (snd_config_get_type(node) == SND_CONFIG_TYPE_STRING) { ++ free(s); + + err = uc_mgr_get_substituted_value(uc_mgr, &s, string); + if (err < 0) { -- -2.29.2 +2.30.2 -From 45f503632acf24877c466a7c1c74d8a26414bf3e Mon Sep 17 00:00:00 2001 +From 7764e3e621a4c8a52327833d44e32c8b6fe3a131 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela -Date: Thu, 7 Jan 2021 17:45:27 +0100 -Subject: [PATCH 40/49] topology: sort_config() cleanups - use goto for the - error path +Date: Wed, 2 Jun 2021 19:53:24 +0200 +Subject: [PATCH 14/22] ucm: fix if_eval_path() - access NULL pointer Signed-off-by: Jaroslav Kysela --- - src/topology/save.c | 15 +++++++-------- - 1 file changed, 7 insertions(+), 8 deletions(-) - -diff --git a/src/topology/save.c b/src/topology/save.c -index f7af7af3..fecbc6a5 100644 ---- a/src/topology/save.c -+++ b/src/topology/save.c -@@ -180,29 +180,28 @@ static snd_config_t *sort_config(const char *id, snd_config_t *src) - } - if (array <= 0) - qsort(a, count, sizeof(a[0]), _compar); -- if (snd_config_make_compound(&dst, id, count == 1)) { -- free(a); -- return NULL; -- } -+ if (snd_config_make_compound(&dst, id, count == 1)) -+ goto lerr; - 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; -+ goto lerr; - } - 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; -+ goto lerr; - } - } - free(a); - return dst; -+lerr: -+ free(a); -+ return NULL; - } + 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; - static int tplg_check_quoted(const unsigned char *p) + if (uc_mgr->conf_format < 4) { -- -2.29.2 +2.30.2 -From 93752fb4de397554e92a4eb9079f77dabaec7d7f Mon Sep 17 00:00:00 2001 +From 7fcb1aadd56e94f03e51c4747e72d77279151c22 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela -Date: Thu, 7 Jan 2021 17:49:25 +0100 -Subject: [PATCH 41/49] conf: USB - add "Xonar U7 MKII" to - USB-Audio.pcm.iec958_device +Date: Wed, 2 Jun 2021 19:56:01 +0200 +Subject: [PATCH 15/22] ucm: find_exec() - fix memory leak (dir) -BugLink: https://github.com/alsa-project/alsa-lib/issues/100 Signed-off-by: Jaroslav Kysela --- - src/conf/cards/USB-Audio.conf | 1 + + src/ucm/ucm_exec.c | 1 + 1 file changed, 1 insertion(+) -diff --git a/src/conf/cards/USB-Audio.conf b/src/conf/cards/USB-Audio.conf -index 9b64af3c..b1b74b02 100644 ---- a/src/conf/cards/USB-Audio.conf -+++ b/src/conf/cards/USB-Audio.conf -@@ -39,6 +39,7 @@ USB-Audio.pcm.iec958_device { - # "NoiseBlaster 3000" 42 - "USB Sound Blaster HD" 1 - "Xonar U7" 1 -+ "Xonar U7 MKII" 1 - "ASUS XONAR U5" 1 - "XONAR U5" 1 - "XONAR SOUND CARD" 1 +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.29.2 +2.30.2 -From 644514e85da169670e4a490b7b15b5ecfcec92c0 Mon Sep 17 00:00:00 2001 +From 26ab7fc3e4cba416cf51aa0fb48fdddaa0d861ee Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela -Date: Mon, 18 Jan 2021 21:09:43 +0100 -Subject: [PATCH 42/49] pcm_plugin: set the initial hw_ptr/appl_ptr from the - child pcm - -The direct plugins (dmix & etc.) sets own initial -hw_ptr and appl_ptr. Use this initial settings -to export correct values in snd_pcm_status(). +Date: Wed, 2 Jun 2021 19:58:04 +0200 +Subject: [PATCH 16/22] ucm: fix possible NULL pointer dereference in + uc_mgr_exec() Signed-off-by: Jaroslav Kysela --- - src/pcm/pcm_plugin.c | 32 +++++++++++++++++--------------- - 1 file changed, 17 insertions(+), 15 deletions(-) - -diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c -index 7ed6f25a..ff254eba 100644 ---- a/src/pcm/pcm_plugin.c -+++ b/src/pcm/pcm_plugin.c -@@ -146,15 +146,14 @@ static int snd_pcm_plugin_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp) - return 0; - } - --static int snd_pcm_plugin_prepare(snd_pcm_t *pcm) -+static int snd_pcm_plugin_call_init_cb(snd_pcm_t *pcm, snd_pcm_plugin_t *plugin) - { -- snd_pcm_plugin_t *plugin = pcm->private_data; -+ snd_pcm_t *slave = plugin->gen.slave; - int err; -- err = snd_pcm_prepare(plugin->gen.slave); -- if (err < 0) -- return err; -- *pcm->hw.ptr = 0; -- *pcm->appl.ptr = 0; -+ -+ assert(pcm->boundary == slave->boundary); -+ *pcm->hw.ptr = *slave->hw.ptr; -+ *pcm->appl.ptr = *slave->appl.ptr; - if (plugin->init) { - err = plugin->init(pcm); - if (err < 0) -@@ -163,6 +162,16 @@ static int snd_pcm_plugin_prepare(snd_pcm_t *pcm) - return 0; - } - -+static int snd_pcm_plugin_prepare(snd_pcm_t *pcm) -+{ -+ snd_pcm_plugin_t *plugin = pcm->private_data; -+ int err; -+ err = snd_pcm_prepare(plugin->gen.slave); -+ if (err < 0) -+ return err; -+ return snd_pcm_plugin_call_init_cb(pcm, plugin); -+} -+ - static int snd_pcm_plugin_reset(snd_pcm_t *pcm) - { - snd_pcm_plugin_t *plugin = pcm->private_data; -@@ -170,14 +179,7 @@ static int snd_pcm_plugin_reset(snd_pcm_t *pcm) - err = snd_pcm_reset(plugin->gen.slave); - if (err < 0) - return err; -- *pcm->hw.ptr = 0; -- *pcm->appl.ptr = 0; -- if (plugin->init) { -- err = plugin->init(pcm); -- if (err < 0) -- return err; -- } -- return 0; -+ return snd_pcm_plugin_call_init_cb(pcm, plugin); - } + 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; - static snd_pcm_sframes_t snd_pcm_plugin_rewindable(snd_pcm_t *pcm) + 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.29.2 +2.30.2 -From 0de72e63d7bd180566c71f6fb01d7719525ee326 Mon Sep 17 00:00:00 2001 +From 64a6d4d1e827732bef7c68e1e6d2cb6863b4597c Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela -Date: Tue, 19 Jan 2021 11:17:00 +0100 -Subject: [PATCH 43/49] pcm: dmix/dshare - delay calculation fixes and cleanups - -Unfortunately, we cannot use status->avail from slave, because this value -does not wrap to the buffer size and it may even overflow slave boundary -(endless run). We can use only hw_ptr from slave. +Date: Wed, 2 Jun 2021 19:59:10 +0200 +Subject: [PATCH 17/22] ucm: check error value in parse_lookup_query() Signed-off-by: Jaroslav Kysela --- - src/pcm/pcm_dmix.c | 5 ++--- - src/pcm/pcm_dshare.c | 5 ++--- - 2 files changed, 4 insertions(+), 6 deletions(-) + src/ucm/ucm_subs.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) -diff --git a/src/pcm/pcm_dmix.c b/src/pcm/pcm_dmix.c -index 5b7472d9..be2675af 100644 ---- a/src/pcm/pcm_dmix.c -+++ b/src/pcm/pcm_dmix.c -@@ -488,8 +488,7 @@ static int snd_pcm_dmix_status(snd_pcm_t *pcm, snd_pcm_status_t * status) - case SNDRV_PCM_STATE_DRAINING: - case SNDRV_PCM_STATE_RUNNING: - snd_pcm_dmix_sync_ptr0(pcm, status->hw_ptr); -- status->delay += snd_pcm_mmap_playback_delay(pcm) -- + status->avail - dmix->spcm->buffer_size; -+ status->delay = snd_pcm_mmap_playback_delay(pcm); - break; - default: - break; -@@ -518,7 +517,7 @@ static int snd_pcm_dmix_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp) - case SNDRV_PCM_STATE_PREPARED: - case SNDRV_PCM_STATE_SUSPENDED: - case STATE_RUN_PENDING: -- *delayp = snd_pcm_mmap_playback_hw_avail(pcm); -+ *delayp = snd_pcm_mmap_playback_delay(pcm); - return 0; - case SNDRV_PCM_STATE_XRUN: - return -EPIPE; -diff --git a/src/pcm/pcm_dshare.c b/src/pcm/pcm_dshare.c -index 8a672572..10243013 100644 ---- a/src/pcm/pcm_dshare.c -+++ b/src/pcm/pcm_dshare.c -@@ -237,8 +237,7 @@ static int snd_pcm_dshare_status(snd_pcm_t *pcm, snd_pcm_status_t * status) - case SNDRV_PCM_STATE_DRAINING: - case SNDRV_PCM_STATE_RUNNING: - snd_pcm_dshare_sync_ptr0(pcm, status->hw_ptr); -- status->delay += snd_pcm_mmap_playback_delay(pcm) -- + status->avail - dshare->spcm->buffer_size; -+ status->delay += snd_pcm_mmap_playback_delay(pcm); - break; - default: - break; -@@ -290,7 +289,7 @@ static int snd_pcm_dshare_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp) - case SNDRV_PCM_STATE_PREPARED: - case SNDRV_PCM_STATE_SUSPENDED: - case STATE_RUN_PENDING: -- *delayp = snd_pcm_mmap_playback_hw_avail(pcm); -+ *delayp = snd_pcm_mmap_playback_delay(pcm); - return 0; - case SNDRV_PCM_STATE_XRUN: - return -EPIPE; +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.29.2 +2.30.2 -From ae7362c996e0b991c399cc26c6d0b3c8e295e83c Mon Sep 17 00:00:00 2001 +From 30d1d256e792fbabf14c57efb98c489541b19f37 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela -Date: Wed, 20 Jan 2021 16:58:33 +0100 -Subject: [PATCH 44/49] topology: fix 'parse_tuple_set() - remove dead - condition code' +Date: Wed, 2 Jun 2021 20:01:08 +0200 +Subject: [PATCH 18/22] ucm: fix out-of-array access in + rval_device_lookup_init() -The whole SND_SOC_TPLG_TUPLE_TYPE_WORD condition part must be -commented out, otherwise the condition is always true. - -Fixes: 51e1d486ce ("topology: parse_tuple_set() - remove dead condition code") -BugLink: https://github.com/alsa-project/alsa-lib/issues/114 Signed-off-by: Jaroslav Kysela --- - src/topology/data.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/src/topology/data.c b/src/topology/data.c -index 5633cdc3..0546d63e 100644 ---- a/src/topology/data.c -+++ b/src/topology/data.c -@@ -859,11 +859,11 @@ static int parse_tuple_set(snd_config_t *cfg, - goto err; - } - -- if ((type == SND_SOC_TPLG_TUPLE_TYPE_WORD -- /* && tuple_val > UINT_MAX */) -- || (type == SND_SOC_TPLG_TUPLE_TYPE_SHORT -- && tuple_val > USHRT_MAX) -- || (type == SND_SOC_TPLG_TUPLE_TYPE_BYTE -+ if (/* (type == SND_SOC_TPLG_TUPLE_TYPE_WORD -+ && tuple_val > UINT_MAX) || */ -+ (type == SND_SOC_TPLG_TUPLE_TYPE_SHORT -+ && tuple_val > USHRT_MAX) || -+ (type == SND_SOC_TPLG_TUPLE_TYPE_BYTE - && tuple_val > UCHAR_MAX)) { - SNDERR("tuple %s: invalid value", id); - goto err; --- -2.29.2 - + src/ucm/ucm_subs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) -From f2c1a9f3279a30cbd8dcba1eaf0d52f50b56b886 Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Fri, 22 Jan 2021 15:48:39 +0100 -Subject: [PATCH 45/49] pcm: direct: Fix the missing appl_ptr update +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 -A snd_pcm_status() call for the direct plugins receives the status -from the slave PCM, but this doesn't contain a valid appl_ptr, since -the slave PCM for the direct plugins is in a free-wheel mode, hence -the appl_ptr is always zero. This result in the inconsistent -status->appl_ptr and pcm->appl.ptr, hitting the recently introduced -assert() call. -Fix it by transferring the plugin's appl_ptr to the upper caller. +From 42c0ccf3275fef523471fa7ea4feecd7b1052357 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 3 Jun 2021 07:29:11 +0200 +Subject: [PATCH 19/22] conf: snd_config_get_card() remove unused assignment -BugLink: https://bugzilla.opensuse.org/show_bug.cgi?id=1181194 -Signed-off-by: Takashi Iwai 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(+) + src/confmisc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/src/pcm/pcm_dmix.c b/src/pcm/pcm_dmix.c -index be2675af..d8495065 100644 ---- a/src/pcm/pcm_dmix.c -+++ b/src/pcm/pcm_dmix.c -@@ -495,6 +495,7 @@ static int snd_pcm_dmix_status(snd_pcm_t *pcm, snd_pcm_status_t * status) - } +diff --git a/src/confmisc.c b/src/confmisc.c +index a561040c..64af96fa 100644 +--- a/src/confmisc.c ++++ b/src/confmisc.c +@@ -155,7 +155,7 @@ int snd_config_get_card(const snd_config_t *conf) + int err; - status->state = snd_pcm_dmix_state(pcm); -+ 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); - status->avail_max = status->avail > dmix->avail_max ? status->avail : dmix->avail_max; -diff --git a/src/pcm/pcm_dshare.c b/src/pcm/pcm_dshare.c -index 10243013..dccb137b 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->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); - status->avail_max = status->avail > dshare->avail_max ? status->avail : dshare->avail_max; -diff --git a/src/pcm/pcm_dsnoop.c b/src/pcm/pcm_dsnoop.c -index c6e8cd27..695bf4aa 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->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); - status->avail_max = status->avail > dsnoop->avail_max ? status->avail : dsnoop->avail_max; + if (snd_config_get_integer(conf, &v) < 0) { +- if ((err = snd_config_get_string(conf, &str)) < 0) { ++ if (snd_config_get_string(conf, &str)) { + if (snd_config_get_id(conf, &id) >= 0) + SNDERR("Invalid field %s", id); + return -EINVAL; -- -2.29.2 - +2.30.2 -From 26fdcb98e6be186016d53f87d06ae47aabe5b7fc Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Fri, 22 Jan 2021 15:48:40 +0100 -Subject: [PATCH 46/49] pcm: ioplug: Pass appl_ptr and hw_ptr in - snd_pcm_status() -The snd_pcm_status() of the ioplug doesn't return the current -positions of hw_ptr and appl_ptr as advertised. Fix it by copying the -current values stored in the plugin data. +From a154cb29043a4db2fa92bc146fd4cf94c9851892 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 3 Jun 2021 07:29:43 +0200 +Subject: [PATCH 20/22] pcm: direct - remove dead code -Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- - src/pcm/pcm_ioplug.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/pcm/pcm_ioplug.c b/src/pcm/pcm_ioplug.c -index e141b1f9..a1463bf6 100644 ---- a/src/pcm/pcm_ioplug.c -+++ b/src/pcm/pcm_ioplug.c -@@ -133,6 +133,8 @@ static int snd_pcm_ioplug_status(snd_pcm_t *pcm, snd_pcm_status_t * status) - gettimestamp(&status->tstamp, pcm->tstamp_type); - status->avail = snd_pcm_mmap_avail(pcm); - status->avail_max = io->avail_max; -+ status->appl_ptr = *pcm->appl.ptr; -+ status->hw_ptr = *pcm->hw.ptr; - if (snd_pcm_ioplug_delay(pcm, &sd) < 0) - sd = snd_pcm_mmap_delay(pcm); - status->delay = sd; --- -2.29.2 - - -From bcc762f99ad642cc0dd9eaceb51f228eba9fe68c Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Fri, 22 Jan 2021 15:48:41 +0100 -Subject: [PATCH 47/49] pcm: null: Pass appl_ptr and hw_ptr in snd_pcm_status() - -Just like the previous fix for ioplug, the null plugin also misses the -appl_ptr and hw_ptr updates for snd_pcm_status(). Fix it as well. + src/pcm/pcm_direct.c | 2 -- + 1 file changed, 2 deletions(-) -Signed-off-by: Takashi Iwai -Signed-off-by: Jaroslav Kysela ---- - src/pcm/pcm_null.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/pcm/pcm_null.c b/src/pcm/pcm_null.c -index 1d815485..c8ea9b38 100644 ---- a/src/pcm/pcm_null.c -+++ b/src/pcm/pcm_null.c -@@ -96,6 +96,8 @@ static int snd_pcm_null_status(snd_pcm_t *pcm, snd_pcm_status_t * status) - memset(status, 0, sizeof(*status)); - status->state = null->state; - status->trigger_tstamp = null->trigger_tstamp; -+ status->appl_ptr = *pcm->appl.ptr; -+ status->hw_ptr = *pcm->hw.ptr; - gettimestamp(&status->tstamp, pcm->tstamp_type); - status->avail = snd_pcm_null_avail_update(pcm); - status->avail_max = pcm->buffer_size; +diff --git a/src/pcm/pcm_direct.c b/src/pcm/pcm_direct.c +index 361805bd..d50503e3 100644 +--- a/src/pcm/pcm_direct.c ++++ b/src/pcm/pcm_direct.c +@@ -1857,8 +1857,6 @@ static int _snd_pcm_direct_get_slave_ipc_offset(snd_config_t *root, + continue; + } + } +- if (card < 0) +- card = 0; + if (device < 0) + device = 0; + if (subdevice < 0) -- -2.29.2 - +2.30.2 -From 55d59821ffb8f44395cf2b7a424d6523da58e66a Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Fri, 22 Jan 2021 15:48:42 +0100 -Subject: [PATCH 48/49] pcm: share: Pass appl_ptr and hw_ptr in - snd_pcm_status() -This one also has the same problem as others; the appl_ptr and hw_ptr -of share plugin aren't updated in snd_pcm_status() call. Fix it. +From e2133090603a74c0b08cd45b689063071bc90c81 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 3 Jun 2021 07:30:27 +0200 +Subject: [PATCH 21/22] ucm: fix possible memory leak in parse_verb_file() -Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- - src/pcm/pcm_share.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/pcm/pcm_share.c b/src/pcm/pcm_share.c -index bff9507d..72509491 100644 ---- a/src/pcm/pcm_share.c -+++ b/src/pcm/pcm_share.c -@@ -711,6 +711,8 @@ static int snd_pcm_share_status(snd_pcm_t *pcm, snd_pcm_status_t *status) - _notrunning: - status->delay = sd + d; - status->state = share->state; -+ status->appl_ptr = *pcm->appl.ptr; -+ status->hw_ptr = *pcm->hw.ptr; - status->trigger_tstamp = share->trigger_tstamp; - _end: - Pthread_mutex_unlock(&slave->mutex); + 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 ed261fa2..fccf5791 100644 +--- a/src/ucm/parser.c ++++ b/src/ucm/parser.c +@@ -1779,7 +1779,7 @@ static int parse_verb_file(snd_use_case_mgr_t *uc_mgr, + err = parse_libconfig(uc_mgr, n); + if (err < 0) { + uc_error("error: failed to parse LibConfig"); +- return err; ++ goto _err; + } + continue; + } -- -2.29.2 +2.30.2 -From 00eafe98eebff8ecd1ecdc58470068bfd610cc8d Mon Sep 17 00:00:00 2001 +From 0325f4357d25f262400038f074512e1887c8e5f1 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela -Date: Thu, 21 Jan 2021 15:45:49 +0100 -Subject: [PATCH 49/49] pcm: pcm_ioplug - fix the avail_update mmap capture - copy issue - -It seems that the commit "pcm: ioplug: Transfer all available data" -introduced new regressions (wrong memory access). The second issue -is that the avail_update in ioplug does not move appl_ptr nor hw_ptr, -so it's possible that the transfers may be repetitive. - -This patch moves the transfer calls to mmap_begin callback where it -should be. The pointer wraps are handled by design now. +Date: Thu, 3 Jun 2021 09:00:51 +0200 +Subject: [PATCH 22/22] ucm: compound_merge() - fix use after free (and logic) -Fixes: 1714332719 ("pcm: ioplug: Transfer all available data") -BugLink: https://github.com/alsa-project/alsa-lib/pull/103 -Tested-by: Andreas Pape Signed-off-by: Jaroslav Kysela --- - src/pcm/pcm.c | 20 ++++++++++----- - src/pcm/pcm_ioplug.c | 60 +++++++++++++++++++++++++------------------- - src/pcm/pcm_local.h | 2 ++ - 3 files changed, 50 insertions(+), 32 deletions(-) - -diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c -index 24030b31..a57ce5d9 100644 ---- a/src/pcm/pcm.c -+++ b/src/pcm/pcm.c -@@ -7218,9 +7218,8 @@ int snd_pcm_mmap_begin(snd_pcm_t *pcm, - } - - #ifndef DOC_HIDDEN --/* locked version */ --int __snd_pcm_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas, -- snd_pcm_uframes_t *offset, snd_pcm_uframes_t *frames) -+int __snd_pcm_mmap_begin_generic(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas, -+ snd_pcm_uframes_t *offset, snd_pcm_uframes_t *frames) - { - snd_pcm_uframes_t cont; - snd_pcm_uframes_t f; -@@ -7229,9 +7228,6 @@ int __snd_pcm_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas, - - assert(pcm && areas && offset && frames); - -- if (pcm->fast_ops->mmap_begin) -- return pcm->fast_ops->mmap_begin(pcm->fast_op_arg, areas, offset, frames); -- - /* fallback for plugins that do not specify new callback */ - xareas = snd_pcm_mmap_areas(pcm); - if (xareas == NULL) -@@ -7250,6 +7246,18 @@ int __snd_pcm_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas, - *frames = f; + src/ucm/ucm_include.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/src/ucm/ucm_include.c b/src/ucm/ucm_include.c +index 6945dd2e..a3a584a1 100644 +--- a/src/ucm/ucm_include.c ++++ b/src/ucm/ucm_include.c +@@ -108,7 +108,7 @@ static int find_position_node(snd_config_t **res, snd_config_t *dst, return 0; } -+ -+/* locked version */ -+int __snd_pcm_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas, -+ snd_pcm_uframes_t *offset, snd_pcm_uframes_t *frames) -+{ -+ assert(pcm && areas && offset && frames); -+ -+ if (pcm->fast_ops->mmap_begin) -+ return pcm->fast_ops->mmap_begin(pcm->fast_op_arg, areas, offset, frames); -+ -+ return __snd_pcm_mmap_begin_generic(pcm, areas, offset, frames); -+} - #endif - /** -diff --git a/src/pcm/pcm_ioplug.c b/src/pcm/pcm_ioplug.c -index a1463bf6..98184398 100644 ---- a/src/pcm/pcm_ioplug.c -+++ b/src/pcm/pcm_ioplug.c -@@ -697,6 +697,38 @@ static snd_pcm_sframes_t snd_pcm_ioplug_readn(snd_pcm_t *pcm, void **bufs, snd_p - } +-static int merge_it(snd_config_t *dst, snd_config_t *n) ++static int merge_it(snd_config_t *dst, snd_config_t *n, snd_config_t **_dn) + { + snd_config_t *dn; + const char *id; +@@ -123,6 +123,8 @@ static int merge_it(snd_config_t *dst, snd_config_t *n) + err = snd_config_merge(dn, n, 0); /* merge / append mode */ + if (err < 0) + snd_config_delete(n); ++ else ++ *_dn = dn; + return err; } -+static int snd_pcm_ioplug_mmap_begin_capture(snd_pcm_t *pcm, -+ const snd_pcm_channel_area_t **areas, -+ snd_pcm_uframes_t *offset, -+ snd_pcm_uframes_t *frames) -+{ -+ ioplug_priv_t *io = pcm->private_data; -+ int err; -+ -+ err = __snd_pcm_mmap_begin_generic(pcm, areas, offset, frames); -+ if (err < 0) -+ return err; -+ -+ if (io->data->callback->transfer && -+ pcm->access != SND_PCM_ACCESS_RW_INTERLEAVED && -+ pcm->access != SND_PCM_ACCESS_RW_NONINTERLEAVED) { -+ snd_pcm_sframes_t result; -+ result = io->data->callback->transfer(io->data, *areas, *offset, *frames); -+ if (result < 0) -+ return result; -+ } -+ -+ return err; -+} -+ -+static int snd_pcm_ioplug_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas, -+ snd_pcm_uframes_t *offset, snd_pcm_uframes_t *frames) -+{ -+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK) -+ return __snd_pcm_mmap_begin_generic(pcm, areas, offset, frames); -+ return snd_pcm_ioplug_mmap_begin_capture(pcm, areas, offset, frames); -+} -+ - static snd_pcm_sframes_t snd_pcm_ioplug_mmap_commit(snd_pcm_t *pcm, - snd_pcm_uframes_t offset, - snd_pcm_uframes_t size) -@@ -707,7 +739,7 @@ static snd_pcm_sframes_t snd_pcm_ioplug_mmap_commit(snd_pcm_t *pcm, - const snd_pcm_channel_area_t *areas; - snd_pcm_uframes_t ofs, frames = size; - -- __snd_pcm_mmap_begin(pcm, &areas, &ofs, &frames); -+ __snd_pcm_mmap_begin_generic(pcm, &areas, &ofs, &frames); - if (ofs != offset) - return -EIO; - return ioplug_priv_transfer_areas(pcm, areas, offset, frames); -@@ -727,31 +759,6 @@ static snd_pcm_sframes_t snd_pcm_ioplug_avail_update(snd_pcm_t *pcm) - return -EPIPE; - - avail = snd_pcm_mmap_avail(pcm); -- if (pcm->stream == SND_PCM_STREAM_CAPTURE && -- pcm->access != SND_PCM_ACCESS_RW_INTERLEAVED && -- pcm->access != SND_PCM_ACCESS_RW_NONINTERLEAVED) { -- if (io->data->callback->transfer) { -- const snd_pcm_channel_area_t *areas; -- snd_pcm_uframes_t offset, size = UINT_MAX; -- snd_pcm_sframes_t result; -- -- __snd_pcm_mmap_begin(pcm, &areas, &offset, &size); -- result = io->data->callback->transfer(io->data, areas, offset, size); -- if (result < 0) -- return result; -- -- /* If the available data doesn't fit in the -- contiguous area at the end of the mmap we -- must transfer the remaining data to the -- beginning of the mmap. */ -- if (size < avail) { -- result = io->data->callback->transfer(io->data, areas, -- 0, avail - size); -- if (result < 0) -- return result; -- } -- } -- } - if (avail > io->avail_max) - io->avail_max = avail; - return (snd_pcm_sframes_t)avail; -@@ -947,6 +954,7 @@ static const snd_pcm_fast_ops_t snd_pcm_ioplug_fast_ops = { - .poll_descriptors_count = snd_pcm_ioplug_poll_descriptors_count, - .poll_descriptors = snd_pcm_ioplug_poll_descriptors, - .poll_revents = snd_pcm_ioplug_poll_revents, -+ .mmap_begin = snd_pcm_ioplug_mmap_begin, - }; - - #endif /* !DOC_HIDDEN */ -diff --git a/src/pcm/pcm_local.h b/src/pcm/pcm_local.h -index bec5a408..a63f4be0 100644 ---- a/src/pcm/pcm_local.h -+++ b/src/pcm/pcm_local.h -@@ -420,6 +420,8 @@ int _snd_pcm_poll_descriptor(snd_pcm_t *pcm); - #define _snd_pcm_async_descriptor _snd_pcm_poll_descriptor /* FIXME */ - - /* locked versions */ -+int __snd_pcm_mmap_begin_generic(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas, -+ snd_pcm_uframes_t *offset, snd_pcm_uframes_t *frames); - int __snd_pcm_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas, - snd_pcm_uframes_t *offset, snd_pcm_uframes_t *frames); - snd_pcm_sframes_t __snd_pcm_mmap_commit(snd_pcm_t *pcm, --- -2.29.2 +@@ -198,7 +200,7 @@ static int compound_merge(const char *id, + if (_before) { + err = snd_config_add_before(_before, n); + if (err == -EEXIST) +- err = merge_it(dst, n); ++ err = merge_it(dst, n, &n); + if (err < 0) + return err; + _before = NULL; +@@ -206,7 +208,7 @@ static int compound_merge(const char *id, + } else if (_after) { + err = snd_config_add_after(_after, n); + if (err == -EEXIST) +- err = merge_it(dst, n); ++ err = merge_it(dst, n, &n); + if (err < 0) + return err; + _after = n; +-- +2.30.2 diff --git a/SOURCES/alsa-ucm-git.patch b/SOURCES/alsa-ucm-git.patch index 3e330d2..4c423c5 100644 --- a/SOURCES/alsa-ucm-git.patch +++ b/SOURCES/alsa-ucm-git.patch @@ -1,1571 +1,24 @@ -From 33be660e4b1e75c19d5332556c3d2636dd3344bf Mon Sep 17 00:00:00 2001 +From 3f34021beffba4e39f064a14c5faceeaa224b766 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela -Date: Mon, 2 Nov 2020 16:44:51 +0100 -Subject: [PATCH 01/24] fix the ucm2/codecs/hda/hdmi.conf use - -The mentioned commit (dcef48f13d) removed the index for the IEC958 on/off -control which made the HDMI 2+ outputs silent. - -Fixes: dcef48f13d ("HDA-Intel: add support for AMD acp microphone devices") -BugLink: https://github.com/alsa-project/alsa-lib/issues/95 -Signed-off-by: Jaroslav Kysela ---- - ucm2/HDA-Intel/Hdmi.conf | 8 +++++++- - ucm2/codecs/hda/hdmi.conf | 4 ++-- - ucm2/sof-hda-dsp/Hdmi.conf | 3 +++ - 3 files changed, 12 insertions(+), 3 deletions(-) - -diff --git a/ucm2/HDA-Intel/Hdmi.conf b/ucm2/HDA-Intel/Hdmi.conf -index c8b6e77..c533e49 100644 ---- a/ucm2/HDA-Intel/Hdmi.conf -+++ b/ucm2/HDA-Intel/Hdmi.conf -@@ -6,6 +6,7 @@ If.hdmi1 { - Define { - HdmiNum 1 - HdmiPCM 3 -+ HdmiCtlIndex 0 - HdmiPrio 1100 - } - Include.hdmi1.File "/codecs/hda/hdmi.conf" -@@ -18,6 +19,7 @@ If.hdmi2 { - Define { - HdmiNum 2 - HdmiPCM 7 -+ HdmiCtlIndex 1 - HdmiPrio 1200 - } - Include.hdmi2.File "/codecs/hda/hdmi.conf" -@@ -30,6 +32,7 @@ If.hdmi3 { - Define { - HdmiNum 3 - HdmiPCM 8 -+ HdmiCtlIndex 2 - HdmiPrio 1300 - } - Include.hdmi3.File "/codecs/hda/hdmi.conf" -@@ -42,6 +45,7 @@ If.hdmi4 { - Define { - HdmiNum 4 - HdmiPCM 9 -+ HdmiCtlIndex 3 - HdmiPrio 1400 - } - Include.hdmi4.File "/codecs/hda/hdmi.conf" -@@ -54,6 +58,7 @@ If.hdmi5 { - Define { - HdmiNum 5 - HdmiPCM 10 -+ HdmiCtlIndex 4 - HdmiPrio 1500 - } - Include.hdmi5.File "/codecs/hda/hdmi.conf" -@@ -66,8 +71,9 @@ If.hdmi6 { - Define { - HdmiNum 6 - HdmiPCM 11 -+ HdmiCtlIndex 5 - HdmiPrio 1600 - } -- Include.hdmi5.File "/codecs/hda/hdmi.conf" -+ Include.hdmi6.File "/codecs/hda/hdmi.conf" - } - } -diff --git a/ucm2/codecs/hda/hdmi.conf b/ucm2/codecs/hda/hdmi.conf -index ba80fef..32a77f4 100644 ---- a/ucm2/codecs/hda/hdmi.conf -+++ b/ucm2/codecs/hda/hdmi.conf -@@ -8,11 +8,11 @@ If.hdmi { - Comment "HDMI${var:HdmiNum} Output" - - EnableSequence [ -- cset "name='IEC958 Playback Switch' on" -+ cset "name='IEC958 Playback Switch',index=${var:HdmiCtlIndex} on" - ] - - DisableSequence [ -- cset "name='IEC958 Playback Switch' off" -+ cset "name='IEC958 Playback Switch',index=${var:HdmiCtlIndex} off" - ] - - Value { -diff --git a/ucm2/sof-hda-dsp/Hdmi.conf b/ucm2/sof-hda-dsp/Hdmi.conf -index 7b777d1..1726567 100644 ---- a/ucm2/sof-hda-dsp/Hdmi.conf -+++ b/ucm2/sof-hda-dsp/Hdmi.conf -@@ -6,6 +6,7 @@ If.hdmi1 { - Define { - HdmiNum 1 - HdmiPCM 3 -+ HdmiCtlIndex 0 - HdmiPrio 500 - } - Include.hdmi1.File "/codecs/hda/hdmi.conf" -@@ -18,6 +19,7 @@ If.hdmi2 { - Define { - HdmiNum 2 - HdmiPCM 4 -+ HdmiCtlIndex 1 - HdmiPrio 600 - } - Include.hdmi2.File "/codecs/hda/hdmi.conf" -@@ -30,6 +32,7 @@ If.hdmi3 { - Define { - HdmiNum 3 - HdmiPCM 5 -+ HdmiCtlIndex 2 - HdmiPrio 700 - } - Include.hdmi3.File "/codecs/hda/hdmi.conf" --- -2.29.2 - - -From f8c2428ccc42488c5e96801cce9f7e28080ecb71 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Mon, 2 Nov 2020 18:15:14 +0100 -Subject: [PATCH 02/24] codecs/hda/hdmi.conf - add DisplayPort to the device - description (Comment) +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/codecs/hda/hdmi.conf | 2 +- + ucm2/HDA-Intel/HDA-Intel.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/ucm2/codecs/hda/hdmi.conf b/ucm2/codecs/hda/hdmi.conf -index 32a77f4..c7b7ba4 100644 ---- a/ucm2/codecs/hda/hdmi.conf -+++ b/ucm2/codecs/hda/hdmi.conf -@@ -5,7 +5,7 @@ If.hdmi { - } - True { - SectionDevice."HDMI${var:HdmiNum}" { -- Comment "HDMI${var:HdmiNum} Output" -+ Comment "HDMI / DisplayPort ${var:HdmiNum} Output" - - EnableSequence [ - cset "name='IEC958 Playback Switch',index=${var:HdmiCtlIndex} on" --- -2.29.2 - - -From 334b12e9a796cddf70779b68418ee7ad52ba1d14 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Mon, 16 Nov 2020 11:48:05 +0100 -Subject: [PATCH 03/24] sof-soundwire: use the codecs/hda/hdmi.conf macro - -Signed-off-by: Jaroslav Kysela ---- - ucm2/sof-soundwire/Hdmi.conf | 83 ++++++++++-------------------------- - 1 file changed, 22 insertions(+), 61 deletions(-) - -diff --git a/ucm2/sof-soundwire/Hdmi.conf b/ucm2/sof-soundwire/Hdmi.conf -index d0ba790..d5ee9c6 100644 ---- a/ucm2/sof-soundwire/Hdmi.conf -+++ b/ucm2/sof-soundwire/Hdmi.conf -@@ -1,79 +1,40 @@ --# Use case Configuration for sof-soundwire card -+# Use case Configuration for sof-soundwire - - If.hdmi1 { -- Condition { -- Type ControlExists -- Control "iface=CARD,name='HDMI/DP,pcm=5 Jack'" -- } -+ Condition { Type String Empty "" } - True { -- SectionDevice."HDMI1" { -- Comment "HDMI1/DP1 Output" -- -- EnableSequence [ -- cset "name='IEC958 Playback Switch' on" -- ] -- -- DisableSequence [ -- cset "name='IEC958 Playback Switch' off" -- ] -- -- Value { -- PlaybackPriority 500 -- PlaybackPCM "hw:${CardId},5" -- JackControl "HDMI/DP,pcm=5 Jack" -- } -+ Define { -+ HdmiNum 1 -+ HdmiPCM 5 -+ HdmiCtlIndex 0 -+ HdmiPrio 500 - } -+ Include.hdmi1.File "/codecs/hda/hdmi.conf" - } - } - - If.hdmi2 { -- Condition { -- Type ControlExists -- Control "iface=CARD,name='HDMI/DP,pcm=6 Jack'" -- } -+ Condition { Type String Empty "" } - True { -- SectionDevice."HDMI2" { -- Comment "HDMI2/DP2 Output" -- -- EnableSequence [ -- cset "name='IEC958 Playback Switch',index=1 on" -- ] -- -- DisableSequence [ -- cset "name='IEC958 Playback Switch',index=1 off" -- ] -- -- Value { -- PlaybackPriority 600 -- PlaybackPCM "hw:${CardId},6" -- JackControl "HDMI/DP,pcm=6 Jack" -- } -+ Define { -+ HdmiNum 2 -+ HdmiPCM 6 -+ HdmiCtlIndex 1 -+ HdmiPrio 600 - } -+ Include.hdmi2.File "/codecs/hda/hdmi.conf" - } - } - - If.hdmi3 { -- Condition { -- Type ControlExists -- Control "iface=CARD,name='HDMI/DP,pcm=7 Jack'" -- } -+ Condition { Type String Empty "" } - True { -- SectionDevice."HDMI3" { -- Comment "HDMI3/DP3 Output" -- -- EnableSequence [ -- cset "name='IEC958 Playback Switch',index=2 on" -- ] -- -- DisableSequence [ -- cset "name='IEC958 Playback Switch',index=2 off" -- ] -- -- Value { -- PlaybackPriority 700 -- PlaybackPCM "hw:${CardId},7" -- JackControl "HDMI/DP,pcm=7 Jack" -- } -+ Define { -+ HdmiNum 3 -+ HdmiPCM 7 -+ HdmiCtlIndex 2 -+ HdmiPrio 700 - } -+ Include.hdmi3.File "/codecs/hda/hdmi.conf" - } - } --- -2.29.2 - - -From 6889736b917eed89c4d775824efd8655400e27e3 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Mon, 7 Dec 2020 09:33:30 +0100 -Subject: [PATCH 04/24] Revert "ucm2: HDA/acp - add Capture simple mixer - element to the ACP Mic device" - -This reverts commit 3320b1ac804595d6c145c1ad7af85917182a3c98. - -This solution does not work. The mute state is shared between -the HDA and AMD ACP in PA, so it may cause the security issue, if -the users do not set the mute manually. - -BugLink: https://github.com/alsa-project/alsa-ucm-conf/issues/64 -Signed-off-by: Jaroslav Kysela ---- - ucm2/HDA-Intel/HiFi-acp.conf | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/ucm2/HDA-Intel/HiFi-acp.conf b/ucm2/HDA-Intel/HiFi-acp.conf -index 15eeca5..123ae15 100644 ---- a/ucm2/HDA-Intel/HiFi-acp.conf -+++ b/ucm2/HDA-Intel/HiFi-acp.conf -@@ -4,6 +4,5 @@ SectionDevice."Mic1" { - Value { - CapturePriority 100 - CapturePCM "hw:${var:AcpCardId}" -- CaptureMixerElem "Capture" - } - } --- -2.29.2 - - -From 13420f94a6858e9c3e3a056a7987d9c0db823394 Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Sun, 6 Dec 2020 13:47:16 +0100 -Subject: [PATCH 05/24] chtnau8824: Fix mono speaker config not working - -Fix the Speaker define / var being changed from "Speaker" to "MonoSpeaker" -not having any effect because the variable gets expanded before the if -making the change is interpreted. - -Signed-off-by: Hans de Goede -Signed-off-by: Jaroslav Kysela ---- - ucm2/chtnau8824/HiFi.conf | 15 +++++++++++---- - 1 file changed, 11 insertions(+), 4 deletions(-) - -diff --git a/ucm2/chtnau8824/HiFi.conf b/ucm2/chtnau8824/HiFi.conf -index 3ccd6b1..d7a5f63 100644 ---- a/ucm2/chtnau8824/HiFi.conf -+++ b/ucm2/chtnau8824/HiFi.conf -@@ -34,8 +34,15 @@ SectionVerb { - } - } - --Include.spk.File "/codecs/nau8824/${var:Speaker}.conf" --Include.hp.File "/codecs/nau8824/HeadPhones.conf" -+# The includes using $vars in there path must be conditional otherwise the -+# $var gets expanded before the other If-s above can change the vars. -+If.cfg-includes { -+ Condition { Type String Empty "" } -+ True { -+ Include.spk.File "/codecs/nau8824/${var:Speaker}.conf" -+ Include.hp.File "/codecs/nau8824/HeadPhones.conf" - --Include.mic.File "/codecs/nau8824/InternalMic.conf" --Include.hsmic.File "/codecs/nau8824/HeadsetMic.conf" -+ Include.mic.File "/codecs/nau8824/InternalMic.conf" -+ Include.hsmic.File "/codecs/nau8824/HeadsetMic.conf" -+ } -+} --- -2.29.2 - - -From 7db718571440b13045ebb3150a71745033ff5c0c Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Sun, 6 Dec 2020 13:47:17 +0100 -Subject: [PATCH 06/24] chtnau8824: Add support for laptops using stereo DMICs - -The Medion E2228T uses a NAU8824 codec combined with stereo -DMICs, add support for this. - -Signed-off-by: Hans de Goede -Signed-off-by: Jaroslav Kysela ---- - ucm2/chtnau8824/HiFi.conf | 16 +++++++++++++++- - ucm2/codecs/nau8824/DMIC1_2.conf | 30 ++++++++++++++++++++++++++++++ - 2 files changed, 45 insertions(+), 1 deletion(-) - create mode 100644 ucm2/codecs/nau8824/DMIC1_2.conf - -diff --git a/ucm2/chtnau8824/HiFi.conf b/ucm2/chtnau8824/HiFi.conf -index d7a5f63..105f360 100644 ---- a/ucm2/chtnau8824/HiFi.conf -+++ b/ucm2/chtnau8824/HiFi.conf -@@ -1,4 +1,5 @@ - Define.Speaker "Speaker" -+Define.Mic "InternalMic" - - If.cfg-mspk { - Condition { -@@ -11,6 +12,19 @@ If.cfg-mspk { - } - } - -+If.cfg-mic { -+ Condition { -+ Type RegexMatch -+ String "${CardLongName}" -+ # Medion E22??T models put DMIC in their product version -+ # when using DMICs -+ Regex "(MEDION-E22..T.*-DMIC-)" -+ } -+ True { -+ Define.Mic "DMIC1_2" -+ } -+} -+ - SectionVerb { - - Value { -@@ -42,7 +56,7 @@ If.cfg-includes { - Include.spk.File "/codecs/nau8824/${var:Speaker}.conf" - Include.hp.File "/codecs/nau8824/HeadPhones.conf" - -- Include.mic.File "/codecs/nau8824/InternalMic.conf" -+ Include.mic.File "/codecs/nau8824/${var:Mic}.conf" - Include.hsmic.File "/codecs/nau8824/HeadsetMic.conf" - } - } -diff --git a/ucm2/codecs/nau8824/DMIC1_2.conf b/ucm2/codecs/nau8824/DMIC1_2.conf -new file mode 100644 -index 0000000..f54f671 ---- /dev/null -+++ b/ucm2/codecs/nau8824/DMIC1_2.conf -@@ -0,0 +1,30 @@ -+# Stereo DMICs on the DMIC1 and DMIC2 inputs -+ -+SectionDevice."Mic" { -+ Comment "Internal Digital Microphones" -+ -+ Value { -+ CapturePriority 200 -+ CapturePCM "hw:${CardId}" -+ } -+ -+ ConflictingDevice [ -+ "Headset" -+ ] -+ -+ EnableSequence [ -+ # Note needs to be swapped / swap is deliberate! -+ cset "name='ADC CH0 Select' 1" -+ cset "name='ADC CH1 Select' 0" -+ -+ cset "name='Int Mic Switch' on" -+ cset "name='DMIC1 Enable Switch' on" -+ cset "name='DMIC2 Enable Switch' on" -+ ] -+ -+ DisableSequence [ -+ cset "name='Int Mic Switch' off" -+ cset "name='DMIC1 Enable Switch' off" -+ cset "name='DMIC2 Enable Switch' off" -+ ] -+} --- -2.29.2 - - -From dacfe2fc7b41b800f4f379ce4b1722462b97cab2 Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Sun, 6 Dec 2020 13:47:18 +0100 -Subject: [PATCH 07/24] chtnau8824: Boost analog mic volumes a bit - -Both Mic1 (internal analog mic) and Mic2 (headset mic) are a bit soft -with the current settings, boost their volumes a bit. - -Signed-off-by: Hans de Goede -Signed-off-by: Jaroslav Kysela ---- - ucm2/codecs/nau8824/EnableSeq.conf | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/ucm2/codecs/nau8824/EnableSeq.conf b/ucm2/codecs/nau8824/EnableSeq.conf -index 433e8e2..3650d06 100644 ---- a/ucm2/codecs/nau8824/EnableSeq.conf -+++ b/ucm2/codecs/nau8824/EnableSeq.conf -@@ -7,8 +7,8 @@ EnableSequence [ - cset "name='DMIC2 Enable Switch' off" - cset "name='DMIC3 Enable Switch' off" - cset "name='DMIC4 Enable Switch' off" -- cset "name='MIC1 Volume' 10" -- cset "name='MIC2 Volume' 10" -+ cset "name='MIC1 Volume' 14" -+ cset "name='MIC2 Volume' 14" - # Button Configuration - cset "name='THD for key media' 10" - cset "name='THD for key voice command' 16" --- -2.29.2 - - -From 263bd26b1216c933db3d216197a78678d0f8610e Mon Sep 17 00:00:00 2001 -From: Libin Yang -Date: Thu, 19 Nov 2020 20:01:30 +0800 -Subject: [PATCH 08/24] rt715: init: setup ADC07 to a proper volume - -This patch initiates 'rt715 ADC 07 Capture Volume' to a proper volume. - -Signed-off-by: Libin Yang -Signed-off-by: Jaroslav Kysela ---- - ucm2/codecs/rt715/init.conf | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/ucm2/codecs/rt715/init.conf b/ucm2/codecs/rt715/init.conf -index 6e07b2d..15a0571 100644 ---- a/ucm2/codecs/rt715/init.conf -+++ b/ucm2/codecs/rt715/init.conf -@@ -7,4 +7,5 @@ BootSequence [ - cset "name='rt715 ADC 25 Mux' 4" - cset "name='rt715 ADC 27 Capture Switch' 1" - cset "name='rt715 ADC 07 Capture Switch' 1" -+ cset "name='rt715 ADC 07 Capture Volume' 58" - ] --- -2.29.2 - - -From cf267cce6d553d4d436c166c23d3befc5476acef Mon Sep 17 00:00:00 2001 -From: Hui Wang -Date: Thu, 29 Oct 2020 13:34:02 +0800 -Subject: [PATCH 09/24] sof-hda-dsp: Set Master Playback Switch on in the - BootSequence - -Otherwise, the audio output will be muted by default if there is no -/var/lib/alsa/asound.state. I have experienced this issue When newly -install an OS. - -Signed-off-by: Hui Wang -Signed-off-by: Jaroslav Kysela ---- - ucm2/HDA-Intel/init.conf | 1 + - ucm2/sof-hda-dsp/sof-hda-dsp.conf | 1 + - 2 files changed, 2 insertions(+) - -diff --git a/ucm2/HDA-Intel/init.conf b/ucm2/HDA-Intel/init.conf -index 1a351a9..6310eb3 100644 ---- a/ucm2/HDA-Intel/init.conf -+++ b/ucm2/HDA-Intel/init.conf -@@ -15,6 +15,7 @@ If.master { - } - True.BootSequence [ - cset "name='Master Playback Volume' 60%" -+ cset "name='Master Playback Switch' on" - ] - } - -diff --git a/ucm2/sof-hda-dsp/sof-hda-dsp.conf b/ucm2/sof-hda-dsp/sof-hda-dsp.conf -index c8069a6..79b54a9 100644 ---- a/ucm2/sof-hda-dsp/sof-hda-dsp.conf -+++ b/ucm2/sof-hda-dsp/sof-hda-dsp.conf -@@ -24,6 +24,7 @@ If.master { - } - True.BootSequence [ - cset "name='Master Playback Volume' 60%" -+ cset "name='Master Playback Switch' on" - ] - } - --- -2.29.2 - - -From 5405544752c18153acc310ee7e4a4bacda040dca Mon Sep 17 00:00:00 2001 -From: Kai-Heng Feng -Date: Thu, 27 Aug 2020 21:18:13 +0800 -Subject: [PATCH 10/24] HDA-Intel/HiFi-dual: Add EnableSequence and - DisableSequence for Speaker and Headphones - -BugLink: https://github.com/alsa-project/alsa-ucm-conf/pull/48 -Signed-off-by: Kai-Heng Feng -Signed-off-by: Jaroslav Kysela ---- - ucm2/HDA-Intel/HiFi-dual.conf | 16 ++++++++++++++++ - 1 file changed, 16 insertions(+) - -diff --git a/ucm2/HDA-Intel/HiFi-dual.conf b/ucm2/HDA-Intel/HiFi-dual.conf -index cff948e..bacfd80 100644 ---- a/ucm2/HDA-Intel/HiFi-dual.conf -+++ b/ucm2/HDA-Intel/HiFi-dual.conf -@@ -27,6 +27,14 @@ SectionDevice."Speaker" { - PlaybackMixerElem "Speaker" - } - -+ EnableSequence [ -+ cset "name='Speaker Playback Switch' on" -+ ] -+ -+ DisableSequence [ -+ cset "name='Speaker Playback Switch' off" -+ ] -+ - ConflictingDevice [ - "Headphones" - ] -@@ -54,6 +62,14 @@ SectionDevice."Headphones" { - JackHWMute "Speaker" - } - -+ EnableSequence [ -+ cset "name='Headphone Playback Switch' on" -+ ] -+ -+ DisableSequence [ -+ cset "name='Headphone Playback Switch' off" -+ ] -+ - ConflictingDevice [ - "Speaker" - ] --- -2.29.2 - - -From 5947daef124c84fae511233248196576dfbfab7c Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 16 Dec 2020 08:55:04 +0100 -Subject: [PATCH 11/24] HDA-Intel/HiFi-dual: Add BootSequence and disable - playback channels in verb init - -BugLink: https://github.com/alsa-project/alsa-ucm-conf/pull/48 -Signed-off-by: Jaroslav Kysela ---- - ucm2/HDA-Intel/HDAudio-DualCodecs.conf | 12 ++++++++++++ - ucm2/HDA-Intel/HiFi-dual.conf | 2 ++ - 2 files changed, 14 insertions(+) - -diff --git a/ucm2/HDA-Intel/HDAudio-DualCodecs.conf b/ucm2/HDA-Intel/HDAudio-DualCodecs.conf -index 8aaabd0..6fd7bd1 100644 ---- a/ucm2/HDA-Intel/HDAudio-DualCodecs.conf -+++ b/ucm2/HDA-Intel/HDAudio-DualCodecs.conf -@@ -4,3 +4,15 @@ SectionUseCase."HiFi" { - File "HiFi-dual.conf" - Comment "Default" - } -+ -+BootSequence [ -+ cset "name='Headphone Playback Volume' 60%" -+ cset "name='Headphone Playback Switch' off" -+ cset "name='Speaker Playback Volume' 60%" -+ cset "name='Speaker Playback Switch' on" -+ 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" -+ cset "name='Input Source' Rear Mic" -+] -diff --git a/ucm2/HDA-Intel/HiFi-dual.conf b/ucm2/HDA-Intel/HiFi-dual.conf -index bacfd80..f2c6915 100644 ---- a/ucm2/HDA-Intel/HiFi-dual.conf -+++ b/ucm2/HDA-Intel/HiFi-dual.conf -@@ -8,6 +8,8 @@ SectionVerb { - cset "name='Front Playback Switch' on" - cset "name='Rear-Panel Capture Volume' 100%" - cset "name='Rear-Panel Capture Switch' on" -+ cset "name='Headphone Playback Switch' off" -+ cset "name='Speaker Playback Switch' off" - ] - - DisableSequence [ --- -2.29.2 - - -From 5634db4be3ed435f3e59f30a71c3c3711162929d Mon Sep 17 00:00:00 2001 -From: Jian-Hong Pan -Date: Tue, 15 Dec 2020 16:54:03 +0800 -Subject: [PATCH 12/24] chtrt5645: Enable Internal MIC of ECS EF20EA - -The ECS EF20EA uses a digital mic connected to the dmic2 pin, rather -then the default analog mic. - -1 [chtrt5645 ]: chtrt5645 - chtrt5645 - Standard-EF20EA-1.0 - -Add a card long name match for this, so that the right config is used. - -BugLink: https://github.com/alsa-project/alsa-ucm-conf/pull/68 -Signed-off-by: Jian-Hong Pan -Signed-off-by: Jaroslav Kysela ---- - ucm2/chtrt5645/HiFi.conf | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/ucm2/chtrt5645/HiFi.conf b/ucm2/chtrt5645/HiFi.conf -index 10b0a1c..30fad50 100644 ---- a/ucm2/chtrt5645/HiFi.conf -+++ b/ucm2/chtrt5645/HiFi.conf -@@ -18,7 +18,7 @@ If.cfg-dmic2 { - Condition { - Type RegexMatch - String "${CardLongName}" -- Regex "(LENOVO.*LenovoMIIX320|MEDION.*Wingman)" -+ Regex "(LENOVO.*LenovoMIIX320|MEDION.*Wingman|Standard-EF20EA-1.0)" - } - True { - Define.AnalogMic "" --- -2.29.2 - - -From bdd05ac3396a3a09f3818aaa9157eb7ef07676d6 Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Sat, 9 Jan 2021 22:02:51 +0100 -Subject: [PATCH 13/24] bytcr-rt5640: Add support for devices without speakers - and/or an internal mic - -There are kernel patches pending upstream for the bytcr-rt5640 machine-driver -to support devices without speakers and/or an internal mic. - -Since the UCM profile already conditionally loads the speaker and -internal-mic codec include files, these will simply get skipped in this -case, so this almost works with the current UCM profile without changes. - -The only troublesome part is the ConflictingDevice sections in the codec -HeadPhones.conf and HeadsetMic.conf files, which refer to resp. a "Speaker" -and a "Mic" device. Without any of the speaker or mic codec conf files -being included there will not by any "Speaker" / "Mic" devices leading -to an error while parsing the HeadPhones.conf / HeadsetMic.conf files. - -This commit makes the ConflictingDevice section conditional, fixing this. - -Cc: Rasmus Porsager -Signed-off-by: Hans de Goede -Signed-off-by: Jaroslav Kysela ---- - ucm2/bytcr-rt5640/HiFi-Components.conf | 28 +++++++++++++++++++++----- - ucm2/bytcr-rt5640/HiFi-LongName.conf | 28 +++++++++++++++++++++----- - ucm2/codecs/rt5640/HeadPhones.conf | 14 ++++++++++--- - ucm2/codecs/rt5640/HeadsetMic.conf | 14 ++++++++++--- - 4 files changed, 68 insertions(+), 16 deletions(-) - -diff --git a/ucm2/bytcr-rt5640/HiFi-Components.conf b/ucm2/bytcr-rt5640/HiFi-Components.conf -index 2ce4f59..a76b42d 100644 ---- a/ucm2/bytcr-rt5640/HiFi-Components.conf -+++ b/ucm2/bytcr-rt5640/HiFi-Components.conf -@@ -1,10 +1,16 @@ -+Define.HaveSpeaker "" -+Define.HaveInternalMic "" -+ - If.spk { - Condition { - Type String - Haystack "${CardComponents}" - Needle "cfg-spk:2" - } -- True.Include.spk.File "/codecs/rt5640/Speaker.conf" -+ True { -+ Include.spk.File "/codecs/rt5640/Speaker.conf" -+ Define.HaveSpeaker "yes" -+ } - } - - If.mono { -@@ -13,7 +19,10 @@ If.mono { - Haystack "${CardComponents}" - Needle "cfg-spk:1" - } -- True.Include.mspk.File "/codecs/rt5640/MonoSpeaker.conf" -+ True { -+ Include.mspk.File "/codecs/rt5640/MonoSpeaker.conf" -+ Define.HaveSpeaker "yes" -+ } - } - - Include.hs.File "/codecs/rt5640/HeadPhones.conf" -@@ -24,7 +33,10 @@ If.dmic1 { - Haystack "${CardComponents}" - Needle "cfg-mic:dmic1" - } -- True.Include.dmic.File "/codecs/rt5640/DigitalMics.conf" -+ True { -+ Include.dmic.File "/codecs/rt5640/DigitalMics.conf" -+ Define.HaveInternalMic "yes" -+ } - } - - If.in1 { -@@ -33,7 +45,10 @@ If.in1 { - Haystack "${CardComponents}" - Needle "cfg-mic:in1" - } -- True.Include.mic1.File "/codecs/rt5640/IN1-InternalMic.conf" -+ True { -+ Include.mic1.File "/codecs/rt5640/IN1-InternalMic.conf" -+ Define.HaveInternalMic "yes" -+ } - } - - If.in3 { -@@ -42,7 +57,10 @@ If.in3 { - Haystack "${CardComponents}" - Needle "cfg-mic:in3" - } -- True.Include.mic3.File "/codecs/rt5640/IN3-InternalMic.conf" -+ True { -+ Include.mic3.File "/codecs/rt5640/IN3-InternalMic.conf" -+ Define.HaveInternalMic "yes" -+ } - } - - Include.hsmic.File "/codecs/rt5640/HeadsetMic.conf" -diff --git a/ucm2/bytcr-rt5640/HiFi-LongName.conf b/ucm2/bytcr-rt5640/HiFi-LongName.conf -index c07f153..6cb5556 100644 ---- a/ucm2/bytcr-rt5640/HiFi-LongName.conf -+++ b/ucm2/bytcr-rt5640/HiFi-LongName.conf -@@ -1,10 +1,16 @@ -+Define.HaveSpeaker "" -+Define.HaveInternalMic "" -+ - If.spk { - Condition { - Type String - Haystack "${CardLongName}" - Needle "-stereo-spk" - } -- True.Include.spk.File "/codecs/rt5640/Speaker.conf" -+ True { -+ Include.spk.File "/codecs/rt5640/Speaker.conf" -+ Define.HaveSpeaker "yes" -+ } - } - - If.mono { -@@ -13,7 +19,10 @@ If.mono { - Haystack "${CardLongName}" - Needle "-mono-spk" - } -- True.Include.mspk.File "/codecs/rt5640/MonoSpeaker.conf" -+ True { -+ Include.mspk.File "/codecs/rt5640/MonoSpeaker.conf" -+ Define.HaveSpeaker "yes" -+ } - } - - Include.hs.File "/codecs/rt5640/HeadPhones.conf" -@@ -24,7 +33,10 @@ If.dmic1 { - Haystack "${CardLongName}" - Needle "-dmic1-mic" - } -- True.Include.dmic.File "/codecs/rt5640/DigitalMics.conf" -+ True { -+ Include.dmic.File "/codecs/rt5640/DigitalMics.conf" -+ Define.HaveInternalMic "yes" -+ } - } - - If.in1 { -@@ -33,7 +45,10 @@ If.in1 { - Haystack "${CardLongName}" - Needle "-in1-mic" - } -- True.Include.mic1.File "/codecs/rt5640/IN1-InternalMic.conf" -+ True { -+ Include.mic1.File "/codecs/rt5640/IN1-InternalMic.conf" -+ Define.HaveInternalMic "yes" -+ } - } - - If.in3 { -@@ -42,7 +57,10 @@ If.in3 { - Haystack "${CardLongName}" - Needle "-in3-mic" - } -- True.Include.mic3.File "/codecs/rt5640/IN3-InternalMic.conf" -+ True { -+ Include.mic3.File "/codecs/rt5640/IN3-InternalMic.conf" -+ Define.HaveInternalMic "yes" -+ } - } - - Include.hsmic.File "/codecs/rt5640/HeadsetMic.conf" -diff --git a/ucm2/codecs/rt5640/HeadPhones.conf b/ucm2/codecs/rt5640/HeadPhones.conf -index 42151d6..b7707e5 100644 ---- a/ucm2/codecs/rt5640/HeadPhones.conf -+++ b/ucm2/codecs/rt5640/HeadPhones.conf -@@ -1,9 +1,17 @@ - SectionDevice."Headphones" { - Comment "Headphones" - -- ConflictingDevice [ -- "Speaker" -- ] -+ If.have-spk { -+ Condition { -+ Type String -+ Empty "${var:HaveSpeaker}" -+ } -+ False { -+ ConflictingDevice [ -+ "Speaker" -+ ] -+ } -+ } - - EnableSequence [ - cset "name='DAC MIXL INF1 Switch' on" -diff --git a/ucm2/codecs/rt5640/HeadsetMic.conf b/ucm2/codecs/rt5640/HeadsetMic.conf -index 7a8dfb8..f88b611 100644 ---- a/ucm2/codecs/rt5640/HeadsetMic.conf -+++ b/ucm2/codecs/rt5640/HeadsetMic.conf -@@ -1,9 +1,17 @@ - SectionDevice."Headset" { - Comment "Headset Microphone" - -- ConflictingDevice [ -- "Mic" -- ] -+ If.have-mic { -+ Condition { -+ Type String -+ Empty "${var:HaveInternalMic}" -+ } -+ False { -+ ConflictingDevice [ -+ "Mic" -+ ] -+ } -+ } - - EnableSequence [ - cset "name='Headset Mic Switch' on" --- -2.29.2 - - -From cd02791e9360bcfa2cd4bed40cf5ddabb378ef93 Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Sat, 9 Jan 2021 22:02:52 +0100 -Subject: [PATCH 14/24] rt5640: Move standard DAC setup to EnableSeq.conf - -No matter which output is used, we always need to setup the standard -DAC config. Move this to the shared EnableSeq.conf to avoid having -to duplicate it in various places. - -Signed-off-by: Hans de Goede -Signed-off-by: Jaroslav Kysela ---- - ucm2/codecs/rt5640/EnableSeq.conf | 6 ++++++ - ucm2/codecs/rt5640/HeadPhones.conf | 6 ------ - ucm2/codecs/rt5640/MonoSpeaker.conf | 6 ------ - ucm2/codecs/rt5640/Speaker.conf | 6 ------ - 4 files changed, 6 insertions(+), 18 deletions(-) - -diff --git a/ucm2/codecs/rt5640/EnableSeq.conf b/ucm2/codecs/rt5640/EnableSeq.conf -index cbf4038..145a23b 100644 ---- a/ucm2/codecs/rt5640/EnableSeq.conf -+++ b/ucm2/codecs/rt5640/EnableSeq.conf -@@ -1,5 +1,11 @@ - EnableSequence [ - # RT5640 default output routing -+ cset "name='DAC MIXL INF1 Switch' on" -+ cset "name='DAC MIXR INF1 Switch' on" -+ cset "name='Stereo DAC MIXL DAC L1 Switch' on" -+ cset "name='Stereo DAC MIXR DAC R1 Switch' on" -+ cset "name='Stereo DAC MIXL DAC L2 Switch' on" -+ cset "name='Stereo DAC MIXR DAC R2 Switch' on" - cset "name='OUT MIXL DAC L1 Switch' on" - cset "name='OUT MIXR DAC R1 Switch' on" - -diff --git a/ucm2/codecs/rt5640/HeadPhones.conf b/ucm2/codecs/rt5640/HeadPhones.conf -index b7707e5..a9e4d20 100644 ---- a/ucm2/codecs/rt5640/HeadPhones.conf -+++ b/ucm2/codecs/rt5640/HeadPhones.conf -@@ -14,12 +14,6 @@ SectionDevice."Headphones" { - } +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 - EnableSequence [ -- cset "name='DAC MIXL INF1 Switch' on" -- cset "name='DAC MIXR INF1 Switch' on" -- cset "name='Stereo DAC MIXL DAC L1 Switch' on" -- cset "name='Stereo DAC MIXR DAC R1 Switch' on" -- cset "name='Stereo DAC MIXL DAC L2 Switch' on" -- cset "name='Stereo DAC MIXR DAC R2 Switch' on" - cset "name='HPO MIX HPVOL Switch' on" - cset "name='Headphone Switch' on" - cset "name='HP Channel Switch' on" -diff --git a/ucm2/codecs/rt5640/MonoSpeaker.conf b/ucm2/codecs/rt5640/MonoSpeaker.conf -index ddc7ba8..23cf34c 100644 ---- a/ucm2/codecs/rt5640/MonoSpeaker.conf -+++ b/ucm2/codecs/rt5640/MonoSpeaker.conf -@@ -6,12 +6,6 @@ SectionDevice."Speaker" { - ] + Define.Use "" # a non-empty string to use UCM configuration for HDA devices - EnableSequence [ -- cset "name='DAC MIXL INF1 Switch' on" -- cset "name='DAC MIXR INF1 Switch' on" -- cset "name='Stereo DAC MIXL DAC L1 Switch' on" -- cset "name='Stereo DAC MIXR DAC R1 Switch' on" -- cset "name='Stereo DAC MIXL DAC L2 Switch' on" -- cset "name='Stereo DAC MIXR DAC R2 Switch' on" - cset "name='SPK MIXL DAC L1 Switch' on" - cset "name='SPK MIXR DAC R1 Switch' on" - cset "name='SPOL MIX SPKVOL L Switch' on" -diff --git a/ucm2/codecs/rt5640/Speaker.conf b/ucm2/codecs/rt5640/Speaker.conf -index 411cd13..422cfdf 100644 ---- a/ucm2/codecs/rt5640/Speaker.conf -+++ b/ucm2/codecs/rt5640/Speaker.conf -@@ -6,12 +6,6 @@ SectionDevice."Speaker" { - ] - - EnableSequence [ -- cset "name='DAC MIXL INF1 Switch' on" -- cset "name='DAC MIXR INF1 Switch' on" -- cset "name='Stereo DAC MIXL DAC L1 Switch' on" -- cset "name='Stereo DAC MIXR DAC R1 Switch' on" -- cset "name='Stereo DAC MIXL DAC L2 Switch' on" -- cset "name='Stereo DAC MIXR DAC R2 Switch' on" - cset "name='SPK MIXL DAC L1 Switch' on" - cset "name='SPK MIXR DAC R1 Switch' on" - cset "name='SPOL MIX SPKVOL L Switch' on" -- -2.29.2 - - -From 95587ae8b75134c4bbc2cec0181e5d529826c9c4 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Thu, 14 Jan 2021 18:31:24 +0100 -Subject: [PATCH 15/24] bytcr-rt5640: fix the execution order - -The includes must be run _after_ defines. The Include directives -have precedence. Put everything to If compound. - -Fixes: bdd05ac339 ("bytcr-rt5640: Add support for devices without speakers and/or an internal mic") -Signed-off-by: Jaroslav Kysela ---- - ucm2/bytcr-rt5640/HiFi-Components.conf | 10 ++++++++-- - ucm2/bytcr-rt5640/HiFi-LongName.conf | 10 ++++++++-- - 2 files changed, 16 insertions(+), 4 deletions(-) - -diff --git a/ucm2/bytcr-rt5640/HiFi-Components.conf b/ucm2/bytcr-rt5640/HiFi-Components.conf -index a76b42d..1999717 100644 ---- a/ucm2/bytcr-rt5640/HiFi-Components.conf -+++ b/ucm2/bytcr-rt5640/HiFi-Components.conf -@@ -25,7 +25,10 @@ If.mono { - } - } - --Include.hs.File "/codecs/rt5640/HeadPhones.conf" -+If.hp { -+ Condition { Type String Empty "" } -+ True.Include.hs.File "/codecs/rt5640/HeadPhones.conf" -+} - - If.dmic1 { - Condition { -@@ -63,4 +66,7 @@ If.in3 { - } - } - --Include.hsmic.File "/codecs/rt5640/HeadsetMic.conf" -+If.hsmic { -+ Condition { Type String Empty "" } -+ True.Include.hsmic.File "/codecs/rt5640/HeadsetMic.conf" -+} -diff --git a/ucm2/bytcr-rt5640/HiFi-LongName.conf b/ucm2/bytcr-rt5640/HiFi-LongName.conf -index 6cb5556..34acef8 100644 ---- a/ucm2/bytcr-rt5640/HiFi-LongName.conf -+++ b/ucm2/bytcr-rt5640/HiFi-LongName.conf -@@ -25,7 +25,10 @@ If.mono { - } - } - --Include.hs.File "/codecs/rt5640/HeadPhones.conf" -+If.hp { -+ Condition { Type String Empty "" } -+ True.Include.hs.File "/codecs/rt5640/HeadPhones.conf" -+} - - If.dmic1 { - Condition { -@@ -63,4 +66,7 @@ If.in3 { - } - } - --Include.hsmic.File "/codecs/rt5640/HeadsetMic.conf" -+If.hsmic { -+ Condition { Type String Empty "" } -+ True.Include.hsmic.File "/codecs/rt5640/HeadsetMic.conf" -+} --- -2.29.2 - - -From 09e5271401480297c2c9c0b753df9705123a1af1 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Thu, 14 Jan 2021 11:03:56 +0100 -Subject: [PATCH 16/24] ucm2: add initial configuration for TRX40 Gigabyte - Aorus Master Audio - -BugLink: https://github.com/alsa-project/alsa-ucm-conf/pull/25 -Signed-off-by: Jaroslav Kysela ---- - ...Gigabyte-Aorus-Master-Front-Headphone.conf | 1 + - ...Gigabyte-Aorus-Master-Main-Audio-HiFi.conf | 61 +++++++++++++++++++ - .../Gigabyte-Aorus-Master-Main-Audio.conf | 6 ++ - 3 files changed, 68 insertions(+) - create mode 120000 ucm2/USB-Audio/Gigabyte-Aorus-Master-Front-Headphone.conf - create mode 100644 ucm2/USB-Audio/Gigabyte-Aorus-Master-Main-Audio-HiFi.conf - create mode 100644 ucm2/USB-Audio/Gigabyte-Aorus-Master-Main-Audio.conf - -diff --git a/ucm2/USB-Audio/Gigabyte-Aorus-Master-Front-Headphone.conf b/ucm2/USB-Audio/Gigabyte-Aorus-Master-Front-Headphone.conf -new file mode 120000 -index 0000000..1376437 ---- /dev/null -+++ b/ucm2/USB-Audio/Gigabyte-Aorus-Master-Front-Headphone.conf -@@ -0,0 +1 @@ -+../module/lib/linked.conf -\ No newline at end of file -diff --git a/ucm2/USB-Audio/Gigabyte-Aorus-Master-Main-Audio-HiFi.conf b/ucm2/USB-Audio/Gigabyte-Aorus-Master-Main-Audio-HiFi.conf -new file mode 100644 -index 0000000..5c24165 ---- /dev/null -+++ b/ucm2/USB-Audio/Gigabyte-Aorus-Master-Main-Audio-HiFi.conf -@@ -0,0 +1,61 @@ -+Define.SecondaryCardId "$${CardIdByName:Aorus Master Front Headphone}" -+ -+SectionDevice."Speaker" { -+ Comment "Speakers" -+ Value { -+ PlaybackChannels 8 -+ PlaybackPriority 200 -+ PlaybackPCM "hw:${CardId}" -+ JackControl "Line Out Jack" -+ PlaybackMixerElem "Line Out" -+ } -+} -+ -+SectionDevice."Headphones" { -+ Comment "Front Headphones" -+ Value { -+ PlaybackPriority 300 -+ PlaybackPCM "hw:${var:SecondaryCardId}" -+ JackCTL "hw:${var:SecondaryCardId}" -+ JackControl "Headphone - Output Jack" -+ } -+} -+ -+SectionDevice."SPDIF" { -+ Comment "S/PDIF Out" -+ Value { -+ PlaybackPriority 100 -+ PlaybackPCM "hw:${CardId},1" -+ # PlaybackMixerElem "IEC958" -+ } -+} -+ -+SectionDevice."Line" { -+ Comment "Line In" -+ Value { -+ CapturePriority 100 -+ CapturePCM "hw:${CardId}" -+ JackControl "Line Jack" -+ CaptureMixerElem "Line" -+ } -+} -+ -+SectionDevice."Mic1" { -+ Comment "Microphone" -+ Value { -+ CapturePriority 200 -+ CapturePCM "hw:${CardId},1" -+ JackControl "Mic Jack" -+ CaptureMixerElem "Mic" -+ } -+} -+ -+SectionDevice."Mic2" { -+ Comment "Front Microphone" -+ Value { -+ CapturePriority 300 -+ CapturePCM "hw:${CardId},2" -+ JackControl "Front Mic Jack" -+ CaptureMixerElem "Front Mic" -+ } -+} -diff --git a/ucm2/USB-Audio/Gigabyte-Aorus-Master-Main-Audio.conf b/ucm2/USB-Audio/Gigabyte-Aorus-Master-Main-Audio.conf -new file mode 100644 -index 0000000..656b989 ---- /dev/null -+++ b/ucm2/USB-Audio/Gigabyte-Aorus-Master-Main-Audio.conf -@@ -0,0 +1,6 @@ -+Syntax 3 -+Comment "Gigabyte Aorus Integrated Audio" -+SectionUseCase."HiFi" { -+ File "Gigabyte-Aorus-Master-Main-Audio-HiFi.conf" -+ Comment "Default Alsa Profile" -+} --- -2.29.2 - - -From 062e4710c524283c5d11cbf99931b24c6d963f98 Mon Sep 17 00:00:00 2001 -From: Marijn Suijten -Date: Thu, 14 Jan 2021 14:11:50 +0100 -Subject: [PATCH 17/24] USB-Audio/ALC1220: Bump analog Speaker priority over - S/PDIF - -The `S/PDIF` port does not have any jack sensing, and with a priority -higher than the `Speakers` it will always be selected by default instead -of the `Speakers` even if unplugged. - -Swapping the priorities around allows analog `Speakers` to be selected -first, _if_ they are plugged in. Otherwise `S/PDIF` is used. - -Signed-off-by: Marijn Suijten -Signed-off-by: Jaroslav Kysela ---- - ucm2/USB-Audio/Realtek-ALC1220-VB-Desktop-HiFi.conf | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/ucm2/USB-Audio/Realtek-ALC1220-VB-Desktop-HiFi.conf b/ucm2/USB-Audio/Realtek-ALC1220-VB-Desktop-HiFi.conf -index 344db83..cbf7154 100644 ---- a/ucm2/USB-Audio/Realtek-ALC1220-VB-Desktop-HiFi.conf -+++ b/ucm2/USB-Audio/Realtek-ALC1220-VB-Desktop-HiFi.conf -@@ -2,7 +2,7 @@ SectionDevice."Speaker" { - Comment "Speakers" - Value { - PlaybackChannels 8 -- PlaybackPriority 100 -+ PlaybackPriority 200 - PlaybackPCM "hw:${CardId}" - JackControl "Speaker Jack" - PlaybackMixerElem "Speaker" -@@ -22,7 +22,7 @@ SectionDevice."Headphones" { - SectionDevice."SPDIF" { - Comment "S/PDIF Out" - Value { -- PlaybackPriority 200 -+ PlaybackPriority 100 - PlaybackPCM "hw:${CardId},2" - PlaybackMixerElem "IEC958" - } --- -2.29.2 - - -From 8e875c9467cc72e53e53104b07d5515f3ef0a779 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 15 Jan 2021 14:03:35 +0100 -Subject: [PATCH 18/24] USB-Audio/ALC1220: fix indentation for Speaker device - -Signed-off-by: Jaroslav Kysela ---- - ucm2/USB-Audio/Realtek-ALC1220-VB-Desktop-HiFi.conf | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/ucm2/USB-Audio/Realtek-ALC1220-VB-Desktop-HiFi.conf b/ucm2/USB-Audio/Realtek-ALC1220-VB-Desktop-HiFi.conf -index cbf7154..0d75384 100644 ---- a/ucm2/USB-Audio/Realtek-ALC1220-VB-Desktop-HiFi.conf -+++ b/ucm2/USB-Audio/Realtek-ALC1220-VB-Desktop-HiFi.conf -@@ -1,11 +1,11 @@ - SectionDevice."Speaker" { - Comment "Speakers" - Value { -- PlaybackChannels 8 -- PlaybackPriority 200 -- PlaybackPCM "hw:${CardId}" -- JackControl "Speaker Jack" -- PlaybackMixerElem "Speaker" -+ PlaybackChannels 8 -+ PlaybackPriority 200 -+ PlaybackPCM "hw:${CardId}" -+ JackControl "Speaker Jack" -+ PlaybackMixerElem "Speaker" - } - } - --- -2.29.2 - +2.30.2 -From 5503703ab95d5ed40b1da138016777bb5429190e Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 15 Jan 2021 14:55:53 +0100 -Subject: [PATCH 19/24] USB-Audio: fix indentation in - Gigabyte-Aorus-Master-Main-Audio-HiFi.conf - -Signed-off-by: Jaroslav Kysela ---- - .../Gigabyte-Aorus-Master-Main-Audio-HiFi.conf | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/ucm2/USB-Audio/Gigabyte-Aorus-Master-Main-Audio-HiFi.conf b/ucm2/USB-Audio/Gigabyte-Aorus-Master-Main-Audio-HiFi.conf -index 5c24165..37800fb 100644 ---- a/ucm2/USB-Audio/Gigabyte-Aorus-Master-Main-Audio-HiFi.conf -+++ b/ucm2/USB-Audio/Gigabyte-Aorus-Master-Main-Audio-HiFi.conf -@@ -3,11 +3,11 @@ Define.SecondaryCardId "$${CardIdByName:Aorus Master Front Headphone}" - SectionDevice."Speaker" { - Comment "Speakers" - Value { -- PlaybackChannels 8 -- PlaybackPriority 200 -- PlaybackPCM "hw:${CardId}" -- JackControl "Line Out Jack" -- PlaybackMixerElem "Line Out" -+ PlaybackChannels 8 -+ PlaybackPriority 200 -+ PlaybackPCM "hw:${CardId}" -+ JackControl "Line Out Jack" -+ PlaybackMixerElem "Line Out" - } - } - --- -2.29.2 - - -From eaa5eacd3e068471537888dee627751dc35e714a Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Wed, 16 Dec 2020 16:38:37 +0100 -Subject: [PATCH 20/24] chtnau8824: Add a SST define/variable - -Add a SST define which gets set to "yes" when using the SST driver -and to "" when not using the SST driver; - -And decide if platforms/bytcr/PlatformEnableSeq.conf should be included -or not based on this. - -This is a preparation patch for adding SOF support. - -Signed-off-by: Hans de Goede -Signed-off-by: Jaroslav Kysela ---- - ucm2/chtnau8824/HiFi.conf | 19 +++++++++++++++---- - 1 file changed, 15 insertions(+), 4 deletions(-) - -diff --git a/ucm2/chtnau8824/HiFi.conf b/ucm2/chtnau8824/HiFi.conf -index 105f360..b36588f 100644 ---- a/ucm2/chtnau8824/HiFi.conf -+++ b/ucm2/chtnau8824/HiFi.conf -@@ -1,5 +1,16 @@ - Define.Speaker "Speaker" - Define.Mic "InternalMic" -+Define.SST "yes" -+ -+If.Controls { -+ Condition { -+ Type ControlExists -+ Control "name='media0_in Gain 0 Switch'" -+ } -+ False { -+ Define.SST "" -+ } -+} - - If.cfg-mspk { - Condition { -@@ -33,12 +44,12 @@ SectionVerb { - - Include.e.File "/codecs/nau8824/EnableSeq.conf" - -- If.Controls { -+ If.SST { - Condition { -- Type ControlExists -- Control "name='media0_in Gain 0 Switch'" -+ Type String -+ Empty "${var:SST}" - } -- True { -+ False { - Include.pe { - File "/platforms/bytcr/PlatformEnableSeq.conf" - Before.EnableSequence "0" --- -2.29.2 - - -From 4e0369b4fcebde195a38d5b90c73b08f28e0047a Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Thu, 21 Jan 2021 11:15:02 +0100 -Subject: [PATCH 21/24] kblrt5660: Fix file permissions - -The exec bit was set wrongly on those files. Fix them. - -Signed-off-by: Takashi Iwai ---- - ucm2/kblrt5660/Hdmi1.conf | 0 - ucm2/kblrt5660/Hdmi2.conf | 0 - ucm2/kblrt5660/HiFi.conf | 0 - ucm2/kblrt5660/kblrt5660.conf | 0 - 4 files changed, 0 insertions(+), 0 deletions(-) - mode change 100755 => 100644 ucm2/kblrt5660/Hdmi1.conf - mode change 100755 => 100644 ucm2/kblrt5660/Hdmi2.conf - mode change 100755 => 100644 ucm2/kblrt5660/HiFi.conf - mode change 100755 => 100644 ucm2/kblrt5660/kblrt5660.conf - -diff --git a/ucm2/kblrt5660/Hdmi1.conf b/ucm2/kblrt5660/Hdmi1.conf -old mode 100755 -new mode 100644 -diff --git a/ucm2/kblrt5660/Hdmi2.conf b/ucm2/kblrt5660/Hdmi2.conf -old mode 100755 -new mode 100644 -diff --git a/ucm2/kblrt5660/HiFi.conf b/ucm2/kblrt5660/HiFi.conf -old mode 100755 -new mode 100644 -diff --git a/ucm2/kblrt5660/kblrt5660.conf b/ucm2/kblrt5660/kblrt5660.conf -old mode 100755 -new mode 100644 --- -2.29.2 - - -From 96e1c19a6bcc1e353f677966d4d93399204af0ec Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Wed, 16 Dec 2020 16:38:38 +0100 -Subject: [PATCH 22/24] chtnau8824: Add support for using the SOF driver - -The old (and currently the default) SST driver uses TDM 4 slots 24 bit -as wire format to the codec. Where as the new SOF driver uses standard -I2S 2 channel 24 bit. - -Normally this should not impact the UCM settings, but on the NAU8824 -the "DAC Right Channel Source" mixer setting must be set to 1 when -using TDM 4 slots and to 0 when using I2S 2 channel mode. - -Getting this wrong (in either case) results in the right channel not -outputting any sound. - -This commit introduces a RightOutputChannel variable which gets -set to 0/1 depending on the driver and then uses that for the -"DAC Right Channel Source" mixer setting so that we do the right -thing depending on the driver. - -This has been tested on the following devices: - -Medion E2215T: Stereo speakers, analog mic -Medion E2228T: Stereo speakers, stereo digital mics -Cube iWork 8 Air: Mono speaker, analog mic - -Signed-off-by: Hans de Goede -Signed-off-by: Jaroslav Kysela ---- - ucm2/chtnau8824/HiFi.conf | 2 ++ - ucm2/codecs/nau8824/EnableSeq.conf | 2 +- - 2 files changed, 3 insertions(+), 1 deletion(-) - -diff --git a/ucm2/chtnau8824/HiFi.conf b/ucm2/chtnau8824/HiFi.conf -index b36588f..c3d830d 100644 ---- a/ucm2/chtnau8824/HiFi.conf -+++ b/ucm2/chtnau8824/HiFi.conf -@@ -1,6 +1,7 @@ - Define.Speaker "Speaker" - Define.Mic "InternalMic" - Define.SST "yes" -+Define.RightOutputChannel 1 - - If.Controls { - Condition { -@@ -9,6 +10,7 @@ If.Controls { - } - False { - Define.SST "" -+ Define.RightOutputChannel 0 - } - } - -diff --git a/ucm2/codecs/nau8824/EnableSeq.conf b/ucm2/codecs/nau8824/EnableSeq.conf -index 3650d06..660856f 100644 ---- a/ucm2/codecs/nau8824/EnableSeq.conf -+++ b/ucm2/codecs/nau8824/EnableSeq.conf -@@ -1,7 +1,7 @@ - EnableSequence [ - # Playback TDM configuration - cset "name='DACL Channel Source' 0" -- cset "name='DACR Channel Source' 1" -+ cset "name='DACR Channel Source' ${var:RightOutputChannel}" - # Input Configuration - cset "name='DMIC1 Enable Switch' off" - cset "name='DMIC2 Enable Switch' off" --- -2.29.2 - - -From 3bea51c3188257c5bc0eaaed922d1f714e3508c7 Mon Sep 17 00:00:00 2001 -From: Pierre-Louis Bossart -Date: Thu, 21 Jan 2021 14:38:26 -0600 -Subject: [PATCH 23/24] sof-hda-dsp: update handling of cfg-dmics strings - -Existing platforms can have 1,2,3 or 4 microphones. The SOF firmware -will generate 2 or 4 channels. Since by default CaptureChannels is 2, -we need to add the case for cfg-dmics = 3. - -Signed-off-by: Pierre-Louis Bossart -Signed-off-by: Jaroslav Kysela ---- - ucm2/sof-hda-dsp/HiFi.conf | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/ucm2/sof-hda-dsp/HiFi.conf b/ucm2/sof-hda-dsp/HiFi.conf -index a250331..2c02c15 100644 ---- a/ucm2/sof-hda-dsp/HiFi.conf -+++ b/ucm2/sof-hda-dsp/HiFi.conf -@@ -16,9 +16,9 @@ SectionDevice."Mic1" { - CapturePCM "hw:${CardId},6" - If.chn { - Condition { -- Type String -- Haystack "${CardComponents}" -- Needle "cfg-dmics:4" -+ Type RegexMatch -+ Regex "cfg-dmics:[34]" -+ String "${CardComponents}" - } - True { - CaptureChannels 4 --- -2.29.2 - - -From 889c5b9809f1635005d77871bb9abc09df6a3cc3 Mon Sep 17 00:00:00 2001 -From: Pierre-Louis Bossart -Date: Thu, 21 Jan 2021 14:44:05 -0600 -Subject: [PATCH 24/24] sof-soundwire: add support for dmics - -the pinmux allows for SoundWire to be used on e.g. link0 and link1, -and the rest of the pins can be assigned for dmic usages. - -We currently don't track this capability which means users don't see a -capture device, e.g. on HP Spectre x360. - -The sof_sdw machine driver was modified to report the cfg-dmics -string, possible values are 0..4. - -BugLink: https://github.com/thesofproject/linux/issues/2700 -BugLink: https://github.com/alsa-project/alsa-ucm-conf/pull/75 -Signed-off-by: Pierre-Louis Bossart -Signed-off-by: Jaroslav Kysela ---- - ucm2/sof-soundwire/dmic.conf | 21 +++++++++++++++++++++ - ucm2/sof-soundwire/sof-soundwire.conf | 5 +++++ - 2 files changed, 26 insertions(+) - create mode 100644 ucm2/sof-soundwire/dmic.conf - -diff --git a/ucm2/sof-soundwire/dmic.conf b/ucm2/sof-soundwire/dmic.conf -new file mode 100644 -index 0000000..1f704a5 ---- /dev/null -+++ b/ucm2/sof-soundwire/dmic.conf -@@ -0,0 +1,21 @@ -+SectionDevice."Mic" { -+ Comment "Digital Microphone" -+ -+ Value { -+ CapturePriority 100 -+ CapturePCM "hw:${CardId},3" -+ If.chn { -+ Condition { -+ Type RegexMatch -+ Regex "[34]" -+ String "${var:Mics1}" -+ } -+ True { -+ CaptureChannels 4 -+ } -+ } -+ CaptureMixerElem "Dmic0" -+ CaptureVolume "Dmic0 Capture Volume" -+ CaptureSwitch "Dmic0 Capture Switch" -+ } -+} -diff --git a/ucm2/sof-soundwire/sof-soundwire.conf b/ucm2/sof-soundwire/sof-soundwire.conf -index 2ba44be..ec8b01e 100644 ---- a/ucm2/sof-soundwire/sof-soundwire.conf -+++ b/ucm2/sof-soundwire/sof-soundwire.conf -@@ -11,6 +11,7 @@ Define { - SpeakerAmps1 "0" - HeadsetCodec1 "" - MicCodec1 "" -+ Mics1 "0" - } - - DefineRegex { -@@ -34,6 +35,10 @@ DefineRegex { - Regex " mic:([a-z0-9]+)" - String "${CardComponents}" - } -+ Mics { -+ Regex " cfg-mics:([1-9][0-9]*)" -+ String "${CardComponents}" -+ } - } - - If.hs_init { --- -2.29.2 diff --git a/SPECS/alsa-lib.spec b/SPECS/alsa-lib.spec index 16a7798..91a9c5c 100644 --- a/SPECS/alsa-lib.spec +++ b/SPECS/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: 3%{?prever_dot}%{?dist} License: LGPLv2+ Group: System Environment/Libraries URL: http://www.alsa-project.org/ @@ -163,6 +163,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h %{_datadir}/alsa/topology %changelog +* Thu Jun 3 2021 Jaroslav Kysela - 1.2.5-3 +- Updated to 1.2.5 + * Mon Feb 1 2021 Jaroslav Kysela - 1.2.4-5 - Apply fixes from upstream (alsa-lib, alsa-ucm-conf)