Commit graph

2895 commits

Author SHA1 Message Date
Patrick Welche
b669b50de2 autotools: update style
- rename configure.in to configure.ac
- replace INCLUDES with AM_CPPFLAGS
- modernize AM_INIT_AUTOMAKE invocation

Signed-off-by: Patrick Welche <prlw1@cam.ac.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-02-26 08:16:22 +01:00
Patrick Welche
7a6e8ca348 Portability fix: look for sys/endian.h as well as endian.h
- define __BYTE_ORDER and friends.
- adjust asoundlib.h accordingly.

Signed-off-by: Patrick Welche <prlw1@cam.ac.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-02-24 11:00:53 +01:00
David Henningsson
1af088e39b conf: Add surround 2.1 support to all cards
All cards that support 4.1 surround now also support 2.1 surround,
because they both have surround 5.1 as slave.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-02-18 17:14:13 +01:00
David Henningsson
57b5076c30 conf: Add basic infrastructure for 2.1 surround sound
For now, we do 2.1 over 5.1, because that's what ALSA allows per default.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-02-18 17:14:04 +01:00
Riku Voipio
326c6802e4 alsa-lib: heavy pcm atomics cleanup
The following patch comes from the realization that at least ARM code
for atomics is quite broken and nobody has cared for a decade.

A quick dive shows that only snd_atomic_{read,write}_{begin,end}
appear to be used widely. These are implemented using wmb/rmb.

Only other use of atomic functions is in pcm_meter.c.
The #SND_PCM_TYPE_METER plugin type appears rarely, if ever, used.
I presume these days anyone who wants a meter/scope will do in pulseaudio
layer instead of alsa.

It would seem better fit to have pcm_meter in alsa-plugins instead
of alsa-lib, but I guess that would be an ABI break...

So instead, I'm proposing here

1. Removal of all hand-crafted atomics from iatomic.h apart from barriers,
   which are used in snd_atomic_{read,write}_{begin,end}.

2. Using __sync_synchronize as the default fallback for barriers. This
   has been available since gcc 4.1, so it shouldn't be a problem.

3. Defining the few atomics used by pcm_meter.c withing pcm_meter.c
   itself, using gcc atomic builtins[1].

4. Since gcc atomic builtins are available only since gcc 4.7, add a check for
   that in gcc configure.in, and don't build pcm meter plugin if using
   older gcc.

The last point has the impact, that if there actually is someone who 1)
uses the meter plugin 2) wants to upgrade to 2014 alsa-lib 3) but
does not want to use a 2012+ gcc - that someone will be inconvenienced.

Finally remove the unneeded configure check for cpu type. We can
trust the gcc to set right flags for us.

[1] http://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html

Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-02-11 13:45:16 +01:00
Olivier Langlois
66f07aa3b7 pcm: use CLOCK_REALTIME for non-monotonic ts
gettimeofday() is the same than clock_gettime(CLOCK_REALTIME)
except for the loss of precision and the double unnecessary
conversion timespec <-> timeval.

Signed-off-by: Olivier Langlois <olivier@trillion01.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-01-24 13:54:15 +01:00
Takashi Iwai
507cdc1318 pcm: initialize monotonic field for dshare and dsnoop, too
Just like the previous fix for dmix, we need update for dshare and
dsnoop plugins.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-01-23 09:46:37 +01:00
Olivier Langlois
e51cd44897 pcm: initialize pcm_dmix monotonic field
not doing so, leaves the pcm object in an inconsistent state since
'info' field is copied from the slave which is then used when
snd_pcm_hw_params_is_monotonic() is called.

For instance, when using dmix with aplay and an underrun is occuring, the following
info is returned:

underrun!!! (at least 1248687948.256 ms long)
Status:
  state       : XRUN
  trigger_time: 1390347762.628483000
  tstamp      : 1390347766.184350000
  delay       : -635
  avail       : 15687
  avail_max   : 15675

