Commit graph

23 commits

Author SHA1 Message Date
Jaroslav Kysela
84173ff9e3 topology: don't allow to mix verbose level and output to stdout
Fixes: https://github.com/alsa-project/alsa-utils/issues/131
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-01-27 13:04:01 +01:00
Jaroslav Kysela
8e71fba810 topology: fix the file permissions for the generated files
The owner r/w file permissions are too restrictive.
Let umask do it's work and set the r/w permissions to any.

Fixes: https://github.com/alsa-project/alsa-utils/issues/126
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-12-12 19:58:54 +01:00
Jaroslav Kysela
c8c348e28a topology: define -I option only for alsa-lib 1.2.6+
Link: https://github.com/alsa-project/alsa-utils/pull/125
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-12-08 09:56:38 +01:00
Ranjani Sridharan
79f8ae46b6 topology: Add option to pass include path for conditional includes
The include path passed with -I option will override the relative
include path based on the source file.

Fixes: https://github.com/alsa-project/alsa-utils/pull/125
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-12-08 09:56:25 +01:00
Jaroslav Kysela
7692cfa0c5 topology: fix the include path parsing
When the last '/' is not found use '.' as the source path.

Fixes: https://github.com/alsa-project/alsa-utils/issues/123
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-12-07 09:39:28 +01:00
Jaroslav Kysela
15a5a16eb7 topology: fix compilation for older alsa-lib
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-12-06 11:00:02 +01:00
Jaroslav Kysela
66693b1a77 topology: change include path
Add support for relative (based on the path from the parsed
configuration file) and absolute include path without
ALSA_CONFIG_DIR environment variable usage. The dependency
on the alsa-lib config tree may be added on demand.

Link: https://github.com/alsa-project/alsa-utils/pull/117
Link: https://github.com/alsa-project/alsa-utils/issues/118
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-12-06 10:21:41 +01:00
Ranjani Sridharan
da8f90c424 topology: Add option to pass pre-processor definitions
Add a -D switch to be able to pass pre-processor definitions that will
be used to expand arguments in the input config file. This will be
useful to generate multiple topology binaries from the same input config
file with different argument values.

For example: if we had a pipeline config as follows:

Object.Pipeline {
	volume-playback.1 {
		dynamic_pipeline $DYNAMIC_PIPELINE
	}
}

We can define the variable for DYNAMIC_PIPELINE as:

Define {
	DYNAMIC_PIPELINE 0
}

And when pre-processing the conf file pass "-D DYNAMIC_PIPELINE=1" to
override the default value for dynamic_pipeline attribute in the input
conf file.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-12-06 09:19:20 +01:00
Ranjani Sridharan
a82058e6ec topology: Add support for pre-processing Topology2.0 syntax
This patch adds support for pre-processing the Topology2.0.
The '-p' switch add pre-processing support during compilation
and the '-P' switch is for converting the Topology2.0
configuration file into the existing syntax.

Topology2.0 is a high level keyword extension on top of the existing ALSA
conf topology format designed to:

1) Simplify the ALSA conf topology definitions by providing high level
   "classes" so topology designers need to write less config for common
   object definitions.

2) Allow simple reuse of objects. Define once and reuse (like M4) with
   the ability to alter objects configuration attributes from defaults.

3) Allow data type and value verification. This is not done today and
   frequently crops up in FW bug reports.

Common Topology Classes
-----------------------

Topology today has some common classes that are often reused throughout
with slightly altered configurations. i.e. widgets (components),
pipelines, dais and controls.

Topology2.0 introduces the high level concept of reusable "class" like
definition for that can be used to create topology objects.

Common Topology Attributes
--------------------------
Topology defines a lot of attributes per object with different types
and constraints. Today there is no easy way to validate type or
constraints and this can lead to many hard to find problems in FW at
runtime.

A new keyword "DefineAttribute" has been added to define attribute
constraints such as min value, max value, enum_values etc. This
then allows alsatplg to validate each topology object attribute.

Topology Classes define the list of attributes that they use and
whether the attribute is mandatory, can be overridden by parent users
or is immutable. This also helps alsatplg emit the appropriate errors
for attribute misuse.

Class constructor attributes
----------------------------
Some attributes in the class definition are declared as constructor
attributes and these will be used to construct the name of the object.
For ex: for the host widget, the index and direction are constructor
attributes and the name for the widget is derived as follows:
host.1.playback or host.2.capture etc.

Attribute Inheritance:
----------------------
One of the key features of Topology2.0 is how the attribute values are
propagated from a parent object to a child object. For ex: a pipeline
object can pass down the pipeline_id attribute to all its widgets.
Inheritance is implicit when an object and its embedded child objects
have matching names for a attribute/argument. Attribute values
set explicitly in an object instance always has precedence over
the values inherited from the parent object.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>

1

1

1

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-25 18:26:51 +02:00
Jaroslav Kysela
88513212c5 topology: fix possible double free in load()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-08 18:33:28 +01:00
Jaroslav Kysela
1dd37fddd8 topology: check for the remove() error (coverity)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-06-09 10:31:50 +02:00
Jaroslav Kysela
9ffc427802 topology: fix the error path in load()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-06-09 10:29:30 +02:00
Jaroslav Kysela
56e1b879d4 alsatplg: add documentation for -z,--dapm-nosort (-h)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-02-09 20:52:30 +01:00
Jaroslav Kysela
786c3ee814 alsatplg: add decode command
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-02-09 20:52:30 +01:00
Jaroslav Kysela
32e7016fd7 alsatplg: add -V,--version option
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-02-09 20:52:30 +01:00
Jaroslav Kysela
cbabe7a3f0 alsatplg: rewrite to use the new libatopology functions
Add '-u,--dump' operation.
Add '-g,--group' and '-x,--nocheck' modifiers.
Add '-z,--dapm-nosort' modifier.
Allow to operate with stdin/stdout for the file input/output.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-02-09 20:52:30 +01:00
Jaroslav Kysela
10db898d9b alsatplg: fix another small leak in normalize_config()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-13 10:44:36 +01:00
Jaroslav Kysela
2656d4bec8 alsatplg: add -s,--sort and fix memory leaks
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-12 19:18:28 +01:00
Jaroslav Kysela
08d2341a17 alsatplg: add -n,--normalize option
This function loads and parses the topology file and
saves back the structured output in the alsa-lib's format
without comments.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-12 19:01:58 +01:00
Thomas Petazzoni
2dec9bca1e topology/topology.c: drop unneeded <dlfcn.h> include
This include is not used/needed and prevents building on systems that
don't provide <dlfcn.h>.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-11-02 15:04:34 +01:00
Liam Girdwood
1e96c5f50e alsatplg: fix topology compiler long option parsing
verbose, compile and output options all have a parameter.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-06-14 13:57:21 +02:00
Liam Girdwood
1a0571bd78 topology: delete output file if parsing fails.
Currently the binary output file is left when parsing fails. This confuses
GNU Make if the parsing fails and causes the compilation to partially
complete.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-06-10 11:34:53 +02:00
Liam Girdwood
665d980aa5 topology: Add command line topology tool to build topology binaries
Add a command line tool that will parse topology text files and convert to the binary
topology data as used by the kernel.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-04 17:45:07 +02:00