OSDN Git Service

android-x86/external-alsa-lib.git
4 years agopcm_file: use EIO instead of EPIPE when failing to write output file
Adam Miartus [Mon, 1 Jul 2019 13:25:16 +0000 (15:25 +0200)]
pcm_file: use EIO instead of EPIPE when failing to write output file

EPIPE is defined as XRUN which is not entirely correct in this condition

failing to write to a file in pcm_file plugin can not be simply recovered
by a retry as user of the api might be led to believe when receiving EPIPE

use EIO instead to indicate a different kid of error that may not be
recoverable by retry

Signed-off-by: Adam Miartus <amiartus@de.adit-jv.com>
Reviewed-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agopcm_file: return errno in case of a failed write operation
Adam Miartus [Mon, 24 Jun 2019 12:21:36 +0000 (14:21 +0200)]
pcm_file: return errno in case of a failed write operation

allows correct error code propagation for snd_pcm_file_write_bytes caller

Signed-off-by: Adam Miartus <amiartus@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agopcm_file: remove double line
Adam Miartus [Mon, 24 Jun 2019 11:23:23 +0000 (13:23 +0200)]
pcm_file: remove double line

snd_pcm_file_add_frames called two times by mistake, introduced in
2a800c0c4f259043c9217a4aa6a57afaf9f77477

Signed-off-by: Adam Miartus <amiartus@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agopcm_file: report write output file error to api user
Adam Miartus [Wed, 12 Jun 2019 06:48:28 +0000 (08:48 +0200)]
pcm_file: report write output file error to api user

when writing to output file fails, api user is notified and can handle
recovery

Signed-off-by: Adam Miartus <amiartus@de.adit-jv.com>
Reviewed-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agopcm_file: do not disrupt playback on output file write fail
Adam Miartus [Wed, 12 Jun 2019 06:48:27 +0000 (08:48 +0200)]
pcm_file: do not disrupt playback on output file write fail

previously playback could be interrupted by snd_pcm_file_add_frames:
    assert(file->wbuf_used_bytes < file->wbuf_size_bytes)

in case snd_pcm_file_write_bytes fails to write full amount of bytes
to file, variable wbuf_used_bytes would not be fully decremented by
requested amount of bytes function was called with

for the assert to trigger, multiple write fails need to happen, so
that wbuf_used_bytes overflows wbuf_size_bytes,

this patch will allow application to report error code to api user
who might have an idea how to recover, before assert is triggered,
also reporting error along with the print out message might give user
a better idea of what is going on, where previously reason for
mentioned assert was not immediately clear

Signed-off-by: Adam Miartus <amiartus@de.adit-jv.com>
Reviewed-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agopcm: rate: Avoid pointer arithmetic on `void *`
Michael Forney [Wed, 12 Jun 2019 06:08:14 +0000 (23:08 -0700)]
pcm: rate: Avoid pointer arithmetic on `void *`

The pointer operand to the binary `+` operator must be to a complete
object type.

Signed-off-by: Michael Forney <mforney@mforney.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agopcm: direct: Remove unused empty struct
Michael Forney [Wed, 12 Jun 2019 06:08:13 +0000 (23:08 -0700)]
pcm: direct: Remove unused empty struct

Signed-off-by: Michael Forney <mforney@mforney.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agopcm: Make sure parameter qualifiers match between declaration and definition
Michael Forney [Wed, 12 Jun 2019 06:08:12 +0000 (23:08 -0700)]
pcm: Make sure parameter qualifiers match between declaration and definition

Signed-off-by: Michael Forney <mforney@mforney.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agopcm: hw: Don't return in a void function
Michael Forney [Wed, 12 Jun 2019 06:08:11 +0000 (23:08 -0700)]
pcm: hw: Don't return in a void function

A return statement with an expression in a function returning void is
a constraint violation.

Signed-off-by: Michael Forney <mforney@mforney.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoconf: List cases in range explicitly
Michael Forney [Wed, 12 Jun 2019 06:08:10 +0000 (23:08 -0700)]
conf: List cases in range explicitly

Case ranges are a GNU extension, and provide only a slight readability
improvement.

Signed-off-by: Michael Forney <mforney@mforney.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoUse __func__ instead of __FUNCTION__
Michael Forney [Wed, 12 Jun 2019 06:08:09 +0000 (23:08 -0700)]
Use __func__ instead of __FUNCTION__

They are equivalent, but __func__ is in C99. __FUNCTION__ exists only
for backwards compatibility with old gcc versions.

Signed-off-by: Michael Forney <mforney@mforney.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoucm: another coverity fix in uc_mgr_config_load()
Jaroslav Kysela [Mon, 27 May 2019 18:10:52 +0000 (20:10 +0200)]
ucm: another coverity fix in uc_mgr_config_load()

4 years agopcm_file: another locking fix (coverity)
Jaroslav Kysela [Mon, 27 May 2019 18:10:32 +0000 (20:10 +0200)]
pcm_file: another locking fix (coverity)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agotopology: next round of coverity fixes
Jaroslav Kysela [Mon, 27 May 2019 12:05:12 +0000 (14:05 +0200)]
topology: next round of coverity fixes

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agopcm_file: coverity fixes (including double locking)
Jaroslav Kysela [Mon, 27 May 2019 11:57:12 +0000 (13:57 +0200)]
pcm_file: coverity fixes (including double locking)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoucm: coverity fixes
Jaroslav Kysela [Fri, 24 May 2019 19:11:00 +0000 (21:11 +0200)]
ucm: coverity fixes

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: various coverity fixes
Jaroslav Kysela [Fri, 24 May 2019 18:52:00 +0000 (20:52 +0200)]
topology: various coverity fixes

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agorawmidi_hw: add sanity check for the invalid stream arguments (coverity)
Jaroslav Kysela [Fri, 24 May 2019 18:45:26 +0000 (20:45 +0200)]
rawmidi_hw: add sanity check for the invalid stream arguments (coverity)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agorawmidi: use snd_dlobj_cache_get2() in rawmidi open (coverity)
Jaroslav Kysela [Fri, 24 May 2019 18:31:24 +0000 (20:31 +0200)]
rawmidi: use snd_dlobj_cache_get2() in rawmidi open (coverity)

