OSDN Git Service

android-x86/external-alsa-lib.git
3 years agoconf: add snd_config_merge() function
Jaroslav Kysela [Fri, 9 Apr 2021 16:11:57 +0000 (18:11 +0200)]
conf: add snd_config_merge() function

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoucm: add ${ConfLibDir} substitution
Jaroslav Kysela [Thu, 8 Apr 2021 10:48:38 +0000 (12:48 +0200)]
ucm: add ${ConfLibDir} substitution

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoconf: add /var/lib/alsa/conf.d directory lookup
Jaroslav Kysela [Thu, 8 Apr 2021 10:31:47 +0000 (12:31 +0200)]
conf: add /var/lib/alsa/conf.d directory lookup

It may be handy to put the configurations or symlinks
to the global runtime directory.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoconf: add /var/lib/alsa/card<NUMBER>.conf.d directory lookups
Jaroslav Kysela [Tue, 6 Apr 2021 19:05:31 +0000 (21:05 +0200)]
conf: add /var/lib/alsa/card<NUMBER>.conf.d directory lookups

It may be handy to put extra configurations or symlinks to
the global runtime directory. The configurations may be
created at boot / hotplug event by udev or other scripts.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoconf: extend hook load_for_all_cards
Jaroslav Kysela [Tue, 6 Apr 2021 18:00:36 +0000 (20:00 +0200)]
conf: extend hook load_for_all_cards

Pass also card integer number.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoinclude: add SND_LIB_VER() macro
Jaroslav Kysela [Tue, 6 Apr 2021 16:32:57 +0000 (18:32 +0200)]
include: add SND_LIB_VER() macro

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoconf: make ctl.default and sysdefault devices more universal
Jaroslav Kysela [Tue, 6 Apr 2021 16:19:48 +0000 (18:19 +0200)]
conf: make ctl.default and sysdefault devices more universal

It may be handy to add hw specific configs.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agocontrol: add empty plugin
Jaroslav Kysela [Tue, 6 Apr 2021 18:34:18 +0000 (20:34 +0200)]
control: add empty plugin

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agocontrol: remap plugin - add docs
Jaroslav Kysela [Tue, 6 Apr 2021 10:57:54 +0000 (12:57 +0200)]
control: remap plugin - add docs

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agocontrol: doc - create controls plugin page
Jaroslav Kysela [Tue, 6 Apr 2021 10:18:23 +0000 (12:18 +0200)]
control: doc - create controls plugin page

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agocontrol: remap plugin - initial version
Jaroslav Kysela [Mon, 29 Mar 2021 10:36:21 +0000 (12:36 +0200)]
control: remap plugin - initial version

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agocontrol: add _snd_ctl_open_child()
Jaroslav Kysela [Mon, 29 Mar 2021 10:19:21 +0000 (12:19 +0200)]
control: add _snd_ctl_open_child()

To support internal plugins, add internal _snd_ctl_open_child()
function like _snd_pcm_open_slave().

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agopcm: empty plugin - fix the docs
Jaroslav Kysela [Tue, 6 Apr 2021 18:03:40 +0000 (20:03 +0200)]
pcm: empty plugin - fix the docs

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agocontrol: shm - add missing continue to _snd_ctl_shm_open()
Jaroslav Kysela [Mon, 29 Mar 2021 09:41:26 +0000 (11:41 +0200)]
control: shm - add missing continue to _snd_ctl_shm_open()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoucm: add ctl-remove sequence command to delete controls from UCM
Jaroslav Kysela [Mon, 29 Mar 2021 09:12:28 +0000 (11:12 +0200)]
ucm: add ctl-remove sequence command to delete controls from UCM

Syntax:

   ctl-remove "name='ABCD'"

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoucm: add cset-new sequence command to create new controls from UCM
Jaroslav Kysela [Thu, 25 Mar 2021 19:36:54 +0000 (20:36 +0100)]
ucm: add cset-new sequence command to create new controls from UCM

This command create a new control using ID, description and value.

