OSDN Git Service

android-x86/external-alsa-lib.git
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>
10 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>
10 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>
10 years agopcm: route: Use get32 for multi-source route calculation
Takashi Iwai [Tue, 22 Jul 2014 09:55:40 +0000 (11:55 +0200)]
pcm: route: Use get32 for multi-source route calculation

The PCM route plugin can assign the destination value from average of
multiple sources with attenuation.  This requires the read of each
channel value, sums and writes the resultant value in the requested
format.

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

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

Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agopcm: Fill sw_params proto field
Takashi Iwai [Wed, 16 Jul 2014 15:48:34 +0000 (17:48 +0200)]
pcm: Fill sw_params proto field

Fill the new proto field introduced to sw_params with the current PCM
protocol version.  This makes tstamp_type evaluated properly in the
kernel.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agopcm: route: Use get/put labels for all 3 byte formats
Takashi Iwai [Mon, 21 Jul 2014 14:30:54 +0000 (16:30 +0200)]
pcm: route: Use get/put labels for all 3 byte formats

So far, use_getput flag is set only when the src or dest format is
24bit physical width.  But, also 18 and 20 bit physical width formats
should set the flag, too.  This patch makes the check broader to cover
all 3 bytes formats.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agotest/audio_time: Set timestamp type explicitly
Takashi Iwai [Mon, 14 Jul 2014 16:12:49 +0000 (18:12 +0200)]
test/audio_time: Set timestamp type explicitly

Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agopcm: Implement timestamp type handling in all plugins
Takashi Iwai [Thu, 10 Jul 2014 12:37:49 +0000 (14:37 +0200)]
pcm: Implement timestamp type handling in all plugins

Now all PCM plugins do support the proper timestamp type or pass it
over slaves.  The internal monotonic flag is dropped and replaced with
tstamp_type in all places.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agopcm: Implement timestamp type setup in hw plugin
Takashi Iwai [Thu, 10 Jul 2014 12:32:50 +0000 (14:32 +0200)]
pcm: Implement timestamp type setup in hw plugin

This patch implements the support for sw_params timestamp type in PCM
hw layer.  As gettimestamp() is still unchanged, the resultant
timstamps may be still with CLOCK_MONOTONIC even if you pass monotonic
raw type.  More fixes will follow.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agopcm: Add sw_params API functions to get/set timestamp type
Takashi Iwai [Thu, 10 Jul 2014 12:26:37 +0000 (14:26 +0200)]
pcm: Add sw_params API functions to get/set timestamp type

For obtaining / changing the timestamp type, add the corresponding
sw_params accessor API functions together with the public definitions
of timestamp types.

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

Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoAdd timestamp type to sw_params (internal only)
Takashi Iwai [Thu, 10 Jul 2014 12:22:33 +0000 (14:22 +0200)]
Add timestamp type to sw_params (internal only)

This patch is just the udpate of sound/asound.h taken from the kernel
commit.  The API changes and PCM structure changes will follow after
this.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agopcm: Provide a CLOCK_MONOTONIC_RAW timestamp type
Mark Brown [Tue, 8 Jul 2014 14:52:32 +0000 (16:52 +0200)]
pcm: Provide a CLOCK_MONOTONIC_RAW timestamp type

For applications which need to synchronise with external timebases such
as broadcast TV applications the kernel monotonic time is not optimal as
it includes adjustments from NTP and so may still include discontinuities
due to that. A raw monotonic time which does not include any adjustments
is available in the kernel from getrawmonotonic() so provide userspace with
a new timestamp type SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW which provides
timestamps based on this as an option.

Reported-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agopcm: rate: fix hw_ptr exceed the boundary
Shengjiu Wang [Mon, 14 Jul 2014 08:55:48 +0000 (16:55 +0800)]
pcm: rate: fix hw_ptr exceed the boundary

For long time test case, the hw_ptr will exceed the boundary, then cause
the avail size wrong.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoUSB-Audio: Add second S/PDIF device on Phiree U2
Anssi Hannula [Tue, 8 Jul 2014 08:19:20 +0000 (11:19 +0300)]
USB-Audio: Add second S/PDIF device on Phiree U2

