1
0
Fork 0
Commit Graph

45 Commits (f722406faae2d073cc1d01063d1123c35425939e)

Author SHA1 Message Date
Eldad Zack ef02e29b01 ALSA: usb-audio: UAC2: auto clock selection module param
Add a module param to disable auto clock selection.
This is provided for users that expect the audio stream to
fail when the clock source is invalid (e.g., the word clock
was unintentionally disconnected).

Signed-off-by: Eldad Zack <eldad@fogrefinery.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-04-04 08:31:32 +02:00
Damien Zammit b7b435e81b ALSA: usb-audio: Fix kernel panic of Digidesign Mbox2 quirk
This patch is based on 3.8-rc1. It fixes two things:
1) A kernel panic caused by incorrect allocation of a u8 variable
   "bootresponse".
2) A noisy dmesg (urb status -32) caused by broken pipe to an
   invalid midi endpoint.

It is also a little cleaner because there is no need for a new
QUIRK_MIDI type as suggested by kernel developers, since the device
follows exactly the MIDIMAN protocol.

Signed-off-by: Damien Zammit <damien@zamaudio.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-04 09:53:17 +01:00
Damien Zammit cb99864d40 ALSA: usb-audio: Support for Digidesign Mbox 2 USB sound card:
This patch is the result of a lot of trial and error, since there are no specs
available for the device.

Full duplex support is provided, i.e. playback and recording in stereo.
The format is hardcoded at 48000Hz @ 24 bit, which is the maximum that the
device supports.  Also, MIDI in and MIDI out both work.

Users will notice that the S/PDIF light also flashes when playback or recording
is active.  I believe this means that S/PDIF input/output is simultaneously
activated with the analogue i/o during use.
But this particular functionality remains untested.

Note that this particular version of the patch is so far untested on the
physical hardware because I have not compiled a full kernel with the changes.
However, extensive testing has been done by many users of the hardware
who believe other versions of my patch have worked since circa 2009.

[Modified to make a function static by tiwai]

Signed-off-by: Damien Zammit <damien@zamaudio.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-12-19 11:27:22 +01:00
Takashi Iwai 20d32022a8 ALSA: usb-audio: Deprecate async_unlink option
The async unlink behavior has been working over years.  The option was
provided only as a workaround for 2.4.x kernel.  Let's get rid of it.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-21 11:37:40 +01:00
Takashi Iwai 34f3c89fda ALSA: usb-audio: Use rwsem for disconnect protection
Replace mutex with rwsem for codec->shutdown protection so that
concurrent accesses are allowed.

Also add the protection to snd_usb_autosuspend() and
snd_usb_autoresume(), too.

Reported-by: Matthieu CASTET <matthieu.castet@parrot.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-10-30 11:07:00 +01:00
Daniel Mack 8fdff6a319 ALSA: snd-usb: implement new endpoint streaming model
This patch adds a new generic streaming logic for audio over USB.

It defines a model (snd_usb_endpoint) that handles everything that
is related to an USB endpoint and its streaming. There are functions to
activate and deactivate an endpoint (which call usb_set_interface()),
and to start and stop its URBs. It also has function pointers to be
called when data was received or is about to be sent, and pointer to
a sync slave (another snd_usb_endpoint) that is informed when data has
been received.

A snd_usb_endpoint knows about its state and implements a refcounting,
so only the first user will actually start the URBs and only the last
one to stop it will tear them down again.

With this sort of abstraction, the actual streaming is decoupled from
the pcm handling, which makes the "implicit feedback" mechanisms easy to
implement.

In order to split changes properly, this patch only adds the new
implementation but leaves the old one around, so the the driver doesn't
change its behaviour. The switch to actually use the new code is
submitted separately.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-04-13 10:23:42 +02:00
Daniel Mack 596580d0ee ALSA: snd-usb: add snd_usb_audio-wide mutex
This is needed for new card-wide list operations.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-04-13 10:21:55 +02:00
Kristian Amlie 1ef0e0a053 ALSA: usb-audio: add Starr Labs USB MIDI support
Add support for Starr Labs USB MIDI devices such as the Z7S, which are
based on an FTDI serial UART chip.

