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