Phiree U2 has an unusual configuration. It only has S/PDIF output, but
there are still two devices presented:
- device 0: PCM audio, subject to volume control
- device 1: non-PCM data (passthrough), not subject to volume control

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

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

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

Reported-by: touc @ XBMC forum
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoICE1712: add surround71 pcm definition
Alexander E. Patrakov [Mon, 30 Jun 2014 18:40:48 +0000 (00:40 +0600)]
ICE1712: add surround71 pcm definition

The M-Audio Delta 1010 card has 7.1 analog output, but no ready-made pcm
definition to use it.

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Reported-and-tested-by: Matt Zagrabelny <mzagrabe@d.umn.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoucm: Document PlaybackPCMIsDummy and CapturePCMIsDummy values
Tanu Kaskinen [Thu, 26 Jun 2014 10:30:25 +0000 (13:30 +0300)]
ucm: Document PlaybackPCMIsDummy and CapturePCMIsDummy values

At least PulseAudio needs special handling for dummy devices. To allow
that to happen automatically, the UCM configuration should contain the
information about which PCMs are dummy.

Signed-off-by: Tanu Kaskinen <tanu.kaskinen@linux.intel.com>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoRelease v1.0.28
Jaroslav Kysela [Tue, 17 Jun 2014 12:34:19 +0000 (14:34 +0200)]
Release v1.0.28

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
10 years agoalsa-lib: pcm_plug: fix float conversion for user specified ttable
Sergey [Mon, 16 Jun 2014 15:52:51 +0000 (19:52 +0400)]
alsa-lib: pcm_plug: fix float conversion for user specified ttable

Move custom ttable with equal channels case from a separate ttable_last
exception into a common plugins insertion loop.
Fixes plug with ttable for float pcms (jack, ladspa).
Example: aplay -fFLOAT_LE /dev/zero
pcm.!default {
    type plug
    slave.pcm { type null }
    ttable.0.0 1
}

Signed-off-by: Sergey <sergemp@mail.ru>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
10 years agoLoopback.conf: fix the comment
Jaroslav Kysela [Fri, 13 Jun 2014 17:18:43 +0000 (19:18 +0200)]
Loopback.conf: fix the comment

10 years agoAdd -lm to test programs to fix build failure.
Jordi Mallach [Fri, 28 Jun 2013 13:01:40 +0000 (15:01 +0200)]
Add -lm to test programs to fix build failure.

Add -lm to test programs that use sin(), to fix a build failure with recent
binutils.

Signed-off-by: Jordi Mallach <jordi@debian.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
10 years agopcm: rate plugin - remove the rewind/forward implementation
Jaroslav Kysela [Fri, 13 Jun 2014 09:15:07 +0000 (11:15 +0200)]
pcm: rate plugin - remove the rewind/forward implementation

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
10 years agopcm: rate: add rewindable and forwardable callbacks
Alexander E. Patrakov [Thu, 12 Jun 2014 10:34:22 +0000 (16:34 +0600)]
pcm: rate: add rewindable and forwardable callbacks

This commit does not fix nonsense values returned by the rewind and
forward callbacks. E.g., with period_size = 1024 and buffer_size = 4096,
an attempt to rewind 1024 samples from the nearly-full buffer returns
4090.

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

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
10 years agopcm: null plugin - fix the avail count
Jaroslav Kysela [Fri, 13 Jun 2014 08:46:54 +0000 (10:46 +0200)]
pcm: null plugin - fix the avail count

The automatic threshold start is not activated when the wrong avail
count is returned in the prepared state.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
10 years agopcm: null: add rewindable and forwardable callbacks
Alexander E. Patrakov [Thu, 12 Jun 2014 10:34:24 +0000 (16:34 +0600)]
pcm: null: add rewindable and forwardable callbacks

Dirty, but consistent with avail_update.

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
10 years agopcm: multi: implement rewindable and forwardable callbacks
Alexander E. Patrakov [Thu, 12 Jun 2014 10:34:23 +0000 (16:34 +0600)]
pcm: multi: implement rewindable and forwardable callbacks

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
10 years agopcm:file: add the missing htimestamp callback
Alexander E. Patrakov [Thu, 12 Jun 2014 10:34:21 +0000 (16:34 +0600)]
pcm:file: add the missing htimestamp callback

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
10 years agopcm: Fix channel map query when there are lots of maps
Anssi Hannula [Sun, 8 Jun 2014 09:58:56 +0000 (12:58 +0300)]
pcm: Fix channel map query when there are lots of maps