Syntax:

    cset-new "name='ABCD',index=2 type=boolean,count=2 on,on"
    cset-new "name='Enum' type=enum,labels='L1;L2;L3' 'L2'"

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoucm: move __snd_ctl_ascii_elem_id_parse prototype to control_local.h
Jaroslav Kysela [Thu, 25 Mar 2021 19:40:22 +0000 (20:40 +0100)]
ucm: move __snd_ctl_ascii_elem_id_parse prototype to control_local.h

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agocontrol: add __snd_ctl_add_elem_set() helper
Jaroslav Kysela [Thu, 25 Mar 2021 19:27:44 +0000 (20:27 +0100)]
control: add __snd_ctl_add_elem_set() helper

It simplifies the add_elem_set functions and we need it for UCM.
It's an internal function.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agocontrol: add snd_ctl_elem_id_compare_numid() function
Jaroslav Kysela [Tue, 23 Mar 2021 16:43:30 +0000 (17:43 +0100)]
control: add snd_ctl_elem_id_compare_numid() function

Idea for the function prototype by Takashi Sakamoto.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agocontrol: rename snd_ctl_elem_id_compare() to snd_ctl_elem_id_compare_set()
Jaroslav Kysela [Tue, 23 Mar 2021 16:30:25 +0000 (17:30 +0100)]
control: rename snd_ctl_elem_id_compare() to snd_ctl_elem_id_compare_set()

- add asserts to check if the unsigned integers are in the valid range
- replace tuple with set in the id description
- add const prefix for id1

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoucm: add Path condition type
Jaroslav Kysela [Tue, 23 Mar 2021 15:53:03 +0000 (16:53 +0100)]
ucm: add Path condition type

Check for a file presence and mode.

Modes: exists, read, write, exec

Example:

If.0 {
Condition {
Type Path
Mode read
Path "/etc/alsa/something"
True {
...
}
}
}

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoucm: rename sysset to sysw
Jaroslav Kysela [Tue, 23 Mar 2021 10:40:30 +0000 (11:40 +0100)]
ucm: rename sysset to sysw

Fixes: 1c6fb202 ("ucm: implement sysset sequence command")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoconf: Fix invalid free at parse_args()
Takashi Iwai [Thu, 18 Mar 2021 16:43:58 +0000 (17:43 +0100)]
conf: Fix invalid free at parse_args()

The previous fix for memory leaks introduced a few regression.
The major one is the assert hit in the error path reaching with NULL
or uninitialized sub object.  Also, in other code paths, it's possible
that an already released sub object gets freed again.

Fix those bugs by initializing the sub object properly and add a NULL
check before calling snd_config_delete().

Fixes: ad5f255b4767 ("conf: fix memory leak on the error path in parse_args()")
Reported-and-tested-by: Mark Hills <mark@xwax.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agocontrol: fix the subdevice fields comparison in snd_ctl_elem_id_compare()
Jaroslav Kysela [Thu, 18 Mar 2021 11:33:10 +0000 (12:33 +0100)]
control: fix the subdevice fields comparison in snd_ctl_elem_id_compare()

3 years agoconf: fix memory leak on the error path in parse_args()
Jaroslav Kysela [Wed, 10 Mar 2021 17:10:57 +0000 (18:10 +0100)]
conf: fix memory leak on the error path in parse_args()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoucm: warn about unknown sequence commands
Jaroslav Kysela [Tue, 9 Mar 2021 19:02:57 +0000 (20:02 +0100)]
ucm: warn about unknown sequence commands

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoucm: implement sysset sequence command
Jaroslav Kysela [Fri, 5 Mar 2021 18:55:06 +0000 (19:55 +0100)]
ucm: implement sysset sequence command

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoucm: ucm_main.c - cosmetic tab cleanups
Jaroslav Kysela [Fri, 5 Mar 2021 18:35:03 +0000 (19:35 +0100)]
ucm: ucm_main.c - cosmetic tab cleanups

This file is problematic for the git's tab checker.
The unexpand tool is used to convert initial spaces
to tabs.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoucm: add _fboot / FixedBootSequence
Jaroslav Kysela [Fri, 5 Mar 2021 17:50:02 +0000 (18:50 +0100)]
ucm: add _fboot / FixedBootSequence

