This patch adds new API functions, snd_ctl_open_fallback() and
snd_pcm_open_fallback(). These are just like snd_*_open_lconf() but
used to open a fallback PCM/control. The difference is that it replaces
the name string with the given original name, so that hctl and other
upper-layers will recognize it as an alias.
When "default" PCM and control definitions are overwritten by others
like PulseAudio setup, the original system-default defition is lost.
This is a problem when PA is temporarily (or intentionally) disabled
and user wants to use the default dmix.
This patch adds a new standard definition for the system-default,
"sysdefault". This can be used for fallbacks.
Stephen Warren [Mon, 6 Jun 2011 20:16:57 +0000 (14:16 -0600)]
UCM: get: Implement 'exact' value retrieval
[=]<NAME>[/[<modifier>|</device>][/<verb>]]
- value identifier <NAME>
- Search starts at given modifier or device if any,
else at a verb
- Search starts at given verb if any,
else current verb
- Searches modifier/device, then verb, then defaults
- Specify a leading "=" to search only the exact
device/modifier/verb specified, and not search
through each object in turn.
- Examples:
"PlaybackPCM/Play Music"
"CapturePCM/SPDIF"
From ValueDefaults only:
"=Variable"
From current active verb:
"=Variable//"
From verb "Verb":
"=Variable//Verb"
From "Modifier" in current active verb:
"=Variable/Modifier/"
From "Modifier" in "Verb":
"=Variable/Modifier/Verb"
Stephen Warren [Fri, 3 Jun 2011 20:56:32 +0000 (14:56 -0600)]
UCM: Disallow gets of undefined system properties
In UCM, there are various system-defined properties whose names start
with "_". Explicitly prevent any gets from falling back to properties
defined in a config file if the property name starts with "_", in order
to reserve the entire "_" namespace for system-defined properties.
Stephen Warren [Fri, 3 Jun 2011 20:56:31 +0000 (14:56 -0600)]
UCM: Implement ConflictingDevices, add device list to devices
Wherever SupportedDevice can appear, also allow ConflictingDevice. Only
one or the other (or neither) may be specified. When neither is
specified, allow anything. Sometimes, listing ConflictingDevices may
result in a shorter list than explicitly listing all SupportedDevices.
Add support for SupportedDevice and ConflictingDevice to SectionDevice.
This allows representing devices which are mutually exclusive, e.g. due
to a mux that switches between capturing from two different microphones,
without the possibility of mixing.
Enhance is_modifier_supported to allow ignoring SupportedDevice and
ConflictingDevice. This is useful when querying values from a
SectionModifier; there's no reason we shouldn't be able to query values
just because the current configuration would prevent enabling that
device. The new is_device_supported is implemented similarly.
Enhance switch_device to remove the old device from the current device
list before querying for the new device, and add it back immediately
afterwards. This allows the query for the new device to ignore any
conflicts caused solely by the old device.
... but also allows the old syntax, iff the index is exactly "0". If an
index is present, but not exactly "0", parsing will appear to succeed,
but produce an empty device or modifier.
When naming devices and modifiers, even if the legacy format is used,
any index is not included in the name; i.e. both sets of syntax above
name the device just "Speaker".
The SupportedDevice list syntax still also accepts either "x" or "x.0",
but internally strips ".0" from the tail of any device name. Any other
name including "." is disallowed.
Finally, when comparing device or modifier names, a simple exact string
compare is now used, since no index data is ever present in device or
modifier names.
The one functional change introduced here is that a SupportedDevice
entry of just "x" will now only ever match a single device. It previously
acted as a wildcard for any device named "x.foo".
Stephen Warren [Thu, 2 Jun 2011 22:44:39 +0000 (16:44 -0600)]
UCM: Fix deadlock following failed get _verb
When querying the current verb without a verb set, snd_use_case_get bails
out early without unlocking uc_mgr->mutex. This causes subsequent API calls
to hang. Instead, s/return/goto __end/.
Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Raymond Yau [Fri, 13 May 2011 02:40:28 +0000 (10:40 +0800)]
emu10k1.conf - Fix no sound problem when using SB Live! Platinum
Add asym to front, rear and center_lfe to prevent route change after
removed the lock.
After removed the lock, when application using "hw", "front", "rear",
"surround40" and "surround51", the route of the front channel is
changed (lost right channel or both channels) when other application
using "front", "rear" or "center_lfe" to record
Signed-off-by: Raymond Yau <superquad.vortex2@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 4 May 2011 07:14:29 +0000 (09:14 +0200)]
Fix compile warnings
strstr() returns a char pointer
simple_none.c: In function ‘base_len’:
simple_none.c:940:33: warning: ordered comparison of pointer with integer zero
simple_none.c:941:29: warning: ordered comparison of pointer with integer zero
alsa-lib: fixed coverity reported issues under "FORWARD_NULL" checker.
Coverity Static Analysis helps developers find hard-to-spot,
yet potentially crash-causing defects early in the development phase,
reducing the cost,time, and risk of software errors.
This patch has fix for situations where variable can be NULL
but not been checked beforehand
Locking the controls in hooks causes a BUSY error when multiple
streams are opened, typically in PulseAudio. Better not to touch
the locking in hooks in such a case.
The ICE1712 kernel driver accepts 10 playback channels and
12 recording channels only. Therefore fix this channel count
in alsa-lib.
BugLink: http://bugs.launchpad.net/bugs/178442 Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Liam Girdwood [Tue, 21 Dec 2010 22:11:51 +0000 (23:11 +0100)]
ucm: modifiers names must be compound parse
Modifier names must end in a .index to ensure we can support
same named modifiers. However the modifier index will be for internal
use only and the client will not use the index when setting modifier.
The modifier selection for same name modifiers will be based upon supported
device.
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Jaroslav Kysela [Thu, 18 Nov 2010 08:27:07 +0000 (09:27 +0100)]
pcm: fix snd_pcm_avail_delay() function
For capture stream, the delay must be obtained as last, but we need to
update the ring buffer pointers for the avail_update call. So, rearrange
the code a bit and add hwsync call as first.
Clemens Ladisch [Mon, 15 Nov 2010 09:33:35 +0000 (10:33 +0100)]
pcm: pass hw_params flags to slave
Fix required before interrupt disabling routines patch can be applied.
Without this fix, the interrupts are only disabled when directly
accessing hw devices.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@intel.com> Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Simon McVittie [Fri, 8 Oct 2010 08:06:29 +0000 (09:06 +0100)]
Version-check libtool correctly when doing an out-of-tree build
libtool is only created at the end of ./configure, so it doesn't make
sense to grep it in ./configure (the check would always fail the first
time). However, ltmain.sh is copied into the ${srcdir} by libtoolize and
should be safe to check at any time that configure can be run.
Signed-off-by: Simon McVittie <smcv@debian.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Clemens Ladisch [Fri, 15 Oct 2010 08:33:20 +0000 (10:33 +0200)]
tlv: fix returned dB information for min-is-mute controls
For TLV information that indicates that the minimum value is actually
muted, the returned range used the wrong minimum dB value, and
converting dB values to raw control values did not round up correctly
near the minimum.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jaroslav Kysela [Mon, 11 Oct 2010 08:34:12 +0000 (10:34 +0200)]
config file processing: rewrite the locking - use one recursive mutex
Avoid configuration file processing races when multiple threads call
the *open() functions together (for example using alsaloop with
multiple -T jobs can reproduce this issue).
Jaroslav Kysela [Wed, 22 Sep 2010 12:31:15 +0000 (14:31 +0200)]
ucm: Introduce "Value {}" section, more implementation work
- new "Value {}" section is introduced for read-only values
describing the PCM and control/mixer IDs (or any other
things)
- more complete implementation for API functions
Jaroslav Kysela [Wed, 25 Aug 2010 07:03:36 +0000 (09:03 +0200)]
ucm: Recode header to be more universal
- merge all similar functions to one - make everything
string based
- add possibility to create virtual cards
- add comment pairs for the end user interface
Liam Girdwood [Mon, 23 Aug 2010 16:17:18 +0000 (18:17 +0200)]
ucm: core - Add initial Use Case Manager support.
This patch adds audio Use Case management support to alsa-lib.
UCM is designed to abstract the audio device hardware mixer controls into
high level abstract use cases.
The use case manager works by configuring the sound card ALSA kcontrols to
change the hardware digital and analog audio routing to match the requested
device use case. The use case manager kcontrol configurations are stored in
easy to modify text files.
UCM development has been kindly sponsored by Texas Instruments Inc,
Wolfson Microelectronics PLC and Slimlogic Ltd.
CC: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Stefan Schmidt <stefan@slimlogic.co.uk> Signed-off-by: Justin Xu <justinx@slimlogic.co.uk> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Liam Girdwood [Mon, 23 Aug 2010 16:17:17 +0000 (18:17 +0200)]
ucm: header - ALSA Use Case Manager
This patch adds the API header for alsa-lib Use Case Management support.
This file defines the public interface exported by UCM to client
applications.
UCM development has been kindly sponsored by Texas Instruments Inc,
Wolfson Microelectronics PLC and Slimlogic Ltd.
CC: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Stefan Schmidt <stefan@slimlogic.co.uk> Signed-off-by: Jaroslav Kysela <perex@perex.cz> Signed-off-by: Justin Xu <justinx@slimlogic.co.uk> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Jaroslav Kysela [Wed, 11 Aug 2010 18:20:40 +0000 (20:20 +0200)]
pcm: introduce defaults.pcm.compat to change the params choose behaviour
Having getenv directly in the function is not a good idea. Allow
configuration of the behaviour change in snd_pcm_param_choose() function
using alsa.conf. Use the environment variable LIBASOUND_COMPAT only
as fallback.
Jaroslav Kysela [Wed, 11 Aug 2010 17:45:40 +0000 (19:45 +0200)]
pcm: add defaults.pcm.minperiodtime parsing
Some broken applications like Audacious don't set any timing parameters.
While the alsa-lib behaviour is to select the smallest period size and
biggest buffer size, the result is the generation of thousands
interrupts per second.