The return value from abs() for the most negative integer is
undefined. Cap it properly for the 32bit sample handling.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The handling of 16bit samples in the peak calculations has a bug when
a sample with 0x8000 is passed. As abs() treats 32bit int, it returns
0x8000. And yet the code stores back into 16bit value again.
To fix that overflow, use 32bit value (i.e. val instead of sval) for
the further calculations.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
In Linux 5.14, a new feedback mechanism for USB Audio
Gadget is introduced (commit e89bb428), along with a
new control element "Capture Pitch 1000000". This patch
adds support for this feature. Note that this property
seems to be the reverse of PCM Rate Shift, so we have
to take reciprocal of pitch.
Signed-off-by: Yunhao Tian <t123yh@outlook.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Added sections FILES and CONFIGURATION.
Removed section BUGS, because the described terminal issues have been fixed.
Signed-off-by: braph <braph93@gmx.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
An object can be declared within a class definition as follows:
Class.Pipeline.volume-playback {
Object.Widget.pga.0 {
ramp_step_ms 250
}
}
While instantiating the volume-pipeline class, the pga object
could be modified as follows:
Object.Pipeline.volume-playback.0 {
Object.Widget.pga.0 {
format "s24le"
}
}
When building the pga.0 object in the class definition, merge
the attributes declared in the volume-playback.0 object to create
a new config as follows to make sure that all attributes are
set for the pga object.
Object.Widget.pga.0 {
ramp_step_ms 250
format "s24le"
}
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Do not create TLV config if it exists already. Just
set the string value with the name name.
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>
Fix typo in config variable name. Should be n2 instead of n.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Skip creating section when it exists already.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Nothing to do for top-level objects with no parent.
Also, add access to the bytes control template.
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>
Some objects just need tobe processed to add their attributes
to the private data section of their parent objects.
An example of this would be the pdm_config objects for
DMIC DAI's. Each pdm_config object's attributes need
to be added as separate arrays in the DAI object's
private data.
Modify the signature of tplg_add_object_data() to pass
the array_name parameter when multiple objects of the
same type in the same parent are processed.
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>
Classes definitions in Topology2.0 can have attributes
qualified with the "automatic" constraint. Values for
these attributes will be calculated by the compiler.
This patch provides a generic method for defining automatic
attributes computation logic for different classes.
To update automatic attributes for a class, add an item
in object_build_map with auto_attr_updater defined, and then
add updating logic in the custom auto_attr_updater function.
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>
When we reverted 0c5948e ("aplay: try to use 16-bit format to
increase capture quality"), we should also handle the original
problem somehow. This code shows a warning with a hint to
the right parameter.
Fixes: https://github.com/alsa-project/alsa-utils/issues/96
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This option allows to run multiple instances of aseqnet without having
to double check the assigned port number, since each one can get spawned
with a unique name.
Fixes: https://github.com/alsa-project/alsa-utils/pull/95
Signed-off-by: Andrea Piras <andrea.piras.85@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Fixes:
| ../../alsa-utils-1.2.5/alsactl/utils.c: In function 'snd_card_clean_cfgdir':
| ../../alsa-utils-1.2.5/alsactl/utils.c:309:19: error: 'PATH_MAX' undeclared (first use in this function)
| 309 | char path[PATH_MAX];
| | ^~~~~~~~
| ../../alsa-utils-1.2.5/alsactl/utils.c:309:19: note: each undeclared identifier is reported only once for each function it appears in
Fixes: https://github.com/alsa-project/alsa-utils/pull/92
Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
If load_configuration fails with open_failed == true, load_state will
jump to the out label without config being initialized and pass this
uninitialized config value to snd_config_delete. This commit fixes this
issue by initializing config with NULL and checking if it is non-null
before invoking snd_config_delete.
Fixes: https://github.com/alsa-project/alsa-utils/pull/94
Fixes: f138117 ("alsactl: load_state() - initialize config variable for the open_failed case")
BugLink: https://github.com/alsa-project/alsa-utils/issues/93
Signed-off-by: Sören Tempel <soeren+git@soeren-tempel.net>
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>
There may be nested iterations for hw: card names.
Handle this card name in snd_card_iterator_sinit().
BugLink: https://github.com/alsa-project/alsa-lib/issues/142
Fixes: eefc2c6 ("alsactl: use card iterator functions for all card loops")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Add support for processing object instances embedded
within objects and classes. For example:
Object.Control.mixer."0" {
#Channel register and shift for Front Left/Right
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
}
}
and pga class embeds the mixer objects as follows:
Class.Widget."pga" {
...
Object.Control {
mixer."0" {...}
mixer."1" {...}
}
The pre-processor starts with the top-pevel PGA widget object
and processes the mixer objects in the class definition.
This will recursively pre-processes its child objects to add the channels,
tlv and ops.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Add support for fe_dai objects:
For ex:
Object.PCM.pcm."0" {
name "Port0"
direction "duplex"
Object.Base.fe_dai."Port 0" {}
}
will be converted to update the SectionPCM as follows:
SectionPCM {
Port0 {
id 0
dai {
'Port 0' {
id 0
}
}
}
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Add support for pre-processing PCM and BE DAI objects:
Object.PCM.pcm."0" {
name "Port0"
direction "duplex"
}
will be converted to:
SectionPCM.'Port0' {}
The capabilities and dai configs will be added those objects are pre-processed.
An ex of DAI object would be:
Object.Dai.SSP."0" {
direction "duplex"
stream_name "NoCodec-0"
id 0
default_hw_conf_id 0
format "s24le"
quirks "lbm_mode"
sample_bits 24
}
converted to:
SectionBE {
'SSP.0.duplex' {
id 0
stream_name NoCodec-0
default_hw_conf_id 0
data [
'SSP.0.duplex.sof_tkn_intel_ssp.word'
'SSP.0.duplex.sof_tkn_dai.word'
'SSP.0.duplex.sof_tkn_dai.string'
'SSP.0.duplex.sof_tkn_intel_ssp.short'
]
}
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@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>
Add support for pre-processing DAPM widget opbects.
For ex:
Object.Widget.pga."0" {
pipeline_id 1
no_pm true
type pga
}
will be converted to:
SectionWidget.'pga.0' {
index 1
type pga
no_pm 1
}
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Add support for pre-processing VendorToken objects.
For ex:
Object.Base.VendorToken."sof_tkn_dai" {
dmac_config 153
dai_type 154
index 155
direction 156
}
would be converted to:
SectionVendorTokens."sof_tkn_dai" {
dmac_config 153
dai_type 154
index 155
direction 156
}
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>