OSDN Git Service

android-x86/external-alsa-lib.git
8 years agotopology: Add text section parser.
Liam Girdwood [Wed, 29 Jul 2015 16:45:15 +0000 (17:45 +0100)]
topology: Add text section parser.

Parse text lists (like enum values) and store for later attachment
to other objects.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agotopology: Add topology core parser.
Liam Girdwood [Wed, 29 Jul 2015 16:45:14 +0000 (17:45 +0100)]
topology: Add topology core parser.

The topology core parses the high level topology file and calls the
individual object parsers when any new object element is detected at
the high level.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agotopology: uapi: Add UAPI headers for topology ABI
Liam Girdwood [Wed, 29 Jul 2015 16:45:13 +0000 (17:45 +0100)]
topology: uapi: Add UAPI headers for topology ABI

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoReplace list.h with its own version
Takashi Iwai [Mon, 27 Jul 2015 10:32:37 +0000 (12:32 +0200)]
Replace list.h with its own version

We copied include/list.h from Linux kernel, and it's of course in
GPLv2.  This has raised concerns to many people, as it's not clear
whether such a code is considered to be completely trivial, thus it
might be seen as a derivative work, which takes effect in GPL, as
suggested by Clemens.

For clearing the situation, this patch replaces the existing list.h
implementation from a new version.  The API is kept to be compatible,
but the codes were written from full scratch under LGPL, to be aligned
with other alsa-lib codes.

Reported-by: Clemens Lang <clemens.lang@bmw-carit.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agopcm: restore hw params on set latency failed
Martin Geier [Fri, 24 Jul 2015 07:30:57 +0000 (09:30 +0200)]
pcm: restore hw params on set latency failed

When method snd_pcm_set_params sets sample rate to 22050 and latency to 50000
to davinci soc driver method snd_pcm_hw_params_set_buffer_time_near fails
and variable params is already changed in the method so the next method
snd_pcm_hw_params_set_period_time_near fails also.

Signed-off-by: Martin Geier <martin.geier@streamunlimited.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agotest: audio_time: show report validity and accuracy
Pierre-Louis Bossart [Wed, 1 Jul 2015 20:40:58 +0000 (15:40 -0500)]
test: audio_time: show report validity and accuracy

Add checks to show if driver reports valid report and resolution
information. disabled by default

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agotest: fix audio_time with new get/set audio_tstamp_config
Pierre-Louis Bossart [Wed, 1 Jul 2015 20:40:57 +0000 (15:40 -0500)]
test: fix audio_time with new get/set audio_tstamp_config

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agopcm: add support for new STATUS_EXT ioctl
Pierre-Louis Bossart [Wed, 1 Jul 2015 20:40:56 +0000 (15:40 -0500)]
pcm: add support for new STATUS_EXT ioctl

use STATUS_EXT ioctl if PCM protocol is > 2.0.12
All audio timestamp configuration will be ignored with an
older protocol.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agopcm: add support for get/set_audio_htstamp_config
Pierre-Louis Bossart [Wed, 1 Jul 2015 20:40:55 +0000 (15:40 -0500)]
pcm: add support for get/set_audio_htstamp_config

Enable kernel-side functionality by letting user select what sort of
timestamp it desires

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agopcm: add helper functions to query timestamping capabilities
Pierre-Louis Bossart [Wed, 1 Jul 2015 20:40:54 +0000 (15:40 -0500)]
pcm: add helper functions to query timestamping capabilities

extend support to link, link_estimated and link_synchronized
timestamp. wall-clock is deprecated

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoReplace unsafe characters with _ in card name
Alexander E. Patrakov [Mon, 29 Jun 2015 17:53:53 +0000 (22:53 +0500)]
Replace unsafe characters with _ in card name

Otherwise, they get misinterpreted as argument separators
in USB-Audio PCM definitions, and thus prevent SPDIF blacklist entries
from working.