now is computed from CLOCK_MONOTONIC while pcm status tstamps are from gettimeofday().

After the fix, underruns are still occuring on my setup but at least the displayed info
is correct:

underrun!!! (at least 7630.409 ms long)
Status:
  state       : XRUN
  trigger_time: 7652.739201431
  tstamp      : 7660.369600636
  delay       : -624
  avail       : 15676
  avail_max   : 15664

Signed-off-by: Olivier Langlois <olivier@trillion01.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-01-23 09:42:01 +01:00
Ivan Sorokin
336dc58beb control_hw: fix potential memory leak
Signed-off-by: Ivan Sorokin <vanyacpp@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-01-22 07:40:46 +01:00
Olivier Langlois
3baf1bee84 alsa-lib: minor typo in pcm doc
Added a missing 'f' in the word 'diferent'

Signed-off-by: Olivier Langlois <olivier@trillion01.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2014-01-06 09:07:11 +01:00
Olivier Langlois
670e228c69 minor malloc changes
replace malloc + memset with calloc since calloc may skip the memset if
returned memory comes directly from sbrk()

use malloc instead of malloc if first thing done with allocated memory is
to flip all bits to 1.

Signed-off-by: Olivier Langlois <olivier@trillion01.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-12-13 09:43:51 +01:00
Takashi Iwai
49ad6699e6 dmix: Don't use assert() and abort()
We seem to still have some races at closing a dmix stream, but
aborting is the worst option.  Let's make not melt down.

Reference: https://bugzilla.novell.com/show_bug.cgi?id=852446
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-11-27 09:37:54 +01:00
Andrey Mazo
29d89ba045 pcm_file: document new argument to snd_pcm_file_open().
Document function argument, added in commit
4081be0b87.

Signed-off-by: Andrey Mazo <mazo@telum.ru>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-11-18 09:19:13 +01:00
Andrey Mazo
4081be0b87 pcm_file: don't touch infile on playback and output file on capture.
Commit 1d80c5b901 message describes
behaviour in case of specified infile option as
'No file writes will take place in this case'.
But this is clearly not the case as output file gets truncated while
running `arecord -Dtestin >/dev/null`, where "testin" is defined as
pcm.testin {
	type file
	slave.pcm null
	file "/tmp/qqqq.out"
	infile "/tmp/qqqq.in"
	format "raw"
}

Besides that, the existing behaviour is rather counterintuitive,
requiring both output and input files to exist and making access to them
regardless of playback or capture intention.
Also, it's very confusing to get output file truncated while trying to
just capture from the device.

Current changeset introduces the following behaviour:
 - output file ("file" option) is only (p)open()'ed for writing
   only on playback to the device
 - any data is written to the output file descriptor
   (provided with "file" option) only on playback to the device
 - input file ("infile" option) is only open()'ed for reading only on
   capture from the device
 - any data is read from the input file descriptor
   (provided with the "infile" option) only on capture from the device

Signed-off-by: Andrey Mazo <mazo@telum.ru>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-11-17 10:15:42 +01:00
Andrey Mazo
e017c5f2df pcm_file: fixed memory leak.
Valgrind report for this leak was:

Command: aplay -Dfile:'/tmp/qqq',raw qqq.wav

14 bytes in 1 blocks are definitely lost in loss record 1 of 2
   at 0x402BF5C: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
   by 0x40D7557: snd_pcm_file_hw_params (in /usr/lib/libasound.so.2.0.0)
   by 0x40BA093: _snd_pcm_hw_params_internal (in /usr/lib/libasound.so.2.0.0)
   by 0x40AB831: snd_pcm_hw_params (in /usr/lib/libasound.so.2.0.0)
   by 0x804C523: ??? (in /usr/bin/aplay)
   by 0x804E5B7: ??? (in /usr/bin/aplay)
   by 0x804FC8C: ??? (in /usr/bin/aplay)
   by 0x80520FB: ??? (in /usr/bin/aplay)
   by 0x4184942: (below main) (libc-start.c:226)

