Bluetooth: Add a new PID/VID 0cf3/e005 for AR3012.
[pandora-kernel.git] / drivers / bluetooth / btusb.c
1 /*
2  *
3  *  Generic Bluetooth USB driver
4  *
5  *  Copyright (C) 2005-2008  Marcel Holtmann <marcel@holtmann.org>
6  *
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2 of the License, or
11  *  (at your option) any later version.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, write to the Free Software
20  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  *
22  */
23
24 #include <linux/kernel.h>
25 #include <linux/module.h>
26 #include <linux/init.h>
27 #include <linux/slab.h>
28 #include <linux/types.h>
29 #include <linux/sched.h>
30 #include <linux/errno.h>
31 #include <linux/skbuff.h>
32
33 #include <linux/usb.h>
34
35 #include <net/bluetooth/bluetooth.h>
36 #include <net/bluetooth/hci_core.h>
37
38 #define VERSION "0.6"
39
40 static int ignore_dga;
41 static int ignore_csr;
42 static int ignore_sniffer;
43 static int disable_scofix;
44 static int force_scofix;
45
46 static int reset = 1;
47
48 static struct usb_driver btusb_driver;
49
50 #define BTUSB_IGNORE            0x01
51 #define BTUSB_DIGIANSWER        0x02
52 #define BTUSB_CSR               0x04
53 #define BTUSB_SNIFFER           0x08
54 #define BTUSB_BCM92035          0x10
55 #define BTUSB_BROKEN_ISOC       0x20
56 #define BTUSB_WRONG_SCO_MTU     0x40
57 #define BTUSB_ATH3012           0x80
58
59 static struct usb_device_id btusb_table[] = {
60         /* Generic Bluetooth USB device */
61         { USB_DEVICE_INFO(0xe0, 0x01, 0x01) },
62
63         /* Apple-specific (Broadcom) devices */
64         { USB_VENDOR_AND_INTERFACE_INFO(0x05ac, 0xff, 0x01, 0x01) },
65
66         /* MediaTek MT76x0E */
67         { USB_DEVICE(0x0e8d, 0x763f) },
68
69         /* Broadcom SoftSailing reporting vendor specific */
70         { USB_DEVICE(0x0a5c, 0x21e1) },
71
72         /* Apple MacBookPro 7,1 */
73         { USB_DEVICE(0x05ac, 0x8213) },
74
75         /* Apple iMac11,1 */
76         { USB_DEVICE(0x05ac, 0x8215) },
77
78         /* Apple MacBookPro6,2 */
79         { USB_DEVICE(0x05ac, 0x8218) },
80
81         /* Apple MacBookAir3,1, MacBookAir3,2 */
82         { USB_DEVICE(0x05ac, 0x821b) },
83
84         /* Apple MacBookAir4,1 */
85         { USB_DEVICE(0x05ac, 0x821f) },
86
87         /* Apple MacBookPro8,2 */
88         { USB_DEVICE(0x05ac, 0x821a) },
89
90         /* Apple MacMini5,1 */
91         { USB_DEVICE(0x05ac, 0x8281) },
92
93         /* AVM BlueFRITZ! USB v2.0 */
94         { USB_DEVICE(0x057c, 0x3800) },
95
96         /* Bluetooth Ultraport Module from IBM */
97         { USB_DEVICE(0x04bf, 0x030a) },
98
99         /* ALPS Modules with non-standard id */
100         { USB_DEVICE(0x044e, 0x3001) },
101         { USB_DEVICE(0x044e, 0x3002) },
102
103         /* Ericsson with non-standard id */
104         { USB_DEVICE(0x0bdb, 0x1002) },
105
106         /* Canyon CN-BTU1 with HID interfaces */
107         { USB_DEVICE(0x0c10, 0x0000) },
108
109         /* Broadcom BCM20702A0 */
110         { USB_DEVICE(0x0b05, 0x17b5) },
111         { USB_DEVICE(0x04ca, 0x2003) },
112         { USB_DEVICE(0x0489, 0xe042) },
113         { USB_DEVICE(0x413c, 0x8197) },
114
115         /* Foxconn - Hon Hai */
116         { USB_VENDOR_AND_INTERFACE_INFO(0x0489, 0xff, 0x01, 0x01) },
117
118         /*Broadcom devices with vendor specific id */
119         { USB_VENDOR_AND_INTERFACE_INFO(0x0a5c, 0xff, 0x01, 0x01) },
120
121         { }     /* Terminating entry */
122 };
123
124 MODULE_DEVICE_TABLE(usb, btusb_table);
125
126 static struct usb_device_id blacklist_table[] = {
127         /* CSR BlueCore devices */
128         { USB_DEVICE(0x0a12, 0x0001), .driver_info = BTUSB_CSR },
129
130         /* Broadcom BCM2033 without firmware */
131         { USB_DEVICE(0x0a5c, 0x2033), .driver_info = BTUSB_IGNORE },
132
133         /* Atheros 3011 with sflash firmware */
134         { USB_DEVICE(0x0cf3, 0x3002), .driver_info = BTUSB_IGNORE },
135         { USB_DEVICE(0x0cf3, 0xe019), .driver_info = BTUSB_IGNORE },
136         { USB_DEVICE(0x13d3, 0x3304), .driver_info = BTUSB_IGNORE },
137         { USB_DEVICE(0x0930, 0x0215), .driver_info = BTUSB_IGNORE },
138         { USB_DEVICE(0x0489, 0xe03d), .driver_info = BTUSB_IGNORE },
139         { USB_DEVICE(0x0489, 0xe027), .driver_info = BTUSB_IGNORE },
140
141         /* Atheros AR9285 Malbec with sflash firmware */
142         { USB_DEVICE(0x03f0, 0x311d), .driver_info = BTUSB_IGNORE },
143
144         /* Atheros 3012 with sflash firmware */
145         { USB_DEVICE(0x0cf3, 0x0036), .driver_info = BTUSB_ATH3012 },
146         { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 },
147         { USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 },
148         { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 },
149         { USB_DEVICE(0x0cf3, 0x817a), .driver_info = BTUSB_ATH3012 },
150         { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 },
151         { USB_DEVICE(0x04ca, 0x3004), .driver_info = BTUSB_ATH3012 },
152         { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 },
153         { USB_DEVICE(0x04ca, 0x3006), .driver_info = BTUSB_ATH3012 },
154         { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 },
155         { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 },
156         { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 },
157         { USB_DEVICE(0x0cf3, 0xe005), .driver_info = BTUSB_ATH3012 },
158         { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 },
159         { USB_DEVICE(0x0489, 0xe057), .driver_info = BTUSB_ATH3012 },
160         { USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 },
161         { USB_DEVICE(0x0489, 0xe04e), .driver_info = BTUSB_ATH3012 },
162         { USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 },
163         { USB_DEVICE(0x0489, 0xe04d), .driver_info = BTUSB_ATH3012 },
164         { USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 },
165         { USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 },
166         { USB_DEVICE(0x0cf3, 0x3121), .driver_info = BTUSB_ATH3012 },
167         { USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 },
168
169         /* Atheros AR5BBU12 with sflash firmware */
170         { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE },
171
172         /* Atheros AR5BBU12 with sflash firmware */
173         { USB_DEVICE(0x0489, 0xe03c), .driver_info = BTUSB_ATH3012 },
174         { USB_DEVICE(0x0489, 0xe036), .driver_info = BTUSB_ATH3012 },
175
176         /* Broadcom BCM2035 */
177         { USB_DEVICE(0x0a5c, 0x2035), .driver_info = BTUSB_WRONG_SCO_MTU },
178         { USB_DEVICE(0x0a5c, 0x200a), .driver_info = BTUSB_WRONG_SCO_MTU },
179         { USB_DEVICE(0x0a5c, 0x2009), .driver_info = BTUSB_BCM92035 },
180
181         /* Broadcom BCM2045 */
182         { USB_DEVICE(0x0a5c, 0x2039), .driver_info = BTUSB_WRONG_SCO_MTU },
183         { USB_DEVICE(0x0a5c, 0x2101), .driver_info = BTUSB_WRONG_SCO_MTU },
184
185         /* IBM/Lenovo ThinkPad with Broadcom chip */
186         { USB_DEVICE(0x0a5c, 0x201e), .driver_info = BTUSB_WRONG_SCO_MTU },
187         { USB_DEVICE(0x0a5c, 0x2110), .driver_info = BTUSB_WRONG_SCO_MTU },
188
189         /* HP laptop with Broadcom chip */
190         { USB_DEVICE(0x03f0, 0x171d), .driver_info = BTUSB_WRONG_SCO_MTU },
191
192         /* Dell laptop with Broadcom chip */
193         { USB_DEVICE(0x413c, 0x8126), .driver_info = BTUSB_WRONG_SCO_MTU },
194
195         /* Dell Wireless 370 and 410 devices */
196         { USB_DEVICE(0x413c, 0x8152), .driver_info = BTUSB_WRONG_SCO_MTU },
197         { USB_DEVICE(0x413c, 0x8156), .driver_info = BTUSB_WRONG_SCO_MTU },
198
199         /* Belkin F8T012 and F8T013 devices */
200         { USB_DEVICE(0x050d, 0x0012), .driver_info = BTUSB_WRONG_SCO_MTU },
201         { USB_DEVICE(0x050d, 0x0013), .driver_info = BTUSB_WRONG_SCO_MTU },
202
203         /* Asus WL-BTD202 device */
204         { USB_DEVICE(0x0b05, 0x1715), .driver_info = BTUSB_WRONG_SCO_MTU },
205
206         /* Kensington Bluetooth USB adapter */
207         { USB_DEVICE(0x047d, 0x105e), .driver_info = BTUSB_WRONG_SCO_MTU },
208
209         /* RTX Telecom based adapters with buggy SCO support */
210         { USB_DEVICE(0x0400, 0x0807), .driver_info = BTUSB_BROKEN_ISOC },
211         { USB_DEVICE(0x0400, 0x080a), .driver_info = BTUSB_BROKEN_ISOC },
212
213         /* CONWISE Technology based adapters with buggy SCO support */
214         { USB_DEVICE(0x0e5e, 0x6622), .driver_info = BTUSB_BROKEN_ISOC },
215
216         /* Digianswer devices */
217         { USB_DEVICE(0x08fd, 0x0001), .driver_info = BTUSB_DIGIANSWER },
218         { USB_DEVICE(0x08fd, 0x0002), .driver_info = BTUSB_IGNORE },
219
220         /* CSR BlueCore Bluetooth Sniffer */
221         { USB_DEVICE(0x0a12, 0x0002), .driver_info = BTUSB_SNIFFER },
222
223         /* Frontline ComProbe Bluetooth Sniffer */
224         { USB_DEVICE(0x16d3, 0x0002), .driver_info = BTUSB_SNIFFER },
225
226         { }     /* Terminating entry */
227 };
228
229 #define BTUSB_MAX_ISOC_FRAMES   10
230
231 #define BTUSB_INTR_RUNNING      0
232 #define BTUSB_BULK_RUNNING      1
233 #define BTUSB_ISOC_RUNNING      2
234 #define BTUSB_SUSPENDING        3
235 #define BTUSB_DID_ISO_RESUME    4
236
237 struct btusb_data {
238         struct hci_dev       *hdev;
239         struct usb_device    *udev;
240         struct usb_interface *intf;
241         struct usb_interface *isoc;
242
243         spinlock_t lock;
244
245         unsigned long flags;
246
247         struct work_struct work;
248         struct work_struct waker;
249
250         struct usb_anchor tx_anchor;
251         struct usb_anchor intr_anchor;
252         struct usb_anchor bulk_anchor;
253         struct usb_anchor isoc_anchor;
254         struct usb_anchor deferred;
255         int tx_in_flight;
256         spinlock_t txlock;
257
258         struct usb_endpoint_descriptor *intr_ep;
259         struct usb_endpoint_descriptor *bulk_tx_ep;
260         struct usb_endpoint_descriptor *bulk_rx_ep;
261         struct usb_endpoint_descriptor *isoc_tx_ep;
262         struct usb_endpoint_descriptor *isoc_rx_ep;
263
264         __u8 cmdreq_type;
265
266         unsigned int sco_num;
267         int isoc_altsetting;
268         int suspend_count;
269 };
270
271 static int inc_tx(struct btusb_data *data)
272 {
273         unsigned long flags;
274         int rv;
275
276         spin_lock_irqsave(&data->txlock, flags);
277         rv = test_bit(BTUSB_SUSPENDING, &data->flags);
278         if (!rv)
279                 data->tx_in_flight++;
280         spin_unlock_irqrestore(&data->txlock, flags);
281
282         return rv;
283 }
284
285 static void btusb_intr_complete(struct urb *urb)
286 {
287         struct hci_dev *hdev = urb->context;
288         struct btusb_data *data = hdev->driver_data;
289         int err;
290
291         BT_DBG("%s urb %p status %d count %d", hdev->name,
292                                         urb, urb->status, urb->actual_length);
293
294         if (!test_bit(HCI_RUNNING, &hdev->flags))
295                 return;
296
297         if (urb->status == 0) {
298                 hdev->stat.byte_rx += urb->actual_length;
299
300                 if (hci_recv_fragment(hdev, HCI_EVENT_PKT,
301                                                 urb->transfer_buffer,
302                                                 urb->actual_length) < 0) {
303                         BT_ERR("%s corrupted event packet", hdev->name);
304                         hdev->stat.err_rx++;
305                 }
306         }
307
308         if (!test_bit(BTUSB_INTR_RUNNING, &data->flags))
309                 return;
310
311         usb_mark_last_busy(data->udev);
312         usb_anchor_urb(urb, &data->intr_anchor);
313
314         err = usb_submit_urb(urb, GFP_ATOMIC);
315         if (err < 0) {
316                 /* -EPERM: urb is being killed;
317                  * -ENODEV: device got disconnected */
318                 if (err != -EPERM && err != -ENODEV)
319                         BT_ERR("%s urb %p failed to resubmit (%d)",
320                                                 hdev->name, urb, -err);
321                 usb_unanchor_urb(urb);
322         }
323 }
324
325 static int btusb_submit_intr_urb(struct hci_dev *hdev, gfp_t mem_flags)
326 {
327         struct btusb_data *data = hdev->driver_data;
328         struct urb *urb;
329         unsigned char *buf;
330         unsigned int pipe;
331         int err, size;
332
333         BT_DBG("%s", hdev->name);
334
335         if (!data->intr_ep)
336                 return -ENODEV;
337
338         urb = usb_alloc_urb(0, mem_flags);
339         if (!urb)
340                 return -ENOMEM;
341
342         size = le16_to_cpu(data->intr_ep->wMaxPacketSize);
343
344         buf = kmalloc(size, mem_flags);
345         if (!buf) {
346                 usb_free_urb(urb);
347                 return -ENOMEM;
348         }
349
350         pipe = usb_rcvintpipe(data->udev, data->intr_ep->bEndpointAddress);
351
352         usb_fill_int_urb(urb, data->udev, pipe, buf, size,
353                                                 btusb_intr_complete, hdev,
354                                                 data->intr_ep->bInterval);
355
356         urb->transfer_flags |= URB_FREE_BUFFER;
357
358         usb_anchor_urb(urb, &data->intr_anchor);
359
360         err = usb_submit_urb(urb, mem_flags);
361         if (err < 0) {
362                 BT_ERR("%s urb %p submission failed (%d)",
363                                                 hdev->name, urb, -err);
364                 usb_unanchor_urb(urb);
365         }
366
367         usb_free_urb(urb);
368
369         return err;
370 }
371
372 static void btusb_bulk_complete(struct urb *urb)
373 {
374         struct hci_dev *hdev = urb->context;
375         struct btusb_data *data = hdev->driver_data;
376         int err;
377
378         BT_DBG("%s urb %p status %d count %d", hdev->name,
379                                         urb, urb->status, urb->actual_length);
380
381         if (!test_bit(HCI_RUNNING, &hdev->flags))
382                 return;
383
384         if (urb->status == 0) {
385                 hdev->stat.byte_rx += urb->actual_length;
386
387                 if (hci_recv_fragment(hdev, HCI_ACLDATA_PKT,
388                                                 urb->transfer_buffer,
389                                                 urb->actual_length) < 0) {
390                         BT_ERR("%s corrupted ACL packet", hdev->name);
391                         hdev->stat.err_rx++;
392                 }
393         }
394
395         if (!test_bit(BTUSB_BULK_RUNNING, &data->flags))
396                 return;
397
398         usb_anchor_urb(urb, &data->bulk_anchor);
399         usb_mark_last_busy(data->udev);
400
401         err = usb_submit_urb(urb, GFP_ATOMIC);
402         if (err < 0) {
403                 /* -EPERM: urb is being killed;
404                  * -ENODEV: device got disconnected */
405                 if (err != -EPERM && err != -ENODEV)
406                         BT_ERR("%s urb %p failed to resubmit (%d)",
407                                                 hdev->name, urb, -err);
408                 usb_unanchor_urb(urb);
409         }
410 }
411
412 static int btusb_submit_bulk_urb(struct hci_dev *hdev, gfp_t mem_flags)
413 {
414         struct btusb_data *data = hdev->driver_data;
415         struct urb *urb;
416         unsigned char *buf;
417         unsigned int pipe;
418         int err, size = HCI_MAX_FRAME_SIZE;
419
420         BT_DBG("%s", hdev->name);
421
422         if (!data->bulk_rx_ep)
423                 return -ENODEV;
424
425         urb = usb_alloc_urb(0, mem_flags);
426         if (!urb)
427                 return -ENOMEM;
428
429         buf = kmalloc(size, mem_flags);
430         if (!buf) {
431                 usb_free_urb(urb);
432                 return -ENOMEM;
433         }
434
435         pipe = usb_rcvbulkpipe(data->udev, data->bulk_rx_ep->bEndpointAddress);
436
437         usb_fill_bulk_urb(urb, data->udev, pipe,
438                                         buf, size, btusb_bulk_complete, hdev);
439
440         urb->transfer_flags |= URB_FREE_BUFFER;
441
442         usb_mark_last_busy(data->udev);
443         usb_anchor_urb(urb, &data->bulk_anchor);
444
445         err = usb_submit_urb(urb, mem_flags);
446         if (err < 0) {
447                 BT_ERR("%s urb %p submission failed (%d)",
448                                                 hdev->name, urb, -err);
449                 usb_unanchor_urb(urb);
450         }
451
452         usb_free_urb(urb);
453
454         return err;
455 }
456
457 static void btusb_isoc_complete(struct urb *urb)
458 {
459         struct hci_dev *hdev = urb->context;
460         struct btusb_data *data = hdev->driver_data;
461         int i, err;
462
463         BT_DBG("%s urb %p status %d count %d", hdev->name,
464                                         urb, urb->status, urb->actual_length);
465
466         if (!test_bit(HCI_RUNNING, &hdev->flags))
467                 return;
468
469         if (urb->status == 0) {
470                 for (i = 0; i < urb->number_of_packets; i++) {
471                         unsigned int offset = urb->iso_frame_desc[i].offset;
472                         unsigned int length = urb->iso_frame_desc[i].actual_length;
473
474                         if (urb->iso_frame_desc[i].status)
475                                 continue;
476
477                         hdev->stat.byte_rx += length;
478
479                         if (hci_recv_fragment(hdev, HCI_SCODATA_PKT,
480                                                 urb->transfer_buffer + offset,
481                                                                 length) < 0) {
482                                 BT_ERR("%s corrupted SCO packet", hdev->name);
483                                 hdev->stat.err_rx++;
484                         }
485                 }
486         }
487
488         if (!test_bit(BTUSB_ISOC_RUNNING, &data->flags))
489                 return;
490
491         usb_anchor_urb(urb, &data->isoc_anchor);
492
493         err = usb_submit_urb(urb, GFP_ATOMIC);
494         if (err < 0) {
495                 /* -EPERM: urb is being killed;
496                  * -ENODEV: device got disconnected */
497                 if (err != -EPERM && err != -ENODEV)
498                         BT_ERR("%s urb %p failed to resubmit (%d)",
499                                                 hdev->name, urb, -err);
500                 usb_unanchor_urb(urb);
501         }
502 }
503
504 static inline void __fill_isoc_descriptor(struct urb *urb, int len, int mtu)
505 {
506         int i, offset = 0;
507
508         BT_DBG("len %d mtu %d", len, mtu);
509
510         for (i = 0; i < BTUSB_MAX_ISOC_FRAMES && len >= mtu;
511                                         i++, offset += mtu, len -= mtu) {
512                 urb->iso_frame_desc[i].offset = offset;
513                 urb->iso_frame_desc[i].length = mtu;
514         }
515
516         if (len && i < BTUSB_MAX_ISOC_FRAMES) {
517                 urb->iso_frame_desc[i].offset = offset;
518                 urb->iso_frame_desc[i].length = len;
519                 i++;
520         }
521
522         urb->number_of_packets = i;
523 }
524
525 static int btusb_submit_isoc_urb(struct hci_dev *hdev, gfp_t mem_flags)
526 {
527         struct btusb_data *data = hdev->driver_data;
528         struct urb *urb;
529         unsigned char *buf;
530         unsigned int pipe;
531         int err, size;
532
533         BT_DBG("%s", hdev->name);
534
535         if (!data->isoc_rx_ep)
536                 return -ENODEV;
537
538         urb = usb_alloc_urb(BTUSB_MAX_ISOC_FRAMES, mem_flags);
539         if (!urb)
540                 return -ENOMEM;
541
542         size = le16_to_cpu(data->isoc_rx_ep->wMaxPacketSize) *
543                                                 BTUSB_MAX_ISOC_FRAMES;
544
545         buf = kmalloc(size, mem_flags);
546         if (!buf) {
547                 usb_free_urb(urb);
548                 return -ENOMEM;
549         }
550
551         pipe = usb_rcvisocpipe(data->udev, data->isoc_rx_ep->bEndpointAddress);
552
553         usb_fill_int_urb(urb, data->udev, pipe, buf, size, btusb_isoc_complete,
554                                 hdev, data->isoc_rx_ep->bInterval);
555
556         urb->transfer_flags  = URB_FREE_BUFFER | URB_ISO_ASAP;
557
558         __fill_isoc_descriptor(urb, size,
559                         le16_to_cpu(data->isoc_rx_ep->wMaxPacketSize));
560
561         usb_anchor_urb(urb, &data->isoc_anchor);
562
563         err = usb_submit_urb(urb, mem_flags);
564         if (err < 0) {
565                 BT_ERR("%s urb %p submission failed (%d)",
566                                                 hdev->name, urb, -err);
567                 usb_unanchor_urb(urb);
568         }
569
570         usb_free_urb(urb);
571
572         return err;
573 }
574
575 static void btusb_tx_complete(struct urb *urb)
576 {
577         struct sk_buff *skb = urb->context;
578         struct hci_dev *hdev = (struct hci_dev *) skb->dev;
579         struct btusb_data *data = hdev->driver_data;
580
581         BT_DBG("%s urb %p status %d count %d", hdev->name,
582                                         urb, urb->status, urb->actual_length);
583
584         if (!test_bit(HCI_RUNNING, &hdev->flags))
585                 goto done;
586
587         if (!urb->status)
588                 hdev->stat.byte_tx += urb->transfer_buffer_length;
589         else
590                 hdev->stat.err_tx++;
591
592 done:
593         spin_lock(&data->txlock);
594         data->tx_in_flight--;
595         spin_unlock(&data->txlock);
596
597         kfree(urb->setup_packet);
598
599         kfree_skb(skb);
600 }
601
602 static void btusb_isoc_tx_complete(struct urb *urb)
603 {
604         struct sk_buff *skb = urb->context;
605         struct hci_dev *hdev = (struct hci_dev *) skb->dev;
606
607         BT_DBG("%s urb %p status %d count %d", hdev->name,
608                                         urb, urb->status, urb->actual_length);
609
610         if (!test_bit(HCI_RUNNING, &hdev->flags))
611                 goto done;
612
613         if (!urb->status)
614                 hdev->stat.byte_tx += urb->transfer_buffer_length;
615         else
616                 hdev->stat.err_tx++;
617
618 done:
619         kfree(urb->setup_packet);
620
621         kfree_skb(skb);
622 }
623
624 static int btusb_open(struct hci_dev *hdev)
625 {
626         struct btusb_data *data = hdev->driver_data;
627         int err;
628
629         BT_DBG("%s", hdev->name);
630
631         err = usb_autopm_get_interface(data->intf);
632         if (err < 0)
633                 return err;
634
635         data->intf->needs_remote_wakeup = 1;
636
637         if (test_and_set_bit(HCI_RUNNING, &hdev->flags))
638                 goto done;
639
640         if (test_and_set_bit(BTUSB_INTR_RUNNING, &data->flags))
641                 goto done;
642
643         err = btusb_submit_intr_urb(hdev, GFP_KERNEL);
644         if (err < 0)
645                 goto failed;
646
647         err = btusb_submit_bulk_urb(hdev, GFP_KERNEL);
648         if (err < 0) {
649                 usb_kill_anchored_urbs(&data->intr_anchor);
650                 goto failed;
651         }
652
653         set_bit(BTUSB_BULK_RUNNING, &data->flags);
654         btusb_submit_bulk_urb(hdev, GFP_KERNEL);
655
656 done:
657         usb_autopm_put_interface(data->intf);
658         return 0;
659
660 failed:
661         clear_bit(BTUSB_INTR_RUNNING, &data->flags);
662         clear_bit(HCI_RUNNING, &hdev->flags);
663         usb_autopm_put_interface(data->intf);
664         return err;
665 }
666
667 static void btusb_stop_traffic(struct btusb_data *data)
668 {
669         usb_kill_anchored_urbs(&data->intr_anchor);
670         usb_kill_anchored_urbs(&data->bulk_anchor);
671         usb_kill_anchored_urbs(&data->isoc_anchor);
672 }
673
674 static int btusb_close(struct hci_dev *hdev)
675 {
676         struct btusb_data *data = hdev->driver_data;
677         int err;
678
679         BT_DBG("%s", hdev->name);
680
681         if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags))
682                 return 0;
683
684         cancel_work_sync(&data->work);
685         cancel_work_sync(&data->waker);
686
687         clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
688         clear_bit(BTUSB_BULK_RUNNING, &data->flags);
689         clear_bit(BTUSB_INTR_RUNNING, &data->flags);
690
691         btusb_stop_traffic(data);
692         err = usb_autopm_get_interface(data->intf);
693         if (err < 0)
694                 goto failed;
695
696         data->intf->needs_remote_wakeup = 0;
697         usb_autopm_put_interface(data->intf);
698
699 failed:
700         usb_scuttle_anchored_urbs(&data->deferred);
701         return 0;
702 }
703
704 static int btusb_flush(struct hci_dev *hdev)
705 {
706         struct btusb_data *data = hdev->driver_data;
707
708         BT_DBG("%s", hdev->name);
709
710         usb_kill_anchored_urbs(&data->tx_anchor);
711
712         return 0;
713 }
714
715 static int btusb_send_frame(struct sk_buff *skb)
716 {
717         struct hci_dev *hdev = (struct hci_dev *) skb->dev;
718         struct btusb_data *data = hdev->driver_data;
719         struct usb_ctrlrequest *dr;
720         struct urb *urb;
721         unsigned int pipe;
722         int err;
723
724         BT_DBG("%s", hdev->name);
725
726         if (!test_bit(HCI_RUNNING, &hdev->flags))
727                 return -EBUSY;
728
729         switch (bt_cb(skb)->pkt_type) {
730         case HCI_COMMAND_PKT:
731                 urb = usb_alloc_urb(0, GFP_ATOMIC);
732                 if (!urb)
733                         return -ENOMEM;
734
735                 dr = kmalloc(sizeof(*dr), GFP_ATOMIC);
736                 if (!dr) {
737                         usb_free_urb(urb);
738                         return -ENOMEM;
739                 }
740
741                 dr->bRequestType = data->cmdreq_type;
742                 dr->bRequest     = 0;
743                 dr->wIndex       = 0;
744                 dr->wValue       = 0;
745                 dr->wLength      = __cpu_to_le16(skb->len);
746
747                 pipe = usb_sndctrlpipe(data->udev, 0x00);
748
749                 usb_fill_control_urb(urb, data->udev, pipe, (void *) dr,
750                                 skb->data, skb->len, btusb_tx_complete, skb);
751
752                 hdev->stat.cmd_tx++;
753                 break;
754
755         case HCI_ACLDATA_PKT:
756                 if (!data->bulk_tx_ep)
757                         return -ENODEV;
758
759                 urb = usb_alloc_urb(0, GFP_ATOMIC);
760                 if (!urb)
761                         return -ENOMEM;
762
763                 pipe = usb_sndbulkpipe(data->udev,
764                                         data->bulk_tx_ep->bEndpointAddress);
765
766                 usb_fill_bulk_urb(urb, data->udev, pipe,
767                                 skb->data, skb->len, btusb_tx_complete, skb);
768
769                 hdev->stat.acl_tx++;
770                 break;
771
772         case HCI_SCODATA_PKT:
773                 if (!data->isoc_tx_ep || hdev->conn_hash.sco_num < 1)
774                         return -ENODEV;
775
776                 urb = usb_alloc_urb(BTUSB_MAX_ISOC_FRAMES, GFP_ATOMIC);
777                 if (!urb)
778                         return -ENOMEM;
779
780                 pipe = usb_sndisocpipe(data->udev,
781                                         data->isoc_tx_ep->bEndpointAddress);
782
783                 usb_fill_int_urb(urb, data->udev, pipe,
784                                 skb->data, skb->len, btusb_isoc_tx_complete,
785                                 skb, data->isoc_tx_ep->bInterval);
786
787                 urb->transfer_flags  = URB_ISO_ASAP;
788
789                 __fill_isoc_descriptor(urb, skb->len,
790                                 le16_to_cpu(data->isoc_tx_ep->wMaxPacketSize));
791
792                 hdev->stat.sco_tx++;
793                 goto skip_waking;
794
795         default:
796                 return -EILSEQ;
797         }
798
799         err = inc_tx(data);
800         if (err) {
801                 usb_anchor_urb(urb, &data->deferred);
802                 schedule_work(&data->waker);
803                 err = 0;
804                 goto done;
805         }
806
807 skip_waking:
808         usb_anchor_urb(urb, &data->tx_anchor);
809
810         err = usb_submit_urb(urb, GFP_ATOMIC);
811         if (err < 0) {
812                 BT_ERR("%s urb %p submission failed", hdev->name, urb);
813                 kfree(urb->setup_packet);
814                 usb_unanchor_urb(urb);
815         } else {
816                 usb_mark_last_busy(data->udev);
817         }
818
819 done:
820         usb_free_urb(urb);
821         return err;
822 }
823
824 static void btusb_destruct(struct hci_dev *hdev)
825 {
826         struct btusb_data *data = hdev->driver_data;
827
828         BT_DBG("%s", hdev->name);
829
830         kfree(data);
831 }
832
833 static void btusb_notify(struct hci_dev *hdev, unsigned int evt)
834 {
835         struct btusb_data *data = hdev->driver_data;
836
837         BT_DBG("%s evt %d", hdev->name, evt);
838
839         if (hdev->conn_hash.sco_num != data->sco_num) {
840                 data->sco_num = hdev->conn_hash.sco_num;
841                 schedule_work(&data->work);
842         }
843 }
844
845 static inline int __set_isoc_interface(struct hci_dev *hdev, int altsetting)
846 {
847         struct btusb_data *data = hdev->driver_data;
848         struct usb_interface *intf = data->isoc;
849         struct usb_endpoint_descriptor *ep_desc;
850         int i, err;
851
852         if (!data->isoc)
853                 return -ENODEV;
854
855         err = usb_set_interface(data->udev, 1, altsetting);
856         if (err < 0) {
857                 BT_ERR("%s setting interface failed (%d)", hdev->name, -err);
858                 return err;
859         }
860
861         data->isoc_altsetting = altsetting;
862
863         data->isoc_tx_ep = NULL;
864         data->isoc_rx_ep = NULL;
865
866         for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++) {
867                 ep_desc = &intf->cur_altsetting->endpoint[i].desc;
868
869                 if (!data->isoc_tx_ep && usb_endpoint_is_isoc_out(ep_desc)) {
870                         data->isoc_tx_ep = ep_desc;
871                         continue;
872                 }
873
874                 if (!data->isoc_rx_ep && usb_endpoint_is_isoc_in(ep_desc)) {
875                         data->isoc_rx_ep = ep_desc;
876                         continue;
877                 }
878         }
879
880         if (!data->isoc_tx_ep || !data->isoc_rx_ep) {
881                 BT_ERR("%s invalid SCO descriptors", hdev->name);
882                 return -ENODEV;
883         }
884
885         return 0;
886 }
887
888 static void btusb_work(struct work_struct *work)
889 {
890         struct btusb_data *data = container_of(work, struct btusb_data, work);
891         struct hci_dev *hdev = data->hdev;
892         int err;
893
894         if (hdev->conn_hash.sco_num > 0) {
895                 if (!test_bit(BTUSB_DID_ISO_RESUME, &data->flags)) {
896                         err = usb_autopm_get_interface(data->isoc ? data->isoc : data->intf);
897                         if (err < 0) {
898                                 clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
899                                 usb_kill_anchored_urbs(&data->isoc_anchor);
900                                 return;
901                         }
902
903                         set_bit(BTUSB_DID_ISO_RESUME, &data->flags);
904                 }
905                 if (data->isoc_altsetting != 2) {
906                         clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
907                         usb_kill_anchored_urbs(&data->isoc_anchor);
908
909                         if (__set_isoc_interface(hdev, 2) < 0)
910                                 return;
911                 }
912
913                 if (!test_and_set_bit(BTUSB_ISOC_RUNNING, &data->flags)) {
914                         if (btusb_submit_isoc_urb(hdev, GFP_KERNEL) < 0)
915                                 clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
916                         else
917                                 btusb_submit_isoc_urb(hdev, GFP_KERNEL);
918                 }
919         } else {
920                 clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
921                 usb_kill_anchored_urbs(&data->isoc_anchor);
922
923                 __set_isoc_interface(hdev, 0);
924                 if (test_and_clear_bit(BTUSB_DID_ISO_RESUME, &data->flags))
925                         usb_autopm_put_interface(data->isoc ? data->isoc : data->intf);
926         }
927 }
928
929 static void btusb_waker(struct work_struct *work)
930 {
931         struct btusb_data *data = container_of(work, struct btusb_data, waker);
932         int err;
933
934         err = usb_autopm_get_interface(data->intf);
935         if (err < 0)
936                 return;
937
938         usb_autopm_put_interface(data->intf);
939 }
940
941 static int btusb_probe(struct usb_interface *intf,
942                                 const struct usb_device_id *id)
943 {
944         struct usb_endpoint_descriptor *ep_desc;
945         struct btusb_data *data;
946         struct hci_dev *hdev;
947         int i, err;
948
949         BT_DBG("intf %p id %p", intf, id);
950
951         /* interface numbers are hardcoded in the spec */
952         if (intf->cur_altsetting->desc.bInterfaceNumber != 0)
953                 return -ENODEV;
954
955         if (!id->driver_info) {
956                 const struct usb_device_id *match;
957                 match = usb_match_id(intf, blacklist_table);
958                 if (match)
959                         id = match;
960         }
961
962         if (id->driver_info == BTUSB_IGNORE)
963                 return -ENODEV;
964
965         if (ignore_dga && id->driver_info & BTUSB_DIGIANSWER)
966                 return -ENODEV;
967
968         if (ignore_csr && id->driver_info & BTUSB_CSR)
969                 return -ENODEV;
970
971         if (ignore_sniffer && id->driver_info & BTUSB_SNIFFER)
972                 return -ENODEV;
973
974         if (id->driver_info & BTUSB_ATH3012) {
975                 struct usb_device *udev = interface_to_usbdev(intf);
976
977                 /* Old firmware would otherwise let ath3k driver load
978                  * patch and sysconfig files */
979                 if (le16_to_cpu(udev->descriptor.bcdDevice) <= 0x0001)
980                         return -ENODEV;
981         }
982
983         data = kzalloc(sizeof(*data), GFP_KERNEL);
984         if (!data)
985                 return -ENOMEM;
986
987         for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++) {
988                 ep_desc = &intf->cur_altsetting->endpoint[i].desc;
989
990                 if (!data->intr_ep && usb_endpoint_is_int_in(ep_desc)) {
991                         data->intr_ep = ep_desc;
992                         continue;
993                 }
994
995                 if (!data->bulk_tx_ep && usb_endpoint_is_bulk_out(ep_desc)) {
996                         data->bulk_tx_ep = ep_desc;
997                         continue;
998                 }
999
1000                 if (!data->bulk_rx_ep && usb_endpoint_is_bulk_in(ep_desc)) {
1001                         data->bulk_rx_ep = ep_desc;
1002                         continue;
1003                 }
1004         }
1005
1006         if (!data->intr_ep || !data->bulk_tx_ep || !data->bulk_rx_ep) {
1007                 kfree(data);
1008                 return -ENODEV;
1009         }
1010
1011         data->cmdreq_type = USB_TYPE_CLASS;
1012
1013         data->udev = interface_to_usbdev(intf);
1014         data->intf = intf;
1015
1016         spin_lock_init(&data->lock);
1017
1018         INIT_WORK(&data->work, btusb_work);
1019         INIT_WORK(&data->waker, btusb_waker);
1020         spin_lock_init(&data->txlock);
1021
1022         init_usb_anchor(&data->tx_anchor);
1023         init_usb_anchor(&data->intr_anchor);
1024         init_usb_anchor(&data->bulk_anchor);
1025         init_usb_anchor(&data->isoc_anchor);
1026         init_usb_anchor(&data->deferred);
1027
1028         hdev = hci_alloc_dev();
1029         if (!hdev) {
1030                 kfree(data);
1031                 return -ENOMEM;
1032         }
1033
1034         hdev->bus = HCI_USB;
1035         hdev->driver_data = data;
1036
1037         data->hdev = hdev;
1038
1039         SET_HCIDEV_DEV(hdev, &intf->dev);
1040
1041         hdev->open     = btusb_open;
1042         hdev->close    = btusb_close;
1043         hdev->flush    = btusb_flush;
1044         hdev->send     = btusb_send_frame;
1045         hdev->destruct = btusb_destruct;
1046         hdev->notify   = btusb_notify;
1047
1048         hdev->owner = THIS_MODULE;
1049
1050         /* Interface numbers are hardcoded in the specification */
1051         data->isoc = usb_ifnum_to_if(data->udev, 1);
1052
1053         if (!reset)
1054                 set_bit(HCI_QUIRK_NO_RESET, &hdev->quirks);
1055
1056         if (force_scofix || id->driver_info & BTUSB_WRONG_SCO_MTU) {
1057                 if (!disable_scofix)
1058                         set_bit(HCI_QUIRK_FIXUP_BUFFER_SIZE, &hdev->quirks);
1059         }
1060
1061         if (id->driver_info & BTUSB_BROKEN_ISOC)
1062                 data->isoc = NULL;
1063
1064         if (id->driver_info & BTUSB_DIGIANSWER) {
1065                 data->cmdreq_type = USB_TYPE_VENDOR;
1066                 set_bit(HCI_QUIRK_NO_RESET, &hdev->quirks);
1067         }
1068
1069         if (id->driver_info & BTUSB_CSR) {
1070                 struct usb_device *udev = data->udev;
1071
1072                 /* Old firmware would otherwise execute USB reset */
1073                 if (le16_to_cpu(udev->descriptor.bcdDevice) < 0x117)
1074                         set_bit(HCI_QUIRK_NO_RESET, &hdev->quirks);
1075         }
1076
1077         if (id->driver_info & BTUSB_SNIFFER) {
1078                 struct usb_device *udev = data->udev;
1079
1080                 /* New sniffer firmware has crippled HCI interface */
1081                 if (le16_to_cpu(udev->descriptor.bcdDevice) > 0x997)
1082                         set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks);
1083
1084                 data->isoc = NULL;
1085         }
1086
1087         if (id->driver_info & BTUSB_BCM92035) {
1088                 unsigned char cmd[] = { 0x3b, 0xfc, 0x01, 0x00 };
1089                 struct sk_buff *skb;
1090
1091                 skb = bt_skb_alloc(sizeof(cmd), GFP_KERNEL);
1092                 if (skb) {
1093                         memcpy(skb_put(skb, sizeof(cmd)), cmd, sizeof(cmd));
1094                         skb_queue_tail(&hdev->driver_init, skb);
1095                 }
1096         }
1097
1098         if (data->isoc) {
1099                 err = usb_driver_claim_interface(&btusb_driver,
1100                                                         data->isoc, data);
1101                 if (err < 0) {
1102                         hci_free_dev(hdev);
1103                         kfree(data);
1104                         return err;
1105                 }
1106         }
1107
1108         err = hci_register_dev(hdev);
1109         if (err < 0) {
1110                 hci_free_dev(hdev);
1111                 kfree(data);
1112                 return err;
1113         }
1114
1115         usb_set_intfdata(intf, data);
1116
1117         return 0;
1118 }
1119
1120 static void btusb_disconnect(struct usb_interface *intf)
1121 {
1122         struct btusb_data *data = usb_get_intfdata(intf);
1123         struct hci_dev *hdev;
1124
1125         BT_DBG("intf %p", intf);
1126
1127         if (!data)
1128                 return;
1129
1130         hdev = data->hdev;
1131
1132         __hci_dev_hold(hdev);
1133
1134         usb_set_intfdata(data->intf, NULL);
1135
1136         if (data->isoc)
1137                 usb_set_intfdata(data->isoc, NULL);
1138
1139         hci_unregister_dev(hdev);
1140
1141         if (intf == data->isoc)
1142                 usb_driver_release_interface(&btusb_driver, data->intf);
1143         else if (data->isoc)
1144                 usb_driver_release_interface(&btusb_driver, data->isoc);
1145
1146         __hci_dev_put(hdev);
1147
1148         hci_free_dev(hdev);
1149 }
1150
1151 #ifdef CONFIG_PM
1152 static int btusb_suspend(struct usb_interface *intf, pm_message_t message)
1153 {
1154         struct btusb_data *data = usb_get_intfdata(intf);
1155
1156         BT_DBG("intf %p", intf);
1157
1158         if (data->suspend_count++)
1159                 return 0;
1160
1161         spin_lock_irq(&data->txlock);
1162         if (!(PMSG_IS_AUTO(message) && data->tx_in_flight)) {
1163                 set_bit(BTUSB_SUSPENDING, &data->flags);
1164                 spin_unlock_irq(&data->txlock);
1165         } else {
1166                 spin_unlock_irq(&data->txlock);
1167                 data->suspend_count--;
1168                 return -EBUSY;
1169         }
1170
1171         cancel_work_sync(&data->work);
1172
1173         btusb_stop_traffic(data);
1174         usb_kill_anchored_urbs(&data->tx_anchor);
1175
1176         return 0;
1177 }
1178
1179 static void play_deferred(struct btusb_data *data)
1180 {
1181         struct urb *urb;
1182         int err;
1183
1184         while ((urb = usb_get_from_anchor(&data->deferred))) {
1185                 err = usb_submit_urb(urb, GFP_ATOMIC);
1186                 if (err < 0)
1187                         break;
1188
1189                 data->tx_in_flight++;
1190         }
1191         usb_scuttle_anchored_urbs(&data->deferred);
1192 }
1193
1194 static int btusb_resume(struct usb_interface *intf)
1195 {
1196         struct btusb_data *data = usb_get_intfdata(intf);
1197         struct hci_dev *hdev = data->hdev;
1198         int err = 0;
1199
1200         BT_DBG("intf %p", intf);
1201
1202         if (--data->suspend_count)
1203                 return 0;
1204
1205         if (!test_bit(HCI_RUNNING, &hdev->flags))
1206                 goto done;
1207
1208         if (test_bit(BTUSB_INTR_RUNNING, &data->flags)) {
1209                 err = btusb_submit_intr_urb(hdev, GFP_NOIO);
1210                 if (err < 0) {
1211                         clear_bit(BTUSB_INTR_RUNNING, &data->flags);
1212                         goto failed;
1213                 }
1214         }
1215
1216         if (test_bit(BTUSB_BULK_RUNNING, &data->flags)) {
1217                 err = btusb_submit_bulk_urb(hdev, GFP_NOIO);
1218                 if (err < 0) {
1219                         clear_bit(BTUSB_BULK_RUNNING, &data->flags);
1220                         goto failed;
1221                 }
1222
1223                 btusb_submit_bulk_urb(hdev, GFP_NOIO);
1224         }
1225
1226         if (test_bit(BTUSB_ISOC_RUNNING, &data->flags)) {
1227                 if (btusb_submit_isoc_urb(hdev, GFP_NOIO) < 0)
1228                         clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
1229                 else
1230                         btusb_submit_isoc_urb(hdev, GFP_NOIO);
1231         }
1232
1233         spin_lock_irq(&data->txlock);
1234         play_deferred(data);
1235         clear_bit(BTUSB_SUSPENDING, &data->flags);
1236         spin_unlock_irq(&data->txlock);
1237         schedule_work(&data->work);
1238
1239         return 0;
1240
1241 failed:
1242         usb_scuttle_anchored_urbs(&data->deferred);
1243 done:
1244         spin_lock_irq(&data->txlock);
1245         clear_bit(BTUSB_SUSPENDING, &data->flags);
1246         spin_unlock_irq(&data->txlock);
1247
1248         return err;
1249 }
1250 #endif
1251
1252 static struct usb_driver btusb_driver = {
1253         .name           = "btusb",
1254         .probe          = btusb_probe,
1255         .disconnect     = btusb_disconnect,
1256 #ifdef CONFIG_PM
1257         .suspend        = btusb_suspend,
1258         .resume         = btusb_resume,
1259 #endif
1260         .id_table       = btusb_table,
1261         .supports_autosuspend = 1,
1262 };
1263
1264 static int __init btusb_init(void)
1265 {
1266         BT_INFO("Generic Bluetooth USB driver ver %s", VERSION);
1267
1268         return usb_register(&btusb_driver);
1269 }
1270
1271 static void __exit btusb_exit(void)
1272 {
1273         usb_deregister(&btusb_driver);
1274 }
1275
1276 module_init(btusb_init);
1277 module_exit(btusb_exit);
1278
1279 module_param(ignore_dga, bool, 0644);
1280 MODULE_PARM_DESC(ignore_dga, "Ignore devices with id 08fd:0001");
1281
1282 module_param(ignore_csr, bool, 0644);
1283 MODULE_PARM_DESC(ignore_csr, "Ignore devices with id 0a12:0001");
1284
1285 module_param(ignore_sniffer, bool, 0644);
1286 MODULE_PARM_DESC(ignore_sniffer, "Ignore devices with id 0a12:0002");
1287
1288 module_param(disable_scofix, bool, 0644);
1289 MODULE_PARM_DESC(disable_scofix, "Disable fixup of wrong SCO buffer size");
1290
1291 module_param(force_scofix, bool, 0644);
1292 MODULE_PARM_DESC(force_scofix, "Force fixup of wrong SCO buffers size");
1293
1294 module_param(reset, bool, 0644);
1295 MODULE_PARM_DESC(reset, "Send HCI reset command on initialization");
1296
1297 MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>");
1298 MODULE_DESCRIPTION("Generic Bluetooth USB driver ver " VERSION);
1299 MODULE_VERSION(VERSION);
1300 MODULE_LICENSE("GPL");