While at it, add my Logitec C910 webcam to the SPDIF blacklist.

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agodocs: Add UCM link to main doxygen page.
Liam Girdwood [Mon, 29 Jun 2015 15:25:59 +0000 (16:25 +0100)]
docs: Add UCM link to main doxygen page.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoucm: docs: Fix doxygen formatting for UCM main page.
Liam Girdwood [Mon, 29 Jun 2015 15:25:58 +0000 (16:25 +0100)]
ucm: docs: Fix doxygen formatting for UCM main page.

Make sure group is defined and lists dipplayed correctly.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoucm: docs: fix doxygen exclude patch for UCM local header
Liam Girdwood [Mon, 29 Jun 2015 15:25:57 +0000 (16:25 +0100)]
ucm: docs: fix doxygen exclude patch for UCM local header

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agosurround41/50.conf: Use chmap syntax for better flexibility
David Henningsson [Thu, 18 Jun 2015 08:47:59 +0000 (10:47 +0200)]
surround41/50.conf: Use chmap syntax for better flexibility

In case the hardware only supports a specific channel map,
this change would allow surround41/50 to select the correct
channel map and channel count in this situation.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoPCM: snd_pcm_xxxx_drain() maybe blocked after suspend and resume
Shengjiu Wang [Fri, 12 Jun 2015 08:15:08 +0000 (16:15 +0800)]
PCM: snd_pcm_xxxx_drain() maybe blocked after suspend and resume

After suspend and resume, the alsa driver is stopped. But if alsa-lib run
into snd_pcm_xxxx_drain(), it need to wait avail >= pcm->stop_threshold,
otherwise, it will not exit the loop, so finally it is blocked at poll() of
snd_pcm_wait_nocheck(pcm, -1).
This patch is to add state check after snd_pcm_wait_nocheck(pcm, -1), if
the state is SND_PCM_STATE_SUSPENDED, then return error.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agocontrol: Allow cset'ing specific values in the multi-value case
Takashi Iwai [Wed, 10 Jun 2015 09:56:23 +0000 (11:56 +0200)]
control: Allow cset'ing specific values in the multi-value case

Improve the parser to allow empty elements followed by a comma.
Now amixer works like below for setting only the third element.
  % amixer cset 'IIR1 Band1' ,,200

Reported-and-tested-by: Arun Raghavan <arun@accosted.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agopcm: Fix snd_pcm_status() for dmix & co
Takashi Iwai [Tue, 2 Jun 2015 14:47:50 +0000 (16:47 +0200)]
pcm: Fix snd_pcm_status() for dmix & co

Fetch the timestamp and other status fields by issuing
snd_pcm_status() for the slave PCM.  Also, fill the delay field
properly.  This should fix longstanding PA's complaints.

Reported-by: Dan Hordern <danhordern@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agopcm: Don't assert in _snd_pcm_hw_params_internal()
Takashi Iwai [Mon, 1 Jun 2015 11:45:01 +0000 (13:45 +0200)]
pcm: Don't assert in _snd_pcm_hw_params_internal()

It's no fatal error from sw params, and it's really bad habit to use
assert() and abort the operation as a system library.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agotest/pcm_min: Fix error messages
Christophe Lohr [Mon, 1 Jun 2015 11:43:36 +0000 (13:43 +0200)]
test/pcm_min: Fix error messages

Fix the wrongly referred error code for error messages from
snd_pcm_writei() and other calls.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agotest/pcm: Fix generated values with float PCM format
Christophe Lohr [Mon, 1 Jun 2015 11:41:49 +0000 (13:41 +0200)]
test/pcm: Fix generated values with float PCM format

The float format should be generated [-1.0..1.0].

Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agopcm: Remove assert() from snd_pcm_hw_params_slave()
Takashi Iwai [Thu, 21 May 2015 05:26:39 +0000 (07:26 +0200)]
pcm: Remove assert() from snd_pcm_hw_params_slave()

Using assert() for non-fatal error checks is really brain-dead.
These are especially bad, as it hits even in the normal operation with
plugins and some h/w constraints.

Reported-by: Alan Horstmann <gineera@aspect135.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoucm: allow multiple devices in JackHWMute
Tanu Kaskinen [Mon, 4 May 2015 16:10:38 +0000 (19:10 +0300)]
ucm: allow multiple devices in JackHWMute