Signed-off-by: Andrey Mazo <mazo@telum.ru>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-11-17 10:15:34 +01:00
Andrey Mazo
1919ee473d pcm_file: fix SEGFAULT if file option is missing while infile is not.
Commit 5c5f135812 requires both file and
infile options to be missing to report a failure.
In fact, only file option is mandatory and should be checked there.
Otherwise, NULL file triggers segfault in
snd_pcm_file_replace_fname() called from
snd_pcm_file_open_output_file().
infile option is optional, so don't report fatal error if it's missing.

Signed-off-by: Andrey Mazo <mazo@telum.ru>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-11-17 10:15:26 +01:00
Timo Teräs
ae035b7fe5 conf.c: use portable way to initialize recursive mutex
PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP is not in POSIX, as _NP
(non-portable) suggests.

exposing such a symbol in musl libc would lock in the ABI for all
times and makes it impossible to do future changes to the under-
lying struct without hideous symbol versioning hacks.

use the portable way instead: pthread_once was designed for such
cases.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Tested-by: John Spencer <maillist-alsa@barfooze.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2013-11-08 14:55:58 +01:00
Jaroslav Kysela
7d06b3ed9f include/global.h - don't define timeval and timespec structures for !glibc
On request from John Spencer <maillist-alsa@barfooze.de> .

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2013-11-08 12:34:44 +01:00
Takashi Iwai
2d6eb4e9ba test/chmap: Add missing usage text for -s option
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-11-04 14:19:03 +01:00
John Spencer
10ecf963ca local.h: include sys/types.h to fix issues with pcm.h
sys/types.h is required for the u_int_XX types used by pcm.h.
since a change in pcm.h is not desired, we add the inclusion
to the header that includes pcm.h during build.

Signed-off-by: John Spencer <maillist-alsa@barfooze.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-11 09:29:05 +02:00
Waldemar Brodkorb
c1fbd57c38 remove unnecessary/obsolete compat/hsearch_r.c
The usage of hsearch functions where removed long time
ago in commit 273d115de0.
This patch highly increases portability for non-glibc systems.

Remove the complete compat directory as requested by
Takashi Iwai.

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-07 10:16:19 +02:00
Stephen Warren
529706fc32 snd_tlv_convert_from_dB: fix decreasing gain across entries
Currently, for a TLV consisting of TLV_DB_SCALE_ITEMs, if e.g. alsamixer
calls snd_mixer_selem_set_playback_dB() with a value that is in-between
two TLV_DB_SCALE_ITEMs, and xdir is negative, the selected raw hardware
value is the minimum in the first range above that value, rather than the
maximum in the last range below that value.

The user-visible symptom is that in alsamixer, pressing the down key to
reduce the value sticks at certain points, and cannot be incrementally
reduced any further, although directly selecting a much lower value (e.g.
by pressing 0..9) works as expected. This is triggered e.g. by
sound/soc/codec/max98090.c's max98090_hp_tlv[].

Fix this by checking whether xdir is positive or not, rather than
checking whether it has a non-zero value. The code to select the previous
range's max value is already present. This matches how xdir is used in
other parts of the code.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-01 12:24:45 +02:00
Anssi Hannula
383912ef83 HDA-Intel: present up to 8 HDMI/DP outputs via "hdmi" device
Some new AMD cards have HDA codecs presenting 6 connected HDMI/DP pin
nodes (plus 1 unconnected pin node) according to the ALSA card database.

Example:
http://www.alsa-project.org/db/?f=de3ced7af41de0ed54d218650e5e2f16c511787b

Bump the maximum number of presented HDMI outputs per card via the
"hdmi" PCM from 4 to 8 (so that the last possible device is DEV=7).

