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>
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>
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>
The hardware devices with SNDRV_PCM_INFO_BATCH flag can't give the
precise current position. And such hardwares have often big FIFO
in addition to the ring buffer, and it screws up the jiffies check
in pcm_lib.c.
This patch adds a simple check of info flag so that the driver skips
the jiffies check in snd_pcm_period_elapsed() when BATCH flag is set.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
* topic/memdup_user:
ALSA: sound/pci: use memdup_user()
ALSA: sound/usb: use memdup_user()
ALSA: sound/isa: use memdup_user()
ALSA: sound/core: use memdup_user()
Added private_data and private_free fields to struct snd_jack so that
the caller can assign the data. It'll be helpful for avoiding the
double-free of the jack instance.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Some drivers like Intel8x0 or Intel HDA are broken for some hardware variants.
This patch adds more strict buffer position checks based on jiffies when
internal hw_ptr is updated. Enable xrun_debug to see mangling of wrong
positions.
As a side effect, the hw_ptr interrupt update routine might do slightly better
job when many interrupts are lost.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Added an else part to check
SNDRV_MIXER_OSS_PRESENT_CVOLUME for MIC (slot 7)
in commit 36c7b833e5
Similarly, checks and volume control is required for
SNDRV_MIXER_OSS_PRESENT_CSWITCH and SNDRV_MIXER_OSS_PRESENT_CROUTE
as well.
Signed-off-by: Deepika Makhija <deepika.makhija@einfochips.com>
Signed-off-by: Viral Mehta <viral.mehta@einfochips.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Setting ->owner as done currently (pde->owner = THIS_MODULE) is racy
as correctly noted at bug #12454. Someone can lookup entry with NULL
->owner, thus not pinning enything, and release it later resulting
in module refcount underflow.
We can keep ->owner and supply it at registration time like ->proc_fops
and ->data.
But this leaves ->owner as easy-manipulative field (just one C assignment)
and somebody will forget to unpin previous/pin current module when
switching ->owner. ->proc_fops is declared as "const" which should give
some thoughts.
->read_proc/->write_proc were just fixed to not require ->owner for
protection.
rmmod'ed directories will be empty and return "." and ".." -- no harm.
And directories with tricky enough readdir and lookup shouldn't be modular.
We definitely don't want such modular code.
Removing ->owner will also make PDE smaller.
So, let's nuke it.
Kudos to Jeff Layton for reminding about this, let's say, oversight.
http://bugzilla.kernel.org/show_bug.cgi?id=12454
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
* '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
Make the boundary checks a bit safer.
These caese are rare or theoretically won't happen, but nothing
bad to keep the checks safer...
Signed-off-by: Takashi Iwai <tiwai@suse.de>
When the hw_ptr_interrupt reaches the boundary, it must check whether
the hw_base was already lapped and corret the delta value appropriately.
Also, rebasing the hw_ptr needs a correction because buffer_size isn't
always aligned to period_size.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Always reset the invalind hw_ptr position returned by the pointer
callback. The behavior should be consitent independently from the
debug option.
Also, add the printk_ratelimit() check to avoid flooding debug
prints.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
In snd_free_sgbuf_pags(), vunmap() is called after releasing the SG
pages, and it causes errors on Xen as Xen manages the pages
differently. Although no significant errors have been reported on
the actual hardware, this order should be fixed other way round,
first vunmap() then free pages.
Cc: Jan Beulich <jbeulich@novell.com>
Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
s/mutex_lock/mutex_unlock/ on 2 fail paths in snd_pcm_oss_proc_write.
Probably a typo, lock should be unlocked when leaving the function.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
At the time of initialization, SNDRV_MIXER_OSS_PRESENT_PVOLUME bit is not
set for MIC (slot 7).
So, the same should not be checked when an application tries to do gain
control for audio recording devices.
Just check slot->present for SNDRV_MIXER_OSS_PRESENT_CVOLUME independently.
Verified with a simple application which opens /dev/dsp for recording and
/dev/mixer for volume control.
Have tested two usb audio mic devices.
Signed-off-by: Viral Mehta <viral.mehta@einfochips.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
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>
Traditionally, changes to struct file->f_flags have been done under BKL
protection, or with no protection at all. This patch causes all f_flags
changes after file open/creation time to be done under protection of
f_lock. This allows the removal of some BKL usage and fixes a number of
longstanding (if microscopic) races.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Use the standard linked list for snd_monitor_file management.
Also, move the list deletion of shutdown_list element into
snd_disconnect_release() (for simplification).
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Added snd_ctl_add_slave_uncached() function to add a slave element
with volatile controls. The values of normal slave elements are
supposed to be cachable, i.e. they are changed only via the put
callbacks. OTOH, when a slave element is volatile and its values may
be changed by other reason (e.g. hardware status change), the values
will get inconsistent.
The new function allows the slave elements with volatile changes.
When the slave is tied with this call, the native get callback is
issued at each time so that the values are always updated.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The timer callbacks are called in the protected status by the lock
of the timer instance, so there is no need for an extra lock in the
PCM substream.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Clean up and improve snd_pcm_update_hw_ptr*() functions.
snd_pcm_update_hw_ptr() tries to detect the unexpected hwptr jumps
more strictly to avoid the position mess-up, which often results in
the bad quality I/O with pulseaudio.
The hw-ptr skip error messages are printed when xrun proc is set to
non-zero.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Incorrect variable was used to get the next sample which caused S2
to be stuck with the same value resulting in loud background noise.
Signed-off-by: Steve Chen <schen at mvista.com>
Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Currently the jack layer refers to card->longname as a part of
its input device name string. However, longname is often really long
and way too ugly as an identifier, such as,
"HDA Intel at 0xf8400000 irq 21".
This patch changes the code to use card->shortname instead.
The shortname string contains usually the h/w vendor and product
names but without messy I/O port or IRQ numbers.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Impact: cleanup
snd_pcm_new takes a char *id argument, although it is not modifying
the string. it can therefore be declared as const char *id.
Signed-off-by: Tim Blechmann <tim@klingt.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
AFMT_S24_LE is set twice in return value
vi sound/core/oss/pcm_oss.c +640
#define AFMT_S24_LE 0x00008000
#define AFMT_S24_BE 0x00010000
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Introduced snd_card_create() function as a replacement of snd_card_new().
The new function returns a negative error code so that the probe callback
can return the proper error code, while snd_card_new() can give only NULL
check.
The old snd_card_new() is still provided as an inline function but with
__deprecated attribute. It'll be removed soon later.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Add support for reporting new jack types SND_JACK_VIDEOOUT and
SND_JACK_AVOUT (a combination of LINEOUT and VIDEOOUT) to the jack
reporting API.
Also add the corresponding SW_VIDEOOUT_INSERT switch to the input system
header.
Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Several subsystem open handlers dereference the fops_get() return value
without checking it for nullness. This opens a race condition between the
open handler and module unloading.
A module can be marked as being unloaded (MODULE_STATE_GOING) before its
exit function is called and gets the chance to unregister the driver.
During that window open handlers can still be called, and fops_get() will
fail in try_module_get() and return a NULL pointer.
This change checks the fops_get() return value and returns -ENODEV if NULL.
Reported-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Acked-by: Takashi Iwai <tiwai@suse.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Dave Airlie <airlied@linux.ie>
Acked-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Use a lookup table rather than explicit code to map input subsystem jack
types into ASoC ones, implemented as suggested by Takashi Iwai.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
hrtimers: fix warning in kernel/hrtimer.c
x86: make sure we really have an hpet mapping before using it
x86: enable HPET on Fujitsu u9200
linux/timex.h: cleanup for userspace
posix-timers: simplify de_thread()->exit_itimers() path
posix-timers: check ->it_signal instead of ->it_pid to validate the timer
posix-timers: use "struct pid*" instead of "struct task_struct*"
nohz: suppress needless timer reprogramming
clocksource, acpi_pm.c: put acpi_pm_read_slow() under CONFIG_PCI
nohz: no softirq pending warnings for offline cpus
hrtimer: removing all ur callback modes, fix
hrtimer: removing all ur callback modes, fix hotplug
hrtimer: removing all ur callback modes
x86: correct link to HPET timer specification
rtc-cmos: export second NVRAM bank
Fixed up conflicts in sound/drivers/pcsp/pcsp.c and sound/core/hrtimer.c
manually.
Replace all tasklet_hi_schedule() callers with the normal
tasklet_schedule(). The former often causes troubles with
RT-kernels, and has actually no merit.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Some systems support both mechanical and electrical jack detection,
allowing them to report that a jack is physically present but does
not have any functioning connections. Add a new jack type for these,
allowing user space to report faulty connections.
Thanks to Guillem Jover for the suggestion.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Add the license and misc comments at the beginning of the code.
Also, use ns_to_ktime() for simplification.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Do not ignore the return of 'device_create_file' in
'snd_card_register' and thereby fixing the following warnings:
sound/core/init.c: In function 'snd_card_register':
sound/core/init.c:640: warning: ignoring return value of
'device_create_file', declared with attribute warn_unused_result
sound/core/init.c:641: warning: ignoring return value of
'device_create_file', declared with attribute warn_unused_result
Signed-off-by: Hannes Eder <hannes@hanneseder.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
For udev, we need a way to rename soundcard names. The soundcard numbers
(indexes) are hardwired but we have a text identification which can be
changed at run-time. The ALSA user space tools already allow using of
this text identification.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
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: make a STAC_DELL_EQ option
ALSA: emu10k1 - Add more invert_shared_spdif flag to Audigy models
ALSA: hda - Add a quirk for another Acer Aspire (1025:0090)
ALSA: remove direct access of dev->bus_id in sound/isa/*
sound: struct device - replace bus_id with dev_name(), dev_set_name()
ALSA: Fix PIT lockup on some chipsets when using the PC-Speaker
ALSA: rawmidi - Add open check in rawmidi callbacks
ALSA: hda - Add digital-mic for ALC269 auto-probe mode
ALSA: hda - Disable broken mic auto-muting in Realtek codes
The drivers (e.g. mtpav) may call rawmidi functions in irq handlers
even though the streams are not opened. This results in Oops or panic.
This patch adds the rawmidi state check before actually operating the
rawmidi buffers.
Tested-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
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>
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
ALSA: ASoC: Fix WM9713 ALC Decay Time name
ALSA: ASoC: Fix some minor errors in mpc5200 psc i2s driver
ALSA: ASoC: Fix mono controls after conversion to support full int masks
ALSA: sound/ice1712: indentation & braces disagree - add braces
ALSA: usb - Add quirk for Edirol UA-25EX advanced modes
sound: struct device - replace bus_id with dev_name(), dev_set_name()
ALSA: hda - Add reboot notifier
ALSA: Warn when control names are truncated
ALSA: intel8x0 - add Dell Optiplex GX620 (AD1981B) to AC97 clock whitelist
ALSA: hda - Fix SPDIF mute on IDT/STAC codecs
ALSA: hda: Add HDA vendor ID for Wolfson Microelectronics
ALSA: hda - Add another HP model for AD1884A
This is likely to confuse user interfaces since the end of the control
name is interpreted (eg, "Volume", "Switch").
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch introduces support for reporting SW_LINEOUT_INSERT detection events
via the jack abstraction layer.
Also adds a SND_JACK_LINEOUT define to the input system header.
Signed-off-by: Matthew Ranostay <mranostay@embeddedalley.com>
Cc: Dmitry Torokhov <dtor@mail.ru>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch duplicates the jack->id pointer with kstrdup() to prevent
scoping issues from calling autoprobing functions from the HDA section.
Signed-off-by: Matthew Ranostay <mranostay@embeddedalley.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Fix alsa kernel-doc warning in linux-next:
Warning(linux-next-20081016//sound/core/pcm_misc.c:327): No description found for parameter 'samples'
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Now that device_create() has been audited, rename things back to the
original call to be sane.
Cc: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
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>
Facilitate drivers that wish to carry on if they can't create a jack
input device by handling attempts to report the state of a NULL jack,
removing the need to check for initialisation before use.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>