Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Staging: line6: another upstream sync

Everything should be in sync now.

Signed-off-by: Markus Grabner <grabner@icg.tugraz.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Markus Grabner and committed by
Greg Kroah-Hartman
e1a164d7 1027f476

+865 -596
+2 -5
drivers/staging/line6/audio.c
··· 1 1 /* 2 - * Line6 Linux USB driver - 0.9.0 2 + * Line6 Linux USB driver - 0.9.1beta 3 3 * 4 4 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at) 5 5 * ··· 15 15 #include "driver.h" 16 16 #include "audio.h" 17 17 18 - 19 18 static int line6_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 20 19 static char *line6_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 21 - 22 20 23 21 /* 24 22 Initialize the Line6 USB audio system. ··· 37 39 strcpy(card->id, line6->properties->id); 38 40 strcpy(card->driver, DRIVER_NAME); 39 41 strcpy(card->shortname, line6->properties->name); 40 - sprintf(card->longname, "Line6 %s at USB %s", line6->properties->name, 41 - dev_name(line6->ifcdev)); /* 80 chars - see asound.h */ 42 + sprintf(card->longname, "Line6 %s at USB %s", line6->properties->name, dev_name(line6->ifcdev)); /* 80 chars - see asound.h */ 42 43 return 0; 43 44 } 44 45
+1 -4
drivers/staging/line6/audio.h
··· 1 1 /* 2 - * Line6 Linux USB driver - 0.9.0 2 + * Line6 Linux USB driver - 0.9.1beta 3 3 * 4 4 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at) 5 5 * ··· 12 12 #ifndef AUDIO_H 13 13 #define AUDIO_H 14 14 15 - 16 15 #include "driver.h" 17 - 18 16 19 17 extern void line6_cleanup_audio(struct usb_line6 *); 20 18 extern int line6_init_audio(struct usb_line6 *); 21 19 extern int line6_register_audio(struct usb_line6 *); 22 - 23 20 24 21 #endif
+27 -22
drivers/staging/line6/capture.c
··· 1 1 /* 2 - * Line6 Linux USB driver - 0.9.0 2 + * Line6 Linux USB driver - 0.9.1beta 3 3 * 4 4 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at) 5 5 * ··· 19 19 #include "pcm.h" 20 20 #include "pod.h" 21 21 22 - 23 22 /* 24 23 Find a free URB and submit it. 25 24 */ ··· 27 28 int index; 28 29 unsigned long flags; 29 30 int i, urb_size; 31 + int ret; 30 32 struct urb *urb_in; 31 33 32 34 spin_lock_irqsave(&line6pcm->lock_audio_in, flags); ··· 57 57 urb_in->transfer_buffer_length = urb_size; 58 58 urb_in->context = line6pcm; 59 59 60 - if (usb_submit_urb(urb_in, GFP_ATOMIC) == 0) 60 + ret = usb_submit_urb(urb_in, GFP_ATOMIC); 61 + 62 + if (ret == 0) 61 63 set_bit(index, &line6pcm->active_urb_in); 62 64 else 63 65 dev_err(line6pcm->line6->ifcdev, 64 - "URB in #%d submission failed\n", index); 66 + "URB in #%d submission failed (%d)\n", index, ret); 65 67 66 68 spin_unlock_irqrestore(&line6pcm->lock_audio_in, flags); 67 69 return 0; ··· 149 147 150 148 if (line6pcm->pos_in_done + frames > runtime->buffer_size) { 151 149 /* 152 - The transferred area goes over buffer boundary, 153 - copy two separate chunks. 154 - */ 150 + The transferred area goes over buffer boundary, 151 + copy two separate chunks. 152 + */ 155 153 int len; 156 154 len = runtime->buffer_size - line6pcm->pos_in_done; 157 155 ··· 218 216 int fsize; 219 217 struct usb_iso_packet_descriptor *fin = &urb->iso_frame_desc[i]; 220 218 221 - if (fin->status == -18) { 219 + if (fin->status == -EXDEV) { 222 220 shutdown = 1; 223 221 break; 224 222 } ··· 260 258 if (!shutdown) { 261 259 submit_audio_in_urb(line6pcm); 262 260 263 - if (test_bit(BIT_PCM_ALSA_CAPTURE, &line6pcm->flags)) 264 - line6_capture_check_period(line6pcm, length); 261 + #ifdef CONFIG_LINE6_USB_IMPULSE_RESPONSE 262 + if (!(line6pcm->flags & MASK_PCM_IMPULSE)) 263 + #endif 264 + if (test_bit(BIT_PCM_ALSA_CAPTURE, &line6pcm->flags)) 265 + line6_capture_check_period(line6pcm, length); 265 266 } 266 267 } 267 268 ··· 277 272 278 273 err = snd_pcm_hw_constraint_ratdens(runtime, 0, 279 274 SNDRV_PCM_HW_PARAM_RATE, 280 - (&line6pcm->properties-> 281 - snd_line6_rates)); 275 + (&line6pcm-> 276 + properties->snd_line6_rates)); 282 277 if (err < 0) 283 278 return err; 284 279 ··· 371 366 372 367 /* capture operators */ 373 368 struct snd_pcm_ops snd_line6_capture_ops = { 374 - .open = snd_line6_capture_open, 375 - .close = snd_line6_capture_close, 376 - .ioctl = snd_pcm_lib_ioctl, 377 - .hw_params = snd_line6_capture_hw_params, 378 - .hw_free = snd_line6_capture_hw_free, 379 - .prepare = snd_line6_prepare, 380 - .trigger = snd_line6_trigger, 381 - .pointer = snd_line6_capture_pointer, 369 + .open = snd_line6_capture_open, 370 + .close = snd_line6_capture_close, 371 + .ioctl = snd_pcm_lib_ioctl, 372 + .hw_params = snd_line6_capture_hw_params, 373 + .hw_free = snd_line6_capture_hw_free, 374 + .prepare = snd_line6_prepare, 375 + .trigger = snd_line6_trigger, 376 + .pointer = snd_line6_capture_pointer, 382 377 }; 383 378 384 379 int line6_create_audio_in_urbs(struct snd_line6_pcm *line6pcm) ··· 401 396 urb->dev = line6pcm->line6->usbdev; 402 397 urb->pipe = 403 398 usb_rcvisocpipe(line6pcm->line6->usbdev, 404 - line6pcm-> 405 - ep_audio_read & USB_ENDPOINT_NUMBER_MASK); 399 + line6pcm->ep_audio_read & 400 + USB_ENDPOINT_NUMBER_MASK); 406 401 urb->transfer_flags = URB_ISO_ASAP; 407 402 urb->start_frame = -1; 408 403 urb->number_of_packets = LINE6_ISO_PACKETS;
+3 -3
drivers/staging/line6/capture.h
··· 1 1 /* 2 - * Line6 Linux USB driver - 0.9.0 2 + * Line6 Linux USB driver - 0.9.1beta 3 3 * 4 4 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at) 5 5 * ··· 12 12 #ifndef CAPTURE_H 13 13 #define CAPTURE_H 14 14 15 - 16 15 #include <sound/pcm.h> 17 16 18 17 #include "driver.h" 19 18 #include "pcm.h" 20 19 21 - 22 20 extern struct snd_pcm_ops snd_line6_capture_ops; 23 21 24 22 extern void line6_capture_copy(struct snd_line6_pcm *line6pcm, char *fbuf, 25 23 int fsize); 24 + extern void line6_capture_check_period(struct snd_line6_pcm *line6pcm, 25 + int length); 26 26 extern int line6_create_audio_in_urbs(struct snd_line6_pcm *line6pcm); 27 27 extern int line6_submit_audio_in_all_urbs(struct snd_line6_pcm *line6pcm); 28 28 extern void line6_unlink_audio_in_urbs(struct snd_line6_pcm *line6pcm);
+1 -1
drivers/staging/line6/control.c
··· 1 1 /* 2 - * Line6 Linux USB driver - 0.9.0 2 + * Line6 Linux USB driver - 0.9.1beta 3 3 * 4 4 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at) 5 5 *
+8 -4
drivers/staging/line6/control.h
··· 1 1 /* 2 - * Line6 Linux USB driver - 0.9.0 2 + * Line6 Linux USB driver - 0.9.1beta 3 3 * 4 4 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at) 5 5 * ··· 22 22 from "control.h", and this process depends on the exact formatting of the 23 23 code and the comments below! 24 24 */ 25 + 25 26 /* *INDENT-OFF* */ 27 + 26 28 enum { 27 29 POD_tweak = 1, 28 30 POD_wah_position = 4, ··· 183 181 VARIAXMIDI_tone = 79, 184 182 }; 185 183 184 + /* *INDENT-ON* */ 186 185 187 186 extern int line6_pod_create_files(int firmware, int type, struct device *dev); 188 187 extern void line6_pod_remove_files(int firmware, int type, struct device *dev); 189 - extern int line6_variax_create_files(int firmware, int type, struct device *dev); 190 - extern void line6_variax_remove_files(int firmware, int type, struct device *dev); 191 - 188 + extern int line6_variax_create_files(int firmware, int type, 189 + struct device *dev); 190 + extern void line6_variax_remove_files(int firmware, int type, 191 + struct device *dev); 192 192 193 193 #endif
+136 -81
drivers/staging/line6/driver.c
··· 1 1 /* 2 - * Line6 Linux USB driver - 0.9.0 2 + * Line6 Linux USB driver - 0.9.1beta 3 3 * 4 4 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at) 5 5 * ··· 26 26 #include "usbdefs.h" 27 27 #include "variax.h" 28 28 29 - 30 29 #define DRIVER_AUTHOR "Markus Grabner <grabner@icg.tugraz.at>" 31 30 #define DRIVER_DESC "Line6 USB Driver" 32 - #define DRIVER_VERSION "0.9.0" 33 - 31 + #define DRIVER_VERSION "0.9.1beta" DRIVER_REVISION 34 32 35 33 /* table of devices that work with this driver */ 36 34 static const struct usb_device_id line6_id_table[] = { 37 - { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_BASSPODXT) }, 38 - { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_BASSPODXTLIVE) }, 39 - { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_BASSPODXTPRO) }, 40 - { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_GUITARPORT) }, 41 - { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_POCKETPOD) }, 42 - { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODSTUDIO_GX) }, 43 - { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODSTUDIO_UX1) }, 44 - { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODSTUDIO_UX2) }, 45 - { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODX3) }, 46 - { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODX3LIVE) }, 47 - { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODXT) }, 48 - { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODXTLIVE) }, 49 - { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODXTPRO) }, 50 - { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_TONEPORT_GX) }, 51 - { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_TONEPORT_UX1) }, 52 - { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_TONEPORT_UX2) }, 53 - { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_VARIAX) }, 54 - { }, 35 + {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_BASSPODXT)}, 36 + {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_BASSPODXTLIVE)}, 37 + {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_BASSPODXTPRO)}, 38 + {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_GUITARPORT)}, 39 + {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_POCKETPOD)}, 40 + {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODSTUDIO_GX)}, 41 + {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODSTUDIO_UX1)}, 42 + {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODSTUDIO_UX2)}, 43 + {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODX3)}, 44 + {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODX3LIVE)}, 45 + {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODXT)}, 46 + {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODXTLIVE)}, 47 + {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODXTPRO)}, 48 + {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_TONEPORT_GX)}, 49 + {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_TONEPORT_UX1)}, 50 + {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_TONEPORT_UX2)}, 51 + {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_VARIAX)}, 52 + {}, 55 53 }; 54 + 56 55 MODULE_DEVICE_TABLE(usb, line6_id_table); 57 56 57 + /* *INDENT-OFF* */ 58 58 static struct line6_properties line6_properties_table[] = { 59 59 { "BassPODxt", "BassPODxt", LINE6_BIT_BASSPODXT, LINE6_BIT_CONTROL_PCM_HWMON }, 60 60 { "BassPODxtLive", "BassPODxt Live", LINE6_BIT_BASSPODXTLIVE, LINE6_BIT_CONTROL_PCM_HWMON }, ··· 74 74 { "TonePortUX2", "TonePort UX2", LINE6_BIT_TONEPORT_UX2, LINE6_BIT_PCM }, 75 75 { "Variax", "Variax Workbench", LINE6_BIT_VARIAX, LINE6_BIT_CONTROL } 76 76 }; 77 - 77 + /* *INDENT-ON* */ 78 78 79 79 /* 80 80 This is Line6's MIDI manufacturer ID. ··· 96 96 */ 97 97 static const char *line6_request_version; 98 98 99 - 100 99 struct usb_line6 *line6_devices[LINE6_MAX_DEVICES]; 101 - 102 100 103 101 /** 104 102 Class for asynchronous messages. ··· 108 110 int done; 109 111 }; 110 112 111 - 112 113 /* 113 114 Forward declarations. 114 115 */ 115 116 static void line6_data_received(struct urb *urb); 116 117 static int line6_send_raw_message_async_part(struct message *msg, 117 118 struct urb *urb); 118 - 119 119 120 120 /* 121 121 Start to listen on endpoint. ··· 126 130 line6->buffer_listen, LINE6_BUFSIZE_LISTEN, 127 131 line6_data_received, line6, line6->interval); 128 132 line6->urb_listen->actual_length = 0; 129 - err = usb_submit_urb(line6->urb_listen, GFP_KERNEL); 133 + err = usb_submit_urb(line6->urb_listen, GFP_ATOMIC); 130 134 return err; 131 135 } 132 136 ··· 162 166 if (j < n) { 163 167 unsigned char val = buffer[i + j]; 164 168 bytes = snprintf(p, hexdumpsize, " %02X", val); 165 - asc[j] = ((val >= 0x20) && (val < 0x7f)) ? val : '.'; 169 + asc[j] = ((val >= 0x20) 170 + && (val < 0x7f)) ? val : '.'; 166 171 } else 167 172 bytes = snprintf(p, hexdumpsize, " "); 168 173 169 174 if (bytes > hexdumpsize) 170 - break; /* buffer overflow */ 175 + break; /* buffer overflow */ 171 176 172 177 p += bytes; 173 178 hexdumpsize -= bytes; ··· 283 286 Setup and start timer. 284 287 */ 285 288 void line6_start_timer(struct timer_list *timer, unsigned int msecs, 286 - void (*function)(unsigned long), unsigned long data) 289 + void (*function) (unsigned long), unsigned long data) 287 290 { 288 291 setup_timer(timer, function, data); 289 292 timer->expires = jiffies + msecs * HZ / 1000; ··· 331 334 */ 332 335 int line6_version_request_async(struct usb_line6 *line6) 333 336 { 334 - return line6_send_raw_message_async(line6, line6_request_version, sizeof(line6_request_version0)); 337 + return line6_send_raw_message_async(line6, line6_request_version, 338 + sizeof(line6_request_version0)); 335 339 } 336 340 337 341 /* ··· 341 343 int line6_send_sysex_message(struct usb_line6 *line6, const char *buffer, 342 344 int size) 343 345 { 344 - return line6_send_raw_message(line6, buffer, size + SYSEX_EXTRA_SIZE) - SYSEX_EXTRA_SIZE; 346 + return line6_send_raw_message(line6, buffer, 347 + size + SYSEX_EXTRA_SIZE) - 348 + SYSEX_EXTRA_SIZE; 345 349 } 346 350 347 351 /* ··· 352 352 int line6_send_sysex_message_async(struct usb_line6 *line6, const char *buffer, 353 353 int size) 354 354 { 355 - return line6_send_raw_message_async(line6, buffer, size + SYSEX_EXTRA_SIZE) - SYSEX_EXTRA_SIZE; 355 + return line6_send_raw_message_async(line6, buffer, 356 + size + SYSEX_EXTRA_SIZE) - 357 + SYSEX_EXTRA_SIZE; 356 358 } 357 359 358 360 /* ··· 396 394 line6_dump_urb(urb); 397 395 #endif 398 396 399 - done = line6_midibuf_write(mb, urb->transfer_buffer, urb->actual_length); 397 + done = 398 + line6_midibuf_write(mb, urb->transfer_buffer, urb->actual_length); 400 399 401 400 if (done < urb->actual_length) { 402 401 line6_midibuf_ignore(mb, done); 403 - DEBUG_MESSAGES(dev_err(line6->ifcdev, "%d %d buffer overflow - message skipped\n", done, urb->actual_length)); 402 + DEBUG_MESSAGES(dev_err 403 + (line6->ifcdev, 404 + "%d %d buffer overflow - message skipped\n", 405 + done, urb->actual_length)); 404 406 } 405 407 406 408 for (;;) { 407 - done = line6_midibuf_read(mb, line6->buffer_message, LINE6_MESSAGE_MAXLEN); 409 + done = 410 + line6_midibuf_read(mb, line6->buffer_message, 411 + LINE6_MESSAGE_MAXLEN); 408 412 409 413 if (done == 0) 410 414 break; 411 415 412 416 /* MIDI input filter */ 413 - if (line6_midibuf_skip_message(mb, line6->line6midi->midi_mask_receive)) 417 + if (line6_midibuf_skip_message 418 + (mb, line6->line6midi->midi_mask_receive)) 414 419 continue; 415 420 416 421 line6->message_length = done; ··· 433 424 case LINE6_DEVID_PODXT: 434 425 case LINE6_DEVID_PODXTPRO: 435 426 case LINE6_DEVID_POCKETPOD: 436 - line6_pod_process_message((struct usb_line6_pod *)line6); 427 + line6_pod_process_message((struct usb_line6_pod *) 428 + line6); 437 429 break; 438 430 439 431 case LINE6_DEVID_PODXTLIVE: 440 432 switch (line6->interface_number) { 441 433 case PODXTLIVE_INTERFACE_POD: 442 - line6_pod_process_message((struct usb_line6_pod *)line6); 434 + line6_pod_process_message((struct usb_line6_pod 435 + *)line6); 443 436 break; 444 437 445 438 case PODXTLIVE_INTERFACE_VARIAX: 446 - line6_variax_process_message((struct usb_line6_variax *)line6); 439 + line6_variax_process_message((struct 440 + usb_line6_variax 441 + *)line6); 447 442 break; 448 443 449 444 default: 450 - dev_err(line6->ifcdev, "PODxt Live interface %d not supported\n", line6->interface_number); 445 + dev_err(line6->ifcdev, 446 + "PODxt Live interface %d not supported\n", 447 + line6->interface_number); 451 448 } 452 449 break; 453 450 454 451 case LINE6_DEVID_VARIAX: 455 - line6_variax_process_message((struct usb_line6_variax *)line6); 452 + line6_variax_process_message((struct usb_line6_variax *) 453 + line6); 456 454 break; 457 455 458 456 default: ··· 499 483 buffer, 2, &partial, LINE6_TIMEOUT * HZ); 500 484 501 485 if (retval) 502 - dev_err(line6->ifcdev, "usb_interrupt_msg failed (%d)\n", retval); 486 + dev_err(line6->ifcdev, "usb_interrupt_msg failed (%d)\n", 487 + retval); 503 488 504 489 kfree(buffer); 505 490 return retval; ··· 531 514 #endif 532 515 533 516 retval = usb_interrupt_msg(line6->usbdev, 534 - usb_sndintpipe(line6->usbdev, line6->ep_control_write), 517 + usb_sndintpipe(line6->usbdev, 518 + line6->ep_control_write), 535 519 buffer, 3, &partial, LINE6_TIMEOUT * HZ); 536 520 537 521 if (retval) 538 - dev_err(line6->ifcdev, "usb_interrupt_msg failed (%d)\n", retval); 522 + dev_err(line6->ifcdev, "usb_interrupt_msg failed (%d)\n", 523 + retval); 539 524 540 525 kfree(buffer); 541 526 return retval; ··· 546 527 /* 547 528 Read data from device. 548 529 */ 549 - int line6_read_data(struct usb_line6 *line6, int address, void *data, size_t datalen) 530 + int line6_read_data(struct usb_line6 *line6, int address, void *data, 531 + size_t datalen) 550 532 { 551 533 struct usb_device *usbdev = line6->usbdev; 552 534 int ret; ··· 635 615 return ret; 636 616 } 637 617 } 638 - while (status == 0xff) 639 - ; 618 + while (status == 0xff); 640 619 641 620 if (status != 0) { 642 621 dev_err(line6->ifcdev, "write failed (error %d)\n", ret); ··· 651 632 */ 652 633 int line6_read_serial_number(struct usb_line6 *line6, int *serial_number) 653 634 { 654 - return line6_read_data(line6, 0x80d0, serial_number, sizeof(*serial_number)); 635 + return line6_read_data(line6, 0x80d0, serial_number, 636 + sizeof(*serial_number)); 655 637 } 656 638 657 639 /* ··· 667 647 /* 668 648 No operation (i.e., unsupported). 669 649 */ 670 - ssize_t line6_nop_write(struct device *dev, struct device_attribute *attr, 650 + ssize_t line6_nop_write(struct device * dev, struct device_attribute * attr, 671 651 const char *buf, size_t count) 672 652 { 673 653 return count; ··· 677 657 "write" request on "raw" special file. 678 658 */ 679 659 #ifdef CONFIG_LINE6_USB_RAW 680 - ssize_t line6_set_raw(struct device *dev, struct device_attribute *attr, 660 + ssize_t line6_set_raw(struct device * dev, struct device_attribute * attr, 681 661 const char *buf, size_t count) 682 662 { 683 663 struct usb_interface *interface = to_usb_interface(dev); ··· 717 697 /* 718 698 Probe USB device. 719 699 */ 720 - static int line6_probe(struct usb_interface *interface, const struct usb_device_id *id) 700 + static int line6_probe(struct usb_interface *interface, 701 + const struct usb_device_id *id) 721 702 { 722 703 int devtype; 723 704 struct usb_device *usbdev = NULL; ··· 786 765 case LINE6_DEVID_POCKETPOD: 787 766 switch (interface_number) { 788 767 case 0: 789 - return 0; /* this interface has no endpoints */ 768 + return 0; /* this interface has no endpoints */ 790 769 case 1: 791 770 alternate = 0; 792 771 break; ··· 821 800 case LINE6_DEVID_PODSTUDIO_UX1: 822 801 case LINE6_DEVID_TONEPORT_GX: 823 802 case LINE6_DEVID_TONEPORT_UX1: 824 - alternate = 2; /* 1..4 seem to be ok */ 803 + alternate = 2; /* 1..4 seem to be ok */ 825 804 break; 826 805 827 806 case LINE6_DEVID_TONEPORT_UX2: ··· 833 812 break; 834 813 case 1: 835 814 /* don't know yet what this is ... 836 - alternate = 1; 837 - break; 838 - */ 815 + alternate = 1; 816 + break; 817 + */ 839 818 return -ENODEV; 840 819 default: 841 820 MISSING_CASE; ··· 862 841 case LINE6_DEVID_PODXT: 863 842 case LINE6_DEVID_PODXTPRO: 864 843 size = sizeof(struct usb_line6_pod); 865 - ep_read = 0x84; 844 + ep_read = 0x84; 866 845 ep_write = 0x03; 867 846 break; 868 847 869 848 case LINE6_DEVID_POCKETPOD: 870 849 size = sizeof(struct usb_line6_pod); 871 - ep_read = 0x82; 850 + ep_read = 0x82; 872 851 ep_write = 0x02; 873 852 break; 874 853 ··· 876 855 case LINE6_DEVID_PODX3LIVE: 877 856 /* currently unused! */ 878 857 size = sizeof(struct usb_line6_pod); 879 - ep_read = 0x81; 858 + ep_read = 0x81; 880 859 ep_write = 0x01; 881 860 break; 882 861 ··· 895 874 switch (interface_number) { 896 875 case PODXTLIVE_INTERFACE_POD: 897 876 size = sizeof(struct usb_line6_pod); 898 - ep_read = 0x84; 877 + ep_read = 0x84; 899 878 ep_write = 0x03; 900 879 break; 901 880 902 881 case PODXTLIVE_INTERFACE_VARIAX: 903 882 size = sizeof(struct usb_line6_variax); 904 - ep_read = 0x86; 883 + ep_read = 0x86; 905 884 ep_write = 0x05; 906 885 break; 907 886 ··· 913 892 914 893 case LINE6_DEVID_VARIAX: 915 894 size = sizeof(struct usb_line6_variax); 916 - ep_read = 0x82; 895 + ep_read = 0x82; 917 896 ep_write = 0x01; 918 897 break; 919 898 ··· 924 903 } 925 904 926 905 if (size == 0) { 927 - dev_err(line6->ifcdev, "driver bug: interface data size not set\n"); 906 + dev_err(line6->ifcdev, 907 + "driver bug: interface data size not set\n"); 928 908 ret = -ENODEV; 929 909 goto err_put; 930 910 } ··· 950 928 /* get data from endpoint descriptor (see usb_maxpacket): */ 951 929 { 952 930 struct usb_host_endpoint *ep; 953 - unsigned epnum = usb_pipeendpoint(usb_rcvintpipe(usbdev, ep_read)); 931 + unsigned epnum = 932 + usb_pipeendpoint(usb_rcvintpipe(usbdev, ep_read)); 954 933 ep = usbdev->ep_in[epnum]; 955 934 956 935 if (ep != NULL) { 957 936 line6->interval = ep->desc.bInterval; 958 - line6->max_packet_size = le16_to_cpu(ep->desc.wMaxPacketSize); 937 + line6->max_packet_size = 938 + le16_to_cpu(ep->desc.wMaxPacketSize); 959 939 } else { 960 940 line6->interval = LINE6_FALLBACK_INTERVAL; 961 941 line6->max_packet_size = LINE6_FALLBACK_MAXPACKETSIZE; 962 - dev_err(line6->ifcdev, "endpoint not available, using fallback values"); 942 + dev_err(line6->ifcdev, 943 + "endpoint not available, using fallback values"); 963 944 } 964 945 } 965 946 ··· 970 945 971 946 if (properties->capabilities & LINE6_BIT_CONTROL) { 972 947 /* initialize USB buffers: */ 973 - line6->buffer_listen = kmalloc(LINE6_BUFSIZE_LISTEN, GFP_KERNEL); 948 + line6->buffer_listen = 949 + kmalloc(LINE6_BUFSIZE_LISTEN, GFP_KERNEL); 974 950 975 951 if (line6->buffer_listen == NULL) { 976 952 dev_err(&interface->dev, "Out of memory\n"); ··· 979 953 goto err_destruct; 980 954 } 981 955 982 - line6->buffer_message = kmalloc(LINE6_MESSAGE_MAXLEN, GFP_KERNEL); 956 + line6->buffer_message = 957 + kmalloc(LINE6_MESSAGE_MAXLEN, GFP_KERNEL); 983 958 984 959 if (line6->buffer_message == NULL) { 985 960 dev_err(&interface->dev, "Out of memory\n"); ··· 1021 994 case LINE6_DEVID_PODXTLIVE: 1022 995 switch (interface_number) { 1023 996 case PODXTLIVE_INTERFACE_POD: 1024 - ret = line6_pod_init(interface, (struct usb_line6_pod *)line6); 997 + ret = 998 + line6_pod_init(interface, 999 + (struct usb_line6_pod *)line6); 1025 1000 break; 1026 1001 1027 1002 case PODXTLIVE_INTERFACE_VARIAX: 1028 - ret = line6_variax_init(interface, (struct usb_line6_variax *)line6); 1003 + ret = 1004 + line6_variax_init(interface, 1005 + (struct usb_line6_variax *)line6); 1029 1006 break; 1030 1007 1031 1008 default: ··· 1042 1011 break; 1043 1012 1044 1013 case LINE6_DEVID_VARIAX: 1045 - ret = line6_variax_init(interface, (struct usb_line6_variax *)line6); 1014 + ret = 1015 + line6_variax_init(interface, 1016 + (struct usb_line6_variax *)line6); 1046 1017 break; 1047 1018 1048 1019 case LINE6_DEVID_PODSTUDIO_GX: ··· 1054 1021 case LINE6_DEVID_TONEPORT_UX1: 1055 1022 case LINE6_DEVID_TONEPORT_UX2: 1056 1023 case LINE6_DEVID_GUITARPORT: 1057 - ret = line6_toneport_init(interface, (struct usb_line6_toneport *)line6); 1024 + ret = 1025 + line6_toneport_init(interface, 1026 + (struct usb_line6_toneport *)line6); 1058 1027 break; 1059 1028 1060 1029 default: ··· 1078 1043 line6->properties->name); 1079 1044 line6_devices[devnum] = line6; 1080 1045 1081 - switch(product) { 1046 + switch (product) { 1082 1047 case LINE6_DEVID_PODX3: 1083 1048 case LINE6_DEVID_PODX3LIVE: 1084 - dev_info(&interface->dev, "NOTE: the Line6 %s is detected, but not yet supported\n", 1049 + dev_info(&interface->dev, 1050 + "NOTE: the Line6 %s is detected, but not yet supported\n", 1085 1051 line6->properties->name); 1086 1052 } 1087 1053 ··· 1173 1137 MISSING_CASE; 1174 1138 } 1175 1139 1176 - dev_info(&interface->dev, "Line6 %s now disconnected\n", line6->properties->name); 1140 + dev_info(&interface->dev, "Line6 %s now disconnected\n", 1141 + line6->properties->name); 1177 1142 1178 1143 for (i = LINE6_MAX_DEVICES; i--;) 1179 1144 if (line6_devices[i] == line6) ··· 1247 1210 return line6_resume(interface); 1248 1211 } 1249 1212 1250 - #endif /* CONFIG_PM */ 1213 + #endif /* CONFIG_PM */ 1251 1214 1252 1215 static struct usb_driver line6_driver = { 1253 1216 .name = DRIVER_NAME, ··· 1268 1231 { 1269 1232 int i, retval; 1270 1233 1271 - printk(KERN_INFO "%s driver version %s%s\n", 1272 - DRIVER_NAME, DRIVER_VERSION, DRIVER_REVISION); 1234 + printk(KERN_INFO "%s driver version %s\n", DRIVER_NAME, DRIVER_VERSION); 1273 1235 1274 1236 for (i = LINE6_MAX_DEVICES; i--;) 1275 1237 line6_devices[i] = NULL; ··· 1299 1263 */ 1300 1264 static void __exit line6_exit(void) 1301 1265 { 1302 - kfree(line6_request_version); 1266 + int i; 1267 + struct usb_line6 *line6; 1268 + struct snd_line6_pcm *line6pcm; 1269 + 1270 + /* stop all PCM channels */ 1271 + for (i = LINE6_MAX_DEVICES; i--;) { 1272 + line6 = line6_devices[i]; 1273 + 1274 + if (line6 == NULL) 1275 + continue; 1276 + 1277 + line6pcm = line6->line6pcm; 1278 + 1279 + if (line6pcm == NULL) 1280 + continue; 1281 + 1282 + line6_pcm_stop(line6pcm, ~0); 1283 + } 1284 + 1303 1285 usb_deregister(&line6_driver); 1286 + kfree(line6_request_version); 1304 1287 } 1305 1288 1306 1289 module_init(line6_init);
+4 -11
drivers/staging/line6/driver.h
··· 1 1 /* 2 - * Line6 Linux USB driver - 0.9.0 2 + * Line6 Linux USB driver - 0.9.1beta 3 3 * 4 4 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at) 5 5 * ··· 12 12 #ifndef DRIVER_H 13 13 #define DRIVER_H 14 14 15 - 16 15 #include <linux/spinlock.h> 17 16 #include <linux/usb.h> 18 17 #include <sound/core.h> 19 18 20 19 #include "midi.h" 21 - 22 20 23 21 #define DRIVER_NAME "line6usb" 24 22 ··· 49 51 */ 50 52 #define LINE6_CHANNEL_DEVICE 0x02 51 53 52 - #define LINE6_CHANNEL_UNKNOWN 5 /* don't know yet what this is good for */ 54 + #define LINE6_CHANNEL_UNKNOWN 5 /* don't know yet what this is good for */ 53 55 54 56 #define LINE6_CHANNEL_MASK 0x0f 55 57 ··· 59 61 #define DEBUG_MESSAGES(x) 60 62 #endif 61 63 62 - 63 64 #define MISSING_CASE \ 64 65 printk(KERN_ERR "line6usb driver bug: missing case in %s:%d\n", \ 65 66 __FILE__, __LINE__) 66 - 67 67 68 68 #define CHECK_RETURN(x) \ 69 69 do { \ ··· 75 79 return; \ 76 80 x = (n); 77 81 78 - 79 82 extern const unsigned char line6_midi_id[3]; 80 83 extern struct usb_line6 *line6_devices[LINE6_MAX_DEVICES]; 81 84 82 85 static const int SYSEX_DATA_OFS = sizeof(line6_midi_id) + 3; 83 86 static const int SYSEX_EXTRA_SIZE = sizeof(line6_midi_id) + 4; 84 - 85 87 86 88 /** 87 89 Common properties of Line6 devices. ··· 196 202 int message_length; 197 203 }; 198 204 199 - 200 205 extern char *line6_alloc_sysex_buffer(struct usb_line6 *line6, int code1, 201 206 int code2, int size); 202 207 extern ssize_t line6_nop_read(struct device *dev, ··· 219 226 extern ssize_t line6_set_raw(struct device *dev, struct device_attribute *attr, 220 227 const char *buf, size_t count); 221 228 extern void line6_start_timer(struct timer_list *timer, unsigned int msecs, 222 - void (*function)(unsigned long), unsigned long data); 229 + void (*function) (unsigned long), 230 + unsigned long data); 223 231 extern int line6_transmit_parameter(struct usb_line6 *line6, int param, 224 232 int value); 225 233 extern int line6_version_request_async(struct usb_line6 *line6); ··· 231 237 extern void line6_write_hexdump(struct usb_line6 *line6, char dir, 232 238 const unsigned char *buffer, int size); 233 239 #endif 234 - 235 240 236 241 #endif
+6 -4
drivers/staging/line6/dumprequest.c
··· 1 1 /* 2 - * Line6 Linux USB driver - 0.9.0 2 + * Line6 Linux USB driver - 0.9.1beta 3 3 * 4 4 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at) 5 5 * ··· 13 13 14 14 #include "driver.h" 15 15 #include "dumprequest.h" 16 - 17 16 18 17 /* 19 18 Set "dump in progress" flag. ··· 62 63 */ 63 64 int line6_dump_wait_interruptible(struct line6_dump_request *l6dr) 64 65 { 65 - return wait_event_interruptible(l6dr->wait, l6dr->in_progress == LINE6_DUMP_NONE); 66 + return wait_event_interruptible(l6dr->wait, 67 + l6dr->in_progress == LINE6_DUMP_NONE); 66 68 } 67 69 68 70 /* ··· 79 79 */ 80 80 int line6_dump_wait_timeout(struct line6_dump_request *l6dr, long timeout) 81 81 { 82 - return wait_event_timeout(l6dr->wait, l6dr->in_progress == LINE6_DUMP_NONE, timeout); 82 + return wait_event_timeout(l6dr->wait, 83 + l6dr->in_progress == LINE6_DUMP_NONE, 84 + timeout); 83 85 } 84 86 85 87 /*
+1 -5
drivers/staging/line6/dumprequest.h
··· 1 1 /* 2 - * Line6 Linux USB driver - 0.9.0 2 + * Line6 Linux USB driver - 0.9.1beta 3 3 * 4 4 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at) 5 5 * ··· 12 12 #ifndef DUMPREQUEST_H 13 13 #define DUMPREQUEST_H 14 14 15 - 16 15 #include <linux/usb.h> 17 16 #include <linux/wait.h> 18 17 #include <sound/core.h> 19 - 20 18 21 19 enum { 22 20 LINE6_DUMP_NONE, 23 21 LINE6_DUMP_CURRENT 24 22 }; 25 - 26 23 27 24 struct line6_dump_reqbuf { 28 25 /** ··· 72 75 extern int line6_dump_wait_interruptible(struct line6_dump_request *l6dr); 73 76 extern int line6_dump_wait_timeout(struct line6_dump_request *l6dr, 74 77 long timeout); 75 - 76 78 77 79 #endif
+27 -19
drivers/staging/line6/midi.c
··· 1 1 /* 2 - * Line6 Linux USB driver - 0.9.0 2 + * Line6 Linux USB driver - 0.9.1beta 3 3 * 4 4 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at) 5 5 * ··· 20 20 #include "pod.h" 21 21 #include "usbdefs.h" 22 22 23 - 24 23 #define line6_rawmidi_substream_midi(substream) \ 25 24 ((struct snd_line6_midi *)((substream)->rmidi->private_data)) 26 25 27 - 28 26 static int send_midi_async(struct usb_line6 *line6, unsigned char *data, 29 27 int length); 30 - 31 28 32 29 /* 33 30 Pass data received via USB to MIDI. ··· 42 45 */ 43 46 static void line6_midi_transmit(struct snd_rawmidi_substream *substream) 44 47 { 45 - struct usb_line6 *line6 = line6_rawmidi_substream_midi(substream)->line6; 48 + struct usb_line6 *line6 = 49 + line6_rawmidi_substream_midi(substream)->line6; 46 50 struct snd_line6_midi *line6midi = line6->line6midi; 47 51 struct MidiBuffer *mb = &line6midi->midibuf_out; 48 52 unsigned long flags; ··· 72 74 if (done == 0) 73 75 break; 74 76 75 - if (line6_midibuf_skip_message(mb, line6midi->midi_mask_transmit)) 77 + if (line6_midibuf_skip_message 78 + (mb, line6midi->midi_mask_transmit)) 76 79 continue; 77 80 78 81 send_midi_async(line6, chunk, done); ··· 131 132 dev_err(line6->ifcdev, "Out of memory\n"); 132 133 return -ENOMEM; 133 134 } 134 - 135 135 #ifdef CONFIG_LINE6_USB_DUMP_CTRL 136 136 line6_write_hexdump(line6, 'S', data, length); 137 137 #endif ··· 172 174 length); 173 175 break; 174 176 177 + case LINE6_DEVID_VARIAX: 178 + break; 179 + 175 180 default: 176 181 MISSING_CASE; 177 182 } ··· 196 195 int up) 197 196 { 198 197 unsigned long flags; 199 - struct usb_line6 *line6 = line6_rawmidi_substream_midi(substream)->line6; 198 + struct usb_line6 *line6 = 199 + line6_rawmidi_substream_midi(substream)->line6; 200 200 201 201 line6->line6midi->substream_transmit = substream; 202 202 spin_lock_irqsave(&line6->line6midi->send_urb_lock, flags); ··· 210 208 211 209 static void line6_midi_output_drain(struct snd_rawmidi_substream *substream) 212 210 { 213 - struct usb_line6 *line6 = line6_rawmidi_substream_midi(substream)->line6; 211 + struct usb_line6 *line6 = 212 + line6_rawmidi_substream_midi(substream)->line6; 214 213 struct snd_line6_midi *midi = line6->line6midi; 215 - wait_event_interruptible(midi->send_wait, midi->num_active_send_urbs == 0); 214 + wait_event_interruptible(midi->send_wait, 215 + midi->num_active_send_urbs == 0); 216 216 } 217 217 218 218 static int line6_midi_input_open(struct snd_rawmidi_substream *substream) ··· 230 226 static void line6_midi_input_trigger(struct snd_rawmidi_substream *substream, 231 227 int up) 232 228 { 233 - struct usb_line6 *line6 = line6_rawmidi_substream_midi(substream)->line6; 229 + struct usb_line6 *line6 = 230 + line6_rawmidi_substream_midi(substream)->line6; 234 231 235 232 if (up) 236 233 line6->line6midi->substream_receive = substream; ··· 276 271 strcpy(rmidi->name, line6midi->line6->properties->name); 277 272 278 273 rmidi->info_flags = 279 - SNDRV_RAWMIDI_INFO_OUTPUT | 280 - SNDRV_RAWMIDI_INFO_INPUT | 281 - SNDRV_RAWMIDI_INFO_DUPLEX; 274 + SNDRV_RAWMIDI_INFO_OUTPUT | 275 + SNDRV_RAWMIDI_INFO_INPUT | SNDRV_RAWMIDI_INFO_DUPLEX; 282 276 283 277 snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, 284 278 &line6_midi_output_ops); ··· 350 346 return count; 351 347 } 352 348 353 - static DEVICE_ATTR(midi_mask_transmit, S_IWUGO | S_IRUGO, midi_get_midi_mask_transmit, midi_set_midi_mask_transmit); 354 - static DEVICE_ATTR(midi_mask_receive, S_IWUGO | S_IRUGO, midi_get_midi_mask_receive, midi_set_midi_mask_receive); 349 + static DEVICE_ATTR(midi_mask_transmit, S_IWUGO | S_IRUGO, 350 + midi_get_midi_mask_transmit, midi_set_midi_mask_transmit); 351 + static DEVICE_ATTR(midi_mask_receive, S_IWUGO | S_IRUGO, 352 + midi_get_midi_mask_receive, midi_set_midi_mask_receive); 355 353 356 354 /* MIDI device destructor */ 357 355 static int snd_line6_midi_free(struct snd_device *device) 358 356 { 359 357 struct snd_line6_midi *line6midi = device->device_data; 360 - device_remove_file(line6midi->line6->ifcdev, &dev_attr_midi_mask_transmit); 361 - device_remove_file(line6midi->line6->ifcdev, &dev_attr_midi_mask_receive); 358 + device_remove_file(line6midi->line6->ifcdev, 359 + &dev_attr_midi_mask_transmit); 360 + device_remove_file(line6midi->line6->ifcdev, 361 + &dev_attr_midi_mask_receive); 362 362 line6_midibuf_destroy(&line6midi->midibuf_in); 363 363 line6_midibuf_destroy(&line6midi->midibuf_out); 364 364 return 0; ··· 381 373 struct snd_line6_midi *line6midi; 382 374 383 375 if (!(line6->properties->capabilities & LINE6_BIT_CONTROL)) 384 - return 0; /* skip MIDI initialization and report success */ 376 + return 0; /* skip MIDI initialization and report success */ 385 377 386 378 line6midi = kzalloc(sizeof(struct snd_line6_midi), GFP_KERNEL); 387 379
+1 -6
drivers/staging/line6/midi.h
··· 1 1 /* 2 - * Line6 Linux USB driver - 0.9.0 2 + * Line6 Linux USB driver - 0.9.1beta 3 3 * 4 4 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at) 5 5 * ··· 12 12 #ifndef MIDI_H 13 13 #define MIDI_H 14 14 15 - 16 15 #include <sound/rawmidi.h> 17 16 18 17 #include "midibuf.h" 19 18 20 - 21 19 #define MIDI_BUFFER_SIZE 1024 22 - 23 20 24 21 struct snd_line6_midi { 25 22 /** ··· 75 78 struct MidiBuffer midibuf_out; 76 79 }; 77 80 78 - 79 81 extern int line6_init_midi(struct usb_line6 *line6); 80 82 extern void line6_midi_receive(struct usb_line6 *line6, unsigned char *data, 81 83 int length); 82 - 83 84 84 85 #endif
+22 -18
drivers/staging/line6/midibuf.c
··· 1 1 /* 2 - * Line6 Linux USB driver - 0.9.0 2 + * Line6 Linux USB driver - 0.9.1beta 3 3 * 4 4 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at) 5 5 * ··· 13 13 14 14 #include "midibuf.h" 15 15 16 - 17 16 static int midibuf_message_length(unsigned char code) 18 17 { 19 18 if (code < 0x80) ··· 22 23 return length[(code >> 4) - 8]; 23 24 } else { 24 25 /* 25 - Note that according to the MIDI specification 0xf2 is 26 - the "Song Position Pointer", but this is used by Line6 27 - to send sysex messages to the host. 28 - */ 26 + Note that according to the MIDI specification 0xf2 is 27 + the "Song Position Pointer", but this is used by Line6 28 + to send sysex messages to the host. 29 + */ 29 30 static const int length[] = { -1, 2, -1, 2, -1, -1, 1, 1, 1, 1, 30 - 1, 1, 1, -1, 1, 1 }; 31 + 1, 1, 1, -1, 1, 1 32 + }; 31 33 return length[code & 0x0f]; 32 34 } 33 35 } ··· 72 72 int line6_midibuf_bytes_free(struct MidiBuffer *this) 73 73 { 74 74 return 75 - midibuf_is_full(this) ? 76 - 0 : 77 - (this->pos_read - this->pos_write + this->size - 1) % this->size + 1; 75 + midibuf_is_full(this) ? 76 + 0 : 77 + (this->pos_read - this->pos_write + this->size - 1) % this->size + 78 + 1; 78 79 } 79 80 80 81 int line6_midibuf_bytes_used(struct MidiBuffer *this) 81 82 { 82 83 return 83 - midibuf_is_empty(this) ? 84 - 0 : 85 - (this->pos_write - this->pos_read + this->size - 1) % this->size + 1; 84 + midibuf_is_empty(this) ? 85 + 0 : 86 + (this->pos_write - this->pos_read + this->size - 1) % this->size + 87 + 1; 86 88 } 87 89 88 - int line6_midibuf_write(struct MidiBuffer *this, unsigned char *data, int length) 90 + int line6_midibuf_write(struct MidiBuffer *this, unsigned char *data, 91 + int length) 89 92 { 90 93 int bytes_free; 91 94 int length1, length2; ··· 161 158 this->command_prev = command; 162 159 } else { 163 160 if (this->command_prev > 0) { 164 - int midi_length_prev = midibuf_message_length(this->command_prev); 161 + int midi_length_prev = 162 + midibuf_message_length(this->command_prev); 165 163 166 164 if (midi_length_prev > 0) { 167 165 midi_length = midi_length_prev - 1; ··· 202 198 } 203 199 204 200 if (midi_length == length) 205 - midi_length = -1; /* end of message not found */ 201 + midi_length = -1; /* end of message not found */ 206 202 } 207 203 208 204 if (midi_length < 0) { 209 205 if (!this->split) 210 - return 0; /* command is not yet complete */ 206 + return 0; /* command is not yet complete */ 211 207 } else { 212 208 if (length < midi_length) 213 - return 0; /* command is not yet complete */ 209 + return 0; /* command is not yet complete */ 214 210 215 211 length = midi_length; 216 212 }
+5 -6
drivers/staging/line6/midibuf.h
··· 1 1 /* 2 - * Line6 Linux USB driver - 0.9.0 2 + * Line6 Linux USB driver - 0.9.1beta 3 3 * 4 4 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at) 5 5 * ··· 12 12 #ifndef MIDIBUF_H 13 13 #define MIDIBUF_H 14 14 15 - 16 15 struct MidiBuffer { 17 16 unsigned char *buf; 18 17 int size; ··· 21 22 int command_prev; 22 23 }; 23 24 24 - 25 25 extern int line6_midibuf_bytes_used(struct MidiBuffer *mb); 26 26 extern int line6_midibuf_bytes_free(struct MidiBuffer *mb); 27 27 extern void line6_midibuf_destroy(struct MidiBuffer *mb); 28 28 extern int line6_midibuf_ignore(struct MidiBuffer *mb, int length); 29 29 extern int line6_midibuf_init(struct MidiBuffer *mb, int size, int split); 30 - extern int line6_midibuf_read(struct MidiBuffer *mb, unsigned char *data, int length); 30 + extern int line6_midibuf_read(struct MidiBuffer *mb, unsigned char *data, 31 + int length); 31 32 extern void line6_midibuf_reset(struct MidiBuffer *mb); 32 - extern int line6_midibuf_skip_message(struct MidiBuffer *mb, unsigned short mask); 33 + extern int line6_midibuf_skip_message(struct MidiBuffer *mb, 34 + unsigned short mask); 33 35 extern void line6_midibuf_status(struct MidiBuffer *mb); 34 36 extern int line6_midibuf_write(struct MidiBuffer *mb, unsigned char *data, 35 37 int length); 36 - 37 38 38 39 #endif
+73 -59
drivers/staging/line6/pcm.c
··· 1 1 /* 2 - * Line6 Linux USB driver - 0.9.0 2 + * Line6 Linux USB driver - 0.9.1beta 3 3 * 4 4 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at) 5 5 * ··· 21 21 #include "playback.h" 22 22 #include "pod.h" 23 23 24 - 25 24 #ifdef CONFIG_LINE6_USB_IMPULSE_RESPONSE 26 25 27 - static struct snd_line6_pcm* dev2pcm(struct device *dev) 26 + static struct snd_line6_pcm *dev2pcm(struct device *dev) 28 27 { 29 28 struct usb_interface *interface = to_usb_interface(dev); 30 29 struct usb_line6 *line6 = usb_get_intfdata(interface); ··· 35 36 "read" request on "impulse_volume" special file. 36 37 */ 37 38 static ssize_t pcm_get_impulse_volume(struct device *dev, 38 - struct device_attribute *attr, 39 - char *buf) 39 + struct device_attribute *attr, char *buf) 40 40 { 41 41 return sprintf(buf, "%d\n", dev2pcm(dev)->impulse_volume); 42 42 } ··· 51 53 int value = simple_strtoul(buf, NULL, 10); 52 54 line6pcm->impulse_volume = value; 53 55 54 - if(value > 0) 56 + if (value > 0) 55 57 line6_pcm_start(line6pcm, MASK_PCM_IMPULSE); 56 58 else 57 59 line6_pcm_stop(line6pcm, MASK_PCM_IMPULSE); ··· 63 65 "read" request on "impulse_period" special file. 64 66 */ 65 67 static ssize_t pcm_get_impulse_period(struct device *dev, 66 - struct device_attribute *attr, 67 - char *buf) 68 + struct device_attribute *attr, char *buf) 68 69 { 69 70 return sprintf(buf, "%d\n", dev2pcm(dev)->impulse_period); 70 71 } ··· 79 82 return count; 80 83 } 81 84 82 - static DEVICE_ATTR(impulse_volume, S_IWUGO | S_IRUGO, pcm_get_impulse_volume, pcm_set_impulse_volume); 83 - static DEVICE_ATTR(impulse_period, S_IWUGO | S_IRUGO, pcm_get_impulse_period, pcm_set_impulse_period); 85 + static DEVICE_ATTR(impulse_volume, S_IWUGO | S_IRUGO, pcm_get_impulse_volume, 86 + pcm_set_impulse_volume); 87 + static DEVICE_ATTR(impulse_period, S_IWUGO | S_IRUGO, pcm_get_impulse_period, 88 + pcm_set_impulse_period); 84 89 85 90 #endif 86 91 87 92 int line6_pcm_start(struct snd_line6_pcm *line6pcm, int channels) 88 93 { 89 - unsigned long flags_old = __sync_fetch_and_or(&line6pcm->flags, channels); 94 + unsigned long flags_old = 95 + __sync_fetch_and_or(&line6pcm->flags, channels); 90 96 unsigned long flags_new = flags_old | channels; 91 97 int err = 0; 92 98 93 99 #if LINE6_BACKUP_MONITOR_SIGNAL 94 100 if (!(line6pcm->line6->properties->capabilities & LINE6_BIT_HWMON)) { 95 - line6pcm->prev_fbuf = kmalloc(LINE6_ISO_PACKETS * line6pcm->max_packet_size, GFP_KERNEL); 101 + line6pcm->prev_fbuf = 102 + kmalloc(LINE6_ISO_PACKETS * line6pcm->max_packet_size, 103 + GFP_KERNEL); 96 104 97 105 if (!line6pcm->prev_fbuf) { 98 - dev_err(line6pcm->line6->ifcdev, "cannot malloc monitor buffer\n"); 106 + dev_err(line6pcm->line6->ifcdev, 107 + "cannot malloc monitor buffer\n"); 99 108 return -ENOMEM; 100 109 } 101 110 } 102 111 #else 103 112 line6pcm->prev_fbuf = NULL; 104 113 #endif 105 - 114 + 106 115 if (((flags_old & MASK_CAPTURE) == 0) && 107 116 ((flags_new & MASK_CAPTURE) != 0)) { 108 117 /* 109 - Waiting for completion of active URBs in the stop handler is 110 - a bug, we therefore report an error if capturing is restarted 111 - too soon. 112 - */ 113 - if(line6pcm->active_urb_in | line6pcm->unlink_urb_in) 118 + Waiting for completion of active URBs in the stop handler is 119 + a bug, we therefore report an error if capturing is restarted 120 + too soon. 121 + */ 122 + if (line6pcm->active_urb_in | line6pcm->unlink_urb_in) 114 123 return -EBUSY; 115 124 116 - line6pcm->buffer_in = kmalloc(LINE6_ISO_BUFFERS * LINE6_ISO_PACKETS * line6pcm->max_packet_size, GFP_KERNEL); 125 + line6pcm->buffer_in = 126 + kmalloc(LINE6_ISO_BUFFERS * LINE6_ISO_PACKETS * 127 + line6pcm->max_packet_size, GFP_KERNEL); 117 128 118 129 if (!line6pcm->buffer_in) { 119 - dev_err(line6pcm->line6->ifcdev, "cannot malloc capture buffer\n"); 130 + dev_err(line6pcm->line6->ifcdev, 131 + "cannot malloc capture buffer\n"); 120 132 return -ENOMEM; 121 133 } 122 134 123 135 line6pcm->count_in = 0; 124 136 line6pcm->prev_fsize = 0; 125 137 err = line6_submit_audio_in_all_urbs(line6pcm); 126 - 138 + 127 139 if (err < 0) { 128 140 __sync_fetch_and_and(&line6pcm->flags, ~channels); 129 141 return err; 130 142 } 131 143 } 132 - 144 + 133 145 if (((flags_old & MASK_PLAYBACK) == 0) && 134 146 ((flags_new & MASK_PLAYBACK) != 0)) { 135 147 /* 136 - See comment above regarding PCM restart. 137 - */ 138 - if(line6pcm->active_urb_out | line6pcm->unlink_urb_out) 148 + See comment above regarding PCM restart. 149 + */ 150 + if (line6pcm->active_urb_out | line6pcm->unlink_urb_out) 139 151 return -EBUSY; 140 152 141 - line6pcm->buffer_out = kmalloc(LINE6_ISO_BUFFERS * LINE6_ISO_PACKETS * line6pcm->max_packet_size, GFP_KERNEL); 153 + line6pcm->buffer_out = 154 + kmalloc(LINE6_ISO_BUFFERS * LINE6_ISO_PACKETS * 155 + line6pcm->max_packet_size, GFP_KERNEL); 142 156 143 157 if (!line6pcm->buffer_out) { 144 - dev_err(line6pcm->line6->ifcdev, "cannot malloc playback buffer\n"); 158 + dev_err(line6pcm->line6->ifcdev, 159 + "cannot malloc playback buffer\n"); 145 160 return -ENOMEM; 146 161 } 147 162 148 163 line6pcm->count_out = 0; 149 164 err = line6_submit_audio_out_all_urbs(line6pcm); 150 - 165 + 151 166 if (err < 0) { 152 167 __sync_fetch_and_and(&line6pcm->flags, ~channels); 153 168 return err; 154 169 } 155 170 } 156 - 171 + 157 172 return 0; 158 173 } 159 174 160 175 int line6_pcm_stop(struct snd_line6_pcm *line6pcm, int channels) 161 176 { 162 - unsigned long flags_old = __sync_fetch_and_and(&line6pcm->flags, ~channels); 177 + unsigned long flags_old = 178 + __sync_fetch_and_and(&line6pcm->flags, ~channels); 163 179 unsigned long flags_new = flags_old & ~channels; 164 180 165 181 if (((flags_old & MASK_CAPTURE) != 0) && ··· 188 178 kfree(line6pcm->buffer_out); 189 179 line6pcm->buffer_out = NULL; 190 180 } 191 - 192 181 #if LINE6_BACKUP_MONITOR_SIGNAL 193 182 if (line6pcm->prev_fbuf != NULL) 194 183 kfree(line6pcm->prev_fbuf); ··· 232 223 break; 233 224 234 225 default: 235 - dev_err(line6pcm->line6->ifcdev, "Unknown stream direction %d\n", 236 - s->stream); 226 + dev_err(line6pcm->line6->ifcdev, 227 + "Unknown stream direction %d\n", s->stream); 237 228 } 238 229 } 239 230 ··· 273 264 struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol); 274 265 275 266 for (i = 2; i--;) 276 - if (line6pcm->volume_playback[i] != ucontrol->value.integer.value[i]) { 277 - line6pcm->volume_playback[i] = ucontrol->value.integer.value[i]; 267 + if (line6pcm->volume_playback[i] != 268 + ucontrol->value.integer.value[i]) { 269 + line6pcm->volume_playback[i] = 270 + ucontrol->value.integer.value[i]; 278 271 changed = 1; 279 272 } 280 273 ··· 326 315 int err; 327 316 328 317 err = snd_pcm_new(line6pcm->line6->card, 329 - (char *)line6pcm->line6->properties->name, 330 - 0, 1, 1, &pcm); 318 + (char *)line6pcm->line6->properties->name, 319 + 0, 1, 1, &pcm); 331 320 if (err < 0) 332 321 return err; 333 322 ··· 339 328 /* set operators */ 340 329 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, 341 330 &snd_line6_playback_ops); 342 - snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, 343 - &snd_line6_capture_ops); 331 + snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_line6_capture_ops); 344 332 345 333 /* pre-allocation of buffers */ 346 334 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, 347 - snd_dma_continuous_data(GFP_KERNEL), 348 - 64 * 1024, 128 * 1024); 335 + snd_dma_continuous_data 336 + (GFP_KERNEL), 64 * 1024, 337 + 128 * 1024); 349 338 350 339 return 0; 351 340 } ··· 361 350 */ 362 351 static void pcm_disconnect_substream(struct snd_pcm_substream *substream) 363 352 { 364 - if(substream->runtime && snd_pcm_running(substream)) { 353 + if (substream->runtime && snd_pcm_running(substream)) { 365 354 snd_pcm_stop(substream, SNDRV_PCM_STATE_DISCONNECTED); 366 355 } 367 356 } ··· 371 360 */ 372 361 void line6_pcm_disconnect(struct snd_line6_pcm *line6pcm) 373 362 { 374 - pcm_disconnect_substream(get_substream(line6pcm, SNDRV_PCM_STREAM_CAPTURE)); 375 - pcm_disconnect_substream(get_substream(line6pcm, SNDRV_PCM_STREAM_PLAYBACK)); 363 + pcm_disconnect_substream(get_substream 364 + (line6pcm, SNDRV_PCM_STREAM_CAPTURE)); 365 + pcm_disconnect_substream(get_substream 366 + (line6pcm, SNDRV_PCM_STREAM_PLAYBACK)); 376 367 line6_unlink_wait_clear_audio_out_urbs(line6pcm); 377 368 line6_unlink_wait_clear_audio_in_urbs(line6pcm); 378 369 } ··· 395 382 struct snd_line6_pcm *line6pcm; 396 383 397 384 if (!(line6->properties->capabilities & LINE6_BIT_PCM)) 398 - return 0; /* skip PCM initialization and report success */ 385 + return 0; /* skip PCM initialization and report success */ 399 386 400 387 /* initialize PCM subsystem based on product id: */ 401 388 switch (line6->product) { ··· 405 392 case LINE6_DEVID_PODXT: 406 393 case LINE6_DEVID_PODXTLIVE: 407 394 case LINE6_DEVID_PODXTPRO: 408 - ep_read = 0x82; 395 + ep_read = 0x82; 409 396 ep_write = 0x01; 410 397 break; 411 398 412 399 case LINE6_DEVID_PODX3: 413 400 case LINE6_DEVID_PODX3LIVE: 414 - ep_read = 0x86; 401 + ep_read = 0x86; 415 402 ep_write = 0x02; 416 403 break; 417 404 418 405 case LINE6_DEVID_POCKETPOD: 419 - ep_read = 0x82; 406 + ep_read = 0x82; 420 407 ep_write = 0x02; 421 408 break; 422 409 ··· 427 414 case LINE6_DEVID_TONEPORT_GX: 428 415 case LINE6_DEVID_TONEPORT_UX1: 429 416 case LINE6_DEVID_TONEPORT_UX2: 430 - ep_read = 0x82; 417 + ep_read = 0x82; 431 418 ep_write = 0x01; 432 419 break; 433 420 434 421 /* this is for interface_number == 1: 435 - case LINE6_DEVID_TONEPORT_UX2: 436 - case LINE6_DEVID_PODSTUDIO_UX2: 437 - ep_read = 0x87; 438 - ep_write = 0x00; 439 - break; 440 - */ 422 + case LINE6_DEVID_TONEPORT_UX2: 423 + case LINE6_DEVID_PODSTUDIO_UX2: 424 + ep_read = 0x87; 425 + ep_write = 0x00; 426 + break; 427 + */ 441 428 442 429 default: 443 430 MISSING_CASE; ··· 455 442 line6pcm->ep_audio_write = ep_write; 456 443 line6pcm->max_packet_size = usb_maxpacket(line6->usbdev, 457 444 usb_rcvintpipe(line6->usbdev, 458 - ep_read), 459 - 0); 445 + ep_read), 0); 460 446 line6pcm->properties = properties; 461 447 line6->line6pcm = line6pcm; 462 448 ··· 483 471 return err; 484 472 485 473 /* mixer: */ 486 - err = snd_ctl_add(line6->card, snd_ctl_new1(&line6_control_playback, line6pcm)); 474 + err = 475 + snd_ctl_add(line6->card, 476 + snd_ctl_new1(&line6_control_playback, line6pcm)); 487 477 if (err < 0) 488 478 return err; 489 479
+11 -12
drivers/staging/line6/pcm.h
··· 1 1 /* 2 - * Line6 Linux USB driver - 0.9.0 2 + * Line6 Linux USB driver - 0.9.1beta 3 3 * 4 4 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at) 5 5 * ··· 16 16 #ifndef PCM_H 17 17 #define PCM_H 18 18 19 - 20 19 #include <sound/pcm.h> 21 20 22 21 #include "driver.h" 23 22 #include "usbdefs.h" 24 - 25 23 26 24 /* number of URBs */ 27 25 #define LINE6_ISO_BUFFERS 2 ··· 42 44 #define LINE6_BACKUP_MONITOR_SIGNAL 0 43 45 #define LINE6_REUSE_DMA_AREA_FOR_PLAYBACK 0 44 46 45 - 46 47 /* 47 48 Get substream from Line6 PCM data structure 48 49 */ 49 50 #define get_substream(line6pcm, stream) (line6pcm->pcm->streams[stream].substream) 50 - 51 51 52 52 /* 53 53 PCM mode bits and masks. ··· 67 71 BIT_PREPARED, 68 72 69 73 /* individual masks: */ 74 + /* *INDENT-OFF* */ 70 75 MASK_PCM_ALSA_PLAYBACK = 1 << BIT_PCM_ALSA_PLAYBACK, 71 76 MASK_PCM_ALSA_CAPTURE = 1 << BIT_PCM_ALSA_CAPTURE, 72 77 MASK_PCM_MONITOR_PLAYBACK = 1 << BIT_PCM_MONITOR_PLAYBACK, ··· 78 81 #endif 79 82 MASK_PAUSE_PLAYBACK = 1 << BIT_PAUSE_PLAYBACK, 80 83 MASK_PREPARED = 1 << BIT_PREPARED, 84 + /* *INDENT-ON* */ 81 85 82 86 /* combined masks (by operation): */ 83 - MASK_PCM_ALSA = MASK_PCM_ALSA_PLAYBACK | MASK_PCM_ALSA_CAPTURE, 87 + MASK_PCM_ALSA = MASK_PCM_ALSA_PLAYBACK | MASK_PCM_ALSA_CAPTURE, 84 88 MASK_PCM_MONITOR = MASK_PCM_MONITOR_PLAYBACK | MASK_PCM_MONITOR_CAPTURE, 85 89 #ifdef CONFIG_LINE6_USB_IMPULSE_RESPONSE 86 90 MASK_PCM_IMPULSE = MASK_PCM_IMPULSE_PLAYBACK | MASK_PCM_IMPULSE_CAPTURE, ··· 89 91 90 92 /* combined masks (by direction): */ 91 93 #ifdef CONFIG_LINE6_USB_IMPULSE_RESPONSE 92 - MASK_PLAYBACK = MASK_PCM_ALSA_PLAYBACK | MASK_PCM_MONITOR_PLAYBACK | MASK_PCM_IMPULSE_PLAYBACK, 93 - MASK_CAPTURE = MASK_PCM_ALSA_CAPTURE | MASK_PCM_MONITOR_CAPTURE | MASK_PCM_IMPULSE_CAPTURE 94 + MASK_PLAYBACK = 95 + MASK_PCM_ALSA_PLAYBACK | MASK_PCM_MONITOR_PLAYBACK | 96 + MASK_PCM_IMPULSE_PLAYBACK, 97 + MASK_CAPTURE = 98 + MASK_PCM_ALSA_CAPTURE | MASK_PCM_MONITOR_CAPTURE | 99 + MASK_PCM_IMPULSE_CAPTURE 94 100 #else 95 101 MASK_PLAYBACK = MASK_PCM_ALSA_PLAYBACK | MASK_PCM_MONITOR_PLAYBACK, 96 - MASK_CAPTURE = MASK_PCM_ALSA_CAPTURE | MASK_PCM_MONITOR_CAPTURE 102 + MASK_CAPTURE = MASK_PCM_ALSA_CAPTURE | MASK_PCM_MONITOR_CAPTURE 97 103 #endif 98 104 }; 99 105 ··· 304 302 int last_frame_in, last_frame_out; 305 303 }; 306 304 307 - 308 305 extern int line6_init_pcm(struct usb_line6 *line6, 309 306 struct line6_pcm_properties *properties); 310 307 extern int snd_line6_trigger(struct snd_pcm_substream *substream, int cmd); ··· 311 310 extern void line6_pcm_disconnect(struct snd_line6_pcm *line6pcm); 312 311 extern int line6_pcm_start(struct snd_line6_pcm *line6pcm, int channels); 313 312 extern int line6_pcm_stop(struct snd_line6_pcm *line6pcm, int channels); 314 - 315 313 316 314 #define PRINT_FRAME_DIFF(op) { \ 317 315 static int diff_prev = 1000; \ ··· 320 320 diff_prev = diff; \ 321 321 } \ 322 322 } 323 - 324 323 325 324 #endif
+49 -36
drivers/staging/line6/playback.c
··· 1 1 /* 2 - * Line6 Linux USB driver - 0.9.0 2 + * Line6 Linux USB driver - 0.9.1beta 3 3 * 4 4 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at) 5 5 * ··· 68 68 int frames = urb_out->transfer_buffer_length / bytes_per_frame; 69 69 70 70 if (bytes_per_frame == 4) { 71 - /* TODO: add code for TonePort etc. */ 71 + int i; 72 + short *pi = (short *)line6pcm->prev_fbuf; 73 + short *po = (short *)urb_out->transfer_buffer; 74 + 75 + for (i = 0; i < frames; ++i) { 76 + po[0] = pi[0]; 77 + po[1] = 0; 78 + pi += 2; 79 + po += 2; 80 + } 72 81 } else if (bytes_per_frame == 6) { 73 82 int i, j; 74 83 unsigned char *pi = line6pcm->prev_fbuf; ··· 93 84 pi += bytes_per_frame; 94 85 po += bytes_per_frame; 95 86 } 96 - 97 - if (--line6pcm->impulse_count <= 0) { 98 - ((unsigned char *)(urb_out-> 99 - transfer_buffer))[bytes_per_frame - 100 - 1] = 101 - line6pcm->impulse_volume; 102 - line6pcm->impulse_count = line6pcm->impulse_period; 103 - } 87 + } 88 + if (--line6pcm->impulse_count <= 0) { 89 + ((unsigned char *)(urb_out->transfer_buffer))[bytes_per_frame - 90 + 1] = 91 + line6pcm->impulse_volume; 92 + line6pcm->impulse_count = line6pcm->impulse_period; 104 93 } 105 94 } 106 95 ··· 124 117 } 125 118 126 119 /* 127 - We don't need to handle devices with 6 bytes per frame here 128 - since they all support hardware monitoring. 129 - */ 120 + We don't need to handle devices with 6 bytes per frame here 121 + since they all support hardware monitoring. 122 + */ 130 123 } 131 124 132 125 /* ··· 137 130 int index; 138 131 unsigned long flags; 139 132 int i, urb_size, urb_frames; 133 + int ret; 140 134 const int bytes_per_frame = line6pcm->properties->bytes_per_frame; 141 135 const int frame_increment = 142 136 line6pcm->properties->snd_line6_rates.rats[0].num_min; ··· 252 244 create_impulse_test_signal(line6pcm, urb_out, 253 245 bytes_per_frame); 254 246 if (line6pcm->flags & MASK_PCM_ALSA_CAPTURE) { 255 - line6_capture_copy(line6pcm, urb_out->transfer_buffer, 256 - urb_out->transfer_buffer_length); 247 + line6_capture_copy(line6pcm, 248 + urb_out->transfer_buffer, 249 + urb_out-> 250 + transfer_buffer_length); 251 + line6_capture_check_period(line6pcm, 252 + urb_out->transfer_buffer_length); 257 253 } 258 254 } else { 259 255 #endif 260 256 if (! 261 - (line6pcm->line6->properties-> 262 - capabilities & LINE6_BIT_HWMON) 263 - && (line6pcm->flags & MASK_PLAYBACK) 264 - && (line6pcm->flags & MASK_CAPTURE)) 257 + (line6pcm->line6-> 258 + properties->capabilities & LINE6_BIT_HWMON) 259 + && (line6pcm->flags & MASK_PLAYBACK) 260 + && (line6pcm->flags & MASK_CAPTURE)) 265 261 add_monitor_signal(urb_out, line6pcm->prev_fbuf, 266 262 line6pcm->volume_monitor, 267 263 bytes_per_frame); ··· 283 271 } 284 272 #endif 285 273 286 - if (usb_submit_urb(urb_out, GFP_ATOMIC) == 0) 274 + ret = usb_submit_urb(urb_out, GFP_ATOMIC); 275 + 276 + if (ret == 0) 287 277 set_bit(index, &line6pcm->active_urb_out); 288 278 else 289 279 dev_err(line6pcm->line6->ifcdev, 290 - "URB out #%d submission failed\n", index); 280 + "URB out #%d submission failed (%d)\n", index, ret); 291 281 292 282 spin_unlock_irqrestore(&line6pcm->lock_audio_out, flags); 293 283 return 0; ··· 369 355 int i, index, length = 0, shutdown = 0; 370 356 unsigned long flags; 371 357 372 - struct snd_line6_pcm *line6pcm = 373 - (struct snd_line6_pcm *)urb->context; 358 + struct snd_line6_pcm *line6pcm = (struct snd_line6_pcm *)urb->context; 374 359 struct snd_pcm_substream *substream = 375 360 get_substream(line6pcm, SNDRV_PCM_STREAM_PLAYBACK); 376 361 ··· 404 391 clear_bit(index, &line6pcm->active_urb_out); 405 392 406 393 for (i = LINE6_ISO_PACKETS; i--;) 407 - if (urb->iso_frame_desc[i].status == -ESHUTDOWN) { 394 + if (urb->iso_frame_desc[i].status == -EXDEV) { 408 395 shutdown = 1; 409 396 break; 410 397 } ··· 435 422 struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream); 436 423 437 424 err = snd_pcm_hw_constraint_ratdens(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, 438 - (&line6pcm->properties-> 439 - snd_line6_rates)); 425 + (&line6pcm-> 426 + properties->snd_line6_rates)); 440 427 if (err < 0) 441 428 return err; 442 429 ··· 537 524 538 525 /* playback operators */ 539 526 struct snd_pcm_ops snd_line6_playback_ops = { 540 - .open = snd_line6_playback_open, 541 - .close = snd_line6_playback_close, 542 - .ioctl = snd_pcm_lib_ioctl, 543 - .hw_params = snd_line6_playback_hw_params, 544 - .hw_free = snd_line6_playback_hw_free, 545 - .prepare = snd_line6_prepare, 546 - .trigger = snd_line6_trigger, 547 - .pointer = snd_line6_playback_pointer, 527 + .open = snd_line6_playback_open, 528 + .close = snd_line6_playback_close, 529 + .ioctl = snd_pcm_lib_ioctl, 530 + .hw_params = snd_line6_playback_hw_params, 531 + .hw_free = snd_line6_playback_hw_free, 532 + .prepare = snd_line6_prepare, 533 + .trigger = snd_line6_trigger, 534 + .pointer = snd_line6_playback_pointer, 548 535 }; 549 536 550 537 int line6_create_audio_out_urbs(struct snd_line6_pcm *line6pcm) ··· 567 554 urb->dev = line6pcm->line6->usbdev; 568 555 urb->pipe = 569 556 usb_sndisocpipe(line6pcm->line6->usbdev, 570 - line6pcm-> 571 - ep_audio_write & USB_ENDPOINT_NUMBER_MASK); 557 + line6pcm->ep_audio_write & 558 + USB_ENDPOINT_NUMBER_MASK); 572 559 urb->transfer_flags = URB_ISO_ASAP; 573 560 urb->start_frame = -1; 574 561 urb->number_of_packets = LINE6_ISO_PACKETS;
+1 -4
drivers/staging/line6/playback.h
··· 1 1 /* 2 - * Line6 Linux USB driver - 0.9.0 2 + * Line6 Linux USB driver - 0.9.1beta 3 3 * 4 4 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at) 5 5 * ··· 12 12 #ifndef PLAYBACK_H 13 13 #define PLAYBACK_H 14 14 15 - 16 15 #include <sound/pcm.h> 17 16 18 17 #include "driver.h" 19 - 20 18 21 19 /* 22 20 When the TonePort is used with jack in full duplex mode and the outputs are ··· 25 27 solution. Until one is found, this workaround can be used to fix the problem. 26 28 */ 27 29 #define USE_CLEAR_BUFFER_WORKAROUND 1 28 - 29 30 30 31 extern struct snd_pcm_ops snd_line6_playback_ops; 31 32
+261 -155
drivers/staging/line6/pod.c
··· 1 1 /* 2 - * Line6 Linux USB driver - 0.9.0 2 + * Line6 Linux USB driver - 0.9.1beta 3 3 * 4 4 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at) 5 5 * ··· 20 20 #include "playback.h" 21 21 #include "pod.h" 22 22 23 - 24 23 #define POD_SYSEX_CODE 3 25 - #define POD_BYTES_PER_FRAME 6 /* 24bit audio (stereo) */ 24 + #define POD_BYTES_PER_FRAME 6 /* 24bit audio (stereo) */ 26 25 26 + /* *INDENT-OFF* */ 27 27 28 28 enum { 29 29 POD_SYSEX_CLIP = 0x0f, ··· 49 49 POD_system_invalid = 0x10000 50 50 }; 51 51 52 + /* *INDENT-ON* */ 53 + 52 54 enum { 53 55 POD_DUMP_MEMORY = 2 54 56 }; ··· 63 61 POD_BUSY_MIDISEND 64 62 }; 65 63 66 - 67 64 static struct snd_ratden pod_ratden = { 68 65 .num_min = 78125, 69 66 .num_max = 78125, ··· 72 71 73 72 static struct line6_pcm_properties pod_pcm_properties = { 74 73 .snd_line6_playback_hw = { 75 - .info = (SNDRV_PCM_INFO_MMAP | 76 - SNDRV_PCM_INFO_INTERLEAVED | 77 - SNDRV_PCM_INFO_BLOCK_TRANSFER | 78 - SNDRV_PCM_INFO_MMAP_VALID | 79 - SNDRV_PCM_INFO_PAUSE | 74 + .info = (SNDRV_PCM_INFO_MMAP | 75 + SNDRV_PCM_INFO_INTERLEAVED | 76 + SNDRV_PCM_INFO_BLOCK_TRANSFER | 77 + SNDRV_PCM_INFO_MMAP_VALID | 78 + SNDRV_PCM_INFO_PAUSE | 80 79 #ifdef CONFIG_PM 81 - SNDRV_PCM_INFO_RESUME | 80 + SNDRV_PCM_INFO_RESUME | 82 81 #endif 83 - SNDRV_PCM_INFO_SYNC_START), 84 - .formats = SNDRV_PCM_FMTBIT_S24_3LE, 85 - .rates = SNDRV_PCM_RATE_KNOT, 86 - .rate_min = 39062, 87 - .rate_max = 39063, 88 - .channels_min = 2, 89 - .channels_max = 2, 90 - .buffer_bytes_max = 60000, 91 - .period_bytes_min = 64, 92 - .period_bytes_max = 8192, 93 - .periods_min = 1, 94 - .periods_max = 1024 95 - }, 82 + SNDRV_PCM_INFO_SYNC_START), 83 + .formats = SNDRV_PCM_FMTBIT_S24_3LE, 84 + .rates = SNDRV_PCM_RATE_KNOT, 85 + .rate_min = 39062, 86 + .rate_max = 39063, 87 + .channels_min = 2, 88 + .channels_max = 2, 89 + .buffer_bytes_max = 60000, 90 + .period_bytes_min = 64, 91 + .period_bytes_max = 8192, 92 + .periods_min = 1, 93 + .periods_max = 1024}, 96 94 .snd_line6_capture_hw = { 97 - .info = (SNDRV_PCM_INFO_MMAP | 98 - SNDRV_PCM_INFO_INTERLEAVED | 99 - SNDRV_PCM_INFO_BLOCK_TRANSFER | 100 - SNDRV_PCM_INFO_MMAP_VALID | 95 + .info = (SNDRV_PCM_INFO_MMAP | 96 + SNDRV_PCM_INFO_INTERLEAVED | 97 + SNDRV_PCM_INFO_BLOCK_TRANSFER | 98 + SNDRV_PCM_INFO_MMAP_VALID | 101 99 #ifdef CONFIG_PM 102 - SNDRV_PCM_INFO_RESUME | 100 + SNDRV_PCM_INFO_RESUME | 103 101 #endif 104 - SNDRV_PCM_INFO_SYNC_START), 105 - .formats = SNDRV_PCM_FMTBIT_S24_3LE, 106 - .rates = SNDRV_PCM_RATE_KNOT, 107 - .rate_min = 39062, 108 - .rate_max = 39063, 109 - .channels_min = 2, 110 - .channels_max = 2, 111 - .buffer_bytes_max = 60000, 112 - .period_bytes_min = 64, 113 - .period_bytes_max = 8192, 114 - .periods_min = 1, 115 - .periods_max = 1024 116 - }, 102 + SNDRV_PCM_INFO_SYNC_START), 103 + .formats = SNDRV_PCM_FMTBIT_S24_3LE, 104 + .rates = SNDRV_PCM_RATE_KNOT, 105 + .rate_min = 39062, 106 + .rate_max = 39063, 107 + .channels_min = 2, 108 + .channels_max = 2, 109 + .buffer_bytes_max = 60000, 110 + .period_bytes_min = 64, 111 + .period_bytes_max = 8192, 112 + .periods_min = 1, 113 + .periods_max = 1024}, 117 114 .snd_line6_rates = { 118 - .nrats = 1, 119 - .rats = &pod_ratden 120 - }, 115 + .nrats = 1, 116 + .rats = &pod_ratden}, 121 117 .bytes_per_frame = POD_BYTES_PER_FRAME 122 118 }; 123 119 ··· 122 124 0xf0, 0x00, 0x01, 0x0c, 0x03, 0x75, 0xf7 123 125 }; 124 126 125 - static const char pod_version_header[] = { 127 + static const char pod_version_header[] = { 126 128 0xf2, 0x7e, 0x7f, 0x06, 0x02 127 129 }; 128 - 129 130 130 131 /* forward declarations: */ 131 132 static void pod_startup2(unsigned long data); 132 133 static void pod_startup3(struct usb_line6_pod *pod); 133 134 static void pod_startup4(struct usb_line6_pod *pod); 134 - 135 135 136 136 /* 137 137 Mark all parameters as dirty and notify waiting processes. ··· 142 146 set_bit(i, pod->param_dirty); 143 147 } 144 148 145 - static char *pod_alloc_sysex_buffer(struct usb_line6_pod *pod, int code, int size) 149 + static char *pod_alloc_sysex_buffer(struct usb_line6_pod *pod, int code, 150 + int size) 146 151 { 147 - return line6_alloc_sysex_buffer(&pod->line6, POD_SYSEX_CODE, code, size); 152 + return line6_alloc_sysex_buffer(&pod->line6, POD_SYSEX_CODE, code, 153 + size); 148 154 } 149 155 150 156 /* ··· 181 183 /* 182 184 Handle SAVE button. 183 185 */ 184 - static void pod_save_button_pressed(struct usb_line6_pod *pod, int type, int index) 186 + static void pod_save_button_pressed(struct usb_line6_pod *pod, int type, 187 + int index) 185 188 { 186 189 pod->dirty = 0; 187 190 set_bit(POD_SAVE_PRESSED, &pod->atomic_flags); ··· 200 201 case LINE6_PARAM_CHANGE: 201 202 case LINE6_PROGRAM_CHANGE: 202 203 case LINE6_SYSEX_BEGIN: 203 - break; /* handle these further down */ 204 + break; /* handle these further down */ 204 205 205 206 default: 206 - return; /* ignore all others */ 207 + return; /* ignore all others */ 207 208 } 208 209 209 210 /* process all remaining messages */ ··· 216 217 if ((buf[1] == POD_amp_model_setup) || 217 218 (buf[1] == POD_effect_setup)) 218 219 /* these also affect other settings */ 219 - line6_dump_request_async(&pod->dumpreq, &pod->line6, 0, LINE6_DUMP_CURRENT); 220 + line6_dump_request_async(&pod->dumpreq, &pod->line6, 0, 221 + LINE6_DUMP_CURRENT); 220 222 221 223 break; 222 224 ··· 226 226 pod->channel_num = buf[1]; 227 227 pod->dirty = 0; 228 228 set_bit(POD_CHANNEL_DIRTY, &pod->atomic_flags); 229 - line6_dump_request_async(&pod->dumpreq, &pod->line6, 0, LINE6_DUMP_CURRENT); 229 + line6_dump_request_async(&pod->dumpreq, &pod->line6, 0, 230 + LINE6_DUMP_CURRENT); 230 231 break; 231 232 232 233 case LINE6_SYSEX_BEGIN | LINE6_CHANNEL_DEVICE: ··· 235 234 if (memcmp(buf + 1, line6_midi_id, sizeof(line6_midi_id)) == 0) { 236 235 switch (buf[5]) { 237 236 case POD_SYSEX_DUMP: 238 - if (pod->line6.message_length == sizeof(pod->prog_data) + 7) { 237 + if (pod->line6.message_length == 238 + sizeof(pod->prog_data) + 7) { 239 239 switch (pod->dumpreq.in_progress) { 240 240 case LINE6_DUMP_CURRENT: 241 - memcpy(&pod->prog_data, buf + 7, sizeof(pod->prog_data)); 241 + memcpy(&pod->prog_data, buf + 7, 242 + sizeof(pod->prog_data)); 242 243 pod_mark_batch_all_dirty(pod); 243 244 break; 244 245 245 246 case POD_DUMP_MEMORY: 246 - memcpy(&pod->prog_data_buf, buf + 7, sizeof(pod->prog_data_buf)); 247 + memcpy(&pod->prog_data_buf, 248 + buf + 7, 249 + sizeof 250 + (pod->prog_data_buf)); 247 251 break; 248 252 249 253 default: 250 - DEBUG_MESSAGES(dev_err(pod->line6.ifcdev, "unknown dump code %02X\n", pod->dumpreq.in_progress)); 254 + DEBUG_MESSAGES(dev_err 255 + (pod-> 256 + line6.ifcdev, 257 + "unknown dump code %02X\n", 258 + pod-> 259 + dumpreq.in_progress)); 251 260 } 252 261 253 262 line6_dump_finished(&pod->dumpreq); 254 263 pod_startup3(pod); 255 264 } else 256 - DEBUG_MESSAGES(dev_err(pod->line6.ifcdev, "wrong size of channel dump message (%d instead of %d)\n", 257 - pod->line6.message_length, (int)sizeof(pod->prog_data) + 7)); 265 + DEBUG_MESSAGES(dev_err 266 + (pod->line6.ifcdev, 267 + "wrong size of channel dump message (%d instead of %d)\n", 268 + pod-> 269 + line6.message_length, 270 + (int) 271 + sizeof(pod->prog_data) + 272 + 7)); 258 273 259 274 break; 260 275 261 - case POD_SYSEX_SYSTEM: { 262 - short value = ((int)buf[7] << 12) | ((int)buf[8] << 8) | ((int)buf[9] << 4) | (int)buf[10]; 276 + case POD_SYSEX_SYSTEM:{ 277 + short value = 278 + ((int)buf[7] << 12) | ((int)buf[8] 279 + << 8) | 280 + ((int)buf[9] << 4) | (int)buf[10]; 263 281 264 282 #define PROCESS_SYSTEM_PARAM(x) \ 265 283 case POD_ ## x: \ ··· 286 266 wake_up(&pod->x.wait); \ 287 267 break; 288 268 289 - switch (buf[6]) { 290 - PROCESS_SYSTEM_PARAM(monitor_level); 291 - PROCESS_SYSTEM_PARAM(routing); 292 - PROCESS_SYSTEM_PARAM(tuner_mute); 293 - PROCESS_SYSTEM_PARAM(tuner_freq); 294 - PROCESS_SYSTEM_PARAM(tuner_note); 295 - PROCESS_SYSTEM_PARAM(tuner_pitch); 269 + switch (buf[6]) { 270 + PROCESS_SYSTEM_PARAM 271 + (monitor_level); 272 + PROCESS_SYSTEM_PARAM(routing); 273 + PROCESS_SYSTEM_PARAM 274 + (tuner_mute); 275 + PROCESS_SYSTEM_PARAM 276 + (tuner_freq); 277 + PROCESS_SYSTEM_PARAM 278 + (tuner_note); 279 + PROCESS_SYSTEM_PARAM 280 + (tuner_pitch); 296 281 297 282 #undef PROCESS_SYSTEM_PARAM 298 283 299 - default: 300 - DEBUG_MESSAGES(dev_err(pod->line6.ifcdev, "unknown tuner/system response %02X\n", buf[6])); 301 - } 284 + default: 285 + DEBUG_MESSAGES(dev_err 286 + (pod-> 287 + line6.ifcdev, 288 + "unknown tuner/system response %02X\n", 289 + buf[6])); 290 + } 302 291 303 - break; 304 - } 292 + break; 293 + } 305 294 306 295 case POD_SYSEX_FINISH: 307 296 /* do we need to respond to this? */ ··· 321 292 break; 322 293 323 294 case POD_SYSEX_CLIP: 324 - DEBUG_MESSAGES(dev_err(pod->line6.ifcdev, "audio clipped\n")); 295 + DEBUG_MESSAGES(dev_err 296 + (pod->line6.ifcdev, 297 + "audio clipped\n")); 325 298 pod->clipping.value = 1; 326 299 wake_up(&pod->clipping.wait); 327 300 break; 328 301 329 302 case POD_SYSEX_STORE: 330 - DEBUG_MESSAGES(dev_err(pod->line6.ifcdev, "message %02X not yet implemented\n", buf[5])); 303 + DEBUG_MESSAGES(dev_err 304 + (pod->line6.ifcdev, 305 + "message %02X not yet implemented\n", 306 + buf[5])); 331 307 break; 332 308 333 309 default: 334 - DEBUG_MESSAGES(dev_err(pod->line6.ifcdev, "unknown sysex message %02X\n", buf[5])); 310 + DEBUG_MESSAGES(dev_err 311 + (pod->line6.ifcdev, 312 + "unknown sysex message %02X\n", 313 + buf[5])); 335 314 } 336 - } else if (memcmp(buf, pod_version_header, sizeof(pod_version_header)) == 0) { 337 - pod->firmware_version = buf[13] * 100 + buf[14] * 10 + buf[15]; 338 - pod->device_id = ((int)buf[8] << 16) | ((int)buf[9] << 8) | (int)buf[10]; 315 + } else 316 + if (memcmp 317 + (buf, pod_version_header, 318 + sizeof(pod_version_header)) == 0) { 319 + pod->firmware_version = 320 + buf[13] * 100 + buf[14] * 10 + buf[15]; 321 + pod->device_id = 322 + ((int)buf[8] << 16) | ((int)buf[9] << 8) | (int) 323 + buf[10]; 339 324 pod_startup4(pod); 340 325 } else 341 - DEBUG_MESSAGES(dev_err(pod->line6.ifcdev, "unknown sysex header\n")); 326 + DEBUG_MESSAGES(dev_err 327 + (pod->line6.ifcdev, 328 + "unknown sysex header\n")); 342 329 343 330 break; 344 331 ··· 362 317 break; 363 318 364 319 default: 365 - DEBUG_MESSAGES(dev_err(pod->line6.ifcdev, "POD: unknown message %02X\n", buf[0])); 320 + DEBUG_MESSAGES(dev_err 321 + (pod->line6.ifcdev, 322 + "POD: unknown message %02X\n", buf[0])); 366 323 } 367 324 } 368 325 ··· 379 332 *) This method fails if a param change message is "chopped" after the first 380 333 byte. 381 334 */ 382 - void line6_pod_midi_postprocess(struct usb_line6_pod *pod, unsigned char *data, int length) 335 + void line6_pod_midi_postprocess(struct usb_line6_pod *pod, unsigned char *data, 336 + int length) 383 337 { 384 338 int i; 385 339 ··· 391 343 if (data[i] == (LINE6_PROGRAM_CHANGE | LINE6_CHANNEL_HOST)) { 392 344 line6_invalidate_current(&pod->dumpreq); 393 345 break; 394 - } else if ((data[i] == (LINE6_PARAM_CHANGE | LINE6_CHANNEL_HOST)) && (i < length - 1)) 395 - if ((data[i + 1] == POD_amp_model_setup) || (data[i + 1] == POD_effect_setup)) { 346 + } else 347 + if ((data[i] == (LINE6_PARAM_CHANGE | LINE6_CHANNEL_HOST)) 348 + && (i < length - 1)) 349 + if ((data[i + 1] == POD_amp_model_setup) 350 + || (data[i + 1] == POD_effect_setup)) { 396 351 line6_invalidate_current(&pod->dumpreq); 397 352 break; 398 353 } ··· 418 367 /* 419 368 Transmit PODxt Pro control parameter. 420 369 */ 421 - void line6_pod_transmit_parameter(struct usb_line6_pod *pod, int param, int value) 370 + void line6_pod_transmit_parameter(struct usb_line6_pod *pod, int param, 371 + int value) 422 372 { 423 373 if (line6_transmit_parameter(&pod->line6, param, value) == 0) 424 374 pod_store_parameter(pod, param, value); 425 375 426 - if ((param == POD_amp_model_setup) || (param == POD_effect_setup)) /* these also affect other settings */ 376 + if ((param == POD_amp_model_setup) || (param == POD_effect_setup)) /* these also affect other settings */ 427 377 line6_invalidate_current(&pod->dumpreq); 428 378 } 429 379 430 380 /* 431 381 Resolve value to memory location. 432 382 */ 433 - static int pod_resolve(const char *buf, short block0, short block1, unsigned char *location) 383 + static int pod_resolve(const char *buf, short block0, short block1, 384 + unsigned char *location) 434 385 { 435 386 unsigned long value; 436 387 short block; ··· 452 399 /* 453 400 Send command to store channel/effects setup/amp setup to PODxt Pro. 454 401 */ 455 - static ssize_t pod_send_store_command(struct device *dev, const char *buf, size_t count, short block0, short block1) 402 + static ssize_t pod_send_store_command(struct device *dev, const char *buf, 403 + size_t count, short block0, short block1) 456 404 { 457 405 struct usb_interface *interface = to_usb_interface(dev); 458 406 struct usb_line6_pod *pod = usb_get_intfdata(interface); ··· 464 410 if (!sysex) 465 411 return 0; 466 412 467 - sysex[SYSEX_DATA_OFS] = 5; /* see pod_dump() */ 413 + sysex[SYSEX_DATA_OFS] = 5; /* see pod_dump() */ 468 414 ret = pod_resolve(buf, block0, block1, sysex + SYSEX_DATA_OFS + 1); 469 415 if (ret) { 470 416 kfree(sysex); 471 417 return ret; 472 418 } 473 419 474 - memcpy(sysex + SYSEX_DATA_OFS + 3, &pod->prog_data_buf, sizeof(pod->prog_data_buf)); 420 + memcpy(sysex + SYSEX_DATA_OFS + 3, &pod->prog_data_buf, 421 + sizeof(pod->prog_data_buf)); 475 422 476 423 line6_send_sysex_message(&pod->line6, sysex, size); 477 424 kfree(sysex); ··· 483 428 /* 484 429 Send command to retrieve channel/effects setup/amp setup to PODxt Pro. 485 430 */ 486 - static ssize_t pod_send_retrieve_command(struct device *dev, const char *buf, size_t count, short block0, short block1) 431 + static ssize_t pod_send_retrieve_command(struct device *dev, const char *buf, 432 + size_t count, short block0, 433 + short block1) 487 434 { 488 435 struct usb_interface *interface = to_usb_interface(dev); 489 436 struct usb_line6_pod *pod = usb_get_intfdata(interface); ··· 516 459 /* 517 460 Generic get name function. 518 461 */ 519 - static ssize_t get_name_generic(struct usb_line6_pod *pod, const char *str, char *buf) 462 + static ssize_t get_name_generic(struct usb_line6_pod *pod, const char *str, 463 + char *buf) 520 464 { 521 465 int length = 0; 522 466 const char *p1; ··· 579 521 { 580 522 struct usb_interface *interface = to_usb_interface(dev); 581 523 struct usb_line6_pod *pod = usb_get_intfdata(interface); 582 - return get_name_generic(pod, pod->prog_data.header + POD_NAME_OFFSET, buf); 524 + return get_name_generic(pod, pod->prog_data.header + POD_NAME_OFFSET, 525 + buf); 583 526 } 584 527 585 528 /* ··· 591 532 { 592 533 struct usb_interface *interface = to_usb_interface(dev); 593 534 struct usb_line6_pod *pod = usb_get_intfdata(interface); 594 - return get_name_generic(pod, pod->prog_data_buf.header + POD_NAME_OFFSET, buf); 535 + return get_name_generic(pod, 536 + pod->prog_data_buf.header + POD_NAME_OFFSET, 537 + buf); 595 538 } 596 539 597 540 /* ··· 622 561 623 562 if (count != sizeof(pod->prog_data)) { 624 563 dev_err(pod->line6.ifcdev, 625 - "data block must be exactly %d bytes\n", 626 - (int)sizeof(pod->prog_data)); 564 + "data block must be exactly %d bytes\n", 565 + (int)sizeof(pod->prog_data)); 627 566 return -EINVAL; 628 567 } 629 568 ··· 637 576 static bool pod_is_tuner(int code) 638 577 { 639 578 return 640 - (code == POD_tuner_mute) || 641 - (code == POD_tuner_freq) || 642 - (code == POD_tuner_note) || 643 - (code == POD_tuner_pitch); 579 + (code == POD_tuner_mute) || 580 + (code == POD_tuner_freq) || 581 + (code == POD_tuner_note) || (code == POD_tuner_pitch); 644 582 } 645 583 646 584 /* 647 585 Get system parameter (as integer). 648 586 @param tuner non-zero, if code refers to a tuner parameter 649 587 */ 650 - static int pod_get_system_param_int(struct usb_line6_pod *pod, int *value, int code, 651 - struct ValueWait *param, int sign) 588 + static int pod_get_system_param_int(struct usb_line6_pod *pod, int *value, 589 + int code, struct ValueWait *param, int sign) 652 590 { 653 591 char *sysex; 654 592 static const int size = 1; 655 593 int retval = 0; 656 594 657 - if (((pod->prog_data.control[POD_tuner] & 0x40) == 0) && pod_is_tuner(code)) 595 + if (((pod->prog_data.control[POD_tuner] & 0x40) == 0) 596 + && pod_is_tuner(code)) 658 597 return -ENODEV; 659 598 660 599 /* send value request to device: */ ··· 669 608 kfree(sysex); 670 609 671 610 /* wait for device to respond: */ 672 - retval = wait_event_interruptible(param->wait, param->value != POD_system_invalid); 611 + retval = 612 + wait_event_interruptible(param->wait, 613 + param->value != POD_system_invalid); 673 614 674 615 if (retval < 0) 675 616 return retval; 676 617 677 - *value = sign ? (int)(signed short)param->value : (int)(unsigned short)param->value; 618 + *value = sign ? (int)(signed short)param->value : (int)(unsigned short) 619 + param->value; 678 620 679 - if(*value == POD_system_invalid) 680 - *value = 0; /* don't report uninitialized values */ 621 + if (*value == POD_system_invalid) 622 + *value = 0; /* don't report uninitialized values */ 681 623 682 624 return 0; 683 625 } ··· 689 625 Get system parameter (as string). 690 626 @param tuner non-zero, if code refers to a tuner parameter 691 627 */ 692 - static ssize_t pod_get_system_param_string(struct usb_line6_pod *pod, char *buf, int code, 693 - struct ValueWait *param, int sign) 628 + static ssize_t pod_get_system_param_string(struct usb_line6_pod *pod, char *buf, 629 + int code, struct ValueWait *param, 630 + int sign) 694 631 { 695 632 int retval, value = 0; 696 633 retval = pod_get_system_param_int(pod, &value, code, param, sign); 697 634 698 - if(retval < 0) 635 + if (retval < 0) 699 636 return retval; 700 637 701 638 return sprintf(buf, "%d\n", value); ··· 706 641 Send system parameter (from integer). 707 642 @param tuner non-zero, if code refers to a tuner parameter 708 643 */ 709 - static int pod_set_system_param_int(struct usb_line6_pod *pod, int value, int code) 644 + static int pod_set_system_param_int(struct usb_line6_pod *pod, int value, 645 + int code) 710 646 { 711 647 char *sysex; 712 648 static const int size = 5; 713 649 714 - if (((pod->prog_data.control[POD_tuner] & 0x40) == 0) && pod_is_tuner(code)) 650 + if (((pod->prog_data.control[POD_tuner] & 0x40) == 0) 651 + && pod_is_tuner(code)) 715 652 return -EINVAL; 716 653 717 654 /* send value to tuner: */ ··· 722 655 return -ENOMEM; 723 656 sysex[SYSEX_DATA_OFS] = code; 724 657 sysex[SYSEX_DATA_OFS + 1] = (value >> 12) & 0x0f; 725 - sysex[SYSEX_DATA_OFS + 2] = (value >> 8) & 0x0f; 726 - sysex[SYSEX_DATA_OFS + 3] = (value >> 4) & 0x0f; 727 - sysex[SYSEX_DATA_OFS + 4] = (value ) & 0x0f; 658 + sysex[SYSEX_DATA_OFS + 2] = (value >> 8) & 0x0f; 659 + sysex[SYSEX_DATA_OFS + 3] = (value >> 4) & 0x0f; 660 + sysex[SYSEX_DATA_OFS + 4] = (value) & 0x0f; 728 661 line6_send_sysex_message(&pod->line6, sysex, size); 729 662 kfree(sysex); 730 663 return 0; ··· 734 667 Send system parameter (from string). 735 668 @param tuner non-zero, if code refers to a tuner parameter 736 669 */ 737 - static ssize_t pod_set_system_param_string(struct usb_line6_pod *pod, const char *buf, 738 - int count, int code, unsigned short mask) 670 + static ssize_t pod_set_system_param_string(struct usb_line6_pod *pod, 671 + const char *buf, int count, int code, 672 + unsigned short mask) 739 673 { 740 674 int retval; 741 675 unsigned short value = simple_strtoul(buf, NULL, 10) & mask; ··· 946 878 { 947 879 struct usb_interface *interface = to_usb_interface(dev); 948 880 struct usb_line6_pod *pod = usb_get_intfdata(interface); 949 - return wait_event_interruptible(pod->clipping.wait, pod->clipping.value != 0); 881 + return wait_event_interruptible(pod->clipping.wait, 882 + pod->clipping.value != 0); 950 883 } 951 884 952 885 /* ··· 959 890 960 891 static void pod_startup1(struct usb_line6_pod *pod) 961 892 { 962 - CHECK_STARTUP_PROGRESS(pod->startup_progress, 1); 893 + CHECK_STARTUP_PROGRESS(pod->startup_progress, POD_STARTUP_INIT); 963 894 964 895 /* delay startup procedure: */ 965 - line6_start_timer(&pod->startup_timer, POD_STARTUP_DELAY, pod_startup2, (unsigned long)pod); 896 + line6_start_timer(&pod->startup_timer, POD_STARTUP_DELAY, pod_startup2, 897 + (unsigned long)pod); 966 898 } 967 899 968 900 static void pod_startup2(unsigned long data) 969 901 { 970 902 struct usb_line6_pod *pod = (struct usb_line6_pod *)data; 971 - CHECK_STARTUP_PROGRESS(pod->startup_progress, 2); 903 + 904 + /* schedule another startup procedure until startup is complete: */ 905 + if (pod->startup_progress >= POD_STARTUP_LAST) 906 + return; 907 + 908 + pod->startup_progress = POD_STARTUP_DUMPREQ; 909 + line6_start_timer(&pod->startup_timer, POD_STARTUP_DELAY, pod_startup2, 910 + (unsigned long)pod); 972 911 973 912 /* current channel dump: */ 974 - line6_dump_request_async(&pod->dumpreq, &pod->line6, 0, LINE6_DUMP_CURRENT); 913 + line6_dump_request_async(&pod->dumpreq, &pod->line6, 0, 914 + LINE6_DUMP_CURRENT); 975 915 } 976 916 977 917 static void pod_startup3(struct usb_line6_pod *pod) 978 918 { 979 919 struct usb_line6 *line6 = &pod->line6; 980 - CHECK_STARTUP_PROGRESS(pod->startup_progress, 3); 920 + CHECK_STARTUP_PROGRESS(pod->startup_progress, POD_STARTUP_VERSIONREQ); 981 921 982 922 /* request firmware version: */ 983 923 line6_version_request_async(line6); ··· 994 916 995 917 static void pod_startup4(struct usb_line6_pod *pod) 996 918 { 997 - CHECK_STARTUP_PROGRESS(pod->startup_progress, 4); 919 + CHECK_STARTUP_PROGRESS(pod->startup_progress, POD_STARTUP_WORKQUEUE); 998 920 999 921 /* schedule work for global work queue: */ 1000 922 schedule_work(&pod->startup_work); ··· 1002 924 1003 925 static void pod_startup5(struct work_struct *work) 1004 926 { 1005 - struct usb_line6_pod *pod = container_of(work, struct usb_line6_pod, startup_work); 927 + struct usb_line6_pod *pod = 928 + container_of(work, struct usb_line6_pod, startup_work); 1006 929 struct usb_line6 *line6 = &pod->line6; 1007 930 1008 - CHECK_STARTUP_PROGRESS(pod->startup_progress, 5); 931 + CHECK_STARTUP_PROGRESS(pod->startup_progress, POD_STARTUP_SETUP); 1009 932 1010 933 /* serial number: */ 1011 934 line6_read_serial_number(&pod->line6, &pod->serial_number); ··· 1015 936 line6_register_audio(line6); 1016 937 1017 938 /* device files: */ 1018 - line6_pod_create_files(pod->firmware_version, line6->properties->device_bit, line6->ifcdev); 939 + line6_pod_create_files(pod->firmware_version, 940 + line6->properties->device_bit, line6->ifcdev); 1019 941 } 1020 942 1021 943 #define POD_GET_SYSTEM_PARAM(code, sign) \ ··· 1051 971 #undef GET_SYSTEM_PARAM 1052 972 1053 973 /* POD special files: */ 1054 - static DEVICE_ATTR(channel, S_IWUGO | S_IRUGO, pod_get_channel, pod_set_channel); 974 + static DEVICE_ATTR(channel, S_IWUGO | S_IRUGO, pod_get_channel, 975 + pod_set_channel); 1055 976 static DEVICE_ATTR(clip, S_IRUGO, pod_wait_for_clip, line6_nop_write); 1056 977 static DEVICE_ATTR(device_id, S_IRUGO, pod_get_device_id, line6_nop_write); 1057 978 static DEVICE_ATTR(dirty, S_IRUGO, pod_get_dirty, line6_nop_write); 1058 979 static DEVICE_ATTR(dump, S_IWUGO | S_IRUGO, pod_get_dump, pod_set_dump); 1059 - static DEVICE_ATTR(dump_buf, S_IWUGO | S_IRUGO, pod_get_dump_buf, pod_set_dump_buf); 980 + static DEVICE_ATTR(dump_buf, S_IWUGO | S_IRUGO, pod_get_dump_buf, 981 + pod_set_dump_buf); 1060 982 static DEVICE_ATTR(finish, S_IWUGO, line6_nop_read, pod_set_finish); 1061 - static DEVICE_ATTR(firmware_version, S_IRUGO, pod_get_firmware_version, line6_nop_write); 1062 - static DEVICE_ATTR(midi_postprocess, S_IWUGO | S_IRUGO, pod_get_midi_postprocess, pod_set_midi_postprocess); 1063 - static DEVICE_ATTR(monitor_level, S_IWUGO | S_IRUGO, pod_get_monitor_level, pod_set_monitor_level); 983 + static DEVICE_ATTR(firmware_version, S_IRUGO, pod_get_firmware_version, 984 + line6_nop_write); 985 + static DEVICE_ATTR(midi_postprocess, S_IWUGO | S_IRUGO, 986 + pod_get_midi_postprocess, pod_set_midi_postprocess); 987 + static DEVICE_ATTR(monitor_level, S_IWUGO | S_IRUGO, pod_get_monitor_level, 988 + pod_set_monitor_level); 1064 989 static DEVICE_ATTR(name, S_IRUGO, pod_get_name, line6_nop_write); 1065 990 static DEVICE_ATTR(name_buf, S_IRUGO, pod_get_name_buf, line6_nop_write); 1066 - static DEVICE_ATTR(retrieve_amp_setup, S_IWUGO, line6_nop_read, pod_set_retrieve_amp_setup); 1067 - static DEVICE_ATTR(retrieve_channel, S_IWUGO, line6_nop_read, pod_set_retrieve_channel); 1068 - static DEVICE_ATTR(retrieve_effects_setup, S_IWUGO, line6_nop_read, pod_set_retrieve_effects_setup); 1069 - static DEVICE_ATTR(routing, S_IWUGO | S_IRUGO, pod_get_routing, pod_set_routing); 1070 - static DEVICE_ATTR(serial_number, S_IRUGO, pod_get_serial_number, line6_nop_write); 1071 - static DEVICE_ATTR(store_amp_setup, S_IWUGO, line6_nop_read, pod_set_store_amp_setup); 1072 - static DEVICE_ATTR(store_channel, S_IWUGO, line6_nop_read, pod_set_store_channel); 1073 - static DEVICE_ATTR(store_effects_setup, S_IWUGO, line6_nop_read, pod_set_store_effects_setup); 1074 - static DEVICE_ATTR(tuner_freq, S_IWUGO | S_IRUGO, pod_get_tuner_freq, pod_set_tuner_freq); 1075 - static DEVICE_ATTR(tuner_mute, S_IWUGO | S_IRUGO, pod_get_tuner_mute, pod_set_tuner_mute); 991 + static DEVICE_ATTR(retrieve_amp_setup, S_IWUGO, line6_nop_read, 992 + pod_set_retrieve_amp_setup); 993 + static DEVICE_ATTR(retrieve_channel, S_IWUGO, line6_nop_read, 994 + pod_set_retrieve_channel); 995 + static DEVICE_ATTR(retrieve_effects_setup, S_IWUGO, line6_nop_read, 996 + pod_set_retrieve_effects_setup); 997 + static DEVICE_ATTR(routing, S_IWUGO | S_IRUGO, pod_get_routing, 998 + pod_set_routing); 999 + static DEVICE_ATTR(serial_number, S_IRUGO, pod_get_serial_number, 1000 + line6_nop_write); 1001 + static DEVICE_ATTR(store_amp_setup, S_IWUGO, line6_nop_read, 1002 + pod_set_store_amp_setup); 1003 + static DEVICE_ATTR(store_channel, S_IWUGO, line6_nop_read, 1004 + pod_set_store_channel); 1005 + static DEVICE_ATTR(store_effects_setup, S_IWUGO, line6_nop_read, 1006 + pod_set_store_effects_setup); 1007 + static DEVICE_ATTR(tuner_freq, S_IWUGO | S_IRUGO, pod_get_tuner_freq, 1008 + pod_set_tuner_freq); 1009 + static DEVICE_ATTR(tuner_mute, S_IWUGO | S_IRUGO, pod_get_tuner_mute, 1010 + pod_set_tuner_mute); 1076 1011 static DEVICE_ATTR(tuner_note, S_IRUGO, pod_get_tuner_note, line6_nop_write); 1077 1012 static DEVICE_ATTR(tuner_pitch, S_IRUGO, pod_get_tuner_pitch, line6_nop_write); 1078 1013 ··· 1123 1028 struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol); 1124 1029 struct usb_line6_pod *pod = (struct usb_line6_pod *)line6pcm->line6; 1125 1030 1126 - if(ucontrol->value.integer.value[0] == pod->monitor_level.value) 1031 + if (ucontrol->value.integer.value[0] == pod->monitor_level.value) 1127 1032 return 0; 1128 1033 1129 1034 pod->monitor_level.value = ucontrol->value.integer.value[0]; 1130 - pod_set_system_param_int(pod, ucontrol->value.integer.value[0], POD_monitor_level); 1035 + pod_set_system_param_int(pod, ucontrol->value.integer.value[0], 1036 + POD_monitor_level); 1131 1037 return 1; 1132 1038 } 1133 1039 ··· 1157 1061 if (line6 == NULL) 1158 1062 return; 1159 1063 line6_cleanup_audio(line6); 1064 + 1065 + del_timer(&pod->startup_timer); 1066 + cancel_work_sync(&pod->startup_work); 1160 1067 1161 1068 /* free dump request data: */ 1162 1069 line6_dumpreq_destruct(&pod->dumpreq); ··· 1207 1108 /* 1208 1109 Try to init POD device. 1209 1110 */ 1210 - static int pod_try_init(struct usb_interface *interface, struct usb_line6_pod *pod) 1111 + static int pod_try_init(struct usb_interface *interface, 1112 + struct usb_line6_pod *pod) 1211 1113 { 1212 1114 int err; 1213 1115 struct usb_line6 *line6 = &pod->line6; 1116 + 1117 + init_timer(&pod->startup_timer); 1118 + INIT_WORK(&pod->startup_work, pod_startup5); 1214 1119 1215 1120 if ((interface == NULL) || (pod == NULL)) 1216 1121 return -ENODEV; ··· 1229 1126 init_waitqueue_head(&pod->tuner_note.wait); 1230 1127 init_waitqueue_head(&pod->tuner_pitch.wait); 1231 1128 init_waitqueue_head(&pod->clipping.wait); 1232 - init_timer(&pod->startup_timer); 1233 - INIT_WORK(&pod->startup_work, pod_startup5); 1234 1129 1235 1130 memset(pod->param_dirty, 0xff, sizeof(pod->param_dirty)); 1236 1131 ··· 1265 1164 } 1266 1165 1267 1166 /* register monitor control: */ 1268 - err = snd_ctl_add(line6->card, snd_ctl_new1(&pod_control_monitor, line6->line6pcm)); 1167 + err = 1168 + snd_ctl_add(line6->card, 1169 + snd_ctl_new1(&pod_control_monitor, line6->line6pcm)); 1269 1170 if (err < 0) { 1270 1171 return err; 1271 1172 } 1272 1173 1273 1174 /* 1274 - When the sound card is registered at this point, the PODxt Live 1275 - displays "Invalid Code Error 07", so we do it later in the event 1276 - handler. 1277 - */ 1175 + When the sound card is registered at this point, the PODxt Live 1176 + displays "Invalid Code Error 07", so we do it later in the event 1177 + handler. 1178 + */ 1278 1179 1279 1180 if (pod->line6.properties->capabilities & LINE6_BIT_CONTROL) { 1280 1181 pod->monitor_level.value = POD_system_invalid; ··· 1323 1220 1324 1221 if (dev != NULL) { 1325 1222 /* remove sysfs entries: */ 1326 - line6_pod_remove_files(pod->firmware_version, pod->line6.properties->device_bit, dev); 1223 + line6_pod_remove_files(pod->firmware_version, 1224 + pod->line6. 1225 + properties->device_bit, dev); 1327 1226 1328 1227 device_remove_file(dev, &dev_attr_channel); 1329 1228 device_remove_file(dev, &dev_attr_clip); ··· 1341 1236 device_remove_file(dev, &dev_attr_name_buf); 1342 1237 device_remove_file(dev, &dev_attr_retrieve_amp_setup); 1343 1238 device_remove_file(dev, &dev_attr_retrieve_channel); 1344 - device_remove_file(dev, &dev_attr_retrieve_effects_setup); 1239 + device_remove_file(dev, 1240 + &dev_attr_retrieve_effects_setup); 1345 1241 device_remove_file(dev, &dev_attr_routing); 1346 1242 device_remove_file(dev, &dev_attr_serial_number); 1347 1243 device_remove_file(dev, &dev_attr_store_amp_setup);
+16 -7
drivers/staging/line6/pod.h
··· 1 1 /* 2 - * Line6 Linux USB driver - 0.9.0 2 + * Line6 Linux USB driver - 0.9.1beta 3 3 * 4 4 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at) 5 5 * ··· 12 12 #ifndef POD_H 13 13 #define POD_H 14 14 15 - 16 15 #include <linux/interrupt.h> 17 16 #include <linux/spinlock.h> 18 17 #include <linux/usb.h> ··· 21 22 22 23 #include "driver.h" 23 24 #include "dumprequest.h" 24 - 25 25 26 26 /* 27 27 PODxt Live interfaces ··· 39 41 */ 40 42 #define POD_CONTROL_SIZE 0x80 41 43 #define POD_BUFSIZE_DUMPREQ 7 42 - #define POD_STARTUP_DELAY 3000 44 + #define POD_STARTUP_DELAY 1000 45 + 46 + /* 47 + Stages of POD startup procedure 48 + */ 49 + enum { 50 + POD_STARTUP_INIT = 1, 51 + POD_STARTUP_DUMPREQ, 52 + POD_STARTUP_VERSIONREQ, 53 + POD_STARTUP_WORKQUEUE, 54 + POD_STARTUP_SETUP, 55 + POD_STARTUP_LAST = POD_STARTUP_SETUP - 1 56 + }; 43 57 44 58 /** 45 59 Data structure for values that need to be requested explicitly. ··· 193 183 char midi_postprocess; 194 184 }; 195 185 196 - 197 186 extern void line6_pod_disconnect(struct usb_interface *interface); 198 - extern int line6_pod_init(struct usb_interface *interface, struct usb_line6_pod *pod); 187 + extern int line6_pod_init(struct usb_interface *interface, 188 + struct usb_line6_pod *pod); 199 189 extern void line6_pod_midi_postprocess(struct usb_line6_pod *pod, 200 190 unsigned char *data, int length); 201 191 extern void line6_pod_process_message(struct usb_line6_pod *pod); 202 192 extern void line6_pod_transmit_parameter(struct usb_line6_pod *pod, int param, 203 193 int value); 204 - 205 194 206 195 #endif
+1 -1
drivers/staging/line6/revision.h
··· 1 1 #ifndef DRIVER_REVISION 2 2 /* current subversion revision */ 3 - #define DRIVER_REVISION " (revision 665)" 3 + #define DRIVER_REVISION " (revision 684)" 4 4 #endif
+77 -66
drivers/staging/line6/toneport.c
··· 1 1 /* 2 - * Line6 Linux USB driver - 0.9.0 2 + * Line6 Linux USB driver - 0.9.1beta 3 3 * 4 4 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at) 5 5 * Emil Myhrman (emil.myhrman@gmail.com) ··· 19 19 #include "playback.h" 20 20 #include "toneport.h" 21 21 22 - 23 22 static int toneport_send_cmd(struct usb_device *usbdev, int cmd1, int cmd2); 24 23 25 - 26 24 #define TONEPORT_PCM_DELAY 1 27 - 28 25 29 26 static struct snd_ratden toneport_ratden = { 30 27 .num_min = 44100, ··· 32 35 33 36 static struct line6_pcm_properties toneport_pcm_properties = { 34 37 .snd_line6_playback_hw = { 35 - .info = (SNDRV_PCM_INFO_MMAP | 36 - SNDRV_PCM_INFO_INTERLEAVED | 37 - SNDRV_PCM_INFO_BLOCK_TRANSFER | 38 - SNDRV_PCM_INFO_MMAP_VALID | 39 - SNDRV_PCM_INFO_PAUSE | 38 + .info = (SNDRV_PCM_INFO_MMAP | 39 + SNDRV_PCM_INFO_INTERLEAVED | 40 + SNDRV_PCM_INFO_BLOCK_TRANSFER | 41 + SNDRV_PCM_INFO_MMAP_VALID | 42 + SNDRV_PCM_INFO_PAUSE | 40 43 #ifdef CONFIG_PM 41 - SNDRV_PCM_INFO_RESUME | 44 + SNDRV_PCM_INFO_RESUME | 42 45 #endif 43 - SNDRV_PCM_INFO_SYNC_START), 44 - .formats = SNDRV_PCM_FMTBIT_S16_LE, 45 - .rates = SNDRV_PCM_RATE_KNOT, 46 - .rate_min = 44100, 47 - .rate_max = 44100, 48 - .channels_min = 2, 49 - .channels_max = 2, 50 - .buffer_bytes_max = 60000, 51 - .period_bytes_min = 64, 52 - .period_bytes_max = 8192, 53 - .periods_min = 1, 54 - .periods_max = 1024 55 - }, 46 + SNDRV_PCM_INFO_SYNC_START), 47 + .formats = SNDRV_PCM_FMTBIT_S16_LE, 48 + .rates = SNDRV_PCM_RATE_KNOT, 49 + .rate_min = 44100, 50 + .rate_max = 44100, 51 + .channels_min = 2, 52 + .channels_max = 2, 53 + .buffer_bytes_max = 60000, 54 + .period_bytes_min = 64, 55 + .period_bytes_max = 8192, 56 + .periods_min = 1, 57 + .periods_max = 1024}, 56 58 .snd_line6_capture_hw = { 57 - .info = (SNDRV_PCM_INFO_MMAP | 58 - SNDRV_PCM_INFO_INTERLEAVED | 59 - SNDRV_PCM_INFO_BLOCK_TRANSFER | 60 - SNDRV_PCM_INFO_MMAP_VALID | 59 + .info = (SNDRV_PCM_INFO_MMAP | 60 + SNDRV_PCM_INFO_INTERLEAVED | 61 + SNDRV_PCM_INFO_BLOCK_TRANSFER | 62 + SNDRV_PCM_INFO_MMAP_VALID | 61 63 #ifdef CONFIG_PM 62 - SNDRV_PCM_INFO_RESUME | 64 + SNDRV_PCM_INFO_RESUME | 63 65 #endif 64 - SNDRV_PCM_INFO_SYNC_START), 65 - .formats = SNDRV_PCM_FMTBIT_S16_LE, 66 - .rates = SNDRV_PCM_RATE_KNOT, 67 - .rate_min = 44100, 68 - .rate_max = 44100, 69 - .channels_min = 2, 70 - .channels_max = 2, 71 - .buffer_bytes_max = 60000, 72 - .period_bytes_min = 64, 73 - .period_bytes_max = 8192, 74 - .periods_min = 1, 75 - .periods_max = 1024 76 - }, 66 + SNDRV_PCM_INFO_SYNC_START), 67 + .formats = SNDRV_PCM_FMTBIT_S16_LE, 68 + .rates = SNDRV_PCM_RATE_KNOT, 69 + .rate_min = 44100, 70 + .rate_max = 44100, 71 + .channels_min = 2, 72 + .channels_max = 2, 73 + .buffer_bytes_max = 60000, 74 + .period_bytes_min = 64, 75 + .period_bytes_max = 8192, 76 + .periods_min = 1, 77 + .periods_max = 1024}, 77 78 .snd_line6_rates = { 78 - .nrats = 1, 79 - .rats = &toneport_ratden 80 - }, 79 + .nrats = 1, 80 + .rats = &toneport_ratden}, 81 81 .bytes_per_frame = 4 82 82 }; 83 83 ··· 87 93 static int led_red = 0x00; 88 94 static int led_green = 0x26; 89 95 90 - struct ToneportSourceInfo 91 - { 96 + struct ToneportSourceInfo { 92 97 const char *name; 93 98 int code; 94 99 }; 95 100 96 101 static const struct ToneportSourceInfo toneport_source_info[] = { 97 - { "Microphone", 0x0a01 }, 98 - { "Line" , 0x0801 }, 99 - { "Instrument", 0x0b01 }, 100 - { "Inst & Mic", 0x0901 } 102 + {"Microphone", 0x0a01}, 103 + {"Line", 0x0801}, 104 + {"Instrument", 0x0b01}, 105 + {"Inst & Mic", 0x0901} 101 106 }; 102 107 103 108 static bool toneport_has_led(short product) 104 109 { 105 110 return 106 - (product == LINE6_DEVID_GUITARPORT) || 107 - (product == LINE6_DEVID_TONEPORT_GX); 111 + (product == LINE6_DEVID_GUITARPORT) || 112 + (product == LINE6_DEVID_TONEPORT_GX); 108 113 /* add your device here if you are missing support for the LEDs */ 109 114 } 110 115 ··· 159 166 static DEVICE_ATTR(led_green, S_IWUGO | S_IRUGO, line6_nop_read, 160 167 toneport_set_led_green); 161 168 162 - 163 169 static int toneport_send_cmd(struct usb_device *usbdev, int cmd1, int cmd2) 164 170 { 165 171 int ret; ··· 201 209 { 202 210 struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol); 203 211 204 - if(ucontrol->value.integer.value[0] == line6pcm->volume_monitor) 212 + if (ucontrol->value.integer.value[0] == line6pcm->volume_monitor) 205 213 return 0; 206 214 207 215 line6pcm->volume_monitor = ucontrol->value.integer.value[0]; 216 + 217 + if (line6pcm->volume_monitor > 0) 218 + line6_pcm_start(line6pcm, MASK_PCM_MONITOR); 219 + else 220 + line6_pcm_stop(line6pcm, MASK_PCM_MONITOR); 221 + 208 222 return 1; 209 223 } 210 224 ··· 223 225 uinfo->count = 1; 224 226 uinfo->value.enumerated.items = size; 225 227 226 - if(uinfo->value.enumerated.item >= size) 228 + if (uinfo->value.enumerated.item >= size) 227 229 uinfo->value.enumerated.item = size - 1; 228 230 229 231 strcpy(uinfo->value.enumerated.name, ··· 237 239 struct snd_ctl_elem_value *ucontrol) 238 240 { 239 241 struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol); 240 - struct usb_line6_toneport *toneport = (struct usb_line6_toneport *)line6pcm->line6; 242 + struct usb_line6_toneport *toneport = 243 + (struct usb_line6_toneport *)line6pcm->line6; 241 244 ucontrol->value.enumerated.item[0] = toneport->source; 242 245 return 0; 243 246 } ··· 248 249 struct snd_ctl_elem_value *ucontrol) 249 250 { 250 251 struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol); 251 - struct usb_line6_toneport *toneport = (struct usb_line6_toneport *)line6pcm->line6; 252 + struct usb_line6_toneport *toneport = 253 + (struct usb_line6_toneport *)line6pcm->line6; 252 254 253 - if(ucontrol->value.enumerated.item[0] == toneport->source) 255 + if (ucontrol->value.enumerated.item[0] == toneport->source) 254 256 return 0; 255 257 256 258 toneport->source = ucontrol->value.enumerated.item[0]; 257 - toneport_send_cmd(toneport->line6.usbdev, toneport_source_info[toneport->source].code, 0x0000); 259 + toneport_send_cmd(toneport->line6.usbdev, 260 + toneport_source_info[toneport->source].code, 0x0000); 258 261 return 1; 259 262 } 260 263 ··· 322 321 toneport_send_cmd(usbdev, 0x0301, 0x0000); 323 322 324 323 /* initialize source select: */ 325 - switch(usbdev->descriptor.idProduct) { 324 + switch (usbdev->descriptor.idProduct) { 326 325 case LINE6_DEVID_TONEPORT_UX1: 327 326 case LINE6_DEVID_PODSTUDIO_UX1: 328 - toneport_send_cmd(usbdev, toneport_source_info[toneport->source].code, 0x0000); 327 + toneport_send_cmd(usbdev, 328 + toneport_source_info[toneport->source].code, 329 + 0x0000); 329 330 } 330 331 331 332 if (toneport_has_led(usbdev->descriptor.idProduct)) ··· 360 357 } 361 358 362 359 /* register monitor control: */ 363 - err = snd_ctl_add(line6->card, snd_ctl_new1(&toneport_control_monitor, line6->line6pcm)); 360 + err = 361 + snd_ctl_add(line6->card, 362 + snd_ctl_new1(&toneport_control_monitor, 363 + line6->line6pcm)); 364 364 if (err < 0) { 365 365 return err; 366 366 } 367 367 368 368 /* register source select control: */ 369 - switch(usbdev->descriptor.idProduct) { 369 + switch (usbdev->descriptor.idProduct) { 370 370 case LINE6_DEVID_TONEPORT_UX1: 371 371 case LINE6_DEVID_PODSTUDIO_UX1: 372 - err = snd_ctl_add(line6->card, snd_ctl_new1(&toneport_control_source, line6->line6pcm)); 372 + err = 373 + snd_ctl_add(line6->card, 374 + snd_ctl_new1(&toneport_control_source, 375 + line6->line6pcm)); 373 376 if (err < 0) { 374 377 return err; 375 378 } ··· 391 382 line6_read_data(line6, 0x80c2, &toneport->firmware_version, 1); 392 383 393 384 if (toneport_has_led(usbdev->descriptor.idProduct)) { 394 - CHECK_RETURN(device_create_file(&interface->dev, &dev_attr_led_red)); 395 - CHECK_RETURN(device_create_file(&interface->dev, &dev_attr_led_green)); 385 + CHECK_RETURN(device_create_file 386 + (&interface->dev, &dev_attr_led_red)); 387 + CHECK_RETURN(device_create_file 388 + (&interface->dev, &dev_attr_led_green)); 396 389 } 397 390 398 391 toneport_setup(toneport);
+1 -5
drivers/staging/line6/toneport.h
··· 1 1 /* 2 - * Line6 Linux USB driver - 0.9.0 2 + * Line6 Linux USB driver - 0.9.1beta 3 3 * 4 4 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at) 5 5 * ··· 12 12 #ifndef TONEPORT_H 13 13 #define TONEPORT_H 14 14 15 - 16 15 #include <linux/usb.h> 17 16 #include <sound/core.h> 18 17 19 18 #include "driver.h" 20 - 21 19 22 20 struct usb_line6_toneport { 23 21 /** ··· 44 46 struct timer_list timer; 45 47 }; 46 48 47 - 48 49 extern void line6_toneport_disconnect(struct usb_interface *interface); 49 50 extern int line6_toneport_init(struct usb_interface *interface, 50 51 struct usb_line6_toneport *toneport); 51 52 extern void line6_toneport_reset_resume(struct usb_line6_toneport *toneport); 52 - 53 53 54 54 #endif
+1 -3
drivers/staging/line6/usbdefs.h
··· 1 1 /* 2 - * Line6 Linux USB driver - 0.9.0 2 + * Line6 Linux USB driver - 0.9.1beta 3 3 * 4 4 * Copyright (C) 2005-2008 Markus Grabner (grabner@icg.tugraz.at) 5 5 * ··· 11 11 12 12 #ifndef USBDEFS_H 13 13 #define USBDEFS_H 14 - 15 14 16 15 #define LINE6_VENDOR_ID 0x0e41 17 16 ··· 78 79 79 80 #define LINE6_FALLBACK_INTERVAL 10 80 81 #define LINE6_FALLBACK_MAXPACKETSIZE 16 81 - 82 82 83 83 #endif
+111 -50
drivers/staging/line6/variax.c
··· 1 1 /* 2 - * Line6 Linux USB driver - 0.9.0 2 + * Line6 Linux USB driver - 0.9.1beta 3 3 * 4 4 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at) 5 5 * ··· 16 16 #include "driver.h" 17 17 #include "variax.h" 18 18 19 - 20 19 #define VARIAX_SYSEX_CODE 7 21 20 #define VARIAX_SYSEX_PARAM 0x3b 22 21 #define VARIAX_SYSEX_ACTIVATE 0x2a 23 22 #define VARIAX_MODEL_HEADER_LENGTH 7 24 23 #define VARIAX_MODEL_MESSAGE_LENGTH 199 25 24 #define VARIAX_OFFSET_ACTIVATE 7 26 - 27 25 28 26 /* 29 27 This message is sent by the device during initialization and identifies ··· 69 71 0x00, 0x00, 0x00, 0xf7 70 72 }; 71 73 72 - 73 74 /* forward declarations: */ 74 75 static int variax_create_files2(struct device *dev); 75 76 static void variax_startup2(unsigned long data); 76 77 static void variax_startup4(unsigned long data); 77 78 static void variax_startup5(unsigned long data); 78 - 79 79 80 80 /* 81 81 Decode data transmitted by workbench. ··· 106 110 107 111 static void variax_startup1(struct usb_line6_variax *variax) 108 112 { 109 - CHECK_STARTUP_PROGRESS(variax->startup_progress, 1); 113 + CHECK_STARTUP_PROGRESS(variax->startup_progress, VARIAX_STARTUP_INIT); 110 114 111 115 /* delay startup procedure: */ 112 - line6_start_timer(&variax->startup_timer, VARIAX_STARTUP_DELAY1, variax_startup2, (unsigned long)variax); 116 + line6_start_timer(&variax->startup_timer1, VARIAX_STARTUP_DELAY1, 117 + variax_startup2, (unsigned long)variax); 113 118 } 114 119 115 120 static void variax_startup2(unsigned long data) 116 121 { 117 122 struct usb_line6_variax *variax = (struct usb_line6_variax *)data; 118 123 struct usb_line6 *line6 = &variax->line6; 119 - CHECK_STARTUP_PROGRESS(variax->startup_progress, 2); 124 + 125 + /* schedule another startup procedure until startup is complete: */ 126 + if (variax->startup_progress >= VARIAX_STARTUP_LAST) 127 + return; 128 + 129 + variax->startup_progress = VARIAX_STARTUP_VERSIONREQ; 130 + line6_start_timer(&variax->startup_timer1, VARIAX_STARTUP_DELAY1, 131 + variax_startup2, (unsigned long)variax); 120 132 121 133 /* request firmware version: */ 122 134 line6_version_request_async(line6); ··· 132 128 133 129 static void variax_startup3(struct usb_line6_variax *variax) 134 130 { 135 - CHECK_STARTUP_PROGRESS(variax->startup_progress, 3); 131 + CHECK_STARTUP_PROGRESS(variax->startup_progress, VARIAX_STARTUP_WAIT); 136 132 137 133 /* delay startup procedure: */ 138 - line6_start_timer(&variax->startup_timer, VARIAX_STARTUP_DELAY3, variax_startup4, (unsigned long)variax); 134 + line6_start_timer(&variax->startup_timer2, VARIAX_STARTUP_DELAY3, 135 + variax_startup4, (unsigned long)variax); 139 136 } 140 137 141 138 static void variax_startup4(unsigned long data) 142 139 { 143 140 struct usb_line6_variax *variax = (struct usb_line6_variax *)data; 144 - CHECK_STARTUP_PROGRESS(variax->startup_progress, 4); 141 + CHECK_STARTUP_PROGRESS(variax->startup_progress, 142 + VARIAX_STARTUP_ACTIVATE); 145 143 146 144 /* activate device: */ 147 145 variax_activate_async(variax, 1); 148 - line6_start_timer(&variax->startup_timer, VARIAX_STARTUP_DELAY4, variax_startup5, (unsigned long)variax); 146 + line6_start_timer(&variax->startup_timer2, VARIAX_STARTUP_DELAY4, 147 + variax_startup5, (unsigned long)variax); 149 148 } 150 149 151 150 static void variax_startup5(unsigned long data) 152 151 { 153 152 struct usb_line6_variax *variax = (struct usb_line6_variax *)data; 154 - CHECK_STARTUP_PROGRESS(variax->startup_progress, 5); 153 + CHECK_STARTUP_PROGRESS(variax->startup_progress, 154 + VARIAX_STARTUP_DUMPREQ); 155 155 156 156 /* current model dump: */ 157 - line6_dump_request_async(&variax->dumpreq, &variax->line6, 0, VARIAX_DUMP_PASS1); 157 + line6_dump_request_async(&variax->dumpreq, &variax->line6, 0, 158 + VARIAX_DUMP_PASS1); 158 159 /* passes 2 and 3 are performed implicitly before entering variax_startup6 */ 159 160 } 160 161 161 162 static void variax_startup6(struct usb_line6_variax *variax) 162 163 { 163 - CHECK_STARTUP_PROGRESS(variax->startup_progress, 6); 164 + CHECK_STARTUP_PROGRESS(variax->startup_progress, 165 + VARIAX_STARTUP_WORKQUEUE); 164 166 165 167 /* schedule work for global work queue: */ 166 168 schedule_work(&variax->startup_work); ··· 174 164 175 165 static void variax_startup7(struct work_struct *work) 176 166 { 177 - struct usb_line6_variax *variax = container_of(work, struct usb_line6_variax, startup_work); 167 + struct usb_line6_variax *variax = 168 + container_of(work, struct usb_line6_variax, startup_work); 178 169 struct usb_line6 *line6 = &variax->line6; 179 170 180 - CHECK_STARTUP_PROGRESS(variax->startup_progress, 7); 171 + CHECK_STARTUP_PROGRESS(variax->startup_progress, VARIAX_STARTUP_SETUP); 181 172 182 173 /* ALSA audio interface: */ 183 174 line6_register_audio(&variax->line6); ··· 211 200 case LINE6_PROGRAM_CHANGE | LINE6_CHANNEL_DEVICE: 212 201 case LINE6_PROGRAM_CHANGE | LINE6_CHANNEL_HOST: 213 202 variax->model = buf[1]; 214 - line6_dump_request_async(&variax->dumpreq, &variax->line6, 0, VARIAX_DUMP_PASS1); 203 + line6_dump_request_async(&variax->dumpreq, &variax->line6, 0, 204 + VARIAX_DUMP_PASS1); 215 205 break; 216 206 217 207 case LINE6_RESET: ··· 226 214 VARIAX_MODEL_MESSAGE_LENGTH) { 227 215 switch (variax->dumpreq.in_progress) { 228 216 case VARIAX_DUMP_PASS1: 229 - variax_decode(buf + VARIAX_MODEL_HEADER_LENGTH, (unsigned char *)&variax->model_data, 230 - (sizeof(variax->model_data.name) + sizeof(variax->model_data.control) / 2) * 2); 231 - line6_dump_request_async(&variax->dumpreq, &variax->line6, 1, VARIAX_DUMP_PASS2); 217 + variax_decode(buf + 218 + VARIAX_MODEL_HEADER_LENGTH, 219 + (unsigned char *) 220 + &variax->model_data, 221 + (sizeof 222 + (variax->model_data. 223 + name) + 224 + sizeof(variax-> 225 + model_data. 226 + control) 227 + / 2) * 2); 228 + line6_dump_request_async 229 + (&variax->dumpreq, &variax->line6, 230 + 1, VARIAX_DUMP_PASS2); 232 231 break; 233 232 234 233 case VARIAX_DUMP_PASS2: 235 234 /* model name is transmitted twice, so skip it here: */ 236 - variax_decode(buf + VARIAX_MODEL_HEADER_LENGTH, 237 - (unsigned char *)&variax->model_data.control + sizeof(variax->model_data.control) / 2, 238 - sizeof(variax->model_data.control) / 2 * 2); 239 - line6_dump_request_async(&variax->dumpreq, &variax->line6, 2, VARIAX_DUMP_PASS3); 235 + variax_decode(buf + 236 + VARIAX_MODEL_HEADER_LENGTH, 237 + (unsigned char *) 238 + &variax-> 239 + model_data.control + 240 + sizeof(variax->model_data. 241 + control) 242 + / 2, 243 + sizeof(variax->model_data. 244 + control) 245 + / 2 * 2); 246 + line6_dump_request_async 247 + (&variax->dumpreq, &variax->line6, 248 + 2, VARIAX_DUMP_PASS3); 240 249 } 241 250 } else { 242 - DEBUG_MESSAGES(dev_err(variax->line6.ifcdev, "illegal length %d of model data\n", variax->line6.message_length)); 251 + DEBUG_MESSAGES(dev_err 252 + (variax->line6.ifcdev, 253 + "illegal length %d of model data\n", 254 + variax->line6.message_length)); 243 255 line6_dump_finished(&variax->dumpreq); 244 256 } 245 257 } else if (memcmp(buf + 1, variax_request_bank + 1, ··· 293 257 break; 294 258 295 259 default: 296 - DEBUG_MESSAGES(dev_err(variax->line6.ifcdev, "Variax: unknown message %02X\n", buf[0])); 260 + DEBUG_MESSAGES(dev_err 261 + (variax->line6.ifcdev, 262 + "Variax: unknown message %02X\n", buf[0])); 297 263 } 298 264 } 299 265 ··· 305 267 static ssize_t variax_get_volume(struct device *dev, 306 268 struct device_attribute *attr, char *buf) 307 269 { 308 - struct usb_line6_variax *variax = usb_get_intfdata(to_usb_interface(dev)); 270 + struct usb_line6_variax *variax = 271 + usb_get_intfdata(to_usb_interface(dev)); 309 272 return sprintf(buf, "%d\n", variax->volume); 310 273 } 311 274 ··· 317 278 struct device_attribute *attr, 318 279 const char *buf, size_t count) 319 280 { 320 - struct usb_line6_variax *variax = usb_get_intfdata(to_usb_interface(dev)); 281 + struct usb_line6_variax *variax = 282 + usb_get_intfdata(to_usb_interface(dev)); 321 283 unsigned long value; 322 284 int ret; 323 285 ··· 339 299 static ssize_t variax_get_model(struct device *dev, 340 300 struct device_attribute *attr, char *buf) 341 301 { 342 - struct usb_line6_variax *variax = usb_get_intfdata(to_usb_interface(dev)); 302 + struct usb_line6_variax *variax = 303 + usb_get_intfdata(to_usb_interface(dev)); 343 304 return sprintf(buf, "%d\n", variax->model); 344 305 } 345 306 ··· 351 310 struct device_attribute *attr, 352 311 const char *buf, size_t count) 353 312 { 354 - struct usb_line6_variax *variax = usb_get_intfdata(to_usb_interface(dev)); 313 + struct usb_line6_variax *variax = 314 + usb_get_intfdata(to_usb_interface(dev)); 355 315 unsigned long value; 356 316 int ret; 357 317 ··· 372 330 static ssize_t variax_get_active(struct device *dev, 373 331 struct device_attribute *attr, char *buf) 374 332 { 375 - struct usb_line6_variax *variax = usb_get_intfdata(to_usb_interface(dev)); 376 - return sprintf(buf, "%d\n", variax->buffer_activate[VARIAX_OFFSET_ACTIVATE]); 333 + struct usb_line6_variax *variax = 334 + usb_get_intfdata(to_usb_interface(dev)); 335 + return sprintf(buf, "%d\n", 336 + variax->buffer_activate[VARIAX_OFFSET_ACTIVATE]); 377 337 } 378 338 379 339 /* ··· 385 341 struct device_attribute *attr, 386 342 const char *buf, size_t count) 387 343 { 388 - struct usb_line6_variax *variax = usb_get_intfdata(to_usb_interface(dev)); 344 + struct usb_line6_variax *variax = 345 + usb_get_intfdata(to_usb_interface(dev)); 389 346 unsigned long value; 390 347 int ret; 391 348 ··· 404 359 static ssize_t variax_get_tone(struct device *dev, 405 360 struct device_attribute *attr, char *buf) 406 361 { 407 - struct usb_line6_variax *variax = usb_get_intfdata(to_usb_interface(dev)); 362 + struct usb_line6_variax *variax = 363 + usb_get_intfdata(to_usb_interface(dev)); 408 364 return sprintf(buf, "%d\n", variax->tone); 409 365 } 410 366 ··· 416 370 struct device_attribute *attr, 417 371 const char *buf, size_t count) 418 372 { 419 - struct usb_line6_variax *variax = usb_get_intfdata(to_usb_interface(dev)); 373 + struct usb_line6_variax *variax = 374 + usb_get_intfdata(to_usb_interface(dev)); 420 375 unsigned long value; 421 376 int ret; 422 377 ··· 454 407 static ssize_t variax_get_name(struct device *dev, 455 408 struct device_attribute *attr, char *buf) 456 409 { 457 - struct usb_line6_variax *variax = usb_get_intfdata(to_usb_interface(dev)); 410 + struct usb_line6_variax *variax = 411 + usb_get_intfdata(to_usb_interface(dev)); 458 412 line6_dump_wait_interruptible(&variax->dumpreq); 459 413 return get_string(buf, variax->model_data.name, 460 414 sizeof(variax->model_data.name)); ··· 467 419 static ssize_t variax_get_bank(struct device *dev, 468 420 struct device_attribute *attr, char *buf) 469 421 { 470 - struct usb_line6_variax *variax = usb_get_intfdata(to_usb_interface(dev)); 422 + struct usb_line6_variax *variax = 423 + usb_get_intfdata(to_usb_interface(dev)); 471 424 line6_dump_wait_interruptible(&variax->dumpreq); 472 425 return get_string(buf, variax->bank, sizeof(variax->bank)); 473 426 } ··· 479 430 static ssize_t variax_get_dump(struct device *dev, 480 431 struct device_attribute *attr, char *buf) 481 432 { 482 - struct usb_line6_variax *variax = usb_get_intfdata(to_usb_interface(dev)); 433 + struct usb_line6_variax *variax = 434 + usb_get_intfdata(to_usb_interface(dev)); 483 435 int retval; 484 436 retval = line6_dump_wait_interruptible(&variax->dumpreq); 485 437 if (retval < 0) ··· 496 446 static ssize_t variax_get_guitar(struct device *dev, 497 447 struct device_attribute *attr, char *buf) 498 448 { 499 - struct usb_line6_variax *variax = usb_get_intfdata(to_usb_interface(dev)); 449 + struct usb_line6_variax *variax = 450 + usb_get_intfdata(to_usb_interface(dev)); 500 451 return sprintf(buf, "%s\n", variax->guitar); 501 452 } 502 453 503 454 #ifdef CONFIG_LINE6_USB_RAW 504 455 505 - static char *variax_alloc_sysex_buffer(struct usb_line6_variax *variax, int code, int size) 456 + static char *variax_alloc_sysex_buffer(struct usb_line6_variax *variax, 457 + int code, int size) 506 458 { 507 - return line6_alloc_sysex_buffer(&variax->line6, VARIAX_SYSEX_CODE, code, size); 459 + return line6_alloc_sysex_buffer(&variax->line6, VARIAX_SYSEX_CODE, code, 460 + size); 508 461 } 509 462 510 463 /* ··· 517 464 struct device_attribute *attr, 518 465 const char *buf, size_t count) 519 466 { 520 - struct usb_line6_variax *variax = usb_get_intfdata(to_usb_interface(dev)); 467 + struct usb_line6_variax *variax = 468 + usb_get_intfdata(to_usb_interface(dev)); 521 469 int size; 522 470 int i; 523 471 char *sysex; ··· 549 495 #endif 550 496 551 497 /* Variax workbench special files: */ 552 - static DEVICE_ATTR(model, S_IWUGO | S_IRUGO, variax_get_model, variax_set_model); 553 - static DEVICE_ATTR(volume, S_IWUGO | S_IRUGO, variax_get_volume, variax_set_volume); 498 + static DEVICE_ATTR(model, S_IWUGO | S_IRUGO, variax_get_model, 499 + variax_set_model); 500 + static DEVICE_ATTR(volume, S_IWUGO | S_IRUGO, variax_get_volume, 501 + variax_set_volume); 554 502 static DEVICE_ATTR(tone, S_IWUGO | S_IRUGO, variax_get_tone, variax_set_tone); 555 503 static DEVICE_ATTR(name, S_IRUGO, variax_get_name, line6_nop_write); 556 504 static DEVICE_ATTR(bank, S_IRUGO, variax_get_bank, line6_nop_write); 557 505 static DEVICE_ATTR(dump, S_IRUGO, variax_get_dump, line6_nop_write); 558 - static DEVICE_ATTR(active, S_IWUGO | S_IRUGO, variax_get_active, variax_set_active); 506 + static DEVICE_ATTR(active, S_IWUGO | S_IRUGO, variax_get_active, 507 + variax_set_active); 559 508 static DEVICE_ATTR(guitar, S_IRUGO, variax_get_guitar, line6_nop_write); 560 509 561 510 #ifdef CONFIG_LINE6_USB_RAW 562 511 static DEVICE_ATTR(raw, S_IWUGO, line6_nop_read, line6_set_raw); 563 512 static DEVICE_ATTR(raw2, S_IWUGO, line6_nop_read, variax_set_raw2); 564 513 #endif 565 - 566 514 567 515 /* 568 516 Variax destructor. ··· 580 524 if (line6 == NULL) 581 525 return; 582 526 line6_cleanup_audio(line6); 527 + 528 + del_timer(&variax->startup_timer1); 529 + del_timer(&variax->startup_timer2); 530 + cancel_work_sync(&variax->startup_work); 583 531 584 532 /* free dump request data: */ 585 533 line6_dumpreq_destructbuf(&variax->dumpreq, 2); ··· 622 562 { 623 563 int err; 624 564 565 + init_timer(&variax->startup_timer1); 566 + init_timer(&variax->startup_timer2); 567 + INIT_WORK(&variax->startup_work, variax_startup7); 568 + 625 569 if ((interface == NULL) || (variax == NULL)) 626 570 return -ENODEV; 627 - 628 - init_timer(&variax->startup_timer); 629 - INIT_WORK(&variax->startup_work, variax_startup7); 630 571 631 572 /* initialize USB buffers: */ 632 573 err = line6_dumpreq_init(&variax->dumpreq, variax_request_model1,
+19 -9
drivers/staging/line6/variax.h
··· 1 1 /* 2 - * Line6 Linux USB driver - 0.9.0 2 + * Line6 Linux USB driver - 0.9.1beta 3 3 * 4 4 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at) 5 5 * ··· 12 12 #ifndef VARIAX_H 13 13 #define VARIAX_H 14 14 15 - 16 15 #include <linux/spinlock.h> 17 16 #include <linux/usb.h> 18 17 #include <linux/wait.h> ··· 20 21 #include "driver.h" 21 22 #include "dumprequest.h" 22 23 23 - 24 24 #define VARIAX_STARTUP_DELAY1 1000 25 25 #define VARIAX_STARTUP_DELAY3 100 26 26 #define VARIAX_STARTUP_DELAY4 100 27 27 28 + /* 29 + Stages of Variax startup procedure 30 + */ 31 + enum { 32 + VARIAX_STARTUP_INIT = 1, 33 + VARIAX_STARTUP_VERSIONREQ, 34 + VARIAX_STARTUP_WAIT, 35 + VARIAX_STARTUP_ACTIVATE, 36 + VARIAX_STARTUP_DUMPREQ, 37 + VARIAX_STARTUP_WORKQUEUE, 38 + VARIAX_STARTUP_SETUP, 39 + VARIAX_STARTUP_LAST = VARIAX_STARTUP_SETUP - 1 40 + }; 28 41 29 42 enum { 30 43 VARIAX_DUMP_PASS1 = LINE6_DUMP_CURRENT, 31 44 VARIAX_DUMP_PASS2, 32 45 VARIAX_DUMP_PASS3 33 46 }; 34 - 35 47 36 48 /** 37 49 Binary Variax model dump ··· 69 59 Dump request structure. 70 60 Append two extra buffers for 3-pass data query. 71 61 */ 72 - struct line6_dump_request dumpreq; struct line6_dump_reqbuf extrabuf[2]; 62 + struct line6_dump_request dumpreq; 63 + struct line6_dump_reqbuf extrabuf[2]; 73 64 74 65 /** 75 66 Buffer for activation code. ··· 113 102 struct work_struct startup_work; 114 103 115 104 /** 116 - Timer for device initializaton. 105 + Timers for device initializaton. 117 106 */ 118 - struct timer_list startup_timer; 107 + struct timer_list startup_timer1; 108 + struct timer_list startup_timer2; 119 109 120 110 /** 121 111 Current progress in startup procedure. ··· 124 112 int startup_progress; 125 113 }; 126 114 127 - 128 115 extern void line6_variax_disconnect(struct usb_interface *interface); 129 116 extern int line6_variax_init(struct usb_interface *interface, 130 117 struct usb_line6_variax *variax); 131 118 extern void line6_variax_process_message(struct usb_line6_variax *variax); 132 - 133 119 134 120 #endif