fed up with those stupid warnings
[mmotm.git] / sound / usb / usx2y / us122l.c
blobfd6cae3c0d56f0335c3044a6d975defe7e87df20
1 /*
2 * Copyright (C) 2007, 2008 Karsten Wiese <fzu@wemgehoertderstaat.de>
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 #include <sound/core.h>
20 #include <sound/hwdep.h>
21 #include <sound/pcm.h>
22 #include <sound/initval.h>
23 #define MODNAME "US122L"
24 #include "usb_stream.c"
25 #include "../usbaudio.h"
26 #include "us122l.h"
28 MODULE_AUTHOR("Karsten Wiese <fzu@wemgehoertderstaat.de>");
29 MODULE_DESCRIPTION("TASCAM "NAME_ALLCAPS" Version 0.5");
30 MODULE_LICENSE("GPL");
32 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */
33 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for this card */
34 /* Enable this card */
35 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
37 module_param_array(index, int, NULL, 0444);
38 MODULE_PARM_DESC(index, "Index value for "NAME_ALLCAPS".");
39 module_param_array(id, charp, NULL, 0444);
40 MODULE_PARM_DESC(id, "ID string for "NAME_ALLCAPS".");
41 module_param_array(enable, bool, NULL, 0444);
42 MODULE_PARM_DESC(enable, "Enable "NAME_ALLCAPS".");
44 static int snd_us122l_card_used[SNDRV_CARDS];
47 static int us122l_create_usbmidi(struct snd_card *card)
49 static struct snd_usb_midi_endpoint_info quirk_data = {
50 .out_ep = 4,
51 .in_ep = 3,
52 .out_cables = 0x001,
53 .in_cables = 0x001
55 static struct snd_usb_audio_quirk quirk = {
56 .vendor_name = "US122L",
57 .product_name = NAME_ALLCAPS,
58 .ifnum = 1,
59 .type = QUIRK_MIDI_US122L,
60 .data = &quirk_data
62 struct usb_device *dev = US122L(card)->chip.dev;
63 struct usb_interface *iface = usb_ifnum_to_if(dev, 1);
65 return snd_usb_create_midi_interface(&US122L(card)->chip,
66 iface, &quirk);
69 static int us144_create_usbmidi(struct snd_card *card)
71 static struct snd_usb_midi_endpoint_info quirk_data = {
72 .out_ep = 4,
73 .in_ep = 3,
74 .out_cables = 0x001,
75 .in_cables = 0x001
77 static struct snd_usb_audio_quirk quirk = {
78 .vendor_name = "US144",
79 .product_name = NAME_ALLCAPS,
80 .ifnum = 0,
81 .type = QUIRK_MIDI_US122L,
82 .data = &quirk_data
84 struct usb_device *dev = US122L(card)->chip.dev;
85 struct usb_interface *iface = usb_ifnum_to_if(dev, 0);
87 return snd_usb_create_midi_interface(&US122L(card)->chip,
88 iface, &quirk);
92 * Wrapper for usb_control_msg().
93 * Allocates a temp buffer to prevent dmaing from/to the stack.
95 static int us122l_ctl_msg(struct usb_device *dev, unsigned int pipe,
96 __u8 request, __u8 requesttype,
97 __u16 value, __u16 index, void *data,
98 __u16 size, int timeout)
100 int err;
101 void *buf = NULL;
103 if (size > 0) {
104 buf = kmemdup(data, size, GFP_KERNEL);
105 if (!buf)
106 return -ENOMEM;
108 err = usb_control_msg(dev, pipe, request, requesttype,
109 value, index, buf, size, timeout);
110 if (size > 0) {
111 memcpy(data, buf, size);
112 kfree(buf);
114 return err;
117 static void pt_info_set(struct usb_device *dev, u8 v)
119 int ret;
121 ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
122 'I',
123 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
124 v, 0, NULL, 0, 1000);
125 snd_printdd(KERN_DEBUG "%i\n", ret);
128 static void usb_stream_hwdep_vm_open(struct vm_area_struct *area)
130 struct us122l *us122l = area->vm_private_data;
131 atomic_inc(&us122l->mmap_count);
132 snd_printdd(KERN_DEBUG "%i\n", atomic_read(&us122l->mmap_count));
135 static int usb_stream_hwdep_vm_fault(struct vm_area_struct *area,
136 struct vm_fault *vmf)
138 unsigned long offset;
139 struct page *page;
140 void *vaddr;
141 struct us122l *us122l = area->vm_private_data;
142 struct usb_stream *s;
144 mutex_lock(&us122l->mutex);
145 s = us122l->sk.s;
146 if (!s)
147 goto unlock;
149 offset = vmf->pgoff << PAGE_SHIFT;
150 if (offset < PAGE_ALIGN(s->read_size))
151 vaddr = (char *)s + offset;
152 else {
153 offset -= PAGE_ALIGN(s->read_size);
154 if (offset >= PAGE_ALIGN(s->write_size))
155 goto unlock;
157 vaddr = us122l->sk.write_page + offset;
159 page = virt_to_page(vaddr);
161 get_page(page);
162 mutex_unlock(&us122l->mutex);
164 vmf->page = page;
166 return 0;
167 unlock:
168 mutex_unlock(&us122l->mutex);
169 return VM_FAULT_SIGBUS;
172 static void usb_stream_hwdep_vm_close(struct vm_area_struct *area)
174 struct us122l *us122l = area->vm_private_data;
175 atomic_dec(&us122l->mmap_count);
176 snd_printdd(KERN_DEBUG "%i\n", atomic_read(&us122l->mmap_count));
179 static const struct vm_operations_struct usb_stream_hwdep_vm_ops = {
180 .open = usb_stream_hwdep_vm_open,
181 .fault = usb_stream_hwdep_vm_fault,
182 .close = usb_stream_hwdep_vm_close,
186 static int usb_stream_hwdep_open(struct snd_hwdep *hw, struct file *file)
188 struct us122l *us122l = hw->private_data;
189 struct usb_interface *iface;
190 snd_printdd(KERN_DEBUG "%p %p\n", hw, file);
191 if (hw->used >= 2)
192 return -EBUSY;
194 if (!us122l->first)
195 us122l->first = file;
197 if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) {
198 iface = usb_ifnum_to_if(us122l->chip.dev, 0);
199 usb_autopm_get_interface(iface);
201 iface = usb_ifnum_to_if(us122l->chip.dev, 1);
202 usb_autopm_get_interface(iface);
203 return 0;
206 static int usb_stream_hwdep_release(struct snd_hwdep *hw, struct file *file)
208 struct us122l *us122l = hw->private_data;
209 struct usb_interface *iface;
210 snd_printdd(KERN_DEBUG "%p %p\n", hw, file);
212 if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) {
213 iface = usb_ifnum_to_if(us122l->chip.dev, 0);
214 usb_autopm_put_interface(iface);
216 iface = usb_ifnum_to_if(us122l->chip.dev, 1);
217 usb_autopm_put_interface(iface);
218 if (us122l->first == file)
219 us122l->first = NULL;
220 mutex_lock(&us122l->mutex);
221 if (us122l->master == file)
222 us122l->master = us122l->slave;
224 us122l->slave = NULL;
225 mutex_unlock(&us122l->mutex);
226 return 0;
229 static int usb_stream_hwdep_mmap(struct snd_hwdep *hw,
230 struct file *filp, struct vm_area_struct *area)
232 unsigned long size = area->vm_end - area->vm_start;
233 struct us122l *us122l = hw->private_data;
234 unsigned long offset;
235 struct usb_stream *s;
236 int err = 0;
237 bool read;
239 offset = area->vm_pgoff << PAGE_SHIFT;
240 mutex_lock(&us122l->mutex);
241 s = us122l->sk.s;
242 read = offset < s->read_size;
243 if (read && area->vm_flags & VM_WRITE) {
244 err = -EPERM;
245 goto out;
247 snd_printdd(KERN_DEBUG "%lu %u\n", size,
248 read ? s->read_size : s->write_size);
249 /* if userspace tries to mmap beyond end of our buffer, fail */
250 if (size > PAGE_ALIGN(read ? s->read_size : s->write_size)) {
251 snd_printk(KERN_WARNING "%lu > %u\n", size,
252 read ? s->read_size : s->write_size);
253 err = -EINVAL;
254 goto out;
257 area->vm_ops = &usb_stream_hwdep_vm_ops;
258 area->vm_flags |= VM_RESERVED;
259 area->vm_private_data = us122l;
260 atomic_inc(&us122l->mmap_count);
261 out:
262 mutex_unlock(&us122l->mutex);
263 return err;
266 static unsigned int usb_stream_hwdep_poll(struct snd_hwdep *hw,
267 struct file *file, poll_table *wait)
269 struct us122l *us122l = hw->private_data;
270 struct usb_stream *s = us122l->sk.s;
271 unsigned *polled;
272 unsigned int mask;
274 poll_wait(file, &us122l->sk.sleep, wait);
276 switch (s->state) {
277 case usb_stream_ready:
278 if (us122l->first == file)
279 polled = &s->periods_polled;
280 else
281 polled = &us122l->second_periods_polled;
282 if (*polled != s->periods_done) {
283 *polled = s->periods_done;
284 mask = POLLIN | POLLOUT | POLLWRNORM;
285 break;
287 /* Fall through */
288 mask = 0;
289 break;
290 default:
291 mask = POLLIN | POLLOUT | POLLWRNORM | POLLERR;
292 break;
294 return mask;
297 static void us122l_stop(struct us122l *us122l)
299 struct list_head *p;
300 list_for_each(p, &us122l->chip.midi_list)
301 snd_usbmidi_input_stop(p);
303 usb_stream_stop(&us122l->sk);
304 usb_stream_free(&us122l->sk);
307 static int us122l_set_sample_rate(struct usb_device *dev, int rate)
309 unsigned int ep = 0x81;
310 unsigned char data[3];
311 int err;
313 data[0] = rate;
314 data[1] = rate >> 8;
315 data[2] = rate >> 16;
316 err = us122l_ctl_msg(dev, usb_sndctrlpipe(dev, 0), SET_CUR,
317 USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_OUT,
318 SAMPLING_FREQ_CONTROL << 8, ep, data, 3, 1000);
319 if (err < 0)
320 snd_printk(KERN_ERR "%d: cannot set freq %d to ep 0x%x\n",
321 dev->devnum, rate, ep);
322 return err;
325 static bool us122l_start(struct us122l *us122l,
326 unsigned rate, unsigned period_frames)
328 struct list_head *p;
329 int err;
330 unsigned use_packsize = 0;
331 bool success = false;
333 if (us122l->chip.dev->speed == USB_SPEED_HIGH) {
334 /* The us-122l's descriptor defaults to iso max_packsize 78,
335 which isn't needed for samplerates <= 48000.
336 Lets save some memory:
338 switch (rate) {
339 case 44100:
340 use_packsize = 36;
341 break;
342 case 48000:
343 use_packsize = 42;
344 break;
345 case 88200:
346 use_packsize = 72;
347 break;
350 if (!usb_stream_new(&us122l->sk, us122l->chip.dev, 1, 2,
351 rate, use_packsize, period_frames, 6))
352 goto out;
354 err = us122l_set_sample_rate(us122l->chip.dev, rate);
355 if (err < 0) {
356 us122l_stop(us122l);
357 snd_printk(KERN_ERR "us122l_set_sample_rate error \n");
358 goto out;
360 err = usb_stream_start(&us122l->sk);
361 if (err < 0) {
362 us122l_stop(us122l);
363 snd_printk(KERN_ERR "us122l_start error %i \n", err);
364 goto out;
366 list_for_each(p, &us122l->chip.midi_list)
367 snd_usbmidi_input_start(p);
368 success = true;
369 out:
370 return success;
373 static int usb_stream_hwdep_ioctl(struct snd_hwdep *hw, struct file *file,
374 unsigned cmd, unsigned long arg)
376 struct usb_stream_config *cfg;
377 struct us122l *us122l = hw->private_data;
378 unsigned min_period_frames;
379 int err = 0;
380 bool high_speed;
382 if (cmd != SNDRV_USB_STREAM_IOCTL_SET_PARAMS)
383 return -ENOTTY;
385 cfg = memdup_user((void *)arg, sizeof(*cfg));
386 if (IS_ERR(cfg))
387 return PTR_ERR(cfg);
389 if (cfg->version != USB_STREAM_INTERFACE_VERSION) {
390 err = -ENXIO;
391 goto free;
393 high_speed = us122l->chip.dev->speed == USB_SPEED_HIGH;
394 if ((cfg->sample_rate != 44100 && cfg->sample_rate != 48000 &&
395 (!high_speed ||
396 (cfg->sample_rate != 88200 && cfg->sample_rate != 96000))) ||
397 cfg->frame_size != 6 ||
398 cfg->period_frames > 0x3000) {
399 err = -EINVAL;
400 goto free;
402 switch (cfg->sample_rate) {
403 case 44100:
404 min_period_frames = 48;
405 break;
406 case 48000:
407 min_period_frames = 52;
408 break;
409 default:
410 min_period_frames = 104;
411 break;
413 if (!high_speed)
414 min_period_frames <<= 1;
415 if (cfg->period_frames < min_period_frames) {
416 err = -EINVAL;
417 goto free;
420 snd_power_wait(hw->card, SNDRV_CTL_POWER_D0);
422 mutex_lock(&us122l->mutex);
423 if (!us122l->master)
424 us122l->master = file;
425 else if (us122l->master != file) {
426 if (memcmp(cfg, &us122l->sk.s->cfg, sizeof(*cfg))) {
427 err = -EIO;
428 goto unlock;
430 us122l->slave = file;
432 if (!us122l->sk.s ||
433 memcmp(cfg, &us122l->sk.s->cfg, sizeof(*cfg)) ||
434 us122l->sk.s->state == usb_stream_xrun) {
435 us122l_stop(us122l);
436 if (!us122l_start(us122l, cfg->sample_rate, cfg->period_frames))
437 err = -EIO;
438 else
439 err = 1;
441 unlock:
442 mutex_unlock(&us122l->mutex);
443 free:
444 kfree(cfg);
445 return err;
448 #define SND_USB_STREAM_ID "USB STREAM"
449 static int usb_stream_hwdep_new(struct snd_card *card)
451 int err;
452 struct snd_hwdep *hw;
453 struct usb_device *dev = US122L(card)->chip.dev;
455 err = snd_hwdep_new(card, SND_USB_STREAM_ID, 0, &hw);
456 if (err < 0)
457 return err;
459 hw->iface = SNDRV_HWDEP_IFACE_USB_STREAM;
460 hw->private_data = US122L(card);
461 hw->ops.open = usb_stream_hwdep_open;
462 hw->ops.release = usb_stream_hwdep_release;
463 hw->ops.ioctl = usb_stream_hwdep_ioctl;
464 hw->ops.ioctl_compat = usb_stream_hwdep_ioctl;
465 hw->ops.mmap = usb_stream_hwdep_mmap;
466 hw->ops.poll = usb_stream_hwdep_poll;
468 sprintf(hw->name, "/proc/bus/usb/%03d/%03d/hwdeppcm",
469 dev->bus->busnum, dev->devnum);
470 return 0;
474 static bool us122l_create_card(struct snd_card *card)
476 int err;
477 struct us122l *us122l = US122L(card);
479 if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) {
480 err = usb_set_interface(us122l->chip.dev, 0, 1);
481 if (err) {
482 snd_printk(KERN_ERR "usb_set_interface error \n");
483 return false;
486 err = usb_set_interface(us122l->chip.dev, 1, 1);
487 if (err) {
488 snd_printk(KERN_ERR "usb_set_interface error \n");
489 return false;
492 pt_info_set(us122l->chip.dev, 0x11);
493 pt_info_set(us122l->chip.dev, 0x10);
495 if (!us122l_start(us122l, 44100, 256))
496 return false;
498 if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144)
499 err = us144_create_usbmidi(card);
500 else
501 err = us122l_create_usbmidi(card);
502 if (err < 0) {
503 snd_printk(KERN_ERR "us122l_create_usbmidi error %i \n", err);
504 us122l_stop(us122l);
505 return false;
507 err = usb_stream_hwdep_new(card);
508 if (err < 0) {
509 /* release the midi resources */
510 struct list_head *p;
511 list_for_each(p, &us122l->chip.midi_list)
512 snd_usbmidi_disconnect(p);
514 us122l_stop(us122l);
515 return false;
517 return true;
520 static void snd_us122l_free(struct snd_card *card)
522 struct us122l *us122l = US122L(card);
523 int index = us122l->chip.index;
524 if (index >= 0 && index < SNDRV_CARDS)
525 snd_us122l_card_used[index] = 0;
528 static int usx2y_create_card(struct usb_device *device, struct snd_card **cardp)
530 int dev;
531 struct snd_card *card;
532 int err;
534 for (dev = 0; dev < SNDRV_CARDS; ++dev)
535 if (enable[dev] && !snd_us122l_card_used[dev])
536 break;
537 if (dev >= SNDRV_CARDS)
538 return -ENODEV;
539 err = snd_card_create(index[dev], id[dev], THIS_MODULE,
540 sizeof(struct us122l), &card);
541 if (err < 0)
542 return err;
543 snd_us122l_card_used[US122L(card)->chip.index = dev] = 1;
544 card->private_free = snd_us122l_free;
545 US122L(card)->chip.dev = device;
546 US122L(card)->chip.card = card;
547 mutex_init(&US122L(card)->mutex);
548 init_waitqueue_head(&US122L(card)->sk.sleep);
549 INIT_LIST_HEAD(&US122L(card)->chip.midi_list);
550 strcpy(card->driver, "USB "NAME_ALLCAPS"");
551 sprintf(card->shortname, "TASCAM "NAME_ALLCAPS"");
552 sprintf(card->longname, "%s (%x:%x if %d at %03d/%03d)",
553 card->shortname,
554 le16_to_cpu(device->descriptor.idVendor),
555 le16_to_cpu(device->descriptor.idProduct),
557 US122L(card)->chip.dev->bus->busnum,
558 US122L(card)->chip.dev->devnum
560 *cardp = card;
561 return 0;
564 static int us122l_usb_probe(struct usb_interface *intf,
565 const struct usb_device_id *device_id,
566 struct snd_card **cardp)
568 struct usb_device *device = interface_to_usbdev(intf);
569 struct snd_card *card;
570 int err;
572 err = usx2y_create_card(device, &card);
573 if (err < 0)
574 return err;
576 snd_card_set_dev(card, &intf->dev);
577 if (!us122l_create_card(card)) {
578 snd_card_free(card);
579 return -EINVAL;
582 err = snd_card_register(card);
583 if (err < 0) {
584 snd_card_free(card);
585 return err;
588 usb_get_intf(usb_ifnum_to_if(device, 0));
589 usb_get_dev(device);
590 *cardp = card;
591 return 0;
594 static int snd_us122l_probe(struct usb_interface *intf,
595 const struct usb_device_id *id)
597 struct usb_device *device = interface_to_usbdev(intf);
598 struct snd_card *card;
599 int err;
601 if (device->descriptor.idProduct == USB_ID_US144
602 && device->speed == USB_SPEED_HIGH) {
603 snd_printk(KERN_ERR "disable ehci-hcd to run US-144 \n");
604 return -ENOENT;
607 snd_printdd(KERN_DEBUG"%p:%i\n",
608 intf, intf->cur_altsetting->desc.bInterfaceNumber);
609 if (intf->cur_altsetting->desc.bInterfaceNumber != 1)
610 return 0;
612 err = us122l_usb_probe(usb_get_intf(intf), id, &card);
613 if (err < 0) {
614 usb_put_intf(intf);
615 return err;
618 usb_set_intfdata(intf, card);
619 return 0;
622 static void snd_us122l_disconnect(struct usb_interface *intf)
624 struct snd_card *card;
625 struct us122l *us122l;
626 struct list_head *p;
628 card = usb_get_intfdata(intf);
629 if (!card)
630 return;
632 snd_card_disconnect(card);
634 us122l = US122L(card);
635 mutex_lock(&us122l->mutex);
636 us122l_stop(us122l);
637 mutex_unlock(&us122l->mutex);
638 us122l->chip.shutdown = 1;
640 /* release the midi resources */
641 list_for_each(p, &us122l->chip.midi_list) {
642 snd_usbmidi_disconnect(p);
645 usb_put_intf(usb_ifnum_to_if(us122l->chip.dev, 0));
646 usb_put_intf(usb_ifnum_to_if(us122l->chip.dev, 1));
647 usb_put_dev(us122l->chip.dev);
649 while (atomic_read(&us122l->mmap_count))
650 msleep(500);
652 snd_card_free(card);
655 static int snd_us122l_suspend(struct usb_interface *intf, pm_message_t message)
657 struct snd_card *card;
658 struct us122l *us122l;
659 struct list_head *p;
661 card = usb_get_intfdata(intf);
662 if (!card)
663 return 0;
664 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
666 us122l = US122L(card);
667 if (!us122l)
668 return 0;
670 list_for_each(p, &us122l->chip.midi_list)
671 snd_usbmidi_input_stop(p);
673 mutex_lock(&us122l->mutex);
674 usb_stream_stop(&us122l->sk);
675 mutex_unlock(&us122l->mutex);
677 return 0;
680 static int snd_us122l_resume(struct usb_interface *intf)
682 struct snd_card *card;
683 struct us122l *us122l;
684 struct list_head *p;
685 int err;
687 card = usb_get_intfdata(intf);
688 if (!card)
689 return 0;
691 us122l = US122L(card);
692 if (!us122l)
693 return 0;
695 mutex_lock(&us122l->mutex);
696 /* needed, doesn't restart without: */
697 if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) {
698 err = usb_set_interface(us122l->chip.dev, 0, 1);
699 if (err) {
700 snd_printk(KERN_ERR "usb_set_interface error \n");
701 goto unlock;
704 err = usb_set_interface(us122l->chip.dev, 1, 1);
705 if (err) {
706 snd_printk(KERN_ERR "usb_set_interface error \n");
707 goto unlock;
710 pt_info_set(us122l->chip.dev, 0x11);
711 pt_info_set(us122l->chip.dev, 0x10);
713 err = us122l_set_sample_rate(us122l->chip.dev,
714 us122l->sk.s->cfg.sample_rate);
715 if (err < 0) {
716 snd_printk(KERN_ERR "us122l_set_sample_rate error \n");
717 goto unlock;
719 err = usb_stream_start(&us122l->sk);
720 if (err)
721 goto unlock;
723 list_for_each(p, &us122l->chip.midi_list)
724 snd_usbmidi_input_start(p);
725 unlock:
726 mutex_unlock(&us122l->mutex);
727 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
728 return err;
731 static struct usb_device_id snd_us122l_usb_id_table[] = {
733 .match_flags = USB_DEVICE_ID_MATCH_DEVICE,
734 .idVendor = 0x0644,
735 .idProduct = USB_ID_US122L
737 { /* US-144 only works at USB1.1! Disable module ehci-hcd. */
738 .match_flags = USB_DEVICE_ID_MATCH_DEVICE,
739 .idVendor = 0x0644,
740 .idProduct = USB_ID_US144
742 { /* terminator */ }
745 MODULE_DEVICE_TABLE(usb, snd_us122l_usb_id_table);
746 static struct usb_driver snd_us122l_usb_driver = {
747 .name = "snd-usb-us122l",
748 .probe = snd_us122l_probe,
749 .disconnect = snd_us122l_disconnect,
750 .suspend = snd_us122l_suspend,
751 .resume = snd_us122l_resume,
752 .reset_resume = snd_us122l_resume,
753 .id_table = snd_us122l_usb_id_table,
754 .supports_autosuspend = 1
758 static int __init snd_us122l_module_init(void)
760 return usb_register(&snd_us122l_usb_driver);
763 static void __exit snd_us122l_module_exit(void)
765 usb_deregister(&snd_us122l_usb_driver);
768 module_init(snd_us122l_module_init)
769 module_exit(snd_us122l_module_exit)