Use proper reference counting for the dynamic symbol.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agopcm_hw: close file descriptor in the error path in snd_pcm_hw_open() (coverity)
Jaroslav Kysela [Fri, 24 May 2019 09:11:46 +0000 (11:11 +0200)]
pcm_hw: close file descriptor in the error path in snd_pcm_hw_open() (coverity)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agopcm_file: call pclose() correctly for popen() (coverity)
Jaroslav Kysela [Fri, 24 May 2019 09:09:43 +0000 (11:09 +0200)]
pcm_file: call pclose() correctly for popen() (coverity)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agopcm: fix memory leak in _snd_pcm_parse_config_chmaps() (coverity)
Jaroslav Kysela [Fri, 24 May 2019 08:57:20 +0000 (10:57 +0200)]
pcm: fix memory leak in _snd_pcm_parse_config_chmaps() (coverity)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agocontrol_shm: add missing socket close to the error path (coverity)
Jaroslav Kysela [Fri, 24 May 2019 08:53:09 +0000 (10:53 +0200)]
control_shm: add missing socket close to the error path (coverity)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agocontrol_shm: remove duplicate code (coverity)
Jaroslav Kysela [Fri, 24 May 2019 08:51:47 +0000 (10:51 +0200)]
control_shm: remove duplicate code (coverity)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoconfig: parse_string() fix the dynamic buffer allocation failure code (coverity)
Jaroslav Kysela [Fri, 24 May 2019 08:44:49 +0000 (10:44 +0200)]
config: parse_string() fix the dynamic buffer allocation failure code (coverity)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agosrc/conf.c: add missing va_end() call (coverity)
Jaroslav Kysela [Fri, 24 May 2019 08:39:05 +0000 (10:39 +0200)]
src/conf.c: add missing va_end() call (coverity)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoaserver: fix resource leak coverity
Jaroslav Kysela [Fri, 24 May 2019 08:27:25 +0000 (10:27 +0200)]
aserver: fix resource leak coverity

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agopcm: file: add infile read support for mmap mode
Adam Miartus [Thu, 23 May 2019 13:00:40 +0000 (15:00 +0200)]
pcm: file: add infile read support for mmap mode

mmap_begin callback is used to copy data from input file to mmaped
buffer

guard for corner use of api (multiple mmap_begin calls by user) is
introduced to check if next continuous buffer was already overwritten

buffer is overwritten with input file data only in case of stream capture

Signed-off-by: Adam Miartus <amiartus@de.adit-jv.com>
Reviewed-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agopcm: add mmap_begin callback to snd_pcm_fast_ops_t api
Adam Miartus [Thu, 23 May 2019 13:00:39 +0000 (15:00 +0200)]
pcm: add mmap_begin callback to snd_pcm_fast_ops_t api

main motivation for adding the callback is to use it to enable operation
on mmaped buffer before user access for pcm_file plugin

support for MMAP read access with masking by data from input file is not
implemented for pcm_file plugin, by adding this callback implementing
such feature can be done by rewriting next continuous portion of buffer
on each mmap_begin call

plugins like softvol use pcm_plugin interface and overwrite the buffer by
looping around it in avail_update callback, this patch hopes to simplify
the task by adding new api callback, removing the need for rewriting
pcm_file (to use pcm_plugin callbacks) and careful checking when looping
around whole mmaped buffer

Signed-off-by: Adam Miartus <amiartus@de.adit-jv.com>
Reviewed-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoucm: Add UCM profile for CX2072X codec on Baytrail/Cherrytrail profiles
Takashi Iwai [Thu, 18 Apr 2019 18:40:18 +0000 (20:40 +0200)]
ucm: Add UCM profile for CX2072X codec on Baytrail/Cherrytrail profiles

Adding a new Conexant CX2072X codec profile and reusing the existing
BYT/CHT platform snippets.

Currently tested only on ASUS E200HA laptop.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agopcm: file: add missing unlock on early return
Adam Miartus [Thu, 23 May 2019 09:44:30 +0000 (11:44 +0200)]
pcm: file: add missing unlock on early return

Signed-off-by: Adam Miartus <amiartus@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agopcm: file: use snd_pcm_file_areas_read_infile for readi
Adam Miartus [Tue, 21 May 2019 13:33:08 +0000 (15:33 +0200)]
pcm: file: use snd_pcm_file_areas_read_infile for readi

use previously introduced helper function, this commit unifies behavior
of readi and readn

corner case behavior of readi is changed by this commit, previously,
in case 0 bytes were red from file (EOF), frames = 0 was returned,
signaling api user as if no data was red from slave, after the patch,
amount of frames red from slave with data red from slave stored in buffer
is returned when EOF is reached

Signed-off-by: Adam Miartus <amiartus@de.adit-jv.com>
Reviewed-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agopcm: file: add support for infile reading in non interleaved mode
Adam Miartus [Tue, 21 May 2019 13:32:47 +0000 (15:32 +0200)]
pcm: file: add support for infile reading in non interleaved mode

add helper function to copy input file data to buffer mapped by areas,
in case of an error, do not fill the areas, allowing device read buffer
to be provided to api caller

previously unused rbuf variable is reused for this purpose

Signed-off-by: Adam Miartus <amiartus@de.adit-jv.com>
Reviewed-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agopcm: dsnoop: Added "hw_ptr_alignment" option in configuration for slave pointer alignment
Vanitha Channaiah [Wed, 15 May 2019 06:26:34 +0000 (11:56 +0530)]
pcm: dsnoop: Added "hw_ptr_alignment" option in configuration for slave pointer alignment

This change adapt the fix commit 6b058fda9dce
("pcm: dmix: Add option to allow alignment of slave pointers")
for dsnoop plugin

Issue is that snd_pcm_wait() goes back to waiting because the hw_ptr
is not period aligned. Therefore snd_pcm_wait() will block for a longer
time as required.

With these rcar driver changes the exact position of the dma is returned.
During snd_pcm_start they read hw_ptr as reference, and this hw_ptr
is now not period aligned, and is a little ahead over the period while it
is read. Therefore when the avail is calculated during snd_pcm_wait(),
it is missing the avail_min by a few frames.

An additional option hw_ptr_alignment is provided to dsnoop configuration,
to allow the user to configure the slave application and hw pointer
alignment at startup

