Lines Matching refs:cdev

190 static inline void snd_caiaq_input_report_abs(struct snd_usb_caiaqdev *cdev,  in snd_caiaq_input_report_abs()  argument
194 input_report_abs(cdev->input_dev, axis, in snd_caiaq_input_report_abs()
198 static void snd_caiaq_input_read_analog(struct snd_usb_caiaqdev *cdev, in snd_caiaq_input_read_analog() argument
202 struct input_dev *input_dev = cdev->input_dev; in snd_caiaq_input_read_analog()
204 switch (cdev->chip.usb_id) { in snd_caiaq_input_read_analog()
206 snd_caiaq_input_report_abs(cdev, ABS_X, buf, 2); in snd_caiaq_input_read_analog()
207 snd_caiaq_input_report_abs(cdev, ABS_Y, buf, 0); in snd_caiaq_input_read_analog()
208 snd_caiaq_input_report_abs(cdev, ABS_Z, buf, 1); in snd_caiaq_input_read_analog()
213 snd_caiaq_input_report_abs(cdev, ABS_X, buf, 0); in snd_caiaq_input_read_analog()
214 snd_caiaq_input_report_abs(cdev, ABS_Y, buf, 1); in snd_caiaq_input_read_analog()
215 snd_caiaq_input_report_abs(cdev, ABS_Z, buf, 2); in snd_caiaq_input_read_analog()
218 snd_caiaq_input_report_abs(cdev, ABS_HAT0X, buf, 4); in snd_caiaq_input_read_analog()
219 snd_caiaq_input_report_abs(cdev, ABS_HAT0Y, buf, 2); in snd_caiaq_input_read_analog()
220 snd_caiaq_input_report_abs(cdev, ABS_HAT1X, buf, 6); in snd_caiaq_input_read_analog()
221 snd_caiaq_input_report_abs(cdev, ABS_HAT1Y, buf, 1); in snd_caiaq_input_read_analog()
222 snd_caiaq_input_report_abs(cdev, ABS_HAT2X, buf, 7); in snd_caiaq_input_read_analog()
223 snd_caiaq_input_report_abs(cdev, ABS_HAT2Y, buf, 0); in snd_caiaq_input_read_analog()
224 snd_caiaq_input_report_abs(cdev, ABS_HAT3X, buf, 5); in snd_caiaq_input_read_analog()
225 snd_caiaq_input_report_abs(cdev, ABS_HAT3Y, buf, 3); in snd_caiaq_input_read_analog()
232 static void snd_caiaq_input_read_erp(struct snd_usb_caiaqdev *cdev, in snd_caiaq_input_read_erp() argument
235 struct input_dev *input_dev = cdev->input_dev; in snd_caiaq_input_read_erp()
238 switch (cdev->chip.usb_id) { in snd_caiaq_input_read_erp()
290 static void snd_caiaq_input_read_io(struct snd_usb_caiaqdev *cdev, in snd_caiaq_input_read_io() argument
293 struct input_dev *input_dev = cdev->input_dev; in snd_caiaq_input_read_io()
308 switch (cdev->chip.usb_id) { in snd_caiaq_input_read_io()
311 input_report_abs(cdev->input_dev, ABS_MISC, 255 - buf[4]); in snd_caiaq_input_read_io()
315 input_report_abs(cdev->input_dev, ABS_X, buf[5] & 0xf); in snd_caiaq_input_read_io()
316 input_report_abs(cdev->input_dev, ABS_Y, buf[5] >> 4); in snd_caiaq_input_read_io()
317 input_report_abs(cdev->input_dev, ABS_Z, buf[6] & 0xf); in snd_caiaq_input_read_io()
318 input_report_abs(cdev->input_dev, ABS_MISC, buf[6] >> 4); in snd_caiaq_input_read_io()
327 static void snd_usb_caiaq_tks4_dispatch(struct snd_usb_caiaqdev *cdev, in snd_usb_caiaq_tks4_dispatch() argument
331 struct device *dev = caiaqdev_to_dev(cdev); in snd_usb_caiaq_tks4_dispatch()
340 input_report_key(cdev->input_dev, KONTROLS4_BUTTON(i), in snd_usb_caiaq_tks4_dispatch()
346 input_report_abs(cdev->input_dev, KONTROLS4_ABS(36), buf[9] | ((buf[8] & 0x3) << 8)); in snd_usb_caiaq_tks4_dispatch()
348 input_report_abs(cdev->input_dev, KONTROLS4_ABS(37), buf[13] | ((buf[12] & 0x3) << 8)); in snd_usb_caiaq_tks4_dispatch()
351 input_report_abs(cdev->input_dev, KONTROLS4_ABS(38), buf[3] & 0xf); in snd_usb_caiaq_tks4_dispatch()
352 input_report_abs(cdev->input_dev, KONTROLS4_ABS(39), buf[4] >> 4); in snd_usb_caiaq_tks4_dispatch()
353 input_report_abs(cdev->input_dev, KONTROLS4_ABS(40), buf[4] & 0xf); in snd_usb_caiaq_tks4_dispatch()
354 input_report_abs(cdev->input_dev, KONTROLS4_ABS(41), buf[5] >> 4); in snd_usb_caiaq_tks4_dispatch()
355 input_report_abs(cdev->input_dev, KONTROLS4_ABS(42), buf[5] & 0xf); in snd_usb_caiaq_tks4_dispatch()
356 input_report_abs(cdev->input_dev, KONTROLS4_ABS(43), buf[6] >> 4); in snd_usb_caiaq_tks4_dispatch()
357 input_report_abs(cdev->input_dev, KONTROLS4_ABS(44), buf[6] & 0xf); in snd_usb_caiaq_tks4_dispatch()
358 input_report_abs(cdev->input_dev, KONTROLS4_ABS(45), buf[7] >> 4); in snd_usb_caiaq_tks4_dispatch()
359 input_report_abs(cdev->input_dev, KONTROLS4_ABS(46), buf[7] & 0xf); in snd_usb_caiaq_tks4_dispatch()
364 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(0), buf, 1); in snd_usb_caiaq_tks4_dispatch()
366 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(1), buf, 2); in snd_usb_caiaq_tks4_dispatch()
368 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(2), buf, 3); in snd_usb_caiaq_tks4_dispatch()
370 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(3), buf, 4); in snd_usb_caiaq_tks4_dispatch()
372 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(4), buf, 6); in snd_usb_caiaq_tks4_dispatch()
374 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(7), buf, 7); in snd_usb_caiaq_tks4_dispatch()
380 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(6), buf, 3); in snd_usb_caiaq_tks4_dispatch()
382 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(5), buf, 4); in snd_usb_caiaq_tks4_dispatch()
384 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(8), buf, 6); in snd_usb_caiaq_tks4_dispatch()
386 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(9), buf, 7); in snd_usb_caiaq_tks4_dispatch()
392 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(10), buf, 1); in snd_usb_caiaq_tks4_dispatch()
394 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(11), buf, 2); in snd_usb_caiaq_tks4_dispatch()
396 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(12), buf, 3); in snd_usb_caiaq_tks4_dispatch()
398 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(13), buf, 4); in snd_usb_caiaq_tks4_dispatch()
400 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(14), buf, 5); in snd_usb_caiaq_tks4_dispatch()
402 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(15), buf, 6); in snd_usb_caiaq_tks4_dispatch()
404 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(16), buf, 7); in snd_usb_caiaq_tks4_dispatch()
410 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(17), buf, 1); in snd_usb_caiaq_tks4_dispatch()
412 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(18), buf, 2); in snd_usb_caiaq_tks4_dispatch()
414 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(19), buf, 3); in snd_usb_caiaq_tks4_dispatch()
416 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(20), buf, 4); in snd_usb_caiaq_tks4_dispatch()
418 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(21), buf, 5); in snd_usb_caiaq_tks4_dispatch()
420 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(22), buf, 6); in snd_usb_caiaq_tks4_dispatch()
422 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(23), buf, 7); in snd_usb_caiaq_tks4_dispatch()
428 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(24), buf, 1); in snd_usb_caiaq_tks4_dispatch()
430 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(25), buf, 2); in snd_usb_caiaq_tks4_dispatch()
432 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(26), buf, 3); in snd_usb_caiaq_tks4_dispatch()
434 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(27), buf, 4); in snd_usb_caiaq_tks4_dispatch()
436 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(28), buf, 5); in snd_usb_caiaq_tks4_dispatch()
438 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(29), buf, 6); in snd_usb_caiaq_tks4_dispatch()
440 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(30), buf, 7); in snd_usb_caiaq_tks4_dispatch()
446 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(31), buf, 1); in snd_usb_caiaq_tks4_dispatch()
448 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(32), buf, 2); in snd_usb_caiaq_tks4_dispatch()
450 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(33), buf, 3); in snd_usb_caiaq_tks4_dispatch()
452 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(34), buf, 4); in snd_usb_caiaq_tks4_dispatch()
454 snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(35), buf, 5); in snd_usb_caiaq_tks4_dispatch()
468 input_sync(cdev->input_dev); in snd_usb_caiaq_tks4_dispatch()
473 static void snd_usb_caiaq_maschine_dispatch(struct snd_usb_caiaqdev *cdev, in snd_usb_caiaq_maschine_dispatch() argument
482 input_report_abs(cdev->input_dev, MASCHINE_PAD(pad_id), in snd_usb_caiaq_maschine_dispatch()
487 input_sync(cdev->input_dev); in snd_usb_caiaq_maschine_dispatch()
492 struct snd_usb_caiaqdev *cdev = urb->context; in snd_usb_caiaq_ep4_reply_dispatch() local
497 if (urb->status || !cdev || urb != cdev->ep4_in_urb) in snd_usb_caiaq_ep4_reply_dispatch()
500 switch (cdev->chip.usb_id) { in snd_usb_caiaq_ep4_reply_dispatch()
506 snd_caiaq_input_read_io(cdev, buf + 1, 7); in snd_usb_caiaq_ep4_reply_dispatch()
509 snd_caiaq_input_read_analog(cdev, buf + 8, 16); in snd_usb_caiaq_ep4_reply_dispatch()
514 snd_usb_caiaq_tks4_dispatch(cdev, buf, urb->actual_length); in snd_usb_caiaq_ep4_reply_dispatch()
521 snd_usb_caiaq_maschine_dispatch(cdev, buf, urb->actual_length); in snd_usb_caiaq_ep4_reply_dispatch()
526 cdev->ep4_in_urb->actual_length = 0; in snd_usb_caiaq_ep4_reply_dispatch()
527 ret = usb_submit_urb(cdev->ep4_in_urb, GFP_ATOMIC); in snd_usb_caiaq_ep4_reply_dispatch()
534 struct snd_usb_caiaqdev *cdev = input_get_drvdata(idev); in snd_usb_caiaq_input_open() local
536 if (!cdev) in snd_usb_caiaq_input_open()
539 switch (cdev->chip.usb_id) { in snd_usb_caiaq_input_open()
543 if (usb_submit_urb(cdev->ep4_in_urb, GFP_KERNEL) != 0) in snd_usb_caiaq_input_open()
553 struct snd_usb_caiaqdev *cdev = input_get_drvdata(idev); in snd_usb_caiaq_input_close() local
555 if (!cdev) in snd_usb_caiaq_input_close()
558 switch (cdev->chip.usb_id) { in snd_usb_caiaq_input_close()
562 usb_kill_urb(cdev->ep4_in_urb); in snd_usb_caiaq_input_close()
567 void snd_usb_caiaq_input_dispatch(struct snd_usb_caiaqdev *cdev, in snd_usb_caiaq_input_dispatch() argument
571 if (!cdev->input_dev || len < 1) in snd_usb_caiaq_input_dispatch()
576 snd_caiaq_input_read_analog(cdev, buf + 1, len - 1); in snd_usb_caiaq_input_dispatch()
579 snd_caiaq_input_read_erp(cdev, buf + 1, len - 1); in snd_usb_caiaq_input_dispatch()
582 snd_caiaq_input_read_io(cdev, buf + 1, len - 1); in snd_usb_caiaq_input_dispatch()
587 int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *cdev) in snd_usb_caiaq_input_init() argument
589 struct usb_device *usb_dev = cdev->chip.dev; in snd_usb_caiaq_input_init()
597 usb_make_path(usb_dev, cdev->phys, sizeof(cdev->phys)); in snd_usb_caiaq_input_init()
598 strlcat(cdev->phys, "/input0", sizeof(cdev->phys)); in snd_usb_caiaq_input_init()
600 input->name = cdev->product_name; in snd_usb_caiaq_input_init()
601 input->phys = cdev->phys; in snd_usb_caiaq_input_init()
605 input_set_drvdata(input, cdev); in snd_usb_caiaq_input_init()
607 switch (cdev->chip.usb_id) { in snd_usb_caiaq_input_init()
612 BUILD_BUG_ON(sizeof(cdev->keycode) < sizeof(keycode_rk2)); in snd_usb_caiaq_input_init()
613 memcpy(cdev->keycode, keycode_rk2, sizeof(keycode_rk2)); in snd_usb_caiaq_input_init()
618 snd_usb_caiaq_set_auto_msg(cdev, 1, 10, 0); in snd_usb_caiaq_input_init()
624 BUILD_BUG_ON(sizeof(cdev->keycode) < sizeof(keycode_rk3)); in snd_usb_caiaq_input_init()
625 memcpy(cdev->keycode, keycode_rk3, sizeof(keycode_rk3)); in snd_usb_caiaq_input_init()
630 snd_usb_caiaq_set_auto_msg(cdev, 1, 10, 0); in snd_usb_caiaq_input_init()
635 BUILD_BUG_ON(sizeof(cdev->keycode) < sizeof(keycode_ak1)); in snd_usb_caiaq_input_init()
636 memcpy(cdev->keycode, keycode_ak1, sizeof(keycode_ak1)); in snd_usb_caiaq_input_init()
639 snd_usb_caiaq_set_auto_msg(cdev, 1, 0, 5); in snd_usb_caiaq_input_init()
651 BUILD_BUG_ON(sizeof(cdev->keycode) < sizeof(keycode_kore)); in snd_usb_caiaq_input_init()
652 memcpy(cdev->keycode, keycode_kore, sizeof(keycode_kore)); in snd_usb_caiaq_input_init()
666 snd_usb_caiaq_set_auto_msg(cdev, 1, 10, 5); in snd_usb_caiaq_input_init()
677 BUILD_BUG_ON(sizeof(cdev->keycode) < KONTROLX1_INPUTS); in snd_usb_caiaq_input_init()
679 cdev->keycode[i] = BTN_MISC + i; in snd_usb_caiaq_input_init()
698 cdev->ep4_in_urb = usb_alloc_urb(0, GFP_KERNEL); in snd_usb_caiaq_input_init()
699 if (!cdev->ep4_in_urb) { in snd_usb_caiaq_input_init()
704 usb_fill_bulk_urb(cdev->ep4_in_urb, usb_dev, in snd_usb_caiaq_input_init()
706 cdev->ep4_in_buf, EP4_BUFSIZE, in snd_usb_caiaq_input_init()
707 snd_usb_caiaq_ep4_reply_dispatch, cdev); in snd_usb_caiaq_input_init()
708 ret = usb_urb_ep_type_check(cdev->ep4_in_urb); in snd_usb_caiaq_input_init()
712 snd_usb_caiaq_set_auto_msg(cdev, 1, 10, 5); in snd_usb_caiaq_input_init()
718 BUILD_BUG_ON(sizeof(cdev->keycode) < KONTROLS4_BUTTONS); in snd_usb_caiaq_input_init()
720 cdev->keycode[i] = KONTROLS4_BUTTON(i); in snd_usb_caiaq_input_init()
740 cdev->ep4_in_urb = usb_alloc_urb(0, GFP_KERNEL); in snd_usb_caiaq_input_init()
741 if (!cdev->ep4_in_urb) { in snd_usb_caiaq_input_init()
746 usb_fill_bulk_urb(cdev->ep4_in_urb, usb_dev, in snd_usb_caiaq_input_init()
748 cdev->ep4_in_buf, EP4_BUFSIZE, in snd_usb_caiaq_input_init()
749 snd_usb_caiaq_ep4_reply_dispatch, cdev); in snd_usb_caiaq_input_init()
750 ret = usb_urb_ep_type_check(cdev->ep4_in_urb); in snd_usb_caiaq_input_init()
754 snd_usb_caiaq_set_auto_msg(cdev, 1, 10, 5); in snd_usb_caiaq_input_init()
767 BUILD_BUG_ON(sizeof(cdev->keycode) < sizeof(keycode_maschine)); in snd_usb_caiaq_input_init()
768 memcpy(cdev->keycode, keycode_maschine, sizeof(keycode_maschine)); in snd_usb_caiaq_input_init()
788 cdev->ep4_in_urb = usb_alloc_urb(0, GFP_KERNEL); in snd_usb_caiaq_input_init()
789 if (!cdev->ep4_in_urb) { in snd_usb_caiaq_input_init()
794 usb_fill_bulk_urb(cdev->ep4_in_urb, usb_dev, in snd_usb_caiaq_input_init()
796 cdev->ep4_in_buf, EP4_BUFSIZE, in snd_usb_caiaq_input_init()
797 snd_usb_caiaq_ep4_reply_dispatch, cdev); in snd_usb_caiaq_input_init()
798 ret = usb_urb_ep_type_check(cdev->ep4_in_urb); in snd_usb_caiaq_input_init()
802 snd_usb_caiaq_set_auto_msg(cdev, 1, 10, 5); in snd_usb_caiaq_input_init()
812 input->keycode = cdev->keycode; in snd_usb_caiaq_input_init()
815 __set_bit(cdev->keycode[i], input->keybit); in snd_usb_caiaq_input_init()
817 cdev->input_dev = input; in snd_usb_caiaq_input_init()
827 cdev->input_dev = NULL; in snd_usb_caiaq_input_init()
831 void snd_usb_caiaq_input_free(struct snd_usb_caiaqdev *cdev) in snd_usb_caiaq_input_free() argument
833 if (!cdev || !cdev->input_dev) in snd_usb_caiaq_input_free()
836 usb_kill_urb(cdev->ep4_in_urb); in snd_usb_caiaq_input_free()
837 usb_free_urb(cdev->ep4_in_urb); in snd_usb_caiaq_input_free()
838 cdev->ep4_in_urb = NULL; in snd_usb_caiaq_input_free()
840 input_unregister_device(cdev->input_dev); in snd_usb_caiaq_input_free()
841 cdev->input_dev = NULL; in snd_usb_caiaq_input_free()