OSDN Git Service

android-x86/external-alsa-lib.git
4 years agoucm: allow to ignore errors for the value substitution
Jaroslav Kysela [Thu, 18 Jun 2020 13:09:23 +0000 (15:09 +0200)]
ucm: allow to ignore errors for the value substitution

It may be useful to ignore the errors where the environment
or sysfs values are not defined for the specific hardware.

Enhance substitution for 'syntax 3' so $${} substitution
means ignore the errors (return an empty string).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agodlsym: fix the race when snd_libdir_origin is freed
Jaroslav Kysela [Thu, 18 Jun 2020 06:41:02 +0000 (08:41 +0200)]
dlsym: fix the race when snd_libdir_origin is freed

snd_dlobj_cache_cleanup() function frees snd_libdir_origin, but
the pointer may be used again in snd_dlpath().

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1847508
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agopcm: dmic: assembly: add x32 support.
Harald van Dijk [Tue, 16 Jun 2020 17:53:57 +0000 (18:53 +0100)]
pcm: dmic: assembly: add x32 support.

x32 is the x86_64 ABI that uses 32-bit pointers, so requires loading
addresses into edi/esi/ebx rather than rdi/rsi/rbx.

Note that instructions such as movl %eax, (%rdi) do not require
updating, as loading an address into %edi zeroes the high bits, causing
the full %rdi register to hold a valid address.

Signed-off-by: Harald van Dijk <harald@gigawatt.nl>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agopcm: direct: correctly apply existing interval settings
Andreas Pape [Wed, 17 Jun 2020 11:42:35 +0000 (13:42 +0200)]
pcm: direct: correctly apply existing interval settings

Feature 'variable periodsize' allows to extend user period size up to
buffer_size/2 independent of slave period. On enlargement of the settings
for period_time.max and period_size.max the setting for openmax
was not updated.

This lead to the effect, that if the slave period itself had openmax
set it was still set on the extended size. Configuration of a period
matching half buffer size was thus rejected.

Example for failure: period size of 384 (half buffer size) is requested
which is rejected and rounded down to 352:

PERIOD_SIZE: [32 352]
BUFFER_SIZE: [64 768]

When correctly applying the openmax setting:

PERIOD_SIZE: [32 384]
BUFFER_SIZE: [64 768]

Signed-off-by: Andreas Pape <apape@de.adit-jv.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agocontrol: ctlparse - use type-specific bound on element count
John Keeping [Tue, 16 Jun 2020 18:29:30 +0000 (19:29 +0100)]
control: ctlparse - use type-specific bound on element count

Using a fixed bound of 128 means that too many values may be set for an
INTEGER64 type and that any elements past 128 are out of reach for BYTE
type controls.

Derive the maximum number of elements from the type so that the full
range is parsed for all types.

Signed-off-by: John Keeping <john@metanate.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: include - fix compound_merge for arrays
Jaroslav Kysela [Mon, 15 Jun 2020 17:49:25 +0000 (19:49 +0200)]
ucm: include - fix compound_merge for arrays

There is a case where the original array has already new indexes
(the merged array is placed before the original nodes).

Set the temporary index string identifiers to unique strings.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agodlmisc.c: fix uclibc build
Bernd Kuhls [Sat, 13 Jun 2020 15:44:45 +0000 (17:44 +0200)]
dlmisc.c: fix uclibc build

RTLD_DL_LINKMAP & RTLD_DI_ORIGIN, are unsupported on uClibc:
https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/tree/include/dlfcn.h#n106

This patch adds detection for uClibc because uClibc also defines
__GLIBC__:
https://lists.gnu.org/archive/html/bug-gnulib/2010-11/msg00280.html