One jack may mute multiple devices, so let's make JackHWMute a list of
device names instead of just a single device name.

Signed-off-by: Tanu Kaskinen <tanu.kaskinen@linux.intel.com>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoconf/ucm: broadwell-rt286: change to set capture volume and capture device
Jie Yang [Fri, 8 May 2015 07:18:47 +0000 (15:18 +0800)]
conf/ucm: broadwell-rt286: change to set capture volume and capture device

Set 'Mic Capture Volume' in capture device EnableSequence, to fix
capture no volume by default issue.

Also add JackHWMute Value item to mute onboard dmic while headset
mic is plugged in.

Signed-off-by: Jie Yang <yang.jie@intel.com>
Tested-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoconf: Add hint descriptions to ctl, hwdep, seq and timer devices
Takashi Iwai [Thu, 30 Apr 2015 13:02:04 +0000 (15:02 +0200)]
conf: Add hint descriptions to ctl, hwdep, seq and timer devices

Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoAllow hint for ctl, hwdep, timer and seq
Takashi Iwai [Thu, 30 Apr 2015 12:52:35 +0000 (14:52 +0200)]
Allow hint for ctl, hwdep, timer and seq

Like pcm and rawmidi, each object parser needs to accept the hint
component.  Now a new local function _snd_conf_generic_id() was
introduced to replace each call of "comment" and "type" field checks.

Also, the two existing identical functions for pcm and rawmidi are
removed and the new function is used commonly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agonamehint: Fix bad free with invalid iface name
Takashi Iwai [Thu, 30 Apr 2015 12:38:25 +0000 (14:38 +0200)]
namehint: Fix bad free with invalid iface name

Due to the uninitialized field before the error path, passing an
invalid iface argument may result in a bad free() call.  Initialize
the fields properly beforehand.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agonamehint: Fix the listing without device number
Takashi Iwai [Thu, 30 Apr 2015 12:32:49 +0000 (14:32 +0200)]
namehint: Fix the listing without device number

The current code of snd_device_name_hint() has a bug when listing up
devices without the device index (e.g. ctl).  Because it assigns the
default device index 0 unconditionally and it has a check at the later
point to filter entries with dev >= 0, it ended up with empty
outputs.

The fix is simply to remove the bogus assignment of dev = 0.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agonamehint: Fix invalid list access in snd_device_name_hint()
Takashi Iwai [Thu, 30 Apr 2015 10:26:43 +0000 (12:26 +0200)]
namehint: Fix invalid list access in snd_device_name_hint()

snd_device_name_hint() tries to free the allocated list at the error
path via snd_device_name_free_hint().  But snd_device_name_free_hint()
expects a list terminated by NULL while snd_device_name_hint() doesn't
add it.  Adding it may again result in an error and thus isn't
guaranteed to work.  Hence we can't add NULL at the error path.

Instead, now the code always allocates one entry more, and zero-clears
the newly allocated beforehand to guarantee the NULL termination.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoconf/ucm: broadwell-rt286: change to use the correct jack kcontrol name
Jie Yang [Tue, 28 Apr 2015 07:40:22 +0000 (15:40 +0800)]
conf/ucm: broadwell-rt286: change to use the correct jack kcontrol name

The headset jack has two kctls: "Headphone Jack" and "Mic Jack",
we need switch speaker output according to the former JackControl.
Here correct it.

Signed-off-by: Jie Yang <yang.jie@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoSync include/sound/asound.h with 4.1 kernel
Takashi Iwai [Tue, 21 Apr 2015 10:49:29 +0000 (12:49 +0200)]
Sync include/sound/asound.h with 4.1 kernel

This adds the new ABI for timestamp stuff and minor fixes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoUSB-audio: Sound Blaster HD iec958 is on device 1
Richard Körber [Wed, 21 Jan 2015 21:50:27 +0000 (22:50 +0100)]
USB-audio: Sound Blaster HD iec958 is on device 1

Creative Sound Blaster X-Fi HD uses device 1 for iec958 output.