Signed-off-by: Vanitha Channaiah <vanitha.channaiah@in.bosch.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agopcm: dshare: Added "hw_ptr_alignment" option in configuration for alignment of slave...
Vanitha Channaiah [Wed, 15 May 2019 06:26:33 +0000 (11:56 +0530)]
pcm: dshare: Added "hw_ptr_alignment" option in configuration for alignment of slave pointers

This change adapt the fix commit 6b058fda9dce
("pcm: dmix: Add option to allow alignment of slave pointers")
for dshare plugin

Issue is that snd_pcm_wait() goes back to waiting because the hw_ptr
is not period aligned. Therefore snd_pcm_wait() will block for a longer
time as required.

With these rcar driver changes the exact position of the dma is returned.
During snd_pcm_start they read hw_ptr as reference, and this hw_ptr
is now not period aligned, and is a little ahead over the period while it
is read. Therefore when the avail is calculated during snd_pcm_wait(),
it is missing the avail_min by a few frames.

An additional option hw_ptr_alignment is provided to dshare configuration,
to allow the user to configure the slave application and hw pointer
alignment at startup

Signed-off-by: Vanitha Channaiah <vanitha.channaiah@in.bosch.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agopcm: direct: Add generic hw_ptr_alignment function for dmix, dshare and dsnoop
Vanitha Channaiah [Wed, 15 May 2019 06:26:32 +0000 (11:56 +0530)]
pcm: direct: Add generic hw_ptr_alignment function for dmix, dshare and dsnoop

Move the code snd_pcm_direct_reset_slave_ptr() from pcm_dmix.c
to pcm_direct.c and its header so that the helper function can be
re-used by other direct-pcm plugins.
There is no change in the behavior or the functionality.

Signed-off-by: Vanitha Channaiah <vanitha.channaiah@in.bosch.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoRelease v1.1.9
Jaroslav Kysela [Fri, 10 May 2019 06:57:21 +0000 (08:57 +0200)]
Release v1.1.9

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoadd support for GCC's LTO
Jaroslav Kysela [Tue, 9 Apr 2019 10:44:14 +0000 (12:44 +0200)]
add support for GCC's LTO

5 years agopcm: multi plugin: reset hw/appl pointers in prepare/reset functions
Jaroslav Kysela [Tue, 9 Apr 2019 08:33:45 +0000 (10:33 +0200)]
pcm: multi plugin: reset hw/appl pointers in prepare/reset functions

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoPrintf unsigned longs with %lu instead of %ld (playmidi1.c)
Quipyowert2 [Sun, 17 Feb 2019 13:00:53 +0000 (05:00 -0800)]
Printf unsigned longs with %lu instead of %ld (playmidi1.c)

Signed-off-by: Nathan Mills <the.true.nathan.mills@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoPrintf unsigned ints with %u instead of %i (pcm.c)
Quipyowert2 [Sun, 17 Feb 2019 12:56:14 +0000 (04:56 -0800)]
Printf unsigned ints with %u instead of %i (pcm.c)

Signed-off-by: Nathan Mills <the.true.nathan.mills@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoPrintf unsigned long longs with %llu (mixtest.c)
Quipyowert2 [Sun, 17 Feb 2019 12:54:17 +0000 (04:54 -0800)]
Printf unsigned long longs with %llu (mixtest.c)

Signed-off-by: Nathan Mills <the.true.nathan.mills@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoPrintf unsigned longs with %lu instead of %li (midifile.c)
Quipyowert2 [Sun, 17 Feb 2019 12:51:22 +0000 (04:51 -0800)]
Printf unsigned longs with %lu instead of %li (midifile.c)

Signed-off-by: Nathan Mills <the.true.nathan.mills@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoPrintf unsigned long with %lu instead of %li (latency.c)
Quipyowert2 [Sun, 17 Feb 2019 12:39:32 +0000 (04:39 -0800)]
Printf unsigned long with %lu instead of %li (latency.c)

Signed-off-by: Nathan Mills <the.true.nathan.mills@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoPrint unsigned ints with %u instead of %i. (snd_ctl_ascii_elem_id_get)
Quipyowert2 [Sun, 17 Feb 2019 12:37:24 +0000 (04:37 -0800)]
Print unsigned ints with %u instead of %i. (snd_ctl_ascii_elem_id_get)

Signed-off-by: Nathan Mills <the.true.nathan.mills@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoClose topology config file after parsing it.
Quipyowert2 [Sun, 17 Feb 2019 11:38:16 +0000 (03:38 -0800)]
Close topology config file after parsing it.

Signed-off-by: Nathan Mills <the.true.nathan.mills@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agopcm: multi plugin: detach the hw_ptr and appl_ptr from master_slave
Jaroslav Kysela [Tue, 9 Apr 2019 08:12:34 +0000 (10:12 +0200)]
pcm: multi plugin: detach the hw_ptr and appl_ptr from master_slave

Unfortunately, the master_slave buffer pointers are not always in sync with
the presented avail value and the higher layers (like write_areas) got
confused. Create own hw_ptr and appl_ptr.

This commit also tries to fix the hwsync and delay implementation (iterate
through all slaves).

The multi plugin was designed only for hardware which runs really in sync.
Anyway, users are trying to use this plugin for other purposes.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agopcm: fix wait condition in snd_pcm_write_areas() to avoid return zero
Jaroslav Kysela [Tue, 9 Apr 2019 07:14:33 +0000 (09:14 +0200)]
pcm: fix wait condition in snd_pcm_write_areas() to avoid return zero

The hw_ptr might be updated during the snd_pcm_may_wait_for_avail_min() call,
so even if it returns zero (OK), the avail must be updated again.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agopcm: multi plugin - fix wait_for_avail_min
Jaroslav Kysela [Mon, 25 Mar 2019 15:15:07 +0000 (16:15 +0100)]
pcm: multi plugin - fix wait_for_avail_min

All slaves should be asked to wait otherwise the write loop might
be interrupted and zero frames might be returned.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agopcm: null: Do not allow a period size of 0
Timo Wischer [Mon, 8 Apr 2019 08:55:54 +0000 (10:55 +0200)]
pcm: null: Do not allow a period size of 0

