2 * Copyright (c) 2006-2008 Daniel Mack, Karsten Wiese
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #include <linux/spinlock.h>
20 #include <linux/init.h>
21 #include <linux/usb.h>
22 #include <sound/core.h>
23 #include <sound/pcm.h>
29 #define CLOCK_DRIFT_TOLERANCE 5
30 #define FRAMES_PER_URB 8
31 #define BYTES_PER_FRAME 512
32 #define CHANNELS_PER_STREAM 2
33 #define BYTES_PER_SAMPLE 3
34 #define BYTES_PER_SAMPLE_USB 4
35 #define MAX_BUFFER_SIZE (128*1024)
36 #define MAX_ENDPOINT_SIZE 512
38 #define ENDPOINT_CAPTURE 2
39 #define ENDPOINT_PLAYBACK 6
41 #define MAKE_CHECKBYTE(dev,stream,i) \
42 (stream << 1) | (~(i / (dev->n_streams * BYTES_PER_SAMPLE_USB)) & 1)
44 static struct snd_pcm_hardware snd_usb_caiaq_pcm_hardware
= {
45 .info
= (SNDRV_PCM_INFO_MMAP
| SNDRV_PCM_INFO_INTERLEAVED
|
46 SNDRV_PCM_INFO_BLOCK_TRANSFER
),
47 .formats
= SNDRV_PCM_FMTBIT_S24_3BE
,
48 .rates
= (SNDRV_PCM_RATE_44100
| SNDRV_PCM_RATE_48000
|
49 SNDRV_PCM_RATE_96000
),
51 .rate_max
= 0, /* will overwrite later */
52 .channels_min
= CHANNELS_PER_STREAM
,
53 .channels_max
= CHANNELS_PER_STREAM
,
54 .buffer_bytes_max
= MAX_BUFFER_SIZE
,
55 .period_bytes_min
= 128,
56 .period_bytes_max
= MAX_BUFFER_SIZE
,
62 activate_substream(struct snd_usb_caiaqdev
*dev
,
63 struct snd_pcm_substream
*sub
)
65 if (sub
->stream
== SNDRV_PCM_STREAM_PLAYBACK
)
66 dev
->sub_playback
[sub
->number
] = sub
;
68 dev
->sub_capture
[sub
->number
] = sub
;
72 deactivate_substream(struct snd_usb_caiaqdev
*dev
,
73 struct snd_pcm_substream
*sub
)
76 spin_lock_irqsave(&dev
->spinlock
, flags
);
78 if (sub
->stream
== SNDRV_PCM_STREAM_PLAYBACK
)
79 dev
->sub_playback
[sub
->number
] = NULL
;
81 dev
->sub_capture
[sub
->number
] = NULL
;
83 spin_unlock_irqrestore(&dev
->spinlock
, flags
);
87 all_substreams_zero(struct snd_pcm_substream
**subs
)
90 for (i
= 0; i
< MAX_STREAMS
; i
++)
96 static int stream_start(struct snd_usb_caiaqdev
*dev
)
100 debug("%s(%p)\n", __func__
, dev
);
105 memset(dev
->sub_playback
, 0, sizeof(dev
->sub_playback
));
106 memset(dev
->sub_capture
, 0, sizeof(dev
->sub_capture
));
107 dev
->input_panic
= 0;
108 dev
->output_panic
= 0;
109 dev
->first_packet
= 1;
113 for (i
= 0; i
< N_URBS
; i
++) {
114 ret
= usb_submit_urb(dev
->data_urbs_in
[i
], GFP_ATOMIC
);
116 log("unable to trigger read #%d! (ret %d)\n", i
, ret
);
125 static void stream_stop(struct snd_usb_caiaqdev
*dev
)
129 debug("%s(%p)\n", __func__
, dev
);
135 for (i
= 0; i
< N_URBS
; i
++) {
136 usb_kill_urb(dev
->data_urbs_in
[i
]);
137 usb_kill_urb(dev
->data_urbs_out
[i
]);
141 static int snd_usb_caiaq_substream_open(struct snd_pcm_substream
*substream
)
143 struct snd_usb_caiaqdev
*dev
= snd_pcm_substream_chip(substream
);
144 debug("%s(%p)\n", __func__
, substream
);
145 substream
->runtime
->hw
= dev
->pcm_info
;
146 snd_pcm_limit_hw_rates(substream
->runtime
);
150 static int snd_usb_caiaq_substream_close(struct snd_pcm_substream
*substream
)
152 struct snd_usb_caiaqdev
*dev
= snd_pcm_substream_chip(substream
);
154 debug("%s(%p)\n", __func__
, substream
);
155 if (all_substreams_zero(dev
->sub_playback
) &&
156 all_substreams_zero(dev
->sub_capture
)) {
157 /* when the last client has stopped streaming,
158 * all sample rates are allowed again */
160 dev
->pcm_info
.rates
= dev
->samplerates
;
166 static int snd_usb_caiaq_pcm_hw_params(struct snd_pcm_substream
*sub
,
167 struct snd_pcm_hw_params
*hw_params
)
169 debug("%s(%p)\n", __func__
, sub
);
170 return snd_pcm_lib_malloc_pages(sub
, params_buffer_bytes(hw_params
));
173 static int snd_usb_caiaq_pcm_hw_free(struct snd_pcm_substream
*sub
)
175 struct snd_usb_caiaqdev
*dev
= snd_pcm_substream_chip(sub
);
176 debug("%s(%p)\n", __func__
, sub
);
177 deactivate_substream(dev
, sub
);
178 return snd_pcm_lib_free_pages(sub
);
181 /* this should probably go upstream */
182 #if SNDRV_PCM_RATE_5512 != 1 << 0 || SNDRV_PCM_RATE_192000 != 1 << 12
183 #error "Change this table"
186 static unsigned int rates
[] = { 5512, 8000, 11025, 16000, 22050, 32000, 44100,
187 48000, 64000, 88200, 96000, 176400, 192000 };
189 static int snd_usb_caiaq_pcm_prepare(struct snd_pcm_substream
*substream
)
191 int bytes_per_sample
, bpp
, ret
, i
;
192 int index
= substream
->number
;
193 struct snd_usb_caiaqdev
*dev
= snd_pcm_substream_chip(substream
);
194 struct snd_pcm_runtime
*runtime
= substream
->runtime
;
196 debug("%s(%p)\n", __func__
, substream
);
198 if (substream
->stream
== SNDRV_PCM_STREAM_PLAYBACK
) {
199 dev
->period_out_count
[index
] = BYTES_PER_SAMPLE
+ 1;
200 dev
->audio_out_buf_pos
[index
] = BYTES_PER_SAMPLE
+ 1;
202 int in_pos
= (dev
->spec
.data_alignment
== 2) ? 0 : 2;
203 dev
->period_in_count
[index
] = BYTES_PER_SAMPLE
+ in_pos
;
204 dev
->audio_in_buf_pos
[index
] = BYTES_PER_SAMPLE
+ in_pos
;
210 /* the first client that opens a stream defines the sample rate
211 * setting for all subsequent calls, until the last client closed. */
212 for (i
=0; i
< ARRAY_SIZE(rates
); i
++)
213 if (runtime
->rate
== rates
[i
])
214 dev
->pcm_info
.rates
= 1 << i
;
216 snd_pcm_limit_hw_rates(runtime
);
218 bytes_per_sample
= BYTES_PER_SAMPLE
;
219 if (dev
->spec
.data_alignment
== 2)
222 bpp
= ((runtime
->rate
/ 8000) + CLOCK_DRIFT_TOLERANCE
)
223 * bytes_per_sample
* CHANNELS_PER_STREAM
* dev
->n_streams
;
225 if (bpp
> MAX_ENDPOINT_SIZE
)
226 bpp
= MAX_ENDPOINT_SIZE
;
228 ret
= snd_usb_caiaq_set_audio_params(dev
, runtime
->rate
,
229 runtime
->sample_bits
, bpp
);
233 ret
= stream_start(dev
);
237 dev
->output_running
= 0;
238 wait_event_timeout(dev
->prepare_wait_queue
, dev
->output_running
, HZ
);
239 if (!dev
->output_running
) {
247 static int snd_usb_caiaq_pcm_trigger(struct snd_pcm_substream
*sub
, int cmd
)
249 struct snd_usb_caiaqdev
*dev
= snd_pcm_substream_chip(sub
);
252 case SNDRV_PCM_TRIGGER_START
:
253 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE
:
254 activate_substream(dev
, sub
);
256 case SNDRV_PCM_TRIGGER_STOP
:
257 case SNDRV_PCM_TRIGGER_PAUSE_PUSH
:
258 deactivate_substream(dev
, sub
);
267 static snd_pcm_uframes_t
268 snd_usb_caiaq_pcm_pointer(struct snd_pcm_substream
*sub
)
270 int index
= sub
->number
;
271 struct snd_usb_caiaqdev
*dev
= snd_pcm_substream_chip(sub
);
273 if (dev
->input_panic
|| dev
->output_panic
)
274 return SNDRV_PCM_POS_XRUN
;
276 if (sub
->stream
== SNDRV_PCM_STREAM_PLAYBACK
)
277 return bytes_to_frames(sub
->runtime
,
278 dev
->audio_out_buf_pos
[index
]);
280 return bytes_to_frames(sub
->runtime
,
281 dev
->audio_in_buf_pos
[index
]);
284 /* operators for both playback and capture */
285 static struct snd_pcm_ops snd_usb_caiaq_ops
= {
286 .open
= snd_usb_caiaq_substream_open
,
287 .close
= snd_usb_caiaq_substream_close
,
288 .ioctl
= snd_pcm_lib_ioctl
,
289 .hw_params
= snd_usb_caiaq_pcm_hw_params
,
290 .hw_free
= snd_usb_caiaq_pcm_hw_free
,
291 .prepare
= snd_usb_caiaq_pcm_prepare
,
292 .trigger
= snd_usb_caiaq_pcm_trigger
,
293 .pointer
= snd_usb_caiaq_pcm_pointer
296 static void check_for_elapsed_periods(struct snd_usb_caiaqdev
*dev
,
297 struct snd_pcm_substream
**subs
)
299 int stream
, pb
, *cnt
;
300 struct snd_pcm_substream
*sub
;
302 for (stream
= 0; stream
< dev
->n_streams
; stream
++) {
307 pb
= snd_pcm_lib_period_bytes(sub
);
308 cnt
= (sub
->stream
== SNDRV_PCM_STREAM_PLAYBACK
) ?
309 &dev
->period_out_count
[stream
] :
310 &dev
->period_in_count
[stream
];
313 snd_pcm_period_elapsed(sub
);
319 static void read_in_urb_mode0(struct snd_usb_caiaqdev
*dev
,
320 const struct urb
*urb
,
321 const struct usb_iso_packet_descriptor
*iso
)
323 unsigned char *usb_buf
= urb
->transfer_buffer
+ iso
->offset
;
324 struct snd_pcm_substream
*sub
;
327 if (all_substreams_zero(dev
->sub_capture
))
330 for (i
= 0; i
< iso
->actual_length
;) {
331 for (stream
= 0; stream
< dev
->n_streams
; stream
++, i
++) {
332 sub
= dev
->sub_capture
[stream
];
334 struct snd_pcm_runtime
*rt
= sub
->runtime
;
335 char *audio_buf
= rt
->dma_area
;
336 int sz
= frames_to_bytes(rt
, rt
->buffer_size
);
337 audio_buf
[dev
->audio_in_buf_pos
[stream
]++]
339 dev
->period_in_count
[stream
]++;
340 if (dev
->audio_in_buf_pos
[stream
] == sz
)
341 dev
->audio_in_buf_pos
[stream
] = 0;
347 static void read_in_urb_mode2(struct snd_usb_caiaqdev
*dev
,
348 const struct urb
*urb
,
349 const struct usb_iso_packet_descriptor
*iso
)
351 unsigned char *usb_buf
= urb
->transfer_buffer
+ iso
->offset
;
352 unsigned char check_byte
;
353 struct snd_pcm_substream
*sub
;
356 for (i
= 0; i
< iso
->actual_length
;) {
357 if (i
% (dev
->n_streams
* BYTES_PER_SAMPLE_USB
) == 0) {
359 stream
< dev
->n_streams
;
361 if (dev
->first_packet
)
364 check_byte
= MAKE_CHECKBYTE(dev
, stream
, i
);
366 if ((usb_buf
[i
] & 0x3f) != check_byte
)
367 dev
->input_panic
= 1;
369 if (usb_buf
[i
] & 0x80)
370 dev
->output_panic
= 1;
373 dev
->first_packet
= 0;
375 for (stream
= 0; stream
< dev
->n_streams
; stream
++, i
++) {
376 sub
= dev
->sub_capture
[stream
];
377 if (dev
->input_panic
)
381 struct snd_pcm_runtime
*rt
= sub
->runtime
;
382 char *audio_buf
= rt
->dma_area
;
383 int sz
= frames_to_bytes(rt
, rt
->buffer_size
);
384 audio_buf
[dev
->audio_in_buf_pos
[stream
]++] =
386 dev
->period_in_count
[stream
]++;
387 if (dev
->audio_in_buf_pos
[stream
] == sz
)
388 dev
->audio_in_buf_pos
[stream
] = 0;
394 static void read_in_urb(struct snd_usb_caiaqdev
*dev
,
395 const struct urb
*urb
,
396 const struct usb_iso_packet_descriptor
*iso
)
401 if (iso
->actual_length
< dev
->bpp
)
404 switch (dev
->spec
.data_alignment
) {
406 read_in_urb_mode0(dev
, urb
, iso
);
409 read_in_urb_mode2(dev
, urb
, iso
);
413 if ((dev
->input_panic
|| dev
->output_panic
) && !dev
->warned
) {
414 debug("streaming error detected %s %s\n",
415 dev
->input_panic
? "(input)" : "",
416 dev
->output_panic
? "(output)" : "");
421 static void fill_out_urb(struct snd_usb_caiaqdev
*dev
,
423 const struct usb_iso_packet_descriptor
*iso
)
425 unsigned char *usb_buf
= urb
->transfer_buffer
+ iso
->offset
;
426 struct snd_pcm_substream
*sub
;
429 for (i
= 0; i
< iso
->length
;) {
430 for (stream
= 0; stream
< dev
->n_streams
; stream
++, i
++) {
431 sub
= dev
->sub_playback
[stream
];
433 struct snd_pcm_runtime
*rt
= sub
->runtime
;
434 char *audio_buf
= rt
->dma_area
;
435 int sz
= frames_to_bytes(rt
, rt
->buffer_size
);
437 audio_buf
[dev
->audio_out_buf_pos
[stream
]];
438 dev
->period_out_count
[stream
]++;
439 dev
->audio_out_buf_pos
[stream
]++;
440 if (dev
->audio_out_buf_pos
[stream
] == sz
)
441 dev
->audio_out_buf_pos
[stream
] = 0;
446 /* fill in the check bytes */
447 if (dev
->spec
.data_alignment
== 2 &&
448 i
% (dev
->n_streams
* BYTES_PER_SAMPLE_USB
) ==
449 (dev
->n_streams
* CHANNELS_PER_STREAM
))
450 for (stream
= 0; stream
< dev
->n_streams
; stream
++, i
++)
451 usb_buf
[i
] = MAKE_CHECKBYTE(dev
, stream
, i
);
455 static void read_completed(struct urb
*urb
)
457 struct snd_usb_caiaq_cb_info
*info
= urb
->context
;
458 struct snd_usb_caiaqdev
*dev
;
460 int frame
, len
, send_it
= 0, outframe
= 0;
462 if (urb
->status
|| !info
)
470 out
= dev
->data_urbs_out
[info
->index
];
472 /* read the recently received packet and send back one which has
474 for (frame
= 0; frame
< FRAMES_PER_URB
; frame
++) {
475 if (urb
->iso_frame_desc
[frame
].status
)
478 len
= urb
->iso_frame_desc
[outframe
].actual_length
;
479 out
->iso_frame_desc
[outframe
].length
= len
;
480 out
->iso_frame_desc
[outframe
].actual_length
= 0;
481 out
->iso_frame_desc
[outframe
].offset
= BYTES_PER_FRAME
* frame
;
484 spin_lock(&dev
->spinlock
);
485 fill_out_urb(dev
, out
, &out
->iso_frame_desc
[outframe
]);
486 read_in_urb(dev
, urb
, &urb
->iso_frame_desc
[frame
]);
487 spin_unlock(&dev
->spinlock
);
488 check_for_elapsed_periods(dev
, dev
->sub_playback
);
489 check_for_elapsed_periods(dev
, dev
->sub_capture
);
497 out
->number_of_packets
= FRAMES_PER_URB
;
498 out
->transfer_flags
= URB_ISO_ASAP
;
499 usb_submit_urb(out
, GFP_ATOMIC
);
502 /* re-submit inbound urb */
503 for (frame
= 0; frame
< FRAMES_PER_URB
; frame
++) {
504 urb
->iso_frame_desc
[frame
].offset
= BYTES_PER_FRAME
* frame
;
505 urb
->iso_frame_desc
[frame
].length
= BYTES_PER_FRAME
;
506 urb
->iso_frame_desc
[frame
].actual_length
= 0;
509 urb
->number_of_packets
= FRAMES_PER_URB
;
510 urb
->transfer_flags
= URB_ISO_ASAP
;
511 usb_submit_urb(urb
, GFP_ATOMIC
);
514 static void write_completed(struct urb
*urb
)
516 struct snd_usb_caiaq_cb_info
*info
= urb
->context
;
517 struct snd_usb_caiaqdev
*dev
= info
->dev
;
519 if (!dev
->output_running
) {
520 dev
->output_running
= 1;
521 wake_up(&dev
->prepare_wait_queue
);
525 static struct urb
**alloc_urbs(struct snd_usb_caiaqdev
*dev
, int dir
, int *ret
)
529 struct usb_device
*usb_dev
= dev
->chip
.dev
;
532 pipe
= (dir
== SNDRV_PCM_STREAM_PLAYBACK
) ?
533 usb_sndisocpipe(usb_dev
, ENDPOINT_PLAYBACK
) :
534 usb_rcvisocpipe(usb_dev
, ENDPOINT_CAPTURE
);
536 urbs
= kmalloc(N_URBS
* sizeof(*urbs
), GFP_KERNEL
);
538 log("unable to kmalloc() urbs, OOM!?\n");
543 for (i
= 0; i
< N_URBS
; i
++) {
544 urbs
[i
] = usb_alloc_urb(FRAMES_PER_URB
, GFP_KERNEL
);
546 log("unable to usb_alloc_urb(), OOM!?\n");
551 urbs
[i
]->transfer_buffer
=
552 kmalloc(FRAMES_PER_URB
* BYTES_PER_FRAME
, GFP_KERNEL
);
553 if (!urbs
[i
]->transfer_buffer
) {
554 log("unable to kmalloc() transfer buffer, OOM!?\n");
559 for (frame
= 0; frame
< FRAMES_PER_URB
; frame
++) {
560 struct usb_iso_packet_descriptor
*iso
=
561 &urbs
[i
]->iso_frame_desc
[frame
];
563 iso
->offset
= BYTES_PER_FRAME
* frame
;
564 iso
->length
= BYTES_PER_FRAME
;
567 urbs
[i
]->dev
= usb_dev
;
568 urbs
[i
]->pipe
= pipe
;
569 urbs
[i
]->transfer_buffer_length
= FRAMES_PER_URB
571 urbs
[i
]->context
= &dev
->data_cb_info
[i
];
572 urbs
[i
]->interval
= 1;
573 urbs
[i
]->transfer_flags
= URB_ISO_ASAP
;
574 urbs
[i
]->number_of_packets
= FRAMES_PER_URB
;
575 urbs
[i
]->complete
= (dir
== SNDRV_PCM_STREAM_CAPTURE
) ?
576 read_completed
: write_completed
;
583 static void free_urbs(struct urb
**urbs
)
590 for (i
= 0; i
< N_URBS
; i
++) {
594 usb_kill_urb(urbs
[i
]);
595 kfree(urbs
[i
]->transfer_buffer
);
596 usb_free_urb(urbs
[i
]);
602 int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev
*dev
)
606 dev
->n_audio_in
= max(dev
->spec
.num_analog_audio_in
,
607 dev
->spec
.num_digital_audio_in
) /
609 dev
->n_audio_out
= max(dev
->spec
.num_analog_audio_out
,
610 dev
->spec
.num_digital_audio_out
) /
612 dev
->n_streams
= max(dev
->n_audio_in
, dev
->n_audio_out
);
614 debug("dev->n_audio_in = %d\n", dev
->n_audio_in
);
615 debug("dev->n_audio_out = %d\n", dev
->n_audio_out
);
616 debug("dev->n_streams = %d\n", dev
->n_streams
);
618 if (dev
->n_streams
> MAX_STREAMS
) {
619 log("unable to initialize device, too many streams.\n");
623 ret
= snd_pcm_new(dev
->chip
.card
, dev
->product_name
, 0,
624 dev
->n_audio_out
, dev
->n_audio_in
, &dev
->pcm
);
627 log("snd_pcm_new() returned %d\n", ret
);
631 dev
->pcm
->private_data
= dev
;
632 strcpy(dev
->pcm
->name
, dev
->product_name
);
634 memset(dev
->sub_playback
, 0, sizeof(dev
->sub_playback
));
635 memset(dev
->sub_capture
, 0, sizeof(dev
->sub_capture
));
637 memcpy(&dev
->pcm_info
, &snd_usb_caiaq_pcm_hardware
,
638 sizeof(snd_usb_caiaq_pcm_hardware
));
640 /* setup samplerates */
641 dev
->samplerates
= dev
->pcm_info
.rates
;
642 switch (dev
->chip
.usb_id
) {
643 case USB_ID(USB_VID_NATIVEINSTRUMENTS
, USB_PID_AK1
):
644 case USB_ID(USB_VID_NATIVEINSTRUMENTS
, USB_PID_RIGKONTROL3
):
645 case USB_ID(USB_VID_NATIVEINSTRUMENTS
, USB_PID_SESSIONIO
):
646 case USB_ID(USB_VID_NATIVEINSTRUMENTS
, USB_PID_GUITARRIGMOBILE
):
647 dev
->samplerates
|= SNDRV_PCM_RATE_192000
;
649 case USB_ID(USB_VID_NATIVEINSTRUMENTS
, USB_PID_AUDIO2DJ
):
650 case USB_ID(USB_VID_NATIVEINSTRUMENTS
, USB_PID_AUDIO4DJ
):
651 case USB_ID(USB_VID_NATIVEINSTRUMENTS
, USB_PID_AUDIO8DJ
):
652 dev
->samplerates
|= SNDRV_PCM_RATE_88200
;
656 snd_pcm_set_ops(dev
->pcm
, SNDRV_PCM_STREAM_PLAYBACK
,
658 snd_pcm_set_ops(dev
->pcm
, SNDRV_PCM_STREAM_CAPTURE
,
661 snd_pcm_lib_preallocate_pages_for_all(dev
->pcm
,
662 SNDRV_DMA_TYPE_CONTINUOUS
,
663 snd_dma_continuous_data(GFP_KERNEL
),
664 MAX_BUFFER_SIZE
, MAX_BUFFER_SIZE
);
667 kmalloc(sizeof(struct snd_usb_caiaq_cb_info
) * N_URBS
,
670 if (!dev
->data_cb_info
)
673 for (i
= 0; i
< N_URBS
; i
++) {
674 dev
->data_cb_info
[i
].dev
= dev
;
675 dev
->data_cb_info
[i
].index
= i
;
678 dev
->data_urbs_in
= alloc_urbs(dev
, SNDRV_PCM_STREAM_CAPTURE
, &ret
);
680 kfree(dev
->data_cb_info
);
681 free_urbs(dev
->data_urbs_in
);
685 dev
->data_urbs_out
= alloc_urbs(dev
, SNDRV_PCM_STREAM_PLAYBACK
, &ret
);
687 kfree(dev
->data_cb_info
);
688 free_urbs(dev
->data_urbs_in
);
689 free_urbs(dev
->data_urbs_out
);
696 void snd_usb_caiaq_audio_free(struct snd_usb_caiaqdev
*dev
)
698 debug("%s(%p)\n", __func__
, dev
);
700 free_urbs(dev
->data_urbs_in
);
701 free_urbs(dev
->data_urbs_out
);
702 kfree(dev
->data_cb_info
);