Note that HDMI PCM devices DEV=4..7 use shared PCM device numbers, so
HDA cards that have over 4 audio PCM devices or multiple S/PDIF or modem
devices will have their remaining PCM devices misrepresented as HDMI
devices.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-09-26 12:01:33 +02:00
David Henningsson
23bf1dce94 Fix access of freed memory in namehints
Sometimes a hook manipulates the config tree, which makes currently
running iterators point to freed memory. As a workaround, make two
copies, one for the iterators and another for the hooks.

BugLink: https://bugs.launchpad.net/bugs/1008600
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-09-19 18:44:03 +02:00
Kai Kang
f21f48a70f Update iatomic.h functions definitions for mips
Functions atomic_add(s) and atomic_sub(s) are defined with 'extern
__inline__' that may cause compile fails when cross compile for mips.
The error message looks like:

| pcm/.libs/libpcm.a(pcm_meter.o): In function `snd_pcm_meter_update_scope':
| .../alsa-lib-1.0.27.2/src/pcm/pcm_meter.c:139: undefined reference to `atomic_sub'

Replace the 'extern __inline__' with 'static __inline__' to fix this
issue.

Signed-off-by: Kai Kang <jiashuo.kang at gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-08-22 10:40:32 +02:00
Adrian Knoth
4b169b05b4 hdspm.h: Update LTC ioctl to use struct hdspm_ltc
Use struct hdspm_ltc to query the LTC, using a mixer struct was just
plain wrong.

Due to the wrong struct, this ioctl was never working, so we're free to
fix it without breaking userspace compatibility.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-08-19 20:13:55 +02:00
Arun Raghavan
36bc577040 UCM: Document some standard values
Playback/CaptureChannels has been around for a bit. Playback/CaptureRate
is new and is intended to be used to specify the sample rate at which
the Playback/CapturePCM should be opened.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-08-08 12:31:05 +02:00
Laurentiu Nicola
d469ebe2ef pcm: Fix a wrong value shown in the error message in rate plugin
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-08-08 12:29:09 +02:00
Przemek Rudy
994ab14b40 conf/cards: add Audio Advantage Micro II
With related kernel chnages add extended suport for:
- AES bits controls (via device suffix AESn= or tools like iecset)
- SPDIF switch control, turning on/off the optical transmitter (via alsamixer tool)

Signed-off-by: Przemek Rudy <prudy1@o2.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-07-31 08:05:34 +02:00
Jaroslav Kysela
b3b53a1bec local.h: use __kernel_off_t from <linux/types.h>
Also, make the empty definitions __user and __force conditional.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2013-07-23 14:50:41 +02:00
Jaroslav Kysela
12a2928b9d Release v1.0.27.2
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2013-07-08 14:31:36 +02:00
Krzysztof Hałasa
9d6736c9a2 pcm_direct: fix SEGFAULT when getgrnam_r() returns 0 and pgrp is NULL
Signed-off-by: Krzysztof Halasa <khalasa@piap.pl>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2013-06-14 14:13:55 +02:00
David Henningsson
c91785e002 pcm_hw: Fix buffer overflow in chmap
We can't calculate memory storage in bytes, when we're supposed
to store ints in it!

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2013-06-14 14:09:55 +02:00
David Henningsson
d20e24e5d1 chmap: Always succeed setting the map to what it already is
If we try to set the channel map to what it already is, this should
always succeed. E g, speaker-test can do this sometimes.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-06-05 17:56:03 +02:00
Jaroslav Kysela
ca487c9511 pcm_direct: fix the memory leak when parsing the slave definitions
Reported-by: <bolsunov@telum.ru>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2013-06-04 15:58:34 +02:00
David Henningsson
f2d39afe61 pcm_plugin: Fix return value of snd_pcm_rewind
In case the rewind did not rewind as much as expected, e g due to
time delay between the latest avail update and the rewind, we must
properly account for that in the plugin layer.