Signed-off-by: Richard Körber <dev@shredzone.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoucm: improve jack configuration documentation
Tanu Kaskinen [Thu, 5 Mar 2015 12:51:58 +0000 (14:51 +0200)]
ucm: improve jack configuration documentation

Signed-off-by: Tanu Kaskinen <tanu.kaskinen@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoucm: reformat snd_use_case_get() doc
Tanu Kaskinen [Thu, 5 Mar 2015 12:51:57 +0000 (14:51 +0200)]
ucm: reformat snd_use_case_get() doc

Doxygen doesn't preserve formatting that relies only on indentation.
This fixes it by using lists more liberally.

There are probably more places to fix than just
snd_use_case_get_list(), but I only have motivation for fixing this
function's documentation formatting (the next patch will add some more
content to the function's documentation).

Signed-off-by: Tanu Kaskinen <tanu.kaskinen@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoconf/ucm: Add Makefile.am for broadwell-rt286 ucm config
Takashi Iwai [Thu, 5 Mar 2015 10:03:56 +0000 (11:03 +0100)]
conf/ucm: Add Makefile.am for broadwell-rt286 ucm config

Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoconf/ucm: broadwell-rt286: add ucm config
Bard Liao [Thu, 5 Mar 2015 00:38:55 +0000 (08:38 +0800)]
conf/ucm: broadwell-rt286: add ucm config

The configure should apply to all Broadwell-rt286 boards from Intel,
like Wilson Beach SDS Ultrabook.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoucm: document some standard values
Lu, Han [Thu, 5 Mar 2015 00:38:54 +0000 (08:38 +0800)]
ucm: document some standard values

add standard value JackDev, JackControl and JackHWMute for speaker
mute control on jack insertion. These values will be applied on
pulseaudio.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoRelease v1.0.29
Jaroslav Kysela [Thu, 26 Feb 2015 12:34:52 +0000 (13:34 +0100)]
Release v1.0.29

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
9 years agoucm: fix some variable constness issues
Tanu Kaskinen [Tue, 17 Feb 2015 19:15:23 +0000 (21:15 +0200)]
ucm: fix some variable constness issues

I submitted earlier a patch that made the value parameter of
snd_use_case_get() non-const, but as that changed the public API, the
patch couldn't be accepted. This is the same patch, modifying the
internal code so that there are fewer issues with constness, but the
public API is left alone (a comment was added to the function
documentation, though, so that hopefully nobody else will try to fix
the same unfixable problem).

Signed-off-by: Tanu Kaskinen <tanu.kaskinen@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoucm: fix the logic of choosing the default cdev
Tanu Kaskinen [Tue, 17 Feb 2015 19:15:22 +0000 (21:15 +0200)]
ucm: fix the logic of choosing the default cdev

If the cdev has not been configured explicitly, use the PlaybackCTL
or CaptureCTL value if one of them is set. If neither are set, or if
both are set to different values, then there's no sensible default, so
executing the sequence should fail. The previous code probably tried
to implement this logic, but it was buggy.

Also use more descriptive variable names than "cdev1" and "cdev2".

Signed-off-by: Tanu Kaskinen <tanu.kaskinen@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoucm: fix incorrect error code sign
Tanu Kaskinen [Tue, 17 Feb 2015 19:15:21 +0000 (21:15 +0200)]
ucm: fix incorrect error code sign

Reported-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Tanu Kaskinen <tanu.kaskinen@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years ago.gitignore: add test-driver
Tanu Kaskinen [Mon, 16 Feb 2015 19:47:58 +0000 (21:47 +0200)]
.gitignore: add test-driver

Signed-off-by: Tanu Kaskinen <tanu.kaskinen@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoucm: fix variable mixup
Tanu Kaskinen [Tue, 10 Feb 2015 20:42:32 +0000 (22:42 +0200)]
ucm: fix variable mixup

I assume the intention was to use cdev1 for PlaybackCTL and cdev2 for
CaptureCTL, but cdev1 was being used for both and cdev2 was not used
for anything.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agocontrol: complement comment for subscribe API
Takashi Sakamoto [Mon, 9 Feb 2015 15:27:19 +0000 (00:27 +0900)]
control: complement comment for subscribe API

