diff options
Diffstat (limited to 'sound/usb/midi.c')
-rw-r--r-- | sound/usb/midi.c | 373 |
1 files changed, 209 insertions, 164 deletions
diff --git a/sound/usb/midi.c b/sound/usb/midi.c index 9a4e82cf4ef9..7b166c2be0f7 100644 --- a/sound/usb/midi.c +++ b/sound/usb/midi.c | |||
@@ -102,8 +102,8 @@ struct usb_protocol_ops { | |||
102 | void (*input)(struct snd_usb_midi_in_endpoint*, uint8_t*, int); | 102 | void (*input)(struct snd_usb_midi_in_endpoint*, uint8_t*, int); |
103 | void (*output)(struct snd_usb_midi_out_endpoint *ep, struct urb *urb); | 103 | void (*output)(struct snd_usb_midi_out_endpoint *ep, struct urb *urb); |
104 | void (*output_packet)(struct urb*, uint8_t, uint8_t, uint8_t, uint8_t); | 104 | void (*output_packet)(struct urb*, uint8_t, uint8_t, uint8_t, uint8_t); |
105 | void (*init_out_endpoint)(struct snd_usb_midi_out_endpoint*); | 105 | void (*init_out_endpoint)(struct snd_usb_midi_out_endpoint *); |
106 | void (*finish_out_endpoint)(struct snd_usb_midi_out_endpoint*); | 106 | void (*finish_out_endpoint)(struct snd_usb_midi_out_endpoint *); |
107 | }; | 107 | }; |
108 | 108 | ||
109 | struct snd_usb_midi { | 109 | struct snd_usb_midi { |
@@ -112,7 +112,7 @@ struct snd_usb_midi { | |||
112 | struct usb_interface *iface; | 112 | struct usb_interface *iface; |
113 | const struct snd_usb_audio_quirk *quirk; | 113 | const struct snd_usb_audio_quirk *quirk; |
114 | struct snd_rawmidi *rmidi; | 114 | struct snd_rawmidi *rmidi; |
115 | struct usb_protocol_ops* usb_protocol_ops; | 115 | struct usb_protocol_ops *usb_protocol_ops; |
116 | struct list_head list; | 116 | struct list_head list; |
117 | struct timer_list error_timer; | 117 | struct timer_list error_timer; |
118 | spinlock_t disc_lock; | 118 | spinlock_t disc_lock; |
@@ -134,7 +134,7 @@ struct snd_usb_midi { | |||
134 | }; | 134 | }; |
135 | 135 | ||
136 | struct snd_usb_midi_out_endpoint { | 136 | struct snd_usb_midi_out_endpoint { |
137 | struct snd_usb_midi* umidi; | 137 | struct snd_usb_midi *umidi; |
138 | struct out_urb_context { | 138 | struct out_urb_context { |
139 | struct urb *urb; | 139 | struct urb *urb; |
140 | struct snd_usb_midi_out_endpoint *ep; | 140 | struct snd_usb_midi_out_endpoint *ep; |
@@ -147,7 +147,7 @@ struct snd_usb_midi_out_endpoint { | |||
147 | spinlock_t buffer_lock; | 147 | spinlock_t buffer_lock; |
148 | 148 | ||
149 | struct usbmidi_out_port { | 149 | struct usbmidi_out_port { |
150 | struct snd_usb_midi_out_endpoint* ep; | 150 | struct snd_usb_midi_out_endpoint *ep; |
151 | struct snd_rawmidi_substream *substream; | 151 | struct snd_rawmidi_substream *substream; |
152 | int active; | 152 | int active; |
153 | uint8_t cable; /* cable number << 4 */ | 153 | uint8_t cable; /* cable number << 4 */ |
@@ -167,8 +167,8 @@ struct snd_usb_midi_out_endpoint { | |||
167 | }; | 167 | }; |
168 | 168 | ||
169 | struct snd_usb_midi_in_endpoint { | 169 | struct snd_usb_midi_in_endpoint { |
170 | struct snd_usb_midi* umidi; | 170 | struct snd_usb_midi *umidi; |
171 | struct urb* urbs[INPUT_URBS]; | 171 | struct urb *urbs[INPUT_URBS]; |
172 | struct usbmidi_in_port { | 172 | struct usbmidi_in_port { |
173 | struct snd_rawmidi_substream *substream; | 173 | struct snd_rawmidi_substream *substream; |
174 | u8 running_status_length; | 174 | u8 running_status_length; |
@@ -178,7 +178,7 @@ struct snd_usb_midi_in_endpoint { | |||
178 | int current_port; | 178 | int current_port; |
179 | }; | 179 | }; |
180 | 180 | ||
181 | static void snd_usbmidi_do_output(struct snd_usb_midi_out_endpoint* ep); | 181 | static void snd_usbmidi_do_output(struct snd_usb_midi_out_endpoint *ep); |
182 | 182 | ||
183 | static const uint8_t snd_usbmidi_cin_length[] = { | 183 | static const uint8_t snd_usbmidi_cin_length[] = { |
184 | 0, 0, 2, 3, 3, 1, 2, 3, 3, 3, 3, 3, 2, 2, 3, 1 | 184 | 0, 0, 2, 3, 3, 1, 2, 3, 3, 3, 3, 3, 2, 2, 3, 1 |
@@ -187,7 +187,7 @@ static const uint8_t snd_usbmidi_cin_length[] = { | |||
187 | /* | 187 | /* |
188 | * Submits the URB, with error handling. | 188 | * Submits the URB, with error handling. |
189 | */ | 189 | */ |
190 | static int snd_usbmidi_submit_urb(struct urb* urb, gfp_t flags) | 190 | static int snd_usbmidi_submit_urb(struct urb *urb, gfp_t flags) |
191 | { | 191 | { |
192 | int err = usb_submit_urb(urb, flags); | 192 | int err = usb_submit_urb(urb, flags); |
193 | if (err < 0 && err != -ENODEV) | 193 | if (err < 0 && err != -ENODEV) |
@@ -221,10 +221,10 @@ static int snd_usbmidi_urb_error(const struct urb *urb) | |||
221 | /* | 221 | /* |
222 | * Receives a chunk of MIDI data. | 222 | * Receives a chunk of MIDI data. |
223 | */ | 223 | */ |
224 | static void snd_usbmidi_input_data(struct snd_usb_midi_in_endpoint* ep, int portidx, | 224 | static void snd_usbmidi_input_data(struct snd_usb_midi_in_endpoint *ep, |
225 | uint8_t* data, int length) | 225 | int portidx, uint8_t *data, int length) |
226 | { | 226 | { |
227 | struct usbmidi_in_port* port = &ep->ports[portidx]; | 227 | struct usbmidi_in_port *port = &ep->ports[portidx]; |
228 | 228 | ||
229 | if (!port->substream) { | 229 | if (!port->substream) { |
230 | dev_dbg(&ep->umidi->dev->dev, "unexpected port %d!\n", portidx); | 230 | dev_dbg(&ep->umidi->dev->dev, "unexpected port %d!\n", portidx); |
@@ -250,9 +250,9 @@ static void dump_urb(const char *type, const u8 *data, int length) | |||
250 | /* | 250 | /* |
251 | * Processes the data read from the device. | 251 | * Processes the data read from the device. |
252 | */ | 252 | */ |
253 | static void snd_usbmidi_in_urb_complete(struct urb* urb) | 253 | static void snd_usbmidi_in_urb_complete(struct urb *urb) |
254 | { | 254 | { |
255 | struct snd_usb_midi_in_endpoint* ep = urb->context; | 255 | struct snd_usb_midi_in_endpoint *ep = urb->context; |
256 | 256 | ||
257 | if (urb->status == 0) { | 257 | if (urb->status == 0) { |
258 | dump_urb("received", urb->transfer_buffer, urb->actual_length); | 258 | dump_urb("received", urb->transfer_buffer, urb->actual_length); |
@@ -274,10 +274,10 @@ static void snd_usbmidi_in_urb_complete(struct urb* urb) | |||
274 | snd_usbmidi_submit_urb(urb, GFP_ATOMIC); | 274 | snd_usbmidi_submit_urb(urb, GFP_ATOMIC); |
275 | } | 275 | } |
276 | 276 | ||
277 | static void snd_usbmidi_out_urb_complete(struct urb* urb) | 277 | static void snd_usbmidi_out_urb_complete(struct urb *urb) |
278 | { | 278 | { |
279 | struct out_urb_context *context = urb->context; | 279 | struct out_urb_context *context = urb->context; |
280 | struct snd_usb_midi_out_endpoint* ep = context->ep; | 280 | struct snd_usb_midi_out_endpoint *ep = context->ep; |
281 | unsigned int urb_index; | 281 | unsigned int urb_index; |
282 | 282 | ||
283 | spin_lock(&ep->buffer_lock); | 283 | spin_lock(&ep->buffer_lock); |
@@ -304,10 +304,10 @@ static void snd_usbmidi_out_urb_complete(struct urb* urb) | |||
304 | * This is called when some data should be transferred to the device | 304 | * This is called when some data should be transferred to the device |
305 | * (from one or more substreams). | 305 | * (from one or more substreams). |
306 | */ | 306 | */ |
307 | static void snd_usbmidi_do_output(struct snd_usb_midi_out_endpoint* ep) | 307 | static void snd_usbmidi_do_output(struct snd_usb_midi_out_endpoint *ep) |
308 | { | 308 | { |
309 | unsigned int urb_index; | 309 | unsigned int urb_index; |
310 | struct urb* urb; | 310 | struct urb *urb; |
311 | unsigned long flags; | 311 | unsigned long flags; |
312 | 312 | ||
313 | spin_lock_irqsave(&ep->buffer_lock, flags); | 313 | spin_lock_irqsave(&ep->buffer_lock, flags); |
@@ -343,7 +343,8 @@ static void snd_usbmidi_do_output(struct snd_usb_midi_out_endpoint* ep) | |||
343 | 343 | ||
344 | static void snd_usbmidi_out_tasklet(unsigned long data) | 344 | static void snd_usbmidi_out_tasklet(unsigned long data) |
345 | { | 345 | { |
346 | struct snd_usb_midi_out_endpoint* ep = (struct snd_usb_midi_out_endpoint *) data; | 346 | struct snd_usb_midi_out_endpoint *ep = |
347 | (struct snd_usb_midi_out_endpoint *) data; | ||
347 | 348 | ||
348 | snd_usbmidi_do_output(ep); | 349 | snd_usbmidi_do_output(ep); |
349 | } | 350 | } |
@@ -375,7 +376,7 @@ static void snd_usbmidi_error_timer(unsigned long data) | |||
375 | } | 376 | } |
376 | 377 | ||
377 | /* helper function to send static data that may not DMA-able */ | 378 | /* helper function to send static data that may not DMA-able */ |
378 | static int send_bulk_static_data(struct snd_usb_midi_out_endpoint* ep, | 379 | static int send_bulk_static_data(struct snd_usb_midi_out_endpoint *ep, |
379 | const void *data, int len) | 380 | const void *data, int len) |
380 | { | 381 | { |
381 | int err = 0; | 382 | int err = 0; |
@@ -396,8 +397,8 @@ static int send_bulk_static_data(struct snd_usb_midi_out_endpoint* ep, | |||
396 | * fourth byte in each packet, and uses length instead of CIN. | 397 | * fourth byte in each packet, and uses length instead of CIN. |
397 | */ | 398 | */ |
398 | 399 | ||
399 | static void snd_usbmidi_standard_input(struct snd_usb_midi_in_endpoint* ep, | 400 | static void snd_usbmidi_standard_input(struct snd_usb_midi_in_endpoint *ep, |
400 | uint8_t* buffer, int buffer_length) | 401 | uint8_t *buffer, int buffer_length) |
401 | { | 402 | { |
402 | int i; | 403 | int i; |
403 | 404 | ||
@@ -405,12 +406,13 @@ static void snd_usbmidi_standard_input(struct snd_usb_midi_in_endpoint* ep, | |||
405 | if (buffer[i] != 0) { | 406 | if (buffer[i] != 0) { |
406 | int cable = buffer[i] >> 4; | 407 | int cable = buffer[i] >> 4; |
407 | int length = snd_usbmidi_cin_length[buffer[i] & 0x0f]; | 408 | int length = snd_usbmidi_cin_length[buffer[i] & 0x0f]; |
408 | snd_usbmidi_input_data(ep, cable, &buffer[i + 1], length); | 409 | snd_usbmidi_input_data(ep, cable, &buffer[i + 1], |
410 | length); | ||
409 | } | 411 | } |
410 | } | 412 | } |
411 | 413 | ||
412 | static void snd_usbmidi_midiman_input(struct snd_usb_midi_in_endpoint* ep, | 414 | static void snd_usbmidi_midiman_input(struct snd_usb_midi_in_endpoint *ep, |
413 | uint8_t* buffer, int buffer_length) | 415 | uint8_t *buffer, int buffer_length) |
414 | { | 416 | { |
415 | int i; | 417 | int i; |
416 | 418 | ||
@@ -427,8 +429,8 @@ static void snd_usbmidi_midiman_input(struct snd_usb_midi_in_endpoint* ep, | |||
427 | * the data bytes but not the status byte and that is marked with CIN 4. | 429 | * the data bytes but not the status byte and that is marked with CIN 4. |
428 | */ | 430 | */ |
429 | static void snd_usbmidi_maudio_broken_running_status_input( | 431 | static void snd_usbmidi_maudio_broken_running_status_input( |
430 | struct snd_usb_midi_in_endpoint* ep, | 432 | struct snd_usb_midi_in_endpoint *ep, |
431 | uint8_t* buffer, int buffer_length) | 433 | uint8_t *buffer, int buffer_length) |
432 | { | 434 | { |
433 | int i; | 435 | int i; |
434 | 436 | ||
@@ -458,7 +460,8 @@ static void snd_usbmidi_maudio_broken_running_status_input( | |||
458 | * doesn't use this format.) | 460 | * doesn't use this format.) |
459 | */ | 461 | */ |
460 | port->running_status_length = 0; | 462 | port->running_status_length = 0; |
461 | snd_usbmidi_input_data(ep, cable, &buffer[i + 1], length); | 463 | snd_usbmidi_input_data(ep, cable, &buffer[i + 1], |
464 | length); | ||
462 | } | 465 | } |
463 | } | 466 | } |
464 | 467 | ||
@@ -479,11 +482,13 @@ static void snd_usbmidi_cme_input(struct snd_usb_midi_in_endpoint *ep, | |||
479 | /* | 482 | /* |
480 | * Adds one USB MIDI packet to the output buffer. | 483 | * Adds one USB MIDI packet to the output buffer. |
481 | */ | 484 | */ |
482 | static void snd_usbmidi_output_standard_packet(struct urb* urb, uint8_t p0, | 485 | static void snd_usbmidi_output_standard_packet(struct urb *urb, uint8_t p0, |
483 | uint8_t p1, uint8_t p2, uint8_t p3) | 486 | uint8_t p1, uint8_t p2, |
487 | uint8_t p3) | ||
484 | { | 488 | { |
485 | 489 | ||
486 | uint8_t* buf = (uint8_t*)urb->transfer_buffer + urb->transfer_buffer_length; | 490 | uint8_t *buf = |
491 | (uint8_t *)urb->transfer_buffer + urb->transfer_buffer_length; | ||
487 | buf[0] = p0; | 492 | buf[0] = p0; |
488 | buf[1] = p1; | 493 | buf[1] = p1; |
489 | buf[2] = p2; | 494 | buf[2] = p2; |
@@ -494,11 +499,13 @@ static void snd_usbmidi_output_standard_packet(struct urb* urb, uint8_t p0, | |||
494 | /* | 499 | /* |
495 | * Adds one Midiman packet to the output buffer. | 500 | * Adds one Midiman packet to the output buffer. |
496 | */ | 501 | */ |
497 | static void snd_usbmidi_output_midiman_packet(struct urb* urb, uint8_t p0, | 502 | static void snd_usbmidi_output_midiman_packet(struct urb *urb, uint8_t p0, |
498 | uint8_t p1, uint8_t p2, uint8_t p3) | 503 | uint8_t p1, uint8_t p2, |
504 | uint8_t p3) | ||
499 | { | 505 | { |
500 | 506 | ||
501 | uint8_t* buf = (uint8_t*)urb->transfer_buffer + urb->transfer_buffer_length; | 507 | uint8_t *buf = |
508 | (uint8_t *)urb->transfer_buffer + urb->transfer_buffer_length; | ||
502 | buf[0] = p1; | 509 | buf[0] = p1; |
503 | buf[1] = p2; | 510 | buf[1] = p2; |
504 | buf[2] = p3; | 511 | buf[2] = p3; |
@@ -509,8 +516,8 @@ static void snd_usbmidi_output_midiman_packet(struct urb* urb, uint8_t p0, | |||
509 | /* | 516 | /* |
510 | * Converts MIDI commands to USB MIDI packets. | 517 | * Converts MIDI commands to USB MIDI packets. |
511 | */ | 518 | */ |
512 | static void snd_usbmidi_transmit_byte(struct usbmidi_out_port* port, | 519 | static void snd_usbmidi_transmit_byte(struct usbmidi_out_port *port, |
513 | uint8_t b, struct urb* urb) | 520 | uint8_t b, struct urb *urb) |
514 | { | 521 | { |
515 | uint8_t p0 = port->cable; | 522 | uint8_t p0 = port->cable; |
516 | void (*output_packet)(struct urb*, uint8_t, uint8_t, uint8_t, uint8_t) = | 523 | void (*output_packet)(struct urb*, uint8_t, uint8_t, uint8_t, uint8_t) = |
@@ -547,10 +554,12 @@ static void snd_usbmidi_transmit_byte(struct usbmidi_out_port* port, | |||
547 | output_packet(urb, p0 | 0x05, 0xf7, 0, 0); | 554 | output_packet(urb, p0 | 0x05, 0xf7, 0, 0); |
548 | break; | 555 | break; |
549 | case STATE_SYSEX_1: | 556 | case STATE_SYSEX_1: |
550 | output_packet(urb, p0 | 0x06, port->data[0], 0xf7, 0); | 557 | output_packet(urb, p0 | 0x06, port->data[0], |
558 | 0xf7, 0); | ||
551 | break; | 559 | break; |
552 | case STATE_SYSEX_2: | 560 | case STATE_SYSEX_2: |
553 | output_packet(urb, p0 | 0x07, port->data[0], port->data[1], 0xf7); | 561 | output_packet(urb, p0 | 0x07, port->data[0], |
562 | port->data[1], 0xf7); | ||
554 | break; | 563 | break; |
555 | } | 564 | } |
556 | port->state = STATE_UNKNOWN; | 565 | port->state = STATE_UNKNOWN; |
@@ -596,21 +605,22 @@ static void snd_usbmidi_transmit_byte(struct usbmidi_out_port* port, | |||
596 | port->state = STATE_SYSEX_2; | 605 | port->state = STATE_SYSEX_2; |
597 | break; | 606 | break; |
598 | case STATE_SYSEX_2: | 607 | case STATE_SYSEX_2: |
599 | output_packet(urb, p0 | 0x04, port->data[0], port->data[1], b); | 608 | output_packet(urb, p0 | 0x04, port->data[0], |
609 | port->data[1], b); | ||
600 | port->state = STATE_SYSEX_0; | 610 | port->state = STATE_SYSEX_0; |
601 | break; | 611 | break; |
602 | } | 612 | } |
603 | } | 613 | } |
604 | } | 614 | } |
605 | 615 | ||
606 | static void snd_usbmidi_standard_output(struct snd_usb_midi_out_endpoint* ep, | 616 | static void snd_usbmidi_standard_output(struct snd_usb_midi_out_endpoint *ep, |
607 | struct urb *urb) | 617 | struct urb *urb) |
608 | { | 618 | { |
609 | int p; | 619 | int p; |
610 | 620 | ||
611 | /* FIXME: lower-numbered ports can starve higher-numbered ports */ | 621 | /* FIXME: lower-numbered ports can starve higher-numbered ports */ |
612 | for (p = 0; p < 0x10; ++p) { | 622 | for (p = 0; p < 0x10; ++p) { |
613 | struct usbmidi_out_port* port = &ep->ports[p]; | 623 | struct usbmidi_out_port *port = &ep->ports[p]; |
614 | if (!port->active) | 624 | if (!port->active) |
615 | continue; | 625 | continue; |
616 | while (urb->transfer_buffer_length + 3 < ep->max_transfer) { | 626 | while (urb->transfer_buffer_length + 3 < ep->max_transfer) { |
@@ -753,18 +763,18 @@ static struct usb_protocol_ops snd_usbmidi_akai_ops = { | |||
753 | * at the third byte. | 763 | * at the third byte. |
754 | */ | 764 | */ |
755 | 765 | ||
756 | static void snd_usbmidi_novation_input(struct snd_usb_midi_in_endpoint* ep, | 766 | static void snd_usbmidi_novation_input(struct snd_usb_midi_in_endpoint *ep, |
757 | uint8_t* buffer, int buffer_length) | 767 | uint8_t *buffer, int buffer_length) |
758 | { | 768 | { |
759 | if (buffer_length < 2 || !buffer[0] || buffer_length < buffer[0] + 1) | 769 | if (buffer_length < 2 || !buffer[0] || buffer_length < buffer[0] + 1) |
760 | return; | 770 | return; |
761 | snd_usbmidi_input_data(ep, 0, &buffer[2], buffer[0] - 1); | 771 | snd_usbmidi_input_data(ep, 0, &buffer[2], buffer[0] - 1); |
762 | } | 772 | } |
763 | 773 | ||
764 | static void snd_usbmidi_novation_output(struct snd_usb_midi_out_endpoint* ep, | 774 | static void snd_usbmidi_novation_output(struct snd_usb_midi_out_endpoint *ep, |
765 | struct urb *urb) | 775 | struct urb *urb) |
766 | { | 776 | { |
767 | uint8_t* transfer_buffer; | 777 | uint8_t *transfer_buffer; |
768 | int count; | 778 | int count; |
769 | 779 | ||
770 | if (!ep->ports[0].active) | 780 | if (!ep->ports[0].active) |
@@ -791,13 +801,13 @@ static struct usb_protocol_ops snd_usbmidi_novation_ops = { | |||
791 | * "raw" protocol: just move raw MIDI bytes from/to the endpoint | 801 | * "raw" protocol: just move raw MIDI bytes from/to the endpoint |
792 | */ | 802 | */ |
793 | 803 | ||
794 | static void snd_usbmidi_raw_input(struct snd_usb_midi_in_endpoint* ep, | 804 | static void snd_usbmidi_raw_input(struct snd_usb_midi_in_endpoint *ep, |
795 | uint8_t* buffer, int buffer_length) | 805 | uint8_t *buffer, int buffer_length) |
796 | { | 806 | { |
797 | snd_usbmidi_input_data(ep, 0, buffer, buffer_length); | 807 | snd_usbmidi_input_data(ep, 0, buffer, buffer_length); |
798 | } | 808 | } |
799 | 809 | ||
800 | static void snd_usbmidi_raw_output(struct snd_usb_midi_out_endpoint* ep, | 810 | static void snd_usbmidi_raw_output(struct snd_usb_midi_out_endpoint *ep, |
801 | struct urb *urb) | 811 | struct urb *urb) |
802 | { | 812 | { |
803 | int count; | 813 | int count; |
@@ -823,8 +833,8 @@ static struct usb_protocol_ops snd_usbmidi_raw_ops = { | |||
823 | * FTDI protocol: raw MIDI bytes, but input packets have two modem status bytes. | 833 | * FTDI protocol: raw MIDI bytes, but input packets have two modem status bytes. |
824 | */ | 834 | */ |
825 | 835 | ||
826 | static void snd_usbmidi_ftdi_input(struct snd_usb_midi_in_endpoint* ep, | 836 | static void snd_usbmidi_ftdi_input(struct snd_usb_midi_in_endpoint *ep, |
827 | uint8_t* buffer, int buffer_length) | 837 | uint8_t *buffer, int buffer_length) |
828 | { | 838 | { |
829 | if (buffer_length > 2) | 839 | if (buffer_length > 2) |
830 | snd_usbmidi_input_data(ep, 0, buffer + 2, buffer_length - 2); | 840 | snd_usbmidi_input_data(ep, 0, buffer + 2, buffer_length - 2); |
@@ -883,7 +893,7 @@ static struct usb_protocol_ops snd_usbmidi_122l_ops = { | |||
883 | * Emagic USB MIDI protocol: raw MIDI with "F5 xx" port switching. | 893 | * Emagic USB MIDI protocol: raw MIDI with "F5 xx" port switching. |
884 | */ | 894 | */ |
885 | 895 | ||
886 | static void snd_usbmidi_emagic_init_out(struct snd_usb_midi_out_endpoint* ep) | 896 | static void snd_usbmidi_emagic_init_out(struct snd_usb_midi_out_endpoint *ep) |
887 | { | 897 | { |
888 | static const u8 init_data[] = { | 898 | static const u8 init_data[] = { |
889 | /* initialization magic: "get version" */ | 899 | /* initialization magic: "get version" */ |
@@ -900,7 +910,7 @@ static void snd_usbmidi_emagic_init_out(struct snd_usb_midi_out_endpoint* ep) | |||
900 | send_bulk_static_data(ep, init_data, sizeof(init_data)); | 910 | send_bulk_static_data(ep, init_data, sizeof(init_data)); |
901 | } | 911 | } |
902 | 912 | ||
903 | static void snd_usbmidi_emagic_finish_out(struct snd_usb_midi_out_endpoint* ep) | 913 | static void snd_usbmidi_emagic_finish_out(struct snd_usb_midi_out_endpoint *ep) |
904 | { | 914 | { |
905 | static const u8 finish_data[] = { | 915 | static const u8 finish_data[] = { |
906 | /* switch to patch mode with last preset */ | 916 | /* switch to patch mode with last preset */ |
@@ -916,8 +926,8 @@ static void snd_usbmidi_emagic_finish_out(struct snd_usb_midi_out_endpoint* ep) | |||
916 | send_bulk_static_data(ep, finish_data, sizeof(finish_data)); | 926 | send_bulk_static_data(ep, finish_data, sizeof(finish_data)); |
917 | } | 927 | } |
918 | 928 | ||
919 | static void snd_usbmidi_emagic_input(struct snd_usb_midi_in_endpoint* ep, | 929 | static void snd_usbmidi_emagic_input(struct snd_usb_midi_in_endpoint *ep, |
920 | uint8_t* buffer, int buffer_length) | 930 | uint8_t *buffer, int buffer_length) |
921 | { | 931 | { |
922 | int i; | 932 | int i; |
923 | 933 | ||
@@ -960,18 +970,18 @@ static void snd_usbmidi_emagic_input(struct snd_usb_midi_in_endpoint* ep, | |||
960 | } | 970 | } |
961 | } | 971 | } |
962 | 972 | ||
963 | static void snd_usbmidi_emagic_output(struct snd_usb_midi_out_endpoint* ep, | 973 | static void snd_usbmidi_emagic_output(struct snd_usb_midi_out_endpoint *ep, |
964 | struct urb *urb) | 974 | struct urb *urb) |
965 | { | 975 | { |
966 | int port0 = ep->current_port; | 976 | int port0 = ep->current_port; |
967 | uint8_t* buf = urb->transfer_buffer; | 977 | uint8_t *buf = urb->transfer_buffer; |
968 | int buf_free = ep->max_transfer; | 978 | int buf_free = ep->max_transfer; |
969 | int length, i; | 979 | int length, i; |
970 | 980 | ||
971 | for (i = 0; i < 0x10; ++i) { | 981 | for (i = 0; i < 0x10; ++i) { |
972 | /* round-robin, starting at the last current port */ | 982 | /* round-robin, starting at the last current port */ |
973 | int portnum = (port0 + i) & 15; | 983 | int portnum = (port0 + i) & 15; |
974 | struct usbmidi_out_port* port = &ep->ports[portnum]; | 984 | struct usbmidi_out_port *port = &ep->ports[portnum]; |
975 | 985 | ||
976 | if (!port->active) | 986 | if (!port->active) |
977 | continue; | 987 | continue; |
@@ -1015,7 +1025,7 @@ static struct usb_protocol_ops snd_usbmidi_emagic_ops = { | |||
1015 | }; | 1025 | }; |
1016 | 1026 | ||
1017 | 1027 | ||
1018 | static void update_roland_altsetting(struct snd_usb_midi* umidi) | 1028 | static void update_roland_altsetting(struct snd_usb_midi *umidi) |
1019 | { | 1029 | { |
1020 | struct usb_interface *intf; | 1030 | struct usb_interface *intf; |
1021 | struct usb_host_interface *hostif; | 1031 | struct usb_host_interface *hostif; |
@@ -1037,7 +1047,7 @@ static void update_roland_altsetting(struct snd_usb_midi* umidi) | |||
1037 | static int substream_open(struct snd_rawmidi_substream *substream, int dir, | 1047 | static int substream_open(struct snd_rawmidi_substream *substream, int dir, |
1038 | int open) | 1048 | int open) |
1039 | { | 1049 | { |
1040 | struct snd_usb_midi* umidi = substream->rmidi->private_data; | 1050 | struct snd_usb_midi *umidi = substream->rmidi->private_data; |
1041 | struct snd_kcontrol *ctl; | 1051 | struct snd_kcontrol *ctl; |
1042 | 1052 | ||
1043 | down_read(&umidi->disc_rwsem); | 1053 | down_read(&umidi->disc_rwsem); |
@@ -1051,7 +1061,8 @@ static int substream_open(struct snd_rawmidi_substream *substream, int dir, | |||
1051 | if (!umidi->opened[0] && !umidi->opened[1]) { | 1061 | if (!umidi->opened[0] && !umidi->opened[1]) { |
1052 | if (umidi->roland_load_ctl) { | 1062 | if (umidi->roland_load_ctl) { |
1053 | ctl = umidi->roland_load_ctl; | 1063 | ctl = umidi->roland_load_ctl; |
1054 | ctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE; | 1064 | ctl->vd[0].access |= |
1065 | SNDRV_CTL_ELEM_ACCESS_INACTIVE; | ||
1055 | snd_ctl_notify(umidi->card, | 1066 | snd_ctl_notify(umidi->card, |
1056 | SNDRV_CTL_EVENT_MASK_INFO, &ctl->id); | 1067 | SNDRV_CTL_EVENT_MASK_INFO, &ctl->id); |
1057 | update_roland_altsetting(umidi); | 1068 | update_roland_altsetting(umidi); |
@@ -1067,7 +1078,8 @@ static int substream_open(struct snd_rawmidi_substream *substream, int dir, | |||
1067 | if (!umidi->opened[0] && !umidi->opened[1]) { | 1078 | if (!umidi->opened[0] && !umidi->opened[1]) { |
1068 | if (umidi->roland_load_ctl) { | 1079 | if (umidi->roland_load_ctl) { |
1069 | ctl = umidi->roland_load_ctl; | 1080 | ctl = umidi->roland_load_ctl; |
1070 | ctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE; | 1081 | ctl->vd[0].access &= |
1082 | ~SNDRV_CTL_ELEM_ACCESS_INACTIVE; | ||
1071 | snd_ctl_notify(umidi->card, | 1083 | snd_ctl_notify(umidi->card, |
1072 | SNDRV_CTL_EVENT_MASK_INFO, &ctl->id); | 1084 | SNDRV_CTL_EVENT_MASK_INFO, &ctl->id); |
1073 | } | 1085 | } |
@@ -1080,8 +1092,8 @@ static int substream_open(struct snd_rawmidi_substream *substream, int dir, | |||
1080 | 1092 | ||
1081 | static int snd_usbmidi_output_open(struct snd_rawmidi_substream *substream) | 1093 | static int snd_usbmidi_output_open(struct snd_rawmidi_substream *substream) |
1082 | { | 1094 | { |
1083 | struct snd_usb_midi* umidi = substream->rmidi->private_data; | 1095 | struct snd_usb_midi *umidi = substream->rmidi->private_data; |
1084 | struct usbmidi_out_port* port = NULL; | 1096 | struct usbmidi_out_port *port = NULL; |
1085 | int i, j; | 1097 | int i, j; |
1086 | 1098 | ||
1087 | for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) | 1099 | for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) |
@@ -1106,9 +1118,11 @@ static int snd_usbmidi_output_close(struct snd_rawmidi_substream *substream) | |||
1106 | return substream_open(substream, 0, 0); | 1118 | return substream_open(substream, 0, 0); |
1107 | } | 1119 | } |
1108 | 1120 | ||
1109 | static void snd_usbmidi_output_trigger(struct snd_rawmidi_substream *substream, int up) | 1121 | static void snd_usbmidi_output_trigger(struct snd_rawmidi_substream *substream, |
1122 | int up) | ||
1110 | { | 1123 | { |
1111 | struct usbmidi_out_port* port = (struct usbmidi_out_port*)substream->runtime->private_data; | 1124 | struct usbmidi_out_port *port = |
1125 | (struct usbmidi_out_port *)substream->runtime->private_data; | ||
1112 | 1126 | ||
1113 | port->active = up; | 1127 | port->active = up; |
1114 | if (up) { | 1128 | if (up) { |
@@ -1125,7 +1139,7 @@ static void snd_usbmidi_output_trigger(struct snd_rawmidi_substream *substream, | |||
1125 | 1139 | ||
1126 | static void snd_usbmidi_output_drain(struct snd_rawmidi_substream *substream) | 1140 | static void snd_usbmidi_output_drain(struct snd_rawmidi_substream *substream) |
1127 | { | 1141 | { |
1128 | struct usbmidi_out_port* port = substream->runtime->private_data; | 1142 | struct usbmidi_out_port *port = substream->runtime->private_data; |
1129 | struct snd_usb_midi_out_endpoint *ep = port->ep; | 1143 | struct snd_usb_midi_out_endpoint *ep = port->ep; |
1130 | unsigned int drain_urbs; | 1144 | unsigned int drain_urbs; |
1131 | DEFINE_WAIT(wait); | 1145 | DEFINE_WAIT(wait); |
@@ -1164,9 +1178,10 @@ static int snd_usbmidi_input_close(struct snd_rawmidi_substream *substream) | |||
1164 | return substream_open(substream, 1, 0); | 1178 | return substream_open(substream, 1, 0); |
1165 | } | 1179 | } |
1166 | 1180 | ||
1167 | static void snd_usbmidi_input_trigger(struct snd_rawmidi_substream *substream, int up) | 1181 | static void snd_usbmidi_input_trigger(struct snd_rawmidi_substream *substream, |
1182 | int up) | ||
1168 | { | 1183 | { |
1169 | struct snd_usb_midi* umidi = substream->rmidi->private_data; | 1184 | struct snd_usb_midi *umidi = substream->rmidi->private_data; |
1170 | 1185 | ||
1171 | if (up) | 1186 | if (up) |
1172 | set_bit(substream->number, &umidi->input_triggered); | 1187 | set_bit(substream->number, &umidi->input_triggered); |
@@ -1199,7 +1214,7 @@ static void free_urb_and_buffer(struct snd_usb_midi *umidi, struct urb *urb, | |||
1199 | * Frees an input endpoint. | 1214 | * Frees an input endpoint. |
1200 | * May be called when ep hasn't been initialized completely. | 1215 | * May be called when ep hasn't been initialized completely. |
1201 | */ | 1216 | */ |
1202 | static void snd_usbmidi_in_endpoint_delete(struct snd_usb_midi_in_endpoint* ep) | 1217 | static void snd_usbmidi_in_endpoint_delete(struct snd_usb_midi_in_endpoint *ep) |
1203 | { | 1218 | { |
1204 | unsigned int i; | 1219 | unsigned int i; |
1205 | 1220 | ||
@@ -1213,12 +1228,12 @@ static void snd_usbmidi_in_endpoint_delete(struct snd_usb_midi_in_endpoint* ep) | |||
1213 | /* | 1228 | /* |
1214 | * Creates an input endpoint. | 1229 | * Creates an input endpoint. |
1215 | */ | 1230 | */ |
1216 | static int snd_usbmidi_in_endpoint_create(struct snd_usb_midi* umidi, | 1231 | static int snd_usbmidi_in_endpoint_create(struct snd_usb_midi *umidi, |
1217 | struct snd_usb_midi_endpoint_info* ep_info, | 1232 | struct snd_usb_midi_endpoint_info *ep_info, |
1218 | struct snd_usb_midi_endpoint* rep) | 1233 | struct snd_usb_midi_endpoint *rep) |
1219 | { | 1234 | { |
1220 | struct snd_usb_midi_in_endpoint* ep; | 1235 | struct snd_usb_midi_in_endpoint *ep; |
1221 | void* buffer; | 1236 | void *buffer; |
1222 | unsigned int pipe; | 1237 | unsigned int pipe; |
1223 | int length; | 1238 | int length; |
1224 | unsigned int i; | 1239 | unsigned int i; |
@@ -1289,14 +1304,14 @@ static void snd_usbmidi_out_endpoint_delete(struct snd_usb_midi_out_endpoint *ep | |||
1289 | /* | 1304 | /* |
1290 | * Creates an output endpoint, and initializes output ports. | 1305 | * Creates an output endpoint, and initializes output ports. |
1291 | */ | 1306 | */ |
1292 | static int snd_usbmidi_out_endpoint_create(struct snd_usb_midi* umidi, | 1307 | static int snd_usbmidi_out_endpoint_create(struct snd_usb_midi *umidi, |
1293 | struct snd_usb_midi_endpoint_info* ep_info, | 1308 | struct snd_usb_midi_endpoint_info *ep_info, |
1294 | struct snd_usb_midi_endpoint* rep) | 1309 | struct snd_usb_midi_endpoint *rep) |
1295 | { | 1310 | { |
1296 | struct snd_usb_midi_out_endpoint* ep; | 1311 | struct snd_usb_midi_out_endpoint *ep; |
1297 | unsigned int i; | 1312 | unsigned int i; |
1298 | unsigned int pipe; | 1313 | unsigned int pipe; |
1299 | void* buffer; | 1314 | void *buffer; |
1300 | 1315 | ||
1301 | rep->out = NULL; | 1316 | rep->out = NULL; |
1302 | ep = kzalloc(sizeof(*ep), GFP_KERNEL); | 1317 | ep = kzalloc(sizeof(*ep), GFP_KERNEL); |
@@ -1381,12 +1396,12 @@ static int snd_usbmidi_out_endpoint_create(struct snd_usb_midi* umidi, | |||
1381 | /* | 1396 | /* |
1382 | * Frees everything. | 1397 | * Frees everything. |
1383 | */ | 1398 | */ |
1384 | static void snd_usbmidi_free(struct snd_usb_midi* umidi) | 1399 | static void snd_usbmidi_free(struct snd_usb_midi *umidi) |
1385 | { | 1400 | { |
1386 | int i; | 1401 | int i; |
1387 | 1402 | ||
1388 | for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) { | 1403 | for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) { |
1389 | struct snd_usb_midi_endpoint* ep = &umidi->endpoints[i]; | 1404 | struct snd_usb_midi_endpoint *ep = &umidi->endpoints[i]; |
1390 | if (ep->out) | 1405 | if (ep->out) |
1391 | snd_usbmidi_out_endpoint_delete(ep->out); | 1406 | snd_usbmidi_out_endpoint_delete(ep->out); |
1392 | if (ep->in) | 1407 | if (ep->in) |
@@ -1399,9 +1414,9 @@ static void snd_usbmidi_free(struct snd_usb_midi* umidi) | |||
1399 | /* | 1414 | /* |
1400 | * Unlinks all URBs (must be done before the usb_device is deleted). | 1415 | * Unlinks all URBs (must be done before the usb_device is deleted). |
1401 | */ | 1416 | */ |
1402 | void snd_usbmidi_disconnect(struct list_head* p) | 1417 | void snd_usbmidi_disconnect(struct list_head *p) |
1403 | { | 1418 | { |
1404 | struct snd_usb_midi* umidi; | 1419 | struct snd_usb_midi *umidi; |
1405 | unsigned int i, j; | 1420 | unsigned int i, j; |
1406 | 1421 | ||
1407 | umidi = list_entry(p, struct snd_usb_midi, list); | 1422 | umidi = list_entry(p, struct snd_usb_midi, list); |
@@ -1417,7 +1432,7 @@ void snd_usbmidi_disconnect(struct list_head* p) | |||
1417 | up_write(&umidi->disc_rwsem); | 1432 | up_write(&umidi->disc_rwsem); |
1418 | 1433 | ||
1419 | for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) { | 1434 | for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) { |
1420 | struct snd_usb_midi_endpoint* ep = &umidi->endpoints[i]; | 1435 | struct snd_usb_midi_endpoint *ep = &umidi->endpoints[i]; |
1421 | if (ep->out) | 1436 | if (ep->out) |
1422 | tasklet_kill(&ep->out->tasklet); | 1437 | tasklet_kill(&ep->out->tasklet); |
1423 | if (ep->out) { | 1438 | if (ep->out) { |
@@ -1448,16 +1463,18 @@ EXPORT_SYMBOL(snd_usbmidi_disconnect); | |||
1448 | 1463 | ||
1449 | static void snd_usbmidi_rawmidi_free(struct snd_rawmidi *rmidi) | 1464 | static void snd_usbmidi_rawmidi_free(struct snd_rawmidi *rmidi) |
1450 | { | 1465 | { |
1451 | struct snd_usb_midi* umidi = rmidi->private_data; | 1466 | struct snd_usb_midi *umidi = rmidi->private_data; |
1452 | snd_usbmidi_free(umidi); | 1467 | snd_usbmidi_free(umidi); |
1453 | } | 1468 | } |
1454 | 1469 | ||
1455 | static struct snd_rawmidi_substream *snd_usbmidi_find_substream(struct snd_usb_midi* umidi, | 1470 | static struct snd_rawmidi_substream *snd_usbmidi_find_substream(struct snd_usb_midi *umidi, |
1456 | int stream, int number) | 1471 | int stream, |
1472 | int number) | ||
1457 | { | 1473 | { |
1458 | struct snd_rawmidi_substream *substream; | 1474 | struct snd_rawmidi_substream *substream; |
1459 | 1475 | ||
1460 | list_for_each_entry(substream, &umidi->rmidi->streams[stream].substreams, list) { | 1476 | list_for_each_entry(substream, &umidi->rmidi->streams[stream].substreams, |
1477 | list) { | ||
1461 | if (substream->number == number) | 1478 | if (substream->number == number) |
1462 | return substream; | 1479 | return substream; |
1463 | } | 1480 | } |
@@ -1633,7 +1650,7 @@ static struct port_info { | |||
1633 | SNDRV_SEQ_PORT_TYPE_SYNTHESIZER), | 1650 | SNDRV_SEQ_PORT_TYPE_SYNTHESIZER), |
1634 | }; | 1651 | }; |
1635 | 1652 | ||
1636 | static struct port_info *find_port_info(struct snd_usb_midi* umidi, int number) | 1653 | static struct port_info *find_port_info(struct snd_usb_midi *umidi, int number) |
1637 | { | 1654 | { |
1638 | int i; | 1655 | int i; |
1639 | 1656 | ||
@@ -1659,16 +1676,18 @@ static void snd_usbmidi_get_port_info(struct snd_rawmidi *rmidi, int number, | |||
1659 | } | 1676 | } |
1660 | } | 1677 | } |
1661 | 1678 | ||
1662 | static void snd_usbmidi_init_substream(struct snd_usb_midi* umidi, | 1679 | static void snd_usbmidi_init_substream(struct snd_usb_midi *umidi, |
1663 | int stream, int number, | 1680 | int stream, int number, |
1664 | struct snd_rawmidi_substream ** rsubstream) | 1681 | struct snd_rawmidi_substream **rsubstream) |
1665 | { | 1682 | { |
1666 | struct port_info *port_info; | 1683 | struct port_info *port_info; |
1667 | const char *name_format; | 1684 | const char *name_format; |
1668 | 1685 | ||
1669 | struct snd_rawmidi_substream *substream = snd_usbmidi_find_substream(umidi, stream, number); | 1686 | struct snd_rawmidi_substream *substream = |
1687 | snd_usbmidi_find_substream(umidi, stream, number); | ||
1670 | if (!substream) { | 1688 | if (!substream) { |
1671 | dev_err(&umidi->dev->dev, "substream %d:%d not found\n", stream, number); | 1689 | dev_err(&umidi->dev->dev, "substream %d:%d not found\n", stream, |
1690 | number); | ||
1672 | return; | 1691 | return; |
1673 | } | 1692 | } |
1674 | 1693 | ||
@@ -1684,21 +1703,23 @@ static void snd_usbmidi_init_substream(struct snd_usb_midi* umidi, | |||
1684 | /* | 1703 | /* |
1685 | * Creates the endpoints and their ports. | 1704 | * Creates the endpoints and their ports. |
1686 | */ | 1705 | */ |
1687 | static int snd_usbmidi_create_endpoints(struct snd_usb_midi* umidi, | 1706 | static int snd_usbmidi_create_endpoints(struct snd_usb_midi *umidi, |
1688 | struct snd_usb_midi_endpoint_info* endpoints) | 1707 | struct snd_usb_midi_endpoint_info *endpoints) |
1689 | { | 1708 | { |
1690 | int i, j, err; | 1709 | int i, j, err; |
1691 | int out_ports = 0, in_ports = 0; | 1710 | int out_ports = 0, in_ports = 0; |
1692 | 1711 | ||
1693 | for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) { | 1712 | for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) { |
1694 | if (endpoints[i].out_cables) { | 1713 | if (endpoints[i].out_cables) { |
1695 | err = snd_usbmidi_out_endpoint_create(umidi, &endpoints[i], | 1714 | err = snd_usbmidi_out_endpoint_create(umidi, |
1715 | &endpoints[i], | ||
1696 | &umidi->endpoints[i]); | 1716 | &umidi->endpoints[i]); |
1697 | if (err < 0) | 1717 | if (err < 0) |
1698 | return err; | 1718 | return err; |
1699 | } | 1719 | } |
1700 | if (endpoints[i].in_cables) { | 1720 | if (endpoints[i].in_cables) { |
1701 | err = snd_usbmidi_in_endpoint_create(umidi, &endpoints[i], | 1721 | err = snd_usbmidi_in_endpoint_create(umidi, |
1722 | &endpoints[i], | ||
1702 | &umidi->endpoints[i]); | 1723 | &umidi->endpoints[i]); |
1703 | if (err < 0) | 1724 | if (err < 0) |
1704 | return err; | 1725 | return err; |
@@ -1706,12 +1727,16 @@ static int snd_usbmidi_create_endpoints(struct snd_usb_midi* umidi, | |||
1706 | 1727 | ||
1707 | for (j = 0; j < 0x10; ++j) { | 1728 | for (j = 0; j < 0x10; ++j) { |
1708 | if (endpoints[i].out_cables & (1 << j)) { | 1729 | if (endpoints[i].out_cables & (1 << j)) { |
1709 | snd_usbmidi_init_substream(umidi, SNDRV_RAWMIDI_STREAM_OUTPUT, out_ports, | 1730 | snd_usbmidi_init_substream(umidi, |
1731 | SNDRV_RAWMIDI_STREAM_OUTPUT, | ||
1732 | out_ports, | ||
1710 | &umidi->endpoints[i].out->ports[j].substream); | 1733 | &umidi->endpoints[i].out->ports[j].substream); |
1711 | ++out_ports; | 1734 | ++out_ports; |
1712 | } | 1735 | } |
1713 | if (endpoints[i].in_cables & (1 << j)) { | 1736 | if (endpoints[i].in_cables & (1 << j)) { |
1714 | snd_usbmidi_init_substream(umidi, SNDRV_RAWMIDI_STREAM_INPUT, in_ports, | 1737 | snd_usbmidi_init_substream(umidi, |
1738 | SNDRV_RAWMIDI_STREAM_INPUT, | ||
1739 | in_ports, | ||
1715 | &umidi->endpoints[i].in->ports[j].substream); | 1740 | &umidi->endpoints[i].in->ports[j].substream); |
1716 | ++in_ports; | 1741 | ++in_ports; |
1717 | } | 1742 | } |
@@ -1725,16 +1750,16 @@ static int snd_usbmidi_create_endpoints(struct snd_usb_midi* umidi, | |||
1725 | /* | 1750 | /* |
1726 | * Returns MIDIStreaming device capabilities. | 1751 | * Returns MIDIStreaming device capabilities. |
1727 | */ | 1752 | */ |
1728 | static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi, | 1753 | static int snd_usbmidi_get_ms_info(struct snd_usb_midi *umidi, |
1729 | struct snd_usb_midi_endpoint_info* endpoints) | 1754 | struct snd_usb_midi_endpoint_info *endpoints) |
1730 | { | 1755 | { |
1731 | struct usb_interface* intf; | 1756 | struct usb_interface *intf; |
1732 | struct usb_host_interface *hostif; | 1757 | struct usb_host_interface *hostif; |
1733 | struct usb_interface_descriptor* intfd; | 1758 | struct usb_interface_descriptor *intfd; |
1734 | struct usb_ms_header_descriptor* ms_header; | 1759 | struct usb_ms_header_descriptor *ms_header; |
1735 | struct usb_host_endpoint *hostep; | 1760 | struct usb_host_endpoint *hostep; |
1736 | struct usb_endpoint_descriptor* ep; | 1761 | struct usb_endpoint_descriptor *ep; |
1737 | struct usb_ms_endpoint_descriptor* ms_ep; | 1762 | struct usb_ms_endpoint_descriptor *ms_ep; |
1738 | int i, epidx; | 1763 | int i, epidx; |
1739 | 1764 | ||
1740 | intf = umidi->iface; | 1765 | intf = umidi->iface; |
@@ -1742,7 +1767,7 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi, | |||
1742 | return -ENXIO; | 1767 | return -ENXIO; |
1743 | hostif = &intf->altsetting[0]; | 1768 | hostif = &intf->altsetting[0]; |
1744 | intfd = get_iface_desc(hostif); | 1769 | intfd = get_iface_desc(hostif); |
1745 | ms_header = (struct usb_ms_header_descriptor*)hostif->extra; | 1770 | ms_header = (struct usb_ms_header_descriptor *)hostif->extra; |
1746 | if (hostif->extralen >= 7 && | 1771 | if (hostif->extralen >= 7 && |
1747 | ms_header->bLength >= 7 && | 1772 | ms_header->bLength >= 7 && |
1748 | ms_header->bDescriptorType == USB_DT_CS_INTERFACE && | 1773 | ms_header->bDescriptorType == USB_DT_CS_INTERFACE && |
@@ -1759,7 +1784,7 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi, | |||
1759 | ep = get_ep_desc(hostep); | 1784 | ep = get_ep_desc(hostep); |
1760 | if (!usb_endpoint_xfer_bulk(ep) && !usb_endpoint_xfer_int(ep)) | 1785 | if (!usb_endpoint_xfer_bulk(ep) && !usb_endpoint_xfer_int(ep)) |
1761 | continue; | 1786 | continue; |
1762 | ms_ep = (struct usb_ms_endpoint_descriptor*)hostep->extra; | 1787 | ms_ep = (struct usb_ms_endpoint_descriptor *)hostep->extra; |
1763 | if (hostep->extralen < 4 || | 1788 | if (hostep->extralen < 4 || |
1764 | ms_ep->bLength < 4 || | 1789 | ms_ep->bLength < 4 || |
1765 | ms_ep->bDescriptorType != USB_DT_CS_ENDPOINT || | 1790 | ms_ep->bDescriptorType != USB_DT_CS_ENDPOINT || |
@@ -1783,9 +1808,10 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi, | |||
1783 | * ESI MIDI Mate that try to use them anyway. | 1808 | * ESI MIDI Mate that try to use them anyway. |
1784 | */ | 1809 | */ |
1785 | endpoints[epidx].out_interval = 1; | 1810 | endpoints[epidx].out_interval = 1; |
1786 | endpoints[epidx].out_cables = (1 << ms_ep->bNumEmbMIDIJack) - 1; | 1811 | endpoints[epidx].out_cables = |
1812 | (1 << ms_ep->bNumEmbMIDIJack) - 1; | ||
1787 | dev_dbg(&umidi->dev->dev, "EP %02X: %d jack(s)\n", | 1813 | dev_dbg(&umidi->dev->dev, "EP %02X: %d jack(s)\n", |
1788 | ep->bEndpointAddress, ms_ep->bNumEmbMIDIJack); | 1814 | ep->bEndpointAddress, ms_ep->bNumEmbMIDIJack); |
1789 | } else { | 1815 | } else { |
1790 | if (endpoints[epidx].in_ep) { | 1816 | if (endpoints[epidx].in_ep) { |
1791 | if (++epidx >= MIDI_MAX_ENDPOINTS) { | 1817 | if (++epidx >= MIDI_MAX_ENDPOINTS) { |
@@ -1799,9 +1825,10 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi, | |||
1799 | endpoints[epidx].in_interval = ep->bInterval; | 1825 | endpoints[epidx].in_interval = ep->bInterval; |
1800 | else if (snd_usb_get_speed(umidi->dev) == USB_SPEED_LOW) | 1826 | else if (snd_usb_get_speed(umidi->dev) == USB_SPEED_LOW) |
1801 | endpoints[epidx].in_interval = 1; | 1827 | endpoints[epidx].in_interval = 1; |
1802 | endpoints[epidx].in_cables = (1 << ms_ep->bNumEmbMIDIJack) - 1; | 1828 | endpoints[epidx].in_cables = |
1829 | (1 << ms_ep->bNumEmbMIDIJack) - 1; | ||
1803 | dev_dbg(&umidi->dev->dev, "EP %02X: %d jack(s)\n", | 1830 | dev_dbg(&umidi->dev->dev, "EP %02X: %d jack(s)\n", |
1804 | ep->bEndpointAddress, ms_ep->bNumEmbMIDIJack); | 1831 | ep->bEndpointAddress, ms_ep->bNumEmbMIDIJack); |
1805 | } | 1832 | } |
1806 | } | 1833 | } |
1807 | return 0; | 1834 | return 0; |
@@ -1825,7 +1852,7 @@ static int roland_load_get(struct snd_kcontrol *kcontrol, | |||
1825 | static int roland_load_put(struct snd_kcontrol *kcontrol, | 1852 | static int roland_load_put(struct snd_kcontrol *kcontrol, |
1826 | struct snd_ctl_elem_value *value) | 1853 | struct snd_ctl_elem_value *value) |
1827 | { | 1854 | { |
1828 | struct snd_usb_midi* umidi = kcontrol->private_data; | 1855 | struct snd_usb_midi *umidi = kcontrol->private_data; |
1829 | int changed; | 1856 | int changed; |
1830 | 1857 | ||
1831 | if (value->value.enumerated.item[0] > 1) | 1858 | if (value->value.enumerated.item[0] > 1) |
@@ -1851,11 +1878,11 @@ static struct snd_kcontrol_new roland_load_ctl = { | |||
1851 | * On Roland devices, use the second alternate setting to be able to use | 1878 | * On Roland devices, use the second alternate setting to be able to use |
1852 | * the interrupt input endpoint. | 1879 | * the interrupt input endpoint. |
1853 | */ | 1880 | */ |
1854 | static void snd_usbmidi_switch_roland_altsetting(struct snd_usb_midi* umidi) | 1881 | static void snd_usbmidi_switch_roland_altsetting(struct snd_usb_midi *umidi) |
1855 | { | 1882 | { |
1856 | struct usb_interface* intf; | 1883 | struct usb_interface *intf; |
1857 | struct usb_host_interface *hostif; | 1884 | struct usb_host_interface *hostif; |
1858 | struct usb_interface_descriptor* intfd; | 1885 | struct usb_interface_descriptor *intfd; |
1859 | 1886 | ||
1860 | intf = umidi->iface; | 1887 | intf = umidi->iface; |
1861 | if (!intf || intf->num_altsetting != 2) | 1888 | if (!intf || intf->num_altsetting != 2) |
@@ -1864,8 +1891,10 @@ static void snd_usbmidi_switch_roland_altsetting(struct snd_usb_midi* umidi) | |||
1864 | hostif = &intf->altsetting[1]; | 1891 | hostif = &intf->altsetting[1]; |
1865 | intfd = get_iface_desc(hostif); | 1892 | intfd = get_iface_desc(hostif); |
1866 | if (intfd->bNumEndpoints != 2 || | 1893 | if (intfd->bNumEndpoints != 2 || |
1867 | (get_endpoint(hostif, 0)->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_BULK || | 1894 | (get_endpoint(hostif, 0)->bmAttributes & |
1868 | (get_endpoint(hostif, 1)->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_INT) | 1895 | USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_BULK || |
1896 | (get_endpoint(hostif, 1)->bmAttributes & | ||
1897 | USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_INT) | ||
1869 | return; | 1898 | return; |
1870 | 1899 | ||
1871 | dev_dbg(&umidi->dev->dev, "switching to altsetting %d with int ep\n", | 1900 | dev_dbg(&umidi->dev->dev, "switching to altsetting %d with int ep\n", |
@@ -1881,14 +1910,14 @@ static void snd_usbmidi_switch_roland_altsetting(struct snd_usb_midi* umidi) | |||
1881 | /* | 1910 | /* |
1882 | * Try to find any usable endpoints in the interface. | 1911 | * Try to find any usable endpoints in the interface. |
1883 | */ | 1912 | */ |
1884 | static int snd_usbmidi_detect_endpoints(struct snd_usb_midi* umidi, | 1913 | static int snd_usbmidi_detect_endpoints(struct snd_usb_midi *umidi, |
1885 | struct snd_usb_midi_endpoint_info* endpoint, | 1914 | struct snd_usb_midi_endpoint_info *endpoint, |
1886 | int max_endpoints) | 1915 | int max_endpoints) |
1887 | { | 1916 | { |
1888 | struct usb_interface* intf; | 1917 | struct usb_interface *intf; |
1889 | struct usb_host_interface *hostif; | 1918 | struct usb_host_interface *hostif; |
1890 | struct usb_interface_descriptor* intfd; | 1919 | struct usb_interface_descriptor *intfd; |
1891 | struct usb_endpoint_descriptor* epd; | 1920 | struct usb_endpoint_descriptor *epd; |
1892 | int i, out_eps = 0, in_eps = 0; | 1921 | int i, out_eps = 0, in_eps = 0; |
1893 | 1922 | ||
1894 | if (USB_ID_VENDOR(umidi->usb_id) == 0x0582) | 1923 | if (USB_ID_VENDOR(umidi->usb_id) == 0x0582) |
@@ -1929,8 +1958,8 @@ static int snd_usbmidi_detect_endpoints(struct snd_usb_midi* umidi, | |||
1929 | /* | 1958 | /* |
1930 | * Detects the endpoints for one-port-per-endpoint protocols. | 1959 | * Detects the endpoints for one-port-per-endpoint protocols. |
1931 | */ | 1960 | */ |
1932 | static int snd_usbmidi_detect_per_port_endpoints(struct snd_usb_midi* umidi, | 1961 | static int snd_usbmidi_detect_per_port_endpoints(struct snd_usb_midi *umidi, |
1933 | struct snd_usb_midi_endpoint_info* endpoints) | 1962 | struct snd_usb_midi_endpoint_info *endpoints) |
1934 | { | 1963 | { |
1935 | int err, i; | 1964 | int err, i; |
1936 | 1965 | ||
@@ -1947,13 +1976,13 @@ static int snd_usbmidi_detect_per_port_endpoints(struct snd_usb_midi* umidi, | |||
1947 | /* | 1976 | /* |
1948 | * Detects the endpoints and ports of Yamaha devices. | 1977 | * Detects the endpoints and ports of Yamaha devices. |
1949 | */ | 1978 | */ |
1950 | static int snd_usbmidi_detect_yamaha(struct snd_usb_midi* umidi, | 1979 | static int snd_usbmidi_detect_yamaha(struct snd_usb_midi *umidi, |
1951 | struct snd_usb_midi_endpoint_info* endpoint) | 1980 | struct snd_usb_midi_endpoint_info *endpoint) |
1952 | { | 1981 | { |
1953 | struct usb_interface* intf; | 1982 | struct usb_interface *intf; |
1954 | struct usb_host_interface *hostif; | 1983 | struct usb_host_interface *hostif; |
1955 | struct usb_interface_descriptor* intfd; | 1984 | struct usb_interface_descriptor *intfd; |
1956 | uint8_t* cs_desc; | 1985 | uint8_t *cs_desc; |
1957 | 1986 | ||
1958 | intf = umidi->iface; | 1987 | intf = umidi->iface; |
1959 | if (!intf) | 1988 | if (!intf) |
@@ -1972,9 +2001,11 @@ static int snd_usbmidi_detect_yamaha(struct snd_usb_midi* umidi, | |||
1972 | cs_desc += cs_desc[0]) { | 2001 | cs_desc += cs_desc[0]) { |
1973 | if (cs_desc[1] == USB_DT_CS_INTERFACE) { | 2002 | if (cs_desc[1] == USB_DT_CS_INTERFACE) { |
1974 | if (cs_desc[2] == UAC_MIDI_IN_JACK) | 2003 | if (cs_desc[2] == UAC_MIDI_IN_JACK) |
1975 | endpoint->in_cables = (endpoint->in_cables << 1) | 1; | 2004 | endpoint->in_cables = |
2005 | (endpoint->in_cables << 1) | 1; | ||
1976 | else if (cs_desc[2] == UAC_MIDI_OUT_JACK) | 2006 | else if (cs_desc[2] == UAC_MIDI_OUT_JACK) |
1977 | endpoint->out_cables = (endpoint->out_cables << 1) | 1; | 2007 | endpoint->out_cables = |
2008 | (endpoint->out_cables << 1) | 1; | ||
1978 | } | 2009 | } |
1979 | } | 2010 | } |
1980 | if (!endpoint->in_cables && !endpoint->out_cables) | 2011 | if (!endpoint->in_cables && !endpoint->out_cables) |
@@ -1986,12 +2017,12 @@ static int snd_usbmidi_detect_yamaha(struct snd_usb_midi* umidi, | |||
1986 | /* | 2017 | /* |
1987 | * Detects the endpoints and ports of Roland devices. | 2018 | * Detects the endpoints and ports of Roland devices. |
1988 | */ | 2019 | */ |
1989 | static int snd_usbmidi_detect_roland(struct snd_usb_midi* umidi, | 2020 | static int snd_usbmidi_detect_roland(struct snd_usb_midi *umidi, |
1990 | struct snd_usb_midi_endpoint_info* endpoint) | 2021 | struct snd_usb_midi_endpoint_info *endpoint) |
1991 | { | 2022 | { |
1992 | struct usb_interface* intf; | 2023 | struct usb_interface *intf; |
1993 | struct usb_host_interface *hostif; | 2024 | struct usb_host_interface *hostif; |
1994 | u8* cs_desc; | 2025 | u8 *cs_desc; |
1995 | 2026 | ||
1996 | intf = umidi->iface; | 2027 | intf = umidi->iface; |
1997 | if (!intf) | 2028 | if (!intf) |
@@ -2024,14 +2055,14 @@ static int snd_usbmidi_detect_roland(struct snd_usb_midi* umidi, | |||
2024 | /* | 2055 | /* |
2025 | * Creates the endpoints and their ports for Midiman devices. | 2056 | * Creates the endpoints and their ports for Midiman devices. |
2026 | */ | 2057 | */ |
2027 | static int snd_usbmidi_create_endpoints_midiman(struct snd_usb_midi* umidi, | 2058 | static int snd_usbmidi_create_endpoints_midiman(struct snd_usb_midi *umidi, |
2028 | struct snd_usb_midi_endpoint_info* endpoint) | 2059 | struct snd_usb_midi_endpoint_info *endpoint) |
2029 | { | 2060 | { |
2030 | struct snd_usb_midi_endpoint_info ep_info; | 2061 | struct snd_usb_midi_endpoint_info ep_info; |
2031 | struct usb_interface* intf; | 2062 | struct usb_interface *intf; |
2032 | struct usb_host_interface *hostif; | 2063 | struct usb_host_interface *hostif; |
2033 | struct usb_interface_descriptor* intfd; | 2064 | struct usb_interface_descriptor *intfd; |
2034 | struct usb_endpoint_descriptor* epd; | 2065 | struct usb_endpoint_descriptor *epd; |
2035 | int cable, err; | 2066 | int cable, err; |
2036 | 2067 | ||
2037 | intf = umidi->iface; | 2068 | intf = umidi->iface; |
@@ -2068,39 +2099,50 @@ static int snd_usbmidi_create_endpoints_midiman(struct snd_usb_midi* umidi, | |||
2068 | epd = get_endpoint(hostif, 4); | 2099 | epd = get_endpoint(hostif, 4); |
2069 | if (!usb_endpoint_dir_out(epd) || | 2100 | if (!usb_endpoint_dir_out(epd) || |
2070 | !usb_endpoint_xfer_bulk(epd)) { | 2101 | !usb_endpoint_xfer_bulk(epd)) { |
2071 | dev_dbg(&umidi->dev->dev, "endpoint[4] isn't bulk output\n"); | 2102 | dev_dbg(&umidi->dev->dev, |
2103 | "endpoint[4] isn't bulk output\n"); | ||
2072 | return -ENXIO; | 2104 | return -ENXIO; |
2073 | } | 2105 | } |
2074 | } | 2106 | } |
2075 | 2107 | ||
2076 | ep_info.out_ep = get_endpoint(hostif, 2)->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; | 2108 | ep_info.out_ep = get_endpoint(hostif, 2)->bEndpointAddress & |
2109 | USB_ENDPOINT_NUMBER_MASK; | ||
2077 | ep_info.out_interval = 0; | 2110 | ep_info.out_interval = 0; |
2078 | ep_info.out_cables = endpoint->out_cables & 0x5555; | 2111 | ep_info.out_cables = endpoint->out_cables & 0x5555; |
2079 | err = snd_usbmidi_out_endpoint_create(umidi, &ep_info, &umidi->endpoints[0]); | 2112 | err = snd_usbmidi_out_endpoint_create(umidi, &ep_info, |
2113 | &umidi->endpoints[0]); | ||
2080 | if (err < 0) | 2114 | if (err < 0) |
2081 | return err; | 2115 | return err; |
2082 | 2116 | ||
2083 | ep_info.in_ep = get_endpoint(hostif, 0)->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; | 2117 | ep_info.in_ep = get_endpoint(hostif, 0)->bEndpointAddress & |
2118 | USB_ENDPOINT_NUMBER_MASK; | ||
2084 | ep_info.in_interval = get_endpoint(hostif, 0)->bInterval; | 2119 | ep_info.in_interval = get_endpoint(hostif, 0)->bInterval; |
2085 | ep_info.in_cables = endpoint->in_cables; | 2120 | ep_info.in_cables = endpoint->in_cables; |
2086 | err = snd_usbmidi_in_endpoint_create(umidi, &ep_info, &umidi->endpoints[0]); | 2121 | err = snd_usbmidi_in_endpoint_create(umidi, &ep_info, |
2122 | &umidi->endpoints[0]); | ||
2087 | if (err < 0) | 2123 | if (err < 0) |
2088 | return err; | 2124 | return err; |
2089 | 2125 | ||
2090 | if (endpoint->out_cables > 0x0001) { | 2126 | if (endpoint->out_cables > 0x0001) { |
2091 | ep_info.out_ep = get_endpoint(hostif, 4)->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; | 2127 | ep_info.out_ep = get_endpoint(hostif, 4)->bEndpointAddress & |
2128 | USB_ENDPOINT_NUMBER_MASK; | ||
2092 | ep_info.out_cables = endpoint->out_cables & 0xaaaa; | 2129 | ep_info.out_cables = endpoint->out_cables & 0xaaaa; |
2093 | err = snd_usbmidi_out_endpoint_create(umidi, &ep_info, &umidi->endpoints[1]); | 2130 | err = snd_usbmidi_out_endpoint_create(umidi, &ep_info, |
2131 | &umidi->endpoints[1]); | ||
2094 | if (err < 0) | 2132 | if (err < 0) |
2095 | return err; | 2133 | return err; |
2096 | } | 2134 | } |
2097 | 2135 | ||
2098 | for (cable = 0; cable < 0x10; ++cable) { | 2136 | for (cable = 0; cable < 0x10; ++cable) { |
2099 | if (endpoint->out_cables & (1 << cable)) | 2137 | if (endpoint->out_cables & (1 << cable)) |
2100 | snd_usbmidi_init_substream(umidi, SNDRV_RAWMIDI_STREAM_OUTPUT, cable, | 2138 | snd_usbmidi_init_substream(umidi, |
2139 | SNDRV_RAWMIDI_STREAM_OUTPUT, | ||
2140 | cable, | ||
2101 | &umidi->endpoints[cable & 1].out->ports[cable].substream); | 2141 | &umidi->endpoints[cable & 1].out->ports[cable].substream); |
2102 | if (endpoint->in_cables & (1 << cable)) | 2142 | if (endpoint->in_cables & (1 << cable)) |
2103 | snd_usbmidi_init_substream(umidi, SNDRV_RAWMIDI_STREAM_INPUT, cable, | 2143 | snd_usbmidi_init_substream(umidi, |
2144 | SNDRV_RAWMIDI_STREAM_INPUT, | ||
2145 | cable, | ||
2104 | &umidi->endpoints[0].in->ports[cable].substream); | 2146 | &umidi->endpoints[0].in->ports[cable].substream); |
2105 | } | 2147 | } |
2106 | return 0; | 2148 | return 0; |
@@ -2110,7 +2152,7 @@ static struct snd_rawmidi_global_ops snd_usbmidi_ops = { | |||
2110 | .get_port_info = snd_usbmidi_get_port_info, | 2152 | .get_port_info = snd_usbmidi_get_port_info, |
2111 | }; | 2153 | }; |
2112 | 2154 | ||
2113 | static int snd_usbmidi_create_rawmidi(struct snd_usb_midi* umidi, | 2155 | static int snd_usbmidi_create_rawmidi(struct snd_usb_midi *umidi, |
2114 | int out_ports, int in_ports) | 2156 | int out_ports, int in_ports) |
2115 | { | 2157 | { |
2116 | struct snd_rawmidi *rmidi; | 2158 | struct snd_rawmidi *rmidi; |
@@ -2128,8 +2170,10 @@ static int snd_usbmidi_create_rawmidi(struct snd_usb_midi* umidi, | |||
2128 | rmidi->ops = &snd_usbmidi_ops; | 2170 | rmidi->ops = &snd_usbmidi_ops; |
2129 | rmidi->private_data = umidi; | 2171 | rmidi->private_data = umidi; |
2130 | rmidi->private_free = snd_usbmidi_rawmidi_free; | 2172 | rmidi->private_free = snd_usbmidi_rawmidi_free; |
2131 | snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &snd_usbmidi_output_ops); | 2173 | snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, |
2132 | snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &snd_usbmidi_input_ops); | 2174 | &snd_usbmidi_output_ops); |
2175 | snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, | ||
2176 | &snd_usbmidi_input_ops); | ||
2133 | 2177 | ||
2134 | umidi->rmidi = rmidi; | 2178 | umidi->rmidi = rmidi; |
2135 | return 0; | 2179 | return 0; |
@@ -2138,16 +2182,16 @@ static int snd_usbmidi_create_rawmidi(struct snd_usb_midi* umidi, | |||
2138 | /* | 2182 | /* |
2139 | * Temporarily stop input. | 2183 | * Temporarily stop input. |
2140 | */ | 2184 | */ |
2141 | void snd_usbmidi_input_stop(struct list_head* p) | 2185 | void snd_usbmidi_input_stop(struct list_head *p) |
2142 | { | 2186 | { |
2143 | struct snd_usb_midi* umidi; | 2187 | struct snd_usb_midi *umidi; |
2144 | unsigned int i, j; | 2188 | unsigned int i, j; |
2145 | 2189 | ||
2146 | umidi = list_entry(p, struct snd_usb_midi, list); | 2190 | umidi = list_entry(p, struct snd_usb_midi, list); |
2147 | if (!umidi->input_running) | 2191 | if (!umidi->input_running) |
2148 | return; | 2192 | return; |
2149 | for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) { | 2193 | for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) { |
2150 | struct snd_usb_midi_endpoint* ep = &umidi->endpoints[i]; | 2194 | struct snd_usb_midi_endpoint *ep = &umidi->endpoints[i]; |
2151 | if (ep->in) | 2195 | if (ep->in) |
2152 | for (j = 0; j < INPUT_URBS; ++j) | 2196 | for (j = 0; j < INPUT_URBS; ++j) |
2153 | usb_kill_urb(ep->in->urbs[j]); | 2197 | usb_kill_urb(ep->in->urbs[j]); |
@@ -2156,14 +2200,14 @@ void snd_usbmidi_input_stop(struct list_head* p) | |||
2156 | } | 2200 | } |
2157 | EXPORT_SYMBOL(snd_usbmidi_input_stop); | 2201 | EXPORT_SYMBOL(snd_usbmidi_input_stop); |
2158 | 2202 | ||
2159 | static void snd_usbmidi_input_start_ep(struct snd_usb_midi_in_endpoint* ep) | 2203 | static void snd_usbmidi_input_start_ep(struct snd_usb_midi_in_endpoint *ep) |
2160 | { | 2204 | { |
2161 | unsigned int i; | 2205 | unsigned int i; |
2162 | 2206 | ||
2163 | if (!ep) | 2207 | if (!ep) |
2164 | return; | 2208 | return; |
2165 | for (i = 0; i < INPUT_URBS; ++i) { | 2209 | for (i = 0; i < INPUT_URBS; ++i) { |
2166 | struct urb* urb = ep->urbs[i]; | 2210 | struct urb *urb = ep->urbs[i]; |
2167 | urb->dev = ep->umidi->dev; | 2211 | urb->dev = ep->umidi->dev; |
2168 | snd_usbmidi_submit_urb(urb, GFP_KERNEL); | 2212 | snd_usbmidi_submit_urb(urb, GFP_KERNEL); |
2169 | } | 2213 | } |
@@ -2172,9 +2216,9 @@ static void snd_usbmidi_input_start_ep(struct snd_usb_midi_in_endpoint* ep) | |||
2172 | /* | 2216 | /* |
2173 | * Resume input after a call to snd_usbmidi_input_stop(). | 2217 | * Resume input after a call to snd_usbmidi_input_stop(). |
2174 | */ | 2218 | */ |
2175 | void snd_usbmidi_input_start(struct list_head* p) | 2219 | void snd_usbmidi_input_start(struct list_head *p) |
2176 | { | 2220 | { |
2177 | struct snd_usb_midi* umidi; | 2221 | struct snd_usb_midi *umidi; |
2178 | int i; | 2222 | int i; |
2179 | 2223 | ||
2180 | umidi = list_entry(p, struct snd_usb_midi, list); | 2224 | umidi = list_entry(p, struct snd_usb_midi, list); |
@@ -2218,11 +2262,11 @@ EXPORT_SYMBOL(snd_usbmidi_resume); | |||
2218 | * Creates and registers everything needed for a MIDI streaming interface. | 2262 | * Creates and registers everything needed for a MIDI streaming interface. |
2219 | */ | 2263 | */ |
2220 | int snd_usbmidi_create(struct snd_card *card, | 2264 | int snd_usbmidi_create(struct snd_card *card, |
2221 | struct usb_interface* iface, | 2265 | struct usb_interface *iface, |
2222 | struct list_head *midi_list, | 2266 | struct list_head *midi_list, |
2223 | const struct snd_usb_audio_quirk* quirk) | 2267 | const struct snd_usb_audio_quirk *quirk) |
2224 | { | 2268 | { |
2225 | struct snd_usb_midi* umidi; | 2269 | struct snd_usb_midi *umidi; |
2226 | struct snd_usb_midi_endpoint_info endpoints[MIDI_MAX_ENDPOINTS]; | 2270 | struct snd_usb_midi_endpoint_info endpoints[MIDI_MAX_ENDPOINTS]; |
2227 | int out_ports, in_ports; | 2271 | int out_ports, in_ports; |
2228 | int i, err; | 2272 | int i, err; |
@@ -2320,7 +2364,8 @@ int snd_usbmidi_create(struct snd_card *card, | |||
2320 | err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); | 2364 | err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); |
2321 | break; | 2365 | break; |
2322 | default: | 2366 | default: |
2323 | dev_err(&umidi->dev->dev, "invalid quirk type %d\n", quirk->type); | 2367 | dev_err(&umidi->dev->dev, "invalid quirk type %d\n", |
2368 | quirk->type); | ||
2324 | err = -ENXIO; | 2369 | err = -ENXIO; |
2325 | break; | 2370 | break; |
2326 | } | 2371 | } |