Skip to content

Commit

Permalink
Tools: Topology2: Add support for ALSA enum control
Browse files Browse the repository at this point in the history
This patch adds to definitions in common.conf a new class "text"
to support the enum control values.

Signed-off-by: Ranjani Sridharan <[email protected]>
Signed-off-by: Seppo Ingalsuo <[email protected]>
  • Loading branch information
singalsu authored and kv2019i committed Oct 26, 2023
1 parent 90fef5a commit d27d068
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tools/topology/topology2/include/controls/common.conf
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,22 @@ Class.Base."tlv" {
unique "instance"
}
}

Class.Base."text" {
DefineAttribute."instance" {}

DefineAttribute."name" {
type "string"
}

attributes {
!constructor [
"name"
]
#
# text objects instantiated within the same alsaconf node must have unique
# instance attribute
#
unique "instance"
}
}
97 changes: 97 additions & 0 deletions tools/topology/topology2/include/controls/enum.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#
# Enum kcontrol class. All attributes defined herein are namespaced
# by alsatplg to "Object.Control.enum.N.attribute_name"
#
# Usage: this component can be used by instantiating it in the parent object. i.e.
#
# Object.Control.enum."N" {
# index 1
# name "Master Playback Enum Control"
# Object.Base.text.1 {
# name "mytext"
# !values [
# "One"
# "Two"
# "Three"
# ]
# }
# Object.Base.channel.1 {
# name "fc"
# shift 0
# reg 0
# }
# Object.Base.ops."ctl" {
# info "enum"
# get "257"
# put "257"
# }
# }
#
# Where N is the unique instance number for the buffer object within the same alsaconf node.
# The enum control object should also include the ops, channels and tlv objects in the object
# instance

<include/controls/common.conf>

Class.Control."enum" {
#
# Pipeline ID for the enum object
#
DefineAttribute."index" {}

#
# Instance of enum object in the same alsaconf node
#
DefineAttribute."instance" {}

#
# Enum name. A enum object is included in the built topology only if it is given a
# name
#
DefineAttribute."name" {
type "string"
}

#
# access control for enum
#
DefineAttribute."access" {
type "compound"
constraints {
!valid_values [
"read_write"
"tlv_read_write"
"read"
"write"
"volatile"
"tlv_read"
"tlv_write"
"tlv_command"
"inactive"
"lock"
"owner"
"tlv_callback"
]
}
}

attributes {
#
# The Enum object name would be constructed using the index and instance arguments.
# For ex: "enum.1.1" or "enum.10.2" etc.
#
!constructor [
"index"
"instance"
]
!mandatory [
name
]
#
# enum control objects instantiated within the same alsaconf node must have unique
# index attribute
#
unique "instance"
}

}

0 comments on commit d27d068

Please sign in to comment.