Commit Graph

54 Commits

Author SHA1 Message Date
Clemens Ladisch c88469704d [ALSA] usb-audio: throttle MIDI URB resubmits on USB errors
USB generic driver
When a USB error occurs that might indicate that the device has been
unplugged, don't resubmit the URB immediately to prevent flooding the
log with error messages before khubd has us disconnect()ed.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-08-30 13:14:13 +02:00
Clemens Ladisch c347e9fca7 [ALSA] usb-audio: fix Emagic MIDI protocol handling
USB generic driver
Emagic devices pad their packets not with 0xff bytes but with a 0xff
byte followed by garbage, so we have to stop at the first such byte.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-08-30 08:47:34 +02:00
Clemens Ladisch 6207e51b79 [ALSA] usb-audio: use vmalloc for the PCM buffer
USB generic driver
With the double buffering, we no longer need contiguous memory for the
PCM buffer, so we can use vmalloc() instead of the preallocation
functions, and increase the maximum size to 256 KB.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-08-30 08:45:57 +02:00
Clemens Ladisch 55851f734d [ALSA] usb-audio: use usb_buffer_alloc/free
USB generic driver
Use the USB buffer allocation functions to avoid repeated DMA mappings
of our buffers, which are re-used quite a lot.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-08-30 08:45:53 +02:00
Clemens Ladisch daa150ef7d [ALSA] usb-audio: properly lock hwptr_done accesses
USB generic driver
Take the substream lock when reading hwptr_done to avoid a race
condition with the updates in the URB callbacks.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-08-30 08:45:50 +02:00
Clemens Ladisch 9624ea812c [ALSA] usb-audio: actually schedule playback URBs at frame boundaries
USB generic driver
Change prepare_playback_urb() not to stop preparing packets before a
frame boundary has been reached.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-08-30 08:45:47 +02:00
Clemens Ladisch 7efd8bc800 [ALSA] usb-audio: double-buffer all playback data
USB generic driver
We always had to use double buffering when capturing, and when playback
data for one URB crosses a buffer boundary.  The latter would make hwptr
updates less precise because the double-buffered data is read from the
buffer much earlier than the other data is read by the host controller.

Double-buffering all data allows to update hwptr immediately after the
data was copied to the USB buffer(s), which has the additional benefit
of avoiding the latency imposed by the host controller's delay of up to
one frame when interrupting.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-08-30 08:45:43 +02:00
Clemens Ladisch b263a9bdf9 [ALSA] usb-audio: optimize handling of capture URBs
USB generic driver
When preparing capture URBs, we don't need to stop when we cross a
period boundary because we now never handle more than one millisecond of
data per URB anyway.

When handling captured data, use an extra flag to call
snd_pcm_period_elapsed() no more than once.  This allows us to move the
period boundary checking code before the copying of the data which
avoids a second locking of the substream's lock.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-08-30 08:45:41 +02:00
Clemens Ladisch a93bf99077 [ALSA] usb-audio: schedule high speed URBs with 1 ms alignment
USB generic driver
The EHCI driver doesn't interrupt more than once per millisecond, and
organizes all iso transfers with frame-sized ITDs, so we can (try to)
be more efficient by aligning all URBs on frame boundaries.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-08-30 08:45:16 +02:00
Clemens Ladisch 71d848ca00 [ALSA] usb-audio: make nrpacks parameter writeable
USB generic driver
The nrpacks module parameter is used only when initializing a playback
stream, so it doesn't hurt to make it writeable.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-08-30 08:45:14 +02:00
Clemens Ladisch d6db392e92 [ALSA] usb-audio: fix packets per URB calculation for playback
USB generic driver
When determining how many packets are needed for one period, we cannot
assume that all packets have their maximum size -- we always use the
nominal sample rate when sending data, and could use an even lower rate
when the endpoint uses frequency feedback.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-08-30 08:45:08 +02:00
Clemens Ladisch 15a24c0778 [ALSA] usb-audio: use 1 ms URBs when capturing
USB generic driver
When capturing audio data, we do not know beforehand how many samples
the device sends per frame, so we have to use URBs that are as short as
possible to make sure that we can handle period boundaries without any
additional latencies.