On most HDA Intel HDMI devices, the channel map list is approx. 500 ints
in size, making the 256-sized buffer used by
snd_pcm_query_chmaps_from_hw() too small and causing the query to fail
(NULL result to caller, ENOMEM).

Bump the buffer size to 2048 ints.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agopcm: route: Correctly close slave pcm when no matching chmap is found
David Henningsson [Tue, 27 May 2014 07:51:21 +0000 (09:51 +0200)]
pcm: route: Correctly close slave pcm when no matching chmap is found

This patch fixes a bug where the slave pcm was not correctly closed
on some error conditions, such as not finding a matching chmap.

Reported-by: Raymond Yau <superquad.vortex2@gmail.com>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agopcm: Fix forward/rewind support in iec958 plugin
Alexander E. Patrakov [Thu, 24 Apr 2014 14:40:06 +0000 (20:40 +0600)]
pcm: Fix forward/rewind support in iec958 plugin

When forwarding or rewinding, the frame counter was not updated. This
could result in corrupted channel status words or misplaced Z-type
preamble.

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agopcm: rate: Don't return negative frame count on success in rewind
Andrew Eikum [Fri, 4 Apr 2014 18:27:25 +0000 (13:27 -0500)]
pcm: rate: Don't return negative frame count on success in rewind

snd_pcm_rewind is documented to return <0 on failure and >=0 on
success.

Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agopcm: ladspa: Delay LADSPA plugin activate call
Matthias Larisch [Thu, 27 Mar 2014 18:05:10 +0000 (19:05 +0100)]
pcm: ladspa: Delay LADSPA plugin activate call

Some LADSPA Plugins rely on connected control ports on activate call.
While this is not okay by spec, the spec also encourages the activate
call happening as late as possible.

Signed-off-by: Matthias Larisch <mail@matthias-larisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoRevert "pcm: route: Don't handle no matching chmap as a serious error"
Takashi Iwai [Wed, 19 Mar 2014 09:54:08 +0000 (10:54 +0100)]
Revert "pcm: route: Don't handle no matching chmap as a serious error"

This reverts commit 5b72e3d5305930bffc300aa4f2545ba95992c144.

With the previous fixes, it's no longer needed as a workaround for
regression with PulseAudio.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoroute: Fix invalid pointer access
Takashi Iwai [Wed, 19 Mar 2014 09:52:24 +0000 (10:52 +0100)]
route: Fix invalid pointer access

An uninitialized chmap pointer value is assigned in
_snd_pcm_route_open().  Add NULL initializations appropriately, and
also avoid the possible invalid access of NULL pcmp pointer.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoroute: Return NULL in case of zero found channels in determine_chmap
David Henningsson [Tue, 18 Mar 2014 22:07:19 +0000 (23:07 +0100)]
route: Return NULL in case of zero found channels in determine_chmap

This should fix the problem where the old route syntax can no longer
be opened.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agopcm: route: Don't handle no matching chmap as a serious error
Takashi Iwai [Tue, 18 Mar 2014 14:23:09 +0000 (15:23 +0100)]
pcm: route: Don't handle no matching chmap as a serious error

When find_matching_chmap() returns an error for the non-matching
chmap, the caller, snd_pcm_route_open(), also returns an error
although it shouldn't be handled as the fatal error.  This results in
the probe error with PulseAudio and it gives no real output in the
end.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agosrc/conf/cards: Add missing entry for Loopback.conf
Takashi Iwai [Tue, 11 Mar 2014 09:59:21 +0000 (10:59 +0100)]
src/conf/cards: Add missing entry for Loopback.conf

Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agopcm: Wrap hw_ptr to boundary in pcm_ioplug
MONTANARO Luciano (MM) [Tue, 4 Mar 2014 11:51:36 +0000 (12:51 +0100)]
pcm: Wrap hw_ptr to boundary in pcm_ioplug