Based on a patch by Daniel Mack.

Signed-off-by: Kristian Amlie <kristian@amlie.name>
Acked-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-08-26 14:12:34 +02:00
Daniel Mack 014950b013 ALSA: usb-audio: add new quirk type QUIRK_AUDIO_STANDARD_MIXER
This quirk type will let the driver assume that there is a standard
mixer on a given interface, or that a specific mixer quirks will handle
the device.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-05-25 09:36:59 +02:00
Oliver Neukum 88a8516a21 ALSA: usbaudio: implement USB autosuspend
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-03-11 14:59:29 +01:00
Takashi Iwai 382225e62b ALSA: usb-audio: fix oops due to cleanup race when disconnecting
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 de1b8b93a0 "[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>
2011-02-23 08:15:43 +01:00
Clemens Ladisch c7f572168f ALSA: usb-audio: add Novation Launchpad support
Add a quirk entry for the Novation Launchpad USB MIDI controller.

QUIRK_MIDI_FASTLANE gets renamed to *_RAW_BYTES because this quirk type
is now shared by different devices.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Tested-by: Jakob Flierl <jakob.flierl@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-10-22 18:48:40 +02:00
Daniel Mack 79f920fbff ALSA: usb-audio: parse clock topology of UAC2 devices
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-31 18:16:59 +02:00
Krzysztof Foltman 4434ade8c9 ALSA: usb-audio: add support for Akai MPD16
The decoding/encoding is based on own reverse-engineering. Both control and
data ports are handled. Writing to control port supports SysEx events only,
as this is the only type of messages that MPD16 recognizes.

Signed-off-by: Krzysztof Foltman <wdev@foltman.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-05-21 17:12:30 +02:00
Daniel Mack e5779998bf ALSA: usb-audio: refactor code
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>
2010-03-05 08:17:14 +01:00
Daniel Mack 3e1aebef6f ALSA: usb-audio: header file cleanups
Rename snd-usb-lib to snd-usbmidi-lib as MIDI functions are the only
thing it actually contains. Introduce a new header file to only declare
these functions.

Introduced usbmixer.h for all functions exported by usbmixer.c.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-03-05 08:16:47 +01:00
Takashi Iwai 156366d315 Merge remote branch 'alsa/devel' into topic/misc
Conflicts:
	sound/usb/usbaudio.c
2010-03-02 11:27:46 +01:00
Clemens Ladisch e584bc3cf6 ALSA: ua101: add Edirol UA-1000 support
Add support for the Edirol UA-1000 to the UA-101 driver.

Both devices behave the same, so we just have to shuffle around some
interface numbers and name strings.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2010-03-01 17:02:38 +01:00
Daniel Mack de48c7bc6f ALSA: usbaudio: consolidate header files
Use the definitions from linux/usb/audio.h all over the ALSA USB audio
driver and add some missing definitions there as well.

Use the endpoint attribute macros from linux/usb/ch9 and remove the own
things from sound/usb/usbaudio.h.

Now things are also nicely prefixed which makes understanding the code
easier.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-02-23 08:51:56 +01:00
Daniel Mack 53ee98fe8a ALSA: usbaudio: implement basic set of class v2.0 parser
This adds a number of parsers for audio class v2.0. In particular, the
following internals are different and now handled by the code:

* the number of streaming interfaces is now reported by an interface
  association descriptor. The old approach using a proprietary
  descriptor is deprecated.

* The number of channels per interface is now stored in the AS_GENERAL
  descriptor (used to be part of the FORMAT_TYPE descriptor).

* The list of supported sample rates is no longer stored in a variable
  length appendix of the format_type descriptor but is retrieved from
  the device using a class specific GET_RANGE command.

* Supported sample formats are now reported as 32bit bitmap rather than
  a fixed value. For now, this is worked around by choosing just one of
  them.

* A devices needs to have at least one CLOCK_SOURCE descriptor which
  denotes a clockID that is needed im the class request command.

