summaryrefslogtreecommitdiff
path: root/sound/core
AgeCommit message (Collapse)Author
2011-09-15ALSA: pcm - fix race condition in wait_for_avail()Arjan van de Ven
wait_for_avail() in pcm_lib.c has a race in it (observed in practice by an Intel validation group). The function is supposed to return once space in the buffer has become available, or if some timeout happens. The entity that creates space (irq handler of sound driver and some such) will do a wake up on a waitqueue that this function registers for. However there are two races in the existing code 1) If space became available between the caller noticing there was no space and this function actually sleeping, the wakeup is missed and the timeout condition will happen instead 2) If a wakeup happened but not sufficient space became available, the code will loop again and wait for more space. However, if the second wake comes in prior to hitting the schedule_timeout_interruptible(), it will be missed, and potentially you'll wait out until the timeout happens. The fix consists of using more careful setting of the current state (so that if a wakeup happens in the main loop window, the schedule_timeout() falls through) and by checking for available space prior to going into the schedule_timeout() loop, but after being on the waitqueue and having the state set to interruptible. [tiwai: the following changes have been added to Arjan's original patch: - merged akpm's fix for waitqueue adding order into a single patch - reduction of duplicated code of avail check ] Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Cc: <stable@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-08-08Merge branch 'fix/kconfig' into for-linusTakashi Iwai
2011-08-08ALSA: timer - Add NULL-check for invalid slave timerTakashi Iwai
Just to be sure. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-08-08ALSA: timer - Fix Oops at closing slave timerTakashi Iwai
A slave-timer instance has no timer reference, and this results in NULL-dereference at stopping the timer, typically called at closing the device. Reference: https://bugzilla.kernel.org/show_bug.cgi?id=40682 Cc: <stable@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-08-02Merge branch 'for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6 * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6: ALSA: asihpi - Clarify adapter index validity check ALSA: asihpi - Don't leak firmware if mem alloc fails ALSA: rtctimer.c needs module.h ASoC: Fix txx9aclc.c build ALSA: hdspm - Add firmware revision 0xcc for RME MADI ALSA: hdspm - Fix reported external sample rate on RME MADI and MADIface ALSA: hdspm - Provide MADI speed mode selector on RME MADI and MADIface ALSA: sound/core/pcm_compat.c: adjust array index
2011-07-30ALSA: rtctimer.c needs module.hRandy Dunlap
rtctimer.c uses interfaces from linux/module.h, so it should include that file. This fixes build errors. Signed-off-by: Randy Dunlap <rdunlap@xenotime.net> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-28ALSA: sound/core/pcm_compat.c: adjust array indexJulia Lawall
Convert array index from the loop bound to the loop index. A simplified version of the semantic patch that fixes this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ expression e1,e2,ar; @@ for(e1 = 0; e1 < e2; e1++) { <... ar[ - e2 + e1 ] ...> } // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Cc: <stable@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-27Merge branch 'for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6 * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6: (22 commits) ALSA: hda - Cirrus Logic CS421x support ALSA: Make pcm.h self-contained ALSA: hda - Allow codec-specific set_power_state ops ALSA: hda - Add post_suspend patch ops ALSA: hda - Make CONFIG_SND_HDA_POWER_SAVE depending on CONFIG_PM ALSA: hda - Make sure mute led reflects master mute state ALSA: hda - Fix invalid mute led state on resume of IDT codecs ASoC: Revert "ASoC: SAMSUNG: Add I2S0 internal dma driver" ALSA: hda - Add support of the 4 internal speakers on certain HP laptops ALSA: Make snd_pcm_debug_name usable outside pcm_lib ALSA: hda - Fix DAC filling for multi-connection pins in Realtek parser ASoC: dapm - Add methods to retrieve snd_card and soc_card from dapm context. ASoC: SAMSUNG: Add I2S0 internal dma driver ASoC: SAMSUNG: Modify I2S driver to support idma ASoC: davinci: add missing break statement ASoC: davinci: fix codec start and stop functions ASoC: dapm - add DAPM macro for external enum widgets ASoC: Acknowledge WM8962 interrupts before acting on them ASoC: sgtl5000: guide user when regulator support is needed ASoC: sgtl5000: refactor registering internal ldo ...
2011-07-25Merge branch 'for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6 * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: fs: take the ACL checks to common code bury posix_acl_..._masq() variants kill boilerplates around posix_acl_create_masq() generic_acl: no need to clone acl just to push it to set_cached_acl() kill boilerplate around posix_acl_chmod_masq() reiserfs: cache negative ACLs for v1 stat format xfs: cache negative ACLs if there is no attribute fork 9p: do no return 0 from ->check_acl without actually checking vfs: move ACL cache lookup into generic code CIFS: Fix oops while mounting with prefixpath xfs: Fix wrong return value of xfs_file_aio_write fix devtmpfs race caam: don't pass bogus S_IFCHR to debugfs_create_...() get rid of create_proc_entry() abuses - proc_mkdir() is there for purpose asus-wmi: ->is_visible() can't return negative fix jffs2 ACLs on big-endian with 16bit mode_t 9p: close ACL leaks ocfs2_init_acl(): fix a leak VFS : mount lock scalability for internal mounts
2011-07-24get rid of create_proc_entry() abuses - proc_mkdir() is there for purposeAl Viro
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-24ALSA: Make snd_pcm_debug_name usable outside pcm_libEliot Blennerhassett
Formatting a PCM name is useful for module debug too. Add snd_prefix when making function public. [minor coding-style fixes by tiwai] Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-12ALSA: Use krealloc() in possible placesTakashi Iwai
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-14ALSA: rawmidi - Use workq for event handlingTakashi Iwai
Kill tasklet usage in rawmidi core code. Use workq for the event callback instead of tasklet (which is used only in core/seq/seq_midi.c). Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-10ALSA: Use %pV for snd_printk()Takashi Iwai
Clean up snd_printk() helper using the %pV prefix for recursive printks. This also automagically fixes an Oops with RO/NX-enabled modules. Tested-by: Maarten Lankhorst <m.b.lankhorst@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-05-26ALSA: core: remove unused variables.Luca Tettamanti
Drop a few variables that are never read. Signed-off-by: Luca Tettamanti <kronos.it@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-05-26ALSA: PCM - Don't check DMA time-out too shortlyTakashi Iwai
When the PCM period size is set larger than 10 seconds, currently the PCM core may abort the operation with DMA-error due to the fixed timeout for 10 seconds. A similar problem is seen in the drain operation that has a fixed timeout of 10 seconds, too. This patch fixes the timeout length depending on the period size and rate, also including the consideration of no_period_wakeup flag. Reported-by: Raymond Yau <superquad.vortex2@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-05-22Merge branch 'topic/misc' into for-linusTakashi Iwai
2011-05-19ALSA: sound, core, pcm_lib: fix xrun_logBen Gardiner
The xrun_log function was augmented with the in_interrupt parameter whereas the empty macro definition used when xrun logging is disabled was not. Add a third parameter to the empty macro definition so as to not cause compiler errors when xrun logging (CONFIG_SND_PCM_XRUN_DEBUG) is disabled. Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-05-18ALSA: sound, core, pcm_lib: xrun_log: log also in_interruptBen Gardiner
When debugging pcm drivers I found the "period" or "hw" prefix printed by either XRUN_DEBUG_PERIODUPDATE or XRUN_DEBUG_PERIODUPDATE events, respectively to be very useful is observing the interplay between interrupt-context updates and syscall-context updates. Similarly, when debugging overruns with XRUN_DEBUG_LOG it is useful to see the context of the last 10 positions. Add an in_interrupt member to hwptr_log_entry which stores the value of the in_interrupt parameter of snd_pcm_update_hw_ptr0 when the log entry is created. Print a "[Q]" prefix when dumping the log entries if in_interrupt was true. Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-04-07Merge branch 'for-linus2' of git://git.profusion.mobi/users/lucas/linux-2.6Linus Torvalds
* 'for-linus2' of git://git.profusion.mobi/users/lucas/linux-2.6: Fix common misspellings
2011-04-04ALSA: core - Don't use "default' for defaultTakashi Iwai
The card-id parser assigns the string "default" when no appropriate word is found in the card name. But this string may confuse the alsa-lib, so better to avoid. Use "Default" now instead. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-04-04Merge branch 'fix/misc' into topic/miscTakashi Iwai
2011-04-01ALSA: pcm: fix infinite loop in snd_pcm_update_hw_ptr0()Kelly Anderson
When period interrupts are disabled, snd_pcm_update_hw_ptr0() compares the current time against the time estimated for the current hardware pointer to detect xruns. The somewhat fuzzy threshold in the while loop makes it possible that hdelta becomes negative; the comparison being done with unsigned types then makes the loop go through the entire 263 negative range, and, depending on the value, never reach an unsigned value that is small enough to stop the loop. Doing this with interrupts disabled results in the machine locking up. To prevent this, ensure that the loop condition uses signed types for both operands so that the comparison is correctly done. Many thanks to Kelly Anderson for debugging this. Reported-by: Nix <nix@esperi.org.uk> Reported-by: "Christopher K." <c.krooss@googlemail.com> Reported-and-tested-by: Kelly Anderson <kelly@silka.with-linux.com> Signed-off-by: Kelly Anderson <kelly@silka.with-linux.com> [cl: remove unneeded casts; use a temp variable] Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Cc: 2.6.38 <stable@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-03-31Fix common misspellingsLucas De Marchi
Fixes generated by 'codespell' and manually reviewed. Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
2011-03-28Merge branch 'fix/misc' into topic/miscTakashi Iwai
2011-03-25ALSA: Fix yet another race in disconnectionTakashi Iwai
This patch fixes a race between snd_card_file_remove() and snd_card_disconnect(). When the card is added to shutdown_files list in snd_card_disconnect(), but it's freed in snd_card_file_remove() at the same time, the shutdown_files list gets corrupted. The list member must be freed in snd_card_file_remove() as well. Reported-and-tested-by: Russ Dill <russ.dill@gmail.com> Cc: <stable@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-03-25ALSA: vmalloc buffers should use normal mmapBenjamin Herrenschmidt
It's a big no-no to use pgprot_noncached() when mmap'ing such buffers into userspace since they are mapped cachable in kernel space. This can cause all sort of interesting things ranging from to garbled sound to lockups on various architectures. I've observed that usb-audio is broken on powerpc 4xx for example because of that. Also remove the now unused snd_pcm_lib_mmap_noncached(). It's an arch business to know when to use uncached mappings, there's already hacks for MIPS inside snd_pcm_default_mmap() and other archs are supposed to use dma_mmap_coherent(). (See my separate patch that adds dma_mmap_coherent() to powerpc) Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> CC: <stable@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-03-22ALSA: Add snd_ctl_replace() to dynamically replace a controlDimitris Papastamos
Add a function to dynamically replace a given control. If the control does not already exist, a third parameter is used to determine whether to actually add that control. This is useful in cases where downloadable firmware at runtime can add or replace existing controls. A separate patch needs to be made to allow ALSA Mixer to render the replaced controls on the fly. Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-03-18Merge branch 'topic/misc' into for-linusTakashi Iwai
2011-03-16Merge branch 'topic/asoc' into for-linusTakashi Iwai
2011-03-16ALSA: sound/core: merge list_del()/list_add_tail() to list_move_tail()Nicolas Kaiser
Merge list_del() + list_add_tail() to list_move_tail(). Signed-off-by: Nicolas Kaiser <nikai@nikai.net> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-03-11Merge branch 'fix/misc' into topic/miscTakashi Iwai
2011-03-11ALSA: Add snd_ctl_activate_id()Takashi Iwai
Added a new API function snd_ctl_activate_id() for activate / inactivate the control element dynamically. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-03-08ALSA: control: clean up snd_ctl_hole_check()Clemens Ladisch
The return value of snd_ctl_hole_check() is used only to detect whether to continue the loop in snd_ctl_find_hole() or not, so we can simplify the code by changing this return type to a boolean. Also rename this function to better show what it actually does. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-03-08ALSA: control: fix numid conflict check for new controlsClemens Ladisch
The purpose of the snd_ctl_hole_check() function is to find conflicts between the numerical IDs of the new control and those of any existing controls. However, it would fail to detect an existing control whose count is smaller than the new control's count and whose interval of IDs is entirely contained in the interval of the new control's IDs. To fix this, use the correct formula to detect overlapping intervals, which happens to simplify the condition. This problem was not encountered so far because ALSA does not yet allow drivers to allocate specific control IDs. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-02-27sound:core:seq:seq_ports.c Remove one to many n's in a word.Justin P. Mattock
The Patch below removes one to many "n's" in a word.. Signed-off-by: Justin P. Mattock <justinmattock@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-02-21ALSA: fix one memory leak in sound jackLu Guanqun
Signed-off-by: Lu Guanqun <guanqun.lu@intel.com> Reviewed-by: Wu Fengguang <fengguang.wu@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-02-14ALSA: core: sparse cleanupsClemens Ladisch
Change the core code where sparse complains. In most cases, this means just adding annotations to confirm that we indeed want to do the dirty things we're doing. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-02-10ALSA: hrtimer: remove superfluous tasklet invocationClemens Ladisch
Commit bb758e9637e5ddc removed snd_hrtimer_callback() from the hardware interrupt handler, thus moving it into a tasklet, but did not tell the ALSA timer framework about this, so the timer handling would now be done in the ALSA timer tasklet scheduled from another tasklet. To fix this, add the flag to tell the ALSA timer framework that the timer handler is already being invoked in a tasklet. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-02-10ALSA: hrtimer: handle delayed timer interruptsClemens Ladisch
If a timer interrupt was delayed too much, hrtimer_forward_now() will forward the timer expiry more than once. When this happens, the additional number of elapsed ALSA timer ticks must be passed to snd_timer_interrupt() to prevent the ALSA timer from falling behind. This mostly fixes MIDI slowdown problems on highly-loaded systems with badly behaved interrupt handlers. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Reported-and-tested-by: Arthur Marsh <arthur.marsh@internode.on.net> Cc: <stable@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-01-13Merge branch 'for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6 * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6: (348 commits) ALSA: hda - Fix NULL-derefence with a single mic in STAC auto-mic detection ALSA: hda - Add missing NID 0x19 fixup for Sony VAIO ALSA: hda - Fix ALC275 enable hardware EQ for SONY VAIO ALSA: oxygen: fix Xonar DG input ALSA: hda - Fix EAPD on Lenovo NB ALC269 to low ALSA: hda - Fix missing EAPD for Acer 4930G ALSA: hda: Disable 4/6 channels on some NVIDIA GPUs. ALSA: hda - Add static_hdmi_pcm option to HDMI codec parser ALSA: hda - Don't refer ELD when unplugged ASoC: tpa6130a2: Fix compiler warning ASoC: tlv320dac33: Add DAPM selection for LOM invert ASoC: DMIC codec: Adding a generic DMIC codec ALSA: snd-usb-us122l: Fix missing NULL checks ALSA: snd-usb-us122l: Fix MIDI output ASoC: soc-cache: Fix invalid memory access during snd_soc_lzo_cache_sync() ASoC: Fix section mismatch in wm8995.c ALSA: oxygen: add S/PDIF source selection for Claro cards ALSA: oxygen: fix CD/MIDI for X-Meridian (2G) ASoC: fix migor audio build ALSA: include delay.h for msleep in Xonar DG support ...
2011-01-13Merge branch 'for-next' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (43 commits) Documentation/trace/events.txt: Remove obsolete sched_signal_send. writeback: fix global_dirty_limits comment runtime -> real-time ppc: fix comment typo singal -> signal drivers: fix comment typo diable -> disable. m68k: fix comment typo diable -> disable. wireless: comment typo fix diable -> disable. media: comment typo fix diable -> disable. remove doc for obsolete dynamic-printk kernel-parameter remove extraneous 'is' from Documentation/iostats.txt Fix spelling milisec -> ms in snd_ps3 module parameter description Fix spelling mistakes in comments Revert conflicting V4L changes i7core_edac: fix typos in comments mm/rmap.c: fix comment sound, ca0106: Fix assignment to 'channel'. hrtimer: fix a typo in comment init/Kconfig: fix typo anon_inodes: fix wrong function name in comment fix comment typos concerning "consistent" poll: fix a typo in comment ... Fix up trivial conflicts in: - drivers/net/wireless/iwlwifi/iwl-core.c (moved to iwl-legacy.c) - fs/ext4/ext4.h Also fix missed 'diabled' typo in drivers/net/bnx2x/bnx2x.h while at it.
2011-01-13Merge branch 'topic/misc' into for-linusTakashi Iwai
2011-01-10ALSA: core, oxygen, virtuoso: add an enum control info helperClemens Ladisch
Introduce the helper function snd_ctl_enum_info() to fill out the elem_info fields for an enumerated control. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-01-10ALSA: Don't leak in sound/core/oss/pcm_oss.c::snd_pcm_hw_param_near()Jesper Juhl
snd_pcm_hw_param_near() will leak the memory allocated to 'save' if the call to snd_pcm_hw_param_max() returns less than zero. This patch makes sure we never leak. Signed-off-by: Jesper Juhl <jj@chaosbits.net> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-12-22Merge branch 'master' into for-nextJiri Kosina
Conflicts: MAINTAINERS arch/arm/mach-omap2/pm24xx.c drivers/scsi/bfa/bfa_fcpim.c Needed to update to apply fixes for which the old branch was too outdated.
2010-12-21ALSA: pcm: remember to always call va_end() on stuff that we va_start()Jesper Juhl
The Coverity checker spotted that we do not always remember to call va_end() on 'args' in failure paths in snd_pcm_hw_rule_add(). Here's a patch to fix that up (compile tested only) - it also removes some annoying trailing whitespace that caught my eye while I was in the area.. Signed-off-by: Jesper Juhl <jj@chaosbits.net> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-12-13Merge branch 'topic/workq-update' into topic/miscTakashi Iwai
2010-11-30ALSA: Fix SNDCTL_DSP_RESET ioctl for OSS emulationTakashi Iwai
In OSS emulation, SNDCTL_DSP_RESET ioctl needs the reset of the internal buffer state in addition to drop of the running streams. Otherwise the succeeding access becomes inconsistent. Tested-by: Amit Nagal <helloin.amit@gmail.com> Cc: <stable@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-11-24ALSA: support module on-demand loading for seq and timerKay Sievers
If CONFIG_SND_DYNAMIC_MINORS is used, assign /dev/snd/seq and /dev/snd/timer the usual static minors, and export specific module aliases to generate udev module on-demand loading instructions: $ cat /lib/modules/2.6.33.4-smp/modules.devname # Device nodes to trigger on-demand module loading. microcode cpu/microcode c10:184 fuse fuse c10:229 ppp_generic ppp c108:0 tun net/tun c10:200 uinput uinput c10:223 dm_mod mapper/control c10:236 snd_timer snd/timer c116:33 snd_seq snd/seq c116:1 The last two lines instruct udev to create device nodes, even when the modules are not loaded at that time. As soon as userspace accesses any of these nodes, the in-kernel module-loader will load the module, and the device can be used. The header file minor calculation needed to be simplified to make __stringify() (supports only two indirections) in the MODULE_ALIAS macro work. This is part of systemd's effort to get rid of unconditional module load instructions and needless init scripts. Cc: Lennart Poettering <lennart@poettering.net> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>