The function snd_pcm_ioplug_hw_ptr_update() always increased the hw_ptr
by delta, without wrapping it to the boundary. This would lead to
problems when after many hours, the hw_ptr would overflow.

Signed-off-by: Luciano Montanaro <luciano.montanaro@magnetimarelli.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
10 years agoconf: Allow 2.1 surround to use different number of channels
David Henningsson [Fri, 28 Feb 2014 07:57:07 +0000 (08:57 +0100)]
conf: Allow 2.1 surround to use different number of channels

This way, cards that support LFE on four channels (e g laptop with
internal subwoofer) can do that, and other cards on a six channel setup
can use that as well.

Well, note that there is still a reference to "pcm.surround51" left here.
In practice, for HDA Intel sound cards this does not matter as both
surround51 and surround40 reference the same definition.
(And that's the only card I currently know of that actually does
surround2.1 over four channels.)

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agopcm: route: Select slave chmap based on ttable information
David Henningsson [Fri, 28 Feb 2014 07:57:06 +0000 (08:57 +0100)]
pcm: route: Select slave chmap based on ttable information

It means we need to initialize this order:

 1) Read the ttable to figure out which channels are present
 2) Open slave pcm and find a matching chmap
 3) Determine size of ttable (this can now depend on the chmap)
 4) Read ttable coefficients
 5) At prepare time, select the matching chmap

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agopcm: route: Allow chmap syntax for slave channels in ttable
David Henningsson [Fri, 28 Feb 2014 07:57:05 +0000 (08:57 +0100)]
pcm: route: Allow chmap syntax for slave channels in ttable

Instead of writing e g "0" and "1", one can now write "FL" and "FR" instead.

E g:
ttable.0.FL 1
ttable.1.FR 1
ttable.2.LFE 1

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agopcm: Insert linear-to-float conversion when rate or channel count is incorrect
Maarten Baert [Wed, 26 Feb 2014 13:23:45 +0000 (14:23 +0100)]
pcm: Insert linear-to-float conversion when rate or channel count is incorrect

This fixes a bug where snd_pcm_plug_insert_plugins fails when both
client and slave use format float, but the rate or channel count does
not match. I also removed some redundant code.

Signed-off-by: Maarten Baert <maarten-baert@hotmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoautotools: update style
Patrick Welche [Tue, 25 Feb 2014 12:40:21 +0000 (12:40 +0000)]
autotools: update style

- rename configure.in to configure.ac
- replace INCLUDES with AM_CPPFLAGS
- modernize AM_INIT_AUTOMAKE invocation

Signed-off-by: Patrick Welche <prlw1@cam.ac.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoPortability fix: look for sys/endian.h as well as endian.h
Patrick Welche [Sun, 23 Feb 2014 11:12:48 +0000 (11:12 +0000)]
Portability fix: look for sys/endian.h as well as endian.h

- define __BYTE_ORDER and friends.
- adjust asoundlib.h accordingly.

Signed-off-by: Patrick Welche <prlw1@cam.ac.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoconf: Add surround 2.1 support to all cards
David Henningsson [Tue, 18 Feb 2014 15:41:49 +0000 (16:41 +0100)]
conf: Add surround 2.1 support to all cards

All cards that support 4.1 surround now also support 2.1 surround,
because they both have surround 5.1 as slave.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoconf: Add basic infrastructure for 2.1 surround sound
David Henningsson [Tue, 18 Feb 2014 15:41:48 +0000 (16:41 +0100)]
conf: Add basic infrastructure for 2.1 surround sound

For now, we do 2.1 over 5.1, because that's what ALSA allows per default.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoalsa-lib: heavy pcm atomics cleanup
Riku Voipio [Fri, 7 Feb 2014 13:38:58 +0000 (15:38 +0200)]
alsa-lib: heavy pcm atomics cleanup

The following patch comes from the realization that at least ARM code
for atomics is quite broken and nobody has cared for a decade.

A quick dive shows that only snd_atomic_{read,write}_{begin,end}
appear to be used widely. These are implemented using wmb/rmb.

