diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2015-04-06 01:52:11 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2015-04-07 12:47:11 -0400 |
commit | 1df1f5910825821ebac5eb1a74da2af8fdcaebf3 (patch) | |
tree | 14f1461a25ab621e422041ac2ddf2a909ac04429 /drivers/bluetooth | |
parent | 4fba30f07f51617438835f75b58e37fb610b2d8d (diff) |
Bluetooth: btusb: Use generic functionality by Broadcom module
The new Broadcom Bluetooth support module provides generic functionality
for changing and checking the Bluetooth device address. Use these new
features instead of keeping a duplicate in the driver.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r-- | drivers/bluetooth/Kconfig | 1 | ||||
-rw-r--r-- | drivers/bluetooth/btusb.c | 62 |
2 files changed, 5 insertions, 58 deletions
diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig index 4fbe067cd33a..b593e5f766df 100644 --- a/drivers/bluetooth/Kconfig +++ b/drivers/bluetooth/Kconfig | |||
@@ -8,6 +8,7 @@ config BT_BCM | |||
8 | config BT_HCIBTUSB | 8 | config BT_HCIBTUSB |
9 | tristate "HCI USB driver" | 9 | tristate "HCI USB driver" |
10 | depends on USB | 10 | depends on USB |
11 | select BT_BCM | ||
11 | help | 12 | help |
12 | Bluetooth HCI USB driver. | 13 | Bluetooth HCI USB driver. |
13 | This driver is required if you want to use Bluetooth devices with | 14 | This driver is required if you want to use Bluetooth devices with |
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 6e4ff16e487b..08561ad7a638 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
@@ -29,6 +29,8 @@ | |||
29 | #include <net/bluetooth/bluetooth.h> | 29 | #include <net/bluetooth/bluetooth.h> |
30 | #include <net/bluetooth/hci_core.h> | 30 | #include <net/bluetooth/hci_core.h> |
31 | 31 | ||
32 | #include "btbcm.h" | ||
33 | |||
32 | #define VERSION "0.7" | 34 | #define VERSION "0.7" |
33 | 35 | ||
34 | static bool disable_scofix; | 36 | static bool disable_scofix; |
@@ -2418,8 +2420,6 @@ static const struct { | |||
2418 | { } | 2420 | { } |
2419 | }; | 2421 | }; |
2420 | 2422 | ||
2421 | #define BDADDR_BCM20702A0 (&(bdaddr_t) {{0x00, 0xa0, 0x02, 0x70, 0x20, 0x00}}) | ||
2422 | |||
2423 | static int btusb_setup_bcm_patchram(struct hci_dev *hdev) | 2423 | static int btusb_setup_bcm_patchram(struct hci_dev *hdev) |
2424 | { | 2424 | { |
2425 | struct btusb_data *data = hci_get_drvdata(hdev); | 2425 | struct btusb_data *data = hci_get_drvdata(hdev); |
@@ -2434,7 +2434,6 @@ static int btusb_setup_bcm_patchram(struct hci_dev *hdev) | |||
2434 | const char *hw_name = NULL; | 2434 | const char *hw_name = NULL; |
2435 | struct sk_buff *skb; | 2435 | struct sk_buff *skb; |
2436 | struct hci_rp_read_local_version *ver; | 2436 | struct hci_rp_read_local_version *ver; |
2437 | struct hci_rp_read_bd_addr *bda; | ||
2438 | long ret; | 2437 | long ret; |
2439 | int i; | 2438 | int i; |
2440 | 2439 | ||
@@ -2572,43 +2571,7 @@ reset_fw: | |||
2572 | hw_name ? : "BCM", (subver & 0x7000) >> 13, | 2571 | hw_name ? : "BCM", (subver & 0x7000) >> 13, |
2573 | (subver & 0x1f00) >> 8, (subver & 0x00ff), rev & 0x0fff); | 2572 | (subver & 0x1f00) >> 8, (subver & 0x00ff), rev & 0x0fff); |
2574 | 2573 | ||
2575 | /* Read BD Address */ | 2574 | btbcm_check_bdaddr(hdev); |
2576 | skb = __hci_cmd_sync(hdev, HCI_OP_READ_BD_ADDR, 0, NULL, | ||
2577 | HCI_INIT_TIMEOUT); | ||
2578 | if (IS_ERR(skb)) { | ||
2579 | ret = PTR_ERR(skb); | ||
2580 | BT_ERR("%s: HCI_OP_READ_BD_ADDR failed (%ld)", | ||
2581 | hdev->name, ret); | ||
2582 | goto done; | ||
2583 | } | ||
2584 | |||
2585 | if (skb->len != sizeof(*bda)) { | ||
2586 | BT_ERR("%s: HCI_OP_READ_BD_ADDR event length mismatch", | ||
2587 | hdev->name); | ||
2588 | kfree_skb(skb); | ||
2589 | ret = -EIO; | ||
2590 | goto done; | ||
2591 | } | ||
2592 | |||
2593 | bda = (struct hci_rp_read_bd_addr *)skb->data; | ||
2594 | if (bda->status) { | ||
2595 | BT_ERR("%s: HCI_OP_READ_BD_ADDR error status (%02x)", | ||
2596 | hdev->name, bda->status); | ||
2597 | kfree_skb(skb); | ||
2598 | ret = -bt_to_errno(bda->status); | ||
2599 | goto done; | ||
2600 | } | ||
2601 | |||
2602 | /* The address 00:20:70:02:A0:00 indicates a BCM20702A0 controller | ||
2603 | * with no configured address. | ||
2604 | */ | ||
2605 | if (!bacmp(&bda->bdaddr, BDADDR_BCM20702A0)) { | ||
2606 | BT_INFO("%s: BCM: using default device address (%pMR)", | ||
2607 | hdev->name, &bda->bdaddr); | ||
2608 | set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks); | ||
2609 | } | ||
2610 | |||
2611 | kfree_skb(skb); | ||
2612 | 2575 | ||
2613 | done: | 2576 | done: |
2614 | release_firmware(fw); | 2577 | release_firmware(fw); |
@@ -2616,23 +2579,6 @@ done: | |||
2616 | return ret; | 2579 | return ret; |
2617 | } | 2580 | } |
2618 | 2581 | ||
2619 | static int btusb_set_bdaddr_bcm(struct hci_dev *hdev, const bdaddr_t *bdaddr) | ||
2620 | { | ||
2621 | struct sk_buff *skb; | ||
2622 | long ret; | ||
2623 | |||
2624 | skb = __hci_cmd_sync(hdev, 0xfc01, 6, bdaddr, HCI_INIT_TIMEOUT); | ||
2625 | if (IS_ERR(skb)) { | ||
2626 | ret = PTR_ERR(skb); | ||
2627 | BT_ERR("%s: BCM: Change address command failed (%ld)", | ||
2628 | hdev->name, ret); | ||
2629 | return ret; | ||
2630 | } | ||
2631 | kfree_skb(skb); | ||
2632 | |||
2633 | return 0; | ||
2634 | } | ||
2635 | |||
2636 | static int btusb_setup_bcm_apple(struct hci_dev *hdev) | 2582 | static int btusb_setup_bcm_apple(struct hci_dev *hdev) |
2637 | { | 2583 | { |
2638 | struct sk_buff *skb; | 2584 | struct sk_buff *skb; |
@@ -3056,7 +3002,7 @@ static int btusb_probe(struct usb_interface *intf, | |||
3056 | 3002 | ||
3057 | if (id->driver_info & BTUSB_BCM_PATCHRAM) { | 3003 | if (id->driver_info & BTUSB_BCM_PATCHRAM) { |
3058 | hdev->setup = btusb_setup_bcm_patchram; | 3004 | hdev->setup = btusb_setup_bcm_patchram; |
3059 | hdev->set_bdaddr = btusb_set_bdaddr_bcm; | 3005 | hdev->set_bdaddr = btbcm_set_bdaddr; |
3060 | set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks); | 3006 | set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks); |
3061 | } | 3007 | } |
3062 | 3008 | ||