When minus value is given as a parameter, the API returns whether
the caller has already subscribed or not.

This commit adds a comment about this so as better documentation.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoconf: add support for USB AudioSport Quattro (tm)
Alexander E. Patrakov [Sat, 31 Jan 2015 18:26:07 +0000 (23:26 +0500)]
conf: add support for USB AudioSport Quattro (tm)

This patch resulted from discussion with redlion_ on #alsa IRC channel
on Freenode. 4-channel playback now works. 4-channel capture works too,
but not simultaneously with playback (hardware limitation).

Alsa-info before the fix:
http://www.alsa-project.org/db/?f=a3673622074b88a1abf4ccc6e7f37d0b5b72f34a

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoRemove unused hostname resolution in shm plugins and aserver
Takashi Iwai [Wed, 28 Jan 2015 15:21:14 +0000 (16:21 +0100)]
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>
9 years agoucm: add binary configure file parse
Lu, Han [Thu, 22 Jan 2015 01:32:47 +0000 (09:32 +0800)]
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>
9 years agoconf/ucm: GoogleNyan: Add configuration
Tomeu Vizoso [Thu, 15 Jan 2015 16:27:29 +0000 (17:27 +0100)]
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>
9 years agoautotools: fix ucm partial build
Matthieu Crapet [Wed, 14 Jan 2015 14:42:45 +0000 (15:42 +0100)]
autotools: fix ucm partial build

When --disable-ucm configure option is specified,
don't install related include file.

Signed-off-by: Matthieu Crapet <Matthieu.Crapet@ingenico.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agocontrol: enable octal and hexadecimal parse
Lu, Han [Wed, 14 Jan 2015 01:08:30 +0000 (09:08 +0800)]
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>
9 years agopcm: fix buffer overflow in snd_pcm_chmap_print()
Anssi Hannula [Tue, 30 Dec 2014 18:46:11 +0000 (20:46 +0200)]
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>
9 years agohwdep: add OXFW driver support
Takashi Sakamoto [Fri, 28 Nov 2014 16:03:34 +0000 (01:03 +0900)]
hwdep: add OXFW driver support

Linux 3.19 newly support this driver. By hardware dependent interface,
userspace applications can get hardware information, lock/unlock kernel
streaming and receive lock status event.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agopcm: Fix assorted tstamp_type bugs/omissions.
Tim Cussins [Tue, 25 Nov 2014 14:44:54 +0000 (14:44 +0000)]
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>
9 years agoucm: Fix uninitialized err in snd_use_case_set()
Takashi Iwai [Fri, 21 Nov 2014 14:25:30 +0000 (15:25 +0100)]
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>
9 years agomixer: Fix unused parameter warnings
Takashi Iwai [Fri, 21 Nov 2014 14:22:01 +0000 (15:22 +0100)]
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>
9 years agomixer: Fix inclusion of config.h
Takashi Iwai [Fri, 21 Nov 2014 14:20:48 +0000 (15:20 +0100)]
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>
9 years agopcm: Fix DSD sample format endianess and add big-endian format
Jussi Laako [Fri, 21 Nov 2014 14:04:47 +0000 (16:04 +0200)]
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>
9 years agoUSB-audio: Add five more cards to IEC958 blacklist
David Henningsson [Mon, 17 Nov 2014 10:29:34 +0000 (11:29 +0100)]
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>
9 years agodlmisc: Remove unused label
Takashi Iwai [Sun, 16 Nov 2014 08:43:39 +0000 (09:43 +0100)]
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>
9 years agosnd_dlsym: only do versioning checks if built --with-versioning
John Spencer [Sat, 15 Nov 2014 12:41:00 +0000 (13:41 +0100)]
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>
9 years agopcm: dmix: Don't ignore SND_TIMER_EVENT_MSTOP
Takashi Iwai [Thu, 6 Nov 2014 11:12:02 +0000 (12:12 +0100)]
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>
9 years agosnd_user_file: fix memory leak
Andreas Schwab [Mon, 3 Nov 2014 16:22:28 +0000 (17:22 +0100)]
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>
9 years agoUSB-Audio: Add Scarlett 2i4 USB to S/PDIF blacklist
Panu Matilainen [Mon, 3 Nov 2014 15:42:44 +0000 (17:42 +0200)]
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>
9 years agoconf/ucm: PAZ00: add Toshiba AC100/Dynabook AZ new config
zombah [Tue, 23 Sep 2014 15:53:43 +0000 (19:53 +0400)]
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>
9 years agomixer: Fix missing hctl handle free in snd_mixer_attach_hctl()
Takashi Iwai [Tue, 23 Sep 2014 07:11:27 +0000 (09:11 +0200)]
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>
9 years agopcm: return negative value in case of error
Renu Tyagi [Tue, 23 Sep 2014 07:08:23 +0000 (09:08 +0200)]
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>
9 years agocontrol: return negative value in case of error
Renu Tyagi [Tue, 23 Sep 2014 07:08:09 +0000 (09:08 +0200)]
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>
9 years agoconf: return negative value in case of error
Renu Tyagi [Tue, 23 Sep 2014 07:07:20 +0000 (09:07 +0200)]
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>
9 years agopcm_hooks: null check for h
Renu Tyagi [Tue, 23 Sep 2014 07:07:13 +0000 (09:07 +0200)]
pcm_hooks: null check for h