Only other use of atomic functions is in pcm_meter.c.
The #SND_PCM_TYPE_METER plugin type appears rarely, if ever, used.
I presume these days anyone who wants a meter/scope will do in pulseaudio
layer instead of alsa.

It would seem better fit to have pcm_meter in alsa-plugins instead
of alsa-lib, but I guess that would be an ABI break...

So instead, I'm proposing here

1. Removal of all hand-crafted atomics from iatomic.h apart from barriers,
   which are used in snd_atomic_{read,write}_{begin,end}.

2. Using __sync_synchronize as the default fallback for barriers. This
   has been available since gcc 4.1, so it shouldn't be a problem.

3. Defining the few atomics used by pcm_meter.c withing pcm_meter.c
   itself, using gcc atomic builtins[1].

4. Since gcc atomic builtins are available only since gcc 4.7, add a check for
   that in gcc configure.in, and don't build pcm meter plugin if using
   older gcc.

The last point has the impact, that if there actually is someone who 1)
uses the meter plugin 2) wants to upgrade to 2014 alsa-lib 3) but
does not want to use a 2012+ gcc - that someone will be inconvenienced.

Finally remove the unneeded configure check for cpu type. We can
trust the gcc to set right flags for us.

[1] http://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html

Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agopcm: use CLOCK_REALTIME for non-monotonic ts
Olivier Langlois [Fri, 24 Jan 2014 00:03:00 +0000 (19:03 -0500)]
pcm: use CLOCK_REALTIME for non-monotonic ts

gettimeofday() is the same than clock_gettime(CLOCK_REALTIME)
except for the loss of precision and the double unnecessary
conversion timespec <-> timeval.

Signed-off-by: Olivier Langlois <olivier@trillion01.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agopcm: initialize monotonic field for dshare and dsnoop, too
Takashi Iwai [Thu, 23 Jan 2014 08:46:37 +0000 (09:46 +0100)]
pcm: initialize monotonic field for dshare and dsnoop, too

Just like the previous fix for dmix, we need update for dshare and
dsnoop plugins.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agopcm: initialize pcm_dmix monotonic field
Olivier Langlois [Thu, 23 Jan 2014 00:04:45 +0000 (19:04 -0500)]
pcm: initialize pcm_dmix monotonic field

not doing so, leaves the pcm object in an inconsistent state since
'info' field is copied from the slave which is then used when
snd_pcm_hw_params_is_monotonic() is called.

For instance, when using dmix with aplay and an underrun is occuring, the following
info is returned:

underrun!!! (at least 1248687948.256 ms long)
Status:
  state       : XRUN
  trigger_time: 1390347762.628483000
  tstamp      : 1390347766.184350000
  delay       : -635
  avail       : 15687
  avail_max   : 15675

now is computed from CLOCK_MONOTONIC while pcm status tstamps are from gettimeofday().

After the fix, underruns are still occuring on my setup but at least the displayed info
is correct:

underrun!!! (at least 7630.409 ms long)
Status:
  state       : XRUN
  trigger_time: 7652.739201431
  tstamp      : 7660.369600636
  delay       : -624
  avail       : 15676
  avail_max   : 15664

Signed-off-by: Olivier Langlois <olivier@trillion01.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agocontrol_hw: fix potential memory leak
Ivan Sorokin [Tue, 21 Jan 2014 20:12:50 +0000 (00:12 +0400)]
control_hw: fix potential memory leak

Signed-off-by: Ivan Sorokin <vanyacpp@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoalsa-lib: minor typo in pcm doc
Olivier Langlois [Mon, 6 Jan 2014 04:12:44 +0000 (23:12 -0500)]
alsa-lib: minor typo in pcm doc

Added a missing 'f' in the word 'diferent'

Signed-off-by: Olivier Langlois <olivier@trillion01.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
10 years agominor malloc changes
Olivier Langlois [Fri, 13 Dec 2013 04:47:20 +0000 (23:47 -0500)]
minor malloc changes

replace malloc + memset with calloc since calloc may skip the memset if
returned memory comes directly from sbrk()

use malloc instead of malloc if first thing done with allocated memory is
to flip all bits to 1.

