Commit graph

168 commits

Author SHA1 Message Date
Jaroslav Kysela
f60e0d5fdc ucm: shuffle code in compound_merge()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-06-02 19:11:22 +02:00
Jaroslav Kysela
3feea064dd ucm: substitute arguments in sequences only for syntax 3+
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-27 15:20:03 +02:00
Jaroslav Kysela
82d86df37f ucm: substitute RenameDevice and DeleteDevice lists
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-27 15:13:55 +02:00
Jaroslav Kysela
8d26f25ad3 ucm: substitute Comment in Transition and Device
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-27 15:04:31 +02:00
Jaroslav Kysela
8d90c4746b ucm: substitute verb name and file field
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-27 14:47:08 +02:00
Jaroslav Kysela
df498d89c7 ucm: substitute component sequence string
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-27 14:12:12 +02:00
Jaroslav Kysela
991990cdf2 ucm: substitute device strings in the device lists
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-27 14:04:13 +02:00
Jaroslav Kysela
529154fe7f ucm: substitute device / modifier names, too
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-27 13:53:10 +02:00
Jaroslav Kysela
1b0e77909d ucm: implement the toplevel ucm configuration file parser
There is a big issue to validate all possible configuration paths.
Let create ucm2/ucm.conf file which describe the lookups. It may
be also customized later to follow the kernel-side development.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-27 12:24:46 +02:00
Jaroslav Kysela
61986c02b0 ucm: substitute ${CardNumber}
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-27 11:12:19 +02:00
Jaroslav Kysela
72b35bff02 ucm: substitute ${OpenName}
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-26 16:11:34 +02:00
Jaroslav Kysela
690cdab6b4 ucm: Define/DefineRegex is supported in Syntax 3
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-26 16:11:34 +02:00
Jaroslav Kysela
a53a104f79 ucm: String condition - implement Empty
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-26 16:11:34 +02:00
Jaroslav Kysela
f688817e2c ucm: handle strict: prefix correctly for the UCM card name
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-26 16:11:32 +02:00
Jaroslav Kysela
efe2469ac3 ucm: substitute also value strings
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-26 15:14:15 +02:00
Jaroslav Kysela
bf83baa8fc ucm: allow to specify the toplevel directory using '/' as first character in File path
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-25 19:20:53 +02:00
Jaroslav Kysela
f33e596fa6 ucm: config - change the in-place include evaluation order
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-25 19:20:53 +02:00
Jaroslav Kysela
9c88ead1bb ucm: allow syntax version 3
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-25 19:20:53 +02:00
Jaroslav Kysela
04c77aa7f4 ucm: substitute arguments in sequences
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-25 19:20:53 +02:00
Jaroslav Kysela
63c4b49cff ucm: configuration - add DefineRegex
Syntax:

  DefineRegex.VariableName {
    String "something to match"
    Regex "(me)thi(ng)"
  }

Result:

- configuration variable "VariableName" is equal to "mething"
- configuration variable "VariableName1" is equal to "me"
- configuration variable "VariableName2" is equal to "ng"

Notes:

The "Flags" string in the DefineRegex compound may specify
the compilation flags (e = extended, i = ignore case,
s = no substitutes, n = newline). See 'man 3 regex' for
more details.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-25 19:20:53 +02:00
Jaroslav Kysela
ed4567d1c9 ucm: configuration - allow to define the configuration variables
It may be useful for the library files to use the runtime configuration
variables.

Example:

 Define.Var1 "hw:${CardId},2"
 Value.PlaybackPCM "${var:Var1}"

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-25 19:20:53 +02:00
Jaroslav Kysela
6cc6024ac5 ucm: config - substitute File string to allow variables in include
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-25 19:20:53 +02:00
Jaroslav Kysela
8a36b43e03 ucm: configuration - substitute ${ConfDir} and ${ConfTopDir}
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-25 19:20:53 +02:00
Jaroslav Kysela
3edfebc522 ucm: configuration - implement in-place Include
An example:

	Include {
		File "Inc.conf"
		Before.SectionDevice "Mic"
	}

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-25 19:20:53 +02:00
Jaroslav Kysela
14636be4a8 ucm: rename _once command to _boot command
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-25 19:20:18 +02:00
Jaroslav Kysela
d05bd80593 ucm: rename SectionOnce to BootSequence
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-25 19:07:12 +02:00
Jaroslav Kysela
2d6eff3927 ucm: fix compilation error in set_defaults_user()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-19 10:55:35 +02:00
Jaroslav Kysela
3cab9018cf ucm: fix SectionOnce comment
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-19 08:31:39 +02:00
root
449bf7e191 ucm: initialize mgr->once_list
BugLink: https://github.com/alsa-project/alsa-lib/pull/50

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-16 15:48:35 +02:00
Jaroslav Kysela
0c3776a354 ucm: handle 'set _defaults' command
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-14 18:32:05 +02:00
Jaroslav Kysela
a570634a22 ucm: handle 'set _once' command
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-14 18:25:58 +02:00
Jaroslav Kysela
afb5a9cf61 ucm: execute SectionDefaults lately (when the first verb is set)
We need a way to set the SectionOnce at first before SectionDefaults.
It also does not make sense to run SectionDefaults when the API is
used only to query for values or so.

