Commit graph

2322 commits

Author SHA1 Message Date
Takashi Iwai
dbb7eca655 Remove unused hostname resolution in shm plugins and aserver
PCM and control shm plugins and aserver have some codes to resolve the
host address and check whether it's a local host although the given
address is never used.  In addition, the code contains gethostbyname()
that is known to be obsoleted.  So, let's get rid of all these unused
codes.

The host configuration item is still accepted (but just ignored) for
keeping the compatibility.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-01-28 16:23:06 +01:00
Lu, Han
6ea14c3624 ucm: add binary configure file parse
with cset command, UCM set kcontrol parameters directly:
    cset "name='<KCONTROL_NAME>' 1<,2,3,...>"
This patch enables UCM to set kcontrol with parameters from
configure file:
    cset-bin-file "name='<KCONTROL_NAME>' <path/to/file>"
where "cset-bin-file" is a newly added keyword alongside of "cset",
to indicate cset with binary data in file.
The binary data in file is parameter for audio DSPs, and it's just
passed by UCM/ALSA as raw data. The data type of parameter elements
must be byte, and the count must matches driver definition.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-01-23 17:21:27 +01:00
Tomeu Vizoso
3b5fac6d10 conf/ucm: GoogleNyan: Add configuration
Taken from the ChromeOS sources, this configuration should apply to all
Nyan boards from Google, so far HP Chromebook 14 (nyan-blaze) and Acer
Chromebook 13 (nyan-big).

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-01-19 10:02:46 +01:00
Lu, Han
f47480af37 control: enable octal and hexadecimal parse
Use zero-base for strtol(), so get_integer() and get_integer64()
can parse decimal, octal and hexadecimal data from input string.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-01-14 12:15:33 +01:00
Anssi Hannula
b2ed0aa9f2 pcm: fix buffer overflow in snd_pcm_chmap_print()
The size argument is wrong for one of the snprintf() calls in
snd_pcm_chmap_print(), allowing an overflow to happen (the user-provided
buffer may be written data up to 2x its actual size).

Seen in an user report here: http://trac.kodi.tv/ticket/15641

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-12-31 10:02:20 +01:00
Tim Cussins
a649c4b1a0 pcm: Fix assorted tstamp_type bugs/omissions.
Just a couple of quick fixes related to tstamp_type.

- snd_pcm_sw_params(): copy tstamp_type field
- snd_pcm_tstamp_type_name(): fix argument type
- snd_pcm_dump_sw_setup(): fix dumping of tstamp_type field

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-11-25 16:34:22 +01:00
Takashi Iwai
72c8b07b2a ucm: Fix uninitialized err in snd_use_case_set()
The compiler warns like:
  main.c:1664:9: warning: 'err' may be used uninitialized in this function [-Wmaybe-uninitialized]

and actually there are slight code paths that slip.
This patch adds the proper initializations to 0 to return the success
code in these code paths.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-11-21 15:32:23 +01:00
Takashi Iwai
b779f6f432 mixer: Fix unused parameter warnings
mixer_simple.h:35:64: warning: unused parameter 'mixer' [-Wunused-parameter]
 static inline int snd_mixer_simple_basic_register(snd_mixer_t *mixer,
                                                                ^
mixer_simple.h:36:40: warning: unused parameter 'options' [-Wunused-parameter]
         struct snd_mixer_selem_regopt *options,
                                        ^
mixer_simple.h:37:29: warning: unused parameter 'classp' [-Wunused-parameter]
         snd_mixer_class_t **classp)
                             ^

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-11-21 15:22:01 +01:00
Takashi Iwai
c0a708180f mixer: Fix inclusion of config.h
config.h wasn't read or read too late in some files in src/mixer.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-11-21 15:20:48 +01:00
Jussi Laako
b14c49ab3d pcm: Fix DSD sample format endianess and add big-endian format
This patch adds big-endian DSD sample format and fixes return value of DSD
formats for snd_pcm_format_little_endian().

