summaryrefslogtreecommitdiff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* pcm: Remove home brew atomic operationsTakashi Iwai2016-07-112-171/+1
| | | | | | | | | | | | We've had a few home brew atomic operations in a couple of places in the PCM code. This was for supporting the concurrent accesses, but in practice, it couldn't cover the race properly by itself alone. Since we have a wider concurrency protection via mutex now, we can get rid of these atomic codes, which worsens the portability significantly. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: Add thread-safety to PCM APITakashi Iwai2016-07-111-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Traditionally, many of ALSA library functions are supposed to be thread-unsafe, and applications are required to take care of thread safety by themselves. However, people never be careful enough, and almost all applications fail in this regard. This patch is an attempt to harden the thread safety in exported PCM functions in a simplistic way: just wrap some of exported functions with the pthread mutex of each PCM object. Not all API functions are wrapped by the mutex since it doesn't make sense. Instead, the patchset covers only the functions that may be likely called concurrently. The supposedly thread-safe API functions are marked in the document. For achieving the feature, two new fields are added snd_pcm_t when the option is enabled: thread_safe and lock. The former indicates that the plugin is thread-safe that doesn't need this workaround and the latter is the pthread mutex. Currently only hw plugin have thread_safe=1. So, the most of real-time sensitive apps won't be influenced by this patchset. Although the patch covers most of PCM ops, a few snd_pcm_fast_ops are left without the extra mutex locking: namely, the ones that may have blocking behavior, i.e. resume, drain, readi, writei, readn and writen. These are supposed to handle own locking in the callbacks. Also, if anyone wants to disable this new thread-safe API feature, it can be still turned off via --disable-thread-safety configure option. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ctl: add an API to set dimension levels to element informationTakashi Sakamoto2016-06-301-0/+2
| | | | | | | | | | | | | | | | In a former commit, 'struct snd_ctl_elem_info' is used as a 'container' to transfer extra fields of element information for APIs to add an element set. The extra fields should be filled in advance of call of the APIs. Currently, dimension level is in the extra fields and no APIs to set it. This commit adds an API to set dimension level to the information structure. This API is expected to be used in advance of usage of APIs to add an element set, for nothing others. When the information structure is extended in future, then the similar APIs shall be added for the new feature. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ctl: support extra information to user-defined element setTakashi Sakamoto2016-06-301-5/+5
| | | | | | | | | | | | | | In ALSA control feature, information of an element includes extra fields to type-specific parameters; i.e. dimension. The fields can be extended in future. Meanwhile, current APIs to add user-defined element set can not support such an extended fields. This may cause inconveniences in future. This commit supports the fields, by changing APIs for element set. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ctl: use consistent name for second argument of snd_ctl_elem_read/writeTakashi Sakamoto2016-06-291-2/+2
| | | | | | | | | | | | Second argument of these functions has three different names in documentation/header/code (obj/control/value). This easily causes users' confusion. This commit applies consistent names for the arguments. Fixes: 90020c05f886 ('ctl: improve comments for handling element data') Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ctl: add functions to add an element setTakashi Sakamoto2016-06-161-0/+21
| | | | | | | | | | | | ALSA control core allows userspace applications to add an element set. However, in ALSA userspace library, there's no APIs enough to utilize the feature. The library has APIs just to add an element set with a single element. This commit adds functions to add an element set with several elements. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* conf: Add thread-safe global tree referenceTakashi Iwai2016-05-171-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Most of open functions in alsa-lib have the call pattern: snd_config_update(); return snd_xxx_open(x, snd_config, ...); This means that the toplevel config gets updated, and passed to a local open function. Although snd_config_update() itself has a pthread mutex to be thread safe, the whole procedure above isn't thread safe. Namely, the global snd_config tree may be deleted and recreated at any time while the open function is being processed. This may lead to a data corruption and crash of the program. For avoiding the corruption, this patch introduces a refcount to config tree object. A few new helper functions are introduced as well: - snd_config_update_ref() does update and take the refcount of the toplevel tree. The obtained config tree has to be freed via snd_config_unref() below. - snd_config_ref() and snd_config_unref() manage the refcount of the config object. The latter eventually deletes the object when all references are gone. Along with these additions, the caller of snd_config_update() and snd_config global tree in alsa-lib are replaced with the new helpers. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* topology: Parse front-end DAI name and ID for the PCMMengdong Lin2016-05-091-0/+4
| | | | | | | | These two fields are necessary to create the front-end DAIs in kernel but the support is missing in text conf previously. Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* topology: Fix pcm ID & name parsingMengdong Lin2016-05-091-1/+1
| | | | | | | | | The name and ID of SectionPCM should be set to pcm_name and pcm_id, for a front-end DAI link in the kernel, not for the front-end DAI of the link. Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* Add u8 in type_compat.hShreyas NC2016-04-281-0/+2
| | | | | | | | | Skylake headers use u8 data types which were not present in type_compat so add them. Signed-off-by: Shreyas NC <shreyas.nc@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* topology: Add support for parsing vendor tuplesMengdong Lin2016-04-071-0/+1
| | | | | | | | | | | Vendor can define several tuple arrays in 'SectionVendorTuples', as well as the reference to a vendor token list object. A later patche will copy vendor tuples in ABI format to the private buffer of its parent data object in the building phase. Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* topology: Add support for vendor tokensMengdong Lin2016-04-071-0/+1
| | | | | | | | | Vendor can define a token list in SectionVendorTokens. Each token element is a pair of string ID and integer value. And both the ID and value are vendor-specific. Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* topology: ABI - Define types for vendor tuplesMengdong Lin2016-04-071-1/+41
| | | | | | | | | | | | | | | | | | | Tuples, a pair of token and value, can be used to define vendor specific data, for controls and widgets. This can avoid importing binary data blob from other files. Vendor specific tuple arrays will be embeded in the private data buffer of a control or widget object. To be backward compatible, union is used to define the tuple arrays in the existing private data ABI object 'struct snd_soc_tplg_private'. Vendors need to make sure the token values defined by the topology conf file match those defined by their driver. Now supported tuple types are uuid, string, bool, byte, short and word. Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* topology: Add doc for vendor tuplesMengdong Lin2016-04-071-4/+73
| | | | | | | Describe how to define vendor tokens and tuples in the text conf file. Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* topology: add support for CTL access flags to config fileLiam Girdwood2016-03-141-0/+29
| | | | | | | Allow the config files to define CTL access flags. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* seq: Provide sequencer sound card number / PID via alsa-libMartin Koegler2016-03-082-2/+6
| | | | | | | | | | | | | | | | | rawmidi devices expose the card number via IOCTLs, which allows to find the corresponding device in sysfs. The sequencer provides no identifing data. Chromium works around this issue by scanning rawmidi as well as sequencer devices and matching them by using assumtions, how the kernel register sequencer devices. This changes adds support for exposing the card number for kernel clients as well as the PID for user client. It supports kernels with and without the required support. Signed-off-by: Martin Koegler <martin.koegler@chello.at> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* Update include/sound/asequencer.h from 4.6-pre kernel uapiTakashi Iwai2016-03-041-6/+1
| | | | | | | A few unimplemented ioctl definitions have been removed. Also <sound/asound.h> is included locally, too. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* Update include/sound/asound.h from 4.6-pre kernel uapiTakashi Iwai2016-03-041-0/+4
| | | | | | | The inclusion of <linux/*.h> is done conditionally for Linux in order to improve portability. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* Add more compatibility defines.Thomas Klausner2016-03-031-0/+7
| | | | Signed-off-by: Takashi Iwai <tiwai@suse.de>
* Introduce bswap.h for portable definitions of byte swap macros.Thomas Klausner2016-03-032-1/+40
| | | | | Signed-off-by: Thomas Klausner <wiz@NetBSD.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* Define some types if missingThomas Klausner2016-03-033-4/+70
| | | | | | | | Include Linux headers on Linux only. For portability with non-Linux. Signed-off-by: Thomas Klausner <wiz@NetBSD.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* Define EBADFD in terms of EBADF if it doesn't exist.Thomas Klausner2016-02-241-0/+4
| | | | | | For portability on FreeBSD, NetBSD and probably others. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* topology: remove little endian type from userspace headerLiam Girdwood2015-11-091-1/+3
| | | | | | | | Use a generic uint64_t for formats instead of an ABI endian specific __le64 type. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* topology: Add C API support for PCMMengdong Lin2015-11-051-0/+36
| | | | | | | | PCM objects can be added by C API. And this is used to create FE DAIs and DAI links in kernel. Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* topology: Add C API support for BE and CC Links.Vedang Patel2015-11-051-0/+23
| | | | | | | | | Adding BE and CC Link support for C API reference. This will be used to populate the .hw_params element for BE and .params for CC, enabling us to update already existing DAI Links created by the kernel. Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* topology: ABI - Rename dai_elems to pcm_elems in manifestMengdong Lin2015-11-051-1/+1
| | | | | | | This field is the number of PCM objects (a pair of FE DAI and DAI link). Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* topology: ABI - Change stream formats to a bitwise flagMengdong Lin2015-11-051-1/+1
| | | | | | | | | | The toplogy user space tool will generate this bitwise flag by using SNDRV_PCM_FORMAT_* exposed by asound.h, and the topology core will copy this flag when generating DAI streams. Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com> Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* topology: ABI - Use __le32 instead of __u32 in snd_soc_tplg_dapm_widgetVedang Patel2015-11-051-5/+5
| | | | | | | | | This fixes the endianness of the ABI parameters in the struct. The field 'num_kcontrols' is also extended from 16 bits to 32 bits. Signed-off-by: Vedang Patel <vedang.patel@intel.com> Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* topology: ABI - Remove unused struct snd_soc_tplg_stream_configVedang Patel2015-11-051-10/+0
| | | | | | | | | The struct snd_soc_tplg_stream_config is no longer used in the ABI. We are using snd_soc_tplg_stream instead. Signed-off-by: Vedang Patel <vedang.patel@intel.com> Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* topology: ABI - Remove tdm_slot & dai_fmt from snd_soc_tplg_streamMengdong Lin2015-11-051-2/+0
| | | | | | | | These two fields are line parameters for BE/CC links and should not be from toplogy but from ACPI. Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* topology: ABI - Separate PCM & BE/CC link support and bump ABI version to 4Vedang Patel2015-11-051-17/+34
| | | | | | | | | | | | | | | | | | | | The struct snd_soc_tplg_pcm_dai is renamed to snd_soc_tplg_pcm. This struct will now be used to handle data related to PCMs (FE DAI & DAI links). It's not for BE, because BE DAI mappings will be provided by ACPI/FDT data. Remove the unused struct snd_soc_tplg_pcm_cfg_caps. We are using snd_soc_tplg_stream and snd_soc_stream_caps instead. Define the topology type for BE DAI link: SND_SOC_TPLG_TYPE_BACKEND_LINK. Define struct snd_soc_tplg_link_config to configure BE & CC links. Bump ABI version to 4. Signed-off-by: Vedang Patel <vedang.patel@intel.com> Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* topology: ABI - Add name element to snd_soc_tplg_streamVedang Patel2015-11-051-0/+1
| | | | | | | | | For codec-codec links, this struct will be mapped to the DAI links's params, which is struct snd_soc_pcm_stream and it needs a stream name. Signed-off-by: Vedang Patel <vedang.patel@intel.com> Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* hwdep: add FireWire digi00x/tascam driver supportTakashi Sakamoto2015-10-052-2/+6
| | | | | | | | | Linux 4.4 newly support these drivers. Their hardware dependent interfaces give functionalities to get hardware information, to lock/unlock kernel streaming and to receive lock status event. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* topology: Add API to set a vendor specific version numberMengdong Lin2015-09-231-0/+8
| | | | | | | | | | | | | This vendor-specific version number is optional. It will be written to the 'version' field of each block header of the binary toplogy data file. The vendor driver can check this number for further processing in kernel. The topology ABI version number is still stored in the 'abi' field of block headers. Signed-off-by: Mengdong Lin <mengdong.lin@intel.com> Reviewed-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: Fix doxygen for two enumsDavid Henningsson2015-08-241-8/+8
| | | | | | | The doxygen comments were wrong, making doxygen output weird. Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* topology: A API calls to directly build topology data from templatesMengdong Lin2015-08-121-0/+26
| | | | | | | | | Add some new API calls so that applications can directly build topology data using template structures. Signed-off-by: Mengdong Lin <mengdong.lin@intel.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* topology: Add C templates structure for building topology from C programsMengdong Lin2015-08-121-0/+176
| | | | | | | | | | | Define structures that can be used by applications to directly build topology data instead of using text files. The application will build up the topology data by populating the template structures for each object type and then registering the template with the topology core. Signed-off-by: Mengdong Lin <mengdong.lin@intel.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* core: add convenience macros to local.hLiam Girdwood2015-08-121-0/+7
| | | | | | | | | Move ARRAY_SIZE() from tplg_local.h to local.h and add container_of() macro to local.h. Both macros are generic but are initially used by topology. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* topology: Add ops support to byte control objects.Mengdong Lin2015-08-071-3/+6
| | | | | | | | | | Rename the control ops structure to make it more generic so we can use it with other objects like bytes controls. Add this structure to the byte control structure. Signed-off-by: Mengdong Lin <mengdong.lin@intel.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* topology: update ABI to improve support for different TLV object types.Mengdong Lin2015-08-071-6/+13
| | | | | | | | | | | | | | | | | | | | | | | | Currently the TLV topology structure is targeted at only supporting the DB scale data. This patch extends support for the other TLV types so they can be easily added at a later stage. TLV structure is moved to common topology control header since it's a common field for controls and can be processed in a general way. Users must set a proper access flag for a control since it's used to decide if the TLV field is valid and if a TLV callback is needed. Removed the following fields from topology TLV struct: - size/count: type can decide the size. - numid: not needed to initialize TLV for kcontrol. - data: replaced by the type specific struct. Added TLV structure to generic control header and removed TLV structure from mixer control. Signed-off-by: Mengdong Lin <mengdong.lin@intel.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* topology: Fix typosTakashi Iwai2015-07-301-9/+9
| | | | Signed-off-by: Takashi Iwai <tiwai@suse.de>
* topology: autotools: Add build support for topology coreLiam Girdwood2015-07-301-0/+4
| | | | | Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* topology: Add topology core parser.Liam Girdwood2015-07-301-0/+497
| | | | | | | | | The topology core parses the high level topology file and calls the individual object parsers when any new object element is detected at the high level. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* topology: uapi: Add UAPI headers for topology ABILiam Girdwood2015-07-303-1/+413
| | | | | Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* Replace list.h with its own versionTakashi Iwai2015-07-271-142/+70
| | | | | | | | | | | | | | | | We copied include/list.h from Linux kernel, and it's of course in GPLv2. This has raised concerns to many people, as it's not clear whether such a code is considered to be completely trivial, thus it might be seen as a derivative work, which takes effect in GPL, as suggested by Clemens. For clearing the situation, this patch replaces the existing list.h implementation from a new version. The API is kept to be compatible, but the codes were written from full scratch under LGPL, to be aligned with other alsa-lib codes. Reported-by: Clemens Lang <clemens.lang@bmw-carit.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: add support for get/set_audio_htstamp_configPierre-Louis Bossart2015-07-021-0/+44
| | | | | | | | Enable kernel-side functionality by letting user select what sort of timestamp it desires Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: add helper functions to query timestamping capabilitiesPierre-Louis Bossart2015-07-021-1/+2
| | | | | | | | extend support to link, link_estimated and link_synchronized timestamp. wall-clock is deprecated Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* Replace unsafe characters with _ in card nameAlexander E. Patrakov2015-06-291-0/+1
| | | | | | | | | | | Otherwise, they get misinterpreted as argument separators in USB-Audio PCM definitions, and thus prevent SPDIF blacklist entries from working. While at it, add my Logitec C910 webcam to the SPDIF blacklist. Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ucm: docs: Fix doxygen formatting for UCM main page.Liam Girdwood2015-06-291-11/+9
| | | | | | | Make sure group is defined and lists dipplayed correctly. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ucm: allow multiple devices in JackHWMuteTanu Kaskinen2015-05-181-8/+9
| | | | | | | | | | One jack may mute multiple devices, so let's make JackHWMute a list of device names instead of just a single device name. Signed-off-by: Tanu Kaskinen <tanu.kaskinen@linux.intel.com> Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Acked-by: Mark Brown <broonie@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>