mirror of https://github.com/thesofproject/sof.git
topology2: Introduction to Topology2.0
About ----- This 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. This PR introduces the high level concept of reusable "class" like definition for a AIF_IN/AIF_OUT type object 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 type, size, min value, max value, enum_values. 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. Common Topology Arguments ------------------------- Arguments are used to pass essential data needed for instantiating an object particularly needed for the object name. A new keyword "DefineArgument" has been added to define the arguments. The order in which the arguments are defined determines the name for the widget. For example, in the case of the host widget, the name would be constructed as "host.1.playback" where "1" is the pipeline_id argument value and "playback" is the direction argument value. Attribute Inheritance: ---------------------- One of the key features of Topology2.0 is howthe attribute values are propagated from a parent object to a child object. This is accomplished by adding attributes/arguments with the same name for a parent and an object. By doing so, when creating a child object, the value for the common attribute is populated from the parent. If the value is provided in the child object instance, then it overrides the value coming from the parent. ALSA Conf Parser ---------------- All the changes being proposed and discussed here must be 100% compliant with the ALSA conf parser. i.e. no syntax changes or changes to semantics for any existing keyword. It's intended that there will be NO changes to the ALSA conf parser (unless new keywords require this ?) and all topology building changes will be in the alsatplg compiler. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
This commit is contained in:
parent
6515df852e
commit
9ef233de48
|
@ -0,0 +1,15 @@
|
|||
#
|
||||
# Vendor token objects with token values used for adding tuple pairs to an object's private data
|
||||
#
|
||||
|
||||
Object.Base.VendorToken {
|
||||
"sof_tkn_comp" {
|
||||
period_sink_count 400
|
||||
period_source_count 401
|
||||
format 402
|
||||
# Token retired with ABI 3.2, do not use for new capabilities
|
||||
preload_count 403
|
||||
core_id 404
|
||||
uuid 405
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
#
|
||||
# vendortoken class definition component. All attributes defined herein are namespaced
|
||||
# by alsatplg to "Object.Base.VendorTokem.name.token_name"
|
||||
#
|
||||
# Usage: this component can be used by instantiating it in the parent object. i.e.
|
||||
#
|
||||
# Object.Base.VendorToken. "sof_tkn_comp" {
|
||||
# period_sink_count 400
|
||||
# period_source_count 401
|
||||
# # Token retired with ABI 3.2, do not use for new capabilities
|
||||
# preload_count 403
|
||||
# core_id 404
|
||||
# uuid 405
|
||||
# }
|
||||
#
|
||||
|
||||
Class.Base.VendorToken {
|
||||
#
|
||||
# name for the vendortoken object
|
||||
#
|
||||
DefineAttribute."name" {
|
||||
type "string"
|
||||
}
|
||||
|
||||
attributes {
|
||||
#
|
||||
# VendorToken object names are constructed as VendorToken.<name>
|
||||
#
|
||||
!constructor [
|
||||
"name"
|
||||
]
|
||||
|
||||
#
|
||||
# name attribute values for VendorToken objects must be unique in the same alsaconf
|
||||
# node
|
||||
#
|
||||
unique "name"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
# A generic AIF_IN/AIF_OUT widget. All attributes defined herein are namespaced
|
||||
# by alsatplg to "Object.host.direction.attribute_name" in the parent object
|
||||
#
|
||||
# Usage: host widget can be instantiated by declaring in a parent object as:
|
||||
#
|
||||
# For playback:
|
||||
# Object.Widget.host."playback" {
|
||||
# index 3
|
||||
# period_sink_count 2
|
||||
# period_source_count 0
|
||||
# type aif_in
|
||||
# }
|
||||
#
|
||||
# For Capture:
|
||||
# Object.Widget.host."capture" {
|
||||
# index 4
|
||||
# period_sink_count 0
|
||||
# period_source_count 2
|
||||
# type aif_out
|
||||
# }
|
||||
|
||||
#
|
||||
# "host" class belongs to the "Widget" group of classes.
|
||||
#
|
||||
Class.Widget."host" {
|
||||
#
|
||||
# Attributes for host widget
|
||||
#
|
||||
|
||||
#
|
||||
# Pipeline ID that the host widget belongs to
|
||||
#
|
||||
DefineAttribute."index" {}
|
||||
|
||||
#
|
||||
# Host direction
|
||||
#
|
||||
DefineAttribute."direction" {
|
||||
type "string"
|
||||
constraints {
|
||||
!valid_values [
|
||||
"playback"
|
||||
"capture"
|
||||
]
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# Host widget type
|
||||
#
|
||||
DefineAttribute."type" {
|
||||
type "string"
|
||||
constraints {
|
||||
!valid_values [
|
||||
"aif_in"
|
||||
"aif_out"
|
||||
]
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#include common widget attributes
|
||||
<include/components/widget-common.conf>
|
||||
|
||||
DefineAttribute.uuid {
|
||||
type "string"
|
||||
# Token set reference name and type
|
||||
token_ref "sof_tkn_comp.uuid"
|
||||
}
|
||||
|
||||
# Attribute categories
|
||||
attributes {
|
||||
#
|
||||
# host objects instantiated within the same alsaconf node must have unique value for
|
||||
# direction attribute
|
||||
#
|
||||
unique "direction"
|
||||
|
||||
#
|
||||
# The host object name is constructed using the index and direction arguments.
|
||||
# E.g. "host.0.capture" or "host.2.playback" etc
|
||||
#
|
||||
!constructor [
|
||||
"index"
|
||||
"direction"
|
||||
]
|
||||
|
||||
#
|
||||
# mandatory attributes that must be provided when the host class is instantiated
|
||||
#
|
||||
!mandatory [
|
||||
"type"
|
||||
"stream_name"
|
||||
]
|
||||
#
|
||||
# immutable attributes cannot be modified in the object instance
|
||||
#
|
||||
!immutable [
|
||||
"uuid"
|
||||
]
|
||||
#
|
||||
# deprecated attributes should not be added in the object instance
|
||||
#
|
||||
!deprecated [
|
||||
"preload_count"
|
||||
]
|
||||
}
|
||||
|
||||
#
|
||||
# Default attribute values for host
|
||||
#
|
||||
uuid "0c:10:9d:8b:78:6d:8f:41:90:a3:e0:e8:05:d0:85:2b"
|
||||
no_pm "true"
|
||||
period_sink_count 0
|
||||
period_source_count 2
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
#
|
||||
# Common widget attribute definitions
|
||||
#
|
||||
|
||||
#
|
||||
# no_pm - maps to the DAPM widget's reg field
|
||||
# "false" value indicates that there is no direct DAPM for this widget
|
||||
#
|
||||
DefineAttribute."no_pm" {
|
||||
type "string"
|
||||
constraints {
|
||||
!valid_values [
|
||||
"true"
|
||||
"false"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# Widget Type - maps to the widget ID with values of type enum SND_SOC_TPLG_DAPM_*
|
||||
#
|
||||
DefineAttribute."type" {
|
||||
type "string"
|
||||
}
|
||||
|
||||
#
|
||||
# Stream name - maps to the DAPM widget's stream name
|
||||
#
|
||||
DefineAttribute."stream_name" {
|
||||
type "string"
|
||||
}
|
||||
|
||||
#
|
||||
# Event type widget binds to
|
||||
#
|
||||
DefineAttribute.event_type {}
|
||||
|
||||
#
|
||||
# Widget event flags
|
||||
#
|
||||
DefineAttribute.event_flags {}
|
||||
|
||||
#
|
||||
# Attributes with a "token_ref" value will be added to widget's private data
|
||||
#
|
||||
|
||||
# number of sink periods
|
||||
DefineAttribute."period_sink_count" {
|
||||
# Token set reference name and type
|
||||
token_ref "sof_tkn_comp.word"
|
||||
}
|
||||
|
||||
# number of source periods
|
||||
DefineAttribute."period_source_count" {
|
||||
# Token set reference name and type
|
||||
token_ref "sof_tkn_comp.word"
|
||||
}
|
||||
|
||||
# widget format
|
||||
DefineAttribute."format" {
|
||||
type "string"
|
||||
# Token set reference name and type
|
||||
token_ref "sof_tkn_comp.string"
|
||||
constraints {
|
||||
!valid_values [
|
||||
"s16le"
|
||||
"s24le"
|
||||
"s32le"
|
||||
"float"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
# ID of the core this widget should be scheduled on
|
||||
DefineAttribute."core_id" {
|
||||
# Token set reference name and type
|
||||
token_ref "sof_tkn_comp.word"
|
||||
}
|
||||
|
||||
# number of periods to preload
|
||||
DefineAttribute."preload_count" {
|
||||
# Token set reference name and type
|
||||
token_ref "sof_tkn_comp.word"
|
||||
}
|
Loading…
Reference in New Issue