]> git.alsa-project.org Git - alsa-lib.git/log
alsa-lib.git
5 years agogithub: create test workflow for fedora and ubuntu workflow
Jaroslav Kysela [Tue, 18 Feb 2020 08:22:58 +0000 (09:22 +0100)]
github: create test workflow for fedora and ubuntu

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agodo not set close-on-exec flag on descriptor if it was already set
Rolf Eike Beer [Tue, 11 Feb 2020 10:22:18 +0000 (11:22 +0100)]
do not set close-on-exec flag on descriptor if it was already set

There is no need to set this again if O_CLOEXEC is supported.

Signed-off-by: Rolf Eike Beer <eb@emlix.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoucm: parser - add error message to verb_dev_list_add()
Jaroslav Kysela [Mon, 10 Feb 2020 12:18:23 +0000 (13:18 +0100)]
ucm: parser - add error message to verb_dev_list_add()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agouapi: Sync with 5.6 kernel ABI
Takashi Iwai [Mon, 10 Feb 2020 11:50:50 +0000 (12:50 +0100)]
uapi: Sync with 5.6 kernel ABI

This is a sync with 5.6-rc1 kernel headers.  The copy is performed
from the sanitized headers installed via make headers_install.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agotopology: Drop SNDRV_CTL_ELEM_ACCESS_TIMESTAMP access
Takashi Iwai [Mon, 10 Feb 2020 11:49:25 +0000 (12:49 +0100)]
topology: Drop SNDRV_CTL_ELEM_ACCESS_TIMESTAMP access

SNDRV_CTL_ELEM_ACCESS_TIMESTAMP is removed from 5.6 kernel ABI as the
ctl timestamp field has been never used and deprecated.
Drop the corresponding access from the topology code, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agocontrol: Remove access to the deprecated dimen fields
Takashi Iwai [Mon, 10 Feb 2020 11:47:19 +0000 (12:47 +0100)]
control: Remove access to the deprecated dimen fields

The dimen fields of control element has been deprecated, and it's
finally dropped in kernel 5.6 ABI definition.  Remove the
corresponding accesses in alsa-lib code.

As of this patch, it's disabled via ifdef, just to be sure.  The
disabled code should be removed in a later stage as a cleanup.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoucm: fill missing device entries (conflicting / supported)
Jaroslav Kysela [Fri, 7 Feb 2020 15:18:11 +0000 (16:18 +0100)]
ucm: fill missing device entries (conflicting / supported)

It is not necessary to maintain this information in sync in the configuration
files. Fill the missing entries to the complementary devices.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoucm: implement RenameDevice and RemoveDevice verb management
Jaroslav Kysela [Fri, 7 Feb 2020 09:09:07 +0000 (10:09 +0100)]
ucm: implement RenameDevice and RemoveDevice verb management

With the conditionals, it may be useful to define the devices
in the included configuration files. To satisfy the specification
requirements (device naming) those device names might require
to be renamed or deleted wrong references from the conflicting
or supported lists.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoucm: the ucm2/ subdirectory is driver name based
Jaroslav Kysela [Mon, 3 Feb 2020 14:24:19 +0000 (15:24 +0100)]
ucm: the ucm2/ subdirectory is driver name based

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoucm: parser - use correct filename in parser_master_file()
Jaroslav Kysela [Mon, 3 Feb 2020 13:44:13 +0000 (14:44 +0100)]
ucm: parser - use correct filename in parser_master_file()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoconfigure.ac: remove an unnecessary libtool fix
Tanu Kaskinen [Fri, 20 Dec 2019 07:26:12 +0000 (09:26 +0200)]
configure.ac: remove an unnecessary libtool fix

This code was added in commit 75d393a563efb578c79364a277087c6326267f52
without explaining why. I assume it was a mistake, since it looks like
the libtool problem should have gone away a long time ago. The referenced
wiki page https://wiki.debian.org/RpathIssue says:

    Since libtool 1.5.2 (released 2004-01-25), on Linux libtool no
    longer sets RPATH for any directories in the dynamic linker search
    path, so this should no longer be an issue unless upstream used a
    really old version of libtool when creating their distribution
    tarball.

