From e03173fce2f2c233b755f2d668d6d4247a717453 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Tue, 10 Jan 2006 14:27:20 +0100 Subject: [ALSA] Add support for EDIROL UM-3ex Modules: USB generic driver This is my naive attempt at adding ALSA device support. The attached patch provides support for the EDIROL UM-3ex. This is a 3-port USB midi interface with a built-in USB hub and the ability to chain 2 other UM-3x's in a master-slave configuration. I only have one, so I do not know how this works in practice. Though this is a 3-port device, I had to throw in that 4th 'Control' interface to the definition in order to make the 3rd port work. If I set in/out_cables to 0x000b, a 3rd interface appears on the driver, but it does nothing. Changing it to 0x000f allows the 3rd interface to work, but of course interface 4 does not work because it does not exist. Signed-off-by: Takashi Iwai --- sound/usb/usbmidi.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound/usb/usbmidi.c') diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c index f15b021c3ce..905e33e6068 100644 --- a/sound/usb/usbmidi.c +++ b/sound/usb/usbmidi.c @@ -1092,6 +1092,8 @@ static struct { { USB_ID(0x086a, 0x0001), 8, "%s Broadcast" }, { USB_ID(0x086a, 0x0002), 8, "%s Broadcast" }, { USB_ID(0x086a, 0x0003), 4, "%s Broadcast" }, + /* Edirol UM-3ex */ + { USB_ID(0x0582, 0x009a), 3, "%s Control" }, }; static void snd_usbmidi_init_substream(struct snd_usb_midi* umidi, -- cgit v1.2.3-70-g09d2 From 7c79b7682ee6318a8e47173b158846ed0edd8f1a Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Tue, 10 Jan 2006 18:56:23 +0100 Subject: [ALSA] usb-audio: cosmetic changes Modules: USB generic driver Move some entries around to keep them sorted by ID. Signed-off-by: Clemens Ladisch --- sound/usb/usbmidi.c | 4 ++-- sound/usb/usbquirks.h | 52 +++++++++++++++++++++------------------------------ 2 files changed, 23 insertions(+), 33 deletions(-) (limited to 'sound/usb/usbmidi.c') diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c index 905e33e6068..7f7e371c5df 100644 --- a/sound/usb/usbmidi.c +++ b/sound/usb/usbmidi.c @@ -1082,6 +1082,8 @@ static struct { { USB_ID(0x0582, 0x004d), 0, "%s MIDI" }, { USB_ID(0x0582, 0x004d), 1, "%s 1" }, { USB_ID(0x0582, 0x004d), 2, "%s 2" }, + /* Edirol UM-3EX */ + { USB_ID(0x0582, 0x009a), 3, "%s Control" }, /* M-Audio MidiSport 8x8 */ { USB_ID(0x0763, 0x1031), 8, "%s Control" }, { USB_ID(0x0763, 0x1033), 8, "%s Control" }, @@ -1092,8 +1094,6 @@ static struct { { USB_ID(0x086a, 0x0001), 8, "%s Broadcast" }, { USB_ID(0x086a, 0x0002), 8, "%s Broadcast" }, { USB_ID(0x086a, 0x0003), 4, "%s Broadcast" }, - /* Edirol UM-3ex */ - { USB_ID(0x0582, 0x009a), 3, "%s Control" }, }; static void snd_usbmidi_init_substream(struct snd_usb_midi* umidi, diff --git a/sound/usb/usbquirks.h b/sound/usb/usbquirks.h index 8f348611bb0..381d9a8ccee 100644 --- a/sound/usb/usbquirks.h +++ b/sound/usb/usbquirks.h @@ -203,28 +203,6 @@ YAMAHA_DEVICE(0x7010, "UB99"), } } }, -{ - USB_DEVICE(0x0582, 0x009a), - .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { - .vendor_name = "EDIROL", - .product_name = "UM-3ex", - .ifnum = QUIRK_ANY_INTERFACE, - .type = QUIRK_COMPOSITE, - .data = (const struct snd_usb_audio_quirk[]) { - { - .ifnum = 0, - .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const struct snd_usb_midi_endpoint_info) { - .out_cables = 0x000f, - .in_cables = 0x000f - } - }, - { - .ifnum = -1 - } - } - } -}, { USB_DEVICE(0x0582, 0x0002), .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { @@ -1112,6 +1090,27 @@ YAMAHA_DEVICE(0x7010, "UB99"), } } }, + /* TODO: add Edirol UA-101 support */ + /* TODO: add Roland G-70 support */ + /* TODO: add Roland V-SYNTH XT support */ + /* TODO: add BOSS GT-PRO support */ + /* TODO: add Edirol PC-50 support */ + /* TODO: add Edirol PC-80 support */ + /* TODO: add Edirol UA-1EX support */ +{ + USB_DEVICE(0x0582, 0x009a), + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { + .vendor_name = "EDIROL", + .product_name = "UM-3EX", + .ifnum = 0, + .type = QUIRK_MIDI_FIXED_ENDPOINT, + .data = & (const struct snd_usb_midi_endpoint_info) { + .out_cables = 0x000f, + .in_cables = 0x000f + } + } +}, + /* TODO: add Edirol MD-P1 support */ /* Guillemot devices */ { @@ -1133,15 +1132,6 @@ YAMAHA_DEVICE(0x7010, "UB99"), } } }, - /* TODO: add Edirol UA-101 support */ - /* TODO: add Roland G-70 support */ - /* TODO: add Roland V-SYNTH XT support */ - /* TODO: add BOSS GT-PRO support */ - /* TODO: add Edirol PC-50 support */ - /* TODO: add Edirol PC-80 support */ - /* TODO: add Edirol UA-1EX support */ - /* TODO: add Edirol UM-3 support */ - /* TODO: add Edirol MD-P1 support */ /* Midiman/M-Audio devices */ { -- cgit v1.2.3-70-g09d2 From cc7a59bd8dcee9b01e0c9ab21380071f0ae6ef0d Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Tue, 7 Feb 2006 17:11:06 +0100 Subject: [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 --- sound/usb/usbaudio.c | 2 +- sound/usb/usbaudio.h | 4 ++-- sound/usb/usbmidi.c | 2 +- sound/usb/usbquirks.h | 10 ++++++---- 4 files changed, 10 insertions(+), 8 deletions(-) (limited to 'sound/usb/usbmidi.c') diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index 51a862637f2..7b1b9f29f37 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c @@ -3074,7 +3074,7 @@ static int snd_usb_create_quirk(struct snd_usb_audio *chip, [QUIRK_MIDI_NOVATION] = snd_usb_create_midi_interface, [QUIRK_MIDI_RAW] = snd_usb_create_midi_interface, [QUIRK_MIDI_EMAGIC] = snd_usb_create_midi_interface, - [QUIRK_MIDI_MIDITECH] = snd_usb_create_midi_interface, + [QUIRK_MIDI_CME] = snd_usb_create_midi_interface, [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk, [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk, [QUIRK_AUDIO_EDIROL_UA700_UA25] = create_ua700_ua25_quirk, diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h index ecd724bfe5a..88733524d0f 100644 --- a/sound/usb/usbaudio.h +++ b/sound/usb/usbaudio.h @@ -161,7 +161,7 @@ enum quirk_type { QUIRK_MIDI_NOVATION, QUIRK_MIDI_RAW, QUIRK_MIDI_EMAGIC, - QUIRK_MIDI_MIDITECH, + QUIRK_MIDI_CME, QUIRK_AUDIO_STANDARD_INTERFACE, QUIRK_AUDIO_FIXED_ENDPOINT, QUIRK_AUDIO_EDIROL_UA700_UA25, @@ -209,7 +209,7 @@ struct snd_usb_midi_endpoint_info { /* for QUIRK_MIDI_EMAGIC, data points to a snd_usb_midi_endpoint_info * structure (out_cables and in_cables only) */ -/* for QUIRK_MIDI_MIDITECH, data is NULL */ +/* for QUIRK_MIDI_CME, data is NULL */ /* */ diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c index 7f7e371c5df..7580339dba2 100644 --- a/sound/usb/usbmidi.c +++ b/sound/usb/usbmidi.c @@ -1576,7 +1576,7 @@ int snd_usb_create_midi_interface(struct snd_usb_audio* chip, sizeof(struct snd_usb_midi_endpoint_info)); err = snd_usbmidi_detect_endpoints(umidi, &endpoints[0], 1); break; - case QUIRK_MIDI_MIDITECH: + case QUIRK_MIDI_CME: err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); break; default: diff --git a/sound/usb/usbquirks.h b/sound/usb/usbquirks.h index bb7829cf98d..0485e21861a 100644 --- a/sound/usb/usbquirks.h +++ b/sound/usb/usbquirks.h @@ -1537,22 +1537,24 @@ YAMAHA_DEVICE(0x7010, "UB99"), } }, +/* Miditech devices */ { USB_DEVICE(0x4752, 0x0011), .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .vendor_name = "Miditech", .product_name = "Midistart-2", .ifnum = 0, - .type = QUIRK_MIDI_MIDITECH + .type = QUIRK_MIDI_CME } }, + +/* Central Music devices */ { + /* this ID used by both Miditech MidiStudio-2 and CME UF-x */ USB_DEVICE(0x7104, 0x2202), .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { - .vendor_name = "Miditech", - .product_name = "MidiStudio-2", .ifnum = 0, - .type = QUIRK_MIDI_MIDITECH + .type = QUIRK_MIDI_CME } }, -- cgit v1.2.3-70-g09d2 From 62f09c3d321c82981ae3f2dd7e32bc4c73379a7e Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Mon, 27 Feb 2006 09:53:03 +0100 Subject: [ALSA] usb-audio: optimize snd_usbmidi_count_bits() Modules: USB generic driver Reduce the code size of the snd_usbmidi_count_bits() function by using simpler operations. Signed-off-by: Clemens Ladisch --- sound/usb/usbmidi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sound/usb/usbmidi.c') diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c index 7580339dba2..2b9d940c806 100644 --- a/sound/usb/usbmidi.c +++ b/sound/usb/usbmidi.c @@ -871,10 +871,10 @@ static int snd_usbmidi_in_endpoint_create(struct snd_usb_midi* umidi, static unsigned int snd_usbmidi_count_bits(unsigned int x) { - unsigned int bits = 0; + unsigned int bits; - for (; x; x >>= 1) - bits += x & 1; + for (bits = 0; x; ++bits) + x &= x - 1; return bits; } -- cgit v1.2.3-70-g09d2