Some applications do not expect that get_period_size_min() could
return 0. Therefore these applications cannot use the null plugin without
this patch.
Due to there is no use case for having a period size of 0 this patch
disallows a period size of 0 when using the null plugin.

Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoDrop -I$includedir/alsa from alsa.pc
Takashi Iwai [Tue, 26 Mar 2019 13:48:23 +0000 (14:48 +0100)]
Drop -I$includedir/alsa from alsa.pc

We used to put the additional include path $includedir/alsa in
pkgconfig just because some applications have included asoundlib.h
like
  #include <asoundlib.h>
although the canonical form should be
  #include <alsa/asoundlib.h>

However, adding this include path is significantly dangerous due to
possible conflicts of file names like version.h.  It's already the
reason to discourage people using alsa.pc for the packages.

In this patch, the additional include path from alsa.pc is dropped
finally.  At the same time, as a rescue plan for the programs
including via <asoundlib.h>, a stub header file is provided in
include/sound/asoundlib.h.  It just includes alsa/asoundlib.h with a
warning to suggest for replacing with alsa/asoundlib.h.
Actually this is the same file as we install into sys/asoundlib.h, so
the whole changes are very minimal here.

Acked-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agopcm: rate plugin - fix signess in snd_pcm_rate_avail_update() comparison
Jaroslav Kysela [Mon, 25 Mar 2019 15:56:34 +0000 (16:56 +0100)]
pcm: rate plugin - fix signess in snd_pcm_rate_avail_update() comparison

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoadd snd_strlcpy() and use it everywhere
Jaroslav Kysela [Mon, 25 Mar 2019 15:45:43 +0000 (16:45 +0100)]
add snd_strlcpy() and use it everywhere

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalisp: add the missing include
Chih-Wei Huang [Fri, 15 Mar 2019 09:17:04 +0000 (17:17 +0800)]
alisp: add the missing include

Commit d4e08c5e865 changed to use internal versioned functions.
However, the header is not included. It generates the errors:

 In file included from external/alsa-lib/src/alisp/alisp.c:3038:
 external/alsa-lib/src/alisp/alisp_snd.c:583:64: error: implicit declaration of function '__snd_ctl_elem_info_get_dimension' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                         p2 = add_cons2(instance, p2, idx > 0, new_integer(instance, INTERNAL(snd_ctl_elem_info_get_dimension)(&info, idx)));
                                                                                    ^
 external/alsa-lib/include/alsa-symbols.h:30:24: note: expanded from macro 'INTERNAL'
 #define INTERNAL(Name) INTERNAL_CONCAT2_2(__, Name)
                        ^
 external/alsa-lib/include/alsa-symbols.h:29:39: note: expanded from macro 'INTERNAL_CONCAT2_2'
 #define INTERNAL_CONCAT2_2(Pre, Post) Pre##Post
                                      ^
 <scratch space>:396:1: note: expanded from here
 __snd_ctl_elem_info_get_dimension
 ^
 external/alsa-lib/src/alisp/alisp_snd.c:583:64: note: did you mean '__snd_ctl_elem_info_get_dimensions'?
 external/alsa-lib/include/alsa-symbols.h:30:24: note: expanded from macro 'INTERNAL'
 #define INTERNAL(Name) INTERNAL_CONCAT2_2(__, Name)
                       ^
 external/alsa-lib/include/alsa-symbols.h:29:39: note: expanded from macro 'INTERNAL_CONCAT2_2'
 #define INTERNAL_CONCAT2_2(Pre, Post) Pre##Post
                                      ^
 <scratch space>:396:1: note: expanded from here
 __snd_ctl_elem_info_get_dimension
 ^
 external/alsa-lib/src/alisp/alisp_snd.c:578:8: note: '__snd_ctl_elem_info_get_dimensions' declared here
         err = INTERNAL(snd_ctl_elem_info_get_dimensions)(&info);
               ^
 external/alsa-lib/include/alsa-symbols.h:30:24: note: expanded from macro 'INTERNAL'
 #define INTERNAL(Name) INTERNAL_CONCAT2_2(__, Name)
                        ^
 external/alsa-lib/include/alsa-symbols.h:29:39: note: expanded from macro 'INTERNAL_CONCAT2_2'
 #define INTERNAL_CONCAT2_2(Pre, Post) Pre##Post
                                       ^
 <scratch space>:395:1: note: expanded from here
 __snd_ctl_elem_info_get_dimensions
 ^
 2 errors generated.

Fixes: d4e08c5e865 ("control: Proper reference of internal versioned functions")
Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agopcm: add the missing <strings.h> include
Chih-Wei Huang [Fri, 15 Mar 2019 09:17:03 +0000 (17:17 +0800)]
pcm: add the missing <strings.h> include

To define the prototype of ffs. See 'man ffs'.

Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoAndroid: avoid using versionsort
Chih-Wei Huang [Fri, 15 Mar 2019 09:17:02 +0000 (17:17 +0800)]
Android: avoid using versionsort

Android doesn't have versionsort yet.

Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoconf: pcm dmix - add CHANNELS argument
Jaroslav Kysela [Wed, 13 Mar 2019 09:45:35 +0000 (10:45 +0100)]
conf: pcm dmix - add CHANNELS argument

It seems that some audio devices do use only mono audio for some
applications (RPi).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotest/latency: use frame bytes correctly in writebuf()
Jaroslav Kysela [Fri, 1 Mar 2019 11:43:19 +0000 (12:43 +0100)]
test/latency: use frame bytes correctly in writebuf()

Reported-by: Alessandro Lapini <alessandro.lapini@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agopcm: dshare: Fix overflow when slave_hw_ptr rolls over boundary
Brendan Shanks [Mon, 11 Feb 2019 19:51:26 +0000 (11:51 -0800)]
pcm: dshare: Fix overflow when slave_hw_ptr rolls over boundary

In snd_pcm_dshare_sync_area() when 'slave_hw_ptr' rolls over
'slave_boundary', the wrong variable is checked ('dshare->slave_hw_ptr' vs
the local 'slave_hw_ptr'). In some cases, this results in 'slave_hw_ptr'
not rolling over correctly. 'slave_size' and 'size' are then much too
large, and the for loop blocks for several minutes copying samples.

