12 #include <linux/slab.h>
26 static int submit_audio_in_urb(
struct snd_line6_pcm *line6pcm)
48 struct usb_iso_packet_descriptor *fin =
49 &urb_in->iso_frame_desc[
i];
50 fin->offset = urb_size;
55 urb_in->transfer_buffer =
58 urb_in->transfer_buffer_length = urb_size;
59 urb_in->context = line6pcm;
67 "URB in #%d submission failed (%d)\n", index, ret);
81 ret = submit_audio_in_urb(line6pcm);
126 }
while (--timeout > 0);
165 len * bytes_per_frame);
167 (frames - len) * bytes_per_frame);
171 "driver bug: len = %d\n", len);
176 line6pcm->
pos_in_done * bytes_per_frame, fbuf, fsize);
205 static void audio_in_callback(
struct urb *
urb)
219 #ifdef CONFIG_LINE6_USB_DUMP_PCM
221 struct usb_iso_packet_descriptor *fout =
222 &urb->iso_frame_desc[
i];
223 line6_write_hexdump(line6pcm->
line6,
'C',
224 urb->transfer_buffer + fout->offset,
234 struct usb_iso_packet_descriptor *fin = &urb->iso_frame_desc[
i];
236 if (fin->status == -
EXDEV) {
241 fbuf = urb->transfer_buffer + fin->offset;
242 fsize = fin->actual_length;
246 "driver and/or device bug: packet too large (%d > %d)\n",
256 #ifdef CONFIG_LINE6_USB_IMPULSE_RESPONSE
257 if (!(line6pcm->
flags & LINE6_BITS_PCM_IMPULSE))
272 submit_audio_in_urb(line6pcm);
274 #ifdef CONFIG_LINE6_USB_IMPULSE_RESPONSE
275 if (!(line6pcm->
flags & LINE6_BITS_PCM_IMPULSE))
296 runtime->
hw = line6pcm->
properties->snd_line6_capture_hw;
315 if (line6pcm ==
NULL) {
318 if (substream->
pcm->private_data ==
NULL)
337 line6pcm->
period_in = params_period_bytes(hw_params);
394 .open = snd_line6_capture_open,
395 .close = snd_line6_capture_close,
397 .hw_params = snd_line6_capture_hw_params,
398 .hw_free = snd_line6_capture_hw_free,
401 .pointer = snd_line6_capture_pointer,
421 urb->dev = line6pcm->
line6->usbdev;
423 usb_rcvisocpipe(line6pcm->
line6->usbdev,
426 urb->transfer_flags = URB_ISO_ASAP;
427 urb->start_frame = -1;
430 urb->error_count = 0;
431 urb->complete = audio_in_callback;