Lines Matching refs:rt
24 struct midi_runtime *rt = urb->context; in usb6fire_midi_out_handler() local
28 spin_lock_irqsave(&rt->out_lock, flags); in usb6fire_midi_out_handler()
30 if (rt->out) { in usb6fire_midi_out_handler()
31 ret = snd_rawmidi_transmit(rt->out, rt->out_buffer + 4, in usb6fire_midi_out_handler()
34 rt->out_buffer[1] = ret + 2; in usb6fire_midi_out_handler()
35 rt->out_buffer[3] = rt->out_serial++; in usb6fire_midi_out_handler()
44 rt->out = NULL; in usb6fire_midi_out_handler()
46 spin_unlock_irqrestore(&rt->out_lock, flags); in usb6fire_midi_out_handler()
50 struct midi_runtime *rt, u8 *data, int length) in usb6fire_midi_in_received() argument
54 spin_lock_irqsave(&rt->in_lock, flags); in usb6fire_midi_in_received()
55 if (rt->in) in usb6fire_midi_in_received()
56 snd_rawmidi_receive(rt->in, data, length); in usb6fire_midi_in_received()
57 spin_unlock_irqrestore(&rt->in_lock, flags); in usb6fire_midi_in_received()
73 struct midi_runtime *rt = alsa_sub->rmidi->private_data; in usb6fire_midi_out_trigger() local
74 struct urb *urb = &rt->out_urb; in usb6fire_midi_out_trigger()
78 spin_lock_irqsave(&rt->out_lock, flags); in usb6fire_midi_out_trigger()
80 if (rt->out) { /* we are already transmitting so just return */ in usb6fire_midi_out_trigger()
81 spin_unlock_irqrestore(&rt->out_lock, flags); in usb6fire_midi_out_trigger()
85 ret = snd_rawmidi_transmit(alsa_sub, rt->out_buffer + 4, in usb6fire_midi_out_trigger()
88 rt->out_buffer[1] = ret + 2; in usb6fire_midi_out_trigger()
89 rt->out_buffer[3] = rt->out_serial++; in usb6fire_midi_out_trigger()
98 rt->out = alsa_sub; in usb6fire_midi_out_trigger()
100 } else if (rt->out == alsa_sub) in usb6fire_midi_out_trigger()
101 rt->out = NULL; in usb6fire_midi_out_trigger()
102 spin_unlock_irqrestore(&rt->out_lock, flags); in usb6fire_midi_out_trigger()
107 struct midi_runtime *rt = alsa_sub->rmidi->private_data; in usb6fire_midi_out_drain() local
110 while (rt->out && retry++ < 100) in usb6fire_midi_out_drain()
127 struct midi_runtime *rt = alsa_sub->rmidi->private_data; in usb6fire_midi_in_trigger() local
130 spin_lock_irqsave(&rt->in_lock, flags); in usb6fire_midi_in_trigger()
132 rt->in = alsa_sub; in usb6fire_midi_in_trigger()
134 rt->in = NULL; in usb6fire_midi_in_trigger()
135 spin_unlock_irqrestore(&rt->in_lock, flags); in usb6fire_midi_in_trigger()
154 struct midi_runtime *rt = kzalloc(sizeof(struct midi_runtime), in usb6fire_midi_init() local
158 if (!rt) in usb6fire_midi_init()
161 rt->out_buffer = kzalloc(MIDI_BUFSIZE, GFP_KERNEL); in usb6fire_midi_init()
162 if (!rt->out_buffer) { in usb6fire_midi_init()
163 kfree(rt); in usb6fire_midi_init()
167 rt->chip = chip; in usb6fire_midi_init()
168 rt->in_received = usb6fire_midi_in_received; in usb6fire_midi_init()
169 rt->out_buffer[0] = 0x80; /* 'send midi' command */ in usb6fire_midi_init()
170 rt->out_buffer[1] = 0x00; /* size of data */ in usb6fire_midi_init()
171 rt->out_buffer[2] = 0x00; /* always 0 */ in usb6fire_midi_init()
172 spin_lock_init(&rt->in_lock); in usb6fire_midi_init()
173 spin_lock_init(&rt->out_lock); in usb6fire_midi_init()
175 comm_rt->init_urb(comm_rt, &rt->out_urb, rt->out_buffer, rt, in usb6fire_midi_init()
178 ret = snd_rawmidi_new(chip->card, "6FireUSB", 0, 1, 1, &rt->instance); in usb6fire_midi_init()
180 kfree(rt->out_buffer); in usb6fire_midi_init()
181 kfree(rt); in usb6fire_midi_init()
185 rt->instance->private_data = rt; in usb6fire_midi_init()
186 strcpy(rt->instance->name, "DMX6FireUSB MIDI"); in usb6fire_midi_init()
187 rt->instance->info_flags = SNDRV_RAWMIDI_INFO_OUTPUT | in usb6fire_midi_init()
190 snd_rawmidi_set_ops(rt->instance, SNDRV_RAWMIDI_STREAM_OUTPUT, in usb6fire_midi_init()
192 snd_rawmidi_set_ops(rt->instance, SNDRV_RAWMIDI_STREAM_INPUT, in usb6fire_midi_init()
195 chip->midi = rt; in usb6fire_midi_init()
201 struct midi_runtime *rt = chip->midi; in usb6fire_midi_abort() local
203 if (rt) in usb6fire_midi_abort()
204 usb_poison_urb(&rt->out_urb); in usb6fire_midi_abort()
209 struct midi_runtime *rt = chip->midi; in usb6fire_midi_destroy() local
211 kfree(rt->out_buffer); in usb6fire_midi_destroy()
212 kfree(rt); in usb6fire_midi_destroy()