Furthermore, the total count of URBs submitted doesn't matter when
capturing, so we can just use the maximum number.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-08-30 08:45:04 +02:00
Karsten Wiese 443feb8826 [ALSA] ALSA's struct _snd_pcm_substream: Obsolete open_flag
PCM Midlevel,ALSA<-OSS emulation,USB USX2Y
This patch removes open_flag from struct _snd_pcm_substream.
All of its uses are substituted by querying struct _snd_pcm_substream's
member ffile instead.

Signed-off-by: Karsten Wiese <annabellesgarden@yahoo.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2005-08-30 08:44:48 +02:00
Clemens Ladisch 854af9578c [ALSA] usb-audio - change quirk type handling
USB generic driver
Make the quirk type an enum instead of a #defined integer, and use a
table for the quirk constructor functions instead of a big switch
statement.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-07-28 12:22:41 +02:00
Clemens Ladisch f38275fe99 [ALSA] usb-audio - add support for Miditech USB MIDI keyboards
USB generic driver
Add support for Miditech Midistart and MidiStudio keyboards (another
case of devices using the standard protocol but having no descriptors).

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-07-28 12:22:37 +02:00
Nishanth Aravamudan b27c187f95 [ALSA] Fix-up sleeping in sound/usb
USB generic driver,USB USX2Y
Description: Fix-up sleeping in sound/usb. Replace big_mdelay() with
msleep() to guarantee the task delays as expected. This also involved
replacing/removing custom sleep functions.

