Commit graph

2960 commits

Author SHA1 Message Date
Renu Tyagi
0ee46280f3 sbase: 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:26 +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
Takashi Sakamoto
9ab3c4a669 hwdep: add missing declaration for snd_hwdep_poll_descriptors_count()
The alsa-lib has 'snd_hwdep_poll_descriptors_count()' but hwdep.h has no
declaration for the function. No applications can call the function just
by including the header.

This commit adds a line to the file for this function.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-09-17 07:54:43 +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
Dmitry Voytik
5f1960e3d8 doc: fix cross-compiling example
Simplest way to configure cross-compilation with configure
script is to pass '--host' option.
Passing just '--target' doesn't work.

Signed-off-by: Dmitry Voytik <voytikd@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-08-25 14:12:38 +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 Sakamoto
dfc3bf97bf Sync enum snd_hwdep_iface_t with include/asound/asound.h
Some members in this enumerated type has not updated for 9 years, although
kernel-drivers added them during this period. This commit adds them following
to a commit 87df9f3 'sync include/asound/asound.h with 3.17-rc1 kernel'.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-08-18 12:55:42 +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
Takashi Iwai
717ae3dd90 Sync include/sound/asound.h with 3.17-rc1 kernel
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-08-11 11:51:29 +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
Takashi Iwai
de63b942ac pcm: route: Use get/put labels for all 3 byte formats
So far, use_getput flag is set only when the src or dest format is
24bit physical width.  But, also 18 and 20 bit physical width formats
should set the flag, too.  This patch makes the check broader to cover
all 3 bytes formats.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-07-21 16:30:54 +02:00
Takashi Iwai
52444bd43a test/audio_time: Set timestamp type explicitly
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-07-14 18:12:49 +02:00
Takashi Iwai
65ff6fdafb pcm: Implement timestamp type handling in all plugins
Now all PCM plugins do support the proper timestamp type or pass it
over slaves.  The internal monotonic flag is dropped and replaced with
tstamp_type in all places.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-07-14 18:12:34 +02:00
Takashi Iwai
9b716075de pcm: Implement timestamp type setup in hw plugin
This patch implements the support for sw_params timestamp type in PCM
hw layer.  As gettimestamp() is still unchanged, the resultant
timstamps may be still with CLOCK_MONOTONIC even if you pass monotonic
raw type.  More fixes will follow.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-07-14 18:12:25 +02:00
Takashi Iwai
0d393c29a2 pcm: Add sw_params API functions to get/set timestamp type
For obtaining / changing the timestamp type, add the corresponding
sw_params accessor API functions together with the public definitions
of timestamp types.

This patch only adds the functions and defines but doesn't bring the
functional changes yet.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-07-14 18:12:21 +02:00
Takashi Iwai
5250a8e212 Add timestamp type to sw_params (internal only)
This patch is just the udpate of sound/asound.h taken from the kernel
commit.  The API changes and PCM structure changes will follow after
this.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-07-14 17:35:07 +02:00
Mark Brown
85e4704151 pcm: Provide a CLOCK_MONOTONIC_RAW timestamp type
For applications which need to synchronise with external timebases such
as broadcast TV applications the kernel monotonic time is not optimal as
it includes adjustments from NTP and so may still include discontinuities
due to that. A raw monotonic time which does not include any adjustments
is available in the kernel from getrawmonotonic() so provide userspace with
a new timestamp type SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW which provides
timestamps based on this as an option.

Reported-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-07-14 17:35:07 +02:00
Shengjiu Wang
035f196bcd pcm: rate: fix hw_ptr exceed the boundary
For long time test case, the hw_ptr will exceed the boundary, then cause
the avail size wrong.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-07-14 17:34:06 +02:00
Anssi Hannula
ea865bba46 USB-Audio: Add second S/PDIF device on Phiree U2
Phiree U2 has an unusual configuration. It only has S/PDIF output, but
there are still two devices presented:
- device 0: PCM audio, subject to volume control
- device 1: non-PCM data (passthrough), not subject to volume control

It looks like the AES bits are set according to the selected device,
since outputting PCM data via device 1 will not work (silence).

Currently only the device 0 is shown via the "iec958" alias, and the
second device is not accessible via hinted aliases.

Simply provide access to both of these devices via the "iec958" alias.

Reported-by: touc @ XBMC forum
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-07-08 12:36:03 +02:00
Alexander E. Patrakov
27cc710b57 ICE1712: add surround71 pcm definition
The M-Audio Delta 1010 card has 7.1 analog output, but no ready-made pcm
definition to use it.

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Reported-and-tested-by: Matt Zagrabelny <mzagrabe@d.umn.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-07-01 11:28:00 +02:00
Tanu Kaskinen
7a748af4db ucm: Document PlaybackPCMIsDummy and CapturePCMIsDummy values
At least PulseAudio needs special handling for dummy devices. To allow
that to happen automatically, the UCM configuration should contain the
information about which PCMs are dummy.

Signed-off-by: Tanu Kaskinen <tanu.kaskinen@linux.intel.com>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-06-27 14:22:28 +02:00
Jaroslav Kysela
c2f8ef7ab0 Release v1.0.28
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2014-06-17 14:34:19 +02:00
Sergey
47ee780997 alsa-lib: pcm_plug: fix float conversion for user specified ttable
Move custom ttable with equal channels case from a separate ttable_last
exception into a common plugins insertion loop.
Fixes plug with ttable for float pcms (jack, ladspa).
Example: aplay -fFLOAT_LE /dev/zero
pcm.!default {
    type plug
    slave.pcm { type null }
    ttable.0.0 1
}

Signed-off-by: Sergey <sergemp@mail.ru>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2014-06-17 14:27:37 +02:00
Jaroslav Kysela
95ab1c1c7c Loopback.conf: fix the comment 2014-06-13 19:18:43 +02:00
Jordi Mallach
8bdec31570 Add -lm to test programs to fix build failure.
Add -lm to test programs that use sin(), to fix a build failure with recent
binutils.

Signed-off-by: Jordi Mallach <jordi@debian.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2014-06-13 18:46:12 +02:00
Jaroslav Kysela
5256e150eb pcm: rate plugin - remove the rewind/forward implementation
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2014-06-13 11:15:17 +02:00
Alexander E. Patrakov
614a66bb2a pcm: rate: add rewindable and forwardable callbacks
This commit does not fix nonsense values returned by the rewind and
forward callbacks. E.g., with period_size = 1024 and buffer_size = 4096,
an attempt to rewind 1024 samples from the nearly-full buffer returns
4090.

Due to these nonsense values, the current rate plugin should be treated
as non-rewindable. That's why the new callbacks return 0.

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2014-06-13 11:12:23 +02:00
Jaroslav Kysela
9c3086fb74 pcm: null plugin - fix the avail count
The automatic threshold start is not activated when the wrong avail
count is returned in the prepared state.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2014-06-13 10:46:54 +02:00
Alexander E. Patrakov
084e7a91d8 pcm: null: add rewindable and forwardable callbacks
Dirty, but consistent with avail_update.

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2014-06-13 09:06:13 +02:00
Alexander E. Patrakov
fb73f310f8 pcm: multi: implement rewindable and forwardable callbacks
Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2014-06-13 09:04:29 +02:00
Alexander E. Patrakov
68ae0c72a5 pcm:file: add the missing htimestamp callback
Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2014-06-13 08:51:37 +02:00