BugLink: https://github.com/alsa-project/alsa-lib/pull/58
From: Bernd Kuhls <bernd.kuhls@t-online.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: fix use-after-free in parse_component_seq()
Jaroslav Kysela [Mon, 8 Jun 2020 16:17:16 +0000 (18:17 +0200)]
ucm: fix use-after-free in parse_component_seq()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoRelease v1.2.3
Jaroslav Kysela [Mon, 8 Jun 2020 11:42:38 +0000 (13:42 +0200)]
Release v1.2.3

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agodlsym: fix the snd_dlopen(), incorrect variable use
Jaroslav Kysela [Mon, 8 Jun 2020 11:41:58 +0000 (13:41 +0200)]
dlsym: fix the snd_dlopen(), incorrect variable use

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoconf: USB-Audio: Add HP Thunderbolt Dock in the IEC958 blacklist
Kai-Heng Feng [Mon, 8 Jun 2020 07:09:23 +0000 (15:09 +0800)]
conf: USB-Audio: Add HP Thunderbolt Dock in the IEC958 blacklist

Both headset and speaker on HP Thunderbolt Dock don't support IEC958
interface.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agodlsym: fix again snd_dlpath()
Jaroslav Kysela [Mon, 8 Jun 2020 10:02:53 +0000 (12:02 +0200)]
dlsym: fix again snd_dlpath()

There is double lock in 8d866e4cd886991f605399af6bd6cf4ac6eea3e2 .

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agopcm: Fix memory leak at snd_pcm_new when THREAD_SAVE_API is defined
chunxu.li [Mon, 27 Apr 2020 13:27:42 +0000 (21:27 +0800)]
pcm: Fix memory leak at snd_pcm_new when THREAD_SAVE_API is defined

The pthread_mutexattr_t object should be destroyed by calling
pthread_mutexattr_destroy(), otherwise it may cause a potential
memory leak due to the different implement of pthread_mutexattr_init()

Signed-off-by: chunxu.li <chunxuxiao@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: fix the wrong return value in uc_mgr_open_ctl()
Jaroslav Kysela [Mon, 8 Jun 2020 07:57:27 +0000 (09:57 +0200)]
ucm: fix the wrong return value in uc_mgr_open_ctl()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: remove strict: in ${OpenName} substitution
Jaroslav Kysela [Mon, 8 Jun 2020 07:17:57 +0000 (09:17 +0200)]
ucm: remove strict: in ${OpenName} substitution

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: fix the error path in parse_toplevel_path()
Jaroslav Kysela [Mon, 8 Jun 2020 07:09:22 +0000 (09:09 +0200)]
ucm: fix the error path in parse_toplevel_path()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: fix the wrong uc_mgr_open_ctl() call in if_eval_control_exists()
Jaroslav Kysela [Mon, 8 Jun 2020 07:03:56 +0000 (09:03 +0200)]
ucm: fix the wrong uc_mgr_open_ctl() call in if_eval_control_exists()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agodlsym: fix the reference to the origin lib directory
Jaroslav Kysela [Mon, 8 Jun 2020 06:59:47 +0000 (08:59 +0200)]
dlsym: fix the reference to the origin lib directory

There is reference to the variable on heap in
commit 33089f30a316060094dfa95a2949fd479299c7 .

Cache the origin directory better.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agouse-case.h: define Linked variable
Jaroslav Kysela [Sun, 7 Jun 2020 15:40:54 +0000 (17:40 +0200)]
use-case.h: define Linked variable

We have a requirement to "hide" some hardware drivers, because
other (main) UCM configuration will refer them.

BugLink: https://github.com/alsa-project/alsa-ucm-conf/issues/30
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agotlv: implement nearest rounding in snd_tlv_convert_from_dB() for xdir == 0
Jaroslav Kysela [Fri, 5 Jun 2020 15:46:39 +0000 (17:46 +0200)]
tlv: implement nearest rounding in snd_tlv_convert_from_dB() for xdir == 0

We should round-up values to nearest to get more precise results.

BugLink: https://github.com/alsa-project/alsa-utils/issues/35
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agocontrol: use more precise rounding in snd_ctl_ascii_value_parse()
Jaroslav Kysela [Fri, 5 Jun 2020 11:38:53 +0000 (13:38 +0200)]
control: use more precise rounding in snd_ctl_ascii_value_parse()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoconf: remove debug printf() in snd_config_hook_load()
Jaroslav Kysela [Fri, 5 Jun 2020 11:12:15 +0000 (13:12 +0200)]
conf: remove debug printf() in snd_config_hook_load()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agopcm: clarify -ENODATA description (recovery, event)
Jaroslav Kysela [Fri, 5 Jun 2020 09:54:34 +0000 (11:54 +0200)]
pcm: clarify -ENODATA description (recovery, event)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agopcm: fix spelling in documentation for -EBADFD
Kai Vehmanen [Fri, 29 May 2020 12:28:17 +0000 (15:28 +0300)]
pcm: fix spelling in documentation for -EBADFD

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
4 years agopcm: add documentation for -ENODATA error code
Kai Vehmanen [Fri, 29 May 2020 12:28:16 +0000 (15:28 +0300)]
pcm: add documentation for -ENODATA error code

