Skip to contentSkip to conversation

topology: alsatplg: add double-expansion for global defines

DISCUSSION GitHub pull_request - opened 1 participant 1 message Oct 9 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): alsa-project/alsa-utils/pr/[email protected]

#1 lore raw

alsa-project/alsa-utils pull request #337 was opened from kv2019i:

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.

Request URL : https://github.com/alsa-project/alsa-utils/pull/337
Patch URL : https://github.com/alsa-project/alsa-utils/pull/337.patch
Repository URL: https://github.com/alsa-project/alsa-utils