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