Commit graph

3729 commits

Author SHA1 Message Date
Jaroslav Kysela
ad8527d81b alsa.m4: another try to fix the libatopology detection
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-04 09:50:27 +01:00
Fabrice Fontaine
8e2c70add7 src/ucm/main.c: fix build without mixer
Commit 4ce38a5ff4 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>
2019-12-03 20:55:34 +01:00
Hans de Goede
e59034a0be 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>
2019-12-03 20:37:43 +01:00
Jaroslav Kysela
a0fc4447bb ucm: docs - add JackCTL, rearrange JackControl and JackDev
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-03 15:01:04 +01:00
Jaroslav Kysela
2a286ca9a8 use-case: docs - add PlaybackMixerCopy and CaptureMixerCopy
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-02 11:58:05 +01:00
Jaroslav Kysela
4dddcf733d ucm: docs - allow spaces in device names for JackHWMute
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-02 11:56:30 +01:00
Jaroslav Kysela
6055f8a584 namehint: improve the previous patch (check the returned value)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-01 14:30:54 +01:00
Jaroslav Kysela
5ee5ef31b5 namehint: correct the @args check
BugLink: https://github.com/alsa-project/alsa-plugins/issues/3
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-01 14:27:04 +01:00
Jaroslav Kysela
ebdd2b6cdb ucm: add _identifiers list
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-30 20:31:55 +01:00
Jaroslav Kysela
9baf64da2f 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>
2019-11-29 22:32:21 +01:00
paulhsia
c79f09e1f5 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>
2019-11-29 20:48:56 +01:00
Jaroslav Kysela
1c7e46d5d8 Release v1.2.1.2
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-29 16:35:31 +01:00
Jaroslav Kysela
15970ebf7f 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>
2019-11-29 09:34:09 +01:00
Jaroslav Kysela
6eb4f8a724 ucm: conditions - fix the wrong string/substring match
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-28 19:54:52 +01:00
Jaroslav Kysela
2cb44791c3 use-case: add priority values from pulseaudio
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-28 18:10:43 +01:00
Jaroslav Kysela
aaf3a081bf control: ctlparse - accept enum values in '' or ""
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-28 15:02:04 +01:00
Jaroslav Kysela
659ecf6ff0 use-case: improve comment for mixer elements
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-28 14:58:36 +01:00
Jaroslav Kysela
eee55a5267 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>
2019-11-27 15:03:06 +01:00
Takashi Iwai
09b40fdcfe 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>
2019-11-27 10:26:42 +01:00
Jaroslav Kysela
4c89f4eb90 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>
2019-11-26 17:35:18 +01:00
Jaroslav Kysela
cf630e4e54 ucm: remove the new-line for uc_error() calls
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-25 19:50:47 +01:00
Jaroslav Kysela
ca251e3518 include/sound/Makefile.am: remove asoundef.h
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-25 16:16:13 +01:00
Jaroslav Kysela
bcd334f58f local.h: remove sound/asoundef.h dependency 2019-11-25 10:36:32 +01:00
Jaroslav Kysela
2b40312d00 asoundef.h: add CEA861_AUDIO_INFOFRAME defines
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-25 10:36:05 +01:00
Jaroslav Kysela
0aece285a7 include/sound: sync with the kernel v5.4
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-25 10:34:27 +01:00
Jaroslav Kysela
1a4b362115 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>
2019-11-23 15:39:49 +01:00
Jaroslav Kysela
193ed64fd9 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>
2019-11-22 00:57:43 +01:00
Jaroslav Kysela
4a480362eb ucm: add ${CardDriver} substitution
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-21 08:15:38 +01:00
Jaroslav Kysela
cb84b02702 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>
2019-11-20 13:58:17 +01:00
Jaroslav Kysela
1d848ab739 Release v1.2.1.1
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-19 14:16:27 +01:00
Jaroslav Kysela
2e53bbd876 ucm: quick fix for the previous commit when ALSA_CONFIG_UCM_VAR is set
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-19 14:15:00 +01:00
Jaroslav Kysela
10a63e093c ucm: fix again the long name configuration filename lookup
The fix in commit 77119d83a1 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: 77119d83a1 ("ucm: Fix opening of master-configs by the card's longname")

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-19 13:11:35 +01:00
Hans de Goede
8c4301e7a8 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>
2019-11-19 12:45:46 +01:00
Hans de Goede
b3a02322d4 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: aba2260ae7 ("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>
2019-11-19 12:45:38 +01:00
Hans de Goede
77119d83a1 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: aba2260ae7 ("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>
2019-11-19 12:45:30 +01:00
Hans de Goede
86c449d231 ucm: Fix opening of master-configs by the card's longname
Prior to commit aba2260ae7 ("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 aba2260ae7
_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: aba2260ae7 ("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>
2019-11-19 12:25:19 +01:00
Jaroslav Kysela
c28618353b conf: check for include path duplicates
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-19 10:55:29 +01:00
Jaroslav Kysela
39fda8a69a conf: fix the include paths support
I omitted to use parent paths and the proper error code
when no paths are defined.

Fixes: f600310954 ("conf: improve the include paths code")

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-18 19:03:06 +01:00
Jaroslav Kysela
6a76c01a01 ucm: fix memory leaks detected by the coverity checker
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-15 12:52:36 +01:00
Jaroslav Kysela
6fbf87c402 pcm: add braces to condition (coverity)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-15 12:44:28 +01:00
Jaroslav Kysela
8006a8e03c Release v1.2.1
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-14 18:02:27 +01:00
Jaroslav Kysela
a0b00a954e ucm: add possibility to keep order of childs for If blocks
Because of the nature of the structured parser, it is not guaranteed
that the order of the parsed tree is equal to the lines in the source.

Add possibility to insert the If results before or after the selected
identifier like:

SectionDevice."Speaker" {
  ...
}

If.1 {
	Condition { ... }
	Before.SectionDevice "Speaker"
	True { ... }
}
If.2 {
	Condition { ... }
	After.SectionDevice "Speaker"
	True { ... }
}

If the "After" or "Before" identifiers are not found, the result is added
after the last entry in the block.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-14 17:21:20 +01:00
Jaroslav Kysela
4c021697f1 conf: implement snd_config_add_before() and snd_config_add_after()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-14 16:56:05 +01:00
Jaroslav Kysela
4724158c0a ucm: change the If block parsing
- evaluate always If before the other blocks
2019-11-14 15:13:38 +01:00
Jaroslav Kysela
cdc8aacbb5 topology: remove configuration files (moved to alsa-topology-conf repository)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-14 15:01:16 +01:00
Jaroslav Kysela
75d393a563 create separated libatopology library with the topology routines
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-14 15:01:12 +01:00
Jaroslav Kysela
1f37ba2a2b ucm: remove configuration files (moved to alsa-ucm-conf repository)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-14 15:00:54 +01:00
Curtis Malainey
35e737f2ec ucm: docs: Add MinBufferLevel value
Allows ucm to override minimum buffer level for platforms that
incorrectly report their buffer level.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-14 15:00:40 +01:00
Curtis Malainey
eab3835c36 ucm: docs: Add EDID File value
Add a sys path to the EDID file for the corresponding HDMI device so
userspace can use if needed

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-14 15:00:40 +01:00
Jaroslav Kysela
e6fbc84c16 use-case header file: add more references to correct ASCII ID parsers for CTL/mixer IDs
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-14 15:00:40 +01:00