* Many descriptors (format_type, ...) have changed their layout. Handle
  this by casting the descriptors to the appropriate structs.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-02-23 08:40:24 +01:00
Daniel Mack 8fee4aff8c ALSA: usbaudio: introduce new types for audio class v2
This patch adds some definitions for audio class v2.

Unfortunately, the UNIT types PROCESSING_UNIT and EXTENSION_UNIT have
different numerical representations in both standards, so there is need
for a _V1 add-on now. usbmixer.c is changed accordingly.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-02-23 08:40:20 +01:00
John S. Gruber 52a7a58351 ALSA: usb-audio: use usbquirk.h for detection of HVR-950Q/850
Detect the HVR-950Q HVR-850 urb data alignment quirk using usbquirk.h
rather than using a case statement in snd_usb_audio_probe.

Signed-off-by: John S. Gruber <JohnSGruber@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-12-28 12:30:57 +01:00
John S. Gruber 98e89f606c ALSA: usb-audio: relax urb data align. restriction HVR-950Q and HVR-850 only
Addressing audio quality problem.

In sound/usb/usbaudio.c, for the Hauppage HVR-950Q and HVR-850 only, change
retire_capture_urb to allow transfers on audio sub-slot boundaries rather
than audio slots boundaries.

With these devices the left and right channel samples can be split between
two different urbs. Throwing away extra channel samples causes a sound
quality problem for stereo streams as the left and right channels are
swapped repeatedly, perhaps many times per second.

Urbs unaligned on sub-slot boundaries are still truncated to the next
lowest stride (audio slot) to retain synchronization on samples even
though left/right channel synchronization may be lost in this case.

Detect the quirk using a case statement in snd_usb_audio_probe.

BugLink: https://bugs.launchpad.net/ubuntu/+bug/495745

Signed-off-by: John S. Gruber <JohnSGruber@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-12-28 12:30:41 +01:00
Sergiy Kovalchuk 7d2b451e65 ALSA: usb-audio - Added functionality for E-mu 0404USB/0202USB/TrackerPre
Added functionality:
1) Extension Units support (all XU settings now available at alsamixer,
   kmix, etc):
- "AnalogueIn soft limiter" switch;
- "Sample rate" selector (values 0,1,2,3,4,5 corresponds to 44.1 48 ...
  192 kHz);
- "DigitalIn CLK source" selector (internal/external) (**);
- "DigitalOut format SPDIF/AC3" switch (**);
(**)E-mu-0404usb only.

2) Automatic device sample rate adjustment depending on substream
   samplerate for both capture and playback substream.

[minor coding-style fixes by tiwai]

Signed-off-by: Sergiy Kovalchuk <cnb_zerg@yahoo.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-12-28 12:29:39 +01:00
Clemens Ladisch 63978ab3e3 sound: add Edirol UA-101 support
Add experimental support for the Edirol UA-101 audio/MIDI interface.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-12-14 17:58:13 +01:00
Clemens Ladisch d82af9f9aa sound: usb: make the USB MIDI module more independent
Remove the dependecy from the USB MIDI code on the snd_usb_audio
structure.  This allows using the USB MIDI module from another driver
without having to pretend to be the generic USB audio driver.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-11-24 10:19:59 +01:00
Julian Anastasov f495088210 ALSA: usb-audio: fix combine_word problem
Fix combine_word problem where first octet is not
read properly. The only affected place seems to be the
INPUT_TERMINAL type. Before now, sound controls can be created
with the output terminal's name which is a fallback mechanism
used only for unknown input terminal types. For example,
Line can wrongly appear as Speaker. After the change it
should appear as Line.

	The side effect of this change can be that users
can expect the wrong control name in their scripts or
programs while now we return the correct one.

	Probably, these defines should use get_unaligned_le16 and
friends.

