1030a07e4SKarsten Wiese /* 2030a07e4SKarsten Wiese * Copyright (C) 2007, 2008 Karsten Wiese <fzu@wemgehoertderstaat.de> 3030a07e4SKarsten Wiese * 4030a07e4SKarsten Wiese * This program is free software; you can redistribute it and/or modify it 5030a07e4SKarsten Wiese * under the terms of the GNU General Public License as published by the 6030a07e4SKarsten Wiese * Free Software Foundation; either version 2 of the License, or (at your 7030a07e4SKarsten Wiese * option) any later version. 8030a07e4SKarsten Wiese * 9030a07e4SKarsten Wiese * This program is distributed in the hope that it will be useful, but 10030a07e4SKarsten Wiese * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 11030a07e4SKarsten Wiese * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12030a07e4SKarsten Wiese * for more details. 13030a07e4SKarsten Wiese * 14030a07e4SKarsten Wiese * You should have received a copy of the GNU General Public License 15030a07e4SKarsten Wiese * along with this program; if not, write to the Free Software Foundation, 16030a07e4SKarsten Wiese * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17030a07e4SKarsten Wiese */ 18030a07e4SKarsten Wiese 195a0e3ad6STejun Heo #include <linux/slab.h> 20de48c7bcSDaniel Mack #include <linux/usb.h> 21de48c7bcSDaniel Mack #include <linux/usb/audio.h> 22da155d5bSPaul Gortmaker #include <linux/module.h> 23030a07e4SKarsten Wiese #include <sound/core.h> 24030a07e4SKarsten Wiese #include <sound/hwdep.h> 25030a07e4SKarsten Wiese #include <sound/pcm.h> 26030a07e4SKarsten Wiese #include <sound/initval.h> 27030a07e4SKarsten Wiese #define MODNAME "US122L" 28030a07e4SKarsten Wiese #include "usb_stream.c" 29030a07e4SKarsten Wiese #include "../usbaudio.h" 30e5779998SDaniel Mack #include "../midi.h" 31030a07e4SKarsten Wiese #include "us122l.h" 32030a07e4SKarsten Wiese 33030a07e4SKarsten Wiese MODULE_AUTHOR("Karsten Wiese <fzu@wemgehoertderstaat.de>"); 34030a07e4SKarsten Wiese MODULE_DESCRIPTION("TASCAM "NAME_ALLCAPS" Version 0.5"); 35030a07e4SKarsten Wiese MODULE_LICENSE("GPL"); 36030a07e4SKarsten Wiese 37030a07e4SKarsten Wiese static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */ 38030a07e4SKarsten Wiese static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for this card */ 39030a07e4SKarsten Wiese /* Enable this card */ 40a67ff6a5SRusty Russell static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 41030a07e4SKarsten Wiese 42030a07e4SKarsten Wiese module_param_array(index, int, NULL, 0444); 43030a07e4SKarsten Wiese MODULE_PARM_DESC(index, "Index value for "NAME_ALLCAPS"."); 44030a07e4SKarsten Wiese module_param_array(id, charp, NULL, 0444); 45030a07e4SKarsten Wiese MODULE_PARM_DESC(id, "ID string for "NAME_ALLCAPS"."); 46030a07e4SKarsten Wiese module_param_array(enable, bool, NULL, 0444); 47030a07e4SKarsten Wiese MODULE_PARM_DESC(enable, "Enable "NAME_ALLCAPS"."); 48030a07e4SKarsten Wiese 495c7e7d58SJohan Hovold /* driver_info flags */ 505c7e7d58SJohan Hovold #define US122L_FLAG_US144 BIT(0) 51030a07e4SKarsten Wiese 525c7e7d58SJohan Hovold static int snd_us122l_card_used[SNDRV_CARDS]; 53030a07e4SKarsten Wiese 54030a07e4SKarsten Wiese static int us122l_create_usbmidi(struct snd_card *card) 55030a07e4SKarsten Wiese { 56030a07e4SKarsten Wiese static struct snd_usb_midi_endpoint_info quirk_data = { 57030a07e4SKarsten Wiese .out_ep = 4, 58030a07e4SKarsten Wiese .in_ep = 3, 59030a07e4SKarsten Wiese .out_cables = 0x001, 60030a07e4SKarsten Wiese .in_cables = 0x001 61030a07e4SKarsten Wiese }; 62030a07e4SKarsten Wiese static struct snd_usb_audio_quirk quirk = { 63030a07e4SKarsten Wiese .vendor_name = "US122L", 64030a07e4SKarsten Wiese .product_name = NAME_ALLCAPS, 65030a07e4SKarsten Wiese .ifnum = 1, 66030a07e4SKarsten Wiese .type = QUIRK_MIDI_US122L, 67030a07e4SKarsten Wiese .data = &quirk_data 68030a07e4SKarsten Wiese }; 69a014bbadSClemens Ladisch struct usb_device *dev = US122L(card)->dev; 70030a07e4SKarsten Wiese struct usb_interface *iface = usb_ifnum_to_if(dev, 1); 71030a07e4SKarsten Wiese 72d82af9f9SClemens Ladisch return snd_usbmidi_create(card, iface, 73d82af9f9SClemens Ladisch &US122L(card)->midi_list, &quirk); 74030a07e4SKarsten Wiese } 75030a07e4SKarsten Wiese 764f272341STobias Hansen static int us144_create_usbmidi(struct snd_card *card) 774f272341STobias Hansen { 784f272341STobias Hansen static struct snd_usb_midi_endpoint_info quirk_data = { 794f272341STobias Hansen .out_ep = 4, 804f272341STobias Hansen .in_ep = 3, 814f272341STobias Hansen .out_cables = 0x001, 824f272341STobias Hansen .in_cables = 0x001 834f272341STobias Hansen }; 844f272341STobias Hansen static struct snd_usb_audio_quirk quirk = { 854f272341STobias Hansen .vendor_name = "US144", 864f272341STobias Hansen .product_name = NAME_ALLCAPS, 874f272341STobias Hansen .ifnum = 0, 884f272341STobias Hansen .type = QUIRK_MIDI_US122L, 894f272341STobias Hansen .data = &quirk_data 904f272341STobias Hansen }; 91a014bbadSClemens Ladisch struct usb_device *dev = US122L(card)->dev; 924f272341STobias Hansen struct usb_interface *iface = usb_ifnum_to_if(dev, 0); 934f272341STobias Hansen 94d82af9f9SClemens Ladisch return snd_usbmidi_create(card, iface, 95d82af9f9SClemens Ladisch &US122L(card)->midi_list, &quirk); 964f272341STobias Hansen } 974f272341STobias Hansen 98030a07e4SKarsten Wiese /* 99030a07e4SKarsten Wiese * Wrapper for usb_control_msg(). 100030a07e4SKarsten Wiese * Allocates a temp buffer to prevent dmaing from/to the stack. 101030a07e4SKarsten Wiese */ 102030a07e4SKarsten Wiese static int us122l_ctl_msg(struct usb_device *dev, unsigned int pipe, 103030a07e4SKarsten Wiese __u8 request, __u8 requesttype, 104030a07e4SKarsten Wiese __u16 value, __u16 index, void *data, 105030a07e4SKarsten Wiese __u16 size, int timeout) 106030a07e4SKarsten Wiese { 107030a07e4SKarsten Wiese int err; 108030a07e4SKarsten Wiese void *buf = NULL; 109030a07e4SKarsten Wiese 110030a07e4SKarsten Wiese if (size > 0) { 111030a07e4SKarsten Wiese buf = kmemdup(data, size, GFP_KERNEL); 112030a07e4SKarsten Wiese if (!buf) 113030a07e4SKarsten Wiese return -ENOMEM; 114030a07e4SKarsten Wiese } 115030a07e4SKarsten Wiese err = usb_control_msg(dev, pipe, request, requesttype, 116030a07e4SKarsten Wiese value, index, buf, size, timeout); 117030a07e4SKarsten Wiese if (size > 0) { 118030a07e4SKarsten Wiese memcpy(data, buf, size); 119030a07e4SKarsten Wiese kfree(buf); 120030a07e4SKarsten Wiese } 121030a07e4SKarsten Wiese return err; 122030a07e4SKarsten Wiese } 123030a07e4SKarsten Wiese 124030a07e4SKarsten Wiese static void pt_info_set(struct usb_device *dev, u8 v) 125030a07e4SKarsten Wiese { 126030a07e4SKarsten Wiese int ret; 127030a07e4SKarsten Wiese 128030a07e4SKarsten Wiese ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 129030a07e4SKarsten Wiese 'I', 130030a07e4SKarsten Wiese USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 131030a07e4SKarsten Wiese v, 0, NULL, 0, 1000); 132030a07e4SKarsten Wiese snd_printdd(KERN_DEBUG "%i\n", ret); 133030a07e4SKarsten Wiese } 134030a07e4SKarsten Wiese 135030a07e4SKarsten Wiese static void usb_stream_hwdep_vm_open(struct vm_area_struct *area) 136030a07e4SKarsten Wiese { 137030a07e4SKarsten Wiese struct us122l *us122l = area->vm_private_data; 138030a07e4SKarsten Wiese atomic_inc(&us122l->mmap_count); 139030a07e4SKarsten Wiese snd_printdd(KERN_DEBUG "%i\n", atomic_read(&us122l->mmap_count)); 140030a07e4SKarsten Wiese } 141030a07e4SKarsten Wiese 14211bac800SDave Jiang static int usb_stream_hwdep_vm_fault(struct vm_fault *vmf) 143030a07e4SKarsten Wiese { 144030a07e4SKarsten Wiese unsigned long offset; 145030a07e4SKarsten Wiese struct page *page; 146030a07e4SKarsten Wiese void *vaddr; 14711bac800SDave Jiang struct us122l *us122l = vmf->vma->vm_private_data; 148030a07e4SKarsten Wiese struct usb_stream *s; 149030a07e4SKarsten Wiese 150030a07e4SKarsten Wiese mutex_lock(&us122l->mutex); 151030a07e4SKarsten Wiese s = us122l->sk.s; 152030a07e4SKarsten Wiese if (!s) 153428ffb71SLi Zefan goto unlock; 154030a07e4SKarsten Wiese 155030a07e4SKarsten Wiese offset = vmf->pgoff << PAGE_SHIFT; 156030a07e4SKarsten Wiese if (offset < PAGE_ALIGN(s->read_size)) 157030a07e4SKarsten Wiese vaddr = (char *)s + offset; 158030a07e4SKarsten Wiese else { 159030a07e4SKarsten Wiese offset -= PAGE_ALIGN(s->read_size); 160030a07e4SKarsten Wiese if (offset >= PAGE_ALIGN(s->write_size)) 161428ffb71SLi Zefan goto unlock; 162030a07e4SKarsten Wiese 163030a07e4SKarsten Wiese vaddr = us122l->sk.write_page + offset; 164030a07e4SKarsten Wiese } 165030a07e4SKarsten Wiese page = virt_to_page(vaddr); 166030a07e4SKarsten Wiese 167030a07e4SKarsten Wiese get_page(page); 168030a07e4SKarsten Wiese mutex_unlock(&us122l->mutex); 169030a07e4SKarsten Wiese 170030a07e4SKarsten Wiese vmf->page = page; 171428ffb71SLi Zefan 172428ffb71SLi Zefan return 0; 173428ffb71SLi Zefan unlock: 174428ffb71SLi Zefan mutex_unlock(&us122l->mutex); 175428ffb71SLi Zefan return VM_FAULT_SIGBUS; 176030a07e4SKarsten Wiese } 177030a07e4SKarsten Wiese 178030a07e4SKarsten Wiese static void usb_stream_hwdep_vm_close(struct vm_area_struct *area) 179030a07e4SKarsten Wiese { 180030a07e4SKarsten Wiese struct us122l *us122l = area->vm_private_data; 181030a07e4SKarsten Wiese atomic_dec(&us122l->mmap_count); 182030a07e4SKarsten Wiese snd_printdd(KERN_DEBUG "%i\n", atomic_read(&us122l->mmap_count)); 183030a07e4SKarsten Wiese } 184030a07e4SKarsten Wiese 185f0f37e2fSAlexey Dobriyan static const struct vm_operations_struct usb_stream_hwdep_vm_ops = { 186030a07e4SKarsten Wiese .open = usb_stream_hwdep_vm_open, 187030a07e4SKarsten Wiese .fault = usb_stream_hwdep_vm_fault, 188030a07e4SKarsten Wiese .close = usb_stream_hwdep_vm_close, 189030a07e4SKarsten Wiese }; 190030a07e4SKarsten Wiese 191030a07e4SKarsten Wiese 192030a07e4SKarsten Wiese static int usb_stream_hwdep_open(struct snd_hwdep *hw, struct file *file) 193030a07e4SKarsten Wiese { 194030a07e4SKarsten Wiese struct us122l *us122l = hw->private_data; 195030a07e4SKarsten Wiese struct usb_interface *iface; 196030a07e4SKarsten Wiese snd_printdd(KERN_DEBUG "%p %p\n", hw, file); 197030a07e4SKarsten Wiese if (hw->used >= 2) 198030a07e4SKarsten Wiese return -EBUSY; 199030a07e4SKarsten Wiese 200030a07e4SKarsten Wiese if (!us122l->first) 201030a07e4SKarsten Wiese us122l->first = file; 2024f272341STobias Hansen 2035c7e7d58SJohan Hovold if (us122l->is_us144) { 204a014bbadSClemens Ladisch iface = usb_ifnum_to_if(us122l->dev, 0); 2054f272341STobias Hansen usb_autopm_get_interface(iface); 2064f272341STobias Hansen } 207a014bbadSClemens Ladisch iface = usb_ifnum_to_if(us122l->dev, 1); 208030a07e4SKarsten Wiese usb_autopm_get_interface(iface); 209030a07e4SKarsten Wiese return 0; 210030a07e4SKarsten Wiese } 211030a07e4SKarsten Wiese 212030a07e4SKarsten Wiese static int usb_stream_hwdep_release(struct snd_hwdep *hw, struct file *file) 213030a07e4SKarsten Wiese { 214030a07e4SKarsten Wiese struct us122l *us122l = hw->private_data; 2154f272341STobias Hansen struct usb_interface *iface; 216030a07e4SKarsten Wiese snd_printdd(KERN_DEBUG "%p %p\n", hw, file); 2174f272341STobias Hansen 2185c7e7d58SJohan Hovold if (us122l->is_us144) { 219a014bbadSClemens Ladisch iface = usb_ifnum_to_if(us122l->dev, 0); 2204f272341STobias Hansen usb_autopm_put_interface(iface); 2214f272341STobias Hansen } 222a014bbadSClemens Ladisch iface = usb_ifnum_to_if(us122l->dev, 1); 223030a07e4SKarsten Wiese usb_autopm_put_interface(iface); 224030a07e4SKarsten Wiese if (us122l->first == file) 225030a07e4SKarsten Wiese us122l->first = NULL; 226030a07e4SKarsten Wiese mutex_lock(&us122l->mutex); 227030a07e4SKarsten Wiese if (us122l->master == file) 228030a07e4SKarsten Wiese us122l->master = us122l->slave; 229030a07e4SKarsten Wiese 230030a07e4SKarsten Wiese us122l->slave = NULL; 231030a07e4SKarsten Wiese mutex_unlock(&us122l->mutex); 232030a07e4SKarsten Wiese return 0; 233030a07e4SKarsten Wiese } 234030a07e4SKarsten Wiese 235030a07e4SKarsten Wiese static int usb_stream_hwdep_mmap(struct snd_hwdep *hw, 236030a07e4SKarsten Wiese struct file *filp, struct vm_area_struct *area) 237030a07e4SKarsten Wiese { 238030a07e4SKarsten Wiese unsigned long size = area->vm_end - area->vm_start; 239030a07e4SKarsten Wiese struct us122l *us122l = hw->private_data; 240030a07e4SKarsten Wiese unsigned long offset; 241030a07e4SKarsten Wiese struct usb_stream *s; 242030a07e4SKarsten Wiese int err = 0; 243030a07e4SKarsten Wiese bool read; 244030a07e4SKarsten Wiese 245030a07e4SKarsten Wiese offset = area->vm_pgoff << PAGE_SHIFT; 246030a07e4SKarsten Wiese mutex_lock(&us122l->mutex); 247030a07e4SKarsten Wiese s = us122l->sk.s; 248030a07e4SKarsten Wiese read = offset < s->read_size; 249030a07e4SKarsten Wiese if (read && area->vm_flags & VM_WRITE) { 250030a07e4SKarsten Wiese err = -EPERM; 251030a07e4SKarsten Wiese goto out; 252030a07e4SKarsten Wiese } 253030a07e4SKarsten Wiese snd_printdd(KERN_DEBUG "%lu %u\n", size, 254030a07e4SKarsten Wiese read ? s->read_size : s->write_size); 255030a07e4SKarsten Wiese /* if userspace tries to mmap beyond end of our buffer, fail */ 256030a07e4SKarsten Wiese if (size > PAGE_ALIGN(read ? s->read_size : s->write_size)) { 257030a07e4SKarsten Wiese snd_printk(KERN_WARNING "%lu > %u\n", size, 258030a07e4SKarsten Wiese read ? s->read_size : s->write_size); 259030a07e4SKarsten Wiese err = -EINVAL; 260030a07e4SKarsten Wiese goto out; 261030a07e4SKarsten Wiese } 262030a07e4SKarsten Wiese 263030a07e4SKarsten Wiese area->vm_ops = &usb_stream_hwdep_vm_ops; 264ac536a84STakashi Iwai area->vm_flags |= VM_DONTDUMP; 265ac536a84STakashi Iwai if (!read) 266ac536a84STakashi Iwai area->vm_flags |= VM_DONTEXPAND; 267030a07e4SKarsten Wiese area->vm_private_data = us122l; 268030a07e4SKarsten Wiese atomic_inc(&us122l->mmap_count); 269030a07e4SKarsten Wiese out: 270030a07e4SKarsten Wiese mutex_unlock(&us122l->mutex); 271030a07e4SKarsten Wiese return err; 272030a07e4SKarsten Wiese } 273030a07e4SKarsten Wiese 274030a07e4SKarsten Wiese static unsigned int usb_stream_hwdep_poll(struct snd_hwdep *hw, 275030a07e4SKarsten Wiese struct file *file, poll_table *wait) 276030a07e4SKarsten Wiese { 277030a07e4SKarsten Wiese struct us122l *us122l = hw->private_data; 278030a07e4SKarsten Wiese unsigned *polled; 279030a07e4SKarsten Wiese unsigned int mask; 280030a07e4SKarsten Wiese 281030a07e4SKarsten Wiese poll_wait(file, &us122l->sk.sleep, wait); 282030a07e4SKarsten Wiese 283cdce2db7SKarsten Wiese mask = POLLIN | POLLOUT | POLLWRNORM | POLLERR; 284cdce2db7SKarsten Wiese if (mutex_trylock(&us122l->mutex)) { 285cdce2db7SKarsten Wiese struct usb_stream *s = us122l->sk.s; 286cdce2db7SKarsten Wiese if (s && s->state == usb_stream_ready) { 287030a07e4SKarsten Wiese if (us122l->first == file) 288030a07e4SKarsten Wiese polled = &s->periods_polled; 289030a07e4SKarsten Wiese else 290030a07e4SKarsten Wiese polled = &us122l->second_periods_polled; 291030a07e4SKarsten Wiese if (*polled != s->periods_done) { 292030a07e4SKarsten Wiese *polled = s->periods_done; 293030a07e4SKarsten Wiese mask = POLLIN | POLLOUT | POLLWRNORM; 294cdce2db7SKarsten Wiese } else 295030a07e4SKarsten Wiese mask = 0; 296cdce2db7SKarsten Wiese } 297cdce2db7SKarsten Wiese mutex_unlock(&us122l->mutex); 298030a07e4SKarsten Wiese } 299030a07e4SKarsten Wiese return mask; 300030a07e4SKarsten Wiese } 301030a07e4SKarsten Wiese 302030a07e4SKarsten Wiese static void us122l_stop(struct us122l *us122l) 303030a07e4SKarsten Wiese { 304030a07e4SKarsten Wiese struct list_head *p; 305d82af9f9SClemens Ladisch list_for_each(p, &us122l->midi_list) 306030a07e4SKarsten Wiese snd_usbmidi_input_stop(p); 307030a07e4SKarsten Wiese 308030a07e4SKarsten Wiese usb_stream_stop(&us122l->sk); 309030a07e4SKarsten Wiese usb_stream_free(&us122l->sk); 310030a07e4SKarsten Wiese } 311030a07e4SKarsten Wiese 312030a07e4SKarsten Wiese static int us122l_set_sample_rate(struct usb_device *dev, int rate) 313030a07e4SKarsten Wiese { 314030a07e4SKarsten Wiese unsigned int ep = 0x81; 315030a07e4SKarsten Wiese unsigned char data[3]; 316030a07e4SKarsten Wiese int err; 317030a07e4SKarsten Wiese 318030a07e4SKarsten Wiese data[0] = rate; 319030a07e4SKarsten Wiese data[1] = rate >> 8; 320030a07e4SKarsten Wiese data[2] = rate >> 16; 321de48c7bcSDaniel Mack err = us122l_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC_SET_CUR, 322030a07e4SKarsten Wiese USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_OUT, 323de48c7bcSDaniel Mack UAC_EP_CS_ATTR_SAMPLE_RATE << 8, ep, data, 3, 1000); 324030a07e4SKarsten Wiese if (err < 0) 325030a07e4SKarsten Wiese snd_printk(KERN_ERR "%d: cannot set freq %d to ep 0x%x\n", 326030a07e4SKarsten Wiese dev->devnum, rate, ep); 327030a07e4SKarsten Wiese return err; 328030a07e4SKarsten Wiese } 329030a07e4SKarsten Wiese 330030a07e4SKarsten Wiese static bool us122l_start(struct us122l *us122l, 331030a07e4SKarsten Wiese unsigned rate, unsigned period_frames) 332030a07e4SKarsten Wiese { 333030a07e4SKarsten Wiese struct list_head *p; 334030a07e4SKarsten Wiese int err; 335030a07e4SKarsten Wiese unsigned use_packsize = 0; 336030a07e4SKarsten Wiese bool success = false; 337030a07e4SKarsten Wiese 338a014bbadSClemens Ladisch if (us122l->dev->speed == USB_SPEED_HIGH) { 339030a07e4SKarsten Wiese /* The us-122l's descriptor defaults to iso max_packsize 78, 340030a07e4SKarsten Wiese which isn't needed for samplerates <= 48000. 341030a07e4SKarsten Wiese Lets save some memory: 342030a07e4SKarsten Wiese */ 343030a07e4SKarsten Wiese switch (rate) { 344030a07e4SKarsten Wiese case 44100: 345030a07e4SKarsten Wiese use_packsize = 36; 346030a07e4SKarsten Wiese break; 347030a07e4SKarsten Wiese case 48000: 348030a07e4SKarsten Wiese use_packsize = 42; 349030a07e4SKarsten Wiese break; 350030a07e4SKarsten Wiese case 88200: 351030a07e4SKarsten Wiese use_packsize = 72; 352030a07e4SKarsten Wiese break; 353030a07e4SKarsten Wiese } 354030a07e4SKarsten Wiese } 355a014bbadSClemens Ladisch if (!usb_stream_new(&us122l->sk, us122l->dev, 1, 2, 356030a07e4SKarsten Wiese rate, use_packsize, period_frames, 6)) 357030a07e4SKarsten Wiese goto out; 358030a07e4SKarsten Wiese 359a014bbadSClemens Ladisch err = us122l_set_sample_rate(us122l->dev, rate); 360030a07e4SKarsten Wiese if (err < 0) { 361030a07e4SKarsten Wiese us122l_stop(us122l); 362030a07e4SKarsten Wiese snd_printk(KERN_ERR "us122l_set_sample_rate error \n"); 363030a07e4SKarsten Wiese goto out; 364030a07e4SKarsten Wiese } 365030a07e4SKarsten Wiese err = usb_stream_start(&us122l->sk); 366030a07e4SKarsten Wiese if (err < 0) { 367030a07e4SKarsten Wiese us122l_stop(us122l); 368030a07e4SKarsten Wiese snd_printk(KERN_ERR "us122l_start error %i \n", err); 369030a07e4SKarsten Wiese goto out; 370030a07e4SKarsten Wiese } 371d82af9f9SClemens Ladisch list_for_each(p, &us122l->midi_list) 372030a07e4SKarsten Wiese snd_usbmidi_input_start(p); 373030a07e4SKarsten Wiese success = true; 374030a07e4SKarsten Wiese out: 375030a07e4SKarsten Wiese return success; 376030a07e4SKarsten Wiese } 377030a07e4SKarsten Wiese 378030a07e4SKarsten Wiese static int usb_stream_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, 379030a07e4SKarsten Wiese unsigned cmd, unsigned long arg) 380030a07e4SKarsten Wiese { 3813d46d710SAl Viro struct usb_stream_config cfg; 382030a07e4SKarsten Wiese struct us122l *us122l = hw->private_data; 383cdce2db7SKarsten Wiese struct usb_stream *s; 384030a07e4SKarsten Wiese unsigned min_period_frames; 385030a07e4SKarsten Wiese int err = 0; 386030a07e4SKarsten Wiese bool high_speed; 387030a07e4SKarsten Wiese 388030a07e4SKarsten Wiese if (cmd != SNDRV_USB_STREAM_IOCTL_SET_PARAMS) 389030a07e4SKarsten Wiese return -ENOTTY; 390030a07e4SKarsten Wiese 3913d46d710SAl Viro if (copy_from_user(&cfg, (void __user *)arg, sizeof(cfg))) 3923d46d710SAl Viro return -EFAULT; 393030a07e4SKarsten Wiese 3943d46d710SAl Viro if (cfg.version != USB_STREAM_INTERFACE_VERSION) 3953d46d710SAl Viro return -ENXIO; 3963d46d710SAl Viro 397a014bbadSClemens Ladisch high_speed = us122l->dev->speed == USB_SPEED_HIGH; 3983d46d710SAl Viro if ((cfg.sample_rate != 44100 && cfg.sample_rate != 48000 && 399030a07e4SKarsten Wiese (!high_speed || 4003d46d710SAl Viro (cfg.sample_rate != 88200 && cfg.sample_rate != 96000))) || 4013d46d710SAl Viro cfg.frame_size != 6 || 4023d46d710SAl Viro cfg.period_frames > 0x3000) 4033d46d710SAl Viro return -EINVAL; 4043d46d710SAl Viro 4053d46d710SAl Viro switch (cfg.sample_rate) { 406030a07e4SKarsten Wiese case 44100: 407030a07e4SKarsten Wiese min_period_frames = 48; 408030a07e4SKarsten Wiese break; 409030a07e4SKarsten Wiese case 48000: 410030a07e4SKarsten Wiese min_period_frames = 52; 411030a07e4SKarsten Wiese break; 412030a07e4SKarsten Wiese default: 413030a07e4SKarsten Wiese min_period_frames = 104; 414030a07e4SKarsten Wiese break; 415030a07e4SKarsten Wiese } 416030a07e4SKarsten Wiese if (!high_speed) 417030a07e4SKarsten Wiese min_period_frames <<= 1; 4183d46d710SAl Viro if (cfg.period_frames < min_period_frames) 4193d46d710SAl Viro return -EINVAL; 420030a07e4SKarsten Wiese 421030a07e4SKarsten Wiese snd_power_wait(hw->card, SNDRV_CTL_POWER_D0); 422030a07e4SKarsten Wiese 423030a07e4SKarsten Wiese mutex_lock(&us122l->mutex); 424cdce2db7SKarsten Wiese s = us122l->sk.s; 425030a07e4SKarsten Wiese if (!us122l->master) 426030a07e4SKarsten Wiese us122l->master = file; 427030a07e4SKarsten Wiese else if (us122l->master != file) { 4283d46d710SAl Viro if (!s || memcmp(&cfg, &s->cfg, sizeof(cfg))) { 429030a07e4SKarsten Wiese err = -EIO; 430030a07e4SKarsten Wiese goto unlock; 431030a07e4SKarsten Wiese } 432030a07e4SKarsten Wiese us122l->slave = file; 433030a07e4SKarsten Wiese } 4343d46d710SAl Viro if (!s || memcmp(&cfg, &s->cfg, sizeof(cfg)) || 435cdce2db7SKarsten Wiese s->state == usb_stream_xrun) { 436030a07e4SKarsten Wiese us122l_stop(us122l); 4373d46d710SAl Viro if (!us122l_start(us122l, cfg.sample_rate, cfg.period_frames)) 438030a07e4SKarsten Wiese err = -EIO; 439030a07e4SKarsten Wiese else 440030a07e4SKarsten Wiese err = 1; 441030a07e4SKarsten Wiese } 442030a07e4SKarsten Wiese unlock: 443030a07e4SKarsten Wiese mutex_unlock(&us122l->mutex); 444cdce2db7SKarsten Wiese wake_up_all(&us122l->sk.sleep); 445030a07e4SKarsten Wiese return err; 446030a07e4SKarsten Wiese } 447030a07e4SKarsten Wiese 448030a07e4SKarsten Wiese #define SND_USB_STREAM_ID "USB STREAM" 449030a07e4SKarsten Wiese static int usb_stream_hwdep_new(struct snd_card *card) 450030a07e4SKarsten Wiese { 451030a07e4SKarsten Wiese int err; 452030a07e4SKarsten Wiese struct snd_hwdep *hw; 453a014bbadSClemens Ladisch struct usb_device *dev = US122L(card)->dev; 454030a07e4SKarsten Wiese 455030a07e4SKarsten Wiese err = snd_hwdep_new(card, SND_USB_STREAM_ID, 0, &hw); 456030a07e4SKarsten Wiese if (err < 0) 457030a07e4SKarsten Wiese return err; 458030a07e4SKarsten Wiese 459030a07e4SKarsten Wiese hw->iface = SNDRV_HWDEP_IFACE_USB_STREAM; 460030a07e4SKarsten Wiese hw->private_data = US122L(card); 461030a07e4SKarsten Wiese hw->ops.open = usb_stream_hwdep_open; 462030a07e4SKarsten Wiese hw->ops.release = usb_stream_hwdep_release; 463030a07e4SKarsten Wiese hw->ops.ioctl = usb_stream_hwdep_ioctl; 464030a07e4SKarsten Wiese hw->ops.ioctl_compat = usb_stream_hwdep_ioctl; 465030a07e4SKarsten Wiese hw->ops.mmap = usb_stream_hwdep_mmap; 466030a07e4SKarsten Wiese hw->ops.poll = usb_stream_hwdep_poll; 467030a07e4SKarsten Wiese 468a5f8661dSMauro Carvalho Chehab sprintf(hw->name, "/dev/bus/usb/%03d/%03d/hwdeppcm", 469030a07e4SKarsten Wiese dev->bus->busnum, dev->devnum); 470030a07e4SKarsten Wiese return 0; 471030a07e4SKarsten Wiese } 472030a07e4SKarsten Wiese 473030a07e4SKarsten Wiese 474030a07e4SKarsten Wiese static bool us122l_create_card(struct snd_card *card) 475030a07e4SKarsten Wiese { 476030a07e4SKarsten Wiese int err; 477030a07e4SKarsten Wiese struct us122l *us122l = US122L(card); 478030a07e4SKarsten Wiese 4795c7e7d58SJohan Hovold if (us122l->is_us144) { 480a014bbadSClemens Ladisch err = usb_set_interface(us122l->dev, 0, 1); 4814f272341STobias Hansen if (err) { 4824f272341STobias Hansen snd_printk(KERN_ERR "usb_set_interface error \n"); 4834f272341STobias Hansen return false; 4844f272341STobias Hansen } 4854f272341STobias Hansen } 486a014bbadSClemens Ladisch err = usb_set_interface(us122l->dev, 1, 1); 487030a07e4SKarsten Wiese if (err) { 488030a07e4SKarsten Wiese snd_printk(KERN_ERR "usb_set_interface error \n"); 489030a07e4SKarsten Wiese return false; 490030a07e4SKarsten Wiese } 491030a07e4SKarsten Wiese 492a014bbadSClemens Ladisch pt_info_set(us122l->dev, 0x11); 493a014bbadSClemens Ladisch pt_info_set(us122l->dev, 0x10); 494030a07e4SKarsten Wiese 495030a07e4SKarsten Wiese if (!us122l_start(us122l, 44100, 256)) 496030a07e4SKarsten Wiese return false; 497030a07e4SKarsten Wiese 4985c7e7d58SJohan Hovold if (us122l->is_us144) 4994f272341STobias Hansen err = us144_create_usbmidi(card); 5004f272341STobias Hansen else 501030a07e4SKarsten Wiese err = us122l_create_usbmidi(card); 502030a07e4SKarsten Wiese if (err < 0) { 503030a07e4SKarsten Wiese snd_printk(KERN_ERR "us122l_create_usbmidi error %i \n", err); 50480753cdfSMarkus Elfring goto stop; 505030a07e4SKarsten Wiese } 506030a07e4SKarsten Wiese err = usb_stream_hwdep_new(card); 507030a07e4SKarsten Wiese if (err < 0) { 508030a07e4SKarsten Wiese /* release the midi resources */ 509030a07e4SKarsten Wiese struct list_head *p; 510d82af9f9SClemens Ladisch list_for_each(p, &us122l->midi_list) 511030a07e4SKarsten Wiese snd_usbmidi_disconnect(p); 512030a07e4SKarsten Wiese 51380753cdfSMarkus Elfring goto stop; 514030a07e4SKarsten Wiese } 515030a07e4SKarsten Wiese return true; 51680753cdfSMarkus Elfring 51780753cdfSMarkus Elfring stop: 51880753cdfSMarkus Elfring us122l_stop(us122l); 51980753cdfSMarkus Elfring return false; 520030a07e4SKarsten Wiese } 521030a07e4SKarsten Wiese 5225d4af1beSKarsten Wiese static void snd_us122l_free(struct snd_card *card) 5235d4af1beSKarsten Wiese { 5245d4af1beSKarsten Wiese struct us122l *us122l = US122L(card); 525a014bbadSClemens Ladisch int index = us122l->card_index; 5265d4af1beSKarsten Wiese if (index >= 0 && index < SNDRV_CARDS) 5275d4af1beSKarsten Wiese snd_us122l_card_used[index] = 0; 5285d4af1beSKarsten Wiese } 5295d4af1beSKarsten Wiese 530874b8d42STakashi Iwai static int usx2y_create_card(struct usb_device *device, 531874b8d42STakashi Iwai struct usb_interface *intf, 5325c7e7d58SJohan Hovold struct snd_card **cardp, 5335c7e7d58SJohan Hovold unsigned long flags) 534030a07e4SKarsten Wiese { 535030a07e4SKarsten Wiese int dev; 536030a07e4SKarsten Wiese struct snd_card *card; 537bd7dd77cSTakashi Iwai int err; 538bd7dd77cSTakashi Iwai 539030a07e4SKarsten Wiese for (dev = 0; dev < SNDRV_CARDS; ++dev) 540030a07e4SKarsten Wiese if (enable[dev] && !snd_us122l_card_used[dev]) 541030a07e4SKarsten Wiese break; 542030a07e4SKarsten Wiese if (dev >= SNDRV_CARDS) 54351721f70STakashi Iwai return -ENODEV; 544874b8d42STakashi Iwai err = snd_card_new(&intf->dev, index[dev], id[dev], THIS_MODULE, 545bd7dd77cSTakashi Iwai sizeof(struct us122l), &card); 546bd7dd77cSTakashi Iwai if (err < 0) 54751721f70STakashi Iwai return err; 548a014bbadSClemens Ladisch snd_us122l_card_used[US122L(card)->card_index = dev] = 1; 5495d4af1beSKarsten Wiese card->private_free = snd_us122l_free; 550a014bbadSClemens Ladisch US122L(card)->dev = device; 551030a07e4SKarsten Wiese mutex_init(&US122L(card)->mutex); 552030a07e4SKarsten Wiese init_waitqueue_head(&US122L(card)->sk.sleep); 5535c7e7d58SJohan Hovold US122L(card)->is_us144 = flags & US122L_FLAG_US144; 554d82af9f9SClemens Ladisch INIT_LIST_HEAD(&US122L(card)->midi_list); 555030a07e4SKarsten Wiese strcpy(card->driver, "USB "NAME_ALLCAPS""); 556030a07e4SKarsten Wiese sprintf(card->shortname, "TASCAM "NAME_ALLCAPS""); 557030a07e4SKarsten Wiese sprintf(card->longname, "%s (%x:%x if %d at %03d/%03d)", 558030a07e4SKarsten Wiese card->shortname, 559030a07e4SKarsten Wiese le16_to_cpu(device->descriptor.idVendor), 560030a07e4SKarsten Wiese le16_to_cpu(device->descriptor.idProduct), 561030a07e4SKarsten Wiese 0, 562a014bbadSClemens Ladisch US122L(card)->dev->bus->busnum, 563a014bbadSClemens Ladisch US122L(card)->dev->devnum 564030a07e4SKarsten Wiese ); 56551721f70STakashi Iwai *cardp = card; 56651721f70STakashi Iwai return 0; 567030a07e4SKarsten Wiese } 568030a07e4SKarsten Wiese 56951721f70STakashi Iwai static int us122l_usb_probe(struct usb_interface *intf, 57051721f70STakashi Iwai const struct usb_device_id *device_id, 57151721f70STakashi Iwai struct snd_card **cardp) 572030a07e4SKarsten Wiese { 573030a07e4SKarsten Wiese struct usb_device *device = interface_to_usbdev(intf); 57451721f70STakashi Iwai struct snd_card *card; 57551721f70STakashi Iwai int err; 576030a07e4SKarsten Wiese 5775c7e7d58SJohan Hovold err = usx2y_create_card(device, intf, &card, device_id->driver_info); 57851721f70STakashi Iwai if (err < 0) 57951721f70STakashi Iwai return err; 580030a07e4SKarsten Wiese 58151721f70STakashi Iwai if (!us122l_create_card(card)) { 582030a07e4SKarsten Wiese snd_card_free(card); 58351721f70STakashi Iwai return -EINVAL; 58451721f70STakashi Iwai } 58551721f70STakashi Iwai 58651721f70STakashi Iwai err = snd_card_register(card); 58751721f70STakashi Iwai if (err < 0) { 58851721f70STakashi Iwai snd_card_free(card); 58951721f70STakashi Iwai return err; 590030a07e4SKarsten Wiese } 591030a07e4SKarsten Wiese 5924f272341STobias Hansen usb_get_intf(usb_ifnum_to_if(device, 0)); 593030a07e4SKarsten Wiese usb_get_dev(device); 59451721f70STakashi Iwai *cardp = card; 59551721f70STakashi Iwai return 0; 596030a07e4SKarsten Wiese } 597030a07e4SKarsten Wiese 598030a07e4SKarsten Wiese static int snd_us122l_probe(struct usb_interface *intf, 599030a07e4SKarsten Wiese const struct usb_device_id *id) 600030a07e4SKarsten Wiese { 6014f272341STobias Hansen struct usb_device *device = interface_to_usbdev(intf); 602030a07e4SKarsten Wiese struct snd_card *card; 60351721f70STakashi Iwai int err; 60451721f70STakashi Iwai 6055c7e7d58SJohan Hovold if (id->driver_info & US122L_FLAG_US144 && 6065c7e7d58SJohan Hovold device->speed == USB_SPEED_HIGH) { 6074f272341STobias Hansen snd_printk(KERN_ERR "disable ehci-hcd to run US-144 \n"); 608a688e488STobias Hansen return -ENODEV; 6094f272341STobias Hansen } 6104f272341STobias Hansen 611030a07e4SKarsten Wiese snd_printdd(KERN_DEBUG"%p:%i\n", 612030a07e4SKarsten Wiese intf, intf->cur_altsetting->desc.bInterfaceNumber); 613030a07e4SKarsten Wiese if (intf->cur_altsetting->desc.bInterfaceNumber != 1) 614030a07e4SKarsten Wiese return 0; 615030a07e4SKarsten Wiese 61651721f70STakashi Iwai err = us122l_usb_probe(usb_get_intf(intf), id, &card); 61751721f70STakashi Iwai if (err < 0) { 61851721f70STakashi Iwai usb_put_intf(intf); 61951721f70STakashi Iwai return err; 620030a07e4SKarsten Wiese } 621030a07e4SKarsten Wiese 62251721f70STakashi Iwai usb_set_intfdata(intf, card); 62351721f70STakashi Iwai return 0; 624030a07e4SKarsten Wiese } 625030a07e4SKarsten Wiese 626030a07e4SKarsten Wiese static void snd_us122l_disconnect(struct usb_interface *intf) 627030a07e4SKarsten Wiese { 628030a07e4SKarsten Wiese struct snd_card *card; 629030a07e4SKarsten Wiese struct us122l *us122l; 630030a07e4SKarsten Wiese struct list_head *p; 631030a07e4SKarsten Wiese 632030a07e4SKarsten Wiese card = usb_get_intfdata(intf); 633030a07e4SKarsten Wiese if (!card) 634030a07e4SKarsten Wiese return; 635030a07e4SKarsten Wiese 636030a07e4SKarsten Wiese snd_card_disconnect(card); 637030a07e4SKarsten Wiese 638030a07e4SKarsten Wiese us122l = US122L(card); 639030a07e4SKarsten Wiese mutex_lock(&us122l->mutex); 640030a07e4SKarsten Wiese us122l_stop(us122l); 641030a07e4SKarsten Wiese mutex_unlock(&us122l->mutex); 642030a07e4SKarsten Wiese 643030a07e4SKarsten Wiese /* release the midi resources */ 644d82af9f9SClemens Ladisch list_for_each(p, &us122l->midi_list) { 645030a07e4SKarsten Wiese snd_usbmidi_disconnect(p); 646030a07e4SKarsten Wiese } 647030a07e4SKarsten Wiese 648a014bbadSClemens Ladisch usb_put_intf(usb_ifnum_to_if(us122l->dev, 0)); 649a014bbadSClemens Ladisch usb_put_intf(usb_ifnum_to_if(us122l->dev, 1)); 650a014bbadSClemens Ladisch usb_put_dev(us122l->dev); 651030a07e4SKarsten Wiese 652030a07e4SKarsten Wiese while (atomic_read(&us122l->mmap_count)) 653030a07e4SKarsten Wiese msleep(500); 654030a07e4SKarsten Wiese 655030a07e4SKarsten Wiese snd_card_free(card); 656030a07e4SKarsten Wiese } 657030a07e4SKarsten Wiese 658030a07e4SKarsten Wiese static int snd_us122l_suspend(struct usb_interface *intf, pm_message_t message) 659030a07e4SKarsten Wiese { 660030a07e4SKarsten Wiese struct snd_card *card; 661030a07e4SKarsten Wiese struct us122l *us122l; 662030a07e4SKarsten Wiese struct list_head *p; 663030a07e4SKarsten Wiese 664f4e9749fSJulia Lawall card = usb_get_intfdata(intf); 665030a07e4SKarsten Wiese if (!card) 666030a07e4SKarsten Wiese return 0; 667030a07e4SKarsten Wiese snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 668030a07e4SKarsten Wiese 669030a07e4SKarsten Wiese us122l = US122L(card); 670030a07e4SKarsten Wiese if (!us122l) 671030a07e4SKarsten Wiese return 0; 672030a07e4SKarsten Wiese 673d82af9f9SClemens Ladisch list_for_each(p, &us122l->midi_list) 674030a07e4SKarsten Wiese snd_usbmidi_input_stop(p); 675030a07e4SKarsten Wiese 676030a07e4SKarsten Wiese mutex_lock(&us122l->mutex); 677030a07e4SKarsten Wiese usb_stream_stop(&us122l->sk); 678030a07e4SKarsten Wiese mutex_unlock(&us122l->mutex); 679030a07e4SKarsten Wiese 680030a07e4SKarsten Wiese return 0; 681030a07e4SKarsten Wiese } 682030a07e4SKarsten Wiese 683030a07e4SKarsten Wiese static int snd_us122l_resume(struct usb_interface *intf) 684030a07e4SKarsten Wiese { 685030a07e4SKarsten Wiese struct snd_card *card; 686030a07e4SKarsten Wiese struct us122l *us122l; 687030a07e4SKarsten Wiese struct list_head *p; 688030a07e4SKarsten Wiese int err; 689030a07e4SKarsten Wiese 690f4e9749fSJulia Lawall card = usb_get_intfdata(intf); 691030a07e4SKarsten Wiese if (!card) 692030a07e4SKarsten Wiese return 0; 693030a07e4SKarsten Wiese 694030a07e4SKarsten Wiese us122l = US122L(card); 695030a07e4SKarsten Wiese if (!us122l) 696030a07e4SKarsten Wiese return 0; 697030a07e4SKarsten Wiese 698030a07e4SKarsten Wiese mutex_lock(&us122l->mutex); 699030a07e4SKarsten Wiese /* needed, doesn't restart without: */ 7005c7e7d58SJohan Hovold if (us122l->is_us144) { 701a014bbadSClemens Ladisch err = usb_set_interface(us122l->dev, 0, 1); 7024f272341STobias Hansen if (err) { 7034f272341STobias Hansen snd_printk(KERN_ERR "usb_set_interface error \n"); 7044f272341STobias Hansen goto unlock; 7054f272341STobias Hansen } 7064f272341STobias Hansen } 707a014bbadSClemens Ladisch err = usb_set_interface(us122l->dev, 1, 1); 708030a07e4SKarsten Wiese if (err) { 709030a07e4SKarsten Wiese snd_printk(KERN_ERR "usb_set_interface error \n"); 710030a07e4SKarsten Wiese goto unlock; 711030a07e4SKarsten Wiese } 712030a07e4SKarsten Wiese 713a014bbadSClemens Ladisch pt_info_set(us122l->dev, 0x11); 714a014bbadSClemens Ladisch pt_info_set(us122l->dev, 0x10); 715030a07e4SKarsten Wiese 716a014bbadSClemens Ladisch err = us122l_set_sample_rate(us122l->dev, 717030a07e4SKarsten Wiese us122l->sk.s->cfg.sample_rate); 718030a07e4SKarsten Wiese if (err < 0) { 719030a07e4SKarsten Wiese snd_printk(KERN_ERR "us122l_set_sample_rate error \n"); 720030a07e4SKarsten Wiese goto unlock; 721030a07e4SKarsten Wiese } 722030a07e4SKarsten Wiese err = usb_stream_start(&us122l->sk); 723030a07e4SKarsten Wiese if (err) 724030a07e4SKarsten Wiese goto unlock; 725030a07e4SKarsten Wiese 726d82af9f9SClemens Ladisch list_for_each(p, &us122l->midi_list) 727030a07e4SKarsten Wiese snd_usbmidi_input_start(p); 728030a07e4SKarsten Wiese unlock: 729030a07e4SKarsten Wiese mutex_unlock(&us122l->mutex); 730030a07e4SKarsten Wiese snd_power_change_state(card, SNDRV_CTL_POWER_D0); 731030a07e4SKarsten Wiese return err; 732030a07e4SKarsten Wiese } 733030a07e4SKarsten Wiese 7347ab64aebSArvind Yadav static const struct usb_device_id snd_us122l_usb_id_table[] = { 735030a07e4SKarsten Wiese { 736030a07e4SKarsten Wiese .match_flags = USB_DEVICE_ID_MATCH_DEVICE, 737030a07e4SKarsten Wiese .idVendor = 0x0644, 738030a07e4SKarsten Wiese .idProduct = USB_ID_US122L 739030a07e4SKarsten Wiese }, 7404f272341STobias Hansen { /* US-144 only works at USB1.1! Disable module ehci-hcd. */ 7414f272341STobias Hansen .match_flags = USB_DEVICE_ID_MATCH_DEVICE, 7424f272341STobias Hansen .idVendor = 0x0644, 7435c7e7d58SJohan Hovold .idProduct = USB_ID_US144, 7445c7e7d58SJohan Hovold .driver_info = US122L_FLAG_US144 7454f272341STobias Hansen }, 7462b6f6c0dSTobias Hansen { 7472b6f6c0dSTobias Hansen .match_flags = USB_DEVICE_ID_MATCH_DEVICE, 7482b6f6c0dSTobias Hansen .idVendor = 0x0644, 7492b6f6c0dSTobias Hansen .idProduct = USB_ID_US122MKII 7502b6f6c0dSTobias Hansen }, 7512b6f6c0dSTobias Hansen { 7522b6f6c0dSTobias Hansen .match_flags = USB_DEVICE_ID_MATCH_DEVICE, 7532b6f6c0dSTobias Hansen .idVendor = 0x0644, 7545c7e7d58SJohan Hovold .idProduct = USB_ID_US144MKII, 7555c7e7d58SJohan Hovold .driver_info = US122L_FLAG_US144 7562b6f6c0dSTobias Hansen }, 757030a07e4SKarsten Wiese { /* terminator */ } 758030a07e4SKarsten Wiese }; 759030a07e4SKarsten Wiese 760030a07e4SKarsten Wiese MODULE_DEVICE_TABLE(usb, snd_us122l_usb_id_table); 761030a07e4SKarsten Wiese static struct usb_driver snd_us122l_usb_driver = { 762030a07e4SKarsten Wiese .name = "snd-usb-us122l", 763030a07e4SKarsten Wiese .probe = snd_us122l_probe, 764030a07e4SKarsten Wiese .disconnect = snd_us122l_disconnect, 765030a07e4SKarsten Wiese .suspend = snd_us122l_suspend, 766030a07e4SKarsten Wiese .resume = snd_us122l_resume, 767030a07e4SKarsten Wiese .reset_resume = snd_us122l_resume, 768030a07e4SKarsten Wiese .id_table = snd_us122l_usb_id_table, 769030a07e4SKarsten Wiese .supports_autosuspend = 1 770030a07e4SKarsten Wiese }; 771030a07e4SKarsten Wiese 772424f0750SGreg Kroah-Hartman module_usb_driver(snd_us122l_usb_driver); 773