OSDN Git Service
Hsin-Yu Chao [Wed, 13 Apr 2016 10:53:09 +0000 (18:53 +0800)]
ucm: add cset-tlv
This patch enables UCM to set a file in TLV format to kcontrol by:
cset-tlv "name='<kcontrol-name>' <path-to-file>"
This new 'cset-tlv' command will be used to write audio DSP to
specific alsa control, where the driver expectes a file in TLV
format.
The TLV file to set to kcontrol will be checked first by file size
not larger than 16 MB, and then examine if the length field reports
correct number of bytes in the TLV file.
Signed-off-by: Hsin-Yu Chao <hychao@chromium.org>
Reviewed-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Thu, 7 Apr 2016 07:29:49 +0000 (15:29 +0800)]
topology: Build data objects with tuples
For data objects with tuples, the parser will bind the vendor tuples
and tokens, copy the tuples to the private buffer of its parent data
object. Then later the builder will export the vendor tuples as private
binary data for the control or widgets objects.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Thu, 7 Apr 2016 07:29:43 +0000 (15:29 +0800)]
topology: Add support for parsing vendor tuples
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>
Mengdong Lin [Thu, 7 Apr 2016 07:29:36 +0000 (15:29 +0800)]
topology: Add support for vendor tokens
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>
Mengdong Lin [Thu, 7 Apr 2016 07:29:27 +0000 (15:29 +0800)]
topology: ABI - Define types for vendor tuples
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>
Mengdong Lin [Thu, 7 Apr 2016 07:29:15 +0000 (15:29 +0800)]
topology: Add doc for vendor tuples
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>
Mengdong Lin [Thu, 7 Apr 2016 07:29:01 +0000 (15:29 +0800)]
topology: Define a free handler for the element
This handler is defined for type-specific destruction of an element.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Thu, 7 Apr 2016 07:28:42 +0000 (15:28 +0800)]
topology: Use the generic pointer to free an element's object
The element is a wrapper for different types of objects.So use the
generic pointer 'obj' instead of the type-specific pointer to free
the object.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 7 Apr 2016 14:29:41 +0000 (16:29 +0200)]
pcm: Clean up error paths in snd_pcm_plugin_*() helpers
Minor code refactoring to unify the error return paths.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Shengjiu Wang [Wed, 6 Apr 2016 11:02:12 +0000 (19:02 +0800)]
pcm_plugin: fix appl pointer not correct when mmap_commit() return error
When snd_pcm_mmap_commit() return error, the appl pointer is also updated.
which cause the avail_update()'s result wrong.
This patch move the snd_pcm_mmap_appl_forward() to the place when
snd_pcm_mmap_commit() is successfully returned.
Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jaroslav Kysela [Thu, 31 Mar 2016 13:10:39 +0000 (15:10 +0200)]
Release v1.1.1
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Liam Girdwood [Mon, 14 Mar 2016 08:07:38 +0000 (08:07 +0000)]
topology: Add support for widget byte controls
Add support for DAPM widgets to include bytes controls.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Liam Girdwood [Mon, 14 Mar 2016 08:07:37 +0000 (08:07 +0000)]
topology: add support for CTL access flags to config file
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>
Liam Girdwood [Mon, 14 Mar 2016 08:07:36 +0000 (08:07 +0000)]
topology: add support for pasring external ops in conf files
Parsing external ops was missing from the conf files but was in the
C API. Fix this now by making sure we also check for external ops.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Liam Girdwood [Mon, 14 Mar 2016 08:07:35 +0000 (08:07 +0000)]
topology: Add ops to bytes control.
Byte controls can also support ops. Add them to the parser.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Qing Cai [Thu, 10 Mar 2016 12:40:51 +0000 (07:40 -0500)]
pcm: fix 'unable to create IPC shm instance' caused by fork from a thread
As stated in manpage SHMCTL(2), shm_nattch is "No. of current attaches"
(i.e., number of processes attached to the shared memeory). If an
application uses alsa-lib and invokes fork() from a thread of the
application, there may be the following execution sequence:
1. execute the following statement:
pcm_direct.c:110: dmix->shmptr = shmat(dmix->shmid, 0, 0)
(shm_nattch becomes 1)
2. invoke fork() in some thread.
(shm_nattch becomes 2)
3. execute the following statement:
pcm_direct.c:122: if (buf.shm_nattch == 1)
4. execute the following statement:
pcm_direct.c:131: if (dmix->shmptr->magic != SND_PCM_DIRECT_MAGIC)
(As stated in manpage SHMGET(2), "When a new shared memory segment
is created, its contents are initialized to zero values", so
dmix->shmptr->magic is 0)
5. execute the following statements:
pcm_direct.c:132: snd_pcm_direct_shm_discard(dmix)
pcm_direct.c:133: return -EINVAL
The above execution sequence will cause the following error:
unable to create IPC shm instance
This error causes multimedia application has no sound. This error rarely
occurs, probability is about 1%.
More notes about this patch:
this patch tries to address the race above by changing the condition
to identify "the first user". Until now, the first user was
identified by checking shm_nattch. But this is racy, as stated in the
above.
In this version, we try to assign a shm at first without IPC_CREAT.
If this succeeds, we are not alone, so we must not be the first user.
Only when this fails, try to get a shmem with IPC_CREAT and IPC_EXCL.
If this succeeds, we are the first user. And, one more notable point
is that the race of this function call itself is protected by
semaphore in the caller side. The only point to avoid is the race
after shmget() and the first initialization, and this method should
work around that.
Signed-off-by: Qing Cai <bsiice@msn.com>
Signed-off-by: Qing Cai <caiqing@neusoft.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Martin Koegler [Thu, 3 Mar 2016 21:39:37 +0000 (22:39 +0100)]
seq: Provide sequencer sound card number / PID via alsa-lib
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>
Takashi Iwai [Fri, 4 Mar 2016 09:57:32 +0000 (10:57 +0100)]
Update include/sound/asequencer.h from 4.6-pre kernel uapi
A few unimplemented ioctl definitions have been removed. Also
<sound/asound.h> is included locally, too.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 4 Mar 2016 09:52:18 +0000 (10:52 +0100)]
Update include/sound/asound.h from 4.6-pre kernel uapi
The inclusion of <linux/*.h> is done conditionally for Linux in order
to improve portability.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Thomas Klausner [Thu, 3 Mar 2016 14:08:04 +0000 (15:08 +0100)]
topology: Remove unnecessary includes
Headers are already included in local.h.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Thomas Klausner [Thu, 3 Mar 2016 11:58:07 +0000 (12:58 +0100)]
Use alphasort where versionsort is not available.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Thomas Klausner [Thu, 3 Mar 2016 11:57:34 +0000 (12:57 +0100)]
Only use F_SETSIG fcntl where it exists.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Thomas Klausner [Thu, 3 Mar 2016 11:56:58 +0000 (12:56 +0100)]
Add more compatibility defines.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Thomas Klausner [Thu, 3 Mar 2016 11:16:57 +0000 (12:16 +0100)]
Introduce bswap.h for portable definitions of byte swap macros.
Signed-off-by: Thomas Klausner <wiz@NetBSD.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Thomas Klausner [Wed, 2 Mar 2016 22:11:54 +0000 (23:11 +0100)]
Define some types if missing
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>
Thomas Klausner [Wed, 24 Feb 2016 13:15:10 +0000 (14:15 +0100)]
Define EBADFD in terms of EBADF if it doesn't exist.
For portability on FreeBSD, NetBSD and probably others.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Mon, 22 Feb 2016 13:13:31 +0000 (22:13 +0900)]
control: keep consistent usage of assertion
In most codes for control APIs, assertions are used to check given
arguments from applications. If the arguments are not expected, the
application is forced to abort. When NDEBUG is defined in the beginning
of the codes, no checks are performed.
Although, in snd_ctl_elem_set_bytes(), assertion is used with condition
statement. There's an intention to check the arguments regardless of
NDEBUG. However, this is not the same fashion in the codes.
This commit applies the same fashion to the function, to keep consistent
usage of assertion.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Sun, 21 Feb 2016 16:54:28 +0000 (01:54 +0900)]
control: initialize element channel values according to identification number at adding a new element
In ALSA control core, there're two ways to identify elements. One is by
numid. Another is by name/index. The former way is lighter than the latter
way.
In control API, after adding elements by snd_ctl_elem_add_integer() and
snd_ctl_elem_add_integer64(), these functions initialize value of each
channel. When executing this operation, used ID information is still given
by applications. Although, in this time, the element can be identified
according to numid.
This commit uses the numid instead of name/index pair.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Sun, 21 Feb 2016 16:54:19 +0000 (01:54 +0900)]
control: fulfill a description about element type with integer64
In UAPI of asound.h, there're 6 types of control element; boolean, integer,
enumerated, bytes, iec958 and integer64 (The none type seems to be added to
start the value at non-zero). Although, current description in alsa-lib
has a lack of integer64 type.
This commit fulfil the type.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Liam Girdwood [Mon, 1 Feb 2016 14:20:44 +0000 (14:20 +0000)]
topology: fix debug output to print correct "max" value.
Debug log is printing num_regs instead of max in the max section.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jaroslav Kysela [Tue, 12 Jan 2016 15:25:42 +0000 (16:25 +0100)]
coverity fixes
Jaroslav Kysela [Tue, 12 Jan 2016 15:07:16 +0000 (16:07 +0100)]
pcm_hw: fix possible memory leak (coverity)
Jaroslav Kysela [Tue, 12 Jan 2016 14:58:25 +0000 (15:58 +0100)]
control: add missing asserts to ctl_elem_set functions
Jaroslav Kysela [Tue, 12 Jan 2016 13:56:18 +0000 (14:56 +0100)]
config files - do not include ucm/topology configuration when not requested
Mengdong Lin [Thu, 19 Nov 2015 08:33:12 +0000 (03:33 -0500)]
topology: Quit and show error message on big-endian machines
This tool can only support little-endian machines atm.
Many codes directly refer to __le32/__le64 variables of ABI objects,
so will be broken on big-endian machines.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Thu, 19 Nov 2015 08:33:05 +0000 (03:33 -0500)]
topology: Not compare a for loop iterator with ABI __le32 variables
The iterator 'i' in a loop is a usually a integer. But ABI variables use
type _le32, which is converted to host unsigned integer. Comparing them
can cause gcc warning: comparison between signed and unsigned integer
expressions[-Wsign-compare].
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Wed, 18 Nov 2015 07:23:59 +0000 (02:23 -0500)]
topology: Fix comparison of unsigned expression < 0
Fix gcc warning: comparison of unsigned expression < 0 is always false
[-Wtype-limits]
The ABI object channel->id is _le32 and is converted to host unsigned
integer. It cannot be < 0.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Wed, 18 Nov 2015 07:23:19 +0000 (02:23 -0500)]
topology: Remove unused variables
Fix gcc warning when -Wunused-variable is set.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Wed, 18 Nov 2015 07:22:59 +0000 (02:22 -0500)]
topology: Remove unused function write_data_block()
Fix gcc warning: 'write_data_block' defined but not used
[-Wunused-function].
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Vinod Koul [Wed, 18 Nov 2015 13:42:46 +0000 (19:12 +0530)]
topology: open topology files with O_TRUNC
The topology file if exists needs to rewritten, so we need to open these
files with O_TRUNC flag as well
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Peter Rosin [Wed, 11 Nov 2015 15:11:10 +0000 (16:11 +0100)]
pcm: simple: Fix asserts
Do not error out on the boundaries.
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Takashi Iwai [Mon, 9 Nov 2015 12:37:26 +0000 (13:37 +0100)]
topology: Add missing include sys/stat.h
Necessary for proper definitions of S_IRUSR & co. Otherwise it
results in compile errors with old glibc:
parser.c: In function 'snd_tplg_build_file':
parser.c:262: error: 'S_IRUSR' undeclared (first use in this function)
parser.c:262: error: (Each undeclared identifier is reported only once
parser.c:262: error: for each function it appears in.)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jaroslav Kysela [Mon, 9 Nov 2015 07:39:18 +0000 (08:39 +0100)]
Release v1.1.0
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Takashi Iwai [Sat, 7 Nov 2015 10:29:13 +0000 (11:29 +0100)]
topology: Add missing prototypes for new functions
The prototypes for some functions that have been added in the recent
changes are missing, which leads to compile warnings. Let's fix.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Liam Girdwood [Fri, 6 Nov 2015 14:57:17 +0000 (14:57 +0000)]
topology: remove little endian type from userspace header
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>
Mengdong Lin [Thu, 5 Nov 2015 12:49:36 +0000 (20:49 +0800)]
topology: Add C API support for PCM
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>
Vedang Patel [Thu, 5 Nov 2015 12:49:23 +0000 (20:49 +0800)]
topology: Add C API support for BE and CC Links.
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>
Mengdong Lin [Thu, 5 Nov 2015 12:49:10 +0000 (20:49 +0800)]
topology: ABI - Rename dai_elems to pcm_elems in manifest
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>
Mengdong Lin [Thu, 5 Nov 2015 12:49:02 +0000 (20:49 +0800)]
topology: ABI - Change stream formats to a bitwise flag
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>
Vedang Patel [Thu, 5 Nov 2015 12:48:54 +0000 (20:48 +0800)]
topology: ABI - Use __le32 instead of __u32 in snd_soc_tplg_dapm_widget
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>
Vedang Patel [Thu, 5 Nov 2015 12:48:46 +0000 (20:48 +0800)]
topology: ABI - Remove unused struct snd_soc_tplg_stream_config
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>
Mengdong Lin [Thu, 5 Nov 2015 12:48:38 +0000 (20:48 +0800)]
topology: ABI - Remove tdm_slot & dai_fmt from snd_soc_tplg_stream
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>
Vedang Patel [Thu, 5 Nov 2015 12:48:30 +0000 (20:48 +0800)]
topology: ABI - Separate PCM & BE/CC link support and bump ABI version to 4
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>
Vedang Patel [Thu, 5 Nov 2015 12:48:18 +0000 (20:48 +0800)]
topology: ABI - Add name element to snd_soc_tplg_stream
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>
Mike Frysinger [Tue, 27 Oct 2015 21:28:04 +0000 (17:28 -0400)]
support building w/out System V shared memory
Some systems, like Android/Bionic, do not support SysV at all.
Let the configure script detect if the header is available, and
if not, automatically disable the pieces that require it.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mike Frysinger [Tue, 27 Oct 2015 21:28:03 +0000 (17:28 -0400)]
pcm: drop unused sys/shm.h inclusion
This header isn't used in these files, so stop trying to include it.
This helps builds on systems that don't provide the header (such as
Android/Bionic).
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mike Frysinger [Tue, 27 Oct 2015 21:27:55 +0000 (17:27 -0400)]
move page helpers to common code
If you build with --disable-pcm, the rawmidi code fails to link because
it uses the page_size helper declared in local.h, but the page_* funcs
are in the pcm mmap module. Move these funcs into conf.c so that they
are always available to the rest of the system.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 30 Oct 2015 16:13:50 +0000 (17:13 +0100)]
pcm: dmix: Handle slave PCM xrun and unexpected states properly
Currently, dmix & co plugins ignore the XRUN state of the slave PCM.
It's (supposedly) because dmix deals with the PCM in a free-wheel
mode, which is equivalent with XRUN. But, this difference (whether
the correct freewheel or XRUN) should be done by the kernel, and we
may have an XRUN state indeed (e.g. via xrun injection).
This patch fixes this lack of behavior, to handle PCM xrun and does
prepare when the slave PCM is in such a state.
Also, the patch consolidates the prepare callback for all dmix, dsnoop
and dshare plugins, and fix/cleanup a bit for dshare/dsnoop codes to
align with dsnoop code.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mike Frysinger [Fri, 9 Oct 2015 21:47:40 +0000 (17:47 -0400)]
fix _GNU_SOURCE handling & header inclusion
The configure script blindly adds -D_GNU_SOURCE to all build settings,
even on non-GNU systems. This isn't too much of a big deal (even if
it uses the wrong variable -- CFLAGS instead of CPPFLAGS), except that
the alsa-lib source itself determines whether to use GNU features when
this is defined (such as versionsort). So when we build on non-glibc
systems, we get build failures like:
src/ucm/parser.c:1268:18: error: 'versionsort' undeclared (first use in this function)
#define SORTFUNC versionsort
^
src/ucm/parser.c:1272:54: note: in expansion of macro 'SORTFUNC'
err = scandir(filename, &namelist, filename_filter, SORTFUNC);
^
The correct way to add these flags is to use the autoconf helper
AC_USE_SYSTEM_EXTENSIONS. Unfortunately, that triggers some more
bugs in the alsa build. This macro adds defines to config.h and
not directly to CPPFLAGS, so it relies on files correctly including
config.h before anything else. A number of alsa files do not do
this leading to build failures. The fix there is to shuffle the
includes around so that the local ones come first.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Mon, 5 Oct 2015 16:08:59 +0000 (01:08 +0900)]
hwdep: add FireWire digi00x/tascam driver support
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>
Takashi Iwai [Fri, 2 Oct 2015 09:55:36 +0000 (11:55 +0200)]
pcm: ladspa: Fix segfault due to a wrong channel reference
Because of a typo in referencing the input array in
snd_pcm_ladspa_allocate_memory(), ladpsa PCM plugin may cause a
segfault at prepare when input and and output channels are different:
#0 0x00007ffff78623ef in snd_pcm_ladspa_allocate_memory (pcm=0x626fa0, pcm=0x626fa0, pcm=0x626fa0, ladspa=0x621ad0) at pcm_ladspa.c:753
#1 snd_pcm_ladspa_init (pcm=0x626fa0) at pcm_ladspa.c:834
#2 0x00007ffff7842946 in snd_pcm_plugin_prepare (pcm=0x626fa0) at pcm_plugin.c:171
#3 0x00007ffff784290f in snd_pcm_plugin_prepare (pcm=0x62c760) at pcm_plugin.c:162
#4 0x000000000040256a in ?? ()
#5 0x00007ffff7222ec5 in __libc_start_main (main=0x401d80,a argc=4, argv=0x7fffffffde28, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffde18) at libc-start.c:287
#6 0x0000000000402fdd in ?? ()
This patch corrects the wrong reference.
Reported-and-tested-by: Andreas Hartmann <mail@andreashartmann.eu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Wed, 16 Sep 2015 09:07:13 +0000 (17:07 +0800)]
topology: Add API to set a vendor specific version number
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>
Khem Raj [Tue, 15 Sep 2015 15:48:02 +0000 (18:48 +0300)]
build: Do not try to detect cross-compiler
cross compilers are passed via path may not be a gcc based cross
compiler in such cases this check fails and try's to force gcc based
cross compiler detection, This code is a convenience that limits the
build system
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 8 Sep 2015 20:15:02 +0000 (22:15 +0200)]
topology: pcm: Remove unused variables
Fix gcc warnings:
pcm.c: In function ‘tplg_parse_stream_cfg’:
pcm.c:160:6: warning: unused variable ‘ret’ [-Wunused-variable]
int ret;
^
pcm.c: In function ‘split_format’:
pcm.c:267:13: warning: unused variable ‘ret’ [-Wunused-variable]
int i = 0, ret;
^
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 8 Sep 2015 20:13:50 +0000 (22:13 +0200)]
topology: parser: Add missing return value to snd_tplg_set_manifest_data()
Spotted by gcc warning:
parser.c: In function ‘snd_tplg_set_manifest_data’:
parser.c:361:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 8 Sep 2015 20:11:48 +0000 (22:11 +0200)]
topology: data: Fix wrong size check in tplg_parse_data_hex()
A wrong, uninitialized variable is referred as the size to check in
tplg_parse_data_hex(). Spotted by gcc warning:
data.c: In function ‘tplg_parse_data_hex’:
data.c:228:5: warning: ‘esize’ may be used uninitialized in this function [-Wmaybe-uninitialized]
if (esize > TPLG_MAX_PRIV_SIZE) {
^
data.c:211:12: note: ‘esize’ was declared here
int size, esize, off, num;
^
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 8 Sep 2015 20:09:44 +0000 (22:09 +0200)]
topology: ctl: Fix access type checks
Fix the wrong bit-and check by adding parentheses properly:
ctl.c: In function ‘tplg_add_bytes’:
ctl.c:868:22: warning: suggest parentheses around comparison in operand of ‘&’ [-Wparentheses]
if (be->hdr.access & SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE
^
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 8 Sep 2015 20:04:48 +0000 (22:04 +0200)]
topology: builder: Fix possibly uninitialized variable in write_elem_block()
When an empty list is passed to write_elem_block(), it may leave
vendor_type uninitialized.
builder.c: In function ‘write_elem_block’:
builder.c:127:8: warning: ‘vendor_type’ may be used uninitialized in this function [-Wmaybe-uninitialized]
ret = write_block_header(tplg, tplg_type, vendor_type,
^
builder.c:114:33: note: ‘vendor_type’ was declared here
int ret, wsize = 0, count = 0, vendor_type;
^
Add an immediate return for count = 0 for avoiding it, and simplify
the code initializing vendor_type without using a one-shot loop.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 8 Sep 2015 19:48:17 +0000 (21:48 +0200)]
pcm: route: Remove bogus ! in snd_config_get_id() checks
There are strange "!" added before snd_config_get_id() return value
checks in a couple of places in pcm_route.c. This essentially makes
the result always positive, making checks bogus.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 8 Sep 2015 18:57:47 +0000 (20:57 +0200)]
pcm: ioplug,extplug: Fix logic errors in type checks
A few error checks are wrongly performed with logical and (&&) instead
of logical or (||), which condition never met.
Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
David Henningsson [Mon, 24 Aug 2015 18:37:29 +0000 (20:37 +0200)]
pcm: Fix doxygen for two enums
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>
Mengdong Lin [Tue, 11 Aug 2015 17:23:17 +0000 (18:23 +0100)]
topology: A API calls to directly build topology data from templates
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>
Mengdong Lin [Tue, 11 Aug 2015 17:23:16 +0000 (18:23 +0100)]
topology: Add C templates structure for building topology from C programs
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>
Liam Girdwood [Tue, 11 Aug 2015 17:23:15 +0000 (18:23 +0100)]
core: add convenience macros to local.h
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>
Liam Girdwood [Mon, 10 Aug 2015 18:13:47 +0000 (19:13 +0100)]
topology: rename OBJECT_TYPE_ to SND_TPLG_TYPE_
rename OBJECT_TYPE_ to SND_TPLG_TYPE_ in preparation for exporting via
a new public API.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Liam Girdwood [Fri, 7 Aug 2015 15:39:16 +0000 (16:39 +0100)]
topology: print error prefix on error message.
Let the user know it's an error.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Fri, 7 Aug 2015 15:39:15 +0000 (16:39 +0100)]
topology: treat all DAPM controls types the same when copying
Copy all DAPM controls types using the same method.
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>
Mengdong Lin [Wed, 5 Aug 2015 13:41:51 +0000 (14:41 +0100)]
topology: Add ops support to byte control objects.
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>
Mengdong Lin [Wed, 5 Aug 2015 13:41:50 +0000 (14:41 +0100)]
topology: update ABI to improve support for different TLV object types.
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>
Mengdong Lin [Tue, 4 Aug 2015 17:09:46 +0000 (18:09 +0100)]
topology: Add support for writing manifest private data.
Allow manifest to contain private data and write this data to file.
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>
Jin Yao [Tue, 4 Aug 2015 17:09:12 +0000 (18:09 +0100)]
topology: Add element ID so we can look up references by name.
Add support to lookup elements by name. This is in preparation for adding
some new API calls that will allow building topology data using a C API. This
will allow applications to build their own topology data directly.
Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Liam Girdwood [Tue, 4 Aug 2015 17:06:55 +0000 (18:06 +0100)]
topology: fix element object type is switch()
Use the correct type for this object.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 30 Jul 2015 14:43:19 +0000 (16:43 +0200)]
topology: Fix typos
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 30 Jul 2015 14:34:50 +0000 (16:34 +0200)]
topology: Fix missing inclusion of ctype.h
Fix a compile warning:
data.c:116:7: warning: implicit declaration of function 'isspace' [-Wimplicit-function-declaration]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Liam Girdwood [Wed, 29 Jul 2015 16:45:25 +0000 (17:45 +0100)]
conf: topology: Add topology file for broadwell audio DSP
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Liam Girdwood [Wed, 29 Jul 2015 16:45:24 +0000 (17:45 +0100)]
topology: doxygen: Add doxygen support for topology core.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Liam Girdwood [Wed, 29 Jul 2015 16:45:23 +0000 (17:45 +0100)]
topology: autotools: Add build support for topology core
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Liam Girdwood [Wed, 29 Jul 2015 16:45:22 +0000 (17:45 +0100)]
topology: Add binary file builder.
Build the binary output file from all the locally parsed objects and elements.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Liam Girdwood [Wed, 29 Jul 2015 16:45:21 +0000 (17:45 +0100)]
topology: Add Channel map parser.
Add support for parsing channel map to control registers.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Liam Girdwood [Wed, 29 Jul 2015 16:45:20 +0000 (17:45 +0100)]
topology: Add CTL parser
Add support to parse mixers, enums and byte controls.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Liam Girdwood [Wed, 29 Jul 2015 16:45:19 +0000 (17:45 +0100)]
topology: Add DAPM object parser
Parse DAPM objects including widgets and graph elements.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Liam Girdwood [Wed, 29 Jul 2015 16:45:18 +0000 (17:45 +0100)]
topology: Add private data parser
Parse private data and store for attachment to other objects. Data can come
file or be locally defined as bytes, shorts or words.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Liam Girdwood [Wed, 29 Jul 2015 16:45:17 +0000 (17:45 +0100)]
topology: Add operations parser
Parse operations so we can bind them to kcontrols in the kernel.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Liam Girdwood [Wed, 29 Jul 2015 16:45:16 +0000 (17:45 +0100)]
topology: Add PCM parser.
Parse PCM configurations and capabilities. These can then be used to define
the capabilities and config for FE DAI links, PCM devices and
codec <-> codec style links.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Liam Girdwood [Wed, 29 Jul 2015 16:45:15 +0000 (17:45 +0100)]
topology: Add text section parser.
Parse text lists (like enum values) and store for later attachment
to other objects.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Liam Girdwood [Wed, 29 Jul 2015 16:45:14 +0000 (17:45 +0100)]
topology: Add topology core parser.
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>
Liam Girdwood [Wed, 29 Jul 2015 16:45:13 +0000 (17:45 +0100)]
topology: uapi: Add UAPI headers for topology ABI
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 27 Jul 2015 10:32:37 +0000 (12:32 +0200)]
Replace list.h with its own version
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>
Martin Geier [Fri, 24 Jul 2015 07:30:57 +0000 (09:30 +0200)]
pcm: restore hw params on set latency failed
When method snd_pcm_set_params sets sample rate to 22050 and latency to 50000
to davinci soc driver method snd_pcm_hw_params_set_buffer_time_near fails
and variable params is already changed in the method so the next method
snd_pcm_hw_params_set_period_time_near fails also.
Signed-off-by: Martin Geier <martin.geier@streamunlimited.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Pierre-Louis Bossart [Wed, 1 Jul 2015 20:40:58 +0000 (15:40 -0500)]
test: audio_time: show report validity and accuracy
Add checks to show if driver reports valid report and resolution
information. disabled by default
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>