1
0
Fork 0
Commit Graph

92 Commits (68c7ccb8f85801655aa681391dc0ee037a2b66d4)

Author SHA1 Message Date
Takashi Iwai 7fb3a069bc Merge branch 'fix/misc' into topic/misc
Conflicts:
	sound/pci/hda/patch_realtek.c
2010-02-17 14:24:46 +01:00
Jaroslav Kysela 3be522a951 ALSA: pcm core - fix fifo_size channels interval check
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Cc: <stable@kernel.org>
2010-02-16 12:00:20 +01:00
Takashi Iwai 30ede1b9f0 Merge remote branch 'alsa/devel' into topic/misc 2010-02-01 15:46:00 +01:00
Jaroslav Kysela 7910b4a1db ALSA: pcm_native - fix runtime->boundary calculation
The code in pcm_lib updating runtime->hw_ptr_interrupt expects
that runtime->boundary is divisible with runtime->period_size.
Thanks are going to Clemens Ladisch for the notice.

Fix the runtime->boundary calculation using buffer_size * period_size
as base and find a least common multiple for 32bit platforms when
the expression might overflow.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2010-01-27 18:17:27 +01:00
Takashi Iwai d0d2c38e39 Merge remote branch 'alsa/devel' into topic/misc 2010-01-26 18:13:04 +01:00
Jaroslav Kysela e763692578 ALSA: pcm_lib - return back hw_ptr_interrupt
Clemens Ladisch noted for hw_ptr_removal in "cleanup & merge hw_ptr
update functions" commit:

"It is possible for the status/delay ioctls to be called when the sound
card's pointer register alreay shows a position at the beginning of the
new period, but immediately before the interrupt is actually executed.
(This happens regularly on a SMP machine with mplayer.)  When that
happens, the code thinks that the position must be at least one period
ahead of the current position and drops an entire buffer of data."

Return back the hw_ptr_interrupt variable. The last interrupt pointer
is always computed from the latest hw_ptr instead of tracking it
separately (in this case all hw_ptr checks and modifications might
influence also hw_ptr_interrupt and it is difficult to keep it
consistent).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2010-01-26 17:50:50 +01:00
Takashi Iwai 6250b9ced2 Merge branch 'topic/noncached-mmap' into topic/misc 2010-01-21 15:27:28 +01:00
Takashi Iwai 8b296c8f9f Merge remote branch 'alsa/devel' into topic/misc 2010-01-21 14:27:14 +01:00
Jaroslav Kysela c91a988dc6 ALSA: pcm_core: Fix wake_up() optimization
This change fixes the "ALSA: pcm_lib - optimize wake_up() calls for PCM I/O"
commit. New sleeping queue is introduced to separate user space and kernel
space wake_ups. runtime->nowake is renamed to twake (transfer wake).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2010-01-21 10:32:15 +01:00
Takashi Iwai c32d977b81 ALSA: pcm - Call pgprot_noncached() for vmalloc'ed buffers
pgprot_noncached() can be set for vmalloc'ed buffers safely, and we'd
need non-cached behavior more or less, even for the intermediate ring-
buffers.

Now snd_pcm_lib_mmap_vmalloc() is added as the common PCM mmap callback
that is coupled with snd_pcm_lib_alloc_vmalloc_buffer() & co.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-01-18 15:00:34 +01:00
Takashi Iwai 3e879d7bac ALSA: pcm - Remove unneeded ifdef pgprot_noncached
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-01-18 14:49:50 +01:00
Takashi Iwai a29fb94ff4 Merge commit alsa/devel into topic/misc
Conflicts:
	include/sound/version.h
2010-01-12 09:40:08 +01:00
Jaroslav Kysela 1250932e48 ALSA: pcm_lib - optimize wake_up() calls for PCM I/O
As noted by pl bossart <bossart.nospam@gmail.com>, the PCM I/O routines
(snd_pcm_lib_write1, snd_pcm_lib_read1) should block wake_up() calls
until all samples are not processed.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2010-01-07 15:48:13 +01:00
Jaroslav Kysela f240406bab ALSA: pcm_lib - cleanup & merge hw_ptr update functions
Do general cleanup in snd_pcm_update_hw_ptr*() routines and merge them.
The main change is hw_ptr_interrupt variable removal to simplify code
logic. This variable can be computed directly from hw_ptr.

