···11/*22- * Line6 Linux USB driver - 0.9.022+ * Line6 Linux USB driver - 0.9.1beta33 *44 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at)55 *···1515#include "driver.h"1616#include "audio.h"17171818-1918static int line6_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;2019static char *line6_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;2121-22202321/*2422 Initialize the Line6 USB audio system.···3739 strcpy(card->id, line6->properties->id);3840 strcpy(card->driver, DRIVER_NAME);3941 strcpy(card->shortname, line6->properties->name);4040- sprintf(card->longname, "Line6 %s at USB %s", line6->properties->name,4141- dev_name(line6->ifcdev)); /* 80 chars - see asound.h */4242+ sprintf(card->longname, "Line6 %s at USB %s", line6->properties->name, dev_name(line6->ifcdev)); /* 80 chars - see asound.h */4243 return 0;4344}4445
+1-4
drivers/staging/line6/audio.h
···11/*22- * Line6 Linux USB driver - 0.9.022+ * Line6 Linux USB driver - 0.9.1beta33 *44 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at)55 *···1212#ifndef AUDIO_H1313#define AUDIO_H14141515-1615#include "driver.h"1717-18161917extern void line6_cleanup_audio(struct usb_line6 *);2018extern int line6_init_audio(struct usb_line6 *);2119extern int line6_register_audio(struct usb_line6 *);2222-23202421#endif
+27-22
drivers/staging/line6/capture.c
···11/*22- * Line6 Linux USB driver - 0.9.022+ * Line6 Linux USB driver - 0.9.1beta33 *44 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at)55 *···1919#include "pcm.h"2020#include "pod.h"21212222-2322/*2423 Find a free URB and submit it.2524*/···2728 int index;2829 unsigned long flags;2930 int i, urb_size;3131+ int ret;3032 struct urb *urb_in;31333234 spin_lock_irqsave(&line6pcm->lock_audio_in, flags);···5757 urb_in->transfer_buffer_length = urb_size;5858 urb_in->context = line6pcm;59596060- if (usb_submit_urb(urb_in, GFP_ATOMIC) == 0)6060+ ret = usb_submit_urb(urb_in, GFP_ATOMIC);6161+6262+ if (ret == 0)6163 set_bit(index, &line6pcm->active_urb_in);6264 else6365 dev_err(line6pcm->line6->ifcdev,6464- "URB in #%d submission failed\n", index);6666+ "URB in #%d submission failed (%d)\n", index, ret);65676668 spin_unlock_irqrestore(&line6pcm->lock_audio_in, flags);6769 return 0;···149147150148 if (line6pcm->pos_in_done + frames > runtime->buffer_size) {151149 /*152152- The transferred area goes over buffer boundary,153153- copy two separate chunks.154154- */150150+ The transferred area goes over buffer boundary,151151+ copy two separate chunks.152152+ */155153 int len;156154 len = runtime->buffer_size - line6pcm->pos_in_done;157155···218216 int fsize;219217 struct usb_iso_packet_descriptor *fin = &urb->iso_frame_desc[i];220218221221- if (fin->status == -18) {219219+ if (fin->status == -EXDEV) {222220 shutdown = 1;223221 break;224222 }···260258 if (!shutdown) {261259 submit_audio_in_urb(line6pcm);262260263263- if (test_bit(BIT_PCM_ALSA_CAPTURE, &line6pcm->flags))264264- line6_capture_check_period(line6pcm, length);261261+#ifdef CONFIG_LINE6_USB_IMPULSE_RESPONSE262262+ if (!(line6pcm->flags & MASK_PCM_IMPULSE))263263+#endif264264+ if (test_bit(BIT_PCM_ALSA_CAPTURE, &line6pcm->flags))265265+ line6_capture_check_period(line6pcm, length);265266 }266267}267268···277272278273 err = snd_pcm_hw_constraint_ratdens(runtime, 0,279274 SNDRV_PCM_HW_PARAM_RATE,280280- (&line6pcm->properties->281281- snd_line6_rates));275275+ (&line6pcm->276276+ properties->snd_line6_rates));282277 if (err < 0)283278 return err;284279···371366372367/* capture operators */373368struct snd_pcm_ops snd_line6_capture_ops = {374374- .open = snd_line6_capture_open,375375- .close = snd_line6_capture_close,376376- .ioctl = snd_pcm_lib_ioctl,377377- .hw_params = snd_line6_capture_hw_params,378378- .hw_free = snd_line6_capture_hw_free,379379- .prepare = snd_line6_prepare,380380- .trigger = snd_line6_trigger,381381- .pointer = snd_line6_capture_pointer,369369+ .open = snd_line6_capture_open,370370+ .close = snd_line6_capture_close,371371+ .ioctl = snd_pcm_lib_ioctl,372372+ .hw_params = snd_line6_capture_hw_params,373373+ .hw_free = snd_line6_capture_hw_free,374374+ .prepare = snd_line6_prepare,375375+ .trigger = snd_line6_trigger,376376+ .pointer = snd_line6_capture_pointer,382377};383378384379int line6_create_audio_in_urbs(struct snd_line6_pcm *line6pcm)···401396 urb->dev = line6pcm->line6->usbdev;402397 urb->pipe =403398 usb_rcvisocpipe(line6pcm->line6->usbdev,404404- line6pcm->405405- ep_audio_read & USB_ENDPOINT_NUMBER_MASK);399399+ line6pcm->ep_audio_read &400400+ USB_ENDPOINT_NUMBER_MASK);406401 urb->transfer_flags = URB_ISO_ASAP;407402 urb->start_frame = -1;408403 urb->number_of_packets = LINE6_ISO_PACKETS;
+3-3
drivers/staging/line6/capture.h
···11/*22- * Line6 Linux USB driver - 0.9.022+ * Line6 Linux USB driver - 0.9.1beta33 *44 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at)55 *···1212#ifndef CAPTURE_H1313#define CAPTURE_H14141515-1615#include <sound/pcm.h>17161817#include "driver.h"1918#include "pcm.h"20192121-2220extern struct snd_pcm_ops snd_line6_capture_ops;23212422extern void line6_capture_copy(struct snd_line6_pcm *line6pcm, char *fbuf,2523 int fsize);2424+extern void line6_capture_check_period(struct snd_line6_pcm *line6pcm,2525+ int length);2626extern int line6_create_audio_in_urbs(struct snd_line6_pcm *line6pcm);2727extern int line6_submit_audio_in_all_urbs(struct snd_line6_pcm *line6pcm);2828extern void line6_unlink_audio_in_urbs(struct snd_line6_pcm *line6pcm);
+1-1
drivers/staging/line6/control.c
···11/*22- * Line6 Linux USB driver - 0.9.022+ * Line6 Linux USB driver - 0.9.1beta33 *44 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at)55 *
+8-4
drivers/staging/line6/control.h
···11/*22- * Line6 Linux USB driver - 0.9.022+ * Line6 Linux USB driver - 0.9.1beta33 *44 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at)55 *···2222 from "control.h", and this process depends on the exact formatting of the2323 code and the comments below!2424*/2525+2526/* *INDENT-OFF* */2727+2628enum {2729 POD_tweak = 1,2830 POD_wah_position = 4,···183181 VARIAXMIDI_tone = 79,184182};185183184184+/* *INDENT-ON* */186185187186extern int line6_pod_create_files(int firmware, int type, struct device *dev);188187extern void line6_pod_remove_files(int firmware, int type, struct device *dev);189189-extern int line6_variax_create_files(int firmware, int type, struct device *dev);190190-extern void line6_variax_remove_files(int firmware, int type, struct device *dev);191191-188188+extern int line6_variax_create_files(int firmware, int type,189189+ struct device *dev);190190+extern void line6_variax_remove_files(int firmware, int type,191191+ struct device *dev);192192193193#endif
+136-81
drivers/staging/line6/driver.c
···11/*22- * Line6 Linux USB driver - 0.9.022+ * Line6 Linux USB driver - 0.9.1beta33 *44 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at)55 *···2626#include "usbdefs.h"2727#include "variax.h"28282929-3029#define DRIVER_AUTHOR "Markus Grabner <grabner@icg.tugraz.at>"3130#define DRIVER_DESC "Line6 USB Driver"3232-#define DRIVER_VERSION "0.9.0"3333-3131+#define DRIVER_VERSION "0.9.1beta" DRIVER_REVISION34323533/* table of devices that work with this driver */3634static const struct usb_device_id line6_id_table[] = {3737- { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_BASSPODXT) },3838- { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_BASSPODXTLIVE) },3939- { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_BASSPODXTPRO) },4040- { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_GUITARPORT) },4141- { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_POCKETPOD) },4242- { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODSTUDIO_GX) },4343- { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODSTUDIO_UX1) },4444- { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODSTUDIO_UX2) },4545- { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODX3) },4646- { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODX3LIVE) },4747- { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODXT) },4848- { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODXTLIVE) },4949- { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODXTPRO) },5050- { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_TONEPORT_GX) },5151- { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_TONEPORT_UX1) },5252- { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_TONEPORT_UX2) },5353- { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_VARIAX) },5454- { },3535+ {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_BASSPODXT)},3636+ {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_BASSPODXTLIVE)},3737+ {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_BASSPODXTPRO)},3838+ {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_GUITARPORT)},3939+ {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_POCKETPOD)},4040+ {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODSTUDIO_GX)},4141+ {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODSTUDIO_UX1)},4242+ {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODSTUDIO_UX2)},4343+ {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODX3)},4444+ {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODX3LIVE)},4545+ {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODXT)},4646+ {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODXTLIVE)},4747+ {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODXTPRO)},4848+ {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_TONEPORT_GX)},4949+ {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_TONEPORT_UX1)},5050+ {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_TONEPORT_UX2)},5151+ {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_VARIAX)},5252+ {},5553};5454+5655MODULE_DEVICE_TABLE(usb, line6_id_table);57565757+/* *INDENT-OFF* */5858static struct line6_properties line6_properties_table[] = {5959 { "BassPODxt", "BassPODxt", LINE6_BIT_BASSPODXT, LINE6_BIT_CONTROL_PCM_HWMON },6060 { "BassPODxtLive", "BassPODxt Live", LINE6_BIT_BASSPODXTLIVE, LINE6_BIT_CONTROL_PCM_HWMON },···7474 { "TonePortUX2", "TonePort UX2", LINE6_BIT_TONEPORT_UX2, LINE6_BIT_PCM },7575 { "Variax", "Variax Workbench", LINE6_BIT_VARIAX, LINE6_BIT_CONTROL }7676};7777-7777+/* *INDENT-ON* */78787979/*8080 This is Line6's MIDI manufacturer ID.···9696*/9797static const char *line6_request_version;98989999-10099struct usb_line6 *line6_devices[LINE6_MAX_DEVICES];101101-102100103101/**104102 Class for asynchronous messages.···108110 int done;109111};110112111111-112113/*113114 Forward declarations.114115*/115116static void line6_data_received(struct urb *urb);116117static int line6_send_raw_message_async_part(struct message *msg,117118 struct urb *urb);118118-119119120120/*121121 Start to listen on endpoint.···126130 line6->buffer_listen, LINE6_BUFSIZE_LISTEN,127131 line6_data_received, line6, line6->interval);128132 line6->urb_listen->actual_length = 0;129129- err = usb_submit_urb(line6->urb_listen, GFP_KERNEL);133133+ err = usb_submit_urb(line6->urb_listen, GFP_ATOMIC);130134 return err;131135}132136···162166 if (j < n) {163167 unsigned char val = buffer[i + j];164168 bytes = snprintf(p, hexdumpsize, " %02X", val);165165- asc[j] = ((val >= 0x20) && (val < 0x7f)) ? val : '.';169169+ asc[j] = ((val >= 0x20)170170+ && (val < 0x7f)) ? val : '.';166171 } else167172 bytes = snprintf(p, hexdumpsize, " ");168173169174 if (bytes > hexdumpsize)170170- break; /* buffer overflow */175175+ break; /* buffer overflow */171176172177 p += bytes;173178 hexdumpsize -= bytes;···283286 Setup and start timer.284287*/285288void line6_start_timer(struct timer_list *timer, unsigned int msecs,286286- void (*function)(unsigned long), unsigned long data)289289+ void (*function) (unsigned long), unsigned long data)287290{288291 setup_timer(timer, function, data);289292 timer->expires = jiffies + msecs * HZ / 1000;···331334*/332335int line6_version_request_async(struct usb_line6 *line6)333336{334334- return line6_send_raw_message_async(line6, line6_request_version, sizeof(line6_request_version0));337337+ return line6_send_raw_message_async(line6, line6_request_version,338338+ sizeof(line6_request_version0));335339}336340337341/*···341343int line6_send_sysex_message(struct usb_line6 *line6, const char *buffer,342344 int size)343345{344344- return line6_send_raw_message(line6, buffer, size + SYSEX_EXTRA_SIZE) - SYSEX_EXTRA_SIZE;346346+ return line6_send_raw_message(line6, buffer,347347+ size + SYSEX_EXTRA_SIZE) -348348+ SYSEX_EXTRA_SIZE;345349}346350347351/*···352352int line6_send_sysex_message_async(struct usb_line6 *line6, const char *buffer,353353 int size)354354{355355- return line6_send_raw_message_async(line6, buffer, size + SYSEX_EXTRA_SIZE) - SYSEX_EXTRA_SIZE;355355+ return line6_send_raw_message_async(line6, buffer,356356+ size + SYSEX_EXTRA_SIZE) -357357+ SYSEX_EXTRA_SIZE;356358}357359358360/*···396394 line6_dump_urb(urb);397395#endif398396399399- done = line6_midibuf_write(mb, urb->transfer_buffer, urb->actual_length);397397+ done =398398+ line6_midibuf_write(mb, urb->transfer_buffer, urb->actual_length);400399401400 if (done < urb->actual_length) {402401 line6_midibuf_ignore(mb, done);403403- DEBUG_MESSAGES(dev_err(line6->ifcdev, "%d %d buffer overflow - message skipped\n", done, urb->actual_length));402402+ DEBUG_MESSAGES(dev_err403403+ (line6->ifcdev,404404+ "%d %d buffer overflow - message skipped\n",405405+ done, urb->actual_length));404406 }405407406408 for (;;) {407407- done = line6_midibuf_read(mb, line6->buffer_message, LINE6_MESSAGE_MAXLEN);409409+ done =410410+ line6_midibuf_read(mb, line6->buffer_message,411411+ LINE6_MESSAGE_MAXLEN);408412409413 if (done == 0)410414 break;411415412416 /* MIDI input filter */413413- if (line6_midibuf_skip_message(mb, line6->line6midi->midi_mask_receive))417417+ if (line6_midibuf_skip_message418418+ (mb, line6->line6midi->midi_mask_receive))414419 continue;415420416421 line6->message_length = done;···433424 case LINE6_DEVID_PODXT:434425 case LINE6_DEVID_PODXTPRO:435426 case LINE6_DEVID_POCKETPOD:436436- line6_pod_process_message((struct usb_line6_pod *)line6);427427+ line6_pod_process_message((struct usb_line6_pod *)428428+ line6);437429 break;438430439431 case LINE6_DEVID_PODXTLIVE:440432 switch (line6->interface_number) {441433 case PODXTLIVE_INTERFACE_POD:442442- line6_pod_process_message((struct usb_line6_pod *)line6);434434+ line6_pod_process_message((struct usb_line6_pod435435+ *)line6);443436 break;444437445438 case PODXTLIVE_INTERFACE_VARIAX:446446- line6_variax_process_message((struct usb_line6_variax *)line6);439439+ line6_variax_process_message((struct440440+ usb_line6_variax441441+ *)line6);447442 break;448443449444 default:450450- dev_err(line6->ifcdev, "PODxt Live interface %d not supported\n", line6->interface_number);445445+ dev_err(line6->ifcdev,446446+ "PODxt Live interface %d not supported\n",447447+ line6->interface_number);451448 }452449 break;453450454451 case LINE6_DEVID_VARIAX:455455- line6_variax_process_message((struct usb_line6_variax *)line6);452452+ line6_variax_process_message((struct usb_line6_variax *)453453+ line6);456454 break;457455458456 default:···499483 buffer, 2, &partial, LINE6_TIMEOUT * HZ);500484501485 if (retval)502502- dev_err(line6->ifcdev, "usb_interrupt_msg failed (%d)\n", retval);486486+ dev_err(line6->ifcdev, "usb_interrupt_msg failed (%d)\n",487487+ retval);503488504489 kfree(buffer);505490 return retval;···531514#endif532515533516 retval = usb_interrupt_msg(line6->usbdev,534534- usb_sndintpipe(line6->usbdev, line6->ep_control_write),517517+ usb_sndintpipe(line6->usbdev,518518+ line6->ep_control_write),535519 buffer, 3, &partial, LINE6_TIMEOUT * HZ);536520537521 if (retval)538538- dev_err(line6->ifcdev, "usb_interrupt_msg failed (%d)\n", retval);522522+ dev_err(line6->ifcdev, "usb_interrupt_msg failed (%d)\n",523523+ retval);539524540525 kfree(buffer);541526 return retval;···546527/*547528 Read data from device.548529*/549549-int line6_read_data(struct usb_line6 *line6, int address, void *data, size_t datalen)530530+int line6_read_data(struct usb_line6 *line6, int address, void *data,531531+ size_t datalen)550532{551533 struct usb_device *usbdev = line6->usbdev;552534 int ret;···635615 return ret;636616 }637617 }638638- while (status == 0xff)639639- ;618618+ while (status == 0xff);640619641620 if (status != 0) {642621 dev_err(line6->ifcdev, "write failed (error %d)\n", ret);···651632*/652633int line6_read_serial_number(struct usb_line6 *line6, int *serial_number)653634{654654- return line6_read_data(line6, 0x80d0, serial_number, sizeof(*serial_number));635635+ return line6_read_data(line6, 0x80d0, serial_number,636636+ sizeof(*serial_number));655637}656638657639/*···667647/*668648 No operation (i.e., unsupported).669649*/670670-ssize_t line6_nop_write(struct device *dev, struct device_attribute *attr,650650+ssize_t line6_nop_write(struct device * dev, struct device_attribute * attr,671651 const char *buf, size_t count)672652{673653 return count;···677657 "write" request on "raw" special file.678658*/679659#ifdef CONFIG_LINE6_USB_RAW680680-ssize_t line6_set_raw(struct device *dev, struct device_attribute *attr,660660+ssize_t line6_set_raw(struct device * dev, struct device_attribute * attr,681661 const char *buf, size_t count)682662{683663 struct usb_interface *interface = to_usb_interface(dev);···717697/*718698 Probe USB device.719699*/720720-static int line6_probe(struct usb_interface *interface, const struct usb_device_id *id)700700+static int line6_probe(struct usb_interface *interface,701701+ const struct usb_device_id *id)721702{722703 int devtype;723704 struct usb_device *usbdev = NULL;···786765 case LINE6_DEVID_POCKETPOD:787766 switch (interface_number) {788767 case 0:789789- return 0; /* this interface has no endpoints */768768+ return 0; /* this interface has no endpoints */790769 case 1:791770 alternate = 0;792771 break;···821800 case LINE6_DEVID_PODSTUDIO_UX1:822801 case LINE6_DEVID_TONEPORT_GX:823802 case LINE6_DEVID_TONEPORT_UX1:824824- alternate = 2; /* 1..4 seem to be ok */803803+ alternate = 2; /* 1..4 seem to be ok */825804 break;826805827806 case LINE6_DEVID_TONEPORT_UX2:···833812 break;834813 case 1:835814 /* don't know yet what this is ...836836- alternate = 1;837837- break;838838- */815815+ alternate = 1;816816+ break;817817+ */839818 return -ENODEV;840819 default:841820 MISSING_CASE;···862841 case LINE6_DEVID_PODXT:863842 case LINE6_DEVID_PODXTPRO:864843 size = sizeof(struct usb_line6_pod);865865- ep_read = 0x84;844844+ ep_read = 0x84;866845 ep_write = 0x03;867846 break;868847869848 case LINE6_DEVID_POCKETPOD:870849 size = sizeof(struct usb_line6_pod);871871- ep_read = 0x82;850850+ ep_read = 0x82;872851 ep_write = 0x02;873852 break;874853···876855 case LINE6_DEVID_PODX3LIVE:877856 /* currently unused! */878857 size = sizeof(struct usb_line6_pod);879879- ep_read = 0x81;858858+ ep_read = 0x81;880859 ep_write = 0x01;881860 break;882861···895874 switch (interface_number) {896875 case PODXTLIVE_INTERFACE_POD:897876 size = sizeof(struct usb_line6_pod);898898- ep_read = 0x84;877877+ ep_read = 0x84;899878 ep_write = 0x03;900879 break;901880902881 case PODXTLIVE_INTERFACE_VARIAX:903882 size = sizeof(struct usb_line6_variax);904904- ep_read = 0x86;883883+ ep_read = 0x86;905884 ep_write = 0x05;906885 break;907886···913892914893 case LINE6_DEVID_VARIAX:915894 size = sizeof(struct usb_line6_variax);916916- ep_read = 0x82;895895+ ep_read = 0x82;917896 ep_write = 0x01;918897 break;919898···924903 }925904926905 if (size == 0) {927927- dev_err(line6->ifcdev, "driver bug: interface data size not set\n");906906+ dev_err(line6->ifcdev,907907+ "driver bug: interface data size not set\n");928908 ret = -ENODEV;929909 goto err_put;930910 }···950928 /* get data from endpoint descriptor (see usb_maxpacket): */951929 {952930 struct usb_host_endpoint *ep;953953- unsigned epnum = usb_pipeendpoint(usb_rcvintpipe(usbdev, ep_read));931931+ unsigned epnum =932932+ usb_pipeendpoint(usb_rcvintpipe(usbdev, ep_read));954933 ep = usbdev->ep_in[epnum];955934956935 if (ep != NULL) {957936 line6->interval = ep->desc.bInterval;958958- line6->max_packet_size = le16_to_cpu(ep->desc.wMaxPacketSize);937937+ line6->max_packet_size =938938+ le16_to_cpu(ep->desc.wMaxPacketSize);959939 } else {960940 line6->interval = LINE6_FALLBACK_INTERVAL;961941 line6->max_packet_size = LINE6_FALLBACK_MAXPACKETSIZE;962962- dev_err(line6->ifcdev, "endpoint not available, using fallback values");942942+ dev_err(line6->ifcdev,943943+ "endpoint not available, using fallback values");963944 }964945 }965946···970945971946 if (properties->capabilities & LINE6_BIT_CONTROL) {972947 /* initialize USB buffers: */973973- line6->buffer_listen = kmalloc(LINE6_BUFSIZE_LISTEN, GFP_KERNEL);948948+ line6->buffer_listen =949949+ kmalloc(LINE6_BUFSIZE_LISTEN, GFP_KERNEL);974950975951 if (line6->buffer_listen == NULL) {976952 dev_err(&interface->dev, "Out of memory\n");···979953 goto err_destruct;980954 }981955982982- line6->buffer_message = kmalloc(LINE6_MESSAGE_MAXLEN, GFP_KERNEL);956956+ line6->buffer_message =957957+ kmalloc(LINE6_MESSAGE_MAXLEN, GFP_KERNEL);983958984959 if (line6->buffer_message == NULL) {985960 dev_err(&interface->dev, "Out of memory\n");···1021994 case LINE6_DEVID_PODXTLIVE:1022995 switch (interface_number) {1023996 case PODXTLIVE_INTERFACE_POD:10241024- ret = line6_pod_init(interface, (struct usb_line6_pod *)line6);997997+ ret =998998+ line6_pod_init(interface,999999+ (struct usb_line6_pod *)line6);10251000 break;1026100110271002 case PODXTLIVE_INTERFACE_VARIAX:10281028- ret = line6_variax_init(interface, (struct usb_line6_variax *)line6);10031003+ ret =10041004+ line6_variax_init(interface,10051005+ (struct usb_line6_variax *)line6);10291006 break;1030100710311008 default:···10421011 break;1043101210441013 case LINE6_DEVID_VARIAX:10451045- ret = line6_variax_init(interface, (struct usb_line6_variax *)line6);10141014+ ret =10151015+ line6_variax_init(interface,10161016+ (struct usb_line6_variax *)line6);10461017 break;1047101810481019 case LINE6_DEVID_PODSTUDIO_GX:···10541021 case LINE6_DEVID_TONEPORT_UX1:10551022 case LINE6_DEVID_TONEPORT_UX2:10561023 case LINE6_DEVID_GUITARPORT:10571057- ret = line6_toneport_init(interface, (struct usb_line6_toneport *)line6);10241024+ ret =10251025+ line6_toneport_init(interface,10261026+ (struct usb_line6_toneport *)line6);10581027 break;1059102810601029 default:···10781043 line6->properties->name);10791044 line6_devices[devnum] = line6;1080104510811081- switch(product) {10461046+ switch (product) {10821047 case LINE6_DEVID_PODX3:10831048 case LINE6_DEVID_PODX3LIVE:10841084- dev_info(&interface->dev, "NOTE: the Line6 %s is detected, but not yet supported\n",10491049+ dev_info(&interface->dev,10501050+ "NOTE: the Line6 %s is detected, but not yet supported\n",10851051 line6->properties->name);10861052 }10871053···11731137 MISSING_CASE;11741138 }1175113911761176- dev_info(&interface->dev, "Line6 %s now disconnected\n", line6->properties->name);11401140+ dev_info(&interface->dev, "Line6 %s now disconnected\n",11411141+ line6->properties->name);1177114211781143 for (i = LINE6_MAX_DEVICES; i--;)11791144 if (line6_devices[i] == line6)···12471210 return line6_resume(interface);12481211}1249121212501250-#endif /* CONFIG_PM */12131213+#endif /* CONFIG_PM */1251121412521215static struct usb_driver line6_driver = {12531216 .name = DRIVER_NAME,···12681231{12691232 int i, retval;1270123312711271- printk(KERN_INFO "%s driver version %s%s\n",12721272- DRIVER_NAME, DRIVER_VERSION, DRIVER_REVISION);12341234+ printk(KERN_INFO "%s driver version %s\n", DRIVER_NAME, DRIVER_VERSION);1273123512741236 for (i = LINE6_MAX_DEVICES; i--;)12751237 line6_devices[i] = NULL;···12991263*/13001264static void __exit line6_exit(void)13011265{13021302- kfree(line6_request_version);12661266+ int i;12671267+ struct usb_line6 *line6;12681268+ struct snd_line6_pcm *line6pcm;12691269+12701270+ /* stop all PCM channels */12711271+ for (i = LINE6_MAX_DEVICES; i--;) {12721272+ line6 = line6_devices[i];12731273+12741274+ if (line6 == NULL)12751275+ continue;12761276+12771277+ line6pcm = line6->line6pcm;12781278+12791279+ if (line6pcm == NULL)12801280+ continue;12811281+12821282+ line6_pcm_stop(line6pcm, ~0);12831283+ }12841284+13031285 usb_deregister(&line6_driver);12861286+ kfree(line6_request_version);13041287}1305128813061289module_init(line6_init);
+4-11
drivers/staging/line6/driver.h
···11/*22- * Line6 Linux USB driver - 0.9.022+ * Line6 Linux USB driver - 0.9.1beta33 *44 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at)55 *···1212#ifndef DRIVER_H1313#define DRIVER_H14141515-1615#include <linux/spinlock.h>1716#include <linux/usb.h>1817#include <sound/core.h>19182019#include "midi.h"2121-22202321#define DRIVER_NAME "line6usb"2422···4951*/5052#define LINE6_CHANNEL_DEVICE 0x0251535252-#define LINE6_CHANNEL_UNKNOWN 5 /* don't know yet what this is good for */5454+#define LINE6_CHANNEL_UNKNOWN 5 /* don't know yet what this is good for */53555456#define LINE6_CHANNEL_MASK 0x0f5557···5961#define DEBUG_MESSAGES(x)6062#endif61636262-6364#define MISSING_CASE \6465 printk(KERN_ERR "line6usb driver bug: missing case in %s:%d\n", \6566 __FILE__, __LINE__)6666-67676868#define CHECK_RETURN(x) \6969do { \···7579 return; \7680 x = (n);77817878-7982extern const unsigned char line6_midi_id[3];8083extern struct usb_line6 *line6_devices[LINE6_MAX_DEVICES];81848285static const int SYSEX_DATA_OFS = sizeof(line6_midi_id) + 3;8386static const int SYSEX_EXTRA_SIZE = sizeof(line6_midi_id) + 4;8484-85878688/**8789 Common properties of Line6 devices.···196202 int message_length;197203};198204199199-200205extern char *line6_alloc_sysex_buffer(struct usb_line6 *line6, int code1,201206 int code2, int size);202207extern ssize_t line6_nop_read(struct device *dev,···219226extern ssize_t line6_set_raw(struct device *dev, struct device_attribute *attr,220227 const char *buf, size_t count);221228extern void line6_start_timer(struct timer_list *timer, unsigned int msecs,222222- void (*function)(unsigned long), unsigned long data);229229+ void (*function) (unsigned long),230230+ unsigned long data);223231extern int line6_transmit_parameter(struct usb_line6 *line6, int param,224232 int value);225233extern int line6_version_request_async(struct usb_line6 *line6);···231237extern void line6_write_hexdump(struct usb_line6 *line6, char dir,232238 const unsigned char *buffer, int size);233239#endif234234-235240236241#endif
+6-4
drivers/staging/line6/dumprequest.c
···11/*22- * Line6 Linux USB driver - 0.9.022+ * Line6 Linux USB driver - 0.9.1beta33 *44 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at)55 *···13131414#include "driver.h"1515#include "dumprequest.h"1616-17161817/*1918 Set "dump in progress" flag.···6263*/6364int line6_dump_wait_interruptible(struct line6_dump_request *l6dr)6465{6565- return wait_event_interruptible(l6dr->wait, l6dr->in_progress == LINE6_DUMP_NONE);6666+ return wait_event_interruptible(l6dr->wait,6767+ l6dr->in_progress == LINE6_DUMP_NONE);6668}67696870/*···7979*/8080int line6_dump_wait_timeout(struct line6_dump_request *l6dr, long timeout)8181{8282- return wait_event_timeout(l6dr->wait, l6dr->in_progress == LINE6_DUMP_NONE, timeout);8282+ return wait_event_timeout(l6dr->wait,8383+ l6dr->in_progress == LINE6_DUMP_NONE,8484+ timeout);8385}84868587/*
+1-5
drivers/staging/line6/dumprequest.h
···11/*22- * Line6 Linux USB driver - 0.9.022+ * Line6 Linux USB driver - 0.9.1beta33 *44 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at)55 *···1212#ifndef DUMPREQUEST_H1313#define DUMPREQUEST_H14141515-1615#include <linux/usb.h>1716#include <linux/wait.h>1817#include <sound/core.h>1919-20182119enum {2220 LINE6_DUMP_NONE,2321 LINE6_DUMP_CURRENT2422};2525-26232724struct line6_dump_reqbuf {2825 /**···7275extern int line6_dump_wait_interruptible(struct line6_dump_request *l6dr);7376extern int line6_dump_wait_timeout(struct line6_dump_request *l6dr,7477 long timeout);7575-76787779#endif
···11/*22- * Line6 Linux USB driver - 0.9.022+ * Line6 Linux USB driver - 0.9.1beta33 *44 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at)55 *···1212#ifndef MIDI_H1313#define MIDI_H14141515-1615#include <sound/rawmidi.h>17161817#include "midibuf.h"19182020-2119#define MIDI_BUFFER_SIZE 10242222-23202421struct snd_line6_midi {2522 /**···7578 struct MidiBuffer midibuf_out;7679};77807878-7981extern int line6_init_midi(struct usb_line6 *line6);8082extern void line6_midi_receive(struct usb_line6 *line6, unsigned char *data,8183 int length);8282-83848485#endif
+22-18
drivers/staging/line6/midibuf.c
···11/*22- * Line6 Linux USB driver - 0.9.022+ * Line6 Linux USB driver - 0.9.1beta33 *44 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at)55 *···13131414#include "midibuf.h"15151616-1716static int midibuf_message_length(unsigned char code)1817{1918 if (code < 0x80)···2223 return length[(code >> 4) - 8];2324 } else {2425 /*2525- Note that according to the MIDI specification 0xf2 is2626- the "Song Position Pointer", but this is used by Line62727- to send sysex messages to the host.2828- */2626+ Note that according to the MIDI specification 0xf2 is2727+ the "Song Position Pointer", but this is used by Line62828+ to send sysex messages to the host.2929+ */2930 static const int length[] = { -1, 2, -1, 2, -1, -1, 1, 1, 1, 1,3030- 1, 1, 1, -1, 1, 1 };3131+ 1, 1, 1, -1, 1, 13232+ };3133 return length[code & 0x0f];3234 }3335}···7272int line6_midibuf_bytes_free(struct MidiBuffer *this)7373{7474 return7575- midibuf_is_full(this) ?7676- 0 :7777- (this->pos_read - this->pos_write + this->size - 1) % this->size + 1;7575+ midibuf_is_full(this) ?7676+ 0 :7777+ (this->pos_read - this->pos_write + this->size - 1) % this->size +7878+ 1;7879}79808081int line6_midibuf_bytes_used(struct MidiBuffer *this)8182{8283 return8383- midibuf_is_empty(this) ?8484- 0 :8585- (this->pos_write - this->pos_read + this->size - 1) % this->size + 1;8484+ midibuf_is_empty(this) ?8585+ 0 :8686+ (this->pos_write - this->pos_read + this->size - 1) % this->size +8787+ 1;8688}87898888-int line6_midibuf_write(struct MidiBuffer *this, unsigned char *data, int length)9090+int line6_midibuf_write(struct MidiBuffer *this, unsigned char *data,9191+ int length)8992{9093 int bytes_free;9194 int length1, length2;···161158 this->command_prev = command;162159 } else {163160 if (this->command_prev > 0) {164164- int midi_length_prev = midibuf_message_length(this->command_prev);161161+ int midi_length_prev =162162+ midibuf_message_length(this->command_prev);165163166164 if (midi_length_prev > 0) {167165 midi_length = midi_length_prev - 1;···202198 }203199204200 if (midi_length == length)205205- midi_length = -1; /* end of message not found */201201+ midi_length = -1; /* end of message not found */206202 }207203208204 if (midi_length < 0) {209205 if (!this->split)210210- return 0; /* command is not yet complete */206206+ return 0; /* command is not yet complete */211207 } else {212208 if (length < midi_length)213213- return 0; /* command is not yet complete */209209+ return 0; /* command is not yet complete */214210215211 length = midi_length;216212 }
+5-6
drivers/staging/line6/midibuf.h
···11/*22- * Line6 Linux USB driver - 0.9.022+ * Line6 Linux USB driver - 0.9.1beta33 *44 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at)55 *···1212#ifndef MIDIBUF_H1313#define MIDIBUF_H14141515-1615struct MidiBuffer {1716 unsigned char *buf;1817 int size;···2122 int command_prev;2223};23242424-2525extern int line6_midibuf_bytes_used(struct MidiBuffer *mb);2626extern int line6_midibuf_bytes_free(struct MidiBuffer *mb);2727extern void line6_midibuf_destroy(struct MidiBuffer *mb);2828extern int line6_midibuf_ignore(struct MidiBuffer *mb, int length);2929extern int line6_midibuf_init(struct MidiBuffer *mb, int size, int split);3030-extern int line6_midibuf_read(struct MidiBuffer *mb, unsigned char *data, int length);3030+extern int line6_midibuf_read(struct MidiBuffer *mb, unsigned char *data,3131+ int length);3132extern void line6_midibuf_reset(struct MidiBuffer *mb);3232-extern int line6_midibuf_skip_message(struct MidiBuffer *mb, unsigned short mask);3333+extern int line6_midibuf_skip_message(struct MidiBuffer *mb,3434+ unsigned short mask);3335extern void line6_midibuf_status(struct MidiBuffer *mb);3436extern int line6_midibuf_write(struct MidiBuffer *mb, unsigned char *data,3537 int length);3636-37383839#endif
+73-59
drivers/staging/line6/pcm.c
···11/*22- * Line6 Linux USB driver - 0.9.022+ * Line6 Linux USB driver - 0.9.1beta33 *44 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at)55 *···2121#include "playback.h"2222#include "pod.h"23232424-2524#ifdef CONFIG_LINE6_USB_IMPULSE_RESPONSE26252727-static struct snd_line6_pcm* dev2pcm(struct device *dev)2626+static struct snd_line6_pcm *dev2pcm(struct device *dev)2827{2928 struct usb_interface *interface = to_usb_interface(dev);3029 struct usb_line6 *line6 = usb_get_intfdata(interface);···3536 "read" request on "impulse_volume" special file.3637*/3738static ssize_t pcm_get_impulse_volume(struct device *dev,3838- struct device_attribute *attr,3939- char *buf)3939+ struct device_attribute *attr, char *buf)4040{4141 return sprintf(buf, "%d\n", dev2pcm(dev)->impulse_volume);4242}···5153 int value = simple_strtoul(buf, NULL, 10);5254 line6pcm->impulse_volume = value;53555454- if(value > 0)5656+ if (value > 0)5557 line6_pcm_start(line6pcm, MASK_PCM_IMPULSE);5658 else5759 line6_pcm_stop(line6pcm, MASK_PCM_IMPULSE);···6365 "read" request on "impulse_period" special file.6466*/6567static ssize_t pcm_get_impulse_period(struct device *dev,6666- struct device_attribute *attr,6767- char *buf)6868+ struct device_attribute *attr, char *buf)6869{6970 return sprintf(buf, "%d\n", dev2pcm(dev)->impulse_period);7071}···7982 return count;8083}81848282-static DEVICE_ATTR(impulse_volume, S_IWUGO | S_IRUGO, pcm_get_impulse_volume, pcm_set_impulse_volume);8383-static DEVICE_ATTR(impulse_period, S_IWUGO | S_IRUGO, pcm_get_impulse_period, pcm_set_impulse_period);8585+static DEVICE_ATTR(impulse_volume, S_IWUGO | S_IRUGO, pcm_get_impulse_volume,8686+ pcm_set_impulse_volume);8787+static DEVICE_ATTR(impulse_period, S_IWUGO | S_IRUGO, pcm_get_impulse_period,8888+ pcm_set_impulse_period);84898590#endif86918792int line6_pcm_start(struct snd_line6_pcm *line6pcm, int channels)8893{8989- unsigned long flags_old = __sync_fetch_and_or(&line6pcm->flags, channels);9494+ unsigned long flags_old =9595+ __sync_fetch_and_or(&line6pcm->flags, channels);9096 unsigned long flags_new = flags_old | channels;9197 int err = 0;92989399#if LINE6_BACKUP_MONITOR_SIGNAL94100 if (!(line6pcm->line6->properties->capabilities & LINE6_BIT_HWMON)) {9595- line6pcm->prev_fbuf = kmalloc(LINE6_ISO_PACKETS * line6pcm->max_packet_size, GFP_KERNEL);101101+ line6pcm->prev_fbuf =102102+ kmalloc(LINE6_ISO_PACKETS * line6pcm->max_packet_size,103103+ GFP_KERNEL);9610497105 if (!line6pcm->prev_fbuf) {9898- dev_err(line6pcm->line6->ifcdev, "cannot malloc monitor buffer\n");106106+ dev_err(line6pcm->line6->ifcdev,107107+ "cannot malloc monitor buffer\n");99108 return -ENOMEM;100109 }101110 }102111#else103112 line6pcm->prev_fbuf = NULL;104113#endif105105-114114+106115 if (((flags_old & MASK_CAPTURE) == 0) &&107116 ((flags_new & MASK_CAPTURE) != 0)) {108117 /*109109- Waiting for completion of active URBs in the stop handler is110110- a bug, we therefore report an error if capturing is restarted111111- too soon.112112- */113113- if(line6pcm->active_urb_in | line6pcm->unlink_urb_in)118118+ Waiting for completion of active URBs in the stop handler is119119+ a bug, we therefore report an error if capturing is restarted120120+ too soon.121121+ */122122+ if (line6pcm->active_urb_in | line6pcm->unlink_urb_in)114123 return -EBUSY;115124116116- line6pcm->buffer_in = kmalloc(LINE6_ISO_BUFFERS * LINE6_ISO_PACKETS * line6pcm->max_packet_size, GFP_KERNEL);125125+ line6pcm->buffer_in =126126+ kmalloc(LINE6_ISO_BUFFERS * LINE6_ISO_PACKETS *127127+ line6pcm->max_packet_size, GFP_KERNEL);117128118129 if (!line6pcm->buffer_in) {119119- dev_err(line6pcm->line6->ifcdev, "cannot malloc capture buffer\n");130130+ dev_err(line6pcm->line6->ifcdev,131131+ "cannot malloc capture buffer\n");120132 return -ENOMEM;121133 }122134123135 line6pcm->count_in = 0;124136 line6pcm->prev_fsize = 0;125137 err = line6_submit_audio_in_all_urbs(line6pcm);126126-138138+127139 if (err < 0) {128140 __sync_fetch_and_and(&line6pcm->flags, ~channels);129141 return err;130142 }131143 }132132-144144+133145 if (((flags_old & MASK_PLAYBACK) == 0) &&134146 ((flags_new & MASK_PLAYBACK) != 0)) {135147 /*136136- See comment above regarding PCM restart.137137- */138138- if(line6pcm->active_urb_out | line6pcm->unlink_urb_out)148148+ See comment above regarding PCM restart.149149+ */150150+ if (line6pcm->active_urb_out | line6pcm->unlink_urb_out)139151 return -EBUSY;140152141141- line6pcm->buffer_out = kmalloc(LINE6_ISO_BUFFERS * LINE6_ISO_PACKETS * line6pcm->max_packet_size, GFP_KERNEL);153153+ line6pcm->buffer_out =154154+ kmalloc(LINE6_ISO_BUFFERS * LINE6_ISO_PACKETS *155155+ line6pcm->max_packet_size, GFP_KERNEL);142156143157 if (!line6pcm->buffer_out) {144144- dev_err(line6pcm->line6->ifcdev, "cannot malloc playback buffer\n");158158+ dev_err(line6pcm->line6->ifcdev,159159+ "cannot malloc playback buffer\n");145160 return -ENOMEM;146161 }147162148163 line6pcm->count_out = 0;149164 err = line6_submit_audio_out_all_urbs(line6pcm);150150-165165+151166 if (err < 0) {152167 __sync_fetch_and_and(&line6pcm->flags, ~channels);153168 return err;154169 }155170 }156156-171171+157172 return 0;158173}159174160175int line6_pcm_stop(struct snd_line6_pcm *line6pcm, int channels)161176{162162- unsigned long flags_old = __sync_fetch_and_and(&line6pcm->flags, ~channels);177177+ unsigned long flags_old =178178+ __sync_fetch_and_and(&line6pcm->flags, ~channels);163179 unsigned long flags_new = flags_old & ~channels;164180165181 if (((flags_old & MASK_CAPTURE) != 0) &&···188178 kfree(line6pcm->buffer_out);189179 line6pcm->buffer_out = NULL;190180 }191191-192181#if LINE6_BACKUP_MONITOR_SIGNAL193182 if (line6pcm->prev_fbuf != NULL)194183 kfree(line6pcm->prev_fbuf);···232223 break;233224234225 default:235235- dev_err(line6pcm->line6->ifcdev, "Unknown stream direction %d\n",236236- s->stream);226226+ dev_err(line6pcm->line6->ifcdev,227227+ "Unknown stream direction %d\n", s->stream);237228 }238229 }239230···273264 struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol);274265275266 for (i = 2; i--;)276276- if (line6pcm->volume_playback[i] != ucontrol->value.integer.value[i]) {277277- line6pcm->volume_playback[i] = ucontrol->value.integer.value[i];267267+ if (line6pcm->volume_playback[i] !=268268+ ucontrol->value.integer.value[i]) {269269+ line6pcm->volume_playback[i] =270270+ ucontrol->value.integer.value[i];278271 changed = 1;279272 }280273···326315 int err;327316328317 err = snd_pcm_new(line6pcm->line6->card,329329- (char *)line6pcm->line6->properties->name,330330- 0, 1, 1, &pcm);318318+ (char *)line6pcm->line6->properties->name,319319+ 0, 1, 1, &pcm);331320 if (err < 0)332321 return err;333322···339328 /* set operators */340329 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,341330 &snd_line6_playback_ops);342342- snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,343343- &snd_line6_capture_ops);331331+ snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_line6_capture_ops);344332345333 /* pre-allocation of buffers */346334 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS,347347- snd_dma_continuous_data(GFP_KERNEL),348348- 64 * 1024, 128 * 1024);335335+ snd_dma_continuous_data336336+ (GFP_KERNEL), 64 * 1024,337337+ 128 * 1024);349338350339 return 0;351340}···361350*/362351static void pcm_disconnect_substream(struct snd_pcm_substream *substream)363352{364364- if(substream->runtime && snd_pcm_running(substream)) {353353+ if (substream->runtime && snd_pcm_running(substream)) {365354 snd_pcm_stop(substream, SNDRV_PCM_STATE_DISCONNECTED);366355 }367356}···371360*/372361void line6_pcm_disconnect(struct snd_line6_pcm *line6pcm)373362{374374- pcm_disconnect_substream(get_substream(line6pcm, SNDRV_PCM_STREAM_CAPTURE));375375- pcm_disconnect_substream(get_substream(line6pcm, SNDRV_PCM_STREAM_PLAYBACK));363363+ pcm_disconnect_substream(get_substream364364+ (line6pcm, SNDRV_PCM_STREAM_CAPTURE));365365+ pcm_disconnect_substream(get_substream366366+ (line6pcm, SNDRV_PCM_STREAM_PLAYBACK));376367 line6_unlink_wait_clear_audio_out_urbs(line6pcm);377368 line6_unlink_wait_clear_audio_in_urbs(line6pcm);378369}···395382 struct snd_line6_pcm *line6pcm;396383397384 if (!(line6->properties->capabilities & LINE6_BIT_PCM))398398- return 0; /* skip PCM initialization and report success */385385+ return 0; /* skip PCM initialization and report success */399386400387 /* initialize PCM subsystem based on product id: */401388 switch (line6->product) {···405392 case LINE6_DEVID_PODXT:406393 case LINE6_DEVID_PODXTLIVE:407394 case LINE6_DEVID_PODXTPRO:408408- ep_read = 0x82;395395+ ep_read = 0x82;409396 ep_write = 0x01;410397 break;411398412399 case LINE6_DEVID_PODX3:413400 case LINE6_DEVID_PODX3LIVE:414414- ep_read = 0x86;401401+ ep_read = 0x86;415402 ep_write = 0x02;416403 break;417404418405 case LINE6_DEVID_POCKETPOD:419419- ep_read = 0x82;406406+ ep_read = 0x82;420407 ep_write = 0x02;421408 break;422409···427414 case LINE6_DEVID_TONEPORT_GX:428415 case LINE6_DEVID_TONEPORT_UX1:429416 case LINE6_DEVID_TONEPORT_UX2:430430- ep_read = 0x82;417417+ ep_read = 0x82;431418 ep_write = 0x01;432419 break;433420434421 /* this is for interface_number == 1:435435- case LINE6_DEVID_TONEPORT_UX2:436436- case LINE6_DEVID_PODSTUDIO_UX2:437437- ep_read = 0x87;438438- ep_write = 0x00;439439- break;440440- */422422+ case LINE6_DEVID_TONEPORT_UX2:423423+ case LINE6_DEVID_PODSTUDIO_UX2:424424+ ep_read = 0x87;425425+ ep_write = 0x00;426426+ break;427427+ */441428442429 default:443430 MISSING_CASE;···455442 line6pcm->ep_audio_write = ep_write;456443 line6pcm->max_packet_size = usb_maxpacket(line6->usbdev,457444 usb_rcvintpipe(line6->usbdev,458458- ep_read),459459- 0);445445+ ep_read), 0);460446 line6pcm->properties = properties;461447 line6->line6pcm = line6pcm;462448···483471 return err;484472485473 /* mixer: */486486- err = snd_ctl_add(line6->card, snd_ctl_new1(&line6_control_playback, line6pcm));474474+ err =475475+ snd_ctl_add(line6->card,476476+ snd_ctl_new1(&line6_control_playback, line6pcm));487477 if (err < 0)488478 return err;489479
···11/*22- * Line6 Linux USB driver - 0.9.022+ * Line6 Linux USB driver - 0.9.1beta33 *44 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at)55 *···6868 int frames = urb_out->transfer_buffer_length / bytes_per_frame;69697070 if (bytes_per_frame == 4) {7171- /* TODO: add code for TonePort etc. */7171+ int i;7272+ short *pi = (short *)line6pcm->prev_fbuf;7373+ short *po = (short *)urb_out->transfer_buffer;7474+7575+ for (i = 0; i < frames; ++i) {7676+ po[0] = pi[0];7777+ po[1] = 0;7878+ pi += 2;7979+ po += 2;8080+ }7281 } else if (bytes_per_frame == 6) {7382 int i, j;7483 unsigned char *pi = line6pcm->prev_fbuf;···9384 pi += bytes_per_frame;9485 po += bytes_per_frame;9586 }9696-9797- if (--line6pcm->impulse_count <= 0) {9898- ((unsigned char *)(urb_out->9999- transfer_buffer))[bytes_per_frame -100100- 1] =101101- line6pcm->impulse_volume;102102- line6pcm->impulse_count = line6pcm->impulse_period;103103- }8787+ }8888+ if (--line6pcm->impulse_count <= 0) {8989+ ((unsigned char *)(urb_out->transfer_buffer))[bytes_per_frame -9090+ 1] =9191+ line6pcm->impulse_volume;9292+ line6pcm->impulse_count = line6pcm->impulse_period;10493 }10594}10695···124117 }125118126119 /*127127- We don't need to handle devices with 6 bytes per frame here128128- since they all support hardware monitoring.129129- */120120+ We don't need to handle devices with 6 bytes per frame here121121+ since they all support hardware monitoring.122122+ */130123}131124132125/*···137130 int index;138131 unsigned long flags;139132 int i, urb_size, urb_frames;133133+ int ret;140134 const int bytes_per_frame = line6pcm->properties->bytes_per_frame;141135 const int frame_increment =142136 line6pcm->properties->snd_line6_rates.rats[0].num_min;···252244 create_impulse_test_signal(line6pcm, urb_out,253245 bytes_per_frame);254246 if (line6pcm->flags & MASK_PCM_ALSA_CAPTURE) {255255- line6_capture_copy(line6pcm, urb_out->transfer_buffer,256256- urb_out->transfer_buffer_length);247247+ line6_capture_copy(line6pcm,248248+ urb_out->transfer_buffer,249249+ urb_out->250250+ transfer_buffer_length);251251+ line6_capture_check_period(line6pcm,252252+ urb_out->transfer_buffer_length);257253 }258254 } else {259255#endif260256 if (!261261- (line6pcm->line6->properties->262262- capabilities & LINE6_BIT_HWMON)263263- && (line6pcm->flags & MASK_PLAYBACK)264264- && (line6pcm->flags & MASK_CAPTURE))257257+ (line6pcm->line6->258258+ properties->capabilities & LINE6_BIT_HWMON)259259+&& (line6pcm->flags & MASK_PLAYBACK)260260+&& (line6pcm->flags & MASK_CAPTURE))265261 add_monitor_signal(urb_out, line6pcm->prev_fbuf,266262 line6pcm->volume_monitor,267263 bytes_per_frame);···283271 }284272#endif285273286286- if (usb_submit_urb(urb_out, GFP_ATOMIC) == 0)274274+ ret = usb_submit_urb(urb_out, GFP_ATOMIC);275275+276276+ if (ret == 0)287277 set_bit(index, &line6pcm->active_urb_out);288278 else289279 dev_err(line6pcm->line6->ifcdev,290290- "URB out #%d submission failed\n", index);280280+ "URB out #%d submission failed (%d)\n", index, ret);291281292282 spin_unlock_irqrestore(&line6pcm->lock_audio_out, flags);293283 return 0;···369355 int i, index, length = 0, shutdown = 0;370356 unsigned long flags;371357372372- struct snd_line6_pcm *line6pcm =373373- (struct snd_line6_pcm *)urb->context;358358+ struct snd_line6_pcm *line6pcm = (struct snd_line6_pcm *)urb->context;374359 struct snd_pcm_substream *substream =375360 get_substream(line6pcm, SNDRV_PCM_STREAM_PLAYBACK);376361···404391 clear_bit(index, &line6pcm->active_urb_out);405392406393 for (i = LINE6_ISO_PACKETS; i--;)407407- if (urb->iso_frame_desc[i].status == -ESHUTDOWN) {394394+ if (urb->iso_frame_desc[i].status == -EXDEV) {408395 shutdown = 1;409396 break;410397 }···435422 struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream);436423437424 err = snd_pcm_hw_constraint_ratdens(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,438438- (&line6pcm->properties->439439- snd_line6_rates));425425+ (&line6pcm->426426+ properties->snd_line6_rates));440427 if (err < 0)441428 return err;442429···537524538525/* playback operators */539526struct snd_pcm_ops snd_line6_playback_ops = {540540- .open = snd_line6_playback_open,541541- .close = snd_line6_playback_close,542542- .ioctl = snd_pcm_lib_ioctl,543543- .hw_params = snd_line6_playback_hw_params,544544- .hw_free = snd_line6_playback_hw_free,545545- .prepare = snd_line6_prepare,546546- .trigger = snd_line6_trigger,547547- .pointer = snd_line6_playback_pointer,527527+ .open = snd_line6_playback_open,528528+ .close = snd_line6_playback_close,529529+ .ioctl = snd_pcm_lib_ioctl,530530+ .hw_params = snd_line6_playback_hw_params,531531+ .hw_free = snd_line6_playback_hw_free,532532+ .prepare = snd_line6_prepare,533533+ .trigger = snd_line6_trigger,534534+ .pointer = snd_line6_playback_pointer,548535};549536550537int line6_create_audio_out_urbs(struct snd_line6_pcm *line6pcm)···567554 urb->dev = line6pcm->line6->usbdev;568555 urb->pipe =569556 usb_sndisocpipe(line6pcm->line6->usbdev,570570- line6pcm->571571- ep_audio_write & USB_ENDPOINT_NUMBER_MASK);557557+ line6pcm->ep_audio_write &558558+ USB_ENDPOINT_NUMBER_MASK);572559 urb->transfer_flags = URB_ISO_ASAP;573560 urb->start_frame = -1;574561 urb->number_of_packets = LINE6_ISO_PACKETS;
+1-4
drivers/staging/line6/playback.h
···11/*22- * Line6 Linux USB driver - 0.9.022+ * Line6 Linux USB driver - 0.9.1beta33 *44 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at)55 *···1212#ifndef PLAYBACK_H1313#define PLAYBACK_H14141515-1615#include <sound/pcm.h>17161817#include "driver.h"1919-20182119/*2220 When the TonePort is used with jack in full duplex mode and the outputs are···2527 solution. Until one is found, this workaround can be used to fix the problem.2628*/2729#define USE_CLEAR_BUFFER_WORKAROUND 12828-29303031extern struct snd_pcm_ops snd_line6_playback_ops;3132
+261-155
drivers/staging/line6/pod.c
···11/*22- * Line6 Linux USB driver - 0.9.022+ * Line6 Linux USB driver - 0.9.1beta33 *44 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at)55 *···2020#include "playback.h"2121#include "pod.h"22222323-2423#define POD_SYSEX_CODE 32525-#define POD_BYTES_PER_FRAME 6 /* 24bit audio (stereo) */2424+#define POD_BYTES_PER_FRAME 6 /* 24bit audio (stereo) */26252626+/* *INDENT-OFF* */27272828enum {2929 POD_SYSEX_CLIP = 0x0f,···4949 POD_system_invalid = 0x100005050};51515252+/* *INDENT-ON* */5353+5254enum {5355 POD_DUMP_MEMORY = 25456};···6361 POD_BUSY_MIDISEND6462};65636666-6764static struct snd_ratden pod_ratden = {6865 .num_min = 78125,6966 .num_max = 78125,···72717372static struct line6_pcm_properties pod_pcm_properties = {7473 .snd_line6_playback_hw = {7575- .info = (SNDRV_PCM_INFO_MMAP |7676- SNDRV_PCM_INFO_INTERLEAVED |7777- SNDRV_PCM_INFO_BLOCK_TRANSFER |7878- SNDRV_PCM_INFO_MMAP_VALID |7979- SNDRV_PCM_INFO_PAUSE |7474+ .info = (SNDRV_PCM_INFO_MMAP |7575+ SNDRV_PCM_INFO_INTERLEAVED |7676+ SNDRV_PCM_INFO_BLOCK_TRANSFER |7777+ SNDRV_PCM_INFO_MMAP_VALID |7878+ SNDRV_PCM_INFO_PAUSE |8079#ifdef CONFIG_PM8181- SNDRV_PCM_INFO_RESUME |8080+ SNDRV_PCM_INFO_RESUME |8281#endif8383- SNDRV_PCM_INFO_SYNC_START),8484- .formats = SNDRV_PCM_FMTBIT_S24_3LE,8585- .rates = SNDRV_PCM_RATE_KNOT,8686- .rate_min = 39062,8787- .rate_max = 39063,8888- .channels_min = 2,8989- .channels_max = 2,9090- .buffer_bytes_max = 60000,9191- .period_bytes_min = 64,9292- .period_bytes_max = 8192,9393- .periods_min = 1,9494- .periods_max = 10249595- },8282+ SNDRV_PCM_INFO_SYNC_START),8383+ .formats = SNDRV_PCM_FMTBIT_S24_3LE,8484+ .rates = SNDRV_PCM_RATE_KNOT,8585+ .rate_min = 39062,8686+ .rate_max = 39063,8787+ .channels_min = 2,8888+ .channels_max = 2,8989+ .buffer_bytes_max = 60000,9090+ .period_bytes_min = 64,9191+ .period_bytes_max = 8192,9292+ .periods_min = 1,9393+ .periods_max = 1024},9694 .snd_line6_capture_hw = {9797- .info = (SNDRV_PCM_INFO_MMAP |9898- SNDRV_PCM_INFO_INTERLEAVED |9999- SNDRV_PCM_INFO_BLOCK_TRANSFER |100100- SNDRV_PCM_INFO_MMAP_VALID |9595+ .info = (SNDRV_PCM_INFO_MMAP |9696+ SNDRV_PCM_INFO_INTERLEAVED |9797+ SNDRV_PCM_INFO_BLOCK_TRANSFER |9898+ SNDRV_PCM_INFO_MMAP_VALID |10199#ifdef CONFIG_PM102102- SNDRV_PCM_INFO_RESUME |100100+ SNDRV_PCM_INFO_RESUME |103101#endif104104- SNDRV_PCM_INFO_SYNC_START),105105- .formats = SNDRV_PCM_FMTBIT_S24_3LE,106106- .rates = SNDRV_PCM_RATE_KNOT,107107- .rate_min = 39062,108108- .rate_max = 39063,109109- .channels_min = 2,110110- .channels_max = 2,111111- .buffer_bytes_max = 60000,112112- .period_bytes_min = 64,113113- .period_bytes_max = 8192,114114- .periods_min = 1,115115- .periods_max = 1024116116- },102102+ SNDRV_PCM_INFO_SYNC_START),103103+ .formats = SNDRV_PCM_FMTBIT_S24_3LE,104104+ .rates = SNDRV_PCM_RATE_KNOT,105105+ .rate_min = 39062,106106+ .rate_max = 39063,107107+ .channels_min = 2,108108+ .channels_max = 2,109109+ .buffer_bytes_max = 60000,110110+ .period_bytes_min = 64,111111+ .period_bytes_max = 8192,112112+ .periods_min = 1,113113+ .periods_max = 1024},117114 .snd_line6_rates = {118118- .nrats = 1,119119- .rats = &pod_ratden120120- },115115+ .nrats = 1,116116+ .rats = &pod_ratden},121117 .bytes_per_frame = POD_BYTES_PER_FRAME122118};123119···122124 0xf0, 0x00, 0x01, 0x0c, 0x03, 0x75, 0xf7123125};124126125125-static const char pod_version_header[] = {127127+static const char pod_version_header[] = {126128 0xf2, 0x7e, 0x7f, 0x06, 0x02127129};128128-129130130131/* forward declarations: */131132static void pod_startup2(unsigned long data);132133static void pod_startup3(struct usb_line6_pod *pod);133134static void pod_startup4(struct usb_line6_pod *pod);134134-135135136136/*137137 Mark all parameters as dirty and notify waiting processes.···142146 set_bit(i, pod->param_dirty);143147}144148145145-static char *pod_alloc_sysex_buffer(struct usb_line6_pod *pod, int code, int size)149149+static char *pod_alloc_sysex_buffer(struct usb_line6_pod *pod, int code,150150+ int size)146151{147147- return line6_alloc_sysex_buffer(&pod->line6, POD_SYSEX_CODE, code, size);152152+ return line6_alloc_sysex_buffer(&pod->line6, POD_SYSEX_CODE, code,153153+ size);148154}149155150156/*···181183/*182184 Handle SAVE button.183185*/184184-static void pod_save_button_pressed(struct usb_line6_pod *pod, int type, int index)186186+static void pod_save_button_pressed(struct usb_line6_pod *pod, int type,187187+ int index)185188{186189 pod->dirty = 0;187190 set_bit(POD_SAVE_PRESSED, &pod->atomic_flags);···200201 case LINE6_PARAM_CHANGE:201202 case LINE6_PROGRAM_CHANGE:202203 case LINE6_SYSEX_BEGIN:203203- break; /* handle these further down */204204+ break; /* handle these further down */204205205206 default:206206- return; /* ignore all others */207207+ return; /* ignore all others */207208 }208209209210 /* process all remaining messages */···216217 if ((buf[1] == POD_amp_model_setup) ||217218 (buf[1] == POD_effect_setup))218219 /* these also affect other settings */219219- line6_dump_request_async(&pod->dumpreq, &pod->line6, 0, LINE6_DUMP_CURRENT);220220+ line6_dump_request_async(&pod->dumpreq, &pod->line6, 0,221221+ LINE6_DUMP_CURRENT);220222221223 break;222224···226226 pod->channel_num = buf[1];227227 pod->dirty = 0;228228 set_bit(POD_CHANNEL_DIRTY, &pod->atomic_flags);229229- line6_dump_request_async(&pod->dumpreq, &pod->line6, 0, LINE6_DUMP_CURRENT);229229+ line6_dump_request_async(&pod->dumpreq, &pod->line6, 0,230230+ LINE6_DUMP_CURRENT);230231 break;231232232233 case LINE6_SYSEX_BEGIN | LINE6_CHANNEL_DEVICE:···235234 if (memcmp(buf + 1, line6_midi_id, sizeof(line6_midi_id)) == 0) {236235 switch (buf[5]) {237236 case POD_SYSEX_DUMP:238238- if (pod->line6.message_length == sizeof(pod->prog_data) + 7) {237237+ if (pod->line6.message_length ==238238+ sizeof(pod->prog_data) + 7) {239239 switch (pod->dumpreq.in_progress) {240240 case LINE6_DUMP_CURRENT:241241- memcpy(&pod->prog_data, buf + 7, sizeof(pod->prog_data));241241+ memcpy(&pod->prog_data, buf + 7,242242+ sizeof(pod->prog_data));242243 pod_mark_batch_all_dirty(pod);243244 break;244245245246 case POD_DUMP_MEMORY:246246- memcpy(&pod->prog_data_buf, buf + 7, sizeof(pod->prog_data_buf));247247+ memcpy(&pod->prog_data_buf,248248+ buf + 7,249249+ sizeof250250+ (pod->prog_data_buf));247251 break;248252249253 default:250250- DEBUG_MESSAGES(dev_err(pod->line6.ifcdev, "unknown dump code %02X\n", pod->dumpreq.in_progress));254254+ DEBUG_MESSAGES(dev_err255255+ (pod->256256+ line6.ifcdev,257257+ "unknown dump code %02X\n",258258+ pod->259259+ dumpreq.in_progress));251260 }252261253262 line6_dump_finished(&pod->dumpreq);254263 pod_startup3(pod);255264 } else256256- DEBUG_MESSAGES(dev_err(pod->line6.ifcdev, "wrong size of channel dump message (%d instead of %d)\n",257257- pod->line6.message_length, (int)sizeof(pod->prog_data) + 7));265265+ DEBUG_MESSAGES(dev_err266266+ (pod->line6.ifcdev,267267+ "wrong size of channel dump message (%d instead of %d)\n",268268+ pod->269269+ line6.message_length,270270+ (int)271271+ sizeof(pod->prog_data) +272272+ 7));258273259274 break;260275261261- case POD_SYSEX_SYSTEM: {262262- short value = ((int)buf[7] << 12) | ((int)buf[8] << 8) | ((int)buf[9] << 4) | (int)buf[10];276276+ case POD_SYSEX_SYSTEM:{277277+ short value =278278+ ((int)buf[7] << 12) | ((int)buf[8]279279+ << 8) |280280+ ((int)buf[9] << 4) | (int)buf[10];263281264282#define PROCESS_SYSTEM_PARAM(x) \265283 case POD_ ## x: \···286266 wake_up(&pod->x.wait); \287267 break;288268289289- switch (buf[6]) {290290- PROCESS_SYSTEM_PARAM(monitor_level);291291- PROCESS_SYSTEM_PARAM(routing);292292- PROCESS_SYSTEM_PARAM(tuner_mute);293293- PROCESS_SYSTEM_PARAM(tuner_freq);294294- PROCESS_SYSTEM_PARAM(tuner_note);295295- PROCESS_SYSTEM_PARAM(tuner_pitch);269269+ switch (buf[6]) {270270+ PROCESS_SYSTEM_PARAM271271+ (monitor_level);272272+ PROCESS_SYSTEM_PARAM(routing);273273+ PROCESS_SYSTEM_PARAM274274+ (tuner_mute);275275+ PROCESS_SYSTEM_PARAM276276+ (tuner_freq);277277+ PROCESS_SYSTEM_PARAM278278+ (tuner_note);279279+ PROCESS_SYSTEM_PARAM280280+ (tuner_pitch);296281297282#undef PROCESS_SYSTEM_PARAM298283299299- default:300300- DEBUG_MESSAGES(dev_err(pod->line6.ifcdev, "unknown tuner/system response %02X\n", buf[6]));301301- }284284+ default:285285+ DEBUG_MESSAGES(dev_err286286+ (pod->287287+ line6.ifcdev,288288+ "unknown tuner/system response %02X\n",289289+ buf[6]));290290+ }302291303303- break;304304- }292292+ break;293293+ }305294306295 case POD_SYSEX_FINISH:307296 /* do we need to respond to this? */···321292 break;322293323294 case POD_SYSEX_CLIP:324324- DEBUG_MESSAGES(dev_err(pod->line6.ifcdev, "audio clipped\n"));295295+ DEBUG_MESSAGES(dev_err296296+ (pod->line6.ifcdev,297297+ "audio clipped\n"));325298 pod->clipping.value = 1;326299 wake_up(&pod->clipping.wait);327300 break;328301329302 case POD_SYSEX_STORE:330330- DEBUG_MESSAGES(dev_err(pod->line6.ifcdev, "message %02X not yet implemented\n", buf[5]));303303+ DEBUG_MESSAGES(dev_err304304+ (pod->line6.ifcdev,305305+ "message %02X not yet implemented\n",306306+ buf[5]));331307 break;332308333309 default:334334- DEBUG_MESSAGES(dev_err(pod->line6.ifcdev, "unknown sysex message %02X\n", buf[5]));310310+ DEBUG_MESSAGES(dev_err311311+ (pod->line6.ifcdev,312312+ "unknown sysex message %02X\n",313313+ buf[5]));335314 }336336- } else if (memcmp(buf, pod_version_header, sizeof(pod_version_header)) == 0) {337337- pod->firmware_version = buf[13] * 100 + buf[14] * 10 + buf[15];338338- pod->device_id = ((int)buf[8] << 16) | ((int)buf[9] << 8) | (int)buf[10];315315+ } else316316+ if (memcmp317317+ (buf, pod_version_header,318318+ sizeof(pod_version_header)) == 0) {319319+ pod->firmware_version =320320+ buf[13] * 100 + buf[14] * 10 + buf[15];321321+ pod->device_id =322322+ ((int)buf[8] << 16) | ((int)buf[9] << 8) | (int)323323+ buf[10];339324 pod_startup4(pod);340325 } else341341- DEBUG_MESSAGES(dev_err(pod->line6.ifcdev, "unknown sysex header\n"));326326+ DEBUG_MESSAGES(dev_err327327+ (pod->line6.ifcdev,328328+ "unknown sysex header\n"));342329343330 break;344331···362317 break;363318364319 default:365365- DEBUG_MESSAGES(dev_err(pod->line6.ifcdev, "POD: unknown message %02X\n", buf[0]));320320+ DEBUG_MESSAGES(dev_err321321+ (pod->line6.ifcdev,322322+ "POD: unknown message %02X\n", buf[0]));366323 }367324}368325···379332 *) This method fails if a param change message is "chopped" after the first380333 byte.381334*/382382-void line6_pod_midi_postprocess(struct usb_line6_pod *pod, unsigned char *data, int length)335335+void line6_pod_midi_postprocess(struct usb_line6_pod *pod, unsigned char *data,336336+ int length)383337{384338 int i;385339···391343 if (data[i] == (LINE6_PROGRAM_CHANGE | LINE6_CHANNEL_HOST)) {392344 line6_invalidate_current(&pod->dumpreq);393345 break;394394- } else if ((data[i] == (LINE6_PARAM_CHANGE | LINE6_CHANNEL_HOST)) && (i < length - 1))395395- if ((data[i + 1] == POD_amp_model_setup) || (data[i + 1] == POD_effect_setup)) {346346+ } else347347+ if ((data[i] == (LINE6_PARAM_CHANGE | LINE6_CHANNEL_HOST))348348+ && (i < length - 1))349349+ if ((data[i + 1] == POD_amp_model_setup)350350+ || (data[i + 1] == POD_effect_setup)) {396351 line6_invalidate_current(&pod->dumpreq);397352 break;398353 }···418367/*419368 Transmit PODxt Pro control parameter.420369*/421421-void line6_pod_transmit_parameter(struct usb_line6_pod *pod, int param, int value)370370+void line6_pod_transmit_parameter(struct usb_line6_pod *pod, int param,371371+ int value)422372{423373 if (line6_transmit_parameter(&pod->line6, param, value) == 0)424374 pod_store_parameter(pod, param, value);425375426426- if ((param == POD_amp_model_setup) || (param == POD_effect_setup)) /* these also affect other settings */376376+ if ((param == POD_amp_model_setup) || (param == POD_effect_setup)) /* these also affect other settings */427377 line6_invalidate_current(&pod->dumpreq);428378}429379430380/*431381 Resolve value to memory location.432382*/433433-static int pod_resolve(const char *buf, short block0, short block1, unsigned char *location)383383+static int pod_resolve(const char *buf, short block0, short block1,384384+ unsigned char *location)434385{435386 unsigned long value;436387 short block;···452399/*453400 Send command to store channel/effects setup/amp setup to PODxt Pro.454401*/455455-static ssize_t pod_send_store_command(struct device *dev, const char *buf, size_t count, short block0, short block1)402402+static ssize_t pod_send_store_command(struct device *dev, const char *buf,403403+ size_t count, short block0, short block1)456404{457405 struct usb_interface *interface = to_usb_interface(dev);458406 struct usb_line6_pod *pod = usb_get_intfdata(interface);···464410 if (!sysex)465411 return 0;466412467467- sysex[SYSEX_DATA_OFS] = 5; /* see pod_dump() */413413+ sysex[SYSEX_DATA_OFS] = 5; /* see pod_dump() */468414 ret = pod_resolve(buf, block0, block1, sysex + SYSEX_DATA_OFS + 1);469415 if (ret) {470416 kfree(sysex);471417 return ret;472418 }473419474474- memcpy(sysex + SYSEX_DATA_OFS + 3, &pod->prog_data_buf, sizeof(pod->prog_data_buf));420420+ memcpy(sysex + SYSEX_DATA_OFS + 3, &pod->prog_data_buf,421421+ sizeof(pod->prog_data_buf));475422476423 line6_send_sysex_message(&pod->line6, sysex, size);477424 kfree(sysex);···483428/*484429 Send command to retrieve channel/effects setup/amp setup to PODxt Pro.485430*/486486-static ssize_t pod_send_retrieve_command(struct device *dev, const char *buf, size_t count, short block0, short block1)431431+static ssize_t pod_send_retrieve_command(struct device *dev, const char *buf,432432+ size_t count, short block0,433433+ short block1)487434{488435 struct usb_interface *interface = to_usb_interface(dev);489436 struct usb_line6_pod *pod = usb_get_intfdata(interface);···516459/*517460 Generic get name function.518461*/519519-static ssize_t get_name_generic(struct usb_line6_pod *pod, const char *str, char *buf)462462+static ssize_t get_name_generic(struct usb_line6_pod *pod, const char *str,463463+ char *buf)520464{521465 int length = 0;522466 const char *p1;···579521{580522 struct usb_interface *interface = to_usb_interface(dev);581523 struct usb_line6_pod *pod = usb_get_intfdata(interface);582582- return get_name_generic(pod, pod->prog_data.header + POD_NAME_OFFSET, buf);524524+ return get_name_generic(pod, pod->prog_data.header + POD_NAME_OFFSET,525525+ buf);583526}584527585528/*···591532{592533 struct usb_interface *interface = to_usb_interface(dev);593534 struct usb_line6_pod *pod = usb_get_intfdata(interface);594594- return get_name_generic(pod, pod->prog_data_buf.header + POD_NAME_OFFSET, buf);535535+ return get_name_generic(pod,536536+ pod->prog_data_buf.header + POD_NAME_OFFSET,537537+ buf);595538}596539597540/*···622561623562 if (count != sizeof(pod->prog_data)) {624563 dev_err(pod->line6.ifcdev,625625- "data block must be exactly %d bytes\n",626626- (int)sizeof(pod->prog_data));564564+ "data block must be exactly %d bytes\n",565565+ (int)sizeof(pod->prog_data));627566 return -EINVAL;628567 }629568···637576static bool pod_is_tuner(int code)638577{639578 return640640- (code == POD_tuner_mute) ||641641- (code == POD_tuner_freq) ||642642- (code == POD_tuner_note) ||643643- (code == POD_tuner_pitch);579579+ (code == POD_tuner_mute) ||580580+ (code == POD_tuner_freq) ||581581+ (code == POD_tuner_note) || (code == POD_tuner_pitch);644582}645583646584/*647585 Get system parameter (as integer).648586 @param tuner non-zero, if code refers to a tuner parameter649587*/650650-static int pod_get_system_param_int(struct usb_line6_pod *pod, int *value, int code,651651- struct ValueWait *param, int sign)588588+static int pod_get_system_param_int(struct usb_line6_pod *pod, int *value,589589+ int code, struct ValueWait *param, int sign)652590{653591 char *sysex;654592 static const int size = 1;655593 int retval = 0;656594657657- if (((pod->prog_data.control[POD_tuner] & 0x40) == 0) && pod_is_tuner(code))595595+ if (((pod->prog_data.control[POD_tuner] & 0x40) == 0)596596+ && pod_is_tuner(code))658597 return -ENODEV;659598660599 /* send value request to device: */···669608 kfree(sysex);670609671610 /* wait for device to respond: */672672- retval = wait_event_interruptible(param->wait, param->value != POD_system_invalid);611611+ retval =612612+ wait_event_interruptible(param->wait,613613+ param->value != POD_system_invalid);673614674615 if (retval < 0)675616 return retval;676617677677- *value = sign ? (int)(signed short)param->value : (int)(unsigned short)param->value;618618+ *value = sign ? (int)(signed short)param->value : (int)(unsigned short)619619+ param->value;678620679679- if(*value == POD_system_invalid)680680- *value = 0; /* don't report uninitialized values */621621+ if (*value == POD_system_invalid)622622+ *value = 0; /* don't report uninitialized values */681623682624 return 0;683625}···689625 Get system parameter (as string).690626 @param tuner non-zero, if code refers to a tuner parameter691627*/692692-static ssize_t pod_get_system_param_string(struct usb_line6_pod *pod, char *buf, int code,693693- struct ValueWait *param, int sign)628628+static ssize_t pod_get_system_param_string(struct usb_line6_pod *pod, char *buf,629629+ int code, struct ValueWait *param,630630+ int sign)694631{695632 int retval, value = 0;696633 retval = pod_get_system_param_int(pod, &value, code, param, sign);697634698698- if(retval < 0)635635+ if (retval < 0)699636 return retval;700637701638 return sprintf(buf, "%d\n", value);···706641 Send system parameter (from integer).707642 @param tuner non-zero, if code refers to a tuner parameter708643*/709709-static int pod_set_system_param_int(struct usb_line6_pod *pod, int value, int code)644644+static int pod_set_system_param_int(struct usb_line6_pod *pod, int value,645645+ int code)710646{711647 char *sysex;712648 static const int size = 5;713649714714- if (((pod->prog_data.control[POD_tuner] & 0x40) == 0) && pod_is_tuner(code))650650+ if (((pod->prog_data.control[POD_tuner] & 0x40) == 0)651651+ && pod_is_tuner(code))715652 return -EINVAL;716653717654 /* send value to tuner: */···722655 return -ENOMEM;723656 sysex[SYSEX_DATA_OFS] = code;724657 sysex[SYSEX_DATA_OFS + 1] = (value >> 12) & 0x0f;725725- sysex[SYSEX_DATA_OFS + 2] = (value >> 8) & 0x0f;726726- sysex[SYSEX_DATA_OFS + 3] = (value >> 4) & 0x0f;727727- sysex[SYSEX_DATA_OFS + 4] = (value ) & 0x0f;658658+ sysex[SYSEX_DATA_OFS + 2] = (value >> 8) & 0x0f;659659+ sysex[SYSEX_DATA_OFS + 3] = (value >> 4) & 0x0f;660660+ sysex[SYSEX_DATA_OFS + 4] = (value) & 0x0f;728661 line6_send_sysex_message(&pod->line6, sysex, size);729662 kfree(sysex);730663 return 0;···734667 Send system parameter (from string).735668 @param tuner non-zero, if code refers to a tuner parameter736669*/737737-static ssize_t pod_set_system_param_string(struct usb_line6_pod *pod, const char *buf,738738- int count, int code, unsigned short mask)670670+static ssize_t pod_set_system_param_string(struct usb_line6_pod *pod,671671+ const char *buf, int count, int code,672672+ unsigned short mask)739673{740674 int retval;741675 unsigned short value = simple_strtoul(buf, NULL, 10) & mask;···946878{947879 struct usb_interface *interface = to_usb_interface(dev);948880 struct usb_line6_pod *pod = usb_get_intfdata(interface);949949- return wait_event_interruptible(pod->clipping.wait, pod->clipping.value != 0);881881+ return wait_event_interruptible(pod->clipping.wait,882882+ pod->clipping.value != 0);950883}951884952885/*···959890960891static void pod_startup1(struct usb_line6_pod *pod)961892{962962- CHECK_STARTUP_PROGRESS(pod->startup_progress, 1);893893+ CHECK_STARTUP_PROGRESS(pod->startup_progress, POD_STARTUP_INIT);963894964895 /* delay startup procedure: */965965- line6_start_timer(&pod->startup_timer, POD_STARTUP_DELAY, pod_startup2, (unsigned long)pod);896896+ line6_start_timer(&pod->startup_timer, POD_STARTUP_DELAY, pod_startup2,897897+ (unsigned long)pod);966898}967899968900static void pod_startup2(unsigned long data)969901{970902 struct usb_line6_pod *pod = (struct usb_line6_pod *)data;971971- CHECK_STARTUP_PROGRESS(pod->startup_progress, 2);903903+904904+ /* schedule another startup procedure until startup is complete: */905905+ if (pod->startup_progress >= POD_STARTUP_LAST)906906+ return;907907+908908+ pod->startup_progress = POD_STARTUP_DUMPREQ;909909+ line6_start_timer(&pod->startup_timer, POD_STARTUP_DELAY, pod_startup2,910910+ (unsigned long)pod);972911973912 /* current channel dump: */974974- line6_dump_request_async(&pod->dumpreq, &pod->line6, 0, LINE6_DUMP_CURRENT);913913+ line6_dump_request_async(&pod->dumpreq, &pod->line6, 0,914914+ LINE6_DUMP_CURRENT);975915}976916977917static void pod_startup3(struct usb_line6_pod *pod)978918{979919 struct usb_line6 *line6 = &pod->line6;980980- CHECK_STARTUP_PROGRESS(pod->startup_progress, 3);920920+ CHECK_STARTUP_PROGRESS(pod->startup_progress, POD_STARTUP_VERSIONREQ);981921982922 /* request firmware version: */983923 line6_version_request_async(line6);···994916995917static void pod_startup4(struct usb_line6_pod *pod)996918{997997- CHECK_STARTUP_PROGRESS(pod->startup_progress, 4);919919+ CHECK_STARTUP_PROGRESS(pod->startup_progress, POD_STARTUP_WORKQUEUE);998920999921 /* schedule work for global work queue: */1000922 schedule_work(&pod->startup_work);···10029241003925static void pod_startup5(struct work_struct *work)1004926{10051005- struct usb_line6_pod *pod = container_of(work, struct usb_line6_pod, startup_work);927927+ struct usb_line6_pod *pod =928928+ container_of(work, struct usb_line6_pod, startup_work);1006929 struct usb_line6 *line6 = &pod->line6;100793010081008- CHECK_STARTUP_PROGRESS(pod->startup_progress, 5);931931+ CHECK_STARTUP_PROGRESS(pod->startup_progress, POD_STARTUP_SETUP);10099321010933 /* serial number: */1011934 line6_read_serial_number(&pod->line6, &pod->serial_number);···1015936 line6_register_audio(line6);10169371017938 /* device files: */10181018- line6_pod_create_files(pod->firmware_version, line6->properties->device_bit, line6->ifcdev);939939+ line6_pod_create_files(pod->firmware_version,940940+ line6->properties->device_bit, line6->ifcdev);1019941}10209421021943#define POD_GET_SYSTEM_PARAM(code, sign) \···1051971#undef GET_SYSTEM_PARAM10529721053973/* POD special files: */10541054-static DEVICE_ATTR(channel, S_IWUGO | S_IRUGO, pod_get_channel, pod_set_channel);974974+static DEVICE_ATTR(channel, S_IWUGO | S_IRUGO, pod_get_channel,975975+ pod_set_channel);1055976static DEVICE_ATTR(clip, S_IRUGO, pod_wait_for_clip, line6_nop_write);1056977static DEVICE_ATTR(device_id, S_IRUGO, pod_get_device_id, line6_nop_write);1057978static DEVICE_ATTR(dirty, S_IRUGO, pod_get_dirty, line6_nop_write);1058979static DEVICE_ATTR(dump, S_IWUGO | S_IRUGO, pod_get_dump, pod_set_dump);10591059-static DEVICE_ATTR(dump_buf, S_IWUGO | S_IRUGO, pod_get_dump_buf, pod_set_dump_buf);980980+static DEVICE_ATTR(dump_buf, S_IWUGO | S_IRUGO, pod_get_dump_buf,981981+ pod_set_dump_buf);1060982static DEVICE_ATTR(finish, S_IWUGO, line6_nop_read, pod_set_finish);10611061-static DEVICE_ATTR(firmware_version, S_IRUGO, pod_get_firmware_version, line6_nop_write);10621062-static DEVICE_ATTR(midi_postprocess, S_IWUGO | S_IRUGO, pod_get_midi_postprocess, pod_set_midi_postprocess);10631063-static DEVICE_ATTR(monitor_level, S_IWUGO | S_IRUGO, pod_get_monitor_level, pod_set_monitor_level);983983+static DEVICE_ATTR(firmware_version, S_IRUGO, pod_get_firmware_version,984984+ line6_nop_write);985985+static DEVICE_ATTR(midi_postprocess, S_IWUGO | S_IRUGO,986986+ pod_get_midi_postprocess, pod_set_midi_postprocess);987987+static DEVICE_ATTR(monitor_level, S_IWUGO | S_IRUGO, pod_get_monitor_level,988988+ pod_set_monitor_level);1064989static DEVICE_ATTR(name, S_IRUGO, pod_get_name, line6_nop_write);1065990static DEVICE_ATTR(name_buf, S_IRUGO, pod_get_name_buf, line6_nop_write);10661066-static DEVICE_ATTR(retrieve_amp_setup, S_IWUGO, line6_nop_read, pod_set_retrieve_amp_setup);10671067-static DEVICE_ATTR(retrieve_channel, S_IWUGO, line6_nop_read, pod_set_retrieve_channel);10681068-static DEVICE_ATTR(retrieve_effects_setup, S_IWUGO, line6_nop_read, pod_set_retrieve_effects_setup);10691069-static DEVICE_ATTR(routing, S_IWUGO | S_IRUGO, pod_get_routing, pod_set_routing);10701070-static DEVICE_ATTR(serial_number, S_IRUGO, pod_get_serial_number, line6_nop_write);10711071-static DEVICE_ATTR(store_amp_setup, S_IWUGO, line6_nop_read, pod_set_store_amp_setup);10721072-static DEVICE_ATTR(store_channel, S_IWUGO, line6_nop_read, pod_set_store_channel);10731073-static DEVICE_ATTR(store_effects_setup, S_IWUGO, line6_nop_read, pod_set_store_effects_setup);10741074-static DEVICE_ATTR(tuner_freq, S_IWUGO | S_IRUGO, pod_get_tuner_freq, pod_set_tuner_freq);10751075-static DEVICE_ATTR(tuner_mute, S_IWUGO | S_IRUGO, pod_get_tuner_mute, pod_set_tuner_mute);991991+static DEVICE_ATTR(retrieve_amp_setup, S_IWUGO, line6_nop_read,992992+ pod_set_retrieve_amp_setup);993993+static DEVICE_ATTR(retrieve_channel, S_IWUGO, line6_nop_read,994994+ pod_set_retrieve_channel);995995+static DEVICE_ATTR(retrieve_effects_setup, S_IWUGO, line6_nop_read,996996+ pod_set_retrieve_effects_setup);997997+static DEVICE_ATTR(routing, S_IWUGO | S_IRUGO, pod_get_routing,998998+ pod_set_routing);999999+static DEVICE_ATTR(serial_number, S_IRUGO, pod_get_serial_number,10001000+ line6_nop_write);10011001+static DEVICE_ATTR(store_amp_setup, S_IWUGO, line6_nop_read,10021002+ pod_set_store_amp_setup);10031003+static DEVICE_ATTR(store_channel, S_IWUGO, line6_nop_read,10041004+ pod_set_store_channel);10051005+static DEVICE_ATTR(store_effects_setup, S_IWUGO, line6_nop_read,10061006+ pod_set_store_effects_setup);10071007+static DEVICE_ATTR(tuner_freq, S_IWUGO | S_IRUGO, pod_get_tuner_freq,10081008+ pod_set_tuner_freq);10091009+static DEVICE_ATTR(tuner_mute, S_IWUGO | S_IRUGO, pod_get_tuner_mute,10101010+ pod_set_tuner_mute);10761011static DEVICE_ATTR(tuner_note, S_IRUGO, pod_get_tuner_note, line6_nop_write);10771012static DEVICE_ATTR(tuner_pitch, S_IRUGO, pod_get_tuner_pitch, line6_nop_write);10781013···11231028 struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol);11241029 struct usb_line6_pod *pod = (struct usb_line6_pod *)line6pcm->line6;1125103011261126- if(ucontrol->value.integer.value[0] == pod->monitor_level.value)10311031+ if (ucontrol->value.integer.value[0] == pod->monitor_level.value)11271032 return 0;1128103311291034 pod->monitor_level.value = ucontrol->value.integer.value[0];11301130- pod_set_system_param_int(pod, ucontrol->value.integer.value[0], POD_monitor_level);10351035+ pod_set_system_param_int(pod, ucontrol->value.integer.value[0],10361036+ POD_monitor_level);11311037 return 1;11321038}11331039···11571061 if (line6 == NULL)11581062 return;11591063 line6_cleanup_audio(line6);10641064+10651065+ del_timer(&pod->startup_timer);10661066+ cancel_work_sync(&pod->startup_work);1160106711611068 /* free dump request data: */11621069 line6_dumpreq_destruct(&pod->dumpreq);···12071108/*12081109 Try to init POD device.12091110*/12101210-static int pod_try_init(struct usb_interface *interface, struct usb_line6_pod *pod)11111111+static int pod_try_init(struct usb_interface *interface,11121112+ struct usb_line6_pod *pod)12111113{12121114 int err;12131115 struct usb_line6 *line6 = &pod->line6;11161116+11171117+ init_timer(&pod->startup_timer);11181118+ INIT_WORK(&pod->startup_work, pod_startup5);1214111912151120 if ((interface == NULL) || (pod == NULL))12161121 return -ENODEV;···12291126 init_waitqueue_head(&pod->tuner_note.wait);12301127 init_waitqueue_head(&pod->tuner_pitch.wait);12311128 init_waitqueue_head(&pod->clipping.wait);12321232- init_timer(&pod->startup_timer);12331233- INIT_WORK(&pod->startup_work, pod_startup5);1234112912351130 memset(pod->param_dirty, 0xff, sizeof(pod->param_dirty));12361131···12651164 }1266116512671166 /* register monitor control: */12681268- err = snd_ctl_add(line6->card, snd_ctl_new1(&pod_control_monitor, line6->line6pcm));11671167+ err =11681168+ snd_ctl_add(line6->card,11691169+ snd_ctl_new1(&pod_control_monitor, line6->line6pcm));12691170 if (err < 0) {12701171 return err;12711172 }1272117312731174 /*12741274- When the sound card is registered at this point, the PODxt Live12751275- displays "Invalid Code Error 07", so we do it later in the event12761276- handler.12771277- */11751175+ When the sound card is registered at this point, the PODxt Live11761176+ displays "Invalid Code Error 07", so we do it later in the event11771177+ handler.11781178+ */1278117912791180 if (pod->line6.properties->capabilities & LINE6_BIT_CONTROL) {12801181 pod->monitor_level.value = POD_system_invalid;···1323122013241221 if (dev != NULL) {13251222 /* remove sysfs entries: */13261326- line6_pod_remove_files(pod->firmware_version, pod->line6.properties->device_bit, dev);12231223+ line6_pod_remove_files(pod->firmware_version,12241224+ pod->line6.12251225+ properties->device_bit, dev);1327122613281227 device_remove_file(dev, &dev_attr_channel);13291228 device_remove_file(dev, &dev_attr_clip);···13411236 device_remove_file(dev, &dev_attr_name_buf);13421237 device_remove_file(dev, &dev_attr_retrieve_amp_setup);13431238 device_remove_file(dev, &dev_attr_retrieve_channel);13441344- device_remove_file(dev, &dev_attr_retrieve_effects_setup);12391239+ device_remove_file(dev,12401240+ &dev_attr_retrieve_effects_setup);13451241 device_remove_file(dev, &dev_attr_routing);13461242 device_remove_file(dev, &dev_attr_serial_number);13471243 device_remove_file(dev, &dev_attr_store_amp_setup);
+16-7
drivers/staging/line6/pod.h
···11/*22- * Line6 Linux USB driver - 0.9.022+ * Line6 Linux USB driver - 0.9.1beta33 *44 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at)55 *···1212#ifndef POD_H1313#define POD_H14141515-1615#include <linux/interrupt.h>1716#include <linux/spinlock.h>1817#include <linux/usb.h>···21222223#include "driver.h"2324#include "dumprequest.h"2424-25252626/*2727 PODxt Live interfaces···3941*/4042#define POD_CONTROL_SIZE 0x804143#define POD_BUFSIZE_DUMPREQ 74242-#define POD_STARTUP_DELAY 30004444+#define POD_STARTUP_DELAY 10004545+4646+/*4747+ Stages of POD startup procedure4848+*/4949+enum {5050+ POD_STARTUP_INIT = 1,5151+ POD_STARTUP_DUMPREQ,5252+ POD_STARTUP_VERSIONREQ,5353+ POD_STARTUP_WORKQUEUE,5454+ POD_STARTUP_SETUP,5555+ POD_STARTUP_LAST = POD_STARTUP_SETUP - 15656+};43574458/**4559 Data structure for values that need to be requested explicitly.···193183 char midi_postprocess;194184};195185196196-197186extern void line6_pod_disconnect(struct usb_interface *interface);198198-extern int line6_pod_init(struct usb_interface *interface, struct usb_line6_pod *pod);187187+extern int line6_pod_init(struct usb_interface *interface,188188+ struct usb_line6_pod *pod);199189extern void line6_pod_midi_postprocess(struct usb_line6_pod *pod,200190 unsigned char *data, int length);201191extern void line6_pod_process_message(struct usb_line6_pod *pod);202192extern void line6_pod_transmit_parameter(struct usb_line6_pod *pod, int param,203193 int value);204204-205194206195#endif