Signed-off-by: renu tyagi <renu.tyagi@samsung.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agosocket: missing socket close
Renu Tyagi [Tue, 23 Sep 2014 07:06:36 +0000 (09:06 +0200)]
socket: missing socket close

Signed-off-by: renu tyagi <renu.tyagi@samsung.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agosimple_abst: null check for lib
Renu Tyagi [Tue, 23 Sep 2014 07:06:28 +0000 (09:06 +0200)]
simple_abst: null check for lib

Signed-off-by: renu tyagi <renu.tyagi@samsung.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agopcm_share: fixing missing mutex unlock
Renu Tyagi [Tue, 23 Sep 2014 07:05:39 +0000 (09:05 +0200)]
pcm_share: fixing missing mutex unlock

Signed-off-by: renu tyagi <renu.tyagi@samsung.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agorawmidi: close handle h
Renu Tyagi [Tue, 23 Sep 2014 07:05:27 +0000 (09:05 +0200)]
rawmidi: close handle h

Signed-off-by: renu tyagi <renu.tyagi@samsung.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agosbase: fixed missing free
Renu Tyagi [Tue, 23 Sep 2014 07:04:26 +0000 (09:04 +0200)]
sbase: fixed missing free

Signed-off-by: renu tyagi <renu.tyagi@samsung.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agopcm_file: fixed missing free
Renu Tyagi [Tue, 23 Sep 2014 07:04:19 +0000 (09:04 +0200)]
pcm_file: fixed missing free

Signed-off-by: renu tyagi <renu.tyagi@samsung.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agomixer: fixed double free
Renu Tyagi [Tue, 23 Sep 2014 07:01:36 +0000 (09:01 +0200)]
mixer: fixed double free

Signed-off-by: renu tyagi <renu.tyagi@samsung.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agohwdep: add missing declaration for snd_hwdep_poll_descriptors_count()
Takashi Sakamoto [Tue, 16 Sep 2014 22:07:03 +0000 (07:07 +0900)]
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>
9 years agopcm, rate: hw_avail must not be negative before starting the stream
Alexander E. Patrakov [Mon, 15 Sep 2014 14:17:47 +0000 (20:17 +0600)]
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>
9 years agopcm route: Fix the bad condition (always false)
Jaroslav Kysela [Tue, 16 Sep 2014 07:00:39 +0000 (09:00 +0200)]
pcm route: Fix the bad condition (always false)

9 years agoRevert "pcm: rewindable, forwardable: don't return stale data"
Jaroslav Kysela [Sun, 14 Sep 2014 16:33:37 +0000 (18:33 +0200)]
Revert "pcm: rewindable, forwardable: don't return stale data"