Signed-off-by: Julian Anastasov <ja@ssi.bg>
Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-11-07 09:46:06 +01:00
Clemens Ladisch 55de5ef970 sound: usb-audio: make the MotU Fastlane work again
Kernel 2.6.18 broke the MotU Fastlane, which uses duplicate endpoint
numbers in a manner that is not only illegal but also confuses the
kernel's endpoint descriptor caching mechanism.  To work around this, we
have to add a separate usb_set_interface() call to guide the USB core to
the correct descriptors.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Reported-and-tested-by: David Fries <david@fries.net>
Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-05-27 11:25:33 +02:00
Pedro Lopez-Cabanillas 310e0dc01d ALSA: snd-usb-audio: support for Edirol UA-4FX device
Renamed the old quirk function for ua-700/ua-25 to become more
generic, moving the MIDI interfaces to the quirk data header.
Added a new quirk for the Edirol UA-4FX.

Signed-off-by: Pedro Lopez-Cabanillas <pedro.lopez.cabanillas@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-10-10 13:41:48 +02:00
Takashi Iwai 7a9b8063cf ALSA: usb-audio - Add ignore_ctl_error parameter
Added the ignore_ctl_error parameter to enable/disable the control-error
handling for mixer interfaces.  It was a hard-coded ifdef, and now you
can change it more easily.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-08-15 11:48:01 +02:00
Karsten Wiese 030a07e441 ALSA: Add USB US122L driver
Added a new US122L usb-audio driver.  This driver works together with a
dedicated alsa-lib plugin.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-08-01 13:37:12 +02:00
Oliver Neukum f85bf29c94 [ALSA] usb audio suspend support
This patch implements suspend/resume support for USB audio devices.
It works with the microphone in my camera.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:36 +01:00
Bjoern Fay d0b0fac14e [ALSA] usbaudio - Add support for Edirol UA-101
Added support for the Edirol UA-101 (only in high-speed mode) by taking
the quirks for the UA-1000 and change them accordingly. Changes were
made in 'usbaudio.c', 'usbaudio.h', and 'usbquirks.h'
MIDI and recording seem to work perfectly (with JACK), but playback
gives some few glitches. I think that's the mentioned
synchronizing-problem in the UA-1000 quirk ('FIXME: playback must be
synchronized to capture'), so I didn't change that.
ToDo: Adding Mixer-Support for the built-in
control-panel/patch-bay/router.

Signed-off-by: Bjoern Fay <mail@bfay.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-02-09 09:03:53 +01:00
Ben Williamson c4a87ef4de [ALSA] USB midi: Remove duplicate CS_AUDIO_* #defines
Removed the CS_AUDIO_* #defines, which were duplicates of the
class-specific USB_DT_CS_* #defines in <linux/usb_ch9.h>.

Signed-off-by: Ben Williamson <ben.williamson@greyinnovation.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2006-06-22 21:34:31 +02:00
Clemens Ladisch cc7a59bd8d [ALSA] usb-audio: rename QUIRK_MIDI_MIDITECH to QUIRK_MIDI_CME
Modules: USB generic driver

Rename QUIRK_MIDI_MIDITECH to QUIRK_MIDI_CME because Miditech keyboards
are built by CME and use the same protocol, and don't force a Miditech
product name for the USB ID used by both Miditech and CME UF-x
keyboards.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2006-03-22 10:28:22 +01:00
Takashi Iwai 86e07d3465 [ALSA] Remove xxx_t typedefs: USB-Audio
Modules: USB generic driver

Remove xxx_t typedefs from the USB-Audio driver.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2006-01-03 12:19:55 +01:00
Clemens Ladisch 3527a008cb [ALSA] usb-audio: remove old compatibility wrappers (2/2)
Modules: USB generic driver

Move the usb_complete_callback() compatibility wrapper out of the
kernel tree.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-11-04 13:16:39 +01:00
Clemens Ladisch 3cfc1eb181 [ALSA] usb-audio: remove old compatibility wrappers (1/2)
Modules: USB generic driver

Move the usb_pipe_needs_resubmit() compatibility wrapper out of the
kernel tree.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2005-11-04 13:16:37 +01: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
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 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 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 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
Linus Torvalds 1da177e4c3 Linux-2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!
2005-04-16 15:20:36 -07:00