This error code can be used e.g. with echo reference PCM devices
(the SND_USE_CASE_MOD_ECHO_REF UCM token).

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
4 years agosnd_dlopen: implement the relocatable version for glibc
Jaroslav Kysela [Thu, 4 Jun 2020 17:06:08 +0000 (19:06 +0200)]
snd_dlopen: implement the relocatable version for glibc

BugLink: https://github.com/alsa-project/alsa-lib/issues/34
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agosnd_dlopen: do not use absolute plugin path for snd_dlopen() calls
Jaroslav Kysela [Thu, 4 Jun 2020 16:22:59 +0000 (18:22 +0200)]
snd_dlopen: do not use absolute plugin path for snd_dlopen() calls

In commit b906db19ef9f4fb7886003072e550391cc1ac651, the snd_dlopen()
implements the automatic lookup to the ALSA_PLUGIN_DIR directory.
It is not necessary to add the absolute paths in callers now.

The plugin names are also searched in ld.so.conf paths as the fallback now,
but it should not be a big problem.

BugLink: https://github.com/alsa-project/alsa-lib/issues/34
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoconf: add support for XDG_CONFIG_HOME search path
Jaroslav Kysela [Thu, 4 Jun 2020 15:31:32 +0000 (17:31 +0200)]
conf: add support for XDG_CONFIG_HOME search path

Include $XDG_CONFIG_HOME/alsa/asoundrc _or_ ~/.config/alsa/asoundrc as
the last user-defined configuration.

BugLink: https://github.com/alsa-project/alsa-lib/issues/49
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoconf: load function (hook) - add OR support
Jaroslav Kysela [Thu, 4 Jun 2020 15:28:25 +0000 (17:28 +0200)]
conf: load function (hook) - add OR support

While I was trying to work on XDG_CONFIG_HOME support, I though
that it may be nice to support OR for the file specification.

But then I found that we can already do this via the refer hook.

I commit this change anyway, because the snd_config_hook_load()
function is more clean now.

The OR is implemented with three | characters like:

  "~/.asoundrc|||~/.asoundrc2|||/opt/some/other/path"

(first file found wins)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoconf: USB-Audio.conf - add another card name for Asus Xonar 5
Jaroslav Kysela [Thu, 4 Jun 2020 09:42:35 +0000 (11:42 +0200)]
conf: USB-Audio.conf - add another card name for Asus Xonar 5

BugLink: https://github.com/alsa-project/alsa-lib/issues/48
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agopcm: return immediately when the state is SETUP in snd_pcm_drain()
Jaroslav Kysela [Wed, 3 Jun 2020 16:42:29 +0000 (18:42 +0200)]
pcm: return immediately when the state is SETUP in snd_pcm_drain()

We are already in the target state. Do not call the plugin callback.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agopcm: fix snd_pcm_drain() excluding SETUP state from valid states
sylvain.bertrand@gmail.com [Sat, 2 May 2020 19:33:11 +0000 (19:33 +0000)]
pcm: fix snd_pcm_drain() excluding SETUP state from valid states

once draining is done, the pcm enters the SETUP state, which ought to
be valid for snd_pcm_drain()

signed-off-by: Sylvain BERTRAND <sylvain.bertrand@legeek.net>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: implement CardIdByName substitution
Jaroslav Kysela [Wed, 3 Jun 2020 15:12:19 +0000 (17:12 +0200)]
ucm: implement CardIdByName substitution

