In some debug cases, it might be usefull to see previous ring buffer
positions to determine position problems from the lowlevel drivers.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Refine the rate selection by choosing the rate
closer to the requested one in case of selecting
single frequency. Previously, the higher rate was
always selected.
Also, fix problem with the best_diff unsigned int
value wrapping (turning negative).
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The direction of rounding is incorrect in the snd_interval_ratnum()
It was detected with following parameters (sb8 driver playing
8kHz stereo file):
- num is always 1000000
- requested frequency rate is from 7999 to 7999 (single frequency)
The first loop calculates div_down(num, freq->min) which is 125.
Thus, a frequency range's minimum value is 1000000 / 125 = 8000 Hz.
The second loop calculates div_up(num, freq->max) which is 126
The frequency range's maximum value is 1000000 / 126 = 7936 Hz.
The range maximum is lower than the range minimum so the function
fails due to empty result range.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
There are now five copies of the code to allocate a PCM buffer using
vmalloc(). Add a sixth in the core so that the others can be removed.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
ALSA: hda - Overwrite pin config on intel DG45ID board.
intelhdmi - dont power off HDA link
ALSA: hrtimer - Fix lock-up
ALSA: intelhdmi - add channel mapping for typical configurations
ALSA: intelhdmi - channel mapping applies to Pin
ALSA: intelhdmi - accept DisplayPort pin
ALSA: hda - show HBR(High Bit Rate) pin cap in procfs
ALSA: hda - Fix LED GPIO setup for HP laptops with IDT codecs
ASoC: Fix build of OMAP sound drivers
ALSA: opti93x: fix irq releasing if the irq cannot be allocated
The timer stop callback can be called from snd_timer_interrupt(), which
is called from the hrtimer callback. Since hrtimer_cancel() waits for
the callback completion, this eventually results in a lock-up.
This patch fixes the problem by just toggling a flag at stop callback
and call hrtimer_cancel() later.
Reported-and-tested-by: Wojtek Zabolotny <W.Zabolotny@elka.pw.edu.pl>
Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
While Linux provided an O_SYNC flag basically since day 1, it took until
Linux 2.4.0-test12pre2 to actually get it implemented for filesystems,
since that day we had generic_osync_around with only minor changes and the
great "For now, when the user asks for O_SYNC, we'll actually give
O_DSYNC" comment. This patch intends to actually give us real O_SYNC
semantics in addition to the O_DSYNC semantics. After Jan's O_SYNC
patches which are required before this patch it's actually surprisingly
simple, we just need to figure out when to set the datasync flag to
vfs_fsync_range and when not.
This patch renames the existing O_SYNC flag to O_DSYNC while keeping it's
numerical value to keep binary compatibility, and adds a new real O_SYNC
flag. To guarantee backwards compatiblity it is defined as expanding to
both the O_DSYNC and the new additional binary flag (__O_SYNC) to make
sure we are backwards-compatible when compiled against the new headers.
This also means that all places that don't care about the differences can
just check O_DSYNC and get the right behaviour for O_SYNC, too - only
places that actuall care need to check __O_SYNC in addition. Drivers and
network filesystems have been updated in a fail safe way to always do the
full sync magic if O_DSYNC is set. The few places setting O_SYNC for
lower layers are kept that way for now to stay failsafe.
We enforce that O_DSYNC is set when __O_SYNC is set early in the open path
to make sure we always get these sane options.
Note that parisc really screwed up their headers as they already define a
O_DSYNC that has always been a no-op. We try to repair it by using it for
the new O_DSYNC and redefinining O_SYNC to send both the traditional
O_SYNC numerical value _and_ the O_DSYNC one.
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Grant Grundler <grundler@parisc-linux.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andreas Dilger <adilger@sun.com>
Acked-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Acked-by: Kyle McMartin <kyle@mcmartin.ca>
Acked-by: Ulrich Drepper <drepper@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jan Kara <jack@suse.cz>
The non-cohernet PPC arch doesn't give the correct address by a simple
virt_to_page() for pages allocated via dma_alloc_coherent().
This patch adds a hack to fix the conversion similarly like MIPS.
Note that this doesn't fix perfectly: the pages should be marked with
proper pgprot value. This will be done in a future implementation like
the conversion to dma_mmap_coherent().
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The non-coherent MIPS arch doesn't give the correct address by a simple
virt_to_page() for pages allocated via dma_alloc_coherent().
Original patch by Wu Zhangjin <wuzj@lemote.com>.
[Ralf mentioned: "The origins of this patch go back far further.
The oldest patch I could find which is a superset of this was written
by Atsushi Nemoto and various incarnations of it have been sumitted
to and reject by me a number of times through the years."]
A proper check of the buffer allocation type was added to avoid the
wrong conversion.
Note that this doesn't fix perfectly: the pages should be marked with
proper pgprot value. This will be done in a future implementation like
the conversion to dma_mmap_coherent().
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Add a helper (inline) function as the default page ops. Any hacks wrt
the page address conversion will be applied in this function.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Use dma_mmap_coherent() for mmapping the buffers allocated via
dma_alloc_coherent() if available. Currently, only ARM has this function,
so we do temporarily have an ifdef pcm_native.c. This should be handled
better globally in future.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This function is only called from snd_ctl_ioctl() and the file parameter
can never be null so there is no need to check it here.
We dereference file at the start of the function:
struct snd_card *card = file->card;
and it confuses static checkers to dereference a pointer before
checking it.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Record the pid of the task that opened a RawMIDI substream.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Record the pid of the task that opened a PCM substream. For sound
cards with hardware mixing, this allows determining which process
is associated with a specific substream's volume control.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The substream_opened field is to count the number of opened substreams,
not the number of times that any substreams have been opened.
Furthermore, all substreams being opened does not imply that the next
open would fail, due to the possibility of O_APPEND. With this wrong
check, opening a substream multiple times would succeed only if the
device had more unopened substreams.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Commit 9a1b64caac in 2.6.30 broke the
error handling code in rawmidi_open_priv().
If only the output substream of a RawMIDI device has been opened and
if this device is then opened with O_RDWR | O_APPEND and if the
initialization of the input substream fails (either because of low
memory or because the device driver's open callback fails), then the
runtime structure of the already open output substream will be freed
and all following writes through the first handle will cause
snd_rawmidi_write() to use the NULL runtime pointer.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Commit 9a1b64caac in 2.6.30 dropped the
check that a substream must already have been opened with O_APPEND to be
able to open it a second time.
This would make it possible for a substream to be switched to append
mode, which would mean that non-atomic writes would fail unexpectedly.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Commit 9a1b64caac in 2.6.30 moved the
substream initialization code to where it would be executed every time
the substream is opened.
This had the consequence that any further opening would drop and leak
the data in the existing buffer, and that the device driver's open
callback would be called multiple times, unexpectedly.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Instead of storing the PID number, take a reference to the task's pid
structure. This protects against duplicates due to PID overflows, and
using pid_vnr() ensures that the PID returned by snd_ctl_elem_info() is
correct as seen from the current namespace.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
We do not need to save the ID of the process that locked a control
because that information is already available in the owner's file data.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
To unify control names, rename "PC Speaker" to "Speaker" for PPC ALSA drivers.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
To avoid confusion in control names for the standard analog PC Beep generator
using a small Internal PC Speaker, rename all related "PC Speaker" and "PC
Beep" controls to "Beep" only. This name is more universal and can be also
used on more platforms without confusion.
Introduce also "Internal Speaker" in ControlNames.txt for systems with
full-featured build-in internal speaker.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
In pcm.c, if the NULL test on pcm is needed, then the dereference should be
after the NULL test.
In dummy.c and ali5451.c, the context of the calls to
snd_card_dummy_new_mixer and snd_ali_free_voice show that dummy and pvoice,
respectively cannot be NULL.
A simplified version of the semantic match that detects this problem is as
follows (http://coccinelle.lip6.fr/):
// <smpl>
@match exists@
expression x, E;
identifier fld;
@@
* x->fld
... when != \(x = E\|&x\)
* x == NULL
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The chipsets with the isa_dma_bridge_buggy set do not stop DMA during
DMA counter reads. The DMA counter is read in two 8-bit read steps
on x86 platform. Sometimes, such reads happen during higher byte
change so the lower byte is already decremented (rolled over) but
the higher byte is not. It introduces an error that position is
moved 256 bytes ahead of the true position. Thus, the next DMA
position read can return a lower value then the previous read.
If the DMA position is decreased (reversed) the ALSA subsystem is
tricked into the playback underrun error and resets the playback.
It results in a "pop" during a playback.
Work around the issue by reading the counter twice and choosing a higher
value.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
* mark struct vm_area_struct::vm_ops as const
* mark vm_ops in AGP code
But leave TTM code alone, something is fishy there with global vm_ops
being used.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Simplify snd_pcm_drain() implementation and avoid unneeded array-
allocation for waitqueues. Instead, one waitqueue is used for the
first draining stream, and wait until all streams finished.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
* 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>
Fix a typo in the commit 13f040f9e5
ALSA: PCM midlevel: Do not update hw_ptr_jiffies when hw_ptr is not changed
which causes obvious problems with PA.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Move locking outside snd_card_set_id_internal() function and rename it
to snd_card_set_id_no_lock() for better function description.
User defined id is just copied to card structure at allocation time.
The real unique id procedure is called in snd_card_register() to
ensure real atomicity.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The introduction of snd_card_set_id() added a lock on the card list
to the old choose_default_id() function when using it to implement
the new API call. This lock is needed to allow us to walk the list
and check to see if our new name is a duplicate. Unfortunately this
causes a lockup when called from snd_card_register() (in cases
where no ID is supplied for the card) since the card list is already
locked there.
Fix this fairly hideously by factoring out the implementation and
using a flag to indicate if the lock should be held. A better fix
would probably be to refactor snd_card_register() to move the
_set_id() outside the locking region but I can't immediately see
anything I can convince myself is safe.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Introduce snd_card_set_id() function to allow lowlevel drivers to set
default identification name for card slot. The function checks also
for identification name collisions and tries to create unique name.
Also, the snd_card_create() function is simplified, because this new
function is used. As bonus, proper name collision checks are evaluated
at the card create time.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Instead of mangling the CONFIG_* variables in the makefiles over and
over, set a few helper variables in Kconfig.
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
When hardware has large FIFO, it is necessary to lower jiffies margin
by count of queued samples.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Some hardware might have bigger FIFOs and DMA pointer value will be updated
in large chunks. Do not update hw_ptr_jiffies and position timestamp when
hw_ptr value was not changed.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
For debugging purposes, it is better to separate actions.
Bit-values:
1: show bad PCM ring buffer pointer
2: show also stack (to debug kernel latency issues)
4: check pointer against system jiffies
Example:
5: show bad PCM ring buffer pointer and do jiffies check
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Move the fifo_size assignment to hw->ioctl callback to allow lowlevel
drivers overwrite the default behaviour.
fifo_size is in frames not bytes as specified in asound.h and alsa-lib's
documentation, but most hardware have fixed byte based FIFOs. Introduce
internal SNDRV_PCM_INFO_FIFO_IN_FRAMES.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The PCM hw_ptr jiffies check results sometimes in problems when a
hardware doesn't give smooth hw_ptr updates. So far, au88x0 and some
other drivers appear not working due to this strict check.
However, this check is a nice debug tool, and the capability should be
still kept.
Hence, we disable this check now as default unless the user enables it
by setting the xrun_debug mode to the specific stream via a proc file.
Signed-off-by: Takashi Iwai <tiwai@suse.de>