Commit graph

2890 commits

Author SHA1 Message Date
Andrew Eikum
226a34ac09 Document strdup allocation in snd_card_get_name family
This was spotted by Jörg Höhle on the wine-patches ML.

Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-01-19 12:38:58 +01:00
Andrew Eikum
ad2a0b3a56 Improve snd_device_name_hint documentation
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-01-19 12:36:58 +01:00
Andrew Eikum
43956de710 Improve hw_params documentation
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-01-19 12:36:39 +01:00
Andrew Eikum
235aec0a75 Search-and-replace improve documentation language
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-01-19 12:36:09 +01:00
Andrew Eikum
6eafe5db3d Remove docs for snd_names_list and snd_names_list_free
No need to have misleading docs for functions that do nothing.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-01-19 12:35:20 +01:00
Takashi Iwai
f562b032be pcm:mmap_emul: Fix sw_params and others in bypass mode
When the slave doesn't need any mmap-emulation, the plugin shouldn't do
anything special in sw_params and other callbacks but just pass to the
generic helpers and update hwptr and applptr.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-11-15 07:58:35 +01:00
Clemens Ladisch
15c6f83296 control: add snd_ctl_elem_add_enumerated()
Handling of user control elements was implemented for all types except
BYTES and ENUMERATED.  Enumerated user controls will be needed for the
device-specific mixers of upcoming FireWire drivers.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2011-10-07 23:38:55 +02:00
Clemens Ladisch
567cc19a88 asound.h: cosmetic changes for consistency with kernel asound.h
Change some whitespace and comments to remove spurious differences
between the alsa-lib and kernel versions of asound.h.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2011-10-05 11:01:38 +02:00
Clemens Ladisch
9736511b36 asound.h: update for latest kernel
Refresh asound.h to be up to date with its kernel source.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2011-10-05 11:01:33 +02:00
Julia Lawall
fef6e6fd58 src/pcm/pcm_mmap.c: add missing free
The mmap_channels and running_areas fields are allocated using calloc, but
are not freed on an error path.

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Suman Saha <sumsaha@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-09-22 14:11:10 +02:00
Julia Lawall
c36f8c87ff src/pcm/pcm_multi.c: add missing free
Something that is allocated using calloc is not freed on an error path.

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Suman Saha <sumsaha@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-09-22 12:50:31 +02:00
Julia Lawall
03aa1a57c9 src/pcm/pcm_ladspa.c: add missing free
Something that is allocated using calloc is not freed on some
error paths.

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Suman Saha <sumsaha@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-09-22 12:49:54 +02:00
Julia Lawall
2a7f653b7f src/pcm/pcm_rate.c: add missing free
Something that is allocated using calloc is not freed on one
or more error paths.

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Suman Saha <sumsaha@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-09-22 12:47:44 +02:00
Clemens Ladisch
6dab1a91cb pcm: recalculate all rules after changing hw_params flags
The rules engine avoids recalculating rules that do not depend on
any changed parameter, but there is no mechanism to record changed
flags.  So when we change a flag, we have to ensure that all rules
depending on that flag are recalculated; the only method to do this
is to force recalculation of all rules.

So far, there have been no kernel drivers with rules depending
on flags, but rules to disable hardware SRCs by setting
SND_PCM_HW_PARAMS_NORESAMPLE are being introduced now.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2011-09-21 08:30:20 +02:00
Colin Guthrie
7924500688 conf: Allow for a directory to be given as a config file.
When this is done, *.conf files can be placed in that directory and they
will be processed by as if they were included directly.

A directory (typically /usr/share/alsa/alsa.conf.d/) has been
added into the distribution.

v2: Used existing conf syntax rather than processing via autotools
v3: Split file loading into separate function and made error handling
more consistent.

Signed-off-by: Colin Guthrie <colin@mageia.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-09-20 09:28:46 +02:00
Lu Guanqun
26e80c2e32 ucm: add another sequence 'msleep'
Thus, we have two sleep statements:
    msleep <milliseconds>
    usleep <microseconds>

Signed-off-by: Lu Guanqun <guanqun.lu@intel.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-08-22 12:42:09 +02:00
Lu Guanqun
a97aa7f065 ucm: tivial code style fix
Signed-off-by: Lu Guanqun <guanqun.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-08-19 10:41:35 +02:00
Lu Guanqun
29880e8c66 ucm: fix seg fault in execute_cset()
When there's no space in 'cset', 'pos' gets NULL, dereferencing 'pos' gets a
seg fault. We need to be more robust.

Signed-off-by: Lu Guanqun <guanqun.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-08-19 10:41:26 +02:00
Takashi Iwai
78dbc57b99 Merge branch 'fallback' 2011-07-29 15:56:39 +02:00
Adrian Knoth
e31aaac530 Add RME RPM to HDSP_IO_Type.
The hdsp.c driver supports the RME RPM devices, but we also need this
information in alsa-lib for tools like hdsploader and hdspmixer.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-29 07:38:19 +02:00
Takashi Iwai
acb423d937 Add snd_{ctl|pcm}_open_fallback() functions
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.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-27 15:24:13 +02:00
Takashi Iwai
e6f990e5c9 Define "sysdefault" PCM and control
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.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-27 15:24:09 +02:00
Stephen Warren
e2c2262403 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"

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-08 18:22:15 +02:00
Stephen Warren
a48f67c0ed UCM: snd_use_case_get: Don't segfault when no current verb
get_value, called by snd_use_case_get, uses uc_mgr->active_verb without
checking there is one, and hence can segfault. Fix this.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-08 18:21:46 +02:00
Stephen Warren
32d24f4071 UCM: Allow querying of {Supported,Conflicting}Devices
At any time, one can query:

_supporteddevs/<modifier>|<device>/<verb>
_conflictingdevs/<modifier>|<device>/<verb>

If a verb is current, one can query:

_supporteddevs/<modifier>|<device>
_conflictingdevs/<modifier>|<device>

Note that at most one of the supported/conflicting devs lists has
any entries, and when neither is present, all devices are supported.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-08 18:21:21 +02:00
Stephen Warren
547300fb35 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.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-08 18:21:01 +02:00
Stephen Warren
fc038149c5 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.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-08 18:20:26 +02:00
Stephen Warren
866fa538d4 UCM: Deprecate index on Section{Device,Modifier}
The previous supported "legacy" syntax was:

SectionDevice."Speaker".0 {
SectionModifier."Capture Voice".0 {

This change supports new syntax:

SectionDevice."Speaker" {
SectionModifier."Capture Voice" {

... 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".

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-08 18:20:00 +02:00
Takashi Iwai
e1c876a2f0 Fix missing error code in snd_ctl_hw_open()
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-03 17:27:27 +02:00
Stephen Warren
0a4b1ee746 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>
2011-06-03 11:45:17 +02:00
Stephen Warren
0a2fd2d386 UCM: Fix typo in error message
parse_name_is_safe disallows dots in the name, so not is the correct
word to use

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2011-06-03 11:44:59 +02:00
Alexander Stein
1720d30ad8 ctlparse: Respect softfloat configure option
If we want softlfoat we can't use ceil which uses libm.

Signed-off-by: Alexander Stein <a.stein@systec-electronic.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-05-20 09:10:04 +02:00
Raymond Yau
ea020c3b2e 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>
2011-05-16 14:27:51 +02:00
Takashi Iwai
922ff0da83 Specficy subdevice 0 for front/surround* of HDA-Intel.conf
The subdevice 0 is used for multi-channel outputs.
This fixes the detection of multi-channel devices of VIA codecs
by PulseAudio.

Reported-by: Raymond Yau <superquad.vortex2@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-05-09 14:11:22 +02:00
Baek Chang
516569bbba UCM: fix memory leak when executing cset commands
fix memory leak when executing cset commands.
snd_ctl_elem's are allocated, but never free'ed

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-05-04 09:21:34 +02:00
Takashi Iwai
e4735ddebd Add test/lsb/config to .gitignore
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-05-04 09:20:23 +02:00
Takashi Iwai
6bef13e251 Fix printf for size_t
Need to use z prefix for size_t type.

midiloop.c: In function ‘main’:
midiloop.c:172:2: warning: format ‘%i’ expects type ‘int’, but argument 2 has type ‘size_t’
....

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-05-04 09:19:09 +02:00
Takashi Iwai
75194776a7 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

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-05-04 09:14:29 +02:00
Sudarshan Bisht
808ce5deb3 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

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-05-04 09:11:46 +02:00
Raymond Yau
6bb36928b1 HDA-Intel.conf - Fix low mic volume due to pulseaudio using "front" device for playback and capture
Signed-off-by: Raymond Yau <superquad.vortex2@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-04-26 12:42:35 +02:00
Takashi Iwai
16f716eadd EMU10K1.conf: Don't lock hook controls
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.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-04-20 14:32:06 +02:00
Raymond Yau
7ed19bbc9a test/latency: print error message when 2 periods per buffer not supported
Print error message when playback/capture does not support 2 periods
per buffer.

Signed-off-by: Raymond Yau <superquad.vortex2@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-04-20 14:11:59 +02:00
David Henningsson
780f30ab1a Fix typo in comment in surround71.conf
BugLink: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=591318
Reported-by: Ariel <asdebian@dsgml.com>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2011-04-19 08:37:02 +02:00
Takashi Iwai
83059ee525 Mark Heaphone {Center|LFE} control of emu10k1 conf as optional
The controls referred in center_lfe definition in EMU10K1.conf should be
marked as optional since some boards don't have these.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-04-06 08:34:56 +02:00
Jaroslav Kysela
cd20fe3f4d configure: Fail when the user attempts to compile shared and static libs
There are some issues with libtool breaking the possibility to build both
types of libraries in one shot. Compile libraries separately.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2011-03-30 17:30:09 +02:00
Jaroslav Kysela
e419f63960 UCM: Fix LGPL licence ("how to receive" part referred GPL instead LGPL)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2011-03-28 11:06:33 +02:00
David Henningsson
d3906a9307 Conf: Fix channels of ICE1712 to 10/12
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>
2011-03-28 10:42:40 +02:00
Jaroslav Kysela
f2912f5099 UCM: Fix empty get_list - initialize returned pointer to NULL
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2011-03-19 01:09:41 +01:00
Jaroslav Kysela
60397387ef UCM: comment fixes and fix myvalue initialization fix in add_values()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2011-03-19 00:54:43 +01:00
Margarita Olaya
ae0a44c628 alsa-lib: ucm: allow values to be read from devices
This allows devices value to be read using the get_value().
Also fix a little formatting.

Signed-off-by: Margarita Olaya Cabrera <magi@slimlogic.co.uk>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-03-18 18:28:07 +01:00