Ensure that updated hw_ptr is not lower than previous one (it was possible
with old code in some obscure situations when interrupt was delayed or
the lowlevel driver returns wrong ring buffer position value).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2010-01-07 15:47:38 +01:00
Guennadi Liakhovetski 8b90ca0882 ALSA: Fix indentation in pcm_native.c
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-12-25 14:12:52 +01:00
Takashi Iwai 6985c8877a ALSA: pcm - fix page conversion on non-coherent PPC arch
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>
2009-11-27 10:15:23 +01:00
Takashi Iwai 66b6cfacfc ALSA: pcm - fix page conversion on non-coherent MIPS arch
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>
2009-11-27 10:12:40 +01:00
Takashi Iwai 9eb4a06788 ALSA: pcm - define snd_pcm_default_page_ops()
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>
2009-11-26 15:07:21 +01:00
Takashi Iwai 657b1989da ALSA: pcm - Use dma_mmap_coherent() if available
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>
2009-11-26 15:07:14 +01:00
Alexey Dobriyan f0f37e2f77 const: mark struct vm_struct_operations
* 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-27 11:39:25 -07:00
Takashi Iwai d3a7dcfeeb ALSA: pcm - Simplify snd_pcm_drain() implementation
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-21 15:13:09 +02:00
Takashi Iwai df9200dd04 Merge branch 'topic/pcm-estrpipe-in-pm' into for-linus
* topic/pcm-estrpipe-in-pm:
  ALSA: pcm - Tell user that stream to be rewound is suspended
2009-09-10 15:33:02 +02:00
Takashi Iwai 4cdc115fd3 ALSA: pcm - Fix drain behavior in non-blocking mode
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-20 16:40:16 +02:00
Lubomir Rintel 51840409b6 ALSA: pcm - Tell user that stream to be rewound is suspended
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-08-03 08:57:00 +02:00
Mariusz Kozlowski 8bd9bca3c1 sound: fix check for return value in snd_pcm_hw_refine
'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-06-22 07:54:21 +02:00
Jaroslav Kysela 8bea869c5e ALSA: PCM midlevel: improve fifo_size handling
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-29 11:47:33 +02:00
Takashi Iwai e93721a702 Merge branch 'fix/pcm-jiffies-check' into topic/pcm-jiffies-check 2009-05-29 11:46:10 +02:00
Takashi Iwai 6af3fb72d2 ALSA: Fix invalid jiffies check after pause
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-27 11:04:18 +02:00
Takashi Iwai 4bbe1ddf89 ALSA: Add extra delay count in PCM
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-05-05 14:47:21 +02:00
Li Zefan ef44a1ec6e ALSA: sound/core: use memdup_user()
Remove open-coded memdup_user().

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-04-14 12:39:12 +02:00
Linus Torvalds 8e9d208972 Merge branch 'bkl-removal' of git://git.lwn.net/linux-2.6
* '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-26 16:14:02 -07:00
Jonathan Corbet 60aa49243d Rationalize fasync return values
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-03-16 08:34:35 -06:00
Takashi Iwai 006de26735 ALSA: Add missing KERN_* prefix to printk in sound/core
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-02-05 16:00:49 +01:00
Al Viro 233e70f422 saner FASYNC handling on file close
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-11-01 09:49:46 -07:00
Randy Dunlap 1c85cc6445 ALSA: kernel docs: fix sound/core/ kernel-doc
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-10-16 08:44:20 +02:00
Cliff Cai 7003609b3b ALSA: add dummy function to support shared mmap in nommu Blackfin arch
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-09-04 11:06:34 +02:00
Takashi Iwai 7eaa943c8e ALSA: Kill snd_assert() in sound/core/*
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-08-13 11:46:35 +02:00
Takashi Iwai 24e8fc498e ALSA: remove unneeded power_mutex lock in snd_pcm_drop
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-09-25 17:52:07 +02:00
Linus Torvalds 685d87f7cc Revert "pcm_native.c: remove unused label"
This reverts commit 680db0136e.  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-06 19:26:20 -07:00
Linus Torvalds 680db0136e pcm_native.c: remove unused label
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-08-06 15:14:13 -07:00
Jonathan Corbet 2db9f0a35a snd/PCM: fasync BKL pushdown
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-07-02 15:06:28 -06:00
Mark Gross f011e2e2df latency.c: use QoS infrastructure
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-02-05 09:44:22 -08:00
Jaroslav Kysela 8c12158687 [ALSA] PCM interface - rename SNDRV_PCM_TSTAMP_MMAP to SNDRV_PCM_TSTAMP_ENABLE
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 17:29:54 +01:00
Takashi Iwai 9004acc70e [ALSA] Remove sound/driver.h
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 17:29:48 +01:00
Takashi Iwai 31e8960b35 [ALSA] Remove PCM sleep_min and tick
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 17:29:47 +01:00
Takashi Iwai d948035a92 [ALSA] Remove PCM xfer_align sw params
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 17:29:47 +01:00
Jaroslav Kysela a713b58347 [ALSA] PCM core - remove SNDRV_PCM_TSTAMP_MMAP condition in snd_pcm_status()
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 17:29:46 +01:00
Jaroslav Kysela 28e9e47384 [ALSA] PCM - added back TSTAMP ioctl for PCM (for old alsa-lib binaries)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:36 +01:00
Marcin Ślusarz b05e578740 [ALSA] pcm_native: fix sparse warning about shadowing 'state' symbol
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 17:29:35 +01:00
Nick Piggin 3ad5afcd5f [ALSA] alsa: nopage
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 17:29:32 +01:00