H A D | us122l.c | 31 #include "us122l.h" 135 struct us122l *us122l = area->vm_private_data; usb_stream_hwdep_vm_open() local 136 atomic_inc(&us122l->mmap_count); usb_stream_hwdep_vm_open() 137 snd_printdd(KERN_DEBUG "%i\n", atomic_read(&us122l->mmap_count)); usb_stream_hwdep_vm_open() 146 struct us122l *us122l = area->vm_private_data; usb_stream_hwdep_vm_fault() local 149 mutex_lock(&us122l->mutex); usb_stream_hwdep_vm_fault() 150 s = us122l->sk.s; usb_stream_hwdep_vm_fault() 162 vaddr = us122l->sk.write_page + offset; usb_stream_hwdep_vm_fault() 167 mutex_unlock(&us122l->mutex); usb_stream_hwdep_vm_fault() 173 mutex_unlock(&us122l->mutex); usb_stream_hwdep_vm_fault() 179 struct us122l *us122l = area->vm_private_data; usb_stream_hwdep_vm_close() local 180 atomic_dec(&us122l->mmap_count); usb_stream_hwdep_vm_close() 181 snd_printdd(KERN_DEBUG "%i\n", atomic_read(&us122l->mmap_count)); usb_stream_hwdep_vm_close() 193 struct us122l *us122l = hw->private_data; usb_stream_hwdep_open() local 199 if (!us122l->first) usb_stream_hwdep_open() 200 us122l->first = file; usb_stream_hwdep_open() 202 if (us122l->dev->descriptor.idProduct == USB_ID_US144 || usb_stream_hwdep_open() 203 us122l->dev->descriptor.idProduct == USB_ID_US144MKII) { usb_stream_hwdep_open() 204 iface = usb_ifnum_to_if(us122l->dev, 0); usb_stream_hwdep_open() 207 iface = usb_ifnum_to_if(us122l->dev, 1); usb_stream_hwdep_open() 214 struct us122l *us122l = hw->private_data; usb_stream_hwdep_release() local 218 if (us122l->dev->descriptor.idProduct == USB_ID_US144 || usb_stream_hwdep_release() 219 us122l->dev->descriptor.idProduct == USB_ID_US144MKII) { usb_stream_hwdep_release() 220 iface = usb_ifnum_to_if(us122l->dev, 0); usb_stream_hwdep_release() 223 iface = usb_ifnum_to_if(us122l->dev, 1); usb_stream_hwdep_release() 225 if (us122l->first == file) usb_stream_hwdep_release() 226 us122l->first = NULL; usb_stream_hwdep_release() 227 mutex_lock(&us122l->mutex); usb_stream_hwdep_release() 228 if (us122l->master == file) usb_stream_hwdep_release() 229 us122l->master = us122l->slave; usb_stream_hwdep_release() 231 us122l->slave = NULL; usb_stream_hwdep_release() 232 mutex_unlock(&us122l->mutex); usb_stream_hwdep_release() 240 struct us122l *us122l = hw->private_data; usb_stream_hwdep_mmap() local 247 mutex_lock(&us122l->mutex); usb_stream_hwdep_mmap() 248 s = us122l->sk.s; usb_stream_hwdep_mmap() 268 area->vm_private_data = us122l; usb_stream_hwdep_mmap() 269 atomic_inc(&us122l->mmap_count); usb_stream_hwdep_mmap() 271 mutex_unlock(&us122l->mutex); usb_stream_hwdep_mmap() 278 struct us122l *us122l = hw->private_data; usb_stream_hwdep_poll() local 282 poll_wait(file, &us122l->sk.sleep, wait); usb_stream_hwdep_poll() 285 if (mutex_trylock(&us122l->mutex)) { usb_stream_hwdep_poll() 286 struct usb_stream *s = us122l->sk.s; usb_stream_hwdep_poll() 288 if (us122l->first == file) usb_stream_hwdep_poll() 291 polled = &us122l->second_periods_polled; usb_stream_hwdep_poll() 298 mutex_unlock(&us122l->mutex); usb_stream_hwdep_poll() 303 static void us122l_stop(struct us122l *us122l) us122l_stop() argument 306 list_for_each(p, &us122l->midi_list) us122l_stop() 309 usb_stream_stop(&us122l->sk); us122l_stop() 310 usb_stream_free(&us122l->sk); us122l_stop() 331 static bool us122l_start(struct us122l *us122l, us122l_start() argument 339 if (us122l->dev->speed == USB_SPEED_HIGH) { us122l_start() 356 if (!usb_stream_new(&us122l->sk, us122l->dev, 1, 2, us122l_start() 360 err = us122l_set_sample_rate(us122l->dev, rate); us122l_start() 362 us122l_stop(us122l); us122l_start() 366 err = usb_stream_start(&us122l->sk); us122l_start() 368 us122l_stop(us122l); us122l_start() 372 list_for_each(p, &us122l->midi_list) us122l_start() 383 struct us122l *us122l = hw->private_data; usb_stream_hwdep_ioctl() local 400 high_speed = us122l->dev->speed == USB_SPEED_HIGH; usb_stream_hwdep_ioctl() 429 mutex_lock(&us122l->mutex); usb_stream_hwdep_ioctl() 430 s = us122l->sk.s; usb_stream_hwdep_ioctl() 431 if (!us122l->master) usb_stream_hwdep_ioctl() 432 us122l->master = file; usb_stream_hwdep_ioctl() 433 else if (us122l->master != file) { usb_stream_hwdep_ioctl() 438 us122l->slave = file; usb_stream_hwdep_ioctl() 442 us122l_stop(us122l); usb_stream_hwdep_ioctl() 443 if (!us122l_start(us122l, cfg->sample_rate, cfg->period_frames)) usb_stream_hwdep_ioctl() 449 mutex_unlock(&us122l->mutex); usb_stream_hwdep_ioctl() 452 wake_up_all(&us122l->sk.sleep); usb_stream_hwdep_ioctl() 485 struct us122l *us122l = US122L(card); us122l_create_card() local 487 if (us122l->dev->descriptor.idProduct == USB_ID_US144 || us122l_create_card() 488 us122l->dev->descriptor.idProduct == USB_ID_US144MKII) { us122l_create_card() 489 err = usb_set_interface(us122l->dev, 0, 1); us122l_create_card() 495 err = usb_set_interface(us122l->dev, 1, 1); us122l_create_card() 501 pt_info_set(us122l->dev, 0x11); us122l_create_card() 502 pt_info_set(us122l->dev, 0x10); us122l_create_card() 504 if (!us122l_start(us122l, 44100, 256)) us122l_create_card() 507 if (us122l->dev->descriptor.idProduct == USB_ID_US144 || us122l_create_card() 508 us122l->dev->descriptor.idProduct == USB_ID_US144MKII) us122l_create_card() 514 us122l_stop(us122l); us122l_create_card() 521 list_for_each(p, &us122l->midi_list) us122l_create_card() 524 us122l_stop(us122l); us122l_create_card() 532 struct us122l *us122l = US122L(card); snd_us122l_free() local 533 int index = us122l->card_index; snd_us122l_free() 552 sizeof(struct us122l), &card); usx2y_create_card() 636 struct us122l *us122l; snd_us122l_disconnect() local 645 us122l = US122L(card); snd_us122l_disconnect() 646 mutex_lock(&us122l->mutex); snd_us122l_disconnect() 647 us122l_stop(us122l); snd_us122l_disconnect() 648 mutex_unlock(&us122l->mutex); snd_us122l_disconnect() 651 list_for_each(p, &us122l->midi_list) { snd_us122l_disconnect() 655 usb_put_intf(usb_ifnum_to_if(us122l->dev, 0)); snd_us122l_disconnect() 656 usb_put_intf(usb_ifnum_to_if(us122l->dev, 1)); snd_us122l_disconnect() 657 usb_put_dev(us122l->dev); snd_us122l_disconnect() 659 while (atomic_read(&us122l->mmap_count)) snd_us122l_disconnect() 668 struct us122l *us122l; snd_us122l_suspend() local 676 us122l = US122L(card); snd_us122l_suspend() 677 if (!us122l) snd_us122l_suspend() 680 list_for_each(p, &us122l->midi_list) snd_us122l_suspend() 683 mutex_lock(&us122l->mutex); snd_us122l_suspend() 684 usb_stream_stop(&us122l->sk); snd_us122l_suspend() 685 mutex_unlock(&us122l->mutex); snd_us122l_suspend() 693 struct us122l *us122l; snd_us122l_resume() local 701 us122l = US122L(card); snd_us122l_resume() 702 if (!us122l) snd_us122l_resume() 705 mutex_lock(&us122l->mutex); snd_us122l_resume() 707 if (us122l->dev->descriptor.idProduct == USB_ID_US144 || snd_us122l_resume() 708 us122l->dev->descriptor.idProduct == USB_ID_US144MKII) { snd_us122l_resume() 709 err = usb_set_interface(us122l->dev, 0, 1); snd_us122l_resume() 715 err = usb_set_interface(us122l->dev, 1, 1); snd_us122l_resume() 721 pt_info_set(us122l->dev, 0x11); snd_us122l_resume() 722 pt_info_set(us122l->dev, 0x10); snd_us122l_resume() 724 err = us122l_set_sample_rate(us122l->dev, snd_us122l_resume() 725 us122l->sk.s->cfg.sample_rate); snd_us122l_resume() 730 err = usb_stream_start(&us122l->sk); snd_us122l_resume() 734 list_for_each(p, &us122l->midi_list) snd_us122l_resume() 737 mutex_unlock(&us122l->mutex); snd_us122l_resume() 768 .name = "snd-usb-us122l",
|