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 [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.
If user asks for 1dB the snd_tlv_convert_from_dB will not find
the raw value, since the 1dB is not part of either range.
To fix this, we will store the previous non maching range's
maximum raw value. If the dB value is not found in the next range,
we will check, if the requested dB value is in between the current
and the previous range, and if it is than pick the apropriate raw
value based on the xdir (up or down rounding).
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Peter Ujfalusi [Wed, 19 May 2010 06:19:26 +0000 (08:19 +0200)]
control: tlv: Check dB range only within the control's volume range
The DB_RANGE need to be used on some HW, since the gain on
volume control is not continuous, and has to be divided into
several sub DB_SCALE ranges.
ASoC has a feature to override the HW default volume range,
and in this case when the volume range is less than the
HW maximum we do not need to go through the whole DB_RANGE,
but we need to stop where the kcontrol's maximum tell us.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
snd_seq_parse_address() uses strncmp() to compare the client name
in the string argument with the existing clients, until it finds one
name matching the same leading characters. This may produce wrong
results when there are two sequencer clients with similar names.
Example: "KMidimon" : "Kmid"
Signed-off-by: Pedro Lopez-Cabanillas <pedro.lopez.cabanillas@gmail.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
setlocale() is not thread-safe. It can actually trigger a crash if
another thread uses locale informations at the same time in the process.
Library code should use POSIX newlocale/duplocale/uselocale/freelocale
instead. Those functions only change the locale data for the calling
thread.
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
David Fries [Fri, 25 Dec 2009 20:22:38 +0000 (14:22 -0600)]
modem.conf Off-hook improve behavior
Only restore the old value if it differs from the requested
value, because if it has changed restoring the old value
overrides the change. Take for example, a voice modem with
a .conf that sets preserve off-hook. Start playback (on-hook
to off-hook), start record (off-hook to off-hook), stop
playback (off-hook to restore on-hook), stop record (on-hook
to restore off-hook), Clearly you don't want to leave the
modem "on the phone" now that there isn't any playback or
recording active.
Signed-off-by: David Fries <david@fries.net> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jaroslav Kysela [Mon, 21 Dec 2009 08:09:42 +0000 (09:09 +0100)]
pcm: Close event timer in pcm_hw plugin
Dan McCombs discovered that snd_pcm_close() invocations are not leading
to associated timers being closed, which results in successively more
timers being created but not freed.
Original patch from Daniel T Chen <crimsun@ubuntu.com>.
Clemens Ladisch [Mon, 23 Nov 2009 09:56:46 +0000 (10:56 +0100)]
mixer: fix enum check
The recent CHECK_ENUM fix uncovered a bug in snd_mixer_selem_is_enumerated()
which would now return -EINVAL for any non-enum control, which would be
interpreted as 'true' by callers like amixer or alsamixer.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Michael Olbrich [Mon, 16 Nov 2009 10:31:49 +0000 (11:31 +0100)]
simple_none.c uses HAVE_SOFT_FLOAT it has to include config.h
for this to work properly.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Takashi Iwai [Sun, 8 Nov 2009 08:26:23 +0000 (09:26 +0100)]
Fix CHECK_ENUM() in simple.c
simple.c: In function ‘snd_mixer_selem_is_enumerated’:
simple.c:881: warning: suggest parentheses around operand of ‘!’ or change ‘&’ to ‘&&’ or ‘!’ to ‘~’
Jaroslav Kysela [Tue, 3 Nov 2009 15:36:55 +0000 (16:36 +0100)]
namehint: add missing list->card initialization
list->card is wrongly assumed to be initialized, but the previous
initialization is within a conditional that is false when only
card-independent devices are found. (This is the case when searching
for mixers on my system; the end result is that the "pulse" mixer is
listed three times.)
Signed-off-by: John Lindgren <john.lindgren@tds.net> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Jaroslav Kysela [Tue, 3 Nov 2009 15:34:34 +0000 (16:34 +0100)]
Cache libasound.so access in snd_dlopen
Speed up repeated calls to snd_dlopen by caching the path to
libasound.so; this reduces the instructions executed by
snd_device_name_hint by 40 percent.
Signed-off-by: John Lindgren <john.lindgren@tds.net> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Takashi Iwai [Tue, 3 Nov 2009 07:57:10 +0000 (08:57 +0100)]
Fix corruption after snd_device_name_hint()
snd_device_name_hint() corrupts the config name space after its call.
This results in the error from the suceeding calls of snd_pcm_open()
after snd_device_name_hint().
The bug is in try_config() in namehint.c; it calls snd_config_delete(res)
but res can be two different objects in the function. One is the object
obtained via snd_config_search_definition(), and another is the one from
snd_config_search_alias_hooks(). The former is the expanded objects,
thus it should be freed. But, the latter is a reference, and must not be
freed.
This patch adds the check to free or not.
Reported-by: John Lindgren <john.lindgren@tds.net> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Stefan Schmidt [Tue, 29 Sep 2009 21:48:20 +0000 (23:48 +0200)]
configure.in: Add m4 check for new AM_SILENT_RULES
Kbuild like output for automake (>=1.11). It's no hard dependency as it needs
the newest automake, but enable it by default if it is available. To turn it off
you can either use --disable-silent-rules at configure time or make V=0 at
compile time.
Signed-off-by: Stefan Schmidt <stefan@slimlogic.co.uk> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Call the slave snd_pcm_info() as long as possible in the direct plugins
(i.e. when the PCM device could be opened with O_APPEND mode).
This allows dmix/dsnoop as a salve for PCM hook controls.
Kai Vehmanen [Thu, 10 Sep 2009 22:07:21 +0000 (01:07 +0300)]
pcm_hw: Always use delay ioctl in snd_pcm_delay()
As the result of snd_pcm_delay() is affected not only by hw_ptr
and appl_ptr, but also by 'runtime->delay' property,
either SNDRV_PCM_IOCTL_DELAY or SNDRV_PCM_IOCTL_STATUS ioctl
must be used to get the correct result.
Previously 'runtime->delay' was ignored in case 'hw->sync_ptr'
was used.
Signed-off-by: Kai Vehmanen <kvehmanen@eca.cx> Signed-off-by: Takashi Iwai <tiwai@suse.de>
In snd_pcm_hw_params_choose(), set the buffer size before the period
size and time as default. This will give more useful configuration for
most of apps, i.e. larger buffer size.
For apps that require the old behavior, now the function checks the
environment variable $LIBASOUND_COMPAT. If this variable is set to
non-empty, the hw_params is determined in the old way, first period
then buffer sizes.
Takashi Iwai [Thu, 20 Aug 2009 23:18:00 +0000 (01:18 +0200)]
pcm: workaround for avoiding automatic start in mmap mode
In the normal mmap mode, the stream isn't started automatically even after
the data >= start_threshold has been written. However, in the
mmap-emulation mode, the stream is started because it uses
snd_pcm_write_areas() internally.
As a workaround for this inconsistency, start_threshold value is changed
dynamically in sw_parmams and mmap_commit callbacks in mmap-emul plugin.
Meanwhile, start_threshold for slave PCM is set to boundary so that only
this plugin (or the one over it) can control the start of the stream.
This will fix problems in some apps using pulse plugin in the mmap mode.
Takashi Iwai [Mon, 10 Aug 2009 12:11:57 +0000 (14:11 +0200)]
Fix driver conf parsing in snd_config_hook_load_for_all_cards()
Reported by Kevin Goodsell.
Summary: load_for_all_cards fails with existing configuration elements
In snd_config_hook_load_for_all_cards, the first call to
snd_config_search attempts to locate an existing configuration node with
the name of the driver. Typically none is found, and everything is
good. However, if such a node is located, the next line assumes it is a
leaf node with type 'string' and calls snd_config_get_string to fetch
the string value. If this fails, the entire hook is abandoned.
Because of this, setting something like the following in asoundrc:
cards.<driver name>.foo 0
is sufficient to disable the entire card-specific configuration.
As a concrete example, I have a HDA-Intel sound card. dmix.conf includes
a way to set period_size, period_time, and periods by using
configuration elements of the form cards.<driver name>.pcm.dmix.<var>.
In ~/.asoundrc I add
cards.HDA-Intel.pcm.dmix.period_size 1024
This will cause HDA-Intel.conf to fail to load, and the pcm defined in
default.conf will fail to find the device-specific pcm
cards.HDA-Intel.pcm.default, and fall back on the default pcm using
plughw. By attempting to configure dmix, I have disabled it.
Clemens Ladisch [Mon, 10 Aug 2009 08:09:02 +0000 (10:09 +0200)]
timer_query: make ops structure constant
The contents of the snd_timer_query_ops structure are not going to be
changed, so we might as well declare is as constant. This change avoids
a warning if some ops structure is actually defined as const.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Clemens Ladisch [Mon, 10 Aug 2009 08:08:25 +0000 (10:08 +0200)]
snd_pcm_scope_set_ops: make ops parameter const
The contents of the snd_pcm_scope_ops structure are not going to be
changed, so we might as well declare is as constant. This change is
backwards compatible, and avoids warnings if some ops structure is
actually defined as const.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Clemens Ladisch [Tue, 4 Aug 2009 07:15:40 +0000 (09:15 +0200)]
doc: hide structs with typedefs
In the documentation, hide structure types that have a corresponding
typedef. Since doxygen 1.5.4, this is no longer the default when
OPTIMIZE_OUTPUT_FOR_C is set.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>