aboutsummaryrefslogtreecommitdiff
path: root/sound/usb/pcm.c
AgeCommit message (Collapse)Author
2011-03-11ALSA: usbaudio: implement USB autosuspendOliver Neukum
Devices are autosuspended if no pcm nor midi channel is open Mixer devices may be opened. This way they are active when in use to play or record sound, but can be suspended while users have a mixer application running. [Small clean-ups using static inline by tiwai] Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-02-23ALSA: usb-audio: fix oops due to cleanup race when disconnectingTakashi Iwai
When a USB audio device is disconnected, snd_usb_audio_disconnect() kills all audio URBs. At the same time, the application, after being notified of the disconnection, might close the device, in which case ALSA calls the .hw_free callback, which should free the URBs too. Commit de1b8b93a0ba "[ALSA] Fix hang-up at disconnection of usb-audio" prevented snd_usb_hw_free() from freeing the URBs to avoid a hang that resulted from this race, but this introduced another race because the URB callbacks could now be executed after snd_usb_hw_free() has returned, and try to access already freed data. Fix the first race by introducing a mutex to serialize the disconnect callback and all PCM callbacks that manage URBs (hw_free and hw_params). Reported-and-tested-by: Pierre-Louis Bossart <pierre-louis.bossart@intel.com> Cc: <stable@kernel.org> [CL: also serialize hw_params callback] Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-11-01ALSA: usb - driver neglects kmalloc return value check and may deref NULLJesper Juhl
sound/usb/pcm.c::snd_usb_pcm_check_knot() fails to check the return value from kmalloc() and may end up dereferencing a null pointer. The patch below (compile tested only) should take care of that little problem. Signed-off-by: Jesper Juhl <jj@chaosbits.net> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-10-27ALSA: usb-audio: automatically detect feedback formatClemens Ladisch
There are two USB Audio Class specifications (v1 and v2), but neither of them clearly defines the feedback format for high-speed UAC v1 devices. Add to this whatever the Creative and M-Audio firmware writers have been smoking, and it becomes impossible to predict the exact feedback format used by a particular device. Therefore, automatically detect the feedback format by looking at the magnitude of the first received feedback value. Also, this allows us to get rid of some special cases for E-Mu devices. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-09-03Merge branch 'fix/misc' into topic/miscTakashi Iwai
2010-09-03ALSA: usb-audio: fix detection of vendor-specific device protocol settingsClemens Ladisch
The Audio Class v2 support code in 2.6.35 added checks for the bInterfaceProtocol field. However, there are devices (usually those detected by vendor-specific quirks) that do not have one of the predefined values in this field, which made the driver reject them. To fix this regression, restore the old behaviour, i.e., assume that a device with an unknown bInterfaceProtocol field (other than UAC_VERSION_2) has more or less UAC-v1-compatible descriptors. [compile warning fixes by tiwai] Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Cc: Daniel Mack <daniel@caiaq.de> Cc: <stable@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-08-18Merge branch 'topic/isa' into topic/miscTakashi Iwai
2010-08-14ALSA: usb: USB3 SuperSpeed sound supportPaul Zimmerman
This is V2 of the patch, after feedback from Clemens and Daniel. This patch adds SuperSpeed support to the USB drivers under sound/. It adds tests for USB_SPEED_SUPER to the appropriate places that check for the USB speed. This patch has been tested with our SS USB3 device emulating a set of Yamaha speakers and a Logitech microphone, but with the descriptors modified to add USB3 support. It has also been tested with the real speakers and microphone, to make sure that USB2 devices still work. Signed-off-by: Paul Zimmerman <paulz@synopsys.com> Cc: Clemens Ladisch <clemens@ladisch.de> Cc: Daniel Mack <daniel@caiaq.de> Cc: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-07-12fix comnment/printk typos concerning "empty"Uwe Kleine-König
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-05-31ALSA: usb-audio: parse clock topology of UAC2 devicesDaniel Mack
Audio devices which comply to the UAC2 standard can export complex clock topologies in its descriptors and set up links between them. The entities that are defined are - clock sources, which define the end-leafs. - clock selectors, which act as switch to select one out of many possible clocks sources. - clock multipliers, which have an input clock source, and act as clock source again. They can be used to derive one clock from another. All sample rate changes, clock validity queries and the like must go to clock source elements, while clock selectors and multipliers can be used as terminal clock source. The following patch adds a parser for these elements and functions to iterate over the tree and find the leaf nodes (clock sources). The samplerate set functions were moved to the new clock.c file. Signed-off-by: Daniel Mack <daniel@caiaq.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-05-27ALSA: usb-audio: add support for UAC2 pitch controlDaniel Mack
This request is again handled differently in comparison to UAC1. Signed-off-by: Daniel Mack <daniel@caiaq.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-03-29ALSA: usb pcm: use of kmalloc requires the include of slab.hStephen Rothwell
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-03-12linux/usb/audio.h: split headerDaniel Mack
- Split the audio.h file in two to clearly denote the differences between the standards. - Add many more defines to audio-v2.h. Most of them are not currently used. - Replaced a magic value with a proper define Signed-off-by: Daniel Mack <daniel@caiaq.de> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Cc: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-03-05ALSA: usb-audio: add support for samplerate setting on v2 devicesDaniel Mack
Sample rate setting is done with a 4-byte long class request that addresses the interface. Signed-off-by: Daniel Mack <daniel@caiaq.de> Cc: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-03-05ALSA: usb-audio: use a format bitmask per alternate settingClemens Ladisch
In preparation for USB audio 2.0 support, change the audioformat structure so that it uses a bitmask to specify possible formats. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-03-05ALSA: usb-audio: rename substream format field to altset_idxClemens Ladisch
The snd_usb_substream::format field actually contains the index of the current alternate setting, so rename it to altset_idx to avoid confusion. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-03-05ALSA: usb-audio: refactor codeDaniel Mack
Clean up the usb audio driver by factoring out a lot of functions to separate files. Code for procfs, quirks, urbs, format parsers etc all got a new home now. Moved almost all special quirk handling to quirks.c and introduced new generic functions to handle them, so the exceptions do not pollute the whole driver. Renamed usbaudio.c to card.c because this is what it actually does now. Renamed usbmidi.c to midi.c for namespace clarity. Removed more things from usbaudio.h. The non-standard drivers were adopted accordingly. Signed-off-by: Daniel Mack <daniel@caiaq.de> Cc: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>