Lines Matching +full:serial +full:- +full:midi
1 // SPDX-License-Identifier: GPL-2.0-or-later
14 #include "midi.h"
25 urb->transfer_buffer = buffer; in usb6fire_comm_init_urb()
26 urb->pipe = usb_sndintpipe(rt->chip->dev, COMM_EP); in usb6fire_comm_init_urb()
27 urb->complete = handler; in usb6fire_comm_init_urb()
28 urb->context = context; in usb6fire_comm_init_urb()
29 urb->interval = 1; in usb6fire_comm_init_urb()
30 urb->dev = rt->chip->dev; in usb6fire_comm_init_urb()
35 struct comm_runtime *rt = urb->context; in usb6fire_comm_receiver_handler()
36 struct midi_runtime *midi_rt = rt->chip->midi; in usb6fire_comm_receiver_handler()
38 if (!urb->status) { in usb6fire_comm_receiver_handler()
39 if (rt->receiver_buffer[0] == 0x10) /* midi in event */ in usb6fire_comm_receiver_handler()
41 midi_rt->in_received(midi_rt, in usb6fire_comm_receiver_handler()
42 rt->receiver_buffer + 2, in usb6fire_comm_receiver_handler()
43 rt->receiver_buffer[1]); in usb6fire_comm_receiver_handler()
46 if (!rt->chip->shutdown) { in usb6fire_comm_receiver_handler()
47 urb->status = 0; in usb6fire_comm_receiver_handler()
48 urb->actual_length = 0; in usb6fire_comm_receiver_handler()
50 dev_warn(&urb->dev->dev, in usb6fire_comm_receiver_handler()
102 return -EIO; in usb6fire_comm_send_buffer()
115 return -ENOMEM; in usb6fire_comm_write8()
118 ret = usb6fire_comm_send_buffer(buffer, rt->chip->dev); in usb6fire_comm_write8()
133 return -ENOMEM; in usb6fire_comm_write16()
136 ret = usb6fire_comm_send_buffer(buffer, rt->chip->dev); in usb6fire_comm_write16()
150 return -ENOMEM; in usb6fire_comm_init()
152 rt->receiver_buffer = kzalloc(COMM_RECEIVER_BUFSIZE, GFP_KERNEL); in usb6fire_comm_init()
153 if (!rt->receiver_buffer) { in usb6fire_comm_init()
155 return -ENOMEM; in usb6fire_comm_init()
158 urb = &rt->receiver; in usb6fire_comm_init()
159 rt->serial = 1; in usb6fire_comm_init()
160 rt->chip = chip; in usb6fire_comm_init()
162 rt->init_urb = usb6fire_comm_init_urb; in usb6fire_comm_init()
163 rt->write8 = usb6fire_comm_write8; in usb6fire_comm_init()
164 rt->write16 = usb6fire_comm_write16; in usb6fire_comm_init()
167 urb->transfer_buffer = rt->receiver_buffer; in usb6fire_comm_init()
168 urb->transfer_buffer_length = COMM_RECEIVER_BUFSIZE; in usb6fire_comm_init()
169 urb->pipe = usb_rcvintpipe(chip->dev, COMM_EP); in usb6fire_comm_init()
170 urb->dev = chip->dev; in usb6fire_comm_init()
171 urb->complete = usb6fire_comm_receiver_handler; in usb6fire_comm_init()
172 urb->context = rt; in usb6fire_comm_init()
173 urb->interval = 1; in usb6fire_comm_init()
176 kfree(rt->receiver_buffer); in usb6fire_comm_init()
178 dev_err(&chip->dev->dev, "cannot create comm data receiver."); in usb6fire_comm_init()
181 chip->comm = rt; in usb6fire_comm_init()
187 struct comm_runtime *rt = chip->comm; in usb6fire_comm_abort()
190 usb_poison_urb(&rt->receiver); in usb6fire_comm_abort()
195 struct comm_runtime *rt = chip->comm; in usb6fire_comm_destroy()
197 kfree(rt->receiver_buffer); in usb6fire_comm_destroy()
199 chip->comm = NULL; in usb6fire_comm_destroy()