Patch is compile-tested.

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2005-07-28 12:22:22 +02:00
Clemens Ladisch bbd4615cdb [ALSA] usb-audio - use bDeviceSubClass to detect MOTU FastLane
USB generic driver
MOTU builds other USB MIDI interfaces with the same product ID as the
FastLane, so we have to check the bDeviceSubClass field to differentiate
between them.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-07-28 12:21:44 +02:00
Clemens Ladisch 6155aff84b [ALSA] usb-audio - rename QUIRK_MIDI_MOTU to QUIRK_MIDI_RAW
USB generic driver
Rename the protocol used by the MOTU FastLane to 'raw' because it might
be useful with other devices, and there are other MOTU interfaces that
do not use this protocol.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-07-28 12:21:41 +02:00
Clemens Ladisch b1c6ef52e2 [ALSA] usb-audio - enable high speed transfers with Audiy 2 NX
USB generic driver
This patch enables the boot commands to activate high speed mode (and
associated sample formats like 8 channels with 24 bits at 96 kHz) on the
SB Audigy 2 NX.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-07-28 12:21:34 +02:00
Clemens Ladisch 0ac2ac0ad7 [ALSA] usb-audio: add support for an unknown Yamaha USB MIDI device
USB generic driver
Add a quirk for the Yamaha USB MIDI device with USB ID 0x103d.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-07-28 12:21:23 +02:00
Clemens Ladisch b4d3f9d452 [ALSA] usb-audio - fix capture of non-48k sample rates on Audigy 2 NX
USB generic driver
On the SB Audigy 2 NX, capturing with sample rates that are not a
multiple of 48 kHz does not seem to work, so disable it.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-07-28 12:09:26 +02:00
Clemens Ladisch 573567e07b [ALSA] usb-audio - high speed audio support
USB generic driver
Add support for endpoints with bInterval > 1, and decoding of the
wMaxPacketSize field of high-speed endpoints.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-07-28 12:09:25 +02:00
Jesper Juhl 77933d7276 [PATCH] clean up inline static vs static inline
`gcc -W' likes to complain if the static keyword is not at the beginning of
the declaration.  This patch fixes all remaining occurrences of "inline
static" up with "static inline" in the entire kernel tree (140 occurrences in
47 files).

While making this change I came across a few lines with trailing whitespace
that I also fixed up, I have also added or removed a blank line or two here
and there, but there are no functional changes in the patch.

Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 16:26:20 -07:00
Jesper Juhl 4d572776d4 [ALSA] Remove redundant NULL checks before kfree
Timer Midlevel,ALSA sequencer,ALSA<-OSS sequencer,Digigram VX core
I2C tea6330t,GUS Library,VIA82xx driver,VIA82xx-modem driver
CA0106 driver,CS46xx driver,EMU10K1/EMU10K2 driver,YMFPCI driver
Digigram VX Pocket driver,Common EMU synth,USB generic driver,USB USX2Y
Checking a pointer for NULL before calling kfree() on it is redundant,
kfree() deals with NULL pointers just fine.
This patch removes such checks from sound/

This patch also makes another, but closely related, change.
It avoids casting pointers about to be kfree()'ed.

Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2005-06-22 12:27:43 +02:00
Clemens Ladisch 604cf49925 [ALSA] usb-audio - fix synchronization packet interval with Audigy 2 NX
USB generic driver
When a device does not provide the bRefresh field in its audio endpoint
descriptors, use the bInterval field instead.

Furthermore, increase the number of sync URBs for better queueing.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-05-29 10:11:03 +02:00
Clemens Ladisch d3ff42fd2b [ALSA] usb-audio - claim all interfaces for Roland USB MIDI devices
USB generic driver
Many Roland USB MIDI devices have two interfaces that are currently not
used by the driver; claim them anyway.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-05-29 10:11:00 +02:00
Clemens Ladisch 29b16931f9 [ALSA] usb-audio - avoid unnecessary double buffering
USB generic driver
When a USB packet boundary falls exactly on a buffer boundary, hwptr
remains at the end of the buffer which causes an overflow in the next
iteration and triggers double buffering although the next packet would
actually be contiguous.

This patch ensures that hwptr is always smaller than buffer_size.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-05-29 10:08:53 +02:00
Clemens Ladisch 50cdbf1519 [ALSA] usb-audio - sanity-check sync feedback frequency values
USB generic driver
Check that the synchronization feedback frequency values returned by the
device are more or less near the nominal frequency.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-05-29 10:08:50 +02:00
Clemens Ladisch 1dcd3ec472 [ALSA] usb-audio - bind to control interface instead of usb_device
USB generic driver
Bind the device files to the (first) audio control interface instead of
the entire USB device.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-05-29 10:06:43 +02:00
Clemens Ladisch aafad5629a [ALSA] usb-audio - add a proc file for Audigy 2 NX jack status
USB generic driver
This patch adds a proc file for the SB Audigy 2 NX which shows the
connection status of the various jacks.  Unfortunately, no SPDIF input
frequency (yet).

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-05-29 10:06:34 +02:00
Clemens Ladisch f55a655bf9 [ALSA] usb-audio - remove superfluous LIRC ioctls
USB generic driver
The ioctls for LIRC compatibility can be removed because the
infrastructure and detection stuff is better done in user space.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-05-29 10:06:31 +02:00
Clemens Ladisch 3a2f08560d [ALSA] usb-audio - enable high speed (not) on Audigy 2 NX
USB generic driver
The SB Audigy 2 NX needs a special boot-up command before it works in
high speed mode.

However, we don't actually enable it yet because high speed
synchronization doesn't seem to work with this device.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-05-29 10:06:28 +02:00
James Courtier-Dutton 3714b5344e [ALSA] Fix snd-usb-audio dependency on snd-hwdep.
USB


Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
2005-05-29 10:06:25 +02:00
Clemens Ladisch c3f9329716 [ALSA] usb-audio - set sample rate attribute on Audigy 2 NX endpoints
USB generic driver
The SB Audigy 2 NX does not advertise the sample rate attribute in its
endpoint descriptors although it supports it.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-05-29 10:06:07 +02:00
Clemens Ladisch 93446edcd0 [ALSA] usb-audio - Audigy 2 NX blinkenlights
USB generic driver
Adds mixer controls for the CMSS/Dolby Digital/Power LEDs
on the SB Audigy 2 NX.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-05-29 10:06:03 +02:00
Clemens Ladisch 434b7f5687 [ALSA] usb-audio - make SB remote control device LIRC compatible
USB generic driver
Add ioctls to the Sound Blaster remote control hwdep device so that it
can be used with LIRC.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-05-29 10:06:00 +02:00
Clemens Ladisch ca81090a00 [ALSA] usb-audio - use only one packet in synchronization feedback URBs
USB generic driver
Do not use more than one packet in synchronization feedback URBs because
it would be pointless to send or receive more than one value at the same
time.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-05-29 10:05:57 +02:00
Clemens Ladisch 1149a64fe4 [ALSA] usb-audio - use proper interval between synchronization packets
USB generic driver
Add sanity checks when reading the bRefresh value, and actually use it
for the synchronization packets instead of polling at 1000 Hz.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-05-29 10:05:54 +02:00
Clemens Ladisch 4dc40a3cc4 [ALSA] usb-audio - allow type 0 extension units
USB generic driver
Extension units can have type 0, so do not ignore them when constructing
mixer controls.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-05-29 10:05:51 +02:00
Clemens Ladisch 27d10f5664 [ALSA] usb-audio - cache vendor/product IDs
USB generic driver
Cache the decoded values of idVendor/idProduct to get rid of most of
those ugly le16_to_cpu() calls.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-05-29 10:05:47 +02:00
Clemens Ladisch b259b10c42 [ALSA] usb-audio - add Extigy/Audigy 2 NX remote control support
ALSA Core,USB generic driver
Add an hwdep interface that supports reading remote control data from
Sound Blaster Extigy and Audigy 2 NX devices.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-05-29 10:05:43 +02:00
Clemens Ladisch 6639b6c236 [ALSA] usb-audio - add mixer control notifications
USB generic driver
Add support for the optional status interrupt endpoint in audio control
interfaces, and translate USB status notifications into ALSA mixer
control notifications.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-05-29 10:05:40 +02:00
Clemens Ladisch 84957a8ab0 [ALSA] usb-audio - move mixer data into separate struct
USB generic driver
Move all data related to audio control interfaces into a separate struct
local to usbmixer.c.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-05-29 10:05:37 +02:00
Clemens Ladisch 707e60732f [ALSA] usb-audio - reduce size of unitbitmap array
USB generic driver
Unit/terminal IDs are 8-bit integers, so the unitbitmap
variable does not need to be bigger than 256 bits.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-05-29 10:05:33 +02:00
Clemens Ladisch 8c1872dcf2 [ALSA] usb-audio - restrict Audigy 2 NX frequencies to 48/96 kHz
USB generic driver
On the SB Audigy 2 NX, frequency feedback doesn't quite work
when playing at 44.1 kHz, so temporarily disable this frequency.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-05-29 10:05:29 +02:00
Clemens Ladisch ee7333970b [ALSA] usb-audio - remove superfluous parameter
USB generic driver,USB USX2Y
This patch removes the superfluous driver parameter from the
disconnect functions.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-05-29 10:05:14 +02:00
Clemens Ladisch 8e062ec710 [ALSA] usb-audio - add selector unit names override for Audigy 2 NX
USB generic driver
Add a mechanism to specify source names of selector units,
and add such names for the SB Audigy 2 NX.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-05-29 10:05:11 +02:00
Clemens Ladisch 08fe15899d [ALSA] usb-audio - show exact synchronous frequency in proc file
USB generic driver
In the streamX proc file, show the exact number of samples per
USB frame as 16.16 hexadecimal floating point value.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-05-29 10:05:07 +02:00
Clemens Ladisch 863ad944b9 [ALSA] usb-audio: add Audigy 2 NX control names
USB generic driver
Add a mixer control map for the SB Audigy 2 NX so
that we get meaningful mixer control names.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-05-29 10:05:04 +02:00
Karsten Wiese 230cd5e248 [ALSA] prevent oops & dead keyboard on usb unplugging while the device is being used
USB generic driver,USB USX2Y
Without this patch, some usb kobjects, which are parents to
the usx2y's kobjects can be freed before the usx2y's.
This led to an oops in get_kobj_path_length() and a dead
keyboard, when the usx2y's kobjects were freed.
The patch ensures the correct sequence.
Tested ok on kernel 2.6.12-rc2.

Signed-off-by: Karsten Wiese <annabellesgarden@yahoo.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2005-05-29 10:04:47 +02:00