Lines Matching +full:diff +full:- +full:channels

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * usbusx2y.c - ALSA USB US-428 Driver
5 2005-04-14 Karsten Wiese
8 Tested ok with kernel 2.6.12-rc2.
10 2004-12-14 Karsten Wiese
12 …snd_pcm_open for rawusb pcm-devices now returns -EBUSY if called without rawusb's hwdep device bei…
14 2004-12-02 Karsten Wiese
18 2004-10-26 Karsten Wiese
22 2004-10-21 Karsten Wiese
26 2004-10-03 Karsten Wiese
30 2004-09-30 Karsten Wiese
34 2004-09-20 Karsten Wiese
38 2004-07-13 Karsten Wiese
41 us428 channels C/D not handled just for this version, sorry.
43 2004-06-21 Karsten Wiese
48 2004-06-12 Karsten Wiese
53 2004-04-06 Karsten Wiese
55 Runs on 2.6.5 kernel without any "--with-debug=" things.
58 2004-01-14 Karsten Wiese
62 2003-12-30 Karsten Wiese
66 2003-11-27 Karsten Wiese, Martin Langer
71 2003-11-03 Karsten Wiese
74 "arecord -D hw:1 -c 2 -r 48000 -M -f S24_3LE|aplay -D hw:1 -c 2 -r 48000 -M -f S24_3LE" works.
76 2003-08-22 Karsten Wiese
78 Removed EZUSB Firmware. First Stage Firmwaredownload is now done by tascam-firmware downloader.
80 http://usb-midi-fw.sourceforge.net/tascam-firmware.tar.gz
82 2003-06-18 Karsten Wiese
86 2002-10-16 Karsten Wiese
88 compiles again with alsa-current.
90 urb->start_frame is calculated here now, some calls inside usb-driver don't need to happen anymore.
93 …Disable APM-support in the kernel as APM-BIOS calls (once each second) hard disable interrupt for …
97 To autoload snd-usb-midi append a line
98 post-install snd-usb-us428 modprobe snd-usb-midi
103 "pcm -c 2" doesn't work. "pcm -c 2 -m direct_interleaved" does.
106 2002-08-31 Karsten Wiese
112 2002-08-09 Karsten Wiese
113 Version 0.0.2: midi works with snd-usb-midi, audio (only fullduplex now) with i.e. bristol.
114 The firmware has been sniffed from win2k us-428 driver 3.09.
116 * Copyright (c) 2002 - 2004 Karsten Wiese
138 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */
160 if (urb->status) { in i_usx2y_out04_int()
162 struct usx2ydev *usx2y = urb->context; in i_usx2y_out04_int()
164 for (i = 0; i < 10 && usx2y->as04.urb[i] != urb; i++) in i_usx2y_out04_int()
166 snd_printdd("%s urb %i status=%i\n", __func__, i, urb->status); in i_usx2y_out04_int()
174 struct usx2ydev *usx2y = urb->context; in i_usx2y_in04_int()
175 struct us428ctls_sharedmem *us428ctls = usx2y->us428ctls_sharedmem; in i_usx2y_in04_int()
177 int i, j, n, diff, send; in i_usx2y_in04_int() local
179 usx2y->in04_int_calls++; in i_usx2y_in04_int()
181 if (urb->status) { in i_usx2y_in04_int()
182 snd_printdd("Interrupt Pipe 4 came back with status=%i\n", urb->status); in i_usx2y_in04_int()
186 …// printk("%i:0x%02X ", 8, (int)((unsigned char*)usx2y->in04_buf)[8]); Master volume shows 0 here … in i_usx2y_in04_int()
188 diff = -1; in i_usx2y_in04_int()
189 if (us428ctls->ctl_snapshot_last == -2) { in i_usx2y_in04_int()
190 diff = 0; in i_usx2y_in04_int()
191 memcpy(usx2y->in04_last, usx2y->in04_buf, sizeof(usx2y->in04_last)); in i_usx2y_in04_int()
192 us428ctls->ctl_snapshot_last = -1; in i_usx2y_in04_int()
195 if (usx2y->in04_last[i] != ((char *)usx2y->in04_buf)[i]) { in i_usx2y_in04_int()
196 if (diff < 0) in i_usx2y_in04_int()
197 diff = i; in i_usx2y_in04_int()
198 usx2y->in04_last[i] = ((char *)usx2y->in04_buf)[i]; in i_usx2y_in04_int()
202 if (diff >= 0) { in i_usx2y_in04_int()
203 n = us428ctls->ctl_snapshot_last + 1; in i_usx2y_in04_int()
206 memcpy(us428ctls->ctl_snapshot + n, usx2y->in04_buf, sizeof(us428ctls->ctl_snapshot[0])); in i_usx2y_in04_int()
207 us428ctls->ctl_snapshot_differs_at[n] = diff; in i_usx2y_in04_int()
208 us428ctls->ctl_snapshot_last = n; in i_usx2y_in04_int()
209 wake_up(&usx2y->us428ctls_wait_queue_head); in i_usx2y_in04_int()
213 if (usx2y->us04) { in i_usx2y_in04_int()
214 if (!usx2y->us04->submitted) { in i_usx2y_in04_int()
216 err = usb_submit_urb(usx2y->us04->urb[usx2y->us04->submitted++], GFP_ATOMIC); in i_usx2y_in04_int()
217 } while (!err && usx2y->us04->submitted < usx2y->us04->len); in i_usx2y_in04_int()
220 if (us428ctls && us428ctls->p4out_last >= 0 && us428ctls->p4out_last < N_US428_P4OUT_BUFS) { in i_usx2y_in04_int()
221 if (us428ctls->p4out_last != us428ctls->p4out_sent) { in i_usx2y_in04_int()
222 send = us428ctls->p4out_sent + 1; in i_usx2y_in04_int()
226 if (!usx2y->as04.urb[j]->status) { in i_usx2y_in04_int()
227 p4out = us428ctls->p4out + send; // FIXME if more than 1 p4out is new, 1 gets lost. in i_usx2y_in04_int()
228 usb_fill_bulk_urb(usx2y->as04.urb[j], usx2y->dev, in i_usx2y_in04_int()
229 usb_sndbulkpipe(usx2y->dev, 0x04), &p4out->val.vol, in i_usx2y_in04_int()
230 p4out->type == ELT_LIGHT ? sizeof(struct us428_lights) : 5, in i_usx2y_in04_int()
232 err = usb_submit_urb(usx2y->as04.urb[j], GFP_ATOMIC); in i_usx2y_in04_int()
233 us428ctls->p4out_sent = send; in i_usx2y_in04_int()
244 urb->dev = usx2y->dev; in i_usx2y_in04_int()
255 if (WARN_ON(usx2y->as04.buffer)) in usx2y_async_seq04_init()
256 return -EBUSY; in usx2y_async_seq04_init()
258 usx2y->as04.buffer = kmalloc_array(URBS_ASYNC_SEQ, in usx2y_async_seq04_init()
260 if (!usx2y->as04.buffer) { in usx2y_async_seq04_init()
261 err = -ENOMEM; in usx2y_async_seq04_init()
264 usx2y->as04.urb[i] = usb_alloc_urb(0, GFP_KERNEL); in usx2y_async_seq04_init()
265 if (!usx2y->as04.urb[i]) { in usx2y_async_seq04_init()
266 err = -ENOMEM; in usx2y_async_seq04_init()
269 usb_fill_bulk_urb(usx2y->as04.urb[i], usx2y->dev, in usx2y_async_seq04_init()
270 usb_sndbulkpipe(usx2y->dev, 0x04), in usx2y_async_seq04_init()
271 usx2y->as04.buffer + URB_DATA_LEN_ASYNC_SEQ * i, 0, in usx2y_async_seq04_init()
273 err = usb_urb_ep_type_check(usx2y->as04.urb[i]); in usx2y_async_seq04_init()
279 usx2y_unlinkseq(&usx2y->as04); in usx2y_async_seq04_init()
287 if (WARN_ON(usx2y->in04_urb)) in usx2y_in04_init()
288 return -EBUSY; in usx2y_in04_init()
290 usx2y->in04_urb = usb_alloc_urb(0, GFP_KERNEL); in usx2y_in04_init()
291 if (!usx2y->in04_urb) { in usx2y_in04_init()
292 err = -ENOMEM; in usx2y_in04_init()
296 usx2y->in04_buf = kmalloc(21, GFP_KERNEL); in usx2y_in04_init()
297 if (!usx2y->in04_buf) { in usx2y_in04_init()
298 err = -ENOMEM; in usx2y_in04_init()
302 init_waitqueue_head(&usx2y->in04_wait_queue); in usx2y_in04_init()
303 usb_fill_int_urb(usx2y->in04_urb, usx2y->dev, usb_rcvintpipe(usx2y->dev, 0x4), in usx2y_in04_init()
304 usx2y->in04_buf, 21, in usx2y_in04_init()
307 if (usb_urb_ep_type_check(usx2y->in04_urb)) { in usx2y_in04_init()
308 err = -EINVAL; in usx2y_in04_init()
311 return usb_submit_urb(usx2y->in04_urb, GFP_KERNEL); in usx2y_in04_init()
314 kfree(usx2y->in04_buf); in usx2y_in04_init()
315 usb_free_urb(usx2y->in04_urb); in usx2y_in04_init()
316 usx2y->in04_buf = NULL; in usx2y_in04_init()
317 usx2y->in04_urb = NULL; in usx2y_in04_init()
326 if (!s->urb[i]) in usx2y_unlinkseq()
328 usb_kill_urb(s->urb[i]); in usx2y_unlinkseq()
329 usb_free_urb(s->urb[i]); in usx2y_unlinkseq()
330 s->urb[i] = NULL; in usx2y_unlinkseq()
332 kfree(s->buffer); in usx2y_unlinkseq()
333 s->buffer = NULL; in usx2y_unlinkseq()
368 return -ENODEV; in usx2y_create_card()
369 err = snd_card_new(&intf->dev, index[dev], id[dev], THIS_MODULE, in usx2y_create_card()
373 snd_usx2y_card_used[usx2y(card)->card_index = dev] = 1; in usx2y_create_card()
374 card->private_free = snd_usx2y_card_private_free; in usx2y_create_card()
375 usx2y(card)->dev = device; in usx2y_create_card()
376 init_waitqueue_head(&usx2y(card)->prepare_wait_queue); in usx2y_create_card()
377 init_waitqueue_head(&usx2y(card)->us428ctls_wait_queue_head); in usx2y_create_card()
378 mutex_init(&usx2y(card)->pcm_mutex); in usx2y_create_card()
379 INIT_LIST_HEAD(&usx2y(card)->midi_list); in usx2y_create_card()
380 strcpy(card->driver, "USB "NAME_ALLCAPS""); in usx2y_create_card()
381 sprintf(card->shortname, "TASCAM "NAME_ALLCAPS""); in usx2y_create_card()
382 sprintf(card->longname, "%s (%x:%x if %d at %03d/%03d)", in usx2y_create_card()
383 card->shortname, in usx2y_create_card()
384 le16_to_cpu(device->descriptor.idVendor), in usx2y_create_card()
385 le16_to_cpu(device->descriptor.idProduct), in usx2y_create_card()
386 0,//us428(card)->usbmidi.ifnum, in usx2y_create_card()
387 usx2y(card)->dev->bus->busnum, usx2y(card)->dev->devnum); in usx2y_create_card()
396 kfree(usx2y->in04_buf); in snd_usx2y_card_private_free()
397 usb_free_urb(usx2y->in04_urb); in snd_usx2y_card_private_free()
398 if (usx2y->us428ctls_sharedmem) in snd_usx2y_card_private_free()
399 free_pages_exact(usx2y->us428ctls_sharedmem, in snd_usx2y_card_private_free()
401 if (usx2y->card_index >= 0 && usx2y->card_index < SNDRV_CARDS) in snd_usx2y_card_private_free()
402 snd_usx2y_card_used[usx2y->card_index] = 0; in snd_usx2y_card_private_free()
415 usx2y->chip_status = USX2Y_STAT_CHIP_HUP; in snd_usx2y_disconnect()
416 usx2y_unlinkseq(&usx2y->as04); in snd_usx2y_disconnect()
417 usb_kill_urb(usx2y->in04_urb); in snd_usx2y_disconnect()
421 list_for_each(p, &usx2y->midi_list) { in snd_usx2y_disconnect()
424 if (usx2y->us428ctls_sharedmem) in snd_usx2y_disconnect()
425 wake_up(&usx2y->us428ctls_wait_queue_head); in snd_usx2y_disconnect()
436 if (le16_to_cpu(device->descriptor.idVendor) != 0x1604 || in snd_usx2y_probe()
437 (le16_to_cpu(device->descriptor.idProduct) != USB_ID_US122 && in snd_usx2y_probe()
438 le16_to_cpu(device->descriptor.idProduct) != USB_ID_US224 && in snd_usx2y_probe()
439 le16_to_cpu(device->descriptor.idProduct) != USB_ID_US428)) in snd_usx2y_probe()
440 return -EINVAL; in snd_usx2y_probe()
452 dev_set_drvdata(&intf->dev, card); in snd_usx2y_probe()
461 .name = "snd-usb-usx2y",