This code caused problems in OpenEmbedded, where the libtool script is
named "x86_64-oe-linux-libtool" or similar rather than just "libtool",
so the sed command failed with a file not found error. Rather than
adapting the code to OpenEmbedded's peculiarities, it seems best to just
remove the unnecessary code altogether.

Note: The rpath is set (hardcoded) for 'make' but it is corrected
for 'make install' by libtool.

Signed-off-by: Tanu Kaskinen <tanuk@iki.fi>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoucm: parser - cosmetic fixes in the comments
Jaroslav Kysela [Fri, 17 Jan 2020 17:21:08 +0000 (18:21 +0100)]
ucm: parser - cosmetic fixes in the comments

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: remove MAX_FILE definition and use correct PATH_MAX
Jaroslav Kysela [Wed, 15 Jan 2020 09:41:35 +0000 (10:41 +0100)]
topology: remove MAX_FILE definition and use correct PATH_MAX

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoucm: remove MAX_FILE definition and use correct PATH_MAX
Jaroslav Kysela [Wed, 15 Jan 2020 09:40:01 +0000 (10:40 +0100)]
ucm: remove MAX_FILE definition and use correct PATH_MAX

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoucm: split conf_file_name and conf_dir_name
Jaroslav Kysela [Wed, 15 Jan 2020 09:31:56 +0000 (10:31 +0100)]
ucm: split conf_file_name and conf_dir_name

With ucm2, the file name might differ from the directory
name. Also, allocate those fields.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoucm: fix the configuration directory (longname) for ucm2
Jaroslav Kysela [Wed, 15 Jan 2020 08:41:05 +0000 (09:41 +0100)]
ucm: fix the configuration directory (longname) for ucm2

The new ucm2 expects that the longname directory is shared with
the driver directory. Fix that for 'Syntax 2'.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoQuote strings containing [ or ] when saving an alsa config
Bertware [Mon, 13 Jan 2020 09:21:33 +0000 (10:21 +0100)]
Quote strings containing [ or ] when saving an alsa config

Signed-off-by: Bert Marcelis <bert.marcelis@outlook.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agomixer: Fix memory leak for more than 16 file descriptor case
David Fries [Tue, 7 Jan 2020 15:18:10 +0000 (09:18 -0600)]
mixer: Fix memory leak for more than 16 file descriptor case

Signed-off-by: David Fries <David@Fries.net>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agotopology: cosmetic changes (functions)
Jaroslav Kysela [Fri, 3 Jan 2020 21:56:48 +0000 (22:56 +0100)]
topology: cosmetic changes (functions)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: tplg_dbg() cleanups
Jaroslav Kysela [Fri, 3 Jan 2020 21:44:15 +0000 (22:44 +0100)]
topology: tplg_dbg() cleanups

- remove newline at the end

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: unify the log mechanism
Jaroslav Kysela [Fri, 3 Jan 2020 21:31:27 +0000 (22:31 +0100)]
topology: unify the log mechanism

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: move the elem->list delete to tplg_elem_free()
Jaroslav Kysela [Fri, 3 Jan 2020 21:07:11 +0000 (22:07 +0100)]
topology: move the elem->list delete to tplg_elem_free()