Actually, the BootSequence is executed only when the driver controls
(identifiers or value types) are changed. It may be handy to have
also a sequence which is executed at _each_ boot without any condition.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agocontrol: better docs for snd_ctl_elem_id_compare()
Jaroslav Kysela [Mon, 8 Mar 2021 14:24:31 +0000 (15:24 +0100)]
control: better docs for snd_ctl_elem_id_compare()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoconf: snd_config_save() - print arrays as [] not the internal representation
Jaroslav Kysela [Sun, 7 Mar 2021 19:58:45 +0000 (20:58 +0100)]
conf: snd_config_save() - print arrays as [] not the internal representation

The internal represention of an array is:

{
0 value1
1 value2
2 value2
...
}

which is identicatal to shorter:

[
value1
value2
value3
]

Always print the short format. It's more optimized and readable.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoconf: improve the tabulator level prints
Jaroslav Kysela [Sun, 7 Mar 2021 19:47:21 +0000 (20:47 +0100)]
conf: improve the tabulator level prints

Do not use per char loop, but compose a string.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agomixer: simple - use for loop in base_len()
Jaroslav Kysela [Fri, 5 Mar 2021 20:11:41 +0000 (21:11 +0100)]
mixer: simple - use for loop in base_len()

... reduce the code a bit

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agomixer: simple - Unify simple_none: base_len() exception handling
Hans de Goede [Sun, 28 Feb 2021 16:13:02 +0000 (17:13 +0100)]
mixer: simple - Unify simple_none: base_len() exception handling

Unify simple_none: base_len() exception handling:

1. In the "Input Source" and "3D Control" cases the base-name is the same
   as the full-name and base_len() simply returns strlen(name).
   Instead of returning 0 when the type is unknown, set the type to
   CTL_SINGLE and return strlen(name). This allows removing the special
   case for base_len() returning 0 in simple_event_add().

2. Move the special handling for "Capture Volume" and "Capture Switch"
   from simple_event_add() to base_len(), so that we handle all exceptions
   inside base_len(). Instead of handling some special cases in base_len()
   and other special cases in simple_event_add().

[jk - moved the "Capture Volume" and "Capture Switch" to "Input Source"
exceptions]

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoconfigure: bumb version to 1.2.5pre1 (for CI tests)
Jaroslav Kysela [Fri, 5 Mar 2021 17:36:01 +0000 (18:36 +0100)]
configure: bumb version to 1.2.5pre1 (for CI tests)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agopcm: softvol - improve TLV data check for new configs
Jaroslav Kysela [Fri, 26 Feb 2021 19:52:23 +0000 (20:52 +0100)]
pcm: softvol - improve TLV data check for new configs

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agocontrol: add snd_ctl_elem_id_compare() function
Jaroslav Kysela [Fri, 26 Feb 2021 19:30:58 +0000 (20:30 +0100)]
control: add snd_ctl_elem_id_compare() function

Compare two control element identifiers like strcmp().

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agocontrol: snd_ctl_ascii_elem_id_get() - do not show unset numid
Jaroslav Kysela [Fri, 26 Feb 2021 18:53:17 +0000 (19:53 +0100)]
control: snd_ctl_ascii_elem_id_get() - do not show unset numid

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agopcm: fix snd_pcm_plugin_status()
Jaroslav Kysela [Wed, 24 Feb 2021 20:03:29 +0000 (21:03 +0100)]
pcm: fix snd_pcm_plugin_status()

The appl_ptr difference must be computed before
the appl_ptr in the status structure is updated.

Fixes: da5b70d3f ("pcm: plugin - fix status code for capture")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoconf: introduce snd_config_get_card() function
Jaroslav Kysela [Wed, 24 Feb 2021 18:20:15 +0000 (19:20 +0100)]
conf: introduce snd_config_get_card() function

It's helper for the "card" entries parsing. It reduces
the code in most of open_hw functions.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agopcm: softvol - make snd_pcm_parse_control_id private
Jaroslav Kysela [Mon, 22 Feb 2021 19:01:34 +0000 (20:01 +0100)]
pcm: softvol - make snd_pcm_parse_control_id private

