Commit graph

3747 commits

Author SHA1 Message Date
Takashi Iwai
ae564665ec 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>
2019-12-20 16:43:50 +01:00
Jaroslav Kysela
780f17126a topology: more coding fixes
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-13 22:07:46 +01:00
Jaroslav Kysela
2b50b594dc topology: dapm - merge identical index blocks like for other elems
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-13 21:56:58 +01:00
Jaroslav Kysela
0d6949b7f1 topology: dapm - coding fixes
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-13 21:52:13 +01:00
Jaroslav Kysela
3b9e39dab5 topology: use list_insert() macro in tplg_elem_insert()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-13 21:24:56 +01:00
Jaroslav Kysela
c9e9ee3c40 topology: make vebose output more nice
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-13 21:19:42 +01:00
Jaroslav Kysela
4dcceb5f86 topology: merge write_block to tplg_write_data
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-13 18:49:29 +01:00
Jaroslav Kysela
f1f5b48d0c topology: use size_t for calc_block_size()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-13 18:26:20 +01:00
Jaroslav Kysela
012bd3b28c topology: use an array describing blocks for the main build loop
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-13 18:24:55 +01:00
Jaroslav Kysela
ce74829db6 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>
2019-12-13 17:14:57 +01:00
Jaroslav Kysela
075ee165e6 topology: remove vendor_fd/name from snd_tplg structure - not used
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-13 16:09:35 +01:00
Jaroslav Kysela
9980e18c3c 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>
2019-12-12 18:44:35 +01:00
Libin Yang
1744159180 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>
2019-12-11 08:01:47 +01:00
Jaroslav Kysela
f828dfe549 ucm: docs - remove MixerCopy values, add Priority for verb, improve priority docs
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-10 11:48:06 +01:00
Jaroslav Kysela
ca67e82383 ucm: docs - add note about the sequences and device split
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-06 11:11:54 +01:00
Jaroslav Kysela
5473c5d677 ucm: docs - change the Mic description to simple Microphone Device
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-05 17:19:06 +01:00
Jaroslav Kysela
1ad660ddee ucm: docs - remove DigitalMic, it does not have sense
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-05 17:01:31 +01:00
Jaroslav Kysela
555a5dbdab ucm: docs - add Mic/DigitalMic and multiple devices comments
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-05 16:59:05 +01:00
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