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