Commit graph

9 commits

Author SHA1 Message Date
Jaroslav Kysela
1a32420577 alsatplg: use standard include/asoundlib.h instead direct headers
BugLink: https://github.com/alsa-project/alsa-lib/pull/169
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-09-03 08:49:03 +02:00
Jaroslav Kysela
8037d4812e topology: some whitespace fixups
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-25 18:36:46 +02:00
Ranjani Sridharan
e3ad68b185 topology: pre-process-class: add function to convert valid attribute values to integer tuple values
Some attributes have valid values that need to be converted
to integer tuple values before it is appended to the
object's private data:

For ex, the buffer widget object's "caps" attribute has the
following definition:
	DefineAttribute."caps" {
		type	"string"
		# Token reference and type
		token_ref	"sof_tkn_buffer.word"
		constraints {
			value_ref	"sof_tkn_mem"
			valid_values [
				"dai"
				"host"
				"pass"
				"comp"
			]
			tuple_values [
				113
				113
				113
				65
			]
		}
	}

Depending on the user input, the value string values for "caps"
will be converted to the appropriate tuple values.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-25 18:26:51 +02:00
Ranjani Sridharan
963578af1e topology: pre-process-class: add function to look up token_ref for an attribute in class
Some attributes may have the token_ref set which is
used to look up the token value for the tuple data
that is appended to the object's private data.

For example, in the buffer widget object:
	DefineAttribute."size" {
		# Token reference and type
		token_ref	"sof_tkn_buffer.word"
	}

The token_ref must include the reference to the vendor
token object name followed by the type of the tuple.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-25 18:26:51 +02:00
Ranjani Sridharan
d8e9466e59 topology: pre-process-class: function to get attribute type
Add a helper function to get attribute type from the
attribute definition and convert them to SND_CONFIG_TYPE_*
values. When no type if provided for an attribute, type
defaults to integer.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-25 18:26:51 +02:00
Ranjani Sridharan
0b0c16d4a7 topology: pre-process-class: add funcion to get the name of the unique attribute in a class
Every class must have a unique attribute that will be used
to instantiate the object. The value provided for this
attribute must be unique within the same alsaconf node for
objects of the same class. Add a helper function to get the
name of the attribute that must have a unique value in the
object instance.

For example, when instantiating 2 buffer widgets within a pipeline,
they must be given unique instance attribute values as:
Object.Widget.buffer.0{} and Object.Widget.buffer.1{}.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-25 18:26:51 +02:00
Ranjani Sridharan
7bf31094e2 topology: pre-process-class: Add functions to check attribute constraints
Add helper functions to check if an attribute is
mandatory, immutable or unique in the class definition.
ex: for a host widget component, these are defined
as follows:

	attributes {
		#
		# host objects instantiated within the same alsaconf node must have unique
		# direction attribute
		#
		unique	"direction"
		mandatory [
			"type"
			"stream_name"
		]
		immutable [
			"uuid"
		]
	}

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-25 18:26:51 +02:00
Ranjani Sridharan
1422c09afd topology: pre-process-class: Add function to look up attribute definition in class
Add a helper function look up attribute definition in the
"DefineAttribute" config in the class definition.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-25 18:26:51 +02:00
Ranjani Sridharan
c832f48404 topology: pre-process-class: Add helper function to look up class definition
Add a helper function to look up the class definition for
an object. ex: for an object instance, Object.Widget.pga.0{}, the
function returns the config pointing to Class.Widget.pga{} in
the input conf.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-25 18:26:51 +02:00