The function is not used externally (it's not exported in headers).
Make it private.

Use snd_config_get_ctl_iface() for the interface value parsing.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agopcm: softvol - do not set TLV access flags for the switch
Jaroslav Kysela [Mon, 22 Feb 2021 12:08:30 +0000 (13:08 +0100)]
pcm: softvol - do not set TLV access flags for the switch

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agocontrol: improve snd_ctl_add_*_elem_set functions (access flags)
Jaroslav Kysela [Mon, 22 Feb 2021 11:24:58 +0000 (12:24 +0100)]
control: improve snd_ctl_add_*_elem_set functions (access flags)

The access flags are useful for the user space elements
with the custom access flags.

Introduce snd_ctl_elem_info_set_*() functions to set those flags
in the info structure.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agocontrol: fix iformation -> information typos
Jaroslav Kysela [Mon, 22 Feb 2021 11:13:44 +0000 (12:13 +0100)]
control: fix iformation -> information typos

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoconf: HDA-Intel: increase the max number of HDMI/DP output to 11
Hui Wang [Tue, 2 Feb 2021 00:33:36 +0000 (08:33 +0800)]
conf: HDA-Intel: increase the max number of HDMI/DP output to 11

Intel TGL HDMI/DP codec provides 9 pins (Linux kernel, 9a11ba7388f16:
ALSA: hda: hdmi - add Tigerlake support), and with the DP MST enabled,
the linux kernel will build 11 output devices (3, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16), and current alsa-lib only maps the first 8 output
devices, if users plug the HDMI/DP monitor to the last 3 ports, the
users will not see the output device from pulseaudio or gnome.

We have experienced this issue on a dell TGL machine with a dock, we
plugged 2 HDMP/DP monitors on the dock, but we could only see 1
HDMI/DP output device from pulseaudio or gnome, through investigation,
we found one monitor is plugged in the 2nd port from last.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
BugLink: https://github.com/alsa-project/alsa-lib/pull/118
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoucm: fix two error messages
Jaroslav Kysela [Wed, 3 Feb 2021 10:55:53 +0000 (11:55 +0100)]
ucm: fix two error messages

- add missing argument to error msg in if_eval_regex_match()
- print correct error value in uc_mgr_config_load_file()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoucm: add ${find-card} and ${find-device} substitutions
Jaroslav Kysela [Tue, 2 Feb 2021 18:26:24 +0000 (19:26 +0100)]
ucm: add ${find-card} and ${find-device} substitutions

It may be useful to find a correct card or device through
control API information fields.

Increase the syntax version to 4.

Examples:

  ${find-card:field=name,regex='HDA Intel'}
  ${find-device:type=pcm,field=id,regex='HDMI 1$'}
  ${find-device:ctl=hw:acp,type=pcm,field=id,regex=DMIC}

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agopcm: pcm_ioplug - fix the avail_update mmap capture copy issue
Jaroslav Kysela [Thu, 21 Jan 2021 14:45:49 +0000 (15:45 +0100)]
pcm: pcm_ioplug - fix the avail_update mmap capture copy issue

It seems that the commit "pcm: ioplug: Transfer all available data"
introduced new regressions (wrong memory access). The second issue
is that the avail_update in ioplug does not move appl_ptr nor hw_ptr,
so it's possible that the transfers may be repetitive.

This patch moves the transfer calls to mmap_begin callback where it
should be. The pointer wraps are handled by design now.

Fixes: 1714332719 ("pcm: ioplug: Transfer all available data")
BugLink: https://github.com/alsa-project/alsa-lib/pull/103
Tested-by: Andreas Pape <apape@de.adit-jv.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agopcm: share: Pass appl_ptr and hw_ptr in snd_pcm_status()
Takashi Iwai [Fri, 22 Jan 2021 14:48:42 +0000 (15:48 +0100)]
pcm: share: Pass appl_ptr and hw_ptr in snd_pcm_status()

This one also has the same problem as others; the appl_ptr and hw_ptr
of share plugin aren't updated in snd_pcm_status() call.  Fix it.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agopcm: null: Pass appl_ptr and hw_ptr in snd_pcm_status()
Takashi Iwai [Fri, 22 Jan 2021 14:48:41 +0000 (15:48 +0100)]
pcm: null: Pass appl_ptr and hw_ptr in snd_pcm_status()

Just like the previous fix for ioplug, the null plugin also misses the
appl_ptr and hw_ptr updates for snd_pcm_status().  Fix it as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agopcm: ioplug: Pass appl_ptr and hw_ptr in snd_pcm_status()
Takashi Iwai [Fri, 22 Jan 2021 14:48:40 +0000 (15:48 +0100)]
pcm: ioplug: Pass appl_ptr and hw_ptr in snd_pcm_status()

The snd_pcm_status() of the ioplug doesn't return the current
positions of hw_ptr and appl_ptr as advertised.  Fix it by copying the
current values stored in the plugin data.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agopcm: direct: Fix the missing appl_ptr update
Takashi Iwai [Fri, 22 Jan 2021 14:48:39 +0000 (15:48 +0100)]
pcm: direct: Fix the missing appl_ptr update

A snd_pcm_status() call for the direct plugins receives the status
from the slave PCM, but this doesn't contain a valid appl_ptr, since
the slave PCM for the direct plugins is in a free-wheel mode, hence
the appl_ptr is always zero.  This result in the inconsistent
status->appl_ptr and pcm->appl.ptr, hitting the recently introduced
assert() call.

Fix it by transferring the plugin's appl_ptr to the upper caller.

BugLink: https://bugzilla.opensuse.org/show_bug.cgi?id=1181194
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: fix 'parse_tuple_set() - remove dead condition code'
Jaroslav Kysela [Wed, 20 Jan 2021 15:58:33 +0000 (16:58 +0100)]
topology: fix 'parse_tuple_set() - remove dead condition code'

The whole SND_SOC_TPLG_TUPLE_TYPE_WORD condition part must be
commented out, otherwise the condition is always true.

Fixes: 51e1d486ce ("topology: parse_tuple_set() - remove dead condition code")
BugLink: https://github.com/alsa-project/alsa-lib/issues/114
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agopcm: dmix/dshare - delay calculation fixes and cleanups
Jaroslav Kysela [Tue, 19 Jan 2021 10:17:00 +0000 (11:17 +0100)]
pcm: dmix/dshare - delay calculation fixes and cleanups

Unfortunately, we cannot use status->avail from slave, because this value
does not wrap to the buffer size and it may even overflow slave boundary
(endless run). We can use only hw_ptr from slave.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agopcm_plugin: set the initial hw_ptr/appl_ptr from the child pcm
Jaroslav Kysela [Mon, 18 Jan 2021 20:09:43 +0000 (21:09 +0100)]
pcm_plugin: set the initial hw_ptr/appl_ptr from the child pcm

The direct plugins (dmix & etc.) sets own initial
hw_ptr and appl_ptr. Use this initial settings
to export correct values in snd_pcm_status().

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoconf: USB - add "Xonar U7 MKII" to USB-Audio.pcm.iec958_device
Jaroslav Kysela [Thu, 7 Jan 2021 16:49:25 +0000 (17:49 +0100)]
conf: USB - add "Xonar U7 MKII" to USB-Audio.pcm.iec958_device

BugLink: https://github.com/alsa-project/alsa-lib/issues/100
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: sort_config() cleanups - use goto for the error path
Jaroslav Kysela [Thu, 7 Jan 2021 16:45:27 +0000 (17:45 +0100)]
topology: sort_config() cleanups - use goto for the error path

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoucm: uc_mgr_substitute_tree() fix use after free
Jaroslav Kysela [Thu, 7 Jan 2021 16:41:38 +0000 (17:41 +0100)]
ucm: uc_mgr_substitute_tree() fix use after free

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: parse_tuple_set() - remove dead condition code
Jaroslav Kysela [Thu, 7 Jan 2021 16:40:42 +0000 (17:40 +0100)]
topology: parse_tuple_set() - remove dead condition code

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: tplg_decode_pcm() - add missing log argument (compress)
Jaroslav Kysela [Thu, 7 Jan 2021 16:38:50 +0000 (17:38 +0100)]
topology: tplg_decode_pcm() - add missing log argument (compress)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: tplg_add_widget_object() - do not use invalid elem_ctl
Jaroslav Kysela [Thu, 7 Jan 2021 16:36:04 +0000 (17:36 +0100)]
topology: tplg_add_widget_object() - do not use invalid elem_ctl

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: tplg_pprint_integer() fix coverity uninitalized variable error
Jaroslav Kysela [Thu, 7 Jan 2021 16:34:00 +0000 (17:34 +0100)]
topology: tplg_pprint_integer() fix coverity uninitalized variable error

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoucm: fix possible memory leak in parse_verb_file()
Jaroslav Kysela [Thu, 7 Jan 2021 16:32:11 +0000 (17:32 +0100)]
ucm: fix possible memory leak in parse_verb_file()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agopcm: rate - fix the capture delay values
Jaroslav Kysela [Mon, 4 Jan 2021 16:27:32 +0000 (17:27 +0100)]
pcm: rate - fix the capture delay values

Use the correct snd_pcm_mmap_capture_delay() function instead
snd_pcm_mmap_capture_hw_avail().

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agopcm: rate - use pcm_frame_diff() on related places
Jaroslav Kysela [Mon, 4 Jan 2021 16:14:42 +0000 (17:14 +0100)]
pcm: rate - use pcm_frame_diff() on related places

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agopcm: plugin - fix status code for capture
Jaroslav Kysela [Mon, 4 Jan 2021 11:32:25 +0000 (12:32 +0100)]
pcm: plugin - fix status code for capture

The recent updates do not take in account the possible
calls for the capture stream. Fix the avail and delay
inconsistencies (and assert).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agopcm: rate - use pcm_frame_diff() in snd_pcm_rate_playback_internal_delay()
Jaroslav Kysela [Mon, 4 Jan 2021 11:29:00 +0000 (12:29 +0100)]
pcm: rate - use pcm_frame_diff() in snd_pcm_rate_playback_internal_delay()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agopcm: ioplug - fix the delay calculation for old plugins
Jaroslav Kysela [Sun, 3 Jan 2021 16:13:50 +0000 (17:13 +0100)]
pcm: ioplug - fix the delay calculation for old plugins

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agopcm: rate - tidy up snd_pcm_rate_avail_update()
Jaroslav Kysela [Sun, 3 Jan 2021 15:56:38 +0000 (16:56 +0100)]
pcm: rate - tidy up snd_pcm_rate_avail_update()

No functional change - just move the capture code to
a separate function for the better readability.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agopcm: ioplug - fix the delay calculation in the status callback
Jaroslav Kysela [Wed, 30 Dec 2020 18:14:25 +0000 (19:14 +0100)]
pcm: ioplug - fix the delay calculation in the status callback

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoRevert "pcm_plugin: fix delay"
Jaroslav Kysela [Wed, 30 Dec 2020 16:49:33 +0000 (17:49 +0100)]
Revert "pcm_plugin: fix delay"

This reverts commit aba87e509898ec9ddb3e319267d7c267409ff100.

The commit does not look good. The plugins must handle
the delay value correctly.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agopcm: plugin - optimize sync in snd_pcm_plugin_status()
Jaroslav Kysela [Sun, 3 Jan 2021 15:41:29 +0000 (16:41 +0100)]
pcm: plugin - optimize sync in snd_pcm_plugin_status()

Do hw_ptr sync only once after the status call. This avoids
double update.

Also, the application pointer must not change when
the status is called. Add assert() call for this condition.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agopcm: plugin - tidy snd_pcm_plugin_avail_update()
Jaroslav Kysela [Sun, 3 Jan 2021 15:34:04 +0000 (16:34 +0100)]
pcm: plugin - tidy snd_pcm_plugin_avail_update()

No functional changes - move the code to snd_pcm_plugin_sync_hw_ptr()
and put the mmap capture updates to separate function for readability.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agopcm: plugin status - revert the recent changes
Jaroslav Kysela [Sun, 3 Jan 2021 15:16:10 +0000 (16:16 +0100)]
pcm: plugin status - revert the recent changes

It's no reason to sync the avail/delay fields using the mirrored
buffer pointers. The slave information must be valid.

The original report probably tries to fix something for
the specific plugin. Revert all changes.

Fixes: afe6ff3b33e ("pcm: plugin status - fix the return value (regression)")
Fixes: 4f90392f07e ("pcm: fix the snd_pcm_plugin_status() avail and delay fields")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agopcm: plugin status - fix the return value (regression)
Jaroslav Kysela [Wed, 30 Dec 2020 08:31:10 +0000 (09:31 +0100)]
pcm: plugin status - fix the return value (regression)

The snd_pcm_plugin_avail_update() error code in snd_pcm_plugin_status()
should not be reported to the caller. The state errors can be determined
using the state member in the status structure.

Fixes: 4f90392f07e ("pcm: fix the snd_pcm_plugin_status() avail and delay fields")
BugLink: https://github.com/alsa-project/alsa-lib/issues/107
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoconf: fix return code in _snd_config_load_with_include
Jaroslav Kysela [Tue, 29 Dec 2020 10:15:46 +0000 (11:15 +0100)]
conf: fix return code in _snd_config_load_with_include

Fixes: 5275d170e0 ("conf: fix use after free in _snd_config_load_with_include")
BugLink: https://github.com/alsa-project/alsa-lib/issues/108
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoconfmisc: fix memory leak in snd_func_concat
Alex Henrie [Mon, 28 Dec 2020 01:43:15 +0000 (18:43 -0700)]
confmisc: fix memory leak in snd_func_concat

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agopcm: fix __snd_pcm_state() return value
Jaroslav Kysela [Sun, 27 Dec 2020 12:29:33 +0000 (13:29 +0100)]
pcm: fix __snd_pcm_state() return value

The __snd_pcm_state() must return a valid state, not an error value
when the plugin callback is not defined. Use the first state
SND_PCM_STATE_OPEN - the other functions will return the error
code depending on this state.

Link: https://lore.kernel.org/alsa-devel/20201226213547.175071-10-alexhenrie24@gmail.com/
Reported-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoconf: fix get_hexachar() return value
Jaroslav Kysela [Sun, 27 Dec 2020 12:17:26 +0000 (13:17 +0100)]
conf: fix get_hexachar() return value

Reported-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agopcm_multi: remove dead assignment from _snd_pcm_multi_open
Alex Henrie [Sat, 26 Dec 2020 21:35:45 +0000 (14:35 -0700)]
pcm_multi: remove dead assignment from _snd_pcm_multi_open

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agopcm: remove dead assignments from snd_pcm_rate_(commit_area|grab_next_period)
Alex Henrie [Sat, 26 Dec 2020 21:35:44 +0000 (14:35 -0700)]
pcm: remove dead assignments from snd_pcm_rate_(commit_area|grab_next_period)

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agotimer: fix sizeof operator mismatch in snd_timer_query_hw_open
Alex Henrie [Sat, 26 Dec 2020 21:35:43 +0000 (14:35 -0700)]
timer: fix sizeof operator mismatch in snd_timer_query_hw_open

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agorawmidi: fix memory leak in snd_rawmidi_virtual_open
Alex Henrie [Sat, 26 Dec 2020 21:35:41 +0000 (14:35 -0700)]
rawmidi: fix memory leak in snd_rawmidi_virtual_open

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoucm: fix bad frees in get_list0 and get_list20
Alex Henrie [Sat, 26 Dec 2020 21:35:40 +0000 (14:35 -0700)]
ucm: fix bad frees in get_list0 and get_list20

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoconf: fix use after free in _snd_config_load_with_include
Alex Henrie [Sat, 26 Dec 2020 21:35:39 +0000 (14:35 -0700)]
conf: fix use after free in _snd_config_load_with_include

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agopcm: Fix a typo in SND_PCM_AUDIO_TSTAMP_TYPE_LAST definition
Takashi Iwai [Tue, 22 Dec 2020 15:10:16 +0000 (16:10 +0100)]
pcm: Fix a typo in SND_PCM_AUDIO_TSTAMP_TYPE_LAST definition

It was wrongly defined with SNDRV_ prefix.  Fix it.

Fixes: ea02dbd20a53 ("pcm: Add snd_pcm_audio_tstamp_type_t constants")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agotest/audio_time: Make use of SND_PCM_AUDIO_TSTAMP_TYPE constants
David Henningsson [Wed, 16 Dec 2020 19:02:52 +0000 (20:02 +0100)]
test/audio_time: Make use of SND_PCM_AUDIO_TSTAMP_TYPE constants

Also fixup the usage row which seemed wrong to me.

Signed-off-by: David Henningsson <diwic@ubuntu.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agopcm: Add snd_pcm_audio_tstamp_type_t constants
David Henningsson [Wed, 16 Dec 2020 18:55:22 +0000 (19:55 +0100)]
pcm: Add snd_pcm_audio_tstamp_type_t constants

These are mostly a copy-paste from the kernel headers. But since functions
snd_pcm_audio_tstamp_config make use of these they should be added to the
public API as well.

Reported-by: Alex Moon <alex.r.moon@gmail.com>
Signed-off-by: David Henningsson <diwic@ubuntu.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoMakefile: Add README.md to EXTRA_DIST
Takashi Iwai [Thu, 10 Dec 2020 09:36:41 +0000 (10:36 +0100)]
Makefile: Add README.md to EXTRA_DIST

Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agopcm: set the snd_pcm_ioplug_status() tstamp field
Jonas Holmberg [Wed, 4 Nov 2020 13:49:56 +0000 (14:49 +0100)]
pcm: set the snd_pcm_ioplug_status() tstamp field

Set the status tstamp field so that it can be accessed with
snd_pcm_status_get_htstamp().

Signed-off-by: Jonas Holmberg <jonashg@axis.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agotopology: use inclusive language in documentation
Pierre-Louis Bossart [Thu, 12 Nov 2020 16:29:40 +0000 (10:29 -0600)]
topology: use inclusive language in documentation

Use codec_provider and codec_consumer for bclk and fsync

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agotopology: use inclusive language for fsync
Pierre-Louis Bossart [Thu, 12 Nov 2020 16:29:39 +0000 (10:29 -0600)]
topology: use inclusive language for fsync

use fsync_provider for structure fields, 'codec_provider' and
'codec_consumer' for options and modify #defines to use CP and CC
suffixes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agotopology: use inclusive language for bclk
Pierre-Louis Bossart [Thu, 12 Nov 2020 16:29:38 +0000 (10:29 -0600)]
topology: use inclusive language for bclk

use bclk_provider for structure fields, 'codec_provider' and
'codec_consumer' for options and modify #defines to use CP and CC
suffixes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agopcm: snd_pcm_mmap_readi - fix typo in comment
Jaroslav Kysela [Thu, 29 Oct 2020 19:34:17 +0000 (20:34 +0100)]
pcm: snd_pcm_mmap_readi - fix typo in comment

\param size frames to be *read*

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agodlmisc: fix snd_plugin_dir locking for not DL_ORIGIN_AVAILABLE
Jaroslav Kysela [Thu, 29 Oct 2020 19:31:19 +0000 (20:31 +0100)]
dlmisc: fix snd_plugin_dir locking for not DL_ORIGIN_AVAILABLE

Fixes: 8580c081c2 ("dlsym: add support for ALSA_PLUGIN_DIR environment variable")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agodlmisc: the snd_plugin_dir_set / snd_plugin_dir must be declared even for \!DL_ORIGIN...
Jaroslav Kysela [Thu, 22 Oct 2020 18:57:32 +0000 (20:57 +0200)]
dlmisc: the snd_plugin_dir_set / snd_plugin_dir must be declared even for \!DL_ORIGIN_AVAILABLE

Fixes: 8580c081c2 ("dlsym: add support for ALSA_PLUGIN_DIR environment variable")
BugLink: https://github.com/alsa-project/alsa-lib/issues/91
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoRelease v1.2.4
Jaroslav Kysela [Mon, 19 Oct 2020 09:45:13 +0000 (11:45 +0200)]
Release v1.2.4

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: straight printf and error path fixes
Jaroslav Kysela [Mon, 19 Oct 2020 09:17:21 +0000 (11:17 +0200)]
topology: straight printf and error path fixes

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: save_config - fix the error path handling
Jaroslav Kysela [Mon, 19 Oct 2020 09:02:29 +0000 (11:02 +0200)]
topology: save_config - fix the error path handling

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoucm: handle correctly Linked configuration
Jaroslav Kysela [Mon, 19 Oct 2020 08:42:27 +0000 (10:42 +0200)]
ucm: handle correctly Linked configuration

BugLink: https://github.com/alsa-project/alsa-ucm-conf/issues/54
Signed-off-by: Jaroslav Kysela <perex@perex.cz>