topology2: add volume support for ipc4

Volume is supported by gain module in ipc4. We need
to set curve_type, curve_duration and init_val for
this module.

Signed-off-by: Rander Wang <rander.wang@intel.com>
This commit is contained in:
Rander Wang 2021-07-27 16:57:05 +08:00 committed by Liam Girdwood
parent 884bfdf125
commit 2ebe36aedd
4 changed files with 299 additions and 0 deletions

View File

@ -31,6 +31,12 @@ Object.Base.VendorToken {
ramp_step_ms 251
}
"sof_tkn_gain" {
curve_type 260
curve_duration 261
init_value 262
}
"sof_tkn_src" {
rate_in 300
rate_out 301
@ -67,6 +73,11 @@ Object.Base.VendorToken {
bclk_delay 506
}
"sof_tkn_mute_led" {
mute_led_use 1300
mute_led_direction 1301
}
"sof_tkn_alh" {
rate 1400
channels 1401

View File

@ -0,0 +1,150 @@
#
# Common pipeline gain (volume)
#
# A generic gain (volume) widget. All attributes defined herein are namespaced
# by alsatplg to "Object.Widget.gain.N.attribute_name"
#
# Usage: this component can be used by declaring int a parent object. i.e.
#
# Object.Widget.gain."N" {
# index 1
# format s24le
# no_pm "true"
# }
#
# Where N is the unique instance number for gain widget in the same alsaconf node.
Class.Widget."gain" {
#
# Pipeline ID for the gain widget object
#
DefineAttribute."index" {}
#
# gain object instance
#
DefineAttribute."instance" {}
#include common component definition
<include/components/widget-common.conf>
#
# gain widget UUID
#
DefineAttribute."uuid" {
type "string"
# Token set reference name and type
token_ref "sof_tkn_comp.uuid"
}
#
# Bespoke attributes for PGA
#
#
# Gain curve type. The values provided will be translated to integer values
# as specified in the tuple_values array.
# For example: "linear" is translated to 0, "log" to 1 etc.
#
DefineAttribute."curve_type" {
type "string"
# Token set reference name
token_ref "sof_tkn_gain.word"
constraints {
!valid_values [
"linear"
"log"
]
!tuple_values [
0
1
]
}
}
#
# Gain curve in milliseconds
#
DefineAttribute."curve_duration" {
# Token set reference name
token_ref "sof_tkn_gain.word"
}
DefineAttribute."init_value" {
# Token set reference name
token_ref "sof_tkn_gain.word"
}
# Attribute categories
attributes {
#
# The PGA widget name would be constructed using the index and instance attributes.
# For ex: "gain.1.1" or "gain.10.2" etc.
#
!constructor [
"index"
"instance"
]
#
# immutable attributes cannot be modified in the object instance
#
!immutable [
"uuid"
"type"
]
#
# deprecated attributes should not be added in the object instance
#
!deprecated [
"preload_count"
]
#
# gain widget objects instantiated within the same alsaconf node must have unique
# instance attribute
#
unique "instance"
}
#
# gain widget mixer controls
#
Object.Control {
# gain mixer control
mixer."1" {
#Channel register and shift for Front Left/Right
Object.Base.channel."fl" {
shift 0
}
Object.Base.channel."fr" {}
Object.Base.ops."ctl" {
info "volsw"
#256 binds the mixer control to volume get/put handlers
get 256
put 256
}
max 66
Object.Base.tlv."vtlv_m64s1" {
Object.Base.scale."m64s1" {
min 1354970
step 1
mute 1
}
}
}
}
# Default attribute values for gain widget
type "pga"
uuid "A8:A9:BC:61:D0:18:18:4A:8E:7B:26:39:21:98:04:B7"
no_pm "true"
period_sink_count 2
period_source_count 2
curve_type "linear"
curve_duration 10
init_value 0x6fffffff
}

View File

@ -0,0 +1,69 @@
#
# CAVS gain (volume) capture pipeline
#
# A simple gain (volume) pipeline. All attributes defined herein are namespaced
# by alsatplg to "Object.Pipeline.gain-capture.N.attribute_name".
#
# Usage: gain-capture pipeline object can be instantiated as:
#
# Object.Pipeline.gain-capture."N" {
# format "s16le"
# period 1000
# time_domain "timer"
# channels 2
# rate 48000
# }
#
# Where N is the unique pipeline ID within the same alsaconf node.
#
Class.Pipeline."gain-capture" {
DefineAttribute."index" {}
<include/pipelines/pipeline-common.conf>
attributes {
!constructor [
"index"
]
!mandatory [
"format"
]
!immutable [
"direction"
]
#
# gain-capture objects instantiated within the same alsaconf node must have
# unique pipeline_id attribute
#
unique "index"
}
Object.Widget {
copier."1" {
copier_type "host"
type "aif_out"
}
gain."1" {
}
pipeline."1" {
priority 0
lp_mode 0
}
}
direction "capture"
time_domain "timer"
channels 2
channels_min 2
channels_max 2
rate 48000
rate_min 48000
rate_max 48000
}

View File

@ -0,0 +1,69 @@
#
# CAVS gain (volume) playback pipeline
#
# A simple gain (volume) pipeline. All attributes defined herein are namespaced
# by alsatplg to "Object.Pipeline.gain-playback.N.attribute_name"
#
# Usage: gain-playback pipeline object can be instantiated as:
#
# Object.Pipeline.gain-playback."N" {
# format "s16le"
# period 1000
# time_domain "timer"
# channels 2
# rate 48000
# }
#
# Where N is the unique pipeline ID within the same alsaconf node.
#
Class.Pipeline."gain-playback" {
DefineAttribute."index" {}
<include/pipelines/pipeline-common.conf>
attributes {
!constructor [
"index"
]
!mandatory [
"format"
]
!immutable [
"direction"
]
#
# gain-playback objects instantiated within the same alsaconf node must have
# unique pipeline_id attribute
#
unique "index"
}
Object.Widget {
copier."1" {
copier_type "host"
type "aif_in"
}
gain."1" {
}
pipeline."1" {
priority 0
lp_mode 0
}
}
direction "playback"
time_domain "timer"
channels 2
channels_min 2
channels_max 2
rate 48000
rate_min 48000
rate_max 48000
}