aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core (follow)
AgeCommit message (Collapse)AuthorFilesLines
2009-08-17sound: snd_ctl_remove_unlocked_id: simplify error pathsClemens Ladisch1-4/+5
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>
2009-08-17sound: snd_ctl_elem_add: fix value count checkClemens Ladisch1-1/+1
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>
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-07-26Merge branch 'fix/pcm-hwptr' into for-linusTakashi Iwai1-1/+35
* fix/pcm-hwptr: ALSA: pcm - Fix hwptr buffer-size overlap bug ALSA: pcm - Fix warnings in debug loggings ALSA: pcm - Add logging of hwptr updates and interrupt updates ALSA: pcm - Fix regressions with VMware
2009-07-23ALSA: pcm - Fix hwptr buffer-size overlap bugTakashi Iwai1-1/+1
The fix 79452f0a28aa5a40522c487b42a5fc423647ad98 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>
2009-07-23ALSA: pcm - Fix warnings in debug loggingsTakashi Iwai1-12/+12
Add proper cast. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-23ALSA: pcm - Add logging of hwptr updates and interrupt updatesTakashi Iwai1-0/+25
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>
2009-07-22ALSA: pcm - Fix regressions with VMwareTakashi Iwai1-1/+10
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>
2009-07-19ALSA: OSS sequencer should be initialized after snd_seq_system_client_initJaswinder Singh Rajput1-5/+2
When build SND_SEQUENCER in kernel then OSS sequencer(alsa_seq_oss_init) is initialized before System (snd_seq_system_client_init) which leads to memory leak : unreferenced object 0xf6b0e680 (size 256): comm "swapper", pid 1, jiffies 4294670753 backtrace: [<c108ac5c>] create_object+0x135/0x204 [<c108adfe>] kmemleak_alloc+0x26/0x4c [<c1087de2>] kmem_cache_alloc+0x72/0xff [<c126d2ac>] seq_create_client1+0x22/0x160 [<c126e3b6>] snd_seq_create_kernel_client+0x72/0xef [<c1485a05>] snd_seq_oss_create_client+0x86/0x142 [<c1485920>] alsa_seq_oss_init+0xf6/0x155 [<c1001059>] do_one_initcall+0x4f/0x111 [<c14655be>] kernel_init+0x115/0x166 [<c10032af>] kernel_thread_helper+0x7/0x10 [<ffffffff>] 0xffffffff unreferenced object 0xf688a580 (size 64): comm "swapper", pid 1, jiffies 4294670753 backtrace: [<c108ac5c>] create_object+0x135/0x204 [<c108adfe>] kmemleak_alloc+0x26/0x4c [<c1087de2>] kmem_cache_alloc+0x72/0xff [<c126f964>] snd_seq_pool_new+0x1c/0xb8 [<c126d311>] seq_create_client1+0x87/0x160 [<c126e3b6>] snd_seq_create_kernel_client+0x72/0xef [<c1485a05>] snd_seq_oss_create_client+0x86/0x142 [<c1485920>] alsa_seq_oss_init+0xf6/0x155 [<c1001059>] do_one_initcall+0x4f/0x111 [<c14655be>] kernel_init+0x115/0x166 [<c10032af>] kernel_thread_helper+0x7/0x10 [<ffffffff>] 0xffffffff unreferenced object 0xf6b0e480 (size 256): comm "swapper", pid 1, jiffies 4294670754 backtrace: [<c108ac5c>] create_object+0x135/0x204 [<c108adfe>] kmemleak_alloc+0x26/0x4c [<c1087de2>] kmem_cache_alloc+0x72/0xff [<c12725a0>] snd_seq_create_port+0x51/0x21c [<c126de50>] snd_seq_ioctl_create_port+0x57/0x13c [<c126d07a>] snd_seq_do_ioctl+0x4a/0x69 [<c126d0de>] snd_seq_kernel_client_ctl+0x33/0x49 [<c1485a74>] snd_seq_oss_create_client+0xf5/0x142 [<c1485920>] alsa_seq_oss_init+0xf6/0x155 [<c1001059>] do_one_initcall+0x4f/0x111 [<c14655be>] kernel_init+0x115/0x166 [<c10032af>] kernel_thread_helper+0x7/0x10 [<ffffffff>] 0xffffffff The correct order should be : System (snd_seq_system_client_init) should be initialized before OSS sequencer(alsa_seq_oss_init) which is equivalent to : 1. insmod sound/core/seq/snd-seq-device.ko 2. insmod sound/core/seq/snd-seq.ko 3. insmod sound/core/seq/snd-seq-midi-event.ko 4. insmod sound/core/seq/oss/snd-seq-oss.ko Including sound/core/seq/oss/Makefile after other seq modules fixes the ordering and memory leak. Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-15sound: rawmidi: disable active-sensing-on-close by defaultClemens Ladisch2-1/+2
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>
2009-07-15sound: seq_oss_midi: remove magic numbersClemens Ladisch1-6/+8
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>
2009-07-15sound: seq_midi: do not send MIDI reset when closingClemens Ladisch1-3/+0
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>
2009-07-15seq-midi: always log message on output overrunClemens Ladisch1-1/+2
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>
2009-07-08ALSA: Fix SG-buffer DMA with non-coherent architecturesTakashi Iwai4-1/+11
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>
2009-07-06ALSA: info - Use krealloc()Takashi Iwai1-3/+1
Use krealloc() to resize the buffer in sound/core/info.c. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-06-22Merge branch 'topic/seq-midi-fix' into for-linusTakashi Iwai1-4/+4
* topic/seq-midi-fix: sound: seq_midi_event: fix decoding of (N)RPN events
2009-06-22Merge branch 'topic/pcm-jiffies-check' into for-linusTakashi Iwai1-1/+1
* topic/pcm-jiffies-check: sound: fix check for return value in snd_pcm_hw_refine
2009-06-22sound: seq_midi_event: fix decoding of (N)RPN eventsClemens Ladisch1-4/+4
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>
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-06-17ALSA: Add new TLV types for dBwith min/maxTakashi Iwai1-2/+6
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>
2009-06-12Merge branch 'topic/misc' into for-linusTakashi Iwai1-1/+1
* topic/misc: ALSA: use card device as parent for jack input-devices
2009-06-10ALSA: use card device as parent for jack input-devicesKay Sievers1-1/+1
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>
2009-06-10Merge branch 'topic/seq-kconfig-cleanup' into for-linusTakashi Iwai3-13/+23
* topic/seq-kconfig-cleanup: ALSA: clean up the logic for building sequencer modules
2009-06-10Merge branch 'topic/pcm-jiffies-check' into for-linusTakashi Iwai2-22/+82
* 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
2009-06-10Merge branch 'topic/pcm-delay' into for-linusTakashi Iwai1-3/+5
* topic/pcm-delay: ALSA: usbaudio - Add delay account ALSA: Add extra delay count in PCM
2009-06-10Merge branch 'topic/div64-cleanup' into for-linusTakashi Iwai2-4/+4
* topic/div64-cleanup: ALSA: Clean up 64bit division functions
2009-06-08ALSA: pcm - A helper function to compose PCM stream name for debug printsTakashi Iwai1-6/+17
Use a common helper function for the PCM stream name displayed in XRUN and buffer-pointer debug prints. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-06-07ALSA: pcm - Fix update of runtime->hw_ptr_interruptTakashi Iwai1-1/+2
The commit 13f040f9e55d41e92e485389123654971e03b819 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>
2009-06-06ALSA: pcm - Fix a typo in hw_ptr update checkJaroslav Kysela1-1/+1
Fix a typo in the commit 13f040f9e55d41e92e485389123654971e03b819 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>
2009-06-05ALSA: Clean up 64bit division functionsTakashi Iwai2-4/+4
Replace the house-made div64_32() with the standard div_u64*() functions. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-06-04ALSA: Core - clean up snd_card_set_id* calls and remove possible id collisionJaroslav Kysela1-16/+10
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>
2009-06-03ALSA: Fix double locking of card list in snd_card_register()Mark Brown1-12/+19
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>
2009-06-02ALSA: Core - add snd_card_set_id() functionJaroslav Kysela1-23/+39
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>
2009-05-29ALSA: clean up the logic for building sequencer modulesMichal Marek3-13/+23
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>
2009-05-29ALSA: PCM midlevel: lower jiffies check margin using runtime->delay valueJaroslav Kysela1-2/+10
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>
2009-05-29ALSA: PCM midlevel: Do not update hw_ptr_jiffies when hw_ptr is not changedJaroslav Kysela1-2/+14
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>
2009-05-29ALSA: PCM midlevel: introduce mask for xrun_debug() macroJaroslav Kysela1-9/+9
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>
2009-05-29ALSA: PCM midlevel: improve fifo_size handlingJaroslav Kysela2-3/+31
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 Iwai2-2/+21
2009-05-27ALSA: Enable PCM hw_ptr_jiffies check only in xrun_debug modeTakashi Iwai1-1/+8
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>
2009-05-27ALSA: Fix invalid jiffies check after pauseTakashi Iwai2-1/+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-28ALSA: pcm core - Avoid jiffies check for devices with BATCH flagTakashi Iwai1-0/+7
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>
2009-04-15Merge branch 'topic/memdup_user' into for-linusTakashi Iwai5-99/+60
* 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()
2009-04-15Merge branch 'topic/hda' into for-linusTakashi Iwai1-0/+3
* topic/hda: ALSA: hda - Add quirk mask for Fujitsu Amilo laptops with ALC883 ALSA: hda - Avoid call of snd_jack_report at release ALSA: add private_data to struct snd_jack
2009-04-14ALSA: add private_data to struct snd_jackTakashi Iwai1-0/+3
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>
2009-04-14ALSA: sound/core: use memdup_user()Li Zefan5-99/+60
Remove open-coded memdup_user(). Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-04-10[ALSA] pcm-midlevel: Add more strict buffer position checks based on jiffiesJaroslav Kysela1-8/+39
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>
2009-04-07ALSA: oss - volume control for CSWITCH and CROUTEDeepika Makhija1-0/+8
Added an else part to check SNDRV_MIXER_OSS_PRESENT_CVOLUME for MIC (slot 7) in commit 36c7b833e5d2501142a371e4e75281d3a29fbd6b 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>
2009-03-31proc 2/2: remove struct proc_dir_entry::ownerAlexey Dobriyan1-29/+2
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>