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>
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.
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>
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>
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.
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>
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>
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>
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>
Jaroslav Kysela [Tue, 5 Nov 2019 12:02:41 +0000 (13:02 +0100)]
ucm: add If condition block
The syntax is simple:
If./any-if-identificator/ {
Condition {
Type /type_here/
/optional defines/
}
True {
/block used when condition is evaluated as true/
}
False {
/block used when condition is evaluated as false/
}
}
The Type "ControlExists" is implemented:
Condition {
Type ControlExists
Device "hw:${CardId}"
Control "iface=CARD,name='Headphone Jack'"
}