Signed-off-by: Jussi Laako <jussi@sonarnerd.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-11-21 15:11:05 +01:00
David Henningsson
984db83aa1 USB-audio: Add five more cards to IEC958 blacklist
These devices do not have any IEC958 outputs, so prevent them from
being opened.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-11-17 13:58:15 +01:00
Takashi Iwai
1eecc3a548 dlmisc: Remove unused label
Fix a compile warning
  dlmisc.c:329:2: warning: label 'unlock' defined but not used [-Wunused-label]

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-11-16 09:43:39 +01:00
John Spencer
11fdac949b snd_dlsym: only do versioning checks if built --with-versioning
a combination of some of the following garbage collecting LD/CFLAGS
-Os -g0 -fdata-sections -ffunction-sections -s -Wl,--gc-sections
-fno-unwind-tables -fno-asynchronous-unwind-tables
causes the symbol versioning marker symbols to be removed from BSS
since they're otherwise unreferenced. this causes dlsym failing to
find them which results in runtime breakage:

$ alsamixer
ALSA lib dlmisc.c:142:(snd_dlsym_verify) unable to verify version for symbol snd_config_hook_load
ALSA lib conf.c:3328:(snd_config_hooks_call) symbol snd_config_hook_load is not defined inside (null)
ALSA lib conf.c:3788:(snd_config_update_r) hooks failed, removing configuration
cannot open mixer: No such device or address

correct DSO:
$ objdump -T libasound.so.2.strip | grep _snd_config_hook_load_dlsym_config_hook_001
001196bc g    DO .bss   00000001 _snd_config_hook_load_dlsym_config_hook_001

incorrect DSO:
$ objdump -T libs/libasound.so.2 | grep _snd_config_hook_load_dlsym_config_hook_001
00000000 g    DO *ABS*  00000001 _snd_config_hook_load_dlsym_config_hook_001

since alsa was built with --without-versioning, doing those versioning
checks at all is unnecessary and harmful and thus now disabled in this case.

Signed-off-by: John Spencer <maillist-alsa@barfooze.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-11-16 09:41:17 +01:00
Takashi Iwai
5a066cb884 pcm: dmix: Don't ignore SND_TIMER_EVENT_MSTOP
When a slave PCM gets an error like XRUN, it stops and notifies with
SND_TIMER_EVENT_MSTOP event.  But the current code filters out this
type and eventually hang due to the empty timer queue.  The fix is to
just add this event type to the filter bit mask.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-11-06 12:12:02 +01:00
Andreas Schwab
c7bfcbb255 snd_user_file: fix memory leak
Call wordfree if and only if wordfree returns zero or WRDE_NOSPACE

Signed-off-by: Andreas Schwab <schwab@suse.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-11-03 17:26:00 +01:00
Panu Matilainen
ebd6afc915 USB-Audio: Add Scarlett 2i4 USB to S/PDIF blacklist
Like Scarlett 2i2, the 2i4 does not have any S/PDIF connections.

Signed-off-by: Panu Matilainen <pmatilai@laiskiainen.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-11-03 17:25:40 +01:00
zombah
24b4e86ddc conf/ucm: PAZ00: add Toshiba AC100/Dynabook AZ new config
Recent mainline kernels threat Toshiba AC100 audio hardware as hw:PAZ00
vs old hw:tegraalc5632.

This patch adds config files for new hw name and include them to
makefiles.

Signed-off-by: zombah <zombah@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-10-07 18:13:27 +02:00
Takashi Iwai
7c1f36dbcb mixer: Fix missing hctl handle free in snd_mixer_attach_hctl()
Yet another missing piece.