The tplg_elem_free() is called in the error path from many places
and it is expected that the element object will be unregistered
from the tplg structure, too.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: implement snd_tplg_decode
Jaroslav Kysela [Sun, 15 Dec 2019 14:24:57 +0000 (15:24 +0100)]
topology: implement snd_tplg_decode

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: fix the wrong memory access (object realloc)
Jaroslav Kysela [Wed, 1 Jan 2020 18:10:20 +0000 (19:10 +0100)]
topology: fix the wrong memory access (object realloc)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: fix the ops parser (accept integer/hexa values)
Jaroslav Kysela [Tue, 31 Dec 2019 14:27:58 +0000 (15:27 +0100)]
topology: fix the ops parser (accept integer/hexa values)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: fix the TPLG_DEBUG compilation
Jaroslav Kysela [Sun, 29 Dec 2019 19:05:14 +0000 (20:05 +0100)]
topology: fix the TPLG_DEBUG compilation

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: implement shorter hexa uuid 00:00 parser
Jaroslav Kysela [Sat, 28 Dec 2019 20:44:03 +0000 (21:44 +0100)]
topology: implement shorter hexa uuid 00:00 parser

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: fix the unitialized tuples
Jaroslav Kysela [Sat, 28 Dec 2019 09:18:34 +0000 (10:18 +0100)]
topology: fix the unitialized tuples

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: dapm - fix the SNDERR() - Undefined
Jaroslav Kysela [Fri, 27 Dec 2019 18:32:03 +0000 (19:32 +0100)]
topology: dapm - fix the SNDERR() - Undefined

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: cleanup the SNDERR() calls
Jaroslav Kysela [Fri, 20 Dec 2019 22:48:40 +0000 (23:48 +0100)]
topology: cleanup the SNDERR() calls

- remove the wrong new lines
- remove error/warning prefixes (error is error)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: add snd_tplg_version() function
Jaroslav Kysela [Fri, 20 Dec 2019 20:28:30 +0000 (21:28 +0100)]
topology: add snd_tplg_version() function

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: add snd_tplg_create() with flags
Jaroslav Kysela [Fri, 20 Dec 2019 13:59:00 +0000 (14:59 +0100)]
topology: add snd_tplg_create() with flags

Add SND_TPLG_CREATE_VERBOSE and SND_TPLG_CREATE_DAPM_NOSORT
flags for the special operations.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: add snd_tplg_save()
Jaroslav Kysela [Mon, 16 Dec 2019 13:26:31 +0000 (14:26 +0100)]
topology: add snd_tplg_save()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: add parser to the tplg_table
Jaroslav Kysela [Sun, 15 Dec 2019 16:24:50 +0000 (17:24 +0100)]
topology: add parser to the tplg_table

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: move the topology element table from builder to elem
Jaroslav Kysela [Sun, 15 Dec 2019 15:15:29 +0000 (16:15 +0100)]
topology: move the topology element table from builder to elem

- use offsetof() for the lists
- add other info to describe the elements
- use the table in the element constructor

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: add snd_tplg_load() remove snd_tplg_build_bin_file()
Jaroslav Kysela [Sun, 15 Dec 2019 15:03:29 +0000 (16:03 +0100)]
topology: add snd_tplg_load() remove snd_tplg_build_bin_file()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: parser - recode tplg_parse_config()
Jaroslav Kysela [Sat, 14 Dec 2019 19:32:24 +0000 (20:32 +0100)]
topology: parser - recode tplg_parse_config()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: add binary output from the builder
Jaroslav Kysela [Sat, 14 Dec 2019 18:20:02 +0000 (19:20 +0100)]
topology: add binary output from the builder

- snd_tplg_build_bin()
- snd_tplg_build_bin_file()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: convert builder to use the mallocated memory
Jaroslav Kysela [Sat, 14 Dec 2019 18:13:53 +0000 (19:13 +0100)]
topology: convert builder to use the mallocated memory

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: add tplg_get_unsigned() function
Jaroslav Kysela [Sat, 14 Dec 2019 13:05:49 +0000 (14:05 +0100)]
topology: add tplg_get_unsigned() function

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: fix tplg_get_integer() - handle errno == ERANGE
Jaroslav Kysela [Sat, 14 Dec 2019 12:52:18 +0000 (13:52 +0100)]
topology: fix tplg_get_integer() - handle errno == ERANGE

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: use snd_config_get_bool() instead own implementation
Jaroslav Kysela [Sat, 14 Dec 2019 12:50:04 +0000 (13:50 +0100)]
topology: use snd_config_get_bool() instead own implementation

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: avoid to use the atoi() directly when expected
Jaroslav Kysela [Sat, 14 Dec 2019 12:36:09 +0000 (13:36 +0100)]
topology: avoid to use the atoi() directly when expected

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoUpdate the attributes.m4 macro file from xine
David Ward [Fri, 3 Jan 2020 18:05:51 +0000 (13:05 -0500)]
Update the attributes.m4 macro file from xine