Execute the SectionDefaults commands only when the first verb
is set (before the verb specific commands).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-14 18:24:39 +02:00
Jaroslav Kysela
e0da1d2a2a ucm: parse SectionOnce section in the master UCM configuration file
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-14 16:04:38 +02:00
Jaroslav Kysela
76c098bf6e ucm: merge the array items from the condition blocks
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-09 21:51:55 +02:00
Jaroslav Kysela
fb48ad9e4f ucm: fix copy-n-paste typo (RemoveDevice list)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-04-06 17:20:24 +02:00
Jaroslav Kysela
c9605484d1 ucm: fix the device remove operation
- allow to remove device only from conflicting lists
- unify the error codes when the device is not found (ENODEV)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-04-06 13:25:46 +02:00
Jaroslav Kysela
6137d263f3 ucm: fix uc_mgr_scan_master_configs()
Skip the lookup, if the top level filename does not exist.

Fixes: https://github.com/alsa-project/alsa-ucm-conf/issues/16

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-03-17 16:21:46 +01:00
Jaroslav Kysela
5bc3d4c4c1 ucm: parser - add error message to verb_dev_list_add()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-02-11 10:38:51 +01:00
Jaroslav Kysela
fdf96312fa ucm: fill missing device entries (conflicting / supported)
It is not necessary to maintain this information in sync in the configuration
files. Fill the missing entries to the complementary devices.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-02-07 16:20:56 +01:00
Jaroslav Kysela
251bc204a1 ucm: implement RenameDevice and RemoveDevice verb management
With the conditionals, it may be useful to define the devices
in the included configuration files. To satisfy the specification
requirements (device naming) those device names might require
to be renamed or deleted wrong references from the conflicting
or supported lists.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-02-07 16:20:49 +01:00
Jaroslav Kysela
71a1367bca ucm: the ucm2/ subdirectory is driver name based
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-02-03 15:24:19 +01:00
Jaroslav Kysela
c5a09b0fea ucm: parser - use correct filename in parser_master_file()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-02-03 14:44:13 +01:00
Jaroslav Kysela
7d3fec6ac6 ucm: parser - cosmetic fixes in the comments
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-01-17 18:23:44 +01:00
Jaroslav Kysela
ebf5213cd6 ucm: remove MAX_FILE definition and use correct PATH_MAX
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-01-15 10:40:39 +01:00
Jaroslav Kysela
fe6425af75 ucm: split conf_file_name and conf_dir_name
With ucm2, the file name might differ from the directory
name. Also, allocate those fields.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-01-15 10:40:35 +01:00
Jaroslav Kysela
b34715004f ucm: fix the configuration directory (longname) for ucm2
The new ucm2 expects that the longname directory is shared with
the driver directory. Fix that for 'Syntax 2'.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-01-15 09:49:56 +01:00
Libin Yang
1744159180 ucm: setup conf_format after getting ALSA_CONFIG_UCM_VAR successfully
Set the conf_format to 1 after getting ALSA_CONFIG_UCM_VAR successfully.
Otherwise, the conf_format is not set in this scenario.

Signed-off-by: Libin Yang <libin.yang@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-11 08:01:47 +01:00
Fabrice Fontaine
8e2c70add7 src/ucm/main.c: fix build without mixer
Commit 4ce38a5ff4 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 <fontaine.fabrice@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-03 20:55:34 +01:00
Hans de Goede
e59034a0be 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 <hdegoede@redhat.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-03 20:37:43 +01:00
Jaroslav Kysela
ebdd2b6cdb ucm: add _identifiers list
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-30 20:31:55 +01:00