This was likely only triggered on 32-bit systems, since the PCM boundary
is computed based on LONG_MAX and is much larger on 64-bit systems.

This same change was made to pcm_dmix in commit
6c7f60f7a982fdba828e4530a9d7aa0aa2b704ae ("Fix boundary overlap”) from
June 2005.

Signed-off-by: Brendan Shanks <brendan.shanks@teradek.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoucm: bytcr/PlatformEnableSeq.conf update some comments
Hans de Goede [Sun, 3 Feb 2019 11:37:41 +0000 (12:37 +0100)]
ucm: bytcr/PlatformEnableSeq.conf update some comments

Commit f91cc3c7d6b7 ("Update chtrt5645 ucm variants to use
bytcr/PlatformEnableSeq.conf component") updated the
following 2 comments:

 # codec0_out settings (used if SSP2 is connected to aif1)
 # modem_out settings (used if SSP0 is connected to aif2)

Specifically it added the " to aif1" resp. " to aif2" part of the comments.

This is not correct, AIF1 / AIF2 are something which is present on
Realtek codecs only, and either one can be used indepedent of
SSP0 or SSP2 being used (the comments in the chtrt5645 UCM profile
before this change were wrong / outdated).

Besides there not being any relationship between SSP0 or SSP2 being
used, bytcr/PlatformEnableSeq.conf is also used with other codecs,
e.g. the ESS8316 codec where this is not applicable at all.

Therefor this commit removes the " to aif?" part of the comments again
to avoid confusing people reading this in the future.

Cc: Russell Parker <russell.parker7@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoucm: Add ucm files for DB820c board
Srinivas Kandagatla [Tue, 29 Jan 2019 10:48:28 +0000 (10:48 +0000)]
ucm: Add ucm files for DB820c board

DB820c board is based of MSM8996 Qualcomm SoC, which has support for both
Digital and Analog audio. Digital audio is over HDMI and analog is over
WCD9335 codec via SLIMbus.

Board itself has HDMI port, a 3.5mm audio Jack and an Audio expansion
connector.
This patch adds support for HDMI port and 3.5mm jack.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoRevert "conf/ucm: Add a UCM profile for Dell WD19 Dock USB-audio"
Jaroslav Kysela [Fri, 25 Jan 2019 11:09:31 +0000 (12:09 +0100)]
Revert "conf/ucm: Add a UCM profile for Dell WD19 Dock USB-audio"

This reverts commit d8013619c942dd996c32337a9ade429bfaf455ee.

The USB driver defines identical profile as for WD15.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoconf/ucm: Add a UCM profile for Dell WD19 Dock USB-audio
Hui Wang [Tue, 27 Nov 2018 01:36:28 +0000 (09:36 +0800)]
conf/ucm: Add a UCM profile for Dell WD19 Dock USB-audio

USB-audio device on Dell WD19 docking station provides two individual
output PCM streams, one for headphone Jack and another for speaker out
Jack. A UCM profile gives the proper roles for these.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agopcm: Preserve period_event in snd_pcm_hw_sw_params() call
Takashi Iwai [Wed, 9 Jan 2019 11:02:56 +0000 (12:02 +0100)]
pcm: Preserve period_event in snd_pcm_hw_sw_params() call

snd_pcm_hw_sw_params() in pcm_hw.c tries to abuse the reserved bits
for passing period_Event flag.  In this hackish way, we clear the
reserved bits at beginning, and restore before returning.  However,
the code paths that return earlier don't restore the value, hence when
user calls this function twice, it may pass an unexpected value.

This patch fixes the failure, restoring the value always before
returning from the function.

Reported-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoRelease v1.1.8
Jaroslav Kysela [Mon, 7 Jan 2019 12:55:38 +0000 (13:55 +0100)]
Release v1.1.8

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoconf: rename snd_conf_load1() to _snd_config_load_with_include()
Jaroslav Kysela [Mon, 7 Jan 2019 12:15:32 +0000 (13:15 +0100)]
conf: rename snd_conf_load1() to _snd_config_load_with_include()

Always free the include path which must be mallocated by the caller.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoconf/ucm: bytcht-es8316: Add long-name UCM profiles
Hans de Goede [Thu, 3 Jan 2019 13:50:15 +0000 (14:50 +0100)]
conf/ucm: bytcht-es8316: Add long-name UCM profiles

After recent kernel work, the kernel now sets a long-name for bytcht-es8316
boards which indicates if a single (mono) speaker or stereo speakers are
used and if in1 or in2 is used for the internal mic (the headset mic will
be on the other input).

This commit adds UCM profiles for bytcht-es8316 boards using these new
long-names, based on the generic bytcht-es8316 profile.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoconf/ucm: Add UCM profile for bytcht-es8316 boards
Hans de Goede [Thu, 3 Jan 2019 13:50:14 +0000 (14:50 +0100)]
conf/ucm: Add UCM profile for bytcht-es8316 boards

Add an UCM profile for Bay Trail and Cherry Trail boards with an
ES8316 codec.

Re-use the existing platform enable and disable sequences for BYT/CHT SST
support and add a codecs/es8316 dir with codec specific enable / disable
sequences for the various inputs and outputs.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoCreate device component for rt5645 Internal Analog Mic UCM
Russell Parker [Sun, 6 Jan 2019 03:47:15 +0000 (19:47 -0800)]
Create device component for rt5645 Internal Analog Mic UCM

Since the Internal Analog Microphone device configuration is
identical for the rt5645 and rt5645 mono speaker UCMs, move
the entire definition to a component.

Signed-off-by: Russell Parker <russell.parker7@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoFactor out rt5645 variants Headset+Digital Mic UCM shared {en,dis}able sequences
Russell Parker [Sun, 6 Jan 2019 03:47:14 +0000 (19:47 -0800)]
Factor out rt5645 variants Headset+Digital Mic UCM shared {en,dis}able sequences

Signed-off-by: Russell Parker <russell.parker7@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoFactor out rt5645 variants Speaker+Headphones shared UCM enable sequences
Russell Parker [Sun, 6 Jan 2019 03:47:13 +0000 (19:47 -0800)]
Factor out rt5645 variants Speaker+Headphones shared UCM enable sequences

Move common enable sequences for rt5645 variants and rt5650
UCM configurations into a shared component. The corresponding
disable sequences are only two lines each and do not seem worth
creating components for.

Signed-off-by: Russell Parker <russell.parker7@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoCreate shared {En,Dis}ableSeq.conf components for rt5645 variants
Russell Parker [Sun, 6 Jan 2019 03:47:12 +0000 (19:47 -0800)]
Create shared {En,Dis}ableSeq.conf components for rt5645 variants

Factor out the common enable and disable sequences used
in rt5645 variants, including the rt5650. Move the sequences
into a new component directory codecs/rt5645/ along with
a Makefile.

Some lines like
    cset "name='Stereo1 ADC1 Mux' 1"
and
    cset "name='I2S2 Func Switch' on"
are not set set in the chtrt5650 UCM sequences and thus are not present
in the new component, in order to maximize reuse.

Signed-off-by: Russell Parker <russell.parker7@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoUpdate chtrt5645 ucm variants to use bytcr/PlatformEnableSeq.conf component
Russell Parker [Sun, 6 Jan 2019 03:47:11 +0000 (19:47 -0800)]
Update chtrt5645 ucm variants to use bytcr/PlatformEnableSeq.conf component

The Lenovo Ideapad Miix 320, Asus T100HA, and chtrt5645 mono variant
UCM configurations have not been updated to make use of the shared
bytcr/PlatfromEnableSeq.conf sequence. This commit deletes those
command sequences and loads the shared component directly.

Signed-off-by: Russell Parker <russell.parker7@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agocontrol: fix the assert() in snd_ctl_elem_set_bytes
Jaroslav Kysela [Mon, 7 Jan 2019 08:08:46 +0000 (09:08 +0100)]
control: fix the assert() in snd_ctl_elem_set_bytes

Allow to write to the whole array (512 bytes).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoconf/ucm: bytcr-rt5651: Document mono speaker wiring
Hans de Goede [Tue, 1 Jan 2019 11:32:46 +0000 (12:32 +0100)]
conf/ucm: bytcr-rt5651: Document mono speaker wiring

During my recent work on the bytcht-es8316 UCM profile I realized that the
bytcr-rt5651 devices with a single speaker use a differential setup just
like the es8316 does. The tell-tale here is the speaker going quiet when
playing the exact same sound on both channels when things are configured
for stereo speakers.

I've run some tests and the rt5651 does have a special mono balanced out
mode for its line-out but using this results in the same sound (and the
same loudness / volume of the sound) as our current solution, so adding
support for this to the kernel buys us nothing.

This commit makes no changes, it just documents my findings in a big
comment for future reference.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoconf/ucm: bytcr-rt5651: Add bytcr-rt5651-stereo-spk-dmic-mic config
Hans de Goede [Mon, 24 Dec 2018 15:05:04 +0000 (16:05 +0100)]
conf/ucm: bytcr-rt5651: Add bytcr-rt5651-stereo-spk-dmic-mic config

Add a config for boards which use a digital mic as internal mic,
combined with having the headset mic on in2.

An example of such a board is the Point of View TAB-P1006W-232 (v1.0) tablet.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoconf/ucm: bytcr-rt5651: Add digital mic support
Hans de Goede [Mon, 24 Dec 2018 15:05:03 +0000 (16:05 +0100)]
conf/ucm: bytcr-rt5651: Add digital mic support

Add a new ucm/codecs/rt5651/DigitalMic.conf snippet for digital mic support
and include this in the default non board-specific bytcr-rt5651.conf.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoconf/ucm: bytcr-rt5651: Add support for a headset-mic on IN2
Hans de Goede [Mon, 24 Dec 2018 15:05:02 +0000 (16:05 +0100)]
conf/ucm: bytcr-rt5651: Add support for a headset-mic on IN2

The first design with the headset-mic on IN2 rather then the
default / reference-design IN3 has shown up.

Add a new ucm/codecs/rt5651/IN2-HeadsetMic.conf snippet to deal with this
and include this in the default non board-specific bytcr-rt5651.conf.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoconf/ucm: bytcr-rt5651: Enable Stereo? ADC MIXL ADC? switches when enabling inputs
Hans de Goede [Mon, 24 Dec 2018 15:05:01 +0000 (16:05 +0100)]
conf/ucm: bytcr-rt5651: Enable Stereo? ADC MIXL ADC? switches when enabling inputs

Explicitly enable the right 'Stereo? ADC MIXL ADC?' when selecting an input,
rather then just enabling them all in ucm/codecs/rt5651/EnableSeq.conf .

This is a preparation patch for adding digital mic support.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoconf/ucm: kblrt5660: Add ucm setting for Dell Edge IoT platform
Hui Wang [Mon, 24 Dec 2018 08:34:46 +0000 (16:34 +0800)]
conf/ucm: kblrt5660: Add ucm setting for Dell Edge IoT platform

The new generation of Dell Edge IoT platform is based on Intel
Kabylake platform, and the audio codec is ALC3277 which is 100%
compatible with RT5660 in I2S mode.

The audio design on this IoT platform is as below:
 - Intel kabylake platform
 - connect the codec ALC3277 via SSP0
 - line-out and line-in with Micbias jacks
 - line-out mute control and jack detection of line-out and line-in
 - two HDMI ports with audio capability

Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoconf/ucm: chtrt5650: Add UCM config for chtrt5650
Russell Parker [Sun, 30 Dec 2018 05:35:26 +0000 (21:35 -0800)]
conf/ucm: chtrt5650: Add UCM config for chtrt5650

Add a UCM configuration for the rt5650 codec. Tested on
a Samsung Chromebook 3. Adapted with minor modifications
from GitHub user evan-a-a's gist:
https://gist.github.com/evan-a-a/86b2a698708074530e2d0ee7c6498767

Signed-off-by: Russell Parker <russell.parker7@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agopcm: ioplug: Fix the regression of pulse plugin drain
Takashi Iwai [Wed, 19 Dec 2018 13:23:38 +0000 (14:23 +0100)]
pcm: ioplug: Fix the regression of pulse plugin drain

The recent change to support the drain via polling caused a regression
for pulse plugin; with speaker-test -c2 -twav with pulse, it leads to
either no sounds or stall.

The only sensible behavior change in the commit wrt pulse plugin is
that now it starts the stream before calling drain callback.  This
supposed to be correct, but it seems hitting a pulse plugin bug.

The start before drain callback is only a matter of consistency, and
since this doesn't work for the single existing plugin using drain
callback, we don't need to stick with this behavior.

For addressing the regression, we check the presence of the drain
callback and start the stream only when it doesn't exist, i.e. only in
drain-via-poll mode.

Fixes: ce2095c41f28 ("pcm: ioplug: Implement proper drain behavior")
Reported-by: Diego Viola <diego.viola@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agopcm: extplug: Keep format and channels the same if requested
Timo Wischer [Mon, 10 Dec 2018 10:33:16 +0000 (11:33 +0100)]
pcm: extplug: Keep format and channels the same if requested

Without this patch it is not possible to link the channel and format
parameter if snd_pcm_extplug_set_param_*() or
snd_pcm_extplug_set_slave_param_*() is called. Therefore the client and
slave parameter can differ. So the extplug has to implement conversion.

To avoid this the new snd_pcm_extplug_set_param_link() function can be
called.
As a reproduction sceanrio the following extplug source code can be used:

===
static snd_pcm_sframes_t my_transfer(snd_pcm_extplug_t *e,
const snd_pcm_channel_area_t *da, snd_pcm_uframes_t dof,
const snd_pcm_channel_area_t *sa, snd_pcm_uframes_t sof,
snd_pcm_uframes_t s) {
return s;
}
static const snd_pcm_extplug_callback_t my_own_callback = {
.transfer = my_transfer
};
SND_PCM_PLUGIN_DEFINE_FUNC(my_plug) {
snd_config_iterator_t i, next;
snd_config_t *slave = NULL;
snd_pcm_extplug_t *myplug;
snd_config_for_each(i, next, conf) {
snd_config_t *n = snd_config_iterator_entry(i);
const char *id;
if (snd_config_get_id(n, &id) < 0)
continue;
if (strcmp(id, "comment") == 0 || strcmp(id, "type") == 0)
continue;
if (strcmp(id, "slave") == 0) {
slave = n;
continue;
}
return -EINVAL;
}
myplug = calloc(1, sizeof(*myplug));
myplug->version = SND_PCM_EXTPLUG_VERSION;
myplug->callback = &my_own_callback;
snd_pcm_extplug_create(myplug, name, root, slave, stream, mode);

snd_pcm_extplug_set_param_minmax(myplug,
SND_PCM_EXTPLUG_HW_CHANNELS, 1, 16);
// snd_pcm_extplug_set_param_link(myplug, SND_PCM_EXTPLUG_HW_CHANNELS, 1);

*pcmp = myplug->pcm;
return 0;
}
SND_PCM_PLUGIN_SYMBOL(my_plug);
===

To use this plugin the following ALSA configuration is required:

pcm.myplug {
    type my_plug
    slave.pcm hw:Dummy
}

With this configuration without this patch
snd_pcm_hw_params_get_channels_max() will always return 16 channels
independent of the supported channels of the dummy device. Due to that for
example the start up of JACK would fail:

$ modprobe snd_dummy
$ jackd -d alsa -P myplug
ALSA: cannot set channel count to 16 for playback
ALSA: cannot configure playback channel

Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoucm: Set default include path
Takashi Iwai [Wed, 28 Nov 2018 15:25:41 +0000 (16:25 +0100)]
ucm: Set default include path

Many UCM profiles include the UCM profile components under ucm/*
subdirectories and thusly put <searchdir:ucm> at each place.  This is
rather cumbersome.

This patch makes the UCM parser to set the default include path, so
that each profile no longer needs to set searchdir.  All the
<searchdir:ucm> lines currently found in the profiles are removed
gracefully, too.

For the needed implementation, a new helper,
_snd_config_load_with_include() is introduced.  It's not exported,
only for the use inside alsa-lib.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoconf: Move UCM profile snippets into components subdirectory
Takashi Iwai [Tue, 27 Nov 2018 12:55:04 +0000 (13:55 +0100)]
conf: Move UCM profile snippets into components subdirectory

We have placed UCM profile snippets to be included by the main config
files also in the same directory, src/conf/ucm, it confuses alsaucm
program that scans over all subdirectories.  It thinks such a file is
also the main config file, and spews errors like:
  % alsaucm
  ALSA lib utils.c:67:(uc_mgr_config_load) could not open configuration file /usr/share/alsa/ucm/bytcr/bytcr.conf
  ALSA lib parser.c:1427:(load_master_config) error: could not parse configuration for card bytcr
  alsaucm: unable to obtain card list: No such file or directory

Actually we already defined the subdirectory for such components, and
they are skipped at parsing the main configs.  So we just need to move
the files there -- this is what's done here.

One more thing done here is to add a new component subdirectory,
platforms, for definitions bytcr/* that don't match with neither the
existing ones (codecs nor dsps).

Suggested-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Jaroslav Kysela <perex@perex.cz>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoconf: USB-Audio: Add Dell WD19 Dock in the IEC958 blacklist
Hui Wang [Wed, 28 Nov 2018 09:16:45 +0000 (17:16 +0800)]
conf: USB-Audio: Add Dell WD19 Dock in the IEC958 blacklist

This Dock doesn't have IEC958 physical output, so add it to the
blacklist to prevent it being opened.

[ Also adding WD15 Dock entry that has the same problem -- tiwai ]

Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agopcm: dshare: Fix segfault when not binding channel 0
Kirill Marinushkin [Tue, 20 Nov 2018 20:43:44 +0000 (21:43 +0100)]
pcm: dshare: Fix segfault when not binding channel 0

Configuration to reproduce:

~~~~
pcm.share_right {
  type dshare
  ipc_key 73
  ipc_perm 0666
  slave {
    pcm "hw:0,0"
  }
  bindings {
    # the seagfault happens when we don't bind channel 0
    1 1
  }
}
~~~~

Execute to reproduce:

~~~~
$ aplay -D plug:share_right test.wav
Playing WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
Segmentation fault
~~~~

For channels whithout binding, values are set to UINT_MAX in function
`snd_pcm_direct_parse_bindings()`:

~~~~
for (chn = 0; chn < count; chn++)
bindings[chn] = UINT_MAX; /* don't route */
~~~~

But, these values are not checked when playing, which causes the segfault.

This commit fixes the issue.

Signed-off-by: Kirill Marinushkin <kmarinushkin@birdec.tech>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agopcm: dmix: Add option to allow alignment of slave pointers
Laxmi Devi [Tue, 13 Nov 2018 07:43:00 +0000 (08:43 +0100)]
pcm: dmix: Add option to allow alignment of slave pointers

These changes are required due to the kernel
commit 07b7acb51d283d8469696c906b91f1882696a4d4
("ASoC: rsnd: update pointer more accurate")

Issue is that snd_pcm_wait() goes back to waiting because the hw_ptr
is not period aligned. Therefore snd_pcm_wait() will block for a longer
time as required.

With these rcar driver changes the exact position of the dma is returned.
During snd_pcm_start they read hw_ptr as reference, and this hw_ptr
is now not period aligned, and is a little ahead over the period while it
is read. Therefore when the avail is calculated during snd_pcm_wait(),
it is missing the avail_min by a few frames.

An additional option hw_ptr_alignment is provided to dmix configuration,
to allow the user to configure the slave application and hw pointer
alignment at startup

[ Slight indentation and parentheses removals by tiwai ]

Signed-off-by: Laxmi Devi <Laxmi.Devi@in.bosch.com>
Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoutils/alsa.m4: conditionally enable libdl in AM_PATH_ALSA m4 macro
Thomas De Schampheleire [Thu, 1 Nov 2018 14:40:07 +0000 (15:40 +0100)]
utils/alsa.m4: conditionally enable libdl in AM_PATH_ALSA m4 macro

The AM_PATH_ALSA macro in utils/alsa.m4 unconditionally uses
-ldl. This breaks compilation of alsa-utils (and probably other
packages using this macro) for targets that do not support dynamic
loading.

This patch updates the macro to check if dlopen is available, and use
that result to conditionally add -ldl to the list of libraries.

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoREADME.md: add link to www.alsa-project.org
Jaroslav Kysela [Wed, 24 Oct 2018 15:33:10 +0000 (17:33 +0200)]
README.md: add link to www.alsa-project.org

5 years agoinitial version of README.md for github
Jaroslav Kysela [Wed, 24 Oct 2018 14:13:48 +0000 (16:13 +0200)]
initial version of README.md for github

5 years agoinitial version of .travis.yml file
Jaroslav Kysela [Tue, 23 Oct 2018 15:21:16 +0000 (17:21 +0200)]
initial version of .travis.yml file

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agopcm: interval: Interpret (x x+1] correctly and return x+1
Timo Wischer [Thu, 18 Oct 2018 11:33:24 +0000 (13:33 +0200)]
pcm: interval: Interpret (x x+1] correctly and return x+1

Without this change an interval of (x x+1] will be interpreted as an
empty interval but the right value would be x+1.
This leads to a failing snd_pcm_hw_params() call which returns -EINVAL.

An example issue log is given in the following:
snd_pcm_hw_params failed with err -22 (Invalid argument)
ACCESS: MMAP_NONINTERLEAVED
FORMAT: S16_LE
SUBFORMAT: STD
SAMPLE_BITS: 16
FRAME_BITS: 16
CHANNELS: 1
RATE: 16000
PERIOD_TIME: (15999 16000]
PERIOD_SIZE: (255 256]
PERIOD_BYTES: (510 512]
PERIODS: [2 3)
BUFFER_TIME: 32000
BUFFER_SIZE: 512
BUFFER_BYTES: 1024

In case of (x x+1) we have to interpret it anyway as a single value of x to
compensate rounding issues.
For example the period size will result in an interval of (352 353) when
the period time is 16ms and the sample rate 22050 Hz
(16ms * 22,05 kHz = 352,8 frames). But 352 has to be chosen to allow a
buffer size of 705 (32ms * 22,05 kHz = 705,6 frames) which has to be >= 2x
period size to avoid Xruns. The buffer size will not end up with an
interval of (705 706) simular to the period size because
snd_pcm_rate_hw_refine_cchange() calls snd_interval_floor() for the buffer
size. Therefore this value will be interpreted as an integer interval
instead of a real interval further on.

This issue seems to exist since the change of 9bb985c38 ("pcm:
snd_interval_refine_first/last: exclude value only if also excluded
before")

Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotest/audio_time: remove unused variables
Jaroslav Kysela [Tue, 23 Oct 2018 08:20:20 +0000 (10:20 +0200)]
test/audio_time: remove unused variables

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotest: rename code to more approriate mixtest
Jaroslav Kysela [Tue, 23 Oct 2018 08:18:24 +0000 (10:18 +0200)]
test: rename code to more approriate mixtest

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotest/code: make it work again
Jaroslav Kysela [Tue, 23 Oct 2018 08:17:12 +0000 (10:17 +0200)]
test/code: make it work again

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotest/latecy: fix typo in tstamp compare
Jaroslav Kysela [Tue, 23 Oct 2018 08:03:17 +0000 (10:03 +0200)]
test/latecy: fix typo in tstamp compare

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoconf/ucm/Dell-WD15-Dock: Fix incorrect device names
Takashi Iwai [Thu, 18 Oct 2018 07:38:38 +0000 (09:38 +0200)]
conf/ucm/Dell-WD15-Dock: Fix incorrect device names

The device name string for Dell WD15 (and its variants) dock is set as
"WD15Dock", while the actual device name to be used is "Dock".

Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1112292
Fixes: 8ebb40c96970 ("conf/ucm: Add a UCM profile for Dell WD15 Dock USB-audio")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoRelease v1.1.7
Jaroslav Kysela [Tue, 16 Oct 2018 08:08:35 +0000 (10:08 +0200)]
Release v1.1.7

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoioplug: Fix comment in struct snd_pcm_ioplug
Andre Guedes [Fri, 28 Sep 2018 21:33:35 +0000 (14:33 -0700)]
ioplug: Fix comment in struct snd_pcm_ioplug

This patch fixes the comment about 'pcm' field in 'struct
snd_pcm_ioplug' which wrongly refers to snd_pcm_extplug_create().

Signed-off-by: Andre Guedes <andre.guedes@intel.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>