diff --git a/.alsa-lib.metadata b/.alsa-lib.metadata new file mode 100644 index 0000000..63d5f76 --- /dev/null +++ b/.alsa-lib.metadata @@ -0,0 +1,3 @@ +b58599c1237b2525962ed190ef501d3b9aa6edf5 SOURCES/alsa-lib-1.2.1.2.tar.bz2 +93fbe39ec099778e67e8ab2ef3780e08893f0176 SOURCES/alsa-topology-conf-1.2.1.tar.bz2 +b4b6070fb3335dcd750718da664b7cba47a3f285 SOURCES/alsa-ucm-conf-1.2.1.2.tar.bz2 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bfc63ac --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +SOURCES/alsa-lib-1.2.1.2.tar.bz2 +SOURCES/alsa-topology-conf-1.2.1.tar.bz2 +SOURCES/alsa-ucm-conf-1.2.1.2.tar.bz2 diff --git a/SOURCES/alsa-git.patch b/SOURCES/alsa-git.patch new file mode 100644 index 0000000..32f91f4 --- /dev/null +++ b/SOURCES/alsa-git.patch @@ -0,0 +1,1022 @@ +From c79f09e1f5e8b559b58dacdb00708d995b2e3aa5 Mon Sep 17 00:00:00 2001 +From: paulhsia +Date: Sat, 30 Nov 2019 03:35:30 +0800 +Subject: [PATCH 01/16] ucm: Use strncmp to avoid access-out-of-boundary + +If the length of the identifier is less than the length of the prefix, +access-out-of-boundary will occur in memcmp(). + +Signed-off-by: paulhsia +Signed-off-by: Jaroslav Kysela +--- + src/ucm/main.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/src/ucm/main.c b/src/ucm/main.c +index b0b6ffb3..252e50d9 100644 +--- a/src/ucm/main.c ++++ b/src/ucm/main.c +@@ -61,11 +61,13 @@ static int check_identifier(const char *identifier, const char *prefix) + { + int len; + +- if (strcmp(identifier, prefix) == 0) +- return 1; + len = strlen(prefix); +- if (memcmp(identifier, prefix, len) == 0 && identifier[len] == '/') ++ if (strncmp(identifier, prefix, len) != 0) ++ return 0; ++ ++ if (identifier[len] == 0 || identifier[len] == '/') + return 1; ++ + return 0; + } + +-- +2.20.1 + + +From 9baf64da2f26844434ecea4825052937a3abe06c Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 29 Nov 2019 22:28:26 +0100 +Subject: [PATCH 02/16] ucm: return always at least NULL if no list is + available in snd_use_case_get_list() + +Signed-off-by: Jaroslav Kysela +--- + src/ucm/main.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/src/ucm/main.c b/src/ucm/main.c +index 252e50d9..b80db65f 100644 +--- a/src/ucm/main.c ++++ b/src/ucm/main.c +@@ -1160,8 +1160,10 @@ static int get_supcon_device_list(snd_use_case_mgr_t *uc_mgr, + + modifier = find_modifier(uc_mgr, verb, name, 0); + if (modifier) { +- if (modifier->dev_list.type != type) ++ if (modifier->dev_list.type != type) { ++ *list = NULL; + return 0; ++ } + return get_list(&modifier->dev_list.list, list, + struct dev_list_node, list, + name); +@@ -1169,8 +1171,10 @@ static int get_supcon_device_list(snd_use_case_mgr_t *uc_mgr, + + device = find_device(uc_mgr, verb, name, 0); + if (device) { +- if (device->dev_list.type != type) ++ if (device->dev_list.type != type) { ++ *list = NULL; + return 0; ++ } + return get_list(&device->dev_list.list, list, + struct dev_list_node, list, + name); +-- +2.20.1 + + +From ebdd2b6cdb8119cf75f0dd0a3b283d271b3a547e Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Sat, 30 Nov 2019 20:31:55 +0100 +Subject: [PATCH 03/16] ucm: add _identifiers list + +Signed-off-by: Jaroslav Kysela +--- + include/use-case.h | 1 + + src/ucm/main.c | 268 ++++++++++++++++++++++++++++++++++----------- + 2 files changed, 208 insertions(+), 61 deletions(-) + +diff --git a/include/use-case.h b/include/use-case.h +index 8e7e838c..85c58ac0 100644 +--- a/include/use-case.h ++++ b/include/use-case.h +@@ -206,6 +206,7 @@ int snd_use_case_free_list(const char *list[], int items); + * - _enadevs - get list of enabled devices + * - _enamods - get list of enabled modifiers + * ++ * - _identifiers/{modifier}|{device}[/{verb}] - list of value identifiers + * - _supporteddevs/{modifier}|{device}[/{verb}] - list of supported devices + * - _conflictingdevs/{modifier}|{device}[/{verb}] - list of conflicting devices + * +diff --git a/src/ucm/main.c b/src/ucm/main.c +index b80db65f..d2078a23 100644 +--- a/src/ucm/main.c ++++ b/src/ucm/main.c +@@ -1072,7 +1072,6 @@ int snd_use_case_mgr_reset(snd_use_case_mgr_t *uc_mgr) + /** + * \brief Get list of verbs in pair verbname+comment + * \param list Returned list +- * \param verbname For verb (NULL = current) + * \return Number of list entries if success, otherwise a negative error code + */ + static int get_verb_list(snd_use_case_mgr_t *uc_mgr, const char **list[]) +@@ -1181,7 +1180,6 @@ static int get_supcon_device_list(snd_use_case_mgr_t *uc_mgr, + } + + return -ENOENT; +- + } + + /** +@@ -1210,41 +1208,201 @@ static int get_conflicting_device_list(snd_use_case_mgr_t *uc_mgr, + + #ifndef DOC_HIDDEN + struct myvalue { +- struct list_head list; +- char *value; ++ struct list_head list; ++ const char *text; + }; + #endif + ++/** ++ * \brief Convert myvalue list string list ++ * \param list myvalue list ++ * \param res string list ++ * \retval Number of list entries if success, otherwise a negativer error code ++ */ ++static int myvalue_to_str_list(struct list_head *list, char ***res) ++{ ++ struct list_head *pos; ++ struct myvalue *value; ++ char **p; ++ int cnt; ++ ++ cnt = alloc_str_list(list, 1, res); ++ if (cnt < 0) ++ return cnt; ++ p = *res; ++ list_for_each(pos, list) { ++ value = list_entry(pos, struct myvalue, list); ++ *p = strdup(value->text); ++ if (*p == NULL) { ++ snd_use_case_free_list((const char **)p, cnt); ++ return -ENOMEM; ++ } ++ p++; ++ } ++ return cnt; ++} ++ ++/** ++ * \brief Free myvalue list ++ * \param list myvalue list ++ */ ++static void myvalue_list_free(struct list_head *list) ++{ ++ struct list_head *pos, *npos; ++ struct myvalue *value; ++ ++ list_for_each_safe(pos, npos, list) { ++ value = list_entry(pos, struct myvalue, list); ++ list_del(&value->list); ++ free(value); ++ } ++} ++ ++/** ++ * \brief Merge one value to the myvalue list ++ * \param list The list with values ++ * \param value The value to be merged (without duplicates) ++ * \return 1 if dup, 0 if success, otherwise a negative error code ++ */ ++static int merge_value(struct list_head *list, const char *text) ++{ ++ struct list_head *pos; ++ struct myvalue *value; ++ ++ list_for_each(pos, list) { ++ value = list_entry(pos, struct myvalue, list); ++ if (strcmp(value->text, text) == 0) ++ return 1; ++ } ++ value = malloc(sizeof(*value)); ++ if (value == NULL) ++ return -ENOMEM; ++ value->text = text; ++ list_add_tail(&value->list, list); ++ return 0; ++} ++ ++/** ++ * \brief Find all values for given identifier ++ * \param list Returned list ++ * \param source Source list with ucm_value structures ++ * \return Zero if success, otherwise a negative error code ++ */ ++static int add_identifiers(struct list_head *list, ++ struct list_head *source) ++{ ++ struct ucm_value *v; ++ struct list_head *pos; ++ int err; ++ ++ list_for_each(pos, source) { ++ v = list_entry(pos, struct ucm_value, list); ++ err = merge_value(list, v->name); ++ if (err < 0) ++ return err; ++ } ++ return 0; ++} ++ ++/** ++ * \brief Find all values for given identifier ++ * \param list Returned list ++ * \param identifier Identifier ++ * \param source Source list with ucm_value structures ++ */ + static int add_values(struct list_head *list, + const char *identifier, + struct list_head *source) + { +- struct ucm_value *v; +- struct myvalue *val; +- struct list_head *pos, *pos1; +- int match; ++ struct ucm_value *v; ++ struct list_head *pos; ++ int err; + +- list_for_each(pos, source) { +- v = list_entry(pos, struct ucm_value, list); +- if (check_identifier(identifier, v->name)) { +- match = 0; +- list_for_each(pos1, list) { +- val = list_entry(pos1, struct myvalue, list); +- if (strcmp(val->value, v->data) == 0) { +- match = 1; +- break; +- } +- } +- if (!match) { +- val = malloc(sizeof(struct myvalue)); +- if (val == NULL) +- return -ENOMEM; +- val->value = v->data; +- list_add_tail(&val->list, list); +- } +- } +- } +- return 0; ++ list_for_each(pos, source) { ++ v = list_entry(pos, struct ucm_value, list); ++ if (check_identifier(identifier, v->name)) { ++ err = merge_value(list, v->data); ++ if (err < 0) ++ return err; ++ } ++ } ++ return 0; ++} ++ ++/** ++ * \brief compare two identifiers ++ */ ++static int identifier_cmp(const void *_a, const void *_b) ++{ ++ const char * const *a = _a; ++ const char * const *b = _b; ++ return strcmp(*a, *b); ++} ++ ++/** ++ * \brief Get list of available identifiers ++ * \param list Returned list ++ * \param name Name of verb or modifier to query ++ * \return Number of list entries if success, otherwise a negative error code ++ */ ++static int get_identifiers_list(snd_use_case_mgr_t *uc_mgr, ++ const char **list[], char *name) ++{ ++ struct use_case_verb *verb; ++ struct use_case_modifier *modifier; ++ struct use_case_device *device; ++ struct list_head mylist; ++ struct list_head *value_list; ++ char *str, **res; ++ int err; ++ ++ if (!name) ++ return -ENOENT; ++ ++ str = strchr(name, '/'); ++ if (str) { ++ *str = '\0'; ++ verb = find_verb(uc_mgr, str + 1); ++ } ++ else { ++ verb = uc_mgr->active_verb; ++ } ++ if (!verb) ++ return -ENOENT; ++ ++ value_list = NULL; ++ modifier = find_modifier(uc_mgr, verb, name, 0); ++ if (modifier) { ++ value_list = &modifier->value_list; ++ } else { ++ device = find_device(uc_mgr, verb, name, 0); ++ if (device) ++ value_list = &device->value_list; ++ } ++ if (value_list == NULL) ++ return -ENOENT; ++ ++ INIT_LIST_HEAD(&mylist); ++ err = add_identifiers(&mylist, &uc_mgr->value_list); ++ if (err < 0) ++ goto __fail; ++ err = add_identifiers(&mylist, &verb->value_list); ++ if (err < 0) ++ goto __fail; ++ err = add_identifiers(&mylist, value_list); ++ if (err < 0) ++ goto __fail; ++ err = myvalue_to_str_list(&mylist, &res); ++ if (err > 0) ++ *list = (const char **)res; ++ else if (err == 0) ++ *list = NULL; ++__fail: ++ myvalue_list_free(&mylist); ++ if (err <= 0) ++ return err; ++ qsort(*list, err, sizeof(char *), identifier_cmp); ++ return err; + } + + /** +@@ -1258,8 +1416,7 @@ static int get_value_list(snd_use_case_mgr_t *uc_mgr, + const char **list[], + char *verbname) + { +- struct list_head mylist, *pos, *npos; +- struct myvalue *val; ++ struct list_head mylist, *pos; + struct use_case_verb *verb; + struct use_case_device *dev; + struct use_case_modifier *mod; +@@ -1292,26 +1449,13 @@ static int get_value_list(snd_use_case_mgr_t *uc_mgr, + if (err < 0) + goto __fail; + } +- err = alloc_str_list(&mylist, 1, &res); +- if (err >= 0) { ++ err = myvalue_to_str_list(&mylist, &res); ++ if (err > 0) + *list = (const char **)res; +- list_for_each(pos, &mylist) { +- val = list_entry(pos, struct myvalue, list); +- *res = strdup(val->value); +- if (*res == NULL) { +- snd_use_case_free_list((const char **)res, err); +- err = -ENOMEM; +- goto __fail; +- } +- res++; +- } +- } ++ else if (err == 0) ++ *list = NULL; + __fail: +- list_for_each_safe(pos, npos, &mylist) { +- val = list_entry(pos, struct myvalue, list); +- list_del(&val->list); +- free(val); +- } ++ myvalue_list_free(&mylist); + return err; + } + +@@ -1381,21 +1525,23 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, + } else { + str = NULL; + } +- if (check_identifier(identifier, "_devices")) +- err = get_device_list(uc_mgr, list, str); ++ if (check_identifier(identifier, "_devices")) ++ err = get_device_list(uc_mgr, list, str); + else if (check_identifier(identifier, "_modifiers")) +- err = get_modifier_list(uc_mgr, list, str); +- else if (check_identifier(identifier, "_supporteddevs")) +- err = get_supported_device_list(uc_mgr, list, str); +- else if (check_identifier(identifier, "_conflictingdevs")) +- err = get_conflicting_device_list(uc_mgr, list, str); ++ err = get_modifier_list(uc_mgr, list, str); ++ else if (check_identifier(identifier, "_identifiers")) ++ err = get_identifiers_list(uc_mgr, list, str); ++ else if (check_identifier(identifier, "_supporteddevs")) ++ err = get_supported_device_list(uc_mgr, list, str); ++ else if (check_identifier(identifier, "_conflictingdevs")) ++ err = get_conflicting_device_list(uc_mgr, list, str); + else if (identifier[0] == '_') + err = -ENOENT; +- else +- err = get_value_list(uc_mgr, identifier, list, str); +- if (str) +- free(str); +- } ++ else ++ err = get_value_list(uc_mgr, identifier, list, str); ++ if (str) ++ free(str); ++ } + __end: + pthread_mutex_unlock(&uc_mgr->mutex); + return err; +-- +2.20.1 + + +From 5ee5ef31b5ff3fb7c904054cb9cac7478a727f7c Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Sun, 1 Dec 2019 14:26:40 +0100 +Subject: [PATCH 04/16] namehint: correct the @args check + +BugLink: https://github.com/alsa-project/alsa-plugins/issues/3 +Signed-off-by: Jaroslav Kysela +--- + src/control/namehint.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/src/control/namehint.c b/src/control/namehint.c +index 808df6b5..4927ef97 100644 +--- a/src/control/namehint.c ++++ b/src/control/namehint.c +@@ -348,6 +348,12 @@ static int try_config(snd_config_t *config, + goto __cleanup; + if (snd_config_search(res, "@args", &cfg) >= 0) { + snd_config_for_each(i, next, cfg) { ++ /* skip the argument list */ ++ snd_config_get_id(snd_config_iterator_entry(i), &str); ++ while (*str && *str >= '0' && *str <= '9') str++; ++ if (*str == '\0') ++ continue; ++ /* the argument definition must have the default */ + if (snd_config_search(snd_config_iterator_entry(i), + "default", NULL) < 0) { + err = -EINVAL; +-- +2.20.1 + + +From 6055f8a584296abfc0cec0439ceb708f0eddcc9d Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Sun, 1 Dec 2019 14:30:54 +0100 +Subject: [PATCH 05/16] namehint: improve the previous patch (check the + returned value) + +Signed-off-by: Jaroslav Kysela +--- + src/control/namehint.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/control/namehint.c b/src/control/namehint.c +index 4927ef97..60c48ae3 100644 +--- a/src/control/namehint.c ++++ b/src/control/namehint.c +@@ -349,7 +349,8 @@ static int try_config(snd_config_t *config, + if (snd_config_search(res, "@args", &cfg) >= 0) { + snd_config_for_each(i, next, cfg) { + /* skip the argument list */ +- snd_config_get_id(snd_config_iterator_entry(i), &str); ++ if (snd_config_get_id(snd_config_iterator_entry(i), &str) < 0) ++ continue; + while (*str && *str >= '0' && *str <= '9') str++; + if (*str == '\0') + continue; +-- +2.20.1 + + +From 4dddcf733d56a13f4d042fefa1fb6230c09f1f65 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 2 Dec 2019 11:56:30 +0100 +Subject: [PATCH 06/16] ucm: docs - allow spaces in device names for JackHWMute + +Signed-off-by: Jaroslav Kysela +--- + include/use-case.h | 25 +++++++++++++------------ + 1 file changed, 13 insertions(+), 12 deletions(-) + +diff --git a/include/use-case.h b/include/use-case.h +index 85c58ac0..e1f58027 100644 +--- a/include/use-case.h ++++ b/include/use-case.h +@@ -326,7 +326,7 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, + * - Valid values: "soft" (software attenuation) + * - EDIDFile + * - Path to EDID file for HDMI devices +- * - JackControl, JackDev, JackHWMute ++ * - JackControl, JackDev + * - Jack information for a device. The jack status can be reported via + * a kcontrol and/or via an input device. **JackControl** is the + * kcontrol name of the jack, and **JackDev** is the input device id of +@@ -334,17 +334,18 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, + * JackDev value should be "foo"). UCM configuration files should + * contain both JackControl and JackDev when possible, because + * applications are likely to support only one or the other. +- * +- * If **JackHWMute** is set, it indicates that when the jack is plugged +- * in, the hardware automatically mutes some other device(s). The +- * JackHWMute value is a space-separated list of device names (this +- * isn't compatible with device names with spaces in them, so don't use +- * such device names!). Note that JackHWMute should be used only when +- * the hardware enforces the automatic muting. If the hardware doesn't +- * enforce any muting, it may still be tempting to set JackHWMute to +- * trick upper software layers to e.g. automatically mute speakers when +- * headphones are plugged in, but that's application policy +- * configuration that doesn't belong to UCM configuration files. ++ * - JackHWMute ++ * If this value is set, it indicates that when the jack is plugged ++ * in, the hardware automatically mutes some other device(s). The ++ * value is a space-separated list of device names. If the device ++ * name contains space, it must be enclosed to ' or ", e.g.: ++ * JackHWMute "'Dock Headphone' Headphone" ++ * Note that JackHWMute should be used only when the hardware enforces ++ * the automatic muting. If the hardware doesn't enforce any muting, it ++ * may still be tempting to set JackHWMute to trick upper software layers ++ * to e.g. automatically mute speakers when headphones are plugged in, ++ * but that's application policy configuration that doesn't belong ++ * to UCM configuration files. + * - MinBufferLevel + * - This is used on platform where reported buffer level is not accurate. + * E.g. "512", which holds 512 samples in device buffer. Note: this will +-- +2.20.1 + + +From 2a286ca9a8415571181ce58027686ec332a834e9 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 2 Dec 2019 11:57:18 +0100 +Subject: [PATCH 07/16] use-case: docs - add PlaybackMixerCopy and + CaptureMixerCopy + +Signed-off-by: Jaroslav Kysela +--- + include/use-case.h | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/include/use-case.h b/include/use-case.h +index e1f58027..71fcc949 100644 +--- a/include/use-case.h ++++ b/include/use-case.h +@@ -309,8 +309,14 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, + * - PlaybackMixerElem + * - mixer element playback identifier + * - can be parsed using snd_use_case_parse_selem_id() ++ * - PlaybackMixerCopy ++ * - additional mixer element playback identifier ++ * - can be parsed using snd_use_case_parse_selem_id() ++ * - those elements should copy the volume and switch settings ++ * - element identifiers are separated using the | character + * - PlaybackMasterElem + * - mixer element playback identifier for the master control ++ * - can be parsed using snd_use_case_parse_selem_id() + * - PlaybackMasterType + * - type of the master volume control + * - Valid values: "soft" (software attenuation) +@@ -319,8 +325,14 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, + * - CaptureMixerElem + * - mixer element capture identifier + * - can be parsed using snd_use_case_parse_selem_id() ++ * - CaptureMixerCopy ++ * - additional mixer element capture identifier ++ * - can be parsed using snd_use_case_parse_selem_id() ++ * - those elements should copy the volume and switch settings ++ * - element identifiers are separated using the | character + * - CaptureMasterElem + * - mixer element playback identifier for the master control ++ * - can be parsed using snd_use_case_parse_selem_id() + * - CaptureMasterType + * - type of the master volume control + * - Valid values: "soft" (software attenuation) +-- +2.20.1 + + +From a0fc4447bb7c7f9a850a0a85f3a5a32c1509caf4 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 3 Dec 2019 15:01:04 +0100 +Subject: [PATCH 08/16] ucm: docs - add JackCTL, rearrange JackControl and + JackDev + +Signed-off-by: Jaroslav Kysela +--- + include/use-case.h | 22 ++++++++++++++-------- + 1 file changed, 14 insertions(+), 8 deletions(-) + +diff --git a/include/use-case.h b/include/use-case.h +index 71fcc949..25998cb9 100644 +--- a/include/use-case.h ++++ b/include/use-case.h +@@ -338,14 +338,20 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, + * - Valid values: "soft" (software attenuation) + * - EDIDFile + * - Path to EDID file for HDMI devices +- * - JackControl, JackDev +- * - Jack information for a device. The jack status can be reported via +- * a kcontrol and/or via an input device. **JackControl** is the +- * kcontrol name of the jack, and **JackDev** is the input device id of +- * the jack (if the full input device path is /dev/input/by-id/foo, the +- * JackDev value should be "foo"). UCM configuration files should +- * contain both JackControl and JackDev when possible, because +- * applications are likely to support only one or the other. ++ * - JackCTL ++ * - jack control device name ++ * - JackControl ++ * - jack control identificator ++ * - can be parsed using snd_use_case_parse_ctl_elem_id() ++ * - UCM configuration files should contain both JackControl and JackDev ++ * when possible, because applications are likely to support only one ++ * or the other ++ * - JackDev ++ * - the input device id of the jack (if the full input device path is ++ * /dev/input/by-id/foo, the JackDev value should be "foo") ++ * - UCM configuration files should contain both JackControl and JackDev ++ * when possible, because applications are likely to support only one ++ * or the other + * - JackHWMute + * If this value is set, it indicates that when the jack is plugged + * in, the hardware automatically mutes some other device(s). The +-- +2.20.1 + + +From e59034a0bec257cc7422a1e9436d936be8696a6f Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Tue, 3 Dec 2019 18:27:39 +0100 +Subject: [PATCH 09/16] ucm: Do not fail to parse configs on cards with an + empty CardComponents lists + +Since the UCM profiles for all Bay- and Cherry-Trail SST cards have been +moved over to UCM2, parsing them fails with: + +ALSA lib ucm_subs.c:220:(uc_mgr_get_substituted_value) variable '${CardComponents}' is not defined in this context! + +This completely breaks audio support on all Bay- and Cherry-Trail devices. + +This is caused by these non-SOF ASoC using cards having an empty +CardComponents list. Which in itself is fine, but is rejected by +the ucm_subs.c code. This commit changes the ucm_subs code to accept +an empty string as a valid value for CardComponents restoring audio +functionality on these boards. + +Signed-off-by: Hans de Goede +Signed-off-by: Jaroslav Kysela +--- + src/ucm/ucm_subs.c | 20 ++++++++++++-------- + 1 file changed, 12 insertions(+), 8 deletions(-) + +diff --git a/src/ucm/ucm_subs.c b/src/ucm/ucm_subs.c +index 00afa9e3..90e395f0 100644 +--- a/src/ucm/ucm_subs.c ++++ b/src/ucm/ucm_subs.c +@@ -25,6 +25,7 @@ + */ + + #include "ucm_local.h" ++#include + #include + #include + +@@ -145,10 +146,11 @@ static char *rval_sysfs(snd_use_case_mgr_t *uc_mgr ATTRIBUTE_UNUSED, const char + return strdup(path); + } + +-#define MATCH_VARIABLE(name, id, fcn) \ ++#define MATCH_VARIABLE(name, id, fcn, empty_ok) \ + if (strncmp((name), (id), sizeof(id) - 1) == 0) { \ + rval = fcn(uc_mgr); \ + idsize = sizeof(id) - 1; \ ++ allow_empty = (empty_ok); \ + goto __rval; \ + } + +@@ -189,12 +191,14 @@ int uc_mgr_get_substituted_value(snd_use_case_mgr_t *uc_mgr, + + while (*value) { + if (*value == '$' && *(value+1) == '{') { +- MATCH_VARIABLE(value, "${ConfName}", rval_conf_name); +- MATCH_VARIABLE(value, "${CardId}", rval_card_id); +- MATCH_VARIABLE(value, "${CardDriver}", rval_card_driver); +- MATCH_VARIABLE(value, "${CardName}", rval_card_name); +- MATCH_VARIABLE(value, "${CardLongName}", rval_card_longname); +- MATCH_VARIABLE(value, "${CardComponents}", rval_card_components); ++ bool allow_empty = false; ++ ++ MATCH_VARIABLE(value, "${ConfName}", rval_conf_name, false); ++ MATCH_VARIABLE(value, "${CardId}", rval_card_id, false); ++ MATCH_VARIABLE(value, "${CardDriver}", rval_card_driver, false); ++ MATCH_VARIABLE(value, "${CardName}", rval_card_name, false); ++ MATCH_VARIABLE(value, "${CardLongName}", rval_card_longname, false); ++ MATCH_VARIABLE(value, "${CardComponents}", rval_card_components, true); + MATCH_VARIABLE2(value, "${env:", rval_env); + MATCH_VARIABLE2(value, "${sys:", rval_sysfs); + err = -EINVAL; +@@ -208,7 +212,7 @@ int uc_mgr_get_substituted_value(snd_use_case_mgr_t *uc_mgr, + } + goto __error; + __rval: +- if (rval == NULL || rval[0] == '\0') { ++ if (rval == NULL || (!allow_empty && rval[0] == '\0')) { + free(rval); + strncpy(r, value, idsize); + r[idsize] = '\0'; +-- +2.20.1 + + +From 8e2c70add782f997f7c269ed3f722888e56ff024 Mon Sep 17 00:00:00 2001 +From: Fabrice Fontaine +Date: Tue, 3 Dec 2019 18:56:40 +0100 +Subject: [PATCH 10/16] src/ucm/main.c: fix build without mixer + +Commit 4ce38a5ff466d18039b2606938f866ea3a6c9f3c breaks the build without +mixer on: + + CCLD libasound.la +/home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/8.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: ucm/.libs/libucm.a(main.o): in function `snd_use_case_set': +main.c:(.text+0x185c): undefined reference to `snd_mixer_selem_id_parse' + +Fixes: http://autobuild.buildroot.org/results/4d91c9f82a2a61c50c457a851073b85cc09ea345 + +Signed-off-by: Fabrice Fontaine +Signed-off-by: Jaroslav Kysela +--- + src/ucm/main.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/ucm/main.c b/src/ucm/main.c +index d2078a23..61922f10 100644 +--- a/src/ucm/main.c ++++ b/src/ucm/main.c +@@ -2115,8 +2115,10 @@ int snd_use_case_parse_selem_id(snd_mixer_selem_id_t *dst, + const char *ucm_id, + const char *value) + { ++#ifdef BUILD_MIXER + if (strcmp(ucm_id, "PlaybackMixerId") == 0 || + strcmp(ucm_id, "CaptureMixerId") == 0) + return snd_mixer_selem_id_parse(dst, value); ++#endif + return -EINVAL; + } +-- +2.20.1 + + +From ad8527d81b09c4d0edd054b5b1468ce1c50b23cb Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 4 Dec 2019 09:49:40 +0100 +Subject: [PATCH 11/16] alsa.m4: another try to fix the libatopology detection + +Signed-off-by: Jaroslav Kysela +--- + utils/alsa.m4 | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/utils/alsa.m4 b/utils/alsa.m4 +index 4c457f0d..320e4336 100644 +--- a/utils/alsa.m4 ++++ b/utils/alsa.m4 +@@ -22,6 +22,7 @@ alsa_save_CFLAGS="$CFLAGS" + alsa_save_LDFLAGS="$LDFLAGS" + alsa_save_LIBS="$LIBS" + alsa_found=yes ++alsa_topology_found=no + + dnl + dnl Get the cflags and libraries for alsa +@@ -158,11 +159,17 @@ AC_CHECK_LIB([asound], [snd_ctl_open],, + alsa_found=no] + ) + if test "x$enable_atopology" = "xyes"; then ++alsa_topology_found=yes + AC_CHECK_LIB([atopology], [snd_tplg_new],, + [ifelse([$3], , [AC_MSG_ERROR(No linkable libatopology was found.)]) +- alsa_found=no] ++ alsa_topology_found=no, ++] + ) + fi ++else ++if test "x$enable_atopology" = "xyes"; then ++ alsa_topology_found=yes ++fi + fi + + if test "x$alsa_found" = "xyes" ; then +@@ -183,7 +190,7 @@ fi + + dnl add the alsa topology library; must be at the end + AC_MSG_CHECKING(for ALSA topology LDFLAGS) +-if test "x$enable_atopology" = "xyes"; then ++if test "x$alsa_topology_found" = "xyes"; then + ALSA_TOPOLOGY_LIBS="$ALSA_TOPOLOGY_LIBS -latopology" + fi + AC_MSG_RESULT($ALSA_TOPOLOGY_LIBS) +-- +2.20.1 + + +From 555a5dbdabc5ed3be1ca81865abdb997bc3a6082 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 5 Dec 2019 16:59:05 +0100 +Subject: [PATCH 12/16] ucm: docs - add Mic/DigitalMic and multiple devices + comments + +Signed-off-by: Jaroslav Kysela +--- + include/use-case.h | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/include/use-case.h b/include/use-case.h +index 25998cb9..1736da25 100644 +--- a/include/use-case.h ++++ b/include/use-case.h +@@ -114,10 +114,18 @@ extern "C" { + * + * Physical system devices the render and capture audio. Devices can be OR'ed + * together to support audio on simultaneous devices. ++ * ++ * If multiple devices with the same name exists, the number suffixes should ++ * be added to these names like HDMI1,HDMI2,HDMI3 etc. No number gaps are ++ * allowed. The names with numbers must be continuous. ++ * ++ * The preference of the devices is determined by the priority value. + */ + #define SND_USE_CASE_DEV_NONE "None" /**< None Device */ + #define SND_USE_CASE_DEV_SPEAKER "Speaker" /**< Speaker Device */ + #define SND_USE_CASE_DEV_LINE "Line" /**< Line Device */ ++#define SND_USE_CASE_DEV_MIC "Mic" /**< Integrated Analog Microphone */ ++#define SND_USE_CASE_DEV_DIGITAL_MIC "DigitalMic" /**< Integrated Digital Microphone */ + #define SND_USE_CASE_DEV_HEADPHONES "Headphones" /**< Headphones Device */ + #define SND_USE_CASE_DEV_HEADSET "Headset" /**< Headset Device */ + #define SND_USE_CASE_DEV_HANDSET "Handset" /**< Handset Device */ +-- +2.20.1 + + +From 1ad660ddeecb2a364f1ca62aa60f256f7029cfdc Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 5 Dec 2019 17:01:31 +0100 +Subject: [PATCH 13/16] ucm: docs - remove DigitalMic, it does not have sense + +Signed-off-by: Jaroslav Kysela +--- + include/use-case.h | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/include/use-case.h b/include/use-case.h +index 1736da25..214a2a4c 100644 +--- a/include/use-case.h ++++ b/include/use-case.h +@@ -124,8 +124,7 @@ extern "C" { + #define SND_USE_CASE_DEV_NONE "None" /**< None Device */ + #define SND_USE_CASE_DEV_SPEAKER "Speaker" /**< Speaker Device */ + #define SND_USE_CASE_DEV_LINE "Line" /**< Line Device */ +-#define SND_USE_CASE_DEV_MIC "Mic" /**< Integrated Analog Microphone */ +-#define SND_USE_CASE_DEV_DIGITAL_MIC "DigitalMic" /**< Integrated Digital Microphone */ ++#define SND_USE_CASE_DEV_MIC "Mic" /**< Integrated Microphone */ + #define SND_USE_CASE_DEV_HEADPHONES "Headphones" /**< Headphones Device */ + #define SND_USE_CASE_DEV_HEADSET "Headset" /**< Headset Device */ + #define SND_USE_CASE_DEV_HANDSET "Handset" /**< Handset Device */ +-- +2.20.1 + + +From 5473c5d677915b88d5c93d5bcc6cd16bb6a40342 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 5 Dec 2019 17:19:06 +0100 +Subject: [PATCH 14/16] ucm: docs - change the Mic description to simple + Microphone Device + +Signed-off-by: Jaroslav Kysela +--- + include/use-case.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/use-case.h b/include/use-case.h +index 214a2a4c..b04f7b9d 100644 +--- a/include/use-case.h ++++ b/include/use-case.h +@@ -124,7 +124,7 @@ extern "C" { + #define SND_USE_CASE_DEV_NONE "None" /**< None Device */ + #define SND_USE_CASE_DEV_SPEAKER "Speaker" /**< Speaker Device */ + #define SND_USE_CASE_DEV_LINE "Line" /**< Line Device */ +-#define SND_USE_CASE_DEV_MIC "Mic" /**< Integrated Microphone */ ++#define SND_USE_CASE_DEV_MIC "Mic" /**< Microphone Device */ + #define SND_USE_CASE_DEV_HEADPHONES "Headphones" /**< Headphones Device */ + #define SND_USE_CASE_DEV_HEADSET "Headset" /**< Headset Device */ + #define SND_USE_CASE_DEV_HANDSET "Handset" /**< Handset Device */ +-- +2.20.1 + + +From ca67e823833213e140a09ce43b6399b7676616df Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 6 Dec 2019 11:11:54 +0100 +Subject: [PATCH 15/16] ucm: docs - add note about the sequences and device + split + +Signed-off-by: Jaroslav Kysela +--- + include/use-case.h | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/include/use-case.h b/include/use-case.h +index b04f7b9d..2efcb4d8 100644 +--- a/include/use-case.h ++++ b/include/use-case.h +@@ -119,6 +119,11 @@ extern "C" { + * be added to these names like HDMI1,HDMI2,HDMI3 etc. No number gaps are + * allowed. The names with numbers must be continuous. + * ++ * If EnableSequence/DisableSequence controls independent paths in the hardware ++ * it is also recommended to split playback and capture UCM devices and use ++ * the number suffixes. Example use case: Use the integrated microphone ++ * in the laptop instead the microphone in headphones. ++ * + * The preference of the devices is determined by the priority value. + */ + #define SND_USE_CASE_DEV_NONE "None" /**< None Device */ +-- +2.20.1 + + +From f828dfe549fbab0a920768c63ebd3478272954eb Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 10 Dec 2019 11:48:06 +0100 +Subject: [PATCH 16/16] ucm: docs - remove MixerCopy values, add Priority for + verb, improve priority docs + +Signed-off-by: Jaroslav Kysela +--- + include/use-case.h | 18 ++++++------------ + 1 file changed, 6 insertions(+), 12 deletions(-) + +diff --git a/include/use-case.h b/include/use-case.h +index 2efcb4d8..134303af 100644 +--- a/include/use-case.h ++++ b/include/use-case.h +@@ -274,6 +274,10 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, + * Recommended names for values: + * - TQ + * - Tone Quality ++ * - Priority ++ * - priority value (1-10000), higher value means higher priority ++ * - valid only for verbs ++ * - for devices - PlaybackPriority and CapturePriority + * - PlaybackPCM + * - full PCM playback device name + * - PlaybackPCMIsDummy +@@ -301,7 +305,7 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, + * - playback control switch identifier string + * - can be parsed using snd_use_case_parse_ctl_elem_id() + * - PlaybackPriority +- * - priority value (1-10000), default value is 100, higher value means lower priority ++ * - priority value (1-10000), higher value means higher priority + * - CaptureRate + * - capture device sample rate + * - CaptureChannels +@@ -315,17 +319,12 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, + * - capture control switch identifier string + * - can be parsed using snd_use_case_parse_ctl_elem_id() + * - CapturePriority +- * - priority value (1-10000), default value is 100, higher value means lower priority ++ * - priority value (1-10000), higher value means higher priority + * - PlaybackMixer + * - name of playback mixer + * - PlaybackMixerElem + * - mixer element playback identifier + * - can be parsed using snd_use_case_parse_selem_id() +- * - PlaybackMixerCopy +- * - additional mixer element playback identifier +- * - can be parsed using snd_use_case_parse_selem_id() +- * - those elements should copy the volume and switch settings +- * - element identifiers are separated using the | character + * - PlaybackMasterElem + * - mixer element playback identifier for the master control + * - can be parsed using snd_use_case_parse_selem_id() +@@ -337,11 +336,6 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, + * - CaptureMixerElem + * - mixer element capture identifier + * - can be parsed using snd_use_case_parse_selem_id() +- * - CaptureMixerCopy +- * - additional mixer element capture identifier +- * - can be parsed using snd_use_case_parse_selem_id() +- * - those elements should copy the volume and switch settings +- * - element identifiers are separated using the | character + * - CaptureMasterElem + * - mixer element playback identifier for the master control + * - can be parsed using snd_use_case_parse_selem_id() +-- +2.20.1 + diff --git a/SOURCES/alsa-lib-1.0.14-glibc-open.patch b/SOURCES/alsa-lib-1.0.14-glibc-open.patch new file mode 100644 index 0000000..bc625bd --- /dev/null +++ b/SOURCES/alsa-lib-1.0.14-glibc-open.patch @@ -0,0 +1,11 @@ +--- alsa-lib-1.0.14/aserver/aserver.c 2007-05-31 10:05:13.000000000 +0200 ++++ alsa-lib-1.0.14.lennart/aserver/aserver.c 2007-08-15 15:53:32.000000000 +0200 +@@ -35,6 +35,8 @@ + + #include "aserver.h" + ++#undef open ++ + char *command; + + #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) diff --git a/SOURCES/alsa-lib-1.1.9-config.patch b/SOURCES/alsa-lib-1.1.9-config.patch new file mode 100644 index 0000000..f8c2c59 --- /dev/null +++ b/SOURCES/alsa-lib-1.1.9-config.patch @@ -0,0 +1,44 @@ +diff --git a/src/conf/alsa.conf b/src/conf/alsa.conf +index 09980586..c4525f0b 100644 +--- a/src/conf/alsa.conf ++++ b/src/conf/alsa.conf +@@ -67,8 +67,7 @@ defaults.pcm.nonblock 1 + defaults.pcm.compat 0 + defaults.pcm.minperiodtime 5000 # in us + defaults.pcm.ipc_key 5678293 +-defaults.pcm.ipc_gid audio +-defaults.pcm.ipc_perm 0660 ++defaults.pcm.ipc_perm 0600 + defaults.pcm.dmix.max_periods 0 + defaults.pcm.dmix.channels 2 + defaults.pcm.dmix.rate 48000 +diff --git a/src/conf/pcm/dmix.conf b/src/conf/pcm/dmix.conf +index 7fa5c8b2..97936a82 100644 +--- a/src/conf/pcm/dmix.conf ++++ b/src/conf/pcm/dmix.conf +@@ -48,10 +48,6 @@ pcm.!dmix { + @func refer + name defaults.pcm.ipc_key + } +- ipc_gid { +- @func refer +- name defaults.pcm.ipc_gid +- } + ipc_perm { + @func refer + name defaults.pcm.ipc_perm +diff --git a/src/conf/pcm/dsnoop.conf b/src/conf/pcm/dsnoop.conf +index abbd44f7..528fb6ad 100644 +--- a/src/conf/pcm/dsnoop.conf ++++ b/src/conf/pcm/dsnoop.conf +@@ -41,10 +41,6 @@ pcm.!dsnoop { + @func refer + name defaults.pcm.ipc_key + } +- ipc_gid { +- @func refer +- name defaults.pcm.ipc_gid +- } + ipc_perm { + @func refer + name defaults.pcm.ipc_perm diff --git a/SOURCES/asound.conf b/SOURCES/asound.conf new file mode 100644 index 0000000..da7ab7c --- /dev/null +++ b/SOURCES/asound.conf @@ -0,0 +1,3 @@ +# +# Place your global alsa-lib configuration here... +# diff --git a/SOURCES/modprobe-dist-alsa.conf b/SOURCES/modprobe-dist-alsa.conf new file mode 100644 index 0000000..cf31fa6 --- /dev/null +++ b/SOURCES/modprobe-dist-alsa.conf @@ -0,0 +1,9 @@ +# ALSA Sound Support +# +# We want to ensure that snd-seq is always loaded for those who want to use +# the sequencer interface, but we can't do this automatically through udev +# at the moment...so we have this rule (just for the moment). +# +# Remove the following line if you don't want the sequencer. + +install snd-pcm /sbin/modprobe --ignore-install snd-pcm && /sbin/modprobe snd-seq diff --git a/SOURCES/modprobe-dist-oss.conf b/SOURCES/modprobe-dist-oss.conf new file mode 100644 index 0000000..21f93cc --- /dev/null +++ b/SOURCES/modprobe-dist-oss.conf @@ -0,0 +1,8 @@ +# OSS Sound Support +# This has been disabled in F11 onwards because it can interfere with the +# PulseAudio sound service (a legacy OSS application can prevent PulseAudio +# applications from playing sound by preventing PulseAudio from (re-)opening +# the sound device). To re-enable support, copy this file to +# the /etc/modprobe.d directory. +# +install snd-pcm /sbin/modprobe --ignore-install snd-pcm && /sbin/modprobe snd-pcm-oss && /sbin/modprobe snd-seq-device && /sbin/modprobe snd-seq-oss diff --git a/SOURCES/sof-hda-dsp-HiFi.conf b/SOURCES/sof-hda-dsp-HiFi.conf new file mode 100644 index 0000000..a97b34f --- /dev/null +++ b/SOURCES/sof-hda-dsp-HiFi.conf @@ -0,0 +1,169 @@ +# Use case Configuration for sof-hda-dsp + +SectionVerb { + EnableSequence [ + cset "name='Auto-Mute Mode' 'Disabled'" + cset "name='Master Playback Volume' 100" + cset "name='Speaker Playback Volume' 100" + cset "name='Headphone Playback Volume' 100" + cset "name='Capture Volume' 50" + cset "name='Mic Boost Volume' 100" + cset "name='Dmic0 Capture Volume' 100" + ] +} + +SectionDevice."Headphones1" { + Comment "Headphones" + + EnableSequence [ + cset "name='Headphone Playback Switch' on" + ] + + DisableSequence [ + cset "name='Headphone Playback Switch' off" + ] + + Value { + PlaybackPriority 200 + PlaybackPCM "hw:${CardId},0" + PlaybackMixerElem "Headphone" + PlaybackMixerMaster "Master" + PlaybackVolume "Headphone Playback Volume" + PlaybackSwitch "Headphone Playback Switch" + PlaybackChannels "2" + If.jack { + Condition { + Type ControlExists + Control "iface=CARD,name='Headphone Mic Jack'" + } + True { + JackControl "Headphone Mic Jack" + } + False { + JackControl "Headphone Jack" + } + } + } +} + +SectionDevice."Speaker" { + Comment "Speaker" + + If.seq { + Condition { + Type ControlExists + Control "name='Bass Speaker Playback Switch'" + } + True { + EnableSequence [ + cset "name='Speaker Playback Switch' on" + cset "name='Bass Speaker Playback Switch' on" + ] + + DisableSequence [ + cset "name='Speaker Playback Switch' off" + cset "name='Bass Speaker Playback Switch' off" + ] + } + False { + EnableSequence [ + cset "name='Speaker Playback Switch' on" + ] + + DisableSequence [ + cset "name='Speaker Playback Switch' off" + ] + } + } + + Value { + PlaybackPriority 100 + PlaybackPCM "hw:${CardId},0" + PlaybackMixerElem "Speaker" + PlaybackMasterElem "Master" + PlaybackVolume "Speaker Playback Volume" + PlaybackSwitch "Speaker Playback Switch" + PlaybackChannels "2" + } +} + +If.monomic { + Condition { + Type ControlExists + Control "name='Input Source'" + ControlEnum "Headphone Mic" + } + After.SectionDevice "Mic" + True { + SectionDevice."Headphones2" { + Comment "Headphones Stereo Microphone" + + ConflictingDevice [ + "HeadsetMic" + ] + + EnableSequence [ + cset "name='Input Source' 'Headphone Mic'" + ] + + Value { + CapturePriority 200 + + JackControl "Headphone Mic Jack" + } + } + + SectionDevice."Headset" { + Comment "Headset Mono Microphone" + + EnableSequence [ + cset "name='Input Source' Headset Mic" + ] + + Value { + CapturePriority 300 + + JackControl "Headphone Mic Jack" + } + } + } + False { + SectionDevice."Headphones2" { + Comment "Headphones Stereo Microphone" + + Value { + CapturePriority 200 + + JackControl "Mic Jack" + } + } + } +} + +SectionDevice."Mic" { + Comment "Digital Microphone" + + Value { + CapturePriority 100 + CapturePCM "hw:${CardId},6" + CaptureChannels 4 + If.vol { + Condition { + Type ControlExists + Control "name='Dmic0 Capture Switch'" + } + True { + CaptureMixerElem "Dmic0" + CaptureVolume "Dmic0 Capture Volume" + CaptureSwitch "Dmic0 Capture Switch" + } + False { + # v1.3 SOF firmware + CaptureMixerElem "PGA10.0 10 Master" + CaptureVolume "PGA10.0 10 Master Capture Volume" + } + } + } +} + + diff --git a/SPECS/alsa-lib.spec b/SPECS/alsa-lib.spec new file mode 100644 index 0000000..aada023 --- /dev/null +++ b/SPECS/alsa-lib.spec @@ -0,0 +1,358 @@ +#define prever rc3 +#define prever_dot .rc3 +#define postver a + +%define version_alsa_lib 1.2.1.2 +%define version_alsa_ucm 1.2.1.2 +%define version_alsa_tplg 1.2.1 + +Summary: The Advanced Linux Sound Architecture (ALSA) library +Name: alsa-lib +Version: %{version_alsa_lib} +Release: 2%{?prever_dot}%{?dist} +License: LGPLv2+ +Group: System Environment/Libraries +URL: http://www.alsa-project.org/ + +Source: ftp://ftp.alsa-project.org/pub/lib/%{name}-%{version}%{?prever}%{?postver}.tar.bz2 +Source1: ftp://ftp.alsa-project.org/pub/lib/alsa-ucm-conf-%{version_alsa_ucm}.tar.bz2 +Source2: ftp://ftp.alsa-project.org/pub/lib/alsa-topology-conf-%{version_alsa_tplg}.tar.bz2 +Source10: asound.conf +Source11: modprobe-dist-alsa.conf +Source12: modprobe-dist-oss.conf +Source20: sof-hda-dsp-HiFi.conf +Patch0: alsa-git.patch +Patch1: alsa-lib-1.1.9-config.patch +Patch2: alsa-lib-1.0.14-glibc-open.patch + +BuildRequires: doxygen +BuildRequires: autoconf automake libtool +Requires(post): /sbin/ldconfig, coreutils + +%description +The Advanced Linux Sound Architecture (ALSA) provides audio and MIDI +functionality to the Linux operating system. + +This package includes the ALSA runtime libraries to simplify application +programming and provide higher level functionality as well as support for +the older OSS API, providing binary compatibility for most OSS programs. + +%package devel +Summary: Development files from the ALSA library +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} +Requires: pkgconfig + +%description devel +The Advanced Linux Sound Architecture (ALSA) provides audio and MIDI +functionality to the Linux operating system. + +This package includes the ALSA development libraries for developing +against the ALSA libraries and interfaces. + +%package -n alsa-ucm +Summary: ALSA Use Case Manager configuration +Group: System Environment/Libraries +BuildArch: noarch +License: BSD +Requires: %{name} >= %{version_alsa_ucm} + +%description -n alsa-ucm +The Advanced Linux Sound Architecture (ALSA) Universal Configuration +Manager allows configuration of Audio input/output names and routing + +%package -n alsa-topology +Summary: ALSA Topology configuration +Group: System Environment/Libraries +BuildArch: noarch +License: BSD +Requires: %{name} >= %{version_alsa_tplg} + +%description -n alsa-topology +The Advanced Linux Sound Architecture (ALSA) topology configuration +contains alsa-lib configuration of SoC topology + +%prep +%setup -q -n %{name}-%{version}%{?prever}%{?postver} +%patch0 -p1 -b .alsa-git +%patch1 -p1 -b .config +%patch2 -p1 -b .glibc-open + +%build +autoreconf -vif +%configure --disable-aload --with-plugindir=%{_libdir}/alsa-lib --disable-alisp + +# Remove useless /usr/lib64 rpath on 64bit archs +sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool +sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool + +make %{?_smp_mflags} V=1 +make doc + +%install +%global sysmodprobedir %{_prefix}/lib/modprobe.d + +make DESTDIR=%{buildroot} install + +# We need the library to be available even before /usr might be mounted +mkdir -p %{buildroot}/%{_lib} +mv %{buildroot}%{_libdir}/libasound.so.* %{buildroot}/%{_lib} +ln -snf ../../%{_lib}/libasound.so.2 %{buildroot}%{_libdir}/libasound.so +mv %{buildroot}%{_libdir}/libatopology.so.* %{buildroot}/%{_lib} +ln -snf ../../%{_lib}/libatopology.so.2 %{buildroot}%{_libdir}/libatopology.so + +# Install global configuration files +mkdir -p -m 755 %{buildroot}/etc +install -p -m 644 %{SOURCE10} %{buildroot}/etc + +# Install the modprobe files for ALSA +mkdir -p -m 755 %{buildroot}%{sysmodprobedir} +install -p -m 644 %{SOURCE11} %{buildroot}%{sysmodprobedir}/dist-alsa.conf +# bug#926973, place this file to the doc directory +install -p -m 644 %{SOURCE12} . + +# Create UCM directories +mkdir -p %{buildroot}/%{_datadir}/alsa/ucm +mkdir -p %{buildroot}/%{_datadir}/alsa/ucm2 + +# Unpack UCMs +tar xvjf %{SOURCE1} -C %{buildroot}/%{_datadir}/alsa ucm ucm2 + +# Workaround for old pulseaudio +if [ "%version_alsa_ucm" != "1.2.1.2" ]; then echo "Remove!"; exit 1; fi +cp %{SOURCE20} %{buildroot}/%{_datadir}/alsa/ucm2/sof-hda-dsp/HiFi.conf + +# Create topology directory +mkdir -p %{buildroot}/%{_datadir}/alsa/topology + +# Unpack topologies +tar xvjf %{SOURCE2} -C %{buildroot}/%{_datadir}/alsa topology + +# Remove libtool archives. +find %{buildroot} -name '*.la' -delete + +# Remove /usr/include/asoundlib.h +rm %{buildroot}/%{_includedir}/asoundlib.h + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%files +%{!?_licensedir:%global license %%doc} +%license COPYING +%doc doc/asoundrc.txt modprobe-dist-oss.conf +%config %{_sysconfdir}/asound.conf +/%{_lib}/libasound.so.* +/%{_lib}/libatopology.so.* +%{_bindir}/aserver +#{_libdir}/alsa-lib/ +%{_datadir}/alsa/ +%exclude %{_datadir}/alsa/ucm +%exclude %{_datadir}/alsa/ucm2 +%exclude %{_datadir}/alsa/topology +%{sysmodprobedir}/dist-* + +%files devel +%doc TODO doc/doxygen/ +%{_includedir}/alsa/ +%{_includedir}/sys/asoundlib.h +%{_libdir}/libasound.so +%{_libdir}/libatopology.so +%{_libdir}/pkgconfig/alsa.pc +%{_libdir}/pkgconfig/alsa-topology.pc +%{_datadir}/aclocal/alsa.m4 + +%files -n alsa-ucm +# BSD +%{_datadir}/alsa/ucm +%{_datadir}/alsa/ucm2 + +%files -n alsa-topology +# BSD +%{_datadir}/alsa/topology + +%changelog +* Tue Dec 10 2019 Jaroslav Kysela - 1.2.1.2-2 +- Updated to 1.2.1.2 +- UCM fixes + +* Fri Nov 15 2019 Jaroslav Kysela - 1.2.1-2 +- Updated to 1.2.1 + +* Mon May 27 2019 Jaroslav Kysela - 1.1.9-4 +- Moved topology files to alsa-topology +- Updated to 1.1.9 + +* Fri Jan 25 2019 Jaroslav Kysela - 1.1.6-3 +- Sync with the RHEL 7 +- Add Dell WD15/WD19 Dock to USB-Audio.conf and create UCM configs +- Resolves: rhbz#1664247 + +* Wed Apr 04 2018 Jaroslav Kysela - 1.1.6-2 +- Changed add-on directory to /etc/alsa/conf.d + +* Tue Apr 03 2018 Jaroslav Kysela - 1.1.6-1 +- Updated to 1.1.6 + +* Wed Feb 07 2018 Fedora Release Engineering - 1.1.5-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Tue Nov 14 2017 Jaroslav Kysela - 1.1.5-1 +- Updated to 1.1.5 + +* Wed Aug 02 2017 Fedora Release Engineering - 1.1.4.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Wed Jul 26 2017 Fedora Release Engineering - 1.1.4.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Tue Jun 13 2017 Jaroslav Kysela - 1.1.4.1-1 +- Updated to 1.1.4.1 + +* Fri May 12 2017 Jaroslav Kysela - 1.1.4-1 +- Updated to 1.1.4 + +* Mon Mar 20 2017 Peter Robinson 1.1.3-3 +- Add upstream patch for Raspberry Pi HDMI audio + +* Fri Feb 10 2017 Fedora Release Engineering - 1.1.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Tue Dec 20 2016 Jaroslav Kysela - 1.1.3-1 +- Updated to 1.1.3 + +* Tue Aug 2 2016 Jaroslav Kysela - 1.1.2-1 +- Updated to 1.1.2 + +* Tue Jul 19 2016 Bastien Nocera - 1.1.1-2 +- Add Surface 3 configuration file + +* Thu Mar 31 2016 Jaroslav Kysela - 1.1.1-1 +- Updated to 1.1.1 + +* Wed Feb 03 2016 Fedora Release Engineering - 1.1.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Mon Nov 9 2015 Jaroslav Kysela - 1.1.0-3 +- Replaced source files with the alsa-lib v1.1.0 final + +* Thu Nov 5 2015 Jaroslav Kysela - 1.1.0-2 +- Replaced source files with the alsa-lib v1.1.0 test2 + +* Tue Oct 27 2015 Jaroslav Kysela - 1.1.0-1 +- Updated to 1.1.0 test1 + +* Tue Jun 16 2015 Fedora Release Engineering - 1.0.29-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Thu Feb 26 2015 Jaroslav Kysela - 1.0.29-1 +- Updated to 1.0.29 + +* Sat Feb 21 2015 Till Maas - 1.0.28-4 +- Rebuilt for Fedora 23 Change + https://fedoraproject.org/wiki/Changes/Harden_all_packages_with_position-independent_code + +* Tue Feb 3 2015 Peter Robinson 1.0.28-3 +- Add UCM sub package +- Use %%license + +* Fri Aug 15 2014 Fedora Release Engineering - 1.0.28-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Thu Jul 24 2014 Peter Robinson 1.0.28-1 +- Update to 1.0.28 + +* Sat Jun 07 2014 Fedora Release Engineering - 1.0.27.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Thu Aug 1 2013 Ville Skyttä - 1.0.27.2-2 +- Fix build with unversioned %%{_docdir_fmt}. + +* Mon Jul 08 2013 Jaroslav Kysela - 1.0.27.2-1 +- Updated to 1.0.27.2 + +* Thu May 30 2013 Jaroslav Kysela - 1.0.27.1-2 +- Fixed bug#953352 + +* Tue May 21 2013 Jaroslav Kysela - 1.0.27.1-1 +- Updated to 1.0.27.1 + +* Tue May 07 2013 Rex Dieter 1.0.27-3 +- pull in upstream fix for building in C90 mode + +* Thu Apr 11 2013 Jaroslav Kysela - 1.0.27-2 +- move dist-oss.conf to doc as modprobe-dist-oss.conf + +* Thu Apr 11 2013 Jaroslav Kysela - 1.0.27-1 +- Updated to 1.0.27 + +* Wed Apr 03 2013 Stephen Gallagher - 1.0.26-4 +- Add upstream patch to explicitly include sys/types.h + +* Wed Feb 13 2013 Fedora Release Engineering - 1.0.26-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Mon Dec 3 2012 Peter Robinson 1.0.26-2 +- Create and own ucm directory so alsaucm doesn't crash. +- Cleanup and modernise spec + +* Thu Sep 6 2012 Jaroslav Kysela - 1.0.26-1 +- Updated to 1.0.26 + +* Thu Jul 26 2012 Michael Schwendt - 1.0.25-6 +- Don't package ancient ChangeLog that ends at alsa-lib 0.2.0 (#510212). + +* Wed Jul 18 2012 Fedora Release Engineering - 1.0.25-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Wed May 2 2012 Josh Boyer - 1.0.25-4 +- Install ALSA related module conf files + +* Wed Feb 1 2012 Jaroslav Kysela - 1.0.25-3 +- Remove the pulse audio configuration from /etc/asound.conf + +* Sat Jan 28 2012 Jaroslav Kysela - 1.0.25-1 +- Updated to 1.0.25 final + +* Thu Jan 12 2012 Fedora Release Engineering - 1.0.24-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Mon Feb 07 2011 Fedora Release Engineering - 1.0.24-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Fri Jan 28 2011 Jaroslav Kysela - 1.0.24-1 +- Updated to 1.0.24 final + +* Tue Nov 9 2010 Jochen Schmitt 1.0.23-2 +- Set plugindir to %%{_libdir}/alsa-lib (bz#651507) + +* Fri Apr 16 2010 Jaroslav Kysela - 1.0.23-1 +- Updated to 1.0.23 final + +* Mon Dec 28 2009 Jaroslav Kysela - 1.0.22-1 +- Updated to 1.0.22 final +- Fix file descriptor leak in pcm_hw plugin +- Fix sound distortions for S24_LE - softvol plugin + +* Wed Sep 9 2009 Jaroslav Kysela - 1.0.21-3 +- Add Speaker and Beep control names to mixer weight list +- Fix redhat bug #521988 + +* Wed Sep 2 2009 Jaroslav Kysela - 1.0.21-1 +- Updated to 1.0.21 final + +* Fri Jul 24 2009 Fedora Release Engineering - 1.0.20-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Wed May 6 2009 Jaroslav Kysela - 1.0.20-1 +- Updated to 1.0.20 final + +* Mon Feb 23 2009 Fedora Release Engineering - 1.0.19-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Wed Feb 4 2009 Jaroslav Kysela - 1.0.19-2 +- Make doxygen documentation same for all architectures (bz#465205) + +* Tue Jan 20 2009 Jaroslav Kysela - 1.0.19-1 +- Updated to 1.0.19 final