Commit graph

948 commits

Author SHA1 Message Date
Jaroslav Kysela
0c99c073d3 conf: add snd_config_is_array() function
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-08 12:00:42 +02:00
Takashi Iwai
bb43546c7a 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>
2020-05-06 22:40:16 +02:00
Jaroslav Kysela
4327660c71 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>
2020-04-28 12:59:13 +02:00
Jaroslav Kysela
341326c21e usecase: allow indexes also for modifier names
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-04-03 18:00:51 +02:00
Jaroslav Kysela
79102bf264 ucm: clarify the index syntax for the device names
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-03-17 10:21:10 +01:00
Rolf Eike Beer
b367274b4d 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>
2020-02-11 12:13:08 +01:00
Takashi Iwai
5bbe8b2fb9 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>
2020-02-10 12:50:50 +01:00
Jaroslav Kysela
b6c9afb4f5 topology: implement snd_tplg_decode
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-01-03 23:38:08 +01:00
Jaroslav Kysela
0793ef064a topology: add snd_tplg_version() function
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-01-03 23:38:08 +01:00
Jaroslav Kysela
b336aea507 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>
2020-01-03 23:38:08 +01:00
Jaroslav Kysela
aa1bac2d04 topology: add snd_tplg_save()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-01-03 23:38:08 +01:00
Jaroslav Kysela
d52eaba63d topology: add snd_tplg_load() remove snd_tplg_build_bin_file()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-01-03 23:38:08 +01:00
Jaroslav Kysela
bee8d4fcaa topology: add binary output from the builder
- snd_tplg_build_bin()
- snd_tplg_build_bin_file()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-01-03 23:38:08 +01:00
Takashi Iwai
59792f467b uapi: Move typedefs from uapi to sound/*
For keeping uapi/*.h cleaner.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-12-20 17:12:37 +01:00
Takashi Iwai
75584fe660 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>
2019-12-20 16:43:50 +01:00
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
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
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
ebdd2b6cdb ucm: add _identifiers list
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-30 20:31:55 +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
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
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
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
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
Jaroslav Kysela
5c88b18371 ucm: add snd_use_case_parse_selem_id()
and add strict ucm_id checks to snd_use_case_parse_ctl_elem_id()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-14 15:00:40 +01:00
Jaroslav Kysela
4ce38a5ff4 mixer: simple - add snd_mixer_selem_id_parse() from amixer
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-14 15:00:40 +01:00
Jaroslav Kysela
cd4b07ffbd ucm: add snd_use_case_parse_ctl_elem_id()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-14 15:00:40 +01:00
Jaroslav Kysela
8a36e38dc4 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'"
}

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-14 15:00:37 +01:00
Jaroslav Kysela
be6deb927f ucm: extend snd_use_case_mgr_open() to address the sound card directly
Some clients like pulseaudio wants to access the multiple instances
of sound cards. This patch adds prefixes like "hw:" to the card_name
argument to handle this. The card index (value) or card identification
(string) can be used for this prefix.

Also the prefix "strict:" was added to avoid the driver name and
driver long name matching. It might be useable for use case
configurations which are not bound to the one sound card.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-10 13:10:43 +01:00
Jaroslav Kysela
f600310954 conf: improve the include paths code
- various cleanups (more straight code and allocations)
- do not add the base config path /usr/share/alsa to the
  explicit include list of directories
  (it's not wanted for ucm configs)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-10 13:05:53 +01:00
Jaroslav Kysela
63ffd41d5f pcm: the maximal rate is 768000Hz, fix the remain code
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-10-25 13:43:31 +02:00
Michael Forney
0baf7b377c Use __func__ instead of __FUNCTION__
They are equivalent, but __func__ is in C99. __FUNCTION__ exists only
for backwards compatibility with old gcc versions.

Signed-off-by: Michael Forney <mforney@mforney.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-06-12 08:52:07 +02:00
Jaroslav Kysela
8ab0393b42 rawmidi: use snd_dlobj_cache_get2() in rawmidi open (coverity)
Use proper reference counting for the dynamic symbol.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-05-24 21:25:50 +02:00
Jaroslav Kysela
5366bdb4fb add support for GCC's LTO 2019-04-09 12:44:14 +02:00
Takashi Iwai
fc0e54c3cc Drop -I$includedir/alsa from alsa.pc
We used to put the additional include path $includedir/alsa in
pkgconfig just because some applications have included asoundlib.h
like
  #include <asoundlib.h>
although the canonical form should be
  #include <alsa/asoundlib.h>

However, adding this include path is significantly dangerous due to
possible conflicts of file names like version.h.  It's already the
reason to discourage people using alsa.pc for the packages.

In this patch, the additional include path from alsa.pc is dropped
finally.  At the same time, as a rescue plan for the programs
including via <asoundlib.h>, a stub header file is provided in
include/sound/asoundlib.h.  It just includes alsa/asoundlib.h with a
warning to suggest for replacing with alsa/asoundlib.h.
Actually this is the same file as we install into sys/asoundlib.h, so
the whole changes are very minimal here.

Acked-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-03-28 08:01:34 +01:00
Jaroslav Kysela
1755df1d9e add snd_strlcpy() and use it everywhere
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-03-25 16:46:05 +01:00