Otherwise, the plugin's appl ptr and the hw's appl ptr become
unsynchronised, which is very bad, especially in mmap_shadow plugins,
e g, this could cause the overlapping memcpy in the softvol plugin
as seen here:
https://bugs.freedesktop.org/show_bug.cgi?id=64299

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2013-05-30 14:04:15 +02:00
David Henningsson
7f877543a3 pcm_hw: Remove unused fields in struct
These fields are not used, and their name similarity to other
fields are quite confusing when trying to debug alsa-lib.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2013-05-30 14:04:05 +02:00
Takashi Iwai
2f43b66c06 Allow specifying the max number of cards
Add --with-max-cards option to specify the max number of cards in
configure script, when the support for more than 32 cards is
required.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-05-24 17:21:15 +02:00
Juho Hämäläinen
14d653d7c3 ucm: Fix segfault when device argument is missing from _sw{dev, mod}
Signed-off-by: Juho Hämäläinen <juho.hamalainen@tieto.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-05-24 13:03:54 +02:00
Jordi Mallach
3d7433a3c8 pcm: Fix typo in documentation: PREPARE → PREPARED.
Signed-off-by: Jordi Mallach <jordi@debian.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-05-23 14:52:04 +02:00
Jaroslav Kysela
49858e7b2f Release v1.0.27.1
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2013-05-21 10:48:28 +02:00
Olivier Langlois
f646b7e8b3 Remove an obsolete macro in configure.in
Replaced AM_CONFIG_HEADER with AC_CONFIG_HEADERS

lano1106@whippet2 ~/dev/alsa-lib $ ./gitcompile
aclocal: warning: autoconf input should be named 'configure.ac', not 'configure.in'
configure.in:56: error: 'AM_CONFIG_HEADER': this macro is obsolete.
    You should use the 'AC_CONFIG_HEADERS' macro instead.
/usr/share/aclocal-1.13/obsolete-err.m4:12: AM_CONFIG_HEADER is expanded from...
configure.in:56: the top level
autom4te: /usr/bin/m4 failed with exit status: 1
aclocal: error: echo failed with exit status: 1

Signed-off-by: Olivier Langlois <olivier@trillion01.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-05-16 15:41:47 +02:00
Jordi Mallach
39a4dad148 Fix several spelling errors for “writable” and derivatives.
Signed-off-by: Jordi Mallach <jordi@debian.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-05-16 10:13:49 +02:00
Steve Langasek
b906db19ef Compile in the ALSA search path instead of relying on ld.so.conf.
The Ubuntu package currently uses ld.so.conf.d fragments to add
/usr/lib/alsa-lib and /usr/lib{32,64}/alsa-lib to the dlopen search path.
These don't *belong* on the global search path, and it becomes much more
problematic to put them there with the advent of multiarch because each
architecture then needs its own distinct config file to add the separate
path... which is then also put in the global library namespace.  Instead,
let ALSA make use of the already defined ALSA_PLUGIN_DIR to look up
plugins.

Signed-off-by: Jordi Mallach <jordi@debian.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-05-16 10:13:28 +02:00
Jordi Mallach
2b84ab0514 Add AM_MAINTAINER_MODE.
Add AM_MAINTAINER_MODE([enable]) to configure.in.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-05-16 10:09:39 +02:00
Dylan Reid
93325038db conf/ucm: DAISY-I2S: Set default filter mode for HiFi.
Default to music mode filter for the HiFi use case on the Samsung ARM
Chromebook.  This mode is better at 44.1k and 48k audio than the
"Voice" setting.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-05-14 21:19:28 +02:00
Takashi Iwai
c6ac8ddde9 conf/ucm: Set up for installation
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-05-14 18:11:01 +02:00
Marcin Juszkiewicz
52de910868 conf/ucm: tegraalc5632: add UCM config from Ubuntu
Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-05-14 17:56:44 +02:00
Marcin Juszkiewicz
7db247be11 conf/ucm: SDP4430: add UCM config from Ubuntu
Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-05-14 17:56:14 +02:00
Marcin Juszkiewicz
9d0f93af0b conf/ucm: PandaBoardES: add UCM config from Ubuntu
Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-05-14 17:55:48 +02:00