Lines Matching refs:rt

28 	struct midi_runtime *rt = urb->context;  in usb6fire_midi_out_handler()  local
32 spin_lock_irqsave(&rt->out_lock, flags); in usb6fire_midi_out_handler()
34 if (rt->out) { in usb6fire_midi_out_handler()
35 ret = snd_rawmidi_transmit(rt->out, rt->out_buffer + 4, in usb6fire_midi_out_handler()
38 rt->out_buffer[1] = ret + 2; in usb6fire_midi_out_handler()
39 rt->out_buffer[3] = rt->out_serial++; in usb6fire_midi_out_handler()
48 rt->out = NULL; in usb6fire_midi_out_handler()
50 spin_unlock_irqrestore(&rt->out_lock, flags); in usb6fire_midi_out_handler()
54 struct midi_runtime *rt, u8 *data, int length) in usb6fire_midi_in_received() argument
58 spin_lock_irqsave(&rt->in_lock, flags); in usb6fire_midi_in_received()
59 if (rt->in) in usb6fire_midi_in_received()
60 snd_rawmidi_receive(rt->in, data, length); in usb6fire_midi_in_received()
61 spin_unlock_irqrestore(&rt->in_lock, flags); in usb6fire_midi_in_received()
77 struct midi_runtime *rt = alsa_sub->rmidi->private_data; in usb6fire_midi_out_trigger() local
78 struct urb *urb = &rt->out_urb; in usb6fire_midi_out_trigger()
82 spin_lock_irqsave(&rt->out_lock, flags); in usb6fire_midi_out_trigger()
84 if (rt->out) { /* we are already transmitting so just return */ in usb6fire_midi_out_trigger()
85 spin_unlock_irqrestore(&rt->out_lock, flags); in usb6fire_midi_out_trigger()
89 ret = snd_rawmidi_transmit(alsa_sub, rt->out_buffer + 4, in usb6fire_midi_out_trigger()
92 rt->out_buffer[1] = ret + 2; in usb6fire_midi_out_trigger()
93 rt->out_buffer[3] = rt->out_serial++; in usb6fire_midi_out_trigger()
102 rt->out = alsa_sub; in usb6fire_midi_out_trigger()
104 } else if (rt->out == alsa_sub) in usb6fire_midi_out_trigger()
105 rt->out = NULL; in usb6fire_midi_out_trigger()
106 spin_unlock_irqrestore(&rt->out_lock, flags); in usb6fire_midi_out_trigger()
111 struct midi_runtime *rt = alsa_sub->rmidi->private_data; in usb6fire_midi_out_drain() local
114 while (rt->out && retry++ < 100) in usb6fire_midi_out_drain()
131 struct midi_runtime *rt = alsa_sub->rmidi->private_data; in usb6fire_midi_in_trigger() local
134 spin_lock_irqsave(&rt->in_lock, flags); in usb6fire_midi_in_trigger()
136 rt->in = alsa_sub; in usb6fire_midi_in_trigger()
138 rt->in = NULL; in usb6fire_midi_in_trigger()
139 spin_unlock_irqrestore(&rt->in_lock, flags); in usb6fire_midi_in_trigger()
158 struct midi_runtime *rt = kzalloc(sizeof(struct midi_runtime), in usb6fire_midi_init() local
162 if (!rt) in usb6fire_midi_init()
165 rt->out_buffer = kzalloc(MIDI_BUFSIZE, GFP_KERNEL); in usb6fire_midi_init()
166 if (!rt->out_buffer) { in usb6fire_midi_init()
167 kfree(rt); in usb6fire_midi_init()
171 rt->chip = chip; in usb6fire_midi_init()
172 rt->in_received = usb6fire_midi_in_received; in usb6fire_midi_init()
173 rt->out_buffer[0] = 0x80; /* 'send midi' command */ in usb6fire_midi_init()
174 rt->out_buffer[1] = 0x00; /* size of data */ in usb6fire_midi_init()
175 rt->out_buffer[2] = 0x00; /* always 0 */ in usb6fire_midi_init()
176 spin_lock_init(&rt->in_lock); in usb6fire_midi_init()
177 spin_lock_init(&rt->out_lock); in usb6fire_midi_init()
179 comm_rt->init_urb(comm_rt, &rt->out_urb, rt->out_buffer, rt, in usb6fire_midi_init()
182 ret = snd_rawmidi_new(chip->card, "6FireUSB", 0, 1, 1, &rt->instance); in usb6fire_midi_init()
184 kfree(rt->out_buffer); in usb6fire_midi_init()
185 kfree(rt); in usb6fire_midi_init()
189 rt->instance->private_data = rt; in usb6fire_midi_init()
190 strcpy(rt->instance->name, "DMX6FireUSB MIDI"); in usb6fire_midi_init()
191 rt->instance->info_flags = SNDRV_RAWMIDI_INFO_OUTPUT | in usb6fire_midi_init()
194 snd_rawmidi_set_ops(rt->instance, SNDRV_RAWMIDI_STREAM_OUTPUT, in usb6fire_midi_init()
196 snd_rawmidi_set_ops(rt->instance, SNDRV_RAWMIDI_STREAM_INPUT, in usb6fire_midi_init()
199 chip->midi = rt; in usb6fire_midi_init()
205 struct midi_runtime *rt = chip->midi; in usb6fire_midi_abort() local
207 if (rt) in usb6fire_midi_abort()
208 usb_poison_urb(&rt->out_urb); in usb6fire_midi_abort()
213 struct midi_runtime *rt = chip->midi; in usb6fire_midi_destroy() local
215 kfree(rt->out_buffer); in usb6fire_midi_destroy()
216 kfree(rt); in usb6fire_midi_destroy()