Also, update the function document to warn about the behavior at
error.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-09-23 09:11:27 +02:00
Renu Tyagi
f78ba070b3 pcm: return negative value in case of error
Signed-off-by: renu tyagi <renu.tyagi@samsung.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-09-23 09:08:23 +02:00
Renu Tyagi
5a0b992548 control: return negative value in case of error
Signed-off-by: renu tyagi <renu.tyagi@samsung.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-09-23 09:08:09 +02:00
Renu Tyagi
b356cd29f9 conf: return negative value in case of error
Signed-off-by: renu tyagi <renu.tyagi@samsung.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-09-23 09:07:20 +02:00
Renu Tyagi
69e0aaa569 pcm_hooks: null check for h
Signed-off-by: renu tyagi <renu.tyagi@samsung.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-09-23 09:07:13 +02:00
Renu Tyagi
bd0b008c0d socket: missing socket close
Signed-off-by: renu tyagi <renu.tyagi@samsung.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-09-23 09:06:36 +02:00
Renu Tyagi
f3f568e3db simple_abst: null check for lib
Signed-off-by: renu tyagi <renu.tyagi@samsung.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-09-23 09:06:28 +02:00
Renu Tyagi
30f289a8a3 pcm_share: fixing missing mutex unlock
Signed-off-by: renu tyagi <renu.tyagi@samsung.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-09-23 09:05:39 +02:00
Renu Tyagi
09f5c75e9c rawmidi: close handle h
Signed-off-by: renu tyagi <renu.tyagi@samsung.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-09-23 09:05:27 +02:00
Renu Tyagi
d37f918795 pcm_file: fixed missing free
Signed-off-by: renu tyagi <renu.tyagi@samsung.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-09-23 09:04:19 +02:00
Renu Tyagi
020bb3018a mixer: fixed double free
Signed-off-by: renu tyagi <renu.tyagi@samsung.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-09-23 09:01:36 +02:00
Alexander E. Patrakov
048568bbea pcm, rate: hw_avail must not be negative before starting the stream
If it is, then it means most likely the driver problem, so we should
return error immediately instead.

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2014-09-16 19:26:20 +02:00
Jaroslav Kysela
650b8c975c pcm route: Fix the bad condition (always false) 2014-09-16 09:00:39 +02:00
Jaroslav Kysela
99e57cb41a Revert "pcm: rewindable, forwardable: don't return stale data"
This reverts commit 6db0fe495e.
2014-09-14 18:33:37 +02:00
Alexander E. Patrakov
f803a3394a pcm, file: don't recurse in the rewindable and forwardable callbacks
Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2014-09-13 21:05:33 +02:00
Alexander E. Patrakov
6db0fe495e pcm: rewindable, forwardable: don't return stale data
The current behavior of snd_pcm_rewindable and snd_pcm_forwardable means
that the returned value is only accurate to one period. Or maybe even
meaningless if period interrupts are off. Fetch the up-to-date position
of the hardware pointer, as that's what is wanted by callers.

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2014-09-13 21:05:24 +02:00
Alexander E. Patrakov
e5e1af8388 dsnoop: rewindable and forwardable logic was swapped
Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2014-09-13 21:05:13 +02:00
Alexander E. Patrakov
ff9d213ff8 rate: handle negative values from snd_pcm_mmap_playback_hw_avail
Such negative returns are possible during an underrun if xrun detection
is disabled.

So, don't store the result in an unsigned variable (where it will
overflow), and postpone the trigger in such case, too.

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2014-09-13 21:05:04 +02:00
Alexander E. Patrakov
4fafa468d4 pcm, null: use the snd_pcm_mmap_avail function
instead of the open-coded equivalent

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2014-09-13 21:04:52 +02:00
Alexander E. Patrakov
0889e94706 pcm, rate: use the snd_pcm_mmap_hw_avail function
instead of the open-coded equivalent

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2014-09-13 21:04:37 +02:00
Alexander E. Patrakov
78c804fc93 pcm: handle negative values from snd_pcm_mmap_hw_avail
Such negative values can happen when an underrun happens and xrun
detection is disabled. Another situation is if the device updated the
pointer before alsa-lib has a chance to detect the xrun.

The problem is that these negative values could propagate to the
snd_pcm_rewindable return value, where it is specified that negative
returns must be interpreted as error codes and not as negative amount of
samples.

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2014-09-13 21:04:26 +02:00
Alexander E. Patrakov
9a43dc15b2 pcm: express the rewind size limitation logic better
There are a few places where the argument of the .rewind or .forward
callback is checked against the same value as returned by .rewindable or
.forwardable. Express this "don't rewind more than rewindable" logic
explicitly, so that the future fixes to the rewindable size can go to
one function instead of two.

