Commit graph

3072 commits

Author SHA1 Message Date
Mike Frysinger
7e90867487 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>
2015-11-05 14:37:10 +01:00
Mike Frysinger
5a24987575 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>
2015-11-05 14:37:10 +01:00
Takashi Iwai
8985742d91 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>
2015-11-05 14:37:10 +01:00
Mike Frysinger
99dc70f023 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>
2015-10-12 10:36:15 +02:00
Takashi Sakamoto
08c4b3b0ad 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>
2015-10-05 23:43:29 +02:00
Takashi Iwai
f07e9af7ee 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>
2015-10-02 11:55:36 +02:00
Mengdong Lin
8b0a5310bf 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>
2015-09-23 10:45:52 +02:00
Khem Raj
c82417650a 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>
2015-09-23 10:39:01 +02:00
Takashi Iwai
9a2fe5399c 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>
2015-09-08 22:15:02 +02:00
Takashi Iwai
e38b13f128 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>
2015-09-08 22:14:19 +02:00
Takashi Iwai
5b21400c42 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>
2015-09-08 22:11:48 +02:00
Takashi Iwai
f41fe763e9 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>
2015-09-08 22:09:44 +02:00
Takashi Iwai
76b9cae026 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>
2015-09-08 22:08:22 +02:00
Takashi Iwai
03d6b15291 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>
2015-09-08 21:48:17 +02:00
Takashi Iwai
fe8bb1fe02 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>
2015-09-08 20:57:47 +02:00
David Henningsson
3313f8740d 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>
2015-08-24 22:26:11 +02:00
Mengdong Lin
5b518c9159 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>
2015-08-12 16:42:37 +02:00
Mengdong Lin
1b148ef590 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>
2015-08-12 16:39:46 +02:00
Liam Girdwood
ab9633d581 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>
2015-08-12 16:39:27 +02:00
Liam Girdwood
634712d21c 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>
2015-08-11 15:33:40 +02:00
Liam Girdwood
b47cf00197 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>
2015-08-07 17:53:44 +02:00
Mengdong Lin
ecf7fdaeef 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>
2015-08-07 17:53:37 +02:00
Mengdong Lin
80a8283d17 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>
2015-08-07 17:52:41 +02:00
Mengdong Lin
8c8372cc06 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>
2015-08-07 17:52:27 +02:00
Mengdong Lin
d5e7e8bb38 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>
2015-08-05 08:06:19 +02:00
Jin Yao
120b3b8ead 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>
2015-08-05 08:05:56 +02:00
Liam Girdwood
1bb4c2fc30 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>
2015-08-05 08:05:40 +02:00
Takashi Iwai
66ce9f9a11 topology: Fix typos
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-07-30 17:10:42 +02:00
Takashi Iwai
907e464593 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>
2015-07-30 17:10:42 +02:00
Liam Girdwood
00a51b5bac 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>
2015-07-30 17:10:32 +02:00
Liam Girdwood
22603237b0 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>
2015-07-30 17:10:18 +02:00
Liam Girdwood
fec1e8f253 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>
2015-07-30 17:10:14 +02:00
Liam Girdwood
1d1dff5676 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>
2015-07-30 16:21:52 +02:00
Liam Girdwood
9764a4b891 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>
2015-07-30 16:21:52 +02:00
Liam Girdwood
694b857ce7 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>
2015-07-30 16:21:51 +02:00
Liam Girdwood
01a0e1a1c2 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>
2015-07-30 16:21:51 +02:00
Liam Girdwood
5b379da2a0 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>
2015-07-30 16:21:50 +02:00
Liam Girdwood
353f1eddb6 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>
2015-07-30 16:21:50 +02:00
Liam Girdwood
4db19506c3 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>
2015-07-30 16:21:49 +02:00
Liam Girdwood
408396a8ca 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>
2015-07-30 16:21:49 +02:00
Liam Girdwood
37692bb985 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>
2015-07-30 16:21:48 +02:00
Liam Girdwood
227c790c16 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>
2015-07-30 16:21:47 +02:00
Takashi Iwai
d0e13f8774 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>
2015-07-27 12:39:54 +02:00
Martin Geier
77b6be6387 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>
2015-07-24 18:19:37 +02:00
Pierre-Louis Bossart
6849d7dc88 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>
2015-07-02 17:02:05 +02:00
Pierre-Louis Bossart
7bb3a74c4d test: fix audio_time with new get/set audio_tstamp_config
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-07-02 17:02:04 +02:00
Pierre-Louis Bossart
cc8b73436a pcm: add support for new STATUS_EXT ioctl
use STATUS_EXT ioctl if PCM protocol is > 2.0.12
All audio timestamp configuration will be ignored with an
older protocol.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-07-02 17:02:04 +02:00
Pierre-Louis Bossart
6ec2464f39 pcm: add support for get/set_audio_htstamp_config
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>
2015-07-02 17:02:03 +02:00
Pierre-Louis Bossart
6cb31b4444 pcm: add helper functions to query timestamping capabilities
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>
2015-07-02 17:02:03 +02:00
Alexander E. Patrakov
4dc44bb34a Replace unsafe characters with _ in card name
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>
2015-06-29 20:33:26 +02:00