aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bluetooth
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2015-03-02 14:47:12 -0500
committerDavid S. Miller <davem@davemloft.net>2015-03-02 14:47:12 -0500
commit70c836a4d15f12aa50195937083b30a6945c2556 (patch)
treef76867215487fd7626acae395b412056eb8fde74 /drivers/bluetooth
parentb4844353c0577bef6db54e5b276ede1acbed5b3d (diff)
parentc91799c50a14137ecee6d60d2f1d9ab8bc895e52 (diff)
Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next
Johan Hedberg says: ==================== pull request: bluetooth-next 2015-03-02 Here's the first bluetooth-next pull request targeting the 4.1 kernel: - ieee802154/6lowpan cleanups - SCO routing to host interface support for the btmrvl driver - AMP code cleanups - Fixes to AMP HCI init sequence - Refactoring of the HCI callback mechanism - Added shutdown routine for Intel controllers in the btusb driver - New config option to enable/disable Bluetooth debugfs information - Fix for early data reception on L2CAP fixed channels Please let me know if there are any issues pulling. Thanks. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r--drivers/bluetooth/ath3k.c1
-rw-r--r--drivers/bluetooth/btmrvl_drv.h1
-rw-r--r--drivers/bluetooth/btmrvl_main.c14
-rw-r--r--drivers/bluetooth/btusb.c120
4 files changed, 98 insertions, 38 deletions
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index de4c8499cbac..288547a3c566 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -65,6 +65,7 @@ static const struct usb_device_id ath3k_table[] = {
65 /* Atheros AR3011 with sflash firmware*/ 65 /* Atheros AR3011 with sflash firmware*/
66 { USB_DEVICE(0x0489, 0xE027) }, 66 { USB_DEVICE(0x0489, 0xE027) },
67 { USB_DEVICE(0x0489, 0xE03D) }, 67 { USB_DEVICE(0x0489, 0xE03D) },
68 { USB_DEVICE(0x04F2, 0xAFF1) },
68 { USB_DEVICE(0x0930, 0x0215) }, 69 { USB_DEVICE(0x0930, 0x0215) },
69 { USB_DEVICE(0x0CF3, 0x3002) }, 70 { USB_DEVICE(0x0CF3, 0x3002) },
70 { USB_DEVICE(0x0CF3, 0xE019) }, 71 { USB_DEVICE(0x0CF3, 0xE019) },
diff --git a/drivers/bluetooth/btmrvl_drv.h b/drivers/bluetooth/btmrvl_drv.h
index e75f8ee2512c..086f0ec89580 100644
--- a/drivers/bluetooth/btmrvl_drv.h
+++ b/drivers/bluetooth/btmrvl_drv.h
@@ -111,6 +111,7 @@ struct btmrvl_private {
111 111
112/* Vendor specific Bluetooth commands */ 112/* Vendor specific Bluetooth commands */
113#define BT_CMD_PSCAN_WIN_REPORT_ENABLE 0xFC03 113#define BT_CMD_PSCAN_WIN_REPORT_ENABLE 0xFC03
114#define BT_CMD_ROUTE_SCO_TO_HOST 0xFC1D
114#define BT_CMD_SET_BDADDR 0xFC22 115#define BT_CMD_SET_BDADDR 0xFC22
115#define BT_CMD_AUTO_SLEEP_MODE 0xFC23 116#define BT_CMD_AUTO_SLEEP_MODE 0xFC23
116#define BT_CMD_HOST_SLEEP_CONFIG 0xFC59 117#define BT_CMD_HOST_SLEEP_CONFIG 0xFC59
diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c
index 413597789c61..de05deb444ce 100644
--- a/drivers/bluetooth/btmrvl_main.c
+++ b/drivers/bluetooth/btmrvl_main.c
@@ -230,6 +230,18 @@ int btmrvl_send_module_cfg_cmd(struct btmrvl_private *priv, u8 subcmd)
230} 230}
231EXPORT_SYMBOL_GPL(btmrvl_send_module_cfg_cmd); 231EXPORT_SYMBOL_GPL(btmrvl_send_module_cfg_cmd);
232 232
233static int btmrvl_enable_sco_routing_to_host(struct btmrvl_private *priv)
234{
235 int ret;
236 u8 subcmd = 0;
237
238 ret = btmrvl_send_sync_cmd(priv, BT_CMD_ROUTE_SCO_TO_HOST, &subcmd, 1);
239 if (ret)
240 BT_ERR("BT_CMD_ROUTE_SCO_TO_HOST command failed: %#x", ret);
241
242 return ret;
243}
244
233int btmrvl_pscan_window_reporting(struct btmrvl_private *priv, u8 subcmd) 245int btmrvl_pscan_window_reporting(struct btmrvl_private *priv, u8 subcmd)
234{ 246{
235 struct btmrvl_sdio_card *card = priv->btmrvl_dev.card; 247 struct btmrvl_sdio_card *card = priv->btmrvl_dev.card;
@@ -558,6 +570,8 @@ static int btmrvl_setup(struct hci_dev *hdev)
558 570
559 btmrvl_check_device_tree(priv); 571 btmrvl_check_device_tree(priv);
560 572
573 btmrvl_enable_sco_routing_to_host(priv);
574
561 btmrvl_pscan_window_reporting(priv, 0x01); 575 btmrvl_pscan_window_reporting(priv, 0x01);
562 576
563 priv->btmrvl_dev.psmode = 1; 577 priv->btmrvl_dev.psmode = 1;
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index b87688881143..3ca2e1bf7bfa 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -159,6 +159,7 @@ static const struct usb_device_id blacklist_table[] = {
159 /* Atheros 3011 with sflash firmware */ 159 /* Atheros 3011 with sflash firmware */
160 { USB_DEVICE(0x0489, 0xe027), .driver_info = BTUSB_IGNORE }, 160 { USB_DEVICE(0x0489, 0xe027), .driver_info = BTUSB_IGNORE },
161 { USB_DEVICE(0x0489, 0xe03d), .driver_info = BTUSB_IGNORE }, 161 { USB_DEVICE(0x0489, 0xe03d), .driver_info = BTUSB_IGNORE },
162 { USB_DEVICE(0x04f2, 0xaff1), .driver_info = BTUSB_IGNORE },
162 { USB_DEVICE(0x0930, 0x0215), .driver_info = BTUSB_IGNORE }, 163 { USB_DEVICE(0x0930, 0x0215), .driver_info = BTUSB_IGNORE },
163 { USB_DEVICE(0x0cf3, 0x3002), .driver_info = BTUSB_IGNORE }, 164 { USB_DEVICE(0x0cf3, 0x3002), .driver_info = BTUSB_IGNORE },
164 { USB_DEVICE(0x0cf3, 0xe019), .driver_info = BTUSB_IGNORE }, 165 { USB_DEVICE(0x0cf3, 0xe019), .driver_info = BTUSB_IGNORE },
@@ -338,16 +339,6 @@ struct btusb_data {
338 int (*recv_bulk)(struct btusb_data *data, void *buffer, int count); 339 int (*recv_bulk)(struct btusb_data *data, void *buffer, int count);
339}; 340};
340 341
341static int btusb_wait_on_bit_timeout(void *word, int bit, unsigned long timeout,
342 unsigned mode)
343{
344 might_sleep();
345 if (!test_bit(bit, word))
346 return 0;
347 return out_of_line_wait_on_bit_timeout(word, bit, bit_wait_timeout,
348 mode, timeout);
349}
350
351static inline void btusb_free_frags(struct btusb_data *data) 342static inline void btusb_free_frags(struct btusb_data *data)
352{ 343{
353 unsigned long flags; 344 unsigned long flags;
@@ -2196,9 +2187,9 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
2196 * and thus just timeout if that happens and fail the setup 2187 * and thus just timeout if that happens and fail the setup
2197 * of this device. 2188 * of this device.
2198 */ 2189 */
2199 err = btusb_wait_on_bit_timeout(&data->flags, BTUSB_DOWNLOADING, 2190 err = wait_on_bit_timeout(&data->flags, BTUSB_DOWNLOADING,
2200 msecs_to_jiffies(5000), 2191 TASK_INTERRUPTIBLE,
2201 TASK_INTERRUPTIBLE); 2192 msecs_to_jiffies(5000));
2202 if (err == 1) { 2193 if (err == 1) {
2203 BT_ERR("%s: Firmware loading interrupted", hdev->name); 2194 BT_ERR("%s: Firmware loading interrupted", hdev->name);
2204 err = -EINTR; 2195 err = -EINTR;
@@ -2249,9 +2240,9 @@ done:
2249 */ 2240 */
2250 BT_INFO("%s: Waiting for device to boot", hdev->name); 2241 BT_INFO("%s: Waiting for device to boot", hdev->name);
2251 2242
2252 err = btusb_wait_on_bit_timeout(&data->flags, BTUSB_BOOTING, 2243 err = wait_on_bit_timeout(&data->flags, BTUSB_BOOTING,
2253 msecs_to_jiffies(1000), 2244 TASK_INTERRUPTIBLE,
2254 TASK_INTERRUPTIBLE); 2245 msecs_to_jiffies(1000));
2255 2246
2256 if (err == 1) { 2247 if (err == 1) {
2257 BT_ERR("%s: Device boot interrupted", hdev->name); 2248 BT_ERR("%s: Device boot interrupted", hdev->name);
@@ -2331,6 +2322,27 @@ static int btusb_set_bdaddr_intel(struct hci_dev *hdev, const bdaddr_t *bdaddr)
2331 return 0; 2322 return 0;
2332} 2323}
2333 2324
2325static int btusb_shutdown_intel(struct hci_dev *hdev)
2326{
2327 struct sk_buff *skb;
2328 long ret;
2329
2330 /* Some platforms have an issue with BT LED when the interface is
2331 * down or BT radio is turned off, which takes 5 seconds to BT LED
2332 * goes off. This command turns off the BT LED immediately.
2333 */
2334 skb = __hci_cmd_sync(hdev, 0xfc3f, 0, NULL, HCI_INIT_TIMEOUT);
2335 if (IS_ERR(skb)) {
2336 ret = PTR_ERR(skb);
2337 BT_ERR("%s: turning off Intel device LED failed (%ld)",
2338 hdev->name, ret);
2339 return ret;
2340 }
2341 kfree_skb(skb);
2342
2343 return 0;
2344}
2345
2334static int btusb_set_bdaddr_marvell(struct hci_dev *hdev, 2346static int btusb_set_bdaddr_marvell(struct hci_dev *hdev,
2335 const bdaddr_t *bdaddr) 2347 const bdaddr_t *bdaddr)
2336{ 2348{
@@ -2354,6 +2366,23 @@ static int btusb_set_bdaddr_marvell(struct hci_dev *hdev,
2354 return 0; 2366 return 0;
2355} 2367}
2356 2368
2369static const struct {
2370 u16 subver;
2371 const char *name;
2372} bcm_subver_table[] = {
2373 { 0x210b, "BCM43142A0" }, /* 001.001.011 */
2374 { 0x2112, "BCM4314A0" }, /* 001.001.018 */
2375 { 0x2118, "BCM20702A0" }, /* 001.001.024 */
2376 { 0x2126, "BCM4335A0" }, /* 001.001.038 */
2377 { 0x220e, "BCM20702A1" }, /* 001.002.014 */
2378 { 0x230f, "BCM4354A2" }, /* 001.003.015 */
2379 { 0x4106, "BCM4335B0" }, /* 002.001.006 */
2380 { 0x410e, "BCM20702B0" }, /* 002.001.014 */
2381 { 0x6109, "BCM4335C0" }, /* 003.001.009 */
2382 { 0x610c, "BCM4354" }, /* 003.001.012 */
2383 { }
2384};
2385
2357#define BDADDR_BCM20702A0 (&(bdaddr_t) {{0x00, 0xa0, 0x02, 0x70, 0x20, 0x00}}) 2386#define BDADDR_BCM20702A0 (&(bdaddr_t) {{0x00, 0xa0, 0x02, 0x70, 0x20, 0x00}})
2358 2387
2359static int btusb_setup_bcm_patchram(struct hci_dev *hdev) 2388static int btusb_setup_bcm_patchram(struct hci_dev *hdev)
@@ -2366,29 +2395,20 @@ static int btusb_setup_bcm_patchram(struct hci_dev *hdev)
2366 size_t fw_size; 2395 size_t fw_size;
2367 const struct hci_command_hdr *cmd; 2396 const struct hci_command_hdr *cmd;
2368 const u8 *cmd_param; 2397 const u8 *cmd_param;
2369 u16 opcode; 2398 u16 opcode, subver, rev;
2399 const char *hw_name = NULL;
2370 struct sk_buff *skb; 2400 struct sk_buff *skb;
2371 struct hci_rp_read_local_version *ver; 2401 struct hci_rp_read_local_version *ver;
2372 struct hci_rp_read_bd_addr *bda; 2402 struct hci_rp_read_bd_addr *bda;
2373 long ret; 2403 long ret;
2374 2404 int i;
2375 snprintf(fw_name, sizeof(fw_name), "brcm/%s-%04x-%04x.hcd",
2376 udev->product ? udev->product : "BCM",
2377 le16_to_cpu(udev->descriptor.idVendor),
2378 le16_to_cpu(udev->descriptor.idProduct));
2379
2380 ret = request_firmware(&fw, fw_name, &hdev->dev);
2381 if (ret < 0) {
2382 BT_INFO("%s: BCM: patch %s not found", hdev->name, fw_name);
2383 return 0;
2384 }
2385 2405
2386 /* Reset */ 2406 /* Reset */
2387 skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT); 2407 skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);
2388 if (IS_ERR(skb)) { 2408 if (IS_ERR(skb)) {
2389 ret = PTR_ERR(skb); 2409 ret = PTR_ERR(skb);
2390 BT_ERR("%s: HCI_OP_RESET failed (%ld)", hdev->name, ret); 2410 BT_ERR("%s: HCI_OP_RESET failed (%ld)", hdev->name, ret);
2391 goto done; 2411 return ret;
2392 } 2412 }
2393 kfree_skb(skb); 2413 kfree_skb(skb);
2394 2414
@@ -2399,23 +2419,43 @@ static int btusb_setup_bcm_patchram(struct hci_dev *hdev)
2399 ret = PTR_ERR(skb); 2419 ret = PTR_ERR(skb);
2400 BT_ERR("%s: HCI_OP_READ_LOCAL_VERSION failed (%ld)", 2420 BT_ERR("%s: HCI_OP_READ_LOCAL_VERSION failed (%ld)",
2401 hdev->name, ret); 2421 hdev->name, ret);
2402 goto done; 2422 return ret;
2403 } 2423 }
2404 2424
2405 if (skb->len != sizeof(*ver)) { 2425 if (skb->len != sizeof(*ver)) {
2406 BT_ERR("%s: HCI_OP_READ_LOCAL_VERSION event length mismatch", 2426 BT_ERR("%s: HCI_OP_READ_LOCAL_VERSION event length mismatch",
2407 hdev->name); 2427 hdev->name);
2408 kfree_skb(skb); 2428 kfree_skb(skb);
2409 ret = -EIO; 2429 return -EIO;
2410 goto done;
2411 } 2430 }
2412 2431
2413 ver = (struct hci_rp_read_local_version *)skb->data; 2432 ver = (struct hci_rp_read_local_version *)skb->data;
2414 BT_INFO("%s: BCM: patching hci_ver=%02x hci_rev=%04x lmp_ver=%02x " 2433 rev = le16_to_cpu(ver->hci_rev);
2415 "lmp_subver=%04x", hdev->name, ver->hci_ver, ver->hci_rev, 2434 subver = le16_to_cpu(ver->lmp_subver);
2416 ver->lmp_ver, ver->lmp_subver);
2417 kfree_skb(skb); 2435 kfree_skb(skb);
2418 2436
2437 for (i = 0; bcm_subver_table[i].name; i++) {
2438 if (subver == bcm_subver_table[i].subver) {
2439 hw_name = bcm_subver_table[i].name;
2440 break;
2441 }
2442 }
2443
2444 BT_INFO("%s: %s (%3.3u.%3.3u.%3.3u) build %4.4u", hdev->name,
2445 hw_name ? : "BCM", (subver & 0x7000) >> 13,
2446 (subver & 0x1f00) >> 8, (subver & 0x00ff), rev & 0x0fff);
2447
2448 snprintf(fw_name, sizeof(fw_name), "brcm/%s-%4.4x-%4.4x.hcd",
2449 hw_name ? : "BCM",
2450 le16_to_cpu(udev->descriptor.idVendor),
2451 le16_to_cpu(udev->descriptor.idProduct));
2452
2453 ret = request_firmware(&fw, fw_name, &hdev->dev);
2454 if (ret < 0) {
2455 BT_INFO("%s: BCM: patch %s not found", hdev->name, fw_name);
2456 return 0;
2457 }
2458
2419 /* Start Download */ 2459 /* Start Download */
2420 skb = __hci_cmd_sync(hdev, 0xfc2e, 0, NULL, HCI_INIT_TIMEOUT); 2460 skb = __hci_cmd_sync(hdev, 0xfc2e, 0, NULL, HCI_INIT_TIMEOUT);
2421 if (IS_ERR(skb)) { 2461 if (IS_ERR(skb)) {
@@ -2493,11 +2533,14 @@ reset_fw:
2493 } 2533 }
2494 2534
2495 ver = (struct hci_rp_read_local_version *)skb->data; 2535 ver = (struct hci_rp_read_local_version *)skb->data;
2496 BT_INFO("%s: BCM: firmware hci_ver=%02x hci_rev=%04x lmp_ver=%02x " 2536 rev = le16_to_cpu(ver->hci_rev);
2497 "lmp_subver=%04x", hdev->name, ver->hci_ver, ver->hci_rev, 2537 subver = le16_to_cpu(ver->lmp_subver);
2498 ver->lmp_ver, ver->lmp_subver);
2499 kfree_skb(skb); 2538 kfree_skb(skb);
2500 2539
2540 BT_INFO("%s: %s (%3.3u.%3.3u.%3.3u) build %4.4u", hdev->name,
2541 hw_name ? : "BCM", (subver & 0x7000) >> 13,
2542 (subver & 0x1f00) >> 8, (subver & 0x00ff), rev & 0x0fff);
2543
2501 /* Read BD Address */ 2544 /* Read BD Address */
2502 skb = __hci_cmd_sync(hdev, HCI_OP_READ_BD_ADDR, 0, NULL, 2545 skb = __hci_cmd_sync(hdev, HCI_OP_READ_BD_ADDR, 0, NULL,
2503 HCI_INIT_TIMEOUT); 2546 HCI_INIT_TIMEOUT);
@@ -2708,6 +2751,7 @@ static int btusb_probe(struct usb_interface *intf,
2708 2751
2709 if (id->driver_info & BTUSB_INTEL) { 2752 if (id->driver_info & BTUSB_INTEL) {
2710 hdev->setup = btusb_setup_intel; 2753 hdev->setup = btusb_setup_intel;
2754 hdev->shutdown = btusb_shutdown_intel;
2711 hdev->set_bdaddr = btusb_set_bdaddr_intel; 2755 hdev->set_bdaddr = btusb_set_bdaddr_intel;
2712 set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks); 2756 set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks);
2713 } 2757 }