]> git.alsa-project.org Git - alsa-utils.git/commit
topology: alsatplg: add double-expansion for global defines
authorKai Vehmanen <kai.vehmanen@linux.intel.com>
Mon, 5 Oct 2026 16:29:39 +0000 (19:29 +0300)
committerJaroslav Kysela <perex@perex.cz>
Fri, 4 Dec 2026 17:38:29 +0000 (18:38 +0100)
commite531308d80503e980ed96e96ba8415cf35de8614
treea2f373ace72673342a61534d1c40166831d58b48
parent079e8817e5f74b0b6002c396ce63f9f2b794ab19
topology: alsatplg: add double-expansion for global defines

Add support for following definition for global variables:

  IncludeByKey.SDW_DMIC_PCM_CHANNELS {
    "1" { Define { SDW_DMIC_CHANNEL_CFG $CHANNEL_CONFIG_MONO } }
  }

This doesn't currently work as the pre-processor merges the nested
Define into the global define registry as a STRING value
("$CHANNEL_CONFIG_MONO").  Later, during object attribute expansion,
pre_process_object_variables_expand_fcn finds the variable in the global
defines and returns immediately with that unresolved string.  The caller
then passes "$CHANNEL_CONFIG_MONO" to the token encoder, which cannot
parse it as an integer and silently substitutes 0.

Add support for double expansion for such global defines. This is
similar to how local variables are already handled (see commit
0029ab7cc7c7 ("topology: Expand attribute references inside $[]
expressions")), and will help to reduce repeated IncludeByKey statements
in topology files.

Closes: https://github.com/alsa-project/alsa-utils/pull/337
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
topology/pre-process-object.c