Signed-off-by: Olivier Langlois <olivier@trillion01.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agodmix: Don't use assert() and abort()
Takashi Iwai [Wed, 27 Nov 2013 08:37:54 +0000 (09:37 +0100)]
dmix: Don't use assert() and abort()

We seem to still have some races at closing a dmix stream, but
aborting is the worst option.  Let's make not melt down.

Reference: https://bugzilla.novell.com/show_bug.cgi?id=852446
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agopcm_file: document new argument to snd_pcm_file_open().
Andrey Mazo [Sun, 17 Nov 2013 15:45:19 +0000 (19:45 +0400)]
pcm_file: document new argument to snd_pcm_file_open().

Document function argument, added in commit
4081be0b87ab9fa53a8906e66bc240f18a7a9a54.

Signed-off-by: Andrey Mazo <mazo@telum.ru>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agopcm_file: don't touch infile on playback and output file on capture.
Andrey Mazo [Sat, 16 Nov 2013 21:11:56 +0000 (01:11 +0400)]
pcm_file: don't touch infile on playback and output file on capture.

Commit 1d80c5b901baf7e1b7998dfa518532fbd64e4283 message describes
behaviour in case of specified infile option as
'No file writes will take place in this case'.
But this is clearly not the case as output file gets truncated while
running `arecord -Dtestin >/dev/null`, where "testin" is defined as
pcm.testin {
type file
slave.pcm null
file "/tmp/qqqq.out"
infile "/tmp/qqqq.in"
format "raw"
}

Besides that, the existing behaviour is rather counterintuitive,
requiring both output and input files to exist and making access to them
regardless of playback or capture intention.
Also, it's very confusing to get output file truncated while trying to
just capture from the device.

Current changeset introduces the following behaviour:
 - output file ("file" option) is only (p)open()'ed for writing
   only on playback to the device
 - any data is written to the output file descriptor
   (provided with "file" option) only on playback to the device
 - input file ("infile" option) is only open()'ed for reading only on
   capture from the device
 - any data is read from the input file descriptor
   (provided with the "infile" option) only on capture from the device

Signed-off-by: Andrey Mazo <mazo@telum.ru>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agopcm_file: fixed memory leak.
Andrey Mazo [Sat, 16 Nov 2013 21:11:55 +0000 (01:11 +0400)]
pcm_file: fixed memory leak.

Valgrind report for this leak was:

Command: aplay -Dfile:'/tmp/qqq',raw qqq.wav

14 bytes in 1 blocks are definitely lost in loss record 1 of 2
   at 0x402BF5C: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
   by 0x40D7557: snd_pcm_file_hw_params (in /usr/lib/libasound.so.2.0.0)
   by 0x40BA093: _snd_pcm_hw_params_internal (in /usr/lib/libasound.so.2.0.0)
   by 0x40AB831: snd_pcm_hw_params (in /usr/lib/libasound.so.2.0.0)
   by 0x804C523: ??? (in /usr/bin/aplay)
   by 0x804E5B7: ??? (in /usr/bin/aplay)
   by 0x804FC8C: ??? (in /usr/bin/aplay)
   by 0x80520FB: ??? (in /usr/bin/aplay)
   by 0x4184942: (below main) (libc-start.c:226)

Signed-off-by: Andrey Mazo <mazo@telum.ru>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agopcm_file: fix SEGFAULT if file option is missing while infile is not.
Andrey Mazo [Sat, 16 Nov 2013 21:11:54 +0000 (01:11 +0400)]
pcm_file: fix SEGFAULT if file option is missing while infile is not.

Commit 5c5f1358123af69155267463a0b6254ad9cbecc4 requires both file and
infile options to be missing to report a failure.
In fact, only file option is mandatory and should be checked there.
Otherwise, NULL file triggers segfault in
snd_pcm_file_replace_fname() called from
snd_pcm_file_open_output_file().
infile option is optional, so don't report fatal error if it's missing.

Signed-off-by: Andrey Mazo <mazo@telum.ru>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoconf.c: use portable way to initialize recursive mutex
Timo Teräs [Fri, 8 Nov 2013 12:17:58 +0000 (13:17 +0100)]
conf.c: use portable way to initialize recursive mutex

PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP is not in POSIX, as _NP
(non-portable) suggests.