The syntax is ${CardIdByName:CARDNAME[#INDEX]}.

The CARDNAME is the ALSA's soundcard name (short form).
The INDEX is the instance (0 = first, 1 = second etc.).

Example: ${CardIdByName:HDA Intel PCH}
(which is identical to ${CardIdByName:HDA Intel PCH#0})

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: shuffle code in compound_merge()
Jaroslav Kysela [Tue, 2 Jun 2020 17:11:22 +0000 (19:11 +0200)]
ucm: shuffle code in compound_merge()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agogithub actions: ubuntu - fix the non-interactive build
Jaroslav Kysela [Tue, 2 Jun 2020 11:16:55 +0000 (13:16 +0200)]
github actions: ubuntu - fix the non-interactive build

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: substitute arguments in sequences only for syntax 3+
Jaroslav Kysela [Wed, 27 May 2020 13:20:03 +0000 (15:20 +0200)]
ucm: substitute arguments in sequences only for syntax 3+

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: substitute RenameDevice and DeleteDevice lists
Jaroslav Kysela [Wed, 27 May 2020 13:13:55 +0000 (15:13 +0200)]
ucm: substitute RenameDevice and DeleteDevice lists

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: substitute Comment in Transition and Device
Jaroslav Kysela [Wed, 27 May 2020 13:04:31 +0000 (15:04 +0200)]
ucm: substitute Comment in Transition and Device

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: substitute verb name and file field
Jaroslav Kysela [Wed, 27 May 2020 12:47:08 +0000 (14:47 +0200)]
ucm: substitute verb name and file field

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: substitute component sequence string
Jaroslav Kysela [Wed, 27 May 2020 12:12:12 +0000 (14:12 +0200)]
ucm: substitute component sequence string

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: substitute device strings in the device lists
Jaroslav Kysela [Wed, 27 May 2020 12:04:13 +0000 (14:04 +0200)]
ucm: substitute device strings in the device lists

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: substitute device / modifier names, too
Jaroslav Kysela [Wed, 27 May 2020 11:53:10 +0000 (13:53 +0200)]
ucm: substitute device / modifier names, too

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: implement the toplevel ucm configuration file parser
Jaroslav Kysela [Tue, 26 May 2020 16:54:31 +0000 (18:54 +0200)]
ucm: implement the toplevel ucm configuration file parser

There is a big issue to validate all possible configuration paths.
Let create ucm2/ucm.conf file which describe the lookups. It may
be also customized later to follow the kernel-side development.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: substitute ${CardNumber}
Jaroslav Kysela [Tue, 26 May 2020 17:46:26 +0000 (19:46 +0200)]
ucm: substitute ${CardNumber}

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: substitute ${OpenName}
Jaroslav Kysela [Tue, 26 May 2020 13:55:12 +0000 (15:55 +0200)]
ucm: substitute ${OpenName}

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: Define/DefineRegex is supported in Syntax 3
Jaroslav Kysela [Tue, 26 May 2020 13:37:42 +0000 (15:37 +0200)]
ucm: Define/DefineRegex is supported in Syntax 3

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: String condition - implement Empty
Jaroslav Kysela [Tue, 26 May 2020 13:32:36 +0000 (15:32 +0200)]
ucm: String condition - implement Empty

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: handle strict: prefix correctly for the UCM card name
Jaroslav Kysela [Tue, 26 May 2020 13:26:26 +0000 (15:26 +0200)]
ucm: handle strict: prefix correctly for the UCM card name

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: substitute also value strings
Jaroslav Kysela [Tue, 26 May 2020 13:14:15 +0000 (15:14 +0200)]
ucm: substitute also value strings

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: allow to specify the toplevel directory using '/' as first character in File...
Jaroslav Kysela [Mon, 25 May 2020 16:32:43 +0000 (18:32 +0200)]
ucm: allow to specify the toplevel directory using '/' as first character in File path

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: config - change the in-place include evaluation order
Jaroslav Kysela [Wed, 20 May 2020 17:34:15 +0000 (19:34 +0200)]
ucm: config - change the in-place include evaluation order

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: allow syntax version 3
Jaroslav Kysela [Wed, 20 May 2020 10:17:39 +0000 (12:17 +0200)]
ucm: allow syntax version 3

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: substitute arguments in sequences
Jaroslav Kysela [Wed, 20 May 2020 09:55:33 +0000 (11:55 +0200)]
ucm: substitute arguments in sequences

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: configuration - add DefineRegex
Jaroslav Kysela [Tue, 19 May 2020 14:48:43 +0000 (16:48 +0200)]
ucm: configuration - add DefineRegex

Syntax:

  DefineRegex.VariableName {
    String "something to match"
    Regex "(me)thi(ng)"
  }

Result:

- configuration variable "VariableName" is equal to "mething"
- configuration variable "VariableName1" is equal to "me"
- configuration variable "VariableName2" is equal to "ng"

Notes:

The "Flags" string in the DefineRegex compound may specify
the compilation flags (e = extended, i = ignore case,
s = no substitutes, n = newline). See 'man 3 regex' for
more details.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: configuration - allow to define the configuration variables
Jaroslav Kysela [Wed, 20 May 2020 17:04:36 +0000 (19:04 +0200)]
ucm: configuration - allow to define the configuration variables

It may be useful for the library files to use the runtime configuration
variables.

Example:

 Define.Var1 "hw:${CardId},2"
 Value.PlaybackPCM "${var:Var1}"

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: config - substitute File string to allow variables in include
Jaroslav Kysela [Tue, 19 May 2020 13:09:47 +0000 (15:09 +0200)]
ucm: config - substitute File string to allow variables in include

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: configuration - substitute ${ConfDir} and ${ConfTopDir}
Jaroslav Kysela [Tue, 19 May 2020 13:07:13 +0000 (15:07 +0200)]
ucm: configuration - substitute ${ConfDir} and ${ConfTopDir}

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: configuration - implement in-place Include
Jaroslav Kysela [Sat, 16 May 2020 13:47:19 +0000 (15:47 +0200)]
ucm: configuration - implement in-place Include

An example:

Include {
File "Inc.conf"
Before.SectionDevice "Mic"
}

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: rename _once command to _boot command
Jaroslav Kysela [Mon, 25 May 2020 17:19:56 +0000 (19:19 +0200)]
ucm: rename _once command to _boot command

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: rename SectionOnce to BootSequence
Jaroslav Kysela [Mon, 25 May 2020 17:07:12 +0000 (19:07 +0200)]
ucm: rename SectionOnce to BootSequence

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: fix compilation error in set_defaults_user()
Jaroslav Kysela [Tue, 19 May 2020 08:55:35 +0000 (10:55 +0200)]
ucm: fix compilation error in set_defaults_user()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: fix SectionOnce comment
Jaroslav Kysela [Tue, 19 May 2020 06:31:39 +0000 (08:31 +0200)]
ucm: fix SectionOnce comment

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: initialize mgr->once_list
root [Sat, 16 May 2020 08:55:54 +0000 (11:55 +0300)]
ucm: initialize mgr->once_list

BugLink: https://github.com/alsa-project/alsa-lib/pull/50
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: handle 'set _defaults' command
Jaroslav Kysela [Thu, 14 May 2020 16:32:05 +0000 (18:32 +0200)]
ucm: handle 'set _defaults' command

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: handle 'set _once' command
Jaroslav Kysela [Thu, 14 May 2020 14:23:17 +0000 (16:23 +0200)]
ucm: handle 'set _once' command

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: execute SectionDefaults lately (when the first verb is set)
Jaroslav Kysela [Thu, 14 May 2020 14:12:23 +0000 (16:12 +0200)]
ucm: execute SectionDefaults lately (when the first verb is set)

We need a way to set the SectionOnce at first before SectionDefaults.
It also does not make sense to run SectionDefaults when the API is
used only to query for values or so.

Execute the SectionDefaults commands only when the first verb
is set (before the verb specific commands).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: parse SectionOnce section in the master UCM configuration file
Jaroslav Kysela [Thu, 14 May 2020 14:03:00 +0000 (16:03 +0200)]
ucm: parse SectionOnce section in the master UCM configuration file

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agotopology: Add missing ATTRIBUTE_UNUSED
Takashi Iwai [Mon, 11 May 2020 14:35:45 +0000 (16:35 +0200)]
topology: Add missing ATTRIBUTE_UNUSED

... to shut up the compiler warnings.

Fixes: b6c9afb4f59b ("topology: implement snd_tplg_decode")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agopcm: rate: Fix uninitialized variable warning
Takashi Iwai [Mon, 11 May 2020 14:31:14 +0000 (16:31 +0200)]
pcm: rate: Fix uninitialized variable warning

The recent gcc warning indicates the uninitialized variable commit_err:
  pcm_rate.c:1104:6: warning: ‘commit_err’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     if (commit_err < 0)
         ^

Add a proper initialization to commit_err.

Fixes: 29041c522071 ("fix infinite draining of the rate plugin in SND_PCM_NONBLOCK mode")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agopcm: rate: Fix compile warning wrt bit ops and comparison
Takashi Iwai [Mon, 11 May 2020 14:27:31 +0000 (16:27 +0200)]
pcm: rate: Fix compile warning wrt bit ops and comparison

We've got a gcc warning:
  pcm_rate.c: In function ‘snd_pcm_rate_drain’:
  pcm_rate.c:1090:19: warning: suggest parentheses around comparison in operand of ‘&’ [-Wparentheses]
     if (pcm->mode & SND_PCM_NONBLOCK != 0) {
                   ^

Drop the zero comparison for fixing the warning and for simplicity.

Fixes: 29041c522071 ("fix infinite draining of the rate plugin in SND_PCM_NONBLOCK mode")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoucm: merge the array items from the condition blocks
Jaroslav Kysela [Fri, 8 May 2020 10:32:36 +0000 (12:32 +0200)]
ucm: merge the array items from the condition blocks

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agotopology: use snd_config_is_array() function
Jaroslav Kysela [Fri, 8 May 2020 10:04:39 +0000 (12:04 +0200)]
topology: use snd_config_is_array() function

... instead the own array test.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoconf: add snd_config_is_array() function
Jaroslav Kysela [Fri, 8 May 2020 10:00:42 +0000 (12:00 +0200)]
conf: add snd_config_is_array() function

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoconf: use bool type for the join member in the config structure
Jaroslav Kysela [Fri, 8 May 2020 09:23:34 +0000 (11:23 +0200)]
conf: use bool type for the join member in the config structure

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoconf: change namehint for pcm.front
Jaroslav Kysela [Thu, 7 May 2020 14:38:29 +0000 (16:38 +0200)]
conf: change namehint for pcm.front

It seems that we have regressions for pcm.front (some
applications are using this device also for the default
raw input). Change the description and allow both
directions.

Fixes: https://github.com/alsa-project/alsa-lib/issues/39

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoheader: Fix build error with old kernel headers
Takashi Iwai [Wed, 6 May 2020 20:40:16 +0000 (22:40 +0200)]
header: Fix build error with old kernel headers

Old development environment doesn't necessarily contain the headers
defining __kernel_long_t that is recently used for y2038 timespec
conditional.  Define it explicitly in such a case.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agopcm: dmix: assembly: give more freedom over the constraints
Frédéric Recoules [Wed, 6 May 2020 17:19:24 +0000 (19:19 +0200)]
pcm: dmix: assembly: give more freedom over the constraints

Minor changes that could help the compiler to produce a
better (smaller/faster) code.

Signed-off-by: Frédéric Recoules <frederic.recoules@orange.fr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agopcm: dmix: assembly: refactor the PIC mode
Frédéric Recoules [Wed, 6 May 2020 17:19:23 +0000 (19:19 +0200)]
pcm: dmix: assembly: refactor the PIC mode

Newer versions of GCC (> 5.0) accept that ebx is declared
in the clobber list even in PIC mode. Meanwhile, even
unlikely, the compiler may use ebx as base address of
one of the memory entry, making subsequent access to
them unreliable ('size', 'dst_step', 'src_step', 'sum_step').

Adding ebx in the clobber solves the problem.
By the way, the entry 'old_ebx' is no longer required.

Signed-off-by: Frédéric Recoules <frederic.recoules@orange.fr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agopcm: dmix: assembly: fix the interface for safety (mmx)
Frédéric Recoules [Wed, 6 May 2020 17:19:22 +0000 (19:19 +0200)]
pcm: dmix: assembly: fix the interface for safety (mmx)

- add mm0 in the clobber list if the compiler
  is aware of the mmx technology;
- otherwise, add the mmx aliased x87 floating point
  registers in the clobbers;
- the configure now checks if the compiler is aware of
  the MMX technology.

  The compiler assumes none of the mmx or x87 registers are used
  by the function. If it chooses to store some data in them, they
  will be overwritten by the chunk.
  Recall that any mmx instruction invalidate the whole set of
  x87 floating point registers.

  Note: currently does not impact the binary output.

Signed-off-by: Frédéric Recoules <frederic.recoules@orange.fr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agopcm: dmix: assembly: fix the interface for safety
Frédéric Recoules [Wed, 6 May 2020 17:19:21 +0000 (19:19 +0200)]
pcm: dmix: assembly: fix the interface for safety

- move 'size' and 'old_ebx' in the output section
  since they are clobbered;
- add the "memory" clobber since input pointers
  are accessed;
- (minor) add the "cc" clobber since flags are
  clobbered.

  The compiler is missing some dataflow information
  about the execution of the assembly chunks.
  For instance, it assumes that 'size' remains unchanged
  and that no input pointer is accessed.
  The compiler optimizer may take advantage of these
  assumption and produce a wrong code.

Note: currently produces the same binary output.

Signed-off-by: Frédéric Recoules <frederic.recoules@orange.fr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agopcm: dmix: assembly: change the token by symbolic names
Frédéric Recoules [Wed, 6 May 2020 17:19:20 +0000 (19:19 +0200)]
pcm: dmix: assembly: change the token by symbolic names

It eases the refactoring of assembly chunk since we can now
add/remove/move entries without worrying about maintaining
the token numbering in the template.

Note: does not impact the binary output.

Signed-off-by: Frédéric Recoules <frederic.recoules@orange.fr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agotest: pcm_min - add snd_pcm_drain() call and indentation fixes
Jaroslav Kysela [Sun, 3 May 2020 18:07:29 +0000 (20:07 +0200)]
test: pcm_min - add snd_pcm_drain() call and indentation fixes

Fixes: https://github.com/alsa-project/alsa-lib/issues/46
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agofix infinite draining of the rate plugin in SND_PCM_NONBLOCK mode
sylvain.bertrand@gmail.com [Tue, 28 Apr 2020 12:09:18 +0000 (12:09 +0000)]
fix infinite draining of the rate plugin in SND_PCM_NONBLOCK mode

The draining function of the rate plugin does not handle properly the
SND_PCM_NONBLOCK case. It can write data to the slave plugin each time the
function is called, but does not update its internal state in order to
reach a stopping condition. Use a last_commit_ptr workaround to reach such
condition.

Signed-off-by: Sylvain BERTRAND <sylvain.bertrand@legeek.net>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agotopology: Use bool parser to parse boolean value
Amadeusz Sławiński [Fri, 17 Apr 2020 16:47:47 +0000 (12:47 -0400)]
topology: Use bool parser to parse boolean value

It should be safe to change this as correct values with int would be 0
or 1 and bool parser handles them correctly.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agouse-case.h: add USB as allowed device name
Jaroslav Kysela [Tue, 28 Apr 2020 10:58:41 +0000 (12:58 +0200)]
use-case.h: add USB as allowed device name

Some USB devices are really generic where the
PCM stream can be routed to different paths.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agopcm: rate - fix the remaining size calculation in snd_pcm_rate_drain()
Jaroslav Kysela [Thu, 23 Apr 2020 11:43:32 +0000 (13:43 +0200)]
pcm: rate - fix the remaining size calculation in snd_pcm_rate_drain()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoconf: USB-Audio: Fix S/PDIF output of ASUS Xonar AE
Ivan Mironov [Thu, 26 Mar 2020 19:46:45 +0000 (00:46 +0500)]
conf: USB-Audio: Fix S/PDIF output of ASUS Xonar AE

ASUS Xonar AE is a PCI-Express card containing USB controller:

USB controller [0c03]: ASMedia Technology Inc. ASM1042A USB 3.0 Host Controller [1b21:1142]

and the actual USB sound card:

ID 0b05:180f ASUSTek Computer, Inc. XONAR SOUND CARD

As other Xonar USB sound cards, it uses second device for digital
output.

Signed-off-by: Ivan Mironov <mironov.ivan@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agopcm: dmix: fix sw_params handling of timestamp types in direct plugins
sylvain.bertrand@gmail.com [Wed, 15 Apr 2020 00:44:39 +0000 (00:44 +0000)]
pcm: dmix: fix sw_params handling of timestamp types in direct plugins

In pcms using direct plugins (dmix/dsnoop/dshare), the timestamp type could
be different from the terminating hw plugin, then the kernel driver.

Be sure such pcms have plugins using consistently the same timestamp type.

signed-off-by: Sylvain Bertrand <sylvain.bertrand@legeek.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoucm: fix copy-n-paste typo (RemoveDevice list)
Jaroslav Kysela [Mon, 6 Apr 2020 15:20:24 +0000 (17:20 +0200)]
ucm: fix copy-n-paste typo (RemoveDevice list)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: fix the device remove operation
Jaroslav Kysela [Mon, 6 Apr 2020 11:25:43 +0000 (13:25 +0200)]
ucm: fix the device remove operation

- allow to remove device only from conflicting lists
- unify the error codes when the device is not found (ENODEV)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agousecase: allow indexes also for modifier names
Jaroslav Kysela [Fri, 3 Apr 2020 16:00:43 +0000 (18:00 +0200)]
usecase: allow indexes also for modifier names

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agopcm: add chmap option to route plugin
Jonas Holmberg [Tue, 31 Mar 2020 15:09:25 +0000 (17:09 +0200)]
pcm: add chmap option to route plugin

Add a config definition "chmap" to override the channel maps in the same
way as in the hw and null plugins.

Signed-off-by: Jonas Holmberg <jonashg@axis.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoconf: fix namehint for pcm.front and pcm.iec958
Jaroslav Kysela [Fri, 27 Mar 2020 17:14:02 +0000 (18:14 +0100)]
conf: fix namehint for pcm.front and pcm.iec958

As suggested in:

Fixes: https://github.com/alsa-project/alsa-lib/issues/39

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agonamehint: remember the direction from the upper levels
Jaroslav Kysela [Fri, 27 Mar 2020 10:59:53 +0000 (11:59 +0100)]
namehint: remember the direction from the upper levels

The current code resets the direction info for each level.
Simply remove this code.

Fixes: https://github.com/alsa-project/alsa-lib/issues/39

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: fix uc_mgr_scan_master_configs()
Jaroslav Kysela [Tue, 17 Mar 2020 15:20:52 +0000 (16:20 +0100)]
ucm: fix uc_mgr_scan_master_configs()

Skip the lookup, if the top level filename does not exist.

Fixes: https://github.com/alsa-project/alsa-ucm-conf/issues/16

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: clarify the index syntax for the device names
Jaroslav Kysela [Tue, 17 Mar 2020 09:21:10 +0000 (10:21 +0100)]
ucm: clarify the index syntax for the device names

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agotopology: add back asrc to widget_map in dapm.c
Jaroslav Kysela [Fri, 13 Mar 2020 16:05:14 +0000 (17:05 +0100)]
topology: add back asrc to widget_map in dapm.c

Fixes: aa1bac2d04bd ("topology: add snd_tplg_save()")
BugLink: https://github.com/thesofproject/sof/issues/2543
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoconf: USB-Audio: Add C-Media USB Headphone Set to the IEC958 blacklist
Tanu Kaskinen [Fri, 13 Mar 2020 07:39:17 +0000 (09:39 +0200)]
conf: USB-Audio: Add C-Media USB Headphone Set to the IEC958 blacklist

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/317

Signed-off-by: Tanu Kaskinen <tanuk@iki.fi>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoconfigure: add --embed for python3-config (python 3.8)
Jaroslav Kysela [Wed, 4 Mar 2020 10:27:12 +0000 (11:27 +0100)]
configure: add --embed for python3-config (python 3.8)

Fixes: https://github.com/alsa-project/alsa-lib/issues/33

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoChange PCM device number of Asus Xonar U5
be-marc [Tue, 3 Mar 2020 10:01:09 +0000 (11:01 +0100)]
Change PCM device number of Asus Xonar U5

Signed-off-by: Jaroslav Kysela <perex@perex.cz>