While at it, take advantage of the fact that snd_pcm_mmap_avail() cannot
return negative values (except due to integer overflow, which is AFAICS
impossible given the current boundary choice).

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2014-09-13 21:04:13 +02:00
Alexander E. Patrakov
9a56a673a6 dmix: actually rewind when running or being drained
Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2014-09-13 21:03:41 +02:00
Jurgen Kramer
e59ffbf30e pcm: add new 32-bit DSD sample format
Add the new DSD_U32_LE sample format to alsa-lib.

NB include/pcm.h and include/sound/asound.h are updated so a new sync with the
kernel headers is not needed

Signed-off-by: Jurgen Kramer <gtmkramer@xs4all.nl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-09-10 09:10:50 +02:00
Alexander E. Patrakov
622b1b6bdb pcm: fix return value of snd_pcm_share_slave_avail
The return value was wrong for playback if slave->hw_ptr was near the
boundary and *pcm->appl.ptr was near zero. The wrong result was greater
than the boundary.

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-09-02 07:20:36 +02:00
Alexander E. Patrakov
99a2254f5f pcm: fix snd_pcm_mmap_hw_avail() near the boundary
This function returned incorrect results when hw.ptr was near the
boundary and hw.appl_ptr was near zero. Here "incorrect" means "greater
than the boundary".

The result was incorrect, because it was used as a return value of
various *_rewindable() functions and also as the delay for ioplug.

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-09-01 15:27:46 +02:00
Jurgen Kramer
b9f58dcc6f pcm: 2nd round of pcm_misc DSD fixes
Functions 'snd_pcm_format_silence_64' and 'snd_pcm_format_size' also need to be
able to handle the DSD smaple format.

Changes from v1:
- Correct silence pattern for DSD

Signed-off-by: Jurgen Kramer <gtmkramer@xs4all.nl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-08-22 11:15:30 +02:00
Takashi Iwai
e8e5481133 pcm: Add missing signed and endianess definitions for DSD formats
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-08-11 11:55:03 +02:00
Jurgen Kramer
87df9f3b7a pcm: Fix DSD formats userland usability
Support for DSD sample formats has been added a while ago. This patch makes
those sample formats beter usable from userland (e.g. aplay).

[These implementation details have been forgotten in the previous DSD
 support patch -- tiwai]

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-08-11 11:51:04 +02:00
Shengjiu Wang
f6b879e7cc pcm: pcm_local.h: include <time.h> to enable CLOCK_MONOTONIC
CLOCK_MONITONIC is defined in <bits/time.h>, add <time.h> before
<sys/time.h>.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-07-23 12:06:49 +02:00
Takashi Iwai
7a5646f58b pcm: Drop snd_pcm_linear_{get|put}32_index()
These are identical with snd_pcm_linear_{get|put}_index().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-07-22 14:20:40 +02:00
Takashi Iwai
fd84adc63e pcm: route: Use get32 for multi-source route calculation
The PCM route plugin can assign the destination value from average of
multiple sources with attenuation.  This requires the read of each
channel value, sums and writes the resultant value in the requested
format.

Currently, get_labels is used for reading source values while
put32_labels is used for writing the dest value.  This is, however,
a buggy implementation; get_labels gives the value as is only with
endianness and signedness conversions, but put32_labels assumes that
the value is normalized to 32bit int and it shifts down to the dest
format.  In addition, the current code lacks get_labels entries for
the 24bit formats, as Shengjiu Wang spotted out.

For fixing these bugs, this patch replaces the read with
get32_labels and use always 64bit int for sum.  This simplifies the
code a lot and drops many lines.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-07-22 14:06:12 +02:00
Takashi Iwai
55c5362521 pcm: Fill sw_params proto field
Fill the new proto field introduced to sw_params with the current PCM
protocol version.  This makes tstamp_type evaluated properly in the
kernel.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-07-22 12:14:49 +02:00