* topic/tlv-minmax:
ALSA: usb-audio - Correct bogus volume dB information
ALSA: usb-audio - Use the new TLV_DB_MINMAX type
ALSA: Add new TLV types for dBwith min/max
* topic/oss:
ALSA: allocation may fail in snd_pcm_oss_change_params()
sound: vwsnd: Fix setting of cfgval and ctlval in li_setup_dma()
sound: fix OSS MIDI output data loss
Add appropriate const prefix to char * arguments in proc helper functions.
Also fixed the caller side to be proper const pointers.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Re-export snd_pcm_format_name() function to be used outside the PCM core.
As a first example, usbaudio is changed to use it now again.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The struct snd_monitor_file is used locally only in sound/core/init.c,
thus it should be moved there from the public sound/core.h.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Allocation may fail, show if it did.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
[Additional fix for invalid runtime->oss.prepare flag set by tiwai]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Add debug module option to snd core.
This controls the debug print level. When CONFIG_SND_DEBUG_VERBOSE
is set, you can suppress the debug messages by giving or changing this
parameter to a lower value. debug=0 means no debug messsages.
As default, it's set to the verbose level 2.
Since this option can be changed dynamically via sysfs file, you can
suppress the verbose debug messages on the fly, which wasn't possible
before.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
When modules are built with M= option, they pass long file paths to
__FILE__. This results in ugly outputs of snd_print*() when
CONFIG_SND_VERBOSE_PRINTK is set.
This patch adds a check of the path and strips the leading path dirs
if the file name is an absolute path to improve the readability of logs.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
snd_interval_list() expected a sorted list but did not document this, so
there are drivers that give it an unsorted list. To fix this, change
the algorithm to work with any list.
This fixes the "Slave PCM not usable" error with USB devices that have
multiple alternate settings with sample rates in decreasing order, such
as the Philips Askey VC010 WebCam.
http://bugzilla.kernel.org/show_bug.cgi?id=14028
Reported-and-tested-by: Andrzej <adkadk@gmail.com>
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The current PCM core has the following problems regarding PCM draining
in non-blocking mode:
- the current f_flags isn't checked in snd_pcm_drain(), thus changing
the mode dynamically via snd_pcm_nonblock() after open doesn't work.
- calling drain in non-blocking mode just return -EAGAIN error, but
doesn't provide any way to sync with draining.
This patch fixes these issues.
- check file->f_flags in snd_pcm_drain() properly
- when O_NONBLOCK is set, PCM core sets the stream(s) to DRAIN state
but quits ioctl immediately without waiting the whole drain; the
caller can sync the drain manually via poll()
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Ensure that userspace can remove only user controls. Controls created
by kernel drivers must not be removed because they might be referenced
in calls to snd_ctl_notify().
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Move the decrementing of the user controls counter from
snd_ctl_elem_remove to snd_ctl_remove_unlocked_id; this saves the
separate locking of the controls semaphore, and therefore removes
a harmless race.
Since the purpose of the function is to operate on user controls (the
control being unlocked is just a prerequisite), rename it to
snd_ctl_remove_user_ctl.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Use a common exit path to release the mutex and to return a possible
error.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Make sure that no user element that has no values can be added.
The check for count>1024 is not needed because the count is checked
later for the individual control types.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Return STRPIPE instead of EBADF when userspace attempts to rewind
of forward a stream that was suspended in meanwhile, so that it
can be recovered by snd_pcm_recover().
This was causing Pulseaudio to unload the ALSA sink module under a race
condition when it attempted to rewind the stream right after resume from
suspend, before writing to the stream which would cause it to revive the
stream otherwise. Tested to work with Pulseaudio patched to attempt to
snd_pcm_recover() upon receiving an error from snd_pcm_rewind().
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The fix 79452f0a28 introduced another
bug due to the missing offset for the overlapped hwptr.
When the hwptr goes back to zero, the delta value has to be corrected
with the buffer size. Otherwise this causes looping sounds.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Added the logging functionality to xrun_debug to record the hwptr
updates via snd_pcm_update_hw_ptr() and snd_pcm_update_hwptr_interrupt(),
corresponding to 16 and 8, respectively.
For example,
# echo 9 > /proc/asound/card0/pcm0p/xrun_debug
will record the position and other parameters at each period interrupt
together with the normal XRUN debugging.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
VMware tends to report PCM positions and period updates at utterly
wrong timing. This screws up the recent PCM core code that tries
to correct the position based on the irq timing.
Now, when a backward irq position is detected, skip the update
instead of rebasing. (This is almost the old behavior before
2.6.30.)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Sending an Active Sensing message when closing a port can interfere with
the following data if the port is reopened and a note-on is sent before
the device's timeout has elapsed. Therefore, it is better to disable
this setting by default.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Instead of using magic numbers for the controlles sent when resetting
a port, use the symbols from asoundef.h.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Sending a MIDI reset message when closing a port is wrong because we
only want to shut the device up, not to reset all settings.
Furthermore, many devices ignore this message.
Fortunately, the RawMIDI layer already shuts the device up, so we can
ignore this matter here.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
It turns out that the main cause of output buffer overruns is not slow
drivers but applications that generate too many messages. Therefore, it
makes more sense to make that error message always visible, and to
rate-limit it.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Using SG-buffers with dma_alloc_coherent() is often very inefficient
on non-coherent architectures because a tracking record could be
allocated in addition for each dma_alloc_coherent() call.
Instead, simply disable SG-buffers but just allocate normal continuous
buffers on non-supported (currently all but x86) architectures.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
When decoding (N)RPN sequencer events into raw MIDI commands, the
extra_decode_xrpn() function had accidentally swapped the MSB and LSB
controller values of both the parameter number and the data value.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
'params' is a pointer and looking at the code this probably should be a check
for ioctl return value.
Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Add new types for TLV dB scale specified with min/max values instead
of min/step since the resolution can't match always with the one
a device provides. For example, usb audio devices give 1/256 dB
resolution while ALSA TLV is based on 1/100 dB resolution.
The new min/max types have less problems because the possible
rounding error happens only at min/max.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This moves the jack devices from the PCI device into the ALSA card device, which
makes it easier for userspace to find all devices belonging to a specific card
while granting access to logged-in users.
Jack input devices from sound cards can now simply be matched with udev by doing:
SUBSYSTEM="input", SUBSYSTEMS="sound", ...
ls -l /sys/devices/pci0000:00/0000:00:1b.0/sound/card0
controlC0
device -> ../../../0000:00:1b.0
id
input10
input11
input8
input9
number
pcmC0D0c
pcmC0D0p
pcmC0D1p
power
subsystem -> ../../../../../class/sound
uevent
Cc: Lennart Poettering <lennart@0pointer.de>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
* topic/pcm-jiffies-check:
ALSA: pcm - A helper function to compose PCM stream name for debug prints
ALSA: pcm - Fix update of runtime->hw_ptr_interrupt
ALSA: pcm - Fix a typo in hw_ptr update check
ALSA: PCM midlevel: lower jiffies check margin using runtime->delay value
ALSA: PCM midlevel: Do not update hw_ptr_jiffies when hw_ptr is not changed
ALSA: PCM midlevel: introduce mask for xrun_debug() macro
ALSA: PCM midlevel: improve fifo_size handling
The commit 13f040f9e5 made another
regression, the missing update of runtime->hw_ptr_interrupt.
Since this field is only checked in snd_pcmupdate__hw_ptr_interrupt(),
not in snd_pcm_update_hw_ptr(), it must be updated before the hw_ptr
change check.
Signed-off-by: Takashi Iwai <tiwai@suse.de>