This reverts commit 6db0fe495ef1db1fd8f0ed791996f834665a926b.

9 years agopcm, file: don't recurse in the rewindable and forwardable callbacks
Alexander E. Patrakov [Sat, 13 Sep 2014 18:30:21 +0000 (00:30 +0600)]
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>
9 years agopcm: rewindable, forwardable: don't return stale data
Alexander E. Patrakov [Sat, 13 Sep 2014 18:30:20 +0000 (00:30 +0600)]
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>
9 years agodsnoop: rewindable and forwardable logic was swapped
Alexander E. Patrakov [Sat, 13 Sep 2014 18:30:19 +0000 (00:30 +0600)]
dsnoop: rewindable and forwardable logic was swapped

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
9 years agorate: handle negative values from snd_pcm_mmap_playback_hw_avail
Alexander E. Patrakov [Sat, 13 Sep 2014 18:30:18 +0000 (00:30 +0600)]
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>
9 years agopcm, null: use the snd_pcm_mmap_avail function
Alexander E. Patrakov [Sat, 13 Sep 2014 18:30:17 +0000 (00:30 +0600)]
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>
9 years agopcm, rate: use the snd_pcm_mmap_hw_avail function
Alexander E. Patrakov [Sat, 13 Sep 2014 18:30:16 +0000 (00:30 +0600)]
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>
9 years agopcm: handle negative values from snd_pcm_mmap_hw_avail
Alexander E. Patrakov [Sat, 13 Sep 2014 18:30:15 +0000 (00:30 +0600)]
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>
9 years agopcm: express the rewind size limitation logic better
Alexander E. Patrakov [Sat, 13 Sep 2014 18:30:14 +0000 (00:30 +0600)]
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>
9 years agodmix: actually rewind when running or being drained
Alexander E. Patrakov [Sat, 13 Sep 2014 18:30:13 +0000 (00:30 +0600)]
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>
9 years agopcm: add new 32-bit DSD sample format
Jurgen Kramer [Wed, 10 Sep 2014 07:00:28 +0000 (09:00 +0200)]
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>
9 years agopcm: fix return value of snd_pcm_share_slave_avail
Alexander E. Patrakov [Mon, 1 Sep 2014 19:29:36 +0000 (01:29 +0600)]
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>
9 years agopcm: fix snd_pcm_mmap_hw_avail() near the boundary
Alexander E. Patrakov [Sun, 31 Aug 2014 16:23:47 +0000 (22:23 +0600)]
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>
9 years agodoc: fix cross-compiling example
Dmitry Voytik [Fri, 22 Aug 2014 10:17:10 +0000 (14:17 +0400)]
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>
9 years agopcm: 2nd round of pcm_misc DSD fixes
Jurgen Kramer [Fri, 22 Aug 2014 08:15:10 +0000 (10:15 +0200)]
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>
9 years agoSync enum snd_hwdep_iface_t with include/asound/asound.h
Takashi Sakamoto [Mon, 18 Aug 2014 09:45:17 +0000 (18:45 +0900)]
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>
9 years agopcm: Add missing signed and endianess definitions for DSD formats
Takashi Iwai [Mon, 11 Aug 2014 09:55:03 +0000 (11:55 +0200)]
pcm: Add missing signed and endianess definitions for DSD formats

Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoSync include/sound/asound.h with 3.17-rc1 kernel
Takashi Iwai [Mon, 11 Aug 2014 09:51:29 +0000 (11:51 +0200)]
Sync include/sound/asound.h with 3.17-rc1 kernel

Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agopcm: Fix DSD formats userland usability
Jurgen Kramer [Sat, 9 Aug 2014 10:09:21 +0000 (12:09 +0200)]
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>
9 years agopcm: pcm_local.h: include <time.h> to enable CLOCK_MONOTONIC
Shengjiu Wang [Wed, 23 Jul 2014 07:09:58 +0000 (15:09 +0800)]
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>
9 years agopcm: Drop snd_pcm_linear_{get|put}32_index()
Takashi Iwai [Tue, 22 Jul 2014 10:20:50 +0000 (12:20 +0200)]
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>