Remove the call to snd_config_expand_custom() to expand the top-level
input config. And replace it with calls to snd_config_evaluate_string()
for each non-compound config while processing individual objects. This
will allow retreving variable definitions from object attribute values
and global definitions.
Add a new field "current_obj_cfg" to hold the current object config
being pre-processed.
This will facilitate adding simple math expressions for computing
attribute values for objects based on other attributes. For ex: we can
set the expression for buffer size as follows:
buffer_size "$[($in_channels * 48) * 4]"
The buffer_size attribute value will be computed with the attribute
value "in_channels" based on the expression above. So if $in_channels =
2, buffer_size will be evaluated to 384.
Additionally this change also permits computing attribute values based
on previously computed values. For example:
buffer_size "$[($in_channels * 48) * 4]"
dma_buffer_size "$[$buffer_size * 2]"
dma_buffer_size will be computed as 768. Note that the order of
definitions for buffer_size and dma_buffer_size matters because the
evaluation for dma_buffer_size depends on the evaluation of buffer_size.
In order to conform to this, the tplg_object_copy_and_add_param() is
modified to add attribute configs from class config to an object using
snd_config_before() instead of snd_config_add().
With this change, we no longer need to set the auto_attr_updater for
buffer type widget objects. So remove it.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Allow support for adding data section for kcontrols.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Switch source and sink widgets in the DAPM route.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Add the function to compute the value for the
"size" automatic attribute in the buffer objects.
Signed-off-by: Chao Song <chao.song@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This patch adds check to the return pointer from strchr,
because it may be null and cause segment fault, if component
is not properly constructed.
Fixes: https://github.com/alsa-project/alsa-utils/pull/91
Signed-off-by: Chao Song <chao.song@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
DAPM route objects such as:
Object.Base.route."1" {
source "dai.SSP.0.dai.capture"
sink "buffer.2.1"
}
will be converted to:
SectionGraph."Endpoint.route.1" {
index 0
lines [
"dai.SSP.0.capture, , buffer.2.1"
]
}
If the source/sink names are references to objects within a parent pipeline
object, the index attribute value can be skipped and it will be
populated when the object is pre-processed
Object.Pipeline.volume-capture."1" {
Object.Base.route."1" {
source "pga..0"
sink "buffer..0"
}
}
The reference pga..0 will need to be resolved to
get the widget name pga.1.0 and buffer..0 will
be resolved to buffer.1.0 before creating the SectionGraph as follows:
SectionGraph."volume-capture.1.route.1" {
index 2
lines [
"pga.1.0, , buffer.1.0"
]
}
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Add support for pre-processing mixer and byte control objects.
For ex: a pga widget with a mixer control as follows:
Object.pga"0" {
...
mixer.0 {
index 2
max 32
name "2 MasterPlaybackControl"
Object.Base.channel."fl" {
shift 0
}
Object.Base.channel."fr" {
}
Object.Base.tlv."vtlv_m64s2" {
Object.Base.scale."m64s2" {
mute 1
}
}
Object.Base.ops."ctl" {
info "volsw"
#256 binds the mixer control to volume get/put handlers
get 256
put 256
}
access [
read_write
tlv_read
]
}
}
Would be converted to:
SectionControlMixer.'2 Master Playback Volume' {
index 2
max 32
channel {
fl {
reg 1
}
fr {
reg 1
shift 1
}
}
tlv "vtlv_m64s2"
ops.0 {
info volsw
get 256
put 256
}
access [
read_write
tlv_read
]
}
and the SectionWidget for pga.2.0 would be updated to add the mixer references as follows:
SectionWidget.'pga.2.0' {
...
mixer [
"2 Master Playback Volume"
]
}
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Add support for pre-processing scale/ops/channel objects
and adding the converted config to the relevant sections.
For ex:
Object.Base.channel."fl" {
shift 0
reg 1
}
Object.Base.channel."fr" {
reg 1
shift 1
}
Will be converted to:
channel {
fl {
reg 1
shift 0
}
fr {
reg 1
shift 1
}
}
And added to the SectionControlMixer that this object belongs to.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Add support for pre-processing TLV objects
For example:
Object.Base.tlv."vtlv_m64s2" {}
will be converted to:
SectionTLV.'vtlv_m64s2' {}
And the mixer controle section will be updated to add
the reference to the tlv object.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>