exposing such a symbol in musl libc would lock in the ABI for all
times and makes it impossible to do future changes to the under-
lying struct without hideous symbol versioning hacks.

use the portable way instead: pthread_once was designed for such
cases.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Tested-by: John Spencer <maillist-alsa@barfooze.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
10 years agoinclude/global.h - don't define timeval and timespec structures for !glibc
Jaroslav Kysela [Fri, 8 Nov 2013 11:30:04 +0000 (12:30 +0100)]
include/global.h - don't define timeval and timespec structures for !glibc

On request from John Spencer <maillist-alsa@barfooze.de> .

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
10 years agotest/chmap: Add missing usage text for -s option
Takashi Iwai [Mon, 4 Nov 2013 13:19:03 +0000 (14:19 +0100)]
test/chmap: Add missing usage text for -s option

Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agolocal.h: include sys/types.h to fix issues with pcm.h
John Spencer [Thu, 10 Oct 2013 16:56:22 +0000 (18:56 +0200)]
local.h: include sys/types.h to fix issues with pcm.h

sys/types.h is required for the u_int_XX types used by pcm.h.
since a change in pcm.h is not desired, we add the inclusion
to the header that includes pcm.h during build.

Signed-off-by: John Spencer <maillist-alsa@barfooze.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoremove unnecessary/obsolete compat/hsearch_r.c
Waldemar Brodkorb [Wed, 2 Oct 2013 19:00:51 +0000 (21:00 +0200)]
remove unnecessary/obsolete compat/hsearch_r.c

The usage of hsearch functions where removed long time
ago in commit 273d115de05574251bdd661747ecb68449a5cf1d.
This patch highly increases portability for non-glibc systems.

Remove the complete compat directory as requested by
Takashi Iwai.

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agosnd_tlv_convert_from_dB: fix decreasing gain across entries
Stephen Warren [Mon, 30 Sep 2013 21:25:49 +0000 (15:25 -0600)]
snd_tlv_convert_from_dB: fix decreasing gain across entries

Currently, for a TLV consisting of TLV_DB_SCALE_ITEMs, if e.g. alsamixer
calls snd_mixer_selem_set_playback_dB() with a value that is in-between
two TLV_DB_SCALE_ITEMs, and xdir is negative, the selected raw hardware
value is the minimum in the first range above that value, rather than the
maximum in the last range below that value.

The user-visible symptom is that in alsamixer, pressing the down key to
reduce the value sticks at certain points, and cannot be incrementally
reduced any further, although directly selecting a much lower value (e.g.
by pressing 0..9) works as expected. This is triggered e.g. by
sound/soc/codec/max98090.c's max98090_hp_tlv[].

Fix this by checking whether xdir is positive or not, rather than
checking whether it has a non-zero value. The code to select the previous
range's max value is already present. This matches how xdir is used in
other parts of the code.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoHDA-Intel: present up to 8 HDMI/DP outputs via "hdmi" device
Anssi Hannula [Sun, 22 Sep 2013 21:41:50 +0000 (00:41 +0300)]
HDA-Intel: present up to 8 HDMI/DP outputs via "hdmi" device

Some new AMD cards have HDA codecs presenting 6 connected HDMI/DP pin
nodes (plus 1 unconnected pin node) according to the ALSA card database.

Example:
http://www.alsa-project.org/db/?f=de3ced7af41de0ed54d218650e5e2f16c511787b

Bump the maximum number of presented HDMI outputs per card via the
"hdmi" PCM from 4 to 8 (so that the last possible device is DEV=7).

Note that HDMI PCM devices DEV=4..7 use shared PCM device numbers, so
HDA cards that have over 4 audio PCM devices or multiple S/PDIF or modem
devices will have their remaining PCM devices misrepresented as HDMI
devices.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoFix access of freed memory in namehints
David Henningsson [Fri, 13 Sep 2013 17:21:44 +0000 (13:21 -0400)]
Fix access of freed memory in namehints

Sometimes a hook manipulates the config tree, which makes currently
running iterators point to freed memory. As a workaround, make two
copies, one for the iterators and another for the hooks.

BugLink: https://bugs.launchpad.net/bugs/1008600
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>