This file was imported from the xine project. Update it to the current
revision, which resolves the "no AC_LANG_SOURCE call detected in body"
warnings with Autoconf 2.68 or later.

Cc: Diego Pettenò <flameeyes@gmail.com>
Signed-off-by: David Ward <david.ward@ll.mit.edu>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agouapi: Move typedefs from uapi to sound/*
Takashi Iwai [Fri, 20 Dec 2019 16:12:37 +0000 (17:12 +0100)]
uapi: Move typedefs from uapi to sound/*

For keeping uapi/*.h cleaner.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agotype_compat: Add missing __s64 and __u64 definitions for non-Linux
Takashi Iwai [Fri, 20 Dec 2019 15:12:50 +0000 (16:12 +0100)]
type_compat: Add missing __s64 and __u64 definitions for non-Linux

Just for the case without Linux-compatible definitions.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoFix alsa/sound/*.h for external programs
Takashi Iwai [Fri, 20 Dec 2019 14:46:48 +0000 (15:46 +0100)]
Fix alsa/sound/*.h for external programs

The recent update of sound/*.h to sync with the latest Linus uapi
files broke the build of alsa-tools programs.  These files used to be
a modified version of Linux sound/* header files, so that they could
be built without Linux headers.  The special prefix like __user and
other things were worked around there.

We may do that again, but a better approach is to fix those things in
Linux kernel uapi side, while we keep the minimal workaround in
alsa-lib such as the __u16 and co type definitions.

This patch is such an attempt, namely:
- Keep the original $LINUX/uapi/sound/*.h in include/sound/uapi
  directory
- The "fixes" are applied to some uapi headers, so that they don't
  contain Linux-specific prefix and use of opaque struct like
  snd_ctl_elem_id
- The uapi headers are included indirectly from include/sound/*.h
- Some headers have inclusion of type_compat.h for the Linux variable
  types and prefixes
- type_compat.h tries to use <linux/types.h> when __linux__ is
  defined, instead of the own conflicting definitions

The last type might need a bit more adjustment depending on the
compiler, but it can be fixed locally without disturbing else.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agotopology: more coding fixes
Jaroslav Kysela [Fri, 13 Dec 2019 21:07:46 +0000 (22:07 +0100)]
topology: more coding fixes

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: dapm - merge identical index blocks like for other elems
Jaroslav Kysela [Fri, 13 Dec 2019 20:56:58 +0000 (21:56 +0100)]
topology: dapm - merge identical index blocks like for other elems

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: dapm - coding fixes
Jaroslav Kysela [Fri, 13 Dec 2019 20:52:13 +0000 (21:52 +0100)]
topology: dapm - coding fixes

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: use list_insert() macro in tplg_elem_insert()
Jaroslav Kysela [Fri, 13 Dec 2019 20:23:52 +0000 (21:23 +0100)]
topology: use list_insert() macro in tplg_elem_insert()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: make vebose output more nice
Jaroslav Kysela [Fri, 13 Dec 2019 17:53:41 +0000 (18:53 +0100)]
topology: make vebose output more nice

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: merge write_block to tplg_write_data
Jaroslav Kysela [Fri, 13 Dec 2019 17:49:29 +0000 (18:49 +0100)]
topology: merge write_block to tplg_write_data

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: use size_t for calc_block_size()
Jaroslav Kysela [Fri, 13 Dec 2019 17:26:20 +0000 (18:26 +0100)]
topology: use size_t for calc_block_size()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: use an array describing blocks for the main build loop
Jaroslav Kysela [Fri, 13 Dec 2019 17:24:55 +0000 (18:24 +0100)]
topology: use an array describing blocks for the main build loop

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: file position and size cleanups
Jaroslav Kysela [Fri, 13 Dec 2019 16:01:03 +0000 (17:01 +0100)]
topology: file position and size cleanups

- try to use size_t/ssize_t
- track the position in own variable, do not use lseek

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: remove vendor_fd/name from snd_tplg structure - not used
Jaroslav Kysela [Fri, 13 Dec 2019 15:09:35 +0000 (16:09 +0100)]
topology: remove vendor_fd/name from snd_tplg structure - not used

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsa-lib: fix the array parser (unique compound keys)
Jaroslav Kysela [Thu, 12 Dec 2019 17:42:33 +0000 (18:42 +0100)]
alsa-lib: fix the array parser (unique compound keys)

The code from the old import may merge arrays wrongly and
the result is a compound with same keys like:

Input:

        lines [
                "SSP0.OUT, , BUF1.3"
        ]
        lines [
                "BUF2.0, , SSP0.IN"
        ]

Parsed contents:

        lines {
                0 'SSP0.OUT, , BUF1.3'
                0 'BUF2.0, , SSP0.IN'
        }

Proper parsed contents (create+merge mode):

        lines {
                0 'SSP0.OUT, , BUF1.3'
                1 'BUF2.0, , SSP0.IN'
        }

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoucm: setup conf_format after getting ALSA_CONFIG_UCM_VAR successfully
Libin Yang [Wed, 11 Dec 2019 06:07:19 +0000 (14:07 +0800)]
ucm: setup conf_format after getting ALSA_CONFIG_UCM_VAR successfully

Set the conf_format to 1 after getting ALSA_CONFIG_UCM_VAR successfully.
Otherwise, the conf_format is not set in this scenario.

Signed-off-by: Libin Yang <libin.yang@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoucm: docs - remove MixerCopy values, add Priority for verb, improve priority docs
Jaroslav Kysela [Tue, 10 Dec 2019 10:48:06 +0000 (11:48 +0100)]
ucm: docs - remove MixerCopy values, add Priority for verb, improve priority docs

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoucm: docs - add note about the sequences and device split
Jaroslav Kysela [Fri, 6 Dec 2019 10:11:54 +0000 (11:11 +0100)]
ucm: docs - add note about the sequences and device split

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoucm: docs - change the Mic description to simple Microphone Device
Jaroslav Kysela [Thu, 5 Dec 2019 16:19:06 +0000 (17:19 +0100)]
ucm: docs - change the Mic description to simple Microphone Device

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoucm: docs - remove DigitalMic, it does not have sense
Jaroslav Kysela [Thu, 5 Dec 2019 16:01:31 +0000 (17:01 +0100)]
ucm: docs - remove DigitalMic, it does not have sense

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoucm: docs - add Mic/DigitalMic and multiple devices comments
Jaroslav Kysela [Thu, 5 Dec 2019 15:59:05 +0000 (16:59 +0100)]
ucm: docs - add Mic/DigitalMic and multiple devices comments

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsa.m4: another try to fix the libatopology detection
Jaroslav Kysela [Wed, 4 Dec 2019 08:49:40 +0000 (09:49 +0100)]
alsa.m4: another try to fix the libatopology detection

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agosrc/ucm/main.c: fix build without mixer
Fabrice Fontaine [Tue, 3 Dec 2019 17:56:40 +0000 (18:56 +0100)]
src/ucm/main.c: fix build without mixer

Commit 4ce38a5ff466d18039b2606938f866ea3a6c9f3c breaks the build without
mixer on:

  CCLD     libasound.la
/home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/8.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: ucm/.libs/libucm.a(main.o): in function `snd_use_case_set':
main.c:(.text+0x185c): undefined reference to `snd_mixer_selem_id_parse'

Fixes: http://autobuild.buildroot.org/results/4d91c9f82a2a61c50c457a851073b85cc09ea345
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoucm: Do not fail to parse configs on cards with an empty CardComponents lists
Hans de Goede [Tue, 3 Dec 2019 17:27:39 +0000 (18:27 +0100)]
ucm: Do not fail to parse configs on cards with an empty CardComponents lists

Since the UCM profiles for all Bay- and Cherry-Trail SST cards have been
moved over to UCM2, parsing them fails with:

ALSA lib ucm_subs.c:220:(uc_mgr_get_substituted_value) variable '${CardComponents}' is not defined in this context!

This completely breaks audio support on all Bay- and Cherry-Trail devices.

This is caused by these non-SOF ASoC using cards having an empty
CardComponents list. Which in itself is fine, but is rejected by
the ucm_subs.c code. This commit changes the ucm_subs code to accept
an empty string as a valid value for CardComponents restoring audio
functionality on these boards.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoucm: docs - add JackCTL, rearrange JackControl and JackDev
Jaroslav Kysela [Tue, 3 Dec 2019 14:01:04 +0000 (15:01 +0100)]
ucm: docs - add JackCTL, rearrange JackControl and JackDev

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agouse-case: docs - add PlaybackMixerCopy and CaptureMixerCopy
Jaroslav Kysela [Mon, 2 Dec 2019 10:57:18 +0000 (11:57 +0100)]
use-case: docs - add PlaybackMixerCopy and CaptureMixerCopy

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoucm: docs - allow spaces in device names for JackHWMute
Jaroslav Kysela [Mon, 2 Dec 2019 10:56:30 +0000 (11:56 +0100)]
ucm: docs - allow spaces in device names for JackHWMute

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agonamehint: improve the previous patch (check the returned value)
Jaroslav Kysela [Sun, 1 Dec 2019 13:30:54 +0000 (14:30 +0100)]
namehint: improve the previous patch (check the returned value)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agonamehint: correct the @args check
Jaroslav Kysela [Sun, 1 Dec 2019 13:26:40 +0000 (14:26 +0100)]
namehint: correct the @args check

BugLink: https://github.com/alsa-project/alsa-plugins/issues/3
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoucm: add _identifiers list
Jaroslav Kysela [Sat, 30 Nov 2019 19:31:55 +0000 (20:31 +0100)]
ucm: add _identifiers list

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoucm: return always at least NULL if no list is available in snd_use_case_get_list()
Jaroslav Kysela [Fri, 29 Nov 2019 21:28:26 +0000 (22:28 +0100)]
ucm: return always at least NULL if no list is available in snd_use_case_get_list()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoucm: Use strncmp to avoid access-out-of-boundary
paulhsia [Fri, 29 Nov 2019 19:35:30 +0000 (03:35 +0800)]
ucm: Use strncmp to avoid access-out-of-boundary

If the length of the identifier is less than the length of the prefix,
access-out-of-boundary will occur in memcmp().

Signed-off-by: paulhsia <paulhsia@chromium.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoRelease v1.2.1.2 v1.2.1.2
Jaroslav Kysela [Fri, 29 Nov 2019 15:35:31 +0000 (16:35 +0100)]
Release v1.2.1.2

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoucm: add support for ControlEnum in ControlExists condition
Jaroslav Kysela [Fri, 29 Nov 2019 08:33:50 +0000 (09:33 +0100)]
ucm: add support for ControlEnum in ControlExists condition

Condition {
  Type ControlExists
  Control "name='Capture Input'"
  ControlEnum "Headphone Mic"
}

The result is true if the control exists, it is the enumerated
type and has the item with the ControlEnum text (name).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoucm: conditions - fix the wrong string/substring match
Jaroslav Kysela [Thu, 28 Nov 2019 18:25:03 +0000 (19:25 +0100)]
ucm: conditions - fix the wrong string/substring match

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agouse-case: add priority values from pulseaudio
Jaroslav Kysela [Thu, 28 Nov 2019 17:10:43 +0000 (18:10 +0100)]
use-case: add priority values from pulseaudio

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agocontrol: ctlparse - accept enum values in '' or ""
Jaroslav Kysela [Wed, 27 Nov 2019 13:59:17 +0000 (14:59 +0100)]
control: ctlparse - accept enum values in '' or ""

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agouse-case: improve comment for mixer elements
Jaroslav Kysela [Thu, 28 Nov 2019 13:58:36 +0000 (14:58 +0100)]
use-case: improve comment for mixer elements

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoucm: rename mixer element identifiers
Jaroslav Kysela [Wed, 27 Nov 2019 13:59:17 +0000 (14:59 +0100)]
ucm: rename mixer element identifiers

To my knowledge, no software is using the mixer element identifiers.
Rename them to be more consistent with the mixer API and add
Master element identifier and type.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsa.m4: Fix the detection of topology library availability
Takashi Iwai [Wed, 27 Nov 2019 09:19:26 +0000 (10:19 +0100)]
alsa.m4: Fix the detection of topology library availability

The header file alsa/topology.h is mandatory and needs to be checked,
too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoucm: fix the cdev initialization sequence
Jaroslav Kysela [Tue, 26 Nov 2019 16:35:15 +0000 (17:35 +0100)]
ucm: fix the cdev initialization sequence

The default values must be set before the defaults
UCM sequence is executed.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoucm: remove the new-line for uc_error() calls
Jaroslav Kysela [Mon, 25 Nov 2019 18:50:47 +0000 (19:50 +0100)]
ucm: remove the new-line for uc_error() calls

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoinclude/sound/Makefile.am: remove asoundef.h
Jaroslav Kysela [Mon, 25 Nov 2019 15:16:13 +0000 (16:16 +0100)]
include/sound/Makefile.am: remove asoundef.h

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agolocal.h: remove sound/asoundef.h dependency
Jaroslav Kysela [Mon, 25 Nov 2019 09:36:32 +0000 (10:36 +0100)]
local.h: remove sound/asoundef.h dependency

5 years agoasoundef.h: add CEA861_AUDIO_INFOFRAME defines
Jaroslav Kysela [Mon, 25 Nov 2019 09:36:05 +0000 (10:36 +0100)]
asoundef.h: add CEA861_AUDIO_INFOFRAME defines

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoinclude/sound: sync with the kernel v5.4
Jaroslav Kysela [Mon, 25 Nov 2019 09:14:43 +0000 (10:14 +0100)]
include/sound: sync with the kernel v5.4

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoucm: use-case.h - add <alsa/asoundlib.h> include
Jaroslav Kysela [Sat, 23 Nov 2019 14:38:35 +0000 (15:38 +0100)]
ucm: use-case.h - add <alsa/asoundlib.h> include

It is required for snd_ctl_elem_id_t and snd_mixer_selem_id_t.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agopcm_file: fix pipe stall when pclose() is called too early
Jaroslav Kysela [Thu, 21 Nov 2019 23:57:19 +0000 (00:57 +0100)]
pcm_file: fix pipe stall when pclose() is called too early

BugLink: https://github.com/alsa-project/alsa-lib/issues/14
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoucm: add ${CardDriver} substitution
Jaroslav Kysela [Thu, 21 Nov 2019 07:15:23 +0000 (08:15 +0100)]
ucm: add ${CardDriver} substitution

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoucm: implement ${sys:sysfs/path} substitution
Jaroslav Kysela [Wed, 20 Nov 2019 12:43:39 +0000 (13:43 +0100)]
ucm: implement ${sys:sysfs/path} substitution

Example:

Condition {
Type String
String1 "${sys:class/dmi/id/board_vendor}"
String2 "LENOVO"
}

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoRelease v1.2.1.1 v1.2.1.1
Jaroslav Kysela [Tue, 19 Nov 2019 13:16:27 +0000 (14:16 +0100)]
Release v1.2.1.1

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoucm: quick fix for the previous commit when ALSA_CONFIG_UCM_VAR is set
Jaroslav Kysela [Tue, 19 Nov 2019 13:15:00 +0000 (14:15 +0100)]
ucm: quick fix for the previous commit when ALSA_CONFIG_UCM_VAR is set

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoucm: fix again the long name configuration filename lookup
Jaroslav Kysela [Tue, 19 Nov 2019 12:10:19 +0000 (13:10 +0100)]
ucm: fix again the long name configuration filename lookup

The fix in commit 77119d83a1f4 assumes that both ucm1 / ucm2 directories
have the configurations for the long name in the same directory. For v2
we changed the location to card_name/card_long_name aka
driver_name/driver_long_name to make the directory layout more structured.

Fixes: 77119d83a1f4 ("ucm: Fix opening of master-configs by the card's longname")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoucm: parser: Fix snprintf usage
Hans de Goede [Tue, 19 Nov 2019 10:48:22 +0000 (11:48 +0100)]
ucm: parser: Fix snprintf usage

There is no need to manually 0 terminate the buffer with snprintf,
only strncpy has the very unfortunate behavior of not guaranteeing 0
termination.

Likewise there is no need to substract one from the buffer size of
the buffer passed to snprintf.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoucm: Only look in ucm[1] or ucm2 dir once we've found a config file in one
Hans de Goede [Tue, 19 Nov 2019 10:48:21 +0000 (11:48 +0100)]
ucm: Only look in ucm[1] or ucm2 dir once we've found a config file in one

Unless environment variables are set, then configuration_filename()
when initially called by load_master_config() will first try to find
the requested master-config under <prefix>/alsa/ucm2 and then under
<prefix>/alsa/ucm.

Once a master-config is found this way, we should set conf_format to
match, so that subsequent lookups only look under the same directory
as where the master-config was found.

This fixes 2 problems:
1. uc_mgr_config_load() looking under <prefix>/alsa/ucm for includes for
   UCM2 profiles because it is called with uc_mgr->conf_format as format
   and before this commit that would stay 0 when autodetecion is used.

2. parse_verb_file() possibly loading an UCM2 verb-file for an UCM1 profile,
   the chance of this happening is small as this means that even though
   there is no UCM2 master-config there is an UCM2 profile dir matching
   uc_mgr->conf_file_name, which would be weird.

Fixes: aba2260ae7b5 ("ucm: switch to ucm2 directory and v2 format, keep backward compatibility")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoucm: Fix fallback to card_name (shortname) config for ucm1 profiles
Hans de Goede [Tue, 19 Nov 2019 10:48:20 +0000 (11:48 +0100)]
ucm: Fix fallback to card_name (shortname) config for ucm1 profiles

uc_mgr_import_master_config() first calls load_master_config()
with the card's longname and if that fails then calls it again with the
card_name.

Before this commit configuration_filename() would force conf_format to 2
when it the access(fn, R_OK) test failed for the ucm1 longname
master-config filename.

This would cause configuration_filename() to blindly return a filename
under <prefix>/ucm2 without seeing if that is actually there and without
trying to fallback to the old profiles under <prefix>/ucm, breaking the
loading of UCM1 profiles by card_name.

This commit fixes this by modifying configuration_filename() to not set
conf_format when checking for the UCM1 config filename fails.
Instead, to make sure that any errors about opening the file still report
the new path, configuration_filename() now resets the filename to the UCM2
path if the access() check has failed for both the UCM2 and UCM1 paths,
without touching conf_format.

Fixes: aba2260ae7b5 ("ucm: switch to ucm2 directory and v2 format, keep backward compatibility")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoucm: Fix opening of master-configs by the card's longname
Hans de Goede [Tue, 19 Nov 2019 10:48:19 +0000 (11:48 +0100)]
ucm: Fix opening of master-configs by the card's longname

Prior to commit aba2260ae7b5 ("ucm: switch to ucm2 directory and v2 format,
keep backward compatibility").

The filename build in parse_verb_file() was build like this:
<prefix>/<uc_mgr->conf_file_name>/<file>

Where uc_mgr->conf_file_name would contain either the card_name or the
card's longname depending on the detection of a longname based config in
uc_mgr_import_master_config().

While the filename used in load_master_config() was build like this:
<prefix>/<card_name>/<card_name>.conf

And uc_mgr_import_master_config() first calls load_master_config()
with the card's longname and if that succeeds it overwrites
uc_mgr->conf_file_name with the longname so that the subsequent uses
of uc_mgr->conf_file_name in parse_verb_file() correctly use the longname.

But the new configuration_filename() helper added in commit aba2260ae7b5
_always_ builds the filename like this:
<prefix>/<uc_mgr->conf_file_name>/<file><suffix>

This breaks the loading of the master-config by its longname, as when
the longname is tried uc_mgr->conf_file_name still contains the card_name.

This commit fixes this by adding a dir parameter to configuration_filename()
and restoring the old behavior by passing card_name as dir in
load_master_config().

Fixes: aba2260ae7b5 ("ucm: switch to ucm2 directory and v2 format, keep backward compatibility")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>