174ba9207SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later
2030a07e4SKarsten Wiese /*
3030a07e4SKarsten Wiese * Copyright (C) 2007, 2008 Karsten Wiese <fzu@wemgehoertderstaat.de>
4030a07e4SKarsten Wiese */
5030a07e4SKarsten Wiese
65a0e3ad6STejun Heo #include <linux/slab.h>
7de48c7bcSDaniel Mack #include <linux/usb.h>
8de48c7bcSDaniel Mack #include <linux/usb/audio.h>
9da155d5bSPaul Gortmaker #include <linux/module.h>
10030a07e4SKarsten Wiese #include <sound/core.h>
11030a07e4SKarsten Wiese #include <sound/hwdep.h>
12030a07e4SKarsten Wiese #include <sound/pcm.h>
13030a07e4SKarsten Wiese #include <sound/initval.h>
14030a07e4SKarsten Wiese #define MODNAME "US122L"
15030a07e4SKarsten Wiese #include "usb_stream.c"
16030a07e4SKarsten Wiese #include "../usbaudio.h"
17e5779998SDaniel Mack #include "../midi.h"
18030a07e4SKarsten Wiese #include "us122l.h"
19030a07e4SKarsten Wiese
20030a07e4SKarsten Wiese MODULE_AUTHOR("Karsten Wiese <fzu@wemgehoertderstaat.de>");
21030a07e4SKarsten Wiese MODULE_DESCRIPTION("TASCAM "NAME_ALLCAPS" Version 0.5");
22030a07e4SKarsten Wiese MODULE_LICENSE("GPL");
23030a07e4SKarsten Wiese
24030a07e4SKarsten Wiese static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */
25030a07e4SKarsten Wiese static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for this card */
26030a07e4SKarsten Wiese /* Enable this card */
27a67ff6a5SRusty Russell static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
28030a07e4SKarsten Wiese
29030a07e4SKarsten Wiese module_param_array(index, int, NULL, 0444);
30030a07e4SKarsten Wiese MODULE_PARM_DESC(index, "Index value for "NAME_ALLCAPS".");
31030a07e4SKarsten Wiese module_param_array(id, charp, NULL, 0444);
32030a07e4SKarsten Wiese MODULE_PARM_DESC(id, "ID string for "NAME_ALLCAPS".");
33030a07e4SKarsten Wiese module_param_array(enable, bool, NULL, 0444);
34030a07e4SKarsten Wiese MODULE_PARM_DESC(enable, "Enable "NAME_ALLCAPS".");
35030a07e4SKarsten Wiese
365c7e7d58SJohan Hovold /* driver_info flags */
375c7e7d58SJohan Hovold #define US122L_FLAG_US144 BIT(0)
38030a07e4SKarsten Wiese
395c7e7d58SJohan Hovold static int snd_us122l_card_used[SNDRV_CARDS];
40030a07e4SKarsten Wiese
us122l_create_usbmidi(struct snd_card * card)41030a07e4SKarsten Wiese static int us122l_create_usbmidi(struct snd_card *card)
42030a07e4SKarsten Wiese {
4349624472STakashi Iwai static const struct snd_usb_midi_endpoint_info quirk_data = {
44030a07e4SKarsten Wiese .out_ep = 4,
45030a07e4SKarsten Wiese .in_ep = 3,
46030a07e4SKarsten Wiese .out_cables = 0x001,
47030a07e4SKarsten Wiese .in_cables = 0x001
48030a07e4SKarsten Wiese };
4949624472STakashi Iwai static const struct snd_usb_audio_quirk quirk = {
50030a07e4SKarsten Wiese .vendor_name = "US122L",
51030a07e4SKarsten Wiese .product_name = NAME_ALLCAPS,
52030a07e4SKarsten Wiese .ifnum = 1,
53030a07e4SKarsten Wiese .type = QUIRK_MIDI_US122L,
54030a07e4SKarsten Wiese .data = &quirk_data
55030a07e4SKarsten Wiese };
56a014bbadSClemens Ladisch struct usb_device *dev = US122L(card)->dev;
57030a07e4SKarsten Wiese struct usb_interface *iface = usb_ifnum_to_if(dev, 1);
58030a07e4SKarsten Wiese
59d82af9f9SClemens Ladisch return snd_usbmidi_create(card, iface,
60d82af9f9SClemens Ladisch &US122L(card)->midi_list, &quirk);
61030a07e4SKarsten Wiese }
62030a07e4SKarsten Wiese
us144_create_usbmidi(struct snd_card * card)634f272341STobias Hansen static int us144_create_usbmidi(struct snd_card *card)
644f272341STobias Hansen {
6549624472STakashi Iwai static const struct snd_usb_midi_endpoint_info quirk_data = {
664f272341STobias Hansen .out_ep = 4,
674f272341STobias Hansen .in_ep = 3,
684f272341STobias Hansen .out_cables = 0x001,
694f272341STobias Hansen .in_cables = 0x001
704f272341STobias Hansen };
7149624472STakashi Iwai static const struct snd_usb_audio_quirk quirk = {
724f272341STobias Hansen .vendor_name = "US144",
734f272341STobias Hansen .product_name = NAME_ALLCAPS,
744f272341STobias Hansen .ifnum = 0,
754f272341STobias Hansen .type = QUIRK_MIDI_US122L,
764f272341STobias Hansen .data = &quirk_data
774f272341STobias Hansen };
78a014bbadSClemens Ladisch struct usb_device *dev = US122L(card)->dev;
794f272341STobias Hansen struct usb_interface *iface = usb_ifnum_to_if(dev, 0);
804f272341STobias Hansen
81d82af9f9SClemens Ladisch return snd_usbmidi_create(card, iface,
82d82af9f9SClemens Ladisch &US122L(card)->midi_list, &quirk);
834f272341STobias Hansen }
844f272341STobias Hansen
pt_info_set(struct usb_device * dev,u8 v)85030a07e4SKarsten Wiese static void pt_info_set(struct usb_device *dev, u8 v)
86030a07e4SKarsten Wiese {
87030a07e4SKarsten Wiese int ret;
88030a07e4SKarsten Wiese
89f2460238SGreg Kroah-Hartman ret = usb_control_msg_send(dev, 0, 'I',
90030a07e4SKarsten Wiese USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
91f2460238SGreg Kroah-Hartman v, 0, NULL, 0, 1000, GFP_NOIO);
92030a07e4SKarsten Wiese snd_printdd(KERN_DEBUG "%i\n", ret);
93030a07e4SKarsten Wiese }
94030a07e4SKarsten Wiese
usb_stream_hwdep_vm_open(struct vm_area_struct * area)95030a07e4SKarsten Wiese static void usb_stream_hwdep_vm_open(struct vm_area_struct *area)
96030a07e4SKarsten Wiese {
97030a07e4SKarsten Wiese struct us122l *us122l = area->vm_private_data;
984c0a58efSTakashi Iwai
99030a07e4SKarsten Wiese atomic_inc(&us122l->mmap_count);
100030a07e4SKarsten Wiese snd_printdd(KERN_DEBUG "%i\n", atomic_read(&us122l->mmap_count));
101030a07e4SKarsten Wiese }
102030a07e4SKarsten Wiese
usb_stream_hwdep_vm_fault(struct vm_fault * vmf)10329581051SSouptick Joarder static vm_fault_t usb_stream_hwdep_vm_fault(struct vm_fault *vmf)
104030a07e4SKarsten Wiese {
105030a07e4SKarsten Wiese unsigned long offset;
106030a07e4SKarsten Wiese struct page *page;
107030a07e4SKarsten Wiese void *vaddr;
10811bac800SDave Jiang struct us122l *us122l = vmf->vma->vm_private_data;
109030a07e4SKarsten Wiese struct usb_stream *s;
110030a07e4SKarsten Wiese
111030a07e4SKarsten Wiese mutex_lock(&us122l->mutex);
112030a07e4SKarsten Wiese s = us122l->sk.s;
113030a07e4SKarsten Wiese if (!s)
114428ffb71SLi Zefan goto unlock;
115030a07e4SKarsten Wiese
116030a07e4SKarsten Wiese offset = vmf->pgoff << PAGE_SHIFT;
117a829dd5bSTakashi Iwai if (offset < PAGE_ALIGN(s->read_size)) {
118030a07e4SKarsten Wiese vaddr = (char *)s + offset;
119a829dd5bSTakashi Iwai } else {
120030a07e4SKarsten Wiese offset -= PAGE_ALIGN(s->read_size);
121030a07e4SKarsten Wiese if (offset >= PAGE_ALIGN(s->write_size))
122428ffb71SLi Zefan goto unlock;
123030a07e4SKarsten Wiese
124030a07e4SKarsten Wiese vaddr = us122l->sk.write_page + offset;
125030a07e4SKarsten Wiese }
126030a07e4SKarsten Wiese page = virt_to_page(vaddr);
127030a07e4SKarsten Wiese
128030a07e4SKarsten Wiese get_page(page);
129030a07e4SKarsten Wiese mutex_unlock(&us122l->mutex);
130030a07e4SKarsten Wiese
131030a07e4SKarsten Wiese vmf->page = page;
132428ffb71SLi Zefan
133428ffb71SLi Zefan return 0;
134428ffb71SLi Zefan unlock:
135428ffb71SLi Zefan mutex_unlock(&us122l->mutex);
136428ffb71SLi Zefan return VM_FAULT_SIGBUS;
137030a07e4SKarsten Wiese }
138030a07e4SKarsten Wiese
usb_stream_hwdep_vm_close(struct vm_area_struct * area)139030a07e4SKarsten Wiese static void usb_stream_hwdep_vm_close(struct vm_area_struct *area)
140030a07e4SKarsten Wiese {
141030a07e4SKarsten Wiese struct us122l *us122l = area->vm_private_data;
1424c0a58efSTakashi Iwai
143030a07e4SKarsten Wiese atomic_dec(&us122l->mmap_count);
144030a07e4SKarsten Wiese snd_printdd(KERN_DEBUG "%i\n", atomic_read(&us122l->mmap_count));
145030a07e4SKarsten Wiese }
146030a07e4SKarsten Wiese
147f0f37e2fSAlexey Dobriyan static const struct vm_operations_struct usb_stream_hwdep_vm_ops = {
148030a07e4SKarsten Wiese .open = usb_stream_hwdep_vm_open,
149030a07e4SKarsten Wiese .fault = usb_stream_hwdep_vm_fault,
150030a07e4SKarsten Wiese .close = usb_stream_hwdep_vm_close,
151030a07e4SKarsten Wiese };
152030a07e4SKarsten Wiese
usb_stream_hwdep_open(struct snd_hwdep * hw,struct file * file)153030a07e4SKarsten Wiese static int usb_stream_hwdep_open(struct snd_hwdep *hw, struct file *file)
154030a07e4SKarsten Wiese {
155030a07e4SKarsten Wiese struct us122l *us122l = hw->private_data;
156030a07e4SKarsten Wiese struct usb_interface *iface;
1574c0a58efSTakashi Iwai
158030a07e4SKarsten Wiese snd_printdd(KERN_DEBUG "%p %p\n", hw, file);
159030a07e4SKarsten Wiese if (hw->used >= 2)
160030a07e4SKarsten Wiese return -EBUSY;
161030a07e4SKarsten Wiese
162030a07e4SKarsten Wiese if (!us122l->first)
163030a07e4SKarsten Wiese us122l->first = file;
1644f272341STobias Hansen
1655c7e7d58SJohan Hovold if (us122l->is_us144) {
166a014bbadSClemens Ladisch iface = usb_ifnum_to_if(us122l->dev, 0);
1674f272341STobias Hansen usb_autopm_get_interface(iface);
1684f272341STobias Hansen }
169a014bbadSClemens Ladisch iface = usb_ifnum_to_if(us122l->dev, 1);
170030a07e4SKarsten Wiese usb_autopm_get_interface(iface);
171030a07e4SKarsten Wiese return 0;
172030a07e4SKarsten Wiese }
173030a07e4SKarsten Wiese
usb_stream_hwdep_release(struct snd_hwdep * hw,struct file * file)174030a07e4SKarsten Wiese static int usb_stream_hwdep_release(struct snd_hwdep *hw, struct file *file)
175030a07e4SKarsten Wiese {
176030a07e4SKarsten Wiese struct us122l *us122l = hw->private_data;
1774f272341STobias Hansen struct usb_interface *iface;
1784c0a58efSTakashi Iwai
179030a07e4SKarsten Wiese snd_printdd(KERN_DEBUG "%p %p\n", hw, file);
1804f272341STobias Hansen
1815c7e7d58SJohan Hovold if (us122l->is_us144) {
182a014bbadSClemens Ladisch iface = usb_ifnum_to_if(us122l->dev, 0);
1834f272341STobias Hansen usb_autopm_put_interface(iface);
1844f272341STobias Hansen }
185a014bbadSClemens Ladisch iface = usb_ifnum_to_if(us122l->dev, 1);
186030a07e4SKarsten Wiese usb_autopm_put_interface(iface);
187030a07e4SKarsten Wiese if (us122l->first == file)
188030a07e4SKarsten Wiese us122l->first = NULL;
189030a07e4SKarsten Wiese mutex_lock(&us122l->mutex);
190030a07e4SKarsten Wiese if (us122l->master == file)
191030a07e4SKarsten Wiese us122l->master = us122l->slave;
192030a07e4SKarsten Wiese
193030a07e4SKarsten Wiese us122l->slave = NULL;
194030a07e4SKarsten Wiese mutex_unlock(&us122l->mutex);
195030a07e4SKarsten Wiese return 0;
196030a07e4SKarsten Wiese }
197030a07e4SKarsten Wiese
usb_stream_hwdep_mmap(struct snd_hwdep * hw,struct file * filp,struct vm_area_struct * area)198030a07e4SKarsten Wiese static int usb_stream_hwdep_mmap(struct snd_hwdep *hw,
199030a07e4SKarsten Wiese struct file *filp, struct vm_area_struct *area)
200030a07e4SKarsten Wiese {
201030a07e4SKarsten Wiese unsigned long size = area->vm_end - area->vm_start;
202030a07e4SKarsten Wiese struct us122l *us122l = hw->private_data;
203030a07e4SKarsten Wiese unsigned long offset;
204030a07e4SKarsten Wiese struct usb_stream *s;
205030a07e4SKarsten Wiese int err = 0;
206030a07e4SKarsten Wiese bool read;
207030a07e4SKarsten Wiese
208030a07e4SKarsten Wiese offset = area->vm_pgoff << PAGE_SHIFT;
209030a07e4SKarsten Wiese mutex_lock(&us122l->mutex);
210030a07e4SKarsten Wiese s = us122l->sk.s;
211030a07e4SKarsten Wiese read = offset < s->read_size;
212030a07e4SKarsten Wiese if (read && area->vm_flags & VM_WRITE) {
213030a07e4SKarsten Wiese err = -EPERM;
214030a07e4SKarsten Wiese goto out;
215030a07e4SKarsten Wiese }
216030a07e4SKarsten Wiese snd_printdd(KERN_DEBUG "%lu %u\n", size,
217030a07e4SKarsten Wiese read ? s->read_size : s->write_size);
218030a07e4SKarsten Wiese /* if userspace tries to mmap beyond end of our buffer, fail */
219030a07e4SKarsten Wiese if (size > PAGE_ALIGN(read ? s->read_size : s->write_size)) {
220030a07e4SKarsten Wiese snd_printk(KERN_WARNING "%lu > %u\n", size,
221030a07e4SKarsten Wiese read ? s->read_size : s->write_size);
222030a07e4SKarsten Wiese err = -EINVAL;
223030a07e4SKarsten Wiese goto out;
224030a07e4SKarsten Wiese }
225030a07e4SKarsten Wiese
226030a07e4SKarsten Wiese area->vm_ops = &usb_stream_hwdep_vm_ops;
227*1c71222eSSuren Baghdasaryan vm_flags_set(area, VM_DONTDUMP);
228ac536a84STakashi Iwai if (!read)
229*1c71222eSSuren Baghdasaryan vm_flags_set(area, VM_DONTEXPAND);
230030a07e4SKarsten Wiese area->vm_private_data = us122l;
231030a07e4SKarsten Wiese atomic_inc(&us122l->mmap_count);
232030a07e4SKarsten Wiese out:
233030a07e4SKarsten Wiese mutex_unlock(&us122l->mutex);
234030a07e4SKarsten Wiese return err;
235030a07e4SKarsten Wiese }
236030a07e4SKarsten Wiese
usb_stream_hwdep_poll(struct snd_hwdep * hw,struct file * file,poll_table * wait)237680ef72aSAl Viro static __poll_t usb_stream_hwdep_poll(struct snd_hwdep *hw,
238030a07e4SKarsten Wiese struct file *file, poll_table *wait)
239030a07e4SKarsten Wiese {
240030a07e4SKarsten Wiese struct us122l *us122l = hw->private_data;
241a829dd5bSTakashi Iwai unsigned int *polled;
242680ef72aSAl Viro __poll_t mask;
243030a07e4SKarsten Wiese
244030a07e4SKarsten Wiese poll_wait(file, &us122l->sk.sleep, wait);
245030a07e4SKarsten Wiese
246a9a08845SLinus Torvalds mask = EPOLLIN | EPOLLOUT | EPOLLWRNORM | EPOLLERR;
247cdce2db7SKarsten Wiese if (mutex_trylock(&us122l->mutex)) {
248cdce2db7SKarsten Wiese struct usb_stream *s = us122l->sk.s;
2494c0a58efSTakashi Iwai
250cdce2db7SKarsten Wiese if (s && s->state == usb_stream_ready) {
251030a07e4SKarsten Wiese if (us122l->first == file)
252030a07e4SKarsten Wiese polled = &s->periods_polled;
253030a07e4SKarsten Wiese else
254030a07e4SKarsten Wiese polled = &us122l->second_periods_polled;
255030a07e4SKarsten Wiese if (*polled != s->periods_done) {
256030a07e4SKarsten Wiese *polled = s->periods_done;
257a9a08845SLinus Torvalds mask = EPOLLIN | EPOLLOUT | EPOLLWRNORM;
258a829dd5bSTakashi Iwai } else {
259030a07e4SKarsten Wiese mask = 0;
260cdce2db7SKarsten Wiese }
261a829dd5bSTakashi Iwai }
262cdce2db7SKarsten Wiese mutex_unlock(&us122l->mutex);
263030a07e4SKarsten Wiese }
264030a07e4SKarsten Wiese return mask;
265030a07e4SKarsten Wiese }
266030a07e4SKarsten Wiese
us122l_stop(struct us122l * us122l)267030a07e4SKarsten Wiese static void us122l_stop(struct us122l *us122l)
268030a07e4SKarsten Wiese {
269030a07e4SKarsten Wiese struct list_head *p;
2704c0a58efSTakashi Iwai
271d82af9f9SClemens Ladisch list_for_each(p, &us122l->midi_list)
272030a07e4SKarsten Wiese snd_usbmidi_input_stop(p);
273030a07e4SKarsten Wiese
274030a07e4SKarsten Wiese usb_stream_stop(&us122l->sk);
275030a07e4SKarsten Wiese usb_stream_free(&us122l->sk);
276030a07e4SKarsten Wiese }
277030a07e4SKarsten Wiese
us122l_set_sample_rate(struct usb_device * dev,int rate)278030a07e4SKarsten Wiese static int us122l_set_sample_rate(struct usb_device *dev, int rate)
279030a07e4SKarsten Wiese {
280030a07e4SKarsten Wiese unsigned int ep = 0x81;
281030a07e4SKarsten Wiese unsigned char data[3];
282030a07e4SKarsten Wiese int err;
283030a07e4SKarsten Wiese
284030a07e4SKarsten Wiese data[0] = rate;
285030a07e4SKarsten Wiese data[1] = rate >> 8;
286030a07e4SKarsten Wiese data[2] = rate >> 16;
287f2460238SGreg Kroah-Hartman err = usb_control_msg_send(dev, 0, UAC_SET_CUR,
288030a07e4SKarsten Wiese USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_OUT,
289f2460238SGreg Kroah-Hartman UAC_EP_CS_ATTR_SAMPLE_RATE << 8, ep, data, 3,
290f2460238SGreg Kroah-Hartman 1000, GFP_NOIO);
291f2460238SGreg Kroah-Hartman if (err)
292030a07e4SKarsten Wiese snd_printk(KERN_ERR "%d: cannot set freq %d to ep 0x%x\n",
293030a07e4SKarsten Wiese dev->devnum, rate, ep);
294030a07e4SKarsten Wiese return err;
295030a07e4SKarsten Wiese }
296030a07e4SKarsten Wiese
us122l_start(struct us122l * us122l,unsigned int rate,unsigned int period_frames)297030a07e4SKarsten Wiese static bool us122l_start(struct us122l *us122l,
298a829dd5bSTakashi Iwai unsigned int rate, unsigned int period_frames)
299030a07e4SKarsten Wiese {
300030a07e4SKarsten Wiese struct list_head *p;
301030a07e4SKarsten Wiese int err;
302a829dd5bSTakashi Iwai unsigned int use_packsize = 0;
303030a07e4SKarsten Wiese bool success = false;
304030a07e4SKarsten Wiese
305a014bbadSClemens Ladisch if (us122l->dev->speed == USB_SPEED_HIGH) {
306030a07e4SKarsten Wiese /* The us-122l's descriptor defaults to iso max_packsize 78,
307030a07e4SKarsten Wiese which isn't needed for samplerates <= 48000.
308030a07e4SKarsten Wiese Lets save some memory:
309030a07e4SKarsten Wiese */
310030a07e4SKarsten Wiese switch (rate) {
311030a07e4SKarsten Wiese case 44100:
312030a07e4SKarsten Wiese use_packsize = 36;
313030a07e4SKarsten Wiese break;
314030a07e4SKarsten Wiese case 48000:
315030a07e4SKarsten Wiese use_packsize = 42;
316030a07e4SKarsten Wiese break;
317030a07e4SKarsten Wiese case 88200:
318030a07e4SKarsten Wiese use_packsize = 72;
319030a07e4SKarsten Wiese break;
320030a07e4SKarsten Wiese }
321030a07e4SKarsten Wiese }
322a014bbadSClemens Ladisch if (!usb_stream_new(&us122l->sk, us122l->dev, 1, 2,
323030a07e4SKarsten Wiese rate, use_packsize, period_frames, 6))
324030a07e4SKarsten Wiese goto out;
325030a07e4SKarsten Wiese
326a014bbadSClemens Ladisch err = us122l_set_sample_rate(us122l->dev, rate);
327030a07e4SKarsten Wiese if (err < 0) {
328030a07e4SKarsten Wiese us122l_stop(us122l);
329030a07e4SKarsten Wiese snd_printk(KERN_ERR "us122l_set_sample_rate error\n");
330030a07e4SKarsten Wiese goto out;
331030a07e4SKarsten Wiese }
332030a07e4SKarsten Wiese err = usb_stream_start(&us122l->sk);
333030a07e4SKarsten Wiese if (err < 0) {
334030a07e4SKarsten Wiese us122l_stop(us122l);
335a829dd5bSTakashi Iwai snd_printk(KERN_ERR "%s error %i\n", __func__, err);
336030a07e4SKarsten Wiese goto out;
337030a07e4SKarsten Wiese }
338d82af9f9SClemens Ladisch list_for_each(p, &us122l->midi_list)
339030a07e4SKarsten Wiese snd_usbmidi_input_start(p);
340030a07e4SKarsten Wiese success = true;
341030a07e4SKarsten Wiese out:
342030a07e4SKarsten Wiese return success;
343030a07e4SKarsten Wiese }
344030a07e4SKarsten Wiese
usb_stream_hwdep_ioctl(struct snd_hwdep * hw,struct file * file,unsigned int cmd,unsigned long arg)345030a07e4SKarsten Wiese static int usb_stream_hwdep_ioctl(struct snd_hwdep *hw, struct file *file,
346a829dd5bSTakashi Iwai unsigned int cmd, unsigned long arg)
347030a07e4SKarsten Wiese {
3483d46d710SAl Viro struct usb_stream_config cfg;
349030a07e4SKarsten Wiese struct us122l *us122l = hw->private_data;
350cdce2db7SKarsten Wiese struct usb_stream *s;
351a829dd5bSTakashi Iwai unsigned int min_period_frames;
352030a07e4SKarsten Wiese int err = 0;
353030a07e4SKarsten Wiese bool high_speed;
354030a07e4SKarsten Wiese
355030a07e4SKarsten Wiese if (cmd != SNDRV_USB_STREAM_IOCTL_SET_PARAMS)
356030a07e4SKarsten Wiese return -ENOTTY;
357030a07e4SKarsten Wiese
3583d46d710SAl Viro if (copy_from_user(&cfg, (void __user *)arg, sizeof(cfg)))
3593d46d710SAl Viro return -EFAULT;
360030a07e4SKarsten Wiese
3613d46d710SAl Viro if (cfg.version != USB_STREAM_INTERFACE_VERSION)
3623d46d710SAl Viro return -ENXIO;
3633d46d710SAl Viro
364a014bbadSClemens Ladisch high_speed = us122l->dev->speed == USB_SPEED_HIGH;
3653d46d710SAl Viro if ((cfg.sample_rate != 44100 && cfg.sample_rate != 48000 &&
366030a07e4SKarsten Wiese (!high_speed ||
3673d46d710SAl Viro (cfg.sample_rate != 88200 && cfg.sample_rate != 96000))) ||
3683d46d710SAl Viro cfg.frame_size != 6 ||
3693d46d710SAl Viro cfg.period_frames > 0x3000)
3703d46d710SAl Viro return -EINVAL;
3713d46d710SAl Viro
3723d46d710SAl Viro switch (cfg.sample_rate) {
373030a07e4SKarsten Wiese case 44100:
374030a07e4SKarsten Wiese min_period_frames = 48;
375030a07e4SKarsten Wiese break;
376030a07e4SKarsten Wiese case 48000:
377030a07e4SKarsten Wiese min_period_frames = 52;
378030a07e4SKarsten Wiese break;
379030a07e4SKarsten Wiese default:
380030a07e4SKarsten Wiese min_period_frames = 104;
381030a07e4SKarsten Wiese break;
382030a07e4SKarsten Wiese }
383030a07e4SKarsten Wiese if (!high_speed)
384030a07e4SKarsten Wiese min_period_frames <<= 1;
3853d46d710SAl Viro if (cfg.period_frames < min_period_frames)
3863d46d710SAl Viro return -EINVAL;
387030a07e4SKarsten Wiese
388b6cc78daSTakashi Iwai snd_power_wait(hw->card);
389030a07e4SKarsten Wiese
390030a07e4SKarsten Wiese mutex_lock(&us122l->mutex);
391cdce2db7SKarsten Wiese s = us122l->sk.s;
392a829dd5bSTakashi Iwai if (!us122l->master) {
393030a07e4SKarsten Wiese us122l->master = file;
394a829dd5bSTakashi Iwai } else if (us122l->master != file) {
3953d46d710SAl Viro if (!s || memcmp(&cfg, &s->cfg, sizeof(cfg))) {
396030a07e4SKarsten Wiese err = -EIO;
397030a07e4SKarsten Wiese goto unlock;
398030a07e4SKarsten Wiese }
399030a07e4SKarsten Wiese us122l->slave = file;
400030a07e4SKarsten Wiese }
4013d46d710SAl Viro if (!s || memcmp(&cfg, &s->cfg, sizeof(cfg)) ||
402cdce2db7SKarsten Wiese s->state == usb_stream_xrun) {
403030a07e4SKarsten Wiese us122l_stop(us122l);
4043d46d710SAl Viro if (!us122l_start(us122l, cfg.sample_rate, cfg.period_frames))
405030a07e4SKarsten Wiese err = -EIO;
406030a07e4SKarsten Wiese else
407030a07e4SKarsten Wiese err = 1;
408030a07e4SKarsten Wiese }
409030a07e4SKarsten Wiese unlock:
410030a07e4SKarsten Wiese mutex_unlock(&us122l->mutex);
411cdce2db7SKarsten Wiese wake_up_all(&us122l->sk.sleep);
412030a07e4SKarsten Wiese return err;
413030a07e4SKarsten Wiese }
414030a07e4SKarsten Wiese
415030a07e4SKarsten Wiese #define SND_USB_STREAM_ID "USB STREAM"
usb_stream_hwdep_new(struct snd_card * card)416030a07e4SKarsten Wiese static int usb_stream_hwdep_new(struct snd_card *card)
417030a07e4SKarsten Wiese {
418030a07e4SKarsten Wiese int err;
419030a07e4SKarsten Wiese struct snd_hwdep *hw;
420a014bbadSClemens Ladisch struct usb_device *dev = US122L(card)->dev;
421030a07e4SKarsten Wiese
422030a07e4SKarsten Wiese err = snd_hwdep_new(card, SND_USB_STREAM_ID, 0, &hw);
423030a07e4SKarsten Wiese if (err < 0)
424030a07e4SKarsten Wiese return err;
425030a07e4SKarsten Wiese
426030a07e4SKarsten Wiese hw->iface = SNDRV_HWDEP_IFACE_USB_STREAM;
427030a07e4SKarsten Wiese hw->private_data = US122L(card);
428030a07e4SKarsten Wiese hw->ops.open = usb_stream_hwdep_open;
429030a07e4SKarsten Wiese hw->ops.release = usb_stream_hwdep_release;
430030a07e4SKarsten Wiese hw->ops.ioctl = usb_stream_hwdep_ioctl;
431030a07e4SKarsten Wiese hw->ops.ioctl_compat = usb_stream_hwdep_ioctl;
432030a07e4SKarsten Wiese hw->ops.mmap = usb_stream_hwdep_mmap;
433030a07e4SKarsten Wiese hw->ops.poll = usb_stream_hwdep_poll;
434030a07e4SKarsten Wiese
435a5f8661dSMauro Carvalho Chehab sprintf(hw->name, "/dev/bus/usb/%03d/%03d/hwdeppcm",
436030a07e4SKarsten Wiese dev->bus->busnum, dev->devnum);
437030a07e4SKarsten Wiese return 0;
438030a07e4SKarsten Wiese }
439030a07e4SKarsten Wiese
us122l_create_card(struct snd_card * card)440030a07e4SKarsten Wiese static bool us122l_create_card(struct snd_card *card)
441030a07e4SKarsten Wiese {
442030a07e4SKarsten Wiese int err;
443030a07e4SKarsten Wiese struct us122l *us122l = US122L(card);
444030a07e4SKarsten Wiese
4455c7e7d58SJohan Hovold if (us122l->is_us144) {
446a014bbadSClemens Ladisch err = usb_set_interface(us122l->dev, 0, 1);
4474f272341STobias Hansen if (err) {
4484f272341STobias Hansen snd_printk(KERN_ERR "usb_set_interface error\n");
4494f272341STobias Hansen return false;
4504f272341STobias Hansen }
4514f272341STobias Hansen }
452a014bbadSClemens Ladisch err = usb_set_interface(us122l->dev, 1, 1);
453030a07e4SKarsten Wiese if (err) {
454030a07e4SKarsten Wiese snd_printk(KERN_ERR "usb_set_interface error\n");
455030a07e4SKarsten Wiese return false;
456030a07e4SKarsten Wiese }
457030a07e4SKarsten Wiese
458a014bbadSClemens Ladisch pt_info_set(us122l->dev, 0x11);
459a014bbadSClemens Ladisch pt_info_set(us122l->dev, 0x10);
460030a07e4SKarsten Wiese
461030a07e4SKarsten Wiese if (!us122l_start(us122l, 44100, 256))
462030a07e4SKarsten Wiese return false;
463030a07e4SKarsten Wiese
4645c7e7d58SJohan Hovold if (us122l->is_us144)
4654f272341STobias Hansen err = us144_create_usbmidi(card);
4664f272341STobias Hansen else
467030a07e4SKarsten Wiese err = us122l_create_usbmidi(card);
468030a07e4SKarsten Wiese if (err < 0) {
469030a07e4SKarsten Wiese snd_printk(KERN_ERR "us122l_create_usbmidi error %i\n", err);
47080753cdfSMarkus Elfring goto stop;
471030a07e4SKarsten Wiese }
472030a07e4SKarsten Wiese err = usb_stream_hwdep_new(card);
473030a07e4SKarsten Wiese if (err < 0) {
474030a07e4SKarsten Wiese /* release the midi resources */
475030a07e4SKarsten Wiese struct list_head *p;
4764c0a58efSTakashi Iwai
477d82af9f9SClemens Ladisch list_for_each(p, &us122l->midi_list)
478030a07e4SKarsten Wiese snd_usbmidi_disconnect(p);
479030a07e4SKarsten Wiese
48080753cdfSMarkus Elfring goto stop;
481030a07e4SKarsten Wiese }
482030a07e4SKarsten Wiese return true;
48380753cdfSMarkus Elfring
48480753cdfSMarkus Elfring stop:
48580753cdfSMarkus Elfring us122l_stop(us122l);
48680753cdfSMarkus Elfring return false;
487030a07e4SKarsten Wiese }
488030a07e4SKarsten Wiese
snd_us122l_free(struct snd_card * card)4895d4af1beSKarsten Wiese static void snd_us122l_free(struct snd_card *card)
4905d4af1beSKarsten Wiese {
4915d4af1beSKarsten Wiese struct us122l *us122l = US122L(card);
492a014bbadSClemens Ladisch int index = us122l->card_index;
4934c0a58efSTakashi Iwai
4945d4af1beSKarsten Wiese if (index >= 0 && index < SNDRV_CARDS)
4955d4af1beSKarsten Wiese snd_us122l_card_used[index] = 0;
4965d4af1beSKarsten Wiese }
4975d4af1beSKarsten Wiese
usx2y_create_card(struct usb_device * device,struct usb_interface * intf,struct snd_card ** cardp,unsigned long flags)498874b8d42STakashi Iwai static int usx2y_create_card(struct usb_device *device,
499874b8d42STakashi Iwai struct usb_interface *intf,
5005c7e7d58SJohan Hovold struct snd_card **cardp,
5015c7e7d58SJohan Hovold unsigned long flags)
502030a07e4SKarsten Wiese {
503030a07e4SKarsten Wiese int dev;
504030a07e4SKarsten Wiese struct snd_card *card;
505bd7dd77cSTakashi Iwai int err;
506bd7dd77cSTakashi Iwai
507030a07e4SKarsten Wiese for (dev = 0; dev < SNDRV_CARDS; ++dev)
508030a07e4SKarsten Wiese if (enable[dev] && !snd_us122l_card_used[dev])
509030a07e4SKarsten Wiese break;
510030a07e4SKarsten Wiese if (dev >= SNDRV_CARDS)
51151721f70STakashi Iwai return -ENODEV;
512874b8d42STakashi Iwai err = snd_card_new(&intf->dev, index[dev], id[dev], THIS_MODULE,
513bd7dd77cSTakashi Iwai sizeof(struct us122l), &card);
514bd7dd77cSTakashi Iwai if (err < 0)
51551721f70STakashi Iwai return err;
516a014bbadSClemens Ladisch snd_us122l_card_used[US122L(card)->card_index = dev] = 1;
5175d4af1beSKarsten Wiese card->private_free = snd_us122l_free;
518a014bbadSClemens Ladisch US122L(card)->dev = device;
519030a07e4SKarsten Wiese mutex_init(&US122L(card)->mutex);
520030a07e4SKarsten Wiese init_waitqueue_head(&US122L(card)->sk.sleep);
5215c7e7d58SJohan Hovold US122L(card)->is_us144 = flags & US122L_FLAG_US144;
522d82af9f9SClemens Ladisch INIT_LIST_HEAD(&US122L(card)->midi_list);
523030a07e4SKarsten Wiese strcpy(card->driver, "USB "NAME_ALLCAPS"");
524030a07e4SKarsten Wiese sprintf(card->shortname, "TASCAM "NAME_ALLCAPS"");
525030a07e4SKarsten Wiese sprintf(card->longname, "%s (%x:%x if %d at %03d/%03d)",
526030a07e4SKarsten Wiese card->shortname,
527030a07e4SKarsten Wiese le16_to_cpu(device->descriptor.idVendor),
528030a07e4SKarsten Wiese le16_to_cpu(device->descriptor.idProduct),
529030a07e4SKarsten Wiese 0,
530a014bbadSClemens Ladisch US122L(card)->dev->bus->busnum,
531a014bbadSClemens Ladisch US122L(card)->dev->devnum
532030a07e4SKarsten Wiese );
53351721f70STakashi Iwai *cardp = card;
53451721f70STakashi Iwai return 0;
535030a07e4SKarsten Wiese }
536030a07e4SKarsten Wiese
us122l_usb_probe(struct usb_interface * intf,const struct usb_device_id * device_id,struct snd_card ** cardp)53751721f70STakashi Iwai static int us122l_usb_probe(struct usb_interface *intf,
53851721f70STakashi Iwai const struct usb_device_id *device_id,
53951721f70STakashi Iwai struct snd_card **cardp)
540030a07e4SKarsten Wiese {
541030a07e4SKarsten Wiese struct usb_device *device = interface_to_usbdev(intf);
54251721f70STakashi Iwai struct snd_card *card;
54351721f70STakashi Iwai int err;
544030a07e4SKarsten Wiese
5455c7e7d58SJohan Hovold err = usx2y_create_card(device, intf, &card, device_id->driver_info);
54651721f70STakashi Iwai if (err < 0)
54751721f70STakashi Iwai return err;
548030a07e4SKarsten Wiese
54951721f70STakashi Iwai if (!us122l_create_card(card)) {
550030a07e4SKarsten Wiese snd_card_free(card);
55151721f70STakashi Iwai return -EINVAL;
55251721f70STakashi Iwai }
55351721f70STakashi Iwai
55451721f70STakashi Iwai err = snd_card_register(card);
55551721f70STakashi Iwai if (err < 0) {
55651721f70STakashi Iwai snd_card_free(card);
55751721f70STakashi Iwai return err;
558030a07e4SKarsten Wiese }
559030a07e4SKarsten Wiese
5604f272341STobias Hansen usb_get_intf(usb_ifnum_to_if(device, 0));
561030a07e4SKarsten Wiese usb_get_dev(device);
56251721f70STakashi Iwai *cardp = card;
56351721f70STakashi Iwai return 0;
564030a07e4SKarsten Wiese }
565030a07e4SKarsten Wiese
snd_us122l_probe(struct usb_interface * intf,const struct usb_device_id * id)566030a07e4SKarsten Wiese static int snd_us122l_probe(struct usb_interface *intf,
567030a07e4SKarsten Wiese const struct usb_device_id *id)
568030a07e4SKarsten Wiese {
5694f272341STobias Hansen struct usb_device *device = interface_to_usbdev(intf);
570030a07e4SKarsten Wiese struct snd_card *card;
57151721f70STakashi Iwai int err;
57251721f70STakashi Iwai
5735c7e7d58SJohan Hovold if (id->driver_info & US122L_FLAG_US144 &&
5745c7e7d58SJohan Hovold device->speed == USB_SPEED_HIGH) {
5754f272341STobias Hansen snd_printk(KERN_ERR "disable ehci-hcd to run US-144\n");
576a688e488STobias Hansen return -ENODEV;
5774f272341STobias Hansen }
5784f272341STobias Hansen
579030a07e4SKarsten Wiese snd_printdd(KERN_DEBUG"%p:%i\n",
580030a07e4SKarsten Wiese intf, intf->cur_altsetting->desc.bInterfaceNumber);
581030a07e4SKarsten Wiese if (intf->cur_altsetting->desc.bInterfaceNumber != 1)
582030a07e4SKarsten Wiese return 0;
583030a07e4SKarsten Wiese
58451721f70STakashi Iwai err = us122l_usb_probe(usb_get_intf(intf), id, &card);
58551721f70STakashi Iwai if (err < 0) {
58651721f70STakashi Iwai usb_put_intf(intf);
58751721f70STakashi Iwai return err;
588030a07e4SKarsten Wiese }
589030a07e4SKarsten Wiese
59051721f70STakashi Iwai usb_set_intfdata(intf, card);
59151721f70STakashi Iwai return 0;
592030a07e4SKarsten Wiese }
593030a07e4SKarsten Wiese
snd_us122l_disconnect(struct usb_interface * intf)594030a07e4SKarsten Wiese static void snd_us122l_disconnect(struct usb_interface *intf)
595030a07e4SKarsten Wiese {
596030a07e4SKarsten Wiese struct snd_card *card;
597030a07e4SKarsten Wiese struct us122l *us122l;
598030a07e4SKarsten Wiese struct list_head *p;
599030a07e4SKarsten Wiese
600030a07e4SKarsten Wiese card = usb_get_intfdata(intf);
601030a07e4SKarsten Wiese if (!card)
602030a07e4SKarsten Wiese return;
603030a07e4SKarsten Wiese
604030a07e4SKarsten Wiese snd_card_disconnect(card);
605030a07e4SKarsten Wiese
606030a07e4SKarsten Wiese us122l = US122L(card);
607030a07e4SKarsten Wiese mutex_lock(&us122l->mutex);
608030a07e4SKarsten Wiese us122l_stop(us122l);
609030a07e4SKarsten Wiese mutex_unlock(&us122l->mutex);
610030a07e4SKarsten Wiese
611030a07e4SKarsten Wiese /* release the midi resources */
612d82af9f9SClemens Ladisch list_for_each(p, &us122l->midi_list) {
613030a07e4SKarsten Wiese snd_usbmidi_disconnect(p);
614030a07e4SKarsten Wiese }
615030a07e4SKarsten Wiese
616a014bbadSClemens Ladisch usb_put_intf(usb_ifnum_to_if(us122l->dev, 0));
617a014bbadSClemens Ladisch usb_put_intf(usb_ifnum_to_if(us122l->dev, 1));
618a014bbadSClemens Ladisch usb_put_dev(us122l->dev);
619030a07e4SKarsten Wiese
620030a07e4SKarsten Wiese while (atomic_read(&us122l->mmap_count))
621030a07e4SKarsten Wiese msleep(500);
622030a07e4SKarsten Wiese
623030a07e4SKarsten Wiese snd_card_free(card);
624030a07e4SKarsten Wiese }
625030a07e4SKarsten Wiese
snd_us122l_suspend(struct usb_interface * intf,pm_message_t message)626030a07e4SKarsten Wiese static int snd_us122l_suspend(struct usb_interface *intf, pm_message_t message)
627030a07e4SKarsten Wiese {
628030a07e4SKarsten Wiese struct snd_card *card;
629030a07e4SKarsten Wiese struct us122l *us122l;
630030a07e4SKarsten Wiese struct list_head *p;
631030a07e4SKarsten Wiese
632f4e9749fSJulia Lawall card = usb_get_intfdata(intf);
633030a07e4SKarsten Wiese if (!card)
634030a07e4SKarsten Wiese return 0;
635030a07e4SKarsten Wiese snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
636030a07e4SKarsten Wiese
637030a07e4SKarsten Wiese us122l = US122L(card);
638030a07e4SKarsten Wiese if (!us122l)
639030a07e4SKarsten Wiese return 0;
640030a07e4SKarsten Wiese
641d82af9f9SClemens Ladisch list_for_each(p, &us122l->midi_list)
642030a07e4SKarsten Wiese snd_usbmidi_input_stop(p);
643030a07e4SKarsten Wiese
644030a07e4SKarsten Wiese mutex_lock(&us122l->mutex);
645030a07e4SKarsten Wiese usb_stream_stop(&us122l->sk);
646030a07e4SKarsten Wiese mutex_unlock(&us122l->mutex);
647030a07e4SKarsten Wiese
648030a07e4SKarsten Wiese return 0;
649030a07e4SKarsten Wiese }
650030a07e4SKarsten Wiese
snd_us122l_resume(struct usb_interface * intf)651030a07e4SKarsten Wiese static int snd_us122l_resume(struct usb_interface *intf)
652030a07e4SKarsten Wiese {
653030a07e4SKarsten Wiese struct snd_card *card;
654030a07e4SKarsten Wiese struct us122l *us122l;
655030a07e4SKarsten Wiese struct list_head *p;
656030a07e4SKarsten Wiese int err;
657030a07e4SKarsten Wiese
658f4e9749fSJulia Lawall card = usb_get_intfdata(intf);
659030a07e4SKarsten Wiese if (!card)
660030a07e4SKarsten Wiese return 0;
661030a07e4SKarsten Wiese
662030a07e4SKarsten Wiese us122l = US122L(card);
663030a07e4SKarsten Wiese if (!us122l)
664030a07e4SKarsten Wiese return 0;
665030a07e4SKarsten Wiese
666030a07e4SKarsten Wiese mutex_lock(&us122l->mutex);
667030a07e4SKarsten Wiese /* needed, doesn't restart without: */
6685c7e7d58SJohan Hovold if (us122l->is_us144) {
669a014bbadSClemens Ladisch err = usb_set_interface(us122l->dev, 0, 1);
6704f272341STobias Hansen if (err) {
6714f272341STobias Hansen snd_printk(KERN_ERR "usb_set_interface error\n");
6724f272341STobias Hansen goto unlock;
6734f272341STobias Hansen }
6744f272341STobias Hansen }
675a014bbadSClemens Ladisch err = usb_set_interface(us122l->dev, 1, 1);
676030a07e4SKarsten Wiese if (err) {
677030a07e4SKarsten Wiese snd_printk(KERN_ERR "usb_set_interface error\n");
678030a07e4SKarsten Wiese goto unlock;
679030a07e4SKarsten Wiese }
680030a07e4SKarsten Wiese
681a014bbadSClemens Ladisch pt_info_set(us122l->dev, 0x11);
682a014bbadSClemens Ladisch pt_info_set(us122l->dev, 0x10);
683030a07e4SKarsten Wiese
684a014bbadSClemens Ladisch err = us122l_set_sample_rate(us122l->dev,
685030a07e4SKarsten Wiese us122l->sk.s->cfg.sample_rate);
686030a07e4SKarsten Wiese if (err < 0) {
687030a07e4SKarsten Wiese snd_printk(KERN_ERR "us122l_set_sample_rate error\n");
688030a07e4SKarsten Wiese goto unlock;
689030a07e4SKarsten Wiese }
690030a07e4SKarsten Wiese err = usb_stream_start(&us122l->sk);
691030a07e4SKarsten Wiese if (err)
692030a07e4SKarsten Wiese goto unlock;
693030a07e4SKarsten Wiese
694d82af9f9SClemens Ladisch list_for_each(p, &us122l->midi_list)
695030a07e4SKarsten Wiese snd_usbmidi_input_start(p);
696030a07e4SKarsten Wiese unlock:
697030a07e4SKarsten Wiese mutex_unlock(&us122l->mutex);
698030a07e4SKarsten Wiese snd_power_change_state(card, SNDRV_CTL_POWER_D0);
699030a07e4SKarsten Wiese return err;
700030a07e4SKarsten Wiese }
701030a07e4SKarsten Wiese
7027ab64aebSArvind Yadav static const struct usb_device_id snd_us122l_usb_id_table[] = {
703030a07e4SKarsten Wiese {
704030a07e4SKarsten Wiese .match_flags = USB_DEVICE_ID_MATCH_DEVICE,
705030a07e4SKarsten Wiese .idVendor = 0x0644,
706030a07e4SKarsten Wiese .idProduct = USB_ID_US122L
707030a07e4SKarsten Wiese },
7084f272341STobias Hansen { /* US-144 only works at USB1.1! Disable module ehci-hcd. */
7094f272341STobias Hansen .match_flags = USB_DEVICE_ID_MATCH_DEVICE,
7104f272341STobias Hansen .idVendor = 0x0644,
7115c7e7d58SJohan Hovold .idProduct = USB_ID_US144,
7125c7e7d58SJohan Hovold .driver_info = US122L_FLAG_US144
7134f272341STobias Hansen },
7142b6f6c0dSTobias Hansen {
7152b6f6c0dSTobias Hansen .match_flags = USB_DEVICE_ID_MATCH_DEVICE,
7162b6f6c0dSTobias Hansen .idVendor = 0x0644,
7172b6f6c0dSTobias Hansen .idProduct = USB_ID_US122MKII
7182b6f6c0dSTobias Hansen },
7192b6f6c0dSTobias Hansen {
7202b6f6c0dSTobias Hansen .match_flags = USB_DEVICE_ID_MATCH_DEVICE,
7212b6f6c0dSTobias Hansen .idVendor = 0x0644,
7225c7e7d58SJohan Hovold .idProduct = USB_ID_US144MKII,
7235c7e7d58SJohan Hovold .driver_info = US122L_FLAG_US144
7242b6f6c0dSTobias Hansen },
725030a07e4SKarsten Wiese { /* terminator */ }
726030a07e4SKarsten Wiese };
727030a07e4SKarsten Wiese MODULE_DEVICE_TABLE(usb, snd_us122l_usb_id_table);
7284c0a58efSTakashi Iwai
729030a07e4SKarsten Wiese static struct usb_driver snd_us122l_usb_driver = {
730030a07e4SKarsten Wiese .name = "snd-usb-us122l",
731030a07e4SKarsten Wiese .probe = snd_us122l_probe,
732030a07e4SKarsten Wiese .disconnect = snd_us122l_disconnect,
733030a07e4SKarsten Wiese .suspend = snd_us122l_suspend,
734030a07e4SKarsten Wiese .resume = snd_us122l_resume,
735030a07e4SKarsten Wiese .reset_resume = snd_us122l_resume,
736030a07e4SKarsten Wiese .id_table = snd_us122l_usb_id_table,
737030a07e4SKarsten Wiese .supports_autosuspend = 1
738030a07e4SKarsten Wiese };
739030a07e4SKarsten Wiese
740424f0750SGreg Kroah-Hartman module_usb_driver(snd_us122l_usb_driver);
741