ucm: implement ValueDefaults.BootCardGroup and define use

We need a boot synchronization for multiple UCM cards where linking
is expected like AMD ACP or Intel AVS drivers. This method is
using a timestamp file which can be created and modified during
the boot process (e.g. from the alsactl tool).

The goal is to return a valid UCM configuration for standard
applications combining multiple ALSA cards into one UCM configuration
and cover the time window when all cards have not been probed yet.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2025-12-01 13:32:10 +01:00
parent 5c4a683bd0
commit 554efca497
5 changed files with 356 additions and 12 deletions

View file

@ -466,6 +466,7 @@ static int evaluate_define_macro(snd_use_case_mgr_t *uc_mgr,
err = snd_config_merge(uc_mgr->macros, d, 0);
if (err < 0)
return err;
return 0;
}
@ -2919,6 +2920,24 @@ static int parse_master_file(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg)
if (err < 0)
return err;
/* parse ValueDefaults first */
err = snd_config_search(cfg, "ValueDefaults", &n);
if (err == 0) {
err = parse_value(uc_mgr, &uc_mgr->value_list, n);
if (err < 0) {
snd_error(UCM, "failed to parse ValueDefaults");
return err;
}
}
err = uc_mgr_check_value(&uc_mgr->value_list, "BootCardGroup");
if (err == 0) {
uc_mgr->card_group = true;
/* if we are in boot, skip the main parsing loop */
if (uc_mgr->in_boot)
return 0;
}
/* parse master config sections */
snd_config_for_each(i, next, cfg) {
@ -2969,13 +2988,8 @@ static int parse_master_file(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg)
continue;
}
/* get the default values */
/* ValueDefaults is now parsed at the top of this function */
if (strcmp(id, "ValueDefaults") == 0) {
err = parse_value(uc_mgr, &uc_mgr->value_list, n);
if (err < 0) {
snd_error(UCM, "failed to parse ValueDefaults");
return err;
}
continue;
}