aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/pcm_native.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2009-09-27const: mark struct vm_struct_operationsAlexey Dobriyan1-4/+4
* 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>
2009-09-21ALSA: pcm - Simplify snd_pcm_drain() implementationTakashi Iwai1-53/+20
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>
2009-09-10Merge branch 'topic/pcm-estrpipe-in-pm' into for-linusTakashi Iwai1-0/+12
* topic/pcm-estrpipe-in-pm: ALSA: pcm - Tell user that stream to be rewound is suspended
2009-08-20ALSA: pcm - Fix drain behavior in non-blocking modeTakashi Iwai1-23/+29
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>
2009-08-03ALSA: pcm - Tell user that stream to be rewound is suspendedLubomir Rintel1-0/+12
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>
2009-06-22sound: fix check for return value in snd_pcm_hw_refineMariusz Kozlowski1-1/+1
'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>
2009-05-29ALSA: PCM midlevel: improve fifo_size handlingJaroslav Kysela1-3/+12
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>
2009-05-29Merge branch 'fix/pcm-jiffies-check' into topic/pcm-jiffies-checkTakashi Iwai1-0/+6
2009-05-27ALSA: Fix invalid jiffies check after pauseTakashi Iwai1-0/+6
The hw_ptr_jiffies has to be reset properly to avoid the invalid check of jiffies delta in snd_pcm_update_hw_ptr*() functions. Especailly this patch fixes the bogus jiffies check after the puase and resume. This patch is a modified version of the original patch by Jaroslav. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-05-05ALSA: Add extra delay count in PCMTakashi Iwai1-3/+5
Added runtime->delay field to adjust the delayed samples for snd_pcm_delay(). Typically a hardware FIFO length is stored in this field, so that the extra delay between hwptr and applptr can be computed. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-04-14ALSA: sound/core: use memdup_user()Li Zefan1-58/+35
Remove open-coded memdup_user(). Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-03-26Merge branch 'bkl-removal' of git://git.lwn.net/linux-2.6Linus Torvalds1-3/+1
* 'bkl-removal' of git://git.lwn.net/linux-2.6: Rationalize fasync return values Move FASYNC bit handling to f_op->fasync() Use f_lock to protect f_flags Rename struct file->f_ep_lock
2009-03-16Rationalize fasync return valuesJonathan Corbet1-3/+1
Most fasync implementations do something like: return fasync_helper(...); But fasync_helper() will return a positive value at times - a feature used in at least one place. Thus, a number of other drivers do: err = fasync_helper(...); if (err < 0) return err; return 0; In the interests of consistency and more concise code, it makes sense to map positive return values onto zero where ->fasync() is called. Cc: Al Viro <viro@ZenIV.linux.org.uk> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
2009-02-05ALSA: Add missing KERN_* prefix to printk in sound/coreTakashi Iwai1-3/+3
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-11-01saner FASYNC handling on file closeAl Viro1-1/+0
As it is, all instances of ->release() for files that have ->fasync() need to remember to evict file from fasync lists; forgetting that creates a hole and we actually have a bunch that *does* forget. So let's keep our lives simple - let __fput() check FASYNC in file->f_flags and call ->fasync() there if it's been set. And lose that crap in ->release() instances - leaving it there is still valid, but we don't have to bother anymore. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-16ALSA: kernel docs: fix sound/core/ kernel-docRandy Dunlap1-16/+8
Add kernel-doc function short descriptions to sound/core functions that are missing this short description. Mostly this involves moving some of the function description onto the @funcname line. Also correct a few variable names and fix other kernel-doc notation. Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-09-04ALSA: add dummy function to support shared mmap in nommu Blackfin archCliff Cai1-0/+13
Cc: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Cliff Cai <cliff.cai@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-08-13ALSA: Kill snd_assert() in sound/core/*Takashi Iwai1-63/+64
Kill snd_assert() in sound/core/*, either removed or replaced with if () with snd_BUG_ON(). Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-09-25ALSA: remove unneeded power_mutex lock in snd_pcm_dropTakashi Iwai1-10/+3
The power_mutex lock in snd_pcm_drop may cause a possible deadlock chain, and above all, it's unneeded. Let's get rid of it. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-08-06Revert "pcm_native.c: remove unused label"Linus Torvalds1-0/+1
This reverts commit 680db0136e0778a0d7e025af7572c6a8d82279e2. The label is actually used, but hidden behind CONFIG_SND_DEBUG and the horrible snd_assert() macro. That macro could probably be improved to be along the lines of #define snd_assert(expr, args...) do { if ((void)(expr),0) { args; } } while (0) or similar to make sure that we always both evaluate 'expr' and parse 'args', but while gcc should optimize it all away, I'm too lazy to really verify that. So I'll just admit defeat and will continue to live with the annoying warning. Noted-by: Robert P. J. Day <rpjday@crashcourse.ca> Signed-off-by: Linus "Grr.." Torvalds
2008-08-06pcm_native.c: remove unused labelLinus Torvalds1-1/+0
This fixes the warning sound/core/pcm_native.c: In function 'snd_pcm_fasync': sound/core/pcm_native.c:3262: warning: label 'out' defined but not used Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-02snd/PCM: fasync BKL pushdownJonathan Corbet1-2/+6
Chances are this is unneeded, but the code is twisty enough that it is hard to tell. Signed-off-by: Jonathan Corbet <corbet@lwn.net>
2008-02-05latency.c: use QoS infrastructureMark Gross1-4/+7
Replace latency.c use with pm_qos_params use. Signed-off-by: mark gross <mgross@linux.intel.com> Cc: "John W. Linville" <linville@tuxdriver.com> Cc: Len Brown <lenb@kernel.org> Cc: Jaroslav Kysela <perex@suse.cz> Cc: Takashi Iwai <tiwai@suse.de> Cc: Arjan van de Ven <arjan@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-01-31[ALSA] PCM interface - rename SNDRV_PCM_TSTAMP_MMAP to SNDRV_PCM_TSTAMP_ENABLEJaroslav Kysela1-1/+7
Change semantics for SNDRV_PCM_TSTAMP_MMAP. Doing timestamping only in the interrupt handler might cause that hw_ptr is not related to actual timestamp. With this change, grab timestamp at every hw_ptr update to have always valid timestamp + ring buffer position pair. With this change, SNDRV_PCM_TSTAMP_MMAP was renamed to SNDRV_PCM_TSTAMP_ENABLE. It's no regression (I think). Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31[ALSA] Remove sound/driver.hTakashi Iwai1-1/+0
This header file exists only for some hacks to adapt alsa-driver tree. It's useless for building in the kernel. Let's move a few lines in it to sound/core.h and remove it. With this patch, sound/driver.h isn't removed but has just a single compile warning to include it. This should be really killed in future. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31[ALSA] Remove PCM sleep_min and tickTakashi Iwai1-30/+0
The 'tick' in PCM is set (again) via sw_params. And, nobody uses this feature at all except for a command line option of aplay. (This is literally 'nobody', as I checked alsa-lib API calls in all programs in major distros.) Above all, if we need finer wake-ups for the position update, it's basically an issue that the driver should solve, not tuned by each application. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31[ALSA] Remove PCM xfer_align sw paramsTakashi Iwai1-13/+0
The xfer_align sw_params parameter has never been used in a sane manner, and no one understands what this does exactly. The current implementation looks also buggy because it allows write of shorter size than xfer_align. So, if you do partial writes, the write isn't actually aligned at all. Removing this parameter will make some pcm_lib_* code more readable (and less buggy). Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31[ALSA] PCM core - remove SNDRV_PCM_TSTAMP_MMAP condition in snd_pcm_status()Jaroslav Kysela1-7/+2
The condition caused that the returned ring buffer position does not match with timestamp when SNDRV_PCM_TSTAMP_MMAP mode was enabled. Removing condition makes unified behaviour and interrupt based timestamp can be accessed via PCM_IOCTL_SYNC_PTR or mmaped status area. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31[ALSA] PCM - added back TSTAMP ioctl for PCM (for old alsa-lib binaries)Jaroslav Kysela1-0/+2
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31[ALSA] pcm_native: fix sparse warning about shadowing 'state' symbolMarcin Ślusarz1-3/+3
pcm_native: fix sparse warning about shadowing 'state' symbol Signed-off-by: Marcin Ślusarz <marcin.slusarz@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31[ALSA] alsa: nopageNick Piggin1-34/+25
Convert ALSA from nopage to fault. Switch from OOM to SIGBUS if the resource is not available. Signed-off-by: Nick Piggin <npiggin@suse.de> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31[ALSA] Use posix clock monotonic for PCM and timer timestampsJaroslav Kysela1-5/+20
We need an accurate and continuous (monotonic) time sources to do accurate synchronization among more timing sources. This patch allows to enable monotonic timestamps for ALSA PCM devices and enables monotonic timestamps for ALSA timer devices. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31[ALSA] Fix PCM MMAP time-stamp modeTakashi Iwai1-1/+1
When MMAP time-stamp mode is given, it's supposed to update the time-stamp only at period boundary. However, it currently updates at each status call so this is just useless. The patch fixes this misbehavior. Also it fixes the wrong check of tstamp_mode (don't use bit-and for enum). Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2007-10-16[ALSA] Changed Jaroslav Kysela's e-mail from perex@suse.cz to perex@perex.czJaroslav Kysela1-1/+1
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2007-10-16[ALSA] pcm: merge rates[] from pcm_misc.c and pcm_native.cClemens Ladisch1-1/+7
Merge the rates[] arrays from pcm_misc.c and pcm_native.c because they are both the same. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-07-20[ALSA] Fix substream to check in PCM drainTakashi Iwai1-1/+1
The check of a substream in snd_pcm_drain() might not be always correct since runtime can point a different substream (although the PCM state of each linked substream should be same, in theory). This patch fixes it. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-05-11[ALSA] pcm_native: lockdep warning when launching jackFrederik Deweerdt1-1/+2
When launching 'jackd -d alsa', lockdep issues the following warning: [39701.405086] ============================================= [39701.405093] [ INFO: possible recursive locking detected ] [39701.405107] 2.6.21-rc5-mm4 #2 [39701.405109] --------------------------------------------- [39701.405112] jackd/17366 is trying to acquire lock: [39701.405114] (&substream->self_group.lock){....}, at: [<c034d3c0>] snd_pcm_action_group+0x90/0x240 [39701.405131] [39701.405131] but task is already holding lock: [39701.405134] (&substream->self_group.lock){....}, at: [<c034d63f>] snd_pcm_action_lock_irq+0x3f/0xb0 [39701.405141] [39701.405142] other info that might help us debug this: [39701.405145] 3 locks held by jackd/17366: [39701.405147] #0: (snd_pcm_link_rwlock){....}, at: [<c034d627>] snd_pcm_action_lock_irq+0x27/0xb0 [39701.405155] #1: (&substream->group->lock){....}, at: [<c034d638>] snd_pcm_action_lock_irq+0x38/0xb0 [39701.405163] #2: (&substream->self_group.lock){....}, at: [<c034d63f>] snd_pcm_action_lock_irq+0x3f/0xb0 [39701.405171] [39701.405171] stack backtrace: [39701.405174] [<c0103b8a>] show_trace_log_lvl+0x1a/0x30 [39701.405179] [<c0104912>] show_trace+0x12/0x20 [39701.405183] [<c01049c6>] dump_stack+0x16/0x20 [39701.405187] [<c013b980>] __lock_acquire+0xbd0/0x1040 [39701.405193] [<c013be60>] lock_acquire+0x70/0x90 [39701.405197] [<c0407846>] _spin_lock+0x36/0x50 [39701.405203] [<c034d3c0>] snd_pcm_action_group+0x90/0x240 [39701.405207] [<c034d653>] snd_pcm_action_lock_irq+0x53/0xb0 [39701.405211] [<c035046f>] snd_pcm_common_ioctl1+0x35f/0xfb0 [39701.405215] [<c0351544>] snd_pcm_playback_ioctl1+0x34/0x420 [39701.405219] [<c03519f3>] snd_pcm_playback_ioctl+0x43/0x50 [39701.405223] [<c017ecc8>] do_ioctl+0x28/0x80 [39701.405229] [<c017ed77>] vfs_ioctl+0x57/0x290 [39701.405233] [<c017efe9>] sys_ioctl+0x39/0x60 [39701.405237] [<c0102bf4>] sysenter_past_esp+0x5d/0x99 [39701.405240] ======================= The attached lockdep annotation silences the warning. Signed-off-by: Frederik Deweerdt <frederik.deweerdt@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-05-11[ALSA] Add snd_pcm_group_for_each_entry() for code cleanupTakashi Iwai1-17/+10
Added a new macro snd_pcm_group_for_each_entry() just for code cleanup. Old macros, snd_pcm_group_for_each() and snd_pcm_group_substream_entry(), are removed. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-05-08header cleaning: don't include smp_lock.h when not usedRandy Dunlap1-1/+0
Remove includes of <linux/smp_lock.h> where it is not used/needed. Suggested by Al Viro. Builds cleanly on x86_64, i386, alpha, ia64, powerpc, sparc, sparc64, and arm (all 59 defconfigs). Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-02-12[PATCH] mark struct file_operations const 9Arjan van de Ven1-1/+1
Many struct file_operations in the kernel can be "const". Marking them const moves these to the .rodata section, which avoids false sharing with potential dirty data. In addition it'll catch accidental writes at compile time to these shared resources. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2006-12-08[PATCH] struct path: convert soundJosef Sipek1-1/+1
Signed-off-by: Josef Sipek <jsipek@fsl.cs.sunysb.edu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-12-07[PATCH] mm: incorrect VM_FAULT_OOM returns from driversNick Piggin1-5/+5
Some drivers are returning OOM when it is not in response to a memory shortage. Signed-off-by: Nick Piggin <npiggin@suse.de> Cc: Dave Airlie <airlied@linux.ie> Cc: Jaroslav Kysela <perex@suse.cz> Cc: Takashi Iwai <tiwai@suse.de> Cc: Greg KH <greg@kroah.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-11-28[ALSA] Fix hang-up at disconnection of usb-audioTakashi Iwai1-2/+4
Fix hang-up at disconnection of usb-audio devices while accessing PCM. Don't handle PCM operations any more after shutdown flag is set. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-10-01[PATCH] Remove readv/writev methods and use aio_read/aio_write insteadBadari Pulavarty1-20/+20
This patch removes readv() and writev() methods and replaces them with aio_read()/aio_write() methods. Signed-off-by: Badari Pulavarty <pbadari@us.ibm.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-01[PATCH] maximum latency tracking: ALSA supportTakashi Iwai1-1/+22
Add maximum latency tracking to the ALSA subsystem for PCM playback. In ALSA, the playback application controls the buffer size and thus indirectly the period of latency that it can deal with. This patch uses 75% of the total available latency as threshold to announce to the latency subsystem; While 75% is a crude heuristic it's a quite reasonable one; the remaining 25% can be used for all driver processing for the next samples which is also proportional to the size of the buffer. With ogg123 a latency setting of about 4msec was seen (at 44Khz), while with the "play" command a much longer maximum tolerable latency was seen. Other, more multimedia oriented players as well as games, will have a lot smaller buffers to allow better synchronization and those will actually get into the latency domains where there is impact on the power management rules. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-23[ALSA] Fix control/status mmap with shared PCM substreamTakashi Iwai1-39/+10
The flag to avoid 32bit-incompatible mmap for control/status records should be outside the pcm substream instance since a substream can be shared among multiple opens. Now it's flagged in pcm_file list that is directly assigned to file->private_data. Also, removed snd_pcm_add_file() and remove_file() functions and substream.files field that are not really used in the code. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-22[ALSA] Remove bogus check of mmap_count in snd_pcm_release()Takashi Iwai1-1/+0
Removed a bogus check of mmap_count in snd_pcm_release(). This is no longer true for the shared streams. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2006-06-22[ALSA] Fix pcm-draining of capture stream in PCM middle layerTakashi Iwai1-2/+0
Fix the draining of PCM capture stream in the PCM middle layer. snd_pcm_drain() ignored capture streams, but it should change the state to SNDRV_PCM_DRAINING. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2006-06-22[ALSA] Fix mmap_count with O_APPEND opened streamsTakashi Iwai1-5/+5
Move mmap_count to snd_pcm_substream instead of runtime struct so that multiplly opened substreams via O_APPEND can be handled correctly. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2006-06-22[ALSA] Add O_APPEND flag support to PCMTakashi Iwai1-26/+55
Added O_APPEND flag support to PCM to enable shared substreams among multiple processes. This mechanism is used by dmix and dsnoop plugins. Signed-off-by: Takashi Iwai <tiwai@suse.de>