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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
dsnoop: rewindable and forwardable logic was swapped

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
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>
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>
Revert "pcm: rewindable, forwardable: don't return stale data"

This reverts commit 6db0fe495ef1db1fd8f0ed791996f834665a926b.
pcm route: Fix the bad condition (always false)
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>
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>
mixer: fixed double free

Signed-off-by: renu tyagi <renu.tyagi@samsung.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>